aboutsummaryrefslogtreecommitdiff
path: root/src/qmmpui/commandlinemanager.cpp
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2010-09-18 16:50:38 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2010-09-18 16:50:38 +0000
commit5717444b38b4f45ad185bbc6ea81cdb141befb8c (patch)
tree9ab1fdb4070f7dab49ce5da8b8cf07b79c508eb4 /src/qmmpui/commandlinemanager.cpp
parent42aa3971c31736f04f668f84884c05f4dad793bd (diff)
downloadqmmp-5717444b38b4f45ad185bbc6ea81cdb141befb8c.tar.gz
qmmp-5717444b38b4f45ad185bbc6ea81cdb141befb8c.tar.bz2
qmmp-5717444b38b4f45ad185bbc6ea81cdb141befb8c.zip
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
Diffstat (limited to 'src/qmmpui/commandlinemanager.cpp')
-rw-r--r--src/qmmpui/commandlinemanager.cpp31
1 files changed, 12 insertions, 19 deletions
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 <QObject>
#include <QList>
#include <QApplication>
-
#include <cstdlib>
#include <iostream>
#include <qmmp/qmmp.h>
+#include <qmmp/soundcore.h>
+#include <qmmpui/generalhandler.h>
+#include <qmmpui/mediaplayer.h>
#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());
}