forked from qt-creator/qt-creator
ProjectExplorer: Use new settings page convenience for BuildProperties
Following the pattern introduced in 809e62e373
.
Change-Id: I7d31afbe5c66e0266ecbb75ab8ef58b4664d0832
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -34,11 +34,11 @@
|
|||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class BuildPropertiesSettingsPage::SettingsWidget : public QWidget
|
class BuildPropertiesSettingsWidget : public Core::IOptionsPageWidget
|
||||||
{
|
{
|
||||||
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::Internal::BuildPropertiesSettingsPage)
|
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::Internal::BuildPropertiesSettingsPage)
|
||||||
public:
|
public:
|
||||||
SettingsWidget()
|
BuildPropertiesSettingsWidget()
|
||||||
{
|
{
|
||||||
const BuildPropertiesSettings &settings = ProjectExplorerPlugin::buildPropertiesSettings();
|
const BuildPropertiesSettings &settings = ProjectExplorerPlugin::buildPropertiesSettings();
|
||||||
for (QComboBox * const comboBox : {&m_separateDebugInfoComboBox, &m_qmlDebuggingComboBox,
|
for (QComboBox * const comboBox : {&m_separateDebugInfoComboBox, &m_qmlDebuggingComboBox,
|
||||||
@@ -64,15 +64,17 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildPropertiesSettings settings() const
|
void apply() final
|
||||||
{
|
{
|
||||||
BuildPropertiesSettings s;
|
BuildPropertiesSettings s;
|
||||||
s.separateDebugInfo = TriState::fromVariant(m_separateDebugInfoComboBox.currentData());
|
s.separateDebugInfo = TriState::fromVariant(m_separateDebugInfoComboBox.currentData());
|
||||||
s.qmlDebugging = TriState::fromVariant(m_qmlDebuggingComboBox.currentData());
|
s.qmlDebugging = TriState::fromVariant(m_qmlDebuggingComboBox.currentData());
|
||||||
s.qtQuickCompiler = TriState::fromVariant(m_qtQuickCompilerComboBox.currentData());
|
s.qtQuickCompiler = TriState::fromVariant(m_qtQuickCompilerComboBox.currentData());
|
||||||
return s;
|
ProjectExplorerPlugin::setBuildPropertiesSettings(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void finish() final {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QComboBox m_separateDebugInfoComboBox;
|
QComboBox m_separateDebugInfoComboBox;
|
||||||
QComboBox m_qmlDebuggingComboBox;
|
QComboBox m_qmlDebuggingComboBox;
|
||||||
@@ -84,24 +86,7 @@ BuildPropertiesSettingsPage::BuildPropertiesSettingsPage()
|
|||||||
setId("AB.ProjectExplorer.BuildPropertiesSettingsPage");
|
setId("AB.ProjectExplorer.BuildPropertiesSettingsPage");
|
||||||
setDisplayName(tr("Default Build Properties"));
|
setDisplayName(tr("Default Build Properties"));
|
||||||
setCategory(Constants::BUILD_AND_RUN_SETTINGS_CATEGORY);
|
setCategory(Constants::BUILD_AND_RUN_SETTINGS_CATEGORY);
|
||||||
}
|
setWidgetCreator([] { return new BuildPropertiesSettingsWidget; });
|
||||||
|
|
||||||
QWidget *BuildPropertiesSettingsPage::widget()
|
|
||||||
{
|
|
||||||
if (!m_widget)
|
|
||||||
m_widget = new SettingsWidget;
|
|
||||||
return m_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BuildPropertiesSettingsPage::apply()
|
|
||||||
{
|
|
||||||
if (m_widget)
|
|
||||||
ProjectExplorerPlugin::setBuildPropertiesSettings(m_widget->settings());
|
|
||||||
}
|
|
||||||
|
|
||||||
void BuildPropertiesSettingsPage::finish()
|
|
||||||
{
|
|
||||||
delete m_widget;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -27,8 +27,6 @@
|
|||||||
|
|
||||||
#include <coreplugin/dialogs/ioptionspage.h>
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
#include <QPointer>
|
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -37,14 +35,6 @@ class BuildPropertiesSettingsPage : public Core::IOptionsPage
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
BuildPropertiesSettingsPage();
|
BuildPropertiesSettingsPage();
|
||||||
|
|
||||||
private:
|
|
||||||
QWidget *widget() override;
|
|
||||||
void apply() override;
|
|
||||||
void finish() override;
|
|
||||||
|
|
||||||
class SettingsWidget;
|
|
||||||
QPointer<SettingsWidget> m_widget;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user