VirtualBox

Ignore:
Timestamp:
Jun 5, 2023 2:54:10 PM (20 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9080. Adding some infrastructure for VISO open functionality.

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

Legend:

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

    r98103 r100071  
    25462546        setStatusTip(QApplication::translate("UIActionPool", "Reset the VISO content."));
    25472547        setToolTip(QApplication::translate("UIActionPool", "Reset the VISO content.")
     2548                   + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
     2549    }
     2550};
     2551
     2552class UIActionMenuVISOCreatorOpen : public UIActionSimple
     2553{
     2554    Q_OBJECT;
     2555
     2556public:
     2557    /** Constructs action passing @a pParent to the base-class. */
     2558    UIActionMenuVISOCreatorOpen(UIActionPool *pParent)
     2559        : UIActionSimple(pParent,
     2560                         ":/cd_remove_16px.png", ":/cd_16px.png")
     2561    {
     2562        setShortcutContext(Qt::WidgetWithChildrenShortcut);
     2563    }
     2564
     2565protected:
     2566
     2567    /** Returns shortcut extra-data ID. */
     2568    virtual QString shortcutExtraDataID() const RT_OVERRIDE
     2569    {
     2570        return QString("VISOOpen");
     2571    }
     2572
     2573    /** Handles translation event. */
     2574    virtual void retranslateUi() RT_OVERRIDE
     2575    {
     2576        setName(QApplication::translate("UIActionPool", "Open"));
     2577        setShortcutScope(QApplication::translate("UIActionPool", "VISO Creator"));
     2578        setStatusTip(QApplication::translate("UIActionPool", "Open the VISO content."));
     2579        setToolTip(QApplication::translate("UIActionPool", "Open the VISO content.")
    25482580                   + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString())));
    25492581    }
     
    32043236    m_pool[UIActionIndex_M_VISOCreator_Rename] = new UIActionMenuVISOCreatorRename(this);
    32053237    m_pool[UIActionIndex_M_VISOCreator_Reset] = new UIActionMenuVISOCreatorReset(this);
     3238    m_pool[UIActionIndex_M_VISOCreator_Open] = new UIActionMenuVISOCreatorOpen(this);
    32063239
    32073240    /* Medium Selector actions: */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h

    r99469 r100071  
    158158    UIActionIndex_M_VISOCreator_Rename,
    159159    UIActionIndex_M_VISOCreator_Reset,
     160    UIActionIndex_M_VISOCreator_Open,
    160161
    161162    /* Medium selector actions : */
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.cpp

    r98103 r100071  
    607607}
    608608
     609void UIVisoContentBrowser::parseVisoFileContent(const QString &strFileName)
     610{
     611    Q_UNUSED(strFileName);
     612}
     613
    609614QModelIndex UIVisoContentBrowser::convertIndexToTableIndex(const QModelIndex &index)
    610615{
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.h

    r98103 r100071  
    7070    void setVisoName(const QString &strName);
    7171    virtual bool tableViewHasSelection() const final override;
     72    void parseVisoFileContent(const QString &strFileName);
    7273
    7374public slots:
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp

    r99946 r100071  
    3333
    3434/* GUI includes: */
     35#include "QIDialogButtonBox.h"
     36#include "QIFileDialog.h"
     37#include "QIToolBar.h"
    3538#include "UIActionPool.h"
    36 #include "QIDialogButtonBox.h"
     39#include "UICommon.h"
    3740#include "UIDesktopWidgetWatchdog.h"
    3841#include "UIExtraDataManager.h"
    3942#include "UIIconPool.h"
    4043#include "UIModalWindowManager.h"
    41 #include "QIToolBar.h"
    4244#include "UIVisoHostBrowser.h"
    4345#include "UIVisoCreator.h"
     
    4547#include "UIVisoCreatorOptionsPanel.h"
    4648#include "UIVisoContentBrowser.h"
    47 #include "UICommon.h"
    4849#ifdef VBOX_WS_MAC
    4950# include "VBoxUtils-darwin.h"
     
    6970    , m_pRenameAction(0)
    7071    , m_pResetAction(0)
     72    , m_pOpenAction(0)
    7173    , m_pMainLayout(0)
    7274    , m_pHostBrowser(0)
     
    227229
    228230    menu.exec(pContextMenuRequester->mapToGlobal(point));
     231}
     232
     233void UIVisoCreatorWidget::sltHandleOpenAction()
     234{
     235    QString strFileName =  QIFileDialog::getOpenFileName(uiCommon().defaultFolderPathForType(UIMediumDeviceType_DVD),
     236                                                         "Viso files (*.viso)", this, UIVisoCreatorWidget::tr("Select a viso file to load"));
     237    if (!strFileName.isEmpty() && m_pVISOContentBrowser)
     238        m_pVISOContentBrowser->parseVisoFileContent(strFileName);
    229239}
    230240
     
    366376        connect(m_pRenameAction, &QAction::triggered,
    367377                m_pVISOContentBrowser,&UIVisoContentBrowser::sltHandleItemRenameAction);
     378    if (m_pOpenAction)
     379        connect(m_pOpenAction, &QAction::triggered,
     380                this, &UIVisoCreatorWidget::sltHandleOpenAction);
    368381}
    369382
     
    376389    m_pActionOptions = m_pActionPool->action(UIActionIndex_M_VISOCreator_ToggleOptionsPanel);
    377390
     391    m_pOpenAction = m_pActionPool->action(UIActionIndex_M_VISOCreator_Open);
    378392    m_pAddAction = m_pActionPool->action(UIActionIndex_M_VISOCreator_Add);
    379393    if (m_pAddAction && m_pHostBrowser)
     
    402416        m_pMainMenu->addAction(m_pActionOptions);
    403417        m_pMainMenu->addSeparator();
    404         m_pMainMenu->addAction(m_pAddAction);
    405         m_pMainMenu->addAction(m_pRemoveAction);
    406         m_pMainMenu->addAction(m_pCreateNewDirectoryAction);
    407         m_pMainMenu->addAction(m_pResetAction);
     418        if (m_pAddAction)
     419            m_pMainMenu->addAction(m_pAddAction);
     420        if (m_pOpenAction)
     421            m_pMainMenu->addAction(m_pOpenAction);
     422        if (m_pRemoveAction)
     423            m_pMainMenu->addAction(m_pRemoveAction);
     424        if (m_pCreateNewDirectoryAction)
     425            m_pMainMenu->addAction(m_pCreateNewDirectoryAction);
     426        if (m_pResetAction)
     427            m_pMainMenu->addAction(m_pResetAction);
    408428    }
    409429
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.h

    r98103 r100071  
    121121    void sltHandleContentBrowserTableSelectionChanged(bool fIsSelectionEmpty);
    122122    void sltHandleShowContextMenu(const QWidget *pContextMenuRequester, const QPoint &point);
     123    void sltHandleOpenAction();
    123124
    124125private:
     
    174175        QAction              *m_pRenameAction;
    175176        QAction              *m_pResetAction;
     177        QAction              *m_pOpenAction;
    176178    /** @} */
    177179
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