- Timestamp:
- Apr 2, 2013 3:23:00 PM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
r45274 r45290 583 583 } 584 584 585 /* static */ 586 UIMediumManager* UIMediumManager::modelessInstance() 587 { 588 return mModelessDialog; 589 } 590 585 591 QString UIMediumManager::selectedId() const 586 592 { -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h
r44528 r45290 57 57 58 58 static void showModeless (QWidget *aParent = NULL, bool aRefresh = true); 59 static UIMediumManager* modelessInstance(); 59 60 60 61 QString selectedId() const; -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r45282 r45290 28 28 #include <QResizeEvent> 29 29 #include <QStackedWidget> 30 #include <QTimer> 30 31 31 32 /* Local includes: */ … … 76 77 Qt::WindowFlags flags /* = Qt::Window */) 77 78 : QIWithRetranslateUI2<QMainWindow>(pParent, flags) 79 , m_fPolished(false) 80 , m_fWarningAboutInaccessibleMediumShown(false) 78 81 , m_pSplitter(0) 79 82 #ifndef Q_WS_MAC … … 85 88 , m_pDetails(0) 86 89 , m_pVMDesktop(0) 87 , m_fDoneInaccessibleWarningOnce(false)88 90 { 89 91 /* Remember self: */ … … 169 171 } 170 172 171 void UISelectorWindow::sltMediumEnumFinished( const VBoxMediaList &list)172 { 173 /* We warn about inaccessible mediaonly once173 void UISelectorWindow::sltMediumEnumFinished() 174 { 175 /* We try to warn about inaccessible mediums only once 174 176 * (after media emumeration started from main() at startup), 175 177 * to avoid annoying the user: */ 176 if (m_fDoneInaccessibleWarningOnce) 177 return; 178 m_fDoneInaccessibleWarningOnce = true; 179 180 /* Ignore the signal if a modal widget is currently active 181 * (we won't be able to properly show the modeless VDI manager window in this case): */ 182 // TODO: Not sure that is required at all... 183 if (QApplication::activeModalWidget()) 184 return; 185 186 /* Ignore the signal if a UIMediumManager window is active: */ 187 // TODO: Thats a very dirty way, rework required! 188 if (qApp->activeWindow() && 189 !strcmp(qApp->activeWindow()->metaObject()->className(), "UIMediumManager")) 190 return; 191 192 /* Look for at least one inaccessible media: */ 178 if (m_fWarningAboutInaccessibleMediumShown) 179 return; 180 m_fWarningAboutInaccessibleMediumShown = true; 181 182 /* Make sure MM window is not opened: */ 183 if (UIMediumManager::modelessInstance()) 184 return; 185 186 /* Look for at least one inaccessible medium: */ 187 const VBoxMediaList &list = vboxGlobal().currentMediaList(); 193 188 VBoxMediaList::const_iterator it; 194 189 for (it = list.begin(); it != list.end(); ++it) 195 190 if ((*it).state() == KMediumState_Inaccessible) 196 191 break; 197 /* Ask the user about: */ 192 193 /* Warn the user about inaccessible medium: */ 198 194 if (it != list.end() && msgCenter().remindAboutInaccessibleMedia()) 199 195 { 200 /* Show the VMM dialog without refresh: */196 /* Open the MM window (without refresh): */ 201 197 UIMediumManager::showModeless(this, false /* refresh? */); 202 198 } … … 312 308 m_pPreferencesDialogAction->setData(true); 313 309 310 /* Don't show the inaccessible warning 311 * if the user tries to open global settings: */ 312 m_fWarningAboutInaccessibleMediumShown = true; 313 314 314 /* Create and execute global settings dialog: */ 315 315 UISettingsDialogGlobal dialog(this); … … 402 402 } 403 403 404 /* Don't show the inaccessible warning if the user tries to open VM settings: */ 405 m_fDoneInaccessibleWarningOnce = true; 404 /* Don't show the inaccessible warning 405 * if the user tries to open VM settings: */ 406 m_fWarningAboutInaccessibleMediumShown = true; 406 407 407 408 /* Create and execute corresponding VM settings dialog: */ … … 1001 1002 } 1002 1003 1004 void UISelectorWindow::showEvent(QShowEvent *pEvent) 1005 { 1006 /* Call to base-class: */ 1007 QMainWindow::showEvent(pEvent); 1008 1009 /* Is polishing required? */ 1010 if (!m_fPolished) 1011 { 1012 /* Pass the show-event to polish-event: */ 1013 polishEvent(pEvent); 1014 /* Mark as polished: */ 1015 m_fPolished = true; 1016 } 1017 } 1018 1019 void UISelectorWindow::polishEvent(QShowEvent*) 1020 { 1021 /* Make sure user warned about inaccessible medium(s) 1022 * even if enumeration had finished before selector window shown: */ 1023 QTimer::singleShot(0, this, SLOT(sltMediumEnumFinished())); 1024 } 1025 1003 1026 void UISelectorWindow::closeEvent(QCloseEvent *pEvent) 1004 1027 { … … 1379 1402 { 1380 1403 /* Medium enumeration connections: */ 1381 connect(&vboxGlobal(), SIGNAL(mediumEnumFinished(const VBoxMediaList &)), this, SLOT(sltMediumEnumFinished( const VBoxMediaList &)));1404 connect(&vboxGlobal(), SIGNAL(mediumEnumFinished(const VBoxMediaList &)), this, SLOT(sltMediumEnumFinished())); 1382 1405 1383 1406 /* Menu-bar connections: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
r44354 r45290 70 70 71 71 /* Handler: Medium enumeration stuff: */ 72 void sltMediumEnumFinished( const VBoxMediaList &mediumList);72 void sltMediumEnumFinished(); 73 73 74 74 /* Handler: Menubar/status stuff: */ … … 115 115 /* Event handlers: */ 116 116 bool event(QEvent *pEvent); 117 void showEvent(QShowEvent *pEvent); 118 void polishEvent(QShowEvent *pEvent); 117 119 void closeEvent(QCloseEvent *pEvent); 118 120 #ifdef Q_WS_MAC … … 157 159 static bool isAtLeastOneItemStarted(const QList<UIVMItem*> &items); 158 160 static bool isAtLeastOneItemRunning(const QList<UIVMItem*> &items); 161 162 /* Variables: */ 163 bool m_fPolished : 1; 164 bool m_fWarningAboutInaccessibleMediumShown : 1; 159 165 160 166 /* Central splitter window: */ … … 240 246 /* Other variables: */ 241 247 QRect m_normalGeo; 242 bool m_fDoneInaccessibleWarningOnce : 1;243 248 }; 244 249
Note:
See TracChangeset
for help on using the changeset viewer.