diff options
author | Eike Ziller <eike.ziller@qt.io> | 2021-01-29 10:01:03 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2021-01-29 15:04:05 +0000 |
commit | c245a642f24ce243fe5e39929f158c577d3c1cf1 (patch) | |
tree | b2983b527f7165a5f7e35a14ea74a86294d5c38c /src/plugins/projectexplorer | |
parent | aae3ce15aa72631e290b4eb6d0e163706b10390b (diff) |
Share "auto-detected" UI string and add tool tip
No need to have the same translatable string repeated at all these
places.
Also add tooltip to expand a bit on what "auto-detected" actually means.
Task-number: QTCREATORBUG-25291
Change-Id: I25d43486758ba17256cf7e1ea2eea0ec3d567b62
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer')
7 files changed, 71 insertions, 6 deletions
diff --git a/src/plugins/projectexplorer/CMakeLists.txt b/src/plugins/projectexplorer/CMakeLists.txt index 87e3a45bfd..fbc61e9a1a 100644 --- a/src/plugins/projectexplorer/CMakeLists.txt +++ b/src/plugins/projectexplorer/CMakeLists.txt @@ -131,6 +131,7 @@ add_qtc_plugin(ProjectExplorer projectexplorer.cpp projectexplorer.h projectexplorer.qrc projectexplorer_export.h + projectexplorerconstants.cpp projectexplorerconstants.h projectexplorericons.cpp projectexplorericons.h projectexplorersettings.h diff --git a/src/plugins/projectexplorer/kitmodel.cpp b/src/plugins/projectexplorer/kitmodel.cpp index 5f157dcbb3..0bb09cf951 100644 --- a/src/plugins/projectexplorer/kitmodel.cpp +++ b/src/plugins/projectexplorer/kitmodel.cpp @@ -29,9 +29,10 @@ #include "kitmanagerconfigwidget.h" #include "kitmanager.h" -#include <utils/utilsicons.h> +#include <projectexplorer/projectexplorerconstants.h> #include <utils/algorithm.h> #include <utils/qtcassert.h> +#include <utils/utilsicons.h> #include <QApplication> #include <QLayout> @@ -106,8 +107,9 @@ KitModel::KitModel(QBoxLayout *parentLayout, QObject *parent) m_parentLayout(parentLayout) { setHeader(QStringList(tr("Name"))); - m_autoRoot = new StaticTreeItem(tr("Auto-detected")); - m_manualRoot = new StaticTreeItem(tr("Manual")); + m_autoRoot = new StaticTreeItem({ProjectExplorer::Constants::msgAutoDetected()}, + {ProjectExplorer::Constants::msgAutoDetectedToolTip()}); + m_manualRoot = new StaticTreeItem(ProjectExplorer::Constants::msgManual()); rootItem()->appendChild(m_autoRoot); rootItem()->appendChild(m_manualRoot); diff --git a/src/plugins/projectexplorer/projectexplorer.pro b/src/plugins/projectexplorer/projectexplorer.pro index 520f63d227..89771190dd 100644 --- a/src/plugins/projectexplorer/projectexplorer.pro +++ b/src/plugins/projectexplorer/projectexplorer.pro @@ -212,6 +212,7 @@ SOURCES += projectexplorer.cpp \ ioutputparser.cpp \ projectconfiguration.cpp \ gnumakeparser.cpp \ + projectexplorerconstants.cpp \ task.cpp \ copytaskhandler.cpp \ showineditortaskhandler.cpp \ diff --git a/src/plugins/projectexplorer/projectexplorer.qbs b/src/plugins/projectexplorer/projectexplorer.qbs index 002a620f01..204049eaed 100644 --- a/src/plugins/projectexplorer/projectexplorer.qbs +++ b/src/plugins/projectexplorer/projectexplorer.qbs @@ -111,6 +111,7 @@ Project { "projectexplorer.cpp", "projectexplorer.h", "projectexplorer.qrc", "projectexplorer_export.h", + "projectexplorerconstants.cpp", "projectexplorerconstants.h", "projectexplorericons.h", "projectexplorericons.cpp", "projectexplorersettings.h", diff --git a/src/plugins/projectexplorer/projectexplorerconstants.cpp b/src/plugins/projectexplorer/projectexplorerconstants.cpp new file mode 100644 index 0000000000..e3b609bca1 --- /dev/null +++ b/src/plugins/projectexplorer/projectexplorerconstants.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "projectexplorerconstants.h" + +#include <coreplugin/icore.h> + +#include <QCoreApplication> +#include <QString> + +namespace ProjectExplorer { +namespace Constants { + +QString msgAutoDetected() +{ + return QCoreApplication::translate("ProjectExplorer", "Auto-detected"); +} + +QString msgAutoDetectedToolTip() +{ + return QCoreApplication::translate("ProjectExplorer", + "Automatically managed by %1 or the installer.") + .arg(Core::ICore::ideDisplayName()); +} + +QString msgManual() +{ + return QCoreApplication::translate("ProjectExplorer", "Manual"); +} + +} // namespace Constants +} // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/projectexplorerconstants.h b/src/plugins/projectexplorer/projectexplorerconstants.h index b91632e9b8..5bc3a8da3f 100644 --- a/src/plugins/projectexplorer/projectexplorerconstants.h +++ b/src/plugins/projectexplorer/projectexplorerconstants.h @@ -25,7 +25,7 @@ #pragma once -#include <QtGlobal> +#include "projectexplorer_export.h" namespace ProjectExplorer { namespace Constants { @@ -230,5 +230,10 @@ const char PROJECT_ROOT_PATH_KEY[] = "ProjectExplorer.Project.RootPath"; const char STARTUPSESSION_KEY[] = "ProjectExplorer/SessionToRestore"; const char LASTSESSION_KEY[] = "ProjectExplorer/StartupSession"; +// UI texts +PROJECTEXPLORER_EXPORT QString msgAutoDetected(); +PROJECTEXPLORER_EXPORT QString msgAutoDetectedToolTip(); +PROJECTEXPLORER_EXPORT QString msgManual(); + } // namespace Constants } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/toolchainoptionspage.cpp b/src/plugins/projectexplorer/toolchainoptionspage.cpp index 42f1002608..470eaa02da 100644 --- a/src/plugins/projectexplorer/toolchainoptionspage.cpp +++ b/src/plugins/projectexplorer/toolchainoptionspage.cpp @@ -161,8 +161,9 @@ public: [](ToolChainFactory *factory) { return factory->canCreate();}); m_model.setHeader({ToolChainOptionsPage::tr("Name"), ToolChainOptionsPage::tr("Type")}); - auto autoRoot = new StaticTreeItem(ToolChainOptionsPage::tr("Auto-detected")); - auto manualRoot = new StaticTreeItem(ToolChainOptionsPage::tr("Manual")); + auto autoRoot = new StaticTreeItem({ProjectExplorer::Constants::msgAutoDetected()}, + {ProjectExplorer::Constants::msgAutoDetectedToolTip()}); + auto manualRoot = new StaticTreeItem(ProjectExplorer::Constants::msgManual()); foreach (const Utils::Id &l, ToolChainManager::allLanguages()) { const QString dn = ToolChainManager::displayNameOfLanguageId(l); |