Changeset 27419 in vbox for trunk/src/VBox
- Timestamp:
- Mar 16, 2010 5:46:10 PM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.cpp
r27242 r27419 979 979 } 980 980 981 void VBoxProblemReporter::cannotSwitchScreenInSeamless(quint64 minVRAM) 982 { 983 message(mainMachineWindowShown(), Error, 984 tr("<p>Could not change the guest screen to this host screen " 985 "due to insufficient guest video memory.</p>" 986 "<p>You should configure the virtual machine to have at " 987 "least <b>%1</b> of video memory.</p>") 988 .arg(VBoxGlobal::formatSize(minVRAM))); 989 } 990 991 int VBoxProblemReporter::cannotSwitchScreenInFullscreen(quint64 minVRAM) 992 { 993 return message(mainMachineWindowShown(), Warning, 994 tr("<p>Could not change the guest screen to this host screen " 995 "due to insufficient guest video memory.</p>" 996 "<p>You should configure the virtual machine to have at " 997 "least <b>%1</b> of video memory.</p>" 998 "<p>Press <b>Ignore</b> to switch the screen anyway " 999 "or press <b>Cancel</b> to cancel the operation.</p>") 1000 .arg(VBoxGlobal::formatSize(minVRAM)), 1001 0, /* aAutoConfirmId */ 1002 QIMessageBox::Ignore | QIMessageBox::Default, 1003 QIMessageBox::Cancel | QIMessageBox::Escape); 1004 } 1005 981 1006 int VBoxProblemReporter::cannotEnterFullscreenMode() 982 1007 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.h
r27028 r27419 226 226 int cannotEnterFullscreenMode (ULONG aWidth, ULONG aHeight, 227 227 ULONG aBpp, ULONG64 aMinVRAM); 228 void cannotSwitchScreenInSeamless(quint64 minVRAM); 229 int cannotSwitchScreenInFullscreen(quint64 minVRAM); 228 230 229 231 int cannotEnterFullscreenMode(); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp
r27337 r27419 27 27 #include "UIActionsPool.h" 28 28 #include "UIMachineLogic.h" 29 #include "UISession.h" 30 #include "VBoxProblemReporter.h" 29 31 30 32 /* Global includes */ … … 129 131 } 130 132 133 quint64 UIMultiScreenLayout::memoryRequirements() const 134 { 135 return memoryRequirements(m_pScreenMap); 136 } 137 131 138 void UIMultiScreenLayout::sltScreenLayoutChanged(QAction *pAction) 132 139 { … … 136 143 137 144 CMachine machine = m_pMachineLogic->session().GetMachine(); 145 QMap<int,int> *pTmpMap = new QMap<int,int>(*m_pScreenMap); 138 146 /* Search for the virtual screen which is currently displayed on the 139 147 * requested host screen. When there is one found, we swap both. */ 140 int r = m_pScreenMap->key(cHostScreen, -1);148 int r = pTmpMap->key(cHostScreen, -1); 141 149 if (r != -1) 142 m_pScreenMap->insert(r, m_pScreenMap->value(cGuestScreen));150 pTmpMap->insert(r, pTmpMap->value(cGuestScreen)); 143 151 /* Set the new host screen */ 144 m_pScreenMap->insert(cGuestScreen, cHostScreen); 145 152 pTmpMap->insert(cGuestScreen, cHostScreen); 153 154 bool fSuccess = true; 155 if (m_pMachineLogic->uisession()->isGuestAdditionsActive()) 156 { 157 quint64 availBits = machine.GetVRAMSize() /* VRAM */ 158 * _1M /* MB to bytes */ 159 * 8; /* to bits */ 160 quint64 usedBits = memoryRequirements(pTmpMap); 161 162 fSuccess = availBits >= usedBits; 163 if (!fSuccess) 164 { 165 /* We have to little video memory for the new layout, so say it to the 166 * user and revert all changes. */ 167 if (m_pMachineLogic->visualStateType() == UIVisualStateType_Seamless) 168 vboxProblem().cannotSwitchScreenInSeamless((((usedBits + 7) / 8 + _1M - 1) / _1M) * _1M); 169 else 170 fSuccess = vboxProblem().cannotSwitchScreenInFullscreen((((usedBits + 7) / 8 + _1M - 1) / _1M) * _1M) != QIMessageBox::Cancel; 171 } 172 } 173 if (fSuccess) 174 { 175 /* Swap the temporary with the previous map. */ 176 delete m_pScreenMap; 177 m_pScreenMap = pTmpMap; 178 } 179 180 /* Update the menu items. Even if we can't switch we have to revert the 181 * menu items. */ 146 182 QList<QAction*> actions = m_pMachineLogic->actionsPool()->action(UIActionIndex_Menu_View)->menu()->actions(); 147 183 /* Update the settings. */ … … 160 196 } 161 197 162 emit screenLayoutChanged(); 163 } 164 198 /* On success inform the observer. */ 199 if (fSuccess) 200 emit screenLayoutChanged(); 201 } 202 203 quint64 UIMultiScreenLayout::memoryRequirements(const QMap<int, int> *pScreenLayout) const 204 { 205 int guestBpp = m_pMachineLogic->uisession()->session().GetConsole().GetDisplay().GetBitsPerPixel(); 206 quint64 usedBits = 0; 207 for (int i = 0; i < m_cGuestScreens; ++ i) 208 { 209 QRect screen = QApplication::desktop()->availableGeometry(pScreenLayout->value(i, 0)); 210 usedBits += screen.width() * /* display width */ 211 screen.height() * /* display height */ 212 guestBpp + /* guest bits per pixel */ 213 _1M * 8; /* current cache per screen - may be changed in future */ 214 } 215 usedBits += 4096 * 8; /* adapter info */ 216 return usedBits; 217 } 218 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.h
r27335 r27419 46 46 int guestScreenCount() const; 47 47 int hostScreenForGuestScreen(int screenId) const; 48 quint64 memoryRequirements() const; 48 49 49 50 signals: … … 55 56 56 57 private: 58 59 quint64 memoryRequirements(const QMap<int, int> *pScreenLayout) const; 57 60 58 61 /* Private member vars */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
r27365 r27419 68 68 /* Temporary get a machine object: */ 69 69 const CMachine &machine = uisession()->session().GetMachine(); 70 const CConsole &console = uisession()->session().GetConsole();71 70 72 71 int cHostScreens = m_pScreenLayout->hostScreenCount(); … … 84 83 if (uisession()->isGuestAdditionsActive()) 85 84 { 86 ULONG64 availBits = machine.GetVRAMSize() /* VRAM */ 87 * _1M /* MB to bytes */ 88 * 8; /* to bits */ 89 ULONG guestBpp = console.GetDisplay().GetBitsPerPixel(); 90 ULONG64 usedBits = 0; 91 for (int i = 0; i < cGuestScreens; ++ i) 92 { 93 // TODO_NEW_CORE: really take the screen geometry into account the 94 // different fb will be displayed. */ 95 QRect screen = QApplication::desktop()->screenGeometry(i); 96 usedBits += screen.width() /* display width */ 97 * screen.height() /* display height */ 98 * guestBpp 99 + _1M * 8; /* current cache per screen - may be changed in future */ 100 } 101 usedBits += 4096 * 8; /* adapter info */ 102 85 quint64 availBits = machine.GetVRAMSize() /* VRAM */ 86 * _1M /* MB to bytes */ 87 * 8; /* to bits */ 88 quint64 usedBits = m_pScreenLayout->memoryRequirements(); 103 89 if (availBits < usedBits) 104 90 { 105 // int result = vboxProblem().cannotEnterFullscreenMode(screen.width(), screen.height(), guestBpp, 106 // (((usedBits + 7) / 8 + _1M - 1) / _1M) * _1M); 107 int result = vboxProblem().cannotEnterFullscreenMode(0, 0, guestBpp, 91 int result = vboxProblem().cannotEnterFullscreenMode(0, 0, 0, 108 92 (((usedBits + 7) / 8 + _1M - 1) / _1M) * _1M); 109 93 if (result == QIMessageBox::Cancel) -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp
r27381 r27419 66 66 /* Temporary get a machine object: */ 67 67 const CMachine &machine = uisession()->session().GetMachine(); 68 const CConsole &console = uisession()->session().GetConsole();69 68 70 69 int cHostScreens = m_pScreenLayout->hostScreenCount(); … … 82 81 if (uisession()->isGuestAdditionsActive()) 83 82 { 84 ULONG64 availBits = machine.GetVRAMSize() /* VRAM */ 85 * _1M /* MB to bytes */ 86 * 8; /* to bits */ 87 ULONG guestBpp = console.GetDisplay().GetBitsPerPixel(); 88 ULONG64 usedBits = 0; 89 for (int i = 0; i < cGuestScreens; ++ i) 90 { 91 // TODO_NEW_CORE: really take the screen geometry into account the 92 // different fb will be displayed. */ 93 QRect screen = QApplication::desktop()->availableGeometry(i); 94 usedBits += screen.width() /* display width */ 95 * screen.height() /* display height */ 96 * guestBpp 97 + _1M * 8; /* current cache per screen - may be changed in future */ 98 } 99 usedBits += 4096 * 8; /* adapter info */ 100 83 quint64 availBits = machine.GetVRAMSize() /* VRAM */ 84 * _1M /* MB to bytes */ 85 * 8; /* to bits */ 86 quint64 usedBits = m_pScreenLayout->memoryRequirements(); 101 87 if (availBits < usedBits) 102 88 { 103 // vboxProblem().cannotEnterSeamlessMode(screen.width(), screen.height(), guestBpp, 104 // (((usedBits + 7) / 8 + _1M - 1) / _1M) * _1M); 105 vboxProblem().cannotEnterSeamlessMode(0, 0, guestBpp, 89 vboxProblem().cannotEnterSeamlessMode(0, 0, 0, 106 90 (((usedBits + 7) / 8 + _1M - 1) / _1M) * _1M); 107 91 return false;
Note:
See TracChangeset
for help on using the changeset viewer.