diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2014-07-06 16:42:26 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2014-07-06 16:42:26 +0000 |
| commit | 4e5a11e1e7288245f4ec9744376a1345d3210369 (patch) | |
| tree | d52c2eb2f8450ed084bfd5dae0eec4c29db30a27 | |
| parent | 5d85d9f2f7c3f82f40b66634f09260fe104e27fe (diff) | |
| download | qmmp-4e5a11e1e7288245f4ec9744376a1345d3210369.tar.gz qmmp-4e5a11e1e7288245f4ec9744376a1345d3210369.tar.bz2 qmmp-4e5a11e1e7288245f4ec9744376a1345d3210369.zip | |
fixed playlist numbers in the command line plugin
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@4344 90c681e8-e032-0410-971d-27865f9a5e38
| -rw-r--r-- | src/plugins/CommandLineOptions/PlayListOption/playlistoption.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/plugins/CommandLineOptions/PlayListOption/playlistoption.cpp b/src/plugins/CommandLineOptions/PlayListOption/playlistoption.cpp index e4e76d6ac..bae382f37 100644 --- a/src/plugins/CommandLineOptions/PlayListOption/playlistoption.cpp +++ b/src/plugins/CommandLineOptions/PlayListOption/playlistoption.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2013 by Ilya Kotov * + * Copyright (C) 2011-2014 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -88,7 +88,7 @@ QString PlayListOption::executeCommand(const QString& opt_str, const QStringList PlayListTrack *track = model->track(i); if(!track) continue; - out += QString("%1. %2").arg(i+1).arg(formatter.parse(track)); + out += QString("%1. %2").arg(model->numberOfTrack(i) + 1).arg(formatter.parse(track)); if(i == model->currentIndex()) out += " [*]"; out += "\n"; @@ -104,7 +104,21 @@ 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 *track = model->track(track_id); + + PlayListTrack *track = 0; + int track_counter = 0; + for(int i = 0; i < model->count(); i++) + { + if(model->isTrack(i)) + track_counter++; + else + continue; + if(track_counter - 1 == track_id) + { + track = model->track(i); + break; + } + } if(!track) return tr("Invalid track ID") + "\n"; player->stop(); |
