forked from qt-creator/qt-creator
Moved the testing of a Maemo device configuration into a dialog
Reduces the minimum size of the Options dialog. Reviewed-by: kh1
This commit is contained in:
183
src/plugins/qt4projectmanager/qt-maemo/maemoconfigtestdialog.cpp
Normal file
183
src/plugins/qt4projectmanager/qt-maemo/maemoconfigtestdialog.cpp
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
** All rights reserved.
|
||||||
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** No Commercial Usage
|
||||||
|
** This file contains pre-release code and may not be distributed.
|
||||||
|
** You may use this file in accordance with the terms and conditions
|
||||||
|
** contained in the Technology Preview License Agreement accompanying
|
||||||
|
** this package.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Nokia gives you certain additional
|
||||||
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** If you have questions regarding the use of this file, please contact
|
||||||
|
** Nokia at qt-info@nokia.com.
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "maemoconfigtestdialog.h"
|
||||||
|
#include "ui_maemoconfigtestdialog.h"
|
||||||
|
|
||||||
|
#include "maemosshthread.h"
|
||||||
|
|
||||||
|
#include <QtGui/QPushButton>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class that waits until a thread is finished and then deletes it, and then
|
||||||
|
* schedules itself to be deleted.
|
||||||
|
*/
|
||||||
|
class SafeThreadDeleter : public QThread
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SafeThreadDeleter(QThread *thread) : m_thread(thread) {}
|
||||||
|
~SafeThreadDeleter() { wait(); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void run()
|
||||||
|
{
|
||||||
|
// Wait for m_thread to finish and then delete it
|
||||||
|
m_thread->wait();
|
||||||
|
delete m_thread;
|
||||||
|
|
||||||
|
// Schedule this thread for deletion
|
||||||
|
deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QThread *m_thread;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // anonymous namespace
|
||||||
|
|
||||||
|
namespace Qt4ProjectManager {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
MaemoConfigTestDialog::MaemoConfigTestDialog(const MaemoDeviceConfig &config, QWidget *parent)
|
||||||
|
: QDialog(parent)
|
||||||
|
, m_ui(new Ui_MaemoConfigTestDialog)
|
||||||
|
, m_config(config)
|
||||||
|
, m_deviceTester(0)
|
||||||
|
{
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
|
m_ui->setupUi(this);
|
||||||
|
m_closeButton = m_ui->buttonBox->button(QDialogButtonBox::Close);
|
||||||
|
|
||||||
|
connect(m_closeButton, SIGNAL(clicked()), SLOT(stopConfigTest()));
|
||||||
|
|
||||||
|
startConfigTest();
|
||||||
|
}
|
||||||
|
|
||||||
|
MaemoConfigTestDialog::~MaemoConfigTestDialog()
|
||||||
|
{
|
||||||
|
stopConfigTest();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MaemoConfigTestDialog::startConfigTest()
|
||||||
|
{
|
||||||
|
if (m_deviceTester)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_ui->testResultEdit->setPlainText(tr("Testing configuration..."));
|
||||||
|
m_closeButton->setText(tr("Stop Test"));
|
||||||
|
|
||||||
|
QLatin1String sysInfoCmd("uname -rsm");
|
||||||
|
QLatin1String qtInfoCmd("dpkg -l |grep libqt "
|
||||||
|
"|sed 's/[[:space:]][[:space:]]*/ /g' "
|
||||||
|
"|cut -d ' ' -f 2,3 |sed 's/~.*//g'");
|
||||||
|
QString command(sysInfoCmd + " && " + qtInfoCmd);
|
||||||
|
m_deviceTester = new MaemoSshRunner(m_config, command);
|
||||||
|
connect(m_deviceTester, SIGNAL(remoteOutput(QString)),
|
||||||
|
this, SLOT(processSshOutput(QString)));
|
||||||
|
connect(m_deviceTester, SIGNAL(finished()),
|
||||||
|
this, SLOT(handleTestThreadFinished()));
|
||||||
|
|
||||||
|
m_deviceTester->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MaemoConfigTestDialog::handleTestThreadFinished()
|
||||||
|
{
|
||||||
|
if (!m_deviceTester)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QString output;
|
||||||
|
if (m_deviceTester->hasError()) {
|
||||||
|
output = tr("Device configuration test failed:\n%1").arg(m_deviceTester->error());
|
||||||
|
if (m_config.type == MaemoDeviceConfig::Simulator)
|
||||||
|
output.append(tr("\nDid you start Qemu?"));
|
||||||
|
} else {
|
||||||
|
output = parseTestOutput();
|
||||||
|
}
|
||||||
|
m_ui->testResultEdit->setPlainText(output);
|
||||||
|
stopConfigTest();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MaemoConfigTestDialog::stopConfigTest()
|
||||||
|
{
|
||||||
|
if (m_deviceTester) {
|
||||||
|
m_deviceTester->disconnect(); // Disconnect signals
|
||||||
|
m_deviceTester->stop();
|
||||||
|
|
||||||
|
SafeThreadDeleter *deleter = new SafeThreadDeleter(m_deviceTester);
|
||||||
|
deleter->start();
|
||||||
|
|
||||||
|
m_deviceTester = 0;
|
||||||
|
m_deviceTestOutput.clear();
|
||||||
|
m_closeButton->setText(tr("Close"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MaemoConfigTestDialog::processSshOutput(const QString &data)
|
||||||
|
{
|
||||||
|
m_deviceTestOutput.append(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString MaemoConfigTestDialog::parseTestOutput()
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
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"));
|
||||||
|
index = dkpgPattern.indexIn(m_deviceTestOutput);
|
||||||
|
if (index == -1) {
|
||||||
|
output.append("No Qt packages installed.");
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
output.append("List of installed Qt packages:\n");
|
||||||
|
do {
|
||||||
|
output.append(QLatin1String("\t") + dkpgPattern.cap(0)
|
||||||
|
+ QLatin1String("\n"));
|
||||||
|
index = dkpgPattern.indexIn(m_deviceTestOutput, index + 1);
|
||||||
|
} while (index != -1);
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Qt4ProjectManager
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
** All rights reserved.
|
||||||
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** No Commercial Usage
|
||||||
|
** This file contains pre-release code and may not be distributed.
|
||||||
|
** You may use this file in accordance with the terms and conditions
|
||||||
|
** contained in the Technology Preview License Agreement accompanying
|
||||||
|
** this package.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Nokia gives you certain additional
|
||||||
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** If you have questions regarding the use of this file, please contact
|
||||||
|
** Nokia at qt-info@nokia.com.
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef MAEMOCONFIGTESTDIALOG_H
|
||||||
|
#define MAEMOCONFIGTESTDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QPushButton;
|
||||||
|
class Ui_MaemoConfigTestDialog;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
namespace Qt4ProjectManager {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
class MaemoDeviceConfig;
|
||||||
|
class MaemoSshRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A dialog that runs a test of a device configuration.
|
||||||
|
*/
|
||||||
|
class MaemoConfigTestDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit MaemoConfigTestDialog(const MaemoDeviceConfig &config, QWidget *parent = 0);
|
||||||
|
~MaemoConfigTestDialog();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void stopConfigTest();
|
||||||
|
void processSshOutput(const QString &data);
|
||||||
|
void handleTestThreadFinished();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void startConfigTest();
|
||||||
|
QString parseTestOutput();
|
||||||
|
|
||||||
|
Ui_MaemoConfigTestDialog *m_ui;
|
||||||
|
QPushButton *m_closeButton;
|
||||||
|
|
||||||
|
const MaemoDeviceConfig &m_config;
|
||||||
|
MaemoSshRunner *m_deviceTester;
|
||||||
|
QString m_deviceTestOutput;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Qt4ProjectManager
|
||||||
|
|
||||||
|
#endif // MAEMOCONFIGTESTDIALOG_H
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MaemoConfigTestDialog</class>
|
||||||
|
<widget class="QDialog" name="MaemoConfigTestDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>395</width>
|
||||||
|
<height>190</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Device Configuration Test</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPlainTextEdit" name="testResultEdit">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</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>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>MaemoConfigTestDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>MaemoConfigTestDialog</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
||||||
@@ -36,12 +36,14 @@
|
|||||||
|
|
||||||
#include "ui_maemosettingswidget.h"
|
#include "ui_maemosettingswidget.h"
|
||||||
|
|
||||||
|
#include "maemoconfigtestdialog.h"
|
||||||
#include "maemodeviceconfigurations.h"
|
#include "maemodeviceconfigurations.h"
|
||||||
#include "maemosshthread.h"
|
#include "maemosshthread.h"
|
||||||
|
|
||||||
#include <QtCore/QRegExp>
|
#include <QtCore/QRegExp>
|
||||||
#include <QtGui/QFileDialog>
|
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
|
#include <QtGui/QFileDialog>
|
||||||
|
#include <QtGui/QMessageBox>
|
||||||
#include <QtGui/QIntValidator>
|
#include <QtGui/QIntValidator>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -109,13 +111,12 @@ private:
|
|||||||
|
|
||||||
MaemoSettingsWidget::MaemoSettingsWidget(QWidget *parent)
|
MaemoSettingsWidget::MaemoSettingsWidget(QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
m_ui(new Ui_maemoSettingsWidget),
|
m_ui(new Ui_MaemoSettingsWidget),
|
||||||
m_devConfs(MaemoDeviceConfigurations::instance().devConfigs()),
|
m_devConfs(MaemoDeviceConfigurations::instance().devConfigs()),
|
||||||
m_nameValidator(new NameValidator(m_devConfs)),
|
m_nameValidator(new NameValidator(m_devConfs)),
|
||||||
m_sshPortValidator(new PortAndTimeoutValidator),
|
m_sshPortValidator(new PortAndTimeoutValidator),
|
||||||
m_gdbServerPortValidator(new PortAndTimeoutValidator),
|
m_gdbServerPortValidator(new PortAndTimeoutValidator),
|
||||||
m_timeoutValidator(new PortAndTimeoutValidator),
|
m_timeoutValidator(new PortAndTimeoutValidator),
|
||||||
m_deviceTester(0),
|
|
||||||
m_keyDeployer(0)
|
m_keyDeployer(0)
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -134,9 +135,8 @@ void MaemoSettingsWidget::initGui()
|
|||||||
m_ui->gdbServerPortLineEdit->setValidator(m_gdbServerPortValidator);
|
m_ui->gdbServerPortLineEdit->setValidator(m_gdbServerPortValidator);
|
||||||
m_ui->timeoutLineEdit->setValidator(m_timeoutValidator);
|
m_ui->timeoutLineEdit->setValidator(m_timeoutValidator);
|
||||||
m_ui->keyFileLineEdit->setExpectedKind(Utils::PathChooser::File);
|
m_ui->keyFileLineEdit->setExpectedKind(Utils::PathChooser::File);
|
||||||
foreach(const MaemoDeviceConfig &devConf, m_devConfs)
|
foreach (const MaemoDeviceConfig &devConf, m_devConfs)
|
||||||
m_ui->configListWidget->addItem(devConf.name);
|
m_ui->configListWidget->addItem(devConf.name);
|
||||||
m_defaultTestOutput = m_ui->testResultEdit->toPlainText();
|
|
||||||
if (m_devConfs.count() == 1)
|
if (m_devConfs.count() == 1)
|
||||||
m_ui->configListWidget->setCurrentRow(0, QItemSelectionModel::Select);
|
m_ui->configListWidget->setCurrentRow(0, QItemSelectionModel::Select);
|
||||||
}
|
}
|
||||||
@@ -314,93 +314,8 @@ void MaemoSettingsWidget::keyFileEditingFinished()
|
|||||||
|
|
||||||
void MaemoSettingsWidget::testConfig()
|
void MaemoSettingsWidget::testConfig()
|
||||||
{
|
{
|
||||||
if (m_deviceTester)
|
QDialog *dialog = new MaemoConfigTestDialog(currentConfig(), this);
|
||||||
return;
|
dialog->open();
|
||||||
|
|
||||||
m_ui->testConfigButton->disconnect();
|
|
||||||
m_ui->testResultEdit->setPlainText(m_defaultTestOutput);
|
|
||||||
QLatin1String sysInfoCmd("uname -rsm");
|
|
||||||
QLatin1String qtInfoCmd("dpkg -l |grep libqt "
|
|
||||||
"|sed 's/[[:space:]][[:space:]]*/ /g' "
|
|
||||||
"|cut -d ' ' -f 2,3 |sed 's/~.*//g'");
|
|
||||||
QString command(sysInfoCmd + " && " + qtInfoCmd);
|
|
||||||
m_deviceTester = new MaemoSshRunner(currentConfig(), command);
|
|
||||||
connect(m_deviceTester, SIGNAL(remoteOutput(QString)),
|
|
||||||
this, SLOT(processSshOutput(QString)));
|
|
||||||
connect(m_deviceTester, SIGNAL(finished()),
|
|
||||||
this, SLOT(handleTestThreadFinished()));
|
|
||||||
m_ui->testConfigButton->setText(tr("Stop test"));
|
|
||||||
connect(m_ui->testConfigButton, SIGNAL(clicked()),
|
|
||||||
this, SLOT(stopConfigTest()));
|
|
||||||
m_deviceTester->start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MaemoSettingsWidget::processSshOutput(const QString &data)
|
|
||||||
{
|
|
||||||
qDebug("%s", qPrintable(data));
|
|
||||||
m_deviceTestOutput.append(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MaemoSettingsWidget::handleTestThreadFinished()
|
|
||||||
{
|
|
||||||
if (!m_deviceTester)
|
|
||||||
return;
|
|
||||||
|
|
||||||
QString output;
|
|
||||||
if (m_deviceTester->hasError()) {
|
|
||||||
output = tr("Device configuration test failed:\n%1").arg(m_deviceTester->error());
|
|
||||||
if (currentConfig().type == MaemoDeviceConfig::Simulator)
|
|
||||||
output.append(tr("\nDid you start Qemu?"));
|
|
||||||
} else {
|
|
||||||
output = parseTestOutput();
|
|
||||||
}
|
|
||||||
m_ui->testResultEdit->setPlainText(output);
|
|
||||||
stopConfigTest();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MaemoSettingsWidget::stopConfigTest()
|
|
||||||
{
|
|
||||||
if (m_deviceTester) {
|
|
||||||
m_ui->testConfigButton->disconnect();
|
|
||||||
const bool buttonWasEnabled = m_ui->testConfigButton->isEnabled();
|
|
||||||
m_deviceTester->disconnect();
|
|
||||||
m_deviceTester->stop();
|
|
||||||
delete m_deviceTester;
|
|
||||||
m_deviceTester = 0;
|
|
||||||
m_deviceTestOutput.clear();
|
|
||||||
m_ui->testConfigButton->setText(tr("Test"));
|
|
||||||
connect(m_ui->testConfigButton, SIGNAL(clicked()),
|
|
||||||
this, SLOT(testConfig()));
|
|
||||||
m_ui->testConfigButton->setEnabled(buttonWasEnabled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString MaemoSettingsWidget::parseTestOutput()
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
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"));
|
|
||||||
index = dkpgPattern.indexIn(m_deviceTestOutput);
|
|
||||||
if (index == -1) {
|
|
||||||
output.append("No Qt packages installed.");
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
output.append("List of installed Qt packages:\n");
|
|
||||||
do {
|
|
||||||
output.append(QLatin1String("\t") + dkpgPattern.cap(0)
|
|
||||||
+ QLatin1String("\n"));
|
|
||||||
index = dkpgPattern.indexIn(m_deviceTestOutput, index + 1);
|
|
||||||
} while (index != -1);
|
|
||||||
return output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoSettingsWidget::deployKey()
|
void MaemoSettingsWidget::deployKey()
|
||||||
@@ -434,13 +349,11 @@ void MaemoSettingsWidget::handleDeployThreadFinished()
|
|||||||
if (!m_keyDeployer)
|
if (!m_keyDeployer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString output;
|
if (m_keyDeployer->hasError())
|
||||||
if (m_keyDeployer->hasError()) {
|
QMessageBox::critical(this, tr("Deployment Failed"), tr("Key deployment failed: %1").arg(m_keyDeployer->error()));
|
||||||
output = tr("Key deployment failed: %1").arg(m_keyDeployer->error());
|
else
|
||||||
} else {
|
QMessageBox::information(this, tr("Deployment Succeeded"), tr("Key was successfully deployed."));
|
||||||
output = tr("Key was successfully deployed.");
|
|
||||||
}
|
|
||||||
m_ui->testResultEdit->setPlainText(output);
|
|
||||||
stopDeploying();
|
stopDeploying();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,9 +378,7 @@ void MaemoSettingsWidget::selectionChanged()
|
|||||||
const QList<QListWidgetItem *> &selectedItems =
|
const QList<QListWidgetItem *> &selectedItems =
|
||||||
m_ui->configListWidget->selectedItems();
|
m_ui->configListWidget->selectedItems();
|
||||||
Q_ASSERT(selectedItems.count() <= 1);
|
Q_ASSERT(selectedItems.count() <= 1);
|
||||||
stopConfigTest();
|
|
||||||
stopDeploying();
|
stopDeploying();
|
||||||
m_ui->testResultEdit->setPlainText(m_defaultTestOutput);
|
|
||||||
if (selectedItems.isEmpty()) {
|
if (selectedItems.isEmpty()) {
|
||||||
m_ui->removeConfigButton->setEnabled(false);
|
m_ui->removeConfigButton->setEnabled(false);
|
||||||
m_ui->testConfigButton->setEnabled(false);
|
m_ui->testConfigButton->setEnabled(false);
|
||||||
|
|||||||
@@ -44,13 +44,12 @@
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
|
|
||||||
class Ui_maemoSettingsWidget;
|
class Ui_MaemoSettingsWidget;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class MaemoSshRunner;
|
|
||||||
class MaemoSshDeployer;
|
class MaemoSshDeployer;
|
||||||
class NameValidator;
|
class NameValidator;
|
||||||
class PortAndTimeoutValidator;
|
class PortAndTimeoutValidator;
|
||||||
@@ -79,9 +78,6 @@ private slots:
|
|||||||
|
|
||||||
// For configuration testing.
|
// For configuration testing.
|
||||||
void testConfig();
|
void testConfig();
|
||||||
void processSshOutput(const QString &data);
|
|
||||||
void handleTestThreadFinished();
|
|
||||||
void stopConfigTest();
|
|
||||||
|
|
||||||
// For key deploying.
|
// For key deploying.
|
||||||
void deployKey();
|
void deployKey();
|
||||||
@@ -97,16 +93,13 @@ private:
|
|||||||
void clearDetails();
|
void clearDetails();
|
||||||
QString parseTestOutput();
|
QString parseTestOutput();
|
||||||
|
|
||||||
Ui_maemoSettingsWidget *m_ui;
|
Ui_MaemoSettingsWidget *m_ui;
|
||||||
QList<MaemoDeviceConfig> m_devConfs;
|
QList<MaemoDeviceConfig> m_devConfs;
|
||||||
NameValidator * const m_nameValidator;
|
NameValidator * const m_nameValidator;
|
||||||
PortAndTimeoutValidator * const m_sshPortValidator;
|
PortAndTimeoutValidator * const m_sshPortValidator;
|
||||||
PortAndTimeoutValidator * const m_gdbServerPortValidator;
|
PortAndTimeoutValidator * const m_gdbServerPortValidator;
|
||||||
PortAndTimeoutValidator * const m_timeoutValidator;
|
PortAndTimeoutValidator * const m_timeoutValidator;
|
||||||
MaemoSshRunner *m_deviceTester;
|
|
||||||
MaemoSshDeployer *m_keyDeployer;
|
MaemoSshDeployer *m_keyDeployer;
|
||||||
QString m_deviceTestOutput;
|
|
||||||
QString m_defaultTestOutput;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>maemoSettingsWidget</class>
|
<class>MaemoSettingsWidget</class>
|
||||||
<widget class="QWidget" name="maemoSettingsWidget">
|
<widget class="QWidget" name="MaemoSettingsWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>526</width>
|
<width>566</width>
|
||||||
<height>514</height>
|
<height>439</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -188,20 +188,6 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QTextEdit" name="testResultEdit">
|
|
||||||
<property name="readOnly">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="html">
|
|
||||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
|
||||||
p, li { white-space: pre-wrap; }
|
|
||||||
</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;">
|
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif';">No current test results available.</span></p></body></html></string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -278,7 +264,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>nameLineEdit</sender>
|
<sender>nameLineEdit</sender>
|
||||||
<signal>editingFinished()</signal>
|
<signal>editingFinished()</signal>
|
||||||
<receiver>maemoSettingsWidget</receiver>
|
<receiver>MaemoSettingsWidget</receiver>
|
||||||
<slot>configNameEditingFinished()</slot>
|
<slot>configNameEditingFinished()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@@ -294,7 +280,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>deviceButton</sender>
|
<sender>deviceButton</sender>
|
||||||
<signal>toggled(bool)</signal>
|
<signal>toggled(bool)</signal>
|
||||||
<receiver>maemoSettingsWidget</receiver>
|
<receiver>MaemoSettingsWidget</receiver>
|
||||||
<slot>deviceTypeChanged()</slot>
|
<slot>deviceTypeChanged()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@@ -310,7 +296,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>hostLineEdit</sender>
|
<sender>hostLineEdit</sender>
|
||||||
<signal>editingFinished()</signal>
|
<signal>editingFinished()</signal>
|
||||||
<receiver>maemoSettingsWidget</receiver>
|
<receiver>MaemoSettingsWidget</receiver>
|
||||||
<slot>hostNameEditingFinished()</slot>
|
<slot>hostNameEditingFinished()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@@ -326,7 +312,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>sshPortLineEdit</sender>
|
<sender>sshPortLineEdit</sender>
|
||||||
<signal>editingFinished()</signal>
|
<signal>editingFinished()</signal>
|
||||||
<receiver>maemoSettingsWidget</receiver>
|
<receiver>MaemoSettingsWidget</receiver>
|
||||||
<slot>sshPortEditingFinished()</slot>
|
<slot>sshPortEditingFinished()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@@ -342,7 +328,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>timeoutLineEdit</sender>
|
<sender>timeoutLineEdit</sender>
|
||||||
<signal>editingFinished()</signal>
|
<signal>editingFinished()</signal>
|
||||||
<receiver>maemoSettingsWidget</receiver>
|
<receiver>MaemoSettingsWidget</receiver>
|
||||||
<slot>timeoutEditingFinished()</slot>
|
<slot>timeoutEditingFinished()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@@ -358,7 +344,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>userLineEdit</sender>
|
<sender>userLineEdit</sender>
|
||||||
<signal>editingFinished()</signal>
|
<signal>editingFinished()</signal>
|
||||||
<receiver>maemoSettingsWidget</receiver>
|
<receiver>MaemoSettingsWidget</receiver>
|
||||||
<slot>userNameEditingFinished()</slot>
|
<slot>userNameEditingFinished()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@@ -374,7 +360,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>pwdLineEdit</sender>
|
<sender>pwdLineEdit</sender>
|
||||||
<signal>editingFinished()</signal>
|
<signal>editingFinished()</signal>
|
||||||
<receiver>maemoSettingsWidget</receiver>
|
<receiver>MaemoSettingsWidget</receiver>
|
||||||
<slot>passwordEditingFinished()</slot>
|
<slot>passwordEditingFinished()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@@ -390,7 +376,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>simulatorButton</sender>
|
<sender>simulatorButton</sender>
|
||||||
<signal>toggled(bool)</signal>
|
<signal>toggled(bool)</signal>
|
||||||
<receiver>maemoSettingsWidget</receiver>
|
<receiver>MaemoSettingsWidget</receiver>
|
||||||
<slot>deviceTypeChanged()</slot>
|
<slot>deviceTypeChanged()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@@ -406,7 +392,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>addConfigButton</sender>
|
<sender>addConfigButton</sender>
|
||||||
<signal>clicked()</signal>
|
<signal>clicked()</signal>
|
||||||
<receiver>maemoSettingsWidget</receiver>
|
<receiver>MaemoSettingsWidget</receiver>
|
||||||
<slot>addConfig()</slot>
|
<slot>addConfig()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@@ -422,7 +408,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>configListWidget</sender>
|
<sender>configListWidget</sender>
|
||||||
<signal>itemSelectionChanged()</signal>
|
<signal>itemSelectionChanged()</signal>
|
||||||
<receiver>maemoSettingsWidget</receiver>
|
<receiver>MaemoSettingsWidget</receiver>
|
||||||
<slot>selectionChanged()</slot>
|
<slot>selectionChanged()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@@ -438,7 +424,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>removeConfigButton</sender>
|
<sender>removeConfigButton</sender>
|
||||||
<signal>clicked()</signal>
|
<signal>clicked()</signal>
|
||||||
<receiver>maemoSettingsWidget</receiver>
|
<receiver>MaemoSettingsWidget</receiver>
|
||||||
<slot>deleteConfig()</slot>
|
<slot>deleteConfig()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@@ -454,7 +440,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>passwordButton</sender>
|
<sender>passwordButton</sender>
|
||||||
<signal>toggled(bool)</signal>
|
<signal>toggled(bool)</signal>
|
||||||
<receiver>maemoSettingsWidget</receiver>
|
<receiver>MaemoSettingsWidget</receiver>
|
||||||
<slot>authenticationTypeChanged()</slot>
|
<slot>authenticationTypeChanged()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@@ -470,7 +456,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>keyFileLineEdit</sender>
|
<sender>keyFileLineEdit</sender>
|
||||||
<signal>editingFinished()</signal>
|
<signal>editingFinished()</signal>
|
||||||
<receiver>maemoSettingsWidget</receiver>
|
<receiver>MaemoSettingsWidget</receiver>
|
||||||
<slot>keyFileEditingFinished()</slot>
|
<slot>keyFileEditingFinished()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@@ -486,7 +472,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>keyFileLineEdit</sender>
|
<sender>keyFileLineEdit</sender>
|
||||||
<signal>browsingFinished()</signal>
|
<signal>browsingFinished()</signal>
|
||||||
<receiver>maemoSettingsWidget</receiver>
|
<receiver>MaemoSettingsWidget</receiver>
|
||||||
<slot>keyFileEditingFinished()</slot>
|
<slot>keyFileEditingFinished()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@@ -502,7 +488,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>testConfigButton</sender>
|
<sender>testConfigButton</sender>
|
||||||
<signal>clicked()</signal>
|
<signal>clicked()</signal>
|
||||||
<receiver>maemoSettingsWidget</receiver>
|
<receiver>MaemoSettingsWidget</receiver>
|
||||||
<slot>testConfig()</slot>
|
<slot>testConfig()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@@ -518,7 +504,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>deployKeyButton</sender>
|
<sender>deployKeyButton</sender>
|
||||||
<signal>clicked()</signal>
|
<signal>clicked()</signal>
|
||||||
<receiver>maemoSettingsWidget</receiver>
|
<receiver>MaemoSettingsWidget</receiver>
|
||||||
<slot>deployKey()</slot>
|
<slot>deployKey()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@@ -534,7 +520,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>gdbServerPortLineEdit</sender>
|
<sender>gdbServerPortLineEdit</sender>
|
||||||
<signal>editingFinished()</signal>
|
<signal>editingFinished()</signal>
|
||||||
<receiver>maemoSettingsWidget</receiver>
|
<receiver>MaemoSettingsWidget</receiver>
|
||||||
<slot>gdbServerPortEditingFinished()</slot>
|
<slot>gdbServerPortEditingFinished()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@@ -550,7 +536,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>keyButton</sender>
|
<sender>keyButton</sender>
|
||||||
<signal>toggled(bool)</signal>
|
<signal>toggled(bool)</signal>
|
||||||
<receiver>maemoSettingsWidget</receiver>
|
<receiver>MaemoSettingsWidget</receiver>
|
||||||
<slot>authenticationTypeChanged()</slot>
|
<slot>authenticationTypeChanged()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ protected:
|
|||||||
bool stopRequested() const { return m_stopRequested; }
|
bool stopRequested() const { return m_stopRequested; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void runInternal()=0;
|
virtual void runInternal() = 0;
|
||||||
|
|
||||||
bool m_stopRequested;
|
bool m_stopRequested;
|
||||||
QString m_error;
|
QString m_error;
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ HEADERS += $$PWD/maemorunconfiguration.h \
|
|||||||
$$PWD/maemoruncontrol.h \
|
$$PWD/maemoruncontrol.h \
|
||||||
$$PWD/maemorunconfigurationwidget.h \
|
$$PWD/maemorunconfigurationwidget.h \
|
||||||
$$PWD/maemorunfactories.h \
|
$$PWD/maemorunfactories.h \
|
||||||
$$PWD/maemoconstants.h
|
$$PWD/maemoconstants.h \
|
||||||
|
$$PWD/maemoconfigtestdialog.h
|
||||||
|
|
||||||
SOURCES += $$PWD/maemorunconfiguration.cpp \
|
SOURCES += $$PWD/maemorunconfiguration.cpp \
|
||||||
$$PWD/maemomanager.cpp \
|
$$PWD/maemomanager.cpp \
|
||||||
@@ -24,7 +25,9 @@ SOURCES += $$PWD/maemorunconfiguration.cpp \
|
|||||||
$$PWD/maemosshthread.cpp \
|
$$PWD/maemosshthread.cpp \
|
||||||
$$PWD/maemoruncontrol.cpp \
|
$$PWD/maemoruncontrol.cpp \
|
||||||
$$PWD/maemorunconfigurationwidget.cpp \
|
$$PWD/maemorunconfigurationwidget.cpp \
|
||||||
$$PWD/maemorunfactories.cpp
|
$$PWD/maemorunfactories.cpp \
|
||||||
|
$$PWD/maemoconfigtestdialog.cpp
|
||||||
|
|
||||||
FORMS += $$PWD/maemosettingswidget.ui
|
FORMS += $$PWD/maemosettingswidget.ui \
|
||||||
|
$$PWD/maemoconfigtestdialog.ui
|
||||||
RESOURCES += $$PWD/qt-maemo.qrc
|
RESOURCES += $$PWD/qt-maemo.qrc
|
||||||
|
|||||||
Reference in New Issue
Block a user