CMakePM: Group CMake settings into one category page

CMake settings were split in two places, which complicates things.

Now they are both into one settings category, just like other build
systems Qbs, Meson.

Change-Id: I55f434d83604c9b3be111fc89014b720ee72b513
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Cristian Adam
2022-07-07 20:44:24 +02:00
parent 99a116d721
commit 531288a715
10 changed files with 27 additions and 15 deletions

View File

@@ -93,7 +93,7 @@ class CMakeKitAspectWidget final : public KitAspectWidget
public:
CMakeKitAspectWidget(Kit *kit, const KitAspect *ki) : KitAspectWidget(kit, ki),
m_comboBox(createSubWidget<QComboBox>()),
m_manageButton(createManageButton(Constants::CMAKE_SETTINGS_PAGE_ID))
m_manageButton(createManageButton(Constants::Settings::TOOLS_ID))
{
m_comboBox->setSizePolicy(QSizePolicy::Ignored, m_comboBox->sizePolicy().verticalPolicy());
m_comboBox->setEnabled(false);

View File

@@ -2,5 +2,7 @@
<qresource prefix="/cmakeproject">
<file>images/fileoverlay_cmake.png</file>
<file>images/fileoverlay_cmake@2x.png</file>
<file>images/logo_cmake_bw.png</file>
<file>images/logo_cmake_bw@2x.png</file>
</qresource>
</RCC>

View File

@@ -48,14 +48,20 @@ const char CMAKE_BUILDCONFIGURATION_ID[] = "CMakeProjectManager.CMakeBuildConfig
// Menu
const char M_CONTEXT[] = "CMakeEditor.ContextMenu";
// Settings page
const char CMAKE_SETTINGS_PAGE_ID[] = "Z.CMake";
namespace Settings {
const char GENERAL_ID[] = "CMakeSpecifcSettings";
const char TOOLS_ID[] = "K.CMake.Tools";
const char CATEGORY[] = "K.CMake";
} // namespace Settings
// Snippets
const char CMAKE_SNIPPETS_GROUP_ID[] = "CMake";
// Icons
const char FILE_OVERLAY_CMAKE[] = ":/cmakeproject/images/fileoverlay_cmake.png";
namespace Icons {
const char FILE_OVERLAY[] = ":/cmakeproject/images/fileoverlay_cmake.png";
const char LOGO_BW[] = ":/cmakeproject/images/logo_cmake_bw.png";
const char LOGO_BW_2X[] = ":/cmakeproject/images/logo_cmake_bw@2x.png";
} // namespace Icons
// Actions
const char BUILD_TARGET_CONTEXT_MENU[] = "CMake.BuildTargetContextMenu";

View File

@@ -53,7 +53,7 @@ CMakeInputsNode::CMakeInputsNode(const Utils::FilePath &cmakeLists) :
CMakeListsNode::CMakeListsNode(const Utils::FilePath &cmakeListPath) :
ProjectExplorer::ProjectNode(cmakeListPath)
{
setIcon(DirectoryIcon(Constants::FILE_OVERLAY_CMAKE));
setIcon(DirectoryIcon(Constants::Icons::FILE_OVERLAY));
setListInProject(false);
}

View File

@@ -103,8 +103,8 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *
const Context projectContext{CMakeProjectManager::Constants::CMAKE_PROJECT_ID};
FileIconProvider::registerIconOverlayForSuffix(Constants::FILE_OVERLAY_CMAKE, "cmake");
FileIconProvider::registerIconOverlayForFilename(Constants::FILE_OVERLAY_CMAKE,
FileIconProvider::registerIconOverlayForSuffix(Constants::Icons::FILE_OVERLAY, "cmake");
FileIconProvider::registerIconOverlayForFilename(Constants::Icons::FILE_OVERLAY,
"CMakeLists.txt");
TextEditor::SnippetProvider::registerGroup(Constants::CMAKE_SNIPPETS_GROUP_ID,

View File

@@ -701,9 +701,10 @@ void CMakeToolConfigWidget::currentCMakeToolChanged(const QModelIndex &newCurren
CMakeSettingsPage::CMakeSettingsPage()
{
setId(Constants::CMAKE_SETTINGS_PAGE_ID);
setDisplayName(CMakeToolConfigWidget::tr("CMake"));
setCategory(ProjectExplorer::Constants::KITS_SETTINGS_CATEGORY);
setId(Constants::Settings::TOOLS_ID);
setDisplayName(tr("Tools"));
setDisplayCategory("CMake");
setCategory(Constants::Settings::CATEGORY);
setWidgetCreator([] { return new CMakeToolConfigWidget; });
}

View File

@@ -24,6 +24,7 @@
****************************************************************************/
#include "cmakespecificsettings.h"
#include "cmakeprojectconstants.h"
#include <coreplugin/icore.h>
#include <projectexplorer/projectexplorerconstants.h>
@@ -83,9 +84,11 @@ CMakeSpecificSettings::CMakeSpecificSettings()
CMakeSpecificSettingsPage::CMakeSpecificSettingsPage(CMakeSpecificSettings *settings)
{
setId("CMakeSpecificSettings");
setDisplayName(::CMakeProjectManager::Internal::CMakeSpecificSettings::tr("CMake"));
setCategory(ProjectExplorer::Constants::BUILD_AND_RUN_SETTINGS_CATEGORY);
setId(Constants::Settings::GENERAL_ID);
setDisplayName(tr("General"));
setDisplayCategory("CMake");
setCategory(Constants::Settings::CATEGORY);
setCategoryIconPath(Constants::Icons::LOGO_BW);
setSettings(settings);
setLayouter([settings](QWidget *widget) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

View File

@@ -103,7 +103,7 @@ McuSupportOptionsWidget::McuSupportOptionsWidget(McuSupportOptions &options,
m_statusInfoLabel->setOpenExternalLinks(false);
mainLayout->addWidget(m_statusInfoLabel);
connect(m_statusInfoLabel, &QLabel::linkActivated, this, [] {
Core::ICore::showOptionsDialog(CMakeProjectManager::Constants::CMAKE_SETTINGS_PAGE_ID);
Core::ICore::showOptionsDialog(CMakeProjectManager::Constants::Settings::TOOLS_ID);
});
}