VirtualBox

Changeset 77255 in vbox


Ignore:
Timestamp:
Feb 11, 2019 11:11:06 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
128762
Message:

FE/Qt: bugref:9340. Adding a 'stub' create medium action to virtual medium manager

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

Legend:

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

    r77215 r77255  
    18221822        setStatusTip(QApplication::translate("UIActionPool", "Add a disk image file"));
    18231823        setToolTip(QApplication::translate("UIActionPool", "Add a Disk Image File (%1)").arg(shortcut().toString()));
     1824    }
     1825};
     1826
     1827/** Simple action extension, used as 'Perform Create' action class. */
     1828class UIActionMenuSelectorMediumPerformCreate : public UIActionSimple
     1829{
     1830    Q_OBJECT;
     1831
     1832public:
     1833
     1834    /** Constructs action passing @a pParent to the base-class. */
     1835    UIActionMenuSelectorMediumPerformCreate(UIActionPool *pParent)
     1836        : UIActionSimple(pParent)
     1837    {
     1838        setShortcutContext(Qt::WidgetWithChildrenShortcut);
     1839        setIcon(0, UIIconPool::iconSetFull(":/hd_create_32px.png",          ":/hd_create_16px.png",
     1840                                           ":/hd_create_disabled_32px.png", ":/hd_create_disabled_16px.png"));
     1841        setIcon(1, UIIconPool::iconSetFull(":/cd_create_32px.png",          ":/cd_create_16px.png",
     1842                                           ":/cd_create_disabled_32px.png", ":/cd_create_disabled_16px.png"));
     1843        setIcon(2, UIIconPool::iconSetFull(":/fd_create_32px.png",          ":/fd_create_16px.png",
     1844                                           ":/fd_create_disabled_32px.png", ":/fd_create_disabled_16px.png"));
     1845    }
     1846
     1847protected:
     1848
     1849    /** Returns shortcut extra-data ID. */
     1850    virtual QString shortcutExtraDataID() const /* override */
     1851    {
     1852        return QString("CreateMedium");
     1853    }
     1854
     1855    /** Returns default shortcut. */
     1856    virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */
     1857    {
     1858        return QKeySequence("");
     1859    }
     1860
     1861    /** Handles translation event. */
     1862    virtual void retranslateUi() /* override */
     1863    {
     1864        setName(QApplication::translate("UIActionPool", "&Create..."));
     1865        setShortcutScope(QApplication::translate("UIActionPool", "Media Manager"));
     1866        setStatusTip(QApplication::translate("UIActionPool", "Create a new disk image"));
     1867        setToolTip(QApplication::translate("UIActionPool", "Create a New Disk Image (%1)").arg(shortcut().toString()));
    18241868    }
    18251869};
     
    26582702    m_pool[UIActionIndexST_M_Medium] = new UIActionMenuSelectorMedium(this);
    26592703    m_pool[UIActionIndexST_M_Medium_S_Add] = new UIActionMenuSelectorMediumPerformAdd(this);
     2704    m_pool[UIActionIndexST_M_Medium_S_Create] = new UIActionMenuSelectorMediumPerformCreate(this);
    26602705    m_pool[UIActionIndexST_M_Medium_S_Copy] = new UIActionMenuSelectorMediumPerformCopy(this);
    26612706    m_pool[UIActionIndexST_M_Medium_S_Move] = new UIActionMenuSelectorMediumPerformMove(this);
     
    31143159    /* 'Add' action: */
    31153160    fSeparator = addAction(pMenu, action(UIActionIndexST_M_Medium_S_Add)) || fSeparator;
     3161    fSeparator = addAction(pMenu, action(UIActionIndexST_M_Medium_S_Create)) || fSeparator;
    31163162
    31173163    /* Separator? */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.h

    r77014 r77255  
    133133    UIActionIndexST_M_Medium,
    134134    UIActionIndexST_M_Medium_S_Add,
     135    UIActionIndexST_M_Medium_S_Create,
    135136    UIActionIndexST_M_Medium_S_Copy,
    136137    UIActionIndexST_M_Medium_S_Move,
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp

    r77161 r77255  
    492492}
    493493
     494void UIMediumManagerWidget::sltCreateMedium()
     495{
     496}
     497
    494498void UIMediumManagerWidget::sltCopyMedium()
    495499{
     
    637641    {
    638642        menu.addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Add));
     643        menu.addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Create));
    639644        menu.addAction(m_pActionPool->action(UIActionIndexST_M_Medium_T_Search));
    640645        menu.addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Refresh));
     
    731736    /* First of all, add actions which has smaller shortcut scope: */
    732737    addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Add));
     738    addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Create));
    733739    addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Copy));
    734740    addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Move));
     
    742748    connect(m_pActionPool->action(UIActionIndexST_M_Medium_S_Add), &QAction::triggered,
    743749            this, &UIMediumManagerWidget::sltAddMedium);
     750    connect(m_pActionPool->action(UIActionIndexST_M_Medium_S_Create), &QAction::triggered,
     751            this, &UIMediumManagerWidget::sltCreateMedium);
    744752    connect(m_pActionPool->action(UIActionIndexST_M_Medium_S_Copy), &QAction::triggered,
    745753            this, &UIMediumManagerWidget::sltCopyMedium);
     
    800808        /* Add toolbar actions: */
    801809        m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Add));
     810        m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Create));
    802811        m_pToolBar->addSeparator();
    803812        m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Medium_S_Copy));
     
    10711080    {
    10721081        m_pActionPool->action(UIActionIndexST_M_Medium_S_Add)->setState((int)enmCurrentMediumType);
     1082        m_pActionPool->action(UIActionIndexST_M_Medium_S_Create)->setState((int)enmCurrentMediumType);
    10731083        m_pActionPool->action(UIActionIndexST_M_Medium_S_Copy)->setState((int)enmCurrentMediumType);
    10741084        m_pActionPool->action(UIActionIndexST_M_Medium_S_Move)->setState((int)enmCurrentMediumType);
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h

    r77014 r77255  
    168168        /** Handles command to add medium. */
    169169        void sltAddMedium();
     170        /** Handles command to create medium. */
     171        void sltCreateMedium();
    170172        /** Handles command to copy medium. */
    171173        void sltCopyMedium();
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp

    r77238 r77255  
    446446    QUuid uMediumId;
    447447
    448     if (m_enmMediumType == UIMediumDeviceType_Floppy)
    449         uMediumId = vboxGlobal().showCreateFloppyDiskDialog(this, m_strMachineName, m_strMachineFolder);
    450     else if (m_enmMediumType == UIMediumDeviceType_HardDisk)
    451         uMediumId = vboxGlobal().createHDWithNewHDWizard(this, m_strMachineGuestOSTypeId, m_strMachineName, m_strMachineFolder);
    452     else if (m_enmMediumType == UIMediumDeviceType_DVD)
    453         uMediumId = vboxGlobal().createVisoMediumWithVisoCreator(this, m_strMachineName, m_strMachineFolder);
    454 
     448    switch (m_enmMediumType)
     449    {
     450        case UIMediumDeviceType_Floppy:
     451            uMediumId = vboxGlobal().showCreateFloppyDiskDialog(this, m_strMachineName, m_strMachineFolder);
     452            break;
     453        case UIMediumDeviceType_HardDisk:
     454            uMediumId = vboxGlobal().createHDWithNewHDWizard(this, m_strMachineGuestOSTypeId, m_strMachineName, m_strMachineFolder);
     455            break;
     456        case UIMediumDeviceType_DVD:
     457            uMediumId = vboxGlobal().createVisoMediumWithVisoCreator(this, m_strMachineName, m_strMachineFolder);
     458            break;
     459        default:
     460            break;
     461    }
    455462    if (!uMediumId.isNull())
    456463    {
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