forked from qt-creator/qt-creator
CMake: Display cmake version on the cmake settings page
Mostly for informational purposes. Helpful e.g. to check whether an auto-detected cmake binary from a docker device matches expectations. Change-Id: I546b0ab6edc240cc779bbf0560e00165cb524fcb Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -112,6 +112,7 @@ public:
|
||||
, m_isAutoRun(item->isAutoRun())
|
||||
, m_autodetected(item->isAutoDetected())
|
||||
, m_isSupported(item->hasFileApi())
|
||||
, m_versionDisplay(item->versionDisplay())
|
||||
, m_changed(changed)
|
||||
{
|
||||
updateErrorFlags();
|
||||
@@ -145,8 +146,9 @@ public:
|
||||
m_isSupported = cmake.hasFileApi();
|
||||
|
||||
m_tooltip = tr("Version: %1<br>Supports fileApi: %2")
|
||||
.arg(QString::fromUtf8(cmake.version().fullVersion))
|
||||
.arg(cmake.versionDisplay())
|
||||
.arg(cmake.hasFileApi() ? tr("yes") : tr("no"));
|
||||
m_versionDisplay = cmake.versionDisplay();
|
||||
}
|
||||
|
||||
CMakeToolTreeItem() = default;
|
||||
@@ -220,6 +222,7 @@ public:
|
||||
QString m_tooltip;
|
||||
FilePath m_executable;
|
||||
FilePath m_qchFile;
|
||||
QString m_versionDisplay;
|
||||
bool m_isAutoRun = true;
|
||||
bool m_pathExists = false;
|
||||
bool m_pathIsFile = false;
|
||||
@@ -430,6 +433,7 @@ private:
|
||||
QCheckBox *m_autoRunCheckBox;
|
||||
PathChooser *m_binaryChooser;
|
||||
PathChooser *m_qchFileChooser;
|
||||
QLabel *m_versionLabel;
|
||||
Utils::Id m_id;
|
||||
bool m_loadingItem;
|
||||
};
|
||||
@@ -452,6 +456,8 @@ CMakeToolItemConfigWidget::CMakeToolItemConfigWidget(CMakeToolItemModel *model)
|
||||
m_qchFileChooser->setPromptDialogFilter("*.qch");
|
||||
m_qchFileChooser->setPromptDialogTitle(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."));
|
||||
@@ -460,6 +466,7 @@ CMakeToolItemConfigWidget::CMakeToolItemConfigWidget(CMakeToolItemModel *model)
|
||||
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(m_autoRunCheckBox);
|
||||
|
||||
@@ -510,6 +517,8 @@ void CMakeToolItemConfigWidget::load(const CMakeToolTreeItem *item)
|
||||
m_qchFileChooser->setBaseDirectory(item->m_executable.parentDir());
|
||||
m_qchFileChooser->setFilePath(item->m_qchFile);
|
||||
|
||||
m_versionLabel->setText(item->m_versionDisplay);
|
||||
|
||||
m_autoRunCheckBox->setChecked(item->m_isAutoRun);
|
||||
|
||||
m_id = item->m_id;
|
||||
|
||||
@@ -304,6 +304,18 @@ CMakeTool::Version CMakeTool::version() const
|
||||
return m_introspection ? m_introspection->m_version : CMakeTool::Version();
|
||||
}
|
||||
|
||||
QString CMakeTool::versionDisplay() const
|
||||
{
|
||||
if (!m_introspection)
|
||||
return CMakeToolManager::tr("Version not parseable");
|
||||
|
||||
const Version &version = m_introspection->m_version;
|
||||
if (version.fullVersion.isEmpty())
|
||||
return QString::fromUtf8(version.fullVersion);
|
||||
|
||||
return QString("%1.%2.%3").arg(version.major).arg(version.minor).arg(version.patch);
|
||||
}
|
||||
|
||||
bool CMakeTool::isAutoDetected() const
|
||||
{
|
||||
return m_isAutoDetected;
|
||||
|
||||
@@ -96,6 +96,7 @@ public:
|
||||
TextEditor::Keywords keywords();
|
||||
bool hasFileApi() const;
|
||||
Version version() const;
|
||||
QString versionDisplay() const;
|
||||
|
||||
bool isAutoDetected() const;
|
||||
QString displayName() const;
|
||||
|
||||
Reference in New Issue
Block a user