Skip to content

Commit

Permalink
app: Cleanup extra command line arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
kwagyeman committed Nov 22, 2024
1 parent bcc78d4 commit 86d009d
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 31 deletions.
66 changes: 37 additions & 29 deletions src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,14 @@ const char fixedOptionsC[]
" -version Display program version\n"
// OPENMV-DIFF //
// " -client Attempt to connect to already running first instance\n"
// OPENMV-DIFF //
" -settingspath <path> Override the default path where user settings are stored\n"
" -installsettingspath <path> Override the default path from where user-independent "
"settings are read\n"
" -temporarycleansettings, -tcs Use clean settings for debug or testing reasons\n"
// OPENMV-DIFF //
// " -settingspath <path> Override the default path where user settings are stored\n"
// " -installsettingspath <path> Override the default path from where user-independent "
// "settings are read\n"
// " -temporarycleansettings, -tcs Use clean settings for debug or testing reasons\n"
// " -pid <pid> Attempt to connect to instance given by pid\n"
// " -block Block until editor is closed\n"
// " -pluginpath <path> Add a custom search path for plugins\n"
// OPENMV-DIFF //
" -pluginpath <path> Add a custom search path for plugins\n"
" -language <locale> Set the UI language\n";

const char HELP_OPTION1[] = "-h";
Expand Down Expand Up @@ -352,34 +350,44 @@ Options parseCommandLine(int argc, char *argv[])
const bool hasNext = it + 1 != end;
const auto nextArg = hasNext ? QString::fromLocal8Bit(*(it + 1)) : QString();

if (arg == SETTINGS_OPTION && hasNext) {
++it;
options.settingsPath = QDir::fromNativeSeparators(nextArg);
options.preAppArguments << arg << nextArg;
} else if (arg == INSTALL_SETTINGS_OPTION && hasNext) {
++it;
options.installSettingsPath = QDir::fromNativeSeparators(nextArg);
options.preAppArguments << arg << nextArg;
} else if (arg == PLUGINPATH_OPTION && hasNext) {
++it;
options.customPluginPaths += QDir::fromNativeSeparators(nextArg);
options.preAppArguments << arg << nextArg;
} else if (arg == LANGUAGE_OPTION && hasNext) {
// OPENMV-DIFF //
// if (arg == SETTINGS_OPTION && hasNext) {
// ++it;
// options.settingsPath = QDir::fromNativeSeparators(nextArg);
// options.preAppArguments << arg << nextArg;
// } else if (arg == INSTALL_SETTINGS_OPTION && hasNext) {
// ++it;
// options.installSettingsPath = QDir::fromNativeSeparators(nextArg);
// options.preAppArguments << arg << nextArg;
// } else if (arg == PLUGINPATH_OPTION && hasNext) {
// ++it;
// options.customPluginPaths += QDir::fromNativeSeparators(nextArg);
// options.preAppArguments << arg << nextArg;
// } else if (arg == LANGUAGE_OPTION && hasNext) {
// ++it;
// options.uiLanguage = nextArg;
// options.preAppArguments << arg << nextArg;
// } else if (arg == USER_LIBRARY_PATH_OPTION && hasNext) {
// ++it;
// options.userLibraryPath = nextArg;
// options.preAppArguments << arg << nextArg;
// } else if (arg == TEMPORARY_CLEAN_SETTINGS1 || arg == TEMPORARY_CLEAN_SETTINGS2) {
// options.wantsCleanSettings = true;
// options.preAppArguments << arg;
// } else { // arguments that are still passed on to the application
// if (arg == TEST_OPTION)
// options.hasTestOption = true;
// options.appArguments.push_back(*it);
// }
// OPENMV-DIFF //
if (arg == LANGUAGE_OPTION && hasNext) {
++it;
options.uiLanguage = nextArg;
options.preAppArguments << arg << nextArg;
} else if (arg == USER_LIBRARY_PATH_OPTION && hasNext) {
++it;
options.userLibraryPath = nextArg;
options.preAppArguments << arg << nextArg;
} else if (arg == TEMPORARY_CLEAN_SETTINGS1 || arg == TEMPORARY_CLEAN_SETTINGS2) {
options.wantsCleanSettings = true;
options.preAppArguments << arg;
} else { // arguments that are still passed on to the application
if (arg == TEST_OPTION)
options.hasTestOption = true;
options.appArguments.push_back(*it);
}
// OPENMV-DIFF //
++it;
}
return options;
Expand Down
7 changes: 6 additions & 1 deletion src/libs/extensionsystem/pluginmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,12 @@ void PluginManager::formatPluginOptions(QTextStream &str, int optionIndentation,
// OPENMV-DIFF //
// formatOption(str, pad.name, pad.parameter, pad.description, optionIndentation, descriptionIndentation);
// OPENMV-DIFF //
if (ps->name() != QStringLiteral("Core") || ((pad.name != QStringLiteral("-color")) && (pad.name != QStringLiteral("-theme"))))
if ((ps->name() != QStringLiteral("Core") || ((pad.name != QStringLiteral("-color")) &&
(pad.name != QStringLiteral("-theme")) &&
(pad.name != QStringLiteral("-lastsession")) &&
(pad.name != QStringLiteral("<session>"))))
&& (ps->name() != QStringLiteral("ProjectExplorer") || ((pad.name != QStringLiteral("-customwizard-verbose")) &&
(pad.name != QStringLiteral("-ensure-kit-for-binary")))))
formatOption(str, pad.name, pad.parameter, pad.description, optionIndentation, descriptionIndentation);
// OPENMV-DIFF //
}
Expand Down
6 changes: 5 additions & 1 deletion src/plugins/projectexplorer/projectexplorer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,11 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
qRegisterMetaType<ProjectExplorer::RunControl *>();
qRegisterMetaType<ProjectExplorer::DeployableFile>("ProjectExplorer::DeployableFile");

handleCommandLineArguments(arguments);
// OPENMV-DIFF //
// handleCommandLineArguments(arguments);
// OPENMV-DIFF //
Q_UNUSED(arguments)
// OPENMV-DIFF //

dd->m_toolChainManager = new ToolchainManager;

Expand Down

0 comments on commit 86d009d

Please sign in to comment.