OSDN Git Service

RemoteLinux: Export and re-use wizard page.
authorChristian Kandeler <christian.kandeler@nokia.com>
Tue, 21 Jun 2011 10:44:52 +0000 (12:44 +0200)
committerChristian Kandeler <christian.kandeler@nokia.com>
Tue, 21 Jun 2011 10:51:46 +0000 (12:51 +0200)
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>
src/plugins/remotelinux/genericlinuxdeviceconfigurationwizard.cpp
src/plugins/remotelinux/genericlinuxdeviceconfigurationwizardpages.cpp [moved from src/plugins/remotelinux/genericlinuxdeviceconfigurationwizardsetuppage.cpp with 83% similarity]
src/plugins/remotelinux/genericlinuxdeviceconfigurationwizardpages.h [moved from src/plugins/remotelinux/genericlinuxdeviceconfigurationwizardsetuppage.h with 86% similarity]
src/plugins/remotelinux/maemodeviceconfigwizard.cpp
src/plugins/remotelinux/maemorunfactories.h
src/plugins/remotelinux/remotelinux.pro

index 6f30024..07b12a3 100644 (file)
 **************************************************************************/
 #include "genericlinuxdeviceconfigurationwizard.h"
 
-#include "genericlinuxdeviceconfigurationwizardsetuppage.h"
+#include "genericlinuxdeviceconfigurationwizardpages.h"
 #include "maemoconfigtestdialog.h"
 
-#include <QtGui/QLabel>
-#include <QtGui/QVBoxLayout>
-
 using namespace Utils;
 
 namespace RemoteLinux {
 namespace Internal {
 namespace {
-
 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
 
 class GenericLinuxDeviceConfigurationWizardPrivate
@@ -117,5 +86,3 @@ LinuxDeviceConfiguration::Ptr GenericLinuxDeviceConfigurationWizard::deviceConfi
 }
 
 } // namespace RemoteLinux
-
-#include "genericlinuxdeviceconfigurationwizard.moc"
@@ -28,7 +28,7 @@
 ** Nokia at info@qt.nokia.com.
 **
 **************************************************************************/
-#include "genericlinuxdeviceconfigurationwizardsetuppage.h"
+#include "genericlinuxdeviceconfigurationwizardpages.h"
 #include "ui_genericlinuxdeviceconfigurationwizardsetuppage.h"
 
 #include "linuxdeviceconfiguration.h"
@@ -71,6 +71,7 @@ void GenericLinuxDeviceConfigurationWizardSetupPage::initializePage()
     m_d->ui.hostNameLineEdit->setText(defaultHostName());
     m_d->ui.userNameLineEdit->setText(defaultUserName());
     m_d->ui.passwordButton->setChecked(true);
+    m_d->ui.passwordLineEdit->setText(defaultPassWord());
     m_d->ui.passwordLineEdit->clear();
     m_d->ui.privateKeyPathChooser->setPath(LinuxDeviceConfiguration::defaultPrivateKeyFilePath());
     handleAuthTypeChanged();
@@ -125,6 +126,11 @@ QString GenericLinuxDeviceConfigurationWizardSetupPage::defaultUserName() const
     return QString();
 }
 
