summaryrefslogtreecommitdiff
path: root/src/plugins/autotest
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2020-01-10 12:00:37 +0100
committerhjk <hjk@qt.io>2020-01-15 10:52:24 +0000
commit03003872bcbf54afc69223f3f5271e98ad15736b (patch)
tree9c4567e41e83a5b9b7daa6eec86729e9cb7ab243 /src/plugins/autotest
parentd86fba3ee1904446442881e77515d019e8618f73 (diff)
downloadqt-creator-03003872bcbf54afc69223f3f5271e98ad15736b.tar.gz
AutoTest: Drop ITestSettingsPage intermediate class
Less code in total, and more uniform with other IOptionPage subclasses. Change-Id: I3d1cb9fae0faf32a360394cc5cf3262a9b59b456 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/autotest')
-rw-r--r--src/plugins/autotest/CMakeLists.txt1
-rw-r--r--src/plugins/autotest/autotest.pro1
-rw-r--r--src/plugins/autotest/autotest.qbs1
-rw-r--r--src/plugins/autotest/boost/boosttestframework.cpp4
-rw-r--r--src/plugins/autotest/boost/boosttestframework.h2
-rw-r--r--src/plugins/autotest/boost/boosttestsettingspage.cpp5
-rw-r--r--src/plugins/autotest/boost/boosttestsettingspage.h7
-rw-r--r--src/plugins/autotest/gtest/gtestframework.cpp4
-rw-r--r--src/plugins/autotest/gtest/gtestframework.h2
-rw-r--r--src/plugins/autotest/gtest/gtestsettingspage.cpp5
-rw-r--r--src/plugins/autotest/gtest/gtestsettingspage.h6
-rw-r--r--src/plugins/autotest/itestframework.h7
-rw-r--r--src/plugins/autotest/itestsettingspage.h66
-rw-r--r--src/plugins/autotest/qtest/qttestframework.cpp4
-rw-r--r--src/plugins/autotest/qtest/qttestframework.h2
-rw-r--r--src/plugins/autotest/qtest/qttestsettingspage.cpp5
-rw-r--r--src/plugins/autotest/qtest/qttestsettingspage.h6
-rw-r--r--src/plugins/autotest/testframeworkmanager.cpp9
-rw-r--r--src/plugins/autotest/testframeworkmanager.h4
19 files changed, 41 insertions, 100 deletions
diff --git a/src/plugins/autotest/CMakeLists.txt b/src/plugins/autotest/CMakeLists.txt
index 2c2051647f..b624c4eff3 100644
--- a/src/plugins/autotest/CMakeLists.txt
+++ b/src/plugins/autotest/CMakeLists.txt
@@ -35,7 +35,6 @@ add_qtc_plugin(AutoTest
iframeworksettings.h
itestframework.h
itestparser.cpp itestparser.h
- itestsettingspage.h
projectsettingswidget.cpp projectsettingswidget.h
qtest/qttest_utils.cpp qtest/qttest_utils.h
qtest/qttestconfiguration.cpp qtest/qttestconfiguration.h
diff --git a/src/plugins/autotest/autotest.pro b/src/plugins/autotest/autotest.pro
index c849d8c4d4..c816a32a44 100644
--- a/src/plugins/autotest/autotest.pro
+++ b/src/plugins/autotest/autotest.pro
@@ -71,7 +71,6 @@ HEADERS += \
iframeworksettings.h \
itestframework.h \
itestparser.h \
- itestsettingspage.h \
projectsettingswidget.h \
testcodeparser.h \
testconfiguration.h \
diff --git a/src/plugins/autotest/autotest.qbs b/src/plugins/autotest/autotest.qbs
index 0336ec75eb..737776dfc7 100644
--- a/src/plugins/autotest/autotest.qbs
+++ b/src/plugins/autotest/autotest.qbs
@@ -78,7 +78,6 @@ QtcPlugin {
"itestparser.h",
"itestframework.h",
"iframeworksettings.h",
- "itestsettingspage.h",
"testframeworkmanager.cpp",
"testframeworkmanager.h",
"testrunconfiguration.h"
diff --git a/src/plugins/autotest/boost/boosttestframework.cpp b/src/plugins/autotest/boost/boosttestframework.cpp
index a6b7515154..d54881540a 100644
--- a/src/plugins/autotest/boost/boosttestframework.cpp
+++ b/src/plugins/autotest/boost/boosttestframework.cpp
@@ -62,9 +62,9 @@ IFrameworkSettings *BoostTestFramework::createFrameworkSettings() const
return new BoostTestSettings;
}
-ITestSettingsPage *BoostTestFramework::createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const
+Core::IOptionsPage *BoostTestFramework::createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const
{
- return new BoostTestSettingsPage(settings, this);
+ return new BoostTestSettingsPage(settings, settingsId());
}
bool BoostTestFramework::hasFrameworkSettings() const
diff --git a/src/plugins/autotest/boost/boosttestframework.h b/src/plugins/autotest/boost/boosttestframework.h
index c9db343deb..dfe46dd0fe 100644
--- a/src/plugins/autotest/boost/boosttestframework.h
+++ b/src/plugins/autotest/boost/boosttestframework.h
@@ -37,7 +37,7 @@ public:
const char *name() const override;
unsigned priority() const override;
IFrameworkSettings *createFrameworkSettings() const override;
- ITestSettingsPage *createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const override;
+ Core::IOptionsPage *createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const override;
bool hasFrameworkSettings() const override;
protected:
ITestParser *createTestParser() const override;
diff --git a/src/plugins/autotest/boost/boosttestsettingspage.cpp b/src/plugins/autotest/boost/boosttestsettingspage.cpp
index b6a1c5c0cc..e453028dfb 100644
--- a/src/plugins/autotest/boost/boosttestsettingspage.cpp
+++ b/src/plugins/autotest/boost/boosttestsettingspage.cpp
@@ -103,9 +103,10 @@ void BoostTestSettingsWidget::fillComboBoxes()
}
BoostTestSettingsPage::BoostTestSettingsPage(QSharedPointer<IFrameworkSettings> settings,
- const ITestFramework *framework)
- : ITestSettingsPage(framework)
+ Core::Id settingsId)
{
+ setId(settingsId);
+ setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY);
setDisplayName(QCoreApplication::translate("BoostTestFramework",
BoostTest::Constants::FRAMEWORK_SETTINGS_CATEGORY));
setWidgetCreator([settings] {
diff --git a/src/plugins/autotest/boost/boosttestsettingspage.h b/src/plugins/autotest/boost/boosttestsettingspage.h
index 3b9e4e3ec8..27a7efd2c1 100644
--- a/src/plugins/autotest/boost/boosttestsettingspage.h
+++ b/src/plugins/autotest/boost/boosttestsettingspage.h
@@ -25,7 +25,7 @@
#pragma once
-#include "../itestsettingspage.h"
+#include <coreplugin/dialogs/ioptionspage.h>
namespace Autotest {
@@ -33,11 +33,10 @@ class IFrameworkSettings;
namespace Internal {
-class BoostTestSettingsPage final : public ITestSettingsPage
+class BoostTestSettingsPage final : public Core::IOptionsPage
{
public:
- BoostTestSettingsPage(QSharedPointer<IFrameworkSettings> settings,
- const ITestFramework *framework);
+ BoostTestSettingsPage(QSharedPointer<IFrameworkSettings> settings, Core::Id settingsId);
};
} // Internal
diff --git a/src/plugins/autotest/gtest/gtestframework.cpp b/src/plugins/autotest/gtest/gtestframework.cpp
index ceb0b12cb0..7e5ea7b681 100644
--- a/src/plugins/autotest/gtest/gtestframework.cpp
+++ b/src/plugins/autotest/gtest/gtestframework.cpp
@@ -61,9 +61,9 @@ IFrameworkSettings *GTestFramework::createFrameworkSettings() const
return new GTestSettings;
}
-ITestSettingsPage *GTestFramework::createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const
+Core::IOptionsPage *GTestFramework::createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const
{
- return new GTestSettingsPage(settings, this);
+ return new GTestSettingsPage(settings, settingsId());
}
bool GTestFramework::hasFrameworkSettings() const
diff --git a/src/plugins/autotest/gtest/gtestframework.h b/src/plugins/autotest/gtest/gtestframework.h
index 7e94884933..e6f1618c7b 100644
--- a/src/plugins/autotest/gtest/gtestframework.h
+++ b/src/plugins/autotest/gtest/gtestframework.h
@@ -38,7 +38,7 @@ public:
const char *name() const override;
unsigned priority() const override;
IFrameworkSettings *createFrameworkSettings() const override;
- ITestSettingsPage *createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const override;
+ Core::IOptionsPage *createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const override;
bool hasFrameworkSettings() const override;
static GTest::Constants::GroupMode groupMode();
static QString currentGTestFilter();
diff --git a/src/plugins/autotest/gtest/gtestsettingspage.cpp b/src/plugins/autotest/gtest/gtestsettingspage.cpp
index af57736c54..a5b1403a48 100644
--- a/src/plugins/autotest/gtest/gtestsettingspage.cpp
+++ b/src/plugins/autotest/gtest/gtestsettingspage.cpp
@@ -111,9 +111,10 @@ void GTestSettingsWidget::apply()
}
GTestSettingsPage::GTestSettingsPage(QSharedPointer<IFrameworkSettings> settings,
- const ITestFramework *framework)
- : ITestSettingsPage(framework)
+ Core::Id settingsId)
{
+ setId(settingsId);
+ setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY);
setDisplayName(QCoreApplication::translate("GTestFramework",
GTest::Constants::FRAMEWORK_SETTINGS_CATEGORY));
setWidgetCreator([settings] { return new GTestSettingsWidget(qSharedPointerCast<GTestSettings>(settings)); });
diff --git a/src/plugins/autotest/gtest/gtestsettingspage.h b/src/plugins/autotest/gtest/gtestsettingspage.h
index f17c4a8124..d789fd4622 100644
--- a/src/plugins/autotest/gtest/gtestsettingspage.h
+++ b/src/plugins/autotest/gtest/gtestsettingspage.h
@@ -25,7 +25,7 @@
#pragma once
-#include "../itestsettingspage.h"
+#include <coreplugin/dialogs/ioptionspage.h>
namespace Autotest {
@@ -33,10 +33,10 @@ class IFrameworkSettings;
namespace Internal {
-class GTestSettingsPage final : public ITestSettingsPage
+class GTestSettingsPage final : public Core::IOptionsPage
{
public:
- GTestSettingsPage(QSharedPointer<IFrameworkSettings> settings, const ITestFramework *framework);
+ GTestSettingsPage(QSharedPointer<IFrameworkSettings> settings, Core::Id settingsId);
};
} // namespace Internal
diff --git a/src/plugins/autotest/itestframework.h b/src/plugins/autotest/itestframework.h
index 9753ccc12a..11bdfa31cc 100644
--- a/src/plugins/autotest/itestframework.h
+++ b/src/plugins/autotest/itestframework.h
@@ -28,10 +28,11 @@
#include "testtreeitem.h"
#include "itestparser.h"
+namespace Core { class IOptionsPage; }
+
namespace Autotest {
class IFrameworkSettings;
-class ITestSettingsPage;
class ITestFramework
{
@@ -47,7 +48,7 @@ public:
virtual unsigned priority() const = 0; // should this be modifyable?
virtual bool hasFrameworkSettings() const { return false; }
virtual IFrameworkSettings *createFrameworkSettings() const { return nullptr; }
- virtual ITestSettingsPage *createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const
+ virtual Core::IOptionsPage *createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const
{
Q_UNUSED(settings)
return nullptr;
@@ -66,6 +67,8 @@ public:
return m_testParser;
}
+ Core::Id settingsId() const;
+
bool active() const { return m_active; }
void setActive(bool active) { m_active = active; }
bool grouping() const { return m_grouping; }
diff --git a/src/plugins/autotest/itestsettingspage.h b/src/plugins/autotest/itestsettingspage.h
deleted file mode 100644
index c985efca61..0000000000
--- a/src/plugins/autotest/itestsettingspage.h
+++ /dev/null
@@ -1,66 +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 "autotestconstants.h"
-#include "itestframework.h"
-
-#include <coreplugin/dialogs/ioptionspage.h>
-
-namespace Autotest {
-
-class IFrameworkSettings;
-
-class ITestSettingsPage : public Core::IOptionsPage
-{
-public:
- explicit ITestSettingsPage(const ITestFramework *framework)
- {
- setId(Core::Id(Constants::SETTINGSPAGE_PREFIX).withSuffix(
- QString("%1.%2").arg(framework->priority()).arg(QLatin1String(framework->name()))));
- setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY);
- }
-
- void finish() override {}
-
-private:
- void setId(Core::Id id)
- {
- Core::IOptionsPage::setId(id);
- }
-
- void setCategory(Core::Id category)
- {
- Core::IOptionsPage::setCategory(category);
- }
-
- void setDisplayCategory(const QString &displayCategory)
- {
- Core::IOptionsPage::setDisplayCategory(displayCategory);
- }
-};
-
-} // namespace Autotest
diff --git a/src/plugins/autotest/qtest/qttestframework.cpp b/src/plugins/autotest/qtest/qttestframework.cpp
index 25250e83bc..bbf42a844a 100644
--- a/src/plugins/autotest/qtest/qttestframework.cpp
+++ b/src/plugins/autotest/qtest/qttestframework.cpp
@@ -51,9 +51,9 @@ IFrameworkSettings *QtTestFramework::createFrameworkSettings() const
return new QtTestSettings;
}
-ITestSettingsPage *QtTestFramework::createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const
+Core::IOptionsPage *QtTestFramework::createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const
{
- return new QtTestSettingsPage(settings, this);
+ return new QtTestSettingsPage(settings, settingsId());
}
bool QtTestFramework::hasFrameworkSettings() const
diff --git a/src/plugins/autotest/qtest/qttestframework.h b/src/plugins/autotest/qtest/qttestframework.h
index e9a181591f..a6cfcb9f2a 100644
--- a/src/plugins/autotest/qtest/qttestframework.h
+++ b/src/plugins/autotest/qtest/qttestframework.h
@@ -37,7 +37,7 @@ public:
const char *name() const override;
unsigned priority() const override;
IFrameworkSettings *createFrameworkSettings() const override;
- ITestSettingsPage *createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const override;
+ Core::IOptionsPage *createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const override;
bool hasFrameworkSettings() const override;
protected:
diff --git a/src/plugins/autotest/qtest/qttestsettingspage.cpp b/src/plugins/autotest/qtest/qttestsettingspage.cpp
index 220b8c091e..17c580c4ec 100644
--- a/src/plugins/autotest/qtest/qttestsettingspage.cpp
+++ b/src/plugins/autotest/qtest/qttestsettingspage.cpp
@@ -102,9 +102,10 @@ void QtTestSettingsWidget::apply()
}
QtTestSettingsPage::QtTestSettingsPage(QSharedPointer<IFrameworkSettings> settings,
- const ITestFramework *framework)
- : ITestSettingsPage(framework)
+ Core::Id settingsId)
{
+ setId(settingsId);
+ setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY);
setDisplayName(QCoreApplication::translate("QtTestFramework",
QtTest::Constants::FRAMEWORK_SETTINGS_CATEGORY));
setWidgetCreator([settings] {
diff --git a/src/plugins/autotest/qtest/qttestsettingspage.h b/src/plugins/autotest/qtest/qttestsettingspage.h
index 4033878d33..6818ea441c 100644
--- a/src/plugins/autotest/qtest/qttestsettingspage.h
+++ b/src/plugins/autotest/qtest/qttestsettingspage.h
@@ -25,7 +25,7 @@
#pragma once
-#include "../itestsettingspage.h"
+#include <coreplugin/dialogs/ioptionspage.h>
namespace Autotest {
@@ -33,10 +33,10 @@ class IFrameworkSettings;
namespace Internal {
-class QtTestSettingsPage final : public ITestSettingsPage
+class QtTestSettingsPage final : public Core::IOptionsPage
{
public:
- QtTestSettingsPage(QSharedPointer<IFrameworkSettings> settings, const ITestFramework *framework);
+ QtTestSettingsPage(QSharedPointer<IFrameworkSettings> settings, Core::Id settingsId);
};
} // namespace Internal
diff --git a/src/plugins/autotest/testframeworkmanager.cpp b/src/plugins/autotest/testframeworkmanager.cpp
index c6233d6026..43eb59d847 100644
--- a/src/plugins/autotest/testframeworkmanager.cpp
+++ b/src/plugins/autotest/testframeworkmanager.cpp
@@ -28,12 +28,13 @@
#include "autotestplugin.h"
#include "iframeworksettings.h"
#include "itestparser.h"
-#include "itestsettingspage.h"
#include "testrunner.h"
#include "testsettings.h"
#include "testtreeitem.h"
#include "testtreemodel.h"
+#include <coreplugin/dialogs/ioptionspage.h>
+
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
@@ -218,4 +219,10 @@ unsigned TestFrameworkManager::priority(const Id &frameworkId) const
return unsigned(-1);
}
+Id ITestFramework::settingsId() const
+{
+ return Core::Id(Constants::SETTINGSPAGE_PREFIX)
+ .withSuffix(QString("%1.%2").arg(priority()).arg(QLatin1String(name())));
+}
+
} // namespace Autotest
diff --git a/src/plugins/autotest/testframeworkmanager.h b/src/plugins/autotest/testframeworkmanager.h
index 9d1c81079e..fd0c4bea47 100644
--- a/src/plugins/autotest/testframeworkmanager.h
+++ b/src/plugins/autotest/testframeworkmanager.h
@@ -44,12 +44,10 @@ namespace Internal {
class TestRunner;
struct TestSettings;
-
}
class IFrameworkSettings;
class ITestParser;
-class ITestSettingsPage;
class TestTreeModel;
class TestFrameworkManager
@@ -80,7 +78,7 @@ private:
explicit TestFrameworkManager();
QHash<Core::Id, ITestFramework *> m_registeredFrameworks;
QHash<Core::Id, QSharedPointer<IFrameworkSettings> > m_frameworkSettings;
- QVector<ITestSettingsPage *> m_frameworkSettingsPages;
+ QVector<Core::IOptionsPage *> m_frameworkSettingsPages;
TestTreeModel *m_testTreeModel;
Internal::TestRunner *m_testRunner;