VirtualBox

Changeset 99012 in vbox for trunk


Ignore:
Timestamp:
Mar 17, 2023 2:19:31 PM (23 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10322: Runtime UI: Window name for the case when COM init failed.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
2 edited

Legend:

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

    r98940 r99012  
    255255        const KMachineState enmState = uimachine()->machineState();
    256256        if (enmState == KMachineState_Null)
    257             return;
    258 
    259         /* Prepare full name: */
    260         QString strMachineName = machineName();
    261 
    262         /* Append snapshot name: */
    263         ulong uSnapshotCount = 0;
    264         uimachine()->acquireSnapshotCount(uSnapshotCount);
    265         if (uSnapshotCount > 0)
    266         {
    267             QString strCurrentSnapshotName;
    268             uimachine()->acquireCurrentSnapshotName(strCurrentSnapshotName);
    269             strMachineName += " (" + strCurrentSnapshotName + ")";
    270         }
    271 
    272         /* Append state name: */
    273         strMachineName += " [" + gpConverter->toString(enmState) + "]";
     257        {
     258            /* Assign default window title: */
     259            setWindowTitle(defaultWindowTitle());
     260        }
     261        else
     262        {
     263            /* Prepare full name: */
     264            QString strMachineName = machineName();
     265
     266            /* Append snapshot name: */
     267            ulong uSnapshotCount = 0;
     268            uimachine()->acquireSnapshotCount(uSnapshotCount);
     269            if (uSnapshotCount > 0)
     270            {
     271                QString strCurrentSnapshotName;
     272                uimachine()->acquireCurrentSnapshotName(strCurrentSnapshotName);
     273                strMachineName += " (" + strCurrentSnapshotName + ")";
     274            }
     275
     276            /* Append state name: */
     277            strMachineName += " [" + gpConverter->toString(enmState) + "]";
    274278
    275279#ifndef VBOX_WS_MAC
    276         /* Append user product name (besides macOS): */
    277         const QString strUserProductName = uimachine()->machineWindowNamePostfix();
    278         strMachineName += " - " + (strUserProductName.isEmpty() ? defaultWindowTitle() : strUserProductName);
     280            /* Append user product name (besides macOS): */
     281            const QString strUserProductName = uimachine()->machineWindowNamePostfix();
     282            strMachineName += " - " + (strUserProductName.isEmpty() ? defaultWindowTitle() : strUserProductName);
    279283#endif /* !VBOX_WS_MAC */
    280284
    281         /* Append screen number only if there are more than one present: */
    282         ulong cMonitorCount = 0;
    283         uimachine()->acquireMonitorCount(cMonitorCount);
    284         if (cMonitorCount > 1)
    285             strMachineName += QString(" : %1").arg(m_uScreenId + 1);
    286 
    287         /* Assign title finally: */
    288         setWindowTitle(strMachineName);
     285            /* Append screen number only if there are more than one present: */
     286            ulong cMonitorCount = 0;
     287            uimachine()->acquireMonitorCount(cMonitorCount);
     288            if (cMonitorCount > 1)
     289                strMachineName += QString(" : %1").arg(m_uScreenId + 1);
     290
     291            /* Assign title finally: */
     292            setWindowTitle(strMachineName);
     293        }
    289294    }
    290295}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h

    r98849 r99012  
    189189
    190190    /* Helpers: */
    191     const QString& defaultWindowTitle() const { return m_strWindowTitlePrefix; }
     191    QString defaultWindowTitle() const { return m_strWindowTitlePrefix; }
    192192    static Qt::Alignment viewAlignment(UIVisualStateType visualStateType);
    193193
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