VirtualBox

Ignore:
Timestamp:
Aug 17, 2021 5:10:51 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8161: Runtime UI / UIMachineWindow: Cleanup for title update code; Don't touch anything if machine-state is Null (at shutdown).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp

    r90567 r90706  
    571571    if (iElement & UIVisualElement_WindowTitle)
    572572    {
    573         /* Get machine state: */
    574         KMachineState state = uisession()->machineState();
     573        /* Make sure machine state is one of valid: */
     574        const KMachineState enmState = uisession()->machineState();
     575        if (enmState == KMachineState_Null)
     576            return;
     577
    575578        /* Prepare full name: */
    576         QString strSnapshotName;
     579        QString strMachineName = machineName();
     580
     581        /* Append snapshot name: */
    577582        if (machine().GetSnapshotCount() > 0)
    578583        {
    579             CSnapshot snapshot = machine().GetCurrentSnapshot();
    580             strSnapshotName = " (" + snapshot.GetName() + ")";
    581         }
    582         QString strMachineName = machineName() + strSnapshotName;
    583         if (state != KMachineState_Null)
    584             strMachineName += " [" + gpConverter->toString(state) + "]";
    585         /* Unusual on the Mac. */
     584            const CSnapshot comSnapshot = machine().GetCurrentSnapshot();
     585            strMachineName += " (" + comSnapshot.GetName() + ")";
     586        }
     587
     588        /* Append state name: */
     589        strMachineName += " [" + gpConverter->toString(enmState) + "]";
     590
    586591#ifndef VBOX_WS_MAC
     592        /* Append user product name (besides macOS): */
    587593        const QString strUserProductName = uisession()->machineWindowNamePostfix();
    588594        strMachineName += " - " + (strUserProductName.isEmpty() ? defaultWindowTitle() : strUserProductName);
    589595#endif /* !VBOX_WS_MAC */
     596
    590597        /* Check if we can get graphics adapter: */
    591598        CGraphicsAdapter comAdapter = machine().GetGraphicsAdapter();
    592         if (!machine().isOk())
    593         {
    594             // What can I say, we really want to notify user about this
    595             // one, but if that happens on VM shutdown/poweroff there
    596             // will no be a chance to do it, cause application got exited.
    597             msgCenter().cannotAcquireMachineParameter(machine());
    598         }
    599         else
     599        if (machine().isOk() && comAdapter.isNotNull())
    600600        {
    601601            /* Append screen number only if there are more than one present: */
     
    603603                strMachineName += QString(" : %1").arg(m_uScreenId + 1);
    604604        }
     605
     606        /* Assign title finally: */
    605607        setWindowTitle(strMachineName);
    606608    }
Note: See TracChangeset for help on using the changeset viewer.

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