diff options
author | hjk <hjk@qt.io> | 2023-01-19 17:19:57 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2023-01-19 17:25:28 +0000 |
commit | 2e98acfdfd9ca7f0373b0dfdcd42d551fbbb089f (patch) | |
tree | 323b61fe7b47fc1cb46481d7a63e414ecfb89792 /src/plugins/incredibuild | |
parent | 0fff2aa172ce2f22e4fe5e0227f6731bbd5b56dd (diff) |
Incredibuild: Tr::tr and code cosmetics
Change-Id: Id2facedde38dd09311069711b9e621a95439d433
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'src/plugins/incredibuild')
-rw-r--r-- | src/plugins/incredibuild/buildconsolebuildstep.cpp | 230 | ||||
-rw-r--r-- | src/plugins/incredibuild/buildconsolebuildstep.h | 6 | ||||
-rw-r--r-- | src/plugins/incredibuild/cmakecommandbuilder.cpp | 17 | ||||
-rw-r--r-- | src/plugins/incredibuild/cmakecommandbuilder.h | 10 | ||||
-rw-r--r-- | src/plugins/incredibuild/commandbuilder.cpp | 13 | ||||
-rw-r--r-- | src/plugins/incredibuild/commandbuilder.h | 12 | ||||
-rw-r--r-- | src/plugins/incredibuild/commandbuilderaspect.cpp | 15 | ||||
-rw-r--r-- | src/plugins/incredibuild/commandbuilderaspect.h | 6 | ||||
-rw-r--r-- | src/plugins/incredibuild/ibconsolebuildstep.cpp | 59 | ||||
-rw-r--r-- | src/plugins/incredibuild/ibconsolebuildstep.h | 6 | ||||
-rw-r--r-- | src/plugins/incredibuild/incredibuildconstants.h | 6 | ||||
-rw-r--r-- | src/plugins/incredibuild/incredibuildplugin.cpp | 6 | ||||
-rw-r--r-- | src/plugins/incredibuild/incredibuildplugin.h | 6 | ||||
-rw-r--r-- | src/plugins/incredibuild/incredibuildtr.h | 2 | ||||
-rw-r--r-- | src/plugins/incredibuild/makecommandbuilder.cpp | 22 | ||||
-rw-r--r-- | src/plugins/incredibuild/makecommandbuilder.h | 10 |
16 files changed, 187 insertions, 239 deletions
diff --git a/src/plugins/incredibuild/buildconsolebuildstep.cpp b/src/plugins/incredibuild/buildconsolebuildstep.cpp index f39daf30844..1238b2c2436 100644 --- a/src/plugins/incredibuild/buildconsolebuildstep.cpp +++ b/src/plugins/incredibuild/buildconsolebuildstep.cpp @@ -5,6 +5,7 @@ #include "commandbuilderaspect.h" #include "incredibuildconstants.h" +#include "incredibuildtr.h" #include <projectexplorer/abstractprocessstep.h> #include <projectexplorer/buildconfiguration.h> @@ -20,31 +21,7 @@ using namespace ProjectExplorer; using namespace Utils; -namespace IncrediBuild { -namespace Internal { - -namespace Constants { -const QLatin1String BUILDCONSOLE_AVOIDLOCAL("IncrediBuild.BuildConsole.AvoidLocal"); -const QLatin1String BUILDCONSOLE_PROFILEXML("IncrediBuild.BuildConsole.ProfileXml"); -const QLatin1String BUILDCONSOLE_MAXCPU("IncrediBuild.BuildConsole.MaxCpu"); -const QLatin1String BUILDCONSOLE_MAXWINVER("IncrediBuild.BuildConsole.MaxWinVer"); -const QLatin1String BUILDCONSOLE_MINWINVER("IncrediBuild.BuildConsole.MinWinVer"); -const QLatin1String BUILDCONSOLE_TITLE("IncrediBuild.BuildConsole.Title"); -const QLatin1String BUILDCONSOLE_MONFILE("IncrediBuild.BuildConsole.MonFile"); -const QLatin1String BUILDCONSOLE_SUPPRESSSTDOUT("IncrediBuild.BuildConsole.SuppressStdOut"); -const QLatin1String BUILDCONSOLE_LOGFILE("IncrediBuild.BuildConsole.LogFile"); -const QLatin1String BUILDCONSOLE_SHOWCMD("IncrediBuild.BuildConsole.ShowCmd"); -const QLatin1String BUILDCONSOLE_SHOWAGENTS("IncrediBuild.BuildConsole.ShowAgents"); -const QLatin1String BUILDCONSOLE_SHOWTIME("IncrediBuild.BuildConsole.ShowTime"); -const QLatin1String BUILDCONSOLE_HIDEHEADER("IncrediBuild.BuildConsole.HideHeader"); -const QLatin1String BUILDCONSOLE_LOGLEVEL("IncrediBuild.BuildConsole.LogLevel"); -const QLatin1String BUILDCONSOLE_SETENV("IncrediBuild.BuildConsole.SetEnv"); -const QLatin1String BUILDCONSOLE_STOPONERROR("IncrediBuild.BuildConsole.StopOnError"); -const QLatin1String BUILDCONSOLE_ADDITIONALARGUMENTS("IncrediBuild.BuildConsole.AdditionalArguments"); -const QLatin1String BUILDCONSOLE_OPENMONITOR("IncrediBuild.BuildConsole.OpenMonitor"); -const QLatin1String BUILDCONSOLE_KEEPJOBNUM("IncrediBuild.BuildConsole.KeepJobNum"); -const QLatin1String BUILDCONSOLE_COMMANDBUILDER("IncrediBuild.BuildConsole.CommandBuilder"); -} +namespace IncrediBuild::Internal { static QString normalizeWinVerArgument(QString winVer) { @@ -69,8 +46,6 @@ const QStringList &supportedWindowsVersions() class BuildConsoleBuildStep : public AbstractProcessStep { - Q_DECLARE_TR_FUNCTIONS(IncrediBuild::Internal::BuildConsoleBuildStep) - public: BuildConsoleBuildStep(BuildStepList *buildStepList, Id id); @@ -80,176 +55,176 @@ public: BuildConsoleBuildStep::BuildConsoleBuildStep(BuildStepList *buildStepList, Id id) : AbstractProcessStep(buildStepList, id) { - setDisplayName(tr("IncrediBuild for Windows")); + setDisplayName(Tr::tr("IncrediBuild for Windows")); - addAspect<TextDisplay>("<b>" + tr("Target and Configuration")); + addAspect<TextDisplay>("<b>" + Tr::tr("Target and Configuration")); auto commandBuilder = addAspect<CommandBuilderAspect>(this); - commandBuilder->setSettingsKey(Constants::BUILDCONSOLE_COMMANDBUILDER); + commandBuilder->setSettingsKey("IncrediBuild.BuildConsole.CommandBuilder"); - addAspect<TextDisplay>("<i>" + tr("Enter the appropriate arguments to your build command.")); - addAspect<TextDisplay>("<i>" + tr("Make sure the build command's multi-job " - "parameter value is large enough " - "(such as -j200 for the JOM or Make build tools)")); + addAspect<TextDisplay>("<i>" + Tr::tr("Enter the appropriate arguments to your build command.")); + addAspect<TextDisplay>("<i>" + Tr::tr("Make sure the build command's multi-job " + "parameter value is large enough " + "(such as -j200 for the JOM or Make build tools)")); auto keepJobNum = addAspect<BoolAspect>(); - keepJobNum->setSettingsKey(Constants::BUILDCONSOLE_KEEPJOBNUM); - keepJobNum->setLabel(tr("Keep original jobs number:")); - keepJobNum->setToolTip(tr("Forces IncrediBuild to not override the -j command line switch, " - "that controls the number of parallel spawned tasks. The default " - "IncrediBuild behavior is to set it to 200.")); + keepJobNum->setSettingsKey("IncrediBuild.BuildConsole.KeepJobNum"); + keepJobNum->setLabel(Tr::tr("Keep original jobs number:")); + keepJobNum->setToolTip(Tr::tr("Forces IncrediBuild to not override the -j command line switch, " + "that controls the number of parallel spawned tasks. The default " + "IncrediBuild behavior is to set it to 200.")); - addAspect<TextDisplay>("<b>" + tr("IncrediBuild Distribution Control")); + addAspect<TextDisplay>("<b>" + Tr::tr("IncrediBuild Distribution Control")); auto profileXml = addAspect<StringAspect>(); - profileXml->setSettingsKey(Constants::BUILDCONSOLE_PROFILEXML); - profileXml->setLabelText(tr("Profile.xml:")); + profileXml->setSettingsKey("IncrediBuild.BuildConsole.ProfileXml"); + profileXml->setLabelText(Tr::tr("Profile.xml:")); profileXml->setDisplayStyle(StringAspect::PathChooserDisplay); profileXml->setExpectedKind(PathChooser::Kind::File); profileXml->setBaseFileName(PathChooser::homePath()); profileXml->setHistoryCompleter("IncrediBuild.BuildConsole.ProfileXml.History"); - profileXml->setToolTip(tr("Defines how Automatic " - "Interception Interface should handle the various processes " - "involved in a distributed job. It is not necessary for " - "\"Visual Studio\" or \"Make and Build tools\" builds, " - "but can be used to provide configuration options if those " - "builds use additional processes that are not included in " - "those packages. It is required to configure distributable " - "processes in \"Dev Tools\" builds.")); + profileXml->setToolTip(Tr::tr("Defines how Automatic " + "Interception Interface should handle the various processes " + "involved in a distributed job. It is not necessary for " + "\"Visual Studio\" or \"Make and Build tools\" builds, " + "but can be used to provide configuration options if those " + "builds use additional processes that are not included in " + "those packages. It is required to configure distributable " + "processes in \"Dev Tools\" builds.")); auto avoidLocal = addAspect<BoolAspect>(); - avoidLocal->setSettingsKey(Constants::BUILDCONSOLE_AVOIDLOCAL); - avoidLocal->setLabel(tr("Avoid local task execution:")); - avoidLocal->setToolTip(tr("Overrides the Agent Settings dialog Avoid task execution on local " - "machine when possible option. This allows to free more resources " - "on the initiator machine and could be beneficial to distribution " - "in scenarios where the initiating machine is bottlenecking the " - "build with High CPU usage.")); + avoidLocal->setSettingsKey("IncrediBuild.BuildConsole.AvoidLocal"); + avoidLocal->setLabel(Tr::tr("Avoid local task execution:")); + avoidLocal->setToolTip(Tr::tr("Overrides the Agent Settings dialog Avoid task execution on local " + "machine when possible option. This allows to free more resources " + "on the initiator machine and could be beneficial to distribution " + "in scenarios where the initiating machine is bottlenecking the " + "build with High CPU usage.")); auto maxCpu = addAspect<IntegerAspect>(); - maxCpu->setSettingsKey(Constants::BUILDCONSOLE_MAXCPU); - maxCpu->setToolTip(tr("Determines the maximum number of CPU cores that can be used in a " - "build, regardless of the number of available Agents. " - "It takes into account both local and remote cores, even if the " - "Avoid Task Execution on Local Machine option is selected.")); - maxCpu->setLabel(tr("Maximum CPUs to utilize in the build:")); + maxCpu->setSettingsKey("IncrediBuild.BuildConsole.MaxCpu"); + maxCpu->setToolTip(Tr::tr("Determines the maximum number of CPU cores that can be used in a " + "build, regardless of the number of available Agents. " + "It takes into account both local and remote cores, even if the " + "Avoid Task Execution on Local Machine option is selected.")); + maxCpu->setLabel(Tr::tr("Maximum CPUs to utilize in the build:")); maxCpu->setRange(0, 65536); auto maxWinVer = addAspect<SelectionAspect>(); - maxWinVer->setSettingsKey(Constants::BUILDCONSOLE_MAXWINVER); - maxWinVer->setDisplayName(tr("Newest allowed helper machine OS:")); + maxWinVer->setSettingsKey("IncrediBuild.BuildConsole.MaxWinVer"); + maxWinVer->setDisplayName(Tr::tr("Newest allowed helper machine OS:")); maxWinVer->setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox); - maxWinVer->setToolTip(tr("Specifies the newest operating system installed on a helper " - "machine to be allowed to participate as helper in the build.")); + maxWinVer->setToolTip(Tr::tr("Specifies the newest operating system installed on a helper " + "machine to be allowed to participate as helper in the build.")); for (const QString &version : supportedWindowsVersions()) maxWinVer->addOption(version); auto minWinVer = addAspect<SelectionAspect>(); - minWinVer->setSettingsKey(Constants::BUILDCONSOLE_MINWINVER); - minWinVer->setDisplayName(tr("Oldest allowed helper machine OS:")); + minWinVer->setSettingsKey("IncrediBuild.BuildConsole.MinWinVer"); + minWinVer->setDisplayName(Tr::tr("Oldest allowed helper machine OS:")); minWinVer->setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox); - minWinVer->setToolTip(tr("Specifies the oldest operating system installed on a helper " - "machine to be allowed to participate as helper in the build.")); + minWinVer->setToolTip(Tr::tr("Specifies the oldest operating system installed on a helper " + "machine to be allowed to participate as helper in the build.")); for (const QString &version : supportedWindowsVersions()) minWinVer->addOption(version); - addAspect<TextDisplay>("<b>" + tr("Output and Logging")); + addAspect<TextDisplay>("<b>" + Tr::tr("Output and Logging")); auto title = addAspect<StringAspect>(); - title->setSettingsKey(Constants::BUILDCONSOLE_TITLE); - title->setLabelText(tr("Build title:")); + title->setSettingsKey("IncrediBuild.BuildConsole.Title"); + title->setLabelText(Tr::tr("Build title:")); title->setDisplayStyle(StringAspect::LineEditDisplay); - title->setToolTip(tr("Specifies a custom header line which will be displayed in the " - "beginning of the build output text. This title will also be used " - "for the Build History and Build Monitor displays.")); + title->setToolTip(Tr::tr("Specifies a custom header line which will be displayed in the " + "beginning of the build output text. This title will also be used " + "for the Build History and Build Monitor displays.")); auto monFile = addAspect<StringAspect>(); - monFile->setSettingsKey(Constants::BUILDCONSOLE_MONFILE); - monFile->setLabelText(tr("Save IncrediBuild monitor file:")); + monFile->setSettingsKey("IncrediBuild.BuildConsole.MonFile"); + monFile->setLabelText(Tr::tr("Save IncrediBuild monitor file:")); monFile->setDisplayStyle(StringAspect::PathChooserDisplay); monFile->setExpectedKind(PathChooser::Kind::Any); monFile->setBaseFileName(PathChooser::homePath()); monFile->setHistoryCompleter(QLatin1String("IncrediBuild.BuildConsole.MonFile.History")); - monFile->setToolTip(tr("Writes a copy of the build progress file (.ib_mon) to the specified " - "location. If only a folder name is given, a generated GUID will serve " - "as the file name. The full path of the saved Build Monitor will be " - "written to the end of the build output.")); + monFile->setToolTip(Tr::tr("Writes a copy of the build progress file (.ib_mon) to the specified " + "location. If only a folder name is given, a generated GUID will serve " + "as the file name. The full path of the saved Build Monitor will be " + "written to the end of the build output.")); auto suppressStdOut = addAspect<BoolAspect>(); - suppressStdOut->setSettingsKey(Constants::BUILDCONSOLE_SUPPRESSSTDOUT); - suppressStdOut->setLabel(tr("Suppress STDOUT:")); - suppressStdOut->setToolTip(tr("Does not write anything to the standard output.")); + suppressStdOut->setSettingsKey("IncrediBuild.BuildConsole.SuppressStdOut"); + suppressStdOut->setLabel(Tr::tr("Suppress STDOUT:")); + suppressStdOut->setToolTip(Tr::tr("Does not write anything to the standard output.")); auto logFile = addAspect<StringAspect>(); - logFile->setSettingsKey(Constants::BUILDCONSOLE_LOGFILE); - logFile->setLabelText(tr("Output Log file:")); + logFile->setSettingsKey("IncrediBuild.BuildConsole.LogFile"); + logFile->setLabelText(Tr::tr("Output Log file:")); logFile->setDisplayStyle(StringAspect::PathChooserDisplay); logFile->setExpectedKind(PathChooser::Kind::SaveFile); logFile->setBaseFileName(PathChooser::homePath()); logFile->setHistoryCompleter(QLatin1String("IncrediBuild.BuildConsole.LogFile.History")); - logFile->setToolTip(tr("Writes build output to a file.")); + logFile->setToolTip(Tr::tr("Writes build output to a file.")); auto showCmd = addAspect<BoolAspect>(); - showCmd->setSettingsKey(Constants::BUILDCONSOLE_SHOWCMD); - showCmd->setLabel(tr("Show Commands in output:")); - showCmd->setToolTip(tr("Shows, for each file built, the command-line used by IncrediBuild " - "to build the file.")); + showCmd->setSettingsKey("IncrediBuild.BuildConsole.ShowCmd"); + showCmd->setLabel(Tr::tr("Show Commands in output:")); + showCmd->setToolTip(Tr::tr("Shows, for each file built, the command-line used by IncrediBuild " + "to build the file.")); auto showAgents = addAspect<BoolAspect>(); - showAgents->setSettingsKey(Constants::BUILDCONSOLE_SHOWAGENTS); - showAgents->setLabel(tr("Show Agents in output:")); - showAgents->setToolTip(tr("Shows the Agent used to build each file.")); + showAgents->setSettingsKey("IncrediBuild.BuildConsole.ShowAgents"); + showAgents->setLabel(Tr::tr("Show Agents in output:")); + showAgents->setToolTip(Tr::tr("Shows the Agent used to build each file.")); auto showTime = addAspect<BoolAspect>(); - showTime->setSettingsKey(Constants::BUILDCONSOLE_SHOWTIME); - showTime->setLabel(tr("Show Time in output:")); - showTime->setToolTip(tr("Shows the Start and Finish time for each file built.")); + showTime->setSettingsKey("IncrediBuild.BuildConsole.ShowTime"); + showTime->setLabel(Tr::tr("Show Time in output:")); + showTime->setToolTip(Tr::tr("Shows the Start and Finish time for each file built.")); auto hideHeader = addAspect<BoolAspect>(); - hideHeader->setSettingsKey(Constants::BUILDCONSOLE_HIDEHEADER); - hideHeader->setLabel(tr("Hide IncrediBuild Header in output:")); - hideHeader->setToolTip(tr("Suppresses IncrediBuild's header in the build output")); + hideHeader->setSettingsKey("IncrediBuild.BuildConsole.HideHeader"); + hideHeader->setLabel(Tr::tr("Hide IncrediBuild Header in output:")); + hideHeader->setToolTip(Tr::tr("Suppresses IncrediBuild's header in the build output")); auto logLevel = addAspect<SelectionAspect>(); - logLevel->setSettingsKey(Constants::BUILDCONSOLE_LOGLEVEL); - logLevel->setDisplayName(tr("Internal IncrediBuild logging level:")); + logLevel->setSettingsKey("IncrediBuild.BuildConsole.LogLevel"); + logLevel->setDisplayName(Tr::tr("Internal IncrediBuild logging level:")); logLevel->setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox); logLevel->addOption(QString()); logLevel->addOption("Minimal"); logLevel->addOption("Extended"); logLevel->addOption("Detailed"); - logLevel->setToolTip(tr("Overrides the internal Incredibuild logging level for this build. " - "Does not affect output or any user accessible logging. Used mainly " - "to troubleshoot issues with the help of IncrediBuild support")); + logLevel->setToolTip(Tr::tr("Overrides the internal Incredibuild logging level for this build. " + "Does not affect output or any user accessible logging. Used mainly " + "to troubleshoot issues with the help of IncrediBuild support")); - addAspect<TextDisplay>("<b>" + tr("Miscellaneous")); + addAspect<TextDisplay>("<b>" + Tr::tr("Miscellaneous")); auto setEnv = addAspect<StringAspect>(); - setEnv->setSettingsKey(Constants::BUILDCONSOLE_SETENV); - setEnv->setLabelText(tr("Set an Environment Variable:")); + setEnv->setSettingsKey("IncrediBuild.BuildConsole.SetEnv"); + setEnv->setLabelText(Tr::tr("Set an Environment Variable:")); setEnv->setDisplayStyle(StringAspect::LineEditDisplay); - setEnv->setToolTip(tr("Sets or overrides environment variables for the context of the build.")); + setEnv->setToolTip(Tr::tr("Sets or overrides environment variables for the context of the build.")); auto stopOnError = addAspect<BoolAspect>(); - stopOnError->setSettingsKey(Constants::BUILDCONSOLE_STOPONERROR); - stopOnError->setLabel(tr("Stop on errors:")); - stopOnError->setToolTip(tr("When specified, the execution will stop as soon as an error " - "is encountered. This is the default behavior in " - "\"Visual Studio\" builds, but not the default for " - "\"Make and Build tools\" or \"Dev Tools\" builds")); + stopOnError->setSettingsKey("IncrediBuild.BuildConsole.StopOnError"); + stopOnError->setLabel(Tr::tr("Stop on errors:")); + stopOnError->setToolTip(Tr::tr("When specified, the execution will stop as soon as an error " + "is encountered. This is the default behavior in " + "\"Visual Studio\" builds, but not the default for " + "\"Make and Build tools\" or \"Dev Tools\" builds")); auto additionalArguments = addAspect<StringAspect>(); - additionalArguments->setSettingsKey(Constants::BUILDCONSOLE_ADDITIONALARGUMENTS); - additionalArguments->setLabelText(tr("Additional Arguments:")); + additionalArguments->setSettingsKey("IncrediBuild.BuildConsole.AdditionalArguments"); + additionalArguments->setLabelText(Tr::tr("Additional Arguments:")); additionalArguments->setDisplayStyle(StringAspect::LineEditDisplay); - additionalArguments->setToolTip(tr("Add additional buildconsole arguments manually. " - "The value of this field will be concatenated to the " - "final buildconsole command line")); + additionalArguments->setToolTip(Tr::tr("Add additional buildconsole arguments manually. " + "The value of this field will be concatenated to the " + "final buildconsole command line")); auto openMonitor = addAspect<BoolAspect>(); - openMonitor->setSettingsKey(Constants::BUILDCONSOLE_OPENMONITOR); - openMonitor->setLabel(tr("Open Build Monitor:")); - openMonitor->setToolTip(tr("Opens Build Monitor once the build starts.")); + openMonitor->setSettingsKey("IncrediBuild.BuildConsole.OpenMonitor"); + openMonitor->setLabel(Tr::tr("Open Build Monitor:")); + openMonitor->setToolTip(Tr::tr("Opens Build Monitor once the build starts.")); setCommandLineProvider([=] { QStringList args; @@ -328,10 +303,9 @@ void BuildConsoleBuildStep::setupOutputFormatter(OutputFormatter *formatter) BuildConsoleStepFactory::BuildConsoleStepFactory() { registerStep<BuildConsoleBuildStep>(IncrediBuild::Constants::BUILDCONSOLE_BUILDSTEP_ID); - setDisplayName(BuildConsoleBuildStep::tr("IncrediBuild for Windows")); + setDisplayName(Tr::tr("IncrediBuild for Windows")); setSupportedStepLists({ProjectExplorer::Constants::BUILDSTEPS_BUILD, ProjectExplorer::Constants::BUILDSTEPS_CLEAN}); } -} // namespace Internal -} // namespace IncrediBuild +} // IncrediBuild::Internal diff --git a/src/plugins/incredibuild/buildconsolebuildstep.h b/src/plugins/incredibuild/buildconsolebuildstep.h index b1a1c6543b2..813e8dcb325 100644 --- a/src/plugins/incredibuild/buildconsolebuildstep.h +++ b/src/plugins/incredibuild/buildconsolebuildstep.h @@ -5,8 +5,7 @@ #include <projectexplorer/buildstep.h> -namespace IncrediBuild { -namespace Internal { +namespace IncrediBuild::Internal { class BuildConsoleStepFactory final : public ProjectExplorer::BuildStepFactory { @@ -14,5 +13,4 @@ public: BuildConsoleStepFactory(); }; -} // namespace Internal -} // namespace IncrediBuild +} // IncrediBuild::Internal diff --git a/src/plugins/incredibuild/cmakecommandbuilder.cpp b/src/plugins/incredibuild/cmakecommandbuilder.cpp index e39389f8f5e..8732601cbc4 100644 --- a/src/plugins/incredibuild/cmakecommandbuilder.cpp +++ b/src/plugins/incredibuild/cmakecommandbuilder.cpp @@ -3,6 +3,8 @@ #include "cmakecommandbuilder.h" +#include "incredibuildtr.h" + #include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildsteplist.h> @@ -16,14 +18,18 @@ using namespace ProjectExplorer; using namespace Utils; -namespace IncrediBuild { -namespace Internal { +namespace IncrediBuild::Internal { -QList<Utils::Id> CMakeCommandBuilder::migratableSteps() const +QList<Id> CMakeCommandBuilder::migratableSteps() const { return {CMakeProjectManager::Constants::CMAKE_BUILD_STEP_ID}; } +QString CMakeCommandBuilder::displayName() const +{ + return Tr::tr("CMake"); +} + FilePath CMakeCommandBuilder::defaultCommand() const { const QString defaultCMake = "cmake"; @@ -42,7 +48,7 @@ QString CMakeCommandBuilder::defaultArguments() const if (buildDir.isEmpty()) buildDir = "."; - return Utils::ProcessArgs::joinArgs({"--build", buildDir, "--target", "all"}); + return ProcessArgs::joinArgs({"--build", buildDir, "--target", "all"}); } QString CMakeCommandBuilder::setMultiProcessArg(QString args) @@ -54,5 +60,4 @@ QString CMakeCommandBuilder::setMultiProcessArg(QString args) return args; } -} // namespace Internal -} // namespace IncrediBuild +} // IncrediBuild::Internal diff --git a/src/plugins/incredibuild/cmakecommandbuilder.h b/src/plugins/incredibuild/cmakecommandbuilder.h index 3119448b655..29429a3e829 100644 --- a/src/plugins/incredibuild/cmakecommandbuilder.h +++ b/src/plugins/incredibuild/cmakecommandbuilder.h @@ -5,25 +5,21 @@ #include "commandbuilder.h" -namespace IncrediBuild { -namespace Internal { +namespace IncrediBuild::Internal { class CMakeCommandBuilder : public CommandBuilder { - Q_DECLARE_TR_FUNCTIONS(IncrediBuild::Internal::CMakeCommandBuilder) - public: CMakeCommandBuilder(ProjectExplorer::BuildStep *buildStep) : CommandBuilder(buildStep) {} private: QList<Utils::Id> migratableSteps() const final; QString id() const final { return "CMakeCommandBuilder"; } - QString displayName() const final { return tr("CMake"); } + QString displayName() const final; Utils::FilePath defaultCommand() const final; QString defaultArguments() const final; QString setMultiProcessArg(QString args) final; }; -} // namespace Internal -} // namespace IncrediBuild +} // IncrediBuild::Internal diff --git a/src/plugins/incredibuild/commandbuilder.cpp b/src/plugins/incredibuild/commandbuilder.cpp index 73585de89f6..9febc343df0 100644 --- a/src/plugins/incredibuild/commandbuilder.cpp +++ b/src/plugins/incredibuild/commandbuilder.cpp @@ -3,14 +3,20 @@ #include "commandbuilder.h" +#include "incredibuildtr.h" + using namespace Utils; -namespace IncrediBuild { -namespace Internal { +namespace IncrediBuild::Internal { const char CUSTOMCOMMANDBUILDER_COMMAND[] = "IncrediBuild.BuildConsole.%1.Command"; const char CUSTOMCOMMANDBUILDER_ARGS[] = "IncrediBuild.BuildConsole.%1.Arguments"; +QString CommandBuilder::displayName() const +{ + return Tr::tr("Custom Command"); +} + void CommandBuilder::fromMap(const QVariantMap &map) { m_command = FilePath::fromSettings(map.value(QString(CUSTOMCOMMANDBUILDER_COMMAND).arg(id()))); @@ -36,5 +42,4 @@ void CommandBuilder::setArguments(const QString &arguments) m_args = arguments; } -} // namespace Internal -} // namespace IncrediBuild +} // IncrediBuild::Internal diff --git a/src/plugins/incredibuild/commandbuilder.h b/src/plugins/incredibuild/commandbuilder.h index 03f53cc27a7..7d800e91b6a 100644 --- a/src/plugins/incredibuild/commandbuilder.h +++ b/src/plugins/incredibuild/commandbuilder.h @@ -5,15 +5,10 @@ #include <projectexplorer/buildstep.h> -#include <QCoreApplication> - -namespace IncrediBuild { -namespace Internal { +namespace IncrediBuild::Internal { class CommandBuilder { - Q_DECLARE_TR_FUNCTIONS(IncrediBuild::Internal::CommandBuilder) - public: CommandBuilder(ProjectExplorer::BuildStep *buildStep) : m_buildStep(buildStep) {} virtual ~CommandBuilder() = default; @@ -23,7 +18,7 @@ public: ProjectExplorer::BuildStep *buildStep() const { return m_buildStep; } virtual QString id() const { return "CustomCommandBuilder"; } - virtual QString displayName() const { return tr("Custom Command"); } + virtual QString displayName() const; virtual void fromMap(const QVariantMap &map); virtual void toMap(QVariantMap *map) const; @@ -45,5 +40,4 @@ private: QString m_args; }; -} // namespace Internal -} // namespace IncrediBuild +} // IncrediBuild::Internal diff --git a/src/plugins/incredibuild/commandbuilderaspect.cpp b/src/plugins/incredibuild/commandbuilderaspect.cpp index b08e16c11fc..4e63a848024 100644 --- a/src/plugins/incredibuild/commandbuilderaspect.cpp +++ b/src/plugins/incredibuild/commandbuilderaspect.cpp @@ -5,6 +5,7 @@ #include "cmakecommandbuilder.h" #include "incredibuildconstants.h" +#include "incredibuildtr.h" #include "makecommandbuilder.h" #include <projectexplorer/abstractprocessstep.h> @@ -22,8 +23,7 @@ using namespace ProjectExplorer; using namespace Utils; -namespace IncrediBuild { -namespace Internal { +namespace IncrediBuild::Internal { class CommandBuilderAspectPrivate { @@ -143,8 +143,8 @@ void CommandBuilderAspect::addToLayout(LayoutBuilder &builder) } if (!d->label) { - d->label = new QLabel(tr("Command Helper:")); - d->label->setToolTip(tr("Select a helper to establish the build command.")); + d->label = new QLabel(Tr::tr("Command Helper:")); + d->label->setToolTip(Tr::tr("Select a helper to establish the build command.")); } // On first creation of the step, attempt to detect and migrate from preceding steps @@ -152,8 +152,8 @@ void CommandBuilderAspect::addToLayout(LayoutBuilder &builder) d->tryToMigrate(); builder.addRow({d->label.data(), d->commandBuilder.data()}); - builder.addRow({tr("Make command:"), d->makePathChooser.data()}); - builder.addRow({tr("Make arguments:"), d->makeArgumentsLineEdit.data()}); + builder.addRow({Tr::tr("Make command:"), d->makePathChooser.data()}); + builder.addRow({Tr::tr("Make arguments:"), d->makeArgumentsLineEdit.data()}); updateGui(); } @@ -197,5 +197,4 @@ void CommandBuilderAspect::updateGui() d->makeArgumentsLineEdit->setText(d->m_activeCommandBuilder->arguments()); } -} // namespace Internal -} // namespace IncrediBuild +} // IncrediBuild::Internal diff --git a/src/plugins/incredibuild/commandbuilderaspect.h b/src/plugins/incredibuild/commandbuilderaspect.h index 4349d7aca2e..c1d1a4db7b1 100644 --- a/src/plugins/incredibuild/commandbuilderaspect.h +++ b/src/plugins/incredibuild/commandbuilderaspect.h @@ -10,8 +10,7 @@ #include <QLabel> #include <QPointer> -namespace IncrediBuild { -namespace Internal { +namespace IncrediBuild::Internal { class CommandBuilderAspect final : public Utils::BaseAspect { @@ -33,5 +32,4 @@ private: class CommandBuilderAspectPrivate *d = nullptr; }; -} // namespace Internal -} // namespace IncrediBuild +} // IncrediBuild::Internal diff --git a/src/plugins/incredibuild/ibconsolebuildstep.cpp b/src/plugins/incredibuild/ibconsolebuildstep.cpp index 7106eaefaa0..3bd453fdb8c 100644 --- a/src/plugins/incredibuild/ibconsolebuildstep.cpp +++ b/src/plugins/incredibuild/ibconsolebuildstep.cpp @@ -5,6 +5,7 @@ #include "commandbuilderaspect.h" #include "incredibuildconstants.h" +#include "incredibuildtr.h" #include <projectexplorer/abstractprocessstep.h> #include <projectexplorer/buildconfiguration.h> @@ -19,21 +20,10 @@ using namespace ProjectExplorer; using namespace Utils; -namespace IncrediBuild { -namespace Internal { - -namespace Constants { -const QLatin1String IBCONSOLE_NICE("IncrediBuild.IBConsole.Nice"); -const QLatin1String IBCONSOLE_COMMANDBUILDER("IncrediBuild.IBConsole.CommandBuilder"); -const QLatin1String IBCONSOLE_KEEPJOBNUM("IncrediBuild.IBConsole.KeepJobNum"); -const QLatin1String IBCONSOLE_FORCEREMOTE("IncrediBuild.IBConsole.ForceRemote"); -const QLatin1String IBCONSOLE_ALTERNATE("IncrediBuild.IBConsole.Alternate"); -} +namespace IncrediBuild::Internal { class IBConsoleBuildStep final : public AbstractProcessStep { - Q_DECLARE_TR_FUNCTIONS(IncrediBuild::Internal::IBConsoleBuildStep) - public: IBConsoleBuildStep(BuildStepList *buildStepList, Id id); @@ -43,40 +33,40 @@ public: IBConsoleBuildStep::IBConsoleBuildStep(BuildStepList *buildStepList, Id id) : AbstractProcessStep(buildStepList, id) { - setDisplayName(tr("IncrediBuild for Linux")); + setDisplayName(Tr::tr("IncrediBuild for Linux")); - addAspect<TextDisplay>("<b>" + tr("Target and Configuration")); + addAspect<TextDisplay>("<b>" + Tr::tr("Target and Configuration")); auto commandBuilder = addAspect<CommandBuilderAspect>(this); - commandBuilder->setSettingsKey(Constants::IBCONSOLE_COMMANDBUILDER); + commandBuilder->setSettingsKey("IncrediBuild.IBConsole.CommandBuilder"); - addAspect<TextDisplay>("<i>" + tr("Enter the appropriate arguments to your build command.")); - addAspect<TextDisplay>("<i>" + tr("Make sure the build command's " - "multi-job parameter value is large enough (such as " - "-j200 for the JOM or Make build tools)")); + addAspect<TextDisplay>("<i>" + Tr::tr("Enter the appropriate arguments to your build command.")); + addAspect<TextDisplay>("<i>" + Tr::tr("Make sure the build command's " + "multi-job parameter value is large enough (such as " + "-j200 for the JOM or Make build tools)")); auto keepJobNum = addAspect<BoolAspect>(); - keepJobNum->setSettingsKey(Constants::IBCONSOLE_KEEPJOBNUM); - keepJobNum->setLabel(tr("Keep original jobs number:")); - keepJobNum->setToolTip(tr("Forces IncrediBuild to not override the -j command line switch, " - "that controls the number of parallel spawned tasks. The default " - "IncrediBuild behavior is to set it to 200.")); + keepJobNum->setSettingsKey("IncrediBuild.IBConsole.KeepJobNum"); + keepJobNum->setLabel(Tr::tr("Keep original jobs number:")); + keepJobNum->setToolTip(Tr::tr("Forces IncrediBuild to not override the -j command line switch, " + "that controls the number of parallel spawned tasks. The default " + "IncrediBuild behavior is to set it to 200.")); - addAspect<TextDisplay>("<b>" + tr("IncrediBuild Distribution Control")); + addAspect<TextDisplay>("<b>" + Tr::tr("IncrediBuild Distribution Control")); auto nice = addAspect<IntegerAspect>(); - nice->setSettingsKey(Constants::IBCONSOLE_NICE); - nice->setToolTip(tr("Specify nice value. Nice Value should be numeric and between -20 and 19")); - nice->setLabel(tr("Nice value:")); + nice->setSettingsKey("IncrediBuild.IBConsole.Nice"); + nice->setToolTip(Tr::tr("Specify nice value. Nice Value should be numeric and between -20 and 19")); + nice->setLabel(Tr::tr("Nice value:")); nice->setRange(-20, 19); auto forceRemote = addAspect<BoolAspect>(); - forceRemote->setSettingsKey(Constants::IBCONSOLE_ALTERNATE); - forceRemote->setLabel(tr("Force remote:")); + forceRemote->setSettingsKey("IncrediBuild.IBConsole.Alternate"); + forceRemote->setLabel(Tr::tr("Force remote:")); auto alternate = addAspect<BoolAspect>(); - alternate->setSettingsKey(Constants::IBCONSOLE_FORCEREMOTE); - alternate->setLabel(tr("Alternate tasks preference:")); + alternate->setSettingsKey("IncrediBuild.IBConsole.ForceRemote"); + alternate->setLabel(Tr::tr("Alternate tasks preference:")); setCommandLineProvider([=] { QStringList args; @@ -109,10 +99,9 @@ void IBConsoleBuildStep::setupOutputFormatter(OutputFormatter *formatter) IBConsoleStepFactory::IBConsoleStepFactory() { registerStep<IBConsoleBuildStep>(IncrediBuild::Constants::IBCONSOLE_BUILDSTEP_ID); - setDisplayName(IBConsoleBuildStep::tr("IncrediBuild for Linux")); + setDisplayName(Tr::tr("IncrediBuild for Linux")); setSupportedStepLists({ProjectExplorer::Constants::BUILDSTEPS_BUILD, ProjectExplorer::Constants::BUILDSTEPS_CLEAN}); } -} // namespace Internal -} // namespace IncrediBuild +} // IncrediBuild::Internal diff --git a/src/plugins/incredibuild/ibconsolebuildstep.h b/src/plugins/incredibuild/ibconsolebuildstep.h index 4065ecdaeb3..e44d27e5570 100644 --- a/src/plugins/incredibuild/ibconsolebuildstep.h +++ b/src/plugins/incredibuild/ibconsolebuildstep.h @@ -5,8 +5,7 @@ #include <projectexplorer/buildstep.h> -namespace IncrediBuild { -namespace Internal { +namespace IncrediBuild::Internal { class IBConsoleStepFactory : public ProjectExplorer::BuildStepFactory { @@ -14,5 +13,4 @@ public: IBConsoleStepFactory(); }; -} // namespace Internal -} // namespace IncrediBuild +} // IncrediBuild::Internal diff --git a/src/plugins/incredibuild/incredibuildconstants.h b/src/plugins/incredibuild/incredibuildconstants.h index 1808960cf00..60031c99631 100644 --- a/src/plugins/incredibuild/incredibuildconstants.h +++ b/src/plugins/incredibuild/incredibuildconstants.h @@ -3,13 +3,11 @@ #pragma once -namespace IncrediBuild { -namespace Constants { +namespace IncrediBuild::Constants { const char INCREDIBUILD_BUILDSTEP_TYPE[] = "IncrediBuild.BuildStep.Type"; const char BUILDCONSOLE_BUILDSTEP_ID[] = "IncrediBuild.BuildStep.BuildConsole"; const char IBCONSOLE_BUILDSTEP_ID[] = "IncrediBuild.BuildStep.IB_Console"; -} // namespace Constants -} // namespace IncrediBuild +} // IncrediBuild::Constants diff --git a/src/plugins/incredibuild/incredibuildplugin.cpp b/src/plugins/incredibuild/incredibuildplugin.cpp index a166508c8a1..a54254ddd2e 100644 --- a/src/plugins/incredibuild/incredibuildplugin.cpp +++ b/src/plugins/incredibuild/incredibuildplugin.cpp @@ -6,8 +6,7 @@ #include "buildconsolebuildstep.h" #include "ibconsolebuildstep.h" -namespace IncrediBuild { -namespace Internal { +namespace IncrediBuild::Internal { class IncrediBuildPluginPrivate { @@ -31,5 +30,4 @@ bool IncrediBuildPlugin::initialize(const QStringList &arguments, QString *error return true; } -} // namespace Internal -} // namespace IncrediBuild +} // IncrediBuild::Internal diff --git a/src/plugins/incredibuild/incredibuildplugin.h b/src/plugins/incredibuild/incredibuildplugin.h index 94d0975bc4f..0ef93934a70 100644 --- a/src/plugins/incredibuild/incredibuildplugin.h +++ b/src/plugins/incredibuild/incredibuildplugin.h @@ -5,8 +5,7 @@ #include <extensionsystem/iplugin.h> -namespace IncrediBuild { -namespace Internal { +namespace IncrediBuild::Internal { class IncrediBuildPlugin final : public ExtensionSystem::IPlugin { @@ -23,5 +22,4 @@ private: class IncrediBuildPluginPrivate *d = nullptr; }; -} // namespace Internal -} // namespace IncrediBuild +} // IncrediBuild::Internal diff --git a/src/plugins/incredibuild/incredibuildtr.h b/src/plugins/incredibuild/incredibuildtr.h index b1ce097c6c1..5a7b5d6cf5d 100644 --- a/src/plugins/incredibuild/incredibuildtr.h +++ b/src/plugins/incredibuild/incredibuildtr.h @@ -12,4 +12,4 @@ struct Tr Q_DECLARE_TR_FUNCTIONS(::IncrediBuild) }; -} // namespace IncrediBuild +} // IncrediBuild diff --git a/src/plugins/incredibuild/makecommandbuilder.cpp b/src/plugins/incredibuild/makecommandbuilder.cpp index cad7ee089b0..f5baa68a46a 100644 --- a/src/plugins/incredibuild/makecommandbuilder.cpp +++ b/src/plugins/incredibuild/makecommandbuilder.cpp @@ -3,9 +3,10 @@ #include "makecommandbuilder.h" +#include "incredibuildtr.h" + #include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildstep.h> -#include <projectexplorer/buildsteplist.h> #include <projectexplorer/kitinformation.h> #include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/target.h> @@ -15,24 +16,26 @@ #include <qmakeprojectmanager/qmakeprojectmanagerconstants.h> // Compile-time only #include <QDebug> -#include <QFileInfo> #include <QRegularExpression> using namespace ProjectExplorer; using namespace Utils; -namespace IncrediBuild { -namespace Internal { +namespace IncrediBuild::Internal { -QList<Utils::Id> MakeCommandBuilder::migratableSteps() const +QList<Id> MakeCommandBuilder::migratableSteps() const { return {QmakeProjectManager::Constants::MAKESTEP_BS_ID}; } -Utils::FilePath MakeCommandBuilder::defaultCommand() const +QString MakeCommandBuilder::displayName() const +{ + return Tr::tr("Make"); +} + +FilePath MakeCommandBuilder::defaultCommand() const { - BuildConfiguration *buildConfig = buildStep()->buildConfiguration(); - if (buildConfig) { + if (BuildConfiguration *buildConfig = buildStep()->buildConfiguration()) { if (Target *target = buildStep()->target()) { if (ToolChain *toolChain = ToolChainKitAspect::cxxToolChain(target->kit())) return toolChain->makeCommand(buildConfig->environment()); @@ -63,5 +66,4 @@ QString MakeCommandBuilder::setMultiProcessArg(QString args) return args; } -} // namespace Internal -} // namespace IncrediBuild +} // IncrediBuild::Internal diff --git a/src/plugins/incredibuild/makecommandbuilder.h b/src/plugins/incredibuild/makecommandbuilder.h index a64249f98d0..4cb3956a9ea 100644 --- a/src/plugins/incredibuild/makecommandbuilder.h +++ b/src/plugins/incredibuild/makecommandbuilder.h @@ -5,23 +5,19 @@ #include "commandbuilder.h" -namespace IncrediBuild { -namespace Internal { +namespace IncrediBuild::Internal { class MakeCommandBuilder final : public CommandBuilder { - Q_DECLARE_TR_FUNCTIONS(IncrediBuild::Internal::MakeCommandBuilder) - public: MakeCommandBuilder(ProjectExplorer::BuildStep *buildStep) : CommandBuilder(buildStep) {} private: QList<Utils::Id> migratableSteps() const final; QString id() const final { return "MakeCommandBuilder"; } - QString displayName() const final { return tr("Make"); } + QString displayName() const final; Utils::FilePath defaultCommand() const final; QString setMultiProcessArg(QString args) final; }; -} // namespace Internal -} // namespace IncrediBuild +} // IncrediBuild::Internal |