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

Reviewed-by: ck
This commit is contained in:
kh1
2010-04-16 16:34:45 +02:00
parent 6027c5a031
commit a8db81fb08
3 changed files with 81 additions and 14 deletions

View File

@@ -128,6 +128,10 @@ void MaemoConfigTestDialog::handleTestThreadFinished()
output = parseTestOutput(); output = parseTestOutput();
} }
m_ui->testResultEdit->setPlainText(output); 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(); stopConfigTest();
} }
@@ -153,28 +157,36 @@ void MaemoConfigTestDialog::processSshOutput(const QString &data)
QString MaemoConfigTestDialog::parseTestOutput() QString MaemoConfigTestDialog::parseTestOutput()
{ {
m_qtVersionOk = false;
QString output; QString output;
const QRegExp unamePattern(QLatin1String("Linux (\\S+)\\s(\\S+)")); const QRegExp unamePattern(QLatin1String("Linux (\\S+)\\s(\\S+)"));
int index = unamePattern.indexIn(m_deviceTestOutput); int index = unamePattern.indexIn(m_deviceTestOutput);
if (index == -1) { 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; return output;
} }
output = tr("Hardware architecture: %1\n").arg(unamePattern.cap(2)); output = tr("Hardware architecture: %1\n").arg(unamePattern.cap(2));
output.append(tr("Kernel version: %1\n").arg(unamePattern.cap(1))); output.append(tr("Kernel version: %1\n").arg(unamePattern.cap(1)));
output.prepend(tr("Device configuration successful.\n")); 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); index = dkpgPattern.indexIn(m_deviceTestOutput);
if (index == -1) { if (index == -1) {
output.append("No Qt packages installed."); output.append(tr("No Qt packages installed."));
return output; return output;
} }
output.append("List of installed Qt packages:\n");
output.append(tr("List of installed Qt packages:") + QLatin1Char('\n'));
do { do {
output.append(QLatin1String("\t") + dkpgPattern.cap(0) output.append(QLatin1Char('\t') + dkpgPattern.cap(0)
+ QLatin1String("\n")); + QLatin1Char('\n'));
index = dkpgPattern.indexIn(m_deviceTestOutput, index + 1); 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); } while (index != -1);
return output; return output;
} }

View File

@@ -73,6 +73,7 @@ private:
const MaemoDeviceConfig &m_config; const MaemoDeviceConfig &m_config;
MaemoSshRunner *m_deviceTester; MaemoSshRunner *m_deviceTester;
QString m_deviceTestOutput; QString m_deviceTestOutput;
bool m_qtVersionOk;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -21,8 +21,60 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<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> <item>
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@@ -32,6 +84,8 @@
</widget> </widget>
</item> </item>
</layout> </layout>
</item>
</layout>
</widget> </widget>
<resources/> <resources/>
<connections> <connections>