IncomingDataParser::IncomingDataParser(Application* app) :app_(app) { // Connect all the signals // due the player is in a different thread, we cannot access these functions directly connect(this, SIGNAL(Play()), app_->player(), SLOT(Play())); connect(this, SIGNAL(PlayPause()), app_->player(), SLOT(PlayPause())); connect(this, SIGNAL(Pause()), app_->player(), SLOT(Pause())); connect(this, SIGNAL(Stop()), app_->player(), SLOT(Stop())); connect(this, SIGNAL(Next()), app_->player(), SLOT(Next())); connect(this, SIGNAL(Previous()), app_->player(), SLOT(Previous())); connect(this, SIGNAL(SetVolume(int)), app_->player(), SLOT(SetVolume(int))); connect(this, SIGNAL(PlayAt(int,Engine::TrackChangeFlags,bool)), app_->player(), SLOT(PlayAt(int,Engine::TrackChangeFlags,bool))); connect(this, SIGNAL(SeekTo(int)), app_->player(), SLOT(SeekTo(int))); // For some connects we have to wait for the playlistmanager // to be initialized connect(app_->playlist_manager(), SIGNAL(PlaylistManagerInitialized()), this, SLOT(PlaylistManagerInitialized())); }
VlcMediaPlayer::VlcMediaPlayer() : QWidget(0), videoWidget_(0), currentSource_("") { ui_.setupUi(this); ui_.pauseButton->hide(); try { videoWidget_ = new VlcVideoWidget(GenerateVlcParameters()); connect(videoWidget_, SIGNAL(StatusUpdate(const PlayerStatus&)), SLOT(OnStatusUpdate(const PlayerStatus&))); connect(videoWidget_, SIGNAL(FrameUpdate(QImage)), SIGNAL(FrameUpdate(QImage)), Qt::QueuedConnection); connect(ui_.playButton, SIGNAL(clicked()), SLOT(PlayPause())); connect(ui_.pauseButton, SIGNAL(clicked()), SLOT(PlayPause())); connect(ui_.stopButton, SIGNAL(clicked()), SLOT(Stop())); connect(ui_.timeSlider, SIGNAL(sliderReleased()), SLOT(Seek())); ui_.verticalLayout->insertWidget(0, videoWidget_, 2); } catch (std::exception &e) { LogError(QString("VlcMediaPlayer: ") + e.what()); } setWindowTitle(""); hide(); }
void BakaEngine::BakaPlayPause(QStringList &args) { if(args.empty()) PlayPause(); else InvalidParameter(args.join(' ')); }
PlayerControl::PlayerControl(Player *player, PlayerHistory *history) : progress_(new Phonon::SeekSlider(player->media())), progress_text_(new QLabel), play_pause_(new QPushButton), next_(new QPushButton(tr("Next"))), previous_(new QPushButton(tr("Previous"))), stop_(new QPushButton(tr("Stop"))), volume_(new Phonon::VolumeSlider(player->audio())) { QVBoxLayout* vLayout = new QVBoxLayout; setLayout(vLayout); QHBoxLayout* hLayout1 = new QHBoxLayout; hLayout1->addWidget(previous_); hLayout1->addWidget(stop_); hLayout1->addWidget(play_pause_); hLayout1->addWidget(next_); hLayout1->addWidget(volume_); QHBoxLayout* hLayout2 = new QHBoxLayout; hLayout2->addWidget(progress_); hLayout2->addWidget(progress_text_); vLayout->addLayout(hLayout1); vLayout->addLayout(hLayout2); connect(next_, SIGNAL(clicked()), history, SLOT(Next())); connect(previous_, SIGNAL(clicked()), history, SLOT(Previous())); connect(play_pause_, SIGNAL(clicked()), player, SLOT(PlayPause())); connect(stop_, SIGNAL(clicked()), player, SLOT(Stop())); connect(player, SIGNAL(OnStatus(PlayerState)), this, SLOT(Status(PlayerState))); Status(PlayerState_Invalid); }
IncomingDataParser::IncomingDataParser(Application* app) : app_(app) { // Connect all the signals // due the player is in a different thread, we cannot access these functions // directly connect(this, SIGNAL(Play()), app_->player(), SLOT(Play())); connect(this, SIGNAL(PlayPause()), app_->player(), SLOT(PlayPause())); connect(this, SIGNAL(Pause()), app_->player(), SLOT(Pause())); connect(this, SIGNAL(Stop()), app_->player(), SLOT(Stop())); connect(this, SIGNAL(StopAfterCurrent()), app_->player(), SLOT(StopAfterCurrent())); connect(this, SIGNAL(Next()), app_->player(), SLOT(Next())); connect(this, SIGNAL(Previous()), app_->player(), SLOT(Previous())); connect(this, SIGNAL(SetVolume(int)), app_->player(), SLOT(SetVolume(int))); connect(this, SIGNAL(PlayAt(int, Engine::TrackChangeFlags, bool)), app_->player(), SLOT(PlayAt(int, Engine::TrackChangeFlags, bool))); connect(this, SIGNAL(SeekTo(int)), app_->player(), SLOT(SeekTo(int))); connect(this, SIGNAL(SetActivePlaylist(int)), app_->playlist_manager(), SLOT(SetActivePlaylist(int))); connect(this, SIGNAL(ShuffleCurrent()), app_->playlist_manager(), SLOT(ShuffleCurrent())); connect(this, SIGNAL(SetRepeatMode(PlaylistSequence::RepeatMode)), app_->playlist_manager()->sequence(), SLOT(SetRepeatMode(PlaylistSequence::RepeatMode))); connect(this, SIGNAL(SetShuffleMode(PlaylistSequence::ShuffleMode)), app_->playlist_manager()->sequence(), SLOT(SetShuffleMode(PlaylistSequence::ShuffleMode))); connect(this, SIGNAL(InsertUrls(int, const QList<QUrl>&, int, bool, bool)), app_->playlist_manager(), SLOT(InsertUrls(int, const QList<QUrl>&, int, bool, bool))); connect(this, SIGNAL(RemoveSongs(int, const QList<int>&)), app_->playlist_manager(), SLOT(RemoveItemsWithoutUndo(int, const QList<int>&))); connect(this, SIGNAL(Open(int)), app_->playlist_manager(), SLOT(Open(int))); connect(this, SIGNAL(Close(int)), app_->playlist_manager(), SLOT(Close(int))); connect(this, SIGNAL(RateCurrentSong(double)), app_->playlist_manager(), SLOT(RateCurrentSong(double))); #ifdef HAVE_LIBLASTFM connect(this, SIGNAL(Love()), InternetModel::Service<LastFMService>(), SLOT(Love())); connect(this, SIGNAL(Ban()), InternetModel::Service<LastFMService>(), SLOT(Ban())); #endif }
GlobalShortcuts::GlobalShortcuts(QObject *parent) : QObject(parent), gnome_backend_(NULL), system_backend_(NULL), use_gnome_(false), rating_signals_mapper_(new QSignalMapper(this)) { settings_.beginGroup(kSettingsGroup); // Create actions AddShortcut("play", tr("Play"), SIGNAL(Play())); AddShortcut("pause", tr("Pause"), SIGNAL(Pause())); AddShortcut("play_pause", tr("Play/Pause"), SIGNAL(PlayPause()), QKeySequence(Qt::Key_MediaPlay)); AddShortcut("stop", tr("Stop"), SIGNAL(Stop()), QKeySequence(Qt::Key_MediaStop)); AddShortcut("stop_after", tr("Stop playing after current track"), SIGNAL(StopAfter())); AddShortcut("next_track", tr("Next track"), SIGNAL(Next()), QKeySequence(Qt::Key_MediaNext)); AddShortcut("prev_track", tr("Previous track"), SIGNAL(Previous()), QKeySequence(Qt::Key_MediaPrevious)); AddShortcut("inc_volume", tr("Increase volume"), SIGNAL(IncVolume())); AddShortcut("dec_volume", tr("Decrease volume"), SIGNAL(DecVolume())); AddShortcut("mute", tr("Mute"), SIGNAL(Mute())); AddShortcut("seek_forward", tr("Seek forward"), SIGNAL(SeekForward())); AddShortcut("seek_backward", tr("Seek backward"), SIGNAL(SeekBackward())); AddShortcut("show_hide", tr("Show/Hide"), SIGNAL(ShowHide())); AddShortcut("show_osd", tr("Show OSD"), SIGNAL(ShowOSD())); AddShortcut("toggle_pretty_osd", tr("Toggle Pretty OSD"), SIGNAL(TogglePrettyOSD())); // Toggling possible only for pretty OSD AddShortcut("shuffle_mode", tr("Change shuffle mode"), SIGNAL(CycleShuffleMode())); AddShortcut("repeat_mode", tr("Change repeat mode"), SIGNAL(CycleRepeatMode())); AddShortcut("toggle_last_fm_scrobbling", tr("Enable/disable Last.fm scrobbling"), SIGNAL(ToggleScrobbling())); AddShortcut("global_search_popup", tr("Show Global Search Popup"), SIGNAL(ShowGlobalSearch())); AddRatingShortcut("rate_zero_star", tr("Rate the current song 0 stars"), rating_signals_mapper_, 0); AddRatingShortcut("rate_one_star", tr("Rate the current song 1 star"), rating_signals_mapper_, 1); AddRatingShortcut("rate_two_star", tr("Rate the current song 2 stars"), rating_signals_mapper_, 2); AddRatingShortcut("rate_three_star", tr("Rate the current song 3 stars"), rating_signals_mapper_, 3); AddRatingShortcut("rate_four_star", tr("Rate the current song 4 stars"), rating_signals_mapper_, 4); AddRatingShortcut("rate_five_star", tr("Rate the current song 5 stars"), rating_signals_mapper_, 5); connect(rating_signals_mapper_, SIGNAL(mapped(int)), SIGNAL(RateCurrentSong(int))); // Create backends - these do the actual shortcut registration gnome_backend_ = new GnomeGlobalShortcutBackend(this); #ifndef Q_OS_DARWIN system_backend_ = new QxtGlobalShortcutBackend(this); #else system_backend_ = new MacGlobalShortcutBackend(this); #endif ReloadSettings(); }
void QtSystemTrayIcon::Clicked(QSystemTrayIcon::ActivationReason reason) { switch (reason) { case QSystemTrayIcon::DoubleClick: case QSystemTrayIcon::Trigger: emit ShowHide(); break; case QSystemTrayIcon::MiddleClick: emit PlayPause(); break; default: break; } }
GlobalShortcuts::GlobalShortcuts(QObject *parent) : QObject(parent), backend(nullptr) { // Create actions AddShortcut("play", tr("Play"), SIGNAL(Play())); AddShortcut("pause", tr("Pause"), SIGNAL(Pause())); AddShortcut("play_pause", tr("Play/Pause"), SIGNAL(PlayPause()), QKeySequence(Qt::Key_MediaPlay)); AddShortcut("stop", tr("Stop"), SIGNAL(Stop()), QKeySequence(Qt::Key_MediaStop)); AddShortcut("stop_after", tr("Stop playing after current track"), SIGNAL(StopAfter())); AddShortcut("next_track", tr("Next track"), SIGNAL(Next()), QKeySequence(Qt::Key_MediaNext)); AddShortcut("prev_track", tr("Previous track"), SIGNAL(Previous()), QKeySequence(Qt::Key_MediaPrevious)); AddShortcut("inc_volume", tr("Increase volume"), SIGNAL(IncVolume())); AddShortcut("dec_volume", tr("Decrease volume"), SIGNAL(DecVolume())); AddShortcut("mute", tr("Mute"), SIGNAL(Mute())); AddShortcut("seek_forward", tr("Seek forward"), SIGNAL(SeekForward())); AddShortcut("seek_backward", tr("Seek backward"), SIGNAL(SeekBackward())); }
void PlaylistView::keyPressEvent(QKeyEvent* event) { if (!model() || state() == QAbstractItemView::EditingState) { QTreeView::keyPressEvent(event); } else if (event == QKeySequence::Delete) { RemoveSelected(); event->accept(); #ifdef Q_OS_DARWIN } else if (event->key() == Qt::Key_Backspace) { RemoveSelected(); event->accept(); #endif } else if (event == QKeySequence::Copy) { CopyCurrentSongToClipboard(); } else if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) { if (currentIndex().isValid()) emit PlayItem(currentIndex()); event->accept(); } else if (event->modifiers() != Qt::ControlModifier // Ctrl+Space selects // the item && event->key() == Qt::Key_Space) { emit PlayPause(); event->accept(); } else if (event->key() == Qt::Key_Left) { emit SeekTrack(-1); event->accept(); } else if (event->key() == Qt::Key_Right) { emit SeekTrack(1); event->accept(); } else if (event->modifiers() == Qt::NoModifier // No modifier keys currently pressed... // ... and key pressed is something related to text && ((event->key() >= Qt::Key_A && event->key() <= Qt::Key_Z) || event->key() == Qt::Key_Backspace || event->key() == Qt::Key_Escape)) { emit FocusOnFilterSignal(event); event->accept(); } else { QTreeView::keyPressEvent(event); } }
void IncomingDataParser::Parse(const pb::remote::Message& msg) { close_connection_ = false; RemoteClient* client = qobject_cast<RemoteClient*>(sender()); // Now check what's to do switch (msg.type()) { case pb::remote::CONNECT: ClientConnect(msg); break; case pb::remote::DISCONNECT: close_connection_ = true; break; case pb::remote::REQUEST_PLAYLISTS: SendPlaylists(msg); break; case pb::remote::REQUEST_PLAYLIST_SONGS: GetPlaylistSongs(msg); break; case pb::remote::SET_VOLUME: emit SetVolume(msg.request_set_volume().volume()); break; case pb::remote::PLAY: emit Play(); break; case pb::remote::PLAYPAUSE: emit PlayPause(); break; case pb::remote::PAUSE: emit Pause(); break; case pb::remote::STOP: emit Stop(); break; case pb::remote::STOP_AFTER: emit StopAfterCurrent(); break; case pb::remote::NEXT: emit Next(); break; case pb::remote::PREVIOUS: emit Previous(); break; case pb::remote::CHANGE_SONG: ChangeSong(msg); break; case pb::remote::SHUFFLE_PLAYLIST: emit ShuffleCurrent(); break; case pb::remote::REPEAT: SetRepeatMode(msg.repeat()); break; case pb::remote::SHUFFLE: SetShuffleMode(msg.shuffle()); break; case pb::remote::SET_TRACK_POSITION: emit SeekTo(msg.request_set_track_position().position()); break; case pb::remote::INSERT_URLS: InsertUrls(msg); break; case pb::remote::REMOVE_SONGS: RemoveSongs(msg); break; case pb::remote::OPEN_PLAYLIST: OpenPlaylist(msg); break; case pb::remote::CLOSE_PLAYLIST: ClosePlaylist(msg); break; case pb::remote::LOVE: emit Love(); break; case pb::remote::BAN: emit Ban(); break; case pb::remote::GET_LYRICS: emit GetLyrics(); break; case pb::remote::DOWNLOAD_SONGS: emit SendSongs(msg.request_download_songs(), client); break; case pb::remote::SONG_OFFER_RESPONSE: emit ResponseSongOffer(client, msg.response_song_offer().accepted()); break; case pb::remote::GET_LIBRARY: emit SendLibrary(client); break; case pb::remote::RATE_SONG: RateSong(msg); break; default: break; } }
void Music::Restart(int loops) { Stop(); PlayPause(loops); }
QToolBar * Console::CreaToolBar() { QToolBar * toolbar = new QToolBar("Barra de Menues", this); reloj = new Clock(this->http, this); // Creamos las acciones actExit = new QAction(QIcon(":/Resources/Consola/exit.png"), tr("Salir"), this); actExit->setShortcut(QKeySequence::Quit); actExit->setToolTip(tr("Salir del Programa... (Ctrl+Q)")); connect(actExit, SIGNAL(triggered()), this, SLOT(Exit())); actRwd = new QAction(QIcon(":/Resources/Consola/rew.png"), tr("Regresar"), this); // actRwd->setShortcut(QKeySequence(tr("F1"))); actRwd->setToolTip(tr("Regresar...")); connect(actRwd, SIGNAL(triggered()), this, SLOT(Rewind())); actPlay = new QAction(QIcon(":/Resources/Consola/play.png"), tr("Reproducir"), this); // actPlay->setShortcut(QKeySequence(tr("F1"))); actPlay->setToolTip(tr("Reproducir/Pausar...")); connect(actPlay, SIGNAL(triggered()), this, SLOT(PlayPause())); actFwd = new QAction(QIcon(":/Resources/Consola/fwd.png"), tr("Velocidad de reproducción"), this); // actPlay->setShortcut(QKeySequence(tr("F1"))); actFwd->setToolTip(tr("Velocidad de reproducción...")); connect(actFwd, SIGNAL(triggered()), this, SLOT(PlayPause())); actStop = new QAction(QIcon(":/Resources/Consola/stop.png"), tr("Detener"), this); // actStop->setShortcut(QKeySequence(tr("F1"))); actStop->setToolTip(tr("Detener...")); connect(actStop, SIGNAL(triggered()), this, SLOT(Stop())); actHMI = new QAction(QIcon(":/Resources/Consola/hmi.png"), tr("Crear HMI"), this); // actHMI->setShortcut(QKeySequence(tr("F1"))); actHMI->setToolTip(tr("Crear HMI...")); connect(actHMI, SIGNAL(triggered()), this, SLOT(CreaIHM())); actConsole = new QAction(QIcon(":/Resources/Consola/console.png"), tr("Consola"), this); // actConsole->setShortcut(QKeySequence(tr("F1"))); actConsole->setToolTip(tr("Consola de instrucción avanzada...")); connect(actConsole, SIGNAL(triggered()), this, SLOT(OpenWeb())); actAdmin = new QAction(QIcon(":/Resources/Consola/config.png"), tr("Configuración"), this); // actConsole->setShortcut(QKeySequence(tr("F1"))); actAdmin->setToolTip(tr("Configuración...")); connect(actAdmin, SIGNAL(triggered()), this, SLOT(Configurar())); actAbout = new QAction(QIcon(":/Resources/Consola/about.png"), tr("Acerca de..."), this); // actAbout->setShortcut(QKeySequence(tr("F1"))); actAbout->setToolTip(tr("Acerca de...")); connect(actAdmin, SIGNAL(triggered()), this, SLOT(About())); toolbar->addSeparator(); toolbar->addAction(actExit); toolbar->addSeparator(); toolbar->addAction(actRwd); toolbar->addAction(actPlay); toolbar->addAction(actFwd); toolbar->addAction(actStop); toolbar->addSeparator(); toolbar->addAction(actHMI); toolbar->addAction(actConsole); toolbar->addAction(actAdmin); toolbar->addSeparator(); toolbar->addWidget(reloj); toolbar->addSeparator(); toolbar->addAction(actAbout); toolbar->addSeparator(); toolbar->setOrientation(Qt::Horizontal); return toolbar; }
void CMsgForm::OnBtnPause() { PlayPause(); }