forked from qt-creator/qt-creator
CMake: Use setup functions for a few more cmake related items
Change-Id: I7a1bbea9507d7d168584348a51d557f4a910de47 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -803,11 +803,20 @@ void CMakeBuildStep::updateDeploymentData()
|
|||||||
|
|
||||||
// CMakeBuildStepFactory
|
// CMakeBuildStepFactory
|
||||||
|
|
||||||
CMakeBuildStepFactory::CMakeBuildStepFactory()
|
class CMakeBuildStepFactory final : public BuildStepFactory
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
CMakeBuildStepFactory()
|
||||||
|
{
|
||||||
registerStep<CMakeBuildStep>(Constants::CMAKE_BUILD_STEP_ID);
|
registerStep<CMakeBuildStep>(Constants::CMAKE_BUILD_STEP_ID);
|
||||||
setDisplayName(Tr::tr("CMake Build", "Display name for CMakeProjectManager::CMakeBuildStep id."));
|
setDisplayName(Tr::tr("CMake Build", "Display name for CMakeProjectManager::CMakeBuildStep id."));
|
||||||
setSupportedProjectType(Constants::CMAKE_PROJECT_ID);
|
setSupportedProjectType(Constants::CMAKE_PROJECT_ID);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void setupCMakeBuildStep()
|
||||||
|
{
|
||||||
|
static CMakeBuildStepFactory theCMakeBuildStepFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // CMakeProjectManager::Internal
|
} // CMakeProjectManager::Internal
|
||||||
|
|||||||
@@ -118,10 +118,6 @@ private:
|
|||||||
std::optional<QString> m_configuration;
|
std::optional<QString> m_configuration;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMakeBuildStepFactory : public ProjectExplorer::BuildStepFactory
|
void setupCMakeBuildStep();
|
||||||
{
|
|
||||||
public:
|
|
||||||
CMakeBuildStepFactory();
|
|
||||||
};
|
|
||||||
|
|
||||||
} // CMakeProjectManager::Internal
|
} // CMakeProjectManager::Internal
|
||||||
|
|||||||
@@ -25,14 +25,13 @@
|
|||||||
|
|
||||||
#include <texteditor/basehoverhandler.h>
|
#include <texteditor/basehoverhandler.h>
|
||||||
#include <texteditor/textdocument.h>
|
#include <texteditor/textdocument.h>
|
||||||
|
#include <texteditor/texteditor.h>
|
||||||
#include <texteditor/texteditoractionhandler.h>
|
#include <texteditor/texteditoractionhandler.h>
|
||||||
|
|
||||||
#include <utils/mimeconstants.h>
|
#include <utils/mimeconstants.h>
|
||||||
#include <utils/textutils.h>
|
#include <utils/textutils.h>
|
||||||
#include <utils/tooltip/tooltip.h>
|
#include <utils/tooltip/tooltip.h>
|
||||||
|
|
||||||
#include <QTextDocument>
|
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
@@ -501,12 +500,13 @@ void CMakeHoverHandler::operateTooltip(TextEditorWidget *editorWidget, const QPo
|
|||||||
setToolTip(m_helpToolTip);
|
setToolTip(m_helpToolTip);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// CMakeEditorFactory
|
// CMakeEditorFactory
|
||||||
//
|
|
||||||
|
|
||||||
CMakeEditorFactory::CMakeEditorFactory()
|
class CMakeEditorFactory final : public TextEditorFactory
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
CMakeEditorFactory()
|
||||||
|
{
|
||||||
setId(Constants::CMAKE_EDITOR_ID);
|
setId(Constants::CMAKE_EDITOR_ID);
|
||||||
setDisplayName(::Core::Tr::tr("CMake Editor"));
|
setDisplayName(::Core::Tr::tr("CMake Editor"));
|
||||||
addMimeType(Utils::Constants::CMAKE_MIMETYPE);
|
addMimeType(Utils::Constants::CMAKE_MIMETYPE);
|
||||||
@@ -533,6 +533,12 @@ CMakeEditorFactory::CMakeEditorFactory()
|
|||||||
contextMenu->addAction(ActionManager::command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR));
|
contextMenu->addAction(ActionManager::command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR));
|
||||||
contextMenu->addSeparator(Context(Constants::CMAKE_EDITOR_ID));
|
contextMenu->addSeparator(Context(Constants::CMAKE_EDITOR_ID));
|
||||||
contextMenu->addAction(ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION));
|
contextMenu->addAction(ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void setupCMakeEditor()
|
||||||
|
{
|
||||||
|
static CMakeEditorFactory theCMakeEditorFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // CMakeProjectManager::Internal
|
} // CMakeProjectManager::Internal
|
||||||
|
|||||||
@@ -3,14 +3,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <texteditor/texteditor.h>
|
|
||||||
|
|
||||||
namespace CMakeProjectManager::Internal {
|
namespace CMakeProjectManager::Internal {
|
||||||
|
|
||||||
class CMakeEditorFactory : public TextEditor::TextEditorFactory
|
void setupCMakeEditor();
|
||||||
{
|
|
||||||
public:
|
|
||||||
CMakeEditorFactory();
|
|
||||||
};
|
|
||||||
|
|
||||||
} // CMakeProjectManager::Internal
|
} // CMakeProjectManager::Internal
|
||||||
|
|||||||
@@ -52,11 +52,7 @@ public:
|
|||||||
Action::AlwaysEnabled/*handled manually*/
|
Action::AlwaysEnabled/*handled manually*/
|
||||||
};
|
};
|
||||||
|
|
||||||
CMakeSettingsPage settingsPage;
|
|
||||||
|
|
||||||
CMakeBuildStepFactory buildStepFactory;
|
|
||||||
CMakeBuildConfigurationFactory buildConfigFactory;
|
CMakeBuildConfigurationFactory buildConfigFactory;
|
||||||
CMakeEditorFactory editorFactor;
|
|
||||||
CMakeInstallStepFactory installStepFactory;
|
CMakeInstallStepFactory installStepFactory;
|
||||||
CMakeBuildTargetFilter cMakeBuildTargetFilter;
|
CMakeBuildTargetFilter cMakeBuildTargetFilter;
|
||||||
CMakeOpenTargetFilter cMakeOpenTargetFilter;
|
CMakeOpenTargetFilter cMakeOpenTargetFilter;
|
||||||
@@ -78,6 +74,11 @@ class CMakeProjectPlugin final : public ExtensionSystem::IPlugin
|
|||||||
{
|
{
|
||||||
setupCMakeToolManager(this);
|
setupCMakeToolManager(this);
|
||||||
|
|
||||||
|
setupCMakeSettingsPage();
|
||||||
|
setupCMakeBuildStep();
|
||||||
|
|
||||||
|
setupCMakeEditor();
|
||||||
|
|
||||||
d = new CMakeProjectPluginPrivate;
|
d = new CMakeProjectPluginPrivate;
|
||||||
|
|
||||||
setupCMakeManager();
|
setupCMakeManager();
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include <coreplugin/dialogs/ioptionspage.h>
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
|
||||||
#include <utils/detailswidget.h>
|
#include <utils/detailswidget.h>
|
||||||
@@ -652,17 +653,24 @@ void CMakeToolConfigWidget::currentCMakeToolChanged(const QModelIndex &newCurren
|
|||||||
m_makeDefButton->setEnabled(m_currentItem && (!m_model.defaultItemId().isValid() || m_currentItem->m_id != m_model.defaultItemId()));
|
m_makeDefButton->setEnabled(m_currentItem && (!m_model.defaultItemId().isValid() || m_currentItem->m_id != m_model.defaultItemId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// CMakeSettingsPage
|
// CMakeSettingsPage
|
||||||
//
|
|
||||||
|
|
||||||
CMakeSettingsPage::CMakeSettingsPage()
|
class CMakeSettingsPage final : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
CMakeSettingsPage()
|
||||||
|
{
|
||||||
setId(Constants::Settings::TOOLS_ID);
|
setId(Constants::Settings::TOOLS_ID);
|
||||||
setDisplayName(Tr::tr("Tools"));
|
setDisplayName(Tr::tr("Tools"));
|
||||||
setDisplayCategory("CMake");
|
setDisplayCategory("CMake");
|
||||||
setCategory(Constants::Settings::CATEGORY);
|
setCategory(Constants::Settings::CATEGORY);
|
||||||
setWidgetCreator([] { return new CMakeToolConfigWidget; });
|
setWidgetCreator([] { return new CMakeToolConfigWidget; });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void setupCMakeSettingsPage()
|
||||||
|
{
|
||||||
|
static CMakeSettingsPage theCMakeSettingsPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // CMakeProjectManager::Internal
|
} // CMakeProjectManager::Internal
|
||||||
|
|||||||
@@ -3,14 +3,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <coreplugin/dialogs/ioptionspage.h>
|
|
||||||
|
|
||||||
namespace CMakeProjectManager::Internal {
|
namespace CMakeProjectManager::Internal {
|
||||||
|
|
||||||
class CMakeSettingsPage final : public Core::IOptionsPage
|
void setupCMakeSettingsPage();
|
||||||
{
|
|
||||||
public:
|
|
||||||
CMakeSettingsPage();
|
|
||||||
};
|
|
||||||
|
|
||||||
} // CMakeProjectManager::Internal
|
} // CMakeProjectManager::Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user