VirtualBox

Changeset 47222 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jul 17, 2013 3:12:06 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Selector UI: Snapshot widget: Handle Ctrl+DoubleClick as *snapshot-restore* procedure.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/selector
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.cpp

    r47171 r47222  
    2929#include <QWindowsStyle>
    3030#include <QPointer>
     31#include <QApplication>
    3132
    3233/* GUI includes: */
     
    413414    connect (mTreeWidget, SIGNAL (itemChanged (QTreeWidgetItem*, int)),
    414415             this, SLOT (onItemChanged (QTreeWidgetItem*)));
     416    connect(mTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)),
     417            this, SLOT (sltItemDoubleClicked(QTreeWidgetItem*)));
    415418
    416419    connect (mTakeSnapshotAction, SIGNAL (triggered()), this, SLOT (sltTakeSnapshot()));
     
    570573}
    571574
     575void VBoxSnapshotsWgt::sltItemDoubleClicked(QTreeWidgetItem *pItem)
     576{
     577    /* Make sure *nothing* is being edited currently: */
     578    if (mEditProtector)
     579        return;
     580
     581    /* Make sure some *valid* item was *really* double-clicked: */
     582    SnapshotWgtItem *pValidItem = pItem ? static_cast<SnapshotWgtItem*>(pItem) : 0;
     583    if (!pValidItem)
     584        return;
     585
     586    /* Handle Ctrl+DoubleClick: */
     587    if (QApplication::keyboardModifiers() == Qt::ControlModifier)
     588    {
     589        /* As call for snapshot-restore procedure: */
     590        sltRestoreSnapshot(true /* suppress non-critical warnings */);
     591    }
     592}
     593
    572594void VBoxSnapshotsWgt::sltTakeSnapshot()
    573595{
     
    575597}
    576598
    577 void VBoxSnapshotsWgt::sltRestoreSnapshot()
     599void VBoxSnapshotsWgt::sltRestoreSnapshot(bool fSuppressNonCriticalWarnings /*= false*/)
    578600{
    579601    /* Get currently chosen item: */
     
    587609
    588610    /* Ask the user if he really wants to restore the snapshot: */
    589     int iResultCode = msgCenter().confirmSnapshotRestoring(snapshot.GetName(), mMachine.GetCurrentStateModified());
    590     if (iResultCode & AlertButton_Cancel)
    591         return;
     611    int iResultCode = AlertButton_Ok;
     612    if (!fSuppressNonCriticalWarnings || mMachine.GetCurrentStateModified())
     613    {
     614        iResultCode = msgCenter().confirmSnapshotRestoring(snapshot.GetName(), mMachine.GetCurrentStateModified());
     615        if (iResultCode & AlertButton_Cancel)
     616            return;
     617    }
    592618
    593619    /* If user also confirmed new snapshot creation: */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.h

    r46726 r47222  
    6464    void onContextMenuRequested (const QPoint &aPoint);
    6565    void onItemChanged (QTreeWidgetItem *aItem);
     66    void sltItemDoubleClicked(QTreeWidgetItem *pItem);
    6667
    6768    /* Snapshot functionality slots: */
    6869    void sltTakeSnapshot();
    69     void sltRestoreSnapshot();
     70    void sltRestoreSnapshot(bool fSuppressNonCriticalWarnings = false);
    7071    void sltDeleteSnapshot();
    7172    void sltShowSnapshotDetails();
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