/* * QS60KeyCapture provides media key handling using services from RemCon. */ QS60KeyCapture::QS60KeyCapture(CCoeEnv *env, QObject *parent): QObject(parent), coeEnv(env), selector(0), target(0), handler(0) { initRemCon(); TTimeIntervalMicroSeconds32 initialTime; TTimeIntervalMicroSeconds32 time; coeEnv->WsSession().GetKeyboardRepeatRate(initialTime, time); initialRepeatTime = (initialTime.Int() / 1000); // msecs repeatTime = (time.Int() / 1000); // msecs int clickTimeout = initialRepeatTime + repeatTime; volumeUpClickTimer.setSingleShot(true); volumeDownClickTimer.setSingleShot(true); repeatTimer.setSingleShot(true); volumeUpClickTimer.setInterval(clickTimeout); volumeDownClickTimer.setInterval(clickTimeout); repeatTimer.setInterval(initialRepeatTime); connect(&volumeUpClickTimer, SIGNAL(timeout()), this, SLOT(volumeUpClickTimerExpired())); connect(&volumeDownClickTimer, SIGNAL(timeout()), this, SLOT(volumeDownClickTimerExpired())); connect(&repeatTimer, SIGNAL(timeout()), this, SLOT(repeatTimerExpired())); }
PlayerControls::PlayerControls(QWidget *parent, QMediaPlayer *player) : QWidget(parent) , playerState(QMediaPlayer::StoppedState) , playerMuted(false) , playButton(0) , stopButton(0) , nextButton(0) , previousButton(0) , muteButton(0) , volumeSlider(0) , rateBox(0) { #ifdef Q_OS_SYMBIAN initRemCon(); #endif // Q_OS_SYMBIAN iplayer = player; playButton = new QToolButton(this); playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); connect(playButton, SIGNAL(clicked()), this, SLOT(playClicked())); stopButton = new QToolButton(this); stopButton->setIcon(style()->standardIcon(QStyle::SP_MediaStop)); stopButton->setEnabled(false); connect(stopButton, SIGNAL(clicked()), this, SIGNAL(stop())); nextButton = new QToolButton(this); nextButton->setIcon(style()->standardIcon(QStyle::SP_MediaSkipForward)); connect(nextButton, SIGNAL(clicked()), this, SIGNAL(next())); previousButton = new QToolButton(this); previousButton->setIcon(style()->standardIcon(QStyle::SP_MediaSkipBackward)); connect(previousButton, SIGNAL(clicked()), this, SIGNAL(previous())); muteButton = new QToolButton(this); muteButton->setIcon(style()->standardIcon(QStyle::SP_MediaVolume)); connect(muteButton, SIGNAL(clicked()), this, SLOT(muteClicked())); #ifndef Q_WS_MAEMO_5 volumeSlider = new QSlider(Qt::Horizontal, this); volumeSlider->setRange(0, 100); connect(volumeSlider, SIGNAL(sliderMoved(int)), this, SIGNAL(changeVolume(int))); rateBox = new QComboBox(this); rateBox->addItem("0.5x", QVariant(0.5)); rateBox->addItem("1.0x", QVariant(1.0)); rateBox->addItem("2.0x", QVariant(2.0)); rateBox->setCurrentIndex(1); connect(rateBox, SIGNAL(activated(int)), SLOT(updateRate())); #endif QBoxLayout *layout = new QHBoxLayout; layout->setMargin(0); layout->addWidget(stopButton); layout->addWidget(previousButton); layout->addWidget(playButton); layout->addWidget(nextButton); layout->addWidget(muteButton); if (volumeSlider) layout->addWidget(volumeSlider); if (rateBox) layout->addWidget(rateBox); setLayout(layout); }