ControlBar::ControlBar(QWidget *parent) : QWidget(parent), isAudioPlaying(false) { this -> playButton = new QToolButton(this); this -> playButton -> setIcon( this -> style() -> standardIcon(QStyle::SP_MediaPlay)); connect(this -> playButton, SIGNAL( clicked() ), this, SLOT(playButtonClicked())); this -> nextButton = new QToolButton(this); this -> nextButton -> setIcon( this -> style() -> standardIcon(QStyle::SP_MediaSkipForward)); connect(this -> nextButton, SIGNAL( clicked() ), this, SIGNAL( nextAudio() ) ); this -> previousButton = new QToolButton(this); this -> previousButton -> setIcon( this -> style() -> standardIcon(QStyle::SP_MediaSkipBackward)); connect(this -> previousButton, SIGNAL( clicked() ), this, SIGNAL( previousAudio() ) ); this -> progressBar = new QSlider(Qt::Horizontal, this); progressBar -> setRange(0,100); QHBoxLayout* buttonBoxLayout = new QHBoxLayout; buttonBoxLayout -> addWidget(progressBar); buttonBoxLayout -> addWidget(playButton); buttonBoxLayout -> addWidget(previousButton); buttonBoxLayout -> addWidget(nextButton); this -> setLayout(buttonBoxLayout); }
/** Constructor */ SoundPage::SoundPage(QWidget * parent, Qt::WFlags flags) : ConfigPage(parent, flags) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); connect(ui.eventTreeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(eventChanged(QTreeWidgetItem*, QTreeWidgetItem*))); connect(ui.filenameEdit, SIGNAL(textChanged(QString)), this, SLOT(filenameChanged(QString))); connect(ui.browseButton, SIGNAL(clicked()), this, SLOT(browseButtonClicked())); connect(ui.playButton, SIGNAL(clicked()), this, SLOT(playButtonClicked())); ui.eventTreeWidget->setColumnCount(COLUMN_COUNT); QTreeWidgetItem *headerItem = ui.eventTreeWidget->headerItem(); headerItem->setText(COLUMN_NAME, tr("Event")); headerItem->setText(COLUMN_FILENAME, tr("Filename")); ui.eventTreeWidget->header()->setResizeMode(QHeaderView::Fixed); ui.eventTreeWidget->setTextElideMode(Qt::ElideMiddle); /* Hide platform specific features */ #ifdef Q_WS_WIN #endif }
void LauncherWindow::keyPressEvent(QKeyEvent *pe) { if (pe->key() == Qt::Key_Return) { playButtonClicked(); } pe->accept(); }
void MusicControler::setupUI() { playAction = new QAction(style()->standardIcon(QStyle::SP_MediaPlay), tr("Play"), this); playAction->setShortcut(tr("Crl+P")); stopAction = new QAction(style()->standardIcon(QStyle::SP_MediaStop), tr("Stop"), this); stopAction->setShortcut(tr("Ctrl+S")); pauseAction = new QAction(style()->standardIcon(QStyle::SP_MediaPause), tr("Pause"), this); connect(playAction, SIGNAL(triggered()), this, SIGNAL(play())); connect(playAction,SIGNAL(triggered()), this, SLOT(playButtonClicked())); connect(stopAction, SIGNAL(triggered()), this, SIGNAL(stop())); connect(pauseAction, SIGNAL(triggered()), this, SIGNAL(pause())); connect(pauseAction, SIGNAL(triggered()), this, SLOT(playButtonClicked())); seeker = new QSlider(Qt::Horizontal); seeker->setRange(0,100); seeker->setValue(0); connect(seeker, SIGNAL(sliderMoved(int)), this, SIGNAL(seeked(int))); this->addAction(playAction); this->addAction(stopAction); this->addWidget(seeker); }
QmlView::QmlView(QUrl source, QWidget *parent, MafwRegistryAdapter *mafwRegistry ) : QMainWindow(parent), ui(new Ui::QmlView), mafwRegistry(mafwRegistry), mafwRenderer(mafwRegistry->renderer()) { ui->setupUi(this); ui->declarativeView->setSource(source); ui->declarativeView->setResizeMode(QDeclarativeView::SizeRootObjectToView); setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_Maemo5StackedWindow); setAttribute(Qt::WA_Maemo5NonComposited); QGLWidget *glWidget = new QGLWidget(this); ui->declarativeView->setViewport(glWidget); positionTimer = new QTimer(this); positionTimer->setInterval(1000); fmtx = new FMTXInterface(this); Rotator *rotator = Rotator::acquire(); savedPolicy = rotator->policy(); rotator->setPolicy(Rotator::Landscape); rootObject = dynamic_cast<QObject*>(ui->declarativeView->rootObject()); rootObject->setParent(this); connect(rootObject, SIGNAL(quitButtonClicked()), this, SLOT(close())); connect(rootObject, SIGNAL(prevButtonClicked()), mafwRenderer, SLOT(previous())); connect(rootObject, SIGNAL(playButtonClicked()), this, SLOT(onPlayClicked())); connect(rootObject, SIGNAL(nextButtonClicked()), mafwRenderer, SLOT(next())); connect(rootObject, SIGNAL(fmtxButtonClicked()), this, SLOT(onFmtxClicked())); connect(rootObject, SIGNAL(sliderValueChanged(int)), this, SLOT(onSliderValueChanged(int))); connect(rootObject, SIGNAL(playlistItemSelected(int)), this, SLOT(onPlaylistItemChanged(int))); connect(this, SIGNAL(titleChanged(QVariant)), rootObject, SLOT(setSongTitle(QVariant))); connect(this, SIGNAL(albumChanged(QVariant)), rootObject, SLOT(setSongAlbum(QVariant))); connect(this, SIGNAL(artistChanged(QVariant)), rootObject, SLOT(setSongArtist(QVariant))); connect(this, SIGNAL(albumArtChanged(QVariant)), rootObject, SLOT(setAlbumArt(QVariant))); connect(this, SIGNAL(durationTextChanged(QVariant)), rootObject, SLOT(setPosition(QVariant))); connect(this, SIGNAL(positionChanged(QVariant)), rootObject, SLOT(setSliderValue(QVariant))); connect(this, SIGNAL(durationChanged(QVariant)), rootObject, SLOT(setSliderMaximum(QVariant))); connect(this, SIGNAL(stateIconChanged(QVariant)), rootObject, SLOT(setPlayButtonIcon(QVariant))); connect(this, SIGNAL(rowChanged(QVariant)), rootObject, SLOT(onRowChanged(QVariant))); connect(this, SIGNAL(fmtxStateChanged(QVariant)), rootObject, SLOT(onFmtxStateChanged(QVariant))); connect(this, SIGNAL(playlistItemAppended(QVariant,QVariant,QVariant)), rootObject, SLOT(appendPlaylistItem(QVariant,QVariant,QVariant))); connect(this, SIGNAL(playlistItemInserted(QVariant,QVariant,QVariant,QVariant)), rootObject, SLOT(insertPlaylistItem(QVariant,QVariant,QVariant,QVariant))); connect(this, SIGNAL(playlistItemSet(QVariant,QVariant,QVariant,QVariant)), rootObject, SLOT(setPlaylistItem(QVariant,QVariant,QVariant,QVariant))); connect(this, SIGNAL(playlistItemRemoved(QVariant)), rootObject, SLOT(removePlaylistItem(QVariant))); connect(this, SIGNAL(playlistCleared()), rootObject, SLOT(clearPlaylist())); connect(mafwRenderer, SIGNAL(stateChanged(MafwPlayState)), this, SLOT(onStateChanged(MafwPlayState))); connect(mafwRenderer, SIGNAL(positionReceived(int,QString)), this, SLOT(onPositionChanged(int))); connect(mafwRenderer, SIGNAL(statusReceived(MafwPlaylist*,uint,MafwPlayState,QString,QString)), this, SLOT(onStatusReceived(MafwPlaylist*,uint,MafwPlayState))); connect(positionTimer, SIGNAL(timeout()), mafwRenderer, SLOT(getPosition())); connect(fmtx, SIGNAL(propertyChanged()), this, SLOT(onFmtxChanged())); onFmtxChanged(); positionTimer->start(); quint32 disable = {0}; Atom winPortraitModeSupportAtom = XInternAtom(QX11Info::display(), "_HILDON_PORTRAIT_MODE_SUPPORT", false); XChangeProperty(QX11Info::display(), winId(), winPortraitModeSupportAtom, XA_CARDINAL, 32, PropModeReplace, (uchar*) &disable, 1); this->setDNDAtom(true); mafwRenderer->getStatus(); mafwRenderer->getPosition(); }