forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -1186,10 +1186,17 @@ StaticTreeItem::StaticTreeItem(const QString &display)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StaticTreeItem::StaticTreeItem(const QStringList &displays, const QStringList &toolTips)
|
||||||
|
: m_displays(displays)
|
||||||
|
, m_toolTips(toolTips)
|
||||||
|
{}
|
||||||
|
|
||||||
QVariant StaticTreeItem::data(int column, int role) const
|
QVariant StaticTreeItem::data(int column, int role) const
|
||||||
{
|
{
|
||||||
if (role == Qt::DisplayRole && column >= 0 && column < m_displays.size())
|
if (role == Qt::DisplayRole && column >= 0 && column < m_displays.size())
|
||||||
return m_displays.at(column);
|
return m_displays.at(column);
|
||||||
|
if (role == Qt::ToolTipRole && column >= 0 && column < m_toolTips.size())
|
||||||
|
return m_toolTips.at(column);
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -165,12 +165,14 @@ class QTCREATOR_UTILS_EXPORT StaticTreeItem : public TreeItem
|
|||||||
public:
|
public:
|
||||||
StaticTreeItem(const QStringList &displays);
|
StaticTreeItem(const QStringList &displays);
|
||||||
StaticTreeItem(const QString &display);
|
StaticTreeItem(const QString &display);
|
||||||
|
StaticTreeItem(const QStringList &displays, const QStringList &toolTips);
|
||||||
|
|
||||||
QVariant data(int column, int role) const override;
|
QVariant data(int column, int role) const override;
|
||||||
Qt::ItemFlags flags(int column) const override;
|
Qt::ItemFlags flags(int column) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList m_displays;
|
QStringList m_displays;
|
||||||
|
QStringList m_toolTips;
|
||||||
};
|
};
|
||||||
|
|
||||||
// A general purpose multi-level model where each item can have its
|
// A general purpose multi-level model where each item can have its
|
||||||
|
@@ -232,7 +232,9 @@ public:
|
|||||||
CMakeToolItemModel::CMakeToolItemModel()
|
CMakeToolItemModel::CMakeToolItemModel()
|
||||||
{
|
{
|
||||||
setHeader({tr("Name"), tr("Location")});
|
setHeader({tr("Name"), tr("Location")});
|
||||||
rootItem()->appendChild(new StaticTreeItem(tr("Auto-detected")));
|
rootItem()->appendChild(
|
||||||
|
new StaticTreeItem({ProjectExplorer::Constants::msgAutoDetected()},
|
||||||
|
{ProjectExplorer::Constants::msgAutoDetectedToolTip()}));
|
||||||
rootItem()->appendChild(new StaticTreeItem(tr("Manual")));
|
rootItem()->appendChild(new StaticTreeItem(tr("Manual")));
|
||||||
|
|
||||||
foreach (const CMakeTool *item, CMakeToolManager::cmakeTools())
|
foreach (const CMakeTool *item, CMakeToolManager::cmakeTools())
|
||||||
|
@@ -490,6 +490,11 @@ QString ICore::crashReportsPath()
|
|||||||
return libexecPath() + "/crashpad_reports/reports";
|
return libexecPath() + "/crashpad_reports/reports";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ICore::ideDisplayName()
|
||||||
|
{
|
||||||
|
return Constants::IDE_DISPLAY_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
static QString clangIncludePath(const QString &clangVersion)
|
static QString clangIncludePath(const QString &clangVersion)
|
||||||
{
|
{
|
||||||
return "/lib/clang/" + clangVersion + "/include";
|
return "/lib/clang/" + clangVersion + "/include";
|
||||||
|
@@ -101,6 +101,8 @@ public:
|
|||||||
static QString libexecPath();
|
static QString libexecPath();
|
||||||
static QString crashReportsPath();
|
static QString crashReportsPath();
|
||||||
|
|
||||||
|
static QString ideDisplayName();
|
||||||
|
|
||||||
static QString versionString();
|
static QString versionString();
|
||||||
|
|
||||||
static QMainWindow *mainWindow();
|
static QMainWindow *mainWindow();
|
||||||
|
@@ -223,8 +223,10 @@ const DebuggerItem *findDebugger(const Predicate &pred)
|
|||||||
DebuggerItemModel::DebuggerItemModel()
|
DebuggerItemModel::DebuggerItemModel()
|
||||||
{
|
{
|
||||||
setHeader({tr("Name"), tr("Location"), tr("Type")});
|
setHeader({tr("Name"), tr("Location"), tr("Type")});
|
||||||
rootItem()->appendChild(new StaticTreeItem(tr("Auto-detected")));
|
rootItem()->appendChild(
|
||||||
rootItem()->appendChild(new StaticTreeItem(tr("Manual")));
|
new StaticTreeItem({ProjectExplorer::Constants::msgAutoDetected()},
|
||||||
|
{ProjectExplorer::Constants::msgAutoDetectedToolTip()}));
|
||||||
|
rootItem()->appendChild(new StaticTreeItem(ProjectExplorer::Constants::msgManual()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerItemModel::addDebugger(const DebuggerItem &item, bool changed)
|
void DebuggerItemModel::addDebugger(const DebuggerItem &item, bool changed)
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
#include "tooltreeitem.h"
|
#include "tooltreeitem.h"
|
||||||
#include "exewrappers/mesontools.h"
|
#include "exewrappers/mesontools.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
|
|
||||||
@@ -37,8 +38,10 @@ namespace Internal {
|
|||||||
ToolsModel::ToolsModel()
|
ToolsModel::ToolsModel()
|
||||||
{
|
{
|
||||||
setHeader({tr("Name"), tr("Location")});
|
setHeader({tr("Name"), tr("Location")});
|
||||||
rootItem()->appendChild(new Utils::StaticTreeItem(tr("Auto-detected")));
|
rootItem()->appendChild(
|
||||||
rootItem()->appendChild(new Utils::StaticTreeItem(tr("Manual")));
|
new Utils::StaticTreeItem({ProjectExplorer::Constants::msgAutoDetected()},
|
||||||
|
{ProjectExplorer::Constants::msgAutoDetectedToolTip()}));
|
||||||
|
rootItem()->appendChild(new Utils::StaticTreeItem(ProjectExplorer::Constants::msgManual()));
|
||||||
for (const auto &tool : MesonTools::tools()) {
|
for (const auto &tool : MesonTools::tools()) {
|
||||||
addMesonTool(tool);
|
addMesonTool(tool);
|
||||||
}
|
}
|
||||||
|
@@ -131,6 +131,7 @@ add_qtc_plugin(ProjectExplorer
|
|||||||
projectexplorer.cpp projectexplorer.h
|
projectexplorer.cpp projectexplorer.h
|
||||||
projectexplorer.qrc
|
projectexplorer.qrc
|
||||||
projectexplorer_export.h
|
projectexplorer_export.h
|
||||||
|
projectexplorerconstants.cpp
|
||||||
projectexplorerconstants.h
|
projectexplorerconstants.h
|
||||||
projectexplorericons.cpp projectexplorericons.h
|
projectexplorericons.cpp projectexplorericons.h
|
||||||
projectexplorersettings.h
|
projectexplorersettings.h
|
||||||
|
@@ -29,9 +29,10 @@
|
|||||||
#include "kitmanagerconfigwidget.h"
|
#include "kitmanagerconfigwidget.h"
|
||||||
#include "kitmanager.h"
|
#include "kitmanager.h"
|
||||||
|
|
||||||
#include <utils/utilsicons.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
#include <utils/utilsicons.h>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QLayout>
|
#include <QLayout>
|
||||||
@@ -106,8 +107,9 @@ KitModel::KitModel(QBoxLayout *parentLayout, QObject *parent)
|
|||||||
m_parentLayout(parentLayout)
|
m_parentLayout(parentLayout)
|
||||||
{
|
{
|
||||||
setHeader(QStringList(tr("Name")));
|
setHeader(QStringList(tr("Name")));
|
||||||
m_autoRoot = new StaticTreeItem(tr("Auto-detected"));
|
m_autoRoot = new StaticTreeItem({ProjectExplorer::Constants::msgAutoDetected()},
|
||||||
m_manualRoot = new StaticTreeItem(tr("Manual"));
|
{ProjectExplorer::Constants::msgAutoDetectedToolTip()});
|
||||||
|
m_manualRoot = new StaticTreeItem(ProjectExplorer::Constants::msgManual());
|
||||||
rootItem()->appendChild(m_autoRoot);
|
rootItem()->appendChild(m_autoRoot);
|
||||||
rootItem()->appendChild(m_manualRoot);
|
rootItem()->appendChild(m_manualRoot);
|
||||||
|
|
||||||
|
@@ -212,6 +212,7 @@ SOURCES += projectexplorer.cpp \
|
|||||||
ioutputparser.cpp \
|
ioutputparser.cpp \
|
||||||
projectconfiguration.cpp \
|
projectconfiguration.cpp \
|
||||||
gnumakeparser.cpp \
|
gnumakeparser.cpp \
|
||||||
|
projectexplorerconstants.cpp \
|
||||||
task.cpp \
|
task.cpp \
|
||||||
copytaskhandler.cpp \
|
copytaskhandler.cpp \
|
||||||
showineditortaskhandler.cpp \
|
showineditortaskhandler.cpp \
|
||||||
|
@@ -111,6 +111,7 @@ Project {
|
|||||||
"projectexplorer.cpp", "projectexplorer.h",
|
"projectexplorer.cpp", "projectexplorer.h",
|
||||||
"projectexplorer.qrc",
|
"projectexplorer.qrc",
|
||||||
"projectexplorer_export.h",
|
"projectexplorer_export.h",
|
||||||
|
"projectexplorerconstants.cpp",
|
||||||
"projectexplorerconstants.h",
|
"projectexplorerconstants.h",
|
||||||
"projectexplorericons.h", "projectexplorericons.cpp",
|
"projectexplorericons.h", "projectexplorericons.cpp",
|
||||||
"projectexplorersettings.h",
|
"projectexplorersettings.h",
|
||||||
|
54
src/plugins/projectexplorer/projectexplorerconstants.cpp
Normal file
54
src/plugins/projectexplorer/projectexplorerconstants.cpp
Normal file
@@ -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
|
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include "projectexplorer_export.h"
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
namespace Constants {
|
namespace Constants {
|
||||||
@@ -230,5 +230,10 @@ const char PROJECT_ROOT_PATH_KEY[] = "ProjectExplorer.Project.RootPath";
|
|||||||
const char STARTUPSESSION_KEY[] = "ProjectExplorer/SessionToRestore";
|
const char STARTUPSESSION_KEY[] = "ProjectExplorer/SessionToRestore";
|
||||||
const char LASTSESSION_KEY[] = "ProjectExplorer/StartupSession";
|
const char LASTSESSION_KEY[] = "ProjectExplorer/StartupSession";
|
||||||
|
|
||||||
|
// UI texts
|
||||||
|
PROJECTEXPLORER_EXPORT QString msgAutoDetected();
|
||||||
|
PROJECTEXPLORER_EXPORT QString msgAutoDetectedToolTip();
|
||||||
|
PROJECTEXPLORER_EXPORT QString msgManual();
|
||||||
|
|
||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
@@ -161,8 +161,9 @@ public:
|
|||||||
[](ToolChainFactory *factory) { return factory->canCreate();});
|
[](ToolChainFactory *factory) { return factory->canCreate();});
|
||||||
|
|
||||||
m_model.setHeader({ToolChainOptionsPage::tr("Name"), ToolChainOptionsPage::tr("Type")});
|
m_model.setHeader({ToolChainOptionsPage::tr("Name"), ToolChainOptionsPage::tr("Type")});
|
||||||
auto autoRoot = new StaticTreeItem(ToolChainOptionsPage::tr("Auto-detected"));
|
auto autoRoot = new StaticTreeItem({ProjectExplorer::Constants::msgAutoDetected()},
|
||||||
auto manualRoot = new StaticTreeItem(ToolChainOptionsPage::tr("Manual"));
|
{ProjectExplorer::Constants::msgAutoDetectedToolTip()});
|
||||||
|
auto manualRoot = new StaticTreeItem(ProjectExplorer::Constants::msgManual());
|
||||||
|
|
||||||
foreach (const Utils::Id &l, ToolChainManager::allLanguages()) {
|
foreach (const Utils::Id &l, ToolChainManager::allLanguages()) {
|
||||||
const QString dn = ToolChainManager::displayNameOfLanguageId(l);
|
const QString dn = ToolChainManager::displayNameOfLanguageId(l);
|
||||||
|
@@ -261,8 +261,9 @@ QtOptionsPageWidget::QtOptionsPageWidget()
|
|||||||
m_ui.versionInfoWidget->setWidget(versionInfoWidget);
|
m_ui.versionInfoWidget->setWidget(versionInfoWidget);
|
||||||
m_ui.versionInfoWidget->setState(DetailsWidget::NoSummary);
|
m_ui.versionInfoWidget->setState(DetailsWidget::NoSummary);
|
||||||
|
|
||||||
m_autoItem = new StaticTreeItem(tr("Auto-detected"));
|
m_autoItem = new StaticTreeItem({ProjectExplorer::Constants::msgAutoDetected()},
|
||||||
m_manualItem = new StaticTreeItem(tr("Manual"));
|
{ProjectExplorer::Constants::msgAutoDetectedToolTip()});
|
||||||
|
m_manualItem = new StaticTreeItem(ProjectExplorer::Constants::msgManual());
|
||||||
|
|
||||||
m_model = new TreeModel<TreeItem, TreeItem, QtVersionItem>();
|
m_model = new TreeModel<TreeItem, TreeItem, QtVersionItem>();
|
||||||
m_model->setHeader({tr("Name"), tr("qmake Location")});
|
m_model->setHeader({tr("Name"), tr("qmake Location")});
|
||||||
|
Reference in New Issue
Block a user