VirtualBox

Changeset 41108 in vbox


Ignore:
Timestamp:
May 2, 2012 12:43:07 AM (13 years ago)
Author:
vboxsync
Message:

FE/Qt: Runtime UI: Machine logic refactoring/cleanup (part 2).

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

Legend:

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

    r41107 r41108  
    215215}
    216216
    217 UIMachineWindow* UIMachineLogic::defaultMachineWindow() const
     217UIMachineWindow* UIMachineLogic::activeMachineWindow() const
    218218{
    219219    /* Return null if windows are not created yet: */
     
    221221        return 0;
    222222
    223     /* Select main machine window by default: */
    224     UIMachineWindow *pWindowToPropose = mainMachineWindow();
    225 
    226     /* Check if there is active window present: */
    227     foreach (UIMachineWindow *pWindowToCheck, machineWindows())
    228     {
    229         if (pWindowToCheck->isActiveWindow())
    230         {
    231             pWindowToPropose = pWindowToCheck;
    232             break;
    233         }
    234     }
    235 
    236     /* Return default machine window: */
    237     return pWindowToPropose;
     223    /* Check if there is an active window present: */
     224    for (int i = 0; i < machineWindows().size(); ++i)
     225    {
     226        UIMachineWindow *pIteratedWindow = machineWindows()[i];
     227        if (pIteratedWindow->isActiveWindow())
     228            return pIteratedWindow;
     229    }
     230
     231    /* Return main machine window: */
     232    return mainMachineWindow();
    238233}
    239234
     
    409404void UIMachineLogic::sltShowWindows()
    410405{
    411     for (int i=0; i < m_machineWindowsList.size(); ++i)
    412     {
    413         UIMachineWindow *pMachineWindow = m_machineWindowsList.at(i);
     406    for (int i=0; i < machineWindows().size(); ++i)
     407    {
     408        UIMachineWindow *pMachineWindow = machineWindows().at(i);
    414409        /* Dunno what Qt thinks a window that has minimized to the dock
    415410         * should be - it is not hidden, neither is it minimized. OTOH it is
     
    721716    /* Now the dock icon preview */
    722717    QString osTypeId = session().GetConsole().GetGuest().GetOSTypeId();
    723     m_pDockIconPreview = new UIDockIconPreview(m_pSession, vboxGlobal().vmGuestOSTypeIcon(osTypeId));
     718    m_pDockIconPreview = new UIDockIconPreview(uisession(), vboxGlobal().vmGuestOSTypeIcon(osTypeId));
    724719
    725720    QString strTest = session().GetMachine().GetExtraData(VBoxDefs::GUI_RealtimeDockIconUpdateEnabled).toLower();
     
    861856
    862857    /* Disable/Enable mouse-integration for all view(s): */
    863     m_pMouseHandler->setMouseIntegrationEnabled(!fOff);
     858    mouseHandler()->setMouseIntegrationEnabled(!fOff);
    864859}
    865860
     
    907902    CMachine machine = session().GetMachine();
    908903
    909     VBoxTakeSnapshotDlg dlg(defaultMachineWindow(), machine);
     904    VBoxTakeSnapshotDlg dlg(activeMachineWindow(), machine);
    910905
    911906    QString strTypeId = machine.GetOSTypeId();
     
    978973    QString strFilename = QIFileDialog::getSaveFileName(strStart,
    979974                                                        filters.join(";;"),
    980                                                         defaultMachineWindow(),
     975                                                        activeMachineWindow(),
    981976                                                        tr("Select a filename for the screenshot ..."),
    982977                                                        &strFilter,
     
    10361031        return;
    10371032
    1038     /* Propose to close default machine window: */
    1039     defaultMachineWindow()->sltTryClose();
     1033    /* Propose to close active machine window: */
     1034    activeMachineWindow()->sltTryClose();
    10401035}
    10411036
     
    10471042
    10481043    /* Create and execute current VM settings dialog: */
    1049     UISettingsDialogMachine dlg(defaultMachineWindow(),
    1050                                 session().GetMachine().GetId(), strCategory, QString());
     1044    UISettingsDialogMachine dlg(activeMachineWindow(), session().GetMachine().GetId(), strCategory, QString());
    10511045    dlg.execute();
    10521046}
     
    10621056    /* Do not process if additions are not loaded! */
    10631057    if (!uisession()->isGuestAdditionsActive())
    1064         msgCenter().remindAboutGuestAdditionsAreNotActive(defaultMachineWindow());
     1058        msgCenter().remindAboutGuestAdditionsAreNotActive(activeMachineWindow());
    10651059
    10661060    /* Open VM settings : Shared folders page: */
     
    13151309        /* Call for file-open window: */
    13161310        QString strMachineFolder(QFileInfo(machine.GetSettingsFilePath()).absolutePath());
    1317         QString strMediumId = vboxGlobal().openMediumWithFileOpenDialog(target.type, defaultMachineWindow(),
     1311        QString strMediumId = vboxGlobal().openMediumWithFileOpenDialog(target.type, activeMachineWindow(),
    13181312                                                                        strMachineFolder);
    1319         defaultMachineWindow()->machineView()->setFocus();
     1313        activeMachineWindow()->machineView()->setFocus();
    13201314        if (!strMediumId.isNull())
    13211315            newId = strMediumId;
     
    16111605    if (dbgCreated())
    16121606    {
    1613         m_pKeyboardHandler->setDebuggerActive();
     1607        keyboardHandler()->setDebuggerActive();
    16141608        m_pDbgGuiVT->pfnShowStatistics(m_pDbgGui);
    16151609    }
     
    16201614    if (dbgCreated())
    16211615    {
    1622         m_pKeyboardHandler->setDebuggerActive();
     1616        keyboardHandler()->setDebuggerActive();
    16231617        m_pDbgGuiVT->pfnShowCommandLine(m_pDbgGui);
    16241618    }
     
    16401634{
    16411635    /* Show VM Log Viewer: */
    1642     UIVMLogViewer::showLogViewerFor(mainMachineWindow(), session().GetMachine());
     1636    UIVMLogViewer::showLogViewerFor(activeMachineWindow(), session().GetMachine());
    16431637}
    16441638
     
    16481642void UIMachineLogic::sltDockPreviewModeChanged(QAction *pAction)
    16491643{
    1650     CMachine machine = m_pSession->session().GetMachine();
     1644    CMachine machine = session().GetMachine();
    16511645    if (!machine.isNull())
    16521646    {
     
    16621656void UIMachineLogic::sltDockPreviewMonitorChanged(QAction *pAction)
    16631657{
    1664     CMachine machine = m_pSession->session().GetMachine();
     1658    CMachine machine = session().GetMachine();
    16651659    if (!machine.isNull())
    16661660    {
     
    17771771                || m_pDbgGuiVT->u32EndVersion == m_pDbgGuiVT->u32Version)
    17781772            {
    1779                 m_pDbgGuiVT->pfnSetParent(m_pDbgGui, defaultMachineWindow());
     1773                m_pDbgGuiVT->pfnSetParent(m_pDbgGui, activeMachineWindow());
    17801774                m_pDbgGuiVT->pfnSetMenu(m_pDbgGui, gActionPool->action(UIActionIndexRuntime_Menu_Debug));
    17811775                dbgAdjustRelativePos();
     
    18111805    if (m_pDbgGui)
    18121806    {
    1813         QRect rct = defaultMachineWindow()->frameGeometry();
     1807        QRect rct = activeMachineWindow()->frameGeometry();
    18141808        m_pDbgGuiVT->pfnAdjustRelativePos(m_pDbgGui, rct.x(), rct.y(), rct.width(), rct.height());
    18151809    }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r41064 r41108  
    2020#define __UIMachineLogic_h__
    2121
    22 /* Local includes */
     22/* Local includes: */
    2323#include "UIMachineDefs.h"
    2424#include <QIWithRetranslateUI.h>
     
    2727#endif /* VBOX_WITH_DEBUGGER_GUI */
    2828
    29 /* Global forwards */
     29/* Forward declarations: */
    3030class QAction;
    3131class QActionGroup;
    32 
    33 /* Local forwards */
    3432class CSession;
    3533class CMachine;
     
    7068    UIMouseHandler* mouseHandler() const { return m_pMouseHandler; }
    7169    UIMachineWindow* mainMachineWindow() const;
    72     UIMachineWindow* defaultMachineWindow() const;
     70    UIMachineWindow* activeMachineWindow() const;
    7371
    7472    /* Maintenance getters/setters: */
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