Add Specific settings page to CMakePLugin and create checkable dialog box for user after add new file action

Change-Id: If5702764fa81f2fdda3ef59780b217e47643b030
Reviewed-by: pawelrutka <prutka13@gmail.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Pawel Rutka
2018-03-10 18:45:06 +01:00
committed by pawelrutka
parent 278a5f1e33
commit 190c5083b7
11 changed files with 443 additions and 17 deletions

View File

@@ -42,11 +42,10 @@
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/fileiconprovider.h>
#include <coreplugin/icore.h>
#include <projectexplorer/kitmanager.h>
#include <projectexplorer/projectmanager.h>
#include <projectexplorer/projecttree.h>
#include <texteditor/snippets/snippetprovider.h>
#include <utils/parameteraction.h>
@@ -64,6 +63,7 @@ public:
QMetaObject::Connection m_actionConnect;
CMakeSettingsPage settingsPage;
static const std::unique_ptr<CMakeSpecificSettings> projectTypeSpecificSettings;
CMakeManager manager;
CMakeBuildStepFactory buildStepFactory;
CMakeRunConfigurationFactory runConfigFactory;
@@ -72,6 +72,14 @@ public:
CMakeLocatorFilter locatorFiler;
};
const std::unique_ptr<CMakeSpecificSettings>
CMakeProjectPluginPrivate::projectTypeSpecificSettings{std::make_unique<CMakeSpecificSettings>()};
CMakeSpecificSettings *CMakeProjectPlugin::projectTypeSpecificSettings()
{
return CMakeProjectPluginPrivate::projectTypeSpecificSettings.get();
}
CMakeProjectPlugin::~CMakeProjectPlugin()
{
delete d;
@@ -82,11 +90,15 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *
Q_UNUSED(errorMessage)
d = new CMakeProjectPluginPrivate;
CMakeProjectPluginPrivate::projectTypeSpecificSettings->fromSettings(ICore::settings());
new CMakeSpecificSettingsPage(CMakeProjectPluginPrivate::projectTypeSpecificSettings.get(),
this); //do not store as this will be cleaned after program close
const Context projectContext(CMakeProjectManager::Constants::CMAKEPROJECT_ID);
Core::FileIconProvider::registerIconOverlayForSuffix(Constants::FILEOVERLAY_CMAKE, "cmake");
Core::FileIconProvider::registerIconOverlayForFilename(Constants::FILEOVERLAY_CMAKE, "CMakeLists.txt");
Core::FileIconProvider::registerIconOverlayForFilename(Constants::FILEOVERLAY_CMAKE,
"CMakeLists.txt");
TextEditor::SnippetProvider::registerGroup(Constants::CMAKE_SNIPPETS_GROUP_ID,
tr("CMake", "SnippetProvider"));
@@ -108,7 +120,8 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *
d->m_buildTargetContextAction = new Utils::ParameterAction(tr("Build"), tr("Build \"%1\""),
Utils::ParameterAction::AlwaysEnabled/*handled manually*/,
this);
command = ActionManager::registerAction(d->m_buildTargetContextAction, Constants::BUILD_TARGET_CONTEXTMENU, projectContext);
command = ActionManager::registerAction(d->m_buildTargetContextAction,
Constants::BUILD_TARGET_CONTEXTMENU, projectContext);
command->setAttribute(Command::CA_Hide);
command->setAttribute(Command::CA_UpdateText);
command->setDescription(d->m_buildTargetContextAction->text());
@@ -143,7 +156,9 @@ void CMakeProjectPlugin::updateContextActions()
d->m_buildTargetContextAction->setVisible(targetNode);
if (cmProject && targetNode) {
d->m_actionConnect = connect(d->m_buildTargetContextAction, &Utils::ParameterAction::triggered,
cmProject, [cmProject, targetDisplayName]() { cmProject->buildCMakeTarget(targetDisplayName); });
cmProject, [cmProject, targetDisplayName]() {
cmProject->buildCMakeTarget(targetDisplayName);
});
}
}