VirtualBox

Changeset 76826 in vbox


Ignore:
Timestamp:
Jan 15, 2019 6:19:10 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9080: Adding a menu to the dialog.

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

Legend:

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

    r76825 r76826  
    26292629}
    26302630
    2631 QUuid VBoxGlobal::createVisoMediumWithVisoCreator(QWidget *pParent, const QString &strFolder)
     2631QUuid VBoxGlobal::createVisoMediumWithVisoCreator(QWidget *pParent, const QString &strMachineName, const QString &strFolder)
    26322632{
    26332633
    26342634    QWidget *pDialogParent = windowManager().realParentWindow(pParent);
    2635     QPointer<UIVisoCreator> pVisoCreator = new UIVisoCreator(pDialogParent);
     2635    QPointer<UIVisoCreator> pVisoCreator = new UIVisoCreator(pDialogParent, strMachineName);
    26362636
    26372637    if (!pVisoCreator)
     
    26392639    windowManager().registerNewParent(pVisoCreator, pDialogParent);
    26402640
    2641     if (pVisoCreator->execute(true, false))
     2641    if (pVisoCreator->exec(false /* not application modal */))
    26422642    {
    26432643        QStringList files = pVisoCreator->entryList();
     
    29572957                    uMediumID = openMediumWithFileOpenDialog(target.mediumType, windowManager().mainWindowShown(), strMachineFolder);
    29582958                else if(target.type == UIMediumTarget::UIMediumTargetType_CreateAdHocVISO)
    2959                     uMediumID = createVisoMediumWithVisoCreator(windowManager().mainWindowShown(), strMachineFolder);
     2959                    uMediumID = createVisoMediumWithVisoCreator(windowManager().mainWindowShown(), comConstMachine.GetName(), strMachineFolder);
    29602960
    29612961                else if(target.type == UIMediumTarget::UIMediumTargetType_CreateFloppyDisk)
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r76825 r76826  
    505505        /** Creates a VISO by using the VISO creator dialog.
    506506          * @param  pParent    Brings the dialog parent.
     507          * @param  strMachineName    Passes the name of the machine,
    507508          * @param  strFolder  Brings the folder to save the VISO file. */
    508         QUuid createVisoMediumWithVisoCreator(QWidget *pParent, const QString &strFolder);
     509        QUuid createVisoMediumWithVisoCreator(QWidget *pParent, const QString &strMachineName, const QString &strFolder);
    509510
    510511        /** Creates and shows a dialog thru which user can create a new floppy disk a VISO using the file-open dialog.
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoBrowserBase.cpp

    r76762 r76826  
    2929#include "UIToolBar.h"
    3030
    31 UIVisoBrowserBase::UIVisoBrowserBase(QWidget *pParent)
    32     : QWidget(pParent)
     31UIVisoBrowserBase::UIVisoBrowserBase(QWidget *pParent /* = 0 */, QMenu *pMenu /*= 0*/)
     32    : QIWithRetranslateUI<QWidget>(pParent)
    3333    , m_pTreeView(0)
    3434    , m_pTitleLabel(0)
     
    3636    , m_pRightContainerLayout(0)
    3737    , m_pVerticalToolBar(0)
     38    , m_pMenu(pMenu)
    3839    , m_pMainLayout(0)
    3940    , m_pHorizontalSplitter(0)
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoBrowserBase.h

    r76762 r76826  
    2626#include <QWidget>
    2727
     28/* GUI includes: */
     29#include "QIWithRetranslateUI.h"
     30
    2831/* Forward declarations: */
    2932class QItemSelection;
    3033class QGridLayout;
    3134class QLabel;
     35class QMenu;
    3236class QSplitter;
    3337class QVBoxLayout;
     
    3640class UIToolBar;
    3741
    38 class UIVisoBrowserBase : public QWidget
     42class UIVisoBrowserBase : public QIWithRetranslateUI<QWidget>
    3943{
    4044    Q_OBJECT;
    4145
    4246public:
    43 
    44     UIVisoBrowserBase(QWidget *pParent = 0);
     47    /** @p pMenu is the pointer to the menu related to this browser widget.
     48     *  any member actions will be added to this menu. */
     49    UIVisoBrowserBase(QWidget *pParent = 0, QMenu *pMenu = 0);
    4550    ~UIVisoBrowserBase();
    4651    virtual void showHideHiddenObjects(bool bShow) = 0;
     
    6671    QGridLayout        *m_pRightContainerLayout;
    6772    UIToolBar          *m_pVerticalToolBar;
    68 
     73    QMenu              *m_pMenu;
    6974private:
    7075    QGridLayout    *m_pMainLayout;
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.cpp

    r76768 r76826  
    2727#include <QLabel>
    2828#include <QListView>
     29#include <QMenu>
    2930#include <QMimeData>
    3031#include <QSplitter>
     
    154155*********************************************************************************************************************************/
    155156
    156 UIVisoContentBrowser::UIVisoContentBrowser(QWidget *pParent)
    157     : QIWithRetranslateUI<UIVisoBrowserBase>(pParent)
     157UIVisoContentBrowser::UIVisoContentBrowser(QWidget *pParent, QMenu *pMenu /* = 0 */)
     158    : UIVisoBrowserBase(pParent, pMenu)
    158159    , m_pTableView(0)
    159160    , m_pModel(0)
     
    248249        m_pTitleLabel->setText(QApplication::translate("UIVisoCreator", "VISO content"));
    249250    if (m_pRemoveAction)
     251    {
    250252        m_pRemoveAction->setToolTip(QApplication::translate("UIVisoCreator", "Remove selected file objects from VISO"));
     253        m_pRemoveAction->setText(QApplication::translate("UIVisoCreator", "Remove"));
     254    }
    251255    if (m_pNewDirectoryAction)
     256    {
    252257        m_pNewDirectoryAction->setToolTip(QApplication::translate("UIVisoCreator", "Create a new directory under the current location"));
     258        m_pNewDirectoryAction->setText(QApplication::translate("UIVisoCreator", "New Directory"));
     259    }
    253260    if (m_pResetAction)
     261    {
    254262        m_pResetAction->setToolTip(QApplication::translate("UIVisoCreator", "Reset ISO content."));
     263        m_pResetAction->setText(QApplication::translate("UIVisoCreator", "Reset"));
     264    }
    255265    if (m_pRenameAction)
    256266        m_pRenameAction->setToolTip(QApplication::translate("UIVisoCreator", "Rename the selected object"));
     
    451461                                                     ":/file_manager_delete_disabled_24px.png", ":/file_manager_delete_disabled_16px.png"));
    452462        m_pRemoveAction->setEnabled(false);
     463        if (m_pMenu)
     464            m_pMenu->addAction(m_pRemoveAction);
    453465    }
    454466
     
    460472                                                           ":/file_manager_new_directory_disabled_24px.png", ":/file_manager_new_directory_disabled_16px.png"));
    461473        m_pNewDirectoryAction->setEnabled(true);
     474        if (m_pMenu)
     475            m_pMenu->addAction(m_pNewDirectoryAction);
    462476    }
    463477
     
    479493        m_pResetAction->setIcon(UIIconPool::iconSet(":/cd_remove_16px.png", ":/cd_remove_disabled_16px.png"));
    480494        m_pResetAction->setEnabled(true);
     495        if (m_pMenu)
     496            m_pMenu->addAction(m_pResetAction);
    481497    }
    482498
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.h

    r76768 r76826  
    3030
    3131/* GUI includes: */
    32 #include "QIWithRetranslateUI.h"
    3332#include "UIVisoBrowserBase.h"
    3433
     
    4544class UIVisoContentTableView;
    4645
    47 class SHARED_LIBRARY_STUFF UIVisoContentBrowser : public QIWithRetranslateUI<UIVisoBrowserBase>
     46class SHARED_LIBRARY_STUFF UIVisoContentBrowser : public UIVisoBrowserBase
    4847{
    4948    Q_OBJECT;
     
    5150public:
    5251
    53     UIVisoContentBrowser(QWidget *pParent = 0);
     52    UIVisoContentBrowser(QWidget *pParent = 0, QMenu *pMenu = 0);
    5453    ~UIVisoContentBrowser();
    5554    /** Adds file objests from the host file system. @p pathList consists of list of paths to there objects. */
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp

    r76768 r76826  
    1717
    1818/* Qt includes: */
    19 #include <QVBoxLayout>
     19#include <QMenuBar>
    2020#include <QPushButton>
    2121#include <QSplitter>
    2222#include <QStyle>
     23#include <QVBoxLayout>
    2324
    2425/* GUI includes: */
     
    3334
    3435
    35 UIVisoCreator::UIVisoCreator(QWidget *pParent /* =0 */)
    36     : QIWithRetranslateUI<QIDialog>(pParent)
     36UIVisoCreator::UIVisoCreator(QWidget *pParent /* =0 */, const QString& strMachineName /* = QString() */)
     37    : QIWithRetranslateUI<QIMainDialog>(pParent)
    3738    , m_pMainLayout(0)
    3839    , m_pVerticalSplitter(0)
     
    4344    , m_pActionConfiguration(0)
    4445    , m_pActionOptions(0)
    45 {
    46 
     46    , m_pCentralWidget(0)
     47    , m_pMainMenu(0)
     48    , m_pHostBrowserMenu(0)
     49    , m_pVisoContentBrowserMenu(0)
     50    , m_strMachineName(strMachineName)
     51{
    4752    prepareActions();
    4853    prepareObjects();
     
    7378void UIVisoCreator::retranslateUi()
    7479{
     80    setWindowTitle(QString("%1 - %2").arg(m_strMachineName).arg(tr("VISO Creator")));
    7581    if (m_pActionConfiguration)
    7682    {
     
    8591        m_pActionOptions->setStatusTip(tr("Manage Dialog Options"));
    8692    }
     93    if (m_pMainMenu)
     94        m_pMainMenu->setTitle(tr("Main Menu"));
     95    if (m_pHostBrowserMenu)
     96        m_pHostBrowserMenu->setTitle(tr("Host Browser"));
     97    if (m_pVisoContentBrowserMenu)
     98        m_pVisoContentBrowserMenu->setTitle(tr("VISO Browser"));
    8799}
    88100
     
    123135void UIVisoCreator::prepareObjects()
    124136{
     137    m_pCentralWidget = new QWidget;
     138    if (!m_pCentralWidget)
     139        return;
     140    setCentralWidget(m_pCentralWidget);
     141
    125142    m_pMainLayout = new QVBoxLayout;
     143        m_pCentralWidget->setLayout(m_pMainLayout);
    126144    if (!m_pMainLayout)
    127145        return;
    128146
     147    QMenuBar *pMenuBar = new QMenuBar;
     148
     149    setMenuBar(pMenuBar);
     150    if (pMenuBar)
     151    {
     152        m_pMainMenu = pMenuBar->addMenu(tr("Main Menu"));
     153        if (m_pActionConfiguration)
     154            m_pMainMenu->addAction(m_pActionConfiguration);
     155        if (m_pActionOptions)
     156            m_pMainMenu->addAction(m_pActionOptions);
     157        m_pHostBrowserMenu = m_pMainMenu->addMenu(tr("Host Browser"));
     158        m_pVisoContentBrowserMenu = m_pMainMenu->addMenu(tr("VISO Browser"));
     159    }
    129160    m_pToolBar = new UIToolBar(parentWidget());
    130161    if (m_pToolBar)
     
    151182    m_pVerticalSplitter->setHandleWidth(1);
    152183
    153     m_pHostBrowser = new UIVisoHostBrowser;
     184    m_pHostBrowser = new UIVisoHostBrowser(0 /* parent */, m_pHostBrowserMenu);
    154185    if (m_pHostBrowser)
    155186    {
     
    158189                this, &UIVisoCreator::sltHandleAddObjectsToViso);
    159190    }
    160     m_pVisoBrowser = new UIVisoContentBrowser;
     191    m_pVisoBrowser = new UIVisoContentBrowser(0 /* parent */, m_pVisoContentBrowserMenu);
    161192    if (m_pVisoBrowser)
    162193    {
     
    172203    }
    173204    retranslateUi();
    174     setLayout(m_pMainLayout);
    175205}
    176206
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.h

    r76768 r76826  
    3131
    3232/* GUI includes: */
    33 #include "QIDialog.h"
     33#include "QIMainDialog.h"
    3434#include "QIWithRetranslateUI.h"
    3535#include "UIVisoCreatorDefs.h"
     
    3737/* Forward declarations: */
    3838class QItemSelection;
     39class QMenu;
     40class QSplitter;
    3941class QVBoxLayout;
    40 class QSplitter;
    4142class QIDialogButtonBox;
    4243class UIActionPool;
     
    4546class UIVisoContentBrowser;
    4647
    47 class SHARED_LIBRARY_STUFF UIVisoCreator : public QIWithRetranslateUI<QIDialog>
     48class SHARED_LIBRARY_STUFF UIVisoCreator : public QIWithRetranslateUI<QIMainDialog>
    4849{
    4950    Q_OBJECT;
     
    5152public:
    5253
    53     UIVisoCreator(QWidget *pParent = 0);
     54    UIVisoCreator(QWidget *pParent = 0, const QString& strMachineName = QString());
    5455    ~UIVisoCreator();
    5556    QStringList entryList() const;
     
    9394    VisoOptions           m_visoOptions;
    9495    BrowserOptions        m_browserOptions;
    95 
     96    QWidget              *m_pCentralWidget;
     97    QMenu                *m_pMainMenu;
     98    QMenu                *m_pHostBrowserMenu;
     99    QMenu                *m_pVisoContentBrowserMenu;
     100    QString               m_strMachineName;
    96101};
    97102
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoHostBrowser.cpp

    r76762 r76826  
    2424#include <QLabel>
    2525#include <QListView>
     26#include <QMenu>
    2627#include <QMimeData>
    2728#include <QTableView>
     
    115116*********************************************************************************************************************************/
    116117
    117 UIVisoHostBrowser::UIVisoHostBrowser(QWidget *pParent)
    118     : QIWithRetranslateUI<UIVisoBrowserBase>(pParent)
     118UIVisoHostBrowser::UIVisoHostBrowser(QWidget *pParent /* = 0 */, QMenu *pMenu /* = 0 */)
     119    : UIVisoBrowserBase(pParent, pMenu)
    119120    , m_pTreeModel(0)
    120121    , m_pTableModel(0)
     
    135136        m_pTitleLabel->setText(QApplication::translate("UIVisoCreator", "Host file system"));
    136137    if (m_pAddAction)
     138    {
    137139        m_pAddAction->setToolTip(QApplication::translate("UIVisoCreator", "Add selected file objects to ISO"));
     140        m_pAddAction->setText(QApplication::translate("UIVisoCreator", "Add"));
     141    }
    138142}
    139143
     
    202206                                                      ":/file_manager_copy_to_guest_disabled_24px.png",
    203207                                                      ":/file_manager_copy_to_guest_disabled_16px.png"));
    204 
     208        m_pAddAction->setText(QApplication::translate("UIVisoCreator", "Add"));
    205209        m_pAddAction->setEnabled(false);
     210        if (m_pMenu)
     211            m_pMenu->addAction(m_pAddAction);
    206212    }
    207213
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoHostBrowser.h

    r76762 r76826  
    2727
    2828/* GUI includes: */
    29 #include "QIWithRetranslateUI.h"
    3029#include "UIVisoBrowserBase.h"
    3130
     
    3433class UIVisoHostBrowserModel;
    3534
    36 /** A QWidget extension. */
    37 class SHARED_LIBRARY_STUFF UIVisoHostBrowser : public QIWithRetranslateUI<UIVisoBrowserBase>
     35class SHARED_LIBRARY_STUFF UIVisoHostBrowser : public UIVisoBrowserBase
    3836{
    3937    Q_OBJECT;
     
    4543public:
    4644
    47     UIVisoHostBrowser(QWidget *pParent = 0);
     45    UIVisoHostBrowser(QWidget *pParent = 0, QMenu *pMenu = 0);
    4846    ~UIVisoHostBrowser();
    4947    virtual void showHideHiddenObjects(bool bShow) /* override */;
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