VirtualBox

Changeset 71374 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 19, 2018 3:19:12 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9049: Runtime UI: Cleanup for main/active machine-window usage.

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

Legend:

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

    r69500 r71374  
    132132QWidget* UIMachine::activeWindow() const
    133133{
    134     if (machineLogic() &&  machineLogic()->activeMachineWindow())
    135         return machineLogic()->activeMachineWindow();
    136     return 0;
     134    return   machineLogic() && machineLogic()->activeMachineWindow()
     135           ? machineLogic()->activeMachineWindow()
     136           : 0;
    137137}
    138138
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r70723 r71374  
    196196    prepareMenu();
    197197
    198     /* Prepare machine window(s): */
     198    /* Prepare machine-window(s): */
    199199    prepareMachineWindows();
    200200
     
    236236    cleanupMenu();
    237237
    238     /* Cleanup machine window(s): */
     238    /* Cleanup machine-window(s): */
    239239    cleanupMachineWindows();
    240240
     
    316316    if (!isMachineWindowsCreated())
    317317        return 0;
    318     /* First machine-window otherwise: */
    319     return machineWindows().first();
     318
     319    /* First machine-window by default: */
     320    return machineWindows().value(0);
    320321}
    321322
    322323UIMachineWindow* UIMachineLogic::activeMachineWindow() const
    323324{
    324     /* Return null if windows are not created yet: */
     325    /* Null if machine-window(s) not yet created: */
    325326    if (!isMachineWindowsCreated())
    326327        return 0;
     
    334335    }
    335336
    336     /* Return main machine window: */
     337    /* Main machine-window by default: */
    337338    return mainMachineWindow();
    338339}
     
    17401741
    17411742    /* Invoke VM information dialog: */
    1742     UIVMInformationDialog::invoke(mainMachineWindow());
     1743    UIVMInformationDialog::invoke(activeMachineWindow());
    17431744}
    17441745
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp

    r71368 r71374  
    260260}
    261261
    262 void UIMachineWindow::showEvent(QShowEvent *pShowEvent)
    263 {
    264     /* Call to base class: */
    265     QMainWindow::showEvent(pShowEvent);
     262void UIMachineWindow::showEvent(QShowEvent *pEvent)
     263{
     264    /* Call to base-class: */
     265    QMainWindow::showEvent(pEvent);
    266266
    267267    /* Update appearance for indicator-pool: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h

    r69500 r71374  
    3636class QCloseEvent;
    3737class QGridLayout;
     38class QShowEvent;
    3839class QSpacerItem;
    3940class UIActionPool;
     
    125126    void retranslateUi();
    126127
    127     /** Show event handler. */
    128     void showEvent(QShowEvent *pShowEvent);
     128    /** Handles show @a pEvent. */
     129    virtual void showEvent(QShowEvent *pEvent) /* override */;
    129130
    130131    /** Close event handler. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r71368 r71374  
    167167    /* Notify user about mouse&keyboard auto-capturing: */
    168168    if (gEDataManager->autoCaptureEnabled())
    169         popupCenter().remindAboutAutoCapture(machineLogic()->activeMachineWindow());
     169        popupCenter().remindAboutAutoCapture(activeMachineWindow());
    170170
    171171    /* Check if we are in teleportation waiting mode.
     
    501501{
    502502    return mainMachineWindow()->winId();
     503}
     504
     505UIMachineWindow *UISession::activeMachineWindow() const
     506{
     507    return machineLogic() ? machineLogic()->activeMachineWindow() : 0;
    503508}
    504509
     
    17821787    /// @todo In case of multi-monitor setup check whether device-pixel-ratio and cursor are screen specific.
    17831788    /* Get screen-id of main-window: */
    1784     const ulong uScreenID = machineLogic()->activeMachineWindow()->screenId();
     1789    const ulong uScreenID = activeMachineWindow()->screenId();
    17851790    /* Get device-pixel-ratio: */
    17861791    const double dDevicePixelRatio = frameBuffer(uScreenID)->devicePixelRatio();
     
    17961801    /// @todo In case of multi-monitor setup check whether device-pixel-ratio and cursor are screen specific.
    17971802    /* Get screen-id of main-window: */
    1798     const ulong uScreenID = machineLogic()->activeMachineWindow()->screenId();
     1803    const ulong uScreenID = activeMachineWindow()->screenId();
    17991804    /* Get device-pixel-ratio: */
    18001805    const double dDevicePixelRatio = frameBuffer(uScreenID)->devicePixelRatio();
     
    19081913        if (!comVBox.isOk() || comMedium.isNull())
    19091914        {
    1910             popupCenter().cannotOpenMedium(machineLogic()->activeMachineWindow(), comVBox, enmMediumType, strMediumName);
     1915            popupCenter().cannotOpenMedium(activeMachineWindow(), comVBox, enmMediumType, strMediumName);
    19111916            return false;
    19121917        }
     
    19511956    if (sStorageSlots.isEmpty())
    19521957    {
    1953         popupCenter().cannotMountImage(machineLogic()->activeMachineWindow(), machineName(), strMediumName);
     1958        popupCenter().cannotMountImage(activeMachineWindow(), machineName(), strMediumName);
    19541959        return false;
    19551960    }
     
    19671972    if (!machine().isOk())
    19681973    {
    1969         msgCenter().cannotRemountMedium(machine(), guiMedium, true /* mount? */, false /* retry? */, mainMachineWindow());
     1974        msgCenter().cannotRemountMedium(machine(), guiMedium, true /* mount? */, false /* retry? */, activeMachineWindow());
    19701975        return false;
    19711976    }
     
    19771982    if (!machine().isOk())
    19781983    {
    1979         popupCenter().cannotSaveMachineSettings(machineLogic()->activeMachineWindow(), machine());
     1984        popupCenter().cannotSaveMachineSettings(activeMachineWindow(), machine());
    19801985        return false;
    19811986    }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r69858 r71374  
    4545class UIMachine;
    4646class UIMachineLogic;
     47class UIMachineWindow;
    4748class UIActionPool;
    4849class CUSBDevice;
     
    126127    QWidget* mainMachineWindow() const;
    127128    WId mainMachineWindowId() const;
     129    UIMachineWindow *activeMachineWindow() const;
    128130    QCursor cursor() const { return m_cursor; }
    129131
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