Squish: Provide error message for license issues

Change-Id: I1b3ca3aba19df2fbc2accd9ecf9e4ec2d862c6d8
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2022-10-10 10:55:32 +02:00
parent 9e2ec17f36
commit c09351e101
5 changed files with 17 additions and 5 deletions

View File

@@ -74,7 +74,7 @@ public:
auto squishTools = SquishTools::instance(); auto squishTools = SquishTools::instance();
connect(squishTools, &SquishTools::queryFinished, this, connect(squishTools, &SquishTools::queryFinished, this,
[this] (const QString &out) { [this] (const QString &out, const QString &) {
SquishServerSettings s; SquishServerSettings s;
s.setFromXmlOutput(out); s.setFromXmlOutput(out);
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();

View File

@@ -393,7 +393,7 @@ SquishServerSettingsWidget::SquishServerSettingsWidget(QWidget *parent)
// query settings // query settings
SquishTools *squishTools = SquishTools::instance(); SquishTools *squishTools = SquishTools::instance();
connect(squishTools, &SquishTools::queryFinished, this, connect(squishTools, &SquishTools::queryFinished, this,
[this, progress] (const QString &out) { [this, progress] (const QString &out, const QString &) {
m_serverSettings.setFromXmlOutput(out); m_serverSettings.setFromXmlOutput(out);
m_originalSettings.setFromXmlOutput(out); m_originalSettings.setFromXmlOutput(out);
repopulateApplicationView(); repopulateApplicationView();

View File

@@ -521,6 +521,7 @@ void SquishTools::startSquishServer(Request request)
{ {
if (m_shutdownInitiated) if (m_shutdownInitiated)
return; return;
m_licenseIssues = false;
QTC_ASSERT(m_perspective.perspectiveMode() != SquishPerspective::NoMode, return); QTC_ASSERT(m_perspective.perspectiveMode() != SquishPerspective::NoMode, return);
m_request = request; m_request = request;
if (m_serverProcess.state() != QProcess::NotRunning) { if (m_serverProcess.state() != QProcess::NotRunning) {
@@ -683,7 +684,9 @@ void SquishTools::onRunnerFinished()
{ {
qCDebug(LOG) << "Runner finished"; qCDebug(LOG) << "Runner finished";
if (m_request == RunnerQueryRequested) { if (m_request == RunnerQueryRequested) {
emit queryFinished(m_fullRunnerOutput); const QString error = m_licenseIssues ? Tr::tr("Could not get Squish license from server.")
: QString();
emit queryFinished(m_fullRunnerOutput, error);
setState(RunnerStopped); setState(RunnerStopped);
m_fullRunnerOutput.clear(); m_fullRunnerOutput.clear();
return; return;
@@ -894,6 +897,9 @@ void SquishTools::onRunnerErrorOutput()
"squishserver settings.\n" "squishserver settings.\n"
"(Tools > Squish > Server Settings...)") "(Tools > Squish > Server Settings...)")
.arg(m_suiteConf.aut())); .arg(m_suiteConf.aut()));
} else if (trimmed.startsWith("Couldn't get license")
|| trimmed.contains("UNLICENSED version of Squish")) {
m_licenseIssues = true;
} }
} }
} }

View File

@@ -77,7 +77,7 @@ signals:
void squishTestRunStarted(); void squishTestRunStarted();
void squishTestRunFinished(); void squishTestRunFinished();
void resultOutputCreated(const QByteArray &output); void resultOutputCreated(const QByteArray &output);
void queryFinished(const QString &output); void queryFinished(const QString &output, const QString &error);
void configChangesFailed(QProcess::ProcessError error); void configChangesFailed(QProcess::ProcessError error);
void configChangesWritten(); void configChangesWritten();
void localsUpdated(const QString &output); void localsUpdated(const QString &output);
@@ -163,6 +163,7 @@ private:
int m_autId = 0; int m_autId = 0;
bool m_shutdownInitiated = false; bool m_shutdownInitiated = false;
bool m_closeRunnerOnEndRecord = false; bool m_closeRunnerOnEndRecord = false;
bool m_licenseIssues = false;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -127,7 +127,7 @@ void SquishToolkitsPage::fetchServerSettings()
QTC_ASSERT(squishTools, return); QTC_ASSERT(squishTools, return);
connect(squishTools, &SquishTools::queryFinished, this, connect(squishTools, &SquishTools::queryFinished, this,
[this] (const QString &out) { [this] (const QString &out, const QString &error) {
SquishServerSettings s; SquishServerSettings s;
s.setFromXmlOutput(out); s.setFromXmlOutput(out);
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
@@ -143,6 +143,11 @@ void SquishToolkitsPage::fetchServerSettings()
} }
} }
m_hiddenLineEdit->setText(s.mappedAuts.keys().join('\n')); m_hiddenLineEdit->setText(s.mappedAuts.keys().join('\n'));
if (!error.isEmpty()) {
m_errorLabel->setText(error);
m_errorLabel->setVisible(true);
}
}); });
QApplication::setOverrideCursor(Qt::WaitCursor); QApplication::setOverrideCursor(Qt::WaitCursor);
squishTools->queryServerSettings(); squishTools->queryServerSettings();