Changeset 98376 in vbox
- Timestamp:
- Feb 1, 2023 12:20:34 PM (20 months ago)
- Location:
- trunk
- Files:
-
- 10 edited
-
. (modified) (1 prop)
-
src/VBox (modified) (1 prop)
-
src/VBox/Frontends (modified) (1 prop)
-
src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp (modified) (6 diffs)
-
src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h (modified) (3 diffs)
-
src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp (modified) (2 diffs)
-
src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp (modified) (6 diffs)
-
src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h (modified) (4 diffs)
-
src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp (modified) (7 diffs)
-
src/VBox/Frontends/VirtualBox/src/runtime/UISession.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo
-
old new 19 19 /branches/dsen/gui2:79224,79228,79233,79235,79258,79262-79263,79273,79341,79345,79354,79357,79387-79388,79559-79569,79572-79573,79578,79581-79582,79590-79591,79598-79599,79602-79603,79605-79606,79632,79635,79637,79644 20 20 /branches/dsen/gui3:79645-79692 21 /branches/dsen/gui4:155183 ,15519821 /branches/dsen/gui4:155183-155184,155198 22 22 /trunk/src:92342,154921
-
- Property svn:mergeinfo
-
trunk/src/VBox
- Property svn:mergeinfo
-
old new 19 19 /branches/dsen/gui2/src/VBox:79224,79228,79233,79235,79258,79262-79263,79273,79341,79345,79354,79357,79387-79388,79559-79569,79572-79573,79578,79581-79582,79590-79591,79598-79599,79602-79603,79605-79606,79632,79635,79637,79644 20 20 /branches/dsen/gui3/src/VBox:79645-79692 21 /branches/dsen/gui4/src/VBox:155183 ,15519821 /branches/dsen/gui4/src/VBox:155183-155184,155198
-
- Property svn:mergeinfo
-
trunk/src/VBox/Frontends
- Property svn:mergeinfo
-
old new 16 16 /branches/dsen/gui2/src/VBox/Frontends:79224,79228,79233,79235,79258,79262-79263,79273,79341,79345,79354,79357,79387-79388,79559-79569,79572-79573,79578,79581-79582,79590-79591,79598-79599,79602-79603,79605-79606,79632,79635,79637,79644 17 17 /branches/dsen/gui3/src/VBox/Frontends:79645-79692 18 /branches/dsen/gui4/src/VBox/Frontends:155183 ,15519818 /branches/dsen/gui4/src/VBox/Frontends:155183-155184,155198
-
- Property svn:mergeinfo
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r98335 r98376 29 29 #include "UICommon.h" 30 30 #include "UIExtraDataManager.h" 31 #include "UIIconPool.h" 31 32 #include "UIMachine.h" 32 33 #include "UISession.h" … … 221 222 , m_enmRequestedVisualState(UIVisualStateType_Invalid) 222 223 , m_pMachineLogic(0) 224 , m_pMachineWindowIcon(0) 223 225 { 224 226 m_spInstance = this; … … 243 245 } 244 246 245 /* Prepare machine-logic: */ 247 /* Prepare stuff: */ 248 prepareMachineWindowIcon(); 246 249 prepareMachineLogic(); 250 251 /* Load settings: */ 252 loadSessionSettings(); 247 253 248 254 /* Try to initialize session UI: */ … … 262 268 /* True by default: */ 263 269 return true; 270 } 271 272 void UIMachine::prepareMachineWindowIcon() 273 { 274 /* Acquire user machine-window icon: */ 275 QIcon icon = generalIconPool().userMachineIcon(uisession()->machine()); 276 /* Use the OS type icon if user one was not set: */ 277 if (icon.isNull()) 278 icon = generalIconPool().guestOSTypeIcon(uisession()->machine().GetOSTypeId()); 279 /* Use the default icon if nothing else works: */ 280 if (icon.isNull()) 281 icon = QIcon(":/VirtualBox_48px.png"); 282 /* Store the icon dynamically: */ 283 m_pMachineWindowIcon = new QIcon(icon); 264 284 } 265 285 … … 306 326 } 307 327 328 void UIMachine::loadSessionSettings() 329 { 330 /* Load extra-data settings: */ 331 { 332 /* Get machine ID: */ 333 const QUuid uMachineID = uiCommon().managedVMUuid(); 334 Q_UNUSED(uMachineID); 335 336 #ifndef VBOX_WS_MAC 337 /* Load user's machine-window name postfix: */ 338 m_strMachineWindowNamePostfix = gEDataManager->machineWindowNamePostfix(uMachineID); 339 #endif 340 } 341 } 342 343 void UIMachine::cleanupMachineWindowIcon() 344 { 345 /* Cleanup machine-window icon: */ 346 delete m_pMachineWindowIcon; 347 m_pMachineWindowIcon = 0; 348 } 349 308 350 void UIMachine::cleanupSession() 309 351 { … … 318 360 QApplication::sendPostedEvents(0, QEvent::MetaCall); 319 361 320 /* Cleanup machine-logic: */362 /* Cleanup stuff: */ 321 363 cleanupMachineLogic(); 364 cleanupMachineWindowIcon(); 322 365 323 366 /* Cleanup session UI: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
r98103 r98376 88 88 UIVisualStateType requestedVisualState() const; 89 89 90 /** @name Branding stuff. 91 ** @{ */ 92 /** Returns the cached machine-window icon. */ 93 QIcon *machineWindowIcon() const { return m_pMachineWindowIcon; } 94 #ifndef VBOX_WS_MAC 95 /** Returns redefined machine-window name postfix. */ 96 QString machineWindowNamePostfix() const { return m_strMachineWindowNamePostfix; } 97 #endif 98 /** @} */ 99 90 100 public slots: 91 101 … … 109 119 /** Prepare routine: Session stuff. */ 110 120 bool prepareSession(); 121 /** Prepares machine-window icon. */ 122 void prepareMachineWindowIcon(); 111 123 /** Prepare routine: Machine-logic stuff. */ 112 124 void prepareMachineLogic(); 113 125 126 /* Settings stuff: */ 127 void loadSessionSettings(); 128 114 129 /** Cleanup routine: Machine-logic stuff. */ 115 130 void cleanupMachineLogic(); 131 /** Cleanup machine-window icon. */ 132 void cleanupMachineWindowIcon(); 116 133 /** Cleanup routine: Session stuff. */ 117 134 void cleanupSession(); … … 138 155 /** Holds current machine-logic. */ 139 156 UIMachineLogic *m_pMachineLogic; 157 158 /** @name Branding stuff. 159 ** @{ */ 160 /** Holds the cached machine-window icon. */ 161 QIcon *m_pMachineWindowIcon; 162 #ifndef VBOX_WS_MAC 163 /** Holds redefined machine-window name postfix. */ 164 QString m_strMachineWindowNamePostfix; 165 #endif 166 /** @} */ 140 167 }; 141 168 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r98375 r98376 159 159 UIVisualStateType enmVisualStateType) 160 160 { 161 AssertPtrReturn(pMachine, 0); 162 AssertPtrReturn(pSession, 0); 163 161 164 UIMachineLogic *pLogic = 0; 162 165 switch (enmVisualStateType) … … 1619 1622 1620 1623 /* Assign corresponding icon: */ 1621 if (ui session() && uisession()->machineWindowIcon())1622 pDlg->setIcon(*ui session()->machineWindowIcon());1624 if (uimachine()->machineWindowIcon()) 1625 pDlg->setIcon(*uimachine()->machineWindowIcon()); 1623 1626 1624 1627 /* Search for the max available filter index: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
r98103 r98376 39 39 #include "UIModalWindowManager.h" 40 40 #include "UIExtraDataManager.h" 41 #include "UIMachine.h" 41 42 #include "UIMessageCenter.h" 42 43 #include "UISession.h" … … 104 105 void UIMachineWindow::prepare() 105 106 { 107 /* Prepare dialog itself: */ 108 prepareSelf(); 109 106 110 /* Prepare session-connections: */ 107 111 prepareSessionConnections(); … … 201 205 , m_pRightSpacer(0) 202 206 { 203 #ifndef VBOX_WS_MAC 204 /* Set machine-window icon if any: */ 205 // On macOS window icon is referenced in info.plist. 206 if (uisession() && uisession()->machineWindowIcon()) 207 setWindowIcon(*uisession()->machineWindowIcon()); 208 #endif /* !VBOX_WS_MAC */ 209 } 210 211 UIActionPool* UIMachineWindow::actionPool() const 207 } 208 209 UIMachine *UIMachineWindow::uimachine() const 210 { 211 return machineLogic()->uimachine(); 212 } 213 214 UISession *UIMachineWindow::uisession() const 215 { 216 return machineLogic()->uisession(); 217 } 218 219 UIActionPool *UIMachineWindow::actionPool() const 212 220 { 213 221 return machineLogic()->actionPool(); 214 }215 216 UISession* UIMachineWindow::uisession() const217 {218 return machineLogic()->uisession();219 222 } 220 223 … … 291 294 #ifndef VBOX_WS_MAC 292 295 /* Append user product name (besides macOS): */ 293 const QString strUserProductName = ui session()->machineWindowNamePostfix();296 const QString strUserProductName = uimachine()->machineWindowNamePostfix(); 294 297 strMachineName += " - " + (strUserProductName.isEmpty() ? defaultWindowTitle() : strUserProductName); 295 298 #endif /* !VBOX_WS_MAC */ … … 436 439 restrictedCloseActions); 437 440 /* Configure close-dialog: */ 438 if (ui session() && uisession()->machineWindowIcon())439 pCloseDlg->setIcon(*ui session()->machineWindowIcon());441 if (uimachine()->machineWindowIcon()) 442 pCloseDlg->setIcon(*uimachine()->machineWindowIcon()); 440 443 441 444 /* Make sure close-dialog is valid: */ … … 543 546 } 544 547 548 void UIMachineWindow::prepareSelf() 549 { 550 #ifndef VBOX_WS_MAC 551 /* Set machine-window icon if any: */ 552 // On macOS window icon is referenced in info.plist. 553 if (uimachine()->machineWindowIcon()) 554 setWindowIcon(*uimachine()->machineWindowIcon()); 555 #endif /* !VBOX_WS_MAC */ 556 } 557 545 558 void UIMachineWindow::prepareSessionConnections() 546 559 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h
r98103 r98376 54 54 class QSpacerItem; 55 55 class UIActionPool; 56 class UIMachine; 56 57 class UISession; 57 58 class UIMachineLogic; … … 84 85 UIMachineView* machineView() const { return m_pMachineView; } 85 86 UIMachineLogic* machineLogic() const { return m_pMachineLogic; } 86 UIActionPool* actionPool() const; 87 UISession* uisession() const; 87 88 /** Returns machine UI reference. */ 89 UIMachine *uimachine() const; 90 /** Returns session UI reference. */ 91 UISession *uisession() const; 92 93 /** Returns action-pool reference. */ 94 UIActionPool *actionPool() const; 88 95 89 96 /** Returns the session reference. */ … … 172 179 173 180 /* Prepare helpers: */ 181 virtual void prepareSelf(); 174 182 virtual void prepareSessionConnections(); 175 183 virtual void prepareMainLayout(); … … 192 200 virtual void cleanupMainLayout() {} 193 201 virtual void cleanupSessionConnections(); 202 virtual void cleanupSelf() {} 194 203 195 204 /* Update stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r98103 r98376 43 43 #include "UIDesktopWidgetWatchdog.h" 44 44 #include "UIExtraDataManager.h" 45 #include "UIIconPool.h"46 45 #include "UISession.h" 47 46 #include "UIMachine.h" … … 892 891 , m_machineStatePrevious(KMachineState_Null) 893 892 , m_machineState(KMachineState_Null) 894 , m_pMachineWindowIcon(0)895 893 #ifdef VBOX_WS_MAC 896 894 , m_pWatchdogDisplayChange(0) … … 950 948 prepareActions(); 951 949 prepareConnections(); 952 prepareMachineWindowIcon();953 950 prepareScreens(); 954 951 prepareSignalHandling(); … … 1132 1129 } 1133 1130 1134 void UISession::prepareMachineWindowIcon()1135 {1136 /* Acquire user machine-window icon: */1137 QIcon icon = generalIconPool().userMachineIcon(machine());1138 /* Use the OS type icon if user one was not set: */1139 if (icon.isNull())1140 icon = generalIconPool().guestOSTypeIcon(machine().GetOSTypeId());1141 /* Use the default icon if nothing else works: */1142 if (icon.isNull())1143 icon = QIcon(":/VirtualBox_48px.png");1144 /* Store the icon dynamically: */1145 m_pMachineWindowIcon = new QIcon(icon);1146 }1147 1148 1131 void UISession::prepareScreens() 1149 1132 { … … 1234 1217 /* Get machine ID: */ 1235 1218 const QUuid uMachineID = uiCommon().managedVMUuid(); 1236 1237 #ifndef VBOX_WS_MAC1238 /* Load user's machine-window name postfix: */1239 m_strMachineWindowNamePostfix = gEDataManager->machineWindowNamePostfix(uMachineID);1240 #endif1241 1219 1242 1220 /* Should guest autoresize? */ … … 1304 1282 } 1305 1283 1306 void UISession::cleanupMachineWindowIcon()1307 {1308 /* Cleanup machine-window icon: */1309 delete m_pMachineWindowIcon;1310 m_pMachineWindowIcon = 0;1311 }1312 1313 1284 void UISession::cleanupConnections() 1314 1285 { … … 1410 1381 //cleanupSignalHandling(); 1411 1382 //cleanupScreens(); 1412 cleanupMachineWindowIcon();1413 1383 cleanupConnections(); 1414 1384 cleanupActions(); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r98103 r98376 134 134 /** Returns currently cached mouse cursor position. */ 135 135 QPoint cursorPosition() const { return m_cursorPosition; } 136 137 /** @name Branding stuff.138 ** @{ */139 /** Returns the cached machine-window icon. */140 QIcon *machineWindowIcon() const { return m_pMachineWindowIcon; }141 #ifndef VBOX_WS_MAC142 /** Returns redefined machine-window name postfix. */143 QString machineWindowNamePostfix() const { return m_strMachineWindowNamePostfix; }144 #endif145 /** @} */146 136 147 137 /** @name Host-screen configuration variables. … … 444 434 void prepareActions(); 445 435 void prepareConnections(); 446 void prepareMachineWindowIcon();447 436 void prepareScreens(); 448 437 void prepareSignalHandling(); … … 454 443 //void cleanupSignalHandling(); 455 444 //void cleanupScreens() {} 456 void cleanupMachineWindowIcon();457 445 void cleanupConnections(); 458 446 void cleanupActions(); … … 545 533 QPoint m_cursorPosition; 546 534 547 /** @name Branding variables.548 ** @{ */549 /** Holds the cached machine-window icon. */550 QIcon *m_pMachineWindowIcon;551 #ifndef VBOX_WS_MAC552 /** Holds redefined machine-window name postfix. */553 QString m_strMachineWindowNamePostfix;554 #endif555 /** @} */556 557 535 /** @name Host-screen configuration variables. 558 536 * @{ */
Note:
See TracChangeset
for help on using the changeset viewer.

