RemoteLinux: Export and re-use wizard page.

Also rename the respective file to better reflect its new purpose.

Change-Id: I815807a958d2d76db87d4d27b63338f5ced9ffeb
Reviewed-on: http://codereview.qt.nokia.com/544
Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
This commit is contained in:
Christian Kandeler
2011-06-21 12:44:52 +02:00
parent e31accb848
commit 92b172641b
6 changed files with 67 additions and 66 deletions

View File

@@ -30,46 +30,15 @@
**************************************************************************/ **************************************************************************/
#include "genericlinuxdeviceconfigurationwizard.h" #include "genericlinuxdeviceconfigurationwizard.h"
#include "genericlinuxdeviceconfigurationwizardsetuppage.h" #include "genericlinuxdeviceconfigurationwizardpages.h"
#include "maemoconfigtestdialog.h" #include "maemoconfigtestdialog.h"
#include <QtGui/QLabel>
#include <QtGui/QVBoxLayout>
using namespace Utils; using namespace Utils;
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
namespace { namespace {
enum PageId { SetupPageId, FinalPageId }; enum PageId { SetupPageId, FinalPageId };
class GenericLinuxDeviceConfigurationWizardFinalPage : public QWizardPage
{
Q_OBJECT
public:
GenericLinuxDeviceConfigurationWizardFinalPage(QWidget *parent)
: QWizardPage(parent), m_infoLabel(new QLabel(this))
{
setTitle(tr("Setup Finished"));
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
m_infoLabel->setWordWrap(true);
QVBoxLayout * const layout = new QVBoxLayout(this);
layout->addWidget(m_infoLabel);
}
virtual void initializePage()
{
const QString infoText = tr("The new device configuration will now be "
"created. In addition, a test procedure will be run to check whether "
"Qt Creator can connect to the device and to provide some information about it.");
m_infoLabel->setText(infoText);
}
private:
QLabel * const m_infoLabel;
};
} // anonymous namespace } // anonymous namespace
class GenericLinuxDeviceConfigurationWizardPrivate class GenericLinuxDeviceConfigurationWizardPrivate
@@ -117,5 +86,3 @@ LinuxDeviceConfiguration::Ptr GenericLinuxDeviceConfigurationWizard::deviceConfi
} }
} // namespace RemoteLinux } // namespace RemoteLinux
#include "genericlinuxdeviceconfigurationwizard.moc"

View File

