From 3e2d3721988640845beeba150e01ff7f516f60b3 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sat, 29 Dec 2018 21:07:21 +0000 Subject: fixed --pl-help processing git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@8535 90c681e8-e032-0410-971d-27865f9a5e38 --- src/app/qmmpstarter.cpp | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'src/app/qmmpstarter.cpp') diff --git a/src/app/qmmpstarter.cpp b/src/app/qmmpstarter.cpp index 34927514e..2c7af2b89 100644 --- a/src/app/qmmpstarter.cpp +++ b/src/app/qmmpstarter.cpp @@ -101,19 +101,42 @@ QMMPStarter::QMMPStarter() : QObject() if(!commands.isEmpty()) { - foreach(QString arg, commands.keys()) + foreach(QString key, commands.keys()) { - if(!m_option_manager->identify(arg) && !CommandLineManager::hasOption(arg) && - arg != "--no-start" && arg != "--ui") + CommandLineHandler::OptionFlags flags; + if(!m_option_manager->identify(key) && + !CommandLineManager::hasOption(key, &flags) && + key != "--no-start" && + key != "--ui") { cout << qPrintable(tr("Unknown command")) << endl; m_exit_code = EXIT_FAILURE; m_finished = true; return; } + + if(flags & CommandLineHandler::NO_START) + { + m_exit_code = EXIT_SUCCESS; + m_finished = true; + //show dialog with command line documentation under ms windows +#ifdef Q_OS_WIN + stringstream tmp_stream; + tmp_stream.copyfmt(cout); + streambuf* old_stream = cout.rdbuf(tmp_stream.rdbuf()); +#endif + cout << qPrintable(CommandLineManager::executeCommand(key, commands.value(key))); +#ifdef Q_OS_WIN + string text = tmp_stream.str(); + QMessageBox::information(0, tr("Command Line Help"), QString::fromLocal8Bit(text.c_str())); + cout.rdbuf(old_stream); //restore old stream buffer +#endif + return; + } } } + m_server = new QLocalServer(this); m_socket = new QLocalSocket(this); bool noStart = commands.keys().contains("--no-start") || commands.keys().contains("--quit"); -- cgit v1.2.3-13-gbd6f