Changeset 44837 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Feb 26, 2013 5:34:17 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 83977
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp
r44836 r44837 75 75 for (int iGuestScreen = 0; iGuestScreen < m_cGuestScreens; ++iGuestScreen) 76 76 { 77 /* If the user ever selected a combination in the view menu, we have the following entry: */ 78 QString strTest = machine.GetExtraData(QString("%1%2").arg(GUI_VirtualScreenToHostScreen).arg(iGuestScreen)); 79 bool fOk; 80 int iHostScreen = strTest.toInt(&fOk); 81 /* Check if valid: */ 82 if (!( fOk /* Valid data */ 83 && iHostScreen >= 0 && iHostScreen < m_cHostScreens /* In the host screen bounds? */ 84 && m_screenMap.key(iHostScreen, -1) == -1)) /* Not taken already? */ 85 { 86 /* If not, check the position of the guest window in normal mode. 77 /* Initialize variables: */ 78 bool fValid = false; 79 int iHostScreen = -1; 80 81 if (!fValid) 82 { 83 /* If the user ever selected a combination in the view menu, we have the following entry: */ 84 QString strTest = machine.GetExtraData(QString("%1%2").arg(GUI_VirtualScreenToHostScreen).arg(iGuestScreen)); 85 bool fOk; 86 /* Check is this value can be converted: */ 87 iHostScreen = strTest.toInt(&fOk); 88 /* Revalidate: */ 89 fValid = fOk /* Valid data */ 90 && iHostScreen >= 0 && iHostScreen < m_cHostScreens /* In the host screen bounds? */ 91 && m_screenMap.key(iHostScreen, -1) == -1; /* Not taken already? */ 92 } 93 94 if (!fValid) 95 { 96 /* Check the position of the guest window in normal mode. 87 97 * This makes sure that on first use the window opens on the same screen as the normal window was before. 88 98 * This even works with multi-screen. The user just have to move all the normal windows to the target screens … … 97 107 /* Check to which screen the position belongs: */ 98 108 iHostScreen = pDW->screenNumber(p); 99 if (!( fOk1 /* Valid data */ 100 && fOk2 /* Valid data */ 101 && iHostScreen >= 0 && iHostScreen < m_cHostScreens /* In the host screen bounds? */ 102 && m_screenMap.key(iHostScreen, -1) == -1)) /* Not taken already? */ 103 /* If not, simply pick the next one of the still available host screens: */ 104 iHostScreen = availableScreens.first(); 109 /* Revalidate: */ 110 fValid = fOk1 && fOk2 /* Valid data */ 111 && iHostScreen >= 0 && iHostScreen < m_cHostScreens /* In the host screen bounds? */ 112 && m_screenMap.key(iHostScreen, -1) == -1; /* Not taken already? */ 105 113 } 106 else 107 /* If not, simply pick the next one of the still available host screens: */ 114 } 115 116 if (!fValid) 117 { 118 /* If still not valid, pick the next one 119 * if there is still available host screen: */ 120 if (!availableScreens.isEmpty()) 121 { 108 122 iHostScreen = availableScreens.first(); 109 } 110 m_screenMap.insert(iGuestScreen, iHostScreen); 111 /* Remove the just selected screen from the list of available: */ 112 availableScreens.removeOne(iHostScreen); 123 fValid = true; 124 } 125 } 126 127 if (fValid) 128 { 129 /* Register host screen for the guest screen: */ 130 m_screenMap.insert(iGuestScreen, iHostScreen); 131 /* Remove it from the list of available host screens: */ 132 availableScreens.removeOne(iHostScreen); 133 } 113 134 } 114 135 … … 166 187 QMap<int,int> tmpMap(m_screenMap); 167 188 int iCurrentGuestScreen = tmpMap.key(iRequestedHostScreen, -1); 168 if (iCurrentGuestScreen != -1 )189 if (iCurrentGuestScreen != -1 && tmpMap.contains(iRequestedGuestScreen)) 169 190 tmpMap.insert(iCurrentGuestScreen, tmpMap.value(iRequestedGuestScreen)); 170 /* Set the new host screen: */ 191 else 192 tmpMap.remove(iCurrentGuestScreen); 171 193 tmpMap.insert(iRequestedGuestScreen, iRequestedHostScreen); 172 194 … … 188 210 } 189 211 } 190 if (fSuccess)191 {192 /* Swap the temporary with the previous map. */193 m_screenMap = tmpMap; 194 }195 212 /* Make sure memory requirements matched: */ 213 if (!fSuccess) 214 return; 215 216 /* Swap the maps: */ 217 m_screenMap = tmpMap; 196 218 /* Update menu actions: */ 197 219 updateMenuActions(true); 198 199 /* On success inform the observer: */ 200 if (fSuccess) 201 emit sigScreenLayoutChanged(); 220 /* Inform the observer: */ 221 emit sigScreenLayoutChanged(); 202 222 } 203 223
Note:
See TracChangeset
for help on using the changeset viewer.