VirtualBox

Changeset 67473 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jun 19, 2017 12:48:41 PM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8901: Selector UI: Tools pane: Snapshot pane: Implement 'restore snapshot' event handler.

File:
1 edited

Legend:

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

    r67472 r67473  
    782782            strMachineId.toUtf8().constData(), strSnapshotId.toUtf8().constData()));
    783783
    784     // TODO: Refresh only necessary bits.
    785     /* Refresh everything: */
    786     refreshAll();
     784    /* Prepare result: */
     785    bool fSuccess = true;
     786    {
     787        /* Prevent snapshot editing in the meantime: */
     788        QWriteLocker locker(m_pLockReadWrite);
     789
     790        /* Search for an existing item with such id: */
     791        UISnapshotItem *pItem = findItem(strSnapshotId);
     792        fSuccess = pItem;
     793
     794        /* Choose this item as new "current snapshot": */
     795        if (fSuccess)
     796        {
     797            /* Delete "current state" item first of all: */
     798            UISnapshotItem *pCurrentStateItem = m_pCurrentStateItem;
     799            m_pCurrentStateItem = 0;
     800            delete pCurrentStateItem;
     801            pCurrentStateItem = 0;
     802
     803            /* Move the "current snapshot" token from one to another: */
     804            m_pCurrentSnapshotItem->setCurrentSnapshotItem(false);
     805            m_pCurrentSnapshotItem = pItem;
     806            m_pCurrentSnapshotItem->setCurrentSnapshotItem(true);
     807
     808            /* Create "current state" item as a child of "current snapshot" item: */
     809            m_pCurrentStateItem = new UISnapshotItem(this, m_pCurrentSnapshotItem, m_comMachine);
     810            m_pCurrentStateItem->recache();
     811            /* And choose is as current one: */
     812            m_pSnapshotTree->setCurrentItem(m_pCurrentStateItem);
     813            sltHandleCurrentItemChange();
     814
     815            LogRel(("GUI: Snapshot tree update successful!\n"));
     816        }
     817    }
     818
     819    /* Just refresh everything as fallback: */
     820    if (!fSuccess)
     821    {
     822        LogRel(("GUI: Snapshot tree update failed! Rebuilding from scratch...\n"));
     823        refreshAll();
     824    }
    787825}
    788826
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