VirtualBox

Ignore:
Timestamp:
Nov 17, 2009 8:19:09 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4: Snapshot Details Dialog: Preserving aspect ratio for initially opened screen-shot, supporting situation when screen-shot is not available but thumbnail is.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxSnapshotDetailsDlg.h

    r24732 r24737  
    5959
    6060    QPixmap mThumbnail;
     61    QPixmap mScreenshot;
    6162};
    6263
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.cpp

    r24735 r24737  
    6969    /* Get thumbnail if present */
    7070    ULONG width = 0, height = 0;
    71     QVector <BYTE> data = machine.ReadSavedThumbnailToArray (true, width, height);
    72     mThumbnail = data.size() != 0 ? QPixmap::fromImage (QImage (data.data(), width, height, QImage::Format_RGB32).copy()) : QPixmap();
     71    QVector <BYTE> thumbData = machine.ReadSavedThumbnailToArray (true, width, height);
     72    mThumbnail = thumbData.size() != 0 ? QPixmap::fromImage (QImage (thumbData.data(), width, height, QImage::Format_RGB32).copy()) : QPixmap();
     73    QVector <BYTE> screenData = machine.ReadSavedScreenshotPNGToArray (width, height);
     74    mScreenshot = screenData.size() != 0 ? QPixmap::fromImage (QImage::fromData (screenData.data(), screenData.size(), "PNG")) : QPixmap();
     75
    7376    QGridLayout *lt = qobject_cast <QGridLayout*> (layout());
    7477    Assert (lt);
     
    118121    setWindowTitle (tr ("Details of %1 (%2)").arg (mSnapshot.GetName()).arg (machine.GetName()));
    119122
     123    mLbThumbnail->setToolTip (mScreenshot.isNull() ? QString() : tr ("Click to enlarge the screenshot."));
     124
    120125    mTeDetails->setText (vboxGlobal().detailsReport (machine, false /* with links? */));
    121126}
     
    124129{
    125130    Assert (aObject == mLbThumbnail);
    126     if (aEvent->type() == QEvent::MouseButtonPress)
    127     {
    128         CMachine machine = mSnapshot.GetMachine();
    129 
    130         ULONG width = 0, height = 0;
    131         QVector <BYTE> data = machine.ReadSavedScreenshotPNGToArray (width, height);
    132         Assert (data.size());
    133         QPixmap pixmap = QPixmap::fromImage (QImage::fromData (data.data(), data.size(), "PNG"));
    134 
    135         VBoxScreenshotViewer *viewer = new VBoxScreenshotViewer (this, pixmap, machine.GetName(), mSnapshot.GetName());
     131    if (aEvent->type() == QEvent::MouseButtonPress && !mScreenshot.isNull())
     132    {
     133        VBoxScreenshotViewer *viewer = new VBoxScreenshotViewer (this, mScreenshot, mSnapshot.GetMachine().GetName(), mSnapshot.GetName());
    136134        viewer->show();
    137135    }
     
    175173    layout->addWidget (mArea);
    176174
     175    double aspectRatio = (double) aScreenshot.height() / aScreenshot.width();
    177176    QSize maxSize = aScreenshot.size() + QSize (mArea->frameWidth() * 2, mArea->frameWidth() * 2);
    178     QSize initSize = QSize (640, 480).boundedTo (maxSize);
     177    QSize initSize = QSize (640, 640 * aspectRatio).boundedTo (maxSize);
    179178
    180179    setMaximumSize (maxSize);
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxSnapshotDetailsDlg.ui

    r24736 r24737  
    6262      </sizepolicy>
    6363     </property>
    64      <property name="toolTip">
    65       <string>Click to enlarge the screenshot.</string>
    66      </property>
    6764     <property name="frameShape">
    6865      <enum>QFrame::Panel</enum>
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