Commit a8db81fb authored by kh1's avatar kh1
Browse files

Implement Qt version check in test dialog and show error next to close.

Reviewed-by: ck
parent 6027c5a0
......@@ -128,6 +128,10 @@ void MaemoConfigTestDialog::handleTestThreadFinished()
output = parseTestOutput();
}
m_ui->testResultEdit->setPlainText(output);
if (!m_qtVersionOk) {
m_ui->errorLabel->setText(tr("Qt version mismatch! Expected Qt on device: "
"4.6.2 or later."));
}
stopConfigTest();
}
......@@ -153,28 +157,36 @@ void MaemoConfigTestDialog::processSshOutput(const QString &data)
QString MaemoConfigTestDialog::parseTestOutput()
{
m_qtVersionOk = false;
QString output;
const QRegExp unamePattern(QLatin1String("Linux (\\S+)\\s(\\S+)"));
int index = unamePattern.indexIn(m_deviceTestOutput);
if (index == -1) {
output = tr("Device configuration test failed: Unexpected output:\n%1").arg(m_deviceTestOutput);
output = tr("Device configuration test failed: Unexpected output:\n%1")
.arg(m_deviceTestOutput);
return output;
}
output = tr("Hardware architecture: %1\n").arg(unamePattern.cap(2));
output.append(tr("Kernel version: %1\n").arg(unamePattern.cap(1)));
output.prepend(tr("Device configuration successful.\n"));
const QRegExp dkpgPattern(QLatin1String("libqt\\S+ \\d\\.\\d\\.\\d"));
const QRegExp dkpgPattern(QLatin1String("libqt\\S+ (\\d)\\.(\\d)\\.(\\d)"));
index = dkpgPattern.indexIn(m_deviceTestOutput);
if (index == -1) {
output.append("No Qt packages installed.");
output.append(tr("No Qt packages installed."));
return output;
}
output.append("List of installed Qt packages:\n");
output.append(tr("List of installed Qt packages:") + QLatin1Char('\n'));
do {
output.append(QLatin1String("\t") + dkpgPattern.cap(0)
+ QLatin1String("\n"));
output.append(QLatin1Char('\t') + dkpgPattern.cap(0)
+ QLatin1Char('\n'));
index = dkpgPattern.indexIn(m_deviceTestOutput, index + 1);
if (!m_qtVersionOk && QT_VERSION_CHECK(dkpgPattern.cap(1).toInt(),
dkpgPattern.cap(2).toInt(), dkpgPattern.cap(3).toInt()) >= 0x040602) {
m_qtVersionOk = true;
}
} while (index != -1);
return output;
}
......
......@@ -73,6 +73,7 @@ private:
const MaemoDeviceConfig &m_config;
MaemoSshRunner *m_deviceTester;
QString m_deviceTestOutput;
bool m_qtVersionOk;
};
} // namespace Internal
......
......@@ -22,14 +22,68 @@
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="errorLabel">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment