void PlaybackControlsWidget::addToMenu( QMenu& menu ) { menu.addAction( m_playAction ); menu.addSeparator(); menu.addAction( aApp->skipAction() ); menu.addSeparator(); menu.addAction( aApp->loveAction() ); menu.addAction( aApp->banAction() ); menu.addSeparator(); menu.addAction( aApp->tagAction() ); menu.addAction( aApp->shareAction() ); menu.addSeparator(); menu.addAction( tr( "Volume Up" ), &RadioService::instance(), SLOT(volumeUp()), QKeySequence( Qt::CTRL + Qt::Key_Up )); menu.addAction( tr( "Volume Down" ), &RadioService::instance(), SLOT(volumeDown()), QKeySequence( Qt::CTRL + Qt::Key_Down )); menu.addAction( tr( "Mute" ), &RadioService::instance(), SLOT(mute()), QKeySequence( Qt::CTRL + Qt::ALT + Qt::Key_Down )); }
ControlPanel::ControlPanel(QWidget *parent) : QWidget(parent), m_coverArt(new CoverArtDialog(this)), m_lyricsDialog(new LyricsDialog(this)), m_lastFm(new LastFmSubmitter(this)) { Q_ASSERT(m_coverArt); Q_ASSERT(m_lyricsDialog); Q_ASSERT(m_lastFm); setupUi(this); coverArtButton->setVisible(false); connect(prevButton, SIGNAL(clicked()), MPD::instance(), SLOT(prev())); connect(playButton, SIGNAL(clicked()), MPD::instance(), SLOT(play())); connect(pauseButton, SIGNAL(clicked()), MPD::instance(), SLOT(pause())); connect(stopButton, SIGNAL(clicked()), MPD::instance(), SLOT(stop())); connect(nextButton, SIGNAL(clicked()), MPD::instance(), SLOT(next())); connect(volumeSlider, SIGNAL(valueChanged(int)), MPD::instance(), SLOT(setVolume(int))); connect(timeSlider, SIGNAL(timeChanged(int)), MPD::instance(), SLOT(seek(int))); connect(timeSlider, SIGNAL(valueChanged(int)), elapsedLabel, SLOT(setTime(int))); connect(MPD::instance(), SIGNAL(volumeUpdated(int)), volumeSlider, SLOT(setValue(int))); connect(MPD::instance(), SIGNAL(timeUpdated(int, int)), elapsedLabel, SLOT(setTime(int, int))); connect(MPD::instance(), SIGNAL(timeUpdated(int, int)), totalLabel, SLOT(setTime(int, int))); connect(MPD::instance(), SIGNAL(timeUpdated(int, int)), timeSlider, SLOT(setTime(int, int))); connect(MPD::instance(), SIGNAL(playingSongUpdated(const MPDSong &)), this, SLOT(setSong(const MPDSong &))); connect(Config::instance(), SIGNAL(showCoverArtChanged(bool)), this, SLOT(showCoverArtChanged(bool))); connect(coverArtButton, SIGNAL(clicked()), m_coverArt, SLOT(show())); connect(lyricsButton, SIGNAL(clicked()), m_lyricsDialog, SLOT(show())); connect(m_lastFm, SIGNAL(infoMsg(QString)), this, SIGNAL(infoMsg(QString))); connect(scrobbleCheckBox, SIGNAL(toggled(bool)), Config::instance(), SLOT(setSubmitSongsToLastFm(bool))); connect(Config::instance(), SIGNAL(submitSongsToLastFmChanged(bool)), scrobbleCheckBox, SLOT(setChecked(bool))); scrobbleCheckBox->setChecked(Config::instance()->submitSongsToLastFm()); // Short cuts m_fwdKey = new QShortcut(Qt::CTRL | Qt::Key_Right, this); m_rwdKey = new QShortcut(Qt::CTRL | Qt::Key_Left, this); m_volUpKey = new QShortcut(Qt::CTRL | Qt::Key_Up, this); m_volDnKey = new QShortcut(Qt::CTRL | Qt::Key_Down, this); m_stopMultKey = new QShortcut(Qt::Key_MediaStop, this); m_togglePlayMultKey = new QShortcut(Qt::Key_MediaPlay, this); m_fwdMultKey = new QShortcut(Qt::Key_MediaNext, this); m_rwdMultKey = new QShortcut(Qt::Key_MediaPrevious, this); m_fwdKey->setObjectName("nextSongKey"); m_rwdKey->setObjectName("prevSongKey"); m_volUpKey->setObjectName("volumeUpKey"); m_volDnKey->setObjectName("volumeDownKey"); m_stopMultKey->setObjectName("stopKey"); m_togglePlayMultKey->setObjectName("togglePlayKey"); m_fwdMultKey->setObjectName("nextSongMultimediaKey"); m_rwdMultKey->setObjectName("prevSongMultimediaKey"); connect(m_fwdKey, SIGNAL(activated()), MPD::instance(), SLOT(seekForward())); connect(m_rwdKey, SIGNAL(activated()), MPD::instance(), SLOT(seekBackward())); connect(m_volUpKey, SIGNAL(activated()), MPD::instance(), SLOT(volumeUp())); connect(m_volDnKey, SIGNAL(activated()), MPD::instance(), SLOT(volumeDown())); connect(m_stopMultKey, SIGNAL(activated()), MPD::instance(), SLOT(stop())); connect(m_togglePlayMultKey, SIGNAL(activated()), MPD::instance(), SLOT(togglePlay())); connect(m_fwdMultKey, SIGNAL(activated()), MPD::instance(), SLOT(next())); connect(m_rwdMultKey, SIGNAL(activated()), MPD::instance(), SLOT(prev())); setSong(MPDSong()); }
void MainWindow::createConnections() { connect(this, SIGNAL(windowWasShown()), this, SLOT(initUpdates()), Qt::ConnectionType(Qt::QueuedConnection | Qt::UniqueConnection)); connect(ui->tabs, SIGNAL(currentChanged(QWidget *)), this, SLOT(currentWidget(QWidget *))); connect(ui->tabs, SIGNAL(currentChanged(QWidget *)), _recorder, SLOT(currentWidget(QWidget *))); connect(_playlistTab, SIGNAL(changeTo(QWidget *)), ui->tabs, SLOT(setCurrentWidget(QWidget *))); connect(_scheduleTab, SIGNAL(changeTo(QWidget *)), ui->tabs, SLOT(setCurrentWidget(QWidget *))); connect(_showInfoTab, SIGNAL(changeTo(QWidget *)), ui->tabs, SLOT(setCurrentWidget(QWidget *))); connect(ui->actionSupport, SIGNAL(triggered()), this, SLOT(support())); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(aboutTano())); connect(ui->actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(ui->actionLogoutExit, SIGNAL(triggered()), this, SLOT(exitLogout())); connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(exit())); connect(ui->actionTop, SIGNAL(triggered()), this, SLOT(top())); connect(ui->actionLite, SIGNAL(triggered()), this, SLOT(lite())); connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openPlaylist())); connect(ui->actionOpenFile, SIGNAL(triggered()), _mediaPlayer, SLOT(openFile())); connect(ui->actionOpenUrl, SIGNAL(triggered()), _mediaPlayer, SLOT(openUrl())); connect(ui->actionSchedule, SIGNAL(triggered()), this, SLOT(showSchedule())); connect(ui->actionScheduleCurrent, SIGNAL(triggered()), this, SLOT(showScheduleCurrent())); connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(showSettings())); connect(ui->actionSettingsShortcuts, SIGNAL(triggered()), this, SLOT(showSettingsShortcuts())); connect(ui->actionEditPlaylist, SIGNAL(triggered()), this, SLOT(showPlaylistEditor())); connect(ui->actionPlay, SIGNAL(triggered()), _mediaPlayer, SLOT(togglePause())); connect(ui->actionStop, SIGNAL(triggered()), this, SLOT(stop())); connect(ui->actionPreview, SIGNAL(triggered(bool)), this, SLOT(preview(bool))); connect(_playlistTab->playlist(), SIGNAL(itemSelected(Channel *)), this, SLOT(playChannel(Channel *))); connect(_previewTimer, SIGNAL(timeout()), ui->actionNext, SLOT(trigger())); if (_trayIcon) { connect(_trayIcon, SIGNAL(restoreClick()), this, SLOT(tray())); connect(ui->actionTray, SIGNAL(triggered()), this, SLOT(tray())); } connect(ui->actionFullscreen, SIGNAL(triggered(bool)), this, SLOT(toggleFullscreen(bool))); connect(ui->actionMute, SIGNAL(toggled(bool)), _mediaPlayer->osd(), SLOT(mute(bool))); connect(ui->actionVolumeDown, SIGNAL(triggered()), _mediaPlayer->osd(), SLOT(volumeDown())); connect(ui->actionVolumeUp, SIGNAL(triggered()), _mediaPlayer->osd(), SLOT(volumeUp())); #if defined(Q_OS_LINUX) if (_mediaPlayer->teletextEnabled()) { connect(ui->actionTeletext, SIGNAL(triggered(bool)), _mediaPlayer->osd(), SLOT(teletext(bool))); connect(ui->actionTeletext, SIGNAL(triggered(bool)), _mediaPlayer, SLOT(teletext(bool))); connect(_mediaPlayer->osd(), SIGNAL(teletextClicked()), ui->actionTeletext, SLOT(trigger())); }
void MCSlider::wheelEvent(QWheelEvent *e) { if (e->orientation() == Horizontal) return; if (e->state() == ShiftButton) { if (e->delta() > 0) emit volumeUp(); else emit volumeDown(); e->accept(); } else { QSlider::wheelEvent(e); } }
int enigmaVCR::eventHandler(const eWidgetEvent &event) { switch (event.type) { case eWidgetEvent::execBegin: eAVSwitch::getInstance()->setInput(1); break; case eWidgetEvent::evtAction: if (event.action == &i_enigmaVCRActions->volumeUp) volumeUp(); else if (event.action == &i_enigmaVCRActions->volumeDown) volumeDown(); else break; return 1; default: break; } return eMessageBox::eventHandler(event); }
void UniversalPlayer::newMediaPlayer( bool video, bool muted ) { if ( m_player ) delete m_player; // Use Qt media player if ( video ) m_player = new QMediaPlayer( 0, QMediaPlayer::VideoSurface ); else m_player = new QMediaPlayer( 0 ); connect( m_player, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(slotError(QMediaPlayer::Error)) ); connect( m_player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(slotMediaStatusChanged(QMediaPlayer::MediaStatus)) ); if ( !muted ) { connect( pActionHandler, SIGNAL(playerVolumeDown()), this, SLOT(volumeDown()) ); connect( pActionHandler, SIGNAL(playerVolumeUp()), this, SLOT(volumeUp()) ); } else m_player->setMuted( true ); }
void parseInput(char s[]) { if( (s[0] <= '7') && ( s[0] >= '1') ) // 7 tunes { startTune(s[0]); } else { // parse first character switch (s[0]) { case '+': volumeUp(); break; case '-': volumeDown(); break; case 's': if( (s[1] == 't') && (s[2] == 'o') && (s[3] == 'p')) stopTune(); break; case 'd': if( (s[1] == 'e') && (s[2] == 'm') && (s[3] == 'o') && (s[4] == '?') ) sendFString(TALKING_TO); sendFString(WHO_DEMO); break; default: sendFString(BAD_COMMAND1); sendChar(s[0]); sendFString(BAD_COMMAND2); break; } s[0] = '\0'; } }
CuteSong::CuteSong(QWidget *parent) : QMainWindow(parent), ui(new Ui::CuteSong) { ui->setupUi(this); ui->tabWidget->setCurrentIndex(0); database.getDatabaseFromFile("QSQLITE","CuteSong.sqlite"); // initialisation du 'lecteur media' audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); mediaObject = new Phonon::MediaObject(this); mediaObject->setTickInterval(1000); connect(mediaObject,SIGNAL(tick(qint64)),this,SLOT(tickOfMediaObject(qint64))); Phonon::createPath(mediaObject, audioOutput); // intialisation de l'afficheur LCD de progression du temps de la musique QTime displayTime(0,0); ui->lcdProgress->display(displayTime.toString("mm:ss")); // affichage du message de binvenue dans la statusBar (en bas) statusBar()->showMessage("Welcome to CuteSong !"); // initialisation du volume ui->volumeSlider->setAudioOutput(audioOutput); ui->volumeSlider->setMuteVisible(true); audioOutput->setVolume(0); // genere la vue makeBddView(); makePlaylistView(); allowPlayControlManager(false); ui->coverLabel->setScaledContents(true); ui->playFilesButton->setEnabled(false); ui->rmButton->setEnabled(false); ui->actionExport_to_PLS->setEnabled(false); currentSong = new Song(); // faire tous les connect connect (mediaObject,SIGNAL(finished()),this,SLOT(songFinished())); connect (ui->actionOuvrir_fichier,SIGNAL(triggered()),this,SLOT(addFile())); connect (ui->actionQuit,SIGNAL(triggered()),this,SLOT(close())); connect (ui->actionAjouter_dossier,SIGNAL(triggered()),this,SLOT(addDirToBdd())); connect (ui->actionAjouter_fichiers,SIGNAL(triggered()),this,SLOT(on_addButton_clicked())); connect (ui->actionSauver_playlist_courante,SIGNAL(triggered()),this,SLOT(popPlaylistDialog())); connect (ui->actionOpen_Directory,SIGNAL(triggered()),this,SLOT(addDirToPlaylist())); connect (ui->actionChange_cover,SIGNAL(triggered()),this,SLOT(on_button_changeCover_clicked())); connect (ui->actionMute,SIGNAL(triggered()),this,SLOT(muteManager())); connect (ui->actionNext,SIGNAL(triggered()),this,SLOT(next())); connect (ui->actionPause,SIGNAL(triggered()),this->mediaObject,SLOT(pause())); connect (ui->actionPlay,SIGNAL(triggered()),this->mediaObject,SLOT(play())); connect (ui->actionPrevious,SIGNAL(triggered()),this,SLOT(previous())); connect (ui->actionStop,SIGNAL(triggered()),this,SLOT(stopStateManager())); connect (ui->actionVolume_Down,SIGNAL(triggered()),this,SLOT(volumeDown())); connect (ui->actionVolume_up,SIGNAL(triggered()),this,SLOT(volumeUp())); connect (ui->actionEdit_song_s_tag,SIGNAL(triggered()),this,SLOT(editCurrentSongTag())); connect (ui->actionExport_to_PLS,SIGNAL(triggered()),this,SLOT(PLSExport())); connect (ui->actionImport_from_PLS,SIGNAL(triggered()),this,SLOT(PLSImport())); }
bool Application::configure() { if ( !QSystemTrayIcon::isSystemTrayAvailable() ) { LOG_ERROR( "application", tr( "No system tray available!" ) ); QMessageBox::critical( 0, tr( "Error" ), tr( "No system tray available!" ) ); return false; } if ( !QSystemTrayIcon::supportsMessages() ) { LOG_ERROR( "application", tr( "System tray not support messages!" ) ); QMessageBox::critical( 0, tr( "Error" ), tr( "System tray not support messages!" ) ); return false; } // Tray icons set. trayIconList.append( ":/images/radio-active-2.png" ); trayIconList.append( ":/images/radio-active-1.png" ); trayIconList.append( ":/images/radio-active.png" ); currTrayIcon = 0; // Setup player. connect( &player, SIGNAL( playerTick( quint64 ) ), SLOT( animateIcon( quint64 ) ) ); connect( &player, SIGNAL( playing() ), SLOT( onPlayerPlay() ) ); connect( &player, SIGNAL( paused() ), SLOT( onPlayerPause() ) ); connect( &player, SIGNAL( stopped() ), SLOT( onPlayerStop() ) ); connect( &player, SIGNAL( errorOccured() ), SLOT( onPlayerError() ) ); connect( &player, SIGNAL( buffering( int ) ), SLOT( onPlayerBuffering( int ) ) ); connect( &player, SIGNAL( volumeChanged( int ) ), SLOT( onPlayerVolumeChanged( int ) ) ); connect( &player, SIGNAL( metaDataChanged( const QMultiMap< QString, QString > ) ), SLOT ( onMetaDataChange( const QMultiMap< QString, QString > ) ) ); // Setup global shortcuts. QxtGlobalShortcut * globalShortcut; globalShortcut = new QxtGlobalShortcut( &trayItem ); if ( globalShortcut ) { globalShortcut->setShortcut( QKeySequence( pauseHotkey ) ); connect( globalShortcut, SIGNAL( activated() ), &player, SLOT( playOrPause() ) ); } globalShortcut = new QxtGlobalShortcut( &trayItem ); if ( globalShortcut ) { globalShortcut->setShortcut( QKeySequence( stopHotkey ) ); connect( globalShortcut, SIGNAL( activated() ), &player, SLOT( stopPlay() ) ); } globalShortcut = new QxtGlobalShortcut( &trayItem ); if ( globalShortcut ) { globalShortcut->setShortcut( QKeySequence( volumeUpHotkey ) ); connect( globalShortcut, SIGNAL( activated() ), &player, SLOT( volumeUp() ) ); } globalShortcut = new QxtGlobalShortcut( &trayItem ); if ( globalShortcut ) { globalShortcut->setShortcut( QKeySequence( volumeDownHotkey ) ); connect( globalShortcut, SIGNAL( activated() ), &player, SLOT( volumeDown() ) ); } globalShortcut = new QxtGlobalShortcut( &trayItem ); if ( globalShortcut ) { globalShortcut->setShortcut( QKeySequence( quitHotkey ) ); connect( globalShortcut, SIGNAL( activated() ), this, SLOT( quit()) ); } // Create stations menu. stationsMenu.setTitle( tr( "Stations" ) ); stationsMenu.setIcon( QIcon( ":/images/radio-passive.png" ) ); stationsGroup = new QActionGroup( &stationsMenu ); if ( stationsGroup ) { stationsGroup->setExclusive( true ); updateStationsMenu(); connect( stationsGroup, SIGNAL( triggered( QAction * ) ), SLOT( processStationAction( QAction * ) ) ); } // Create base menu. trayMenu.addMenu( &stationsMenu ); trayMenu.addSeparator(); QAction * action; action = new QAction( &trayMenu ); if ( action ) { action->setIcon( QIcon( ":/images/audio-volume-up.png" ) ); action->setText( tr( "Volume up" ) ); action->setShortcut( QKeySequence( volumeUpHotkey ) ); connect( action, SIGNAL( triggered() ), &player, SLOT( volumeUp() ) ); trayMenu.addAction( action ); } action = new QAction( &trayMenu ); if ( action ) { action->setIcon( QIcon( ":/images/audio-volume-down.png" ) ); action->setText( tr( "Volume down" ) ); action->setShortcut( QKeySequence( volumeDownHotkey ) ); connect( action, SIGNAL( triggered() ), &player, SLOT( volumeDown() ) ); trayMenu.addAction( action ); } trayMenu.addSeparator(); action = new QAction( &trayMenu ); if ( action ) { action->setIcon( QIcon( ":/images/media-playback-start.png" ) ); action->setText( tr( "Play|Pause" ) ); action->setShortcut( QKeySequence( pauseHotkey ) ); connect( action, SIGNAL( triggered() ), &player, SLOT( playOrPause() ) ); trayMenu.addAction( action ); } action = new QAction( &trayMenu ); if ( action ) { action->setIcon( QIcon( ":/images/media-playback-stop.png" ) ); action->setText( tr( "Stop" ) ); action->setShortcut( QKeySequence( stopHotkey ) ); connect( action, SIGNAL( triggered() ), &player, SLOT( stopPlay() ) ); trayMenu.addAction( action ); } trayMenu.addSeparator(); action = new QAction( &trayMenu ); if ( action ) { action->setIcon( QIcon( ":/images/application-info.png" ) ); action->setText( tr( "Info" ) ); action->setMenuRole( QAction::AboutRole ); connect( action, SIGNAL( triggered() ), this, SLOT( about() ) ); trayMenu.addAction( action ); } action = new QAction( &trayMenu ); if ( action ) { action->setIcon( QIcon( ":/images/application-exit.png" ) ); action->setText( tr( "Exit" ) ); action->setShortcut( QKeySequence( quitHotkey ) ); action->setMenuRole( QAction::QuitRole ); connect( action, SIGNAL( triggered() ), this, SLOT( quit() ) ); trayMenu.addAction( action ); } // Create settings menu. action = new QAction( &trayMenu ); if ( action ) { action->setIcon( QIcon( ":/images/application-settings.png" ) ); action->setText( tr( "Settings" ) ); action->setMenuRole( QAction::PreferencesRole ); connect( action, SIGNAL( triggered() ), this, SLOT( manageSettings() ) ); settingsMenu.addAction( action ); } action = new QAction( &trayMenu ); if ( action ) { action->setIcon( QIcon( ":/images/application-exit.png" ) ); action->setText( tr( "Exit" ) ); action->setShortcut( QKeySequence( quitHotkey ) ); action->setMenuRole( QAction::QuitRole ); connect( action, SIGNAL( triggered() ), this, SLOT( quit() ) ); settingsMenu.addAction( action ); } // Setup tray item. trayItem.setIcon( QIcon( ":/images/radio-passive.png" ) ); trayItem.show(); trayItem.showMessage( tr( "QRadioTray" ), tr( "Program started!" ), QSystemTrayIcon::Information ); connect( &trayItem, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ), SLOT( processTrayActivation( QSystemTrayIcon::ActivationReason ) ) ); return true; }
void event_sdl_keydown(int keysym, int keymod) { /* check for the only 2 hard-coded key commands: Alt-enter for fullscreen and 0-9 for save state slot */ if (keysym == SDLK_RETURN && keymod & (KMOD_LALT | KMOD_RALT)) { changeWindow(); } else if (keysym >= SDLK_0 && keysym <= SDLK_9) { main_state_set_slot(keysym - SDLK_0); } /* check all of the configurable commands */ else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdStop)) main_stop(); else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdFullscreen)) changeWindow(); else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdSave)) main_state_save(0, NULL); /* save in mupen64plus format using current slot */ else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdLoad)) main_state_load(NULL); /* load using current slot */ else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdIncrement)) main_state_inc_slot(); else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdReset)) { add_interupt_event(HW2_INT, 0); /* Hardware 2 Interrupt immediately */ add_interupt_event(NMI_INT, 50000000); /* Non maskable Interrupt after 1/2 second */ } else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdSpeeddown)) main_speeddown(5); else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdSpeedup)) main_speedup(5); else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdScreenshot)) main_take_next_screenshot(); /* screenshot will be taken at the end of frame rendering */ else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdPause)) main_toggle_pause(); else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdMute)) { volumeMute(); main_draw_volume_osd(); } else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdIncrease)) { volumeUp(); main_draw_volume_osd(); } else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdDecrease)) { volumeDown(); main_draw_volume_osd(); } else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdForward)) { main_set_fastforward(1); } else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdAdvance)) { main_advance_one(); } else if (keysym == ConfigGetParamInt(g_CoreConfig, kbdGameshark)) { KbdGamesharkPressed = 1; } else { /* pass all other keypresses to the input plugin */ keyDown(keymod, keysym); } }
/********************************************************************************************************* * sdl event filter */ static int event_sdl_filter(const SDL_Event *event) { int cmd, action; switch(event->type) { // user clicked on window close button case SDL_QUIT: main_stop(); break; case SDL_KEYDOWN: event_sdl_keydown(event->key.keysym.sym, event->key.keysym.mod); return 0; case SDL_KEYUP: event_sdl_keyup(event->key.keysym.sym, event->key.keysym.mod); return 0; // if joystick action is detected, check if it's mapped to a special function case SDL_JOYAXISMOTION: case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONUP: case SDL_JOYHATMOTION: for (cmd = 0; cmd < NumJoyCommands; cmd++) { action = MatchJoyCommand(event, (eJoyCommand) cmd); if (action == 1) /* command was just activated (button down, etc) */ { if (cmd == joyFullscreen) changeWindow(); else if (cmd == joyStop) main_stop(); else if (cmd == joyPause) main_toggle_pause(); else if (cmd == joySave) main_state_save(0, NULL); /* save in mupen64plus format using current slot */ else if (cmd == joyLoad) main_state_load(NULL); /* load using current slot */ else if (cmd == joyIncrement) main_state_inc_slot(); else if (cmd == joyScreenshot) main_take_next_screenshot(); else if (cmd == joyMute) { volumeMute(); main_draw_volume_osd(); } else if (cmd == joyDecrease) { volumeDown(); main_draw_volume_osd(); } else if (cmd == joyIncrease) { volumeUp(); main_draw_volume_osd(); } else if (cmd == joyForward) main_set_fastforward(1); } else if (action == -1) /* command was just de-activated (button up, etc) */ { if (cmd == joyForward) main_set_fastforward(0); } } return 0; break; } return 1; }
FramelessMainWindow::FramelessMainWindow( QWidget *parent ) : QMainWindow( parent ), m_scene( new QGraphicsScene( this ) ), m_browser( new GraphicsBrowser( m_scene, *this ) ), m_mouseFilter( *this, *qApp ), m_video( new EventfulVidgetVideo( this ) ), m_intro( new QGraphicsScene ), m_control( new VideoControl( this ) ), m_closeControl( new QFrame( this ) ), m_hostApp( new HostApp( m_browser->webView(), this ) ) { m_video->hide(); m_control->hide(); m_browser->webView()->page()->settings()->setAttribute( QWebSettings::JavascriptCanOpenWindows, true ); m_control->setVolume( m_hostApp->getVolume() ); m_closeControl->hide(); m_closeControl->setStyleSheet( "QFrame{background-color:black; } " "QPushButton { background-image: url(':/close-styled'); width:31;} " "QWidget{border:none; padding:0; spacing:0; height:30;}" ); QHBoxLayout *hl = new QHBoxLayout( m_closeControl ); hl->setContentsMargins( QMargins() ); hl->addSpacerItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ) ); m_closeButton = new QPushButton(); m_closeButton->setCursor( Qt::PointingHandCursor ); // btn->setFlat( true ); hl->addWidget( m_closeButton ); connect( m_control, SIGNAL( uiShow() ), m_closeButton, SLOT( show() ) ); connect( m_control, SIGNAL( uiHide() ), m_closeButton, SLOT( hide() ) ); setWindowTitle( "Popcorn Time" ); m_intro->addPixmap( QPixmap( ":/intro" ).scaled( DEFAULT_WIDTH, DEFAULT_HEIGHT, Qt::IgnoreAspectRatio ) ); m_browser->setScene( m_intro ); new QShortcut( QKeySequence( "Ctrl+M" ), this, SLOT( minimize() ) ); QObject::connect( m_hostApp->thread(), SIGNAL( torrentUrlAvailable( QString ) ), this, SLOT( playMedia( QString ) ) ); QObject::connect( m_browser->webView(), SIGNAL( loadFinished( bool ) ), this, SLOT( removeIntro() ) ); QObject::connect( m_hostApp, SIGNAL( commandedClose() ), this, SLOT( close() ) ); QObject::connect( m_hostApp, SIGNAL( commandedMinimize() ), this, SLOT( minimize() ) ); QObject::connect( m_hostApp, SIGNAL( toggledMaximize() ), this, SLOT( toggleMaximize() ) ); QObject::connect( m_hostApp, SIGNAL( haveSubtitles( SubtitleItem ) ), m_control, SLOT( addSubtitle( SubtitleItem ) ) ); QObject::connect( m_hostApp, SIGNAL( downloadInfoChanged( DownloadInfo ) ), m_control, SLOT( updateDownloadStatus( DownloadInfo ) ) ); QObject::connect( m_control, SIGNAL( volumeChanged( int ) ), m_hostApp, SLOT( setVolume( int ) ) ); QObject::connect( m_control, SIGNAL( newImage( QString ) ), m_video, SLOT( setImage( QString ) ) ); QObject::connect( m_control->fullscreenButton(), SIGNAL( clicked() ), this, SLOT( toggleMaximize() ) ); QObject::connect( &m_mouseFilter, SIGNAL( enterPressed() ), this, SLOT( toggleMaximize() ) ); QObject::connect( &m_mouseFilter, SIGNAL( upPressed() ), m_control, SLOT( volumeUp() ) ); QObject::connect( &m_mouseFilter, SIGNAL( downPressed() ), m_control, SLOT( volumeDown() ) ); QObject::connect( &m_mouseFilter, SIGNAL( pausePressed() ), m_control, SLOT( pauseToggleReq() ) ); connect( m_video, SIGNAL( mouseEnter() ), m_control, SLOT( showForDefaultPeriod() ) ); this->setWindowFlags( Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint ); #ifdef Q_OS_MAC fixNativeWindow( this ); #endif this->setMinimumSize( 800, 330 ); this->setMouseTracking( true ); this->setCentralWidget( m_browser ); qApp->installEventFilter( this ); reconnectMediaPlayer(); QObject::connect( VLC::VLCObject(), SIGNAL( mediaPlayerReplaced() ), this, SLOT( reconnectMediaPlayer() ) ); }
void MediaControl::reparseConfig() { // kdDebug(90200) << "reparseConfig();" << endl; _configFrontend->reparseConfiguration(); if (_player != 0L) // make sure there is no player-object { _player->disconnect(); // disconnect from all things time_slider->disconnect(); prev_button->disconnect(); playpause_button->disconnect(); stop_button->disconnect(); next_button->disconnect(); delete slider_tooltip; // tooltip depends on _player : delete it before _player gets deleted slider_tooltip = 0L; delete _player; _player = 0L; } mLastLen = -1; mLastTime = -1; mLastStatus = -1; QString playerString = _configFrontend->player(); #ifdef HAVE_XMMS if (playerString == "XMMS") { _player = new XmmsInterface (); time_slider->setSteps((_configFrontend->mouseWheelSpeed()*1000), (_configFrontend->mouseWheelSpeed()*1000)); } else #endif if (playerString == "JuK") { _player = new JuKInterface(); time_slider->setSteps((_configFrontend->mouseWheelSpeed()), (_configFrontend->mouseWheelSpeed())); } else if (playerString == "Amarok") { _player = new AmarokInterface(); time_slider->setSteps((_configFrontend->mouseWheelSpeed()), (_configFrontend->mouseWheelSpeed())); } else if (playerString == "KsCD") { _player = new KsCDInterface(); time_slider->setSteps((_configFrontend->mouseWheelSpeed()), (_configFrontend->mouseWheelSpeed())); } else if (playerString == "mpd") { _player = new MpdInterface(); time_slider->setSteps((_configFrontend->mouseWheelSpeed()), (_configFrontend->mouseWheelSpeed())); } else // Fallback is Noatun { _player = new NoatunInterface(); time_slider->setSteps((_configFrontend->mouseWheelSpeed()), (_configFrontend->mouseWheelSpeed())); } // this signal gets emitted by a playerInterface when the player's playtime changed connect(_player, SIGNAL(newSliderPosition(int,int)), this, SLOT(setSliderPosition(int,int))); connect(_player, SIGNAL(playerStarted()), SLOT(enableAll())); connect(_player, SIGNAL(playerStopped()), SLOT(disableAll())); connect(_player, SIGNAL(playingStatusChanged(int)), SLOT(slotPlayingStatusChanged(int))); // do we use our icons or the default ones from KDE? if(_configFrontend->useCustomTheme()) { // load theme QString skindir = locate("data", "mediacontrol/"+_configFrontend->theme()+"/"); // the user has to take care if all pixmaps are there, we only check for one of them if (QFile(skindir+"play.png").exists()) { prev_button->setIconSet(SmallIconSet(locate("data",skindir+"prev.png"))); if (_player->playingStatus() == PlayerInterface::Playing) playpause_button->setIconSet(SmallIconSet(locate("data",skindir+"play.png"))); else playpause_button->setIconSet(SmallIconSet(locate("data",skindir+"pause.png"))); stop_button->setIconSet(SmallIconSet(locate("data",skindir+"stop.png"))); next_button->setIconSet(SmallIconSet(locate("data",skindir+"next.png"))); } else // icon-theme is invalid or not there { KNotifyClient::event(winId(), KNotifyClient::warning, i18n("There was trouble loading theme %1. Please choose" \ " a different theme.").arg(skindir)); // default to kde-icons, they have to be installed :) slotIconChanged(); // and open prefs-dialog preferences(); } } else // KDE default-icons, assuming that these icons exist! { // sets icons from kde slotIconChanged(); } slider_tooltip = new MediaControlToolTip(time_slider, _player); connect(prev_button, SIGNAL(clicked()), _player, SLOT(prev())); connect(playpause_button, SIGNAL(clicked()), _player, SLOT(playpause())); connect(stop_button, SIGNAL(clicked()), _player, SLOT(stop())); connect(next_button, SIGNAL(clicked()), _player, SLOT(next())); connect(time_slider, SIGNAL(sliderPressed()), _player, SLOT(sliderStartDrag())); connect(time_slider, SIGNAL(sliderReleased()), _player, SLOT(sliderStopDrag())); connect(time_slider, SIGNAL(valueChanged(int)), this, SLOT(adjustTime(int))); connect(time_slider, SIGNAL(volumeUp()), _player, SLOT(volumeUp())); connect(time_slider, SIGNAL(volumeDown()), _player, SLOT(volumeDown())); connect(this, SIGNAL(newJumpToTime(int)), _player, SLOT(jumpToTime(int))); }
void lircCheckInput(void) { struct pollfd lircpoll; lircpoll.fd = g_lircfd; lircpoll.events = POLLIN; if(poll(&lircpoll, 1, 0) > 0) { char *code; char *c; int ret; if(lirc_nextcode(&code) == 0 && code != NULL) { while((ret = lirc_code2char(g_config, code, &c)) == 0 && c!=NULL) { char *c_ind = c; while(*c_ind != '\0') { *c_ind = toupper(*c_ind); c_ind++; } DebugMessage(M64MSG_VERBOSE, "LIRC Execing command \"%s\"", c); if(strcmp(c, "SAVE") == 0) savestates_job |= SAVESTATE; else if(strcmp(c, "LOAD") == 0) savestates_job |= LOADSTATE; else if(strcmp(c, "QUIT") == 0) main_stop(); else if(strcmp(c, "FULLSCREEN") == 0) changeWindow(); else if(strcmp(c, "MUTE") == 0) { volumeMute(); main_draw_volume_osd(); } else if(strcmp(c, "VOL+") == 0) { volumeUp(); main_draw_volume_osd(); } else if(strcmp(c, "VOL-") == 0) { volumeDown(); main_draw_volume_osd(); } else if(strcmp(c, "SCREENSHOT") == 0) main_take_next_screenshot(); else if(strcmp(c, "SPEED+") == 0) main_speedup(5); else if(strcmp(c, "SPEED-") == 0) main_speeddown(5); else if(strcmp(c, "ADVANCE") == 0) main_advance_one(); else if(strcmp(c, "PAUSE") == 0) main_toggle_pause(); else { int val = ((int)c[0])-((int) '0'); if (val >= 0 && val <= 9) savestates_select_slot( val ); } } free(code); } } }
int main(void) { struct _tm timeCheck; WatchDogDisable(); NutDelay(100); SysInitIO(); SPIinit(); LedInit(); LcdLowLevelInit(); Uart0DriverInit(); Uart0DriverStart(); LogInit(); X12Init(); VsPlayerInit(); NtpInit(); NutThreadCreate("BackgroundThread", StartupInit, NULL, 1024); NutThreadCreate("BackgroundThread", AlarmSync, NULL, 2500); NutThreadCreate("BackgroundThread", AlarmCheck, NULL, 256); KbInit(); SysControlMainBeat(ON); // enable 4.4 msecs heartbeat interrupt /* * Increase our priority so we can feed the watchdog. */ NutThreadSetPriority(1); /* Enable global interrupts */ sei(); LcdBackLight(LCD_BACKLIGHT_ON); setCurrentDisplay(DISPLAY_DateTime, 5); X12RtcGetClock(&timeCheck); int hours; int mins; int secs; if(!NutNvMemLoad(100, &hours, sizeof(hours))) { printf("uren: %d", hours); } if(!NutNvMemLoad(105, &mins, sizeof(mins))) { printf(" minuten: %d", mins); } if(!NutNvMemLoad(110, &secs, sizeof(secs))) { printf(" seconden %d", secs); } printf("Welcome to Saltyradio.\nI'm using mac address: %s\n\n\n", getMacAdress()); for (;;) { //Key detecten if(KbGetKey() == KEY_01){ setCurrentDisplay(DISPLAY_DateTime, 5); } else if(KbGetKey() == KEY_OK) { if(getCurrentDisplay() == DISPLAY_MainMenu) { clickOk(); } else if(getCurrentDisplay() == DISPLAY_SettingsMenu) { clickOkSettings(); } else if(getCurrentDisplay() == DISPLAY_Play || getCurrentDisplay() == DISPLAY_Song) { clickOkPlay(); } else { setCurrentDisplay(DISPLAY_MainMenu, 10000); } } else if(KbGetKey() == KEY_LEFT) { switchLeft(); } else if(KbGetKey() == KEY_RIGHT) { switchItem(); } else if(KbGetKey() == KEY_DOWN){ setCurrentDisplay(DISPLAY_Volume, 5); volumeDown(); }else if(KbGetKey() == KEY_UP) { setCurrentDisplay(DISPLAY_Volume, 5); volumeUp(); } refreshScreen(); WatchDogRestart(); NutSleep(100); } return(0); }