VirtualBox

Changeset 51569 in vbox


Ignore:
Timestamp:
Jun 6, 2014 3:23:18 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
94249
Message:

FE/Qt: 6660: Advanced extra-data management framework: Integrate GUI_VirtualScreenToHostScreen.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r51565 r51569  
    826826}
    827827
     828int UIExtraDataManager::hostScreenForPassedGuestScreen(int iGuestScreenIndex, const QString &strID)
     829{
     830    /* Choose corresponding key: */
     831    const QString strKey = extraDataKeyPerScreen(GUI_VirtualScreenToHostScreen, iGuestScreenIndex, true);
     832
     833    /* Load value and convert it to index: */
     834    const QString strValue = extraDataString(strKey, strID);
     835    bool fOk = false;
     836    const int iHostScreenIndex = strValue.toULong(&fOk);
     837
     838    /* Return corresponding index: */
     839    return fOk ? iHostScreenIndex : -1;
     840}
     841
     842void UIExtraDataManager::setHostScreenForPassedGuestScreen(int iGuestScreenIndex, int iHostScreenIndex, const QString &strID)
     843{
     844    /* Choose corresponding key: */
     845    const QString strKey = extraDataKeyPerScreen(GUI_VirtualScreenToHostScreen, iGuestScreenIndex, true);
     846
     847    /* Save passed index under corresponding value: */
     848    setExtraDataString(strKey, iHostScreenIndex != -1 ? QString::number(iHostScreenIndex) : QString(), strID);
     849}
     850
    828851MachineCloseAction UIExtraDataManager::restrictedMachineCloseActions(const QString &strID) const
    829852{
     
    12031226
    12041227/* static */
    1205 QString UIExtraDataManager::extraDataKeyPerScreen(const QString &strBase, ulong uScreenIndex)
    1206 {
    1207     return uScreenIndex ? strBase + QString::number(uScreenIndex) : strBase;
     1228QString UIExtraDataManager::extraDataKeyPerScreen(const QString &strBase, ulong uScreenIndex, bool fSameRuleForPrimary /* = false */)
     1229{
     1230    return fSameRuleForPrimary || uScreenIndex ? strBase + QString::number(uScreenIndex) : strBase;
    12081231}
    12091232
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r51565 r51569  
    235235    void setRequestedVisualState(UIVisualStateType visualState, const QString &strID);
    236236
     237    /** Returns host-screen index corresponding to passed guest-screen @a iGuestScreenIndex. */
     238    int hostScreenForPassedGuestScreen(int iGuestScreenIndex, const QString &strID);
     239    /** Defines host-screen index corresponding to passed guest-screen @a iGuestScreenIndex as @a iHostScreenIndex. */
     240    void setHostScreenForPassedGuestScreen(int iGuestScreenIndex, int iHostScreenIndex, const QString &strID);
     241
    237242    /** Returns default machine close action. */
    238243    MachineCloseAction defaultMachineCloseAction(const QString &strID) const;
     
    315320    void setExtraDataStringList(const QString &strKey, const QStringList &strValue, const QString &strID = m_sstrGlobalID);
    316321
    317     /** Return a string consisting of @a strBase with a suffix for the passed screen.
    318       * Used for storing per-screen extra-data. */
    319     static QString extraDataKeyPerScreen(const QString &strBase, ulong uScreenIndex);
     322    /** Returns string consisting of @a strBase appended with @a uScreenIndex for the *non-primary* screen-index.
     323      * If @a fSameRuleForPrimary is 'true' same rule will be used for *primary* screen-index. Used for storing per-screen extra-data. */
     324    static QString extraDataKeyPerScreen(const QString &strBase, ulong uScreenIndex, bool fSameRuleForPrimary = false);
    320325
    321326    /** Singleton Extra-data Manager instance. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp

    r51054 r51569  
    9393        {
    9494            /* If the user ever selected a combination in the view menu, we have the following entry: */
    95             QString strTest = machine.GetExtraData(QString("%1%2").arg(GUI_VirtualScreenToHostScreen).arg(iGuestScreen));
    96             bool fOk;
    97             /* Check is this value can be converted: */
    98             iHostScreen = strTest.toInt(&fOk);
     95            iHostScreen = gEDataManager->hostScreenForPassedGuestScreen(iGuestScreen, vboxGlobal().managedVMUuid());
    9996            /* Revalidate: */
    100             fValid =    fOk /* Valid data */
    101                      && iHostScreen >= 0 && iHostScreen < m_cHostScreens /* In the host screen bounds? */
     97            fValid =    iHostScreen >= 0 && iHostScreen < m_cHostScreens /* In the host screen bounds? */
    10298                     && m_screenMap.key(iHostScreen, -1) == -1; /* Not taken already? */
    10399        }
     
    379375        int iHostScreen = m_screenMap.value(iGuestScreen, -1);
    380376        if (fWithSave)
    381         {
    382             QString strHostScreen(iHostScreen != -1 ? QString::number(iHostScreen) : QString());
    383             machine.SetExtraData(QString("%1%2").arg(GUI_VirtualScreenToHostScreen).arg(iViewAction), strHostScreen);
    384         }
     377            gEDataManager->setHostScreenForPassedGuestScreen(iViewAction, iHostScreen, vboxGlobal().managedVMUuid());
    385378        QList<QAction*> screenActions = viewActions.at(iViewAction)->menu()->actions();
    386379        /* Update screen actions: */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette