diff --git a/src/plugins/qmlprofiler/CMakeLists.txt b/src/plugins/qmlprofiler/CMakeLists.txt
index 016e874e039..304c69dd35a 100644
--- a/src/plugins/qmlprofiler/CMakeLists.txt
+++ b/src/plugins/qmlprofiler/CMakeLists.txt
@@ -17,17 +17,15 @@ add_qtc_plugin(QmlProfiler
qmlprofiler_global.h
qmlprofileractions.cpp qmlprofileractions.h
qmlprofileranimationsmodel.cpp qmlprofileranimationsmodel.h
- qmlprofilerattachdialog.cpp qmlprofilerattachdialog.h qmlprofilerattachdialog.ui
+ qmlprofilerattachdialog.cpp qmlprofilerattachdialog.h
qmlprofilerbindingloopsrenderpass.cpp qmlprofilerbindingloopsrenderpass.h
qmlprofilerclientmanager.cpp qmlprofilerclientmanager.h
- qmlprofilerconfigwidget.cpp qmlprofilerconfigwidget.h qmlprofilerconfigwidget.ui
qmlprofilerconstants.h
qmlprofilerdetailsrewriter.cpp qmlprofilerdetailsrewriter.h
qmlprofilereventsview.h
qmlprofilereventtypes.h
qmlprofilermodelmanager.cpp qmlprofilermodelmanager.h
qmlprofilernotesmodel.cpp qmlprofilernotesmodel.h
- qmlprofileroptionspage.cpp qmlprofileroptionspage.h
qmlprofilerplugin.cpp qmlprofilerplugin.h
qmlprofilerrangemodel.cpp qmlprofilerrangemodel.h
qmlprofilerrunconfigurationaspect.cpp qmlprofilerrunconfigurationaspect.h
@@ -67,7 +65,6 @@ extend_qtc_plugin(QmlProfiler
tests/qmlprofilerattachdialog_test.cpp tests/qmlprofilerattachdialog_test.h
tests/qmlprofilerbindingloopsrenderpass_test.cpp tests/qmlprofilerbindingloopsrenderpass_test.h
tests/qmlprofilerclientmanager_test.cpp tests/qmlprofilerclientmanager_test.h
- tests/qmlprofilerconfigwidget_test.cpp tests/qmlprofilerconfigwidget_test.h
tests/qmlprofilerdetailsrewriter_test.cpp tests/qmlprofilerdetailsrewriter_test.h
tests/qmlprofilertool_test.cpp tests/qmlprofilertool_test.h
tests/qmlprofilertraceclient_test.cpp tests/qmlprofilertraceclient_test.h
diff --git a/src/plugins/qmlprofiler/qmlprofiler.pro b/src/plugins/qmlprofiler/qmlprofiler.pro
index 884a63e24dd..be6db89a7f2 100644
--- a/src/plugins/qmlprofiler/qmlprofiler.pro
+++ b/src/plugins/qmlprofiler/qmlprofiler.pro
@@ -20,11 +20,9 @@ SOURCES += \
qmlprofilerattachdialog.cpp \
qmlprofilerbindingloopsrenderpass.cpp \
qmlprofilerclientmanager.cpp \
- qmlprofilerconfigwidget.cpp \
qmlprofilerdetailsrewriter.cpp \
qmlprofilermodelmanager.cpp \
qmlprofilernotesmodel.cpp \
- qmlprofileroptionspage.cpp \
qmlprofilerplugin.cpp \
qmlprofilerrangemodel.cpp \
qmlprofilerrunconfigurationaspect.cpp \
@@ -61,14 +59,12 @@ HEADERS += \
qmlprofilerattachdialog.h \
qmlprofilerbindingloopsrenderpass.h \
qmlprofilerclientmanager.h \
- qmlprofilerconfigwidget.h \
qmlprofilerconstants.h \
qmlprofilerdetailsrewriter.h \
qmlprofilereventsview.h \
qmlprofilereventtypes.h \
qmlprofilermodelmanager.h \
qmlprofilernotesmodel.h \
- qmlprofileroptionspage.h \
qmlprofilerplugin.h \
qmlprofilerrangemodel.h \
qmlprofilerrunconfigurationaspect.h \
@@ -91,9 +87,6 @@ HEADERS += \
RESOURCES += \
qml/qmlprofiler.qrc
-FORMS += \
- qmlprofilerconfigwidget.ui
-
equals(TEST, 1) {
include(tests/tests.pri)
}
diff --git a/src/plugins/qmlprofiler/qmlprofiler.qbs b/src/plugins/qmlprofiler/qmlprofiler.qbs
index 44103450c11..d6b445c9c3a 100644
--- a/src/plugins/qmlprofiler/qmlprofiler.qbs
+++ b/src/plugins/qmlprofiler/qmlprofiler.qbs
@@ -36,14 +36,12 @@ QtcPlugin {
"qmlprofilerattachdialog.cpp", "qmlprofilerattachdialog.h",
"qmlprofilerbindingloopsrenderpass.cpp","qmlprofilerbindingloopsrenderpass.h",
"qmlprofilerclientmanager.cpp", "qmlprofilerclientmanager.h",
- "qmlprofilerconfigwidget.cpp", "qmlprofilerconfigwidget.h",
- "qmlprofilerconfigwidget.ui", "qmlprofilerconstants.h",
+ "qmlprofilerconstants.h",
"qmlprofilerdetailsrewriter.cpp", "qmlprofilerdetailsrewriter.h",
"qmlprofilereventsview.h",
"qmlprofilereventtypes.h",
"qmlprofilermodelmanager.cpp", "qmlprofilermodelmanager.h",
"qmlprofilernotesmodel.cpp", "qmlprofilernotesmodel.h",
- "qmlprofileroptionspage.cpp", "qmlprofileroptionspage.h",
"qmlprofilerplugin.cpp", "qmlprofilerplugin.h",
"qmlprofilerrunconfigurationaspect.cpp", "qmlprofilerrunconfigurationaspect.h",
"qmlprofilerrangemodel.cpp", "qmlprofilerrangemodel.h",
@@ -93,7 +91,6 @@ QtcPlugin {
"qmlprofilerbindingloopsrenderpass_test.cpp",
"qmlprofilerbindingloopsrenderpass_test.h",
"qmlprofilerclientmanager_test.cpp", "qmlprofilerclientmanager_test.h",
- "qmlprofilerconfigwidget_test.cpp", "qmlprofilerconfigwidget_test.h",
"qmlprofilerdetailsrewriter_test.cpp", "qmlprofilerdetailsrewriter_test.h",
"qmlprofilertool_test.cpp", "qmlprofilertool_test.h",
"qmlprofilertraceclient_test.cpp", "qmlprofilertraceclient_test.h",
diff --git a/src/plugins/qmlprofiler/qmlprofilerattachdialog.ui b/src/plugins/qmlprofiler/qmlprofilerattachdialog.ui
deleted file mode 100644
index c920c4d160e..00000000000
--- a/src/plugins/qmlprofiler/qmlprofilerattachdialog.ui
+++ /dev/null
@@ -1,129 +0,0 @@
-
-
- QmlProfiler::Internal::QmlProfilerAttachDialog
-
-
-
- 0
- 0
- 203
- 136
-
-
-
- QML Profiler
-
-
- -
-
-
-
-
-
- &Host:
-
-
- addressLineEdit
-
-
-
- -
-
-
- localhost
-
-
-
- -
-
-
- &Port:
-
-
- portSpinBox
-
-
-
- -
-
-
- 1
-
-
- 65535
-
-
- 3768
-
-
-
- -
-
-
- Sys&root:
-
-
- sysrootChooser
-
-
-
- -
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QDialogButtonBox::Cancel|QDialogButtonBox::Ok
-
-
-
-
-
-
-
- Utils::PathChooser
- QWidget
-
- 1
-
-
-
-
-
- buttonBox
- accepted()
- QmlProfiler::Internal::QmlProfilerAttachDialog
- accept()
-
-
- 248
- 254
-
-
- 157
- 274
-
-
-
-
- buttonBox
- rejected()
- QmlProfiler::Internal::QmlProfilerAttachDialog
- reject()
-
-
- 316
- 260
-
-
- 286
- 274
-
-
-
-
-
diff --git a/src/plugins/qmlprofiler/qmlprofilerconfigwidget.cpp b/src/plugins/qmlprofiler/qmlprofilerconfigwidget.cpp
deleted file mode 100644
index 3eea2775255..00000000000
--- a/src/plugins/qmlprofiler/qmlprofilerconfigwidget.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#include "qmlprofilerconfigwidget.h"
-#include "ui_qmlprofilerconfigwidget.h"
-
-namespace QmlProfiler {
-namespace Internal {
-
-QmlProfilerConfigWidget::QmlProfilerConfigWidget(QmlProfilerSettings *settings) :
- m_ui(new Ui::QmlProfilerConfigWidget), m_settings(settings)
-{
- m_ui->setupUi(this);
- updateUi();
-
- connect(m_ui->flushEnabled, &QCheckBox::toggled,
- m_settings, &QmlProfilerSettings::setFlushEnabled);
-
- connect(m_ui->flushInterval, QOverload::of(&QSpinBox::valueChanged),
- m_settings, &QmlProfilerSettings::setFlushInterval);
-
- connect(m_ui->aggregateTraces, &QCheckBox::toggled,
- m_settings, &QmlProfilerSettings::setAggregateTraces);
-
- connect(m_settings, &QmlProfilerSettings::changed, this, &QmlProfilerConfigWidget::updateUi);
-}
-
-QmlProfilerConfigWidget::~QmlProfilerConfigWidget()
-{
- delete m_ui;
-}
-
-void QmlProfilerConfigWidget::updateUi()
-{
- m_ui->flushEnabled->setChecked(m_settings->flushEnabled());
- m_ui->flushInterval->setEnabled(m_settings->flushEnabled());
- m_ui->flushInterval->setValue(m_settings->flushInterval());
- m_ui->aggregateTraces->setChecked(m_settings->aggregateTraces());
-}
-
-} // Internal
-} // QmlProfiler
diff --git a/src/plugins/qmlprofiler/qmlprofilerconfigwidget.h b/src/plugins/qmlprofiler/qmlprofilerconfigwidget.h
deleted file mode 100644
index cc80849f85e..00000000000
--- a/src/plugins/qmlprofiler/qmlprofilerconfigwidget.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#pragma once
-
-#include "qmlprofilersettings.h"
-#include
-
-namespace QmlProfiler {
-namespace Internal {
-
-namespace Ui {
-class QmlProfilerConfigWidget;
-}
-
-
-class QmlProfilerConfigWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit QmlProfilerConfigWidget(QmlProfilerSettings *settings);
- ~QmlProfilerConfigWidget() override;
-
-private:
- void updateUi();
-
- Ui::QmlProfilerConfigWidget *m_ui;
- QmlProfilerSettings *m_settings;
-};
-
-} // Internal
-} // QmlProfiler
diff --git a/src/plugins/qmlprofiler/qmlprofilerconfigwidget.ui b/src/plugins/qmlprofiler/qmlprofilerconfigwidget.ui
deleted file mode 100644
index df66e67b80a..00000000000
--- a/src/plugins/qmlprofiler/qmlprofilerconfigwidget.ui
+++ /dev/null
@@ -1,71 +0,0 @@
-
-
- QmlProfiler::Internal::QmlProfilerConfigWidget
-
-
-
- 0
- 0
- 320
- 100
-
-
-
- -
-
-
- Flush data while profiling:
-
-
-
- -
-
-
- Periodically flush pending data to the profiler. This reduces the delay when loading the
-data and the memory usage in the application. It distorts the profile as the flushing
-itself takes time.
-
-
-
- -
-
-
- Flush interval (ms):
-
-
-
- -
-
-
- 1
-
-
- 10000000
-
-
- 1000
-
-
-
- -
-
-
- Process data only when process ends:
-
-
-
- -
-
-
- Only process data when the process being profiled ends, not when the current recording
-session ends. This way multiple recording sessions can be aggregated in a single trace,
-for example if multiple QML engines start and stop sequentially during a single run of
-the program.
-
-
-
-
-
-
-
-
diff --git a/src/plugins/qmlprofiler/qmlprofilerconstants.h b/src/plugins/qmlprofiler/qmlprofilerconstants.h
index 183e8e779be..0645cd3f06e 100644
--- a/src/plugins/qmlprofiler/qmlprofilerconstants.h
+++ b/src/plugins/qmlprofiler/qmlprofilerconstants.h
@@ -30,10 +30,6 @@ namespace Constants {
const char TASK_LOAD[] = "QmlProfiler.TaskLoad";
const char TASK_SAVE[] = "QmlProfiler.TaskSave";
-const char FLUSH_ENABLED[] = "Analyzer.QmlProfiler.FlushEnabled";
-const char FLUSH_INTERVAL[] = "Analyzer.QmlProfiler.FlushInterval";
-const char LAST_TRACE_FILE[] = "Analyzer.QmlProfiler.LastTraceFile";
-const char AGGREGATE_TRACES[] = "Analyzer.QmlProfiler.AggregateTraces";
const char SETTINGS[] = "Analyzer.QmlProfiler.Settings";
const char ANALYZER[] = "Analyzer";
const char TEXT_MARK_CATEGORY[] = "Analyzer.QmlProfiler.TextMark";
diff --git a/src/plugins/qmlprofiler/qmlprofileroptionspage.cpp b/src/plugins/qmlprofiler/qmlprofileroptionspage.cpp
deleted file mode 100644
index 4d1f478a6cb..00000000000
--- a/src/plugins/qmlprofiler/qmlprofileroptionspage.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#include "qmlprofileroptionspage.h"
-#include "qmlprofilerconfigwidget.h"
-#include "qmlprofilerplugin.h"
-#include "qmlprofilerconstants.h"
-
-#include
-
-namespace QmlProfiler {
-namespace Internal {
-
-QmlProfilerOptionsPage::QmlProfilerOptionsPage()
-{
- setId(Constants::SETTINGS);
- setDisplayName(QmlProfilerConfigWidget::tr("QML Profiler"));
- setCategory("T.Analyzer");
- setDisplayCategory(QmlProfilerConfigWidget::tr("Analyzer"));
- setCategoryIconPath(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
-}
-
-QWidget *QmlProfilerOptionsPage::widget()
-{
- // We cannot parent the widget to the options page as it expects a QWidget as parent
- if (!m_widget)
- m_widget = new QmlProfilerConfigWidget(QmlProfilerPlugin::globalSettings());
- return m_widget;
-}
-
-void QmlProfilerOptionsPage::apply()
-{
- QmlProfilerPlugin::globalSettings()->writeGlobalSettings();
-}
-
-void QmlProfilerOptionsPage::finish()
-{
- delete m_widget;
-}
-
-} // Internal
-} // QmlProfiler
diff --git a/src/plugins/qmlprofiler/qmlprofileroptionspage.h b/src/plugins/qmlprofiler/qmlprofileroptionspage.h
deleted file mode 100644
index 3278de15d77..00000000000
--- a/src/plugins/qmlprofiler/qmlprofileroptionspage.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#pragma once
-
-#include
-#include
-
-namespace QmlProfiler {
-namespace Internal {
-
-class QmlProfilerOptionsPage final : public Core::IOptionsPage
-{
-public:
- QmlProfilerOptionsPage();
-
- QWidget *widget() override;
- void apply() override;
- void finish() override;
-
-private:
- QPointer m_widget;
-};
-
-} // Internal
-} // QmlProfiler
diff --git a/src/plugins/qmlprofiler/qmlprofilerplugin.cpp b/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
index f53c604285d..f6592de524e 100644
--- a/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
@@ -25,7 +25,6 @@
#include "qmlprofilerplugin.h"
#include "qmlprofilerrunconfigurationaspect.h"
-#include "qmlprofileroptionspage.h"
#include "qmlprofilerruncontrol.h"
#include "qmlprofilersettings.h"
#include "qmlprofilertool.h"
@@ -49,7 +48,6 @@
#include "tests/qmlprofilerattachdialog_test.h"
#include "tests/qmlprofilerbindingloopsrenderpass_test.h"
#include "tests/qmlprofilerclientmanager_test.h"
-#include "tests/qmlprofilerconfigwidget_test.h"
#include "tests/qmlprofilerdetailsrewriter_test.h"
#include "tests/qmlprofilertool_test.h"
#include "tests/qmlprofilertraceclient_test.h"
@@ -154,7 +152,6 @@ QVector QmlProfiler::Internal::QmlProfilerPlugin::createTestObjects()
tests << new QmlProfilerAttachDialogTest;
tests << new QmlProfilerBindingLoopsRenderPassTest;
tests << new QmlProfilerClientManagerTest;
- tests << new QmlProfilerConfigWidgetTest;
tests << new QmlProfilerDetailsRewriterTest;
tests << new QmlProfilerToolTest;
tests << new QmlProfilerTraceClientTest;
diff --git a/src/plugins/qmlprofiler/qmlprofilersettings.cpp b/src/plugins/qmlprofiler/qmlprofilersettings.cpp
index ded460bead8..e2709ae546e 100644
--- a/src/plugins/qmlprofiler/qmlprofilersettings.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilersettings.cpp
@@ -24,115 +24,122 @@
****************************************************************************/
#include "qmlprofilersettings.h"
+
#include "qmlprofilerconstants.h"
-#include "qmlprofilerconfigwidget.h"
+#include "qmlprofilerplugin.h"
#include
+#include
+
+#include
+
#include
+using namespace Utils;
+
namespace QmlProfiler {
namespace Internal {
+static QWidget *createQmlConfigWidget(QmlProfilerSettings *settings)
+{
+ QmlProfilerSettings &s = *settings;
+ using namespace Layouting;
+
+ return Form {
+ s.flushEnabled,
+ s.flushInterval,
+ s.aggregateTraces
+ }.emerge();
+}
+
QmlProfilerSettings::QmlProfilerSettings()
{
- setConfigWidgetCreator([this] { return new QmlProfilerConfigWidget(this); });
+ setConfigWidgetCreator([this] { return createQmlConfigWidget(this); });
- QVariantMap defaults;
- defaults.insert(QLatin1String(Constants::FLUSH_INTERVAL), 1000);
- defaults.insert(QLatin1String(Constants::FLUSH_ENABLED), false);
- defaults.insert(QLatin1String(Constants::LAST_TRACE_FILE), QString());
- defaults.insert(QLatin1String(Constants::AGGREGATE_TRACES), false);
+ group.setSettingsGroup(Constants::ANALYZER);
+
+ group.registerAspect(&flushEnabled);
+ flushEnabled.setSettingsKey("Analyzer.QmlProfiler.FlushEnabled");
+ flushEnabled.setLabelPlacement(BoolAspect::LabelPlacement::InExtraLabel);
+ flushEnabled.setLabelText(tr("Flush data while profiling:"));
+ flushEnabled.setToolTip(tr(
+ "Periodically flush pending data to the profiler. This reduces the delay when loading the\n"
+ "data and the memory usage in the application. It distorts the profile as the flushing\n"
+ "itself takes time."));
+
+ group.registerAspect(&flushInterval);
+ flushInterval.setSettingsKey("Analyzer.QmlProfiler.FlushInterval");
+ flushInterval.setRange(1, 10000000);
+ flushInterval.setDefaultValue(1000);
+ flushInterval.setLabelText(tr("Flush interval (ms):", nullptr));
+ flushInterval.setEnabled(false); // Controled by flushEnabled.
+
+ group.registerAspect(&lastTraceFile);
+ lastTraceFile.setSettingsKey("Analyzer.QmlProfiler.LastTraceFile");
+
+ group.registerAspect(&aggregateTraces);
+ aggregateTraces.setSettingsKey("Analyzer.QmlProfiler.AggregateTraces");
+ aggregateTraces.setLabelPlacement(BoolAspect::LabelPlacement::InExtraLabel);
+ aggregateTraces.setLabelText(tr("Process data only when process ends:"));
+ aggregateTraces.setToolTip(tr(
+ "Only process data when the process being profiled ends, not when the current recording\n"
+ "session ends. This way multiple recording sessions can be aggregated in a single trace,\n"
+ "for example if multiple QML engines start and stop sequentially during a single run of\n"
+ "the program."));
+
+ connect(&flushEnabled, &BoolAspect::volatileValueChanged,
+ &flushInterval, &BaseAspect::setEnabled);
+ connect(&flushEnabled, &BoolAspect::valueChanged,
+ &flushInterval, &BaseAspect::setEnabled);
// Read stored values
- QSettings *settings = Core::ICore::settings();
- settings->beginGroup(QLatin1String(Constants::ANALYZER));
- QVariantMap map = defaults;
- for (QVariantMap::ConstIterator it = defaults.constBegin(); it != defaults.constEnd(); ++it)
- map.insert(it.key(), settings->value(it.key(), it.value()));
- settings->endGroup();
-
- fromMap(map);
-}
-
-bool QmlProfilerSettings::flushEnabled() const
-{
- return m_flushEnabled;
-}
-
-void QmlProfilerSettings::setFlushEnabled(bool flushEnabled)
-{
- if (m_flushEnabled != flushEnabled) {
- m_flushEnabled = flushEnabled;
- emit changed();
- }
-}
-
-quint32 QmlProfilerSettings::flushInterval() const
-{
- return m_flushInterval;
-}
-
-void QmlProfilerSettings::setFlushInterval(quint32 flushInterval)
-{
- if (m_flushInterval != flushInterval) {
- m_flushInterval = flushInterval;
- emit changed();
- }
-}
-
-QString QmlProfilerSettings::lastTraceFile() const
-{
- return m_lastTraceFile;
-}
-
-void QmlProfilerSettings::setLastTraceFile(const QString &lastTracePath)
-{
- if (m_lastTraceFile != lastTracePath) {
- m_lastTraceFile = lastTracePath;
- emit changed();
- }
-}
-
-bool QmlProfilerSettings::aggregateTraces() const
-{
- return m_aggregateTraces;
-}
-
-void QmlProfilerSettings::setAggregateTraces(bool aggregateTraces)
-{
- if (m_aggregateTraces != aggregateTraces) {
- m_aggregateTraces = aggregateTraces;
- emit changed();
- }
+ group.readSettings(Core::ICore::settings());
}
void QmlProfilerSettings::writeGlobalSettings() const
{
- QSettings *settings = Core::ICore::settings();
- settings->beginGroup(QLatin1String(Constants::ANALYZER));
- QVariantMap map;
- toMap(map);
- for (QVariantMap::ConstIterator it = map.constBegin(); it != map.constEnd(); ++it)
- settings->setValue(it.key(), it.value());
- settings->endGroup();
+ group.writeSettings(Core::ICore::settings());
}
void QmlProfilerSettings::toMap(QVariantMap &map) const
{
- map[QLatin1String(Constants::FLUSH_INTERVAL)] = m_flushInterval;
- map[QLatin1String(Constants::FLUSH_ENABLED)] = m_flushEnabled;
- map[QLatin1String(Constants::LAST_TRACE_FILE)] = m_lastTraceFile;
- map[QLatin1String(Constants::AGGREGATE_TRACES)] = m_aggregateTraces;
+ group.toMap(map);
}
void QmlProfilerSettings::fromMap(const QVariantMap &map)
{
- m_flushEnabled = map.value(QLatin1String(Constants::FLUSH_ENABLED)).toBool();
- m_flushInterval = map.value(QLatin1String(Constants::FLUSH_INTERVAL)).toUInt();
- m_lastTraceFile = map.value(QLatin1String(Constants::LAST_TRACE_FILE)).toString();
- m_aggregateTraces = map.value(QLatin1String(Constants::AGGREGATE_TRACES)).toBool();
- emit changed();
+ group.fromMap(map);
+}
+
+
+// QmlProfilerOptionsPage
+
+QmlProfilerOptionsPage::QmlProfilerOptionsPage()
+{
+ setId(Constants::SETTINGS);
+ setDisplayName(QmlProfilerSettings::tr("QML Profiler"));
+ setCategory("T.Analyzer");
+ setDisplayCategory(QmlProfilerSettings::tr("Analyzer"));
+ setCategoryIconPath(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
+}
+
+QWidget *QmlProfilerOptionsPage::widget()
+{
+ // 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
diff --git a/src/plugins/qmlprofiler/qmlprofilersettings.h b/src/plugins/qmlprofiler/qmlprofilersettings.h
index 6af1b65de96..6f6ab228f41 100644
--- a/src/plugins/qmlprofiler/qmlprofilersettings.h
+++ b/src/plugins/qmlprofiler/qmlprofilersettings.h
@@ -25,8 +25,12 @@
#pragma once
+#include
+
#include
+#include
+
namespace QmlProfiler {
namespace Internal {
@@ -36,32 +40,31 @@ class QmlProfilerSettings : public ProjectExplorer::ISettingsAspect
public:
QmlProfilerSettings();
- bool flushEnabled() const;
- void setFlushEnabled(bool flushEnabled);
-
- quint32 flushInterval() const;
- void setFlushInterval(quint32 flushInterval);
-
- QString lastTraceFile() const;
- void setLastTraceFile(const QString &lastTraceFile);
-
- bool aggregateTraces() const;
- void setAggregateTraces(bool aggregateTraces);
-
void writeGlobalSettings() const;
-signals:
- void changed();
+ Utils::BoolAspect flushEnabled;
+ Utils::IntegerAspect flushInterval;
+ Utils::StringAspect lastTraceFile;
+ Utils::BoolAspect aggregateTraces;
+
+ Utils::AspectContainer group;
protected:
void toMap(QVariantMap &map) const override;
void fromMap(const QVariantMap &map) override;
+};
+
+class QmlProfilerOptionsPage final : public Core::IOptionsPage
+{
+public:
+ QmlProfilerOptionsPage();
+
+ QWidget *widget() override;
+ void apply() override;
+ void finish() override;
private:
- bool m_flushEnabled;
- quint32 m_flushInterval;
- QString m_lastTraceFile;
- bool m_aggregateTraces;
+ QPointer m_widget;
};
} // Internal
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp
index c41076ede98..3d49dbd59d5 100644
--- a/src/plugins/qmlprofiler/qmlprofilertool.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp
@@ -314,9 +314,9 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunner *runWorker)
if (auto aspect = static_cast(
runControl->aspect(Constants::SETTINGS))) {
if (auto settings = static_cast(aspect->currentSettings())) {
- d->m_profilerConnections->setFlushInterval(settings->flushEnabled() ?
- settings->flushInterval() : 0);
- d->m_profilerModelManager->setAggregateTraces(settings->aggregateTraces());
+ d->m_profilerConnections->setFlushInterval(settings->flushEnabled.value() ?
+ settings->flushInterval.value() : 0);
+ d->m_profilerModelManager->setAggregateTraces(settings->aggregateTraces.value());
}
}
@@ -589,8 +589,8 @@ void QmlProfilerTool::showErrorDialog(const QString &error)
void saveLastTraceFile(const QString &filename)
{
QmlProfilerSettings *settings = QmlProfilerPlugin::globalSettings();
- if (filename != settings->lastTraceFile()) {
- settings->setLastTraceFile(filename);
+ if (filename != settings->lastTraceFile.value()) {
+ settings->lastTraceFile.setValue(filename);
settings->writeGlobalSettings();
}
}
@@ -601,7 +601,7 @@ void QmlProfilerTool::showSaveDialog()
QLatin1String zFile(QztFileExtension);
QString filename = QFileDialog::getSaveFileName(
ICore::dialogParent(), tr("Save QML Trace"),
- QmlProfilerPlugin::globalSettings()->lastTraceFile(),
+ QmlProfilerPlugin::globalSettings()->lastTraceFile.value(),
tr("QML traces (*%1 *%2)").arg(zFile).arg(tFile));
if (!filename.isEmpty()) {
if (!filename.endsWith(zFile) && !filename.endsWith(tFile))
@@ -625,7 +625,7 @@ void QmlProfilerTool::showLoadDialog()
QLatin1String zFile(QztFileExtension);
QString filename = QFileDialog::getOpenFileName(
ICore::dialogParent(), tr("Load QML Trace"),
- QmlProfilerPlugin::globalSettings()->lastTraceFile(),
+ QmlProfilerPlugin::globalSettings()->lastTraceFile.value(),
tr("QML traces (*%1 *%2)").arg(zFile).arg(tFile));
if (!filename.isEmpty()) {
diff --git a/src/plugins/qmlprofiler/tests/qmlprofilerconfigwidget_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilerconfigwidget_test.cpp
deleted file mode 100644
index e291c15f5df..00000000000
--- a/src/plugins/qmlprofiler/tests/qmlprofilerconfigwidget_test.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-#include "qmlprofilerconfigwidget_test.h"
-#include
-
-namespace QmlProfiler {
-namespace Internal {
-
-QmlProfilerConfigWidgetTest::QmlProfilerConfigWidgetTest(QObject *parent) :
- QObject(parent), widget(&settings)
-{
- widget.show();
- flushEnabled = widget.findChild("flushEnabled");
- QVERIFY(flushEnabled);
- flushInterval = widget.findChild("flushInterval");
- QVERIFY(flushInterval);
- aggregateTraces = widget.findChild("aggregateTraces");
- QVERIFY(aggregateTraces);
-}
-
-void QmlProfilerConfigWidgetTest::testUpdateFromSettings()
-{
- QSignalSpy flushes(flushEnabled, SIGNAL(stateChanged(int)));
- QCOMPARE(flushEnabled->checkState(), Qt::Unchecked);
- settings.setFlushEnabled(true);
- QCOMPARE(flushEnabled->checkState(), Qt::Checked);
- settings.setFlushEnabled(false);
- QCOMPARE(flushEnabled->checkState(), Qt::Unchecked);
- QCOMPARE(flushes.count(), 2);
-
-
- QSignalSpy intervals(flushInterval, SIGNAL(valueChanged(int)));
- QCOMPARE(flushInterval->value(), 1000);
- settings.setFlushInterval(200);
- QCOMPARE(flushInterval->value(), 200);
- settings.setFlushInterval(1000);
- QCOMPARE(flushInterval->value(), 1000);
- QCOMPARE(intervals.count(), 2);
-
- QSignalSpy aggregates(aggregateTraces, SIGNAL(stateChanged(int)));
- QCOMPARE(aggregateTraces->checkState(), Qt::Unchecked);
- settings.setAggregateTraces(true);
- QCOMPARE(aggregateTraces->checkState(), Qt::Checked);
- settings.setAggregateTraces(false);
- QCOMPARE(aggregateTraces->checkState(), Qt::Unchecked);
- QCOMPARE(aggregates.count(), 2);
-}
-
-void QmlProfilerConfigWidgetTest::testChangeWidget()
-{
- QCOMPARE(flushEnabled->checkState(), Qt::Unchecked);
- QVERIFY(!settings.flushEnabled());
- flushEnabled->setCheckState(Qt::Checked);
- QVERIFY(settings.flushEnabled());
- flushEnabled->setCheckState(Qt::Unchecked);
- QVERIFY(!settings.flushEnabled());
-
- QCOMPARE(flushInterval->value(), 1000);
- QCOMPARE(settings.flushInterval(), 1000u);
- flushInterval->setValue(200);
- QCOMPARE(settings.flushInterval(), 200u);
- flushInterval->setValue(1000);
- QCOMPARE(settings.flushInterval(), 1000u);
-
- QCOMPARE(aggregateTraces->checkState(), Qt::Unchecked);
- QVERIFY(!settings.aggregateTraces());
- aggregateTraces->setCheckState(Qt::Checked);
- QVERIFY(settings.aggregateTraces());
- aggregateTraces->setCheckState(Qt::Unchecked);
- QVERIFY(!settings.aggregateTraces());
-}
-
-} // namespace Internal
-} // namespace QmlProfiler
diff --git a/src/plugins/qmlprofiler/tests/qmlprofilerconfigwidget_test.h b/src/plugins/qmlprofiler/tests/qmlprofilerconfigwidget_test.h
deleted file mode 100644
index d669d1c8992..00000000000
--- a/src/plugins/qmlprofiler/tests/qmlprofilerconfigwidget_test.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-#pragma once
-
-#include
-#include
-#include
-#include
-
-namespace QmlProfiler {
-namespace Internal {
-
-class QmlProfilerConfigWidgetTest : public QObject
-{
- Q_OBJECT
-public:
- explicit QmlProfilerConfigWidgetTest(QObject *parent = nullptr);
-
-private slots:
- void testUpdateFromSettings();
- void testChangeWidget();
-
-private:
- QmlProfilerSettings settings;
- QmlProfilerConfigWidget widget;
-
- QCheckBox *flushEnabled;
- QSpinBox *flushInterval;
- QCheckBox *aggregateTraces;
-};
-
-} // namespace Internal
-} // namespace QmlProfiler
diff --git a/src/plugins/qmlprofiler/tests/tests.pri b/src/plugins/qmlprofiler/tests/tests.pri
index eee511e93f8..166f606a769 100644
--- a/src/plugins/qmlprofiler/tests/tests.pri
+++ b/src/plugins/qmlprofiler/tests/tests.pri
@@ -15,7 +15,6 @@ SOURCES += \
$$PWD/qmlprofilerattachdialog_test.cpp \
$$PWD/qmlprofilerbindingloopsrenderpass_test.cpp \
$$PWD/qmlprofilerclientmanager_test.cpp \
- $$PWD/qmlprofilerconfigwidget_test.cpp \
$$PWD/qmlprofilerdetailsrewriter_test.cpp \
$$PWD/qmlprofilertool_test.cpp \
$$PWD/qmlprofilertraceclient_test.cpp \
@@ -38,7 +37,6 @@ HEADERS += \
$$PWD/qmlprofilerattachdialog_test.h \
$$PWD/qmlprofilerbindingloopsrenderpass_test.h \
$$PWD/qmlprofilerclientmanager_test.h \
- $$PWD/qmlprofilerconfigwidget_test.h \
$$PWD/qmlprofilerdetailsrewriter_test.h \
$$PWD/qmlprofilertool_test.h \
$$PWD/qmlprofilertraceclient_test.h \