forked from qt-creator/qt-creator
PerfProfiler: Convert to current settings scheme
Change-Id: I33e667a1cd9515f17af1bf9b2af6171b083c79de Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -15,7 +15,6 @@ set(PERFPROFILER_CPP_SOURCES
|
|||||||
perfevent.h
|
perfevent.h
|
||||||
perfeventtype.h
|
perfeventtype.h
|
||||||
perfloaddialog.cpp perfloaddialog.h
|
perfloaddialog.cpp perfloaddialog.h
|
||||||
perfoptionspage.cpp perfoptionspage.h
|
|
||||||
perfprofiler.qrc
|
perfprofiler.qrc
|
||||||
perfprofilerconstants.h
|
perfprofilerconstants.h
|
||||||
perfprofilerflamegraphmodel.cpp perfprofilerflamegraphmodel.h
|
perfprofilerflamegraphmodel.cpp perfprofilerflamegraphmodel.h
|
||||||
|
@@ -1,26 +0,0 @@
|
|||||||
// Copyright (C) 2018 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#include "perfconfigwidget.h"
|
|
||||||
#include "perfoptionspage.h"
|
|
||||||
#include "perfprofilerconstants.h"
|
|
||||||
#include "perfprofilertr.h"
|
|
||||||
|
|
||||||
#include <debugger/analyzer/analyzericons.h>
|
|
||||||
#include <debugger/debuggertr.h>
|
|
||||||
|
|
||||||
namespace PerfProfiler {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
PerfOptionsPage::PerfOptionsPage(PerfSettings *settings)
|
|
||||||
{
|
|
||||||
setId(Constants::PerfSettingsId);
|
|
||||||
setDisplayName(Tr::tr("CPU Usage"));
|
|
||||||
setCategory("T.Analyzer");
|
|
||||||
setDisplayCategory(::Debugger::Tr::tr("Analyzer"));
|
|
||||||
setCategoryIconPath(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
|
|
||||||
setWidgetCreator([settings] { return new PerfConfigWidget(settings); });
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace PerfProfiler
|
|
@@ -1,21 +0,0 @@
|
|||||||
// Copyright (C) 2018 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <coreplugin/dialogs/ioptionspage.h>
|
|
||||||
|
|
||||||
namespace PerfProfiler {
|
|
||||||
|
|
||||||
class PerfSettings;
|
|
||||||
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class PerfOptionsPage final : public Core::IOptionsPage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit PerfOptionsPage(PerfSettings *settings);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace PerfProfiler
|
|
@@ -26,8 +26,6 @@ QtcPlugin {
|
|||||||
"perfeventtype.h",
|
"perfeventtype.h",
|
||||||
"perfloaddialog.cpp",
|
"perfloaddialog.cpp",
|
||||||
"perfloaddialog.h",
|
"perfloaddialog.h",
|
||||||
"perfoptionspage.cpp",
|
|
||||||
"perfoptionspage.h",
|
|
||||||
"perfprofiler_global.h", "perfprofilertr.h",
|
"perfprofiler_global.h", "perfprofilertr.h",
|
||||||
"perfprofilerconstants.h",
|
"perfprofilerconstants.h",
|
||||||
"perfprofilerplugin.cpp",
|
"perfprofilerplugin.cpp",
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
// Copyright (C) 2018 The Qt Company Ltd.
|
// Copyright (C) 2018 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
#include "perfoptionspage.h"
|
|
||||||
#include "perfprofilerplugin.h"
|
#include "perfprofilerplugin.h"
|
||||||
|
|
||||||
#include "perfprofilerruncontrol.h"
|
#include "perfprofilerruncontrol.h"
|
||||||
#include "perfprofilertool.h"
|
#include "perfprofilertool.h"
|
||||||
#include "perfrunconfigurationaspect.h"
|
#include "perfrunconfigurationaspect.h"
|
||||||
@@ -17,8 +17,6 @@ using namespace ProjectExplorer;
|
|||||||
|
|
||||||
namespace PerfProfiler::Internal {
|
namespace PerfProfiler::Internal {
|
||||||
|
|
||||||
Q_GLOBAL_STATIC(PerfSettings, perfGlobalSettings)
|
|
||||||
|
|
||||||
class PerfProfilerPluginPrivate
|
class PerfProfilerPluginPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -28,7 +26,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
PerfProfilerRunWorkerFactory profilerWorkerFactory;
|
PerfProfilerRunWorkerFactory profilerWorkerFactory;
|
||||||
PerfOptionsPage optionsPage{perfGlobalSettings()};
|
|
||||||
PerfProfilerTool profilerTool;
|
PerfProfilerTool profilerTool;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -47,9 +44,4 @@ void PerfProfilerPlugin::initialize()
|
|||||||
#endif // WITH_TESTS
|
#endif // WITH_TESTS
|
||||||
}
|
}
|
||||||
|
|
||||||
PerfSettings *PerfProfilerPlugin::globalSettings()
|
|
||||||
{
|
|
||||||
return perfGlobalSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // PerfProfiler::Internal
|
} // PerfProfiler::Internal
|
||||||
|
@@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "perfsettings.h"
|
|
||||||
|
|
||||||
#include <extensionsystem/iplugin.h>
|
#include <extensionsystem/iplugin.h>
|
||||||
|
|
||||||
namespace PerfProfiler::Internal {
|
namespace PerfProfiler::Internal {
|
||||||
@@ -19,8 +17,6 @@ public:
|
|||||||
|
|
||||||
void initialize() final;
|
void initialize() final;
|
||||||
|
|
||||||
static PerfSettings *globalSettings();
|
|
||||||
|
|
||||||
class PerfProfilerPluginPrivate *d = nullptr;
|
class PerfProfilerPluginPrivate *d = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -237,7 +237,7 @@ void PerfProfilerTool::createViews()
|
|||||||
}
|
}
|
||||||
|
|
||||||
PerfConfigWidget *widget = new PerfConfigWidget(
|
PerfConfigWidget *widget = new PerfConfigWidget(
|
||||||
settings ? settings : PerfProfilerPlugin::globalSettings(),
|
settings ? settings : &globalSettings(),
|
||||||
Core::ICore::dialogParent());
|
Core::ICore::dialogParent());
|
||||||
widget->setTracePointsButtonVisible(true);
|
widget->setTracePointsButtonVisible(true);
|
||||||
widget->setTarget(target);
|
widget->setTarget(target);
|
||||||
|
@@ -14,7 +14,7 @@ namespace PerfProfiler {
|
|||||||
PerfRunConfigurationAspect::PerfRunConfigurationAspect(ProjectExplorer::Target *target)
|
PerfRunConfigurationAspect::PerfRunConfigurationAspect(ProjectExplorer::Target *target)
|
||||||
{
|
{
|
||||||
setProjectSettings(new PerfSettings(target));
|
setProjectSettings(new PerfSettings(target));
|
||||||
setGlobalSettings(Internal::PerfProfilerPlugin::globalSettings());
|
setGlobalSettings(&PerfProfiler::globalSettings());
|
||||||
setId(Constants::PerfSettingsId);
|
setId(Constants::PerfSettingsId);
|
||||||
setDisplayName(Tr::tr("Performance Analyzer Settings"));
|
setDisplayName(Tr::tr("Performance Analyzer Settings"));
|
||||||
setUsingGlobalSettings(true);
|
setUsingGlobalSettings(true);
|
||||||
|
@@ -6,16 +6,25 @@
|
|||||||
#include "perfprofilertr.h"
|
#include "perfprofilertr.h"
|
||||||
#include "perfsettings.h"
|
#include "perfsettings.h"
|
||||||
|
|
||||||
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
#include <QSettings>
|
#include <debugger/analyzer/analyzericons.h>
|
||||||
|
#include <debugger/debuggertr.h>
|
||||||
|
|
||||||
|
#include <utils/layoutbuilder.h>
|
||||||
#include <utils/process.h>
|
#include <utils/process.h>
|
||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace PerfProfiler {
|
namespace PerfProfiler {
|
||||||
|
|
||||||
|
PerfSettings &globalSettings()
|
||||||
|
{
|
||||||
|
static PerfSettings theSettings(nullptr);
|
||||||
|
return theSettings;
|
||||||
|
}
|
||||||
|
|
||||||
PerfSettings::PerfSettings(ProjectExplorer::Target *target)
|
PerfSettings::PerfSettings(ProjectExplorer::Target *target)
|
||||||
{
|
{
|
||||||
setConfigWidgetCreator([this, target] {
|
setConfigWidgetCreator([this, target] {
|
||||||
@@ -62,6 +71,14 @@ PerfSettings::PerfSettings(ProjectExplorer::Target *target)
|
|||||||
stackSize.setEnabled(callgraphMode.volatileValue() == 0);
|
stackSize.setEnabled(callgraphMode.volatileValue() == 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setLayouter([this] {
|
||||||
|
using namespace Layouting;
|
||||||
|
return Column {
|
||||||
|
createConfigWidget()
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
readSettings();
|
||||||
readGlobalSettings();
|
readGlobalSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,4 +142,22 @@ void PerfSettings::resetToDefault()
|
|||||||
fromMap(map);
|
fromMap(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PerfSettingsPage
|
||||||
|
|
||||||
|
class PerfSettingsPage final : public Core::IOptionsPage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PerfSettingsPage()
|
||||||
|
{
|
||||||
|
setId(Constants::PerfSettingsId);
|
||||||
|
setDisplayName(Tr::tr("CPU Usage"));
|
||||||
|
setCategory("T.Analyzer");
|
||||||
|
setDisplayCategory(::Debugger::Tr::tr("Analyzer"));
|
||||||
|
setCategoryIconPath(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
|
||||||
|
setSettingsProvider([] { return &globalSettings(); });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const PerfSettingsPage settingsPage;
|
||||||
|
|
||||||
} // namespace PerfProfiler
|
} // namespace PerfProfiler
|
||||||
|
@@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
namespace PerfProfiler {
|
namespace PerfProfiler {
|
||||||
|
|
||||||
class PERFPROFILER_EXPORT PerfSettings final : public ProjectExplorer::ISettingsAspect
|
class PERFPROFILER_EXPORT PerfSettings final : public ProjectExplorer::ISettingsAspect
|
||||||
@@ -34,4 +32,6 @@ public:
|
|||||||
Utils::StringAspect extraArguments{this};
|
Utils::StringAspect extraArguments{this};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PerfSettings &globalSettings();
|
||||||
|
|
||||||
} // namespace PerfProfiler
|
} // namespace PerfProfiler
|
||||||
|
Reference in New Issue
Block a user