- Timestamp:
- Nov 13, 2014 12:11:01 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r53295 r53321 491 491 src/runtime/UIActionPoolRuntime.cpp \ 492 492 src/runtime/UIIndicatorsPool.cpp \ 493 src/runtime/UIMenuBarEditorWindow.cpp \494 493 src/runtime/UIStatusBarEditorWindow.cpp \ 495 494 src/selector/UIActionPoolSelector.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.cpp
r53320 r53321 27 27 # include <QPainter> 28 28 # include <QMenu> 29 # include <QMap>30 29 31 30 /* GUI includes: */ … … 37 36 # include "UIIconPool.h" 38 37 # include "UIToolBar.h" 39 # include "QIWithRetranslateUI.h"40 38 # include "QIToolButton.h" 41 39 # include "VBoxGlobal.h" … … 44 42 45 43 46 47 /** QWidget reimplementation48 * 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_MAC88 /** 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 094 /** Prepare copied sub-menu routine. */95 QMenu* prepareCopiedSubMenu(QMenu *pMenu, const UIAction *pAction);96 #endif97 /** 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_MAC106 /** 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_GUI118 /** 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_MAC127 /** 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_GUI139 /** 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 General152 * @{ */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 Contents160 * @{ */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 172 44 UIMenuBarEditorWidget::UIMenuBarEditorWidget(QWidget *pParent, 173 const QString &strMachineID, 174 UIActionPool *pActionPool) 45 bool fStartedFromVMSettings /* = true */, 46 const QString &strMachineID /* = QString() */, 47 UIActionPool *pActionPool /* = 0 */) 175 48 : QIWithRetranslateUI2<QWidget>(pParent) 49 , m_fPrepared(false) 50 , m_fStartedFromVMSettings(fStartedFromVMSettings) 176 51 , m_strMachineID(strMachineID) 177 52 , m_pActionPool(pActionPool) … … 180 55 , m_pButtonClose(0) 181 56 { 57 /* Prepare: */ 58 prepare(); 59 } 60 61 void UIMenuBarEditorWidget::setMachineID(const QString &strMachineID) 62 { 63 /* Remember new machine ID: */ 64 m_strMachineID = strMachineID; 65 /* Prepare: */ 66 prepare(); 67 } 68 69 void UIMenuBarEditorWidget::setActionPool(UIActionPool *pActionPool) 70 { 71 /* Remember new action-pool: */ 72 m_pActionPool = pActionPool; 182 73 /* Prepare: */ 183 74 prepare(); … … 317 208 void UIMenuBarEditorWidget::prepare() 318 209 { 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 319 218 /* Create main-layout: */ 320 219 m_pMainLayout = new QHBoxLayout(this); … … 345 244 /* Insert stretch: */ 346 245 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; 361 266 362 267 /* Translate contents: */ … … 909 814 void UIMenuBarEditorWidget::retranslateUi() 910 815 { 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")); 913 819 } 914 820 … … 974 880 painter.drawLine(QLine(QPoint(5 + 1, height() - 1 - 5 - 1), QPoint(width() - 1 - 5 - 1, height() - 1 - 5 - 1))); 975 881 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))); 976 884 painter.restore(); 977 885 #endif /* Q_WS_WIN || Q_WS_X11 */ … … 981 889 UIMenuBarEditorWindow::UIMenuBarEditorWindow(UIMachineWindow *pParent, UIActionPool *pActionPool) 982 890 #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) 984 892 #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) 986 894 #endif /* Q_WS_MAC */ 987 895 { 988 896 } 989 897 990 #include "UIMenuBarEditorWindow.moc"991 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.h
r52478 r53321 19 19 20 20 /* Qt includes: */ 21 #include <QMap> 22 23 /* GUI includes: */ 21 24 #include "UISlidingToolBar.h" 25 #include "QIWithRetranslateUI.h" 22 26 23 27 /* Forward declarations: */ 24 28 class UIMachineWindow; 25 29 class UIActionPool; 30 class UIToolBar; 31 class UIAction; 32 class QIToolButton; 33 class QHBoxLayout; 34 class QAction; 35 class QMenu; 26 36 27 37 /** UISlidingToolBar wrapper … … 38 48 }; 39 49 50 /** QWidget reimplementation 51 * used as menu-bar editor widget. */ 52 class UIMenuBarEditorWidget : public QIWithRetranslateUI2<QWidget> 53 { 54 Q_OBJECT; 55 56 signals: 57 58 /** Notifies about Cancel button click. */ 59 void sigCancelClicked(); 60 61 public: 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 83 private slots: 84 85 /** Handles configuration change. */ 86 void sltHandleConfigurationChange(const QString &strMachineID); 87 88 /** Handles menu-bar menu click. */ 89 void sltHandleMenuBarMenuClick(); 90 91 private: 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 40 185 #endif /* !___UIMenuBarEditorWindow_h___ */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIStatusBarEditorWindow.cpp
r53320 r53321 30 30 # include <QPixmap> 31 31 # include <QDrag> 32 # include <QList>33 # include <QMap>34 32 35 33 /* GUI includes: */ … … 39 37 # include "UIConverter.h" 40 38 # include "UIIconPool.h" 41 # include "QIWithRetranslateUI.h"42 39 # include "QIToolButton.h" 43 40 # include "VBoxGlobal.h" … … 111 108 /** Holds the last mouse-press position. */ 112 109 QPoint m_mousePressPosition; 113 };114 115 116 /** QWidget reimplementation117 * 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 General180 * @{ */181 /** Holds the machine ID instance. */182 QString m_strMachineID;183 /** @} */184 185 /** @name Contents186 * @{ */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: Restrictions198 * @{ */199 /** Holds the cached status-bar button restrictions. */200 QList<IndicatorType> m_restrictions;201 /** @} */202 203 /** @name Contents: Order204 * @{ */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 /** @} */212 110 }; 213 111 … … 358 256 359 257 UIStatusBarEditorWidget::UIStatusBarEditorWidget(QWidget *pParent, 360 const QString &strMachineID) 258 bool fStartedFromVMSettings /* = true */, 259 const QString &strMachineID /* = QString() */) 361 260 : QIWithRetranslateUI2<QWidget>(pParent) 261 , m_fPrepared(false) 262 , m_fStartedFromVMSettings(fStartedFromVMSettings) 362 263 , m_strMachineID(strMachineID) 363 264 , m_pMainLayout(0), m_pButtonLayout(0) … … 370 271 } 371 272 273 void UIStatusBarEditorWidget::setMachineID(const QString &strMachineID) 274 { 275 /* Remember new machine ID: */ 276 m_strMachineID = strMachineID; 277 /* Prepare: */ 278 prepare(); 279 } 280 372 281 void UIStatusBarEditorWidget::sltHandleConfigurationChange(const QString &strMachineID) 373 282 { … … 414 323 void UIStatusBarEditorWidget::prepare() 415 324 { 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 416 333 /* Track D&D events: */ 417 334 setAcceptDrops(true); … … 434 351 #endif /* !Q_WS_MAC */ 435 352 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) 439 355 { 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 } 448 368 } 449 369 /* Insert stretch: */ … … 463 383 } 464 384 385 /* Mark as prepared: */ 386 m_fPrepared = true; 387 465 388 /* Translate contents: */ 466 389 retranslateUi(); … … 536 459 void UIStatusBarEditorWidget::retranslateUi() 537 460 { 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")); 540 464 } 541 465 … … 737 661 738 662 UIStatusBarEditorWindow::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) 740 664 { 741 665 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIStatusBarEditorWindow.h
r52389 r53321 19 19 20 20 /* Qt includes: */ 21 #include <QMap> 22 #include <QList> 23 24 /* GUI includes: */ 25 #include "UIExtraDataDefs.h" 21 26 #include "UISlidingToolBar.h" 27 #include "QIWithRetranslateUI.h" 22 28 23 29 /* Forward declarations: */ 30 class UIStatusBarEditorButton; 24 31 class UIMachineWindow; 32 class QIToolButton; 33 class QHBoxLayout; 25 34 26 35 /** UISlidingToolBar wrapper … … 36 45 }; 37 46 47 /** QWidget reimplementation 48 * used as status-bar editor widget. */ 49 class UIStatusBarEditorWidget : 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 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 73 private 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 84 private: 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 38 153 #endif /* !___UIStatusBarEditorWindow_h___ */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r52730 r53321 29 29 # include "UIMessageCenter.h" 30 30 # include "UIConverter.h" 31 # include "UIActionPool.h" 31 32 32 33 /* COM includes: */ … … 49 50 , m_fWddmModeSupported(false) 50 51 #endif /* VBOX_WITH_CRHGSMI */ 52 , m_pActionPool(0) 51 53 { 52 54 /* Prepare: */ 53 55 prepare(); 56 } 57 58 UIMachineSettingsDisplay::~UIMachineSettingsDisplay() 59 { 60 /* Cleanup: */ 61 cleanup(); 54 62 } 55 63 … … 178 186 m_pEditorVideoCaptureBitRate->setValue(displayData.m_iVideoCaptureBitRate); 179 187 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); 180 194 181 195 /* Polish page finally: */ … … 693 707 prepareRemoteDisplayTab(); 694 708 prepareVideoCaptureTab(); 709 prepareMachineWindowTab(); 695 710 696 711 /* Prepare validation: */ … … 841 856 } 842 857 858 void UIMachineSettingsDisplay::prepareMachineWindowTab() 859 { 860 /* Create personal action-pool: */ 861 m_pActionPool = UIActionPool::create(UIActionPoolType_Runtime); 862 } 863 843 864 void UIMachineSettingsDisplay::prepareValidation() 844 865 { … … 851 872 connect(m_pEditorRemoteDisplayPort, SIGNAL(textChanged(const QString&)), this, SLOT(revalidate())); 852 873 connect(m_pEditorRemoteDisplayTimeout, SIGNAL(textChanged(const QString&)), this, SLOT(revalidate())); 874 } 875 876 void UIMachineSettingsDisplay::cleanupMachineWindowTab() 877 { 878 /* Destroy personal action-pool: */ 879 UIActionPool::destroy(m_pActionPool); 880 } 881 882 void UIMachineSettingsDisplay::cleanup() 883 { 884 /* Cleanup tabs: */ 885 cleanupMachineWindowTab(); 853 886 } 854 887 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h
r52727 r53321 24 24 /* COM includes: */ 25 25 #include "CGuestOSType.h" 26 27 /* Forward declarations: */ 28 class UIActionPool; 26 29 27 30 /* Machine settings / Display page / Data: */ … … 115 118 public: 116 119 117 /* Constructor:*/120 /** Constructor. */ 118 121 UIMachineSettingsDisplay(); 122 /** Destructor. */ 123 ~UIMachineSettingsDisplay(); 119 124 120 125 /* API: Correlation stuff: */ … … 175 180 private: 176 181 177 /* Helpers: Prepare stuff:*/182 /** Prepare routine. */ 178 183 void prepare(); 184 /** Prepare routine: Video tab. */ 179 185 void prepareVideoTab(); 186 /** Prepare routine: Remote Display tab. */ 180 187 void prepareRemoteDisplayTab(); 188 /** Prepare routine: Video Capture tab. */ 181 189 void prepareVideoCaptureTab(); 190 /** Prepare routine: Machine Window tab. */ 191 void prepareMachineWindowTab(); 192 /** Prepare routine: Validation. */ 182 193 void prepareValidation(); 194 195 /** Cleanup routine: Machine Window tab. */ 196 void cleanupMachineWindowTab(); 197 /** Cleanup routine. */ 198 void cleanup(); 183 199 184 200 /* Helpers: Video stuff: */ … … 217 233 /* Cache: */ 218 234 UICacheSettingsMachineDisplay m_cache; 235 236 /** Holds the action-pool instance. */ 237 UIActionPool *m_pActionPool; 219 238 }; 220 239 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.ui
r52234 r53321 645 645 </layout> 646 646 </widget> 647 <widget class="QWidget" name="m_pTabMachineWindow"> 648 <attribute name="title"> 649 <string>Machine &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> 647 681 </widget> 648 682 </item> … … 671 705 <header>UIFilmContainer.h</header> 672 706 </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> 673 717 </customwidgets> 674 718 <resources/>
Note:
See TracChangeset
for help on using the changeset viewer.