Changeset 77376 in vbox
- Timestamp:
- Feb 20, 2019 12:32:25 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 128924
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
r77014 r77376 73 73 const char *UIExtraDataDefs::GUI_RecentFolderCD = "GUI/RecentFolderCD"; 74 74 const char *UIExtraDataDefs::GUI_RecentFolderFD = "GUI/RecentFolderFD"; 75 const char *UIExtraDataDefs::GUI_RecentFolderVISOContent = "GUI/RecentFolderVISOContent";76 75 const char *UIExtraDataDefs::GUI_RecentListHD = "GUI/RecentListHD"; 77 76 const char *UIExtraDataDefs::GUI_RecentListCD = "GUI/RecentListCD"; 78 77 const char *UIExtraDataDefs::GUI_RecentListFD = "GUI/RecentListFD"; 79 78 79 /* Viso Creator: */ 80 const char *UIExtraDataDefs::GUI_VisoCreator_RecentFolder = "GUI/VisoCreator/RecentFolder"; 81 const char *UIExtraDataDefs::GUI_VisoCreator_DialogGeometry = "GUI/VisoCreator/DialogGeometry"; 80 82 81 83 /* VirtualBox Manager: */ -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r77362 r77376 136 136 /** Holds recent folder for floppy-disks. */ 137 137 SHARED_LIBRARY_STUFF extern const char *GUI_RecentFolderFD; 138 /** Holds recent folder for VISO creation content. */139 SHARED_LIBRARY_STUFF extern const char *GUI_RecentFolderVISOContent;140 138 /** Holds the list of recently used hard-drives. */ 141 139 SHARED_LIBRARY_STUFF extern const char *GUI_RecentListHD; … … 144 142 /** Holds the list of recently used floppy-disks. */ 145 143 SHARED_LIBRARY_STUFF extern const char *GUI_RecentListFD; 144 /** @} */ 145 146 /** @name Settings: Viso Creator 147 * @{ */ 148 /** Holds recent folder for Viso creation content. */ 149 SHARED_LIBRARY_STUFF extern const char *GUI_VisoCreator_RecentFolder; 150 /** Holds dialog geometry for Viso creation dialog. */ 151 SHARED_LIBRARY_STUFF extern const char *GUI_VisoCreator_DialogGeometry; 146 152 /** @} */ 147 153 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r77014 r77376 1957 1957 << GUI_ActivateHoveredMachineWindow 1958 1958 << GUI_Input_SelectorShortcuts << GUI_Input_MachineShortcuts 1959 << GUI_RecentFolderHD << GUI_RecentFolderCD << GUI_RecentFolderFD << GUI_RecentFolderVISOContent 1959 << GUI_RecentFolderHD << GUI_RecentFolderCD << GUI_RecentFolderFD 1960 << GUI_VisoCreator_RecentFolder << GUI_VisoCreator_DialogGeometry 1960 1961 << GUI_RecentListHD << GUI_RecentListCD << GUI_RecentListFD 1961 1962 << GUI_LastSelectorWindowPosition << GUI_SplitterSizes … … 2618 2619 } 2619 2620 2620 QString UIExtraDataManager::recentFolderForVISOContent()2621 {2622 return extraDataString(GUI_RecentFolderVISOContent);2623 }2624 2625 2621 void UIExtraDataManager::setRecentFolderForHardDrives(const QString &strValue) 2626 2622 { … … 2638 2634 } 2639 2635 2640 void UIExtraDataManager::setRecentFolderForVISOContent(const QString &strValue)2641 {2642 setExtraDataString(GUI_RecentFolderVISOContent, strValue);2643 }2644 2645 2636 QStringList UIExtraDataManager::recentListOfHardDrives() 2646 2637 { … … 2671 2662 { 2672 2663 setExtraDataStringList(GUI_RecentListFD, value); 2664 } 2665 2666 QString UIExtraDataManager::visoCreatorRecentFolder() 2667 { 2668 return extraDataString(GUI_VisoCreator_RecentFolder); 2669 } 2670 2671 void UIExtraDataManager::setVisoCreatorRecentFolder(const QString &strValue) 2672 { 2673 setExtraDataString(GUI_VisoCreator_RecentFolder, strValue); 2674 } 2675 2676 QRect UIExtraDataManager::visoCreatorDialogGeometry(QWidget *pWidget, const QRect &defaultGeometry) 2677 { 2678 return dialogGeometry(GUI_VisoCreator_DialogGeometry, pWidget, defaultGeometry); 2679 } 2680 2681 void UIExtraDataManager::setVisoCreatorDialogGeometry(const QRect &geometry, bool fMaximized) 2682 { 2683 setDialogGeometry(GUI_VisoCreator_DialogGeometry, geometry, fMaximized); 2684 } 2685 2686 bool UIExtraDataManager::visoCreatorDialogShouldBeMaximized() 2687 { 2688 /* Get corresponding extra-data: */ 2689 const QStringList data = extraDataStringList(GUI_VisoCreator_DialogGeometry); 2690 2691 /* Make sure 5th item has required value: */ 2692 return data.size() == 5 && data[4] == GUI_Geometry_State_Max; 2673 2693 } 2674 2694 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r77014 r77376 269 269 /** Returns recent folder for floppy-disks. */ 270 270 QString recentFolderForFloppyDisks(); 271 /** Returns recent folder for VISO creation content. */272 QString recentFolderForVISOContent();273 271 /** Defines recent folder for hard-drives as @a strValue. */ 274 272 void setRecentFolderForHardDrives(const QString &strValue); … … 277 275 /** Defines recent folder for floppy-disk as @a strValue. */ 278 276 void setRecentFolderForFloppyDisks(const QString &strValue); 279 /** Defines recent folder for VISO creation content as @a strValue. */280 void setRecentFolderForVISOContent(const QString &strValue);281 277 282 278 /** Returns the list of recently used hard-drives. */ … … 292 288 /** Defines the list of recently used floppy-disks as @a value. */ 293 289 void setRecentListOfFloppyDisks(const QStringList &value); 290 /** @} */ 291 292 /** @name Viso Creator 293 * @{ */ 294 /** Returns recent folder for Viso creation content. */ 295 QString visoCreatorRecentFolder(); 296 /** Defines recent folder for Viso creation content as @a strValue. */ 297 void setVisoCreatorRecentFolder(const QString &strValue); 298 /** Returns the Viso creation dialog geometry. */ 299 QRect visoCreatorDialogGeometry(QWidget *pWidget, const QRect &defaultGeometry); 300 /** Defines the Viso creation dialog geometry. */ 301 void setVisoCreatorDialogGeometry(const QRect &geometry, bool fMaximized); 302 /** Returns whether the Viso creation dialog should be maximized. */ 303 bool visoCreatorDialogShouldBeMaximized(); 294 304 /** @} */ 295 305 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r77359 r77376 2721 2721 2722 2722 QWidget *pDialogParent = windowManager().realParentWindow(pParent); 2723 QPointer<UIVisoCreator>pVisoCreator = new UIVisoCreator(pDialogParent, strMachineName);2723 UIVisoCreator *pVisoCreator = new UIVisoCreator(pDialogParent, strMachineName); 2724 2724 2725 2725 if (!pVisoCreator) 2726 2726 return QString(); 2727 2727 windowManager().registerNewParent(pVisoCreator, pDialogParent); 2728 pVisoCreator->setCurrentPath(gEDataManager-> recentFolderForVISOContent());2728 pVisoCreator->setCurrentPath(gEDataManager->visoCreatorRecentFolder()); 2729 2729 2730 2730 if (pVisoCreator->exec(false /* not application modal */)) … … 2736 2736 2737 2737 if (files.empty() || files[0].isEmpty()) 2738 { 2739 delete pVisoCreator; 2738 2740 return QUuid(); 2739 2740 gEDataManager->setRecentFolderForVISOContent(pVisoCreator->currentPath()); 2741 } 2742 2743 gEDataManager->setVisoCreatorRecentFolder(pVisoCreator->currentPath()); 2741 2744 2742 2745 /* Produce the VISO. */ -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp
r77332 r77376 24 24 /* GUI includes: */ 25 25 #include "QIDialogButtonBox.h" 26 #include "UIDesktopWidgetWatchdog.h" 27 #include "UIExtraDataManager.h" 26 28 #include "UIIconPool.h" 27 29 #include "UIToolBar.h" … … 31 33 #include "UIVisoCreatorOptionsPanel.h" 32 34 #include "UIVisoContentBrowser.h" 33 35 #include "VBoxGlobal.h" 34 36 35 37 UIVisoCreator::UIVisoCreator(QWidget *pParent /* =0 */, const QString& strMachineName /* = QString() */) … … 55 57 { 56 58 m_visoOptions.m_strVisoName = !strMachineName.isEmpty() ? strMachineName : "ad-hoc"; 59 loadSettings(); 57 60 prepareActions(); 58 61 prepareWidgets(); … … 65 68 UIVisoCreator::~UIVisoCreator() 66 69 { 70 saveSettings(); 67 71 } 68 72 … … 540 544 m_pVerticalToolBar->addWidget(bottomSpacerWidget); 541 545 } 546 547 void UIVisoCreator::loadSettings() 548 { 549 const QRect desktopRect = gpDesktop->availableGeometry(this); 550 int iDefaultWidth = desktopRect.width() / 2; 551 int iDefaultHeight = desktopRect.height() * 3 / 4; 552 553 QRect defaultGeometry(0, 0, iDefaultWidth, iDefaultHeight); 554 QWidget *pParent = qobject_cast<QWidget*>(parent()); 555 if (pParent) 556 defaultGeometry.moveCenter(pParent->geometry().center()); 557 558 /* Load geometry from extradata: */ 559 QRect geometry = gEDataManager->visoCreatorDialogGeometry(this, defaultGeometry); 560 setDialogGeometry(geometry); 561 } 562 563 void UIVisoCreator::saveSettings() const 564 { 565 /* Save window geometry to extradata: */ 566 const QRect saveGeometry = geometry(); 567 #ifdef VBOX_WS_MAC 568 /* darwinIsWindowMaximized expects a non-const QWidget*. thus const_cast: */ 569 QWidget *pw = const_cast<QWidget*>(qobject_cast<const QWidget*>(this)); 570 gEDataManager->setVisoCreatorDialogGeometry(saveGeometry, ::darwinIsWindowMaximized(pw)); 571 #else /* !VBOX_WS_MAC */ 572 gEDataManager->setVisoCreatorDialogGeometry(saveGeometry, isMaximized()); 573 #endif /* !VBOX_WS_MAC */ 574 } 575 576 void UIVisoCreator::setDialogGeometry(const QRect &geometry) 577 { 578 #ifdef VBOX_WS_MAC 579 /* Use the old approach for OSX: */ 580 move(geometry.topLeft()); 581 resize(geometry.size()); 582 #else /* VBOX_WS_MAC */ 583 /* Use the new approach for Windows/X11: */ 584 VBoxGlobal::setTopLevelGeometry(this, geometry); 585 #endif /* !VBOX_WS_MAC */ 586 587 /* Maximize (if necessary): */ 588 if (gEDataManager->visoCreatorDialogShouldBeMaximized()) 589 showMaximized(); 590 } -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.h
r77330 r77376 121 121 * - assign it to the most recently "unhidden" panel */ 122 122 void manageEscapeShortCut(); 123 void loadSettings(); 124 void saveSettings() const; 125 void setDialogGeometry(const QRect &geometry); 123 126 124 127 QAction *m_pActionConfiguration;
Note:
See TracChangeset
for help on using the changeset viewer.