From 4e5a11e1e7288245f4ec9744376a1345d3210369 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sun, 6 Jul 2014 16:42:26 +0000 Subject: 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 --- .../PlayListOption/playlistoption.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/plugins/CommandLineOptions/PlayListOption') 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(); -- cgit v1.2.3-13-gbd6f