diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2017-03-07 20:34:31 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2017-03-07 20:34:31 +0000 |
| commit | 5df8f2fd1b44da4a1c57ae955d3fdbd43a24b9cb (patch) | |
| tree | 9b82e8cd25aa2fa55fa9d671ab5cc55fb6bf7809 /src/app | |
| parent | 4c9233c098e0bed5c3c10447f5da40cb8469b4d1 (diff) | |
| download | qmmp-5df8f2fd1b44da4a1c57ae955d3fdbd43a24b9cb.tar.gz qmmp-5df8f2fd1b44da4a1c57ae955d3fdbd43a24b9cb.tar.bz2 qmmp-5df8f2fd1b44da4a1c57ae955d3fdbd43a24b9cb.zip | |
added feature to channge user interface from command line
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@7077 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/app')
| -rw-r--r-- | src/app/qmmpstarter.cpp | 35 | ||||
| -rw-r--r-- | src/app/qmmpstarter.h | 1 |
2 files changed, 34 insertions, 2 deletions
diff --git a/src/app/qmmpstarter.cpp b/src/app/qmmpstarter.cpp index a58534678..3275ccff0 100644 --- a/src/app/qmmpstarter.cpp +++ b/src/app/qmmpstarter.cpp @@ -82,13 +82,25 @@ QMMPStarter::QMMPStarter() : QObject() m_finished = true; return; } + if(commands.keys().contains("--ui-list")) + { + printUserInterfaces(); + m_finished = true; + return; + } + if(commands.keys().contains("--ui")) + { + QStringList args = commands.value("--ui"); + if(args.size() == 1) + UiLoader::select(args.first()); + } if(!commands.isEmpty()) { foreach(QString arg, commands.keys()) { if(!m_option_manager->identify(arg) && !CommandLineManager::hasOption(arg) && - arg != "--no-start") + arg != "--no-start" && arg != "--ui") { cout << qPrintable(tr("Unknown command")) << endl; m_exit_code = EXIT_FAILURE; @@ -319,7 +331,7 @@ QString QMMPStarter::processCommandArgs(const QStringList &slist, const QString& return QString(); foreach(QString key, commands.keys()) { - if(key == "--no-start") + if(key == "--no-start" || key == "--ui") continue; if (CommandLineManager::hasOption(key)) return CommandLineManager::executeCommand(key, commands.value(key)); @@ -346,6 +358,8 @@ void QMMPStarter::printUsage() cout << qPrintable(CommandLineManager::formatHelpString(line) ) << endl; CommandLineManager::printUsage(); QStringList extraHelp; + extraHelp << QString("--ui <name>") + "||" + tr("Start qmmp with the specified user interface"); + extraHelp << QString("--ui-list") + "||" + tr("List all available user interfaces"); 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"); @@ -379,3 +393,20 @@ void QMMPStarter::printVersion() cout.rdbuf(old_stream); //restore old stream buffer #endif } + +void QMMPStarter::printUserInterfaces() +{ + //show dialog with qmmp version under ms windows +#ifdef Q_OS_WIN + stringstream tmp_stream; + tmp_stream.copyfmt(cout); + streambuf* old_stream = cout.rdbuf(tmp_stream.rdbuf()); +#endif + foreach (QString name, UiLoader::names()) + cout << qPrintable(name) << endl; +#ifdef Q_OS_WIN + string text = tmp_stream.str(); + QMessageBox::information(0, tr("User Interfaces"), QString::fromLocal8Bit(text.c_str())); + cout.rdbuf(old_stream); //restore old stream buffer +#endif +} diff --git a/src/app/qmmpstarter.h b/src/app/qmmpstarter.h index 60f80d9ba..f7332aa21 100644 --- a/src/app/qmmpstarter.h +++ b/src/app/qmmpstarter.h @@ -69,6 +69,7 @@ private: * Prints version of program */ void printVersion(); + void printUserInterfaces(); void startPlayer(); private: |
