VirtualBox

Changeset 44832 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 26, 2013 4:11:20 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: Multi-screen support: Cleanup/rework multi-screen layout (part 4).

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

Legend:

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

    r44831 r44832  
    120120    }
    121121
    122     /* Get the list of all view-menu actions: */
    123     QList<QAction*> viewMenuActions = gActionPool->action(UIActionIndexRuntime_Menu_View)->menu()->actions();
    124     /* Get the list of all view related actions: */
    125     QList<QAction*> viewActions;
    126     for (int i = 0; i < viewMenuActions.size(); ++i)
    127     {
    128         if (viewMenuActions[i]->data().toBool())
    129             viewActions << viewMenuActions[i];
    130     }
    131     /* Mark currently chosen action: */
    132     for (int i = 0; i < viewActions.size(); ++i)
    133     {
    134         int iHostScreen = m_pScreenMap->value(i);
    135         QList<QAction*> screenActions = viewActions.at(i)->menu()->actions();
    136         for (int w = 0; w < screenActions.size(); ++w)
    137         {
    138             QAction *pTmpAction = screenActions.at(w);
    139             pTmpAction->blockSignals(true);
    140             pTmpAction->setChecked(RT_HIWORD(pTmpAction->data().toInt()) == iHostScreen);
    141             pTmpAction->blockSignals(false);
    142         }
    143     }
     122    /* Update menu actions: */
     123    updateMenuActions(false);
    144124}
    145125
     
    224204    }
    225205
    226     /* Get the list of all view-menu actions: */
    227     QList<QAction*> viewMenuActions = gActionPool->action(UIActionIndexRuntime_Menu_View)->menu()->actions();
    228     /* Get the list of all view related actions: */
    229     QList<QAction*> viewActions;
    230     for (int i = 0; i < viewMenuActions.size(); ++i)
    231     {
    232         if (viewMenuActions[i]->data().toBool())
    233             viewActions << viewMenuActions[i];
    234     }
    235     /* Update the menu items. Even if we can't switch we have to revert the menu items. */
    236     for (int i = 0; i < viewActions.size(); ++i)
    237     {
    238         int iHostScreen = m_pScreenMap->value(i);
    239         machine.SetExtraData(QString("%1%2").arg(GUI_VirtualScreenToHostScreen).arg(i), QString::number(iHostScreen));
    240         QList<QAction*> screenActions = viewActions.at(i)->menu()->actions();
    241         for (int w = 0; w < screenActions.size(); ++w)
    242         {
    243             QAction *pTmpAction = screenActions.at(w);
    244             pTmpAction->blockSignals(true);
    245             pTmpAction->setChecked(RT_HIWORD(pTmpAction->data().toInt()) == iHostScreen);
    246             pTmpAction->blockSignals(false);
    247         }
    248     }
     206    /* Update menu actions: */
     207    updateMenuActions(true);
    249208
    250209    /* On success inform the observer. */
     
    309268}
    310269
     270void UIMultiScreenLayout::updateMenuActions(bool fWithSave)
     271{
     272    /* Get the list of all view-menu actions: */
     273    QList<QAction*> viewMenuActions = gActionPool->action(UIActionIndexRuntime_Menu_View)->menu()->actions();
     274    /* Get the list of all view related actions: */
     275    QList<QAction*> viewActions;
     276    for (int i = 0; i < viewMenuActions.size(); ++i)
     277        if (viewMenuActions[i]->data().toBool())
     278            viewActions << viewMenuActions[i];
     279    /* Update view actions: */
     280    CMachine machine = m_pMachineLogic->session().GetMachine();
     281    for (int i = 0; i < viewActions.size(); ++i)
     282    {
     283        int iHostScreen = m_pScreenMap->value(i);
     284        if (fWithSave)
     285            machine.SetExtraData(QString("%1%2").arg(GUI_VirtualScreenToHostScreen).arg(i), QString::number(iHostScreen));
     286        QList<QAction*> screenActions = viewActions.at(i)->menu()->actions();
     287        /* Update screen actions: */
     288        for (int j = 0; j < screenActions.size(); ++j)
     289        {
     290            QAction *pTmpAction = screenActions.at(j);
     291            pTmpAction->blockSignals(true);
     292            pTmpAction->setChecked(RT_HIWORD(pTmpAction->data().toInt()) == iHostScreen);
     293            pTmpAction->blockSignals(false);
     294        }
     295    }
     296}
     297
    311298quint64 UIMultiScreenLayout::memoryRequirements(const QMap<int, int> *pScreenLayout) const
    312299{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.h

    r44831 r44832  
    7474
    7575    /* Other helpers: */
     76    void updateMenuActions(bool fWithSave);
    7677    quint64 memoryRequirements(const QMap<int, int> *pScreenLayout) const;
    7778
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