bool VideoWidget::change_video(bool next) { if(next)//next video { if(queue.size()==0)return false; //only one video current_play++; current_play%=queue.size(); m_MediaObject.setCurrentSource(queue[current_play]); m_MediaObject.play(); } else// prev video { if(!playing) { current_play--; current_play%=queue.size(); m_MediaObject.setCurrentSource(queue[current_play]); m_MediaObject.play(); playpause(); } else { m_MediaObject.seek(0); m_MediaObject.pause(); playpause(); } } return true; }
Boolean MCPlayer::playstart(MCStringRef options) { if (!prepare(options)) return False; playpause(False); return True; }
DVDPanel::DVDPanel(QWidget *parent) : Panel(parent) { connect( buttons[PLAY], SIGNAL(clicked()), this, SLOT(playpause()) ); connect( buttons[STOP], SIGNAL(clicked()), this, SLOT(stop()) ); connect( buttons[EXIT], SIGNAL(clicked()), parent, SLOT(lower()) ); }
void Browser::keyPressEvent(QKeyEvent * event) { switch ( event->key() ) { case Qt::Key_K: /* next */ nextpage(); break; case Qt::Key_J: /* previous */ previouspage(); break; case Qt::Key_Q: /* quit - just for test */ //save(); close(); break; case Qt::Key_R: /* Reload config file - just for test */ reload(); break; case Qt::Key_P: playpause(); break; case Qt::Key_T: /* just for debug */ test(); break; default: // n'importe quelle autre touche std::cout << "UNDEF KEY" << std::endl; break; } }
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())); }
Boolean MCPlayer::mdown(uint2 which) { if (state & CS_MFOCUSED || flags & F_DISABLED) return False; if (state & CS_MENU_ATTACHED) return MCObject::mdown(which); state |= CS_MFOCUSED; if (flags & F_TRAVERSAL_ON && !(state & CS_KFOCUSED)) getstack()->kfocusset(this); switch (which) { case Button1: switch (getstack()->gettool(this)) { case T_BROWSE: if (message_with_valueref_args(MCM_mouse_down, MCSTR("1")) == ES_NORMAL) return True; break; case T_POINTER: case T_PLAYER: //when the movie object is in editing mode start(True); //starting draggin or resizing playpause(True); //pause the movie break; case T_HELP: break; default: return False; } break; case Button2: if (message_with_valueref_args(MCM_mouse_down, MCSTR("2")) == ES_NORMAL) return True; break; case Button3: message_with_valueref_args(MCM_mouse_down, MCSTR("3")); break; } return True; }
void keyb(unsigned char key, int x, int y) { switch(key) { case 27: exit(0); case 's': stereo = !stereo; break; case 'b': use_bump = !use_bump; break; case '`': { int xsz = glutGet(GLUT_WINDOW_WIDTH); int ysz = glutGet(GLUT_WINDOW_HEIGHT); glutReshapeWindow(ysz, xsz); } break; case ' ': playpause(); break; case '.': seektime(50); break; case '>': seektime(10); break; case ']': seektime(1); break; case ',': seektime(-50); break; case '<': seektime(-10); break; case '[': seektime(-1); break; case '1': glutReshapeWindow(960, 640); /* 3.5 inch iphone */ break; case '2': glutReshapeWindow(1136, 640); /* 4.0 inch iphone */ break; case '3': glutReshapeWindow(1334, 750); /* 4.7 inch iphone */ break; case '4': glutReshapeWindow(2208, 1242); /* 5.5 inch iphone */ break; case '5': glutReshapeWindow(2048, 1496); /* ipad2? */ break; case '9': glutReshapeWindow(1104, 621); /* hald 5.5 inch iphone */ break; case '0': glutReshapeWindow(1024, 748); /* half ipad2 */ break; default: break; } }
void SimpleUI::setupCentralWidget() { QVBox *npWidget = new QVBox( this ); npWidget->setMargin( 0 ); npWidget->setSpacing( 0 ); positionLabel = new QLabel( statusBar() ); positionLabel->setAlignment( AlignVCenter | AlignCenter ); positionLabel->setFixedSize( fontMetrics().size( 0, " 00:00/00:00 " ) ); statusBar()->addWidget( positionLabel, 0, true ); video = new VideoFrame( npWidget ); connect( video, SIGNAL(adaptSize(int,int)), SLOT(slotAdaptSize(int,int)) ); connect( video, SIGNAL(rightButtonPressed(const QPoint &)), SLOT(slotContextMenu(const QPoint &)) ); QHBox *ctlFrame = new QHBox( npWidget ); ctlFrame->setFixedHeight( 38 ); ctlFrame->setFrameShape( QFrame::StyledPanel ); ctlFrame->setFrameShadow( QFrame::Raised ); ctlFrame->setMargin( 6 ); ctlFrame->setSpacing( 6 ); QPushButton *backButton = new QPushButton( ctlFrame ); backButton->setFixedSize( 24, 24 ); backButton->setPixmap( QPixmap( back_xpm ) ); QToolTip::add( backButton, i18n("Back") ); connect( backButton, SIGNAL(clicked()), napp->player(), SLOT(back()) ); stopButton = new QPushButton( ctlFrame ); stopButton->setFixedSize( 24, 24 ); stopButton->setPixmap( QPixmap( stop_xpm ) ); QToolTip::add( stopButton, i18n("Stop") ); connect( stopButton, SIGNAL(clicked()), napp->player(), SLOT(stop()) ); playButton = new QPushButton( ctlFrame ); playButton->setFixedSize( 24, 24 ); playButton->setPixmap( QPixmap( play_xpm ) ); QToolTip::add( playButton, i18n("Play / Pause") ); connect( playButton, SIGNAL(clicked()), napp->player(), SLOT(playpause()) ); QPushButton *forwButton = new QPushButton( ctlFrame ); forwButton->setFixedSize( 24, 24 ); forwButton->setPixmap( QPixmap( forward_xpm ) ); QToolTip::add( forwButton, i18n("Forward") ); connect( forwButton, SIGNAL(clicked()), napp->player(), SLOT(forward()) ); slider = new L33tSlider( 0, 1000, 10, 0, L33tSlider::Horizontal, ctlFrame ); slider->setFixedHeight( 24 ); slider->setMinimumWidth( 100 ); slider->setTickmarks( QSlider::NoMarks ); connect( slider, SIGNAL(userChanged(int)), SLOT(slotSkipTo(int)) ); connect( slider, SIGNAL(sliderMoved(int)), SLOT(slotSliderMoved(int)) ); QPushButton *playlistButton = new QPushButton( ctlFrame ); playlistButton->setFixedSize( 24, 24 ); playlistButton->setPixmap( QPixmap( playlist_xpm ) ); QToolTip::add( playlistButton, i18n("Playlist") ); connect( playlistButton, SIGNAL(clicked()), napp->player(), SLOT(toggleListView()) ); volumeButton = new QPushButton( ctlFrame ); volumeButton->setFixedSize( 24, 24 ); volumeButton->setPixmap( QPixmap( volume_xpm ) ); QToolTip::add( volumeButton, i18n("Volume") ); volumeFrame = new QVBox( this, "Volume", WStyle_Customize | WType_Popup ); volumeFrame->setFrameStyle( QFrame::PopupPanel ); volumeFrame->setMargin( 4 ); volumeLabel = new QLabel( volumeFrame ); volumeLabel->setText( "100%" ); volumeLabel->setAlignment( AlignCenter ); volumeLabel->setFixedSize( volumeLabel->sizeHint() ); QHBox *volumeSubFrame = new QHBox( volumeFrame ); volumeSlider = new L33tSlider( 0, 100, 10, 0, Vertical, volumeSubFrame ); volumeSlider->setValue( 100 - napp->player()->volume() ); volumeSlider->setFixedSize( volumeSlider->sizeHint() ); volumeFrame->resize( volumeFrame->sizeHint() ); connect( volumeSlider, SIGNAL(sliderMoved(int)), SLOT(slotVolumeSliderMoved(int)) ); connect( volumeSlider, SIGNAL(userChanged(int)), SLOT(slotVolumeSliderMoved(int)) ); connect( volumeButton, SIGNAL(clicked()), SLOT(slotVolumeFrame()) ); setCentralWidget( npWidget ); video->setMinimumSize( minimumSizeHint().width(), 1 ); // Create properties dialog propertiesDialog = new PropertiesDialog( this ); propertiesDialog->resize( 375, 285 ); }
void VideoWidget::on_button_play2_clicked() { playpause(); }
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))); }