diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2017-03-05 17:40:01 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2017-03-05 17:40:01 +0000 |
| commit | 2f376a7ebcfc4103b50c523eff7655f619c77353 (patch) | |
| tree | 219a408556740105141949a920bda942441e7f0d /src/app | |
| parent | f731ee7de3fe936c65349d70650fe90045e79c8e (diff) | |
| download | qmmp-2f376a7ebcfc4103b50c523eff7655f619c77353.tar.gz qmmp-2f376a7ebcfc4103b50c523eff7655f619c77353.tar.bz2 qmmp-2f376a7ebcfc4103b50c523eff7655f619c77353.zip | |
changed command line api
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@7069 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/app')
| -rw-r--r-- | src/app/builtincommandlineoption.cpp | 37 | ||||
| -rw-r--r-- | src/app/builtincommandlineoption.h | 6 | ||||
| -rw-r--r-- | src/app/qmmpstarter.cpp | 19 |
3 files changed, 34 insertions, 28 deletions
diff --git a/src/app/builtincommandlineoption.cpp b/src/app/builtincommandlineoption.cpp index 4481b369b..e26b685f6 100644 --- a/src/app/builtincommandlineoption.cpp +++ b/src/app/builtincommandlineoption.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008-2014 by Ilya Kotov * + * Copyright (C) 2008-2017 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -65,25 +65,24 @@ bool BuiltinCommandLineOption::identify(const QString &str) const return m_options.contains(str); } -const QString BuiltinCommandLineOption::helpString() const +const QStringList BuiltinCommandLineOption::helpString() const { - return QString( - "-e, --enqueue "+tr("Don't clear the playlist") + "\n" + - "-p, --play "+tr("Start playing current song")+"\n" + - "-u, --pause "+tr("Pause current song")+ "\n" - "-t, --play-pause "+tr("Pause if playing, play otherwise")+ "\n" - "-s, --stop "+tr("Stop current song")+ "\n" + - "-j, --jump-to-file "+tr("Display Jump to File dialog")+ "\n" + - "-q, --quit "+tr("Quit application") + "\n" + - "--volume <0..100> "+tr("Set playback volume (example: qmmp --volume 20)") + "\n" - "--toggle-mute "+tr("Mute/Restore volume") + "\n" - "--next "+tr("Skip forward in playlist")+ "\n" + - "--previous "+tr("Skip backwards in playlist")+"\n" + - "--toggle-visibility "+tr("Show/hide application")+ "\n" + - "--show-mw "+tr("Show main window") + "\n" + - "--add-file "+tr("Display Add File dialog")+ "\n" + - "--add-dir "+tr("Display Add Directory dialog") - ); + return QStringList() + << QString("-e, --enqueue") + "||" + tr("Don't clear the playlist") + << QString("-p, --play") + "||" + tr("Start playing current song") + << QString("-u, --pause") + "||" + tr("Pause current song") + << QString("-t, --play-pause") + "||" + tr("Pause if playing, play otherwise") + << QString("-s, --stop") + "||" + tr("Stop current song") + << QString("-j, --jump-to-file") + "||" + tr("Display Jump to File dialog") + << QString("-q, --quit") + "||" + tr("Quit application") + << QString("--volume <0..100>") + "||" + tr("Set playback volume (example: qmmp --volume 20)") + << QString("--toggle-mute") + "||" + tr("Mute/Restore volume") + << QString("--next") + "||" + tr("Skip forward in playlist") + << QString("--previous") + "||" + tr("Skip backwards in playlist") + << QString("--toggle-visibility") + "||" + tr("Show/hide application") + << QString("--show-mw") + "||" + tr("Show main window") + << QString("--add-file") + "||" + tr("Display Add File dialog") + << QString("--add-dir") + "||" + tr("Display Add Directory dialog"); } void BuiltinCommandLineOption::executeCommand(const QString &option_string, diff --git a/src/app/builtincommandlineoption.h b/src/app/builtincommandlineoption.h index 64e1cfac4..d47656a36 100644 --- a/src/app/builtincommandlineoption.h +++ b/src/app/builtincommandlineoption.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008-2014 by Ilya Kotov * + * Copyright (C) 2008-2017 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -42,8 +42,8 @@ public: ~BuiltinCommandLineOption(); - bool identify(const QString& str)const; - const QString helpString()const; + bool identify(const QString& str) const; + const QStringList helpString() const; void executeCommand(const QString& option, const QStringList &args, const QString &cwd); QHash <QString, QStringList> splitArgs(const QStringList &args) const; diff --git a/src/app/qmmpstarter.cpp b/src/app/qmmpstarter.cpp index aa5ccd45a..a58534678 100644 --- a/src/app/qmmpstarter.cpp +++ b/src/app/qmmpstarter.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2006-2016 by Ilya Kotov * + * Copyright (C) 2006-2017 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -342,12 +342,19 @@ void QMMPStarter::printUsage() cout << qPrintable(tr("Usage: qmmp [options] [files]")) << endl; cout << qPrintable(tr("Options:")) << endl; cout << "--------" << endl; - cout << qPrintable(m_option_manager->helpString()) << endl; + foreach (QString line, m_option_manager->helpString()) + cout << qPrintable(CommandLineManager::formatHelpString(line) ) << endl; CommandLineManager::printUsage(); - cout << "--no-start " << qPrintable(tr("Don't start the application")) << endl; - 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; + QStringList extraHelp; + extraHelp << QString("--no-start") + "||" + tr("Don't start the application"); + extraHelp << QString("--help") + "||" + tr("Display this text and exit"); + extraHelp << QString("--version") + "||" + tr("Print version number and exit"); + extraHelp << ""; + extraHelp << tr("Home page: %1").arg("http://qmmp.ylsoftware.com"); + extraHelp << tr("Development page: %1").arg("https://sourceforge.net/p/qmmp-dev"); + extraHelp << tr("Bug tracker: %1").arg("https://sourceforge.net/p/qmmp-dev/tickets"); + foreach (QString line, extraHelp) + cout << qPrintable(CommandLineManager::formatHelpString(line)) << endl; #ifdef Q_OS_WIN string text = tmp_stream.str(); QMessageBox::information(0, tr("Command Line Help"), QString::fromLocal8Bit(text.c_str())); |
