VirtualBox

Changeset 102493 in vbox


Ignore:
Timestamp:
Dec 6, 2023 9:55:27 AM (10 months ago)
Author:
vboxsync
Message:

FE/Qt: ​bugref:9080, bugref:10141. Removing obsolete UIVisoBrowserBase class.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r102485 r102493  
    861861        src/medium/UIMediumSearchWidget.h \
    862862        src/medium/UIMediumSelector.h \
    863         src/medium/viso/UIVisoBrowserBase.h \
    864863        src/medium/viso/UIVisoContentBrowser.h \
    865864        src/medium/viso/UIVisoCreator.h \
     
    14431442        src/medium/UIMediumSearchWidget.cpp \
    14441443        src/medium/UIMediumSelector.cpp \
    1445         src/medium/viso/UIVisoBrowserBase.cpp \
    14461444        src/medium/viso/UIVisoContentBrowser.cpp \
    14471445        src/medium/viso/UIVisoCreator.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.cpp

    r102485 r102493  
    3434#include <QHeaderView>
    3535#include <QMimeData>
     36#include <QLabel>
    3637#include <QTableView>
    3738#include <QTextStream>
     
    4142#include "UIActionPool.h"
    4243#include "UIFileSystemModel.h"
     44#include "UIFileTableNavigationWidget.h"
    4345#include "UIPathOperations.h"
    4446#include "UIVisoContentBrowser.h"
     
    241243
    242244UIVisoContentBrowser::UIVisoContentBrowser(UIActionPool *pActionPool, QWidget *pParent)
    243     : UIVisoBrowserBase(pActionPool, pParent)
     245    : QIWithRetranslateUI<QWidget>(pParent)
    244246    , m_pTableView(0)
    245247    , m_pModel(0)
    246248    , m_pTableProxyModel(0)
     249    , m_pMainLayout(0)
     250    , m_pToolBar(0)
     251    , m_pNavigationWidget(0)
     252    , m_pFileTableLabel(0)
     253    , m_pActionPool(pActionPool)
    247254    , m_pRemoveAction(0)
    248255    , m_pRestoreAction(0)
     
    250257    , m_pRenameAction(0)
    251258    , m_pResetAction(0)
     259    , m_pGoUp(0)
     260    , m_pGoForward(0)
     261    , m_pGoBackward(0)
    252262{
    253263    prepareObjects();
     
    577587void UIVisoContentBrowser::prepareObjects()
    578588{
    579     UIVisoBrowserBase::prepareObjects();
     589    m_pMainLayout = new QGridLayout;
     590    AssertPtrReturnVoid(m_pMainLayout);
     591    setLayout(m_pMainLayout);
     592
     593    QHBoxLayout *pTopLayout = new QHBoxLayout;
     594    AssertPtrReturnVoid(pTopLayout);
     595
     596    m_pToolBar = new QIToolBar;
     597    m_pNavigationWidget = new UIFileTableNavigationWidget;
     598    m_pFileTableLabel = new QLabel;
     599
     600    AssertReturnVoid(m_pToolBar);
     601    AssertReturnVoid(m_pNavigationWidget);
     602    AssertReturnVoid(m_pFileTableLabel);
     603
     604    pTopLayout->addWidget(m_pFileTableLabel);
     605    pTopLayout->addWidget(m_pNavigationWidget);
     606
     607    m_pMainLayout->addWidget(m_pToolBar, 0, 0, 1, 4);
     608    m_pMainLayout->addLayout(pTopLayout, 1, 0, 1, 4);
     609
     610    m_pMainLayout->setRowStretch(2, 2);
     611
    580612
    581613    m_pModel = new UIFileSystemModel(this);
     
    713745void UIVisoContentBrowser::prepareConnections()
    714746{
    715     UIVisoBrowserBase::prepareConnections();
     747    if (m_pNavigationWidget)
     748        connect(m_pNavigationWidget, &UIFileTableNavigationWidget::sigPathChanged,
     749                this, &UIVisoContentBrowser::sltNavigationWidgetPathChange);
    716750
    717751    if (m_pTableView)
    718752    {
    719753        connect(m_pTableView, &UIVisoContentTableView::doubleClicked,
    720                 this, &UIVisoBrowserBase::sltTableViewItemDoubleClick);
     754                this, &UIVisoContentBrowser::sltTableViewItemDoubleClick);
    721755        connect(m_pTableView, &UIVisoContentTableView::sigNewItemsDropped,
    722756                this, &UIVisoContentBrowser::sltDroppedItems);
     
    11301164}
    11311165
     1166void UIVisoContentBrowser::sltNavigationWidgetPathChange(const QString &strPath)
     1167{
     1168    setPathFromNavigationWidget(strPath);
     1169    enableForwardBackwardActions();
     1170}
     1171
     1172void UIVisoContentBrowser::sltTableViewItemDoubleClick(const QModelIndex &index)
     1173{
     1174    tableViewItemDoubleClick(index);
     1175}
     1176
     1177void UIVisoContentBrowser::sltGoForward()
     1178{
     1179    if (m_pNavigationWidget)
     1180        m_pNavigationWidget->goForwardInHistory();
     1181}
     1182
     1183void UIVisoContentBrowser::sltGoBackward()
     1184{
     1185    if (m_pNavigationWidget)
     1186        m_pNavigationWidget->goBackwardInHistory();
     1187}
     1188
    11321189QList<UIFileSystemItem*> UIVisoContentBrowser::tableSelectedItems()
    11331190{
     
    12271284}
    12281285
     1286void UIVisoContentBrowser::updateNavigationWidgetPath(const QString &strPath)
     1287{
     1288    if (!m_pNavigationWidget)
     1289        return;
     1290    m_pNavigationWidget->setPath(strPath);
     1291}
     1292
     1293void UIVisoContentBrowser::setFileTableLabelText(const QString &strText)
     1294{
     1295    if (m_pFileTableLabel)
     1296        m_pFileTableLabel->setText(strText);
     1297}
     1298
     1299void UIVisoContentBrowser::enableForwardBackwardActions()
     1300{
     1301    AssertReturnVoid(m_pNavigationWidget);
     1302    if (m_pGoForward)
     1303        m_pGoForward->setEnabled(m_pNavigationWidget->canGoForward());
     1304    if (m_pGoBackward)
     1305        m_pGoBackward->setEnabled(m_pNavigationWidget->canGoBackward());
     1306}
     1307
    12291308#include "UIVisoContentBrowser.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.h

    r102485 r102493  
    4343/* Forward declarations: */
    4444class QFileInfo;
     45class QLabel;
    4546class UIFileSystemItem;
    4647class UIFileSystemModel;
    4748class UIFileSystemProxyModel;
     49class UIFileTableNavigationWidget;
    4850class UIVisoContentTableView;
    4951
    5052/** A UIVisoBrowserBase extension to view content of a VISO as a file tree. */
    51 class UIVisoContentBrowser : public UIVisoBrowserBase
     53class UIVisoContentBrowser : public QIWithRetranslateUI<QWidget>
    5254{
    5355    Q_OBJECT;
     
    7274      * .viso file. */
    7375    QStringList entryList();
    74     virtual void showHideHiddenObjects(bool bShow)  override final;
     76    void showHideHiddenObjects(bool bShow);
    7577
    7678    void parseVisoFileContent(const QString &strFileName);
     
    9496    void sltItemRenameAction();
    9597    void sltGoUp();
     98    void sltNavigationWidgetPathChange(const QString &strPath);
     99    void sltTableViewItemDoubleClick(const QModelIndex &index);
     100    void sltGoForward();
     101    void sltGoBackward();
    96102
    97103protected:
    98104
    99105    void retranslateUi() final override;
    100     virtual void tableViewItemDoubleClick(const QModelIndex &index)  final override;
    101     virtual void setPathFromNavigationWidget(const QString &strPath) final override;
    102     virtual void setTableRootIndex(QModelIndex index = QModelIndex())  final override;
     106    void tableViewItemDoubleClick(const QModelIndex &index);
     107    void setPathFromNavigationWidget(const QString &strPath);
     108    void setTableRootIndex(QModelIndex index = QModelIndex());
    103109
    104110private slots:
     
    111117private:
    112118
    113     void                    prepareObjects();
    114     void                    prepareConnections();
    115     void                    prepareToolBar();
    116     void                    initializeModel();
     119    void              prepareObjects();
     120    void              prepareConnections();
     121    void              prepareToolBar();
     122    void              initializeModel();
    117123    UIFileSystemItem *rootItem();
    118124    /* Child of root. */
    119125    UIFileSystemItem *startItem();
    120 
    121     QModelIndex             convertIndexToTableIndex(const QModelIndex &index);
     126    QModelIndex       convertIndexToTableIndex(const QModelIndex &index);
    122127    /** Lists the content of the host file system directory by using Qt file system API. */
    123     void                    scanHostDirectory(UIFileSystemItem *directory, bool fRecursive);
    124     KFsObjType              fileType(const QFileInfo &fsInfo);
     128    void              scanHostDirectory(UIFileSystemItem *directory, bool fRecursive);
     129    KFsObjType        fileType(const QFileInfo &fsInfo);
    125130    /** Renames the starts item's name as VISO name changes. */
    126     void                    updateStartItemName();
    127     void                    renameFileObject(UIFileSystemItem *pItem);
    128     void                    removeItems(const QList<UIFileSystemItem*> itemList);
    129     void                    restoreItems(const QList<UIFileSystemItem*> itemList);
     131    void              updateStartItemName();
     132    void              renameFileObject(UIFileSystemItem *pItem);
     133    void              removeItems(const QList<UIFileSystemItem*> itemList);
     134    void              restoreItems(const QList<UIFileSystemItem*> itemList);
    130135    /** Creates and entry for pItem consisting of a map item (key is viso path and value is host file system path)
    131136     *  if @p bRemove is true then the value is the string ":remove:" which effectively removes the file object
    132137     *  from the iso image. */
    133     void                    createVisoEntry(const QString &strPath, const QString &strLocalPath, bool bRemove = false);
    134     QString                 currentPath() const;
     138    void              createVisoEntry(const QString &strPath, const QString &strLocalPath, bool bRemove = false);
     139    QString           currentPath() const;
    135140    UIFileSystemItem* searchItemByPath(const QString &strPath);
    136     void                    goToStart();
     141    void              goToStart();
    137142    /** Returns a list of items which are currecntly selected
    138143     *  in the table view. */
    139144    QList<UIFileSystemItem*> tableSelectedItems();
     145    const UIFileSystemItem*  currentDirectoryItem() const;
     146
    140147    /* Names of the file objects of the current directory. */
    141     QStringList                    currentDirectoryListing() const;
    142     bool                           onStartItem();
    143     void                           goUp();
    144     void                           createLoadedFileEntries(const QMap<QString, QString> &fileEntries);
     148    QStringList currentDirectoryListing() const;
     149    bool        onStartItem();
     150    void        goUp();
     151    void        createLoadedFileEntries(const QMap<QString, QString> &fileEntries);
    145152    /* Processes a list of VISO paths that are loaded from a file and indicate file object to be removed from VISO content. */
    146     void                           processRemovedEntries(const QStringList &removedEntries);
    147     const UIFileSystemItem*  currentDirectoryItem() const;
    148     void                           markRemovedUnremovedItemParents(UIFileSystemItem *pItem, bool fRemoved);
    149     void                           enableDisableSelectionDependentActions();
    150     UIVisoContentTableView        *m_pTableView;
    151     UIFileSystemModel             *m_pModel;
    152     UIFileSystemProxyModel        *m_pTableProxyModel;
    153 
    154     QString                       m_strImportedISOPath;
     153    void        processRemovedEntries(const QStringList &removedEntries);
     154    void        markRemovedUnremovedItemParents(UIFileSystemItem *pItem, bool fRemoved);
     155    void        enableDisableSelectionDependentActions();
     156    void        updateNavigationWidgetPath(const QString &strPath);
     157    void        setFileTableLabelText(const QString &strText);
     158    void        enableForwardBackwardActions();
     159    UIVisoContentTableView *m_pTableView;
     160    UIFileSystemModel      *m_pModel;
     161    UIFileSystemProxyModel *m_pTableProxyModel;
     162    QPointer<QMenu>        m_pSubMenu;
     163    QString                m_strImportedISOPath;
    155164    /** keys of m_entryMap are iso locations and values are
    156165     *  local location of file objects. these keys and values are
    157166     *  concatenated and passed to the client to create ad-hoc.viso entries. */
    158     QMap<QString, QString>        m_entryMap;
    159 
    160     QAction                      *m_pRemoveAction;
    161     QAction                      *m_pRestoreAction;
    162     QAction                      *m_pCreateNewDirectoryAction;
    163     QAction                      *m_pRenameAction;
    164     QAction                      *m_pResetAction;
     167    QMap<QString, QString> m_entryMap;
     168    QGridLayout           *m_pMainLayout;
     169    QIToolBar             *m_pToolBar;
     170    UIFileTableNavigationWidget *m_pNavigationWidget;
     171    QLabel *m_pFileTableLabel;
     172    QPointer<UIActionPool> m_pActionPool;
     173    QAction  *m_pRemoveAction;
     174    QAction  *m_pRestoreAction;
     175    QAction  *m_pCreateNewDirectoryAction;
     176    QAction  *m_pRenameAction;
     177    QAction  *m_pResetAction;
     178    QAction  *m_pGoUp;
     179    QAction  *m_pGoForward;
     180    QAction  *m_pGoBackward;
    165181};
    166182
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