Meson: Convert to Tr::tr

Change-Id: I37e8a8c559464f7d55e17a5ca08e8d8d9760a4d6
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
hjk
2022-10-10 09:14:04 +02:00
parent 63faccdb7c
commit 9e2ec17f36
31 changed files with 104 additions and 278 deletions

View File

@@ -13,7 +13,6 @@ namespace Internal {
class RegexHighlighter : public QSyntaxHighlighter
{
Q_OBJECT
const QRegularExpression m_regex{R"('([^']+)'+|([^', ]+)[, ]*)"};
QTextCharFormat m_format;

View File

@@ -3,7 +3,7 @@
#pragma once
#include "mesoninfoparser.h"
#include "buildoptions.h"
#include <utils/qtcassert.h>
#include <utils/treemodel.h>
@@ -66,6 +66,7 @@ public:
}
inline BuildOption::Type type() { return m_currentValue->type(); }
};
using CancellableOptionsList = std::vector<std::unique_ptr<CancellableOption>>;
class BuidOptionsModel final : public Utils::TreeModel<>
{

View File

@@ -3,6 +3,7 @@
#pragma once
#include "common.h"
#include "mesoninfo.h"
#include "mesonpluginconstants.h"

View File

@@ -3,6 +3,8 @@
#pragma once
#include "mesonprojectmanagertr.h"
#include <utils/parameteraction.h>
namespace MesonProjectManager {
@@ -12,7 +14,8 @@ class MesonActionsManager : public QObject
{
Q_OBJECT
Utils::ParameterAction buildTargetContextAction{
tr("Build"), tr("Build \"%1\""), Utils::ParameterAction::AlwaysEnabled /*handled manually*/
Tr::tr("Build"), Tr::tr("Build \"%1\""),
Utils::ParameterAction::AlwaysEnabled /*handled manually*/
};
QAction configureActionMenu;
QAction configureActionContextMenu;

View File

@@ -5,6 +5,7 @@
#include "mesonbuildconfiguration.h"
#include "mesonbuildsystem.h"
#include "mesonprojectmanagertr.h"
#include <coreplugin/find/itemviewfind.h>
@@ -25,19 +26,19 @@ using namespace Utils;
namespace MesonProjectManager::Internal {
MesonBuildSettingsWidget::MesonBuildSettingsWidget(MesonBuildConfiguration *buildCfg)
: ProjectExplorer::NamedWidget{tr("Meson")}
: ProjectExplorer::NamedWidget(Tr::tr("Meson"))
, m_progressIndicator(ProgressIndicatorSize::Large)
{
auto configureButton = new QPushButton(tr("Apply Configuration Changes"));
auto configureButton = new QPushButton(Tr::tr("Apply Configuration Changes"));
configureButton->setEnabled(false);
configureButton->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
auto wipeButton = new QPushButton(tr("Wipe Project"));
auto wipeButton = new QPushButton(Tr::tr("Wipe Project"));
wipeButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
wipeButton->setIcon(Utils::Icons::WARNING.icon());
wipeButton->setToolTip(tr("Wipes build directory and reconfigures using previous command "
"line options.\nUseful if build directory is corrupted or when "
"rebuilding with a newer version of Meson."));
wipeButton->setToolTip(Tr::tr("Wipes build directory and reconfigures using previous command "
"line options.\nUseful if build directory is corrupted or when "
"rebuilding with a newer version of Meson."));
auto container = new DetailsWidget;
@@ -62,7 +63,7 @@ MesonBuildSettingsWidget::MesonBuildSettingsWidget(MesonBuildConfiguration *buil
using namespace Layouting;
Column {
Form { tr("Parameters"), parametersLineEdit, br, },
Form { Tr::tr("Parameters"), parametersLineEdit, br, },
buildDirWidget,
optionsFilterLineEdit,
optionsTreeView,

View File

@@ -6,6 +6,7 @@
#include "kithelper.h"
#include "machinefilemanager.h"
#include "mesonbuildconfiguration.h"
#include "mesonprojectmanagertr.h"
#include "mesontoolkitaspect.h"
#include "settings.h"
@@ -82,7 +83,7 @@ void MesonBuildSystem::parsingCompleted(bool success)
UNLOCK(true);
emitBuildSystemUpdated();
} else {
TaskHub::addTask(BuildSystemTask(Task::Error, tr("Meson build: Parsing failed")));
TaskHub::addTask(BuildSystemTask(Task::Error, Tr::tr("Meson build: Parsing failed")));
UNLOCK(false);
emitBuildSystemUpdated();
}

View File

@@ -3,7 +3,7 @@
#include "mesonprocess.h"
#include "mesonoutputparser.h"
#include "mesonprojectmanagertr.h"
#include <coreplugin/messagemanager.h>
#include <coreplugin/progressmanager/progressmanager.h>
@@ -44,7 +44,7 @@ bool MesonProcess::run(const Command &command,
setupProcess(command, env, captureStdo);
m_future.setProgressRange(0, 1);
Core::ProgressManager::addTimedTask(m_future,
tr("Configuring \"%1\".").arg(projectName),
Tr::tr("Configuring \"%1\".").arg(projectName),
"Meson.Configure",
10);
emit started();
@@ -121,7 +121,7 @@ void MesonProcess::setupProcess(const Command &command,
m_process->setWorkingDirectory(command.workDir());
m_process->setEnvironment(env);
Core::MessageManager::writeFlashing(
tr("Running %1 in %2.").arg(command.toUserOutput()).arg(command.workDir().toUserOutput()));
Tr::tr("Running %1 in %2.").arg(command.toUserOutput()).arg(command.workDir().toUserOutput()));
m_process->setCommand(command.cmdLine());
}
@@ -132,15 +132,15 @@ bool MesonProcess::sanityCheck(const Command &command) const
//Should only reach this point if Meson exe is removed while a Meson project is opened
ProjectExplorer::TaskHub::addTask(
ProjectExplorer::BuildSystemTask{ProjectExplorer::Task::TaskType::Error,
tr("Executable does not exist: %1")
Tr::tr("Executable does not exist: %1")
.arg(exe.toUserOutput())});
return false;
}
if (!exe.toFileInfo().isExecutable()) {
ProjectExplorer::TaskHub::addTask(
ProjectExplorer::BuildSystemTask{ProjectExplorer::Task::TaskType::Error,
tr("Command is not executable: %1")
.arg(exe.toUserOutput())});
Tr::tr("Command is not executable: %1")
.arg(exe.toUserOutput())});
return false;
}
return true;

View File

@@ -4,6 +4,7 @@
#include "mesonproject.h"
#include "mesonpluginconstants.h"
#include "mesonprojectmanagertr.h"
#include "mesontoolkitaspect.h"
#include "ninjatoolkitaspect.h"
@@ -13,11 +14,13 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
using namespace ProjectExplorer;
namespace MesonProjectManager {
namespace Internal {
MesonProject::MesonProject(const Utils::FilePath &path)
: ProjectExplorer::Project{Constants::Project::MIMETYPE, path}
: Project{Constants::Project::MIMETYPE, path}
{
setId(Constants::Project::ID);
setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
@@ -26,33 +29,33 @@ MesonProject::MesonProject(const Utils::FilePath &path)
setHasMakeInstallEquivalent(true);
}
ProjectExplorer::Tasks MesonProject::projectIssues(const ProjectExplorer::Kit *k) const
Tasks MesonProject::projectIssues(const Kit *k) const
{
ProjectExplorer::Tasks result = Project::projectIssues(k);
Tasks result = Project::projectIssues(k);
if (!MesonToolKitAspect::isValid(k))
result.append(
createProjectTask(ProjectExplorer::Task::TaskType::Error, tr("No Meson tool set.")));
createProjectTask(Task::TaskType::Error, Tr::tr("No Meson tool set.")));
if (!NinjaToolKitAspect::isValid(k))
result.append(
createProjectTask(ProjectExplorer::Task::TaskType::Error, tr("No Ninja tool set.")));
if (ProjectExplorer::ToolChainKitAspect::toolChains(k).isEmpty())
result.append(createProjectTask(ProjectExplorer::Task::TaskType::Warning,
tr("No compilers set in kit.")));
createProjectTask(Task::TaskType::Error, Tr::tr("No Ninja tool set.")));
if (ToolChainKitAspect::toolChains(k).isEmpty())
result.append(createProjectTask(Task::TaskType::Warning,
Tr::tr("No compilers set in kit.")));
return result;
}
ProjectExplorer::ProjectImporter *MesonProject::projectImporter() const
ProjectImporter *MesonProject::projectImporter() const
{
if (m_projectImporter)
m_projectImporter = std::make_unique<MesonProjectImporter>(projectFilePath());
return m_projectImporter.get();
}
ProjectExplorer::DeploymentKnowledge MesonProject::deploymentKnowledge() const
DeploymentKnowledge MesonProject::deploymentKnowledge() const
{
// TODO in next releases
return ProjectExplorer::DeploymentKnowledge::Bad;
return DeploymentKnowledge::Bad;
}
} // namespace Internal

View File

@@ -5,13 +5,11 @@
#include <QLoggingCategory>
namespace {
static Q_LOGGING_CATEGORY(mInputLog, "qtc.meson.import", QtWarningMsg);
}
namespace MesonProjectManager {
namespace Internal {
static Q_LOGGING_CATEGORY(mInputLog, "qtc.meson.import", QtWarningMsg);
MesonProjectImporter::MesonProjectImporter(const Utils::FilePath &path)
: QtSupport::QtProjectImporter{path}
{}

View File

@@ -3,6 +3,7 @@
#include "mesontoolkitaspect.h"
#include "mesonprojectmanagertr.h"
#include "toolkitaspectwidget.h"
#include <utils/qtcassert.h>
@@ -16,8 +17,8 @@ MesonToolKitAspect::MesonToolKitAspect()
{
setObjectName(QLatin1String("MesonKitAspect"));
setId(TOOL_ID);
setDisplayName(tr("Meson Tool"));
setDescription(tr("The Meson tool to use when building a project with Meson.<br>"
setDisplayName(Tr::tr("Meson Tool"));
setDescription(Tr::tr("The Meson tool to use when building a project with Meson.<br>"
"This setting is ignored when using other build systems."));
setPriority(9000);
}
@@ -28,7 +29,7 @@ ProjectExplorer::Tasks MesonToolKitAspect::validate(const ProjectExplorer::Kit *
const auto tool = mesonTool(k);
if (tool && !tool->isValid())
tasks << ProjectExplorer::BuildSystemTask{ProjectExplorer::Task::Warning,
tr("Cannot validate this meson executable.")};
Tr::tr("Cannot validate this meson executable.")};
return tasks;
}
@@ -52,8 +53,8 @@ ProjectExplorer::KitAspect::ItemList MesonToolKitAspect::toUserOutput(
{
const auto tool = mesonTool(k);
if (tool)
return {{tr("Meson"), tool->name()}};
return {{tr("Meson"), tr("Unconfigured")}};
return {{Tr::tr("Meson"), tool->name()}};
return {{Tr::tr("Meson"), Tr::tr("Unconfigured")}};
}
ProjectExplorer::KitAspectWidget *MesonToolKitAspect::createConfigWidget(ProjectExplorer::Kit *k) const

View File

@@ -13,8 +13,6 @@ namespace Internal {
class MesonToolKitAspect final : public ProjectExplorer::KitAspect
{
Q_DECLARE_TR_FUNCTIONS(MesonProjectManager::Internal::MesonToolKitAspect)
public:
MesonToolKitAspect();

View File

@@ -3,8 +3,6 @@
#include "nativefilegenerator.h"
#include "kithelper.h"
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/kitmanager.h>
#include <projectexplorer/projectexplorerconstants.h>

View File

@@ -6,6 +6,7 @@
#include "mesonbuildconfiguration.h"
#include "mesonbuildsystem.h"
#include "mesonpluginconstants.h"
#include "mesonprojectmanagertr.h"
#include "mesonoutputparser.h"
#include "ninjatoolkitaspect.h"
#include "settings.h"
@@ -32,8 +33,8 @@ namespace Internal {
const char TARGETS_KEY[] = "MesonProjectManager.BuildStep.BuildTargets";
const char TOOL_ARGUMENTS_KEY[] = "MesonProjectManager.BuildStep.AdditionalArguments";
NinjaBuildStep::NinjaBuildStep(ProjectExplorer::BuildStepList *bsl, Utils::Id id)
: ProjectExplorer::AbstractProcessStep{bsl, id}
NinjaBuildStep::NinjaBuildStep(BuildStepList *bsl, Id id)
: AbstractProcessStep{bsl, id}
{
if (m_targetName.isEmpty())
setBuildTarget(defaultBuildTarget());
@@ -43,16 +44,14 @@ NinjaBuildStep::NinjaBuildStep(ProjectExplorer::BuildStepList *bsl, Utils::Id id
setUseEnglishOutput();
connect(target(), &ProjectExplorer::Target::parsingFinished, this, &NinjaBuildStep::update);
connect(&Settings::instance()->verboseNinja,
&BaseAspect::changed,
this,
&NinjaBuildStep::commandChanged);
connect(&Settings::instance()->verboseNinja, &BaseAspect::changed,
this, &NinjaBuildStep::commandChanged);
}
QWidget *NinjaBuildStep::createConfigWidget()
{
auto widget = new QWidget;
setDisplayName(tr("Build", "MesonProjectManager::MesonBuildStepConfigWidget display name."));
setDisplayName(Tr::tr("Build", "MesonProjectManager::MesonBuildStepConfigWidget display name."));
auto buildTargetsList = new QListWidget(widget);
buildTargetsList->setMinimumHeight(200);
@@ -67,8 +66,8 @@ QWidget *NinjaBuildStep::createConfigWidget()
auto formLayout = new QFormLayout(widget);
formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
formLayout->setContentsMargins(0, 0, 0, 0);
formLayout->addRow(tr("Tool arguments:"), toolArguments);
formLayout->addRow(tr("Targets:"), wrapper);
formLayout->addRow(Tr::tr("Tool arguments:"), toolArguments);
formLayout->addRow(Tr::tr("Targets:"), wrapper);
auto updateDetails = [this] {
ProcessParameters param;
@@ -188,7 +187,7 @@ MesonBuildStepFactory::MesonBuildStepFactory()
{
registerStep<NinjaBuildStep>(Constants::MESON_BUILD_STEP_ID);
setSupportedProjectType(Constants::Project::ID);
setDisplayName(NinjaBuildStep::tr("Meson Build"));
setDisplayName(Tr::tr("Meson Build"));
}
void MesonProjectManager::Internal::NinjaBuildStep::setBuildTarget(const QString &targetName)

View File

@@ -3,6 +3,7 @@
#include "ninjatoolkitaspect.h"
#include "mesonprojectmanagertr.h"
#include "toolkitaspectwidget.h"
#include <utils/qtcassert.h>
@@ -16,9 +17,9 @@ NinjaToolKitAspect::NinjaToolKitAspect()
{
setObjectName(QLatin1String("NinjaKitAspect"));
setId(TOOL_ID);
setDisplayName(tr("Ninja Tool"));
setDescription(tr("The Ninja tool to use when building a project with Meson.<br>"
"This setting is ignored when using other build systems."));
setDisplayName(Tr::tr("Ninja Tool"));
setDescription(Tr::tr("The Ninja tool to use when building a project with Meson.<br>"
"This setting is ignored when using other build systems."));
setPriority(9000);
}
@@ -28,7 +29,7 @@ ProjectExplorer::Tasks NinjaToolKitAspect::validate(const ProjectExplorer::Kit *
const auto tool = ninjaTool(k);
if (tool && !tool->isValid())
tasks << ProjectExplorer::BuildSystemTask{ProjectExplorer::Task::Warning,
tr("Cannot validate this Ninja executable.")};
Tr::tr("Cannot validate this Ninja executable.")};
return tasks;
}
@@ -52,8 +53,8 @@ ProjectExplorer::KitAspect::ItemList NinjaToolKitAspect::toUserOutput(
{
const auto tool = ninjaTool(k);
if (tool)
return {{tr("Ninja"), tool->name()}};
return {{tr("Ninja"), tr("Unconfigured")}};
return {{Tr::tr("Ninja"), tool->name()}};
return {{Tr::tr("Ninja"), Tr::tr("Unconfigured")}};
}
ProjectExplorer::KitAspectWidget *NinjaToolKitAspect::createConfigWidget(ProjectExplorer::Kit *k) const

View File

@@ -13,8 +13,6 @@ namespace Internal {
class NinjaToolKitAspect final : public ProjectExplorer::KitAspect
{
Q_DECLARE_TR_FUNCTIONS(MesonProjectManager::Internal::NinjaToolKitAspect)
public:
NinjaToolKitAspect();

View File

@@ -4,6 +4,7 @@
#include "settings.h"
#include "mesonpluginconstants.h"
#include "mesonprojectmanagertr.h"
#include <utils/layoutbuilder.h>
@@ -16,12 +17,12 @@ Settings::Settings()
setAutoApply(false);
autorunMeson.setSettingsKey("meson.autorun");
autorunMeson.setLabelText(tr("Autorun Meson"));
autorunMeson.setToolTip(tr("Automatically run Meson when needed."));
autorunMeson.setLabelText(Tr::tr("Autorun Meson"));
autorunMeson.setToolTip(Tr::tr("Automatically run Meson when needed."));
verboseNinja.setSettingsKey("ninja.verbose");
verboseNinja.setLabelText(tr("Ninja verbose mode"));
verboseNinja.setToolTip(tr("Enables verbose mode by default when invoking Ninja."));
verboseNinja.setLabelText(Tr::tr("Ninja verbose mode"));
verboseNinja.setToolTip(Tr::tr("Enables verbose mode by default when invoking Ninja."));
registerAspect(&autorunMeson);
registerAspect(&verboseNinja);
@@ -36,7 +37,7 @@ Settings *Settings::instance()
GeneralSettingsPage::GeneralSettingsPage()
{
setId(Constants::SettingsPage::GENERAL_ID);
setDisplayName(tr("General"));
setDisplayName(Tr::tr("General"));
setDisplayCategory("Meson");
setCategory(Constants::SettingsPage::CATEGORY);
setCategoryIconPath(Constants::Icons::MESON_BW);

View File

@@ -12,8 +12,6 @@ namespace Internal {
class Settings : public Utils::AspectContainer
{
Q_DECLARE_TR_FUNCTIONS(MesonProjectManager::Internal::Settings)
public:
Settings();
@@ -25,8 +23,6 @@ public:
class GeneralSettingsPage final : public Core::IOptionsPage
{
Q_DECLARE_TR_FUNCTIONS(MesonProjectManager::Internal::GeneralSettingsPage)
public:
GeneralSettingsPage();
};

View File

@@ -3,6 +3,7 @@
#include "toolitemsettings.h"
#include "mesonprojectmanagertr.h"
#include "tooltreeitem.h"
#include <utils/layoutbuilder.h>
@@ -26,8 +27,8 @@ ToolItemSettings::ToolItemSettings(QWidget *parent)
using namespace Layouting;
Form {
tr("Name:"), m_mesonNameLineEdit, br,
tr("Path:"), m_mesonPathChooser, br,
Tr::tr("Name:"), m_mesonNameLineEdit, br,
Tr::tr("Path:"), m_mesonPathChooser, br,
}.attachTo(this, WithoutMargins);
connect(m_mesonPathChooser, &PathChooser::rawPathChanged, this, &ToolItemSettings::store);

View File

@@ -3,7 +3,6 @@
#pragma once
#include "mesontoolkitaspect.h"
#include "mesonwrapper.h"
#include "ninjatoolkitaspect.h"
#include <projectexplorer/kitmanager.h>
@@ -18,7 +17,6 @@ namespace Internal {
class ToolKitAspectWidget final : public ProjectExplorer::KitAspectWidget
{
Q_DECLARE_TR_FUNCTIONS(MesonProjectManager::Internal::ToolKitAspect)
public:
enum class ToolType { Meson, Ninja };

View File

@@ -4,6 +4,7 @@
#include "toolsmodel.h"
#include "tooltreeitem.h"
#include "mesonprojectmanagertr.h"
#include "mesontools.h"
#include <projectexplorer/projectexplorerconstants.h>
@@ -15,7 +16,7 @@ namespace Internal {
ToolsModel::ToolsModel()
{
setHeader({tr("Name"), tr("Location")});
setHeader({Tr::tr("Name"), Tr::tr("Location")});
rootItem()->appendChild(
new Utils::StaticTreeItem({ProjectExplorer::Constants::msgAutoDetected()},
{ProjectExplorer::Constants::msgAutoDetectedToolTip()}));
@@ -39,7 +40,7 @@ void ToolsModel::updateItem(const Utils::Id &itemId, const QString &name, const
void ToolsModel::addMesonTool()
{
manualGroup()->appendChild(new ToolTreeItem{uniqueName(tr("New Meson or Ninja tool"))});
manualGroup()->appendChild(new ToolTreeItem{uniqueName(Tr::tr("New Meson or Ninja tool"))});
}
void ToolsModel::removeMesonTool(ToolTreeItem *item)

View File

@@ -17,9 +17,9 @@ class ToolTreeItem;
class ToolsModel final : public Utils::TreeModel<Utils::TreeItem, Utils::TreeItem, ToolTreeItem>
{
Q_DECLARE_TR_FUNCTIONS(MesonProjectManager::Internal::ToolsSettingsPage)
public:
ToolsModel();
ToolTreeItem *mesoneToolTreeItem(const QModelIndex &index) const;
void updateItem(const Utils::Id &itemId, const QString &name, const Utils::FilePath &exe);
void addMesonTool();

View File

@@ -4,6 +4,7 @@
#include "toolssettingsaccessor.h"
#include "mesonpluginconstants.h"
#include "mesonprojectmanagertr.h"
#include <app/app_version.h>
#include <coreplugin/icore.h>
@@ -18,18 +19,15 @@
namespace MesonProjectManager {
namespace Internal {
namespace {
inline QString entryName(int index)
static QString entryName(int index)
{
using namespace Constants;
return QString("%1%2").arg(ToolsSettings::ENTRY_KEY).arg(index);
}
} // namespace
ToolsSettingsAccessor::ToolsSettingsAccessor()
: UpgradingSettingsAccessor("QtCreatorMesonTools",
QCoreApplication::translate("MesonProjectManager::MesonToolManager",
"Meson"),
Tr::tr("Meson"),
Core::Constants::IDE_DISPLAY_NAME)
{
setBaseFilePath(Core::ICore::userResourcePath(Constants::ToolsSettings::FILENAME));

View File

@@ -4,6 +4,7 @@
#include "toolssettingspage.h"
#include "mesonpluginconstants.h"
#include "mesonprojectmanagertr.h"
#include "toolssettingswidget.h"
namespace MesonProjectManager {
@@ -12,7 +13,7 @@ namespace Internal {
ToolsSettingsPage::ToolsSettingsPage()
{
setId(Constants::SettingsPage::TOOLS_ID);
setDisplayName(tr("Tools"));
setDisplayName(Tr::tr("Tools"));
setCategory(Constants::SettingsPage::CATEGORY);
setWidgetCreator([]() { return new ToolsSettingsWidget; });
}

View File

@@ -5,17 +5,11 @@
#include <coreplugin/dialogs/ioptionspage.h>
#include <QCoreApplication>
namespace MesonProjectManager {
namespace Internal {
class MesonTools;
class ToolsSettingsPage final : public Core::IOptionsPage
{
Q_DECLARE_TR_FUNCTIONS(MesonProjectManager::Internal::ToolsSettingsPage)
public:
ToolsSettingsPage();
};

View File

@@ -3,6 +3,7 @@
#include "toolssettingswidget.h"
#include "mesonprojectmanagertr.h"
#include "toolsmodel.h"
#include "tooltreeitem.h"
@@ -33,19 +34,19 @@ ToolsSettingsWidget::ToolsSettingsWidget()
m_mesonDetails->setVisible(false);
m_mesonDetails->setWidget(m_itemSettings);
auto addButton = new QPushButton(tr("Add"));
auto addButton = new QPushButton(Tr::tr("Add"));
m_cloneButton = new QPushButton(tr("Clone"));
m_cloneButton = new QPushButton(Tr::tr("Clone"));
m_cloneButton->setEnabled(false);
m_removeButton = new QPushButton(tr("Remove"));
m_removeButton = new QPushButton(Tr::tr("Remove"));
m_removeButton->setEnabled(false);
auto makeDefaultButton = new QPushButton(tr("Make Default"));
auto makeDefaultButton = new QPushButton(Tr::tr("Make Default"));
makeDefaultButton->setEnabled(false);
makeDefaultButton->setVisible(false);
makeDefaultButton->setToolTip(tr("Set as the default Meson executable to use "
"when creating a new kit or when no value is set."));
makeDefaultButton->setToolTip(Tr::tr("Set as the default Meson executable to use "
"when creating a new kit or when no value is set."));
using namespace Layouting;

View File

@@ -8,23 +8,21 @@
#include <coreplugin/dialogs/ioptionspage.h>
#include <QCoreApplication>
namespace Utils { class DetailsWidget; }
namespace MesonProjectManager::Internal {
class ToolTreeItem;
class ToolsSettingsWidget final : public Core::IOptionsPageWidget
{
Q_DECLARE_TR_FUNCTIONS(MesonProjectManager::Internal::ToolsSettingsWidget)
void apply() final;
public:
explicit ToolsSettingsWidget();
~ToolsSettingsWidget();
private:
void apply() final;
void cloneMesonTool();
void removeMesonTool();
void currentMesonToolChanged(const QModelIndex &newCurrent);

View File

@@ -3,6 +3,8 @@
#include "tooltreeitem.h"
#include "mesonprojectmanagertr.h"
#include <utils/utilsicons.h>
#include <QFileInfo>
@@ -27,12 +29,12 @@ ToolTreeItem::ToolTreeItem(const MesonTools::Tool_t &tool)
, m_autoDetected{tool->autoDetected()}
, m_id{tool->id()}
{
m_tooltip = tr("Version: %1").arg(tool->version().toQString());
m_tooltip = Tr::tr("Version: %1").arg(tool->version().toQString());
self_check();
}
ToolTreeItem::ToolTreeItem(const ToolTreeItem &other)
: m_name{tr("Clone of %1").arg(other.m_name)}
: m_name{Tr::tr("Clone of %1").arg(other.m_name)}
, m_executable{other.m_executable}
, m_autoDetected{false}
, m_id{Utils::Id::fromString(QUuid::createUuid().toString())}
@@ -63,14 +65,11 @@ QVariant ToolTreeItem::data(int column, int role) const
}
case Qt::ToolTipRole: {
if (!m_pathExists)
return QCoreApplication::translate("MesonProjectManager::Internal::ToolTreeItem",
"Meson executable path does not exist.");
return Tr::tr("Meson executable path does not exist.");
if (!m_pathIsFile)
return QCoreApplication::translate("MesonProjectManager::Internal::ToolTreeItem",
"Meson executable path is not a file.");
return Tr::tr("Meson executable path is not a file.");
if (!m_pathIsExecutable)
return QCoreApplication::translate("MesonProjectManager::Internal::ToolTreeItem",
"Meson executable path is not executable.");
return Tr::tr("Meson executable path is not executable.");
return m_tooltip;
}
case Qt::DecorationRole: {
@@ -103,9 +102,9 @@ void ToolTreeItem::self_check()
void ToolTreeItem::update_tooltip(const Version &version)
{
if (version.isValid)
m_tooltip = tr("Version: %1").arg(version.toQString());
m_tooltip = Tr::tr("Version: %1").arg(version.toQString());
else
m_tooltip = tr("Cannot get tool version.");
m_tooltip = Tr::tr("Cannot get tool version.");
}
void ToolTreeItem::update_tooltip()

View File

@@ -4,7 +4,6 @@
#pragma once
#include "mesontools.h"
#include "toolssettingspage.h"
#include <utils/fileutils.h>
#include <utils/id.h>
@@ -20,11 +19,11 @@ namespace Internal {
class ToolTreeItem final : public Utils::TreeItem
{
Q_DECLARE_TR_FUNCTIONS(MesonProjectManager::Internal::ToolsSettingsPage)
public:
ToolTreeItem(const QString &name);
ToolTreeItem(const MesonTools::Tool_t &tool);
ToolTreeItem(const ToolTreeItem &other);
QVariant data(int column, int role) const override;
inline bool isAutoDetected() const noexcept { return m_autoDetected; }
inline QString name() const noexcept { return m_name; }