VirtualBox

Changeset 96658 in vbox


Ignore:
Timestamp:
Sep 8, 2022 1:10:38 PM (2 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9930: Snapshot UI: Do not use column name as item name, split item name to internal and external.

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

Legend:

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

    r96407 r96658  
    780780void UISnapshotDetailsWidget::sltHandleNameChange()
    781781{
    782     m_newData.m_strName = m_pEditorName->text();
     782    m_newData.setName(m_pEditorName->text());
    783783    revalidate(m_pErrorPaneName);
    784784    updateButtonStates();
     
    787787void UISnapshotDetailsWidget::sltHandleDescriptionChange()
    788788{
    789     m_newData.m_strDescription = m_pBrowserDescription->toPlainText();
     789    m_newData.setDescription(m_pBrowserDescription->toPlainText());
    790790    revalidate(m_pErrorPaneDescription);
    791791    updateButtonStates();
     
    11501150{
    11511151    /* Read general snapshot properties: */
    1152     m_pEditorName->setText(m_newData.m_strName);
    1153     m_pBrowserDescription->setText(m_newData.m_strDescription);
     1152    m_pEditorName->setText(m_newData.name());
     1153    m_pBrowserDescription->setText(m_newData.description());
    11541154    revalidate();
    11551155
     
    11971197    if (!pWidget || pWidget == m_pErrorPaneName)
    11981198    {
    1199         const bool fError = m_newData.m_strName.isEmpty();
     1199        const bool fError = m_newData.name().isEmpty();
    12001200        m_pErrorPaneName->setVisible(fError && m_comMachine.isNull());
    12011201    }
  • trunk/src/VBox/Frontends/VirtualBox/src/snapshots/UISnapshotDetailsWidget.h

    r96407 r96658  
    5959
    6060
    61 /** Snapshot pane: Snapshot data structure. */
    62 struct UIDataSnapshot
     61/** Snapshot pane: Snapshot data. */
     62class UIDataSnapshot
    6363{
     64public:
     65
    6466    /** Constructs data. */
    6567    UIDataSnapshot()
     
    6769        , m_strDescription(QString())
    6870    {}
     71
     72    /** Returns name. */
     73    QString name() const { return m_strName; }
     74    /** Defines @a strName. */
     75    void setName(const QString &strName) { m_strName = strName; }
     76
     77    /** Returns description. */
     78    QString description() const { return m_strDescription; }
     79    /** Defines @a strDescription. */
     80    void setDescription(const QString &strDescription) { m_strDescription = strDescription; }
    6981
    7082    /** Returns whether the @a other passed data is equal to this one. */
     
    8294    bool operator!=(const UIDataSnapshot &other) const { return !equal(other); }
    8395
    84     /** Holds the snapshot name. */
    85     QString m_strName;
    86     /** Holds the snapshot description. */
    87     QString m_strDescription;
     96protected:
     97
     98    /** Holds the name. */
     99    QString  m_strName;
     100    /** Holds the description. */
     101    QString  m_strDescription;
    88102};
    89103
  • trunk/src/VBox/Frontends/VirtualBox/src/snapshots/UISnapshotPane.cpp

    r96635 r96658  
    8787
    8888    /** Constructs normal snapshot item (child of tree-widget). */
    89     UISnapshotItem(UISnapshotPane *pSnapshotWidget, QITreeWidget *pTreeWidget, const CSnapshot &comSnapshot);
     89    UISnapshotItem(UISnapshotPane *pSnapshotWidget,
     90                   QITreeWidget *pTreeWidget,
     91                   const CSnapshot &comSnapshot);
    9092    /** Constructs normal snapshot item (child of tree-widget-item). */
    91     UISnapshotItem(UISnapshotPane *pSnapshotWidget, QITreeWidgetItem *pRootItem, const CSnapshot &comSnapshot);
     93    UISnapshotItem(UISnapshotPane *pSnapshotWidget,
     94                   QITreeWidgetItem *pRootItem,
     95                   const CSnapshot &comSnapshot);
    9296
    9397    /** Constructs "current state" item (child of tree-widget). */
    94     UISnapshotItem(UISnapshotPane *pSnapshotWidget, QITreeWidget *pTreeWidget, const CMachine &comMachine);
     98    UISnapshotItem(UISnapshotPane *pSnapshotWidget,
     99                   QITreeWidget *pTreeWidget,
     100                   const CMachine &comMachine);
    95101    /** Constructs "current state" item (child of tree-widget-item). */
    96     UISnapshotItem(UISnapshotPane *pSnapshotWidget, QITreeWidgetItem *pRootItem, const CMachine &comMachine);
     102    UISnapshotItem(UISnapshotPane *pSnapshotWidget,
     103                   QITreeWidgetItem *pRootItem,
     104                   const CMachine &comMachine);
    97105
    98106    /** Returns item machine. */
     
    200208}
    201209
    202 UISnapshotItem::UISnapshotItem(UISnapshotPane *pSnapshotWidget, QITreeWidget *pTreeWidget, const CSnapshot &comSnapshot)
     210UISnapshotItem::UISnapshotItem(UISnapshotPane *pSnapshotWidget,
     211                               QITreeWidget *pTreeWidget,
     212                               const CSnapshot &comSnapshot)
    203213    : QITreeWidgetItem(pTreeWidget)
    204214    , m_pSnapshotWidget(pSnapshotWidget)
     
    212222}
    213223
    214 UISnapshotItem::UISnapshotItem(UISnapshotPane *pSnapshotWidget, QITreeWidgetItem *pRootItem, const CSnapshot &comSnapshot)
     224UISnapshotItem::UISnapshotItem(UISnapshotPane *pSnapshotWidget,
     225                               QITreeWidgetItem *pRootItem,
     226                               const CSnapshot &comSnapshot)
    215227    : QITreeWidgetItem(pRootItem)
    216228    , m_pSnapshotWidget(pSnapshotWidget)
     
    224236}
    225237
    226 UISnapshotItem::UISnapshotItem(UISnapshotPane *pSnapshotWidget, QITreeWidget *pTreeWidget, const CMachine &comMachine)
     238UISnapshotItem::UISnapshotItem(UISnapshotPane *pSnapshotWidget,
     239                               QITreeWidget *pTreeWidget,
     240                               const CMachine &comMachine)
    227241    : QITreeWidgetItem(pTreeWidget)
    228242    , m_pSnapshotWidget(pSnapshotWidget)
     
    244258}
    245259
    246 UISnapshotItem::UISnapshotItem(UISnapshotPane *pSnapshotWidget, QITreeWidgetItem *pRootItem, const CMachine &comMachine)
     260UISnapshotItem::UISnapshotItem(UISnapshotPane *pSnapshotWidget,
     261                               QITreeWidgetItem *pRootItem,
     262                               const CMachine &comMachine)
    247263    : QITreeWidgetItem(pRootItem)
    248264    , m_pSnapshotWidget(pSnapshotWidget)
     
    452468    /* Prepare tool-tip: */
    453469    QString strToolTip = QString("<nobr><b>%1</b>%2</nobr><br><nobr>%3</nobr>")
    454                              .arg(text(Column_Name)).arg(strDetails).arg(strDateTime);
     470                             .arg(name()).arg(strDetails).arg(strDateTime);
    455471
    456472    /* Append description if any: */
     
    968984        /* Take snapshot: */
    969985        UINotificationProgressSnapshotTake *pNotification = new UINotificationProgressSnapshotTake(m_comMachine,
    970                                                                                                    newData.m_strName,
    971                                                                                                    newData.m_strDescription);
     986                                                                                                   newData.name(),
     987                                                                                                   newData.description());
    972988        gpNotificationCenter->append(pNotification);
    973989    }
     
    10031019            {
    10041020                /* Save snapshot name: */
    1005                 if (newData.m_strName != oldData.m_strName)
     1021                if (newData.name() != oldData.name())
    10061022                {
    1007                     comSnapshot.SetName(newData.m_strName);
     1023                    comSnapshot.SetName(newData.name());
    10081024                    if (!comSnapshot.isOk())
    10091025                    {
    1010                         UINotificationMessage::cannotChangeSnapshot(comSnapshot, oldData.m_strName, comMachine.GetName());
     1026                        UINotificationMessage::cannotChangeSnapshot(comSnapshot, oldData.name(), comMachine.GetName());
    10111027                        break;
    10121028                    }
     
    10141030
    10151031                /* Save snapshot description: */
    1016                 if (newData.m_strDescription != oldData.m_strDescription)
     1032                if (newData.description() != oldData.description())
    10171033                {
    1018                     comSnapshot.SetDescription(newData.m_strDescription);
     1034                    comSnapshot.SetDescription(newData.description());
    10191035                    if (!comSnapshot.isOk())
    10201036                    {
    1021                         UINotificationMessage::cannotChangeSnapshot(comSnapshot, oldData.m_strName, comMachine.GetName());
     1037                        UINotificationMessage::cannotChangeSnapshot(comSnapshot, oldData.name(), comMachine.GetName());
    10221038                        break;
    10231039                    }
     
    11261142        {
    11271143            /* Rename corresponding snapshot if necessary: */
    1128             if (comSnapshot.GetName() != pSnapshotItem->text(Column_Name))
     1144            if (comSnapshot.GetName() != pSnapshotItem->name())
    11291145            {
    11301146                /* We need to open a session when we manipulate the snapshot data of a machine: */
     
    11351151
    11361152                    /* Save snapshot name: */
    1137                     comSnapshot.SetName(pSnapshotItem->text(Column_Name));
     1153                    comSnapshot.SetName(pSnapshotItem->name());
    11381154
    11391155                    /* Close the session again: */
     
    15471563    while (*iterator)
    15481564    {
    1549         const QString strName = static_cast<UISnapshotItem*>(*iterator)->text(Column_Name);
     1565        const QString strName = static_cast<UISnapshotItem*>(*iterator)->name();
    15501566        const int iPosition = reName.indexIn(strName);
    15511567        if (iPosition != -1)
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