@@ -28,7 +28,7 @@
** Nokia at info@qt.nokia.com. ** Nokia at info@qt.nokia.com.
** **
**************************************************************************/ **************************************************************************/
#include "genericlinuxdeviceconfigurationwizardsetuppage.h" #include "genericlinuxdeviceconfigurationwizardpages.h"
#include "ui_genericlinuxdeviceconfigurationwizardsetuppage.h" #include "ui_genericlinuxdeviceconfigurationwizardsetuppage.h"
#include "linuxdeviceconfiguration.h" #include "linuxdeviceconfiguration.h"
@@ -71,6 +71,7 @@ void GenericLinuxDeviceConfigurationWizardSetupPage::initializePage()
m_d->ui.hostNameLineEdit->setText(defaultHostName()); m_d->ui.hostNameLineEdit->setText(defaultHostName());
m_d->ui.userNameLineEdit->setText(defaultUserName()); m_d->ui.userNameLineEdit->setText(defaultUserName());
m_d->ui.passwordButton->setChecked(true); m_d->ui.passwordButton->setChecked(true);
m_d->ui.passwordLineEdit->setText(defaultPassWord());
m_d->ui.passwordLineEdit->clear(); m_d->ui.passwordLineEdit->clear();
m_d->ui.privateKeyPathChooser->setPath(LinuxDeviceConfiguration::defaultPrivateKeyFilePath()); m_d->ui.privateKeyPathChooser->setPath(LinuxDeviceConfiguration::defaultPrivateKeyFilePath());
handleAuthTypeChanged(); handleAuthTypeChanged();
@@ -125,6 +126,11 @@ QString GenericLinuxDeviceConfigurationWizardSetupPage::defaultUserName() const
return QString(); return QString();
} }
QString GenericLinuxDeviceConfigurationWizardSetupPage::defaultPassWord() const
{
return QString();
}
void GenericLinuxDeviceConfigurationWizardSetupPage::handleAuthTypeChanged() void GenericLinuxDeviceConfigurationWizardSetupPage::handleAuthTypeChanged()
{ {
m_d->ui.passwordLineEdit->setEnabled(authenticationType() == SshConnectionParameters::AuthenticationByPassword); m_d->ui.passwordLineEdit->setEnabled(authenticationType() == SshConnectionParameters::AuthenticationByPassword);
@@ -132,4 +138,26 @@ void GenericLinuxDeviceConfigurationWizardSetupPage::handleAuthTypeChanged()
emit completeChanged(); emit completeChanged();
} }
GenericLinuxDeviceConfigurationWizardFinalPage::GenericLinuxDeviceConfigurationWizardFinalPage(QWidget *parent)
: QWizardPage(parent), m_infoLabel(new QLabel(this))
{
setTitle(tr("Setup Finished"));
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
m_infoLabel->setWordWrap(true);
QVBoxLayout * const layout = new QVBoxLayout(this);
layout->addWidget(m_infoLabel);
}
void GenericLinuxDeviceConfigurationWizardFinalPage::initializePage()
{
m_infoLabel->setText(infoText());
}
QString GenericLinuxDeviceConfigurationWizardFinalPage::infoText() const
{
return tr("The new device configuration will now be created.\n"
"In addition, device connectivity will be tested.");
}
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -37,6 +37,10 @@
#include <QtGui/QWizardPage> #include <QtGui/QWizardPage>
QT_BEGIN_NAMESPACE
class QLabel;
QT_END_NAMESPACE
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
class GenericLinuxDeviceConfigurationWizardSetupPagePrivate; class GenericLinuxDeviceConfigurationWizardSetupPagePrivate;
@@ -63,6 +67,7 @@ public:
virtual QString defaultHostName() const; virtual QString defaultHostName() const;
virtual QString defaultUserName() const; virtual QString defaultUserName() const;
virtual QString defaultPassWord() const;
private: private:
Q_SLOT void handleAuthTypeChanged(); Q_SLOT void handleAuthTypeChanged();
@@ -70,6 +75,22 @@ private:
Internal::GenericLinuxDeviceConfigurationWizardSetupPagePrivate * const m_d; Internal::GenericLinuxDeviceConfigurationWizardSetupPagePrivate * const m_d;
}; };
class REMOTELINUX_EXPORT GenericLinuxDeviceConfigurationWizardFinalPage : public QWizardPage
{
Q_OBJECT
public:
GenericLinuxDeviceConfigurationWizardFinalPage(QWidget *parent);
void initializePage();
protected:
virtual QString infoText() const;
private:
QLabel * const m_infoLabel;
};
} // namespace RemoteLinux } // namespace RemoteLinux
#endif // GENERICLINUXDEVICECONFIGURATIONWIZARDSETUPPAGE_H #endif // GENERICLINUXDEVICECONFIGURATIONWIZARDSETUPPAGE_H

View File

