summaryrefslogtreecommitdiff
path: root/src/plugins/autotest
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2018-02-01 09:17:56 +0100
committerhjk <hjk@qt.io>2018-02-01 09:51:54 +0000
commit0bd6f712f0658e1685a074523d8b289e63935f1d (patch)
treeae7d4be249dd9ac5582ae00c73dfa24a2c576b09 /src/plugins/autotest
parent56fbeb8a68bd3cf3bcbd3a3c3fdd0a5b66f90e3e (diff)
downloadqt-creator-0bd6f712f0658e1685a074523d8b289e63935f1d.tar.gz
AutoTest: Access plugin singleton through static functions
It's the more common pattern nowadays, and cheaper. Change-Id: If6217b2a820fbfa6f088fd9349225f5f8488f593 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/autotest')
-rw-r--r--src/plugins/autotest/autotestplugin.cpp9
-rw-r--r--src/plugins/autotest/autotestplugin.h8
-rw-r--r--src/plugins/autotest/gtest/gtestconfiguration.cpp2
-rw-r--r--src/plugins/autotest/qtest/qttestconfiguration.cpp2
-rw-r--r--src/plugins/autotest/quick/quicktestconfiguration.cpp2
-rw-r--r--src/plugins/autotest/testcodeparser.cpp2
-rw-r--r--src/plugins/autotest/testframeworkmanager.cpp2
-rw-r--r--src/plugins/autotest/testresultdelegate.cpp6
-rw-r--r--src/plugins/autotest/testresultspane.cpp8
-rw-r--r--src/plugins/autotest/testrunner.cpp2
10 files changed, 17 insertions, 26 deletions
diff --git a/src/plugins/autotest/autotestplugin.cpp b/src/plugins/autotest/autotestplugin.cpp
index 7eaef33f92..46defa4a57 100644
--- a/src/plugins/autotest/autotestplugin.cpp
+++ b/src/plugins/autotest/autotestplugin.cpp
@@ -87,14 +87,9 @@ AutotestPlugin::~AutotestPlugin()
delete m_frameworkManager;
}
-AutotestPlugin *AutotestPlugin::instance()
+QSharedPointer<TestSettings> AutotestPlugin::settings()
{
- return s_instance;
-}
-
-QSharedPointer<TestSettings> AutotestPlugin::settings() const
-{
- return m_settings;
+ return s_instance->m_settings;
}
void AutotestPlugin::initializeMenuEntries()
diff --git a/src/plugins/autotest/autotestplugin.h b/src/plugins/autotest/autotestplugin.h
index 3f375dcd2e..a1f0d3b83e 100644
--- a/src/plugins/autotest/autotestplugin.h
+++ b/src/plugins/autotest/autotestplugin.h
@@ -47,14 +47,12 @@ public:
AutotestPlugin();
~AutotestPlugin();
- static AutotestPlugin *instance();
-
- QSharedPointer<TestSettings> settings() const;
-
bool initialize(const QStringList &arguments, QString *errorString) override;
void extensionsInitialized() override;
ShutdownFlag aboutToShutdown() override;
- void updateMenuItemsEnabledState();
+
+ static QSharedPointer<TestSettings> settings();
+ static void updateMenuItemsEnabledState();
private:
bool checkLicense();
diff --git a/src/plugins/autotest/gtest/gtestconfiguration.cpp b/src/plugins/autotest/gtest/gtestconfiguration.cpp
index 3e146f2db7..7754a85493 100644
--- a/src/plugins/autotest/gtest/gtestconfiguration.cpp
+++ b/src/plugins/autotest/gtest/gtestconfiguration.cpp
@@ -77,7 +77,7 @@ QStringList GTestConfiguration::argumentsForTestRunner(QStringList *omitted) con
= Core::Id(Constants::FRAMEWORK_PREFIX).withSuffix(GTest::Constants::FRAMEWORK_NAME);
QStringList arguments;
- if (AutotestPlugin::instance()->settings()->processArgs) {
+ if (AutotestPlugin::settings()->processArgs) {
arguments << filterInterfering(runnable().commandLineArguments.split(
' ', QString::SkipEmptyParts), omitted);
}
diff --git a/src/plugins/autotest/qtest/qttestconfiguration.cpp b/src/plugins/autotest/qtest/qttestconfiguration.cpp
index 976e14aee2..b79d3a72b4 100644
--- a/src/plugins/autotest/qtest/qttestconfiguration.cpp
+++ b/src/plugins/autotest/qtest/qttestconfiguration.cpp
@@ -60,7 +60,7 @@ QStringList QtTestConfiguration::argumentsForTestRunner(QStringList *omitted) co
= Core::Id(Constants::FRAMEWORK_PREFIX).withSuffix(QtTest::Constants::FRAMEWORK_NAME);
QStringList arguments;
- if (AutotestPlugin::instance()->settings()->processArgs) {
+ if (AutotestPlugin::settings()->processArgs) {
arguments.append(QTestUtils::filterInterfering(
runnable().commandLineArguments.split(' ', QString::SkipEmptyParts),
omitted, false));
diff --git a/src/plugins/autotest/quick/quicktestconfiguration.cpp b/src/plugins/autotest/quick/quicktestconfiguration.cpp
index 43bfe560b6..9503e4cbb0 100644
--- a/src/plugins/autotest/quick/quicktestconfiguration.cpp
+++ b/src/plugins/autotest/quick/quicktestconfiguration.cpp
@@ -64,7 +64,7 @@ QStringList QuickTestConfiguration::argumentsForTestRunner(QStringList *omitted)
= Core::Id(Constants::FRAMEWORK_PREFIX).withSuffix(QtTest::Constants::FRAMEWORK_NAME);
QStringList arguments;
- if (AutotestPlugin::instance()->settings()->processArgs) {
+ if (AutotestPlugin::settings()->processArgs) {
arguments.append(QTestUtils::filterInterfering
(runnable().commandLineArguments.split(' ', QString::SkipEmptyParts),
omitted, true));
diff --git a/src/plugins/autotest/testcodeparser.cpp b/src/plugins/autotest/testcodeparser.cpp
index 6ebc559597..611bdd0333 100644
--- a/src/plugins/autotest/testcodeparser.cpp
+++ b/src/plugins/autotest/testcodeparser.cpp
@@ -174,7 +174,7 @@ void TestCodeParser::updateTestTree(ITestParser *parser)
static QStringList filterFiles(const QString &projectDir, const QStringList &files)
{
- const QSharedPointer<TestSettings> &settings = AutotestPlugin::instance()->settings();
+ const QSharedPointer<TestSettings> &settings = AutotestPlugin::settings();
const QSet<QString> &filters = settings->whiteListFilters.toSet(); // avoid duplicates
if (!settings->filterScan || filters.isEmpty())
return files;
diff --git a/src/plugins/autotest/testframeworkmanager.cpp b/src/plugins/autotest/testframeworkmanager.cpp
index bb86f1e4ba..0d8b5a723e 100644
--- a/src/plugins/autotest/testframeworkmanager.cpp
+++ b/src/plugins/autotest/testframeworkmanager.cpp
@@ -168,7 +168,7 @@ QSharedPointer<IFrameworkSettings> TestFrameworkManager::settingsForTestFramewor
void TestFrameworkManager::synchronizeSettings(QSettings *s)
{
- AutotestPlugin::instance()->settings()->fromSettings(s);
+ AutotestPlugin::settings()->fromSettings(s);
for (const Core::Id &id : m_frameworkSettings.keys()) {
QSharedPointer<IFrameworkSettings> fSettings = settingsForTestFramework(id);
if (!fSettings.isNull())
diff --git a/src/plugins/autotest/testresultdelegate.cpp b/src/plugins/autotest/testresultdelegate.cpp
index 6840394831..076adbc3aa 100644
--- a/src/plugins/autotest/testresultdelegate.cpp
+++ b/src/plugins/autotest/testresultdelegate.cpp
@@ -105,8 +105,7 @@ void TestResultDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
if (selected) {
output.replace('\n', QChar::LineSeparator);
- if (AutotestPlugin::instance()->settings()->limitResultOutput
- && output.length() > outputLimit)
+ if (AutotestPlugin::settings()->limitResultOutput && output.length() > outputLimit)
output = output.left(outputLimit).append("...");
recalculateTextLayout(index, output, painter->font(), positions.textAreaWidth());
@@ -163,8 +162,7 @@ QSize TestResultDelegate::sizeHint(const QStyleOptionViewItem &option, const QMo
QString output = testResult->outputString(selected);
output.replace('\n', QChar::LineSeparator);
- if (AutotestPlugin::instance()->settings()->limitResultOutput
- && output.length() > outputLimit)
+ if (AutotestPlugin::settings()->limitResultOutput && output.length() > outputLimit)
output = output.left(outputLimit).append("...");
recalculateTextLayout(index, output, opt.font, positions.textAreaWidth());
diff --git a/src/plugins/autotest/testresultspane.cpp b/src/plugins/autotest/testresultspane.cpp
index cbe0a61ead..cfdc4b4ba0 100644
--- a/src/plugins/autotest/testresultspane.cpp
+++ b/src/plugins/autotest/testresultspane.cpp
@@ -268,7 +268,7 @@ void TestResultsPane::clearContents()
setIconBadgeNumber(0);
navigateStateChanged();
m_summaryWidget->setVisible(false);
- m_autoScroll = AutotestPlugin::instance()->settings()->autoScroll;
+ m_autoScroll = AutotestPlugin::settings()->autoScroll;
connect(m_treeView->verticalScrollBar(), &QScrollBar::rangeChanged,
this, &TestResultsPane::onScrollBarRangeChanged, Qt::UniqueConnection);
m_textOutput->clear();
@@ -413,7 +413,7 @@ void TestResultsPane::onRunSelectedTriggered()
void TestResultsPane::initializeFilterMenu()
{
- const bool omitIntern = AutotestPlugin::instance()->settings()->omitInternalMssg;
+ const bool omitIntern = AutotestPlugin::settings()->omitInternalMssg;
// FilterModel has all messages enabled by default
if (omitIntern)
m_filterModel->toggleTestResultType(Result::MessageInternal);
@@ -490,7 +490,7 @@ void TestResultsPane::onTestRunStarted()
{
m_testRunning = true;
m_stopTestRun->setEnabled(true);
- AutotestPlugin::instance()->updateMenuItemsEnabledState();
+ AutotestPlugin::updateMenuItemsEnabledState();
m_summaryWidget->setVisible(false);
}
@@ -499,7 +499,7 @@ void TestResultsPane::onTestRunFinished()
m_testRunning = false;
m_stopTestRun->setEnabled(false);
- AutotestPlugin::instance()->updateMenuItemsEnabledState();
+ AutotestPlugin::updateMenuItemsEnabledState();
updateSummaryLabel();
m_summaryWidget->setVisible(true);
m_model->removeCurrentTestMessage();
diff --git a/src/plugins/autotest/testrunner.cpp b/src/plugins/autotest/testrunner.cpp
index 828a9700c8..5d74ec9f62 100644
--- a/src/plugins/autotest/testrunner.cpp
+++ b/src/plugins/autotest/testrunner.cpp
@@ -393,7 +393,7 @@ void TestRunner::runTests()
}
QFuture<TestResultPtr> future = Utils::runAsync(&performTestRun, m_selectedTests,
- *AutotestPlugin::instance()->settings());
+ *AutotestPlugin::settings());
m_futureWatcher.setFuture(future);
Core::ProgressManager::addTask(future, tr("Running Tests"), Autotest::Constants::TASK_INDEX);
}