From dca857498e15d000b6ba27dd07380302a47d1fcc Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Thu, 4 Mar 2010 11:56:59 +0000 Subject: improved command line support git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1597 90c681e8-e032-0410-971d-27865f9a5e38 --- src/qmmpui/commandlinemanager.cpp | 6 +++--- src/qmmpui/commandlinemanager.h | 5 +++-- src/qmmpui/commandlineoption.h | 5 ++++- src/qmmpui/generalhandler.cpp | 6 +++--- src/qmmpui/generalhandler.h | 6 ++++-- 5 files changed, 17 insertions(+), 11 deletions(-) (limited to 'src/qmmpui') diff --git a/src/qmmpui/commandlinemanager.cpp b/src/qmmpui/commandlinemanager.cpp index e6b23ac4c..82c8d7861 100644 --- a/src/qmmpui/commandlinemanager.cpp +++ b/src/qmmpui/commandlinemanager.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008 by Ilya Kotov * + * Copyright (C) 2008-2010 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -79,14 +79,14 @@ CommandLineManager::~CommandLineManager() { } -void CommandLineManager::executeCommand(const QString& opt_str) +void CommandLineManager::executeCommand(const QString& opt_str, const QStringList &args) { checkOptions(); foreach(CommandLineOption *opt, *m_options) { if (opt->identify(opt_str)) { - opt->executeCommand(opt_str, this); + opt->executeCommand(opt_str, args); return; } } diff --git a/src/qmmpui/commandlinemanager.h b/src/qmmpui/commandlinemanager.h index a985f260a..aa393ac42 100644 --- a/src/qmmpui/commandlinemanager.h +++ b/src/qmmpui/commandlinemanager.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008-2009 by Ilya Kotov * + * Copyright (C) 2008-2010 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -43,8 +43,9 @@ public: /*! * Executes command \b opt_str * @param opt_str Command line option string + * @param args Command arguments */ - void executeCommand(const QString& opt_str); + void executeCommand(const QString& opt_str, const QStringList &args = QStringList()); /*! * Return \b true if command \b opt_str is supported, otherwise returns \b false */ diff --git a/src/qmmpui/commandlineoption.h b/src/qmmpui/commandlineoption.h index 9799d063e..edbd40a5c 100644 --- a/src/qmmpui/commandlineoption.h +++ b/src/qmmpui/commandlineoption.h @@ -25,6 +25,7 @@ class CommandLineManager; class QTranslator; class QString; class QObject; +class QStringList; /*! @brief Abstract base class of the command line plugins. * @author Vladimir Kuznetsov @@ -47,8 +48,10 @@ public: virtual const QString helpString()const = 0; /*! * Parses \b opt_str args(if needed), executes command. + * @param opt_str Command to execute + * @param args Command arguments */ - virtual void executeCommand(const QString& opt_str, CommandLineManager* clm) = 0; + virtual void executeCommand(const QString &opt_str, const QStringList &args) = 0; /*! * Creates translator with parent object \b parent */ diff --git a/src/qmmpui/generalhandler.cpp b/src/qmmpui/generalhandler.cpp index 744591243..fa8659046 100644 --- a/src/qmmpui/generalhandler.cpp +++ b/src/qmmpui/generalhandler.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008-2009 by Ilya Kotov * + * Copyright (C) 2008-2010 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -102,10 +102,10 @@ bool GeneralHandler::visibilityControl() return FALSE; } -void GeneralHandler::executeCommand(const QString &opt_str) +void GeneralHandler::executeCommand(const QString &opt_str, const QStringList &args) { if (CommandLineManager::hasOption(opt_str)) - m_commandLineManager->executeCommand(opt_str); + m_commandLineManager->executeCommand(opt_str, args); } void GeneralHandler::addAction(QAction *action, MenuType type) diff --git a/src/qmmpui/generalhandler.h b/src/qmmpui/generalhandler.h index fa064f3ee..5d2e9cef0 100644 --- a/src/qmmpui/generalhandler.h +++ b/src/qmmpui/generalhandler.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008-2009 by Ilya Kotov * + * Copyright (C) 2008-2010 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -24,6 +24,7 @@ #include #include #include +#include class QAction; class QMenu; @@ -76,8 +77,9 @@ public: /*! * Executes command by command line plugins * @param opt_str Command line option string + * @param args Command arguments */ - void executeCommand(const QString &opt_str); + void executeCommand(const QString &opt_str, const QStringList &args = QStringList()); /*! * Adds the newly created action to the menu with type \b type. * Menu with type \b type should be created first. -- cgit v1.2.3-13-gbd6f