VirtualBox

Changeset 53321 in vbox for trunk/src


Ignore:
Timestamp:
Nov 13, 2014 12:11:01 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: 7599: Add menu-bar / status-bar options into VM Settings dialog: Display page: Machine Window tab.

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

Legend:

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

    r53295 r53321  
    491491        src/runtime/UIActionPoolRuntime.cpp \
    492492        src/runtime/UIIndicatorsPool.cpp \
    493         src/runtime/UIMenuBarEditorWindow.cpp \
    494493        src/runtime/UIStatusBarEditorWindow.cpp \
    495494        src/selector/UIActionPoolSelector.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.cpp

    r53320 r53321  
    2727# include <QPainter>
    2828# include <QMenu>
    29 # include <QMap>
    3029
    3130/* GUI includes: */
     
    3736# include "UIIconPool.h"
    3837# include "UIToolBar.h"
    39 # include "QIWithRetranslateUI.h"
    4038# include "QIToolButton.h"
    4139# include "VBoxGlobal.h"
     
    4442
    4543
    46 
    47 /** QWidget reimplementation
    48   * used as menu-bar editor widget. */
    49 class UIMenuBarEditorWidget : public QIWithRetranslateUI2<QWidget>
    50 {
    51     Q_OBJECT;
    52 
    53 signals:
    54 
    55     /** Notifies about Cancel button click. */
    56     void sigCancelClicked();
    57 
    58 public:
    59 
    60     /** Constructor.
    61       * @param pParent      is passed to QWidget constructor,
    62       * @param strMachineID brings the machine ID to be used by the editor,
    63       * @param pActionPool  brings the action-pool to be used by the editor. */
    64     UIMenuBarEditorWidget(QWidget *pParent,
    65                           const QString &strMachineID,
    66                           UIActionPool *pActionPool);
    67 
    68     /** Returns the machine ID instance. */
    69     const QString& machineID() const { return m_strMachineID; }
    70 
    71     /** Returns the action-pool reference. */
    72     const UIActionPool* actionPool() const { return m_pActionPool; }
    73 
    74 private slots:
    75 
    76     /** Handles configuration change. */
    77     void sltHandleConfigurationChange(const QString &strMachineID);
    78 
    79     /** Handles menu-bar menu click. */
    80     void sltHandleMenuBarMenuClick();
    81 
    82 private:
    83 
    84     /** Prepare routine. */
    85     void prepare();
    86 
    87 #ifdef Q_WS_MAC
    88     /** Prepare named menu routine. */
    89     QMenu* prepareNamedMenu(const QString &strName);
    90 #endif /* Q_WS_MAC */
    91     /** Prepare copied menu routine. */
    92     QMenu* prepareCopiedMenu(const UIAction *pAction);
    93 #if 0
    94     /** Prepare copied sub-menu routine. */
    95     QMenu* prepareCopiedSubMenu(QMenu *pMenu, const UIAction *pAction);
    96 #endif
    97     /** Prepare named action routine. */
    98     QAction* prepareNamedAction(QMenu *pMenu, const QString &strName,
    99                                 int iExtraDataID, const QString &strExtraDataID);
    100     /** Prepare copied action routine. */
    101     QAction* prepareCopiedAction(QMenu *pMenu, const UIAction *pAction);
    102 
    103     /** Prepare menus routine. */
    104     void prepareMenus();
    105 #ifdef Q_WS_MAC
    106     /** Mac OS X: Prepare 'Application' menu routine. */
    107     void prepareMenuApplication();
    108 #endif /* Q_WS_MAC */
    109     /** Prepare 'Machine' menu routine. */
    110     void prepareMenuMachine();
    111     /** Prepare 'View' menu routine. */
    112     void prepareMenuView();
    113     /** Prepare 'Input' menu routine. */
    114     void prepareMenuInput();
    115     /** Prepare 'Devices' menu routine. */
    116     void prepareMenuDevices();
    117 #ifdef VBOX_WITH_DEBUGGER_GUI
    118     /** Prepare 'Debug' menu routine. */
    119     void prepareMenuDebug();
    120 #endif /* VBOX_WITH_DEBUGGER_GUI */
    121     /** Prepare 'Help' menu routine. */
    122     void prepareMenuHelp();
    123 
    124     /** Updates menus routine. */
    125     void updateMenus();
    126 #ifdef Q_WS_MAC
    127     /** Mac OS X: Updates 'Application' menu routine. */
    128     void updateMenuApplication();
    129 #endif /* Q_WS_MAC */
    130     /** Updates 'Machine' menu routine. */
    131     void updateMenuMachine();
    132     /** Updates 'View' menu routine. */
    133     void updateMenuView();
    134     /** Updates 'Input' menu routine. */
    135     void updateMenuInput();
    136     /** Updates 'Devices' menu routine. */
    137     void updateMenuDevices();
    138 #ifdef VBOX_WITH_DEBUGGER_GUI
    139     /** Updates 'Debug' menu routine. */
    140     void updateMenuDebug();
    141 #endif /* VBOX_WITH_DEBUGGER_GUI */
    142     /** Updates 'Help' menu routine. */
    143     void updateMenuHelp();
    144 
    145     /** Retranslation routine. */
    146     virtual void retranslateUi();
    147 
    148     /** Paint event handler. */
    149     virtual void paintEvent(QPaintEvent *pEvent);
    150 
    151     /** @name General
    152       * @{ */
    153         /** Holds the machine ID instance. */
    154         QString m_strMachineID;
    155         /** Holds the action-pool reference. */
    156         const UIActionPool *m_pActionPool;
    157     /** @} */
    158 
    159     /** @name Contents
    160       * @{ */
    161         /** Holds the main-layout instance. */
    162         QHBoxLayout *m_pMainLayout;
    163         /** Holds the tool-bar instance. */
    164         UIToolBar *m_pToolBar;
    165         /** Holds the close-button instance. */
    166         QIToolButton *m_pButtonClose;
    167         /** Holds tool-bar action references. */
    168         QMap<QString, QAction*> m_actions;
    169     /** @} */
    170 };
    171 
    17244UIMenuBarEditorWidget::UIMenuBarEditorWidget(QWidget *pParent,
    173                                              const QString &strMachineID,
    174                                              UIActionPool *pActionPool)
     45                                             bool fStartedFromVMSettings /* = true */,
     46                                             const QString &strMachineID /* = QString() */,
     47                                             UIActionPool *pActionPool /* = 0 */)
    17548    : QIWithRetranslateUI2<QWidget>(pParent)
     49    , m_fPrepared(false)
     50    , m_fStartedFromVMSettings(fStartedFromVMSettings)
    17651    , m_strMachineID(strMachineID)
    17752    , m_pActionPool(pActionPool)
     
    18055    , m_pButtonClose(0)
    18156{
     57    /* Prepare: */
     58    prepare();
     59}
     60
     61void UIMenuBarEditorWidget::setMachineID(const QString &strMachineID)
     62{
     63    /* Remember new machine ID: */
     64    m_strMachineID = strMachineID;
     65    /* Prepare: */
     66    prepare();
     67}
     68
     69void UIMenuBarEditorWidget::setActionPool(UIActionPool *pActionPool)
     70{
     71    /* Remember new action-pool: */
     72    m_pActionPool = pActionPool;
    18273    /* Prepare: */
    18374    prepare();
     
    317208void UIMenuBarEditorWidget::prepare()
    318209{
     210    /* Do nothing if already prepared: */
     211    if (m_fPrepared)
     212        return;
     213
     214    /* Do not prepare if machine ID or action-pool is not set: */
     215    if (m_strMachineID.isEmpty() || !m_pActionPool)
     216        return;
     217
    319218    /* Create main-layout: */
    320219    m_pMainLayout = new QHBoxLayout(this);
     
    345244        /* Insert stretch: */
    346245        m_pMainLayout->addStretch();
    347         /* Create close-button: */
    348         m_pButtonClose = new QIToolButton;
    349         AssertPtrReturnVoid(m_pButtonClose);
    350         {
    351             /* Configure close-button: */
    352             m_pButtonClose->setFocusPolicy(Qt::StrongFocus);
    353             m_pButtonClose->setMinimumSize(QSize(1, 1));
    354             m_pButtonClose->setShortcut(Qt::Key_Escape);
    355             m_pButtonClose->setIcon(UIIconPool::iconSet(":/ok_16px.png"));
    356             connect(m_pButtonClose, SIGNAL(clicked(bool)), this, SIGNAL(sigCancelClicked()));
    357             /* Add close-button into main-layout: */
    358             m_pMainLayout->addWidget(m_pButtonClose);
    359         }
    360     }
     246        /* Create close-button if necessary: */
     247        if (!m_fStartedFromVMSettings)
     248        {
     249            m_pButtonClose = new QIToolButton;
     250            AssertPtrReturnVoid(m_pButtonClose);
     251            {
     252                /* Configure close-button: */
     253                m_pButtonClose->setFocusPolicy(Qt::StrongFocus);
     254                m_pButtonClose->setMinimumSize(QSize(1, 1));
     255                m_pButtonClose->setShortcut(Qt::Key_Escape);
     256                m_pButtonClose->setIcon(UIIconPool::iconSet(":/ok_16px.png"));
     257                connect(m_pButtonClose, SIGNAL(clicked(bool)), this, SIGNAL(sigCancelClicked()));
     258                /* Add close-button into main-layout: */
     259                m_pMainLayout->addWidget(m_pButtonClose);
     260            }
     261        }
     262    }
     263
     264    /* Mark as prepared: */
     265    m_fPrepared = true;
    361266
    362267    /* Translate contents: */
     
    909814void UIMenuBarEditorWidget::retranslateUi()
    910815{
    911     /* Translate close-button: */
    912     m_pButtonClose->setToolTip(tr("Close"));
     816    /* Translate close-button if necessary: */
     817    if (!m_fStartedFromVMSettings && m_pButtonClose)
     818        m_pButtonClose->setToolTip(tr("Close"));
    913819}
    914820
     
    974880    painter.drawLine(QLine(QPoint(5 + 1, height() - 1 - 5 - 1),               QPoint(width() - 1 - 5 - 1, height() - 1 - 5 - 1)));
    975881    painter.drawLine(QLine(QPoint(width() - 1 - 5 - 1, height() - 1 - 5 - 1), QPoint(width() - 1 - 5 - 1, 0)));
     882    if (m_fStartedFromVMSettings)
     883        painter.drawLine(QLine(QPoint(width() - 1 - 5 - 1, 0), QPoint(5 + 1, 0)));
    976884    painter.restore();
    977885#endif /* Q_WS_WIN || Q_WS_X11 */
     
    981889UIMenuBarEditorWindow::UIMenuBarEditorWindow(UIMachineWindow *pParent, UIActionPool *pActionPool)
    982890#ifndef Q_WS_MAC
    983     : UISlidingToolBar(pParent, pParent->menuBar(), new UIMenuBarEditorWidget(0, vboxGlobal().managedVMUuid(), pActionPool), UISlidingToolBar::Position_Top)
     891    : UISlidingToolBar(pParent, pParent->menuBar(), new UIMenuBarEditorWidget(0, false, vboxGlobal().managedVMUuid(), pActionPool), UISlidingToolBar::Position_Top)
    984892#else /* Q_WS_MAC */
    985     : UISlidingToolBar(pParent, 0, new UIMenuBarEditorWidget(0, vboxGlobal().managedVMUuid(), pActionPool), UISlidingToolBar::Position_Top)
     893    : UISlidingToolBar(pParent, 0, new UIMenuBarEditorWidget(0, false, vboxGlobal().managedVMUuid(), pActionPool), UISlidingToolBar::Position_Top)
    986894#endif /* Q_WS_MAC */
    987895{
    988896}
    989897
    990 #include "UIMenuBarEditorWindow.moc"
    991 
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.h

    r52478 r53321  
    1919
    2020/* Qt includes: */
     21#include <QMap>
     22
     23/* GUI includes: */
    2124#include "UISlidingToolBar.h"
     25#include "QIWithRetranslateUI.h"
    2226
    2327/* Forward declarations: */
    2428class UIMachineWindow;
    2529class UIActionPool;
     30class UIToolBar;
     31class UIAction;
     32class QIToolButton;
     33class QHBoxLayout;
     34class QAction;
     35class QMenu;
    2636
    2737/** UISlidingToolBar wrapper
     
    3848};
    3949
     50/** QWidget reimplementation
     51  * used as menu-bar editor widget. */
     52class UIMenuBarEditorWidget : public QIWithRetranslateUI2<QWidget>
     53{
     54    Q_OBJECT;
     55
     56signals:
     57
     58    /** Notifies about Cancel button click. */
     59    void sigCancelClicked();
     60
     61public:
     62
     63    /** Constructor.
     64      * @param pParent                is passed to QWidget constructor,
     65      * @param fStartedFromVMSettings determines whether 'this' is a part of VM settings,
     66      * @param strMachineID           brings the machine ID to be used by the editor,
     67      * @param pActionPool            brings the action-pool to be used by the editor. */
     68    UIMenuBarEditorWidget(QWidget *pParent,
     69                          bool fStartedFromVMSettings = true,
     70                          const QString &strMachineID = QString(),
     71                          UIActionPool *pActionPool = 0);
     72
     73    /** Returns the machine ID instance. */
     74    const QString& machineID() const { return m_strMachineID; }
     75    /** Defines the @a strMachineID instance. */
     76    void setMachineID(const QString &strMachineID);
     77
     78    /** Returns the action-pool reference. */
     79    const UIActionPool* actionPool() const { return m_pActionPool; }
     80    /** Defines the @a pActionPool reference. */
     81    void setActionPool(UIActionPool *pActionPool);
     82
     83private slots:
     84
     85    /** Handles configuration change. */
     86    void sltHandleConfigurationChange(const QString &strMachineID);
     87
     88    /** Handles menu-bar menu click. */
     89    void sltHandleMenuBarMenuClick();
     90
     91private:
     92
     93    /** Prepare routine. */
     94    void prepare();
     95
     96#ifdef Q_WS_MAC
     97    /** Prepare named menu routine. */
     98    QMenu* prepareNamedMenu(const QString &strName);
     99#endif /* Q_WS_MAC */
     100    /** Prepare copied menu routine. */
     101    QMenu* prepareCopiedMenu(const UIAction *pAction);
     102#if 0
     103    /** Prepare copied sub-menu routine. */
     104    QMenu* prepareCopiedSubMenu(QMenu *pMenu, const UIAction *pAction);
     105#endif
     106    /** Prepare named action routine. */
     107    QAction* prepareNamedAction(QMenu *pMenu, const QString &strName,
     108                                int iExtraDataID, const QString &strExtraDataID);
     109    /** Prepare copied action routine. */
     110    QAction* prepareCopiedAction(QMenu *pMenu, const UIAction *pAction);
     111
     112    /** Prepare menus routine. */
     113    void prepareMenus();
     114#ifdef Q_WS_MAC
     115    /** Mac OS X: Prepare 'Application' menu routine. */
     116    void prepareMenuApplication();
     117#endif /* Q_WS_MAC */
     118    /** Prepare 'Machine' menu routine. */
     119    void prepareMenuMachine();
     120    /** Prepare 'View' menu routine. */
     121    void prepareMenuView();
     122    /** Prepare 'Input' menu routine. */
     123    void prepareMenuInput();
     124    /** Prepare 'Devices' menu routine. */
     125    void prepareMenuDevices();
     126#ifdef VBOX_WITH_DEBUGGER_GUI
     127    /** Prepare 'Debug' menu routine. */
     128    void prepareMenuDebug();
     129#endif /* VBOX_WITH_DEBUGGER_GUI */
     130    /** Prepare 'Help' menu routine. */
     131    void prepareMenuHelp();
     132
     133    /** Updates menus routine. */
     134    void updateMenus();
     135#ifdef Q_WS_MAC
     136    /** Mac OS X: Updates 'Application' menu routine. */
     137    void updateMenuApplication();
     138#endif /* Q_WS_MAC */
     139    /** Updates 'Machine' menu routine. */
     140    void updateMenuMachine();
     141    /** Updates 'View' menu routine. */
     142    void updateMenuView();
     143    /** Updates 'Input' menu routine. */
     144    void updateMenuInput();
     145    /** Updates 'Devices' menu routine. */
     146    void updateMenuDevices();
     147#ifdef VBOX_WITH_DEBUGGER_GUI
     148    /** Updates 'Debug' menu routine. */
     149    void updateMenuDebug();
     150#endif /* VBOX_WITH_DEBUGGER_GUI */
     151    /** Updates 'Help' menu routine. */
     152    void updateMenuHelp();
     153
     154    /** Retranslation routine. */
     155    virtual void retranslateUi();
     156
     157    /** Paint event handler. */
     158    virtual void paintEvent(QPaintEvent *pEvent);
     159
     160    /** @name General
     161      * @{ */
     162        /** Holds whether 'this' is prepared. */
     163        bool m_fPrepared;
     164        /** Holds whether 'this' is a part of VM settings. */
     165        bool m_fStartedFromVMSettings;
     166        /** Holds the machine ID instance. */
     167        QString m_strMachineID;
     168        /** Holds the action-pool reference. */
     169        const UIActionPool *m_pActionPool;
     170    /** @} */
     171
     172    /** @name Contents
     173      * @{ */
     174        /** Holds the main-layout instance. */
     175        QHBoxLayout *m_pMainLayout;
     176        /** Holds the tool-bar instance. */
     177        UIToolBar *m_pToolBar;
     178        /** Holds the close-button instance. */
     179        QIToolButton *m_pButtonClose;
     180        /** Holds tool-bar action references. */
     181        QMap<QString, QAction*> m_actions;
     182    /** @} */
     183};
     184
    40185#endif /* !___UIMenuBarEditorWindow_h___ */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIStatusBarEditorWindow.cpp

    r53320 r53321  
    3030# include <QPixmap>
    3131# include <QDrag>
    32 # include <QList>
    33 # include <QMap>
    3432
    3533/* GUI includes: */
     
    3937# include "UIConverter.h"
    4038# include "UIIconPool.h"
    41 # include "QIWithRetranslateUI.h"
    4239# include "QIToolButton.h"
    4340# include "VBoxGlobal.h"
     
    111108    /** Holds the last mouse-press position. */
    112109    QPoint m_mousePressPosition;
    113 };
    114 
    115 
    116 /** QWidget reimplementation
    117   * used as status-bar editor widget. */
    118 class UIStatusBarEditorWidget : public QIWithRetranslateUI2<QWidget>
    119 {
    120     Q_OBJECT;
    121 
    122 signals:
    123 
    124     /** Notifies about Cancel button click. */
    125     void sigCancelClicked();
    126 
    127 public:
    128 
    129     /** Constructor.
    130       * @param pParent      is passed to QWidget constructor,
    131       * @param strMachineID brings the machine ID to be used by the editor. */
    132     UIStatusBarEditorWidget(QWidget *pParent,
    133                             const QString &strMachineID);
    134 
    135     /** Returns the machine ID instance. */
    136     const QString& machineID() const { return m_strMachineID; }
    137 
    138 private slots:
    139 
    140     /** Handles configuration change. */
    141     void sltHandleConfigurationChange(const QString &strMachineID);
    142 
    143     /** Handles button click. */
    144     void sltHandleButtonClick();
    145 
    146     /** Handles drag object destroy. */
    147     void sltHandleDragObjectDestroy();
    148 
    149 private:
    150 
    151     /** Prepare routine. */
    152     void prepare();
    153     /** Prepare status buttons routine. */
    154     void prepareStatusButtons();
    155     /** Prepare status button routine. */
    156     void prepareStatusButton(IndicatorType type);
    157 
    158     /** Updates status buttons. */
    159     void updateStatusButtons();
    160 
    161     /** Retranslation routine. */
    162     virtual void retranslateUi();
    163 
    164     /** Paint event handler. */
    165     virtual void paintEvent(QPaintEvent *pEvent);
    166 
    167     /** Drag-enter event handler. */
    168     virtual void dragEnterEvent(QDragEnterEvent *pEvent);
    169     /** Drag-move event handler. */
    170     virtual void dragMoveEvent(QDragMoveEvent *pEvent);
    171     /** Drag-leave event handler. */
    172     virtual void dragLeaveEvent(QDragLeaveEvent *pEvent);
    173     /** Drop event handler. */
    174     virtual void dropEvent(QDropEvent *pEvent);
    175 
    176     /** Returns position for passed @a type. */
    177     int position(IndicatorType type) const;
    178 
    179     /** @name General
    180       * @{ */
    181         /** Holds the machine ID instance. */
    182         QString m_strMachineID;
    183     /** @} */
    184 
    185     /** @name Contents
    186       * @{ */
    187         /** Holds the main-layout instance. */
    188         QHBoxLayout *m_pMainLayout;
    189         /** Holds the button-layout instance. */
    190         QHBoxLayout *m_pButtonLayout;
    191         /** Holds the close-button instance. */
    192         QIToolButton *m_pButtonClose;
    193         /** Holds status-bar buttons. */
    194         QMap<IndicatorType, UIStatusBarEditorButton*> m_buttons;
    195     /** @} */
    196 
    197     /** @name Contents: Restrictions
    198       * @{ */
    199         /** Holds the cached status-bar button restrictions. */
    200         QList<IndicatorType> m_restrictions;
    201     /** @} */
    202 
    203     /** @name Contents: Order
    204       * @{ */
    205         /** Holds the cached status-bar button order. */
    206         QList<IndicatorType> m_order;
    207         /** Holds the token-button to drop dragged-button nearby. */
    208         UIStatusBarEditorButton *m_pButtonDropToken;
    209         /** Holds whether dragged-button should be dropped <b>after</b> the token-button. */
    210         bool m_fDropAfterTokenButton;
    211     /** @} */
    212110};
    213111
     
    358256
    359257UIStatusBarEditorWidget::UIStatusBarEditorWidget(QWidget *pParent,
    360                                                  const QString &strMachineID)
     258                                                 bool fStartedFromVMSettings /* = true */,
     259                                                 const QString &strMachineID /* = QString() */)
    361260    : QIWithRetranslateUI2<QWidget>(pParent)
     261    , m_fPrepared(false)
     262    , m_fStartedFromVMSettings(fStartedFromVMSettings)
    362263    , m_strMachineID(strMachineID)
    363264    , m_pMainLayout(0), m_pButtonLayout(0)
     
    370271}
    371272
     273void UIStatusBarEditorWidget::setMachineID(const QString &strMachineID)
     274{
     275    /* Remember new machine ID: */
     276    m_strMachineID = strMachineID;
     277    /* Prepare: */
     278    prepare();
     279}
     280
    372281void UIStatusBarEditorWidget::sltHandleConfigurationChange(const QString &strMachineID)
    373282{
     
    414323void UIStatusBarEditorWidget::prepare()
    415324{
     325    /* Do nothing if already prepared: */
     326    if (m_fPrepared)
     327        return;
     328
     329    /* Do not prepare if machine ID is not set: */
     330    if (m_strMachineID.isEmpty())
     331        return;
     332
    416333    /* Track D&D events: */
    417334    setAcceptDrops(true);
     
    434351#endif /* !Q_WS_MAC */
    435352        m_pMainLayout->setSpacing(0);
    436         /* Create close-button: */
    437         m_pButtonClose = new QIToolButton;
    438         AssertPtrReturnVoid(m_pButtonClose);
     353        /* Create close-button if necessary: */
     354        if (!m_fStartedFromVMSettings)
    439355        {
    440             /* Configure close-button: */
    441             m_pButtonClose->setFocusPolicy(Qt::StrongFocus);
    442             m_pButtonClose->setMinimumSize(QSize(1, 1));
    443             m_pButtonClose->setShortcut(Qt::Key_Escape);
    444             m_pButtonClose->setIcon(UIIconPool::iconSet(":/ok_16px.png"));
    445             connect(m_pButtonClose, SIGNAL(clicked(bool)), this, SIGNAL(sigCancelClicked()));
    446             /* Add close-button into main-layout: */
    447             m_pMainLayout->addWidget(m_pButtonClose);
     356            m_pButtonClose = new QIToolButton;
     357            AssertPtrReturnVoid(m_pButtonClose);
     358            {
     359                /* Configure close-button: */
     360                m_pButtonClose->setFocusPolicy(Qt::StrongFocus);
     361                m_pButtonClose->setMinimumSize(QSize(1, 1));
     362                m_pButtonClose->setShortcut(Qt::Key_Escape);
     363                m_pButtonClose->setIcon(UIIconPool::iconSet(":/ok_16px.png"));
     364                connect(m_pButtonClose, SIGNAL(clicked(bool)), this, SIGNAL(sigCancelClicked()));
     365                /* Add close-button into main-layout: */
     366                m_pMainLayout->addWidget(m_pButtonClose);
     367            }
    448368        }
    449369        /* Insert stretch: */
     
    463383    }
    464384
     385    /* Mark as prepared: */
     386    m_fPrepared = true;
     387
    465388    /* Translate contents: */
    466389    retranslateUi();
     
    536459void UIStatusBarEditorWidget::retranslateUi()
    537460{
    538     /* Translate close-button: */
    539     m_pButtonClose->setToolTip(tr("Close"));
     461    /* Translate close-button if necessary: */
     462    if (!m_fStartedFromVMSettings && m_pButtonClose)
     463        m_pButtonClose->setToolTip(tr("Close"));
    540464}
    541465
     
    737661
    738662UIStatusBarEditorWindow::UIStatusBarEditorWindow(UIMachineWindow *pParent)
    739     : UISlidingToolBar(pParent, pParent->statusBar(), new UIStatusBarEditorWidget(0, vboxGlobal().managedVMUuid()), UISlidingToolBar::Position_Bottom)
     663    : UISlidingToolBar(pParent, pParent->statusBar(), new UIStatusBarEditorWidget(0, false, vboxGlobal().managedVMUuid()), UISlidingToolBar::Position_Bottom)
    740664{
    741665}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIStatusBarEditorWindow.h

    r52389 r53321  
    1919
    2020/* Qt includes: */
     21#include <QMap>
     22#include <QList>
     23
     24/* GUI includes: */
     25#include "UIExtraDataDefs.h"
    2126#include "UISlidingToolBar.h"
     27#include "QIWithRetranslateUI.h"
    2228
    2329/* Forward declarations: */
     30class UIStatusBarEditorButton;
    2431class UIMachineWindow;
     32class QIToolButton;
     33class QHBoxLayout;
    2534
    2635/** UISlidingToolBar wrapper
     
    3645};
    3746
     47/** QWidget reimplementation
     48  * used as status-bar editor widget. */
     49class UIStatusBarEditorWidget : public QIWithRetranslateUI2<QWidget>
     50{
     51    Q_OBJECT;
     52
     53signals:
     54
     55    /** Notifies about Cancel button click. */
     56    void sigCancelClicked();
     57
     58public:
     59
     60    /** Constructor,
     61      * @param pParent                is passed to QWidget constructor,
     62      * @param fStartedFromVMSettings determines whether 'this' is a part of VM settings,
     63      * @param strMachineID           brings the machine ID to be used by the editor. */
     64    UIStatusBarEditorWidget(QWidget *pParent,
     65                            bool fStartedFromVMSettings = true,
     66                            const QString &strMachineID = QString());
     67
     68    /** Returns the machine ID instance. */
     69    const QString& machineID() const { return m_strMachineID; }
     70    /** Defines the @a strMachineID instance. */
     71    void setMachineID(const QString &strMachineID);
     72
     73private slots:
     74
     75    /** Handles configuration change. */
     76    void sltHandleConfigurationChange(const QString &strMachineID);
     77
     78    /** Handles button click. */
     79    void sltHandleButtonClick();
     80
     81    /** Handles drag object destroy. */
     82    void sltHandleDragObjectDestroy();
     83
     84private:
     85
     86    /** Prepare routine. */
     87    void prepare();
     88    /** Prepare status buttons routine. */
     89    void prepareStatusButtons();
     90    /** Prepare status button routine. */
     91    void prepareStatusButton(IndicatorType type);
     92
     93    /** Updates status buttons. */
     94    void updateStatusButtons();
     95
     96    /** Retranslation routine. */
     97    virtual void retranslateUi();
     98
     99    /** Paint event handler. */
     100    virtual void paintEvent(QPaintEvent *pEvent);
     101
     102    /** Drag-enter event handler. */
     103    virtual void dragEnterEvent(QDragEnterEvent *pEvent);
     104    /** Drag-move event handler. */
     105    virtual void dragMoveEvent(QDragMoveEvent *pEvent);
     106    /** Drag-leave event handler. */
     107    virtual void dragLeaveEvent(QDragLeaveEvent *pEvent);
     108    /** Drop event handler. */
     109    virtual void dropEvent(QDropEvent *pEvent);
     110
     111    /** Returns position for passed @a type. */
     112    int position(IndicatorType type) const;
     113
     114    /** @name General
     115      * @{ */
     116        /** Holds whether 'this' is prepared. */
     117        bool m_fPrepared;
     118        /** Holds whether 'this' is a part of VM settings. */
     119        bool m_fStartedFromVMSettings;
     120        /** Holds the machine ID instance. */
     121        QString m_strMachineID;
     122    /** @} */
     123
     124    /** @name Contents
     125      * @{ */
     126        /** Holds the main-layout instance. */
     127        QHBoxLayout *m_pMainLayout;
     128        /** Holds the button-layout instance. */
     129        QHBoxLayout *m_pButtonLayout;
     130        /** Holds the close-button instance. */
     131        QIToolButton *m_pButtonClose;
     132        /** Holds status-bar buttons. */
     133        QMap<IndicatorType, UIStatusBarEditorButton*> m_buttons;
     134    /** @} */
     135
     136    /** @name Contents: Restrictions
     137      * @{ */
     138        /** Holds the cached status-bar button restrictions. */
     139        QList<IndicatorType> m_restrictions;
     140    /** @} */
     141
     142    /** @name Contents: Order
     143      * @{ */
     144        /** Holds the cached status-bar button order. */
     145        QList<IndicatorType> m_order;
     146        /** Holds the token-button to drop dragged-button nearby. */
     147        UIStatusBarEditorButton *m_pButtonDropToken;
     148        /** Holds whether dragged-button should be dropped <b>after</b> the token-button. */
     149        bool m_fDropAfterTokenButton;
     150    /** @} */
     151};
     152
    38153#endif /* !___UIStatusBarEditorWindow_h___ */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp

    r52730 r53321  
    2929# include "UIMessageCenter.h"
    3030# include "UIConverter.h"
     31# include "UIActionPool.h"
    3132
    3233/* COM includes: */
     
    4950    , m_fWddmModeSupported(false)
    5051#endif /* VBOX_WITH_CRHGSMI */
     52    , m_pActionPool(0)
    5153{
    5254    /* Prepare: */
    5355    prepare();
     56}
     57
     58UIMachineSettingsDisplay::~UIMachineSettingsDisplay()
     59{
     60    /* Cleanup: */
     61    cleanup();
    5462}
    5563
     
    178186    m_pEditorVideoCaptureBitRate->setValue(displayData.m_iVideoCaptureBitRate);
    179187    m_pScrollerVideoCaptureScreens->setValue(displayData.m_screens);
     188
     189    /* Prepare Machine Window data: */
     190    const QString strMachineID = m_machine.GetId();
     191    m_pMenuBarEditor->setMachineID(strMachineID);
     192    m_pStatusBarEditor->setMachineID(strMachineID);
     193    m_pMenuBarEditor->setActionPool(m_pActionPool);
    180194
    181195    /* Polish page finally: */
     
    693707    prepareRemoteDisplayTab();
    694708    prepareVideoCaptureTab();
     709    prepareMachineWindowTab();
    695710
    696711    /* Prepare validation: */
     
    841856}
    842857
     858void UIMachineSettingsDisplay::prepareMachineWindowTab()
     859{
     860    /* Create personal action-pool: */
     861    m_pActionPool = UIActionPool::create(UIActionPoolType_Runtime);
     862}
     863
    843864void UIMachineSettingsDisplay::prepareValidation()
    844865{
     
    851872    connect(m_pEditorRemoteDisplayPort, SIGNAL(textChanged(const QString&)), this, SLOT(revalidate()));
    852873    connect(m_pEditorRemoteDisplayTimeout, SIGNAL(textChanged(const QString&)), this, SLOT(revalidate()));
     874}
     875
     876void UIMachineSettingsDisplay::cleanupMachineWindowTab()
     877{
     878    /* Destroy personal action-pool: */
     879    UIActionPool::destroy(m_pActionPool);
     880}
     881
     882void UIMachineSettingsDisplay::cleanup()
     883{
     884    /* Cleanup tabs: */
     885    cleanupMachineWindowTab();
    853886}
    854887
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h

    r52727 r53321  
    2424/* COM includes: */
    2525#include "CGuestOSType.h"
     26
     27/* Forward declarations: */
     28class UIActionPool;
    2629
    2730/* Machine settings / Display page / Data: */
     
    115118public:
    116119
    117     /* Constructor: */
     120    /** Constructor. */
    118121    UIMachineSettingsDisplay();
     122    /** Destructor. */
     123    ~UIMachineSettingsDisplay();
    119124
    120125    /* API: Correlation stuff: */
     
    175180private:
    176181
    177     /* Helpers: Prepare stuff: */
     182    /** Prepare routine. */
    178183    void prepare();
     184    /** Prepare routine: Video tab. */
    179185    void prepareVideoTab();
     186    /** Prepare routine: Remote Display tab. */
    180187    void prepareRemoteDisplayTab();
     188    /** Prepare routine: Video Capture tab. */
    181189    void prepareVideoCaptureTab();
     190    /** Prepare routine: Machine Window tab. */
     191    void prepareMachineWindowTab();
     192    /** Prepare routine: Validation. */
    182193    void prepareValidation();
     194
     195    /** Cleanup routine: Machine Window tab. */
     196    void cleanupMachineWindowTab();
     197    /** Cleanup routine. */
     198    void cleanup();
    183199
    184200    /* Helpers: Video stuff: */
     
    217233    /* Cache: */
    218234    UICacheSettingsMachineDisplay m_cache;
     235
     236    /** Holds the action-pool instance. */
     237    UIActionPool *m_pActionPool;
    219238};
    220239
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.ui

    r52234 r53321  
    645645      </layout>
    646646     </widget>
     647     <widget class="QWidget" name="m_pTabMachineWindow">
     648      <attribute name="title">
     649       <string>Machine &amp;Window</string>
     650      </attribute>
     651      <layout class="QVBoxLayout" name="m_pLayoutTabMachineWindow">
     652       <item>
     653        <widget class="UIMenuBarEditorWidget" name="m_pMenuBarEditor">
     654         <property name="whatsThis">
     655          <string>Allows to modify VM menu-bar contents.</string>
     656         </property>
     657        </widget>
     658       </item>
     659       <item>
     660        <spacer name="m_pSpacer">
     661         <property name="orientation">
     662          <enum>Qt::Vertical</enum>
     663         </property>
     664         <property name="sizeHint" stdset="0">
     665          <size>
     666           <width>0</width>
     667           <height>0</height>
     668          </size>
     669         </property>
     670        </spacer>
     671       </item>
     672       <item>
     673        <widget class="UIStatusBarEditorWidget" name="m_pStatusBarEditor">
     674         <property name="whatsThis">
     675          <string>Allows to modify VM status-bar contents.</string>
     676         </property>
     677        </widget>
     678       </item>
     679      </layout>
     680     </widget>
    647681    </widget>
    648682   </item>
     
    671705   <header>UIFilmContainer.h</header>
    672706  </customwidget>
     707  <customwidget>
     708   <class>UIMenuBarEditorWidget</class>
     709   <extends>QWidget</extends>
     710   <header>UIMenuBarEditorWindow.h</header>
     711  </customwidget>
     712  <customwidget>
     713   <class>UIStatusBarEditorWidget</class>
     714   <extends>QWidget</extends>
     715   <header>UIStatusBarEditorWindow.h</header>
     716  </customwidget>
    673717 </customwidgets>
    674718 <resources/>
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