Changeset 81257 in vbox
- Timestamp:
- Oct 14, 2019 1:09:01 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 1 deleted
- 6 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r81001 r81257 785 785 src/extensions/QILineEdit.h \ 786 786 src/extensions/QIMainDialog.h \ 787 src/extensions/QIMainWindow.h \788 787 src/extensions/QIManagerDialog.h \ 789 788 src/extensions/QIMenu.h \ … … 1267 1266 src/extensions/QILineEdit.cpp \ 1268 1267 src/extensions/QIMainDialog.cpp \ 1269 src/extensions/QIMainWindow.cpp \1270 1268 src/extensions/QIManagerDialog.cpp \ 1271 1269 src/extensions/QIMenu.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r81255 r81257 53 53 # include "QIDialogButtonBox.h" 54 54 # include "QIFileDialog.h" 55 # include "QIMainWindow.h"56 55 # include "QISplitter.h" 57 56 # include "QIWidgetValidator.h" 57 # include "QIWithRestorableGeometry.h" 58 58 # include "VBoxUtils.h" 59 59 # include "UIIconPool.h" … … 458 458 459 459 460 /** Q IMainWindow extension460 /** QMainWindow extension 461 461 * providing Extra Data Manager with UI features. */ 462 class UIExtraDataManagerWindow : public QI MainWindow462 class UIExtraDataManagerWindow : public QIWithRestorableGeometry<QMainWindow> 463 463 { 464 464 Q_OBJECT; -
trunk/src/VBox/Frontends/VirtualBox/src/globals/QIWithRestorableGeometry.h
r81256 r81257 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - QI MainWindowclass declaration.3 * VBox Qt GUI - QIWithRestorableGeometry class declaration. 4 4 */ 5 5 … … 16 16 */ 17 17 18 #ifndef FEQT_INCLUDED_SRC_ extensions_QIMainWindow_h19 #define FEQT_INCLUDED_SRC_ extensions_QIMainWindow_h18 #ifndef FEQT_INCLUDED_SRC_globals_QIWithRestorableGeometry_h 19 #define FEQT_INCLUDED_SRC_globals_QIWithRestorableGeometry_h 20 20 #ifndef RT_WITHOUT_PRAGMA_ONCE 21 21 # pragma once … … 25 25 #include <QMainWindow> 26 26 #include <QRect> 27 #include <QResizeEvent> 27 28 28 29 /* GUI includes: */ 29 30 #include "UILibraryDefs.h" 31 #ifdef VBOX_WS_MAC 32 # include "VBoxUtils-darwin.h" 33 #endif 34 #ifdef VBOX_WS_X11 35 # include "UICommon.h" 36 # include "UIDesktopWidgetWatchdog.h" 37 #endif 30 38 31 /* Forward declarations: */ 32 class QWidget; 33 34 /** QMainWindow extension providing GUI 35 * with the extended geometry management support. */ 36 class SHARED_LIBRARY_STUFF QIMainWindow : public QMainWindow 39 /** Template with geometry saving/restoring capabilities. */ 40 template <class Base> 41 class QIWithRestorableGeometry : public Base 37 42 { 38 Q_OBJECT;39 40 43 public: 41 44 42 45 /** Constructs main window passing @a pParent and @a enmFlags to base-class. */ 43 QIMainWindow(QWidget *pParent = 0, Qt::WindowFlags enmFlags = 0); 46 QIWithRestorableGeometry(QWidget *pParent = 0, Qt::WindowFlags enmFlags = 0) 47 : Base(pParent, enmFlags) 48 {} 44 49 45 50 protected: 46 51 47 52 /** Handles move @a pEvent. */ 48 virtual void moveEvent(QMoveEvent *pEvent) /* override */; 53 virtual void moveEvent(QMoveEvent *pEvent) /* override */ 54 { 55 /* Call to base-class: */ 56 QMainWindow::moveEvent(pEvent); 57 58 #ifdef VBOX_WS_X11 59 /* Prevent further handling if fake screen detected: */ 60 if (gpDesktop->isFakeScreenDetected()) 61 return; 62 #endif 63 64 /* Prevent handling for yet/already invisible window or if window is in minimized state: */ 65 if (isVisible() && (windowState() & Qt::WindowMinimized) == 0) 66 { 67 #if defined(VBOX_WS_MAC) || defined(VBOX_WS_WIN) 68 /* Use the old approach for OSX/Win: */ 69 m_geometry.moveTo(frameGeometry().x(), frameGeometry().y()); 70 #else 71 /* Use the new approach otherwise: */ 72 m_geometry.moveTo(geometry().x(), geometry().y()); 73 #endif 74 } 75 } 76 49 77 /** Handles resize @a pEvent. */ 50 virtual void resizeEvent(QResizeEvent *pEvent) /* override */; 78 virtual void resizeEvent(QResizeEvent *pEvent) /* override */ 79 { 80 /* Call to base-class: */ 81 QMainWindow::resizeEvent(pEvent); 82 83 #ifdef VBOX_WS_X11 84 /* Prevent handling if fake screen detected: */ 85 if (gpDesktop->isFakeScreenDetected()) 86 return; 87 #endif 88 89 /* Prevent handling for yet/already invisible window or if window is in minimized state: */ 90 if (isVisible() && (windowState() & Qt::WindowMinimized) == 0) 91 { 92 QResizeEvent *pResizeEvent = static_cast<QResizeEvent*>(pEvent); 93 m_geometry.setSize(pResizeEvent->size()); 94 } 95 } 51 96 52 97 /** Returns whether the window should be maximized when geometry being restored. */ … … 54 99 55 100 /** Restores the window geometry to passed @a rect. */ 56 void restoreGeometry(const QRect &rect); 101 void restoreGeometry(const QRect &rect) 102 { 103 m_geometry = rect; 104 #if defined(VBOX_WS_MAC) || defined(VBOX_WS_WIN) 105 /* Use the old approach for OSX/Win: */ 106 move(m_geometry.topLeft()); 107 resize(m_geometry.size()); 108 #else 109 /* Use the new approach otherwise: */ 110 UICommon::setTopLevelGeometry(this, m_geometry); 111 #endif 112 113 /* Maximize (if necessary): */ 114 if (shouldBeMaximized()) 115 showMaximized(); 116 } 57 117 58 118 /** Returns current window geometry. */ 59 QRect currentGeometry() const; 119 QRect currentGeometry() const 120 { 121 return m_geometry; 122 } 123 60 124 /** Returns whether the window is currently maximized. */ 61 bool isCurrentlyMaximized() const; 125 bool isCurrentlyMaximized() const 126 { 127 #ifdef VBOX_WS_MAC 128 return ::darwinIsWindowMaximized(this); 129 #else 130 return isMaximized(); 131 #endif 132 } 62 133 63 134 private: … … 67 138 }; 68 139 69 #endif /* !FEQT_INCLUDED_SRC_ extensions_QIMainWindow_h */140 #endif /* !FEQT_INCLUDED_SRC_globals_QIWithRestorableGeometry_h */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r81255 r81257 128 128 /* Ignore for non-active window except for FileOpen event which should be always processed: */ 129 129 if (!isActiveWindow() && pEvent->type() != QEvent::FileOpen) 130 return Q IWithRetranslateUI<QIMainWindow>::eventFilter(pObject, pEvent);130 return QMainWindowWithRestorableGeometryAndRetranslateUi::eventFilter(pObject, pEvent); 131 131 132 132 /* Ignore for other objects: */ 133 133 if (qobject_cast<QWidget*>(pObject) && 134 134 qobject_cast<QWidget*>(pObject)->window() != this) 135 return Q IWithRetranslateUI<QIMainWindow>::eventFilter(pObject, pEvent);135 return QMainWindowWithRestorableGeometryAndRetranslateUi::eventFilter(pObject, pEvent); 136 136 137 137 /* Which event do we have? */ … … 150 150 151 151 /* Call to base-class: */ 152 return Q IWithRetranslateUI<QIMainWindow>::eventFilter(pObject, pEvent);152 return QMainWindowWithRestorableGeometryAndRetranslateUi::eventFilter(pObject, pEvent); 153 153 } 154 154 #endif /* VBOX_WS_MAC */ … … 184 184 } 185 185 /* Call to base-class: */ 186 return Q IWithRetranslateUI<QIMainWindow>::event(pEvent);186 return QMainWindowWithRestorableGeometryAndRetranslateUi::event(pEvent); 187 187 } 188 188 … … 190 190 { 191 191 /* Call to base-class: */ 192 Q IWithRetranslateUI<QIMainWindow>::showEvent(pEvent);192 QMainWindowWithRestorableGeometryAndRetranslateUi::showEvent(pEvent); 193 193 194 194 /* Is polishing required? */ … … 211 211 { 212 212 /* Call to base-class: */ 213 Q IWithRetranslateUI<QIMainWindow>::closeEvent(pEvent);213 QMainWindowWithRestorableGeometryAndRetranslateUi::closeEvent(pEvent); 214 214 215 215 /* Quit application: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h
r81248 r81257 23 23 24 24 /* Qt includes: */ 25 #include <QMainWindow> 25 26 #include <QUrl> 26 27 27 28 /* GUI includes: */ 28 #include "QI MainWindow.h"29 #include "QIWithRestorableGeometry.h" 29 30 #include "QIWithRetranslateUI.h" 30 31 #include "UICommon.h" … … 39 40 40 41 /* Type definitions: */ 42 typedef QIWithRestorableGeometry<QMainWindow> QMainWindowWithRestorableGeometry; 43 typedef QIWithRetranslateUI<QMainWindowWithRestorableGeometry> QMainWindowWithRestorableGeometryAndRetranslateUi; 41 44 typedef QMap<QString, QIManagerDialog*> VMLogViewerMap; 42 45 43 /** Singleton Q IMainWindow extension used as VirtualBox Manager instance. */44 class UIVirtualBoxManager : public Q IWithRetranslateUI<QIMainWindow>46 /** Singleton QMainWindow extension used as VirtualBox Manager instance. */ 47 class UIVirtualBoxManager : public QMainWindowWithRestorableGeometryAndRetranslateUi 45 48 { 46 49 Q_OBJECT; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.cpp
r81255 r81257 79 79 80 80 UIVMInformationDialog::UIVMInformationDialog(UIMachineWindow *pMachineWindow) 81 : Q IWithRetranslateUI<QIMainWindow>(0)81 : QMainWindowWithRestorableGeometryAndRetranslateUi(0) 82 82 , m_pTabWidget(0) 83 83 , m_pMachineWindow(pMachineWindow) -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.h
r81248 r81257 22 22 #endif 23 23 24 /* Qt includes: */ 25 #include <QMainWindow> 26 24 27 /* GUI includes: */ 25 #include "QI MainWindow.h"28 #include "QIWithRestorableGeometry.h" 26 29 #include "QIWithRetranslateUI.h" 27 30 … … 35 38 class UIMachineWindow; 36 39 40 /* Type definitions: */ 41 typedef QIWithRestorableGeometry<QMainWindow> QMainWindowWithRestorableGeometry; 42 typedef QIWithRetranslateUI<QMainWindowWithRestorableGeometry> QMainWindowWithRestorableGeometryAndRetranslateUi; 37 43 38 /** QIMainWindow subclass providing user 44 45 /** QMainWindow subclass providing user 39 46 * with the dialog unifying VM details and statistics. */ 40 class UIVMInformationDialog : public Q IWithRetranslateUI<QIMainWindow>47 class UIVMInformationDialog : public QMainWindowWithRestorableGeometryAndRetranslateUi 41 48 { 42 49 Q_OBJECT;
Note:
See TracChangeset
for help on using the changeset viewer.