Changeset 45432 in vbox
- Timestamp:
- Apr 9, 2013 1:03:52 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 84863
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIFileDialog.cpp
r45377 r45432 267 267 QString result; 268 268 269 QWidget *topParent = mwManager().realParentWindow(mParent ? mParent : msgCenter().mainWindowShown());269 QWidget *topParent = windowManager().realParentWindow(mParent ? mParent : msgCenter().mainWindowShown()); 270 270 QString title = mCaption.isNull() ? tr ("Select a directory") : mCaption; 271 271 … … 468 468 QString title = mCaption.isNull() ? tr ("Select a file") : mCaption; 469 469 470 QWidget *topParent = mwManager().realParentWindow(mParent ? mParent : msgCenter().mainWindowShown());470 QWidget *topParent = windowManager().realParentWindow(mParent ? mParent : msgCenter().mainWindowShown()); 471 471 QString winFilters = winFilter (mFilters); 472 472 AssertCompile (sizeof (TCHAR) == sizeof (QChar)); … … 717 717 QString title = mCaption.isNull() ? tr ("Select a file") : mCaption; 718 718 719 QWidget *topParent = mwManager().realParentWindow(mParent ? mParent : msgCenter().mainWindowShown());719 QWidget *topParent = windowManager().realParentWindow(mParent ? mParent : msgCenter().mainWindowShown()); 720 720 QString winFilters = winFilter (mFilters); 721 721 AssertCompile (sizeof (TCHAR) == sizeof (QChar)); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r45427 r45432 243 243 244 244 /* Create message-box: */ 245 QWidget *pBoxParent = mwManager().realParentWindow(pParent);245 QWidget *pBoxParent = windowManager().realParentWindow(pParent); 246 246 QPointer<QIMessageBox> pBox = new QIMessageBox(strTitle, strMessage, icon, 247 247 iButton1, iButton2, iButton3, pBoxParent); 248 mwManager().registerNewParent(pBox, pBoxParent);248 windowManager().registerNewParent(pBox, pBoxParent); 249 249 250 250 /* Load option: */ … … 293 293 294 294 /* Create progress-dialog: */ 295 QWidget *pDlgParent = mwManager().realParentWindow(pParent ? pParent :mainWindowShown());295 QWidget *pDlgParent = windowManager().realParentWindow(pParent ? pParent : windowManager().mainWindowShown()); 296 296 QPointer<UIProgressDialog> pProgressDlg = new UIProgressDialog(progress, strTitle, pPixmap, cMinDuration, pDlgParent); 297 mwManager().registerNewParent(pProgressDlg, pDlgParent);297 windowManager().registerNewParent(pProgressDlg, pDlgParent); 298 298 299 299 /* Run the dialog with the 350 ms refresh interval. */ … … 312 312 313 313 return true; 314 }315 316 QWidget* UIMessageCenter::mainWindowShown() const317 {318 /* It may happen that this method is called during VBoxGlobal319 * initialization or even after it failed (for example, to show some error message).320 * Return no main window in this case: */321 if (!vboxGlobal().isValid())322 return 0;323 324 /* For VM console process: */325 if (vboxGlobal().isVMConsoleProcess())326 {327 /* It will be currently active machine-window if visible: */328 if (vboxGlobal().activeMachineWindow()->isVisible())329 return vboxGlobal().activeMachineWindow();330 }331 /* Otherwise: */332 else333 {334 /* It will be the selector window if visible: */335 if (vboxGlobal().selectorWnd().isVisible())336 return &vboxGlobal().selectorWnd();337 }338 339 /* Nothing by default: */340 return 0;341 }342 343 QWidget* UIMessageCenter::networkManagerOrMainWindowShown() const344 {345 return gNetworkManager->window()->isVisible() ? gNetworkManager->window() : mainWindowShown();346 314 } 347 315 … … 1989 1957 bool UIMessageCenter::confirmCancelingAllNetworkRequests() const 1990 1958 { 1991 return questionBinary( networkManagerOrMainWindowShown(), MessageType_Question,1959 return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question, 1992 1960 tr("Do you wish to cancel all current network operations?")); 1993 1961 } … … 1995 1963 void UIMessageCenter::showUpdateSuccess(const QString &strVersion, const QString &strLink) const 1996 1964 { 1997 alert( networkManagerOrMainWindowShown(), MessageType_Info,1965 alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Info, 1998 1966 tr("<p>A new version of VirtualBox has been released! Version <b>%1</b> is available " 1999 1967 "at <a href=\"http://www.virtualbox.org/\">virtualbox.org</a>.</p>" … … 2005 1973 void UIMessageCenter::showUpdateNotFound() const 2006 1974 { 2007 alert( networkManagerOrMainWindowShown(), MessageType_Info,1975 alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Info, 2008 1976 tr("You are already running the most recent version of VirtualBox.")); 2009 1977 } … … 2011 1979 void UIMessageCenter::askUserToDownloadExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion, const QString &strVBoxVersion) const 2012 1980 { 2013 alert( networkManagerOrMainWindowShown(), MessageType_Info,1981 alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Info, 2014 1982 tr("<p>You have version %1 of the <b><nobr>%2</nobr></b> installed.</p>" 2015 1983 "<p>You should download and install version %3 of this extension pack from Oracle!</p>") … … 2028 1996 bool UIMessageCenter::confirmDownloadGuestAdditions(const QString &strUrl, qulonglong uSize) const 2029 1997 { 2030 return questionBinary( networkManagerOrMainWindowShown(), MessageType_Question,1998 return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question, 2031 1999 tr("<p>Are you sure you want to download the <b>VirtualBox Guest Additions</b> CD image " 2032 2000 "from <nobr><a href=\"%1\">%1</a></nobr> (size %2 bytes)?</p>") … … 2038 2006 void UIMessageCenter::cannotSaveGuestAdditions(const QString &strURL, const QString &strTarget) const 2039 2007 { 2040 alert( networkManagerOrMainWindowShown(), MessageType_Error,2008 alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Error, 2041 2009 tr("<p>The <b>VirtualBox Guest Additions</b> CD image has been successfully downloaded " 2042 2010 "from <nobr><a href=\"%1\">%1</a></nobr> " … … 2048 2016 bool UIMessageCenter::proposeMountGuestAdditions(const QString &strUrl, const QString &strSrc) const 2049 2017 { 2050 return questionBinary( networkManagerOrMainWindowShown(), MessageType_Question,2018 return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question, 2051 2019 tr("<p>The <b>VirtualBox Guest Additions</b> CD image has been successfully downloaded " 2052 2020 "from <nobr><a href=\"%1\">%1</a></nobr> " … … 2087 2055 bool UIMessageCenter::confirmDownloadUserManual(const QString &strURL, qulonglong uSize) const 2088 2056 { 2089 return questionBinary( networkManagerOrMainWindowShown(), MessageType_Question,2057 return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question, 2090 2058 tr("<p>Are you sure you want to download the <b>VirtualBox User Manual</b> " 2091 2059 "from <nobr><a href=\"%1\">%1</a></nobr> (size %2 bytes)?</p>") … … 2097 2065 void UIMessageCenter::cannotSaveUserManual(const QString &strURL, const QString &strTarget) const 2098 2066 { 2099 alert( networkManagerOrMainWindowShown(), MessageType_Error,2067 alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Error, 2100 2068 tr("<p>The VirtualBox User Manual has been successfully downloaded " 2101 2069 "from <nobr><a href=\"%1\">%1</a></nobr> " … … 2107 2075 void UIMessageCenter::warnAboutUserManualDownloaded(const QString &strURL, const QString &strTarget) const 2108 2076 { 2109 alert( networkManagerOrMainWindowShown(), MessageType_Warning,2077 alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Warning, 2110 2078 tr("<p>The VirtualBox User Manual has been successfully downloaded " 2111 2079 "from <nobr><a href=\"%1\">%1</a></nobr> " … … 2116 2084 bool UIMessageCenter::warAboutOutdatedExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion) const 2117 2085 { 2118 return questionBinary( networkManagerOrMainWindowShown(), MessageType_Question,2086 return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question, 2119 2087 tr("<p>You have an old version (%1) of the <b><nobr>%2</nobr></b> installed.</p>" 2120 2088 "<p>Do you wish to download latest one from the Internet?</p>") … … 2126 2094 bool UIMessageCenter::confirmDownloadExtensionPack(const QString &strExtPackName, const QString &strURL, qulonglong uSize) const 2127 2095 { 2128 return questionBinary( networkManagerOrMainWindowShown(), MessageType_Question,2096 return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question, 2129 2097 tr("<p>Are you sure you want to download the <b><nobr>%1</nobr></b> " 2130 2098 "from <nobr><a href=\"%2\">%2</a></nobr> (size %3 bytes)?</p>") … … 2136 2104 void UIMessageCenter::cannotSaveExtensionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const 2137 2105 { 2138 alert( networkManagerOrMainWindowShown(), MessageType_Error,2106 alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Error, 2139 2107 tr("<p>The <b><nobr>%1</nobr></b> has been successfully downloaded " 2140 2108 "from <nobr><a href=\"%2\">%2</a></nobr> " … … 2146 2114 bool UIMessageCenter::proposeInstallExtentionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const 2147 2115 { 2148 return questionBinary( networkManagerOrMainWindowShown(), MessageType_Question,2116 return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question, 2149 2117 tr("<p>The <b><nobr>%1</nobr></b> has been successfully downloaded " 2150 2118 "from <nobr><a href=\"%2\">%2</a></nobr> " … … 2469 2437 AssertWrapperOk(vbox); 2470 2438 2471 (new VBoxAboutDlg( mainWindowShown(), strFullVersion))->show();2439 (new VBoxAboutDlg(windowManager().mainWindowShown(), strFullVersion))->show(); 2472 2440 } 2473 2441 … … 2755 2723 2756 2724 /* Create message-box: */ 2757 QWidget *pMessageBoxParent = mwManager().realParentWindow(pParent ? pParent :mainWindowShown());2725 QWidget *pMessageBoxParent = windowManager().realParentWindow(pParent ? pParent : windowManager().mainWindowShown()); 2758 2726 QPointer<QIMessageBox> pMessageBox = new QIMessageBox(title, strMessage, icon, 2759 2727 iButton1, iButton2, iButton3, 2760 2728 pMessageBoxParent); 2761 mwManager().registerNewParent(pMessageBox, pMessageBoxParent);2729 windowManager().registerNewParent(pMessageBox, pMessageBoxParent); 2762 2730 2763 2731 /* Prepare auto-confirmation check-box: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r45427 r45432 151 151 const QString &strImage = "", QWidget *pParent = 0, 152 152 int cMinDuration = 2000); 153 154 /* API: Main window stuff: */155 QWidget* mainWindowShown() const;156 QWidget* networkManagerOrMainWindowShown() const;157 153 158 154 /* API: Main (startup) warnings: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIModalWindowManager.cpp
r45183 r45432 20 20 /* GUI includes: */ 21 21 #include "UIModalWindowManager.h" 22 #include "UINetworkManagerDialog.h" 23 #include "UINetworkManager.h" 24 #include "UISelectorWindow.h" 25 #include "VBoxGlobal.h" 22 26 23 27 /* Other VBox includes: */ … … 62 66 if (m_spInstance == this) 63 67 m_spInstance = 0; 68 } 69 70 QWidget* UIModalWindowManager::mainWindowShown() const 71 { 72 /* Later this function will be independent of VBoxGlobal at all, 73 * but for now VBoxGlobal creates all the main application windows, 74 * so we should honor this fact. 75 * 76 * It may happen that this method is called during VBoxGlobal 77 * initialization or even after it had failed (for example, to show some message). 78 * Return NULL pointer in this case: */ 79 if (!vboxGlobal().isValid()) 80 return 0; 81 82 /* For VM console process: */ 83 if (vboxGlobal().isVMConsoleProcess()) 84 { 85 /* It will be currently active machine-window if visible: */ 86 if (vboxGlobal().activeMachineWindow()->isVisible()) 87 return vboxGlobal().activeMachineWindow(); 88 } 89 /* Otherwise: */ 90 else 91 { 92 /* It will be the selector window if visible: */ 93 if (vboxGlobal().selectorWnd().isVisible()) 94 return &vboxGlobal().selectorWnd(); 95 } 96 97 /* Nothing by default: */ 98 return 0; 99 } 100 101 QWidget* UIModalWindowManager::networkManagerOrMainWindowShown() const 102 { 103 /* It may happen that this method is called before network-manager initialization 104 * or when the network-manager is hidden, return main application window in this case: */ 105 return gNetworkManager && gNetworkManager->window()->isVisible() ? gNetworkManager->window() : mainWindowShown(); 64 106 } 65 107 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIModalWindowManager.h
r45429 r45432 46 46 void registerNewParent(QWidget *pWindow, QWidget *pParentWindow = 0); 47 47 48 /* API: Main application window stuff: */ 49 QWidget* mainWindowShown() const; 50 QWidget* networkManagerOrMainWindowShown() const; 51 48 52 private slots: 49 53 … … 66 70 /* Static API: Instance stuff: */ 67 71 static UIModalWindowManager* instance(); 68 friend UIModalWindowManager& mwManager();72 friend UIModalWindowManager& windowManager(); 69 73 }; 70 74 71 75 /* Shortcut to the static UIModalWindowManager::instance() method: */ 72 inline UIModalWindowManager& mwManager() { return *(UIModalWindowManager::instance()); }76 inline UIModalWindowManager& windowManager() { return *(UIModalWindowManager::instance()); } 73 77 74 78 #endif /* !__UIModalWindowManager_h__ */ -
trunk/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderAdditions.cpp
r45371 r45432 28 28 #include "VBoxGlobal.h" 29 29 #include "UIMessageCenter.h" 30 #include "UIModalWindowManager.h" 30 31 31 32 /* static */ … … 103 104 /* Ask the user for another location for the additions-image file: */ 104 105 QString strTarget = QIFileDialog::getExistingDirectory(QFileInfo(target()).absolutePath(), 105 msgCenter().networkManagerOrMainWindowShown(),106 windowManager().networkManagerOrMainWindowShown(), 106 107 tr("Select folder to save Guest Additions image to"), true); 107 108 -
trunk/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderExtensionPack.cpp
r45342 r45432 29 29 #include "VBoxGlobal.h" 30 30 #include "UIMessageCenter.h" 31 #include "UIModalWindowManager.h" 31 32 32 33 /* static */ … … 120 121 /* Ask the user for another location for the extension-pack file: */ 121 122 QString strTarget = QIFileDialog::getExistingDirectory(QFileInfo(target()).absolutePath(), 122 msgCenter().networkManagerOrMainWindowShown(),123 windowManager().networkManagerOrMainWindowShown(), 123 124 tr("Select folder to save %1 to").arg(GUI_ExtPackName), true); 124 125 -
trunk/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderUserManual.cpp
r45342 r45432 28 28 #include "VBoxGlobal.h" 29 29 #include "UIMessageCenter.h" 30 #include "UIModalWindowManager.h" 30 31 31 32 /* static */ … … 107 108 /* Ask the user for another location for the user-manual file: */ 108 109 QString strTarget = QIFileDialog::getExistingDirectory(QFileInfo(target()).absolutePath(), 109 msgCenter().networkManagerOrMainWindowShown(),110 windowManager().networkManagerOrMainWindowShown(), 110 111 tr("Select folder to save User Manual to"), true); 111 112 -
trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkManagerDialog.cpp
r45377 r45432 34 34 #include "VBoxGlobal.h" 35 35 #include "UIMessageCenter.h" 36 #include "UIModalWindowManager.h" 36 37 #include "QIDialogButtonBox.h" 37 38 … … 168 169 169 170 /* Center according current main application window: */ 170 vboxGlobal().centerWidget(this, msgCenter().mainWindowShown(), false);171 vboxGlobal().centerWidget(this, windowManager().mainWindowShown(), false); 171 172 172 173 /* Pass event to the base-class: */ -
trunk/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.cpp
r45371 r45432 32 32 #include "VBoxGlobal.h" 33 33 #include "UIMessageCenter.h" 34 #include "UIModalWindowManager.h" 34 35 #include "VBoxUtils.h" 35 36 #include "UIDownloaderExtensionPack.h" … … 443 444 /* Warn the user about extension pack was downloaded and saved, propose to install it: */ 444 445 if (msgCenter().proposeInstallExtentionPack(GUI_ExtPackName, strSource, QDir::toNativeSeparators(strTarget))) 445 UIGlobalSettingsExtension::doInstallation(strTarget, strDigest, msgCenter().networkManagerOrMainWindowShown(), NULL);446 UIGlobalSettingsExtension::doInstallation(strTarget, strDigest, windowManager().networkManagerOrMainWindowShown(), NULL); 446 447 } 447 448 }; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r45424 r45432 999 999 1000 1000 /* Create take-snapshot dialog: */ 1001 QWidget *pDlgParent = mwManager().realParentWindow(activeMachineWindow());1001 QWidget *pDlgParent = windowManager().realParentWindow(activeMachineWindow()); 1002 1002 QPointer<VBoxTakeSnapshotDlg> pDlg = new VBoxTakeSnapshotDlg(pDlgParent, machine); 1003 mwManager().registerNewParent(pDlg, pDlgParent);1003 windowManager().registerNewParent(pDlg, pDlgParent); 1004 1004 1005 1005 /* Assign corresponding icon: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
r45377 r45432 273 273 274 274 /* Prepare close-dialog: */ 275 QWidget *pParentDlg = mwManager().realParentWindow(this);275 QWidget *pParentDlg = windowManager().realParentWindow(this); 276 276 QPointer<UIVMCloseDialog> pCloseDlg = new UIVMCloseDialog(pParentDlg, machineCopy, session()); 277 mwManager().registerNewParent(pCloseDlg, pParentDlg);277 windowManager().registerNewParent(pCloseDlg, pParentDlg); 278 278 279 279 /* Makes sure the dialog is valid: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.cpp
r45371 r45432 814 814 { 815 815 /* Create take-snapshot dialog: */ 816 QWidget *pDlgParent = mwManager().realParentWindow(this);816 QWidget *pDlgParent = windowManager().realParentWindow(this); 817 817 QPointer<VBoxTakeSnapshotDlg> pDlg = new VBoxTakeSnapshotDlg(pDlgParent, mMachine); 818 mwManager().registerNewParent(pDlg, pDlgParent);818 windowManager().registerNewParent(pDlg, pDlgParent); 819 819 820 820 /* Assign corresponding icon: */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.cpp
r45335 r45432 193 193 * modal dialog prevents our event-loop from 194 194 * being exit overlapping 'this'. */ 195 if (m_fEnded && !isHidden() && mwManager().isWindowOnTheTopOfTheModalWindowStack(this))195 if (m_fEnded && !isHidden() && windowManager().isWindowOnTheTopOfTheModalWindowStack(this)) 196 196 { 197 197 hide(); … … 204 204 { 205 205 /* Is this progress-dialog a top-level modal-dialog now? */ 206 if ( mwManager().isWindowOnTheTopOfTheModalWindowStack(this))206 if (windowManager().isWindowOnTheTopOfTheModalWindowStack(this)) 207 207 { 208 208 /* Progress finished: */
Note:
See TracChangeset
for help on using the changeset viewer.