From 4ad1526dc8448d6e379cdc92836d797a977b5e20 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Tue, 20 Aug 2013 17:25:34 +0000 Subject: enabled PlayListOption plugin git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@3631 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/CommandLineOptions/CMakeLists.txt | 2 +- src/plugins/CommandLineOptions/CommandLineOptions.pro | 4 ++-- .../CommandLineOptions/PlayListOption/playlistoption.cpp | 11 +++++++---- 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/CommandLineOptions/CMakeLists.txt b/src/plugins/CommandLineOptions/CMakeLists.txt index 5fcde7b7f..51aae5fdb 100644 --- a/src/plugins/CommandLineOptions/CMakeLists.txt +++ b/src/plugins/CommandLineOptions/CMakeLists.txt @@ -1,4 +1,4 @@ add_subdirectory(IncDecVolumeOption) add_subdirectory(SeekOption) add_subdirectory(StatusOption) -#add_subdirectory(PlayListOption) +add_subdirectory(PlayListOption) diff --git a/src/plugins/CommandLineOptions/CommandLineOptions.pro b/src/plugins/CommandLineOptions/CommandLineOptions.pro index 9435a8682..ea15469d5 100644 --- a/src/plugins/CommandLineOptions/CommandLineOptions.pro +++ b/src/plugins/CommandLineOptions/CommandLineOptions.pro @@ -1,5 +1,5 @@ TEMPLATE = subdirs SUBDIRS = IncDecVolumeOption \ SeekOption \ - StatusOption - #PlayListOption + StatusOption \ + PlayListOption diff --git a/src/plugins/CommandLineOptions/PlayListOption/playlistoption.cpp b/src/plugins/CommandLineOptions/PlayListOption/playlistoption.cpp index 3c77e977e..2fcd37b30 100644 --- a/src/plugins/CommandLineOptions/PlayListOption/playlistoption.cpp +++ b/src/plugins/CommandLineOptions/PlayListOption/playlistoption.cpp @@ -83,7 +83,10 @@ QString PlayListOption::executeCommand(const QString& opt_str, const QStringList return tr("Invalid playlist ID") + "\n"; for(int i = 0; i < model->count(); ++i) { - out += QString("%1. %2").arg(i+1).arg(formatter.parse(model->item(i))); + PlayListTrack *track = model->track(i); + if(!track) + continue; + out += QString("%1. %2").arg(i+1).arg(formatter.parse(track)); if(i == model->currentIndex()) out += " [*]"; out += "\n"; @@ -99,13 +102,13 @@ QString PlayListOption::executeCommand(const QString& opt_str, const QStringList PlayListModel *model = pl_manager->playListAt(pl_id); if(!model) return tr("Invalid playlist ID") + "\n"; - PlayListTrack *item = model->item(track_id); - if(!item) + PlayListTrack *track = model->track(track_id); + if(!track) return tr("Invalid track ID") + "\n"; player->stop(); pl_manager->activatePlayList(model); pl_manager->selectPlayList(model); - model->setCurrent(item); + model->setCurrent(track); player->play(); } else if(opt_str == "--pl-clear") -- cgit v1.2.3-13-gbd6f