forked from qt-creator/qt-creator
Cmake: Use new settings page convenience for CMakeSettings
Following the pattern introduced in 809e62e373
.
Change-Id: I3fc42afcdfd71634bd0749cb970c4bf94ed7932a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -522,7 +522,7 @@ void CMakeToolItemConfigWidget::load(const CMakeToolTreeItem *item)
|
|||||||
// CMakeToolConfigWidget
|
// CMakeToolConfigWidget
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
class CMakeToolConfigWidget : public QWidget
|
class CMakeToolConfigWidget : public Core::IOptionsPageWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@@ -588,7 +588,9 @@ public:
|
|||||||
m_container->setWidget(m_itemConfigWidget);
|
m_container->setWidget(m_itemConfigWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply();
|
void apply() final;
|
||||||
|
void finish() final {}
|
||||||
|
|
||||||
void cloneCMakeTool();
|
void cloneCMakeTool();
|
||||||
void addCMakeTool();
|
void addCMakeTool();
|
||||||
void removeCMakeTool();
|
void removeCMakeTool();
|
||||||
@@ -608,6 +610,7 @@ public:
|
|||||||
|
|
||||||
void CMakeToolConfigWidget::apply()
|
void CMakeToolConfigWidget::apply()
|
||||||
{
|
{
|
||||||
|
m_itemConfigWidget->store();
|
||||||
m_model.apply();
|
m_model.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -688,26 +691,7 @@ CMakeSettingsPage::CMakeSettingsPage()
|
|||||||
setId(Constants::CMAKE_SETTINGSPAGE_ID);
|
setId(Constants::CMAKE_SETTINGSPAGE_ID);
|
||||||
setDisplayName(tr("CMake"));
|
setDisplayName(tr("CMake"));
|
||||||
setCategory(ProjectExplorer::Constants::KITS_SETTINGS_CATEGORY);
|
setCategory(ProjectExplorer::Constants::KITS_SETTINGS_CATEGORY);
|
||||||
}
|
setWidgetCreator([] { return new CMakeToolConfigWidget; });
|
||||||
|
|
||||||
QWidget *CMakeSettingsPage::widget()
|
|
||||||
{
|
|
||||||
if (!m_widget)
|
|
||||||
m_widget = new CMakeToolConfigWidget;
|
|
||||||
return m_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMakeSettingsPage::apply()
|
|
||||||
{
|
|
||||||
QTC_ASSERT(m_widget, return);
|
|
||||||
m_widget->m_itemConfigWidget->store();
|
|
||||||
m_widget->apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMakeSettingsPage::finish()
|
|
||||||
{
|
|
||||||
delete m_widget;
|
|
||||||
m_widget = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -26,30 +26,16 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <coreplugin/dialogs/ioptionspage.h>
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
#include <utils/pathchooser.h>
|
|
||||||
|
|
||||||
#include <QPointer>
|
|
||||||
|
|
||||||
#include "cmaketool.h"
|
|
||||||
|
|
||||||
namespace CMakeProjectManager {
|
namespace CMakeProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class CMakeToolConfigWidget;
|
|
||||||
|
|
||||||
class CMakeSettingsPage : public Core::IOptionsPage
|
class CMakeSettingsPage : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMakeSettingsPage();
|
CMakeSettingsPage();
|
||||||
|
|
||||||
QWidget *widget() override;
|
|
||||||
void apply() override;
|
|
||||||
void finish() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
CMakeToolConfigWidget *m_widget = nullptr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user