UIImportApplianceWzd.cpp revision ec3d8a7babbf884ae60c4577c259ebeab34f3bff
/** @file
*
* VBox frontends: Qt4 GUI ("VirtualBox"):
* UIImportApplianceWzd class implementation
*/
/*
* Copyright (C) 2009-2010 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
/* Global includes */
#include <QDialogButtonBox>
#include <QFileInfo>
#include <QPrintDialog>
#include <QPrinter>
#include <QPushButton>
#include <QTextStream>
/* Local includes */
#include "VBoxGlobal.h"
#include "UIImportApplianceWzd.h"
#include "QIFileDialog.h"
{
m_pCaption = new QLabel(this);
m_pCaption->setWordWrap(true);
m_pLicenseText = new QTextEdit(this);
m_pLicenseText->setReadOnly(true);
m_pButtonBox = new QDialogButtonBox(QDialogButtonBox::No | QDialogButtonBox::Yes, Qt::Horizontal, this);
m_pPrintButton = new QPushButton(this);
m_pSaveButton = new QPushButton(this);
}
{
}
void UIImportLicenseViewer::retranslateUi()
{
m_pCaption->setText(tr("<b>The virtual system \"%1\" requires that you agree to the terms and conditions "
"of the software license agreement shown below.</b><br /><br />Click <b>Agree</b> "
}
void UIImportLicenseViewer::sltPrint()
{
}
void UIImportLicenseViewer::sltSave()
{
this, tr("Save license to file..."));
{
{
}
}
}
{
/* Create & add pages */
/* Translate */
/* Resize to 'golden ratio' */
/* Assign watermark */
#ifdef Q_WS_MAC
/* Assign background image */
assignBackground(":/vmw_ovf_import_bg.png");
#else /* Q_WS_MAC */
assignWatermark(":/vmw_ovf_import.png");
#endif /* Q_WS_MAC */
/* Configure 'Restore Defaults' button */
AssertMsg(!field("applianceWidget").value<ImportAppliancePointer>().isNull(), ("Appliance Widget is not set!\n"));
connect(this, SIGNAL(customButtonClicked(int)), field("applianceWidget").value<ImportAppliancePointer>(), SLOT(restoreDefaults()));
}
void UIImportApplianceWzd::retranslateUi()
{
/* Wizard title */
/* Translate 'Restore Defaults' button */
}
{
}
{
/* Decorate page */
/* Setup file selector */
/* Setup validation */
/* Translate */
}
{
/* Translate uic generated strings */
/* Translate the file selector */
/* Wizard page 1 title */
}
bool UIImportApplianceWzdPage1::isComplete() const
{
return m_pFileSelector->path().toLower().endsWith(".ovf") && QFileInfo(m_pFileSelector->path()).exists();
}
{
AssertMsg(!field("applianceWidget").value<ImportAppliancePointer>().isNull(), ("Appliance Widget is not set!\n"));
/* Set the file path only if something had changed */
if (m_pFileSelector->isModified())
{
/* Reset the modified bit afterwards */
}
/* If we have a valid ovf proceed to the appliance settings page */
return applianceWidget->isValid();
}
{
/* Decorate page */
/* Register ImportAppliancePointer class */
/* Register 'applianceWidget' field! */
/* Translate */
}
{
/* Translate uic generated strings */
/* Wizard page 2 title */
}
{
/* Make sure the final values are puted back */
/* Check if there are license agreements the user must confirm */
if (!licAgreements.isEmpty())
{
UIImportLicenseViewer ilv(this);
for (int i = 0; i < licAgreements.size(); ++ i)
{
return false;
}
}
/* Now import all virtual systems */
return m_pSettingsCnt->import();
}