VirtualBox

Changeset 17450 in vbox for trunk/src


Ignore:
Timestamp:
Mar 6, 2009 10:27:03 AM (16 years ago)
Author:
vboxsync
Message:

FE/Qt4-OVF: initial OVF export support

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
3 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r17384 r17450  
    288288        include/VBoxSettingsSelector.h \
    289289        include/VBoxImportApplianceWgt.h \
    290         include/VBoxImportApplianceWzd.h
     290        include/VBoxImportApplianceWzd.h \
     291        include/VBoxExportApplianceWzd.h
    291292
    292293# Sources containing local definitions of classes that use the Q_OBJECT macro.
     
    367368        src/VBoxMedium.cpp \
    368369        src/VBoxImportApplianceWgt.cpp \
    369         src/VBoxImportApplianceWzd.cpp
     370        src/VBoxImportApplianceWzd.cpp \
     371        src/VBoxExportApplianceWzd.cpp
    370372
    371373ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(KBUILD_TARGET)),) # X11
  • trunk/src/VBox/Frontends/VirtualBox/VBoxUI.pro

    r17049 r17450  
    5757    ui/VBoxGLSettingsLanguage.ui \
    5858    ui/VBoxImportApplianceWgt.ui \
    59     ui/VBoxImportApplianceWzd.ui
     59    ui/VBoxImportApplianceWzd.ui \
     60    ui/VBoxExportApplianceWzd.ui
    6061
    6162TRANSLATIONS = \
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h

    r17049 r17450  
    8888class VBoxProblemReporter : public QObject
    8989{
    90     Q_OBJECT
     90    Q_OBJECT;
    9191
    9292public:
     
    109109    static VBoxProblemReporter &instance();
    110110
    111     bool isValid();
     111    bool isValid() const;
    112112
    113113    // helpers
     
    119119                 const QString &aText1 = QString::null,
    120120                 const QString &aText2 = QString::null,
    121                  const QString &aText3 = QString::null);
     121                 const QString &aText3 = QString::null) const;
    122122
    123123    int message (QWidget *aParent, Type aType, const QString &aMessage,
     
    126126                 const QString &aText1 = QString::null,
    127127                 const QString &aText2 = QString::null,
    128                  const QString &aText3 = QString::null)
     128                 const QString &aText3 = QString::null) const
    129129    {
    130130        return message (aParent, aType, aMessage, QString::null, aAutoConfirmId,
     
    136136                       const char *aAutoConfirmId = 0,
    137137                       const QString &aYesText = QString::null,
    138                        const QString &aNoText = QString::null)
     138                       const QString &aNoText = QString::null) const
    139139    {
    140140        return (message (aParent, aType, aMessage, aDetails, aAutoConfirmId,
     
    149149                       const char *aAutoConfirmId,
    150150                       const QString &aYesText = QString::null,
    151                        const QString &aNoText = QString::null)
     151                       const QString &aNoText = QString::null) const
    152152    {
    153153        return messageYesNo (aParent, aType, aMessage, QString::null,
     
    159159                          const char *aAutoConfirmId = 0,
    160160                          const QString &aOkText = QString::null,
    161                           const QString &aCancelText = QString::null)
     161                          const QString &aCancelText = QString::null) const
    162162    {
    163163        return (message (aParent, aType, aMessage, aDetails, aAutoConfirmId,
     
    172172                          const char *aAutoConfirmId,
    173173                          const QString &aOkText = QString::null,
    174                           const QString &aCancelText = QString::null)
     174                          const QString &aCancelText = QString::null) const
    175175    {
    176176        return messageOkCancel (aParent, aType, aMessage, QString::null,
     
    181181                                  QWidget *aParent, int aMinDuration = 2000);
    182182
    183     QWidget *mainWindowShown();
     183    QWidget *mainWindowShown() const;
    184184
    185185    // problem handlers
     
    372372    void cannotRunInSelectorMode();
    373373
    374     void cannotImportAppliance (CAppliance *aAppliance, QWidget *aParent = NULL);
    375     void cannotImportAppliance (const CProgress &aProgress, CAppliance *aAppliance, QWidget *aParent = NULL);
     374    void cannotImportAppliance (CAppliance *aAppliance, QWidget *aParent = NULL) const;
     375    void cannotImportAppliance (const CProgress &aProgress, CAppliance *aAppliance, QWidget *aParent = NULL) const;
     376
     377
     378    bool askForOverridingAppliance (const QString& path, QWidget *aParent = NULL) const;
     379    void cannotExportAppliance (CAppliance *aAppliance, QWidget *aParent = NULL) const;
     380    void cannotExportAppliance (const CProgress &aProgress, CAppliance *aAppliance, QWidget *aParent = NULL) const;
    376381
    377382    void showRuntimeError (const CConsole &console, bool fatal,
    378383                           const QString &errorID,
    379                            const QString &errorMsg);
     384                           const QString &errorMsg) const;
    380385
    381386    static QString toAccusative (VBoxDefs::MediaType aType);
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxSelectorWnd.h

    r16617 r17450  
    6969    void fileMediaMgr();
    7070    void fileImportAppliance();
     71    void fileExportAppliance();
    7172    void fileSettings();
    7273    void fileExit();
     
    151152    QAction *mFileMediaMgrAction;
    152153    QAction *mFileApplianceImportAction;
     154    QAction *mFileApplianceExportAction;
    153155    QAction *mFileSettingsAction;
    154156    QAction *mFileExitAction;
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxImportApplianceWzd.cpp

    r17053 r17450  
    8383
    8484    if (aWval == mWValFileSelector)
    85         valid = mFileSelector->path().endsWith (".ovf") &&
     85        valid = mFileSelector->path().toLower().endsWith (".ovf") &&
    8686                QFileInfo (mFileSelector->path()).exists();
    8787
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp

    r17408 r17450  
    314314}
    315315
    316 bool VBoxProblemReporter::isValid()
     316bool VBoxProblemReporter::isValid() const
    317317{
    318318    return qApp != 0;
     
    377377                                  const QString &aText1 /* = QString::null */,
    378378                                  const QString &aText2 /* = QString::null */,
    379                                   const QString &aText3 /* = QString::null */)
     379                                  const QString &aText3 /* = QString::null */) const
    380380{
    381381    if (aButton1 == 0 && aButton2 == 0 && aButton3 == 0)
     
    520520 *  zero if none of them. The selector window takes precedence.
    521521 */
    522 QWidget *VBoxProblemReporter::mainWindowShown()
     522QWidget *VBoxProblemReporter::mainWindowShown() const
    523523{
    524524    /* It may happen that this method is called during VBoxGlobal
     
    21152115}
    21162116
    2117 void VBoxProblemReporter::cannotImportAppliance (CAppliance *aAppliance, QWidget *aParent /* = NULL */)
     2117void VBoxProblemReporter::cannotImportAppliance (CAppliance *aAppliance, QWidget *aParent /* = NULL */) const
    21182118{
    21192119    if (aAppliance->isNull())
     
    21342134}
    21352135
    2136 void VBoxProblemReporter::cannotImportAppliance (const CProgress &aProgress, CAppliance* aAppliance, QWidget *aParent /* = NULL */)
     2136void VBoxProblemReporter::cannotImportAppliance (const CProgress &aProgress, CAppliance* aAppliance, QWidget *aParent /* = NULL */) const
    21372137{
    21382138    AssertWrapperOk (aProgress);
     
    21442144}
    21452145
     2146bool VBoxProblemReporter::askForOverridingAppliance (const QString& aPath, QWidget *aParent /* = NULL */) const
     2147{
     2148    return messageYesNo (aParent, Question, tr ("The file <b>%1</b> exists already. Are you sure you want override it?").arg (aPath), NULL);
     2149}
     2150
     2151void VBoxProblemReporter::cannotExportAppliance (CAppliance *aAppliance, QWidget *aParent /* = NULL */) const
     2152{
     2153    if (aAppliance->isNull())
     2154    {
     2155        message (aParent ? aParent : mainWindowShown(),
     2156                 Error,
     2157                 tr ("Failed to create an appliance."));
     2158    }else
     2159    {
     2160        /* Preserve the current error info before calling the object again */
     2161        COMResult res (*aAppliance);
     2162
     2163        message (aParent ? aParent : mainWindowShown(),
     2164                 Error,
     2165                 tr ("Failed to prepare the export of the appliance <b>%1</b>.").arg (aAppliance->GetPath()),
     2166                 formatErrorInfo (res));
     2167    }
     2168}
     2169
     2170void VBoxProblemReporter::cannotExportAppliance (const CProgress &aProgress, CAppliance* aAppliance, QWidget *aParent /* = NULL */) const
     2171{
     2172    AssertWrapperOk (aProgress);
     2173
     2174    message (aParent ? aParent : mainWindowShown(),
     2175             Error,
     2176             tr ("Failed to export appliance <b>%1</b>.").arg (aAppliance->GetPath()),
     2177             formatErrorInfo (aProgress.GetErrorInfo()));
     2178}
     2179
    21462180void VBoxProblemReporter::showRuntimeError (const CConsole &aConsole, bool fatal,
    21472181                                            const QString &errorID,
    2148                                             const QString &errorMsg)
     2182                                            const QString &errorMsg) const
    21492183{
    21502184    /// @todo (r=dmik) it's just a preliminary box. We need to:
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp

    r17160 r17450  
    3131#include "VBoxMediaManagerDlg.h"
    3232#include "VBoxImportApplianceWzd.h"
     33#include "VBoxExportApplianceWzd.h"
    3334#include "VBoxSettingsDialogSpecific.h"
    3435#include "VBoxVMLogViewer.h"
     
    408409    mFileApplianceImportAction = new QAction (this);
    409410    mFileApplianceImportAction->setIcon (VBoxGlobal::iconSet (":/import_16px.png"));
     411
     412    mFileApplianceExportAction = new QAction (this);
     413    mFileApplianceExportAction->setIcon (VBoxGlobal::iconSet (":/import_16px.png"));
    410414
    411415    mFileSettingsAction = new QAction(this);
     
    546550    mFileMenu->addAction (mFileMediaMgrAction);
    547551    mFileMenu->addAction (mFileApplianceImportAction);
     552    mFileMenu->addAction (mFileApplianceExportAction);
    548553#ifndef Q_WS_MAC
    549554    mFileMenu->addSeparator();
     
    651656    connect (mFileMediaMgrAction, SIGNAL (triggered()), this, SLOT (fileMediaMgr()));
    652657    connect (mFileApplianceImportAction, SIGNAL (triggered()), this, SLOT (fileImportAppliance()));
     658    connect (mFileApplianceExportAction, SIGNAL (triggered()), this, SLOT (fileExportAppliance()));
    653659    connect (mFileSettingsAction, SIGNAL (triggered()), this, SLOT (fileSettings()));
    654660    connect (mFileExitAction, SIGNAL (triggered()), this, SLOT (fileExit()));
     
    751757{
    752758    VBoxImportApplianceWzd wzd (this);
     759
     760    wzd.exec();
     761}
     762
     763void VBoxSelectorWnd::fileExportAppliance()
     764{
     765    QString name;
     766
     767    VBoxVMItem *item = mVMListView->selectedItem();
     768    if (item)
     769        name = item->name();
     770
     771    VBoxExportApplianceWzd wzd (this, name);
    753772
    754773    wzd.exec();
     
    12731292    mFileApplianceImportAction->setStatusTip (tr ("Import an appliance into VirtualBox"));
    12741293
     1294    mFileApplianceExportAction->setText (tr ("&Export Appliance..."));
     1295    mFileApplianceExportAction->setShortcut (QKeySequence ("Ctrl+J"));
     1296    mFileApplianceExportAction->setStatusTip (tr ("Export an appliance out of VM's from VirtualBox"));
     1297
    12751298#ifdef Q_WS_MAC
    12761299    /*
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxImportApplianceWzd.ui

    r17049 r17450  
    374374 <resources>
    375375  <include location="../VirtualBox.qrc"/>
    376   <include location="../../VirtualBox.qrc"/>
     376  <include location="../VirtualBox.qrc"/>
    377377 </resources>
    378378 <connections/>
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette