VirtualBox

Changeset 55552 in vbox for trunk/src


Ignore:
Timestamp:
Apr 30, 2015 1:39:17 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
99919
Message:

FE/Qt: 7791: Added a possibility to reconnect separate GUI to headless VM with simple Start/Show button click.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/selector
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp

    r55550 r55552  
    470470        /* Launch/show current VM: */
    471471        CMachine machine = pItem->machine();
    472         vboxGlobal().launchMachine(machine, qApp->keyboardModifiers() == Qt::ShiftModifier ?
    473                                             VBoxGlobal::LaunchMode_Headless :
    474                                             VBoxGlobal::LaunchMode_Default);
     472        vboxGlobal().launchMachine(machine,
     473                                   UIVMItem::isItemRunningHeadless(pItem)         ? VBoxGlobal::LaunchMode_Separate :
     474                                   qApp->keyboardModifiers() == Qt::ShiftModifier ? VBoxGlobal::LaunchMode_Headless :
     475                                                                                    VBoxGlobal::LaunchMode_Default);
    475476    }
    476477}
     
    19761977    {
    19771978        if ((UIVMItem::isItemPoweredOff(pItem) && UIVMItem::isItemEditable(pItem)) ||
    1978             (UIVMItem::isItemStarted(pItem) && pItem->canSwitchTo()))
     1979            (UIVMItem::isItemStarted(pItem) && (pItem->canSwitchTo() || UIVMItem::isItemRunningHeadless(pItem))))
    19791980            return true;
    19801981    }
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMItem.cpp

    r52730 r55552  
    477477
    478478/* static */
     479bool UIVMItem::isItemRunningHeadless(UIVMItem *pItem)
     480{
     481    if (isItemRunning(pItem))
     482    {
     483        /* Open session to determine which frontend VM is started with: */
     484        CSession session = vboxGlobal().openExistingSession(pItem->id());
     485        if (!session.isNull())
     486        {
     487            /* Acquire the session type: */
     488            const QString strSessionType = session.GetMachine().GetSessionType();
     489            /* Close the session early: */
     490            session.UnlockMachine();
     491            /* Check whether we are in 'headless' session type: */
     492            if (strSessionType.compare("headless", Qt::CaseInsensitive) == 0)
     493                return true;
     494        }
     495    }
     496    return false;
     497}
     498
     499/* static */
    479500bool UIVMItem::isItemPaused(UIVMItem *pItem)
    480501{
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMItem.h

    r55401 r55552  
    8080    static bool isItemStarted(UIVMItem *pItem);
    8181    static bool isItemRunning(UIVMItem *pItem);
     82    static bool isItemRunningHeadless(UIVMItem *pItem);
    8283    static bool isItemPaused(UIVMItem *pItem);
    8384    static bool isItemStuck(UIVMItem *pItem);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette