forked from qt-creator/qt-creator
Squish: Cancel wizard early if settings are wrong
Add an error label for the user and stop internal actions to avoid displaying error message dialogs with less helpful information. Change-Id: Ie0d075121fabb56b67300eaf6c0ebde674475b9c Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -4,10 +4,12 @@
|
|||||||
#include "squishwizardpages.h"
|
#include "squishwizardpages.h"
|
||||||
|
|
||||||
#include "squishfilehandler.h"
|
#include "squishfilehandler.h"
|
||||||
|
#include "squishplugin.h"
|
||||||
#include "squishsettings.h"
|
#include "squishsettings.h"
|
||||||
#include "squishtools.h"
|
#include "squishtools.h"
|
||||||
#include "squishtr.h"
|
#include "squishtr.h"
|
||||||
|
|
||||||
|
#include <utils/infolabel.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@@ -47,7 +49,7 @@ SquishToolkitsPage::SquishToolkitsPage()
|
|||||||
resize(400, 300);
|
resize(400, 300);
|
||||||
setTitle(Tr::tr("Create New Squish Test Suite"));
|
setTitle(Tr::tr("Create New Squish Test Suite"));
|
||||||
|
|
||||||
auto layout = new QHBoxLayout(this);
|
auto layout = new QVBoxLayout(this);
|
||||||
auto groupBox = new QGroupBox(Tr::tr("Available GUI toolkits:"), this);
|
auto groupBox = new QGroupBox(Tr::tr("Available GUI toolkits:"), this);
|
||||||
auto buttonLayout = new QVBoxLayout(groupBox);
|
auto buttonLayout = new QVBoxLayout(groupBox);
|
||||||
|
|
||||||
@@ -63,6 +65,15 @@ SquishToolkitsPage::SquishToolkitsPage()
|
|||||||
}
|
}
|
||||||
groupBox->setLayout(buttonLayout);
|
groupBox->setLayout(buttonLayout);
|
||||||
layout->addWidget(groupBox);
|
layout->addWidget(groupBox);
|
||||||
|
|
||||||
|
m_errorLabel = new Utils::InfoLabel(Tr::tr("Invalid Squish settings. Configure Squish "
|
||||||
|
"installation path inside "
|
||||||
|
"Preferences... > Squish > General to use "
|
||||||
|
"this wizard."),
|
||||||
|
Utils::InfoLabel::Error, this);
|
||||||
|
m_errorLabel->setVisible(false);
|
||||||
|
layout->addWidget(m_errorLabel);
|
||||||
|
|
||||||
auto hiddenLineEdit = new QLineEdit(this);
|
auto hiddenLineEdit = new QLineEdit(this);
|
||||||
hiddenLineEdit->setVisible(false);
|
hiddenLineEdit->setVisible(false);
|
||||||
layout->addWidget(hiddenLineEdit);
|
layout->addWidget(hiddenLineEdit);
|
||||||
@@ -99,7 +110,13 @@ bool SquishToolkitsPage::handleReject()
|
|||||||
|
|
||||||
void SquishToolkitsPage::delayedInitialize()
|
void SquishToolkitsPage::delayedInitialize()
|
||||||
{
|
{
|
||||||
|
const auto s = SquishPlugin::squishSettings();
|
||||||
|
const Utils::FilePath server = s->squishPath.filePath().pathAppended(
|
||||||
|
Utils::HostOsInfo::withExecutableSuffix("bin/squishserver"));
|
||||||
|
if (server.isExecutableFile())
|
||||||
fetchServerSettings();
|
fetchServerSettings();
|
||||||
|
else
|
||||||
|
m_errorLabel->setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SquishToolkitsPage::fetchServerSettings()
|
void SquishToolkitsPage::fetchServerSettings()
|
||||||
|
@@ -13,6 +13,8 @@ class QComboBox;
|
|||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
namespace Utils { class InfoLabel; }
|
||||||
|
|
||||||
namespace Squish {
|
namespace Squish {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -43,6 +45,7 @@ private:
|
|||||||
|
|
||||||
QButtonGroup *m_buttonGroup = nullptr;
|
QButtonGroup *m_buttonGroup = nullptr;
|
||||||
QLineEdit *m_hiddenLineEdit = nullptr;
|
QLineEdit *m_hiddenLineEdit = nullptr;
|
||||||
|
Utils::InfoLabel *m_errorLabel = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SquishScriptLanguagePageFactory : public ProjectExplorer::JsonWizardPageFactory
|
class SquishScriptLanguagePageFactory : public ProjectExplorer::JsonWizardPageFactory
|
||||||
|
Reference in New Issue
Block a user