LCOV - code coverage report
Current view: top level - src/app/internal - commandlineparser.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 310 0
Test Date: 2026-11-19 04:14:36

            Line data    Source code
       1              : /*
       2              :  * SPDX-License-Identifier: GPL-3.0-only
       3              :  * MuseScore-Studio-CLA-applies
       4              :  *
       5              :  * MuseScore Studio
       6              :  * Music Composition & Notation
       7              :  *
       8              :  * Copyright (C) 2021 MuseScore Limited and others
       9              :  *
      10              :  * This program is free software: you can redistribute it and/or modify
      11              :  * it under the terms of the GNU General Public License version 3 as
      12              :  * published by the Free Software Foundation.
      13              :  *
      14              :  * This program is distributed in the hope that it will be useful,
      15              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      16              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17              :  * GNU General Public License for more details.
      18              :  *
      19              :  * You should have received a copy of the GNU General Public License
      20              :  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      21              :  */
      22              : #include "commandlineparser.h"
      23              : 
      24              : #include <QDir>
      25              : 
      26              : #include "global/io/dir.h"
      27              : #include "global/internal/baseapplication.h"
      28              : 
      29              : #include "app_config.h"
      30              : #include "muse_framework_config.h"
      31              : 
      32              : #ifdef MUSE_MODULE_TESTFLOW
      33              : #include "testflow/testflowcmdline.h"
      34              : #endif
      35              : 
      36              : #include "log.h"
      37              : 
      38              : using namespace muse;
      39              : using namespace mu::app;
      40              : 
      41            0 : static QStringList prepareArguments(int argc, char** argv)
      42              : {
      43            0 :     QStringList args;
      44              : 
      45            0 :     for (int i = 0; i < argc; ++i) {
      46            0 :         QString arg = QString::fromUtf8(argv[i]);
      47              : 
      48              : #ifndef NDEBUG
      49            0 :         if (arg.startsWith("-qmljsdebugger")) {
      50            0 :             continue;
      51              :         }
      52              : #endif
      53              : 
      54            0 :         args << arg;
      55            0 :     }
      56              : 
      57            0 :     return args;
      58            0 : }
      59              : 
      60              : template<typename ... Args>
      61            0 : QCommandLineOption internalCommandLineOption(Args&& ... args)
      62              : {
      63            0 :     QCommandLineOption option(std::forward<Args>(args)...);
      64            0 :     option.setFlags(QCommandLineOption::HiddenFromHelp);
      65            0 :     return option;
      66            0 : }
      67              : 
      68            0 : void CommandLineParser::init()
      69              : {
      70              :     // Common
      71            0 :     m_parser.addHelpOption(); // -?, -h, --help
      72            0 :     m_parser.addVersionOption(); // -v, --version
      73              : 
      74            0 :     m_parser.addPositionalArgument("scorefiles", "The files to open", "[scorefile...]");
      75              : 
      76            0 :     m_parser.addOption(QCommandLineOption("long-version", "Print detailed version information"));
      77            0 :     m_parser.addOption(QCommandLineOption({ "d", "debug" }, "Debug mode"));
      78              : 
      79            0 :     m_parser.addOption(QCommandLineOption({ "D", "monitor-resolution" }, "Specify monitor resolution", "DPI"));
      80            0 :     m_parser.addOption(QCommandLineOption({ "T", "trim-image" },
      81              :                                           "Use with '-o <file>.png' and '-o <file.svg>'. Trim exported image with specified margin (in pixels)",
      82            0 :                                           "margin"));
      83              : 
      84            0 :     m_parser.addOption(QCommandLineOption({ "b", "bitrate" }, "Use with '-o <file>.mp3', sets bitrate, in kbps", "bitrate"));
      85              : 
      86            0 :     m_parser.addOption(QCommandLineOption("template-mode", "Save template mode, no page size")); // and no platform and creationDate tags
      87            0 :     m_parser.addOption(QCommandLineOption({ "t", "test-mode" }, "Set test mode flag for all files")); // this includes --template-mode
      88              : 
      89            0 :     m_parser.addOption(QCommandLineOption("session-type", "Startup with given session type", "type")); // see StartupScenario::sessionTypeTromString
      90              : 
      91            0 :     m_parser.addOption(QCommandLineOption("unroll-repeats", "Unroll repeats"));
      92              : 
      93              :     // Converter mode
      94            0 :     m_parser.addOption(QCommandLineOption({ "r", "image-resolution" }, "Set output resolution for image export", "DPI"));
      95            0 :     m_parser.addOption(QCommandLineOption({ "o", "export-to" }, "Export to 'file'. Format depends on file's extension", "file"));
      96            0 :     m_parser.addOption(QCommandLineOption({ "j", "job" }, "Process a conversion job", "file"));
      97            0 :     m_parser.addOption(QCommandLineOption("extension", "Use extension to process a conversion job", "uri"));
      98              : 
      99            0 :     m_parser.addOption(QCommandLineOption({ "F", "factory-settings" }, "Use factory settings"));
     100            0 :     m_parser.addOption(QCommandLineOption({ "R", "revert-settings" }, "Revert to factory settings, but keep default preferences"));
     101            0 :     m_parser.addOption(QCommandLineOption("audio-output-disabled",
     102            0 :                                           "Do not use an audio device, the audio is discarded: true|false", "value"));
     103            0 :     m_parser.addOption(QCommandLineOption("user-data-dir",
     104            0 :                                           "Use the given directory for all user data (settings, logs, session, scores, ...)", "dir"));
     105            0 :     m_parser.addOption(QCommandLineOption({ "M", "midi-operations" }, "Specify MIDI import operations file", "file"));
     106            0 :     m_parser.addOption(QCommandLineOption({ "P", "export-score-parts" }, "Use with '-o <file>.pdf', export score and parts"));
     107            0 :     m_parser.addOption(QCommandLineOption({ "f", "force" },
     108            0 :                                           "Use with '-o <file>', ignore warnings reg. score being corrupted or from wrong version"));
     109              : 
     110            0 :     m_parser.addOption(QCommandLineOption("score-media",
     111            0 :                                           "Export all media (excepting mp3) for a given score in a single JSON file and print it to stdout"));
     112            0 :     m_parser.addOption(QCommandLineOption("highlight-config", "Set highlight to svg, generated from a given score", "highlight-config"));
     113            0 :     m_parser.addOption(QCommandLineOption("score-meta", "Export score metadata to JSON document and print it to stdout"));
     114            0 :     m_parser.addOption(QCommandLineOption("score-parts", "Generate parts data for the given score and save them to separate mscz files"));
     115            0 :     m_parser.addOption(QCommandLineOption("score-parts-pdf",
     116            0 :                                           "Generate parts data for the given score and export the data to a single JSON file, print it to stdout"));
     117            0 :     m_parser.addOption(QCommandLineOption("score-transpose",
     118              :                                           "Transpose the given score and export the data to a single JSON file, print it to stdout",
     119            0 :                                           "options"));
     120            0 :     m_parser.addOption(QCommandLineOption("score-elements",
     121            0 :                                           "Scan the given score and export elements to a single JSON file, print it to stdout"));
     122            0 :     m_parser.addOption(QCommandLineOption("source-update", "Update the source in the given score"));
     123              : 
     124            0 :     m_parser.addOption(QCommandLineOption({ "S", "style" }, "Load style file", "style"));
     125              : 
     126            0 :     m_parser.addOption(QCommandLineOption("sound-profile",
     127              :                                           "Use with '-o <file>.mp3' or with '-j <file>', override the sound profile in the given score(s). "
     128            0 :                                           "Possible values: \"MuseScore Basic\", \"MuseSounds\"", "sound-profile"));
     129              : 
     130            0 :     m_parser.addOption(QCommandLineOption("tracks-diff",
     131              :                                           "Use with -o <file>.mp3, write a diff of tracks before and after applying the sound profile. "
     132              :                                           "The report contains two lists: oldTracks and newTracks",
     133            0 :                                           "tracks-diff"));
     134              : 
     135            0 :     m_parser.addOption(QCommandLineOption("transpose",
     136              :                                           "Transpose the given score before executing the '-o' options",
     137            0 :                                           "options"));
     138              : 
     139            0 :     m_parser.addOption(QCommandLineOption("page",
     140              :                                           "Use with '-o <file>', export only the specified page. "
     141              :                                           "Supported output formats: SVG, PNG, PDF, MSCZ",
     142            0 :                                           "options"));
     143              : 
     144            0 :     m_parser.addOption(QCommandLineOption("region",
     145              :                                           "Use with '-o <file>', export only the specified region to a separate mscz file. ",
     146            0 :                                           "options"));
     147              : 
     148              :     // MusicXML
     149            0 :     m_parser.addOption(QCommandLineOption("musicxml-use-default-font",
     150            0 :                                           "Apply default typeface (Edwin) to imported scores"));
     151            0 :     m_parser.addOption(QCommandLineOption("musicxml-infer-text-type",
     152            0 :                                           "Infer text type based on content where possible"));
     153              : 
     154              :     // Video export
     155              : #ifdef MUE_BUILD_IMPEXP_VIDEOEXPORT_MODULE
     156            0 :     m_parser.addOption(QCommandLineOption("score-video", "Generate video for the given score and export it to file"));
     157              : // not implemented
     158              : //    m_parser.addOption(QCommandLineOption("view-mode",
     159              : //                                          "View mode [paged-float, paged-original, paged-float-height, pano, auto]. Auto (default) will choose the best mode according to number of instruments etc... Will show piano for piano score only",
     160              : //                                          "auto"));
     161              : // not implemented
     162              : //    m_parser.addOption(QCommandLineOption("piano", "Show Piano, works only if one part and not auto or float modes"));
     163              : //    m_parser.addOption(QCommandLineOption("piano-position", "Show Piano top or bottom. Default bottom", "bottom"));
     164            0 :     m_parser.addOption(QCommandLineOption("resolution", "Resolution [2160p, 1440p, 1080p, 720p, 480p, 360p]", "1080p"));
     165            0 :     m_parser.addOption(QCommandLineOption("fps", "Frame per second [60, 30, 24]", "24"));
     166            0 :     m_parser.addOption(QCommandLineOption("ls", "Pause before playback in seconds (3.0)", "3.0"));
     167            0 :     m_parser.addOption(QCommandLineOption("ts", "Pause before end of video in seconds (3.0)", "3.0"));
     168            0 :     m_parser.addOption(QCommandLineOption("no-audio", "Export video without audio"));
     169              : #endif
     170              : 
     171            0 :     m_parser.addOption(QCommandLineOption("gp-linked", "create tabulature linked staves for guitar pro"));
     172            0 :     m_parser.addOption(QCommandLineOption("gp-experimental", "experimental features for guitar pro import"));
     173              : 
     174              :     //! NOTE Currently only implemented `full` mode
     175            0 :     m_parser.addOption(QCommandLineOption("migration", "Whether to do migration with given mode, `full` - full migration", "mode"));
     176              : 
     177              :     // Diagnostic
     178            0 :     m_parser.addOption(QCommandLineOption("diagnostic-output", "Diagnostic output", "output"));
     179            0 :     m_parser.addOption(QCommandLineOption("diagnostic-gen-drawdata", "Generate engraving draw data", "scores-dir"));
     180            0 :     m_parser.addOption(QCommandLineOption("diagnostic-com-drawdata", "Compare engraving draw data"));
     181            0 :     m_parser.addOption(QCommandLineOption("diagnostic-drawdata-to-png", "Convert draw data to png", "file"));
     182            0 :     m_parser.addOption(QCommandLineOption("diagnostic-drawdiff-to-png", "Convert draw diff to png"));
     183              : 
     184              :     // Testflow
     185              : #ifdef MUSE_MODULE_TESTFLOW
     186              :     muse::testflow::addCmdOptions(m_parser);
     187              : #endif
     188              : 
     189              :     // Audio plugins
     190            0 :     m_parser.addOption(QCommandLineOption("register-audio-plugin",
     191            0 :                                           "Check an audio plugin for compatibility with the application and register it", "path"));
     192            0 :     m_parser.addOption(QCommandLineOption("register-audio-plugin-out", "Write audio plugin registration result to file", "path"));
     193              : 
     194              :     // Internal
     195            0 :     m_parser.addOption(internalCommandLineOption("score-display-name-override",
     196              :                                                  "Display name to be shown in splash screen for the score that is being opened", "name"));
     197            0 : }
     198              : 
     199            0 : void CommandLineParser::parse(int argc, char** argv)
     200              : {
     201            0 :     m_options = std::make_shared<MuseScoreCmdOptions>();
     202              : 
     203            0 :     QStringList args = prepareArguments(argc, argv);
     204            0 :     m_parser.parse(args);
     205              : 
     206            0 :     auto floatValue = [this](const QString& name) -> std::optional<float> {
     207            0 :         bool ok = true;
     208            0 :         float val = m_parser.value(name).toFloat(&ok);
     209            0 :         if (ok) {
     210            0 :             return val;
     211              :         }
     212            0 :         return std::nullopt;
     213            0 :     };
     214              : 
     215            0 :     auto doubleValue = [this](const QString& name) -> std::optional<double> {
     216            0 :         bool ok = true;
     217            0 :         double val = m_parser.value(name).toDouble(&ok);
     218            0 :         if (ok) {
     219            0 :             return val;
     220              :         }
     221            0 :         return std::nullopt;
     222            0 :     };
     223              : 
     224            0 :     auto intValue = [this](const QString& name) -> std::optional<int> {
     225            0 :         bool ok = true;
     226            0 :         int val = m_parser.value(name).toInt(&ok);
     227            0 :         if (ok) {
     228            0 :             return val;
     229              :         }
     230            0 :         return std::nullopt;
     231            0 :     };
     232              : 
     233            0 :     auto fromUserInputPath = [](const QString& path) -> QString {
     234            0 :         return io::Dir::fromNativeSeparators(path).toQString();
     235              :     };
     236              : 
     237            0 :     QStringList scorefiles;
     238            0 :     for (const QString& arg : m_parser.positionalArguments()) {
     239            0 :         scorefiles << fromUserInputPath(arg);
     240            0 :     }
     241              : 
     242            0 :     auto firstScoreFile = [](const QStringList& scorefiles) -> QString {
     243            0 :         if (scorefiles.size() < 1) {
     244            0 :             LOGE() << "Option: -o no input file specified";
     245            0 :             return QString();
     246            0 :         } else if (scorefiles.size() > 1) {
     247            0 :             LOGW() << "Option: -o multiple input files specified; processing only the first one";
     248              :         }
     249            0 :         return scorefiles.front();
     250              :     };
     251              : 
     252            0 :     if (m_parser.isSet("long-version")) {
     253            0 :         printLongVersion();
     254            0 :         exit(EXIT_SUCCESS);
     255              :     }
     256              : 
     257            0 :     if (m_parser.isSet("d")) {
     258            0 :         m_options->global.loggerLevel = logger::Level::Debug;
     259              :     }
     260              : 
     261            0 :     if (m_parser.isSet("audio-output-disabled")) {
     262            0 :         m_options->audio.outputDisabled = m_parser.value("audio-output-disabled") == "true";
     263              :     }
     264              : 
     265            0 :     if (m_parser.isSet("user-data-dir")) {
     266            0 :         m_options->global.userDataDir = QDir(m_parser.value("user-data-dir")).absolutePath();
     267              :     }
     268              : 
     269            0 :     if (m_parser.isSet("D")) {
     270            0 :         std::optional<double> val = doubleValue("D");
     271            0 :         if (val) {
     272            0 :             m_options->ui.physicalDotsPerInch = val;
     273              :         } else {
     274            0 :             LOGE() << "Option: -D not recognized DPI value: " << m_parser.value("D");
     275              :         }
     276              :     }
     277              : 
     278            0 :     if (m_parser.isSet("T")) {
     279            0 :         std::optional<int> val = intValue("T");
     280            0 :         if (val) {
     281            0 :             m_options->exportImage.trimMarginPixelSize = val;
     282              :         } else {
     283            0 :             LOGE() << "Option: -T not recognized trim value: " << m_parser.value("T");
     284              :         }
     285              :     }
     286              : 
     287            0 :     if (m_parser.isSet("M")) {
     288            0 :         m_options->importMidi.operationsFile = fromUserInputPath(m_parser.value("M"));
     289              :     }
     290              : 
     291            0 :     if (m_parser.isSet("b")) {
     292            0 :         std::optional<int> val = intValue("b");
     293            0 :         if (val) {
     294            0 :             m_options->exportAudio.mp3Bitrate = val;
     295              :         } else {
     296            0 :             LOGE() << "Option: -b not recognized bitrate value: " << m_parser.value("b");
     297              :         }
     298              :     }
     299              : 
     300            0 :     if (m_parser.isSet("template-mode")) {
     301            0 :         m_options->notation.templateModeEnabled = true;
     302              :     }
     303              : 
     304            0 :     if (m_parser.isSet("t")) {
     305            0 :         m_options->notation.testModeEnabled = true;
     306              :     }
     307              : 
     308            0 :     if (m_parser.isSet("session-type")) {
     309            0 :         m_options->startup.type = m_parser.value("session-type").toStdString();
     310              :     }
     311              : 
     312            0 :     if (m_parser.isSet("register-audio-plugin")) {
     313            0 :         m_options->runMode = IApplication::RunMode::AudioPluginRegistration;
     314            0 :         m_options->audioPluginRegistration.pluginPath = fromUserInputPath(m_parser.value("register-audio-plugin"));
     315            0 :         m_options->audioPluginRegistration.outputFile = fromUserInputPath(m_parser.value("register-audio-plugin-out"));
     316              :     }
     317              : 
     318              :     // Converter mode
     319            0 :     if (m_parser.isSet("r")) {
     320            0 :         std::optional<float> val = floatValue("r");
     321            0 :         if (val) {
     322            0 :             m_options->exportImage.pngDpiResolution = val;
     323              :         } else {
     324            0 :             LOGE() << "Option: -r not recognized DPI value: " << m_parser.value("r");
     325              :         }
     326              :     }
     327              : 
     328            0 :     if (m_parser.isSet("o")) {
     329            0 :         m_options->runMode = IApplication::RunMode::ConsoleApp;
     330            0 :         m_options->converterTask.type = ConvertType::File;
     331            0 :         m_options->converterTask.inputFile = firstScoreFile(scorefiles);
     332            0 :         m_options->converterTask.outputFile = fromUserInputPath(m_parser.value("o"));
     333              : 
     334              :         // Only if "-o" is set "transpose" has some meaning
     335            0 :         if (m_parser.isSet("transpose")) {
     336            0 :             m_options->converterTask.params[MuseScoreCmdOptions::ParamKey::ScoreTransposeOptions] = m_parser.value("transpose");
     337              :         }
     338              : 
     339            0 :         if (m_parser.isSet("page")) {
     340            0 :             m_options->converterTask.params[MuseScoreCmdOptions::ParamKey::PageNumber] = m_parser.value("page");
     341              :         }
     342              : 
     343            0 :         if (m_parser.isSet("region")) {
     344            0 :             m_options->converterTask.params[MuseScoreCmdOptions::ParamKey::ScoreRegion] = m_parser.value("region");
     345              :         }
     346              :     }
     347              : 
     348            0 :     if (m_parser.isSet("P")) {
     349            0 :         if (m_options->converterTask.outputFile.isEmpty()) {
     350            0 :             LOGE() << "Option: -R no output file specified";
     351              :         } else {
     352            0 :             m_options->converterTask.type = ConvertType::ConvertScoreParts;
     353              :         }
     354              :     }
     355              : 
     356            0 :     if (m_parser.isSet("j")) {
     357            0 :         m_options->runMode = IApplication::RunMode::ConsoleApp;
     358            0 :         m_options->converterTask.type = ConvertType::Batch;
     359            0 :         m_options->converterTask.inputFile = fromUserInputPath(m_parser.value("j"));
     360              :     }
     361              : 
     362            0 :     if (m_parser.isSet("score-media")) {
     363            0 :         m_options->runMode = IApplication::RunMode::ConsoleApp;
     364            0 :         m_options->converterTask.type = ConvertType::ExportScoreMedia;
     365            0 :         m_options->converterTask.inputFile = firstScoreFile(scorefiles);
     366            0 :         if (m_parser.isSet("highlight-config")) {
     367            0 :             m_options->converterTask.params[MuseScoreCmdOptions::ParamKey::HighlightConfigPath]
     368            0 :                 = fromUserInputPath(m_parser.value("highlight-config"));
     369              :         }
     370              :     }
     371              : 
     372            0 :     if (m_parser.isSet("score-meta")) {
     373            0 :         m_options->runMode = IApplication::RunMode::ConsoleApp;
     374            0 :         m_options->converterTask.type = ConvertType::ExportScoreMeta;
     375            0 :         m_options->converterTask.inputFile = firstScoreFile(scorefiles);
     376              :     }
     377              : 
     378            0 :     if (m_parser.isSet("score-parts")) {
     379            0 :         m_options->runMode = IApplication::RunMode::ConsoleApp;
     380            0 :         m_options->converterTask.type = ConvertType::ExportScoreParts;
     381            0 :         m_options->converterTask.inputFile = firstScoreFile(scorefiles);
     382              :     }
     383              : 
     384            0 :     if (m_parser.isSet("score-parts-pdf")) {
     385            0 :         m_options->runMode = IApplication::RunMode::ConsoleApp;
     386            0 :         m_options->converterTask.type = ConvertType::ExportScorePartsPdf;
     387            0 :         m_options->converterTask.inputFile = firstScoreFile(scorefiles);
     388              :     }
     389              : 
     390            0 :     if (m_parser.isSet("score-transpose")) {
     391            0 :         m_options->runMode = IApplication::RunMode::ConsoleApp;
     392            0 :         m_options->converterTask.type = ConvertType::ExportScoreTranspose;
     393            0 :         m_options->converterTask.inputFile = firstScoreFile(scorefiles);
     394            0 :         m_options->converterTask.params[MuseScoreCmdOptions::ParamKey::ScoreTransposeOptions] = m_parser.value("score-transpose");
     395              :     }
     396              : 
     397            0 :     if (m_parser.isSet("score-elements")) {
     398            0 :         m_options->runMode = IApplication::RunMode::ConsoleApp;
     399            0 :         m_options->converterTask.type = ConvertType::ExportScoreElements;
     400            0 :         m_options->converterTask.inputFile = firstScoreFile(scorefiles);
     401              :     }
     402              : 
     403            0 :     if (m_parser.isSet("source-update")) {
     404            0 :         QStringList args2 = m_parser.positionalArguments();
     405              : 
     406            0 :         m_options->runMode = IApplication::RunMode::ConsoleApp;
     407            0 :         m_options->converterTask.type = ConvertType::SourceUpdate;
     408            0 :         m_options->converterTask.inputFile = fromUserInputPath(args2.empty() ? "" : args2[0]);
     409              : 
     410            0 :         if (args2.size() >= 2) {
     411            0 :             m_options->converterTask.params[MuseScoreCmdOptions::ParamKey::ScoreSource] = args2[1];
     412              :         } else {
     413            0 :             LOGW() << "Option: --source-update no source specified";
     414              :         }
     415            0 :     }
     416              : 
     417              :     // MusicXML
     418            0 :     if (m_parser.isSet("musicxml-use-default-font")) {
     419            0 :         m_options->importMusicXml.useDefaultFont = true;
     420              :     }
     421              : 
     422            0 :     if (m_parser.isSet("musicxml-infer-text-type")) {
     423            0 :         m_options->importMusicXml.inferTextType = true;
     424              :     }
     425              : 
     426              :     // Video
     427              : #ifdef MUE_BUILD_IMPEXP_VIDEOEXPORT_MODULE
     428            0 :     if (m_parser.isSet("score-video")) {
     429            0 :         m_options->runMode = IApplication::RunMode::ConsoleApp;
     430            0 :         m_options->converterTask.type = ConvertType::ExportScoreVideo;
     431            0 :         m_options->converterTask.inputFile = firstScoreFile(scorefiles);
     432            0 :         m_options->converterTask.outputFile = fromUserInputPath(m_parser.value("o"));
     433              : 
     434            0 :         if (m_parser.isSet("view-mode")) {
     435            0 :             NOT_IMPLEMENTED;
     436              :         }
     437              : 
     438            0 :         if (m_parser.isSet("piano")) {
     439            0 :             NOT_IMPLEMENTED;
     440              :         }
     441              : 
     442            0 :         if (m_parser.isSet("piano-position")) {
     443            0 :             NOT_IMPLEMENTED;
     444              :         }
     445              : 
     446            0 :         if (m_parser.isSet("resolution")) {
     447            0 :             m_options->exportVideo.resolution = m_parser.value("resolution").toStdString();
     448              :         }
     449              : 
     450            0 :         if (m_parser.isSet("fps")) {
     451            0 :             m_options->exportVideo.fps = intValue("fps");
     452              :         }
     453              : 
     454            0 :         if (m_parser.isSet("ls")) {
     455            0 :             m_options->exportVideo.leadingSec = doubleValue("ls");
     456              :         }
     457              : 
     458            0 :         if (m_parser.isSet("ts")) {
     459            0 :             m_options->exportVideo.trailingSec = doubleValue("ts");
     460              :         }
     461              : 
     462            0 :         if (m_parser.isSet("no-audio")) {
     463            0 :             m_options->converterTask.params[MuseScoreCmdOptions::ParamKey::NoAudio] = true;
     464              :         }
     465              :     }
     466              : #endif
     467              : 
     468            0 :     if (m_parser.isSet("F") || m_parser.isSet("R")) {
     469            0 :         m_options->app.revertToFactorySettings = true;
     470              :     }
     471              : 
     472            0 :     if (m_parser.isSet("f")) {
     473            0 :         m_options->converterTask.params[MuseScoreCmdOptions::ParamKey::ForceMode] = true;
     474              :     }
     475              : 
     476            0 :     if (m_parser.isSet("unroll-repeats")) {
     477            0 :         m_options->converterTask.params[MuseScoreCmdOptions::ParamKey::UnrollRepeats] = true;
     478              :     }
     479              : 
     480            0 :     if (m_parser.isSet("S")) {
     481            0 :         m_options->converterTask.params[MuseScoreCmdOptions::ParamKey::StylePath] = fromUserInputPath(m_parser.value("S"));
     482              :     }
     483              : 
     484            0 :     if (m_parser.isSet("sound-profile")) {
     485            0 :         m_options->converterTask.params[MuseScoreCmdOptions::ParamKey::SoundProfile] = m_parser.value("sound-profile");
     486              :     }
     487              : 
     488            0 :     if (m_parser.isSet("tracks-diff")) {
     489            0 :         m_options->converterTask.params[MuseScoreCmdOptions::ParamKey::TracksDiffPath] = m_parser.value("tracks-diff");
     490              :     }
     491              : 
     492            0 :     if (m_parser.isSet("extension")) {
     493            0 :         m_options->converterTask.params[MuseScoreCmdOptions::ParamKey::ExtensionUri] = m_parser.value("extension");
     494              :     }
     495              : 
     496            0 :     if (m_parser.isSet("gp-linked")) {
     497            0 :         m_options->guitarPro.linkedTabStaffCreated = true;
     498              :     }
     499              : 
     500            0 :     if (m_parser.isSet("gp-experimental")) {
     501            0 :         m_options->guitarPro.experimental = true;
     502              :     }
     503              : 
     504            0 :     if (m_options->runMode == IApplication::RunMode::ConsoleApp) {
     505            0 :         if (m_parser.isSet("migration")) {
     506            0 :             QString val = m_parser.value("migration");
     507            0 :             m_options->project.fullMigration = (val == "full") ? true : false;
     508            0 :         }
     509              :     }
     510              : 
     511              :     // Diagnostic
     512            0 :     if (m_parser.isSet("diagnostic-output")) {
     513            0 :         m_options->diagnostic.output = m_parser.value("diagnostic-output");
     514              :     }
     515              : 
     516            0 :     if (m_parser.isSet("diagnostic-gen-drawdata")) {
     517            0 :         m_options->runMode = IApplication::RunMode::ConsoleApp;
     518            0 :         m_options->diagnostic.type = DiagnosticType::GenDrawData;
     519            0 :         m_options->diagnostic.input << m_parser.value("diagnostic-gen-drawdata");
     520              :     }
     521              : 
     522            0 :     if (m_parser.isSet("diagnostic-com-drawdata")) {
     523            0 :         m_options->runMode = IApplication::RunMode::ConsoleApp;
     524            0 :         m_options->diagnostic.type = DiagnosticType::ComDrawData;
     525            0 :         m_options->diagnostic.input = scorefiles;
     526              :     }
     527              : 
     528            0 :     if (m_parser.isSet("diagnostic-drawdata-to-png")) {
     529            0 :         m_options->runMode = IApplication::RunMode::ConsoleApp;
     530            0 :         m_options->diagnostic.type = DiagnosticType::DrawDataToPng;
     531            0 :         m_options->diagnostic.input << m_parser.value("diagnostic-drawdata-to-png");
     532              :     }
     533              : 
     534            0 :     if (m_parser.isSet("diagnostic-drawdiff-to-png")) {
     535            0 :         m_options->runMode = IApplication::RunMode::ConsoleApp;
     536            0 :         m_options->diagnostic.type = DiagnosticType::DrawDiffToPng;
     537            0 :         m_options->diagnostic.input = scorefiles;
     538              :     }
     539              : 
     540              :     // Testflow
     541              : #ifdef MUSE_MODULE_TESTFLOW
     542              :     m_options->testflow = muse::testflow::parseCmdOptions(m_parser, *m_options);
     543              : #endif
     544              : 
     545              :     // Startup
     546            0 :     if (m_options->runMode == IApplication::RunMode::GuiApp) {
     547            0 :         if (!scorefiles.isEmpty()) {
     548            0 :             m_options->startup.scoreUrl = QUrl::fromUserInput(scorefiles[0], QDir::currentPath(), QUrl::AssumeLocalFile);
     549              :         }
     550              : 
     551            0 :         if (m_parser.isSet("score-display-name-override")) {
     552            0 :             m_options->startup.scoreDisplayNameOverride = m_parser.value("score-display-name-override");
     553              :         }
     554              :     }
     555            0 : }
     556              : 
     557            0 : void CommandLineParser::processBuiltinArgs(const QCoreApplication& app)
     558              : {
     559              :     //! NOTE: some options require an instance of QCoreApplication
     560            0 :     m_parser.process(app);
     561            0 : }
     562              : 
     563            0 : IApplication::RunMode CommandLineParser::runMode() const
     564              : {
     565            0 :     return m_options->runMode;
     566              : }
     567              : 
     568            0 : std::shared_ptr<MuseScoreCmdOptions> CommandLineParser::options() const
     569              : {
     570            0 :     return m_options;
     571              : }
     572              : 
     573            0 : void CommandLineParser::printLongVersion() const
     574              : {
     575            0 :     if (BaseApplication::appUnstable()) {
     576            0 :         printf("MuseScore: Music Score Editor\nUnstable Prerelease for Version %s; Build %s\n",
     577            0 :                BaseApplication::appVersion().toStdString().c_str(), BaseApplication::appRevision().toStdString().c_str());
     578              :     } else {
     579            0 :         printf("MuseScore: Music Score Editor; Version %s; Build %s\n",
     580            0 :                BaseApplication::appVersion().toStdString().c_str(), BaseApplication::appRevision().toStdString().c_str());
     581              :     }
     582            0 : }
        

Generated by: LCOV version 2.0-1