forked from qt-creator/qt-creator
Squish: Aspectify settings
Change-Id: I9861de1803adaf39fda9378a3169e99e37ad8695 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -18,7 +18,6 @@ add_qtc_plugin(Squish
|
||||
squishplugin.cpp squishplugin.h
|
||||
squishresultmodel.cpp squishresultmodel.h
|
||||
squishsettings.cpp squishsettings.h
|
||||
squishsettingspage.cpp squishsettingspage.h squishsettingspage.ui
|
||||
squishtesttreemodel.cpp squishtesttreemodel.h
|
||||
squishtesttreeview.cpp squishtesttreeview.h
|
||||
squishtools.cpp squishtools.h
|
||||
|
||||
@@ -16,9 +16,6 @@ QtcPlugin {
|
||||
"squishplugin.h",
|
||||
"squishsettings.cpp",
|
||||
"squishsettings.h",
|
||||
"squishsettingspage.cpp",
|
||||
"squishsettingspage.h",
|
||||
"squishsettingspage.ui",
|
||||
"squishnavigationwidget.cpp",
|
||||
"squishnavigationwidget.h",
|
||||
"squishoutputpane.cpp",
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "squishplugin.h"
|
||||
|
||||
#include "objectsmapeditor.h"
|
||||
#include "squishnavigationwidget.h"
|
||||
#include "squishoutputpane.h"
|
||||
#include "squishsettings.h"
|
||||
#include "squishsettingspage.h"
|
||||
#include "squishtesttreemodel.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -45,7 +45,6 @@ using namespace Core;
|
||||
static SquishPlugin *m_instance = nullptr;
|
||||
|
||||
SquishPlugin::SquishPlugin()
|
||||
: m_squishSettings(new SquishSettings)
|
||||
{
|
||||
m_instance = this;
|
||||
}
|
||||
@@ -54,7 +53,6 @@ SquishPlugin::~SquishPlugin()
|
||||
{
|
||||
delete m_objectsMapEditorFactory;
|
||||
delete m_navigationWidgetFactory;
|
||||
delete m_settingsPage;
|
||||
delete m_outputPane;
|
||||
}
|
||||
|
||||
@@ -63,9 +61,9 @@ SquishPlugin *SquishPlugin::instance()
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
QSharedPointer<SquishSettings> SquishPlugin::squishSettings() const
|
||||
SquishSettings *SquishPlugin::squishSettings()
|
||||
{
|
||||
return m_squishSettings;
|
||||
return &m_squishSettings;
|
||||
}
|
||||
|
||||
void SquishPlugin::initializeMenuEntries() {}
|
||||
@@ -75,12 +73,12 @@ bool SquishPlugin::initialize(const QStringList &arguments, QString *errorString
|
||||
Q_UNUSED(arguments)
|
||||
Q_UNUSED(errorString)
|
||||
|
||||
m_squishSettings.readSettings(ICore::settings());
|
||||
|
||||
initializeMenuEntries();
|
||||
|
||||
m_squishSettings->fromSettings(ICore::settings());
|
||||
m_treeModel = new SquishTestTreeModel(this);
|
||||
|
||||
m_settingsPage = new SquishSettingsPage(m_squishSettings);
|
||||
m_navigationWidgetFactory = new SquishNavigationWidgetFactory;
|
||||
m_outputPane = SquishOutputPane::instance();
|
||||
m_objectsMapEditorFactory = new ObjectsMapEditorFactory;
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
|
||||
#include "squishplugin_global.h"
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
#include "squishsettings.h"
|
||||
|
||||
#include <QSharedPointer>
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
namespace Squish {
|
||||
namespace Internal {
|
||||
@@ -37,8 +37,6 @@ namespace Internal {
|
||||
class ObjectsMapEditorFactory;
|
||||
class SquishNavigationWidgetFactory;
|
||||
class SquishOutputPane;
|
||||
struct SquishSettings;
|
||||
class SquishSettingsPage;
|
||||
class SquishTestTreeModel;
|
||||
|
||||
class SquishPlugin : public ExtensionSystem::IPlugin
|
||||
@@ -52,7 +50,7 @@ public:
|
||||
|
||||
static SquishPlugin *instance();
|
||||
|
||||
QSharedPointer<SquishSettings> squishSettings() const;
|
||||
SquishSettings *squishSettings();
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *errorString) override;
|
||||
void extensionsInitialized() override;
|
||||
@@ -62,9 +60,9 @@ private:
|
||||
void initializeMenuEntries();
|
||||
|
||||
SquishTestTreeModel *m_treeModel;
|
||||
QSharedPointer<SquishSettings> m_squishSettings;
|
||||
SquishSettings m_squishSettings;
|
||||
|
||||
SquishSettingsPage *m_settingsPage = nullptr;
|
||||
SquishSettingsPage m_settingsPage{&m_squishSettings};
|
||||
SquishNavigationWidgetFactory *m_navigationWidgetFactory = nullptr;
|
||||
SquishOutputPane *m_outputPane = nullptr;
|
||||
ObjectsMapEditorFactory *m_objectsMapEditorFactory = nullptr;
|
||||
|
||||
@@ -25,53 +25,93 @@
|
||||
|
||||
#include "squishsettings.h"
|
||||
|
||||
#include "squishconstants.h"
|
||||
|
||||
#include <utils/icon.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace Squish {
|
||||
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
|
||||
SquishSettings::SquishSettings()
|
||||
{
|
||||
s->beginGroup(group);
|
||||
s->setValue(squishPathKey, squishPath.toString());
|
||||
s->setValue(licensePathKey, licensePath.toString());
|
||||
s->setValue(localKey, local);
|
||||
s->setValue(serverHostKey, serverHost);
|
||||
s->setValue(serverPortKey, serverPort);
|
||||
s->setValue(verboseKey, verbose);
|
||||
s->endGroup();
|
||||
setSettingsGroup("Squish");
|
||||
setAutoApply(false);
|
||||
|
||||
registerAspect(&squishPath);
|
||||
squishPath.setSettingsKey("SquishPath");
|
||||
squishPath.setLabelText(tr("Squish path:"));
|
||||
squishPath.setDisplayStyle(StringAspect::PathChooserDisplay);
|
||||
squishPath.setExpectedKind(PathChooser::ExistingDirectory);
|
||||
squishPath.setPlaceHolderText(tr("Path to Squish installation"));
|
||||
|
||||
registerAspect(&licensePath);
|
||||
licensePath.setSettingsKey("LicensePath");
|
||||
licensePath.setLabelText(tr("License path:"));
|
||||
licensePath.setDisplayStyle(StringAspect::PathChooserDisplay);
|
||||
licensePath.setExpectedKind(PathChooser::ExistingDirectory);
|
||||
|
||||
registerAspect(&local);
|
||||
local.setSettingsKey("Local");
|
||||
local.setLabel(tr("Local Server"));
|
||||
local.setDefaultValue(true);
|
||||
|
||||
registerAspect(&serverHost);
|
||||
serverHost.setSettingsKey("ServerHost");
|
||||
serverHost.setLabelText(tr("Server host:"));
|
||||
serverHost.setDisplayStyle(StringAspect::LineEditDisplay);
|
||||
serverHost.setDefaultValue("localhost");
|
||||
serverHost.setEnabled(false);
|
||||
|
||||
registerAspect(&serverPort);
|
||||
serverPort.setSettingsKey("ServerPort");
|
||||
serverPort.setLabel(tr("Server Port"));
|
||||
serverPort.setRange(1, 65535);
|
||||
serverPort.setValue(9999);
|
||||
serverPort.setEnabled(false);
|
||||
|
||||
|
||||
registerAspect(&verbose);
|
||||
verbose.setSettingsKey("Verbose");
|
||||
verbose.setLabel(tr("Verbose log"));
|
||||
verbose.setDefaultValue(false);
|
||||
|
||||
connect(&local, &BoolAspect::volatileValueChanged,
|
||||
this, [this] (bool checked) {
|
||||
serverHost.setEnabled(!checked);
|
||||
serverPort.setEnabled(!checked);
|
||||
});
|
||||
}
|
||||
|
||||
void SquishSettings::fromSettings(QSettings *s)
|
||||
SquishSettingsPage::SquishSettingsPage(SquishSettings *settings)
|
||||
{
|
||||
s->beginGroup(group);
|
||||
squishPath = Utils::FilePath::fromVariant(s->value(squishPathKey));
|
||||
licensePath = Utils::FilePath::fromVariant(s->value(licensePathKey));
|
||||
local = s->value(localKey, true).toBool();
|
||||
serverHost = s->value(serverHostKey, "localhost").toString();
|
||||
serverPort = s->value(serverPortKey, 9999).toUInt();
|
||||
verbose = s->value(verboseKey, false).toBool();
|
||||
s->endGroup();
|
||||
}
|
||||
setId("A.Squish.General");
|
||||
setDisplayName(tr("General"));
|
||||
setCategory(Constants::SQUISH_SETTINGS_CATEGORY);
|
||||
setDisplayCategory("Squish");
|
||||
setCategoryIcon(Icon({{":/squish/images/settingscategory_squish.png",
|
||||
Theme::PanelTextColorDark}}, Icon::Tint));
|
||||
|
||||
bool SquishSettings::operator==(const SquishSettings &other) const
|
||||
{
|
||||
return local == other.local && verbose == other.verbose && serverPort == other.serverPort
|
||||
&& squishPath == other.squishPath && licensePath == other.licensePath
|
||||
&& serverHost == other.serverHost;
|
||||
}
|
||||
setSettings(settings);
|
||||
|
||||
bool SquishSettings::operator!=(const SquishSettings &other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
setLayouter([settings](QWidget *widget) {
|
||||
SquishSettings &s = *settings;
|
||||
using namespace Layouting;
|
||||
|
||||
const Break nl;
|
||||
|
||||
Grid grid {
|
||||
s.squishPath, nl,
|
||||
s.licensePath, nl,
|
||||
Span {2, Row { s.local, s.serverHost, s.serverPort } }, nl,
|
||||
s.verbose, nl,
|
||||
};
|
||||
Column { Row { grid }, Stretch() }.attachTo(widget);
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -25,10 +25,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
#include <utils/aspects.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QSettings;
|
||||
@@ -37,20 +36,28 @@ QT_END_NAMESPACE
|
||||
namespace Squish {
|
||||
namespace Internal {
|
||||
|
||||
struct SquishSettings
|
||||
class SquishSettings : public Utils::AspectContainer
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(Squish::Internal::SquishSettings)
|
||||
public:
|
||||
SquishSettings();
|
||||
|
||||
void toSettings(QSettings *s) const;
|
||||
void fromSettings(QSettings *s);
|
||||
|
||||
bool operator==(const SquishSettings &other) const;
|
||||
bool operator!=(const SquishSettings &other) const;
|
||||
Utils::StringAspect squishPath;
|
||||
Utils::StringAspect licensePath;
|
||||
Utils::StringAspect serverHost;
|
||||
Utils::IntegerAspect serverPort;
|
||||
Utils::BoolAspect local;
|
||||
Utils::BoolAspect verbose;
|
||||
};
|
||||
|
||||
Utils::FilePath squishPath;
|
||||
Utils::FilePath licensePath;
|
||||
QString serverHost;
|
||||
quint16 serverPort;
|
||||
bool local;
|
||||
bool verbose;
|
||||
class SquishSettingsPage final : public Core::IOptionsPage
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(Squish::Internal::SquishSettings)
|
||||
public:
|
||||
SquishSettingsPage(SquishSettings *settings);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2022 The Qt Company Ltd
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator Squish plugin.
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "squishsettingspage.h"
|
||||
#include "squishconstants.h"
|
||||
#include "squishsettings.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <utils/theme/theme.h>
|
||||
|
||||
namespace Squish {
|
||||
namespace Internal {
|
||||
|
||||
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->setFilePath(settings.squishPath);
|
||||
m_ui.licensePathChooser->setFilePath(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->filePath();
|
||||
result.licensePath = m_ui.licensePathChooser->filePath();
|
||||
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<SquishSettings> &settings)
|
||||
: m_settings(settings)
|
||||
, m_widget(nullptr)
|
||||
{
|
||||
setId("A.Squish.General");
|
||||
setDisplayName(tr("General"));
|
||||
setCategory(Constants::SQUISH_SETTINGS_CATEGORY);
|
||||
setDisplayCategory(tr("Squish"));
|
||||
setCategoryIcon(Utils::Icon({{":/squish/images/settingscategory_squish.png",
|
||||
Utils::Theme::PanelTextColorDark}},
|
||||
Utils::Icon::Tint));
|
||||
}
|
||||
|
||||
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 Squish
|
||||
@@ -1,72 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2022 The Qt Company Ltd
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator Squish plugin.
|
||||
**
|
||||
** 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 "ui_squishsettingspage.h"
|
||||
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
#include <QPointer>
|
||||
#include <QSharedPointer>
|
||||
#include <QWidget>
|
||||
|
||||
namespace Squish {
|
||||
namespace Internal {
|
||||
|
||||
struct SquishSettings;
|
||||
|
||||
class SquishSettingsWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SquishSettingsWidget(QWidget *parent = nullptr);
|
||||
|
||||
void setSettings(const SquishSettings &settings);
|
||||
SquishSettings settings() const;
|
||||
|
||||
private:
|
||||
void onLocalToggled(bool checked);
|
||||
|
||||
Ui::SquishSettingsPage m_ui;
|
||||
};
|
||||
|
||||
class SquishSettingsPage : public Core::IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SquishSettingsPage(const QSharedPointer<SquishSettings> &settings);
|
||||
|
||||
QWidget *widget() override;
|
||||
void apply() override;
|
||||
void finish() override {}
|
||||
|
||||
private:
|
||||
QSharedPointer<SquishSettings> m_settings;
|
||||
QPointer<SquishSettingsWidget> m_widget;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Squish
|
||||
@@ -1,127 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Squish::Internal::SquishSettingsPage</class>
|
||||
<widget class="QWidget" name="Squish::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>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="squishPathLabel">
|
||||
<property name="text">
|
||||
<string>Squish path:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="5">
|
||||
<widget class="Utils::PathChooser" name="squishPathChooser">
|
||||
<property name="toolTip">
|
||||
<string>Path to Squish installation directory.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QLabel" name="licensePathLabel">
|
||||
<property name="text">
|
||||
<string>License path:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" colspan="5">
|
||||
<widget class="Utils::PathChooser" name="licensePathChooser">
|
||||
<property name="toolTip">
|
||||
<string>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.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="localCheckBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Local server</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QLabel" name="serverHostLabel">
|
||||
<property name="text">
|
||||
<string>Server host:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="4">
|
||||
<widget class="QLineEdit" name="serverHostLineEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="5">
|
||||
<widget class="QLabel" name="portLabel">
|
||||
<property name="text">
|
||||
<string>Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="6">
|
||||
<widget class="QSpinBox" name="serverPortSpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="verboseCheckBox">
|
||||
<property name="text">
|
||||
<string>Verbose log</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>289</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Utils::PathChooser</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header location="global">utils/pathchooser.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -47,6 +47,8 @@
|
||||
#include <QTimer>
|
||||
#include <QWindow>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace Squish {
|
||||
namespace Internal {
|
||||
|
||||
@@ -99,34 +101,34 @@ struct SquishToolsSettings
|
||||
{
|
||||
SquishToolsSettings() {}
|
||||
|
||||
QString squishPath;
|
||||
QString serverPath = "squishserver";
|
||||
QString runnerPath = "squishrunner";
|
||||
FilePath squishPath;
|
||||
FilePath serverPath;
|
||||
FilePath runnerPath;
|
||||
bool isLocalServer = true;
|
||||
bool verboseLog = false;
|
||||
QString serverHost = "localhost";
|
||||
int serverPort = 9999;
|
||||
QString licenseKeyPath;
|
||||
FilePath licenseKeyPath;
|
||||
|
||||
// populate members using current settings
|
||||
void setup()
|
||||
{
|
||||
QSharedPointer<SquishSettings> squishSettings = SquishPlugin::instance()->squishSettings();
|
||||
squishPath = squishSettings->squishPath.toString();
|
||||
serverPath = Utils::HostOsInfo::withExecutableSuffix("squishserver");
|
||||
runnerPath = Utils::HostOsInfo::withExecutableSuffix("squishrunner");
|
||||
const SquishSettings *squishSettings = SquishPlugin::instance()->squishSettings();
|
||||
squishPath = squishSettings->squishPath.filePath();
|
||||
|
||||
if (!squishPath.isEmpty()) {
|
||||
const QDir squishBin(squishPath + QDir::separator() + "bin");
|
||||
serverPath = QFileInfo(squishBin, serverPath).absoluteFilePath();
|
||||
runnerPath = QFileInfo(squishBin, runnerPath).absoluteFilePath();
|
||||
const FilePath squishBin(squishPath.pathAppended("bin"));
|
||||
serverPath = squishBin.pathAppended(
|
||||
HostOsInfo::withExecutableSuffix("squishserver")).absoluteFilePath();
|
||||
runnerPath = squishBin.pathAppended(
|
||||
HostOsInfo::withExecutableSuffix("squishrunner")).absoluteFilePath();
|
||||
}
|
||||
|
||||
isLocalServer = squishSettings->local;
|
||||
serverHost = squishSettings->serverHost;
|
||||
serverPort = squishSettings->serverPort;
|
||||
verboseLog = squishSettings->verbose;
|
||||
licenseKeyPath = squishSettings->licensePath.toString();
|
||||
isLocalServer = squishSettings->local.value();
|
||||
serverHost = squishSettings->serverHost.value();
|
||||
serverPort = squishSettings->serverPort.value();
|
||||
verboseLog = squishSettings->verbose.value();
|
||||
licenseKeyPath = squishSettings->licensePath.filePath();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -304,25 +306,25 @@ void SquishTools::startSquishServer(Request request)
|
||||
toolsSettings.setup();
|
||||
m_serverPort = -1;
|
||||
|
||||
const Utils::FilePath squishServer = Utils::Environment::systemEnvironment().searchInPath(
|
||||
toolsSettings.serverPath);
|
||||
const FilePath squishServer = Environment::systemEnvironment().searchInPath(
|
||||
toolsSettings.serverPath.toString());
|
||||
if (squishServer.isEmpty()) {
|
||||
QMessageBox::critical(Core::ICore::dialogParent(),
|
||||
tr("Squish Server Error"),
|
||||
tr("\"%1\" could not be found or is not executable.\n"
|
||||
"Check the settings.")
|
||||
.arg(QDir::toNativeSeparators(toolsSettings.serverPath)));
|
||||
.arg(toolsSettings.serverPath.toUserOutput()));
|
||||
setState(Idle);
|
||||
return;
|
||||
}
|
||||
toolsSettings.serverPath = squishServer.toString();
|
||||
toolsSettings.serverPath = squishServer;
|
||||
|
||||
if (true) // TODO squish setting of minimize QC on squish run/record
|
||||
minimizeQtCreatorWindows();
|
||||
else
|
||||
m_lastTopLevelWindows.clear();
|
||||
|
||||
m_serverProcess = new Utils::QtcProcess;
|
||||
m_serverProcess = new QtcProcess;
|
||||
QStringList arguments;
|
||||
// TODO if isLocalServer is false we should start a squishserver on remote device
|
||||
if (toolsSettings.isLocalServer)
|
||||
@@ -332,14 +334,14 @@ void SquishTools::startSquishServer(Request request)
|
||||
if (toolsSettings.verboseLog)
|
||||
arguments << "--verbose";
|
||||
|
||||
m_serverProcess->setCommand({Utils::FilePath::fromString(toolsSettings.serverPath), arguments});
|
||||
m_serverProcess->setCommand({toolsSettings.serverPath, arguments});
|
||||
m_serverProcess->setEnvironment(squishEnvironment());
|
||||
|
||||
connect(m_serverProcess, &Utils::QtcProcess::readyReadStandardOutput,
|
||||
connect(m_serverProcess, &QtcProcess::readyReadStandardOutput,
|
||||
this, &SquishTools::onServerOutput);
|
||||
connect(m_serverProcess, &Utils::QtcProcess::readyReadStandardError,
|
||||
connect(m_serverProcess, &QtcProcess::readyReadStandardError,
|
||||
this, &SquishTools::onServerErrorOutput);
|
||||
connect(m_serverProcess, &Utils::QtcProcess::done,
|
||||
connect(m_serverProcess, &QtcProcess::done,
|
||||
this, &SquishTools::onServerFinished);
|
||||
|
||||
setState(ServerStarting);
|
||||
@@ -353,7 +355,7 @@ void SquishTools::startSquishServer(Request request)
|
||||
void SquishTools::stopSquishServer()
|
||||
{
|
||||
if (m_serverProcess && m_serverPort > 0) {
|
||||
Utils::QtcProcess serverKiller;
|
||||
QtcProcess serverKiller;
|
||||
QStringList args;
|
||||
args << "--stop" << "--port" << QString::number(m_serverPort);
|
||||
serverKiller.setCommand({m_serverProcess->commandLine().executable(), args});
|
||||
@@ -411,20 +413,20 @@ void SquishTools::startSquishRunner()
|
||||
return;
|
||||
}
|
||||
|
||||
const Utils::FilePath squishRunner = Utils::Environment::systemEnvironment().searchInPath(
|
||||
toolsSettings.runnerPath);
|
||||
const FilePath squishRunner = Environment::systemEnvironment().searchInPath(
|
||||
toolsSettings.runnerPath.toString());
|
||||
if (squishRunner.isEmpty()) {
|
||||
QMessageBox::critical(Core::ICore::dialogParent(),
|
||||
tr("Squish Runner Error"),
|
||||
tr("\"%1\" could not be found or is not executable.\n"
|
||||
"Check the settings.")
|
||||
.arg(QDir::toNativeSeparators(toolsSettings.runnerPath)));
|
||||
.arg(toolsSettings.runnerPath.toUserOutput()));
|
||||
setState(RunnerStopped);
|
||||
return;
|
||||
}
|
||||
toolsSettings.runnerPath = squishRunner.toString();
|
||||
toolsSettings.runnerPath = squishRunner;
|
||||
|
||||
m_runnerProcess = new Utils::QtcProcess;
|
||||
m_runnerProcess = new QtcProcess;
|
||||
|
||||
QStringList args;
|
||||
args << m_additionalServerArguments;
|
||||
@@ -449,12 +451,12 @@ void SquishTools::startSquishRunner()
|
||||
args << "--reportgen"
|
||||
<< QString::fromLatin1("xml2.2,%1").arg(caseReportFilePath);
|
||||
|
||||
m_runnerProcess->setCommand({Utils::FilePath::fromString(toolsSettings.runnerPath), args});
|
||||
m_runnerProcess->setCommand({toolsSettings.runnerPath, args});
|
||||
m_runnerProcess->setEnvironment(squishEnvironment());
|
||||
|
||||
connect(m_runnerProcess, &Utils::QtcProcess::readyReadStandardError,
|
||||
connect(m_runnerProcess, &QtcProcess::readyReadStandardError,
|
||||
this, &SquishTools::onRunnerErrorOutput);
|
||||
connect(m_runnerProcess, &Utils::QtcProcess::done,
|
||||
connect(m_runnerProcess, &QtcProcess::done,
|
||||
this, &SquishTools::onRunnerFinished);
|
||||
|
||||
setState(RunnerStarting);
|
||||
@@ -487,12 +489,12 @@ void SquishTools::startSquishRunner()
|
||||
m_currentResultsXML = new QFile(caseReportFilePath);
|
||||
}
|
||||
|
||||
Utils::Environment SquishTools::squishEnvironment()
|
||||
Environment SquishTools::squishEnvironment()
|
||||
{
|
||||
Utils::Environment environment = Utils::Environment::systemEnvironment();
|
||||
Environment environment = Environment::systemEnvironment();
|
||||
if (!toolsSettings.licenseKeyPath.isEmpty())
|
||||
environment.prependOrSet("SQUISH_LICENSEKEY_DIR", toolsSettings.licenseKeyPath);
|
||||
environment.prependOrSet("SQUISH_PREFIX", toolsSettings.squishPath);
|
||||
environment.prependOrSet("SQUISH_LICENSEKEY_DIR", toolsSettings.licenseKeyPath.nativePath());
|
||||
environment.prependOrSet("SQUISH_PREFIX", toolsSettings.squishPath.nativePath());
|
||||
return environment;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user