forked from qt-creator/qt-creator
Squish: Adapt to recent aspect development
Change-Id: Ied7406af9c39d8b57b5b9064500e589e33fb86da Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -195,7 +195,7 @@ Core::IDocument::OpenResult ObjectsMapDocument::openImpl(QString *error,
|
|||||||
|
|
||||||
text = reader.data();
|
text = reader.data();
|
||||||
} else {
|
} else {
|
||||||
const Utils::FilePath base = SquishPlugin::squishSettings()->squishPath.filePath();
|
const Utils::FilePath base = SquishPlugin::squishSettings()->squishPath();
|
||||||
if (base.isEmpty()) {
|
if (base.isEmpty()) {
|
||||||
if (error)
|
if (error)
|
||||||
error->append(Tr::tr("Incomplete Squish settings. "
|
error->append(Tr::tr("Incomplete Squish settings. "
|
||||||
@@ -233,7 +233,7 @@ bool ObjectsMapDocument::writeFile(const Utils::FilePath &fileName) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// otherwise we need the objectmaptool to write the scripted object map again
|
// otherwise we need the objectmaptool to write the scripted object map again
|
||||||
const Utils::FilePath base = SquishPlugin::squishSettings()->squishPath.filePath();
|
const Utils::FilePath base = SquishPlugin::squishSettings()->squishPath();
|
||||||
if (base.isEmpty())
|
if (base.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
const Utils::FilePath exe = base.pathAppended("lib/exec/objectmaptool").withExecutableSuffix();
|
const Utils::FilePath exe = base.pathAppended("lib/exec/objectmaptool").withExecutableSuffix();
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ void SquishNavigationWidget::onNewTestCaseTriggered(const QModelIndex &index)
|
|||||||
auto settings = SquishPlugin::squishSettings();
|
auto settings = SquishPlugin::squishSettings();
|
||||||
QTC_ASSERT(settings, return);
|
QTC_ASSERT(settings, return);
|
||||||
|
|
||||||
if (!settings->squishPath.filePath().pathAppended("scriptmodules").exists()) {
|
if (!settings->squishPath().pathAppended("scriptmodules").exists()) {
|
||||||
SquishMessages::criticalMessage(Tr::tr("Set up a valid Squish path to be able to create "
|
SquishMessages::criticalMessage(Tr::tr("Set up a valid Squish path to be able to create "
|
||||||
"a new test case.\n(Edit > Preferences > Squish)"));
|
"a new test case.\n(Edit > Preferences > Squish)"));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ bool SquishPluginPrivate::initializeGlobalScripts()
|
|||||||
QTC_ASSERT(dd->m_squishTools, return false);
|
QTC_ASSERT(dd->m_squishTools, return false);
|
||||||
SquishFileHandler::instance()->setSharedFolders({});
|
SquishFileHandler::instance()->setSharedFolders({});
|
||||||
|
|
||||||
const Utils::FilePath squishserver = dd->m_squishSettings.squishPath.filePath().pathAppended(
|
const Utils::FilePath squishserver = dd->m_squishSettings.squishPath().pathAppended(
|
||||||
Utils::HostOsInfo::withExecutableSuffix("bin/squishserver"));
|
Utils::HostOsInfo::withExecutableSuffix("bin/squishserver"));
|
||||||
if (!squishserver.isExecutableFile())
|
if (!squishserver.isExecutableFile())
|
||||||
return false;
|
return false;
|
||||||
@@ -134,8 +134,7 @@ void SquishPlugin::initialize()
|
|||||||
|
|
||||||
bool SquishPlugin::delayedInitialize()
|
bool SquishPlugin::delayedInitialize()
|
||||||
{
|
{
|
||||||
|
connect(&dd->m_squishSettings.squishPath, &Utils::BaseAspect::changed,
|
||||||
connect(&dd->m_squishSettings, &SquishSettings::squishPathChanged,
|
|
||||||
dd, &SquishPluginPrivate::initializeGlobalScripts);
|
dd, &SquishPluginPrivate::initializeGlobalScripts);
|
||||||
|
|
||||||
return dd->initializeGlobalScripts();
|
return dd->initializeGlobalScripts();
|
||||||
|
|||||||
@@ -36,10 +36,8 @@ SquishSettings::SquishSettings()
|
|||||||
setSettingsGroup("Squish");
|
setSettingsGroup("Squish");
|
||||||
setAutoApply(false);
|
setAutoApply(false);
|
||||||
|
|
||||||
registerAspect(&squishPath);
|
|
||||||
squishPath.setSettingsKey("SquishPath");
|
squishPath.setSettingsKey("SquishPath");
|
||||||
squishPath.setLabelText(Tr::tr("Squish path:"));
|
squishPath.setLabelText(Tr::tr("Squish path:"));
|
||||||
squishPath.setDisplayStyle(StringAspect::PathChooserDisplay);
|
|
||||||
squishPath.setExpectedKind(PathChooser::ExistingDirectory);
|
squishPath.setExpectedKind(PathChooser::ExistingDirectory);
|
||||||
squishPath.setPlaceHolderText(Tr::tr("Path to Squish installation"));
|
squishPath.setPlaceHolderText(Tr::tr("Path to Squish installation"));
|
||||||
squishPath.setValidationFunction([this](FancyLineEdit *edit, QString *error) {
|
squishPath.setValidationFunction([this](FancyLineEdit *edit, QString *error) {
|
||||||
@@ -54,37 +52,30 @@ SquishSettings::SquishSettings()
|
|||||||
return valid;
|
return valid;
|
||||||
});
|
});
|
||||||
|
|
||||||
registerAspect(&licensePath);
|
|
||||||
licensePath.setSettingsKey("LicensePath");
|
licensePath.setSettingsKey("LicensePath");
|
||||||
licensePath.setLabelText(Tr::tr("License path:"));
|
licensePath.setLabelText(Tr::tr("License path:"));
|
||||||
licensePath.setDisplayStyle(StringAspect::PathChooserDisplay);
|
|
||||||
licensePath.setExpectedKind(PathChooser::ExistingDirectory);
|
licensePath.setExpectedKind(PathChooser::ExistingDirectory);
|
||||||
|
|
||||||
registerAspect(&local);
|
|
||||||
local.setSettingsKey("Local");
|
local.setSettingsKey("Local");
|
||||||
local.setLabel(Tr::tr("Local Server"));
|
local.setLabel(Tr::tr("Local Server"));
|
||||||
local.setDefaultValue(true);
|
local.setDefaultValue(true);
|
||||||
|
|
||||||
registerAspect(&serverHost);
|
|
||||||
serverHost.setSettingsKey("ServerHost");
|
serverHost.setSettingsKey("ServerHost");
|
||||||
serverHost.setLabelText(Tr::tr("Server host:"));
|
serverHost.setLabelText(Tr::tr("Server host:"));
|
||||||
serverHost.setDisplayStyle(StringAspect::LineEditDisplay);
|
serverHost.setDisplayStyle(StringAspect::LineEditDisplay);
|
||||||
serverHost.setDefaultValue("localhost");
|
serverHost.setDefaultValue("localhost");
|
||||||
serverHost.setEnabled(false);
|
serverHost.setEnabled(false);
|
||||||
|
|
||||||
registerAspect(&serverPort);
|
|
||||||
serverPort.setSettingsKey("ServerPort");
|
serverPort.setSettingsKey("ServerPort");
|
||||||
serverPort.setLabel(Tr::tr("Server Port"));
|
serverPort.setLabel(Tr::tr("Server Port"));
|
||||||
serverPort.setRange(1, 65535);
|
serverPort.setRange(1, 65535);
|
||||||
serverPort.setDefaultValue(9999);
|
serverPort.setDefaultValue(9999);
|
||||||
serverPort.setEnabled(false);
|
serverPort.setEnabled(false);
|
||||||
|
|
||||||
registerAspect(&verbose);
|
|
||||||
verbose.setSettingsKey("Verbose");
|
verbose.setSettingsKey("Verbose");
|
||||||
verbose.setLabel(Tr::tr("Verbose log"));
|
verbose.setLabel(Tr::tr("Verbose log"));
|
||||||
verbose.setDefaultValue(false);
|
verbose.setDefaultValue(false);
|
||||||
|
|
||||||
registerAspect(&minimizeIDE);
|
|
||||||
minimizeIDE.setSettingsKey("MinimizeIDE");
|
minimizeIDE.setSettingsKey("MinimizeIDE");
|
||||||
minimizeIDE.setLabel(Tr::tr("Minimize IDE"));
|
minimizeIDE.setLabel(Tr::tr("Minimize IDE"));
|
||||||
minimizeIDE.setToolTip(Tr::tr("Minimize IDE automatically while running or recording test cases."));
|
minimizeIDE.setToolTip(Tr::tr("Minimize IDE automatically while running or recording test cases."));
|
||||||
@@ -94,13 +85,11 @@ SquishSettings::SquishSettings()
|
|||||||
serverHost.setEnabled(!checked);
|
serverHost.setEnabled(!checked);
|
||||||
serverPort.setEnabled(!checked);
|
serverPort.setEnabled(!checked);
|
||||||
});
|
});
|
||||||
connect(&squishPath, &Utils::StringAspect::valueChanged,
|
|
||||||
this, &SquishSettings::squishPathChanged);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::FilePath SquishSettings::scriptsPath(Language language) const
|
Utils::FilePath SquishSettings::scriptsPath(Language language) const
|
||||||
{
|
{
|
||||||
Utils::FilePath scripts = squishPath.filePath().pathAppended("scriptmodules");
|
Utils::FilePath scripts = squishPath().pathAppended("scriptmodules");
|
||||||
switch (language) {
|
switch (language) {
|
||||||
case Language::Python: scripts = scripts.pathAppended("python"); break;
|
case Language::Python: scripts = scripts.pathAppended("python"); break;
|
||||||
case Language::Perl: scripts = scripts.pathAppended("perl"); break;
|
case Language::Perl: scripts = scripts.pathAppended("perl"); break;
|
||||||
@@ -139,7 +128,6 @@ SquishSettingsPage::SquishSettingsPage(SquishSettings *settings)
|
|||||||
|
|
||||||
SquishServerSettings::SquishServerSettings()
|
SquishServerSettings::SquishServerSettings()
|
||||||
{
|
{
|
||||||
registerAspect(&autTimeout);
|
|
||||||
autTimeout.setLabel(Tr::tr("Maximum startup time:"));
|
autTimeout.setLabel(Tr::tr("Maximum startup time:"));
|
||||||
autTimeout.setToolTip(Tr::tr("Specifies how many seconds Squish should wait for a reply from the "
|
autTimeout.setToolTip(Tr::tr("Specifies how many seconds Squish should wait for a reply from the "
|
||||||
"AUT directly after starting it."));
|
"AUT directly after starting it."));
|
||||||
@@ -147,7 +135,6 @@ SquishServerSettings::SquishServerSettings()
|
|||||||
autTimeout.setSuffix("s");
|
autTimeout.setSuffix("s");
|
||||||
autTimeout.setDefaultValue(20);
|
autTimeout.setDefaultValue(20);
|
||||||
|
|
||||||
registerAspect(&responseTimeout);
|
|
||||||
responseTimeout.setLabel(Tr::tr("Maximum response time:"));
|
responseTimeout.setLabel(Tr::tr("Maximum response time:"));
|
||||||
responseTimeout.setToolTip(Tr::tr("Specifies how many seconds Squish should wait for a reply from "
|
responseTimeout.setToolTip(Tr::tr("Specifies how many seconds Squish should wait for a reply from "
|
||||||
"the hooked up AUT before raising a timeout error."));
|
"the hooked up AUT before raising a timeout error."));
|
||||||
@@ -155,7 +142,6 @@ SquishServerSettings::SquishServerSettings()
|
|||||||
responseTimeout.setDefaultValue(300);
|
responseTimeout.setDefaultValue(300);
|
||||||
responseTimeout.setSuffix("s");
|
responseTimeout.setSuffix("s");
|
||||||
|
|
||||||
registerAspect(&postMortemWaitTime);
|
|
||||||
postMortemWaitTime.setLabel(Tr::tr("Maximum post-mortem wait time:"));
|
postMortemWaitTime.setLabel(Tr::tr("Maximum post-mortem wait time:"));
|
||||||
postMortemWaitTime.setToolTip(Tr::tr("Specifies how many seconds Squish should wait after the the "
|
postMortemWaitTime.setToolTip(Tr::tr("Specifies how many seconds Squish should wait after the the "
|
||||||
"first AUT process has exited."));
|
"first AUT process has exited."));
|
||||||
@@ -163,7 +149,6 @@ SquishServerSettings::SquishServerSettings()
|
|||||||
postMortemWaitTime.setDefaultValue(1500);
|
postMortemWaitTime.setDefaultValue(1500);
|
||||||
postMortemWaitTime.setSuffix("ms");
|
postMortemWaitTime.setSuffix("ms");
|
||||||
|
|
||||||
registerAspect(&animatedCursor);
|
|
||||||
animatedCursor.setLabel(Tr::tr("Animate mouse cursor:"));
|
animatedCursor.setLabel(Tr::tr("Animate mouse cursor:"));
|
||||||
animatedCursor.setDefaultValue(true);
|
animatedCursor.setDefaultValue(true);
|
||||||
}
|
}
|
||||||
@@ -250,10 +235,10 @@ void SquishServerSettings::setFromXmlOutput(const QString &output)
|
|||||||
autPaths = newSettings.autPaths;
|
autPaths = newSettings.autPaths;
|
||||||
attachableAuts = newSettings.attachableAuts;
|
attachableAuts = newSettings.attachableAuts;
|
||||||
licensedToolkits = newSettings.licensedToolkits;
|
licensedToolkits = newSettings.licensedToolkits;
|
||||||
autTimeout.setValue(newSettings.autTimeout.value());
|
autTimeout.setValue(newSettings.autTimeout());
|
||||||
postMortemWaitTime.setValue(newSettings.postMortemWaitTime.value());
|
postMortemWaitTime.setValue(newSettings.postMortemWaitTime());
|
||||||
responseTimeout.setValue(newSettings.responseTimeout.value());
|
responseTimeout.setValue(newSettings.responseTimeout());
|
||||||
animatedCursor.setValue(newSettings.animatedCursor.value());
|
animatedCursor.setValue(newSettings.animatedCursor());
|
||||||
}
|
}
|
||||||
|
|
||||||
class SquishServerItem : public TreeItem
|
class SquishServerItem : public TreeItem
|
||||||
@@ -625,14 +610,14 @@ QList<QStringList> SquishServerSettingsWidget::toConfigChangeArguments() const
|
|||||||
result.append({"addAppPath", path});
|
result.append({"addAppPath", path});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_originalSettings.autTimeout.value() != m_serverSettings.autTimeout.value())
|
if (m_originalSettings.autTimeout() != m_serverSettings.autTimeout())
|
||||||
result.append({"setAUTTimeout", QString::number(m_serverSettings.autTimeout.value())});
|
result.append({"setAUTTimeout", QString::number(m_serverSettings.autTimeout())});
|
||||||
if (m_originalSettings.responseTimeout.value() != m_serverSettings.responseTimeout.value())
|
if (m_originalSettings.responseTimeout() != m_serverSettings.responseTimeout())
|
||||||
result.append({"setResponseTimeout", QString::number(m_serverSettings.responseTimeout.value())});
|
result.append({"setResponseTimeout", QString::number(m_serverSettings.responseTimeout())});
|
||||||
if (m_originalSettings.postMortemWaitTime.value() != m_serverSettings.postMortemWaitTime.value())
|
if (m_originalSettings.postMortemWaitTime() != m_serverSettings.postMortemWaitTime())
|
||||||
result.append({"setAUTPostMortemTimeout", QString::number(m_serverSettings.postMortemWaitTime.value())});
|
result.append({"setAUTPostMortemTimeout", QString::number(m_serverSettings.postMortemWaitTime())});
|
||||||
if (m_originalSettings.animatedCursor.value() != m_serverSettings.animatedCursor.value())
|
if (m_originalSettings.animatedCursor() != m_serverSettings.animatedCursor())
|
||||||
result.append({"setCursorAnimation", m_serverSettings.animatedCursor.value() ? QString("on") : QString("off")});
|
result.append({"setCursorAnimation", m_serverSettings.animatedCursor() ? QString("on") : QString("off")});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,7 @@
|
|||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
namespace Squish::Internal {
|
||||||
class QSettings;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Squish {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
enum class Language;
|
enum class Language;
|
||||||
|
|
||||||
@@ -30,30 +25,26 @@ public:
|
|||||||
QMap<QString, QString> attachableAuts; // name, host:port
|
QMap<QString, QString> attachableAuts; // name, host:port
|
||||||
QStringList autPaths; // absolute path
|
QStringList autPaths; // absolute path
|
||||||
QStringList licensedToolkits;
|
QStringList licensedToolkits;
|
||||||
Utils::IntegerAspect autTimeout;
|
Utils::IntegerAspect autTimeout{this};
|
||||||
Utils::IntegerAspect responseTimeout;
|
Utils::IntegerAspect responseTimeout{this};
|
||||||
Utils::IntegerAspect postMortemWaitTime;
|
Utils::IntegerAspect postMortemWaitTime{this};
|
||||||
Utils::BoolAspect animatedCursor;
|
Utils::BoolAspect animatedCursor{this};
|
||||||
};
|
};
|
||||||
|
|
||||||
class SquishSettings : public Utils::AspectContainer
|
class SquishSettings : public Utils::AspectContainer
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
public:
|
public:
|
||||||
SquishSettings();
|
SquishSettings();
|
||||||
|
|
||||||
Utils::FilePath scriptsPath(Language language) const;
|
Utils::FilePath scriptsPath(Language language) const;
|
||||||
|
|
||||||
Utils::StringAspect squishPath;
|
Utils::FilePathAspect squishPath{this};
|
||||||
Utils::StringAspect licensePath;
|
Utils::FilePathAspect licensePath{this};
|
||||||
Utils::StringAspect serverHost;
|
Utils::StringAspect serverHost{this};
|
||||||
Utils::IntegerAspect serverPort;
|
Utils::IntegerAspect serverPort{this};
|
||||||
Utils::BoolAspect local;
|
Utils::BoolAspect local{this};
|
||||||
Utils::BoolAspect verbose;
|
Utils::BoolAspect verbose{this};
|
||||||
Utils::BoolAspect minimizeIDE;
|
Utils::BoolAspect minimizeIDE{this};
|
||||||
|
|
||||||
signals:
|
|
||||||
void squishPathChanged();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SquishSettingsPage final : public Core::IOptionsPage
|
class SquishSettingsPage final : public Core::IOptionsPage
|
||||||
@@ -71,5 +62,4 @@ private:
|
|||||||
void configWriteFailed(QProcess::ProcessError error);
|
void configWriteFailed(QProcess::ProcessError error);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // Squish::Internal
|
||||||
} // namespace Squish
|
|
||||||
|
|||||||
@@ -166,7 +166,6 @@ static bool copyScriptTemplates(const SuiteConf &suiteConf, const Utils::FilePat
|
|||||||
const SquishSettings *s = SquishPlugin::squishSettings();
|
const SquishSettings *s = SquishPlugin::squishSettings();
|
||||||
QTC_ASSERT(s, return false);
|
QTC_ASSERT(s, return false);
|
||||||
// copy template files
|
// copy template files
|
||||||
const Utils::FilePath squishPath = s->squishPath.filePath();
|
|
||||||
|
|
||||||
bool ok = destination.ensureWritableDir();
|
bool ok = destination.ensureWritableDir();
|
||||||
QTC_ASSERT(ok, return false);
|
QTC_ASSERT(ok, return false);
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ struct SquishToolsSettings
|
|||||||
{
|
{
|
||||||
const SquishSettings *squishSettings = SquishPlugin::squishSettings();
|
const SquishSettings *squishSettings = SquishPlugin::squishSettings();
|
||||||
QTC_ASSERT(squishSettings, return);
|
QTC_ASSERT(squishSettings, return);
|
||||||
squishPath = squishSettings->squishPath.filePath();
|
squishPath = squishSettings->squishPath();
|
||||||
|
|
||||||
if (!squishPath.isEmpty()) {
|
if (!squishPath.isEmpty()) {
|
||||||
const FilePath squishBin(squishPath.pathAppended("bin"));
|
const FilePath squishBin(squishPath.pathAppended("bin"));
|
||||||
@@ -181,12 +181,12 @@ struct SquishToolsSettings
|
|||||||
HostOsInfo::withExecutableSuffix("processcomm")).absoluteFilePath();
|
HostOsInfo::withExecutableSuffix("processcomm")).absoluteFilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
isLocalServer = squishSettings->local.value();
|
isLocalServer = squishSettings->local();
|
||||||
serverHost = squishSettings->serverHost.value();
|
serverHost = squishSettings->serverHost();
|
||||||
serverPort = squishSettings->serverPort.value();
|
serverPort = squishSettings->serverPort();
|
||||||
verboseLog = squishSettings->verbose.value();
|
verboseLog = squishSettings->verbose();
|
||||||
licenseKeyPath = squishSettings->licensePath.filePath();
|
licenseKeyPath = squishSettings->licensePath();
|
||||||
minimizeIDE = squishSettings->minimizeIDE.value();
|
minimizeIDE = squishSettings->minimizeIDE();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ bool SquishToolkitsPage::handleReject()
|
|||||||
void SquishToolkitsPage::delayedInitialize()
|
void SquishToolkitsPage::delayedInitialize()
|
||||||
{
|
{
|
||||||
const auto s = SquishPlugin::squishSettings();
|
const auto s = SquishPlugin::squishSettings();
|
||||||
const Utils::FilePath server = s->squishPath.filePath().pathAppended(
|
const Utils::FilePath server = s->squishPath().pathAppended(
|
||||||
Utils::HostOsInfo::withExecutableSuffix("bin/squishserver"));
|
Utils::HostOsInfo::withExecutableSuffix("bin/squishserver"));
|
||||||
if (server.isExecutableFile())
|
if (server.isExecutableFile())
|
||||||
fetchServerSettings();
|
fetchServerSettings();
|
||||||
|
|||||||
Reference in New Issue
Block a user