VirtualBox

Changeset 1068 in vbox for trunk


Ignore:
Timestamp:
Feb 26, 2007 8:50:40 PM (18 years ago)
Author:
vboxsync
Message:

1765: Indicate that a VM has snapshots

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

Legend:

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

    r382 r1068  
    5858    QFont nameFont() const { return mNameFont; }
    5959
     60    QFont shotFont() const { return mShotFont; }
     61
    6062    QFont stateFont (CEnums::SessionState aS) const
    6163    {
     
    8183    CVirtualBox mVBox;
    8284    QFont mNameFont;
     85    QFont mShotFont;
    8386    QFont mStateBusyFont;
    8487    int mMargin;
     
    121124    int height (const QListBox *) const;
    122125    int width (const QListBox *) const;
    123    
     126
    124127    bool accessible() const { return mAccessible; }
    125128    const CVirtualBoxErrorInfo &accessError() const { return mAccessError; }
     
    137140    QUuid mId;
    138141    QString mSettingsFile;
    139    
     142
    140143    bool mAccessible;
    141144    CVirtualBoxErrorInfo mAccessError;
    142    
     145
    143146    QString mName;
     147    QString mSnapshotName;
    144148    CEnums::MachineState mState;
    145149    QDateTime mLastStateChange;
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp

    r1000 r1068  
    7070
    7171    void languageChange();
    72    
     72
    7373    void setDetailsText (const QString &aText)
    7474    {
     
    8383        raiseWidget (1);
    8484    }
    85    
     85
    8686    void setEmpty()
    8787    {
     
    9595        return connect (mDetailsText, aSignal, aReceiver, aMember);
    9696    }
    97    
     97
    9898private:
    9999
     
    117117{
    118118    Assert (mRefreshAction);
    119    
     119
    120120    /* create normal details page */
    121    
     121
    122122    mDetailsText = new QTextBrowser (mErrBox);
    123123    mDetailsText->setFocusPolicy (QWidget::StrongFocus);
     
    133133{
    134134    /* create inaccessible details page */
    135    
     135
    136136    if (mErrBox)
    137137        return;
     
    141141    QVBoxLayout *layout = new QVBoxLayout (mErrBox);
    142142    layout->setSpacing (10);
    143    
     143
    144144    mErrLabel = new QLabel (mErrBox);
    145145    mErrLabel->setAlignment (WordBreak);
     
    156156        mRefreshButton = new QToolButton (mErrBox);
    157157        mRefreshButton->setFocusPolicy (QWidget::StrongFocus);
    158    
     158
    159159        QHBoxLayout *hLayout = new QHBoxLayout (layout);
    160160        hLayout->addItem (new QSpacerItem (0, 0, QSizePolicy::Expanding,
    161161                                                 QSizePolicy::Minimum));
    162162        hLayout->add (mRefreshButton);
    163        
     163
    164164        connect (mRefreshButton, SIGNAL (clicked()),
    165165                 mRefreshAction, SIGNAL (activated()));
     
    168168    layout->addItem (new QSpacerItem (0, 0, QSizePolicy::Minimum,
    169169                                            QSizePolicy::Expanding));
    170    
     170
    171171    addWidget (mErrBox, 1);
    172    
    173     languageChange();   
     172
     173    languageChange();
    174174}
    175175
     
    259259    vmRefreshAction->setIconSet (VBoxGlobal::iconSet (
    260260        "refresh_16px.png", "refresh_disabled_16px.png"));
    261    
     261
    262262    helpContentsAction = new QAction (this, "helpContentsAction");
    263263    helpContentsAction->setIconSet (VBoxGlobal::iconSet ("help_16px.png"));
     
    353353
    354354    menuBar()->insertItem (QString::null, helpMenu, 3);
    355    
     355
    356356    languageChange();
    357357
     
    729729
    730730    AssertMsgReturn (item, ("Item must be always selected here"), (void) 0);
    731    
     731
    732732    refreshVMItem (item->id(), true /* aDetails */, true /* aSnapshots */);
    733733}
     
    888888    if (menuBar()->findItem(3))
    889889        menuBar()->findItem(3)->setText (tr ("&Help"));
    890    
     890
    891891    vmDetailsView->languageChange();
    892892}
     
    910910    {
    911911        CMachine m = item->machine();
     912
    912913        if (aRefreshDetails)
    913914        {
     
    918919        if (aRefreshSnapshots)
    919920        {
     921            /* update snapshots tab name */
     922            QString shotName = tr ("&Snapshots");
     923            ULONG shotCount = m.GetSnapshotCount();
     924            if (shotCount)
     925                shotName += QString (" (%1)").arg (shotCount);
     926            vmTabWidget->changeTab (vmSnapshotsWgt, shotName);
    920927            /* refresh snapshots widget */
    921928            vmSnapshotsWgt->setMachine (m);
     
    955962
    956963        vmDetailsView->setEnabled (true);
    957        
     964
    958965        /* empty and disable refresh snapshots widget */
    959966        vmSnapshotsWgt->setMachine (CMachine());
     
    974981
    975982    do
    976     {   
     983    {
    977984        /* ignore the signal if a modal widget is currently active (we won't be
    978985         * able to properly show the modeless VDI manager window in this case) */
    979986        if (QApplication::activeModalWidget())
    980987            break;
    981        
     988
    982989        /* ignore the signal if a VBoxDiskImageManagerDlg window is active */
    983990        if (qApp->activeWindow() &&
    984991            !strcmp (qApp->activeWindow()->className(), "VBoxDiskImageManagerDlg"))
    985992            break;
    986    
     993
    987994        /* look for at least one inaccessible media */
    988995        VBoxMediaList::const_iterator it;
     
    990997            if ((*it).status == VBoxMedia::Inaccessible)
    991998                break;
    992    
     999
    9931000        if (it != list.end() && vboxProblem().remindAboutInaccessibleMedia())
    9941001        {
     
    10461053}
    10471054
    1048 void VBoxSelectorWnd::snapshotChanged (const VBoxSnapshotEvent &/* e */)
    1049 {
    1050     /// @todo (dmik) nothing to do, should remove I guess
    1051 }
     1055void VBoxSelectorWnd::snapshotChanged (const VBoxSnapshotEvent &aEvent)
     1056{
     1057    refreshVMItem (aEvent.machineId, false, true);
     1058}
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMListBox.cpp

    r382 r1068  
    9898
    9999    mNameFont = QFont ("Arial", font().pointSize() + 1, QFont::Bold);
     100    mShotFont = QFont ("Arial", font().pointSize() + 1);
    100101    mStateBusyFont = font();
    101102    mStateBusyFont.setItalic (true);
     
    251252    {
    252253        QString name = mMachine.GetName();
     254        CSnapshot snp = mMachine.GetCurrentSnapshot();
     255        mSnapshotName = snp.isNull() ? QString::null : snp.GetName();
    253256        needsResort = name != mName;
    254257        mName = name;
    255    
     258
    256259        mState = mMachine.GetState();
    257260        mLastStateChange.setTime_t (mMachine.GetLastStateChange() / 1000);
     
    262265    {
    263266        mAccessError = mMachine.GetAccessError();
    264        
     267
    265268        /* this should be in sync with
    266269         * VBoxProblemReporter::confirmMachineDeletion() */
     
    287290
    288291    QString toolTip;
    289    
     292
    290293    if (mAccessible)
    291294    {
     295        toolTip = QString ("<b>%1</b>").arg (mName);
     296        if (!mSnapshotName.isNull())
     297            toolTip += QString (" (%1)").arg (mSnapshotName);
    292298        toolTip = QString (VBoxVMListBox::tr (
    293             "<nobr><b>%1</b><br></nobr>"
     299            "<nobr>%1<br></nobr>"
    294300            "<nobr>%2 since %3</nobr><br>"
    295301            "<nobr>Session %4</nobr>",
    296302            "VM tooltip (name, last state change, session state)"))
    297             .arg (mName)
     303            .arg (toolTip)
    298304            .arg (vboxGlobal().toString (mState))
    299305            .arg (dateTime)
     
    320326
    321327    QFontMetrics fmName = QFontMetrics (lb->nameFont());
     328    QFontMetrics fmShot = QFontMetrics (lb->shotFont());
    322329    QFontMetrics fmState = QFontMetrics (lb->stateFont (mSessionState));
    323330    const int marg = lb->margin();
     
    326333    QPixmap pmState;
    327334    QString strState;
    328    
     335
    329336    if (mAccessible)
    330337    {
     
    342349
    343350    int nameWidth = fmName.width (mName);
     351    if (!mSnapshotName.isNull())
     352        nameWidth += fmShot.width (QString (" (%1)").arg (mSnapshotName));
    344353    int stateWidth = pmState.width() + fmState.width (' ') +
    345354                     fmState.width (strState);
     
    404413
    405414    QFontMetrics fmName = QFontMetrics (lb->nameFont());
     415    QFontMetrics fmShot = QFontMetrics (lb->shotFont());
    406416    QFontMetrics fmState = QFontMetrics (lb->stateFont (mSessionState));
    407417    const int marg = lb->margin();
     
    446456    aP->drawText (textX, marg + fmName.ascent(), mName);
    447457
     458    if (!mSnapshotName.isNull())
     459    {
     460        int nameWidth = fmName.width (mName);
     461        aP->setFont (lb->shotFont());
     462        QString shotName = QString (" (%1)").arg (mSnapshotName);
     463        aP->drawText (textX + nameWidth, marg + fmName.ascent(), shotName);
     464    }
     465
    448466    int stateY = marg + fmName.lineSpacing();
    449467    int stateH = QMAX (pmState.height(), fmState.height());
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