VirtualBox

Changeset 53030 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Oct 10, 2014 2:45:53 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: Runtime UI rework/cleanup for 7115 (part #13): Machine-logic: Using cached stuff instead of acquiring it every time.

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

Legend:

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

    r52993 r53030  
    251251}
    252252
     253CMachine& UIMachineLogic::machine() const
     254{
     255    return uisession()->machine();
     256}
     257
     258CConsole& UIMachineLogic::console() const
     259{
     260    return uisession()->console();
     261}
     262
     263CDisplay& UIMachineLogic::display() const
     264{
     265    return uisession()->display();
     266}
     267
     268CGuest& UIMachineLogic::guest() const
     269{
     270    return uisession()->guest();
     271}
     272
     273CMouse& UIMachineLogic::mouse() const
     274{
     275    return uisession()->mouse();
     276}
     277
     278CKeyboard& UIMachineLogic::keyboard() const
     279{
     280    return uisession()->keyboard();
     281}
     282
     283CMachineDebugger& UIMachineLogic::debugger() const
     284{
     285    return uisession()->debugger();
     286}
     287
     288const QString& UIMachineLogic::machineName() const
     289{
     290    return uisession()->machineName();
     291}
     292
    253293UIMachineWindow* UIMachineLogic::mainMachineWindow() const
    254294{
     
    348388{
    349389    /* Warn the user about ACPI is not available if so: */
    350     CConsole console = session().GetConsole();
    351     if (!console.GetGuestEnteredACPIMode())
     390    if (!console().GetGuestEnteredACPIMode())
    352391        return popupCenter().cannotSendACPIToMachine(activeMachineWindow());
    353392
     
    431470            uisession()->setGuestResizeIgnored(true);
    432471            /* Get log-folder: */
    433             QString strLogFolder = session().GetMachine().GetLogFolder();
     472            QString strLogFolder = machine().GetLogFolder();
    434473            /* Take the screenshot for debugging purposes: */
    435474            takeScreenshot(strLogFolder + "/VBox.png", "png");
     
    581620    {
    582621        if (fIsAttached)
    583             msgCenter().cannotAttachUSBDevice(error, vboxGlobal().details(device), session().GetMachine().GetName());
     622            msgCenter().cannotAttachUSBDevice(error, vboxGlobal().details(device), machineName());
    584623        else
    585             msgCenter().cannotDetachUSBDevice(error, vboxGlobal().details(device), session().GetMachine().GetName());
     624            msgCenter().cannotDetachUSBDevice(error, vboxGlobal().details(device), machineName());
    586625    }
    587626}
     
    589628void UIMachineLogic::sltRuntimeError(bool fIsFatal, const QString &strErrorId, const QString &strMessage)
    590629{
    591     msgCenter().showRuntimeError(session().GetConsole(), fIsFatal, strErrorId, strMessage);
     630    msgCenter().showRuntimeError(console(), fIsFatal, strErrorId, strMessage);
    592631}
    593632
     
    10521091
    10531092    /* Monitor selection if there are more than one monitor */
    1054     int cGuestScreens = uisession()->session().GetMachine().GetMonitorCount();
     1093    int cGuestScreens = machine().GetMonitorCount();
    10551094    if (cGuestScreens > 1)
    10561095    {
     
    10781117
    10791118    /* Now the dock icon preview */
    1080     QString osTypeId = session().GetConsole().GetGuest().GetOSTypeId();
     1119    QString osTypeId = guest().GetOSTypeId();
    10811120    m_pDockIconPreview = new UIDockIconPreview(uisession(), vboxGlobal().vmGuestOSTypeIcon(osTypeId));
    10821121
     
    12661305void UIMachineLogic::sltTypeCAD()
    12671306{
    1268     CKeyboard keyboard = session().GetConsole().GetKeyboard();
    1269     Assert(!keyboard.isNull());
    1270     keyboard.PutCAD();
    1271     AssertWrapperOk(keyboard);
     1307    keyboard().PutCAD();
     1308    AssertWrapperOk(keyboard());
    12721309}
    12731310
     
    12751312void UIMachineLogic::sltTypeCABS()
    12761313{
    1277     CKeyboard keyboard = session().GetConsole().GetKeyboard();
    1278     Assert(!keyboard.isNull());
    1279     static QVector<LONG> aSequence(6);
    1280     aSequence[0] = 0x1d; /* Ctrl down */
    1281     aSequence[1] = 0x38; /* Alt down */
    1282     aSequence[2] = 0x0E; /* Backspace down */
    1283     aSequence[3] = 0x8E; /* Backspace up */
    1284     aSequence[4] = 0xb8; /* Alt up */
    1285     aSequence[5] = 0x9d; /* Ctrl up */
    1286     keyboard.PutScancodes(aSequence);
    1287     AssertWrapperOk(keyboard);
     1314    static QVector<LONG> sequence(6);
     1315    sequence[0] = 0x1d; /* Ctrl down */
     1316    sequence[1] = 0x38; /* Alt down */
     1317    sequence[2] = 0x0E; /* Backspace down */
     1318    sequence[3] = 0x8E; /* Backspace up */
     1319    sequence[4] = 0xb8; /* Alt up */
     1320    sequence[5] = 0x9d; /* Ctrl up */
     1321    keyboard().PutScancodes(sequence);
     1322    AssertWrapperOk(keyboard());
    12881323}
    12891324#endif /* Q_WS_X11 */
     
    13051340    }
    13061341
    1307     /* Get current machine: */
    1308     CMachine machine = session().GetMachine();
    1309 
    13101342    /* Create take-snapshot dialog: */
    13111343    QWidget *pDlgParent = windowManager().realParentWindow(activeMachineWindow());
    1312     QPointer<VBoxTakeSnapshotDlg> pDlg = new VBoxTakeSnapshotDlg(pDlgParent, machine);
     1344    QPointer<VBoxTakeSnapshotDlg> pDlg = new VBoxTakeSnapshotDlg(pDlgParent, machine());
    13131345    windowManager().registerNewParent(pDlg, pDlgParent);
    13141346
    13151347    /* Assign corresponding icon: */
    1316     QString strTypeId = machine.GetOSTypeId();
     1348    QString strTypeId = machine().GetOSTypeId();
    13171349    pDlg->mLbIcon->setPixmap(vboxGlobal().vmGuestOSTypeIcon(strTypeId));
    13181350
    13191351    /* Search for the max available filter index: */
    13201352    QString strNameTemplate = QApplication::translate("UIMachineLogic", "Snapshot %1");
    1321     int iMaxSnapshotIndex = searchMaxSnapshotIndex(machine, machine.FindSnapshot(QString()), strNameTemplate);
     1353    int iMaxSnapshotIndex = searchMaxSnapshotIndex(machine(), machine().FindSnapshot(QString()), strNameTemplate);
    13221354    pDlg->mLeName->setText(strNameTemplate.arg(++ iMaxSnapshotIndex));
    13231355
     
    13401372    {
    13411373        /* Prepare the take-snapshot progress: */
    1342         CConsole console = session().GetConsole();
    1343         CProgress progress = console.TakeSnapshot(strSnapshotName, strSnapshotDescription);
    1344         if (console.isOk())
     1374        CProgress progress = console().TakeSnapshot(strSnapshotName, strSnapshotDescription);
     1375        if (console().isOk())
    13451376        {
    13461377            /* Show the take-snapshot progress: */
    1347             msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_snapshot_create_90px.png");
     1378            msgCenter().showModalProgressDialog(progress, machineName(), ":/progress_snapshot_create_90px.png");
    13481379            if (!progress.isOk() || progress.GetResultCode() != 0)
    1349                 msgCenter().cannotTakeSnapshot(progress, machine.GetName());
     1380                msgCenter().cannotTakeSnapshot(progress, machineName());
    13501381        }
    13511382        else
    1352             msgCenter().cannotTakeSnapshot(console, machine.GetName());
     1383            msgCenter().cannotTakeSnapshot(console(), machineName());
    13531384    }
    13541385
     
    14051436
    14061437    /* Request the filename from the user. */
    1407     const CMachine &machine = session().GetMachine();
    1408     QFileInfo fi(machine.GetSettingsFilePath());
     1438    QFileInfo fi(machine().GetSettingsFilePath());
    14091439    QString strAbsolutePath(fi.absolutePath());
    14101440    QString strCompleteBaseName(fi.completeBaseName());
     
    14461476{
    14471477    /* Confirm/Reset current console: */
    1448     CMachine machine = session().GetMachine();
    1449     if (msgCenter().confirmResetMachine(machine.GetName()))
    1450         session().GetConsole().Reset();
     1478    if (msgCenter().confirmResetMachine(machineName()))
     1479        console().Reset();
    14511480
    14521481    /* TODO_NEW_CORE: On reset the additional screens didn't get a display
    14531482       update. Emulate this for now until it get fixed. */
    1454     ulong uMonitorCount = machine.GetMonitorCount();
     1483    ulong uMonitorCount = machine().GetMonitorCount();
    14551484    for (ulong uScreenId = 1; uScreenId < uMonitorCount; ++uScreenId)
    14561485        machineWindows().at(uScreenId)->update();
     
    14951524    }
    14961525
    1497     powerOff(session().GetMachine().GetSnapshotCount() > 0);
     1526    powerOff(machine().GetSnapshotCount() > 0);
    14981527}
    14991528
     
    15381567     * Its necessary to allow QObject hierarchy cleanup to delete this dialog if necessary: */
    15391568    QPointer<UISettingsDialogMachine> pDialog = new UISettingsDialogMachine(activeMachineWindow(),
    1540                                                                             session().GetMachine().GetId(),
     1569                                                                            machine().GetId(),
    15411570                                                                            strCategory, strControl);
    15421571    /* Executing VM settings window.
     
    15911620    AssertMsgReturnVoid(pAction, ("This slot should only be called by menu action!\n"));
    15921621
    1593     /* Current machine: */
    1594     const CMachine machine = session().GetMachine();
    15951622    /* Current mount-target: */
    15961623    const UIMediumTarget target = pAction->data().value<UIMediumTarget>();
    15971624
    15981625    /* Update current machine mount-target: */
    1599     vboxGlobal().updateMachineStorage(machine, target);
     1626    vboxGlobal().updateMachineStorage(machine(), target);
    16001627}
    16011628
     
    16091636    USBTarget target = pAction->data().value<USBTarget>();
    16101637
    1611     /* Get current console: */
    1612     CConsole console = session().GetConsole();
    1613 
    16141638    /* Attach USB device: */
    16151639    if (target.attach)
    16161640    {
    16171641        /* Try to attach corresponding device: */
    1618         console.AttachUSBDevice(target.id);
     1642        console().AttachUSBDevice(target.id);
    16191643        /* Check if console is OK: */
    1620         if (!console.isOk())
     1644        if (!console().isOk())
    16211645        {
    16221646            /* Get current host: */
     
    16271651            CUSBDevice device(hostDevice);
    16281652            /* Show a message about procedure failure: */
    1629             msgCenter().cannotAttachUSBDevice(console, vboxGlobal().details(device));
     1653            msgCenter().cannotAttachUSBDevice(console(), vboxGlobal().details(device));
    16301654        }
    16311655    }
     
    16341658    {
    16351659        /* Search the console for the corresponding USB device: */
    1636         CUSBDevice device = console.FindUSBDeviceById(target.id);
     1660        CUSBDevice device = console().FindUSBDeviceById(target.id);
    16371661        /* Try to detach corresponding device: */
    1638         console.DetachUSBDevice(target.id);
     1662        console().DetachUSBDevice(target.id);
    16391663        /* Check if console is OK: */
    1640         if (!console.isOk())
     1664        if (!console().isOk())
    16411665        {
    16421666            /* Show a message about procedure failure: */
    1643             msgCenter().cannotDetachUSBDevice(console, vboxGlobal().details(device));
     1667            msgCenter().cannotDetachUSBDevice(console(), vboxGlobal().details(device));
    16441668        }
    16451669    }
     
    16561680
    16571681    /* Get current emulated USB: */
    1658     const CConsole &console = session().GetConsole();
    1659     CEmulatedUSB dispatcher = console.GetEmulatedUSB();
     1682    CEmulatedUSB dispatcher = console().GetEmulatedUSB();
    16601683
    16611684    /* Attach webcam device: */
     
    16661689        /* Check if dispatcher is OK: */
    16671690        if (!dispatcher.isOk())
    1668             msgCenter().cannotAttachWebCam(dispatcher, target.name, console.GetMachine().GetName());
     1691            msgCenter().cannotAttachWebCam(dispatcher, target.name, machineName());
    16691692    }
    16701693    /* Detach webcam device: */
     
    16751698        /* Check if dispatcher is OK: */
    16761699        if (!dispatcher.isOk())
    1677             msgCenter().cannotDetachWebCam(dispatcher, target.name, console.GetMachine().GetName());
     1700            msgCenter().cannotDetachWebCam(dispatcher, target.name, machineName());
    16781701    }
    16791702}
     
    16831706    /* Assign new mode (without save): */
    16841707    KClipboardMode mode = pAction->data().value<KClipboardMode>();
    1685     session().GetMachine().SetClipboardMode(mode);
     1708    machine().SetClipboardMode(mode);
    16861709}
    16871710
     
    16931716    AssertReturnVoid(pAction);
    16941717
    1695     /* Get and check current machine: */
    1696     CMachine machine = session().GetMachine();
    1697     AssertReturnVoid(!machine.isNull());
    1698 
    16991718    /* Get operation target: */
    1700     CNetworkAdapter adapter = machine.GetNetworkAdapter((ULONG)pAction->property("slot").toInt());
    1701     AssertReturnVoid(machine.isOk() && !adapter.isNull());
     1719    CNetworkAdapter adapter = machine().GetNetworkAdapter((ULONG)pAction->property("slot").toInt());
     1720    AssertReturnVoid(machine().isOk() && !adapter.isNull());
    17021721
    17031722    /* Connect/disconnect cable to/from target: */
    17041723    adapter.SetCableConnected(!adapter.GetCableConnected());
    1705     machine.SaveSettings();
    1706     if (!machine.isOk())
    1707         msgCenter().cannotSaveMachineSettings(machine);
     1724    machine().SaveSettings();
     1725    if (!machine().isOk())
     1726        msgCenter().cannotSaveMachineSettings(machine());
    17081727}
    17091728
     
    17121731    /* Assign new mode (without save): */
    17131732    KDnDMode mode = pAction->data().value<KDnDMode>();
    1714     session().GetMachine().SetDnDMode(mode);
     1733    machine().SetDnDMode(mode);
    17151734}
    17161735
     
    17221741
    17231742    /* Access VRDE server: */
    1724     CMachine machine = session().GetMachine();
    1725     CVRDEServer server = machine.GetVRDEServer();
     1743    CVRDEServer server = machine().GetVRDEServer();
    17261744    AssertMsg(!server.isNull(), ("VRDE server should NOT be null!\n"));
    1727     if (!machine.isOk() || server.isNull())
     1745    if (!machine().isOk() || server.isNull())
    17281746        return;
    17291747
     
    17411759        {
    17421760            /* Save machine-settings: */
    1743             machine.SaveSettings();
     1761            machine().SaveSettings();
    17441762            /* Machine still OK? */
    1745             if (!machine.isOk())
     1763            if (!machine().isOk())
    17461764            {
    17471765                /* Notify about the error: */
    1748                 msgCenter().cannotSaveMachineSettings(machine);
     1766                msgCenter().cannotSaveMachineSettings(machine());
    17491767                /* Make sure action is updated! */
    17501768                uisession()->updateStatusVRDE();
     
    17541772        {
    17551773            /* Notify about the error: */
    1756             msgCenter().cannotToggleVRDEServer(server, machine.GetName(), fEnabled);
     1774            msgCenter().cannotToggleVRDEServer(server, machineName(), fEnabled);
    17571775            /* Make sure action is updated! */
    17581776            uisession()->updateStatusVRDE();
     
    17671785        return;
    17681786
    1769     /* Access machine: */
    1770     CMachine machine = session().GetMachine();
    1771     AssertMsg(!machine.isNull(), ("Machine should NOT be null!\n"));
    1772     if (machine.isNull())
    1773         return;
    1774 
    17751787    /* Make sure something had changed: */
    1776     if (machine.GetVideoCaptureEnabled() == static_cast<BOOL>(fEnabled))
     1788    if (machine().GetVideoCaptureEnabled() == static_cast<BOOL>(fEnabled))
    17771789        return;
    17781790
    17791791    /* Update Video Capture state: */
    1780     AssertMsg(machine.isOk(), ("Machine should be OK!\n"));
    1781     machine.SetVideoCaptureEnabled(fEnabled);
     1792    AssertMsg(machine().isOk(), ("Machine should be OK!\n"));
     1793    machine().SetVideoCaptureEnabled(fEnabled);
    17821794    /* Machine is not OK? */
    1783     if (!machine.isOk())
     1795    if (!machine().isOk())
    17841796    {
    17851797        /* Notify about the error: */
    1786         msgCenter().cannotToggleVideoCapture(machine, fEnabled);
     1798        msgCenter().cannotToggleVideoCapture(machine(), fEnabled);
    17871799        /* Make sure action is updated! */
    17881800        uisession()->updateStatusVideoCapture();
     
    17921804    {
    17931805        /* Save machine-settings: */
    1794         machine.SaveSettings();
     1806        machine().SaveSettings();
    17951807        /* Machine is not OK? */
    1796         if (!machine.isOk())
     1808        if (!machine().isOk())
    17971809        {
    17981810            /* Notify about the error: */
    1799             msgCenter().cannotSaveMachineSettings(machine);
     1811            msgCenter().cannotSaveMachineSettings(machine());
    18001812            /* Make sure action is updated! */
    18011813            uisession()->updateStatusVideoCapture();
     
    18781890{
    18791891    NOREF(fState);
    1880     CConsole console = session().GetConsole();
    1881     if (console.isOk())
    1882     {
    1883         CMachineDebugger cdebugger = console.GetDebugger();
    1884         if (console.isOk())
    1885             cdebugger.SetLogEnabled(fState);
    1886     }
     1892    if (!debugger().isNull() && debugger().isOk())
     1893        debugger().SetLogEnabled(fState);
    18871894}
    18881895
     
    18901897{
    18911898    /* Show VM Log Viewer: */
    1892     UIVMLogViewer::showLogViewerFor(activeMachineWindow(), session().GetMachine());
     1899    UIVMLogViewer::showLogViewerFor(activeMachineWindow(), machine());
    18931900}
    18941901
     
    18981905void UIMachineLogic::sltDockPreviewModeChanged(QAction *pAction)
    18991906{
    1900     CMachine machine = session().GetMachine();
    1901     if (!machine.isNull())
    1902     {
    1903         bool fEnabled = pAction != actionPool()->action(UIActionIndexRT_M_Dock_M_DockSettings_T_DisableMonitor);
    1904         gEDataManager->setRealtimeDockIconUpdateEnabled(fEnabled, vboxGlobal().managedVMUuid());
    1905         updateDockOverlay();
    1906     }
     1907    bool fEnabled = pAction != actionPool()->action(UIActionIndexRT_M_Dock_M_DockSettings_T_DisableMonitor);
     1908    gEDataManager->setRealtimeDockIconUpdateEnabled(fEnabled, vboxGlobal().managedVMUuid());
     1909    updateDockOverlay();
    19071910}
    19081911
    19091912void UIMachineLogic::sltDockPreviewMonitorChanged(QAction *pAction)
    19101913{
    1911     CMachine machine = session().GetMachine();
    1912     if (!machine.isNull())
    1913     {
    1914         gEDataManager->setRealtimeDockIconUpdateMonitor(pAction->data().toInt(), vboxGlobal().managedVMUuid());
    1915         updateDockOverlay();
    1916     }
     1914    gEDataManager->setRealtimeDockIconUpdateMonitor(pAction->data().toInt(), vboxGlobal().managedVMUuid());
     1915    updateDockOverlay();
    19171916}
    19181917
     
    19251924        {
    19261925            m_pDockPreviewSelectMonitorGroup->setEnabled(fEnabled);
    1927             CMachine machine = session().GetMachine();
    19281926            m_DockIconPreviewMonitor = qMin(gEDataManager->realtimeDockIconUpdateMonitor(vboxGlobal().managedVMUuid()),
    1929                                             (int)machine.GetMonitorCount() - 1);
     1927                                            (int)machine().GetMonitorCount() - 1);
    19301928        }
    19311929        /* Resize the dock icon in the case the preview monitor has changed. */
     
    19431941//    printf("%s: UIMachineLogic: sltSwitchKeyboardLedsToGuestLeds called, machine name is {%s}\n",
    19441942//           strDt.toAscii().constData(),
    1945 //           session().GetMachine().GetName().toAscii().constData());
     1943//           machineName().toAscii().constData());
    19461944
    19471945    /* Here we have to store host LED lock states. */
     
    19741972//    printf("%s: UIMachineLogic: sltSwitchKeyboardLedsToPreviousLeds called, machine name is {%s}\n",
    19751973//           strDt.toAscii().constData(),
    1976 //           session().GetMachine().GetName().toAscii().constData());
     1974//           machineName().toAscii().constData());
    19771975
    19781976    if (!isHidLedsSyncEnabled())
     
    20192017
    20202018    /* Prepare/fill all storage menus: */
    2021     const CMachine machine = session().GetMachine();
    2022     foreach (const CMediumAttachment &attachment, machine.GetMediumAttachments())
     2019    foreach (const CMediumAttachment &attachment, machine().GetMediumAttachments())
    20232020    {
    20242021        /* Current controller: */
    2025         const CStorageController controller = machine.GetStorageControllerByName(attachment.GetController());
     2022        const CStorageController controller = machine().GetStorageControllerByName(attachment.GetController());
    20262023        /* If controller present and device-type correct: */
    20272024        if (!controller.isNull() && attachment.GetType() == deviceType)
     
    20562053            vboxGlobal().prepareStorageMenu(*pStorageMenu,
    20572054                                            this, SLOT(sltMountStorageMedium()),
    2058                                             machine, strControllerName, storageSlot);
     2055                                            machine(), strControllerName, storageSlot);
    20592056        }
    20602057    }
     
    20632060void UIMachineLogic::updateMenuDevicesNetwork(QMenu *pMenu)
    20642061{
    2065     /* Get and check current machine: */
    2066     const CMachine machine = session().GetMachine();
    2067     AssertReturnVoid(!machine.isNull());
    2068 
    20692062    /* Determine how many adapters we should display: */
    2070     const KChipsetType chipsetType = machine.GetChipsetType();
     2063    const KChipsetType chipsetType = machine().GetChipsetType();
    20712064    const ULONG uCount = qMin((ULONG)4, vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(chipsetType));
    20722065
     
    20762069    {
    20772070        /* Get and check iterated adapter: */
    2078         const CNetworkAdapter adapter = machine.GetNetworkAdapter(uSlot);
    2079         AssertReturnVoid(machine.isOk() && !adapter.isNull());
     2071        const CNetworkAdapter adapter = machine().GetNetworkAdapter(uSlot);
     2072        AssertReturnVoid(machine().isOk() && !adapter.isNull());
    20802073
    20812074        /* Skip disabled adapters: */
     
    21362129
    21372130            /* Check if that USB device was already attached to this session: */
    2138             CConsole console = session().GetConsole();
    2139             const CUSBDevice attachedDevice = console.FindUSBDeviceById(device.GetId());
     2131            const CUSBDevice attachedDevice = console().FindUSBDeviceById(device.GetId());
    21402132            pAttachUSBAction->setChecked(!attachedDevice.isNull());
    21412133            pAttachUSBAction->setEnabled(hostDevice.GetState() != KUSBDeviceState_Unavailable);
     
    21712163    {
    21722164        /* Populate menu with host webcams: */
    2173         const QVector<QString> attachedWebcamPaths = session().GetConsole().GetEmulatedUSB().GetWebcams();
     2165        const QVector<QString> attachedWebcamPaths = console().GetEmulatedUSB().GetWebcams();
    21742166        foreach (const CHostVideoInputDevice &webcam, webcams)
    21752167        {
     
    22062198            pAction->setData(QVariant::fromValue(mode));
    22072199            pAction->setCheckable(true);
    2208             pAction->setChecked(session().GetMachine().GetClipboardMode() == mode);
     2200            pAction->setChecked(machine().GetClipboardMode() == mode);
    22092201        }
    22102202        connect(m_pSharedClipboardActions, SIGNAL(triggered(QAction*)),
     
    22142206    else
    22152207        foreach (QAction *pAction, m_pSharedClipboardActions->actions())
    2216             if (pAction->data().value<KClipboardMode>() == session().GetMachine().GetClipboardMode())
     2208            if (pAction->data().value<KClipboardMode>() == machine().GetClipboardMode())
    22172209                pAction->setChecked(true);
    22182210}
     
    22312223            pAction->setData(QVariant::fromValue(mode));
    22322224            pAction->setCheckable(true);
    2233             pAction->setChecked(session().GetMachine().GetDnDMode() == mode);
     2225            pAction->setChecked(machine().GetDnDMode() == mode);
    22342226        }
    22352227        connect(m_pDragAndDropActions, SIGNAL(triggered(QAction*)),
     
    22392231    else
    22402232        foreach (QAction *pAction, m_pDragAndDropActions->actions())
    2241             if (pAction->data().value<KDnDMode>() == session().GetMachine().GetDnDMode())
     2233            if (pAction->data().value<KDnDMode>() == machine().GetDnDMode())
    22422234                pAction->setChecked(true);
    22432235}
     
    22492241    bool fEnabled = false;
    22502242    bool fChecked = false;
    2251     const CConsole console = session().GetConsole();
    2252     if (console.isOk())
    2253     {
    2254         const CMachineDebugger cdebugger = console.GetDebugger();
    2255         if (console.isOk())
    2256         {
    2257             fEnabled = true;
    2258             fChecked = cdebugger.GetLogEnabled() != FALSE;
    2259         }
     2243    if (!debugger().isNull() && debugger().isOk())
     2244    {
     2245        fEnabled = true;
     2246        fChecked = debugger().GetLogEnabled() != FALSE;
    22602247    }
    22612248    if (fEnabled != actionPool()->action(UIActionIndexRT_M_Debug_T_Logging)->isEnabled())
     
    23282315{
    23292316    /* Get console: */
    2330     const CConsole &console = session().GetConsole();
    2331     CDisplay display = console.GetDisplay();
    2332     const int cGuestScreens = uisession()->session().GetMachine().GetMonitorCount();
     2317    const int cGuestScreens = machine().GetMonitorCount();
    23332318    QList<QImage> images;
    23342319    ULONG uMaxWidth  = 0;
     
    23442329        LONG yOrigin = 0;
    23452330        KGuestMonitorStatus monitorStatus = KGuestMonitorStatus_Enabled;
    2346         display.GetScreenResolution(i, width, height, bpp, xOrigin, yOrigin, monitorStatus);
     2331        display().GetScreenResolution(i, width, height, bpp, xOrigin, yOrigin, monitorStatus);
    23472332        uMaxWidth  += width;
    23482333        uMaxHeight  = RT_MAX(uMaxHeight, height);
    23492334        QImage shot = QImage(width, height, QImage::Format_RGB32);
    2350         display.TakeScreenShot(i, shot.bits(), shot.width(), shot.height(), KBitmapFormat_BGR0);
     2335        display().TakeScreenShot(i, shot.bits(), shot.width(), shot.height(), KBitmapFormat_BGR0);
    23512336        images << shot;
    23522337    }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r52894 r53030  
    4040class CSession;
    4141class CMachine;
     42class CConsole;
     43class CDisplay;
     44class CGuest;
     45class CMouse;
     46class CKeyboard;
     47class CMachineDebugger;
    4248class CSnapshot;
    4349class CUSBDevice;
     
    8187    UISession* uisession() const { return m_pSession; }
    8288    UIActionPool* actionPool() const;
     89
     90    /** Returns the session reference. */
    8391    CSession& session() const;
     92    /** Returns the session's machine reference. */
     93    CMachine& machine() const;
     94    /** Returns the session's console reference. */
     95    CConsole& console() const;
     96    /** Returns the console's display reference. */
     97    CDisplay& display() const;
     98    /** Returns the console's guest reference. */
     99    CGuest& guest() const;
     100    /** Returns the console's mouse reference. */
     101    CMouse& mouse() const;
     102    /** Returns the console's keyboard reference. */
     103    CKeyboard& keyboard() const;
     104    /** Returns the console's debugger reference. */
     105    CMachineDebugger& debugger() const;
     106
     107    /** Returns the machine name. */
     108    const QString& machineName() const;
     109
    84110    UIVisualStateType visualStateType() const { return m_visualStateType; }
    85111    const QList<UIMachineWindow*>& machineWindows() const { return m_machineWindowsList; }
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