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:
Christian Stenger
2022-07-04 11:32:49 +02:00
parent 8a7a4fce6c
commit 2d7457573b
10 changed files with 145 additions and 411 deletions

View File

@@ -18,7 +18,6 @@ add_qtc_plugin(Squish
squishplugin.cpp squishplugin.h squishplugin.cpp squishplugin.h
squishresultmodel.cpp squishresultmodel.h squishresultmodel.cpp squishresultmodel.h
squishsettings.cpp squishsettings.h squishsettings.cpp squishsettings.h
squishsettingspage.cpp squishsettingspage.h squishsettingspage.ui
squishtesttreemodel.cpp squishtesttreemodel.h squishtesttreemodel.cpp squishtesttreemodel.h
squishtesttreeview.cpp squishtesttreeview.h squishtesttreeview.cpp squishtesttreeview.h
squishtools.cpp squishtools.h squishtools.cpp squishtools.h

View File

@@ -16,9 +16,6 @@ QtcPlugin {
"squishplugin.h", "squishplugin.h",
"squishsettings.cpp", "squishsettings.cpp",
"squishsettings.h", "squishsettings.h",
"squishsettingspage.cpp",
"squishsettingspage.h",
"squishsettingspage.ui",
"squishnavigationwidget.cpp", "squishnavigationwidget.cpp",
"squishnavigationwidget.h", "squishnavigationwidget.h",
"squishoutputpane.cpp", "squishoutputpane.cpp",

View File

@@ -24,11 +24,11 @@
****************************************************************************/ ****************************************************************************/
#include "squishplugin.h" #include "squishplugin.h"
#include "objectsmapeditor.h" #include "objectsmapeditor.h"
#include "squishnavigationwidget.h" #include "squishnavigationwidget.h"
#include "squishoutputpane.h" #include "squishoutputpane.h"
#include "squishsettings.h" #include "squishsettings.h"
#include "squishsettingspage.h"
#include "squishtesttreemodel.h" #include "squishtesttreemodel.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
@@ -45,7 +45,6 @@ using namespace Core;
static SquishPlugin *m_instance = nullptr; static SquishPlugin *m_instance = nullptr;
SquishPlugin::SquishPlugin() SquishPlugin::SquishPlugin()
: m_squishSettings(new SquishSettings)
{ {
m_instance = this; m_instance = this;
} }
@@ -54,7 +53,6 @@ SquishPlugin::~SquishPlugin()
{ {
delete m_objectsMapEditorFactory; delete m_objectsMapEditorFactory;
delete m_navigationWidgetFactory; delete m_navigationWidgetFactory;
delete m_settingsPage;
delete m_outputPane; delete m_outputPane;
} }
@@ -63,9 +61,9 @@ SquishPlugin *SquishPlugin::instance()
return m_instance; return m_instance;
} }
QSharedPointer<SquishSettings> SquishPlugin::squishSettings() const SquishSettings *SquishPlugin::squishSettings()
{ {
return m_squishSettings; return &m_squishSettings;
} }
void SquishPlugin::initializeMenuEntries() {} void SquishPlugin::initializeMenuEntries() {}
@@ -75,12 +73,12 @@ bool SquishPlugin::initialize(const QStringList &arguments, QString *errorString
Q_UNUSED(arguments) Q_UNUSED(arguments)
Q_UNUSED(errorString) Q_UNUSED(errorString)
m_squishSettings.readSettings(ICore::settings());
initializeMenuEntries(); initializeMenuEntries();
m_squishSettings->fromSettings(ICore::settings());
m_treeModel = new SquishTestTreeModel(this); m_treeModel = new SquishTestTreeModel(this);
m_settingsPage = new SquishSettingsPage(m_squishSettings);
m_navigationWidgetFactory = new SquishNavigationWidgetFactory; m_navigationWidgetFactory = new SquishNavigationWidgetFactory;
m_outputPane = SquishOutputPane::instance(); m_outputPane = SquishOutputPane::instance();
m_objectsMapEditorFactory = new ObjectsMapEditorFactory; m_objectsMapEditorFactory = new ObjectsMapEditorFactory;

View File

@@ -27,9 +27,9 @@
#include "squishplugin_global.h" #include "squishplugin_global.h"
#include <extensionsystem/iplugin.h> #include "squishsettings.h"
#include <QSharedPointer> #include <extensionsystem/iplugin.h>
namespace Squish { namespace Squish {
namespace Internal { namespace Internal {
@@ -37,8 +37,6 @@ namespace Internal {
class ObjectsMapEditorFactory; class ObjectsMapEditorFactory;
class SquishNavigationWidgetFactory; class SquishNavigationWidgetFactory;
class SquishOutputPane; class SquishOutputPane;
struct SquishSettings;
class SquishSettingsPage;
class SquishTestTreeModel; class SquishTestTreeModel;
class SquishPlugin : public ExtensionSystem::IPlugin class SquishPlugin : public ExtensionSystem::IPlugin
@@ -52,7 +50,7 @@ public:
static SquishPlugin *instance(); static SquishPlugin *instance();
QSharedPointer<SquishSettings> squishSettings() const; SquishSettings *squishSettings();
bool initialize(const QStringList &arguments, QString *errorString) override; bool initialize(const QStringList &arguments, QString *errorString) override;
void extensionsInitialized() override; void extensionsInitialized() override;
@@ -62,9 +60,9 @@ private:
void initializeMenuEntries(); void initializeMenuEntries();
SquishTestTreeModel *m_treeModel; SquishTestTreeModel *m_treeModel;
QSharedPointer<SquishSettings> m_squishSettings; SquishSettings m_squishSettings;
SquishSettingsPage *m_settingsPage = nullptr; SquishSettingsPage m_settingsPage{&m_squishSettings};
SquishNavigationWidgetFactory *m_navigationWidgetFactory = nullptr; SquishNavigationWidgetFactory *m_navigationWidgetFactory = nullptr;
SquishOutputPane *m_outputPane = nullptr; SquishOutputPane *m_outputPane = nullptr;
ObjectsMapEditorFactory *m_objectsMapEditorFactory = nullptr; ObjectsMapEditorFactory *m_objectsMapEditorFactory = nullptr;

View File

@@ -25,53 +25,93 @@
#include "squishsettings.h" #include "squishsettings.h"
#include "squishconstants.h"
#include <utils/icon.h>
#include <utils/layoutbuilder.h>
#include <QSettings> #include <QSettings>
using namespace Utils;
namespace Squish { namespace Squish {
namespace Internal { namespace Internal {
static const char group[] = "Squish"; SquishSettings::SquishSettings()
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(group); setSettingsGroup("Squish");
s->setValue(squishPathKey, squishPath.toString()); setAutoApply(false);
s->setValue(licensePathKey, licensePath.toString());
s->setValue(localKey, local); registerAspect(&squishPath);
s->setValue(serverHostKey, serverHost); squishPath.setSettingsKey("SquishPath");
s->setValue(serverPortKey, serverPort); squishPath.setLabelText(tr("Squish path:"));
s->setValue(verboseKey, verbose); squishPath.setDisplayStyle(StringAspect::PathChooserDisplay);
s->endGroup(); 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); setId("A.Squish.General");
squishPath = Utils::FilePath::fromVariant(s->value(squishPathKey)); setDisplayName(tr("General"));
licensePath = Utils::FilePath::fromVariant(s->value(licensePathKey)); setCategory(Constants::SQUISH_SETTINGS_CATEGORY);
local = s->value(localKey, true).toBool(); setDisplayCategory("Squish");
serverHost = s->value(serverHostKey, "localhost").toString(); setCategoryIcon(Icon({{":/squish/images/settingscategory_squish.png",
serverPort = s->value(serverPortKey, 9999).toUInt(); Theme::PanelTextColorDark}}, Icon::Tint));
verbose = s->value(verboseKey, false).toBool();
s->endGroup();
}
bool SquishSettings::operator==(const SquishSettings &other) const setSettings(settings);
{
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 setLayouter([settings](QWidget *widget) {
{ SquishSettings &s = *settings;
return !(*this == other); 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 } // namespace Internal

View File

@@ -25,10 +25,9 @@
#pragma once #pragma once
#include <utils/fileutils.h> #include <coreplugin/dialogs/ioptionspage.h>
#include <QString> #include <utils/aspects.h>
#include <QtGlobal>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QSettings; class QSettings;
@@ -37,20 +36,28 @@ QT_END_NAMESPACE
namespace Squish { namespace Squish {
namespace Internal { namespace Internal {
struct SquishSettings class SquishSettings : public Utils::AspectContainer
{ {
Q_DECLARE_TR_FUNCTIONS(Squish::Internal::SquishSettings)
public:
SquishSettings();
void toSettings(QSettings *s) const; void toSettings(QSettings *s) const;
void fromSettings(QSettings *s); void fromSettings(QSettings *s);
bool operator==(const SquishSettings &other) const; Utils::StringAspect squishPath;
bool operator!=(const SquishSettings &other) const; Utils::StringAspect licensePath;
Utils::StringAspect serverHost;
Utils::IntegerAspect serverPort;
Utils::BoolAspect local;
Utils::BoolAspect verbose;
};
Utils::FilePath squishPath; class SquishSettingsPage final : public Core::IOptionsPage
Utils::FilePath licensePath; {
QString serverHost; Q_DECLARE_TR_FUNCTIONS(Squish::Internal::SquishSettings)
quint16 serverPort; public:
bool local; SquishSettingsPage(SquishSettings *settings);
bool verbose;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -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

View File

@@ -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

View File

@@ -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>

View File

@@ -47,6 +47,8 @@
#include <QTimer> #include <QTimer>
#include <QWindow> #include <QWindow>
using namespace Utils;
namespace Squish { namespace Squish {
namespace Internal { namespace Internal {
@@ -99,34 +101,34 @@ struct SquishToolsSettings
{ {
SquishToolsSettings() {} SquishToolsSettings() {}
QString squishPath; FilePath squishPath;
QString serverPath = "squishserver"; FilePath serverPath;
QString runnerPath = "squishrunner"; FilePath runnerPath;
bool isLocalServer = true; bool isLocalServer = true;
bool verboseLog = false; bool verboseLog = false;
QString serverHost = "localhost"; QString serverHost = "localhost";
int serverPort = 9999; int serverPort = 9999;
QString licenseKeyPath; FilePath licenseKeyPath;
// populate members using current settings // populate members using current settings
void setup() void setup()
{ {
QSharedPointer<SquishSettings> squishSettings = SquishPlugin::instance()->squishSettings(); const SquishSettings *squishSettings = SquishPlugin::instance()->squishSettings();
squishPath = squishSettings->squishPath.toString(); squishPath = squishSettings->squishPath.filePath();
serverPath = Utils::HostOsInfo::withExecutableSuffix("squishserver");
runnerPath = Utils::HostOsInfo::withExecutableSuffix("squishrunner");
if (!squishPath.isEmpty()) { if (!squishPath.isEmpty()) {
const QDir squishBin(squishPath + QDir::separator() + "bin"); const FilePath squishBin(squishPath.pathAppended("bin"));
serverPath = QFileInfo(squishBin, serverPath).absoluteFilePath(); serverPath = squishBin.pathAppended(
runnerPath = QFileInfo(squishBin, runnerPath).absoluteFilePath(); HostOsInfo::withExecutableSuffix("squishserver")).absoluteFilePath();
runnerPath = squishBin.pathAppended(
HostOsInfo::withExecutableSuffix("squishrunner")).absoluteFilePath();
} }
isLocalServer = squishSettings->local; isLocalServer = squishSettings->local.value();
serverHost = squishSettings->serverHost; serverHost = squishSettings->serverHost.value();
serverPort = squishSettings->serverPort; serverPort = squishSettings->serverPort.value();
verboseLog = squishSettings->verbose; verboseLog = squishSettings->verbose.value();
licenseKeyPath = squishSettings->licensePath.toString(); licenseKeyPath = squishSettings->licensePath.filePath();
} }
}; };
@@ -304,25 +306,25 @@ void SquishTools::startSquishServer(Request request)
toolsSettings.setup(); toolsSettings.setup();
m_serverPort = -1; m_serverPort = -1;
const Utils::FilePath squishServer = Utils::Environment::systemEnvironment().searchInPath( const FilePath squishServer = Environment::systemEnvironment().searchInPath(
toolsSettings.serverPath); toolsSettings.serverPath.toString());
if (squishServer.isEmpty()) { if (squishServer.isEmpty()) {
QMessageBox::critical(Core::ICore::dialogParent(), QMessageBox::critical(Core::ICore::dialogParent(),
tr("Squish Server Error"), tr("Squish Server Error"),
tr("\"%1\" could not be found or is not executable.\n" tr("\"%1\" could not be found or is not executable.\n"
"Check the settings.") "Check the settings.")
.arg(QDir::toNativeSeparators(toolsSettings.serverPath))); .arg(toolsSettings.serverPath.toUserOutput()));
setState(Idle); setState(Idle);
return; return;
} }
toolsSettings.serverPath = squishServer.toString(); toolsSettings.serverPath = squishServer;
if (true) // TODO squish setting of minimize QC on squish run/record if (true) // TODO squish setting of minimize QC on squish run/record
minimizeQtCreatorWindows(); minimizeQtCreatorWindows();
else else
m_lastTopLevelWindows.clear(); m_lastTopLevelWindows.clear();
m_serverProcess = new Utils::QtcProcess; m_serverProcess = new QtcProcess;
QStringList arguments; QStringList arguments;
// TODO if isLocalServer is false we should start a squishserver on remote device // TODO if isLocalServer is false we should start a squishserver on remote device
if (toolsSettings.isLocalServer) if (toolsSettings.isLocalServer)
@@ -332,14 +334,14 @@ void SquishTools::startSquishServer(Request request)
if (toolsSettings.verboseLog) if (toolsSettings.verboseLog)
arguments << "--verbose"; arguments << "--verbose";
m_serverProcess->setCommand({Utils::FilePath::fromString(toolsSettings.serverPath), arguments}); m_serverProcess->setCommand({toolsSettings.serverPath, arguments});
m_serverProcess->setEnvironment(squishEnvironment()); m_serverProcess->setEnvironment(squishEnvironment());
connect(m_serverProcess, &Utils::QtcProcess::readyReadStandardOutput, connect(m_serverProcess, &QtcProcess::readyReadStandardOutput,
this, &SquishTools::onServerOutput); this, &SquishTools::onServerOutput);
connect(m_serverProcess, &Utils::QtcProcess::readyReadStandardError, connect(m_serverProcess, &QtcProcess::readyReadStandardError,
this, &SquishTools::onServerErrorOutput); this, &SquishTools::onServerErrorOutput);
connect(m_serverProcess, &Utils::QtcProcess::done, connect(m_serverProcess, &QtcProcess::done,
this, &SquishTools::onServerFinished); this, &SquishTools::onServerFinished);
setState(ServerStarting); setState(ServerStarting);
@@ -353,7 +355,7 @@ void SquishTools::startSquishServer(Request request)
void SquishTools::stopSquishServer() void SquishTools::stopSquishServer()
{ {
if (m_serverProcess && m_serverPort > 0) { if (m_serverProcess && m_serverPort > 0) {
Utils::QtcProcess serverKiller; QtcProcess serverKiller;
QStringList args; QStringList args;
args << "--stop" << "--port" << QString::number(m_serverPort); args << "--stop" << "--port" << QString::number(m_serverPort);
serverKiller.setCommand({m_serverProcess->commandLine().executable(), args}); serverKiller.setCommand({m_serverProcess->commandLine().executable(), args});
@@ -411,20 +413,20 @@ void SquishTools::startSquishRunner()
return; return;
} }
const Utils::FilePath squishRunner = Utils::Environment::systemEnvironment().searchInPath( const FilePath squishRunner = Environment::systemEnvironment().searchInPath(
toolsSettings.runnerPath); toolsSettings.runnerPath.toString());
if (squishRunner.isEmpty()) { if (squishRunner.isEmpty()) {
QMessageBox::critical(Core::ICore::dialogParent(), QMessageBox::critical(Core::ICore::dialogParent(),
tr("Squish Runner Error"), tr("Squish Runner Error"),
tr("\"%1\" could not be found or is not executable.\n" tr("\"%1\" could not be found or is not executable.\n"
"Check the settings.") "Check the settings.")
.arg(QDir::toNativeSeparators(toolsSettings.runnerPath))); .arg(toolsSettings.runnerPath.toUserOutput()));
setState(RunnerStopped); setState(RunnerStopped);
return; return;
} }
toolsSettings.runnerPath = squishRunner.toString(); toolsSettings.runnerPath = squishRunner;
m_runnerProcess = new Utils::QtcProcess; m_runnerProcess = new QtcProcess;
QStringList args; QStringList args;
args << m_additionalServerArguments; args << m_additionalServerArguments;
@@ -449,12 +451,12 @@ void SquishTools::startSquishRunner()
args << "--reportgen" args << "--reportgen"
<< QString::fromLatin1("xml2.2,%1").arg(caseReportFilePath); << 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()); m_runnerProcess->setEnvironment(squishEnvironment());
connect(m_runnerProcess, &Utils::QtcProcess::readyReadStandardError, connect(m_runnerProcess, &QtcProcess::readyReadStandardError,
this, &SquishTools::onRunnerErrorOutput); this, &SquishTools::onRunnerErrorOutput);
connect(m_runnerProcess, &Utils::QtcProcess::done, connect(m_runnerProcess, &QtcProcess::done,
this, &SquishTools::onRunnerFinished); this, &SquishTools::onRunnerFinished);
setState(RunnerStarting); setState(RunnerStarting);
@@ -487,12 +489,12 @@ void SquishTools::startSquishRunner()
m_currentResultsXML = new QFile(caseReportFilePath); 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()) if (!toolsSettings.licenseKeyPath.isEmpty())
environment.prependOrSet("SQUISH_LICENSEKEY_DIR", toolsSettings.licenseKeyPath); environment.prependOrSet("SQUISH_LICENSEKEY_DIR", toolsSettings.licenseKeyPath.nativePath());
environment.prependOrSet("SQUISH_PREFIX", toolsSettings.squishPath); environment.prependOrSet("SQUISH_PREFIX", toolsSettings.squishPath.nativePath());
return environment; return environment;
} }