- Timestamp:
- Apr 3, 2017 12:04:28 PM (8 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
-
globals/UIMessageCenter.cpp (modified) (1 diff)
-
globals/UIMessageCenter.h (modified) (1 diff)
-
selector/UISelectorWindow.cpp (modified) (2 diffs)
-
selector/UISelectorWindow.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r65599 r66398 844 844 .arg(strMachineName), 845 845 formatErrorInfo(progress)); 846 } 847 848 bool UIMessageCenter::confirmStartMultipleMachines(const QString &strNames) const 849 { 850 return questionBinary(0, MessageType_Question, 851 tr("<p>You are about to start all of the following virtual machines:</p>" 852 "<p><b>%1</b></p><p>This could take some time and consume a lot of " 853 "host system resources. Do you wish to proceed?</p>").arg(strNames), 854 "confirmStartMultipleMachines" /* auto-confirm id */); 846 855 } 847 856 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r65268 r66398 201 201 void cannotPowerDownMachine(const CConsole &console) const; 202 202 void cannotPowerDownMachine(const CProgress &progress, const QString &strMachineName) const; 203 bool confirmStartMultipleMachines(const QString &strNames) const; 203 204 204 205 /* API: Snapshot warnings: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r66397 r66398 2007 2007 void UISelectorWindow::performStartOrShowVirtualMachines(const QList<UIVMItem*> &items, VBoxGlobal::LaunchMode enmLaunchMode) 2008 2008 { 2009 /* Do nothing while group saving is in progress: */ 2010 if (m_pPaneChooser->isGroupSavingInProgress()) 2011 return; 2012 2013 /* Compose the list of startable items: */ 2014 QStringList startableMachineNames; 2015 QList<UIVMItem*> startableItems; 2016 foreach (UIVMItem *pItem, items) 2017 if (isAtLeastOneItemCanBeStarted(QList<UIVMItem*>() << pItem)) 2018 { 2019 startableItems << pItem; 2020 startableMachineNames << pItem->name(); 2021 } 2022 2023 /* Initially we have start auto-confirmed: */ 2024 bool fStartConfirmed = true; 2025 /* But if we have more than one item to start => 2026 * We should still ask user for a confirmation: */ 2027 if (startableItems.size() > 1) 2028 fStartConfirmed = msgCenter().confirmStartMultipleMachines(startableMachineNames.join(", ")); 2029 2009 2030 /* For every item => check if it could be launched: */ 2010 2031 foreach (UIVMItem *pItem, items) 2011 if (isActionEnabled(UIActionIndexST_M_Group_M_StartOrShow, QList<UIVMItem*>() << pItem)) 2032 if ( isAtLeastOneItemCanBeShown(QList<UIVMItem*>() << pItem) 2033 || ( isAtLeastOneItemCanBeStarted(QList<UIVMItem*>() << pItem) 2034 && fStartConfirmed)) 2012 2035 { 2013 2036 /* Fetch item launch mode: */ … … 2341 2364 2342 2365 /* static */ 2366 bool UISelectorWindow::isAtLeastOneItemCanBeStarted(const QList<UIVMItem*> &items) 2367 { 2368 foreach (UIVMItem *pItem, items) 2369 { 2370 if (UIVMItem::isItemPoweredOff(pItem) && UIVMItem::isItemEditable(pItem)) 2371 return true; 2372 } 2373 return false; 2374 } 2375 2376 /* static */ 2377 bool UISelectorWindow::isAtLeastOneItemCanBeShown(const QList<UIVMItem*> &items) 2378 { 2379 foreach (UIVMItem *pItem, items) 2380 { 2381 if (UIVMItem::isItemStarted(pItem) && (pItem->canSwitchTo() || UIVMItem::isItemRunningHeadless(pItem))) 2382 return true; 2383 } 2384 return false; 2385 } 2386 2387 /* static */ 2343 2388 bool UISelectorWindow::isAtLeastOneItemCanBeStartedOrShown(const QList<UIVMItem*> &items) 2344 2389 { -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
r66397 r66398 294 294 /** Returns whether at least one of passed @a items is removable. */ 295 295 static bool isAtLeastOneItemRemovable(const QList<UIVMItem*> &items); 296 /** Returns whether at least one of passed @a items can be started. */ 297 static bool isAtLeastOneItemCanBeStarted(const QList<UIVMItem*> &items); 298 /** Returns whether at least one of passed @a items can be shown. */ 299 static bool isAtLeastOneItemCanBeShown(const QList<UIVMItem*> &items); 296 300 /** Returns whether at least one of passed @a items can be started or shown. */ 297 301 static bool isAtLeastOneItemCanBeStartedOrShown(const QList<UIVMItem*> &items);
Note:
See TracChangeset
for help on using the changeset viewer.

