aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2021-04-06 16:44:18 +0200
committerhjk <hjk@qt.io>2021-04-12 11:29:16 +0000
commit8eb74080ab387dc4c10fa222b9d73844cc5d6c3f (patch)
tree3a02f32dc088c8a1ed3fb5e42444e94bcc26a32c
parentb88b73d9c1b9fb4c1da4ab8ad85fbcad05512668 (diff)
QmlProfiler: Aspectify settings
Only four simple values. Adapting qmlprofilerconfigwidget_test did not seem desirable, as in the aspectified state this is hidden in the base aspects implementations. Change-Id: I933a8ca065169c61b7f25f109e0b7a0e6d21cb33 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r--src/plugins/qmlprofiler/CMakeLists.txt5
-rw-r--r--src/plugins/qmlprofiler/qmlprofiler.pro7
-rw-r--r--src/plugins/qmlprofiler/qmlprofiler.qbs5
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerattachdialog.ui129
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerconfigwidget.cpp64
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerconfigwidget.h55
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerconfigwidget.ui71
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerconstants.h4
-rw-r--r--src/plugins/qmlprofiler/qmlprofileroptionspage.cpp64
-rw-r--r--src/plugins/qmlprofiler/qmlprofileroptionspage.h48
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerplugin.cpp3
-rw-r--r--src/plugins/qmlprofiler/qmlprofilersettings.cpp151
-rw-r--r--src/plugins/qmlprofiler/qmlprofilersettings.h39
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertool.cpp14
-rw-r--r--src/plugins/qmlprofiler/tests/qmlprofilerconfigwidget_test.cpp96
-rw-r--r--src/plugins/qmlprofiler/tests/qmlprofilerconfigwidget_test.h55
-rw-r--r--src/plugins/qmlprofiler/tests/tests.pri2
17 files changed, 109 insertions, 703 deletions
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 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>QmlProfiler::Internal::QmlProfilerAttachDialog</class>
- <widget class="QDialog" name="QmlProfiler::Internal::QmlProfilerAttachDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>203</width>
- <height>136</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>QML Profiler</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QFormLayout" name="formLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="addressLabel">
- <property name="text">
- <string>&amp;Host:</string>
- </property>
- <property name="buddy">
- <cstring>addressLineEdit</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="addressLineEdit">
- <property name="text">
- <string>localhost</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="portLabel">
- <property name="text">
- <string>&amp;Port:</string>
- </property>
- <property name="buddy">
- <cstring>portSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QSpinBox" name="portSpinBox">
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>65535</number>
- </property>
- <property name="value">
- <number>3768</number>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Sys&amp;root:</string>
- </property>
- <property name="buddy">
- <cstring>sysrootChooser</cstring>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="Utils::PathChooser" name="sysrootChooser" native="true"/>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>Utils::PathChooser</class>
- <extends>QWidget</extends>
- <header location="global">utils/pathchooser.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>QmlProfiler::Internal::QmlProfilerAttachDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>248</x>
- <y>254</y>
- </hint>
- <hint type="destinationlabel">
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>QmlProfiler::Internal::QmlProfilerAttachDialog</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>316</x>
- <y>260</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
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<int>::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 <QWidget>
-
-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 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>QmlProfiler::Internal::QmlProfilerConfigWidget</class>
- <widget class="QWidget" name="QmlProfiler::Internal::QmlProfilerConfigWidget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>320</width>
- <height>100</height>
- </rect>
- </property>
- <layout class="QFormLayout" name="formLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="flushEnabledLabel">
- <property name="text">
- <string>Flush data while profiling:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QCheckBox" name="flushEnabled">
- <property name="toolTip">
- <string>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.</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="flushIntervalLabel">
- <property name="text">
- <string>Flush interval (ms):</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QSpinBox" name="flushInterval">
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>10000000</number>
- </property>
- <property name="value">
- <number>1000</number>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="aggregateTracesLabel">
- <property name="text">
- <string>Process data only when process ends:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QCheckBox" name="aggregateTraces">
- <property name="toolTip">
- <string>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.</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
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 <debugger/analyzer/analyzericons.h>
-
-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 <coreplugin/dialogs/ioptionspage.h>
-#include <QPointer>
-
-namespace QmlProfiler {
-namespace Internal {
-
-class QmlProfilerOptionsPage final : public Core::IOptionsPage
-{
-public:
- QmlProfilerOptionsPage();
-
- QWidget *widget() override;
- void apply() override;
- void finish() override;
-
-private:
- QPointer<QWidget> 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<QObject *> 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 <coreplugin/icore.h>
+#include <debugger/analyzer/analyzericons.h>
+
+#include <utils/layoutbuilder.h>
+
#include <QSettings>
+using namespace Utils;
+
namespace QmlProfiler {
namespace Internal {
-QmlProfilerSettings::QmlProfilerSettings()
+static QWidget *createQmlConfigWidget(QmlProfilerSettings *settings)
{
- setConfigWidgetCreator([this] { return new QmlProfilerConfigWidget(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);
-
- // 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);
+ QmlProfilerSettings &s = *settings;
+ using namespace Layouting;
+
+ return Form {
+ s.flushEnabled,
+ s.flushInterval,
+ s.aggregateTraces
+ }.emerge();
}
-bool QmlProfilerSettings::flushEnabled() const
+QmlProfilerSettings::QmlProfilerSettings()
{
- return m_flushEnabled;
-}
+ setConfigWidgetCreator([this] { return createQmlConfigWidget(this); });
+
+ 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);
-void QmlProfilerSettings::setFlushEnabled(bool flushEnabled)
-{
- if (m_flushEnabled != flushEnabled) {
- m_flushEnabled = flushEnabled;
- emit changed();
- }
+ // Read stored values
+ group.readSettings(Core::ICore::settings());
}
-quint32 QmlProfilerSettings::flushInterval() const
+void QmlProfilerSettings::writeGlobalSettings() const
{
- return m_flushInterval;
+ group.writeSettings(Core::ICore::settings());
}
-void QmlProfilerSettings::setFlushInterval(quint32 flushInterval)
+void QmlProfilerSettings::toMap(QVariantMap &map) const
{
- if (m_flushInterval != flushInterval) {
- m_flushInterval = flushInterval;
- emit changed();
- }
+ group.toMap(map);
}
-QString QmlProfilerSettings::lastTraceFile() const
+void QmlProfilerSettings::fromMap(const QVariantMap &map)
{
- return m_lastTraceFile;
+ group.fromMap(map);
}
-void QmlProfilerSettings::setLastTraceFile(const QString &lastTracePath)
-{
- if (m_lastTraceFile != lastTracePath) {
- m_lastTraceFile = lastTracePath;
- emit changed();
- }
-}
-bool QmlProfilerSettings::aggregateTraces() const
-{
- return m_aggregateTraces;
-}
+// QmlProfilerOptionsPage
-void QmlProfilerSettings::setAggregateTraces(bool aggregateTraces)
+QmlProfilerOptionsPage::QmlProfilerOptionsPage()
{
- if (m_aggregateTraces != aggregateTraces) {
- m_aggregateTraces = aggregateTraces;
- emit changed();
- }
+ setId(Constants::SETTINGS);
+ setDisplayName(QmlProfilerSettings::tr("QML Profiler"));
+ setCategory("T.Analyzer");
+ setDisplayCategory(QmlProfilerSettings::tr("Analyzer"));
+ setCategoryIconPath(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
}
-void QmlProfilerSettings::writeGlobalSettings() const
+QWidget *QmlProfilerOptionsPage::widget()
{
- 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();
+ // 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 QmlProfilerSettings::toMap(QVariantMap &map) const
+void QmlProfilerOptionsPage::apply()
{
- 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;
+ QmlProfilerPlugin::globalSettings()->writeGlobalSettings();
}
-void QmlProfilerSettings::fromMap(const QVariantMap &map)
+void QmlProfilerOptionsPage::finish()
{
- 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();
+ 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 <coreplugin/dialogs/ioptionspage.h>
+
#include <projectexplorer/runconfiguration.h>
+#include <QPointer>
+
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<QWidget> 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<QmlProfilerRunConfigurationAspect *>(
runControl->aspect(Constants::SETTINGS))) {
if (auto settings = static_cast<const QmlProfilerSettings *>(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 <QtTest>
-
-namespace QmlProfiler {
-namespace Internal {
-
-QmlProfilerConfigWidgetTest::QmlProfilerConfigWidgetTest(QObject *parent) :
- QObject(parent), widget(&settings)
-{
- widget.show();
- flushEnabled = widget.findChild<QCheckBox*>("flushEnabled");
- QVERIFY(flushEnabled);
- flushInterval = widget.findChild<QSpinBox*>("flushInterval");
- QVERIFY(flushInterval);
- aggregateTraces = widget.findChild<QCheckBox*>("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 <qmlprofiler/qmlprofilerconfigwidget.h>
-#include <QObject>
-#include <QCheckBox>
-#include <QSpinBox>
-
-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 \