void trackManager::update(){ float timer = ofGetElapsedTimeMillis() - startTime; if(timer >= endTime && !bTimerReached) { bTimerReached = true; currentItem++; if(currentItem<track.size()){ playItem(currentItem); } else { ofMessage msg("end"); ofSendMessage(msg); } } }
int PlayListWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QTreeWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: playListEmpty(); break; case 1: playItem((*reinterpret_cast< PlayListItem*(*)>(_a[1]))); break; case 2: addFile((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 3: addFile((*reinterpret_cast< QString(*)>(_a[1]))); break; case 4: addFile((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QMap<QString,QString>(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; case 5: addFile((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QMap<QString,QString>(*)>(_a[2]))); break; case 6: { int _r = addDir((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 7: { int _r = addDir((*reinterpret_cast< QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 8: removeSelected(); break; case 9: doubleClicked((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 10: scrollToActive(); break; case 11: deselect((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 12: clearPlayList(); break; case 13: { int _r = loadM3UPlayList((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 14: { int _r = loadM3UPlayList((*reinterpret_cast< QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 15: { int _r = loadPLSPlayList((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 16: { int _r = loadPLSPlayList((*reinterpret_cast< QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 17: saveM3UPlayList((*reinterpret_cast< QString(*)>(_a[1]))); break; case 18: savePLSPlayList((*reinterpret_cast< QString(*)>(_a[1]))); break; case 19: updateColumnWidth((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; case 20: updateColumnPosition((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; case 21: headerContextMenu((*reinterpret_cast< const QPoint(*)>(_a[1]))); break; case 22: setScroll(); break; case 23: hideSection(); break; case 24: showSection(); break; case 25: printPos((*reinterpret_cast< int(*)>(_a[1]))); break; default: ; } _id -= 26; } return _id; }
//------------------------------------------------------------------------- void MainWindow::createActions() { mSettings.mDesactiveUIElements << ADD_FROM_FILE_ACT; GraphicsSceneMainWindow::createActions(); mExportAct = new QAction(QIcon(RSC_DIR + QString("export.png")), tr("&Export...") , this); mExportAct->setShortcut( tr("Ctrl+E") ); mExportAct->setStatusTip(tr("Export the scene, an item, or use Shift+Drag&Drop to specify an export-window")); connect(mExportAct , SIGNAL(triggered()) , this , SLOT(exportToImage()) ); mAddTextAct = new QAction(QIcon(RSC_DIR + QString("addText.png")), tr("Add text item") , this); mAddTextAct->setStatusTip(tr("Add a text item to the scene")); connect(mAddTextAct , SIGNAL(triggered()) , this , SLOT(addTextItem()) ); mAddFromAnyFileAct = new QAction(QIcon(RSC_DIR + QString("addFromAnyFile.png")), tr("Add item from file...") , this); mAddFromAnyFileAct->setStatusTip("Add a new item from a file"); connect(mAddFromAnyFileAct , SIGNAL(triggered()) , this , SLOT(addItemFromAnyFile()) ); mSetPageA4PortraitAct = new QAction(tr("A4 Portrait") , this); connect(mSetPageA4PortraitAct , SIGNAL(triggered()) , this , SLOT(setPageA4Portrait()) ); mSetPageA3PortraitAct = new QAction(tr("A3 Portrait") , this); connect(mSetPageA3PortraitAct , SIGNAL(triggered()) , this , SLOT(setPageA3Portrait()) ); mSetPageA4LandscapeAct = new QAction(tr("A4 Landscape") , this); connect(mSetPageA4LandscapeAct , SIGNAL(triggered()) , this , SLOT(setPageA4Landscape()) ); mSetPageA3LandscapeAct = new QAction(tr("A3 Landscape") , this); connect(mSetPageA3LandscapeAct , SIGNAL(triggered()) , this , SLOT(setPageA3Landscape()) ); #ifdef USES_GUIDO_AR mPlayAct = new QAction(style()->standardIcon(QStyle::SP_MediaPlay), tr("Play"), this); mPlayAct->setStatusTip(tr("Play selected item")); connect( mPlayAct , SIGNAL(triggered()) , this , SLOT(playItem()) ); mPauseAct = new QAction(style()->standardIcon(QStyle::SP_MediaPause), tr("Pause"), this); mPauseAct->setStatusTip(tr("Pause selected item")); connect( mPauseAct , SIGNAL(triggered()) , this , SLOT(pauseItem()) ); mStopAct = new QAction(style()->standardIcon(QStyle::SP_MediaStop), tr("Stop"), this); mStopAct->setStatusTip(tr("Stop selected item")); connect( mStopAct , SIGNAL(triggered()) , this , SLOT(stopItem()) ); #endif }
/*! \brief Control player. * \param params The parameters * \details params[0] = Control to execute. * params[1] = "notify" to notify user (optional, certain controls). */ static int PlayerControl(const std::vector<std::string>& params) { g_application.ResetScreenSaver(); g_application.WakeUpScreenSaverAndDPMS(); std::string paramlow(params[0]); StringUtils::ToLower(paramlow); if (paramlow == "play") { // play/pause // either resume playing, or pause if (g_application.GetAppPlayer().IsPlaying()) { if (g_application.GetAppPlayer().GetPlaySpeed() != 1) g_application.GetAppPlayer().SetPlaySpeed(1); else g_application.GetAppPlayer().Pause(); } } else if (paramlow == "stop") { g_application.StopPlaying(); } else if (StringUtils::StartsWithNoCase(params[0], "frameadvance")) { std::string strFrames; if (params[0].size() == 12) CLog::Log(LOGERROR, "PlayerControl(frameadvance(n)) called with no argument"); else if (params[0].size() < 15) // arg must be at least "(N)" CLog::Log(LOGERROR, "PlayerControl(frameadvance(n)) called with invalid argument: \"%s\"", params[0].substr(13).c_str()); else strFrames = params[0].substr(13); StringUtils::TrimRight(strFrames, ")"); float frames = (float) atof(strFrames.c_str()); g_application.GetAppPlayer().FrameAdvance(frames); } else if (paramlow =="rewind" || paramlow == "forward") { if (g_application.GetAppPlayer().IsPlaying() && !g_application.GetAppPlayer().IsPaused()) { float playSpeed = g_application.GetAppPlayer().GetPlaySpeed(); if (paramlow == "rewind" && playSpeed == 1) // Enables Rewinding playSpeed *= -2; else if (paramlow == "rewind" && playSpeed > 1) //goes down a notch if you're FFing playSpeed /= 2; else if (paramlow == "forward" && playSpeed < 1) //goes up a notch if you're RWing { playSpeed /= 2; if (playSpeed == -1) playSpeed = 1; } else playSpeed *= 2; if (playSpeed > 32 || playSpeed < -32) playSpeed = 1; g_application.GetAppPlayer().SetPlaySpeed(playSpeed); } } else if (paramlow =="tempoup" || paramlow == "tempodown") { if (g_application.GetAppPlayer().SupportsTempo() && g_application.GetAppPlayer().IsPlaying() && !g_application.GetAppPlayer().IsPaused()) { float playTempo = g_application.GetAppPlayer().GetPlayTempo(); if (paramlow == "tempodown") playTempo -= 0.1f; else if (paramlow == "tempoup") playTempo += 0.1f; g_application.GetAppPlayer().SetTempo(playTempo); } } else if (paramlow == "next") { g_application.OnAction(CAction(ACTION_NEXT_ITEM)); } else if (paramlow == "previous") { g_application.OnAction(CAction(ACTION_PREV_ITEM)); } else if (paramlow == "bigskipbackward") { if (g_application.GetAppPlayer().IsPlaying()) g_application.GetAppPlayer().Seek(false, true); } else if (paramlow == "bigskipforward") { if (g_application.GetAppPlayer().IsPlaying()) g_application.GetAppPlayer().Seek(true, true); } else if (paramlow == "smallskipbackward") { if (g_application.GetAppPlayer().IsPlaying()) g_application.GetAppPlayer().Seek(false, false); } else if (paramlow == "smallskipforward") { if (g_application.GetAppPlayer().IsPlaying()) g_application.GetAppPlayer().Seek(true, false); } else if (StringUtils::StartsWithNoCase(params[0], "seekpercentage")) { std::string offset; if (params[0].size() == 14) CLog::Log(LOGERROR,"PlayerControl(seekpercentage(n)) called with no argument"); else if (params[0].size() < 17) // arg must be at least "(N)" CLog::Log(LOGERROR,"PlayerControl(seekpercentage(n)) called with invalid argument: \"%s\"", params[0].substr(14).c_str()); else { // Don't bother checking the argument: an invalid arg will do seek(0) offset = params[0].substr(15); StringUtils::TrimRight(offset, ")"); float offsetpercent = (float) atof(offset.c_str()); if (offsetpercent < 0 || offsetpercent > 100) CLog::Log(LOGERROR,"PlayerControl(seekpercentage(n)) argument, %f, must be 0-100", offsetpercent); else if (g_application.GetAppPlayer().IsPlaying()) g_application.SeekPercentage(offsetpercent); } } else if (paramlow == "showvideomenu") { if( g_application.GetAppPlayer().IsPlaying() ) g_application.GetAppPlayer().OnAction(CAction(ACTION_SHOW_VIDEOMENU)); } else if (StringUtils::StartsWithNoCase(params[0], "partymode")) { std::string strXspPath; //empty param=music, "music"=music, "video"=video, else xsp path PartyModeContext context = PARTYMODECONTEXT_MUSIC; if (params[0].size() > 9) { if (params[0].size() == 16 && StringUtils::EndsWithNoCase(params[0], "video)")) context = PARTYMODECONTEXT_VIDEO; else if (params[0].size() != 16 || !StringUtils::EndsWithNoCase(params[0], "music)")) { strXspPath = params[0].substr(10); StringUtils::TrimRight(strXspPath, ")"); context = PARTYMODECONTEXT_UNKNOWN; } } if (g_partyModeManager.IsEnabled()) g_partyModeManager.Disable(); else g_partyModeManager.Enable(context, strXspPath); } else if (paramlow == "random" || paramlow == "randomoff" || paramlow == "randomon") { // get current playlist int iPlaylist = CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist(); // reverse the current setting bool shuffled = CServiceBroker::GetPlaylistPlayer().IsShuffled(iPlaylist); if ((shuffled && paramlow == "randomon") || (!shuffled && paramlow == "randomoff")) return 0; // check to see if we should notify the user bool notify = (params.size() == 2 && StringUtils::EqualsNoCase(params[1], "notify")); CServiceBroker::GetPlaylistPlayer().SetShuffle(iPlaylist, !shuffled, notify); // save settings for now playing windows switch (iPlaylist) { case PLAYLIST_MUSIC: CMediaSettings::GetInstance().SetMusicPlaylistShuffled(CServiceBroker::GetPlaylistPlayer().IsShuffled(iPlaylist)); CServiceBroker::GetSettings().Save(); break; case PLAYLIST_VIDEO: CMediaSettings::GetInstance().SetVideoPlaylistShuffled(CServiceBroker::GetPlaylistPlayer().IsShuffled(iPlaylist)); CServiceBroker::GetSettings().Save(); default: break; } // send message CGUIMessage msg(GUI_MSG_PLAYLISTPLAYER_RANDOM, 0, 0, iPlaylist, CServiceBroker::GetPlaylistPlayer().IsShuffled(iPlaylist)); CServiceBroker::GetGUI()->GetWindowManager().SendThreadMessage(msg); } else if (StringUtils::StartsWithNoCase(params[0], "repeat")) { // get current playlist int iPlaylist = CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist(); PLAYLIST::REPEAT_STATE previous_state = CServiceBroker::GetPlaylistPlayer().GetRepeat(iPlaylist); std::string paramlow(params[0]); StringUtils::ToLower(paramlow); PLAYLIST::REPEAT_STATE state; if (paramlow == "repeatall") state = PLAYLIST::REPEAT_ALL; else if (paramlow == "repeatone") state = PLAYLIST::REPEAT_ONE; else if (paramlow == "repeatoff") state = PLAYLIST::REPEAT_NONE; else if (previous_state == PLAYLIST::REPEAT_NONE) state = PLAYLIST::REPEAT_ALL; else if (previous_state == PLAYLIST::REPEAT_ALL) state = PLAYLIST::REPEAT_ONE; else state = PLAYLIST::REPEAT_NONE; if (state == previous_state) return 0; // check to see if we should notify the user bool notify = (params.size() == 2 && StringUtils::EqualsNoCase(params[1], "notify")); CServiceBroker::GetPlaylistPlayer().SetRepeat(iPlaylist, state, notify); // save settings for now playing windows switch (iPlaylist) { case PLAYLIST_MUSIC: CMediaSettings::GetInstance().SetMusicPlaylistRepeat(state == PLAYLIST::REPEAT_ALL); CServiceBroker::GetSettings().Save(); break; case PLAYLIST_VIDEO: CMediaSettings::GetInstance().SetVideoPlaylistRepeat(state == PLAYLIST::REPEAT_ALL); CServiceBroker::GetSettings().Save(); } // send messages so now playing window can get updated CGUIMessage msg(GUI_MSG_PLAYLISTPLAYER_REPEAT, 0, 0, iPlaylist, (int)state); CServiceBroker::GetGUI()->GetWindowManager().SendThreadMessage(msg); } else if (StringUtils::StartsWithNoCase(params[0], "resumelivetv")) { CFileItem& fileItem(g_application.CurrentFileItem()); PVR::CPVRChannelPtr channel = fileItem.HasPVRRecordingInfoTag() ? fileItem.GetPVRRecordingInfoTag()->Channel() : PVR::CPVRChannelPtr(); if (channel) { CFileItem playItem(channel); if (!g_application.PlayMedia(playItem, "", channel->IsRadio() ? PLAYLIST_MUSIC : PLAYLIST_VIDEO)) { CLog::Log(LOGERROR, "ResumeLiveTv could not play channel: %s", channel->ChannelName().c_str()); return false; } } } else if (paramlow == "reset") { g_application.OnAction(CAction(ACTION_PLAYER_RESET)); } return 0; }