void MainWindow::mkconnections() { connect(bar,SIGNAL(closeClicked()),SLOT(close())); connect(bar,SIGNAL(maximizeClicked(bool)),SLOT(showWind(bool))); connect(bar,SIGNAL(hideClicked()),SLOT(showMinimized())); connect(playlists,SIGNAL(songAdded(QString,QString)),&library,SLOT(addSongInPlaylist(QString,QString))); connect(bar,SIGNAL(addFilePressed()),SLOT(addFiles())); connect(bar,SIGNAL(addFolderPressed()),SLOT(addFolder())); connect(&player,SIGNAL(inPlaylist(bool)),SLOT(changePlayerConnections(bool))); connect(&library,SIGNAL(newSong(Song)),table,SLOT(addSongInList(Song))); connect(&player,SIGNAL(positionChanged(qint64)),bar,SIGNAL(seekChanged(qint64))); connect(&player,SIGNAL(currentSongChanged(Song)),bar,SIGNAL(songChanged(Song))); connect(bar,SIGNAL(playClicked()),&player,SLOT(playpause())); connect(addFile,SIGNAL(triggered()),SLOT(addFiles())); connect(actionAddFolder,SIGNAL(triggered()),SLOT(addFolder())); connect(actionOuvrir,SIGNAL(triggered()),SLOT(openFile())); connect(bar,SIGNAL(volumeChanged(int)),&player,SLOT(setVolume(int))); connect(bar,SIGNAL(positionChanged(int)),&player,SLOT(setPosition(int))); connect(bar,SIGNAL(seekBarPressed()),&player,SLOT(pause())); connect(bar,SIGNAL(seekBarReleased()),&player,SLOT(play())); connect(&player,SIGNAL(playbackStateChanged(bool)),bar,SLOT(changeButton(bool))); connect(tree,SIGNAL(albumChosen(QString,QString)),table,SLOT(showSongsFrom(QString,QString))); connect(tree,SIGNAL(artistChosen(QString)),table,SLOT(showSongsBy(QString))); connect(&library,SIGNAL(libraryChanged(Library*)),tree,SLOT(updateTree(Library*))); connect(table,SIGNAL(newPlaylist(Song)),this,SLOT(mkPlaylist(Song))); connect(playlists,SIGNAL(playlistChosen(QString)),table,SLOT(showSongsIn(QString))); connect(table,SIGNAL(deleteSong(Song,bool)),&library,SLOT(deleteSong(Song,bool))); connect(bar,SIGNAL(newQuery(QString,int)),table,SLOT(setQuery(QString,int))); connect(bar,SIGNAL(newPlaybackMode(QMediaPlaylist::PlaybackMode)),&player,SLOT(setPlayBackMode(QMediaPlaylist::PlaybackMode))); connect(table,SIGNAL(songChosen(int)),&player,SLOT(play(int))); connect(table,SIGNAL(newSongList(SongList)),&player,SLOT(update(SongList))); connect(&player,SIGNAL(inPlaylist(bool)),bar,SLOT(enableNavigation(bool))); connect(bar,SIGNAL(miniLecteur()),&mLecteur,SLOT(show())); connect(bar,SIGNAL(miniLecteur()),SLOT(hide())); connect(&mLecteur,SIGNAL(windowedMode()),SLOT(show())); connect(&mLecteur,SIGNAL(positionChanged(int)),bar,SIGNAL(positionChanged(int))); connect(&mLecteur,SIGNAL(seekBarPressed()),bar,SIGNAL(seekBarPressed())); connect(&mLecteur,SIGNAL(seekBarReleased()),bar,SIGNAL(seekBarReleased())); connect(&mLecteur,SIGNAL(positionChanged(int)),bar,SIGNAL(positionChanged(int))); connect(&mLecteur,SIGNAL(playClicked()),bar,SIGNAL(playClicked())); connect(&mLecteur,SIGNAL(nextClicked()),bar,SIGNAL(nextClicked())); connect(&mLecteur,SIGNAL(previousClicked()),bar,SIGNAL(previousClicked())); connect(&mLecteur,SIGNAL(volumeChanged(int)),bar,SIGNAL(volumeChanged(int))); connect(&player,SIGNAL(currentSongChanged(Song)),&mLecteur,SLOT(setNewSong(Song))); connect(&player,SIGNAL(positionChanged(qint64)),&mLecteur,SLOT(setPosition(qint64))); connect(&player,SIGNAL(playbackStateChanged(bool)),&mLecteur,SLOT(changeButton(bool))); connect(&player,SIGNAL(indexChanged(int,int)),table,SLOT(setIconTo(int,int))); connect(table,SIGNAL(addFileTriggered()),SLOT(addFiles())); connect(table,SIGNAL(addFolderTriggered()),SLOT(addFolder())); }
void PlayerController::setView(AbstractPlayerView *view) { if (m_view == view) return; if (m_view) { m_view->disconnect(this); } m_view = view; if (m_view) { connect(m_view, SIGNAL(playClicked()), SLOT(play())); connect(m_view, SIGNAL(pauseClicked()), SLOT(pause())); connect(m_view, SIGNAL(stopClicked()), SLOT(stop())); connect(m_view, SIGNAL(nextClicked()), SLOT(next())); connect(m_view, SIGNAL(previousClicked()), SLOT(previous())); connect(m_view, SIGNAL(shuffleClicked()), SLOT(toggleShuffle())); connect(m_view, SIGNAL(muteClicked()), SLOT(toggleMute())); connect(m_view, SIGNAL(repeatClicked()), SLOT(toggleRepeat())); connect(m_view, SIGNAL(volumeChanged(qreal)), SLOT(setVolume(qreal))); connect(m_view, SIGNAL(songSelected(int)), SLOT(play(int))); } initializeView(); }
ContactSwitcher::ContactSwitcher( QWidget *parent ) : QWidget( parent ), mView( 0 ) { QHBoxLayout *layout = new QHBoxLayout( this ); mPreviousButton = new QPushButton( i18nc( "@action:button Previous contact", "Previous" ) ); mPreviousButton->setToolTip( i18nc( "@info:tooltip", "Move to the previous contact in the list" ) ); mPreviousButton->setWhatsThis( i18nc( "@info:whatsthis", "Press this button to move to the previous contact in the list." ) ); mNextButton = new QPushButton( i18nc( "@action:button Next contact", "Next" ) ); mNextButton->setToolTip( i18nc( "@info:tooltip", "Move to the next contact in the list" ) ); mNextButton->setWhatsThis( i18nc( "@info:whatsthis", "Press this button to move to the next contact in the list." ) ); mStatusLabel = new QLabel(); layout->addWidget( mPreviousButton ); layout->addWidget( mNextButton ); layout->addStretch( 1 ); layout->addWidget( mStatusLabel ); connect( mPreviousButton, SIGNAL(clicked()), SLOT(previousClicked()) ); connect( mNextButton, SIGNAL(clicked()), SLOT(nextClicked()) ); }
void WeatherParamSetupWidget::initConnect(){ connect(airportComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onAirportChanged(int))); connect(planeNameComboBox, SIGNAL(currentTextChanged(QString)), this, SLOT(onPlaneNameChanged(QString))); if(SharedMemory::isWelcome){ connect(previousButton, SIGNAL(clicked()), this, SIGNAL(previousClicked())); connect(nextButton, SIGNAL(clicked()), this, SIGNAL(nextClicked())); } }
void HelpViewer::setupConnections() { connect(previous, SIGNAL(clicked()), this, SLOT(previousClicked())); connect(next, SIGNAL(clicked()), this, SLOT(nextClicked())); connect(home, SIGNAL(clicked()), this, SLOT(homeClicked())); connect(viewer, SIGNAL(backwardAvailable(bool)), this, SLOT(backwardAvailable(bool))); connect(viewer, SIGNAL(forwardAvailable(bool)), this, SLOT(forwardAvailable(bool))); connect(helpEngine->contentWidget(), SIGNAL(linkActivated(const QUrl&)), viewer, SLOT(setSource(const QUrl&))); connect(viewer, SIGNAL(sourceChanged(const QUrl&)), this, SLOT(sourceChanged(const QUrl&))); }
void MainWindow::changePlayerConnections(bool connected) { if(connected) { nextConnection = connect(bar,SIGNAL(nextClicked()),&player,SLOT(next())); previousConnection = connect(bar,SIGNAL(previousClicked()),&player,SLOT(previous())); } else { disconnect(nextConnection); disconnect(previousConnection); } }
void PlaylistControl::mouseReleaseEvent(QMouseEvent *me) { QPoint pt = me->pos(); if(QRect(4*m_ratio,m_ratio,7*m_ratio,7*m_ratio).contains(pt)) emit previousClicked(); else if(QRect(12*m_ratio,m_ratio,7*m_ratio,7*m_ratio).contains(pt)) emit playClicked(); else if(QRect(21*m_ratio,m_ratio,7*m_ratio,7*m_ratio).contains(pt)) emit pauseClicked(); else if(QRect(31*m_ratio,m_ratio,7*m_ratio,7*m_ratio).contains(pt)) emit stopClicked(); else if(QRect(40*m_ratio,m_ratio,7*m_ratio,7*m_ratio).contains(pt)) emit nextClicked(); else if(QRect(49*m_ratio,m_ratio,7*m_ratio,7*m_ratio).contains(pt)) emit ejectClicked(); }
int Player::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: hideWindow(); break; case 1: open(); break; case 2: durationChanged((*reinterpret_cast< qint64(*)>(_a[1]))); break; case 3: positionChanged((*reinterpret_cast< qint64(*)>(_a[1]))); break; case 4: metaDataChanged(); break; case 5: previousClicked(); break; case 6: seek((*reinterpret_cast< int(*)>(_a[1]))); break; case 7: jump((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break; case 8: playlistPositionChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 9: statusChanged((*reinterpret_cast< QMediaPlayer::MediaStatus(*)>(_a[1]))); break; case 10: bufferingProgress((*reinterpret_cast< int(*)>(_a[1]))); break; case 11: displayErrorMessage(); break; case 12: handleAspectRatio((*reinterpret_cast< bool(*)>(_a[1]))); break; case 13: handleStateChange((*reinterpret_cast< QMediaPlayer::State(*)>(_a[1]))); break; case 14: showPlayList(); break; case 15: hideOrShowCoverArt(); break; case 16: launchYoutubeDialog(); break; case 17: youtubeHttpRequestFinished((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break; case 18: youtubeReadResponseHeader((*reinterpret_cast< const QHttpResponseHeader(*)>(_a[1]))); break; case 19: searchYoutubeVideo(); break; case 20: addYoutubeVideo(); break; case 21: handleAudioOutputDefault(); break; case 22: handleAudioOutputAll(); break; case 23: handleAudioOutputNone(); break; case 24: handleAudioOutputEarphone(); break; case 25: handleAudioOutputSpeaker(); break; case 26: handleAudioOutputChangedSignal((*reinterpret_cast< const QString(*)>(_a[1]))); break; default: ; } _id -= 27; } return _id; }
Player::Player(QWidget *parent) : QWidget(parent) , videoWidget(0) , coverLabel(0) , slider(0) #ifndef PLAYER_NO_COLOROPTIONS , colorDialog(0) #endif { //! [create-objs] player = new QMediaPlayer(this); // owned by PlaylistModel playlist = new QMediaPlaylist(); player->setPlaylist(playlist); //! [create-objs] connect(player, SIGNAL(durationChanged(qint64)), SLOT(durationChanged(qint64))); connect(player, SIGNAL(positionChanged(qint64)), SLOT(positionChanged(qint64))); connect(player, SIGNAL(metaDataChanged()), SLOT(metaDataChanged())); connect(playlist, SIGNAL(currentIndexChanged(int)), SLOT(playlistPositionChanged(int))); connect(player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(statusChanged(QMediaPlayer::MediaStatus))); connect(player, SIGNAL(bufferStatusChanged(int)), this, SLOT(bufferingProgress(int))); connect(player, SIGNAL(videoAvailableChanged(bool)), this, SLOT(videoAvailableChanged(bool))); connect(player, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(displayErrorMessage())); //! [2] videoWidget = new VideoWidget(this); player->setVideoOutput(videoWidget); playlistModel = new PlaylistModel(this); playlistModel->setPlaylist(playlist); //! [2] playlistView = new QListView(this); playlistView->setModel(playlistModel); playlistView->setCurrentIndex(playlistModel->index(playlist->currentIndex(), 0)); connect(playlistView, SIGNAL(activated(QModelIndex)), this, SLOT(jump(QModelIndex))); slider = new QSlider(Qt::Horizontal, this); slider->setRange(0, player->duration() / SLIDER_DIVISOR); labelDuration = new QLabel(this); connect(slider, SIGNAL(sliderMoved(int)), this, SLOT(seek(int))); labelHistogram = new QLabel(this); labelHistogram->setText("Histogram:"); histogram = new HistogramWidget(this); QHBoxLayout *histogramLayout = new QHBoxLayout; histogramLayout->addWidget(labelHistogram); histogramLayout->addWidget(histogram, 1); probe = new QVideoProbe(this); connect(probe, SIGNAL(videoFrameProbed(QVideoFrame)), histogram, SLOT(processFrame(QVideoFrame))); probe->setSource(player); QPushButton *openButton = new QPushButton(tr("Open"), this); connect(openButton, SIGNAL(clicked()), this, SLOT(open())); PlayerControls *controls = new PlayerControls(this); controls->setState(player->state()); controls->setVolume(player->volume()); controls->setMuted(controls->isMuted()); connect(controls, SIGNAL(play()), player, SLOT(play())); connect(controls, SIGNAL(pause()), player, SLOT(pause())); connect(controls, SIGNAL(stop()), player, SLOT(stop())); connect(controls, SIGNAL(next()), playlist, SLOT(next())); connect(controls, SIGNAL(previous()), this, SLOT(previousClicked())); connect(controls, SIGNAL(changeVolume(int)), player, SLOT(setVolume(int))); connect(controls, SIGNAL(changeMuting(bool)), player, SLOT(setMuted(bool))); connect(controls, SIGNAL(changeRate(qreal)), player, SLOT(setPlaybackRate(qreal))); connect(controls, SIGNAL(stop()), videoWidget, SLOT(update())); connect(player, SIGNAL(stateChanged(QMediaPlayer::State)), controls, SLOT(setState(QMediaPlayer::State))); connect(player, SIGNAL(volumeChanged(int)), controls, SLOT(setVolume(int))); connect(player, SIGNAL(mutedChanged(bool)), controls, SLOT(setMuted(bool))); fullScreenButton = new QPushButton(tr("FullScreen"), this); fullScreenButton->setCheckable(true); #ifndef PLAYER_NO_COLOROPTIONS colorButton = new QPushButton(tr("Color Options..."), this); colorButton->setEnabled(false); connect(colorButton, SIGNAL(clicked()), this, SLOT(showColorDialog())); #endif QBoxLayout *displayLayout = new QHBoxLayout; displayLayout->addWidget(videoWidget, 2); displayLayout->addWidget(playlistView); QBoxLayout *controlLayout = new QHBoxLayout; controlLayout->setMargin(0); controlLayout->addWidget(openButton); controlLayout->addStretch(1); controlLayout->addWidget(controls); controlLayout->addStretch(1); controlLayout->addWidget(fullScreenButton); #ifndef PLAYER_NO_COLOROPTIONS controlLayout->addWidget(colorButton); #endif QBoxLayout *layout = new QVBoxLayout; layout->addLayout(displayLayout); QHBoxLayout *hLayout = new QHBoxLayout; hLayout->addWidget(slider); hLayout->addWidget(labelDuration); layout->addLayout(hLayout); layout->addLayout(controlLayout); layout->addLayout(histogramLayout); setLayout(layout); if (!player->isAvailable()) { QMessageBox::warning(this, tr("Service not available"), tr("The QMediaPlayer object does not have a valid service.\n"\ "Please check the media service plugins are installed.")); controls->setEnabled(false); playlistView->setEnabled(false); openButton->setEnabled(false); #ifndef PLAYER_NO_COLOROPTIONS colorButton->setEnabled(false); #endif fullScreenButton->setEnabled(false); } metaDataChanged(); QStringList arguments = qApp->arguments(); arguments.removeAt(0); addToPlaylist(arguments); }
Player::Player(QWidget *parent) : QWidget(parent) , videoWidget(0) , coverLabel(0) , slider(0) , colorDialog(0) { player = new QMediaPlayer(this); playlist = new QMediaPlaylist(this); playlist->setMediaObject(player); connect(player, SIGNAL(durationChanged(qint64)), SLOT(durationChanged(qint64))); connect(player, SIGNAL(positionChanged(qint64)), SLOT(positionChanged(qint64))); connect(player, SIGNAL(metaDataChanged()), SLOT(metaDataChanged())); connect(playlist, SIGNAL(currentIndexChanged(int)), SLOT(playlistPositionChanged(int))); connect(player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(statusChanged(QMediaPlayer::MediaStatus))); connect(player, SIGNAL(bufferStatusChanged(int)), this, SLOT(bufferingProgress(int))); videoWidget = new VideoWidget; videoWidget->setMediaObject(player); playlistModel = new PlaylistModel(this); playlistModel->setPlaylist(playlist); playlistView = new QListView; playlistView->setModel(playlistModel); playlistView->setCurrentIndex(playlistModel->index(playlist->currentIndex(), 0)); connect(playlistView, SIGNAL(activated(QModelIndex)), this, SLOT(jump(QModelIndex))); playbackModeBox = new QComboBox; playbackModeBox->addItem(tr("Linear"), QVariant::fromValue<QMediaPlaylist::PlaybackMode>(QMediaPlaylist::Linear)); playbackModeBox->addItem(tr("Loop"), QVariant::fromValue<QMediaPlaylist::PlaybackMode>(QMediaPlaylist::Loop)); playbackModeBox->addItem(tr("Random"), QVariant::fromValue<QMediaPlaylist::PlaybackMode>(QMediaPlaylist::Random)); playbackModeBox->addItem(tr("Current Item Once"), QVariant::fromValue<QMediaPlaylist::PlaybackMode>(QMediaPlaylist::CurrentItemOnce)); playbackModeBox->addItem(tr("Current Item In Loop"), QVariant::fromValue<QMediaPlaylist::PlaybackMode>(QMediaPlaylist::CurrentItemInLoop)); playbackModeBox->setCurrentIndex(0); connect(playbackModeBox, SIGNAL(activated(int)), SLOT(updatePlaybackMode())); updatePlaybackMode(); slider = new QSlider(Qt::Horizontal); slider->setRange(0, player->duration() / 1000); connect(slider, SIGNAL(sliderMoved(int)), this, SLOT(seek(int))); QPushButton *openButton = new QPushButton(tr("Open")); connect(openButton, SIGNAL(clicked()), this, SLOT(open())); PlayerControls *controls = new PlayerControls; controls->setState(player->state()); controls->setVolume(player->volume()); controls->setMuted(controls->isMuted()); connect(controls, SIGNAL(play()), player, SLOT(play())); connect(controls, SIGNAL(pause()), player, SLOT(pause())); connect(controls, SIGNAL(stop()), player, SLOT(stop())); connect(controls, SIGNAL(next()), playlist, SLOT(next())); connect(controls, SIGNAL(previous()), this, SLOT(previousClicked())); connect(controls, SIGNAL(changeVolume(int)), player, SLOT(setVolume(int))); connect(controls, SIGNAL(changeMuting(bool)), player, SLOT(setMuted(bool))); connect(controls, SIGNAL(changeRate(qreal)), player, SLOT(setPlaybackRate(qreal))); connect(player, SIGNAL(stateChanged(QMediaPlayer::State)), controls, SLOT(setState(QMediaPlayer::State))); connect(player, SIGNAL(volumeChanged(int)), controls, SLOT(setVolume(int))); connect(player, SIGNAL(mutedChanged(bool)), controls, SLOT(setMuted(bool))); QPushButton *fullScreenButton = new QPushButton(tr("FullScreen")); fullScreenButton->setCheckable(true); if (videoWidget != 0) { connect(fullScreenButton, SIGNAL(clicked(bool)), videoWidget, SLOT(setFullScreen(bool))); connect(videoWidget, SIGNAL(fullScreenChanged(bool)), fullScreenButton, SLOT(setChecked(bool))); } else { fullScreenButton->setEnabled(false); } QPushButton *colorButton = new QPushButton(tr("Color Options...")); if (videoWidget) connect(colorButton, SIGNAL(clicked()), this, SLOT(showColorDialog())); else colorButton->setEnabled(false); QBoxLayout *playlistLayout = new QVBoxLayout; playlistLayout->addWidget(playlistView); playlistLayout->addWidget(playbackModeBox); QBoxLayout *displayLayout = new QHBoxLayout; if (videoWidget) displayLayout->addWidget(videoWidget, 2); else displayLayout->addWidget(coverLabel, 2); displayLayout->addLayout(playlistLayout); QBoxLayout *controlLayout = new QHBoxLayout; controlLayout->setMargin(0); controlLayout->addWidget(openButton); controlLayout->addStretch(1); controlLayout->addWidget(controls); controlLayout->addStretch(1); controlLayout->addWidget(fullScreenButton); controlLayout->addWidget(colorButton); QBoxLayout *layout = new QVBoxLayout; layout->addLayout(displayLayout); layout->addWidget(slider); layout->addLayout(controlLayout); setLayout(layout); metaDataChanged(); QStringList arguments = qApp->arguments(); arguments.removeAt(0); foreach (QString const &argument, arguments) { QFileInfo fileInfo(argument); if (fileInfo.exists()) { QUrl url = QUrl::fromLocalFile(fileInfo.absoluteFilePath()); if (fileInfo.suffix().toLower() == QLatin1String("m3u")) { playlist->load(url); } else playlist->addMedia(url); } else { QUrl url(argument); if (url.isValid()) { playlist->addMedia(url); } } }
/* * The constructor instantiates all the necessary widgets used for controlling * the radio. This includes the 9 preset buttons, scan buttons and the * next/prev buttons. The VisualizerWidget is also created which uses FFT to * display a frequency spectrum in real time. This is done by reading in * sound samples from /dev/dsp (line in) */ RadioWidget::RadioWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) { setBackgroundColor(Qt::black); // instantiate the LCD to display the current radio frequency lcd = new QLCDNumber(5, this, 0); lcd->setSegmentStyle(QLCDNumber::Filled); QPalette palette = lcd->palette(); palette.setColor(QPalette::Normal, QColorGroup::Foreground, Qt::red); palette.setColor(QPalette::Normal, QColorGroup::Background, Qt::black); palette.setColor(QPalette::Normal, QColorGroup::Light, Qt::red); palette.setColor(QPalette::Normal, QColorGroup::Dark, Qt::black); lcd->setPalette(palette); //lcd->setWFlags(Qt::WStyle_NoBorder); connect(this, SIGNAL(freqChanged(double)), lcd, SLOT(display(double))); // create buttons for tuning the radio scanBackward = new FlatButton(FlatButton::Toggle, "|<", this,0); scanBackward->setNormalColor(64, 164, 64); scanBackward->setHiliteColor(200, 94, 94); scanBackward->setToggleColor(200, 94, 94); scanBackward->setGeometry(0, 430, 100, 50); connect(scanBackward, SIGNAL(toggled(int)), this, SLOT(scanBackwardToggled(int))); FlatButton *button = new FlatButton(FlatButton::Text, "<<", this,0); button->setNormalColor(64, 164, 64); button->setHiliteColor(100, 230, 100); button->setGeometry(100, 430, 100, 50); connect(button, SIGNAL(clicked()), this, SLOT(previousClicked())); scan = new FlatButton(FlatButton::Toggle, "Scan", this,0); scan->setNormalColor(64, 164, 64); scan->setHiliteColor(200, 94, 94); scan->setToggleColor(200, 94, 94); scan->setGeometry(200, 430, 160, 50); connect(scan, SIGNAL(toggled(int)), this, SLOT(scanToggled(int))); button = new FlatButton(FlatButton::Text, ">>", this,0); button->setNormalColor(64, 164, 64); button->setHiliteColor(100, 230, 100); button->setGeometry(360, 430, 100, 50); connect(button, SIGNAL(clicked()), this, SLOT(nextClicked())); scanForward = new FlatButton(FlatButton::Toggle, ">|", this,0); scanForward->setNormalColor(64, 164, 64); scanForward->setHiliteColor(200, 94, 94); scanForward->setToggleColor(200, 94, 94); scanForward->setGeometry(460, 430, 100, 50); connect(scanForward, SIGNAL(toggled(int)), this, SLOT(scanForwardToggled(int))); // create the presets // TO DO: Read presets from a file preset[0] = new FlatButton(FlatButton::Radio, "89.7", this,0); preset[1] = new FlatButton(FlatButton::Radio, "93.3", this,0); preset[2] = new FlatButton(FlatButton::Radio, "94.9", this,0); preset[3] = new FlatButton(FlatButton::Radio, "95.7", this,0); preset[4] = new FlatButton(FlatButton::Radio, "97.9", this,0); preset[5] = new FlatButton(FlatButton::Radio, "101.5", this,0); preset[6] = new FlatButton(FlatButton::Radio, "102.5", this,0); preset[7] = new FlatButton(FlatButton::Radio, "105.1", this,0); preset[8] = new FlatButton(FlatButton::Radio, "107.9", this,0); // connect every preset button's clicked signal to stationSelected slot for (int i = 0; i < 9; i++) connect(preset[i], SIGNAL(stationSelected(float)), this, SLOT(stationSelected(float))); // Initialize the radio device frequency = 89.7; struct video_tuner tuner; fd = open("/dev/radio0", O_TRUNC); if (fd > 0) { tuner.tuner = 0; if (ioctl(fd, VIDIOCGTUNER , &tuner) == 0) freq_factor = (tuner.flags&VIDEO_TUNER_LOW ? 16000.0 : 16.0); setFrequency(93.3); } deactivate(); threadRunning = FALSE; visualizer = new VisualizerWidget(this, 0); }
#ifndef Q_OS_SYMBIAN QPushButton *openButton = new QPushButton(tr("Open"), this); connect(openButton, SIGNAL(clicked()), this, SLOT(open())); #endif PlayerControls *controls = new PlayerControls(this); controls->setState(player->state()); controls->setVolume(player->volume()); controls->setMuted(controls->isMuted()); connect(controls, SIGNAL(play()), player, SLOT(play())); connect(controls, SIGNAL(pause()), player, SLOT(pause())); connect(controls, SIGNAL(stop()), player, SLOT(stop())); connect(controls, SIGNAL(next()), playlist, SLOT(next())); connect(controls, SIGNAL(previous()), this, SLOT(previousClicked())); connect(controls, SIGNAL(changeVolume(int)), player, SLOT(setVolume(int))); connect(controls, SIGNAL(changeMuting(bool)), player, SLOT(setMuted(bool))); connect(controls, SIGNAL(changeRate(qreal)), player, SLOT(setPlaybackRate(qreal))); connect(controls, SIGNAL(stop()), videoWidget, SLOT(update())); connect(player, SIGNAL(stateChanged(QMediaPlayer::State)), controls, SLOT(setState(QMediaPlayer::State))); connect(player, SIGNAL(volumeChanged(int)), controls, SLOT(setVolume(int))); connect(player, SIGNAL(mutedChanged(bool)), controls, SLOT(setMuted(bool))); #ifndef Q_OS_SYMBIAN QPushButton *hideWindowButton = new QPushButton(tr("HideWindow"), this); hideWindowButton->setCheckable(true);
void ControlWidget::previousButtonClicked(){ emit previousClicked(); }