Changeset 67176 in vbox
- Timestamp:
- May 31, 2017 2:50:59 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 115852
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotDetailsWidget.cpp
r67173 r67176 33 33 34 34 /* GUI includes: */ 35 # include "UIDesktopWidgetWatchdog.h" 35 36 # include "UISnapshotDetailsWidget.h" 36 37 # include "UIMessageCenter.h" … … 82 83 /** Prepares all. */ 83 84 void prepare(); 85 86 /** Adjusts window size. */ 87 void adjustWindowSize(); 84 88 85 89 /** Adjusts picture. */ … … 169 173 m_fZoomMode = !m_fZoomMode; 170 174 175 /* Adjust the windiow size: */ 176 adjustWindowSize(); 171 177 /* Adjust the picture: */ 172 178 adjustPicture(); … … 222 228 } 223 229 224 /* Calculate aspect-ratio: */ 225 double dAspectRatio = (double)m_pixmapScreenshot.height() / m_pixmapScreenshot.width(); 230 /* Apply language settings: */ 231 retranslateUi(); 232 233 /* Adjust window size: */ 234 adjustWindowSize(); 235 236 /* Center according requested widget: */ 237 VBoxGlobal::centerWidget(this, parentWidget(), false); 238 } 239 240 void UIScreenshotViewer::adjustWindowSize() 241 { 242 /* Acquire current host-screen size, fallback to 1024x768 if failed: */ 243 QSize screenSize = gpDesktop->screenGeometry(parentWidget()).size(); 244 if (!screenSize.isValid()) 245 screenSize = QSize(1024, 768); 246 const int iInitWidth = screenSize.width() * .50 /* 50% of host-screen width */; 247 248 /* Calculate screenshot aspect-ratio: */ 249 const double dAspectRatio = (double)m_pixmapScreenshot.height() / m_pixmapScreenshot.width(); 250 226 251 /* Calculate maximum window size: */ 227 const QSize maxSize = m_pixmapScreenshot.size() + QSize(m_pScrollArea->frameWidth() * 2, m_pScrollArea->frameWidth() * 2); 252 const QSize maxSize = m_fZoomMode 253 ? screenSize * .9 /* 90% of host-screen size */ + 254 QSize(m_pScrollArea->frameWidth() * 2, m_pScrollArea->frameWidth() * 2) 255 : m_pixmapScreenshot.size() /* just the screenshot size */ + 256 QSize(m_pScrollArea->frameWidth() * 2, m_pScrollArea->frameWidth() * 2); 257 228 258 /* Calculate initial window size: */ 229 const QSize initSize = QSize( 640, (int)(640* dAspectRatio)).boundedTo(maxSize);259 const QSize initSize = QSize(iInitWidth, (int)(iInitWidth * dAspectRatio)).boundedTo(maxSize); 230 260 231 261 /* Apply maximum window size restrictions: */ … … 233 263 /* Apply initial window size: */ 234 264 resize(initSize); 235 236 /* Apply language settings: */237 retranslateUi();238 239 /* Center according requested widget: */240 VBoxGlobal::centerWidget(this, parentWidget(), false);241 265 } 242 266 … … 245 269 if (m_fZoomMode) 246 270 { 271 /* Adjust visual aspects: */ 247 272 m_pScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 248 273 m_pScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); … … 254 279 else 255 280 { 281 /* Adjust visual aspects: */ 256 282 m_pScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); 257 283 m_pScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
Note:
See TracChangeset
for help on using the changeset viewer.