From aa2ab9492fc7ec7c39dfcc16de23f41690473651 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 4 Feb 2011 10:34:29 +0100 Subject: [PATCH] Maemo: Use rpm for listing packages on Meego devices. --- .../qt-maemo/maemoconfigtestdialog.cpp | 33 ++++++++++------- .../qt-maemo/maemodeviceconfigwizard.cpp | 36 +++++++++++++------ .../maemodeviceconfigwizardstartpage.ui | 4 +-- .../qt-maemo/maemoglobal.cpp | 4 +++ .../qt4projectmanager/qt-maemo/maemoglobal.h | 3 ++ 5 files changed, 56 insertions(+), 24 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoconfigtestdialog.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoconfigtestdialog.cpp index 09c67b0d833..01dd025f71e 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoconfigtestdialog.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoconfigtestdialog.cpp @@ -81,7 +81,10 @@ void MaemoConfigTestDialog::startConfigTest() return; m_currentTest = GeneralTest; - m_ui->testResultEdit->setPlainText(tr("Testing configuration...")); + const QString testingText = m_config->type() == MaemoDeviceConfig::Simulator + ? tr("Testing configuration. This may take a while.") + : tr("Testing configuration..."); + m_ui->testResultEdit->setPlainText(testingText); m_closeButton->setText(tr("Stop Test")); m_testProcessRunner = SshRemoteProcessRunner::create(m_config->sshParameters()); connect(m_testProcessRunner.data(), SIGNAL(connectionError(Core::SshError)), @@ -91,9 +94,12 @@ void MaemoConfigTestDialog::startConfigTest() connect(m_testProcessRunner.data(), SIGNAL(processOutputAvailable(QByteArray)), this, SLOT(processSshOutput(QByteArray))); - QLatin1String sysInfoCmd("uname -rsm"); - QLatin1String qtInfoCmd("dpkg-query -W -f '${Package} ${Version} ${Status}\n' 'libqt*' " - "|grep ' installed$'"); + const QLatin1String sysInfoCmd("uname -rsm"); + const bool osUsesRpm = MaemoGlobal::packagingSystem(m_config->osVersion()) == MaemoGlobal::Rpm; + const QLatin1String qtInfoCmd(osUsesRpm + ? "rpm -qa 'libqt*' --queryformat '%{NAME} %{VERSION}\\n'" + : "dpkg-query -W -f '${Package} ${Version} ${Status}\n' 'libqt*' " + "|grep ' installed$'"); QString command(sysInfoCmd + " && " + qtInfoCmd); m_testProcessRunner->run(command.toUtf8()); } @@ -229,8 +235,11 @@ QString MaemoConfigTestDialog::parseTestOutput() output = tr("Hardware architecture: %1\n").arg(unamePattern.cap(2)); output.append(tr("Kernel version: %1\n").arg(unamePattern.cap(1))); - const QRegExp dkpgPattern(QLatin1String("(\\S+) (\\S*(\\d+)\\.(\\d+)\\.(\\d+)\\S*) \\S+ \\S+ \\S+")); - index = dkpgPattern.indexIn(m_deviceTestOutput); + const bool osUsesRpm = MaemoGlobal::packagingSystem(m_config->osVersion()) == MaemoGlobal::Rpm; + const QRegExp packagePattern(QLatin1String(osUsesRpm + ? "(libqt\\S+) ((\\d+)\\.(\\d+)\\.(\\d+))" + : "(\\S+) (\\S*(\\d+)\\.(\\d+)\\.(\\d+)\\S*) \\S+ \\S+ \\S+")); + index = packagePattern.indexIn(m_deviceTestOutput); if (index == -1) { output.append(tr("No Qt packages installed.")); return output; @@ -238,12 +247,12 @@ QString MaemoConfigTestDialog::parseTestOutput() output.append(tr("List of installed Qt packages:") + QLatin1Char('\n')); do { - output.append(QLatin1Char('\t') + dkpgPattern.cap(1) + QLatin1Char(' ') - + dkpgPattern.cap(2) + QLatin1Char('\n')); - index = dkpgPattern.indexIn(m_deviceTestOutput, index - + dkpgPattern.cap(0).length()); - if (!m_qtVersionOk && QT_VERSION_CHECK(dkpgPattern.cap(3).toInt(), - dkpgPattern.cap(4).toInt(), dkpgPattern.cap(5).toInt()) >= 0x040602) { + output.append(QLatin1Char('\t') + packagePattern.cap(1) + QLatin1Char(' ') + + packagePattern.cap(2) + QLatin1Char('\n')); + index = packagePattern.indexIn(m_deviceTestOutput, index + + packagePattern.cap(0).length()); + if (!m_qtVersionOk && QT_VERSION_CHECK(packagePattern.cap(3).toInt(), + packagePattern.cap(4).toInt(), packagePattern.cap(5).toInt()) >= 0x040602) { m_qtVersionOk = true; } } while (index != -1); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizard.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizard.cpp index 4565432948c..7ff1b19a68c 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizard.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizard.cpp @@ -456,20 +456,36 @@ class MaemoDeviceConfigWizardFinalPage : public QWizardPage { Q_OBJECT public: - MaemoDeviceConfigWizardFinalPage(QWidget *parent) : QWizardPage(parent) + MaemoDeviceConfigWizardFinalPage(const WizardData &wizardData, + QWidget *parent) + : QWizardPage(parent), + m_infoLabel(new QLabel(this)), + m_wizardData(wizardData) { setTitle(tr("Setup Finished")); setSubTitle(QLatin1String(" ")); // For Qt bug (background color) - const QString infoText = tr("Setup is complete.\n" - "The new device configuration will now be created and a test " - "procedure will be run to check whether Qt Creator can " - "connect to the device and to provide some information " - "about its features."); - QLabel * const infoLabel = new QLabel(infoText, this); - infoLabel->setWordWrap(true); + m_infoLabel->setWordWrap(true); QVBoxLayout * const layout = new QVBoxLayout(this); - layout->addWidget(infoLabel); + layout->addWidget(m_infoLabel); } + + virtual void initializePage() + { + QString infoText = tr("The new device configuration will now be " + "created and a test procedure will be run to check whether " + "Qt Creator can connect to the device and to provide some " + "information about its features."); + if (m_wizardData.deviceType == MaemoDeviceConfig::Simulator) { + infoText += QLatin1Char('\n') + + tr("Please make sure that Qemu is running, otherwise " + "the test will fail."); + } + m_infoLabel->setText(infoText); + } + +private: + QLabel * const m_infoLabel; + const WizardData &m_wizardData; }; } // anonymous namespace @@ -484,7 +500,7 @@ struct MaemoDeviceConfigWizardPrivate reuseKeysCheckPage(parent), keyCreationPage(parent), keyDeploymentPage(wizardData, parent), - finalPage(parent) + finalPage(wizardData, parent) { } diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizardstartpage.ui b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizardstartpage.ui index bf2b5eeb3ca..8ca9b6ed6aa 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizardstartpage.ui +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceconfigwizardstartpage.ui @@ -6,7 +6,7 @@ 0 0 - 680 + 618 122 @@ -68,7 +68,7 @@ - Emulator (Qemu, should be currently running) + Emulator (Qemu) diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.cpp index 5faaf6e5806..5b9743dde57 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.cpp @@ -300,6 +300,10 @@ QString MaemoGlobal::maemoVersionToString(MaemoVersion version) return QString(); } +MaemoGlobal::PackagingSystem MaemoGlobal::packagingSystem(MaemoVersion maemoVersion) +{ + return maemoVersion == Meego ? Rpm : Dpkg; +} MaemoGlobal::FileUpdate::FileUpdate(const QString &fileName) : m_fileName(fileName) diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.h b/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.h index d03d2365a59..682862ae5e4 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.h @@ -62,6 +62,7 @@ class MaemoGlobal Q_DECLARE_TR_FUNCTIONS(Qt4ProjectManager::Internal::MaemoGlobal) public: enum MaemoVersion { Maemo5, Maemo6, Meego }; + enum PackagingSystem { Dpkg, Rpm }; class FileUpdate { public: @@ -99,6 +100,8 @@ public: static QString maemoVersionToString(MaemoVersion version); + static PackagingSystem packagingSystem(MaemoVersion maemoVersion); + static bool removeRecursively(const QString &filePath, QString &error); template static T *buildStep(const ProjectExplorer::DeployConfiguration *dc)