diff options
| -rw-r--r-- | src/plugins/CommandLineOptions/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/plugins/CommandLineOptions/CommandLineOptions.pro | 4 | ||||
| -rw-r--r-- | src/plugins/CommandLineOptions/PlayListOption/playlistoption.cpp | 11 |
3 files changed, 10 insertions, 7 deletions
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") |
