2022-08-19 15:59:36 +02:00
|
|
|
// 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
|
2018-03-10 18:45:06 +01:00
|
|
|
|
2022-07-07 20:44:24 +02:00
|
|
|
#include "cmakeprojectconstants.h"
|
2022-07-08 17:07:33 +02:00
|
|
|
#include "cmakespecificsettings.h"
|
2018-03-10 18:45:06 +01:00
|
|
|
|
2021-09-22 15:57:27 +02:00
|
|
|
#include <coreplugin/icore.h>
|
2021-03-23 15:58:16 +01:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
|
|
|
|
|
|
|
|
|
#include <utils/layoutbuilder.h>
|
|
|
|
|
|
|
|
|
|
using namespace Utils;
|
|
|
|
|
|
2018-03-10 18:45:06 +01:00
|
|
|
namespace CMakeProjectManager {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2021-03-23 15:58:16 +01:00
|
|
|
CMakeSpecificSettings::CMakeSpecificSettings()
|
|
|
|
|
{
|
2021-09-22 15:57:27 +02:00
|
|
|
// TODO: fixup of QTCREATORBUG-26289 , remove in Qt Creator 7 or so
|
|
|
|
|
Core::ICore::settings()->remove("CMakeSpecificSettings/NinjaPath");
|
|
|
|
|
|
2021-03-23 15:58:16 +01:00
|
|
|
setSettingsGroup("CMakeSpecificSettings");
|
|
|
|
|
setAutoApply(false);
|
|
|
|
|
|
2021-03-26 16:54:40 +01:00
|
|
|
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 "
|
2021-03-23 15:58:16 +01:00
|
|
|
"to the clipboard for pasting to the CMakeLists.txt file when you "
|
|
|
|
|
"add new files to CMake projects."));
|
|
|
|
|
|
2021-03-26 16:54:40 +01:00
|
|
|
registerAspect(&ninjaPath);
|
|
|
|
|
ninjaPath.setSettingsKey("NinjaPath");
|
2021-09-22 15:57:27 +02:00
|
|
|
// never save this to the settings:
|
|
|
|
|
ninjaPath.setToSettingsTransformation(
|
|
|
|
|
[](const QVariant &) { return QVariant::fromValue(QString()); });
|
2021-03-23 15:58:16 +01:00
|
|
|
|
2021-03-26 16:54:40 +01:00
|
|
|
registerAspect(&packageManagerAutoSetup);
|
|
|
|
|
packageManagerAutoSetup.setSettingsKey("PackageManagerAutoSetup");
|
2022-08-11 09:12:45 +02:00
|
|
|
packageManagerAutoSetup.setDefaultValue(false);
|
2021-03-26 16:54:40 +01:00
|
|
|
packageManagerAutoSetup.setLabelText(tr("Package manager auto setup"));
|
|
|
|
|
packageManagerAutoSetup.setToolTip(tr("Add the CMAKE_PROJECT_INCLUDE_BEFORE variable "
|
2021-03-23 15:58:16 +01:00
|
|
|
"pointing to a CMake script that will install dependencies from the conanfile.txt, "
|
|
|
|
|
"conanfile.py, or vcpkg.json file from the project source directory."));
|
|
|
|
|
|
2021-03-26 16:54:40 +01:00
|
|
|
registerAspect(&askBeforeReConfigureInitialParams);
|
|
|
|
|
askBeforeReConfigureInitialParams.setSettingsKey("AskReConfigureInitialParams");
|
|
|
|
|
askBeforeReConfigureInitialParams.setDefaultValue(true);
|
|
|
|
|
askBeforeReConfigureInitialParams.setLabelText(tr("Ask before re-configuring with "
|
2021-03-23 15:58:16 +01:00
|
|
|
"initial parameters"));
|
2022-07-04 08:54:24 +02:00
|
|
|
|
|
|
|
|
registerAspect(&showSourceSubFolders);
|
|
|
|
|
showSourceSubFolders.setSettingsKey("ShowSourceSubFolders");
|
|
|
|
|
showSourceSubFolders.setDefaultValue(true);
|
|
|
|
|
showSourceSubFolders.setLabelText(tr("Show subfolders inside source group folders"));
|
2018-03-10 18:45:06 +01:00
|
|
|
}
|
|
|
|
|
|
2021-03-23 15:58:16 +01:00
|
|
|
// CMakeSpecificSettingsPage
|
|
|
|
|
|
|
|
|
|
CMakeSpecificSettingsPage::CMakeSpecificSettingsPage(CMakeSpecificSettings *settings)
|
|
|
|
|
{
|
2022-07-07 20:44:24 +02:00
|
|
|
setId(Constants::Settings::GENERAL_ID);
|
|
|
|
|
setDisplayName(tr("General"));
|
|
|
|
|
setDisplayCategory("CMake");
|
|
|
|
|
setCategory(Constants::Settings::CATEGORY);
|
2022-07-20 14:46:27 +02:00
|
|
|
setCategoryIconPath(Constants::Icons::SETTINGS_CATEGORY);
|
2021-03-26 16:54:40 +01:00
|
|
|
setSettings(settings);
|
|
|
|
|
|
|
|
|
|
setLayouter([settings](QWidget *widget) {
|
|
|
|
|
CMakeSpecificSettings &s = *settings;
|
|
|
|
|
using namespace Layouting;
|
|
|
|
|
Column {
|
|
|
|
|
Group {
|
2022-07-26 13:46:27 +02:00
|
|
|
title(::CMakeProjectManager::Internal::CMakeSpecificSettings::tr("Adding Files")),
|
2022-07-21 11:10:34 +02:00
|
|
|
Column { s.afterAddFileSetting }
|
2021-03-26 16:54:40 +01:00
|
|
|
},
|
|
|
|
|
s.packageManagerAutoSetup,
|
|
|
|
|
s.askBeforeReConfigureInitialParams,
|
2022-07-04 08:54:24 +02:00
|
|
|
s.showSourceSubFolders,
|
2022-07-22 18:54:04 +02:00
|
|
|
st
|
2021-03-26 16:54:40 +01:00
|
|
|
}.attachTo(widget);
|
|
|
|
|
});
|
2018-03-10 18:45:06 +01:00
|
|
|
}
|
2021-03-23 15:58:16 +01:00
|
|
|
|
|
|
|
|
} // Internal
|
|
|
|
|
} // CMakeProjectManager
|