aboutsummaryrefslogtreecommitdiff
path: root/src/ui/qmmpstarter.cpp
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2008-06-11 13:03:47 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2008-06-11 13:03:47 +0000
commit05881204465655b9657891cddb195e37dd5dd020 (patch)
tree1ed20dadbc38f361dda65e2771bddd71a4a599f5 /src/ui/qmmpstarter.cpp
parentda088637dea9ba5aed112e88deb933201de8947a (diff)
downloadqmmp-05881204465655b9657891cddb195e37dd5dd020.tar.gz
qmmp-05881204465655b9657891cddb195e37dd5dd020.tar.bz2
qmmp-05881204465655b9657891cddb195e37dd5dd020.zip
enabled command line plugins support
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@401 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/ui/qmmpstarter.cpp')
-rw-r--r--src/ui/qmmpstarter.cpp41
1 files changed, 20 insertions, 21 deletions
diff --git a/src/ui/qmmpstarter.cpp b/src/ui/qmmpstarter.cpp
index 4d47ffabd..b2d7ac92c 100644
--- a/src/ui/qmmpstarter.cpp
+++ b/src/ui/qmmpstarter.cpp
@@ -20,21 +20,26 @@
#include <QApplication>
-#include "unixdomainsocket.h"
+#include <cstdlib>
+#include <iostream>
#include <unistd.h>
#include <sys/types.h>
#include <string.h>
+#include <qmmpui/commandlinemanager.h>
+#include "unixdomainsocket.h"
#include "mainwindow.h"
#include "version.h"
#include "qmmpstarter.h"
-#include "commandlineoption.h"
+#include "builtincommandlineoption.h"
#define MAXCOMMANDSIZE 1024
-QMMPStarter::QMMPStarter(int argc,char ** argv,QObject* parent) : QObject(parent),mw(NULL)
+using namespace std;
+
+QMMPStarter::QMMPStarter(int argc,char **argv, QObject* parent) : QObject(parent), mw(NULL)
{
- m_option_manager = new CommandLineOptionManager();
+ m_option_manager = new BuiltinCommandLineOption(this);
QStringList tmp;
for (int i = 1;i < argc;i++)
tmp << QString::fromLocal8Bit(argv[i]);
@@ -53,8 +58,8 @@ QMMPStarter::QMMPStarter(int argc,char ** argv,QObject* parent) : QObject(parent
}
if (argString.startsWith("--") && // command?
- !m_option_manager->hasOption(argString)
- )
+ !(m_option_manager->identify(argString) ||
+ CommandLineManager::hasOption(argString)))
{
qFatal("QMMP: Unknown command...");
exit(1);
@@ -132,23 +137,17 @@ void QMMPStarter::readCommand()
void QMMPStarter::printUsage()
{
- qWarning(
- "Usage: qmmp [options] [files] \n"
- "Options:\n"
- "--------\n"
- );
- for (int i = 0; i< m_option_manager->count();i++)
- {
- qWarning(qPrintable((*m_option_manager)[i]->helpString()));
- }
- qWarning(
- "--help Display this text and exit.\n"
- "--version Print version number and exit.\n\n"
- "Ideas, patches, bugreports send to forkotov02@hotmail.ru\n"
- );
+ cout << qPrintable(tr("Usage: qmmp [options] [files]")) << endl;
+ cout << qPrintable(tr("Options:")) << endl;
+ cout << qPrintable(tr("--------")) << endl;
+ cout << qPrintable(m_option_manager->helpString()) << endl;
+ CommandLineManager::printUsage();
+ cout << "--help " << qPrintable(tr("Display this text and exit.")) << endl;
+ cout << "--version " << qPrintable(tr("Print version number and exit")) << endl;
+ cout << qPrintable(tr("Ideas, patches, bugreports send to forkotov02@hotmail.ru")) << endl;
}
void QMMPStarter::printVersion()
{
- qWarning("QMMP version: %s",QMMP_STR_VERSION);
+ cout << qPrintable(tr("QMMP version: ")) << QMMP_STR_VERSION << endl;
}