@@ -42,6 +42,7 @@
#include "maemoglobal.h" #include "maemoglobal.h"
#include "maemokeydeployer.h" #include "maemokeydeployer.h"
#include <remotelinux/genericlinuxdeviceconfigurationwizardpages.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/ssh/sshkeygenerator.h> #include <utils/ssh/sshkeygenerator.h>
@@ -532,39 +533,23 @@ private:
QString m_instructionTextTemplate; QString m_instructionTextTemplate;
}; };
class MaemoDeviceConfigWizardFinalPage : public QWizardPage class MaemoDeviceConfigWizardFinalPage : public GenericLinuxDeviceConfigurationWizardFinalPage
{ {
Q_OBJECT Q_OBJECT
public: public:
MaemoDeviceConfigWizardFinalPage(const WizardData &wizardData, MaemoDeviceConfigWizardFinalPage(const WizardData &wizardData, QWidget *parent)
QWidget *parent) : GenericLinuxDeviceConfigurationWizardFinalPage(parent), m_wizardData(wizardData)
: QWizardPage(parent),
m_infoLabel(new QLabel(this)),
m_wizardData(wizardData)
{ {
setTitle(tr("Setup Finished"));
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
m_infoLabel->setWordWrap(true);
QVBoxLayout * const layout = new QVBoxLayout(this);
layout->addWidget(m_infoLabel);
}
virtual void initializePage()
{
QString infoText;
if (m_wizardData.deviceType == LinuxDeviceConfiguration::Physical) {
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.");
} else {
infoText = tr("The new device configuration will now be created.");
}
m_infoLabel->setText(infoText);
} }
private: private:
QLabel * const m_infoLabel; QString infoText() const
{
if (m_wizardData.deviceType == LinuxDeviceConfiguration::Emulator)
return tr("The new device configuration will now be created.");
return GenericLinuxDeviceConfigurationWizardFinalPage::infoText();
}
const WizardData &m_wizardData; const WizardData &m_wizardData;
}; };

View File

@@ -47,7 +47,7 @@ using ProjectExplorer::RunControl;
using ProjectExplorer::Target; using ProjectExplorer::Target;
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
class MaemoRunConfigurationFactory : public IRunConfigurationFactory class MaemoRunConfigurationFactory : public IRunConfigurationFactory
{ {

View File

@@ -75,7 +75,6 @@ HEADERS += \
linuxdevicefactoryselectiondialog.h \ linuxdevicefactoryselectiondialog.h \
publickeydeploymentdialog.h \ publickeydeploymentdialog.h \
genericlinuxdeviceconfigurationwizard.h \ genericlinuxdeviceconfigurationwizard.h \
genericlinuxdeviceconfigurationwizardsetuppage.h \
genericlinuxdeviceconfigurationfactory.h \ genericlinuxdeviceconfigurationfactory.h \
maddedeviceconfigurationfactory.h \ maddedeviceconfigurationfactory.h \
maemorunconfiguration.h \ maemorunconfiguration.h \
@@ -84,7 +83,8 @@ HEADERS += \
remotelinuxapplicationrunner.h \ remotelinuxapplicationrunner.h \
remotelinuxruncontrol.h \ remotelinuxruncontrol.h \
remotelinuxruncontrolfactory.h \ remotelinuxruncontrolfactory.h \
remotelinuxdebugsupport.h remotelinuxdebugsupport.h \
genericlinuxdeviceconfigurationwizardpages.h
SOURCES += \ SOURCES += \
remotelinuxplugin.cpp \ remotelinuxplugin.cpp \
@@ -151,7 +151,6 @@ SOURCES += \
linuxdevicefactoryselectiondialog.cpp \ linuxdevicefactoryselectiondialog.cpp \
publickeydeploymentdialog.cpp \ publickeydeploymentdialog.cpp \
genericlinuxdeviceconfigurationwizard.cpp \ genericlinuxdeviceconfigurationwizard.cpp \
genericlinuxdeviceconfigurationwizardsetuppage.cpp \
genericlinuxdeviceconfigurationfactory.cpp \ genericlinuxdeviceconfigurationfactory.cpp \
maddedeviceconfigurationfactory.cpp \ maddedeviceconfigurationfactory.cpp \
maemorunconfiguration.cpp \ maemorunconfiguration.cpp \
@@ -160,7 +159,8 @@ SOURCES += \
remotelinuxapplicationrunner.cpp \ remotelinuxapplicationrunner.cpp \
remotelinuxruncontrol.cpp \ remotelinuxruncontrol.cpp \
remotelinuxruncontrolfactory.cpp \ remotelinuxruncontrolfactory.cpp \
remotelinuxdebugsupport.cpp remotelinuxdebugsupport.cpp \
genericlinuxdeviceconfigurationwizardpages.cpp
FORMS += \ FORMS += \
maemoconfigtestdialog.ui \ maemoconfigtestdialog.ui \