UIWizardExportAppPageBasic2::UIWizardExportAppPageBasic2()
{
    /* Create widgets: */
    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
    {
        m_pLabel = new QIRichTextLabel(this);
        m_pTypeCnt = new QGroupBox(this);
        {
            QVBoxLayout *pTypeCntLayout = new QVBoxLayout(m_pTypeCnt);
            {
                m_pTypeLocalFilesystem = new QRadioButton(m_pTypeCnt);
                m_pTypeSunCloud = new QRadioButton(m_pTypeCnt);
                m_pTypeSimpleStorageSystem = new QRadioButton(m_pTypeCnt);
                pTypeCntLayout->addWidget(m_pTypeLocalFilesystem);
                pTypeCntLayout->addWidget(m_pTypeSunCloud);
                pTypeCntLayout->addWidget(m_pTypeSimpleStorageSystem);
            }
        }
        pMainLayout->addWidget(m_pLabel);
        pMainLayout->addWidget(m_pTypeCnt);
        pMainLayout->addStretch();
        chooseDefaultStorageType();
    }

    /* Setup connections: */
    connect(m_pTypeLocalFilesystem, SIGNAL(clicked()), this, SIGNAL(completeChanged()));
    connect(m_pTypeSunCloud, SIGNAL(clicked()), this, SIGNAL(completeChanged()));
    connect(m_pTypeSimpleStorageSystem, SIGNAL(clicked()), this, SIGNAL(completeChanged()));

    /* Register classes: */
    qRegisterMetaType<StorageType>();
    /* Register fields: */
    registerField("storageType", this, "storageType");
}
UIWizardExportAppPageExpert::UIWizardExportAppPageExpert(const QStringList &selectedVMNames)
{
    /* Create widgets: */
    QGridLayout *pMainLayout = new QGridLayout(this);
    {
        pMainLayout->setContentsMargins(8, 6, 8, 6);
        pMainLayout->setSpacing(10);
        m_pSelectorCnt = new QGroupBox(this);
        {
            QVBoxLayout *pSelectorCntLayout = new QVBoxLayout(m_pSelectorCnt);
            {
                m_pVMSelector = new QListWidget(m_pSelectorCnt);
                {
                    m_pVMSelector->setAlternatingRowColors(true);
                    m_pVMSelector->setSelectionMode(QAbstractItemView::ExtendedSelection);
                }
                pSelectorCntLayout->addWidget(m_pVMSelector);
            }
        }
        m_pApplianceCnt = new QGroupBox(this);
        {
            QVBoxLayout *pApplianceCntLayout = new QVBoxLayout(m_pApplianceCnt);
            {
                m_pApplianceWidget = new UIApplianceExportEditorWidget(m_pApplianceCnt);
                {
                    m_pApplianceWidget->setMinimumHeight(250);
                    m_pApplianceWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
                }
                pApplianceCntLayout->addWidget(m_pApplianceWidget);
            }
        }
        m_pTypeCnt = new QGroupBox(this);
        {
            m_pTypeCnt->hide();
            QVBoxLayout *pTypeCntLayout = new QVBoxLayout(m_pTypeCnt);
            {
                m_pTypeLocalFilesystem = new QRadioButton(m_pTypeCnt);
                m_pTypeSunCloud = new QRadioButton(m_pTypeCnt);
                m_pTypeSimpleStorageSystem = new QRadioButton(m_pTypeCnt);
                pTypeCntLayout->addWidget(m_pTypeLocalFilesystem);
                pTypeCntLayout->addWidget(m_pTypeSunCloud);
                pTypeCntLayout->addWidget(m_pTypeSimpleStorageSystem);
            }
        }
        m_pSettingsCnt = new QGroupBox(this);
        {
            QGridLayout *pSettingsLayout = new QGridLayout(m_pSettingsCnt);
            {
                m_pUsernameEditor = new QLineEdit(m_pSettingsCnt);
                m_pUsernameLabel = new QLabel(m_pSettingsCnt);
                {
                    m_pUsernameLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
                    m_pUsernameLabel->setBuddy(m_pUsernameEditor);
                }
                m_pPasswordEditor = new QLineEdit(m_pSettingsCnt);
                {
                    m_pPasswordEditor->setEchoMode(QLineEdit::Password);
                }
                m_pPasswordLabel = new QLabel(m_pSettingsCnt);
                {
                    m_pPasswordLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
                    m_pPasswordLabel->setBuddy(m_pPasswordEditor);
                }
                m_pHostnameEditor = new QLineEdit(m_pSettingsCnt);
                m_pHostnameLabel = new QLabel(m_pSettingsCnt);
                {
                    m_pHostnameLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
                    m_pHostnameLabel->setBuddy(m_pHostnameEditor);
                }
                m_pBucketEditor = new QLineEdit(m_pSettingsCnt);
                m_pBucketLabel = new QLabel(m_pSettingsCnt);
                {
                    m_pBucketLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
                    m_pBucketLabel->setBuddy(m_pBucketEditor);
                }
                m_pFileSelector = new VBoxEmptyFileSelector(m_pSettingsCnt);
                {
                    m_pFileSelector->setMode(VBoxFilePathSelectorWidget::Mode_File_Save);
                    m_pFileSelector->setEditable(true);
                    m_pFileSelector->setButtonPosition(VBoxEmptyFileSelector::RightPosition);
                    m_pFileSelector->setDefaultSaveExt("ova");
                }
                m_pFileSelectorLabel = new QLabel(m_pSettingsCnt);
                {
                    m_pFileSelectorLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
                    m_pFileSelectorLabel->setBuddy(m_pFileSelector);
                }
                m_pFormatComboBox = new QComboBox(m_pSettingsCnt);
                {
                    const QString strFormat09("ovf-0.9");
                    const QString strFormat10("ovf-1.0");
                    const QString strFormat20("ovf-2.0");
                    m_pFormatComboBox->addItem(strFormat09, strFormat09);
                    m_pFormatComboBox->addItem(strFormat10, strFormat10);
                    m_pFormatComboBox->addItem(strFormat20, strFormat20);
                    connect(m_pFormatComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(sltUpdateFormatComboToolTip()));
                }
                m_pFormatComboBoxLabel = new QLabel(m_pSettingsCnt);
                {
                    m_pFormatComboBoxLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
                    m_pFormatComboBoxLabel->setBuddy(m_pFormatComboBox);
                }
                m_pManifestCheckbox = new QCheckBox(m_pSettingsCnt);
                pSettingsLayout->addWidget(m_pUsernameLabel, 0, 0);
                pSettingsLayout->addWidget(m_pUsernameEditor, 0, 1);
                pSettingsLayout->addWidget(m_pPasswordLabel, 1, 0);
                pSettingsLayout->addWidget(m_pPasswordEditor, 1, 1);
                pSettingsLayout->addWidget(m_pHostnameLabel, 2, 0);
                pSettingsLayout->addWidget(m_pHostnameEditor, 2, 1);
                pSettingsLayout->addWidget(m_pBucketLabel, 3, 0);
                pSettingsLayout->addWidget(m_pBucketEditor, 3, 1);
                pSettingsLayout->addWidget(m_pFileSelectorLabel, 4, 0);
                pSettingsLayout->addWidget(m_pFileSelector, 4, 1);
                pSettingsLayout->addWidget(m_pFormatComboBoxLabel, 5, 0);
                pSettingsLayout->addWidget(m_pFormatComboBox, 5, 1);
                pSettingsLayout->addWidget(m_pManifestCheckbox, 6, 0, 1, 2);
            }
        }
        pMainLayout->addWidget(m_pSelectorCnt, 0, 0);
        pMainLayout->addWidget(m_pApplianceCnt, 0, 1);
        pMainLayout->addWidget(m_pTypeCnt, 1, 0, 1, 2);
        pMainLayout->addWidget(m_pSettingsCnt, 2, 0, 1, 2);
        populateVMSelectorItems(selectedVMNames);
        chooseDefaultStorageType();
        chooseDefaultSettings();
    }

    /* Setup connections: */
    connect(m_pVMSelector, SIGNAL(itemSelectionChanged()), this, SLOT(sltVMSelectionChangeHandler()));
    connect(m_pTypeLocalFilesystem, SIGNAL(clicked()), this, SLOT(sltStorageTypeChangeHandler()));
    connect(m_pTypeSunCloud, SIGNAL(clicked()), this, SLOT(sltStorageTypeChangeHandler()));
    connect(m_pTypeSimpleStorageSystem, SIGNAL(clicked()), this, SLOT(sltStorageTypeChangeHandler()));
    connect(m_pUsernameEditor, SIGNAL(textChanged(const QString &)), this, SIGNAL(completeChanged()));
    connect(m_pPasswordEditor, SIGNAL(textChanged(const QString &)), this, SIGNAL(completeChanged()));
    connect(m_pHostnameEditor, SIGNAL(textChanged(const QString &)), this, SIGNAL(completeChanged()));
    connect(m_pBucketEditor, SIGNAL(textChanged(const QString &)), this, SIGNAL(completeChanged()));
    connect(m_pFileSelector, SIGNAL(pathChanged(const QString &)), this, SIGNAL(completeChanged()));

    /* Register classes: */
    qRegisterMetaType<StorageType>();
    qRegisterMetaType<ExportAppliancePointer>();
    /* Register fields: */
    registerField("machineNames", this, "machineNames");
    registerField("machineIDs", this, "machineIDs");
    registerField("storageType", this, "storageType");
    registerField("format", this, "format");
    registerField("manifestSelected", this, "manifestSelected");
    registerField("username", this, "username");
    registerField("password", this, "password");
    registerField("hostname", this, "hostname");
    registerField("bucket", this, "bucket");
    registerField("path", this, "path");
    registerField("applianceWidget", this, "applianceWidget");
}