forked from qt-creator/qt-creator
CMake: Move to Tr::tr
Change-Id: I169da93b5184351cb915d4c198fd33318fcfe06f Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -18,8 +18,7 @@
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
BuildDirParameters::BuildDirParameters() = default;
|
||||
|
||||
@@ -78,5 +77,4 @@ CMakeTool *BuildDirParameters::cmakeTool() const
|
||||
return CMakeToolManager::findById(cmakeToolId);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
#include <utils/environment.h>
|
||||
#include <utils/filepath.h>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
class CMakeBuildSystem;
|
||||
|
||||
@@ -37,5 +36,4 @@ public:
|
||||
QStringList additionalCMakeArguments;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
CMakeAutoCompleter::CMakeAutoCompleter()
|
||||
{
|
||||
@@ -123,5 +122,4 @@ bool CMakeAutoCompleter::contextAllowsElectricCharacters(const QTextCursor &curs
|
||||
return !isInComment(cursor) && !isInString(cursor);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
|
||||
#include <texteditor/autocompleter.h>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
class CMAKE_EXPORT CMakeAutoCompleter : public TextEditor::AutoCompleter
|
||||
{
|
||||
@@ -27,5 +26,4 @@ public:
|
||||
bool contextAllowsElectricCharacters(const QTextCursor &cursor) const override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "cmakekitinformation.h"
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
#include "cmakeprojectplugin.h"
|
||||
#include "cmakespecificsettings.h"
|
||||
#include "configmodel.h"
|
||||
@@ -75,8 +76,8 @@
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
namespace CMakeProjectManager {
|
||||
|
||||
static Q_LOGGING_CATEGORY(cmakeBuildConfigurationLog, "qtc.cmake.bc", QtWarningMsg);
|
||||
@@ -96,8 +97,6 @@ namespace Internal {
|
||||
|
||||
class CMakeBuildSettingsWidget : public NamedWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::CMakeBuildSettingsWidget)
|
||||
|
||||
public:
|
||||
CMakeBuildSettingsWidget(CMakeBuildSystem *bc);
|
||||
|
||||
@@ -165,7 +164,7 @@ static QModelIndex mapToSource(const QAbstractItemView *view, const QModelIndex
|
||||
}
|
||||
|
||||
CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildSystem *bs) :
|
||||
NamedWidget(tr("CMake")),
|
||||
NamedWidget(Tr::tr("CMake")),
|
||||
m_buildSystem(bs),
|
||||
m_configModel(new ConfigModel(this)),
|
||||
m_configFilterModel(new CategorySortFilterModel(this)),
|
||||
@@ -211,19 +210,19 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildSystem *bs) :
|
||||
m_warningMessageLabel->setVisible(false);
|
||||
|
||||
m_configurationStates = new QTabBar(this);
|
||||
m_configurationStates->addTab(tr("Initial Configuration"));
|
||||
m_configurationStates->addTab(tr("Current Configuration"));
|
||||
m_configurationStates->addTab(Tr::tr("Initial Configuration"));
|
||||
m_configurationStates->addTab(Tr::tr("Current Configuration"));
|
||||
connect(m_configurationStates, &QTabBar::currentChanged, this, [this](int index) {
|
||||
updateConfigurationStateIndex(index);
|
||||
});
|
||||
|
||||
m_kitConfiguration = new QPushButton(tr("Kit Configuration"));
|
||||
m_kitConfiguration->setToolTip(tr("Edit the current kit's CMake configuration."));
|
||||
m_kitConfiguration = new QPushButton(Tr::tr("Kit Configuration"));
|
||||
m_kitConfiguration->setToolTip(Tr::tr("Edit the current kit's CMake configuration."));
|
||||
m_kitConfiguration->setFixedWidth(m_kitConfiguration->sizeHint().width());
|
||||
connect(m_kitConfiguration, &QPushButton::clicked, this, [this]() { kitCMakeConfiguration(); });
|
||||
|
||||
m_filterEdit = new FancyLineEdit;
|
||||
m_filterEdit->setPlaceholderText(tr("Filter"));
|
||||
m_filterEdit->setPlaceholderText(Tr::tr("Filter"));
|
||||
m_filterEdit->setFiltering(true);
|
||||
auto tree = new TreeView;
|
||||
connect(tree, &TreeView::activated,
|
||||
@@ -271,46 +270,46 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildSystem *bs) :
|
||||
m_showProgressTimer.setInterval(50); // don't show progress for < 50ms tasks
|
||||
connect(&m_showProgressTimer, &QTimer::timeout, [this]() { m_progressIndicator->show(); });
|
||||
|
||||
m_addButton = new QPushButton(tr("&Add"));
|
||||
m_addButton->setToolTip(tr("Add a new configuration value."));
|
||||
m_addButton = new QPushButton(Tr::tr("&Add"));
|
||||
m_addButton->setToolTip(Tr::tr("Add a new configuration value."));
|
||||
auto addButtonMenu = new QMenu(this);
|
||||
addButtonMenu->addAction(tr("&Boolean"))->setData(
|
||||
addButtonMenu->addAction(Tr::tr("&Boolean"))->setData(
|
||||
QVariant::fromValue(static_cast<int>(ConfigModel::DataItem::BOOLEAN)));
|
||||
addButtonMenu->addAction(tr("&String"))->setData(
|
||||
addButtonMenu->addAction(Tr::tr("&String"))->setData(
|
||||
QVariant::fromValue(static_cast<int>(ConfigModel::DataItem::STRING)));
|
||||
addButtonMenu->addAction(tr("&Directory"))->setData(
|
||||
addButtonMenu->addAction(Tr::tr("&Directory"))->setData(
|
||||
QVariant::fromValue(static_cast<int>(ConfigModel::DataItem::DIRECTORY)));
|
||||
addButtonMenu->addAction(tr("&File"))->setData(
|
||||
addButtonMenu->addAction(Tr::tr("&File"))->setData(
|
||||
QVariant::fromValue(static_cast<int>(ConfigModel::DataItem::FILE)));
|
||||
m_addButton->setMenu(addButtonMenu);
|
||||
|
||||
m_editButton = new QPushButton(tr("&Edit"));
|
||||
m_editButton->setToolTip(tr("Edit the current CMake configuration value."));
|
||||
m_editButton = new QPushButton(Tr::tr("&Edit"));
|
||||
m_editButton->setToolTip(Tr::tr("Edit the current CMake configuration value."));
|
||||
|
||||
m_setButton = new QPushButton(tr("&Set"));
|
||||
m_setButton->setToolTip(tr("Set a value in the CMake configuration."));
|
||||
m_setButton = new QPushButton(Tr::tr("&Set"));
|
||||
m_setButton->setToolTip(Tr::tr("Set a value in the CMake configuration."));
|
||||
|
||||
m_unsetButton = new QPushButton(tr("&Unset"));
|
||||
m_unsetButton->setToolTip(tr("Unset a value in the CMake configuration."));
|
||||
m_unsetButton = new QPushButton(Tr::tr("&Unset"));
|
||||
m_unsetButton->setToolTip(Tr::tr("Unset a value in the CMake configuration."));
|
||||
|
||||
m_resetButton = new QPushButton(tr("&Reset"));
|
||||
m_resetButton->setToolTip(tr("Reset all unapplied changes."));
|
||||
m_resetButton = new QPushButton(Tr::tr("&Reset"));
|
||||
m_resetButton->setToolTip(Tr::tr("Reset all unapplied changes."));
|
||||
m_resetButton->setEnabled(false);
|
||||
|
||||
m_batchEditButton = new QPushButton(tr("Batch Edit..."));
|
||||
m_batchEditButton->setToolTip(tr("Set or reset multiple values in the CMake configuration."));
|
||||
m_batchEditButton = new QPushButton(Tr::tr("Batch Edit..."));
|
||||
m_batchEditButton->setToolTip(Tr::tr("Set or reset multiple values in the CMake configuration."));
|
||||
|
||||
m_showAdvancedCheckBox = new QCheckBox(tr("Advanced"));
|
||||
m_showAdvancedCheckBox = new QCheckBox(Tr::tr("Advanced"));
|
||||
|
||||
connect(m_configView->selectionModel(), &QItemSelectionModel::selectionChanged,
|
||||
this, [this](const QItemSelection &, const QItemSelection &) {
|
||||
updateSelection();
|
||||
});
|
||||
|
||||
m_reconfigureButton = new QPushButton(tr("Run CMake"));
|
||||
m_reconfigureButton = new QPushButton(Tr::tr("Run CMake"));
|
||||
m_reconfigureButton->setEnabled(false);
|
||||
|
||||
auto clearBox = new QCheckBox(tr("Clear system environment"), this);
|
||||
auto clearBox = new QCheckBox(Tr::tr("Clear system environment"), this);
|
||||
clearBox->setChecked(cbc->useClearConfigureEnvironment());
|
||||
|
||||
auto envWidget = new EnvironmentWidget(this, EnvironmentWidget::TypeLocal, clearBox);
|
||||
@@ -479,14 +478,14 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildSystem *bs) :
|
||||
connect(addButtonMenu, &QMenu::triggered, this, [this](QAction *action) {
|
||||
ConfigModel::DataItem::Type type =
|
||||
static_cast<ConfigModel::DataItem::Type>(action->data().value<int>());
|
||||
QString value = tr("<UNSET>");
|
||||
QString value = Tr::tr("<UNSET>");
|
||||
if (type == ConfigModel::DataItem::BOOLEAN)
|
||||
value = QString::fromLatin1("OFF");
|
||||
|
||||
m_configModel->appendConfiguration(tr("<UNSET>"), value, type, isInitialConfiguration());
|
||||
m_configModel->appendConfiguration(Tr::tr("<UNSET>"), value, type, isInitialConfiguration());
|
||||
const TreeItem *item = m_configModel->findNonRootItem([&value, type](TreeItem *item) {
|
||||
ConfigModel::DataItem dataItem = ConfigModel::dataItemFromIndex(item->index());
|
||||
return dataItem.key == tr("<UNSET>") && dataItem.type == type && dataItem.value == value;
|
||||
return dataItem.key == Tr::tr("<UNSET>") && dataItem.type == type && dataItem.value == value;
|
||||
});
|
||||
QModelIndex idx = m_configModel->indexForItem(item);
|
||||
idx = m_configTextFilterModel->mapFromSource(m_configFilterModel->mapFromSource(idx));
|
||||
@@ -537,14 +536,14 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildSystem *bs) :
|
||||
void CMakeBuildSettingsWidget::batchEditConfiguration()
|
||||
{
|
||||
auto dialog = new QDialog(this);
|
||||
dialog->setWindowTitle(tr("Edit CMake Configuration"));
|
||||
dialog->setWindowTitle(Tr::tr("Edit CMake Configuration"));
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dialog->setModal(true);
|
||||
auto layout = new QVBoxLayout(dialog);
|
||||
auto editor = new QPlainTextEdit(dialog);
|
||||
|
||||
auto label = new QLabel(dialog);
|
||||
label->setText(tr("Enter one CMake <a href=\"variable\">variable</a> per line.<br/>"
|
||||
label->setText(Tr::tr("Enter one CMake <a href=\"variable\">variable</a> per line.<br/>"
|
||||
"To set or change a variable, use -D<variable>:<type>=<value>.<br/>"
|
||||
"<type> can have one of the following values: FILEPATH, PATH, BOOL, INTERNAL, or STRING.<br/>"
|
||||
"To unset a variable, use -U<variable>.<br/>"));
|
||||
@@ -598,9 +597,9 @@ void CMakeBuildSettingsWidget::reconfigureWithInitialParameters()
|
||||
if (!doNotAsk) {
|
||||
QDialogButtonBox::StandardButton reply = Utils::CheckableMessageBox::question(
|
||||
Core::ICore::dialogParent(),
|
||||
tr("Re-configure with Initial Parameters"),
|
||||
tr("Clear CMake configuration and configure with initial parameters?"),
|
||||
tr("Do not ask again"),
|
||||
Tr::tr("Re-configure with Initial Parameters"),
|
||||
Tr::tr("Clear CMake configuration and configure with initial parameters?"),
|
||||
Tr::tr("Do not ask again"),
|
||||
&doNotAsk,
|
||||
QDialogButtonBox::Yes | QDialogButtonBox::No,
|
||||
QDialogButtonBox::Yes);
|
||||
@@ -657,7 +656,7 @@ void CMakeBuildSettingsWidget::kitCMakeConfiguration()
|
||||
m_buildSystem->kit()->blockNotification();
|
||||
|
||||
auto dialog = new QDialog(this);
|
||||
dialog->setWindowTitle(tr("Kit CMake Configuration"));
|
||||
dialog->setWindowTitle(Tr::tr("Kit CMake Configuration"));
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dialog->setModal(true);
|
||||
dialog->setSizeGripEnabled(true);
|
||||
@@ -708,7 +707,7 @@ void CMakeBuildSettingsWidget::updateConfigureDetailsWidgetsSummary(
|
||||
cmd.addArgs(configurationArguments);
|
||||
|
||||
params.setCommandLine(cmd);
|
||||
m_configureDetailsWidget->setSummaryText(params.summary(tr("Configure")));
|
||||
m_configureDetailsWidget->setSummaryText(params.summary(Tr::tr("Configure")));
|
||||
m_configureDetailsWidget->setState(DetailsWidget::Expanded);
|
||||
}
|
||||
|
||||
@@ -777,14 +776,14 @@ void CMakeBuildSettingsWidget::updateButtonState()
|
||||
// Update label and text boldness of the reconfigure button
|
||||
QFont reconfigureButtonFont = m_reconfigureButton->font();
|
||||
if (isParsing) {
|
||||
m_reconfigureButton->setText(tr("Stop CMake"));
|
||||
m_reconfigureButton->setText(Tr::tr("Stop CMake"));
|
||||
reconfigureButtonFont.setBold(false);
|
||||
} else {
|
||||
m_reconfigureButton->setEnabled(true);
|
||||
if (isInitial) {
|
||||
m_reconfigureButton->setText(tr("Re-configure with Initial Parameters"));
|
||||
m_reconfigureButton->setText(Tr::tr("Re-configure with Initial Parameters"));
|
||||
} else {
|
||||
m_reconfigureButton->setText(tr("Run CMake"));
|
||||
m_reconfigureButton->setText(Tr::tr("Run CMake"));
|
||||
}
|
||||
reconfigureButtonFont.setBold(isInitial ? m_configModel->hasChanges(isInitial)
|
||||
: !configChanges.isEmpty());
|
||||
@@ -998,21 +997,21 @@ QAction *CMakeBuildSettingsWidget::createForceAction(int type, const QModelIndex
|
||||
QString typeString;
|
||||
switch (type) {
|
||||
case ConfigModel::DataItem::BOOLEAN:
|
||||
typeString = tr("bool", "display string for cmake type BOOLEAN");
|
||||
typeString = Tr::tr("bool", "display string for cmake type BOOLEAN");
|
||||
break;
|
||||
case ConfigModel::DataItem::FILE:
|
||||
typeString = tr("file", "display string for cmake type FILE");
|
||||
typeString = Tr::tr("file", "display string for cmake type FILE");
|
||||
break;
|
||||
case ConfigModel::DataItem::DIRECTORY:
|
||||
typeString = tr("directory", "display string for cmake type DIRECTORY");
|
||||
typeString = Tr::tr("directory", "display string for cmake type DIRECTORY");
|
||||
break;
|
||||
case ConfigModel::DataItem::STRING:
|
||||
typeString = tr("string", "display string for cmake type STRING");
|
||||
typeString = Tr::tr("string", "display string for cmake type STRING");
|
||||
break;
|
||||
case ConfigModel::DataItem::UNKNOWN:
|
||||
return nullptr;
|
||||
}
|
||||
QAction *forceAction = new QAction(tr("Force to %1").arg(typeString), nullptr);
|
||||
QAction *forceAction = new QAction(Tr::tr("Force to %1").arg(typeString), nullptr);
|
||||
forceAction->setEnabled(m_configModel->canForceTo(idx, t));
|
||||
connect(forceAction, &QAction::triggered,
|
||||
this, [this, idx, t]() { m_configModel->forceTo(idx, t); });
|
||||
@@ -1033,7 +1032,7 @@ bool CMakeBuildSettingsWidget::eventFilter(QObject *target, QEvent *event)
|
||||
auto menu = new QMenu(this);
|
||||
connect(menu, &QMenu::triggered, menu, &QMenu::deleteLater);
|
||||
|
||||
auto help = new QAction(tr("Help"), this);
|
||||
auto help = new QAction(Tr::tr("Help"), this);
|
||||
menu->addAction(help);
|
||||
connect(help, &QAction::triggered, this, [=] {
|
||||
const CMakeConfigItem item = ConfigModel::dataItemFromIndex(idx).toCMakeConfigItem();
|
||||
@@ -1058,8 +1057,8 @@ bool CMakeBuildSettingsWidget::eventFilter(QObject *target, QEvent *event)
|
||||
menu->addSeparator();
|
||||
|
||||
auto applyKitOrInitialValue = new QAction(isInitialConfiguration()
|
||||
? tr("Apply Kit Value")
|
||||
: tr("Apply Initial Configuration Value"),
|
||||
? Tr::tr("Apply Kit Value")
|
||||
: Tr::tr("Apply Initial Configuration Value"),
|
||||
this);
|
||||
menu->addAction(applyKitOrInitialValue);
|
||||
connect(applyKitOrInitialValue, &QAction::triggered, this, [this] {
|
||||
@@ -1079,7 +1078,7 @@ bool CMakeBuildSettingsWidget::eventFilter(QObject *target, QEvent *event)
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
auto copy = new QAction(tr("Copy"), this);
|
||||
auto copy = new QAction(Tr::tr("Copy"), this);
|
||||
menu->addAction(copy);
|
||||
connect(copy, &QAction::triggered, this, [this] {
|
||||
const QModelIndexList selectedIndexes = m_configView->selectionModel()->selectedIndexes();
|
||||
@@ -1377,8 +1376,8 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
|
||||
if (QDir(oldDir).exists("CMakeCache.txt") && !QDir(newDir).exists("CMakeCache.txt")) {
|
||||
if (QMessageBox::information(
|
||||
Core::ICore::dialogParent(),
|
||||
tr("Changing Build Directory"),
|
||||
tr("Change the build directory to \"%1\" and start with a "
|
||||
Tr::tr("Changing Build Directory"),
|
||||
Tr::tr("Change the build directory to \"%1\" and start with a "
|
||||
"basic CMake configuration?")
|
||||
.arg(newDir),
|
||||
QMessageBox::Ok,
|
||||
@@ -1398,7 +1397,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
|
||||
additionalCMakeArgumentsAspect->setMacroExpanderProvider([this] { return macroExpander(); });
|
||||
|
||||
macroExpander()->registerVariable(DEVELOPMENT_TEAM_FLAG,
|
||||
tr("The CMake flag for the development team"),
|
||||
Tr::tr("The CMake flag for the development team"),
|
||||
[this] {
|
||||
const CMakeConfig flags = signingFlags();
|
||||
if (!flags.isEmpty())
|
||||
@@ -1406,7 +1405,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
|
||||
return QString();
|
||||
});
|
||||
macroExpander()->registerVariable(PROVISIONING_PROFILE_FLAG,
|
||||
tr("The CMake flag for the provisioning profile"),
|
||||
Tr::tr("The CMake flag for the provisioning profile"),
|
||||
[this] {
|
||||
const CMakeConfig flags = signingFlags();
|
||||
if (flags.size() > 1 && !flags.at(1).isUnset) {
|
||||
@@ -1416,7 +1415,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
|
||||
});
|
||||
|
||||
macroExpander()->registerVariable(CMAKE_OSX_ARCHITECTURES_FLAG,
|
||||
tr("The CMake flag for the architecture on macOS"),
|
||||
Tr::tr("The CMake flag for the architecture on macOS"),
|
||||
[target] {
|
||||
if (HostOsInfo::isRunningUnderRosetta()) {
|
||||
if (auto *qt = QtSupport::QtKitAspect::qtVersion(target->kit())) {
|
||||
@@ -1430,7 +1429,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
|
||||
return QLatin1String();
|
||||
});
|
||||
macroExpander()->registerVariable(QT_QML_DEBUG_FLAG,
|
||||
tr("The CMake flag for QML debugging, if enabled"),
|
||||
Tr::tr("The CMake flag for QML debugging, if enabled"),
|
||||
[this] {
|
||||
if (aspect<QtSupport::QmlDebuggingAspect>()->value()
|
||||
== TriState::Enabled) {
|
||||
@@ -1997,17 +1996,17 @@ BuildInfo CMakeBuildConfigurationFactory::createBuildInfo(BuildType buildType)
|
||||
break;
|
||||
case BuildTypeMinSizeRel:
|
||||
info.typeName = "MinSizeRel";
|
||||
info.displayName = CMakeBuildConfiguration::tr("Minimum Size Release");
|
||||
info.displayName = Tr::tr("Minimum Size Release");
|
||||
info.buildType = BuildConfiguration::Release;
|
||||
break;
|
||||
case BuildTypeRelWithDebInfo:
|
||||
info.typeName = "RelWithDebInfo";
|
||||
info.displayName = CMakeBuildConfiguration::tr("Release with Debug Information");
|
||||
info.displayName = Tr::tr("Release with Debug Information");
|
||||
info.buildType = BuildConfiguration::Profile;
|
||||
break;
|
||||
case BuildTypeProfile: {
|
||||
info.typeName = "Profile";
|
||||
info.displayName = CMakeBuildConfiguration::tr("Profile");
|
||||
info.displayName = Tr::tr("Profile");
|
||||
info.buildType = BuildConfiguration::Profile;
|
||||
QVariantMap extraInfo;
|
||||
// override CMake build type, which defaults to info.typeName
|
||||
@@ -2125,9 +2124,9 @@ Environment CMakeBuildConfiguration::baseConfigureEnvironment() const
|
||||
QString CMakeBuildConfiguration::baseConfigureEnvironmentText() const
|
||||
{
|
||||
if (useClearConfigureEnvironment())
|
||||
return tr("Clean Environment");
|
||||
return Tr::tr("Clean Environment");
|
||||
else
|
||||
return tr("System Environment");
|
||||
return Tr::tr("System Environment");
|
||||
}
|
||||
|
||||
QString CMakeBuildSystem::cmakeBuildType() const
|
||||
@@ -2262,7 +2261,7 @@ void InitialCMakeArgumentsAspect::toMap(QVariantMap &map) const
|
||||
InitialCMakeArgumentsAspect::InitialCMakeArgumentsAspect()
|
||||
{
|
||||
setSettingsKey("CMake.Initial.Parameters");
|
||||
setLabelText(tr("Additional CMake <a href=\"options\">options</a>:"));
|
||||
setLabelText(Tr::tr("Additional CMake <a href=\"options\">options</a>:"));
|
||||
setDisplayStyle(LineEditDisplay);
|
||||
}
|
||||
|
||||
@@ -2273,7 +2272,7 @@ InitialCMakeArgumentsAspect::InitialCMakeArgumentsAspect()
|
||||
AdditionalCMakeOptionsAspect::AdditionalCMakeOptionsAspect()
|
||||
{
|
||||
setSettingsKey("CMake.Additional.Options");
|
||||
setLabelText(tr("Additional CMake <a href=\"options\">options</a>:"));
|
||||
setLabelText(Tr::tr("Additional CMake <a href=\"options\">options</a>:"));
|
||||
setDisplayStyle(LineEditDisplay);
|
||||
}
|
||||
|
||||
@@ -2292,7 +2291,7 @@ SourceDirectoryAspect::SourceDirectoryAspect()
|
||||
BuildTypeAspect::BuildTypeAspect()
|
||||
{
|
||||
setSettingsKey(CMAKE_BUILD_TYPE);
|
||||
setLabelText(tr("Build type:"));
|
||||
setLabelText(Tr::tr("Build type:"));
|
||||
setDisplayStyle(LineEditDisplay);
|
||||
setDefaultValue("Unknown");
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "cmakeparser.h"
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
#include "cmaketool.h"
|
||||
|
||||
#include <coreplugin/find/itemviewfind.h>
|
||||
@@ -38,8 +39,7 @@ using namespace Core;
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
const char BUILD_TARGETS_KEY[] = "CMakeProjectManager.MakeStep.BuildTargets";
|
||||
const char CMAKE_ARGUMENTS_KEY[] = "CMakeProjectManager.MakeStep.CMakeArguments";
|
||||
@@ -112,17 +112,17 @@ QVariant CMakeTargetItem::data(int column, int role) const
|
||||
if (column == 0) {
|
||||
if (role == Qt::DisplayRole) {
|
||||
if (m_target.isEmpty())
|
||||
return CMakeBuildStep::tr("Current executable");
|
||||
return Tr::tr("Current executable");
|
||||
return m_target;
|
||||
}
|
||||
|
||||
if (role == Qt::ToolTipRole) {
|
||||
if (m_target.isEmpty()) {
|
||||
return CMakeBuildStep::tr("Build the executable used in the active run "
|
||||
return Tr::tr("Build the executable used in the active run "
|
||||
"configuration. Currently: %1")
|
||||
.arg(m_step->activeRunConfigTarget());
|
||||
}
|
||||
return CMakeBuildStep::tr("Target: %1").arg(m_target);
|
||||
return Tr::tr("Target: %1").arg(m_target);
|
||||
}
|
||||
|
||||
if (role == Qt::CheckStateRole)
|
||||
@@ -161,12 +161,12 @@ CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Utils::Id id) :
|
||||
{
|
||||
m_cmakeArguments = addAspect<StringAspect>();
|
||||
m_cmakeArguments->setSettingsKey(CMAKE_ARGUMENTS_KEY);
|
||||
m_cmakeArguments->setLabelText(tr("CMake arguments:"));
|
||||
m_cmakeArguments->setLabelText(Tr::tr("CMake arguments:"));
|
||||
m_cmakeArguments->setDisplayStyle(StringAspect::LineEditDisplay);
|
||||
|
||||
m_toolArguments = addAspect<StringAspect>();
|
||||
m_toolArguments->setSettingsKey(TOOL_ARGUMENTS_KEY);
|
||||
m_toolArguments->setLabelText(tr("Tool arguments:"));
|
||||
m_toolArguments->setLabelText(Tr::tr("Tool arguments:"));
|
||||
m_toolArguments->setDisplayStyle(StringAspect::LineEditDisplay);
|
||||
|
||||
Kit *kit = buildConfiguration()->kit();
|
||||
@@ -176,13 +176,13 @@ CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Utils::Id id) :
|
||||
m_useiOSAutomaticProvisioningUpdates->setSettingsKey(
|
||||
IOS_AUTOMATIC_PROVISIONG_UPDATES_ARGUMENTS_KEY);
|
||||
m_useiOSAutomaticProvisioningUpdates->setLabel(
|
||||
tr("Enable automatic provisioning updates:"));
|
||||
Tr::tr("Enable automatic provisioning updates:"));
|
||||
m_useiOSAutomaticProvisioningUpdates->setToolTip(
|
||||
tr("Tells xcodebuild to create and download a provisioning profile "
|
||||
Tr::tr("Tells xcodebuild to create and download a provisioning profile "
|
||||
"if a valid one does not exist."));
|
||||
}
|
||||
|
||||
m_buildTargetModel.setHeader({tr("Target")});
|
||||
m_buildTargetModel.setHeader({Tr::tr("Target")});
|
||||
|
||||
setBuildTargets({defaultBuildTarget()});
|
||||
auto *bs = qobject_cast<CMakeBuildSystem *>(buildSystem());
|
||||
@@ -248,7 +248,7 @@ bool CMakeBuildStep::init()
|
||||
|
||||
if (!bc->isEnabled()) {
|
||||
emit addTask(BuildSystemTask(Task::Error,
|
||||
tr("The build configuration is currently disabled.")));
|
||||
Tr::tr("The build configuration is currently disabled.")));
|
||||
emitFaultyConfigurationMessage();
|
||||
return false;
|
||||
}
|
||||
@@ -256,7 +256,7 @@ bool CMakeBuildStep::init()
|
||||
CMakeTool *tool = CMakeKitAspect::cmakeTool(kit());
|
||||
if (!tool || !tool->isValid()) {
|
||||
emit addTask(BuildSystemTask(Task::Error,
|
||||
tr("A CMake tool must be set up for building. "
|
||||
Tr::tr("A CMake tool must be set up for building. "
|
||||
"Configure a CMake tool in the kit options.")));
|
||||
emitFaultyConfigurationMessage();
|
||||
return false;
|
||||
@@ -280,7 +280,7 @@ bool CMakeBuildStep::init()
|
||||
if (bc->buildDirectory() != projectDirectory) {
|
||||
if (projectDirectory.pathAppended("CMakeCache.txt").exists()) {
|
||||
emit addTask(BuildSystemTask(Task::Warning,
|
||||
tr("There is a CMakeCache.txt file in \"%1\", which suggest an "
|
||||
Tr::tr("There is a CMakeCache.txt file in \"%1\", which suggest an "
|
||||
"in-source build was done before. You are now building in \"%2\", "
|
||||
"and the CMakeCache.txt file might confuse CMake.")
|
||||
.arg(projectDirectory.toUserOutput(), bc->buildDirectory().toUserOutput())));
|
||||
@@ -323,10 +323,10 @@ void CMakeBuildStep::doRun()
|
||||
m_waiting = false;
|
||||
auto bs = static_cast<CMakeBuildSystem *>(buildSystem());
|
||||
if (bs->persistCMakeState()) {
|
||||
emit addOutput(tr("Persisting CMake state..."), BuildStep::OutputFormat::NormalMessage);
|
||||
emit addOutput(Tr::tr("Persisting CMake state..."), BuildStep::OutputFormat::NormalMessage);
|
||||
m_waiting = true;
|
||||
} else if (buildSystem()->isWaitingForParse()) {
|
||||
emit addOutput(tr("Running CMake in preparation to build..."), BuildStep::OutputFormat::NormalMessage);
|
||||
emit addOutput(Tr::tr("Running CMake in preparation to build..."), BuildStep::OutputFormat::NormalMessage);
|
||||
m_waiting = true;
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ void CMakeBuildStep::handleProjectWasParsed(bool success)
|
||||
} else if (success) {
|
||||
runImpl();
|
||||
} else {
|
||||
AbstractProcessStep::stdError(tr("Project did not parse successfully, cannot build."));
|
||||
AbstractProcessStep::stdError(Tr::tr("Project did not parse successfully, cannot build."));
|
||||
emit finished(false);
|
||||
}
|
||||
}
|
||||
@@ -518,7 +518,7 @@ QWidget *CMakeBuildStep::createConfigWidget()
|
||||
setSummaryText(summaryText);
|
||||
};
|
||||
|
||||
setDisplayName(tr("Build", "ConfigWidget display name."));
|
||||
setDisplayName(Tr::tr("Build", "ConfigWidget display name."));
|
||||
|
||||
auto buildTargetsView = new QTreeView;
|
||||
buildTargetsView->setMinimumHeight(200);
|
||||
@@ -530,7 +530,7 @@ QWidget *CMakeBuildStep::createConfigWidget()
|
||||
ItemViewFind::LightColored);
|
||||
|
||||
auto createAndAddEnvironmentWidgets = [this](Layouting::Form &builder) {
|
||||
auto clearBox = new QCheckBox(tr("Clear system environment"));
|
||||
auto clearBox = new QCheckBox(Tr::tr("Clear system environment"));
|
||||
clearBox->setChecked(useClearEnvironment());
|
||||
|
||||
auto envWidget = new EnvironmentWidget(nullptr, EnvironmentWidget::TypeLocal, clearBox);
|
||||
@@ -564,7 +564,7 @@ QWidget *CMakeBuildStep::createConfigWidget()
|
||||
if (m_useiOSAutomaticProvisioningUpdates)
|
||||
builder.addRow(m_useiOSAutomaticProvisioningUpdates);
|
||||
|
||||
builder.addRow({new QLabel(tr("Targets:")), frame});
|
||||
builder.addRow({new QLabel(Tr::tr("Targets:")), frame});
|
||||
|
||||
if (!isCleanStep() && !m_buildPreset.isEmpty())
|
||||
createAndAddEnvironmentWidgets(builder);
|
||||
@@ -712,9 +712,9 @@ Environment CMakeBuildStep::baseEnvironment() const
|
||||
QString CMakeBuildStep::baseEnvironmentText() const
|
||||
{
|
||||
if (useClearEnvironment())
|
||||
return tr("Clean Environment");
|
||||
return Tr::tr("Clean Environment");
|
||||
else
|
||||
return tr("System Environment");
|
||||
return Tr::tr("System Environment");
|
||||
}
|
||||
|
||||
void CMakeBuildStep::processFinished(int exitCode, QProcess::ExitStatus status)
|
||||
@@ -728,11 +728,10 @@ void CMakeBuildStep::processFinished(int exitCode, QProcess::ExitStatus status)
|
||||
CMakeBuildStepFactory::CMakeBuildStepFactory()
|
||||
{
|
||||
registerStep<CMakeBuildStep>(Constants::CMAKE_BUILD_STEP_ID);
|
||||
setDisplayName(CMakeBuildStep::tr("CMake Build", "Display name for CMakeProjectManager::CMakeBuildStep id."));
|
||||
setDisplayName(Tr::tr("CMake Build", "Display name for CMakeProjectManager::CMakeBuildStep id."));
|
||||
setSupportedProjectType(Constants::CMAKE_PROJECT_ID);
|
||||
}
|
||||
|
||||
} // Internal
|
||||
} // CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
#include <cmakebuildstep.moc>
|
||||
|
||||
@@ -11,8 +11,7 @@ class CommandLine;
|
||||
class StringAspect;
|
||||
} // Utils
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
class CMakeBuildStep;
|
||||
|
||||
@@ -123,5 +122,4 @@ public:
|
||||
CMakeBuildStepFactory();
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeprojectnodes.h"
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
#include "cmakeprojectplugin.h"
|
||||
#include "cmakespecificsettings.h"
|
||||
#include "projecttreehelper.h"
|
||||
@@ -59,8 +60,7 @@
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
static void copySourcePathsToClipboard(const FilePaths &srcPaths, const ProjectNode *node)
|
||||
{
|
||||
@@ -92,8 +92,8 @@ static void noAutoAdditionNotify(const FilePaths &filePaths, const ProjectNode *
|
||||
bool checkValue{false};
|
||||
QDialogButtonBox::StandardButton reply = CheckableMessageBox::question(
|
||||
Core::ICore::dialogParent(),
|
||||
QMessageBox::tr("Copy to Clipboard?"),
|
||||
QMessageBox::tr("Files are not automatically added to the "
|
||||
Tr::tr("Copy to Clipboard?"),
|
||||
Tr::tr("Files are not automatically added to the "
|
||||
"CMakeLists.txt file of the CMake project."
|
||||
"\nCopy the path to the source files to the clipboard?"),
|
||||
"Remember My Choice",
|
||||
@@ -359,7 +359,7 @@ void CMakeBuildSystem::setParametersAndRequestParse(const BuildDirParameters &pa
|
||||
if (!tool || !tool->isValid()) {
|
||||
TaskHub::addTask(
|
||||
BuildSystemTask(Task::Error,
|
||||
tr("The kit needs to define a CMake tool to parse this project.")));
|
||||
Tr::tr("The kit needs to define a CMake tool to parse this project.")));
|
||||
return;
|
||||
}
|
||||
if (!tool->hasFileApi()) {
|
||||
@@ -391,8 +391,8 @@ bool CMakeBuildSystem::mustApplyConfigurationChangesArguments(const BuildDirPara
|
||||
return false;
|
||||
|
||||
int answer = QMessageBox::question(Core::ICore::dialogParent(),
|
||||
tr("Apply configuration changes?"),
|
||||
"<p>" + tr("Run CMake with configuration changes?")
|
||||
Tr::tr("Apply configuration changes?"),
|
||||
"<p>" + Tr::tr("Run CMake with configuration changes?")
|
||||
+ "</p><pre>"
|
||||
+ parameters.configurationChangesArguments.join("\n")
|
||||
+ "</pre>",
|
||||
@@ -498,7 +498,7 @@ void CMakeBuildSystem::combineScanAndParse(bool restoredFromBackup)
|
||||
if (restoredFromBackup)
|
||||
project()->addIssue(
|
||||
CMakeProject::IssueType::Warning,
|
||||
tr("<b>CMake configuration failed<b>"
|
||||
Tr::tr("<b>CMake configuration failed<b>"
|
||||
"<p>The backup of the previous configuration has been restored.</p>"
|
||||
"<p>Issues and \"Projects > Build\" settings "
|
||||
"show more information about the failure.</p"));
|
||||
@@ -516,7 +516,7 @@ void CMakeBuildSystem::combineScanAndParse(bool restoredFromBackup)
|
||||
|
||||
project()->addIssue(
|
||||
CMakeProject::IssueType::Warning,
|
||||
tr("<b>Failed to load project<b>"
|
||||
Tr::tr("<b>Failed to load project<b>"
|
||||
"<p>Issues and \"Projects > Build\" settings "
|
||||
"show more information about the failure.</p"));
|
||||
}
|
||||
@@ -704,7 +704,7 @@ void CMakeBuildSystem::updateFallbackProjectData()
|
||||
QTC_CHECK(m_treeScanner.isFinished());
|
||||
if (m_treeScanner.asyncScanForFiles(projectDirectory()))
|
||||
Core::ProgressManager::addTask(m_treeScanner.future(),
|
||||
tr("Scan \"%1\" project tree")
|
||||
Tr::tr("Scan \"%1\" project tree")
|
||||
.arg(project()->displayName()),
|
||||
"CMake.Scan.Tree");
|
||||
}
|
||||
@@ -853,13 +853,13 @@ void CMakeBuildSystem::ensureBuildDirectory(const BuildDirParameters ¶meters
|
||||
const FilePath bdir = parameters.buildDirectory;
|
||||
|
||||
if (!buildConfiguration()->createBuildDirectory()) {
|
||||
handleParsingFailed(tr("Failed to create build directory \"%1\".").arg(bdir.toUserOutput()));
|
||||
handleParsingFailed(Tr::tr("Failed to create build directory \"%1\".").arg(bdir.toUserOutput()));
|
||||
return;
|
||||
}
|
||||
|
||||
const CMakeTool *tool = parameters.cmakeTool();
|
||||
if (!tool) {
|
||||
handleParsingFailed(tr("No CMake tool set up in kit."));
|
||||
handleParsingFailed(Tr::tr("No CMake tool set up in kit."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -867,7 +867,7 @@ void CMakeBuildSystem::ensureBuildDirectory(const BuildDirParameters ¶meters
|
||||
if (!tool->cmakeExecutable().ensureReachable(bdir)) {
|
||||
// Make sure that the build directory is available on the device.
|
||||
handleParsingFailed(
|
||||
tr("The remote CMake executable cannot write to the local build directory."));
|
||||
Tr::tr("The remote CMake executable cannot write to the local build directory."));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1337,5 +1337,4 @@ MakeInstallCommand CMakeBuildSystem::makeInstallCommand(const FilePath &installR
|
||||
return cmd;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "cmakeconfigitem.h"
|
||||
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
|
||||
#include <projectexplorer/kit.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
@@ -337,8 +339,7 @@ CMakeConfig CMakeConfig::fromFile(const Utils::FilePath &cacheFile, QString *err
|
||||
QFile cache(cacheFile.toString());
|
||||
if (!cache.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
if (errorMessage)
|
||||
*errorMessage = QCoreApplication::translate("CMakeProjectManager::CMakeConfigItem", "Failed to open %1 for reading.")
|
||||
.arg(cacheFile.toUserOutput());
|
||||
*errorMessage = Tr::tr("Failed to open %1 for reading.").arg(cacheFile.toUserOutput());
|
||||
return CMakeConfig();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include "cmake_global.h"
|
||||
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QStringList>
|
||||
|
||||
|
||||
@@ -21,13 +21,18 @@
|
||||
using namespace Core;
|
||||
using namespace TextEditor;
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
//
|
||||
// CMakeEditor
|
||||
//
|
||||
|
||||
class CMakeEditor : public TextEditor::BaseTextEditor
|
||||
{
|
||||
public:
|
||||
void contextHelp(const HelpCallback &callback) const final;
|
||||
};
|
||||
|
||||
void CMakeEditor::contextHelp(const HelpCallback &callback) const
|
||||
{
|
||||
int pos = position();
|
||||
@@ -239,5 +244,4 @@ CMakeEditorFactory::CMakeEditorFactory()
|
||||
contextMenu->addAction(ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION));
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -5,20 +5,7 @@
|
||||
|
||||
#include <texteditor/texteditor.h>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class CMakeEditorWidget;
|
||||
|
||||
class CMakeEditor : public TextEditor::BaseTextEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
void contextHelp(const HelpCallback &callback) const override;
|
||||
|
||||
friend class CMakeEditorWidget;
|
||||
};
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
class CMakeEditorFactory : public TextEditor::TextEditorFactory
|
||||
{
|
||||
@@ -26,5 +13,4 @@ public:
|
||||
CMakeEditorFactory();
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -14,18 +14,18 @@
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
using namespace TextEditor;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
// -------------------------------
|
||||
// CMakeFileCompletionAssistProvider
|
||||
// -------------------------------
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
IAssistProcessor *CMakeFileCompletionAssistProvider::createProcessor(const AssistInterface *) const
|
||||
class CMakeFileCompletionAssist : public TextEditor::KeywordsCompletionAssistProcessor
|
||||
{
|
||||
return new CMakeFileCompletionAssist;
|
||||
}
|
||||
public:
|
||||
CMakeFileCompletionAssist();
|
||||
|
||||
TextEditor::IAssistProposal *perform(const TextEditor::AssistInterface *interface) final;
|
||||
};
|
||||
|
||||
CMakeFileCompletionAssist::CMakeFileCompletionAssist() :
|
||||
KeywordsCompletionAssistProcessor(Keywords())
|
||||
@@ -50,3 +50,10 @@ IAssistProposal *CMakeFileCompletionAssist::perform(const AssistInterface *inter
|
||||
setKeywords(kw);
|
||||
return KeywordsCompletionAssistProcessor::perform(interface);
|
||||
}
|
||||
|
||||
IAssistProcessor *CMakeFileCompletionAssistProvider::createProcessor(const AssistInterface *) const
|
||||
{
|
||||
return new CMakeFileCompletionAssist;
|
||||
}
|
||||
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -5,25 +5,12 @@
|
||||
|
||||
#include <texteditor/codeassist/keywordscompletionassist.h>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class CMakeFileCompletionAssist : public TextEditor::KeywordsCompletionAssistProcessor
|
||||
{
|
||||
public:
|
||||
CMakeFileCompletionAssist();
|
||||
|
||||
// IAssistProcessor interface
|
||||
TextEditor::IAssistProposal *perform(const TextEditor::AssistInterface *interface) override;
|
||||
};
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
class CMakeFileCompletionAssistProvider : public TextEditor::CompletionAssistProvider
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TextEditor::IAssistProcessor *createProcessor(const TextEditor::AssistInterface *) const override;
|
||||
TextEditor::IAssistProcessor *createProcessor(const TextEditor::AssistInterface *) const final;
|
||||
};
|
||||
|
||||
} // Internal
|
||||
} // CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
|
||||
#include "cmakeindenter.h"
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
CMakeIndenter::CMakeIndenter(QTextDocument *doc)
|
||||
: TextEditor::TextIndenter(doc)
|
||||
@@ -111,7 +110,4 @@ int CMakeIndenter::indentFor(const QTextBlock &block,
|
||||
return qMax(0, indentation);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
|
||||
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
|
||||
#include <texteditor/textindenter.h>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
class CMAKE_EXPORT CMakeIndenter : public TextEditor::TextIndenter
|
||||
{
|
||||
@@ -21,5 +20,4 @@ public:
|
||||
int cursorPositionInEditor = -1) override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// Copyright (C) 2016 Canonical Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "cmakeconfigitem.h"
|
||||
#include "cmakekitinformation.h"
|
||||
|
||||
#include "cmakeconfigitem.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
#include "cmakeprojectplugin.h"
|
||||
#include "cmakespecificsettings.h"
|
||||
#include "cmaketool.h"
|
||||
@@ -50,9 +51,6 @@ using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
// --------------------------------------------------------------------
|
||||
// CMakeKitAspect:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
static bool isIos(const Kit *k)
|
||||
{
|
||||
@@ -69,7 +67,6 @@ static Id defaultCMakeToolId()
|
||||
|
||||
class CMakeKitAspectWidget final : public KitAspectWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::CMakeKitAspect)
|
||||
public:
|
||||
CMakeKitAspectWidget(Kit *kit, const KitAspect *ki) : KitAspectWidget(kit, ki),
|
||||
m_comboBox(createSubWidget<QComboBox>()),
|
||||
@@ -137,7 +134,7 @@ private:
|
||||
m_comboBox->removeItem(pos);
|
||||
|
||||
if (m_comboBox->count() == 0) {
|
||||
m_comboBox->addItem(tr("<No CMake Tool available>"), Id().toSetting());
|
||||
m_comboBox->addItem(Tr::tr("<No CMake Tool available>"), Id().toSetting());
|
||||
m_comboBox->setEnabled(false);
|
||||
} else {
|
||||
m_comboBox->setEnabled(true);
|
||||
@@ -199,8 +196,8 @@ CMakeKitAspect::CMakeKitAspect()
|
||||
{
|
||||
setObjectName(QLatin1String("CMakeKitAspect"));
|
||||
setId(Constants::TOOL_ID);
|
||||
setDisplayName(tr("CMake Tool"));
|
||||
setDescription(tr("The CMake Tool to use when building a project with CMake.<br>"
|
||||
setDisplayName(Tr::tr("CMake Tool"));
|
||||
setDescription(Tr::tr("The CMake Tool to use when building a project with CMake.<br>"
|
||||
"This setting is ignored when using other build systems."));
|
||||
setPriority(20000);
|
||||
|
||||
@@ -278,7 +275,7 @@ void CMakeKitAspect::fix(Kit *k)
|
||||
KitAspect::ItemList CMakeKitAspect::toUserOutput(const Kit *k) const
|
||||
{
|
||||
const CMakeTool *const tool = cmakeTool(k);
|
||||
return {{tr("CMake"), tool ? tool->displayName() : tr("Unconfigured")}};
|
||||
return {{Tr::tr("CMake"), tool ? tool->displayName() : Tr::tr("Unconfigured")}};
|
||||
}
|
||||
|
||||
KitAspectWidget *CMakeKitAspect::createConfigWidget(Kit *k) const
|
||||
@@ -290,7 +287,7 @@ KitAspectWidget *CMakeKitAspect::createConfigWidget(Kit *k) const
|
||||
void CMakeKitAspect::addToMacroExpander(Kit *k, MacroExpander *expander) const
|
||||
{
|
||||
QTC_ASSERT(k, return);
|
||||
expander->registerFileVariables("CMake:Executable", tr("Path to the cmake executable"),
|
||||
expander->registerFileVariables("CMake:Executable", Tr::tr("Path to the cmake executable"),
|
||||
[k] {
|
||||
CMakeTool *tool = CMakeKitAspect::cmakeTool(k);
|
||||
return tool ? tool->cmakeExecutable() : FilePath();
|
||||
@@ -306,7 +303,7 @@ QSet<Id> CMakeKitAspect::availableFeatures(const Kit *k) const
|
||||
|
||||
QString CMakeKitAspect::msgUnsupportedVersion(const QByteArray &versionString)
|
||||
{
|
||||
return tr("CMake version %1 is unsupported. Update to "
|
||||
return Tr::tr("CMake version %1 is unsupported. Update to "
|
||||
"version 3.14 (with file-api) or later.")
|
||||
.arg(QString::fromUtf8(versionString));
|
||||
}
|
||||
@@ -324,8 +321,6 @@ const char TOOLSET_KEY[] = "Toolset";
|
||||
|
||||
class CMakeGeneratorKitAspectWidget final : public KitAspectWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::CMakeGeneratorKitAspect)
|
||||
|
||||
public:
|
||||
CMakeGeneratorKitAspectWidget(Kit *kit, const KitAspect *ki)
|
||||
: KitAspectWidget(kit, ki),
|
||||
@@ -338,7 +333,7 @@ public:
|
||||
});
|
||||
|
||||
m_label->setToolTip(ki->description());
|
||||
m_changeButton->setText(tr("Change..."));
|
||||
m_changeButton->setText(Tr::tr("Change..."));
|
||||
refresh();
|
||||
connect(m_changeButton, &QPushButton::clicked,
|
||||
this, &CMakeGeneratorKitAspectWidget::changeGenerator);
|
||||
@@ -380,9 +375,9 @@ private:
|
||||
messageLabel << generator;
|
||||
|
||||
if (!platform.isEmpty())
|
||||
messageLabel << ", " << tr("Platform") << ": " << platform;
|
||||
messageLabel << ", " << Tr::tr("Platform") << ": " << platform;
|
||||
if (!toolset.isEmpty())
|
||||
messageLabel << ", " << tr("Toolset") << ": " << toolset;
|
||||
messageLabel << ", " << Tr::tr("Toolset") << ": " << toolset;
|
||||
|
||||
m_label->setText(messageLabel.join(""));
|
||||
}
|
||||
@@ -396,7 +391,7 @@ private:
|
||||
flags |= Qt::MSWindowsFixedSizeDialogHint;
|
||||
changeDialog->setWindowFlags(flags);
|
||||
|
||||
changeDialog->setWindowTitle(tr("CMake Generator"));
|
||||
changeDialog->setWindowTitle(Tr::tr("CMake Generator"));
|
||||
|
||||
auto layout = new QGridLayout(changeDialog);
|
||||
layout->setSizeConstraint(QLayout::SetFixedSize);
|
||||
@@ -414,19 +409,19 @@ private:
|
||||
layout->addWidget(cmakeLabel, row, 1);
|
||||
|
||||
++row;
|
||||
layout->addWidget(new QLabel(tr("Generator:")), row, 0);
|
||||
layout->addWidget(new QLabel(Tr::tr("Generator:")), row, 0);
|
||||
layout->addWidget(generatorCombo, row, 1);
|
||||
|
||||
++row;
|
||||
layout->addWidget(new QLabel(tr("Extra generator:")), row, 0);
|
||||
layout->addWidget(new QLabel(Tr::tr("Extra generator:")), row, 0);
|
||||
layout->addWidget(extraGeneratorCombo, row, 1);
|
||||
|
||||
++row;
|
||||
layout->addWidget(new QLabel(tr("Platform:")), row, 0);
|
||||
layout->addWidget(new QLabel(Tr::tr("Platform:")), row, 0);
|
||||
layout->addWidget(platformEdit, row, 1);
|
||||
|
||||
++row;
|
||||
layout->addWidget(new QLabel(tr("Toolset:")), row, 0);
|
||||
layout->addWidget(new QLabel(Tr::tr("Toolset:")), row, 0);
|
||||
layout->addWidget(toolsetEdit, row, 1);
|
||||
|
||||
++row;
|
||||
@@ -452,7 +447,7 @@ private:
|
||||
generatorCombo->setCurrentText(name);
|
||||
|
||||
extraGeneratorCombo->clear();
|
||||
extraGeneratorCombo->addItem(tr("<none>"), QString());
|
||||
extraGeneratorCombo->addItem(Tr::tr("<none>"), QString());
|
||||
for (const QString &eg : qAsConst(it->extraGenerators))
|
||||
extraGeneratorCombo->addItem(eg, eg);
|
||||
extraGeneratorCombo->setEnabled(extraGeneratorCombo->count() > 1);
|
||||
@@ -550,8 +545,8 @@ CMakeGeneratorKitAspect::CMakeGeneratorKitAspect()
|
||||
{
|
||||
setObjectName(QLatin1String("CMakeGeneratorKitAspect"));
|
||||
setId(GENERATOR_ID);
|
||||
setDisplayName(tr("CMake <a href=\"generator\">generator</a>"));
|
||||
setDescription(tr("CMake generator defines how a project is built when using CMake.<br>"
|
||||
setDisplayName(Tr::tr("CMake <a href=\"generator\">generator</a>"));
|
||||
setDescription(Tr::tr("CMake generator defines how a project is built when using CMake.<br>"
|
||||
"This setting is ignored when using other build systems."));
|
||||
setPriority(19000);
|
||||
}
|
||||
@@ -755,7 +750,7 @@ Tasks CMakeGeneratorKitAspect::validate(const Kit *k) const
|
||||
};
|
||||
|
||||
if (!tool->isValid()) {
|
||||
addWarning(tr("CMake Tool is unconfigured, CMake generator will be ignored."));
|
||||
addWarning(Tr::tr("CMake Tool is unconfigured, CMake generator will be ignored."));
|
||||
} else {
|
||||
const GeneratorInfo info = generatorInfo(k);
|
||||
QList<CMakeTool::Generator> known = tool->supportedGenerators();
|
||||
@@ -763,15 +758,15 @@ Tasks CMakeGeneratorKitAspect::validate(const Kit *k) const
|
||||
return g.matches(info.generator, info.extraGenerator);
|
||||
});
|
||||
if (it == known.constEnd()) {
|
||||
addWarning(tr("CMake Tool does not support the configured generator."));
|
||||
addWarning(Tr::tr("CMake Tool does not support the configured generator."));
|
||||
} else {
|
||||
if (!it->supportsPlatform && !info.platform.isEmpty())
|
||||
addWarning(tr("Platform is not supported by the selected CMake generator."));
|
||||
addWarning(Tr::tr("Platform is not supported by the selected CMake generator."));
|
||||
if (!it->supportsToolset && !info.toolset.isEmpty())
|
||||
addWarning(tr("Toolset is not supported by the selected CMake generator."));
|
||||
addWarning(Tr::tr("Toolset is not supported by the selected CMake generator."));
|
||||
}
|
||||
if (!tool->hasFileApi()) {
|
||||
addWarning(tr("The selected CMake binary does not support file-api. "
|
||||
addWarning(Tr::tr("The selected CMake binary does not support file-api. "
|
||||
"%1 will not be able to parse CMake projects.")
|
||||
.arg(Core::Constants::IDE_DISPLAY_NAME));
|
||||
}
|
||||
@@ -838,15 +833,15 @@ KitAspect::ItemList CMakeGeneratorKitAspect::toUserOutput(const Kit *k) const
|
||||
const GeneratorInfo info = generatorInfo(k);
|
||||
QString message;
|
||||
if (info.generator.isEmpty()) {
|
||||
message = tr("<Use Default Generator>");
|
||||
message = Tr::tr("<Use Default Generator>");
|
||||
} else {
|
||||
message = tr("Generator: %1<br>Extra generator: %2").arg(info.generator).arg(info.extraGenerator);
|
||||
message = Tr::tr("Generator: %1<br>Extra generator: %2").arg(info.generator).arg(info.extraGenerator);
|
||||
if (!info.platform.isEmpty())
|
||||
message += "<br/>" + tr("Platform: %1").arg(info.platform);
|
||||
message += "<br/>" + Tr::tr("Platform: %1").arg(info.platform);
|
||||
if (!info.toolset.isEmpty())
|
||||
message += "<br/>" + tr("Toolset: %1").arg(info.toolset);
|
||||
message += "<br/>" + Tr::tr("Toolset: %1").arg(info.toolset);
|
||||
}
|
||||
return {{tr("CMake Generator"), message}};
|
||||
return {{Tr::tr("CMake Generator"), message}};
|
||||
}
|
||||
|
||||
KitAspectWidget *CMakeGeneratorKitAspect::createConfigWidget(Kit *k) const
|
||||
@@ -880,8 +875,6 @@ const char QTC_CMAKE_PRESET_KEY[] = "QTC_CMAKE_PRESET";
|
||||
|
||||
class CMakeConfigurationKitAspectWidget final : public KitAspectWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::CMakeConfigurationKitAspect)
|
||||
|
||||
public:
|
||||
CMakeConfigurationKitAspectWidget(Kit *kit, const KitAspect *ki)
|
||||
: KitAspectWidget(kit, ki),
|
||||
@@ -889,7 +882,7 @@ public:
|
||||
m_manageButton(createSubWidget<QPushButton>())
|
||||
{
|
||||
refresh();
|
||||
m_manageButton->setText(tr("Change..."));
|
||||
m_manageButton->setText(Tr::tr("Change..."));
|
||||
connect(m_manageButton, &QAbstractButton::clicked,
|
||||
this, &CMakeConfigurationKitAspectWidget::editConfigurationChanges);
|
||||
}
|
||||
@@ -940,11 +933,11 @@ private:
|
||||
const CMakeTool *tool = CMakeKitAspect::cmakeTool(kit());
|
||||
|
||||
m_dialog = new QDialog(m_summaryLabel->window());
|
||||
m_dialog->setWindowTitle(tr("Edit CMake Configuration"));
|
||||
m_dialog->setWindowTitle(Tr::tr("Edit CMake Configuration"));
|
||||
auto layout = new QVBoxLayout(m_dialog);
|
||||
m_editor = new QPlainTextEdit;
|
||||
auto editorLabel = new QLabel(m_dialog);
|
||||
editorLabel->setText(tr("Enter one CMake <a href=\"variable\">variable</a> per line.<br/>"
|
||||
editorLabel->setText(Tr::tr("Enter one CMake <a href=\"variable\">variable</a> per line.<br/>"
|
||||
"To set a variable, use -D<variable>:<type>=<value>.<br/>"
|
||||
"<type> can have one of the following values: FILEPATH, PATH, "
|
||||
"BOOL, INTERNAL, or STRING."));
|
||||
@@ -959,7 +952,7 @@ private:
|
||||
|
||||
m_additionalEditor = new QLineEdit;
|
||||
auto additionalLabel = new QLabel(m_dialog);
|
||||
additionalLabel->setText(tr("Additional CMake <a href=\"options\">options</a>:"));
|
||||
additionalLabel->setText(Tr::tr("Additional CMake <a href=\"options\">options</a>:"));
|
||||
connect(additionalLabel, &QLabel::linkActivated, this, [=](const QString &) {
|
||||
CMakeTool::openCMakeHelpUrl(tool, "%1/manual/cmake.1.html#options");
|
||||
});
|
||||
@@ -1042,8 +1035,8 @@ CMakeConfigurationKitAspect::CMakeConfigurationKitAspect()
|
||||
{
|
||||
setObjectName(QLatin1String("CMakeConfigurationKitAspect"));
|
||||
setId(CONFIGURATION_ID);
|
||||
setDisplayName(tr("CMake Configuration"));
|
||||
setDescription(tr("Default configuration passed to CMake when setting up a project."));
|
||||
setDisplayName(Tr::tr("CMake Configuration"));
|
||||
setDescription(Tr::tr("Default configuration passed to CMake when setting up a project."));
|
||||
setPriority(18000);
|
||||
}
|
||||
|
||||
@@ -1185,22 +1178,22 @@ Tasks CMakeConfigurationKitAspect::validate(const Kit *k) const
|
||||
// Validate Qt:
|
||||
if (qmakePath.isEmpty()) {
|
||||
if (version && version->isValid() && isQt4) {
|
||||
addWarning(tr("CMake configuration has no path to qmake binary set, "
|
||||
addWarning(Tr::tr("CMake configuration has no path to qmake binary set, "
|
||||
"even though the kit has a valid Qt version."));
|
||||
}
|
||||
} else {
|
||||
if (!version || !version->isValid()) {
|
||||
addWarning(tr("CMake configuration has a path to a qmake binary set, "
|
||||
addWarning(Tr::tr("CMake configuration has a path to a qmake binary set, "
|
||||
"even though the kit has no valid Qt version."));
|
||||
} else if (qmakePath != version->qmakeFilePath() && isQt4) {
|
||||
addWarning(tr("CMake configuration has a path to a qmake binary set "
|
||||
addWarning(Tr::tr("CMake configuration has a path to a qmake binary set "
|
||||
"that does not match the qmake binary path "
|
||||
"configured in the Qt version."));
|
||||
}
|
||||
}
|
||||
if (version && !qtInstallDirs.contains(version->prefix().path()) && !isQt4) {
|
||||
if (version->isValid()) {
|
||||
addWarning(tr("CMake configuration has no CMAKE_PREFIX_PATH set "
|
||||
addWarning(Tr::tr("CMake configuration has no CMAKE_PREFIX_PATH set "
|
||||
"that points to the kit Qt version."));
|
||||
}
|
||||
}
|
||||
@@ -1208,15 +1201,15 @@ Tasks CMakeConfigurationKitAspect::validate(const Kit *k) const
|
||||
// Validate Toolchains:
|
||||
if (tcCPath.isEmpty()) {
|
||||
if (tcC && tcC->isValid()) {
|
||||
addWarning(tr("CMake configuration has no path to a C compiler set, "
|
||||
addWarning(Tr::tr("CMake configuration has no path to a C compiler set, "
|
||||
"even though the kit has a valid tool chain."));
|
||||
}
|
||||
} else {
|
||||
if (!tcC || !tcC->isValid()) {
|
||||
addWarning(tr("CMake configuration has a path to a C compiler set, "
|
||||
addWarning(Tr::tr("CMake configuration has a path to a C compiler set, "
|
||||
"even though the kit has no valid tool chain."));
|
||||
} else if (tcCPath != tcC->compilerCommand() && tcCPath != tcC->compilerCommand().onDevice(tcCPath)) {
|
||||
addWarning(tr("CMake configuration has a path to a C compiler set "
|
||||
addWarning(Tr::tr("CMake configuration has a path to a C compiler set "
|
||||
"that does not match the compiler path "
|
||||
"configured in the tool chain of the kit."));
|
||||
}
|
||||
@@ -1224,15 +1217,15 @@ Tasks CMakeConfigurationKitAspect::validate(const Kit *k) const
|
||||
|
||||
if (tcCxxPath.isEmpty()) {
|
||||
if (tcCxx && tcCxx->isValid()) {
|
||||
addWarning(tr("CMake configuration has no path to a C++ compiler set, "
|
||||
addWarning(Tr::tr("CMake configuration has no path to a C++ compiler set, "
|
||||
"even though the kit has a valid tool chain."));
|
||||
}
|
||||
} else {
|
||||
if (!tcCxx || !tcCxx->isValid()) {
|
||||
addWarning(tr("CMake configuration has a path to a C++ compiler set, "
|
||||
addWarning(Tr::tr("CMake configuration has a path to a C++ compiler set, "
|
||||
"even though the kit has no valid tool chain."));
|
||||
} else if (tcCxxPath != tcCxx->compilerCommand() && tcCxxPath != tcCxx->compilerCommand().onDevice(tcCxxPath)) {
|
||||
addWarning(tr("CMake configuration has a path to a C++ compiler set "
|
||||
addWarning(Tr::tr("CMake configuration has a path to a C++ compiler set "
|
||||
"that does not match the compiler path "
|
||||
"configured in the tool chain of the kit."));
|
||||
}
|
||||
@@ -1254,7 +1247,7 @@ void CMakeConfigurationKitAspect::fix(Kit *k)
|
||||
|
||||
KitAspect::ItemList CMakeConfigurationKitAspect::toUserOutput(const Kit *k) const
|
||||
{
|
||||
return {{tr("CMake Configuration"), toStringList(k).join("<br>")}};
|
||||
return {{Tr::tr("CMake Configuration"), toStringList(k).join("<br>")}};
|
||||
}
|
||||
|
||||
KitAspectWidget *CMakeConfigurationKitAspect::createConfigWidget(Kit *k) const
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
|
||||
class CMakeTool;
|
||||
|
||||
class CMAKE_EXPORT CMakeKitAspect : public ProjectExplorer::KitAspect
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CMakeKitAspect();
|
||||
|
||||
@@ -40,7 +40,6 @@ public:
|
||||
|
||||
class CMAKE_EXPORT CMakeGeneratorKitAspect : public ProjectExplorer::KitAspect
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CMakeGeneratorKitAspect();
|
||||
|
||||
@@ -73,7 +72,6 @@ private:
|
||||
|
||||
class CMAKE_EXPORT CMakeConfigurationKitAspect : public ProjectExplorer::KitAspect
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CMakeConfigurationKitAspect();
|
||||
|
||||
@@ -104,4 +102,4 @@ private:
|
||||
QVariant defaultValue(const ProjectExplorer::Kit *k) const;
|
||||
};
|
||||
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
#include "cmakebuildstep.h"
|
||||
#include "cmakebuildsystem.h"
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
|
||||
#include <projectexplorer/buildmanager.h>
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/session.h>
|
||||
@@ -15,11 +17,11 @@
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
using namespace CMakeProjectManager;
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// CMakeTargetLocatorFilter:
|
||||
// --------------------------------------------------------------------
|
||||
@@ -93,8 +95,8 @@ void CMakeTargetLocatorFilter::projectListUpdated()
|
||||
BuildCMakeTargetLocatorFilter::BuildCMakeTargetLocatorFilter()
|
||||
{
|
||||
setId("Build CMake target");
|
||||
setDisplayName(tr("Build CMake target"));
|
||||
setDescription(tr("Builds a target of any open CMake project."));
|
||||
setDisplayName(Tr::tr("Build CMake target"));
|
||||
setDescription(Tr::tr("Builds a target of any open CMake project."));
|
||||
setDefaultShortcutString("cm");
|
||||
setPriority(High);
|
||||
}
|
||||
@@ -143,8 +145,8 @@ void BuildCMakeTargetLocatorFilter::accept(const Core::LocatorFilterEntry &selec
|
||||
OpenCMakeTargetLocatorFilter::OpenCMakeTargetLocatorFilter()
|
||||
{
|
||||
setId("Open CMake target definition");
|
||||
setDisplayName(tr("Open CMake target"));
|
||||
setDescription(tr("Jumps to the definition of a target of any open CMake project."));
|
||||
setDisplayName(Tr::tr("Open CMake target"));
|
||||
setDescription(Tr::tr("Jumps to the definition of a target of any open CMake project."));
|
||||
setDefaultShortcutString("cmo");
|
||||
setPriority(Medium);
|
||||
}
|
||||
@@ -169,3 +171,5 @@ void OpenCMakeTargetLocatorFilter::accept(const Core::LocatorFilterEntry &select
|
||||
else
|
||||
Core::EditorManager::openEditor(file, {}, Core::EditorManager::AllowExternalEditor);
|
||||
}
|
||||
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -5,13 +5,10 @@
|
||||
|
||||
#include <coreplugin/locator/ilocatorfilter.h>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
class CMakeTargetLocatorFilter : public Core::ILocatorFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CMakeTargetLocatorFilter();
|
||||
|
||||
@@ -27,8 +24,6 @@ private:
|
||||
|
||||
class BuildCMakeTargetLocatorFilter : CMakeTargetLocatorFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BuildCMakeTargetLocatorFilter();
|
||||
|
||||
@@ -40,8 +35,6 @@ public:
|
||||
|
||||
class OpenCMakeTargetLocatorFilter : CMakeTargetLocatorFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
OpenCMakeTargetLocatorFilter();
|
||||
|
||||
@@ -51,5 +44,4 @@ public:
|
||||
int *selectionLength) const final;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "builddirparameters.h"
|
||||
#include "cmakeparser.h"
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
#include <projectexplorer/buildsystem.h>
|
||||
@@ -17,12 +18,11 @@
|
||||
|
||||
#include <QFutureWatcher>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
const int USER_STOP_EXIT_CODE = 15;
|
||||
|
||||
static QString stripTrailingNewline(QString str)
|
||||
@@ -57,7 +57,7 @@ void CMakeProcess::run(const BuildDirParameters ¶meters, const QStringList &
|
||||
|
||||
if (!cmakeExecutable.ensureReachable(parameters.sourceDirectory)
|
||||
|| !cmakeExecutable.ensureReachable(parameters.buildDirectory)) {
|
||||
QString msg = ::CMakeProjectManager::Internal::CMakeProcess::tr(
|
||||
QString msg = ::CMakeProjectManager::Tr::tr(
|
||||
"The source or build directory is not reachable by the CMake executable.");
|
||||
BuildSystem::appendBuildSystemOutput(msg + '\n');
|
||||
emit finished();
|
||||
@@ -68,8 +68,7 @@ void CMakeProcess::run(const BuildDirParameters ¶meters, const QStringList &
|
||||
const FilePath buildDirectory = parameters.buildDirectory.onDevice(cmakeExecutable);
|
||||
|
||||
if (!buildDirectory.exists()) {
|
||||
QString msg = ::CMakeProjectManager::Internal::CMakeProcess::tr(
|
||||
"The build directory \"%1\" does not exist")
|
||||
QString msg = ::CMakeProjectManager::Tr::tr( "The build directory \"%1\" does not exist")
|
||||
.arg(buildDirectory.toUserOutput());
|
||||
BuildSystem::appendBuildSystemOutput(msg + '\n');
|
||||
emit finished();
|
||||
@@ -78,9 +77,8 @@ void CMakeProcess::run(const BuildDirParameters ¶meters, const QStringList &
|
||||
|
||||
if (buildDirectory.needsDevice()) {
|
||||
if (cmake->cmakeExecutable().host() != buildDirectory.host()) {
|
||||
QString msg = ::CMakeProjectManager::Internal::CMakeProcess::tr(
|
||||
"CMake executable \"%1\" and build directory "
|
||||
"\"%2\" must be on the same device.")
|
||||
QString msg = ::CMakeProjectManager::Tr::tr("CMake executable \"%1\" and build directory "
|
||||
"\"%2\" must be on the same device.")
|
||||
.arg(cmake->cmakeExecutable().toUserOutput(),
|
||||
buildDirectory.toUserOutput());
|
||||
BuildSystem::appendBuildSystemOutput(msg + '\n');
|
||||
@@ -120,15 +118,13 @@ void CMakeProcess::run(const BuildDirParameters ¶meters, const QStringList &
|
||||
|
||||
TaskHub::clearTasks(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
|
||||
|
||||
BuildSystem::startNewBuildSystemOutput(
|
||||
::CMakeProjectManager::Internal::CMakeProcess::tr("Running %1 in %2.")
|
||||
BuildSystem::startNewBuildSystemOutput(::CMakeProjectManager::Tr::tr("Running %1 in %2.")
|
||||
.arg(commandLine.toUserOutput(), buildDirectory.toUserOutput()));
|
||||
|
||||
m_futureInterface = QFutureInterface<void>();
|
||||
m_futureInterface.setProgressRange(0, 1);
|
||||
Core::ProgressManager::addTimedTask(m_futureInterface,
|
||||
::CMakeProjectManager::Internal::CMakeProcess::tr(
|
||||
"Configuring \"%1\"")
|
||||
::CMakeProjectManager::Tr::tr("Configuring \"%1\"")
|
||||
.arg(parameters.projectName),
|
||||
"CMake.Configure",
|
||||
10);
|
||||
@@ -160,17 +156,14 @@ void CMakeProcess::handleProcessDone(const Utils::ProcessResultData &resultData)
|
||||
|
||||
QString msg;
|
||||
if (resultData.m_error == QProcess::FailedToStart) {
|
||||
msg = ::CMakeProjectManager::Internal::CMakeProcess::tr("CMake process failed to start.");
|
||||
msg = ::CMakeProjectManager::Tr::tr("CMake process failed to start.");
|
||||
} else if (resultData.m_exitStatus != QProcess::NormalExit) {
|
||||
if (m_futureInterface.isCanceled() || code == USER_STOP_EXIT_CODE)
|
||||
msg = ::CMakeProjectManager::Internal::CMakeProcess::tr(
|
||||
"CMake process was canceled by the user.");
|
||||
msg = ::CMakeProjectManager::Tr::tr("CMake process was canceled by the user.");
|
||||
else
|
||||
msg = ::CMakeProjectManager::Internal::CMakeProcess::tr("CMake process crashed.");
|
||||
msg = ::CMakeProjectManager::Tr::tr("CMake process crashed.");
|
||||
} else if (code != 0) {
|
||||
msg = ::CMakeProjectManager::Internal::CMakeProcess::tr(
|
||||
"CMake process exited with exit code %1.")
|
||||
.arg(code);
|
||||
msg = ::CMakeProjectManager::Tr::tr("CMake process exited with exit code %1.") .arg(code);
|
||||
}
|
||||
m_lastExitCode = code;
|
||||
|
||||
@@ -190,5 +183,4 @@ void CMakeProcess::handleProcessDone(const Utils::ProcessResultData &resultData)
|
||||
BuildSystem::appendBuildSystemOutput(elapsedTime + '\n');
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -22,8 +22,7 @@ class ProcessResultData;
|
||||
class QtcProcess;
|
||||
}
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
class BuildDirParameters;
|
||||
|
||||
@@ -55,5 +54,4 @@ private:
|
||||
int m_lastExitCode = 0;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "cmakekitinformation.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeprojectimporter.h"
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
#include "cmaketool.h"
|
||||
|
||||
#include <coreplugin/icontext.h>
|
||||
@@ -19,11 +20,10 @@
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
|
||||
using namespace Internal;
|
||||
|
||||
/*!
|
||||
\class CMakeProject
|
||||
*/
|
||||
@@ -49,9 +49,9 @@ Tasks CMakeProject::projectIssues(const Kit *k) const
|
||||
Tasks result = Project::projectIssues(k);
|
||||
|
||||
if (!CMakeKitAspect::cmakeTool(k))
|
||||
result.append(createProjectTask(Task::TaskType::Error, tr("No cmake tool set.")));
|
||||
result.append(createProjectTask(Task::TaskType::Error, Tr::tr("No cmake tool set.")));
|
||||
if (ToolChainKitAspect::toolChains(k).isEmpty())
|
||||
result.append(createProjectTask(Task::TaskType::Warning, tr("No compilers set in kit.")));
|
||||
result.append(createProjectTask(Task::TaskType::Warning, Tr::tr("No compilers set in kit.")));
|
||||
|
||||
result.append(m_issues);
|
||||
|
||||
@@ -115,7 +115,7 @@ Internal::PresetsData CMakeProject::combinePresets(Internal::PresetsData &cmakeP
|
||||
if (presetsHash.contains(p.name)) {
|
||||
TaskHub::addTask(
|
||||
BuildSystemTask(Task::TaskType::Error,
|
||||
tr("CMakeUserPresets.json cannot re-define the %1 preset: %2")
|
||||
Tr::tr("CMakeUserPresets.json cannot re-define the %1 preset: %2")
|
||||
.arg(presetType)
|
||||
.arg(p.name),
|
||||
"CMakeUserPresets.json"));
|
||||
@@ -158,7 +158,7 @@ void CMakeProject::setupBuildPresets(Internal::PresetsData &presetsData)
|
||||
if (!buildPreset.configurePreset) {
|
||||
TaskHub::addTask(BuildSystemTask(
|
||||
Task::TaskType::Error,
|
||||
tr("Build preset %1 is missing a corresponding configure preset.")
|
||||
Tr::tr("Build preset %1 is missing a corresponding configure preset.")
|
||||
.arg(buildPreset.name)));
|
||||
TaskHub::requestPopup();
|
||||
}
|
||||
@@ -189,7 +189,7 @@ void CMakeProject::readPresets()
|
||||
data = parser.presetsData();
|
||||
} else {
|
||||
TaskHub::addTask(BuildSystemTask(Task::TaskType::Error,
|
||||
tr("Failed to load %1: %2")
|
||||
Tr::tr("Failed to load %1: %2")
|
||||
.arg(presetFile.fileName())
|
||||
.arg(errorMessage),
|
||||
presetFile,
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "cmakebuildconfiguration.h"
|
||||
#include "cmakekitinformation.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
#include "cmaketoolmanager.h"
|
||||
#include "presetsmacros.h"
|
||||
|
||||
@@ -488,7 +489,7 @@ QList<void *> CMakeProjectImporter::examineDirectory(const FilePath &importPath,
|
||||
.canonicalPath();
|
||||
const FilePath canonicalProjectDirectory = projectDirectory().canonicalPath();
|
||||
if (data->cmakeHomeDirectory != canonicalProjectDirectory) {
|
||||
*warningMessage = tr("Unexpected source directory \"%1\", expected \"%2\". "
|
||||
*warningMessage = Tr::tr("Unexpected source directory \"%1\", expected \"%2\". "
|
||||
"This can be correct in some situations, for example when "
|
||||
"importing a standalone Qt test, but usually this is an error. "
|
||||
"Import the build anyway?")
|
||||
|
||||
@@ -16,8 +16,6 @@ namespace Internal {
|
||||
|
||||
class CMakeProjectImporter : public QtSupport::QtProjectImporter
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::CMakeProjectImporter)
|
||||
|
||||
public:
|
||||
CMakeProjectImporter(const Utils::FilePath &path, const Internal::PresetsData &presetsData);
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "cmakekitinformation.h"
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
#include "cmakeprojectnodes.h"
|
||||
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
@@ -32,10 +33,10 @@ using namespace ProjectExplorer;
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
|
||||
CMakeManager::CMakeManager()
|
||||
: m_runCMakeAction(new QAction(QIcon(), tr("Run CMake"), this))
|
||||
, m_clearCMakeCacheAction(new QAction(QIcon(), tr("Clear CMake Configuration"), this))
|
||||
, m_runCMakeActionContextMenu(new QAction(QIcon(), tr("Run CMake"), this))
|
||||
, m_rescanProjectAction(new QAction(QIcon(), tr("Rescan Project"), this))
|
||||
: m_runCMakeAction(new QAction(QIcon(), Tr::tr("Run CMake"), this))
|
||||
, m_clearCMakeCacheAction(new QAction(QIcon(), Tr::tr("Clear CMake Configuration"), this))
|
||||
, m_runCMakeActionContextMenu(new QAction(QIcon(), Tr::tr("Run CMake"), this))
|
||||
, m_rescanProjectAction(new QAction(QIcon(), Tr::tr("Rescan Project"), this))
|
||||
{
|
||||
Core::ActionContainer *mbuild =
|
||||
Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT);
|
||||
@@ -77,7 +78,7 @@ CMakeManager::CMakeManager()
|
||||
runCMake(ProjectTree::currentBuildSystem());
|
||||
});
|
||||
|
||||
m_buildFileContextMenu = new QAction(tr("Build"), this);
|
||||
m_buildFileContextMenu = new QAction(Tr::tr("Build"), this);
|
||||
command = Core::ActionManager::registerAction(m_buildFileContextMenu,
|
||||
Constants::BUILD_FILE_CONTEXT_MENU,
|
||||
projectContext);
|
||||
@@ -95,15 +96,15 @@ CMakeManager::CMakeManager()
|
||||
rescanProject(ProjectTree::currentBuildSystem());
|
||||
});
|
||||
|
||||
m_buildFileAction = new Utils::ParameterAction(tr("Build File"),
|
||||
tr("Build File \"%1\""),
|
||||
m_buildFileAction = new Utils::ParameterAction(Tr::tr("Build File"),
|
||||
Tr::tr("Build File \"%1\""),
|
||||
Utils::ParameterAction::AlwaysEnabled,
|
||||
this);
|
||||
command = Core::ActionManager::registerAction(m_buildFileAction, Constants::BUILD_FILE);
|
||||
command->setAttribute(Core::Command::CA_Hide);
|
||||
command->setAttribute(Core::Command::CA_UpdateText);
|
||||
command->setDescription(m_buildFileAction->text());
|
||||
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+B")));
|
||||
command->setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+Alt+B")));
|
||||
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD);
|
||||
connect(m_buildFileAction, &QAction::triggered, this, [this] { buildFile(); });
|
||||
|
||||
@@ -230,7 +231,7 @@ void CMakeManager::buildFile(Node *node)
|
||||
targetBase = relativeBuildDir / "CMakeFiles" / (targetNode->displayName() + ".dir");
|
||||
} else if (!generator.contains("Makefiles")) {
|
||||
Core::MessageManager::writeFlashing(
|
||||
tr("Build File is not supported for generator \"%1\"").arg(generator));
|
||||
Tr::tr("Build File is not supported for generator \"%1\"").arg(generator));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,29 +5,32 @@
|
||||
|
||||
#include "cmakebuildsystem.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
|
||||
#include <android/androidconstants.h>
|
||||
|
||||
#include <ios/iosconstants.h>
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
CMakeInputsNode::CMakeInputsNode(const Utils::FilePath &cmakeLists) :
|
||||
CMakeInputsNode::CMakeInputsNode(const FilePath &cmakeLists) :
|
||||
ProjectExplorer::ProjectNode(cmakeLists)
|
||||
{
|
||||
setPriority(Node::DefaultPriority - 10); // Bottom most!
|
||||
setDisplayName(QCoreApplication::translate("CMakeFilesProjectNode", "CMake Modules"));
|
||||
setDisplayName(Tr::tr("CMake Modules"));
|
||||
setIcon(DirectoryIcon(ProjectExplorer::Constants::FILEOVERLAY_MODULES));
|
||||
setListInProject(false);
|
||||
}
|
||||
|
||||
CMakeListsNode::CMakeListsNode(const Utils::FilePath &cmakeListPath) :
|
||||
CMakeListsNode::CMakeListsNode(const FilePath &cmakeListPath) :
|
||||
ProjectExplorer::ProjectNode(cmakeListPath)
|
||||
{
|
||||
setIcon(DirectoryIcon(Constants::Icons::FILE_OVERLAY));
|
||||
@@ -39,12 +42,12 @@ bool CMakeListsNode::showInSimpleTree() const
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<Utils::FilePath> CMakeListsNode::visibleAfterAddFileAction() const
|
||||
std::optional<FilePath> CMakeListsNode::visibleAfterAddFileAction() const
|
||||
{
|
||||
return filePath().pathAppended("CMakeLists.txt");
|
||||
}
|
||||
|
||||
CMakeProjectNode::CMakeProjectNode(const Utils::FilePath &directory) :
|
||||
CMakeProjectNode::CMakeProjectNode(const FilePath &directory) :
|
||||
ProjectExplorer::ProjectNode(directory)
|
||||
{
|
||||
setPriority(Node::DefaultProjectPriority + 1000);
|
||||
@@ -57,7 +60,7 @@ QString CMakeProjectNode::tooltip() const
|
||||
return QString();
|
||||
}
|
||||
|
||||
CMakeTargetNode::CMakeTargetNode(const Utils::FilePath &directory, const QString &target) :
|
||||
CMakeTargetNode::CMakeTargetNode(const FilePath &directory, const QString &target) :
|
||||
ProjectExplorer::ProjectNode(directory)
|
||||
{
|
||||
m_target = target;
|
||||
@@ -77,17 +80,17 @@ QString CMakeTargetNode::buildKey() const
|
||||
return m_target;
|
||||
}
|
||||
|
||||
Utils::FilePath CMakeTargetNode::buildDirectory() const
|
||||
FilePath CMakeTargetNode::buildDirectory() const
|
||||
{
|
||||
return m_buildDirectory;
|
||||
}
|
||||
|
||||
void CMakeTargetNode::setBuildDirectory(const Utils::FilePath &directory)
|
||||
void CMakeTargetNode::setBuildDirectory(const FilePath &directory)
|
||||
{
|
||||
m_buildDirectory = directory;
|
||||
}
|
||||
|
||||
QVariant CMakeTargetNode::data(Utils::Id role) const
|
||||
QVariant CMakeTargetNode::data(Id role) const
|
||||
{
|
||||
auto value = [this](const QByteArray &key) -> QVariant {
|
||||
for (const CMakeConfigItem &configItem : m_config) {
|
||||
@@ -169,7 +172,7 @@ void CMakeTargetNode::setConfig(const CMakeConfig &config)
|
||||
m_config = config;
|
||||
}
|
||||
|
||||
std::optional<Utils::FilePath> CMakeTargetNode::visibleAfterAddFileAction() const
|
||||
std::optional<FilePath> CMakeTargetNode::visibleAfterAddFileAction() const
|
||||
{
|
||||
return filePath().pathAppended("CMakeLists.txt");
|
||||
}
|
||||
@@ -182,19 +185,16 @@ void CMakeTargetNode::build()
|
||||
static_cast<CMakeBuildSystem *>(t->buildSystem())->buildCMakeTarget(displayName());
|
||||
}
|
||||
|
||||
void CMakeTargetNode::setTargetInformation(const QList<Utils::FilePath> &artifacts,
|
||||
const QString &type)
|
||||
void CMakeTargetNode::setTargetInformation(const QList<FilePath> &artifacts, const QString &type)
|
||||
{
|
||||
m_tooltip = QCoreApplication::translate("CMakeTargetNode", "Target type: ") + type + "<br>";
|
||||
m_tooltip = Tr::tr("Target type: ") + type + "<br>";
|
||||
if (artifacts.isEmpty()) {
|
||||
m_tooltip += QCoreApplication::translate("CMakeTargetNode", "No build artifacts");
|
||||
m_tooltip += Tr::tr("No build artifacts");
|
||||
} else {
|
||||
const QStringList tmp = Utils::transform(artifacts, &Utils::FilePath::toUserOutput);
|
||||
m_tooltip += QCoreApplication::translate("CMakeTargetNode", "Build artifacts:") + "<br>"
|
||||
+ tmp.join("<br>");
|
||||
const QStringList tmp = Utils::transform(artifacts, &FilePath::toUserOutput);
|
||||
m_tooltip += Tr::tr("Build artifacts:") + "<br>" + tmp.join("<br>");
|
||||
m_artifact = artifacts.first();
|
||||
}
|
||||
}
|
||||
|
||||
} // Internal
|
||||
} // CMakeBuildSystem
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
|
||||
#include <projectexplorer/projectnodes.h>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
class CMakeInputsNode : public ProjectExplorer::ProjectNode
|
||||
{
|
||||
@@ -59,5 +58,4 @@ private:
|
||||
CMakeConfig m_config;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeprojectmanager.h"
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
#include "cmakeprojectnodes.h"
|
||||
#include "cmakesettingspage.h"
|
||||
#include "cmakespecificsettings.h"
|
||||
@@ -20,9 +21,11 @@
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/projectmanager.h>
|
||||
#include <projectexplorer/projecttree.h>
|
||||
|
||||
#include <texteditor/snippets/snippetprovider.h>
|
||||
|
||||
#include <utils/fsengine/fileiconprovider.h>
|
||||
@@ -32,8 +35,7 @@ using namespace Core;
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
class CMakeProjectPluginPrivate
|
||||
{
|
||||
@@ -41,8 +43,8 @@ public:
|
||||
CMakeToolManager cmakeToolManager; // have that before the first CMakeKitAspect
|
||||
|
||||
ParameterAction buildTargetContextAction{
|
||||
CMakeProjectPlugin::tr("Build"),
|
||||
CMakeProjectPlugin:: tr("Build \"%1\""),
|
||||
Tr::tr("Build"),
|
||||
Tr::tr("Build \"%1\""),
|
||||
ParameterAction::AlwaysEnabled/*handled manually*/
|
||||
};
|
||||
|
||||
@@ -86,7 +88,7 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *
|
||||
"CMakeLists.txt");
|
||||
|
||||
TextEditor::SnippetProvider::registerGroup(Constants::CMAKE_SNIPPETS_GROUP_ID,
|
||||
tr("CMake", "SnippetProvider"));
|
||||
Tr::tr("CMake", "SnippetProvider"));
|
||||
ProjectManager::registerProjectType<CMakeProject>(Constants::CMAKE_PROJECT_MIMETYPE);
|
||||
|
||||
//register actions
|
||||
@@ -131,6 +133,5 @@ void CMakeProjectPlugin::updateContextActions(Node *node)
|
||||
d->buildTargetContextAction.setVisible(targetNode);
|
||||
}
|
||||
|
||||
} // Internal
|
||||
} // CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
|
||||
namespace ProjectExplorer { class Node; }
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
class CMakeSpecificSettings;
|
||||
|
||||
@@ -45,5 +44,4 @@ private:
|
||||
class CMakeProjectPluginPrivate *d = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "cmakesettingspage.h"
|
||||
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
#include "cmaketool.h"
|
||||
#include "cmaketoolmanager.h"
|
||||
|
||||
@@ -21,7 +22,6 @@
|
||||
|
||||
#include <QBoxLayout>
|
||||
#include <QCheckBox>
|
||||
#include <QCoreApplication>
|
||||
#include <QFormLayout>
|
||||
#include <QHeaderView>
|
||||
#include <QLabel>
|
||||
@@ -42,8 +42,6 @@ class CMakeToolTreeItem;
|
||||
|
||||
class CMakeToolItemModel : public TreeModel<TreeItem, TreeItem, CMakeToolTreeItem>
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::CMakeSettingsPage)
|
||||
|
||||
public:
|
||||
CMakeToolItemModel();
|
||||
|
||||
@@ -77,8 +75,6 @@ private:
|
||||
|
||||
class CMakeToolTreeItem : public TreeItem
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::CMakeSettingsPage)
|
||||
|
||||
public:
|
||||
CMakeToolTreeItem(const CMakeTool *item, bool changed)
|
||||
: m_id(item->id())
|
||||
@@ -122,9 +118,9 @@ public:
|
||||
cmake.setFilePath(m_executable);
|
||||
m_isSupported = cmake.hasFileApi();
|
||||
|
||||
m_tooltip = tr("Version: %1").arg(cmake.versionDisplay());
|
||||
m_tooltip += "<br>" + tr("Supports fileApi: %1").arg(m_isSupported ? tr("yes") : tr("no"));
|
||||
m_tooltip += "<br>" + tr("Detection source: \"%1\"").arg(m_detectionSource);
|
||||
m_tooltip = Tr::tr("Version: %1").arg(cmake.versionDisplay());
|
||||
m_tooltip += "<br>" + Tr::tr("Supports fileApi: %1").arg(m_isSupported ? Tr::tr("yes") : Tr::tr("no"));
|
||||
m_tooltip += "<br>" + Tr::tr("Detection source: \"%1\"").arg(m_detectionSource);
|
||||
|
||||
m_versionDisplay = cmake.versionDisplay();
|
||||
}
|
||||
@@ -141,7 +137,7 @@ public:
|
||||
case 0: {
|
||||
QString name = m_name;
|
||||
if (model()->defaultItemId() == m_id)
|
||||
name += tr(" (Default)");
|
||||
name += Tr::tr(" (Default)");
|
||||
return name;
|
||||
}
|
||||
case 1: {
|
||||
@@ -160,20 +156,13 @@ public:
|
||||
QString result = m_tooltip;
|
||||
QString error;
|
||||
if (!m_pathExists) {
|
||||
error = QCoreApplication::translate(
|
||||
"CMakeProjectManager::Internal::CMakeToolTreeItem",
|
||||
"CMake executable path does not exist.");
|
||||
error = Tr::tr("CMake executable path does not exist.");
|
||||
} else if (!m_pathIsFile) {
|
||||
error = QCoreApplication::translate(
|
||||
"CMakeProjectManager::Internal::CMakeToolTreeItem",
|
||||
"CMake executable path is not a file.");
|
||||
error = Tr::tr("CMake executable path is not a file.");
|
||||
} else if (!m_pathIsExecutable) {
|
||||
error = QCoreApplication::translate(
|
||||
"CMakeProjectManager::Internal::CMakeToolTreeItem",
|
||||
"CMake executable path is not executable.");
|
||||
error = Tr::tr("CMake executable path is not executable.");
|
||||
} else if (!m_isSupported) {
|
||||
error = QCoreApplication::translate(
|
||||
"CMakeProjectManager::Internal::CMakeToolTreeItem",
|
||||
error = Tr::tr(
|
||||
"CMake executable does not provide required IDE integration features.");
|
||||
}
|
||||
if (result.isEmpty() || error.isEmpty())
|
||||
@@ -213,11 +202,11 @@ public:
|
||||
|
||||
CMakeToolItemModel::CMakeToolItemModel()
|
||||
{
|
||||
setHeader({tr("Name"), tr("Path")});
|
||||
setHeader({Tr::tr("Name"), Tr::tr("Path")});
|
||||
rootItem()->appendChild(
|
||||
new StaticTreeItem({ProjectExplorer::Constants::msgAutoDetected()},
|
||||
{ProjectExplorer::Constants::msgAutoDetectedToolTip()}));
|
||||
rootItem()->appendChild(new StaticTreeItem(tr("Manual")));
|
||||
rootItem()->appendChild(new StaticTreeItem(Tr::tr("Manual")));
|
||||
|
||||
const QList<CMakeTool *> items = CMakeToolManager::cmakeTools();
|
||||
for (const CMakeTool *item : items)
|
||||
@@ -400,8 +389,6 @@ QString CMakeToolItemModel::uniqueDisplayName(const QString &base) const
|
||||
|
||||
class CMakeToolItemConfigWidget : public QWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::CMakeSettingsPage)
|
||||
|
||||
public:
|
||||
explicit CMakeToolItemConfigWidget(CMakeToolItemModel *model);
|
||||
void load(const CMakeToolTreeItem *item);
|
||||
@@ -437,20 +424,20 @@ CMakeToolItemConfigWidget::CMakeToolItemConfigWidget(CMakeToolItemModel *model)
|
||||
m_qchFileChooser->setMinimumWidth(400);
|
||||
m_qchFileChooser->setHistoryCompleter(QLatin1String("Cmake.qchFile.History"));
|
||||
m_qchFileChooser->setPromptDialogFilter("*.qch");
|
||||
m_qchFileChooser->setPromptDialogTitle(tr("CMake .qch File"));
|
||||
m_qchFileChooser->setPromptDialogTitle(Tr::tr("CMake .qch File"));
|
||||
|
||||
m_versionLabel = new QLabel(this);
|
||||
|
||||
m_autoRunCheckBox = new QCheckBox;
|
||||
m_autoRunCheckBox->setText(tr("Autorun CMake"));
|
||||
m_autoRunCheckBox->setToolTip(tr("Automatically run CMake after changes to CMake project files."));
|
||||
m_autoRunCheckBox->setText(Tr::tr("Autorun CMake"));
|
||||
m_autoRunCheckBox->setToolTip(Tr::tr("Automatically run CMake after changes to CMake project files."));
|
||||
|
||||
auto formLayout = new QFormLayout(this);
|
||||
formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
||||
formLayout->addRow(new QLabel(tr("Name:")), m_displayNameLineEdit);
|
||||
formLayout->addRow(new QLabel(tr("Path:")), m_binaryChooser);
|
||||
formLayout->addRow(new QLabel(tr("Version:")), m_versionLabel);
|
||||
formLayout->addRow(new QLabel(tr("Help file:")), m_qchFileChooser);
|
||||
formLayout->addRow(new QLabel(Tr::tr("Name:")), m_displayNameLineEdit);
|
||||
formLayout->addRow(new QLabel(Tr::tr("Path:")), m_binaryChooser);
|
||||
formLayout->addRow(new QLabel(Tr::tr("Version:")), m_versionLabel);
|
||||
formLayout->addRow(new QLabel(Tr::tr("Help file:")), m_qchFileChooser);
|
||||
formLayout->addRow(m_autoRunCheckBox);
|
||||
|
||||
connect(m_binaryChooser, &PathChooser::browsingFinished, this, &CMakeToolItemConfigWidget::onBinaryPathEditingFinished);
|
||||
@@ -517,22 +504,20 @@ void CMakeToolItemConfigWidget::load(const CMakeToolTreeItem *item)
|
||||
|
||||
class CMakeToolConfigWidget : public Core::IOptionsPageWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::CMakeToolConfigWidget)
|
||||
|
||||
public:
|
||||
CMakeToolConfigWidget()
|
||||
{
|
||||
m_addButton = new QPushButton(tr("Add"), this);
|
||||
m_addButton = new QPushButton(Tr::tr("Add"), this);
|
||||
|
||||
m_cloneButton = new QPushButton(tr("Clone"), this);
|
||||
m_cloneButton = new QPushButton(Tr::tr("Clone"), this);
|
||||
m_cloneButton->setEnabled(false);
|
||||
|
||||
m_delButton = new QPushButton(tr("Remove"), this);
|
||||
m_delButton = new QPushButton(Tr::tr("Remove"), this);
|
||||
m_delButton->setEnabled(false);
|
||||
|
||||
m_makeDefButton = new QPushButton(tr("Make Default"), this);
|
||||
m_makeDefButton = new QPushButton(Tr::tr("Make Default"), this);
|
||||
m_makeDefButton->setEnabled(false);
|
||||
m_makeDefButton->setToolTip(tr("Set as the default CMake Tool to use when creating a new kit or when no value is set."));
|
||||
m_makeDefButton->setToolTip(Tr::tr("Set as the default CMake Tool to use when creating a new kit or when no value is set."));
|
||||
|
||||
m_container = new DetailsWidget(this);
|
||||
m_container->setState(DetailsWidget::NoSummary);
|
||||
@@ -613,7 +598,7 @@ void CMakeToolConfigWidget::cloneCMakeTool()
|
||||
if (!m_currentItem)
|
||||
return;
|
||||
|
||||
QModelIndex newItem = m_model.addCMakeTool(tr("Clone of %1").arg(m_currentItem->m_name),
|
||||
QModelIndex newItem = m_model.addCMakeTool(Tr::tr("Clone of %1").arg(m_currentItem->m_name),
|
||||
m_currentItem->m_executable,
|
||||
m_currentItem->m_qchFile,
|
||||
m_currentItem->m_isAutoRun,
|
||||
@@ -624,7 +609,7 @@ void CMakeToolConfigWidget::cloneCMakeTool()
|
||||
|
||||
void CMakeToolConfigWidget::addCMakeTool()
|
||||
{
|
||||
QModelIndex newItem = m_model.addCMakeTool(m_model.uniqueDisplayName(tr("New CMake")),
|
||||
QModelIndex newItem = m_model.addCMakeTool(m_model.uniqueDisplayName(Tr::tr("New CMake")),
|
||||
FilePath(),
|
||||
FilePath(),
|
||||
true,
|
||||
@@ -681,7 +666,7 @@ void CMakeToolConfigWidget::currentCMakeToolChanged(const QModelIndex &newCurren
|
||||
CMakeSettingsPage::CMakeSettingsPage()
|
||||
{
|
||||
setId(Constants::Settings::TOOLS_ID);
|
||||
setDisplayName(tr("Tools"));
|
||||
setDisplayName(Tr::Tr::tr("Tools"));
|
||||
setDisplayCategory("CMake");
|
||||
setCategory(Constants::Settings::CATEGORY);
|
||||
setWidgetCreator([] { return new CMakeToolConfigWidget; });
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
// Copyright (C) 2018 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakespecificsettings.h"
|
||||
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
@@ -11,8 +13,7 @@
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
CMakeSpecificSettings::CMakeSpecificSettings()
|
||||
{
|
||||
@@ -25,10 +26,10 @@ CMakeSpecificSettings::CMakeSpecificSettings()
|
||||
registerAspect(&afterAddFileSetting);
|
||||
afterAddFileSetting.setSettingsKey("ProjectPopupSetting");
|
||||
afterAddFileSetting.setDefaultValue(AfterAddFileAction::AskUser);
|
||||
afterAddFileSetting.addOption(tr("Ask about copying file paths"));
|
||||
afterAddFileSetting.addOption(tr("Do not copy file paths"));
|
||||
afterAddFileSetting.addOption(tr("Copy file paths"));
|
||||
afterAddFileSetting.setToolTip(tr("Determines whether file paths are copied "
|
||||
afterAddFileSetting.addOption(::CMakeProjectManager::Tr::tr("Ask about copying file paths"));
|
||||
afterAddFileSetting.addOption(::CMakeProjectManager::Tr::tr("Do not copy file paths"));
|
||||
afterAddFileSetting.addOption(::CMakeProjectManager::Tr::tr("Copy file paths"));
|
||||
afterAddFileSetting.setToolTip(::CMakeProjectManager::Tr::tr("Determines whether file paths are copied "
|
||||
"to the clipboard for pasting to the CMakeLists.txt file when you "
|
||||
"add new files to CMake projects."));
|
||||
|
||||
@@ -41,21 +42,22 @@ CMakeSpecificSettings::CMakeSpecificSettings()
|
||||
registerAspect(&packageManagerAutoSetup);
|
||||
packageManagerAutoSetup.setSettingsKey("PackageManagerAutoSetup");
|
||||
packageManagerAutoSetup.setDefaultValue(false);
|
||||
packageManagerAutoSetup.setLabelText(tr("Package manager auto setup"));
|
||||
packageManagerAutoSetup.setToolTip(tr("Add the CMAKE_PROJECT_INCLUDE_BEFORE variable "
|
||||
packageManagerAutoSetup.setLabelText(::CMakeProjectManager::Tr::tr("Package manager auto setup"));
|
||||
packageManagerAutoSetup.setToolTip(::CMakeProjectManager::Tr::tr("Add the CMAKE_PROJECT_INCLUDE_BEFORE variable "
|
||||
"pointing to a CMake script that will install dependencies from the conanfile.txt, "
|
||||
"conanfile.py, or vcpkg.json file from the project source directory."));
|
||||
|
||||
registerAspect(&askBeforeReConfigureInitialParams);
|
||||
askBeforeReConfigureInitialParams.setSettingsKey("AskReConfigureInitialParams");
|
||||
askBeforeReConfigureInitialParams.setDefaultValue(true);
|
||||
askBeforeReConfigureInitialParams.setLabelText(tr("Ask before re-configuring with "
|
||||
askBeforeReConfigureInitialParams.setLabelText(::CMakeProjectManager::Tr::tr("Ask before re-configuring with "
|
||||
"initial parameters"));
|
||||
|
||||
registerAspect(&showSourceSubFolders);
|
||||
showSourceSubFolders.setSettingsKey("ShowSourceSubFolders");
|
||||
showSourceSubFolders.setDefaultValue(true);
|
||||
showSourceSubFolders.setLabelText(tr("Show subfolders inside source group folders"));
|
||||
showSourceSubFolders.setLabelText(
|
||||
::CMakeProjectManager::Tr::tr("Show subfolders inside source group folders"));
|
||||
}
|
||||
|
||||
// CMakeSpecificSettingsPage
|
||||
@@ -63,7 +65,7 @@ CMakeSpecificSettings::CMakeSpecificSettings()
|
||||
CMakeSpecificSettingsPage::CMakeSpecificSettingsPage(CMakeSpecificSettings *settings)
|
||||
{
|
||||
setId(Constants::Settings::GENERAL_ID);
|
||||
setDisplayName(tr("General"));
|
||||
setDisplayName(::CMakeProjectManager::Tr::tr("General"));
|
||||
setDisplayCategory("CMake");
|
||||
setCategory(Constants::Settings::CATEGORY);
|
||||
setCategoryIconPath(Constants::Icons::SETTINGS_CATEGORY);
|
||||
@@ -74,7 +76,7 @@ CMakeSpecificSettingsPage::CMakeSpecificSettingsPage(CMakeSpecificSettings *sett
|
||||
using namespace Layouting;
|
||||
Column {
|
||||
Group {
|
||||
title(::CMakeProjectManager::Internal::CMakeSpecificSettings::tr("Adding Files")),
|
||||
title(::CMakeProjectManager::Tr::tr("Adding Files")),
|
||||
Column { s.afterAddFileSetting }
|
||||
},
|
||||
s.packageManagerAutoSetup,
|
||||
@@ -85,5 +87,4 @@ CMakeSpecificSettingsPage::CMakeSpecificSettingsPage(CMakeSpecificSettings *sett
|
||||
});
|
||||
}
|
||||
|
||||
} // Internal
|
||||
} // CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
|
||||
#include <utils/aspects.h>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
enum AfterAddFileAction : int {
|
||||
AskUser,
|
||||
@@ -18,8 +17,6 @@ enum AfterAddFileAction : int {
|
||||
|
||||
class CMakeSpecificSettings final : public Utils::AspectContainer
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::CMakeSpecificSettings)
|
||||
|
||||
public:
|
||||
CMakeSpecificSettings();
|
||||
|
||||
@@ -36,5 +33,4 @@ public:
|
||||
explicit CMakeSpecificSettingsPage(CMakeSpecificSettings *settings);
|
||||
};
|
||||
|
||||
} // Internal
|
||||
} // CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "cmaketool.h"
|
||||
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
#include "cmaketoolmanager.h"
|
||||
|
||||
#include <coreplugin/helpmanager.h>
|
||||
@@ -294,7 +295,7 @@ CMakeTool::Version CMakeTool::version() const
|
||||
QString CMakeTool::versionDisplay() const
|
||||
{
|
||||
if (!isValid())
|
||||
return CMakeToolManager::tr("Version not parseable");
|
||||
return Tr::tr("Version not parseable");
|
||||
|
||||
const Version &version = m_introspection->m_version;
|
||||
if (version.fullVersion.isEmpty())
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "cmaketoolmanager.h"
|
||||
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
#include "cmaketoolsettingsaccessor.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
@@ -19,10 +20,6 @@ using namespace Utils;
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// CMakeToolManagerPrivate:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
class CMakeToolManagerPrivate
|
||||
{
|
||||
public:
|
||||
@@ -30,12 +27,8 @@ public:
|
||||
std::vector<std::unique_ptr<CMakeTool>> m_cmakeTools;
|
||||
Internal::CMakeToolSettingsAccessor m_accessor;
|
||||
};
|
||||
|
||||
static CMakeToolManagerPrivate *d = nullptr;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// CMakeToolManager:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
CMakeToolManager *CMakeToolManager::m_instance = nullptr;
|
||||
|
||||
CMakeToolManager::CMakeToolManager()
|
||||
@@ -163,14 +156,14 @@ QList<Id> CMakeToolManager::autoDetectCMakeForDevice(const FilePaths &searchPath
|
||||
QString *logMessage)
|
||||
{
|
||||
QList<Id> result;
|
||||
QStringList messages{tr("Searching CMake binaries...")};
|
||||
QStringList messages{Tr::tr("Searching CMake binaries...")};
|
||||
for (const FilePath &path : searchPaths) {
|
||||
const FilePath cmake = path.pathAppended("cmake").withExecutableSuffix();
|
||||
if (cmake.isExecutableFile()) {
|
||||
const Id currentId = registerCMakeByPath(cmake, detectionSource);
|
||||
if (currentId.isValid())
|
||||
result.push_back(currentId);
|
||||
messages.append(tr("Found \"%1\"").arg(cmake.toUserOutput()));
|
||||
messages.append(Tr::tr("Found \"%1\"").arg(cmake.toUserOutput()));
|
||||
}
|
||||
}
|
||||
if (logMessage)
|
||||
@@ -200,12 +193,12 @@ Id CMakeToolManager::registerCMakeByPath(const FilePath &cmakePath, const QStrin
|
||||
|
||||
void CMakeToolManager::removeDetectedCMake(const QString &detectionSource, QString *logMessage)
|
||||
{
|
||||
QStringList logMessages{tr("Removing CMake entries...")};
|
||||
QStringList logMessages{Tr::tr("Removing CMake entries...")};
|
||||
while (true) {
|
||||
auto toRemove = Utils::take(d->m_cmakeTools, Utils::equal(&CMakeTool::detectionSource, detectionSource));
|
||||
if (!toRemove.has_value())
|
||||
break;
|
||||
logMessages.append(tr("Removed \"%1\"").arg((*toRemove)->displayName()));
|
||||
logMessages.append(Tr::tr("Removed \"%1\"").arg((*toRemove)->displayName()));
|
||||
emit m_instance->cmakeRemoved((*toRemove)->id());
|
||||
}
|
||||
|
||||
@@ -218,7 +211,7 @@ void CMakeToolManager::removeDetectedCMake(const QString &detectionSource, QStri
|
||||
void CMakeToolManager::listDetectedCMake(const QString &detectionSource, QString *logMessage)
|
||||
{
|
||||
QTC_ASSERT(logMessage, return);
|
||||
QStringList logMessages{tr("CMake:")};
|
||||
QStringList logMessages{Tr::tr("CMake:")};
|
||||
for (const auto &tool : qAsConst(d->m_cmakeTools)) {
|
||||
if (tool->detectionSource() == detectionSource)
|
||||
logMessages.append(tool->displayName());
|
||||
@@ -257,4 +250,4 @@ void CMakeToolManager::ensureDefaultCMakeToolIsValid()
|
||||
emit m_instance->defaultCMakeChanged();
|
||||
}
|
||||
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
|
||||
#include "cmaketoolsettingsaccessor.h"
|
||||
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
#include "cmaketool.h"
|
||||
#include "cmaketoolmanager.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <app/app_version.h>
|
||||
#include <utils/environment.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/environment.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
@@ -83,8 +83,7 @@ static std::vector<std::unique_ptr<CMakeTool>> autoDetectCMakeTools()
|
||||
for (const FilePath &command : qAsConst(suspects)) {
|
||||
auto item = std::make_unique<CMakeTool>(CMakeTool::AutoDetection, CMakeTool::createId());
|
||||
item->setFilePath(command);
|
||||
item->setDisplayName(::CMakeProjectManager::CMakeToolManager::tr("System CMake at %1")
|
||||
.arg(command.toUserOutput()));
|
||||
item->setDisplayName(Tr::tr("System CMake at %1").arg(command.toUserOutput()));
|
||||
|
||||
found.emplace_back(std::move(item));
|
||||
}
|
||||
@@ -145,7 +144,7 @@ mergeTools(std::vector<std::unique_ptr<CMakeTool>> &sdkTools,
|
||||
|
||||
CMakeToolSettingsAccessor::CMakeToolSettingsAccessor() :
|
||||
UpgradingSettingsAccessor("QtCreatorCMakeTools",
|
||||
QCoreApplication::translate("CMakeProjectManager::CMakeToolManager", "CMake"),
|
||||
Tr::tr("CMake"),
|
||||
Core::Constants::IDE_DISPLAY_NAME)
|
||||
{
|
||||
setBaseFilePath(Core::ICore::userResourcePath(CMAKE_TOOL_FILENAME));
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "configmodel.h"
|
||||
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/macroexpander.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -11,8 +13,7 @@
|
||||
#include <QFont>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
// DataItem
|
||||
|
||||
@@ -104,7 +105,7 @@ CMakeConfigItem ConfigModel::DataItem::toCMakeConfigItem() const
|
||||
|
||||
ConfigModel::ConfigModel(QObject *parent) : Utils::TreeModel<>(parent)
|
||||
{
|
||||
setHeader({tr("Key"), tr("Value")});
|
||||
setHeader({Tr::tr("Key"), Tr::tr("Value")});
|
||||
}
|
||||
|
||||
ConfigModel::~ConfigModel() = default;
|
||||
@@ -578,9 +579,7 @@ QVariant ConfigModelTreeItem::data(int column, int role) const
|
||||
: QVariant();
|
||||
case Qt::DisplayRole:
|
||||
if (column == 0)
|
||||
return dataItem->key.isEmpty()
|
||||
? ConfigModel::tr("<UNSET>")
|
||||
: dataItem->key;
|
||||
return dataItem->key.isEmpty() ? Tr::tr("<UNSET>") : dataItem->key;
|
||||
return value;
|
||||
case Qt::EditRole:
|
||||
if (column == 0)
|
||||
@@ -668,23 +667,22 @@ QString ConfigModelTreeItem::toolTip() const
|
||||
const QString pattern = "<dt style=\"font-weight:bold\">%1</dt><dd>%2</dd>";
|
||||
if (dataItem->isInitial) {
|
||||
if (!dataItem->kitValue.isEmpty())
|
||||
tooltip << pattern.arg(ConfigModel::tr("Kit:")).arg(dataItem->kitValue);
|
||||
tooltip << pattern.arg(Tr::tr("Kit:")).arg(dataItem->kitValue);
|
||||
|
||||
tooltip << pattern.arg(ConfigModel::tr("Initial Configuration:")).arg(dataItem->currentValue());
|
||||
tooltip << pattern.arg(Tr::tr("Initial Configuration:")).arg(dataItem->currentValue());
|
||||
} else {
|
||||
if (!dataItem->initialValue.isEmpty()) {
|
||||
tooltip << pattern.arg(ConfigModel::tr("Initial Configuration:"))
|
||||
tooltip << pattern.arg(Tr::tr("Initial Configuration:"))
|
||||
.arg(dataItem->initialValue);
|
||||
}
|
||||
|
||||
if (dataItem->inCMakeCache) {
|
||||
tooltip << pattern.arg(ConfigModel::tr("Current Configuration:"))
|
||||
.arg(dataItem->currentValue());
|
||||
tooltip << pattern.arg(Tr::tr("Current Configuration:")).arg(dataItem->currentValue());
|
||||
} else {
|
||||
tooltip << pattern.arg(ConfigModel::tr("Not in CMakeCache.txt")).arg(QString());
|
||||
tooltip << pattern.arg(Tr::tr("Not in CMakeCache.txt")).arg(QString());
|
||||
}
|
||||
}
|
||||
tooltip << pattern.arg(ConfigModel::tr("Type:")).arg(dataItem->typeDisplay());
|
||||
tooltip << pattern.arg(Tr::tr("Type:")).arg(dataItem->typeDisplay());
|
||||
|
||||
return "<dl style=\"white-space:pre\">" + tooltip.join(QString()) + "</dl>";
|
||||
}
|
||||
@@ -695,5 +693,4 @@ QString ConfigModelTreeItem::currentValue() const
|
||||
return dataItem->isUserChanged ? dataItem->newValue : dataItem->value;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -7,10 +7,7 @@
|
||||
|
||||
#include <utils/treemodel.h>
|
||||
|
||||
#include <QString>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
class ConfigModelTreeItem;
|
||||
|
||||
@@ -136,5 +133,4 @@ public:
|
||||
ConfigModel::InternalDataItem *dataItem;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -4,15 +4,17 @@
|
||||
#include "configmodelitemdelegate.h"
|
||||
|
||||
#include "configmodel.h"
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
|
||||
#include <utils/pathchooser.h>
|
||||
|
||||
#include <QCheckBox>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
using namespace Utils;
|
||||
|
||||
ConfigModelItemDelegate::ConfigModelItemDelegate(const Utils::FilePath &base, QObject* parent)
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
ConfigModelItemDelegate::ConfigModelItemDelegate(const FilePath &base, QObject* parent)
|
||||
: QStyledItemDelegate(parent)
|
||||
, m_base(base)
|
||||
{ }
|
||||
@@ -24,17 +26,17 @@ QWidget *ConfigModelItemDelegate::createEditor(QWidget *parent, const QStyleOpti
|
||||
if (index.column() == 1) {
|
||||
ConfigModel::DataItem data = ConfigModel::dataItemFromIndex(index);
|
||||
if (data.type == ConfigModel::DataItem::FILE || data.type == ConfigModel::DataItem::DIRECTORY) {
|
||||
auto edit = new Utils::PathChooser(parent);
|
||||
auto edit = new PathChooser(parent);
|
||||
edit->setAttribute(Qt::WA_MacSmallSize);
|
||||
edit->setFocusPolicy(Qt::StrongFocus);
|
||||
edit->setBaseDirectory(m_base);
|
||||
edit->setAutoFillBackground(true);
|
||||
if (data.type == ConfigModel::DataItem::FILE) {
|
||||
edit->setExpectedKind(Utils::PathChooser::File);
|
||||
edit->setPromptDialogTitle(tr("Select a file for %1").arg(data.key));
|
||||
edit->setExpectedKind(PathChooser::File);
|
||||
edit->setPromptDialogTitle(Tr::tr("Select a file for %1").arg(data.key));
|
||||
} else {
|
||||
edit->setExpectedKind(Utils::PathChooser::Directory);
|
||||
edit->setPromptDialogTitle(tr("Select a directory for %1").arg(data.key));
|
||||
edit->setExpectedKind(PathChooser::Directory);
|
||||
edit->setPromptDialogTitle(Tr::tr("Select a directory for %1").arg(data.key));
|
||||
}
|
||||
return edit;
|
||||
} else if (!data.values.isEmpty()) {
|
||||
@@ -64,8 +66,8 @@ void ConfigModelItemDelegate::setEditorData(QWidget *editor, const QModelIndex &
|
||||
if (index.column() == 1) {
|
||||
ConfigModel::DataItem data = ConfigModel::dataItemFromIndex(index);
|
||||
if (data.type == ConfigModel::DataItem::FILE || data.type == ConfigModel::DataItem::DIRECTORY) {
|
||||
auto edit = static_cast<Utils::PathChooser *>(editor);
|
||||
edit->setFilePath(Utils::FilePath::fromUserInput(data.value));
|
||||
auto edit = static_cast<PathChooser *>(editor);
|
||||
edit->setFilePath(FilePath::fromUserInput(data.value));
|
||||
return;
|
||||
} else if (!data.values.isEmpty()) {
|
||||
auto edit = static_cast<QComboBox *>(editor);
|
||||
@@ -91,7 +93,7 @@ void ConfigModelItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *
|
||||
if (index.column() == 1) {
|
||||
ConfigModel::DataItem data = ConfigModel::dataItemFromIndex(index);
|
||||
if (data.type == ConfigModel::DataItem::FILE || data.type == ConfigModel::DataItem::DIRECTORY) {
|
||||
auto edit = static_cast<Utils::PathChooser *>(editor);
|
||||
auto edit = static_cast<PathChooser *>(editor);
|
||||
if (edit->rawFilePath().toString() != data.value)
|
||||
model->setData(index, edit->filePath().toString(), Qt::EditRole);
|
||||
return;
|
||||
@@ -133,6 +135,4 @@ QSize ConfigModelItemDelegate::sizeHint(const QStyleOptionViewItem &option,
|
||||
return QSize(100, height);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -3,13 +3,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
class ConfigModelItemDelegate : public QStyledItemDelegate
|
||||
{
|
||||
@@ -29,5 +28,4 @@ private:
|
||||
Utils::FilePath m_base;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "fileapidataextractor.h"
|
||||
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
#include "cmakeprojectplugin.h"
|
||||
#include "cmakespecificsettings.h"
|
||||
#include "fileapiparser.h"
|
||||
@@ -22,13 +23,10 @@
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace {
|
||||
|
||||
using namespace CMakeProjectManager;
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
using namespace CMakeProjectManager::Internal::FileApiDetails;
|
||||
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Helpers:
|
||||
// --------------------------------------------------------------------
|
||||
@@ -601,14 +599,12 @@ void addCompileGroups(ProjectNode *targetRoot,
|
||||
addCMakeVFolder(targetRoot,
|
||||
buildDirectory,
|
||||
100,
|
||||
QCoreApplication::translate("CMakeProjectManager::Internal::FileApi",
|
||||
"<Build Directory>"),
|
||||
Tr::tr("<Build Directory>"),
|
||||
std::move(buildFileNodes));
|
||||
addCMakeVFolder(targetRoot,
|
||||
Utils::FilePath(),
|
||||
10,
|
||||
QCoreApplication::translate("CMakeProjectManager::Internal::FileApi",
|
||||
"<Other Locations>"),
|
||||
Tr::tr("<Other Locations>"),
|
||||
std::move(otherFileNodes));
|
||||
}
|
||||
|
||||
@@ -730,11 +726,6 @@ void setupLocationInfoForTargets(CMakeProjectNode *rootNode, const QList<CMakeBu
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
using namespace FileApiDetails;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@@ -777,5 +768,4 @@ FileApiQtcData extractData(FileApiData &input,
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <projectexplorer/rawprojectpart.h>
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QList>
|
||||
#include <QSet>
|
||||
@@ -17,8 +17,7 @@
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
class FileApiData;
|
||||
|
||||
@@ -53,5 +52,4 @@ FileApiQtcData extractData(FileApiData &data,
|
||||
const Utils::FilePath &sourceDirectory,
|
||||
const Utils::FilePath &buildDirectory);
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "fileapiparser.h"
|
||||
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
|
||||
#include <app/app_version.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <projectexplorer/rawprojectpart.h>
|
||||
@@ -15,11 +17,11 @@
|
||||
#include <QJsonObject>
|
||||
#include <QLoggingCategory>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
using namespace Utils;
|
||||
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
using namespace FileApiDetails;
|
||||
using namespace Utils;
|
||||
|
||||
const char CMAKE_RELATIVE_REPLY_PATH[] = ".cmake/api/v1/reply";
|
||||
const char CMAKE_RELATIVE_QUERY_PATH[] = ".cmake/api/v1/query";
|
||||
@@ -40,9 +42,8 @@ static FilePath cmakeReplyDirectory(const FilePath &buildDirectory)
|
||||
static void reportFileApiSetupFailure()
|
||||
{
|
||||
Core::MessageManager::writeFlashing(
|
||||
QCoreApplication::translate("CMakeProjectManager::Internal",
|
||||
"Failed to set up CMake file API support. %1 cannot "
|
||||
"extract project information.")
|
||||
Tr::tr("Failed to set up CMake file API support. %1 cannot "
|
||||
"extract project information.")
|
||||
.arg(Core::Constants::IDE_DISPLAY_NAME));
|
||||
}
|
||||
|
||||
@@ -99,8 +100,7 @@ std::vector<int> indexList(const QJsonValue &v)
|
||||
static ReplyFileContents readReplyFile(const FilePath &filePath, QString &errorMessage)
|
||||
{
|
||||
const QJsonDocument document = readJsonFile(filePath);
|
||||
static const QString msg = QCoreApplication::translate("CMakeProjectManager::Internal",
|
||||
"Invalid reply file created by CMake.");
|
||||
static const QString msg = Tr::tr("Invalid reply file created by CMake.");
|
||||
|
||||
ReplyFileContents result;
|
||||
if (document.isNull() || document.isEmpty() || !document.isObject()) {
|
||||
@@ -171,8 +171,7 @@ static CMakeConfig readCacheFile(const FilePath &cacheFile, QString &errorMessag
|
||||
const QJsonObject root = doc.object();
|
||||
|
||||
if (!checkJsonObject(root, "cache", 2)) {
|
||||
errorMessage = QCoreApplication::translate("CMakeProjectManager::Internal",
|
||||
"Invalid cache file generated by CMake.");
|
||||
errorMessage = Tr::tr("Invalid cache file generated by CMake.");
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -217,8 +216,7 @@ static std::vector<CMakeFileInfo> readCMakeFilesFile(const FilePath &cmakeFilesF
|
||||
const QJsonObject root = doc.object();
|
||||
|
||||
if (!checkJsonObject(root, "cmakeFiles", 1)) {
|
||||
errorMessage = QCoreApplication::translate("CMakeProjectManager::Internal",
|
||||
"Invalid cmakeFiles file generated by CMake.");
|
||||
errorMessage = Tr::tr( "Invalid cmakeFiles file generated by CMake.");
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -247,8 +245,7 @@ static std::vector<CMakeFileInfo> readCMakeFilesFile(const FilePath &cmakeFilesF
|
||||
std::vector<Directory> extractDirectories(const QJsonArray &directories, QString &errorMessage)
|
||||
{
|
||||
if (directories.isEmpty()) {
|
||||
errorMessage = QCoreApplication::translate(
|
||||
"CMakeProjectManager::Internal",
|
||||
errorMessage = Tr::tr(
|
||||
"Invalid codemodel file generated by CMake: No directories.");
|
||||
return {};
|
||||
}
|
||||
@@ -257,8 +254,7 @@ std::vector<Directory> extractDirectories(const QJsonArray &directories, QString
|
||||
for (const QJsonValue &v : directories) {
|
||||
const QJsonObject obj = v.toObject();
|
||||
if (obj.isEmpty()) {
|
||||
errorMessage = QCoreApplication::translate(
|
||||
"CMakeProjectManager::Internal",
|
||||
errorMessage = Tr::tr(
|
||||
"Invalid codemodel file generated by CMake: Empty directory object.");
|
||||
continue;
|
||||
}
|
||||
@@ -279,8 +275,7 @@ std::vector<Directory> extractDirectories(const QJsonArray &directories, QString
|
||||
static std::vector<Project> extractProjects(const QJsonArray &projects, QString &errorMessage)
|
||||
{
|
||||
if (projects.isEmpty()) {
|
||||
errorMessage = QCoreApplication::translate(
|
||||
"CMakeProjectManager::Internal",
|
||||
errorMessage = Tr::tr(
|
||||
"Invalid codemodel file generated by CMake: No projects.");
|
||||
return {};
|
||||
}
|
||||
@@ -290,8 +285,7 @@ static std::vector<Project> extractProjects(const QJsonArray &projects, QString
|
||||
const QJsonObject obj = v.toObject();
|
||||
if (obj.isEmpty()) {
|
||||
qCDebug(cmakeFileApi) << "Empty project skipped!";
|
||||
errorMessage = QCoreApplication::translate(
|
||||
"CMakeProjectManager::Internal",
|
||||
errorMessage = Tr::tr(
|
||||
"Invalid codemodel file generated by CMake: Empty project object.");
|
||||
continue;
|
||||
}
|
||||
@@ -304,8 +298,7 @@ static std::vector<Project> extractProjects(const QJsonArray &projects, QString
|
||||
|
||||
if (project.directories.empty()) {
|
||||
qCDebug(cmakeFileApi) << "Invalid project skipped!";
|
||||
errorMessage = QCoreApplication::translate(
|
||||
"CMakeProjectManager::Internal",
|
||||
errorMessage = Tr::tr(
|
||||
"Invalid codemodel file generated by CMake: Broken project data.");
|
||||
continue;
|
||||
}
|
||||
@@ -322,8 +315,7 @@ static std::vector<Target> extractTargets(const QJsonArray &targets, QString &er
|
||||
for (const QJsonValue &v : targets) {
|
||||
const QJsonObject obj = v.toObject();
|
||||
if (obj.isEmpty()) {
|
||||
errorMessage = QCoreApplication::translate(
|
||||
"CMakeProjectManager::Internal",
|
||||
errorMessage = Tr::tr(
|
||||
"Invalid codemodel file generated by CMake: Empty target object.");
|
||||
continue;
|
||||
}
|
||||
@@ -336,8 +328,7 @@ static std::vector<Target> extractTargets(const QJsonArray &targets, QString &er
|
||||
|
||||
if (target.name.isEmpty() || target.id.isEmpty() || target.jsonFile.isEmpty()
|
||||
|| target.directory == -1 || target.project == -1) {
|
||||
errorMessage = QCoreApplication::translate(
|
||||
"CMakeProjectManager::Internal",
|
||||
errorMessage = Tr::tr(
|
||||
"Invalid codemodel file generated by CMake: Broken target data.");
|
||||
continue;
|
||||
}
|
||||
@@ -437,8 +428,7 @@ static std::vector<Configuration> extractConfigurations(const QJsonArray &config
|
||||
QString &errorMessage)
|
||||
{
|
||||
if (configs.isEmpty()) {
|
||||
errorMessage = QCoreApplication::translate(
|
||||
"CMakeProjectManager::Internal",
|
||||
errorMessage = Tr::tr(
|
||||
"Invalid codemodel file generated by CMake: No configurations.");
|
||||
return {};
|
||||
}
|
||||
@@ -447,8 +437,7 @@ static std::vector<Configuration> extractConfigurations(const QJsonArray &config
|
||||
for (const QJsonValue &v : configs) {
|
||||
const QJsonObject obj = v.toObject();
|
||||
if (obj.isEmpty()) {
|
||||
errorMessage = QCoreApplication::translate(
|
||||
"CMakeProjectManager::Internal",
|
||||
errorMessage = Tr::tr(
|
||||
"Invalid codemodel file generated by CMake: Empty configuration object.");
|
||||
continue;
|
||||
}
|
||||
@@ -460,10 +449,8 @@ static std::vector<Configuration> extractConfigurations(const QJsonArray &config
|
||||
config.targets = extractTargets(obj.value("targets").toArray(), errorMessage);
|
||||
|
||||
if (!validateIndexes(config)) {
|
||||
errorMessage
|
||||
= QCoreApplication::translate("CMakeProjectManager::Internal",
|
||||
"Invalid codemodel file generated by CMake: Broken "
|
||||
"indexes in directories, projects, or targets.");
|
||||
errorMessage = Tr::tr("Invalid codemodel file generated by CMake: Broken "
|
||||
"indexes in directories, projects, or targets.");
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -479,8 +466,7 @@ static std::vector<Configuration> readCodemodelFile(const FilePath &codemodelFil
|
||||
const QJsonObject root = doc.object();
|
||||
|
||||
if (!checkJsonObject(root, "codemodel", 2)) {
|
||||
errorMessage = QCoreApplication::translate("CMakeProjectManager::Internal",
|
||||
"Invalid codemodel file generated by CMake.");
|
||||
errorMessage = Tr::tr("Invalid codemodel file generated by CMake.");
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -507,8 +493,7 @@ static TargetDetails extractTargetDetails(const QJsonObject &root, QString &erro
|
||||
t.type = root.value("type").toString();
|
||||
|
||||
if (t.name.isEmpty() || t.id.isEmpty() || t.type.isEmpty()) {
|
||||
errorMessage = QCoreApplication::translate("CMakeProjectManager::Internal",
|
||||
"Invalid target file: Information is missing.");
|
||||
errorMessage = Tr::tr("Invalid target file: Information is missing.");
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -776,8 +761,7 @@ static TargetDetails readTargetFile(const FilePath &targetFile, QString &errorMe
|
||||
|
||||
TargetDetails result = extractTargetDetails(root, errorMessage);
|
||||
if (errorMessage.isEmpty() && !validateTargetDetails(result)) {
|
||||
errorMessage = QCoreApplication::translate(
|
||||
"CMakeProjectManager::Internal",
|
||||
errorMessage = Tr::tr(
|
||||
"Invalid target file generated by CMake: Broken indexes in target details.");
|
||||
}
|
||||
return result;
|
||||
@@ -854,7 +838,7 @@ FileApiData FileApiParser::parseData(QFutureInterface<std::shared_ptr<FileApiQtc
|
||||
|
||||
const auto cancelCheck = [&fi, &errorMessage]() -> bool {
|
||||
if (fi.isCanceled()) {
|
||||
errorMessage = FileApiParser::tr("CMake parsing was cancelled.");
|
||||
errorMessage = Tr::tr("CMake parsing was cancelled.");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -888,12 +872,12 @@ FileApiData FileApiParser::parseData(QFutureInterface<std::shared_ptr<FileApiQtc
|
||||
buildTypes << cfg.name;
|
||||
|
||||
if (result.replyFile.isMultiConfig) {
|
||||
errorMessage = tr("No \"%1\" CMake configuration found. Available configurations: \"%2\".\n"
|
||||
errorMessage = Tr::tr("No \"%1\" CMake configuration found. Available configurations: \"%2\".\n"
|
||||
"Make sure that CMAKE_CONFIGURATION_TYPES variable contains the \"Build type\" field.")
|
||||
.arg(cmakeBuildType)
|
||||
.arg(buildTypes.join(", "));
|
||||
} else {
|
||||
errorMessage = tr("No \"%1\" CMake configuration found. Available configuration: \"%2\".\n"
|
||||
errorMessage = Tr::tr("No \"%1\" CMake configuration found. Available configuration: \"%2\".\n"
|
||||
"Make sure that CMAKE_BUILD_TYPE variable matches the \"Build type\" field.")
|
||||
.arg(cmakeBuildType)
|
||||
.arg(buildTypes.join(", "));
|
||||
@@ -941,5 +925,4 @@ FilePaths FileApiParser::cmakeQueryFilePaths(const FilePath &buildDirectory)
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -21,8 +21,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
namespace FileApiDetails {
|
||||
|
||||
@@ -218,7 +217,6 @@ public:
|
||||
|
||||
class FileApiParser
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(FileApiParser)
|
||||
public:
|
||||
static FileApiData parseData(QFutureInterface<std::shared_ptr<FileApiQtcData>> &fi,
|
||||
const Utils::FilePath &replyFilePath,
|
||||
@@ -233,5 +231,4 @@ public:
|
||||
static Utils::FilePath scanForCMakeReplyFile(const Utils::FilePath &buildDirectory);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "fileapireader.h"
|
||||
|
||||
#include "cmakeprocess.h"
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
#include "fileapidataextractor.h"
|
||||
#include "fileapiparser.h"
|
||||
|
||||
@@ -20,8 +21,7 @@
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
static Q_LOGGING_CATEGORY(cmakeFileApiMode, "qtc.cmake.fileApiMode", QtWarningMsg);
|
||||
|
||||
@@ -180,7 +180,7 @@ QList<CMakeBuildTarget> FileApiReader::takeBuildTargets(QString &errorMessage){
|
||||
CMakeConfig FileApiReader::takeParsedConfiguration(QString &errorMessage)
|
||||
{
|
||||
if (m_lastCMakeExitCode != 0)
|
||||
errorMessage = tr("CMake returned error code: %1").arg(m_lastCMakeExitCode);
|
||||
errorMessage = Tr::tr("CMake returned error code: %1").arg(m_lastCMakeExitCode);
|
||||
|
||||
return std::exchange(m_cache, {});
|
||||
}
|
||||
@@ -283,7 +283,7 @@ void FileApiReader::makeBackupConfiguration(bool store)
|
||||
replyPrev.removeRecursively();
|
||||
QTC_CHECK(!replyPrev.exists());
|
||||
if (!reply.renameFile(replyPrev))
|
||||
Core::MessageManager::writeFlashing(tr("Failed to rename %1 to %2.")
|
||||
Core::MessageManager::writeFlashing(Tr::tr("Failed to rename %1 to %2.")
|
||||
.arg(reply.toString(), replyPrev.toString()));
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ void FileApiReader::makeBackupConfiguration(bool store)
|
||||
|
||||
if (cmakeCacheTxt.exists())
|
||||
if (!FileUtils::copyIfDifferent(cmakeCacheTxt, cmakeCacheTxtPrev))
|
||||
Core::MessageManager::writeFlashing(tr("Failed to copy %1 to %2.")
|
||||
Core::MessageManager::writeFlashing(Tr::tr("Failed to copy %1 to %2.")
|
||||
.arg(cmakeCacheTxt.toString(), cmakeCacheTxtPrev.toString()));
|
||||
|
||||
}
|
||||
@@ -383,5 +383,4 @@ void FileApiReader::replyDirectoryHasChanged(const QString &directory) const
|
||||
emit dirty();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -20,12 +20,9 @@
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class ProjectNode;
|
||||
}
|
||||
namespace ProjectExplorer { class ProjectNode; }
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
class CMakeProcess;
|
||||
class FileApiQtcData;
|
||||
@@ -103,5 +100,4 @@ private:
|
||||
QDateTime m_lastReplyTimestamp;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
|
||||
#include "presetsparser.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
bool parseVersion(const QJsonValue &jsonValue, int &version)
|
||||
{
|
||||
@@ -284,9 +284,7 @@ bool PresetsParser::parse(const Utils::FilePath &jsonFile, QString &errorMessage
|
||||
{
|
||||
const std::optional<QByteArray> jsonContents = jsonFile.fileContents();
|
||||
if (!jsonContents) {
|
||||
errorMessage = QCoreApplication::translate("CMakeProjectManager::Internal",
|
||||
"Failed to read %1 file")
|
||||
.arg(jsonFile.fileName());
|
||||
errorMessage = Tr::tr("Failed to read %1 file").arg(jsonFile.fileName());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -302,18 +300,14 @@ bool PresetsParser::parse(const Utils::FilePath &jsonFile, QString &errorMessage
|
||||
}
|
||||
|
||||
if (!jsonDoc.isObject()) {
|
||||
errorMessage = QCoreApplication::translate("CMakeProjectManager::Internal",
|
||||
"Invalid %1 file")
|
||||
.arg(jsonFile.fileName());
|
||||
errorMessage = Tr::tr( "Invalid %1 file").arg(jsonFile.fileName());
|
||||
return false;
|
||||
}
|
||||
|
||||
QJsonObject root = jsonDoc.object();
|
||||
|
||||
if (!parseVersion(root.value("version"), m_presetsData.version)) {
|
||||
errorMessage = QCoreApplication::translate("CMakeProjectManager::Internal",
|
||||
"Invalid \"version\" in %1 file")
|
||||
.arg(jsonFile.fileName());
|
||||
errorMessage = Tr::tr("Invalid \"version\" in %1 file").arg(jsonFile.fileName());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -324,18 +318,14 @@ bool PresetsParser::parse(const Utils::FilePath &jsonFile, QString &errorMessage
|
||||
// optional
|
||||
if (!parseConfigurePresets(root.value("configurePresets"), m_presetsData.configurePresets)) {
|
||||
errorMessage
|
||||
= QCoreApplication::translate("CMakeProjectManager::Internal",
|
||||
"Invalid \"configurePresets\" section in %1 file")
|
||||
.arg(jsonFile.fileName());
|
||||
= Tr::tr("Invalid \"configurePresets\" section in %1 file").arg(jsonFile.fileName());
|
||||
return false;
|
||||
}
|
||||
|
||||
// optional
|
||||
if (!parseBuildPresets(root.value("buildPresets"), m_presetsData.buildPresets)) {
|
||||
errorMessage
|
||||
= QCoreApplication::translate("CMakeProjectManager::Internal",
|
||||
"Invalid \"buildPresets\" section in %1 file")
|
||||
.arg(jsonFile.fileName());
|
||||
= Tr::tr("Invalid \"buildPresets\" section in %1 file").arg(jsonFile.fileName());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -411,5 +401,4 @@ void PresetsDetails::BuildPreset::inheritFrom(const BuildPreset &other)
|
||||
nativeToolOptions = other.nativeToolOptions;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -3,16 +3,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include "cmakeconfigitem.h"
|
||||
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QHash>
|
||||
#include <QString>
|
||||
#include <QVersionNumber>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
namespace PresetsDetails {
|
||||
|
||||
@@ -109,5 +107,4 @@ public:
|
||||
const PresetsData &presetsData() const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "projecttreehelper.h"
|
||||
|
||||
#include "cmakeprojectmanagertr.h"
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
@@ -11,8 +13,7 @@
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
std::unique_ptr<FolderNode> createCMakeVFolder(const Utils::FilePath &basePath,
|
||||
int priority,
|
||||
@@ -77,18 +78,17 @@ void addCMakeInputs(FolderNode *root,
|
||||
addCMakeVFolder(cmakeVFolder.get(),
|
||||
buildDir,
|
||||
100,
|
||||
QCoreApplication::translate("CMakeProjectManager::Internal::ProjectTreeHelper",
|
||||
"<Build Directory>"),
|
||||
Tr::tr("<Build Directory>"),
|
||||
removeKnownNodes(knownFiles, std::move(buildInputs)));
|
||||
addCMakeVFolder(cmakeVFolder.get(),
|
||||
Utils::FilePath(),
|
||||
10,
|
||||
QCoreApplication::translate("CMakeProjectManager::Internal::ProjectTreeHelper",
|
||||
"<Other Locations>"),
|
||||
Tr::tr("<Other Locations>"),
|
||||
removeKnownNodes(knownFiles, std::move(rootInputs)));
|
||||
|
||||
root->addNode(std::move(cmakeVFolder));
|
||||
}
|
||||
|
||||
QHash<Utils::FilePath, ProjectNode *> addCMakeLists(
|
||||
CMakeProjectNode *root, std::vector<std::unique_ptr<FileNode>> &&cmakeLists)
|
||||
{
|
||||
@@ -177,9 +177,7 @@ void addFileSystemNodes(ProjectNode *root, const std::shared_ptr<FolderNode> &fo
|
||||
auto fileSystemNode = cloneFolderNode<VirtualFolderNode>(folderNode.get());
|
||||
// just before special nodes like "CMake Modules"
|
||||
fileSystemNode->setPriority(Node::DefaultPriority - 6);
|
||||
fileSystemNode->setDisplayName(
|
||||
QCoreApplication::translate("CMakeProjectManager::Internal::ProjectTreeHelper",
|
||||
"<File System>"));
|
||||
fileSystemNode->setDisplayName(Tr::tr("<File System>"));
|
||||
fileSystemNode->setIcon(DirectoryIcon(ProjectExplorer::Constants::FILEOVERLAY_UNKNOWN));
|
||||
|
||||
if (!fileSystemNode->isEmpty()) {
|
||||
@@ -192,5 +190,4 @@ void addFileSystemNodes(ProjectNode *root, const std::shared_ptr<FolderNode> &fo
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -3,12 +3,11 @@
|
||||
|
||||
#include "cmakeprojectnodes.h"
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
namespace CMakeProjectManager::Internal {
|
||||
|
||||
std::unique_ptr<ProjectExplorer::FolderNode> createCMakeVFolder(const Utils::FilePath &basePath,
|
||||
int priority,
|
||||
@@ -44,5 +43,5 @@ CMakeTargetNode *createTargetNode(
|
||||
|
||||
void addFileSystemNodes(ProjectExplorer::ProjectNode *root,
|
||||
const std::shared_ptr<ProjectExplorer::FolderNode> &folderNode);
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
Reference in New Issue
Block a user