VirtualBox

Changeset 77297 in vbox


Ignore:
Timestamp:
Feb 13, 2019 12:58:29 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
128817
Message:

FE/Qt: bugref:9390: Manager action-pool, VirtualBox Manager and Export Appliance wizard: Adding Export menu item to Machine menu and context-menu.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.cpp

    r77255 r77297  
    689689        setName(QApplication::translate("UIActionPool", "Cl&one..."));
    690690        setStatusTip(QApplication::translate("UIActionPool", "Clone selected virtual machine"));
     691    }
     692};
     693
     694/** Simple action extension, used as 'Perform Export Machine' action class. */
     695class UIActionSimpleSelectorMachinePerformExport : public UIActionSimple
     696{
     697    Q_OBJECT;
     698
     699public:
     700
     701    /** Constructs action passing @a pParent to the base-class. */
     702    UIActionSimpleSelectorMachinePerformExport(UIActionPool *pParent)
     703        : UIActionSimple(pParent, ":/export_16px.png", ":/export_disabled_16px.png")
     704    {}
     705
     706protected:
     707
     708    /** Returns shortcut extra-data ID. */
     709    virtual QString shortcutExtraDataID() const /* override */
     710    {
     711        return QString("ExportVM");
     712    }
     713
     714    /** Handles translation event. */
     715    virtual void retranslateUi() /* override */
     716    {
     717        setName(QApplication::translate("UIActionPool", "&Export..."));
     718        setStatusTip(QApplication::translate("UIActionPool", "Export selected virtual machine"));
    691719    }
    692720};
     
    26592687    m_pool[UIActionIndexST_M_Machine_S_Settings] = new UIActionSimpleSelectorMachineShowSettings(this);
    26602688    m_pool[UIActionIndexST_M_Machine_S_Clone] = new UIActionSimpleSelectorMachinePerformClone(this);
     2689    m_pool[UIActionIndexST_M_Machine_S_Export] = new UIActionSimpleSelectorMachinePerformExport(this);
    26612690    m_pool[UIActionIndexST_M_Machine_S_Move] = new UIActionSimpleSelectorMachinePerformMove(this);
    26622691    m_pool[UIActionIndexST_M_Machine_S_Remove] = new UIActionSimpleSelectorMachinePerformRemove(this);
     
    30033032    pMenu->addAction(action(UIActionIndexST_M_Machine_S_Settings));
    30043033    pMenu->addAction(action(UIActionIndexST_M_Machine_S_Clone));
     3034    pMenu->addAction(action(UIActionIndexST_M_Machine_S_Export));
    30053035    pMenu->addAction(action(UIActionIndexST_M_Machine_S_Move));
    30063036    pMenu->addAction(action(UIActionIndexST_M_Machine_S_Remove));
     
    33693399        case UIActionIndexST_M_Machine:
    33703400        {
    3371 
    33723401            actions << action(UIActionIndexST_M_Machine_S_New)
    33733402                    << action(UIActionIndexST_M_Machine_S_Add)
    33743403                    << action(UIActionIndexST_M_Machine_S_Settings)
    33753404                    << action(UIActionIndexST_M_Machine_S_Clone)
     3405                    << action(UIActionIndexST_M_Machine_S_Export)
    33763406                    << action(UIActionIndexST_M_Machine_S_Move)
    33773407                    << action(UIActionIndexST_M_Machine_S_Remove)
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.h

    r77255 r77297  
    9090    UIActionIndexST_M_Machine_S_Settings,
    9191    UIActionIndexST_M_Machine_S_Clone,
     92    UIActionIndexST_M_Machine_S_Export,
    9293    UIActionIndexST_M_Machine_S_Move,
    9394    UIActionIndexST_M_Machine_S_Remove,
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r76949 r77297  
    530530    /* Lock the action preventing cascade calls: */
    531531    actionPool()->action(UIActionIndexST_M_File_S_ExportAppliance)->setProperty("opened", true);
     532    actionPool()->action(UIActionIndexST_M_Machine_S_Export)->setProperty("opened", true);
    532533    updateActionsAppearance();
     534
     535    /* Check what was the action invoked us: */
     536    UIAction *pAction = qobject_cast<UIAction*>(sender());
    533537
    534538    /* Use the "safe way" to open stack of Mac OS X Sheets: */
    535539    QWidget *pWizardParent = windowManager().realParentWindow(this);
    536     UISafePointerWizard pWizard = new UIWizardExportApp(pWizardParent, names);
     540    UISafePointerWizard pWizard = new UIWizardExportApp(pWizardParent, names,
     541                                                        pAction &&
     542                                                        pAction == actionPool()->action(UIActionIndexST_M_Machine_S_Export));
    537543    windowManager().registerNewParent(pWizard, pWizardParent);
    538544    pWizard->prepare();
     
    544550    {
    545551        actionPool()->action(UIActionIndexST_M_File_S_ExportAppliance)->setProperty("opened", QVariant());
     552        actionPool()->action(UIActionIndexST_M_Machine_S_Export)->setProperty("opened", QVariant());
    546553        updateActionsAppearance();
    547554    }
     
    14291436    connect(actionPool()->action(UIActionIndexST_M_Machine_S_Clone), &UIAction::triggered,
    14301437            this, &UIVirtualBoxManager::sltOpenCloneMachineWizard);
     1438    connect(actionPool()->action(UIActionIndexST_M_Machine_S_Export), &UIAction::triggered,
     1439            this, &UIVirtualBoxManager::sltOpenExportApplianceWizard);
    14311440    connect(actionPool()->action(UIActionIndexST_M_Machine_S_Move), &UIAction::triggered,
    14321441            this, &UIVirtualBoxManager::sltPerformMachineMove);
     
    17121721    actionPool()->action(UIActionIndexST_M_Machine_S_Settings)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_Settings, items));
    17131722    actionPool()->action(UIActionIndexST_M_Machine_S_Clone)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_Clone, items));
     1723    actionPool()->action(UIActionIndexST_M_Machine_S_Export)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_Export, items));
    17141724    actionPool()->action(UIActionIndexST_M_Machine_S_Move)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_Move, items));
    17151725    actionPool()->action(UIActionIndexST_M_Machine_S_Remove)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_Remove, items));
     
    18761886                   UIVirtualMachineItem::isItemEditable(pItem);
    18771887        }
     1888        case UIActionIndexST_M_Machine_S_Export:
     1889        {
     1890            return !actionPool()->action(iActionIndex)->property("opened").toBool() &&
     1891                   items.size() == 1;
     1892        }
    18781893        case UIActionIndexST_M_Machine_S_Remove:
    18791894        {
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp

    r77228 r77297  
    14141414        m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Settings));
    14151415        m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Clone));
     1416        m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Export));
    14161417        m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Move));
    14171418        m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Remove));
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.cpp

    r76606 r77297  
    1717
    1818/* Qt includes: */
     19#include <QAbstractButton>
    1920#include <QFileInfo>
    2021#include <QVariant>
     
    3738
    3839
    39 UIWizardExportApp::UIWizardExportApp(QWidget *pParent, const QStringList &selectedVMNames)
     40UIWizardExportApp::UIWizardExportApp(QWidget *pParent,
     41                                     const QStringList &selectedVMNames /* = QStringList() */,
     42                                     bool fFastTraverToPage2 /* = false */)
    4043    : UIWizard(pParent, WizardType_ExportAppliance)
    4144    , m_selectedVMNames(selectedVMNames)
     45    , m_fFastTraverToPage2(fFastTraverToPage2)
    4246{
    4347#ifndef VBOX_WS_MAC
     
    226230    /* Call to base-class: */
    227231    UIWizard::prepare();
     232
     233    /* Now, when we are ready, we can
     234     * fast traver to page 2 if requested: */
     235    if (m_fFastTraverToPage2)
     236        button(QWizard::NextButton)->click();
    228237}
    229238
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.h

    r76581 r77297  
    5151    /** Constructs export appliance wizard passing @a pParent to the base-class.
    5252      * @param  selectedVMNames  Brings the names of VMs to be exported. */
    53     UIWizardExportApp(QWidget *pParent, const QStringList &selectedVMNames = QStringList());
     53    UIWizardExportApp(QWidget *pParent, const QStringList &selectedVMNames = QStringList(), bool fFastTraverToPage2 = false);
    5454
    5555    /** Exports full appliance. */
     
    8282
    8383    /** Holds the names of VMs to be exported. */
    84     QStringList m_selectedVMNames;
     84    QStringList  m_selectedVMNames;
     85    /** Holds whether we should fast travel to page 2. */
     86    bool         m_fFastTraverToPage2;
    8587};
    8688
Note: See TracChangeset for help on using the changeset viewer.

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