VirtualBox

Changeset 4092 in vbox


Ignore:
Timestamp:
Aug 8, 2007 3:07:07 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
23540
Message:

2168: Snapshot names suggested by the GUI:

Done the same for runtime "Take Snapshot" operation.

File:
1 edited

Legend:

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

    r4090 r4092  
    3838#include <qtimer.h>
    3939#include <qeventloop.h>
     40#include <qregexp.h>
    4041
    4142#include <VBox/VBoxGuest.h>
     
    21392140    dlg.pmIcon->setPixmap (vboxGlobal().vmGuestOSTypeIcon (typeId));
    21402141
    2141     dlg.leName->setText (tr ("Snapshot %1").arg (cmachine.GetSnapshotCount() + 1));
     2142    /* search for the max available filter index */
     2143    int maxSnapShotIndex = 0;
     2144    QString snapShotName = tr ("Snapshot %1");
     2145    QRegExp regExp (QString ("^") + snapShotName.arg ("([0-9]+)") + QString ("$"));
     2146    CSnapshot index = cmachine.GetSnapshot (QUuid());
     2147    while (!index.isNull())
     2148    {
     2149        /* Check the current snapshot name */
     2150        QString name = index.GetName();
     2151        int pos = regExp.search (name);
     2152        if (pos != -1)
     2153            maxSnapShotIndex = regExp.cap (1).toInt() > maxSnapShotIndex ?
     2154                               regExp.cap (1).toInt() : maxSnapShotIndex;
     2155        /* Traversing to the next child */
     2156        index = index.GetChildren().GetItemAt (0);
     2157    }
     2158    dlg.leName->setText (snapShotName.arg (maxSnapShotIndex + 1));
    21422159
    21432160    if (dlg.exec() == QDialog::Accepted)
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette