From 5717444b38b4f45ad185bbc6ea81cdb141befb8c Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sat, 18 Sep 2010 16:50:38 +0000 Subject: added --status and --nowplaying command line option (Closes issue 266) git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1893 90c681e8-e032-0410-971d-27865f9a5e38 --- src/qmmpui/commandlinemanager.cpp | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) (limited to 'src/qmmpui/commandlinemanager.cpp') diff --git a/src/qmmpui/commandlinemanager.cpp b/src/qmmpui/commandlinemanager.cpp index 85d822b1e..fde1da6d4 100644 --- a/src/qmmpui/commandlinemanager.cpp +++ b/src/qmmpui/commandlinemanager.cpp @@ -22,10 +22,12 @@ #include #include #include - #include #include #include +#include +#include +#include #include "commandlinemanager.h" using namespace std; @@ -65,31 +67,22 @@ void CommandLineManager::checkOptions() } } -CommandLineManager::CommandLineManager(QObject *parent) - : General(parent) -{ - //m_state = General::Stopped; - m_left = 0; - m_right = 0; - m_time = 0; -} - - -CommandLineManager::~CommandLineManager() -{ -} - -void CommandLineManager::executeCommand(const QString& opt_str, const QStringList &args) +QString CommandLineManager::executeCommand(const QString& opt_str, const QStringList &args) { checkOptions(); + if(!GeneralHandler::instance() || !SoundCore::instance() || !MediaPlayer::instance()) + { + qWarning("CommandLineManager: player objects are not created"); + return QString(); + } foreach(CommandLineOption *opt, *m_options) { if (opt->identify(opt_str)) { - opt->executeCommand(opt_str, args); - return; + return opt->executeCommand(opt_str, args); } } + return QString(); } bool CommandLineManager::hasOption(const QString &opt_str) @@ -107,5 +100,5 @@ void CommandLineManager::printUsage() { checkOptions(); foreach(CommandLineOption *opt, *m_options) - cout << qPrintable(opt->helpString()); + cout << qPrintable(opt->helpString()); } -- cgit v1.2.3-13-gbd6f