summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Loehning <robert.loehning@theqtcompany.com>2015-05-11 15:06:33 +0200
committerRobert Loehning <robert.loehning@theqtcompany.com>2015-05-11 16:20:53 +0300
commit67682f01a7e06416ac5986f15e5b9a662ee8bf14 (patch)
treee26f90c59d89b16cfcac6b1abf4d25ea9a9e67d1
parent76a631f3f8ca22fcccac70fc642dbef5fce92361 (diff)
downloadqt-creator-67682f01a7e06416ac5986f15e5b9a662ee8bf14.tar.gz
Add settings page for Squish tests
Change-Id: I665b0d33c6da415578ec8f145926e4a770b64916 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
-rw-r--r--plugins/autotest/autotest.pro5
-rw-r--r--plugins/autotest/autotest.qbs5
-rw-r--r--plugins/autotest/autotestplugin.cpp19
-rw-r--r--plugins/autotest/autotestplugin.h7
-rw-r--r--plugins/autotest/squishsettings.cpp50
-rw-r--r--plugins/autotest/squishsettings.h45
-rw-r--r--plugins/autotest/squishsettingspage.cpp75
-rw-r--r--plugins/autotest/squishsettingspage.h68
-rw-r--r--plugins/autotest/squishsettingspage.ui18
-rw-r--r--plugins/autotest/testresultdelegate.cpp4
-rw-r--r--plugins/autotest/testresultspane.cpp2
-rw-r--r--plugins/autotest/testrunner.cpp2
-rw-r--r--plugins/autotest/testsettings.cpp2
-rw-r--r--plugins/autotest/testsettingspage.cpp4
-rw-r--r--plugins/autotest/testsettingspage.h1
15 files changed, 293 insertions, 14 deletions
diff --git a/plugins/autotest/autotest.pro b/plugins/autotest/autotest.pro
index 9b9c7a8a01..b60a83f656 100644
--- a/plugins/autotest/autotest.pro
+++ b/plugins/autotest/autotest.pro
@@ -9,6 +9,8 @@ include(autotest_dependencies.pri)
DEFINES += AUTOTEST_LIBRARY
SOURCES += \
+ squishsettings.cpp \
+ squishsettingspage.cpp \
testtreeview.cpp \
testtreemodel.cpp \
testtreeitem.cpp \
@@ -32,6 +34,8 @@ SOURCES += \
testsquishutils.cpp
HEADERS += \
+ squishsettings.h \
+ squishsettingspage.h \
testtreeview.h \
testtreemodel.h \
testtreeitem.h \
@@ -60,6 +64,7 @@ RESOURCES += \
autotest.qrc
FORMS += \
+ squishsettingspage.ui \
testsettingspage.ui \
opensquishsuitesdialog.ui
diff --git a/plugins/autotest/autotest.qbs b/plugins/autotest/autotest.qbs
index a9f17682a3..09581cfdee 100644
--- a/plugins/autotest/autotest.qbs
+++ b/plugins/autotest/autotest.qbs
@@ -31,6 +31,11 @@ QtcPlugin {
"autotestconstants.h",
"autotestplugin.cpp",
"autotestplugin.h",
+ "squishsettings.cpp",
+ "squishsettings.h",
+ "squishsettingspage.cpp",
+ "squishsettingspage.h",
+ "squishsettingspage.ui",
"testcodeparser.cpp",
"testcodeparser.h",
"testconfiguration.cpp",
diff --git a/plugins/autotest/autotestplugin.cpp b/plugins/autotest/autotestplugin.cpp
index a2ab783418..6992166c6b 100644
--- a/plugins/autotest/autotestplugin.cpp
+++ b/plugins/autotest/autotestplugin.cpp
@@ -19,6 +19,8 @@
#include "autotestplugin.h"
#include "autotestconstants.h"
+#include "squishsettings.h"
+#include "squishsettingspage.h"
#include "testcodeparser.h"
#include "testrunner.h"
#include "testsettings.h"
@@ -57,7 +59,7 @@ using namespace Core;
static AutotestPlugin *m_instance = 0;
AutotestPlugin::AutotestPlugin()
- : m_settings(new TestSettings)
+ : m_qtestSettings(new TestSettings), m_squishSettings(new SquishSettings)
{
// needed to be used in QueuedConnection connects
qRegisterMetaType<TestResult>();
@@ -82,9 +84,14 @@ AutotestPlugin *AutotestPlugin::instance()
return m_instance;
}
-QSharedPointer<TestSettings> AutotestPlugin::settings() const
+QSharedPointer<TestSettings> AutotestPlugin::qtestSettings() const
{
- return m_settings;
+ return m_qtestSettings;
+}
+
+QSharedPointer<SquishSettings> AutotestPlugin::squishSettings() const
+{
+ return m_squishSettings;
}
bool AutotestPlugin::checkLicense()
@@ -142,8 +149,10 @@ bool AutotestPlugin::initialize(const QStringList &arguments, QString *errorStri
initializeMenuEntries();
- m_settings->fromSettings(ICore::settings());
- addAutoReleasedObject(new TestSettingsPage(m_settings));
+ m_qtestSettings->fromSettings(ICore::settings());
+ m_squishSettings->fromSettings(ICore::settings());
+ addAutoReleasedObject(new TestSettingsPage(m_qtestSettings));
+ addAutoReleasedObject(new SquishSettingsPage(m_squishSettings));
addAutoReleasedObject(new TestNavigationWidgetFactory);
addAutoReleasedObject(TestResultsPane::instance());
diff --git a/plugins/autotest/autotestplugin.h b/plugins/autotest/autotestplugin.h
index b7a02d89e7..ad6a2b9a2a 100644
--- a/plugins/autotest/autotestplugin.h
+++ b/plugins/autotest/autotestplugin.h
@@ -28,6 +28,7 @@ namespace Autotest {
namespace Internal {
struct TestSettings;
+struct SquishSettings;
class AutotestPlugin : public ExtensionSystem::IPlugin
{
@@ -40,7 +41,8 @@ public:
static AutotestPlugin *instance();
- QSharedPointer<TestSettings> settings() const;
+ QSharedPointer<TestSettings> qtestSettings() const;
+ QSharedPointer<SquishSettings> squishSettings() const;
bool initialize(const QStringList &arguments, QString *errorString);
void extensionsInitialized();
@@ -53,7 +55,8 @@ private:
void onRunSelectedTriggered();
void updateMenuItemsEnabledState();
QList<QObject *> createTestObjects() const;
- const QSharedPointer<TestSettings> m_settings;
+ const QSharedPointer<TestSettings> m_qtestSettings;
+ const QSharedPointer<SquishSettings> m_squishSettings;
};
} // namespace Internal
diff --git a/plugins/autotest/squishsettings.cpp b/plugins/autotest/squishsettings.cpp
new file mode 100644
index 0000000000..c66a30d16d
--- /dev/null
+++ b/plugins/autotest/squishsettings.cpp
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd
+** All rights reserved.
+** For any questions to The Qt Company, please use contact form at
+** http://www.qt.io/contact-us
+**
+** This file is part of the Qt Creator Enterprise Auto Test Add-on.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://www.qt.io/contact-us
+**
+****************************************************************************/
+
+#include "squishsettings.h"
+
+#include <QSettings>
+
+namespace Autotest {
+namespace Internal {
+
+static const char group[] = "Squish";
+
+void SquishSettings::toSettings(QSettings *s) const
+{
+ s->beginGroup(QLatin1String(group));
+ s->endGroup();
+}
+
+void SquishSettings::fromSettings(const QSettings *s)
+{
+}
+
+bool SquishSettings::operator==(const SquishSettings &other) const
+{
+ return true;
+}
+
+bool SquishSettings::operator!=(const SquishSettings &other) const
+{
+ return !(*this == other);
+}
+
+} // namespace Internal
+} // namespace Autotest
diff --git a/plugins/autotest/squishsettings.h b/plugins/autotest/squishsettings.h
new file mode 100644
index 0000000000..0764735855
--- /dev/null
+++ b/plugins/autotest/squishsettings.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd
+** All rights reserved.
+** For any questions to The Qt Company, please use contact form at
+** http://www.qt.io/contact-us
+**
+** This file is part of the Qt Creator Enterprise Auto Test Add-on.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://www.qt.io/contact-us
+**
+****************************************************************************/
+
+#ifndef SQUISHSETTINGS_H
+#define SQUISHSETTINGS_H
+
+#include <QtGlobal>
+
+QT_BEGIN_NAMESPACE
+class QSettings;
+QT_END_NAMESPACE
+
+namespace Autotest {
+namespace Internal {
+
+struct SquishSettings
+{
+ void toSettings(QSettings *s) const;
+ void fromSettings(const QSettings *s);
+
+ bool operator==(const SquishSettings &other) const;
+ bool operator!=(const SquishSettings &other) const;
+};
+
+
+} // namespace Internal
+} // namespace Autotest
+
+#endif // SQUISHSETTINGS_H
diff --git a/plugins/autotest/squishsettingspage.cpp b/plugins/autotest/squishsettingspage.cpp
new file mode 100644
index 0000000000..9c650c2c01
--- /dev/null
+++ b/plugins/autotest/squishsettingspage.cpp
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd
+** All rights reserved.
+** For any questions to The Qt Company, please use contact form at
+** http://www.qt.io/contact-us
+**
+** This file is part of the Qt Creator Enterprise Auto Test Add-on.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://www.qt.io/contact-us
+**
+****************************************************************************/
+
+#include "autotestconstants.h"
+#include "squishsettingspage.h"
+#include "squishsettings.h"
+
+#include <coreplugin/icore.h>
+#include <utils/hostosinfo.h>
+
+namespace Autotest {
+namespace Internal {
+
+SquishSettingsWidget::SquishSettingsWidget(QWidget *parent)
+ : QWidget(parent)
+{
+ m_ui.setupUi(this);
+}
+
+void SquishSettingsWidget::setSettings(const SquishSettings &settings)
+{
+}
+
+SquishSettings SquishSettingsWidget::settings() const
+{
+ SquishSettings result;
+ return result;
+}
+
+SquishSettingsPage::SquishSettingsPage(const QSharedPointer<SquishSettings> &settings)
+ : m_settings(settings), m_widget(0)
+{
+ setId("B.Squish");
+ setDisplayName(tr("Squish"));
+ setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY);
+}
+
+QWidget *SquishSettingsPage::widget()
+{
+ if (!m_widget) {
+ m_widget = new SquishSettingsWidget;
+ m_widget->setSettings(*m_settings);
+ }
+ return m_widget;
+}
+
+void SquishSettingsPage::apply()
+{
+ if (!m_widget) // page was not shown at all
+ return;
+ const SquishSettings newSettings = m_widget->settings();
+ if (newSettings != *m_settings) {
+ *m_settings = newSettings;
+ m_settings->toSettings(Core::ICore::settings());
+ }
+}
+
+} // namespace Internal
+} // namespace Autotest
diff --git a/plugins/autotest/squishsettingspage.h b/plugins/autotest/squishsettingspage.h
new file mode 100644
index 0000000000..b15c39ef00
--- /dev/null
+++ b/plugins/autotest/squishsettingspage.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd
+** All rights reserved.
+** For any questions to The Qt Company, please use contact form at
+** http://www.qt.io/contact-us
+**
+** This file is part of the Qt Creator Enterprise Auto Test Add-on.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://www.qt.io/contact-us
+**
+****************************************************************************/
+
+#ifndef SQUISHSETTINGSPAGE_H
+#define SQUISHSETTINGSPAGE_H
+
+#include "ui_squishsettingspage.h"
+
+#include <coreplugin/dialogs/ioptionspage.h>
+
+#include <QPointer>
+#include <QSharedPointer>
+#include <QWidget>
+
+namespace Autotest {
+namespace Internal {
+
+struct SquishSettings;
+
+class SquishSettingsWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit SquishSettingsWidget(QWidget *parent = 0);
+
+ void setSettings(const SquishSettings &settings);
+ SquishSettings settings() const;
+
+private:
+ Ui::SquishSettingsPage m_ui;
+
+};
+
+class SquishSettingsPage : public Core::IOptionsPage
+{
+ Q_OBJECT
+public:
+ explicit SquishSettingsPage(const QSharedPointer<SquishSettings> &settings);
+
+ QWidget *widget();
+ void apply();
+ void finish() { }
+
+private:
+ QSharedPointer<SquishSettings> m_settings;
+ QPointer<SquishSettingsWidget> m_widget;
+};
+
+} // namespace Internal
+} // namespace Autotest
+
+#endif // SQUISHSETTINGSPAGE_H
diff --git a/plugins/autotest/squishsettingspage.ui b/plugins/autotest/squishsettingspage.ui
new file mode 100644
index 0000000000..626137663a
--- /dev/null
+++ b/plugins/autotest/squishsettingspage.ui
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Autotest::Internal::SquishSettingsPage</class>
+ <widget class="QWidget" name="Autotest::Internal::SquishSettingsPage">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>463</width>
+ <height>338</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ </widget>
+ <connections/>
+</ui>
diff --git a/plugins/autotest/testresultdelegate.cpp b/plugins/autotest/testresultdelegate.cpp
index c20ce11200..0eedd68eef 100644
--- a/plugins/autotest/testresultdelegate.cpp
+++ b/plugins/autotest/testresultdelegate.cpp
@@ -131,7 +131,7 @@ void TestResultDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
int fontHeight = fm.height();
output.replace(QLatin1Char('\n'), QChar::LineSeparator);
- if (AutotestPlugin::instance()->settings()->limitResultOutput
+ if (AutotestPlugin::instance()->qtestSettings()->limitResultOutput
&& output.length() > outputLimit)
output = output.left(outputLimit).append(QLatin1String("..."));
@@ -237,7 +237,7 @@ QSize TestResultDelegate::sizeHint(const QStyleOptionViewItem &option, const QMo
int height = 0;
int leading = fm.leading();
- if (AutotestPlugin::instance()->settings()->limitResultOutput
+ if (AutotestPlugin::instance()->qtestSettings()->limitResultOutput
&& output.length() > outputLimit)
output = output.left(outputLimit).append(QLatin1String("..."));
diff --git a/plugins/autotest/testresultspane.cpp b/plugins/autotest/testresultspane.cpp
index e53af910da..149d988a19 100644
--- a/plugins/autotest/testresultspane.cpp
+++ b/plugins/autotest/testresultspane.cpp
@@ -291,7 +291,7 @@ void TestResultsPane::onRunSelectedTriggered()
void TestResultsPane::initializeFilterMenu()
{
- const bool omitIntern = AutotestPlugin::instance()->settings()->omitInternalMssg;
+ const bool omitIntern = AutotestPlugin::instance()->qtestSettings()->omitInternalMssg;
// FilterModel has all messages enabled by default
if (omitIntern)
m_filterModel->toggleTestResultType(Result::MESSAGE_INTERNAL);
diff --git a/plugins/autotest/testrunner.cpp b/plugins/autotest/testrunner.cpp
index 07f90a56ad..368897a929 100644
--- a/plugins/autotest/testrunner.cpp
+++ b/plugins/autotest/testrunner.cpp
@@ -186,7 +186,7 @@ void performTestRun(QFutureInterface<void> &futureInterface,
void TestRunner::runTests()
{
- const QSharedPointer<TestSettings> settings = AutotestPlugin::instance()->settings();
+ const QSharedPointer<TestSettings> settings = AutotestPlugin::instance()->qtestSettings();
const int timeout = settings->timeout;
const QString metricsOption = TestSettings::metricsTypeToOption(settings->metrics);
const bool displayRunConfigWarnings = !settings->omitRunConfigWarn;
diff --git a/plugins/autotest/testsettings.cpp b/plugins/autotest/testsettings.cpp
index 3a11b8c66b..276c2c9a79 100644
--- a/plugins/autotest/testsettings.cpp
+++ b/plugins/autotest/testsettings.cpp
@@ -24,7 +24,7 @@
namespace Autotest {
namespace Internal {
-static const char group[] = "Autotest";
+static const char group[] = "QTest";
static const char timeoutKey[] = "Timeout";
static const char metricsKey[] = "Metrics";
static const char omitInternalKey[] = "OmitInternal";
diff --git a/plugins/autotest/testsettingspage.cpp b/plugins/autotest/testsettingspage.cpp
index e65bff754a..a0b218cb27 100644
--- a/plugins/autotest/testsettingspage.cpp
+++ b/plugins/autotest/testsettingspage.cpp
@@ -89,8 +89,8 @@ TestSettings TestSettingsWidget::settings() const
TestSettingsPage::TestSettingsPage(const QSharedPointer<TestSettings> &settings)
: m_settings(settings), m_widget(0)
{
- setId("A.General");
- setDisplayName(tr("General"));
+ setId("A.QTest");
+ setDisplayName(tr("QTest"));
setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY);
setDisplayCategory(tr("Test Settings"));
setCategoryIcon(QLatin1String(":/images/autotest.png"));
diff --git a/plugins/autotest/testsettingspage.h b/plugins/autotest/testsettingspage.h
index 3e98c8413d..61a8ea678a 100644
--- a/plugins/autotest/testsettingspage.h
+++ b/plugins/autotest/testsettingspage.h
@@ -25,6 +25,7 @@
#include <coreplugin/dialogs/ioptionspage.h>
#include <QPointer>
+#include <QSharedPointer>
namespace Autotest {
namespace Internal {