Changeset 81261 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Oct 14, 2019 2:38:47 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 133956
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 1 deleted
- 6 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r81258 r81261 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
r81258 r81261 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
r81260 r81261 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; 39 /* Other VBox includes: */ 40 #ifdef VBOX_WS_MAC 41 # include "iprt/cpp/utils.h" 42 #endif 33 43 34 /** QMainWindow extension providing GUI35 * with the extended geometry management support. */ 36 class SHARED_LIBRARY_STUFF QIMainWindow : public QMainWindow44 /** Template with geometry saving/restoring capabilities. */ 45 template <class Base> 46 class QIWithRestorableGeometry : public Base 37 47 { 38 Q_OBJECT;39 40 48 public: 41 49 42 50 /** Constructs main window passing @a pParent and @a enmFlags to base-class. */ 43 QIMainWindow(QWidget *pParent = 0, Qt::WindowFlags enmFlags = 0); 51 QIWithRestorableGeometry(QWidget *pParent = 0, Qt::WindowFlags enmFlags = 0) 52 : Base(pParent, enmFlags) 53 {} 44 54 45 55 protected: 46 56 47 57 /** Handles move @a pEvent. */ 48 virtual void moveEvent(QMoveEvent *pEvent) /* override */; 58 virtual void moveEvent(QMoveEvent *pEvent) /* override */ 59 { 60 /* Call to base-class: */ 61 QMainWindow::moveEvent(pEvent); 62 63 #ifdef VBOX_WS_X11 64 /* Prevent further handling if fake screen detected: */ 65 if (gpDesktop->isFakeScreenDetected()) 66 return; 67 #endif 68 69 /* Prevent handling for yet/already invisible window or if window is in minimized state: */ 70 if (this->isVisible() && (this->windowState() & Qt::WindowMinimized) == 0) 71 { 72 #if defined(VBOX_WS_MAC) || defined(VBOX_WS_WIN) 73 /* Use the old approach for OSX/Win: */ 74 m_geometry.moveTo(this->frameGeometry().x(), this->frameGeometry().y()); 75 #else 76 /* Use the new approach otherwise: */ 77 m_geometry.moveTo(this->geometry().x(), this->geometry().y()); 78 #endif 79 } 80 } 81 49 82 /** Handles resize @a pEvent. */ 50 virtual void resizeEvent(QResizeEvent *pEvent) /* override */; 83 virtual void resizeEvent(QResizeEvent *pEvent) /* override */ 84 { 85 /* Call to base-class: */ 86 QMainWindow::resizeEvent(pEvent); 87 88 #ifdef VBOX_WS_X11 89 /* Prevent handling if fake screen detected: */ 90 if (gpDesktop->isFakeScreenDetected()) 91 return; 92 #endif 93 94 /* Prevent handling for yet/already invisible window or if window is in minimized state: */ 95 if (this->isVisible() && (this->windowState() & Qt::WindowMinimized) == 0) 96 { 97 QResizeEvent *pResizeEvent = static_cast<QResizeEvent*>(pEvent); 98 m_geometry.setSize(pResizeEvent->size()); 99 } 100 } 51 101 52 102 /** Returns whether the window should be maximized when geometry being restored. */ … … 54 104 55 105 /** Restores the window geometry to passed @a rect. */ 56 void restoreGeometry(const QRect &rect); 106 void restoreGeometry(const QRect &rect) 107 { 108 m_geometry = rect; 109 #if defined(VBOX_WS_MAC) || defined(VBOX_WS_WIN) 110 /* Use the old approach for OSX/Win: */ 111 this->move(m_geometry.topLeft()); 112 this->resize(m_geometry.size()); 113 #else 114 /* Use the new approach otherwise: */ 115 UICommon::setTopLevelGeometry(this, m_geometry); 116 #endif 117 118 /* Maximize (if necessary): */ 119 if (shouldBeMaximized()) 120 this->showMaximized(); 121 } 57 122 58 123 /** Returns current window geometry. */ 59 QRect currentGeometry() const; 124 QRect currentGeometry() const 125 { 126 return m_geometry; 127 } 128 60 129 /** Returns whether the window is currently maximized. */ 61 bool isCurrentlyMaximized() const; 130 bool isCurrentlyMaximized() const 131 { 132 #ifdef VBOX_WS_MAC 133 return ::darwinIsWindowMaximized(unconst(this)); 134 #else 135 return this->isMaximized(); 136 #endif 137 } 62 138 63 139 private: … … 67 143 }; 68 144 69 #endif /* !FEQT_INCLUDED_SRC_ extensions_QIMainWindow_h */145 #endif /* !FEQT_INCLUDED_SRC_globals_QIWithRestorableGeometry_h */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r81258 r81261 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
r81258 r81261 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
r81258 r81261 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
r81258 r81261 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.