+QString GenericLinuxDeviceConfigurationWizardSetupPage::defaultPassWord() const
+{
+    return QString();
+}
+
 void GenericLinuxDeviceConfigurationWizardSetupPage::handleAuthTypeChanged()
 {
     m_d->ui.passwordLineEdit->setEnabled(authenticationType() == SshConnectionParameters::AuthenticationByPassword);
@@ -132,4 +138,26 @@ void GenericLinuxDeviceConfigurationWizardSetupPage::handleAuthTypeChanged()
     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
 
 #include <QtGui/QWizardPage>
 
+QT_BEGIN_NAMESPACE
+class QLabel;
+QT_END_NAMESPACE
+
 namespace RemoteLinux {
 namespace Internal {
 class GenericLinuxDeviceConfigurationWizardSetupPagePrivate;
@@ -63,6 +67,7 @@ public:
 
     virtual QString defaultHostName() const;
     virtual QString defaultUserName() const;
+    virtual QString defaultPassWord() const;
 
 private:
     Q_SLOT void handleAuthTypeChanged();
@@ -70,6 +75,22 @@ private:
     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
 
 #endif // GENERICLINUXDEVICECONFIGURATIONWIZARDSETUPPAGE_H
index 46d9a6a..b122f5b 100644 (file)
@@ -42,6 +42,7 @@
 #include "maemoglobal.h"
 #include "maemokeydeployer.h"
 
+#include <remotelinux/genericlinuxdeviceconfigurationwizardpages.h>
 #include <utils/fileutils.h>
 #include <utils/ssh/sshkeygenerator.h>
 
@@ -532,39 +533,23 @@ private:
     QString m_instructionTextTemplate;
 };
 
-class MaemoDeviceConfigWizardFinalPage : public QWizardPage
+class MaemoDeviceConfigWizardFinalPage : public GenericLinuxDeviceConfigurationWizardFinalPage
 {
     Q_OBJECT
 public:
-    MaemoDeviceConfigWizardFinalPage(const WizardData &wizardData,
-        QWidget *parent)
-            : QWizardPage(parent),
-              m_infoLabel(new QLabel(this)),
-              m_wizardData(wizardData)
+    MaemoDeviceConfigWizardFinalPage(const WizardData &wizardData, QWidget *parent)
+        : GenericLinuxDeviceConfigurationWizardFinalPage(parent), 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()
+private:
+    QString infoText() const
     {
-        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);
+        if (m_wizardData.deviceType == LinuxDeviceConfiguration::Emulator)
+            return tr("The new device configuration will now be created.");
+        return GenericLinuxDeviceConfigurationWizardFinalPage::infoText();
     }
 
-private:
-    QLabel * const m_infoLabel;
     const WizardData &m_wizardData;
 };
 
index 51812c6..954093a 100644 (file)
@@ -47,7 +47,7 @@ using ProjectExplorer::RunControl;
 using ProjectExplorer::Target;
 
 namespace RemoteLinux {
-    namespace Internal {
+namespace Internal {
 
 class MaemoRunConfigurationFactory : public IRunConfigurationFactory
 {
index eb9fb15..6b0a7b6 100644 (file)
@@ -75,7 +75,6 @@ HEADERS += \
     linuxdevicefactoryselectiondialog.h \
     publickeydeploymentdialog.h \
     genericlinuxdeviceconfigurationwizard.h \
-    genericlinuxdeviceconfigurationwizardsetuppage.h \
     genericlinuxdeviceconfigurationfactory.h \
     maddedeviceconfigurationfactory.h \
     maemorunconfiguration.h \
@@ -84,7 +83,8 @@ HEADERS += \
     remotelinuxapplicationrunner.h \
     remotelinuxruncontrol.h \
     remotelinuxruncontrolfactory.h \
-    remotelinuxdebugsupport.h
+    remotelinuxdebugsupport.h \
+    genericlinuxdeviceconfigurationwizardpages.h
 
 SOURCES += \
     remotelinuxplugin.cpp \
@@ -151,7 +151,6 @@ SOURCES += \
     linuxdevicefactoryselectiondialog.cpp \
     publickeydeploymentdialog.cpp \
     genericlinuxdeviceconfigurationwizard.cpp \
-    genericlinuxdeviceconfigurationwizardsetuppage.cpp \
     genericlinuxdeviceconfigurationfactory.cpp \
     maddedeviceconfigurationfactory.cpp \
     maemorunconfiguration.cpp \
@@ -160,7 +159,8 @@ SOURCES += \
     remotelinuxapplicationrunner.cpp \
     remotelinuxruncontrol.cpp \
     remotelinuxruncontrolfactory.cpp \
-    remotelinuxdebugsupport.cpp
+    remotelinuxdebugsupport.cpp \
+    genericlinuxdeviceconfigurationwizardpages.cpp
 
 FORMS += \
     maemoconfigtestdialog.ui \