forked from qt-creator/qt-creator
QmlProfiler: Use IOptionPage::setWidgetCreator() for settings
Change-Id: If9371820abf4e86e7041a7a5555c0a043de5ae3f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -17,24 +17,32 @@
|
|||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace QmlProfiler {
|
namespace QmlProfiler::Internal {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
static QWidget *createQmlConfigWidget(QmlProfilerSettings *settings)
|
class QmlProfilerOptionsPageWidget : public Core::IOptionsPageWidget
|
||||||
{
|
{
|
||||||
QmlProfilerSettings &s = *settings;
|
public:
|
||||||
using namespace Layouting;
|
explicit QmlProfilerOptionsPageWidget(QmlProfilerSettings *settings)
|
||||||
|
{
|
||||||
|
QmlProfilerSettings &s = *settings;
|
||||||
|
|
||||||
return Form {
|
using namespace Layouting;
|
||||||
s.flushEnabled,
|
Form {
|
||||||
s.flushInterval,
|
s.flushEnabled,
|
||||||
s.aggregateTraces
|
s.flushInterval,
|
||||||
}.emerge();
|
s.aggregateTraces
|
||||||
}
|
}.attachTo(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void apply() final
|
||||||
|
{
|
||||||
|
QmlProfilerPlugin::globalSettings()->writeGlobalSettings();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
QmlProfilerSettings::QmlProfilerSettings()
|
QmlProfilerSettings::QmlProfilerSettings()
|
||||||
{
|
{
|
||||||
setConfigWidgetCreator([this] { return createQmlConfigWidget(this); });
|
setConfigWidgetCreator([this] { return new QmlProfilerOptionsPageWidget(this); });
|
||||||
|
|
||||||
setSettingsGroup(Constants::ANALYZER);
|
setSettingsGroup(Constants::ANALYZER);
|
||||||
|
|
||||||
@@ -85,25 +93,9 @@ QmlProfilerOptionsPage::QmlProfilerOptionsPage()
|
|||||||
setCategory("T.Analyzer");
|
setCategory("T.Analyzer");
|
||||||
setDisplayCategory(::Debugger::Tr::tr("Analyzer"));
|
setDisplayCategory(::Debugger::Tr::tr("Analyzer"));
|
||||||
setCategoryIconPath(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
|
setCategoryIconPath(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
|
||||||
|
setWidgetCreator([] {
|
||||||
|
return new QmlProfilerOptionsPageWidget(QmlProfilerPlugin::globalSettings());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *QmlProfilerOptionsPage::widget()
|
} // QmlProfiler::Internal
|
||||||
{
|
|
||||||
// We cannot parent the widget to the options page as it expects a QWidget as parent
|
|
||||||
if (!m_widget)
|
|
||||||
m_widget = createQmlConfigWidget(QmlProfilerPlugin::globalSettings());
|
|
||||||
return m_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlProfilerOptionsPage::apply()
|
|
||||||
{
|
|
||||||
QmlProfilerPlugin::globalSettings()->writeGlobalSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlProfilerOptionsPage::finish()
|
|
||||||
{
|
|
||||||
delete m_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // Internal
|
|
||||||
} // QmlProfiler
|
|
||||||
|
@@ -7,15 +7,10 @@
|
|||||||
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
|
|
||||||
#include <QPointer>
|
namespace QmlProfiler::Internal {
|
||||||
|
|
||||||
namespace QmlProfiler {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class QmlProfilerSettings : public ProjectExplorer::ISettingsAspect
|
class QmlProfilerSettings : public ProjectExplorer::ISettingsAspect
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QmlProfilerSettings();
|
QmlProfilerSettings();
|
||||||
|
|
||||||
@@ -31,14 +26,6 @@ class QmlProfilerOptionsPage final : public Core::IOptionsPage
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QmlProfilerOptionsPage();
|
QmlProfilerOptionsPage();
|
||||||
|
|
||||||
QWidget *widget() override;
|
|
||||||
void apply() override;
|
|
||||||
void finish() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QPointer<QWidget> m_widget;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Internal
|
} // QmlProfiler::Internal
|
||||||
} // QmlProfiler
|
|
||||||
|
Reference in New Issue
Block a user