Changeset 66397 in vbox
- Timestamp:
- Apr 3, 2017 11:54:11 AM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 114349
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r66279 r66397 5043 5043 case LaunchMode_Separate: strType = vboxGlobal().isSeparateProcess() ? "headless" : "separate"; break; 5044 5044 case LaunchMode_Headless: strType = "headless"; break; 5045 default: AssertFailedReturn(false); 5045 5046 } 5046 5047 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r66152 r66397 81 81 enum LaunchMode 82 82 { 83 LaunchMode_Invalid, 83 84 LaunchMode_Default, 84 85 LaunchMode_Headless, -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r66152 r66397 69 69 # include "UIDesktopWidgetWatchdog.h" 70 70 # include "UIModalWindowManager.h" 71 # include "VBoxGlobal.h"72 71 # ifdef VBOX_WS_MAC 73 72 # include "VBoxUtils.h" … … 604 603 void UISelectorWindow::sltPerformStartOrShowMachine() 605 604 { 606 /* Get selected items: */605 /* Start selected VMs in corresponding mode: */ 607 606 QList<UIVMItem*> items = currentItems(); 608 607 AssertMsgReturnVoid(!items.isEmpty(), ("At least one item should be selected!\n")); 609 610 /* For every selected item: */ 611 foreach (UIVMItem *pItem, items) 612 { 613 /* Check if current item could be started/showed: */ 614 if (!isActionEnabled(UIActionIndexST_M_Group_M_StartOrShow, QList<UIVMItem*>() << pItem)) 615 continue; 616 617 /* Launch/show current VM: */ 618 CMachine machine = pItem->machine(); 619 vboxGlobal().launchMachine(machine, 620 UIVMItem::isItemRunningHeadless(pItem) ? VBoxGlobal::LaunchMode_Separate : 621 qApp->keyboardModifiers() == Qt::ShiftModifier ? VBoxGlobal::LaunchMode_Headless : 622 VBoxGlobal::LaunchMode_Default); 623 } 608 performStartOrShowVirtualMachines(items, VBoxGlobal::LaunchMode_Invalid); 624 609 } 625 610 626 611 void UISelectorWindow::sltPerformStartMachineNormal() 627 612 { 628 /* Get selected items: */613 /* Start selected VMs in corresponding mode: */ 629 614 QList<UIVMItem*> items = currentItems(); 630 615 AssertMsgReturnVoid(!items.isEmpty(), ("At least one item should be selected!\n")); 631 632 /* For every selected item: */ 633 foreach (UIVMItem *pItem, items) 634 { 635 /* Check if current item could be started/showed: */ 636 if (!isActionEnabled(UIActionIndexST_M_Group_M_StartOrShow, QList<UIVMItem*>() << pItem)) 637 continue; 638 639 /* Launch/show current VM: */ 640 CMachine machine = pItem->machine(); 641 vboxGlobal().launchMachine(machine, VBoxGlobal::LaunchMode_Default); 642 } 616 performStartOrShowVirtualMachines(items, VBoxGlobal::LaunchMode_Default); 643 617 } 644 618 645 619 void UISelectorWindow::sltPerformStartMachineHeadless() 646 620 { 647 /* Get selected items: */621 /* Start selected VMs in corresponding mode: */ 648 622 QList<UIVMItem*> items = currentItems(); 649 623 AssertMsgReturnVoid(!items.isEmpty(), ("At least one item should be selected!\n")); 650 651 /* For every selected item: */ 652 foreach (UIVMItem *pItem, items) 653 { 654 /* Check if current item could be started/showed: */ 655 if (!isActionEnabled(UIActionIndexST_M_Group_M_StartOrShow, QList<UIVMItem*>() << pItem)) 656 continue; 657 658 /* Launch/show current VM: */ 659 CMachine machine = pItem->machine(); 660 vboxGlobal().launchMachine(machine, VBoxGlobal::LaunchMode_Headless); 661 } 624 performStartOrShowVirtualMachines(items, VBoxGlobal::LaunchMode_Headless); 662 625 } 663 626 664 627 void UISelectorWindow::sltPerformStartMachineDetachable() 665 628 { 666 /* Get selected items: */629 /* Start selected VMs in corresponding mode: */ 667 630 QList<UIVMItem*> items = currentItems(); 668 631 AssertMsgReturnVoid(!items.isEmpty(), ("At least one item should be selected!\n")); 669 670 /* For every selected item: */ 671 foreach (UIVMItem *pItem, items) 672 { 673 /* Check if current item could be started/showed: */ 674 if (!isActionEnabled(UIActionIndexST_M_Group_M_StartOrShow, QList<UIVMItem*>() << pItem)) 675 continue; 676 677 /* Launch/show current VM: */ 678 CMachine machine = pItem->machine(); 679 vboxGlobal().launchMachine(machine, VBoxGlobal::LaunchMode_Separate); 680 } 632 performStartOrShowVirtualMachines(items, VBoxGlobal::LaunchMode_Separate); 681 633 } 682 634 … … 2053 2005 } 2054 2006 2007 void UISelectorWindow::performStartOrShowVirtualMachines(const QList<UIVMItem*> &items, VBoxGlobal::LaunchMode enmLaunchMode) 2008 { 2009 /* For every item => check if it could be launched: */ 2010 foreach (UIVMItem *pItem, items) 2011 if (isActionEnabled(UIActionIndexST_M_Group_M_StartOrShow, QList<UIVMItem*>() << pItem)) 2012 { 2013 /* Fetch item launch mode: */ 2014 VBoxGlobal::LaunchMode enmItemLaunchMode = enmLaunchMode; 2015 if (enmItemLaunchMode == VBoxGlobal::LaunchMode_Invalid) 2016 enmItemLaunchMode = UIVMItem::isItemRunningHeadless(pItem) ? VBoxGlobal::LaunchMode_Separate : 2017 qApp->keyboardModifiers() == Qt::ShiftModifier ? VBoxGlobal::LaunchMode_Headless : 2018 VBoxGlobal::LaunchMode_Default; 2019 2020 /* Launch current VM: */ 2021 CMachine machine = pItem->machine(); 2022 vboxGlobal().launchMachine(machine, enmItemLaunchMode); 2023 } 2024 } 2025 2055 2026 void UISelectorWindow::updateActionsAppearance() 2056 2027 { … … 2210 2181 { 2211 2182 return !m_pPaneChooser->isGroupSavingInProgress() && 2212 isAtLeastOneItemCanBeStartedOrShow ed(items);2183 isAtLeastOneItemCanBeStartedOrShown(items); 2213 2184 } 2214 2185 case UIActionIndexST_M_Group_S_Discard: … … 2370 2341 2371 2342 /* static */ 2372 bool UISelectorWindow::isAtLeastOneItemCanBeStartedOrShow ed(const QList<UIVMItem*> &items)2343 bool UISelectorWindow::isAtLeastOneItemCanBeStartedOrShown(const QList<UIVMItem*> &items) 2373 2344 { 2374 2345 foreach (UIVMItem *pItem, items) -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
r64767 r66397 25 25 #include "QIMainWindow.h" 26 26 #include "QIWithRetranslateUI.h" 27 #include "VBoxGlobal.h" 27 28 28 29 /* Forward declarations: */ … … 266 267 /** @} */ 267 268 269 /** @name VM launching stuff. 270 * @{ */ 271 /** Launches or shows virtual machines represented by passed @a items in corresponding @a enmLaunchMode (for launch). */ 272 void performStartOrShowVirtualMachines(const QList<UIVMItem*> &items, VBoxGlobal::LaunchMode enmLaunchMode); 273 /** @} */ 274 268 275 /** @name Action update stuff. 269 276 * @{ */ … … 288 295 static bool isAtLeastOneItemRemovable(const QList<UIVMItem*> &items); 289 296 /** Returns whether at least one of passed @a items can be started or shown. */ 290 static bool isAtLeastOneItemCanBeStartedOrShow ed(const QList<UIVMItem*> &items);297 static bool isAtLeastOneItemCanBeStartedOrShown(const QList<UIVMItem*> &items); 291 298 /** Returns whether at least one of passed @a items can be discarded. */ 292 299 static bool isAtLeastOneItemDiscardable(const QList<UIVMItem*> &items);
Note:
See TracChangeset
for help on using the changeset viewer.