AutoTools: Move to Tr::tr

Change-Id: I605c2b5c812b500c1db2bdbfab26882ee55249d2
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2022-09-29 17:11:01 +02:00
parent bbd516f262
commit 685cc1a2fc
28 changed files with 106 additions and 830 deletions

View File

@@ -4,6 +4,7 @@
#include "autogenstep.h"
#include "autotoolsprojectconstants.h"
#include "autotoolsprojectmanagertr.h"
#include <projectexplorer/abstractprocessstep.h>
#include <projectexplorer/buildconfiguration.h>
@@ -19,8 +20,7 @@
using namespace ProjectExplorer;
using namespace Utils;
namespace AutotoolsProjectManager {
namespace Internal {
namespace AutotoolsProjectManager::Internal {
// AutogenStep
@@ -35,8 +35,6 @@ namespace Internal {
class AutogenStep final : public AbstractProcessStep
{
Q_DECLARE_TR_FUNCTIONS(AutotoolsProjectManager::Internal::AutogenStep)
public:
AutogenStep(BuildStepList *bsl, Id id);
@@ -50,7 +48,7 @@ AutogenStep::AutogenStep(BuildStepList *bsl, Id id) : AbstractProcessStep(bsl, i
{
auto arguments = addAspect<StringAspect>();
arguments->setSettingsKey("AutotoolsProjectManager.AutogenStep.AdditionalArguments");
arguments->setLabelText(tr("Arguments:"));
arguments->setLabelText(Tr::tr("Arguments:"));
arguments->setDisplayStyle(StringAspect::LineEditDisplay);
arguments->setHistoryCompleter("AutotoolsPM.History.AutogenStepArgs");
@@ -86,7 +84,8 @@ void AutogenStep::doRun()
}
if (!m_runAutogen) {
emit addOutput(tr("Configuration unchanged, skipping autogen step."), BuildStep::OutputFormat::NormalMessage);
emit addOutput(Tr::tr("Configuration unchanged, skipping autogen step."),
OutputFormat::NormalMessage);
emit finished(true);
return;
}
@@ -106,10 +105,9 @@ void AutogenStep::doRun()
AutogenStepFactory::AutogenStepFactory()
{
registerStep<AutogenStep>(Constants::AUTOGEN_STEP_ID);
setDisplayName(AutogenStep::tr("Autogen", "Display name for AutotoolsProjectManager::AutogenStep id."));
setDisplayName(Tr::tr("Autogen", "Display name for AutotoolsProjectManager::AutogenStep id."));
setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
}
} // Internal
} // AutotoolsProjectManager
} // AutotoolsProjectManager::Internal

View File

@@ -5,8 +5,7 @@
#include <projectexplorer/buildstep.h>
namespace AutotoolsProjectManager {
namespace Internal {
namespace AutotoolsProjectManager::Internal {
class AutogenStepFactory final : public ProjectExplorer::BuildStepFactory
{
@@ -14,5 +13,4 @@ public:
AutogenStepFactory();
};
} // namespace Internal
} // namespace AutotoolsProjectManager
} // AutotoolsProjectManager::Internal

View File

@@ -4,6 +4,7 @@
#include "autoreconfstep.h"
#include "autotoolsprojectconstants.h"
#include "autotoolsprojectmanagertr.h"
#include <projectexplorer/abstractprocessstep.h>
#include <projectexplorer/buildconfiguration.h>
@@ -17,8 +18,7 @@
using namespace ProjectExplorer;
using namespace Utils;
namespace AutotoolsProjectManager {
namespace Internal {
namespace AutotoolsProjectManager::Internal {
// AutoreconfStep class
@@ -33,8 +33,6 @@ namespace Internal {
class AutoreconfStep final : public AbstractProcessStep
{
Q_DECLARE_TR_FUNCTIONS(AutotoolsProjectManager::Internal::AutoreconfStep)
public:
AutoreconfStep(BuildStepList *bsl, Id id);
@@ -49,7 +47,7 @@ AutoreconfStep::AutoreconfStep(BuildStepList *bsl, Id id)
{
auto arguments = addAspect<StringAspect>();
arguments->setSettingsKey("AutotoolsProjectManager.AutoreconfStep.AdditionalArguments");
arguments->setLabelText(tr("Arguments:"));
arguments->setLabelText(Tr::tr("Arguments:"));
arguments->setValue("--force --install");
arguments->setDisplayStyle(StringAspect::LineEditDisplay);
arguments->setHistoryCompleter("AutotoolsPM.History.AutoreconfStepArgs");
@@ -80,7 +78,8 @@ void AutoreconfStep::doRun()
m_runAutoreconf = true;
if (!m_runAutoreconf) {
emit addOutput(tr("Configuration unchanged, skipping autoreconf step."), OutputFormat::NormalMessage);
emit addOutput(Tr::tr("Configuration unchanged, skipping autoreconf step."),
OutputFormat::NormalMessage);
emit finished(true);
return;
}
@@ -100,10 +99,9 @@ void AutoreconfStep::doRun()
AutoreconfStepFactory::AutoreconfStepFactory()
{
registerStep<AutoreconfStep>(Constants::AUTORECONF_STEP_ID);
setDisplayName(AutoreconfStep::tr("Autoreconf", "Display name for AutotoolsProjectManager::AutoreconfStep id."));
setDisplayName(Tr::tr("Autoreconf", "Display name for AutotoolsProjectManager::AutoreconfStep id."));
setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
}
} // Internal
} // AutotoolsProjectManager
} // AutotoolsProjectManager::Internal

View File

@@ -5,8 +5,7 @@
#include <projectexplorer/buildstep.h>
namespace AutotoolsProjectManager {
namespace Internal {
namespace AutotoolsProjectManager::Internal {
class AutoreconfStepFactory final : public ProjectExplorer::BuildStepFactory
{
@@ -14,5 +13,4 @@ public:
AutoreconfStepFactory();
};
} // namespace Internal
} // namespace AutotoolsProjectManager
} // AutotoolsProjectManager::Internal

View File

@@ -4,6 +4,7 @@
#include "autotoolsbuildconfiguration.h"
#include "autotoolsprojectconstants.h"
#include "autotoolsprojectmanagertr.h"
#include <projectexplorer/buildinfo.h>
#include <projectexplorer/buildsteplist.h>
@@ -14,15 +15,12 @@
using namespace ProjectExplorer;
using namespace Utils;
namespace AutotoolsProjectManager {
namespace Internal {
namespace AutotoolsProjectManager::Internal {
// AutotoolsBuildConfiguration
class AutotoolsBuildConfiguration : public BuildConfiguration
{
Q_DECLARE_TR_FUNCTIONS(AutotoolsProjectManager::Internal::AutotoolsBuildConfiguration)
public:
AutotoolsBuildConfiguration(Target *target, Id id)
: BuildConfiguration(target, id)
@@ -31,7 +29,7 @@ public:
// The leading / is to avoid the relative the path expansion in BuildConfiguration::buildDirectory.
setBuildDirectory("/<foobar>");
setBuildDirectoryHistoryCompleter("AutoTools.BuildDir.History");
setConfigWidgetDisplayName(tr("Autotools Manager"));
setConfigWidgetDisplayName(Tr::tr("Autotools Manager"));
// ### Build Steps Build ###
const FilePath autogenFile = target->project()->projectDirectory() / "autogen.sh";
@@ -69,5 +67,4 @@ AutotoolsBuildConfigurationFactory::AutotoolsBuildConfigurationFactory()
});
}
} // Internal
} // AutotoolsProjectManager
} // AutotoolsProjectManager::Internal

View File

@@ -5,8 +5,7 @@
#include <projectexplorer/buildconfiguration.h>
namespace AutotoolsProjectManager {
namespace Internal {
namespace AutotoolsProjectManager::Internal {
class AutotoolsBuildConfigurationFactory final : public ProjectExplorer::BuildConfigurationFactory
{
@@ -14,5 +13,4 @@ public:
AutotoolsBuildConfigurationFactory();
};
} // namespace Internal
} // namespace AutotoolsProjectManager
} // AutotoolsProjectManager::Internal

View File

@@ -4,7 +4,6 @@
#include "autotoolsbuildsystem.h"
#include "makefileparserthread.h"
#include "makestep.h"
#include <cppeditor/cppprojectupdater.h>
#include <projectexplorer/buildconfiguration.h>
@@ -12,19 +11,18 @@
#include <qtsupport/qtcppkitinfo.h>
#include <utils/filesystemwatcher.h>
#include <utils/qtcassert.h>
using namespace ProjectExplorer;
namespace AutotoolsProjectManager {
namespace Internal {
namespace AutotoolsProjectManager::Internal {
AutotoolsBuildSystem::AutotoolsBuildSystem(Target *target)
: BuildSystem(target)
, m_cppCodeModelUpdater(new CppEditor::CppProjectUpdater)
{
connect(target, &Target::activeBuildConfigurationChanged, this, [this]() { requestParse(); });
connect(target->project(), &Project::projectFileIsDirty, this, [this]() { requestParse(); });
connect(target, &Target::activeBuildConfigurationChanged, this, [this] { requestParse(); });
connect(target->project(), &Project::projectFileIsDirty, this, [this] { requestParse(); });
}
AutotoolsBuildSystem::~AutotoolsBuildSystem()
@@ -158,5 +156,4 @@ void AutotoolsBuildSystem::updateCppCodeModel()
m_cppCodeModelUpdater->update({project(), kitInfo, activeParseEnvironment(), {rpp}});
}
} // namespace Internal
} // namespace AutotoolsProjectManager
} // AutotoolsProjectManager::Internal

View File

@@ -9,8 +9,7 @@
namespace CppEditor { class CppProjectUpdater; }
namespace AutotoolsProjectManager {
namespace Internal {
namespace AutotoolsProjectManager::Internal {
class MakefileParserThread;
@@ -46,5 +45,4 @@ private:
CppEditor::CppProjectUpdater *m_cppCodeModelUpdater = nullptr;
};
} // namespace Internal
} // namespace AutotoolsProjectManager
} // AutotoolsProjectManager::Internal

View File

@@ -14,23 +14,36 @@
#include <coreplugin/icontext.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectmanager.h>
#include <projectexplorer/target.h>
namespace AutotoolsProjectManager {
namespace Internal {
namespace AutotoolsProjectManager::Internal {
AutotoolsProject::AutotoolsProject(const Utils::FilePath &fileName)
: Project(Constants::MAKEFILE_MIMETYPE, fileName)
/**
* @brief Implementation of the ProjectExplorer::Project interface.
*
* Loads the autotools project and embeds it into the QtCreator project tree.
* The class AutotoolsProject is the core of the autotools project plugin.
* It is responsible to parse the Makefile.am files and do trigger project
* updates if a Makefile.am file or a configure.ac file has been changed.
*/
class AutotoolsProject : public ProjectExplorer::Project
{
setId(Constants::AUTOTOOLS_PROJECT_ID);
setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
setDisplayName(projectDirectory().fileName());
public:
explicit AutotoolsProject(const Utils::FilePath &fileName)
: Project(Constants::MAKEFILE_MIMETYPE, fileName)
{
setId(Constants::AUTOTOOLS_PROJECT_ID);
setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
setDisplayName(projectDirectory().fileName());
setHasMakeInstallEquivalent(true);
setHasMakeInstallEquivalent(true);
setBuildSystemCreator([](ProjectExplorer::Target *t) { return new AutotoolsBuildSystem(t); });
}
};
setBuildSystemCreator([](ProjectExplorer::Target *t) { return new AutotoolsBuildSystem(t); });
}
class AutotoolsProjectPluginPrivate
{
@@ -50,8 +63,7 @@ AutotoolsProjectPlugin::~AutotoolsProjectPlugin()
void AutotoolsProjectPlugin::extensionsInitialized()
{ }
bool AutotoolsProjectPlugin::initialize(const QStringList &arguments,
QString *errorString)
bool AutotoolsProjectPlugin::initialize(const QStringList &arguments, QString *errorString)
{
Q_UNUSED(arguments)
Q_UNUSED(errorString)
@@ -62,5 +74,4 @@ bool AutotoolsProjectPlugin::initialize(const QStringList &arguments,
return true;
}
} // namespace Internal
} // AutotoolsProjectManager
} // AutotoolsProjectManager::Internal

View File

@@ -3,12 +3,9 @@
#pragma once
#include <projectexplorer/project.h>
#include <extensionsystem/iplugin.h>
namespace AutotoolsProjectManager {
namespace Internal {
namespace AutotoolsProjectManager::Internal {
/**
* @brief Implementation of the ExtensionsSystem::IPlugin interface.
@@ -51,19 +48,4 @@ class AutotoolsProjectPlugin final : public ExtensionSystem::IPlugin
class AutotoolsProjectPluginPrivate *d;
};
/**
* @brief Implementation of the ProjectExplorer::Project interface.
*
* Loads the autotools project and embeds it into the QtCreator project tree.
* The class AutotoolsProject is the core of the autotools project plugin.
* It is responsible to parse the Makefile.am files and do trigger project
* updates if a Makefile.am file or a configure.ac file has been changed.
*/
class AutotoolsProject : public ProjectExplorer::Project
{
public:
explicit AutotoolsProject(const Utils::FilePath &fileName);
};
} // namespace Internal
} // namespace AutotoolsProjectManager
} // AutotoolsProjectManager::Internal

View File

@@ -3,8 +3,8 @@
#include "configurestep.h"
#include "autotoolsbuildconfiguration.h"
#include "autotoolsprojectconstants.h"
#include "autotoolsprojectmanagertr.h"
#include <projectexplorer/abstractprocessstep.h>
#include <projectexplorer/processparameters.h>
@@ -20,8 +20,7 @@
using namespace ProjectExplorer;
using namespace Utils;
namespace AutotoolsProjectManager {
namespace Internal {
namespace AutotoolsProjectManager::Internal {
// Helper Function
@@ -52,8 +51,6 @@ static QString projectDirRelativeToBuildDir(BuildConfiguration *bc)
class ConfigureStep final : public AbstractProcessStep
{
Q_DECLARE_TR_FUNCTIONS(AutotoolsProjectManager::Internal::ConfigureStep)
public:
ConfigureStep(BuildStepList *bsl, Id id);
@@ -73,7 +70,7 @@ ConfigureStep::ConfigureStep(BuildStepList *bsl, Id id)
auto arguments = addAspect<StringAspect>();
arguments->setDisplayStyle(StringAspect::LineEditDisplay);
arguments->setSettingsKey("AutotoolsProjectManager.ConfigureStep.AdditionalArguments");
arguments->setLabelText(tr("Arguments:"));
arguments->setLabelText(Tr::tr("Arguments:"));
arguments->setHistoryCompleter("AutotoolsPM.History.ConfigureArgs");
connect(arguments, &BaseAspect::changed, this, [this] {
@@ -116,7 +113,7 @@ void ConfigureStep::doRun()
}
if (!m_runConfigure) {
emit addOutput(tr("Configuration unchanged, skipping configure step."), OutputFormat::NormalMessage);
emit addOutput(Tr::tr("Configuration unchanged, skipping configure step."), OutputFormat::NormalMessage);
emit finished(true);
return;
}
@@ -142,10 +139,9 @@ void ConfigureStep::doRun()
ConfigureStepFactory::ConfigureStepFactory()
{
registerStep<ConfigureStep>(Constants::CONFIGURE_STEP_ID);
setDisplayName(ConfigureStep::tr("Configure", "Display name for AutotoolsProjectManager::ConfigureStep id."));
setDisplayName(Tr::tr("Configure", "Display name for AutotoolsProjectManager::ConfigureStep id."));
setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
}
} // namespace Internal
} // namespace AutotoolsProjectManager
} // AutotoolsProjectManager::Internal

View File

@@ -5,8 +5,7 @@
#include <projectexplorer/buildstep.h>
namespace AutotoolsProjectManager {
namespace Internal {
namespace AutotoolsProjectManager::Internal {
class ConfigureStepFactory final : public ProjectExplorer::BuildStepFactory
{
@@ -14,5 +13,4 @@ public:
ConfigureStepFactory();
};
} // namespace Internal
} // namespace AutotoolsProjectManager
} // AutotoolsProjectManager::Internal

View File

@@ -3,6 +3,8 @@
#include "makefileparser.h"
#include "autotoolsprojectmanagertr.h"
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <utils/stringutils.h>
@@ -11,7 +13,7 @@
#include <QFile>
#include <QFileInfo>
using namespace AutotoolsProjectManager::Internal;
namespace AutotoolsProjectManager::Internal {
MakefileParser::MakefileParser(const QString &makefile) : m_makefile(makefile)
{ }
@@ -40,7 +42,7 @@ bool MakefileParser::parse()
QFileInfo info(m_makefile);
m_makefiles.append(info.fileName());
emit status(tr("Parsing %1 in directory %2").arg(info.fileName()).arg(info.absolutePath()));
emit status(Tr::tr("Parsing %1 in directory %2").arg(info.fileName()).arg(info.absolutePath()));
m_textStream.setDevice(file);
@@ -237,7 +239,7 @@ void MakefileParser::parseSubDirs()
// Delegate the parsing of all sub directories to a local
// makefile parser and merge the results
foreach (const QString& subDir, subDirs) {
for (const QString &subDir : qAsConst(subDirs)) {
const QChar slash = QLatin1Char('/');
const QString subDirMakefile = path + slash + subDir
+ slash + makefileName;
@@ -298,7 +300,7 @@ QStringList MakefileParser::directorySources(const QString &directory,
return QStringList();
}
emit status(tr("Parsing directory %1").arg(directory));
emit status(Tr::tr("Parsing directory %1").arg(directory));
QStringList list; // return value
@@ -550,3 +552,5 @@ void MakefileParser::parseIncludePaths()
m_cflags.removeDuplicates();
m_cxxflags.removeDuplicates();
}
} // AutotoolsProjectManager::Internal

View File

@@ -14,8 +14,7 @@
QT_FORWARD_DECLARE_CLASS(QDir)
namespace AutotoolsProjectManager {
namespace Internal {
namespace AutotoolsProjectManager::Internal {
/**
* @brief Parses the autotools makefile Makefile.am.
@@ -258,5 +257,4 @@ private:
QTextStream m_textStream; ///< Textstream that represents the makefile
};
} // namespace Internal
} // namespace AutotoolsProjectManager
} // AutotoolsProjectManager::Internal

View File

@@ -13,8 +13,7 @@
#include <QThread>
#include <QVector>
namespace AutotoolsProjectManager {
namespace Internal {
namespace AutotoolsProjectManager::Internal {
/**
* @brief Executes the makefile parser in the thread.
@@ -129,5 +128,4 @@ private:
ProjectExplorer::BuildSystem::ParseGuard m_guard;
};
} // namespace Internal
} // namespace AutotoolsProjectManager
} // AutotoolsProjectManager::Internal

View File

@@ -9,28 +9,25 @@
using namespace AutotoolsProjectManager::Constants;
namespace AutotoolsProjectManager {
namespace Internal {
namespace AutotoolsProjectManager::Internal {
// MakeStep
class MakeStep : public ProjectExplorer::MakeStep
{
public:
MakeStep(ProjectExplorer::BuildStepList *bsl, Utils::Id id);
};
MakeStep::MakeStep(ProjectExplorer::BuildStepList *bsl, Utils::Id id)
: ProjectExplorer::MakeStep(bsl, id)
{
setAvailableBuildTargets({"all", "clean"});
if (bsl->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) {
setSelectedBuildTarget("clean");
setIgnoreReturnValue(true);
} else {
setSelectedBuildTarget("all");
MakeStep(ProjectExplorer::BuildStepList *bsl, Utils::Id id)
: ProjectExplorer::MakeStep(bsl, id)
{
setAvailableBuildTargets({"all", "clean"});
if (bsl->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) {
setSelectedBuildTarget("clean");
setIgnoreReturnValue(true);
} else {
setSelectedBuildTarget("all");
}
}
}
};
// MakeStepFactory
@@ -41,5 +38,4 @@ MakeStepFactory::MakeStepFactory()
setSupportedProjectType(AUTOTOOLS_PROJECT_ID);
}
} // Internal
} // AutotoolsProjectManager
} // AutotoolsProjectManager::Internal

View File

@@ -5,8 +5,7 @@
#include <projectexplorer/makestep.h>
namespace AutotoolsProjectManager {
namespace Internal {
namespace AutotoolsProjectManager::Internal {
class MakeStepFactory final : public ProjectExplorer::BuildStepFactory
{
@@ -14,5 +13,4 @@ public:
MakeStepFactory();
};
} // namespace Internal
} // namespace AutotoolsProjectManager
} // AutotoolsProjectManager::Internal