mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
This patch changes both the Input::Session interface and the skeleton
for the server-side implementation of this interface
('input/component.h').
The Input::Session interface offers a new 'sigh' function, which can be
called be the client to register a signal handler. The signal handler
gets notified on the arrival of new input. This alleviates the need to
poll for input events at the client side.
The server-side skeleton for implementing input services underwent a
redesign to make it more modular and robust. I.e., there are no
global functions needed at the server side and the event-queue
enable/disable mechanism is implemented at a central place (in the root
component) rather than inside each driver.
Fixes #46
75 lines
1.8 KiB
C++
75 lines
1.8 KiB
C++
/*
|
|
* \brief Control bar
|
|
* \author Christian Prochaska
|
|
* \date 2012-03-30
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2012-2013 Genode Labs GmbH
|
|
*
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
* under the terms of the GNU General Public License version 2.
|
|
*/
|
|
|
|
/* Genode includes */
|
|
#include <input/keycodes.h>
|
|
|
|
/* Qoost includes */
|
|
#include <qoost/style.h>
|
|
|
|
/* local includes */
|
|
#include "main_window.h"
|
|
|
|
|
|
void Control_bar::_rewind()
|
|
{
|
|
/* mouse click at horizontal position 0 */
|
|
_event_queue.add(Input::Event(Input::Event::PRESS, Input::BTN_LEFT, 0, 0, 0, 0));
|
|
_event_queue.add(Input::Event(Input::Event::RELEASE, Input::BTN_LEFT, 0, 0, 0, 0));
|
|
}
|
|
|
|
|
|
void Control_bar::_pause_resume()
|
|
{
|
|
_event_queue.add(Input::Event(Input::Event::PRESS, Input::KEY_SPACE, 0, 0, 0, 0));
|
|
_event_queue.add(Input::Event(Input::Event::RELEASE, Input::KEY_SPACE, 0, 0, 0, 0));
|
|
|
|
_playing = !_playing;
|
|
if (_playing)
|
|
update_style_id(_play_pause_button, "play");
|
|
else
|
|
update_style_id(_play_pause_button, "pause");
|
|
}
|
|
|
|
|
|
void Control_bar::_stop()
|
|
{
|
|
if (_playing)
|
|
_pause_resume();
|
|
|
|
_rewind();
|
|
}
|
|
|
|
|
|
Control_bar::Control_bar(Input::Event_queue &event_queue)
|
|
:
|
|
_event_queue(event_queue), _playing(true)
|
|
{
|
|
update_style_id(_play_pause_button, "play");
|
|
|
|
_volume_slider->setOrientation(Qt::Horizontal);
|
|
_volume_slider->setRange(0, 100);
|
|
_volume_slider->setTickInterval(10);
|
|
_volume_slider->setValue(100);
|
|
|
|
_layout->addWidget(_play_pause_button);
|
|
_layout->addWidget(_stop_button);
|
|
_layout->addStretch();
|
|
_layout->addWidget(_volume_label);
|
|
_layout->addWidget(_volume_slider);
|
|
|
|
connect(_play_pause_button, SIGNAL(clicked()), this, SLOT(_pause_resume()));
|
|
connect(_stop_button, SIGNAL(clicked()), this, SLOT(_stop()));
|
|
connect(_volume_slider, SIGNAL(valueChanged(int)), this, SIGNAL(volume_changed(int)));
|
|
}
|