AutoTest: Use setupFunction for TestSettingsPage

Change-Id: Ib592b3fd92480a5e712cf7cd69d4b5c899a1f216
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2024-01-29 09:02:52 +01:00
parent 8b8e360ba8
commit 45a62e785a
3 changed files with 21 additions and 16 deletions

View File

@@ -94,8 +94,6 @@ public:
void onRunUnderCursorTriggered(TestRunMode mode); void onRunUnderCursorTriggered(TestRunMode mode);
void onDisableTemporarily(bool disable); void onDisableTemporarily(bool disable);
TestSettingsPage m_testSettingPage;
TestCodeParser m_testCodeParser; TestCodeParser m_testCodeParser;
TestTreeModel m_testTreeModel{&m_testCodeParser}; TestTreeModel m_testTreeModel{&m_testCodeParser};
TestRunner m_testRunner; TestRunner m_testRunner;
@@ -506,6 +504,8 @@ public:
void initialize() final void initialize() final
{ {
setupTestSettingsPage();
dd = new AutotestPluginPrivate; dd = new AutotestPluginPrivate;
#ifdef WITH_TESTS #ifdef WITH_TESTS
ExtensionSystem::PluginManager::registerScenario("TestModelManagerInterface", ExtensionSystem::PluginManager::registerScenario("TestModelManagerInterface",

View File

@@ -10,6 +10,8 @@
#include "testsettings.h" #include "testsettings.h"
#include "testtreemodel.h" #include "testtreemodel.h"
#include <coreplugin/dialogs/ioptionspage.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/id.h> #include <utils/id.h>
#include <utils/infolabel.h> #include <utils/infolabel.h>
@@ -253,14 +255,23 @@ void TestSettingsWidget::onFrameworkItemChanged()
// TestSettingsPage // TestSettingsPage
TestSettingsPage::TestSettingsPage() class TestSettingsPage final : public Core::IOptionsPage
{ {
setId(Constants::AUTOTEST_SETTINGS_ID); public:
setDisplayName(Tr::tr("General")); TestSettingsPage()
setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY); {
setDisplayCategory(Tr::tr("Testing")); setId(Constants::AUTOTEST_SETTINGS_ID);
setCategoryIconPath(":/autotest/images/settingscategory_autotest.png"); setDisplayName(Tr::tr("General"));
setWidgetCreator([] { return new TestSettingsWidget; }); setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY);
setDisplayCategory(Tr::tr("Testing"));
setCategoryIconPath(":/autotest/images/settingscategory_autotest.png");
setWidgetCreator([] { return new TestSettingsWidget; });
}
};
void setupTestSettingsPage()
{
static TestSettingsPage theTestSettingsPage;
} }
} // Autotest::Internal } // Autotest::Internal

View File

@@ -3,14 +3,8 @@
#pragma once #pragma once
#include <coreplugin/dialogs/ioptionspage.h>
namespace Autotest::Internal { namespace Autotest::Internal {
class TestSettingsPage : public Core::IOptionsPage void setupTestSettingsPage();
{
public:
TestSettingsPage();
};
} // Autotest::Internal } // Autotest::Internal