VirtualBox

Changeset 67246 in vbox


Ignore:
Timestamp:
Jun 2, 2017 3:16:34 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
115941
Message:

FE/Qt: Selector UI: Tools pane: Snapshot pane: Do not close details-widget when the Current State item is selected.

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

Legend:

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

    r67218 r67246  
    2828# include <QPushButton>
    2929# include <QScrollArea>
     30# include <QStackedLayout>
    3031# include <QTabWidget>
    3132# include <QTextEdit>
     
    297298UISnapshotDetailsWidget::UISnapshotDetailsWidget(QWidget *pParent /* = 0 */)
    298299    : QIWithRetranslateUI<QWidget>(pParent)
     300    , m_pStackedLayout(0)
     301    , m_pEmptyWidget(0)
     302    , m_pEmptyWidgetLabel(0)
    299303    , m_pTabWidget(0)
    300304    , m_pLayoutOptions(0)
     
    360364{
    361365    /* Translate labels: */
     366    m_pEmptyWidgetLabel->setText("<p>You have the <b>Current State</b> item selected.<br>"
     367                                 "Press <b>Take</b> button if you wish to take a new snapshot.</p>");
    362368    m_pTabWidget->setTabText(0, tr("&Attributes"));
    363369    m_pTabWidget->setTabText(1, tr("D&etails"));
     
    410416void UISnapshotDetailsWidget::prepare()
    411417{
    412     /* Create layout: */
    413     new QVBoxLayout(this);
    414     AssertPtrReturnVoid(layout());
    415     {
    416         /* Configure layout: */
    417         layout()->setContentsMargins(0, 0, 0, 0);
    418 
     418    /* Create stacked layout: */
     419    m_pStackedLayout = new QStackedLayout(this);
     420    AssertPtrReturnVoid(m_pStackedLayout);
     421    {
     422        /* Prepare empty-widget: */
     423        prepareEmptyWidget();
    419424        /* Prepare tab-widget: */
    420425        prepareTabWidget();
     426    }
     427}
     428
     429void UISnapshotDetailsWidget::prepareEmptyWidget()
     430{
     431    /* Create empty-widget: */
     432    m_pEmptyWidget = new QWidget;
     433    AssertPtrReturnVoid(m_pEmptyWidget);
     434    {
     435        /* Create empty-widget layout: */
     436        new QVBoxLayout(m_pEmptyWidget);
     437        AssertPtrReturnVoid(m_pEmptyWidget->layout());
     438        {
     439            /* Create empty-widget label: */
     440            m_pEmptyWidgetLabel = new QLabel;
     441            {
     442                /* Configure label: */
     443                QFont font = m_pEmptyWidgetLabel->font();
     444                font.setPointSize(font.pointSize() * 1.5);
     445                m_pEmptyWidgetLabel->setAlignment(Qt::AlignCenter);
     446                m_pEmptyWidgetLabel->setFont(font);
     447
     448                /* Add into layout: */
     449                m_pEmptyWidget->layout()->addWidget(m_pEmptyWidgetLabel);
     450            }
     451        }
     452
     453        /* Add into layout: */
     454        m_pStackedLayout->addWidget(m_pEmptyWidget);
    421455    }
    422456}
     
    434468
    435469        /* Add into layout: */
    436         layout()->addWidget(m_pTabWidget);
     470        m_pStackedLayout->addWidget(m_pTabWidget);
    437471    }
    438472}
     
    455489                m_pLabelTaken->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
    456490
    457                 /* Add to layout: */
     491                /* Add into layout: */
    458492                m_pLayoutOptions->addWidget(m_pLabelTaken, 0, 0);
    459493            }
     
    467501                m_pLabelTakenText->setSizePolicy(policy);
    468502
    469                 /* Add to layout: */
     503                /* Add into layout: */
    470504                m_pLayoutOptions->addWidget(m_pLabelTakenText, 0, 1);
    471505            }
     
    478512                m_pLabelName->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
    479513
    480                 /* Add to layout: */
     514                /* Add into layout: */
    481515                m_pLayoutOptions->addWidget(m_pLabelName, 1, 0);
    482516            }
     
    493527                        this, &UISnapshotDetailsWidget::sltHandleNameChange);
    494528
    495                 /* Add to layout: */
     529                /* Add into layout: */
    496530                m_pLayoutOptions->addWidget(m_pEditorName, 1, 1);
    497531            }
     
    512546                m_pLabelThumbnail->setPalette(pal);
    513547
    514                 /* Add to layout: */
     548                /* Add into layout: */
    515549                m_pLayoutOptions->addWidget(m_pLabelThumbnail, 0, 2, 2, 1);
    516550            }
     
    523557                m_pLabelDescription->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignTop);
    524558
    525                 /* Add to layout: */
     559                /* Add into layout: */
    526560                m_pLayoutOptions->addWidget(m_pLabelDescription, 2, 0);
    527561            }
     
    540574                        this, &UISnapshotDetailsWidget::sltHandleDescriptionChange);
    541575
    542                 /* Add to layout: */
     576                /* Add into layout: */
    543577                m_pLayoutOptions->addWidget(m_pBrowserDescription, 2, 1, 1, 2);
    544578            }
     
    603637                        QVariant(gpConverter->toIcon(enmType).pixmap(iconSize)));
    604638
    605                 /* Add to layout: */
     639                /* Add into layout: */
    606640                m_pLayoutDetails->addWidget(m_pBrowserDetails);
    607641            }
     
    622656    if (m_comSnapshot.isNotNull())
    623657    {
     658        /* Choose the tab-widget as current one: */
     659        m_pStackedLayout->setCurrentWidget(m_pTabWidget);
     660
    624661        /* Calculate snapshot timestamp info: */
    625662        QDateTime timestamp;
     
    681718    else
    682719    {
     720        /* Choose the empty-widget as current one: */
     721        m_pStackedLayout->setCurrentWidget(m_pEmptyWidget);
     722
    683723        /* Clear snapshot timestamp info: */
    684724        m_pLabelTakenText->clear();
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotDetailsWidget.h

    r67173 r67246  
    3232class QLabel;
    3333class QLineEdit;
     34class QStackedLayout;
    3435class QTabWidget;
    3536class QTextEdit;
    3637class QVBoxLayout;
     38class QWidget;
    3739
    3840
     
    108110    /** Prepares all. */
    109111    void prepare();
     112    /** Prepares empty-widget. */
     113    void prepareEmptyWidget();
    110114    /** Prepares tab-widget. */
    111115    void prepareTabWidget();
     
    133137    /** Holds the cached screenshot. */
    134138    QPixmap  m_pixmapScreenshot;
     139
     140    /** Holds the stacked layout instance. */
     141    QStackedLayout *m_pStackedLayout;
     142
     143    /** Holds the empty-widget instance. */
     144    QWidget *m_pEmptyWidget;
     145    /** Holds the empty-widget label instance. */
     146    QLabel  *m_pEmptyWidgetLabel;
    135147
    136148    /** Holds the tab-widget instance. */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.cpp

    r67162 r67246  
    800800    );
    801801    m_pActionShowSnapshotDetails->setEnabled(
    802            m_pCurrentSnapshotItem
    803         && pSnapshotItem
    804         && !pSnapshotItem->isCurrentStateItem()
     802        pSnapshotItem
    805803    );
    806804    m_pActionCommitSnapshotDetails->setEnabled(
     
    814812
    815813    /* If there is a proper snasphot item: */
    816     if (   m_pCurrentSnapshotItem
    817         && pSnapshotItem
    818         && !pSnapshotItem->isCurrentStateItem())
     814    if (pSnapshotItem)
    819815    {
    820816        /* Update details-widget if it's visible: */
    821817        if (m_pDetailsWidget->isVisible())
    822818            m_pDetailsWidget->setData(*pSnapshotItem, pSnapshotItem->snapshot());
    823     }
    824     else
    825     {
    826         /* Clear details-widget if it's visible: */
    827         if (m_pDetailsWidget->isVisible())
    828             m_pDetailsWidget->clearData();
    829         /* Toggle details button off and hide the widget: */
    830         m_pActionShowSnapshotDetails->setChecked(false);
    831         sltToggleSnapshotDetailsVisibility(false);
    832819    }
    833820}
     
    914901
    915902    /* If this is a snapshot item: */
    916     if (   m_pCurrentSnapshotItem
    917         && pSnapshotItem
    918         && !pSnapshotItem->isCurrentStateItem())
     903    if (pSnapshotItem)
    919904    {
    920905        /* Handle Ctrl+DoubleClick: */
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