forked from qt-creator/qt-creator
Android: Make errors visible
Change-Id: Ic0a1ebbc932c5854f7b41572a96a1c6b6c8896a0 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -56,6 +56,7 @@ class SummaryWidget : public QWidget
|
||||
public:
|
||||
InfoLabel *m_infoLabel = nullptr;
|
||||
bool m_valid = false;
|
||||
QString m_validText;
|
||||
};
|
||||
|
||||
public:
|
||||
@@ -73,6 +74,7 @@ public:
|
||||
for (auto itr = validationPoints.cbegin(); itr != validationPoints.cend(); ++itr) {
|
||||
RowData data;
|
||||
data.m_infoLabel = new InfoLabel(itr.value());
|
||||
data.m_validText = itr.value();
|
||||
layout->addWidget(data.m_infoLabel);
|
||||
m_validationData[itr.key()] = data;
|
||||
setPointValid(itr.key(), false);
|
||||
@@ -81,13 +83,20 @@ public:
|
||||
setContentsMargins(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
void setPointValid(int key, bool valid)
|
||||
template<class T>
|
||||
void setPointValid(int key, const expected_str<T> &test)
|
||||
{
|
||||
setPointValid(key, test.has_value(), test.has_value() ? QString{} : test.error());
|
||||
}
|
||||
|
||||
void setPointValid(int key, bool valid, const QString errorText = {})
|
||||
{
|
||||
if (!m_validationData.contains(key))
|
||||
return;
|
||||
RowData &data = m_validationData[key];
|
||||
data.m_valid = valid;
|
||||
data.m_infoLabel->setType(valid ? InfoLabel::Ok : InfoLabel::NotOk);
|
||||
data.m_infoLabel->setText(valid || errorText.isEmpty() ? data.m_validText : errorText);
|
||||
updateUi();
|
||||
}
|
||||
|
||||
@@ -598,7 +607,7 @@ void AndroidSettingsWidget::validateJdk()
|
||||
androidConfig().setOpenJDKLocation(m_openJdkLocationPathChooser->filePath());
|
||||
expected_str<void> test = testJavaC(androidConfig().openJDKLocation());
|
||||
|
||||
m_androidSummary->setPointValid(JavaPathExistsAndWritableRow, test.has_value());
|
||||
m_androidSummary->setPointValid(JavaPathExistsAndWritableRow, test);
|
||||
|
||||
updateUI();
|
||||
|
||||
|
Reference in New Issue
Block a user