From bbc656f3d37da9bb4bfe74a57c8e17b035fbd0ec Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Wed, 13 May 2015 16:34:24 +0200 Subject: Add further settings for Squish Change-Id: I9b297a8c7fdf3634676bd84479f2b6fd210e0d3f Reviewed-by: Christian Stenger --- plugins/autotest/squishsettings.cpp | 22 ++++++- plugins/autotest/squishsettings.h | 6 ++ plugins/autotest/squishsettingspage.cpp | 19 ++++++ plugins/autotest/squishsettingspage.h | 2 + plugins/autotest/squishsettingspage.ui | 108 ++++++++++++++++++++++++++------ 5 files changed, 136 insertions(+), 21 deletions(-) (limited to 'plugins') diff --git a/plugins/autotest/squishsettings.cpp b/plugins/autotest/squishsettings.cpp index 182945c899..db981ce34a 100644 --- a/plugins/autotest/squishsettings.cpp +++ b/plugins/autotest/squishsettings.cpp @@ -26,11 +26,21 @@ namespace Internal { static const char group[] = "Squish"; static const char squishPathKey[] = "SquishPath"; +static const char licensePathKey[] = "LicensePath"; +static const char localKey[] = "Local"; +static const char serverHostKey[] = "ServerHost"; +static const char serverPortKey[] = "ServerPort"; +static const char verboseKey[] = "Verbose"; void SquishSettings::toSettings(QSettings *s) const { s->beginGroup(QLatin1String(group)); s->setValue(QLatin1String(squishPathKey), squishPath.toString()); + s->setValue(QLatin1String(licensePathKey), licensePath.toString()); + s->setValue(QLatin1String(localKey), local); + s->setValue(QLatin1String(serverHostKey), serverHost); + s->setValue(QLatin1String(serverPortKey), serverPort); + s->setValue(QLatin1String(verboseKey), verbose); s->endGroup(); } @@ -38,11 +48,21 @@ void SquishSettings::fromSettings(const QSettings *s) { const QString root = QLatin1String(group) + QLatin1Char('/'); squishPath = Utils::FileName::fromString(s->value(root + QLatin1String(squishPathKey)).toString()); + licensePath = Utils::FileName::fromString(s->value(root + QLatin1String(licensePathKey)).toString()); + local = s->value(root + QLatin1String(localKey), true).toBool(); + serverHost = s->value(root + QLatin1String(serverHostKey), QStringLiteral("localhost")).toString(); + serverPort = s->value(root + QLatin1String(serverPortKey), 9999).toUInt(); + verbose = s->value(root + QLatin1String(verboseKey), false).toBool(); } bool SquishSettings::operator==(const SquishSettings &other) const { - return squishPath == other.squishPath; + return local == other.local + && verbose == other.verbose + && serverPort == other.serverPort + && squishPath == other.squishPath + && licensePath == other.licensePath + && serverHost == other.serverHost; } bool SquishSettings::operator!=(const SquishSettings &other) const diff --git a/plugins/autotest/squishsettings.h b/plugins/autotest/squishsettings.h index 571636e767..5c11e1793c 100644 --- a/plugins/autotest/squishsettings.h +++ b/plugins/autotest/squishsettings.h @@ -23,6 +23,7 @@ #include #include +#include QT_BEGIN_NAMESPACE class QSettings; @@ -40,6 +41,11 @@ struct SquishSettings bool operator!=(const SquishSettings &other) const; Utils::FileName squishPath; + Utils::FileName licensePath; + QString serverHost; + quint16 serverPort; + bool local; + bool verbose; }; diff --git a/plugins/autotest/squishsettingspage.cpp b/plugins/autotest/squishsettingspage.cpp index 4c94dd5fb7..9325e928e6 100644 --- a/plugins/autotest/squishsettingspage.cpp +++ b/plugins/autotest/squishsettingspage.cpp @@ -31,20 +31,39 @@ SquishSettingsWidget::SquishSettingsWidget(QWidget *parent) : QWidget(parent) { m_ui.setupUi(this); + + connect(m_ui.localCheckBox, &QCheckBox::toggled, + this, &SquishSettingsWidget::onLocalToggled); } void SquishSettingsWidget::setSettings(const SquishSettings &settings) { m_ui.squishPathChooser->setFileName(settings.squishPath); + m_ui.licensePathChooser->setFileName(settings.licensePath); + m_ui.localCheckBox->setChecked(settings.local); + m_ui.serverHostLineEdit->setText(settings.serverHost); + m_ui.serverPortSpinBox->setValue(settings.serverPort); + m_ui.verboseCheckBox->setChecked(settings.verbose); } SquishSettings SquishSettingsWidget::settings() const { SquishSettings result; result.squishPath = m_ui.squishPathChooser->fileName(); + result.licensePath = m_ui.licensePathChooser->fileName(); + result.local = m_ui.localCheckBox->checkState() == Qt::Checked; + result.serverHost = m_ui.serverHostLineEdit->text(); + result.serverPort = m_ui.serverPortSpinBox->value(); + result.verbose = m_ui.verboseCheckBox->checkState() == Qt::Checked; return result; } +void SquishSettingsWidget::onLocalToggled(bool checked) +{ + m_ui.serverHostLineEdit->setEnabled(!checked); + m_ui.serverPortSpinBox->setEnabled(!checked); +} + SquishSettingsPage::SquishSettingsPage(const QSharedPointer &settings) : m_settings(settings), m_widget(0) { diff --git a/plugins/autotest/squishsettingspage.h b/plugins/autotest/squishsettingspage.h index b15c39ef00..2685012485 100644 --- a/plugins/autotest/squishsettingspage.h +++ b/plugins/autotest/squishsettingspage.h @@ -43,6 +43,8 @@ public: SquishSettings settings() const; private: + void onLocalToggled(bool checked); + Ui::SquishSettingsPage m_ui; }; diff --git a/plugins/autotest/squishsettingspage.ui b/plugins/autotest/squishsettingspage.ui index 5dd82dc97e..08fbe72ee5 100644 --- a/plugins/autotest/squishsettingspage.ui +++ b/plugins/autotest/squishsettingspage.ui @@ -13,26 +13,93 @@ Form - - - - - - - Squish path: - - - - - - - Path to Squish installation directory. - - - - - - + + + + + Squish path: + + + + + + + Path to Squish installation directory. + + + + + + + License path: + + + + + + + Path to directory containing Squish license file. You will only need this in special configurations like if you did not run the Squish setup tool. + + + + + + + + 0 + 0 + + + + Local server + + + + + + + Server host: + + + + + + + + 0 + 0 + + + + + + + + Port: + + + + + + + + 0 + 0 + + + + 65535 + + + + + + + Verbose log + + + + Qt::Vertical @@ -52,6 +119,7 @@ Utils::PathChooser QLineEdit
utils/pathchooser.h
+ 1 -- cgit v1.2.1