- Timestamp:
- Dec 6, 2023 9:55:27 AM (10 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 2 deleted
- 3 edited
-
Makefile.kmk (modified) (2 diffs)
-
src/medium/viso/UIVisoBrowserBase.cpp (deleted)
-
src/medium/viso/UIVisoBrowserBase.h (deleted)
-
src/medium/viso/UIVisoContentBrowser.cpp (modified) (8 diffs)
-
src/medium/viso/UIVisoContentBrowser.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r102485 r102493 861 861 src/medium/UIMediumSearchWidget.h \ 862 862 src/medium/UIMediumSelector.h \ 863 src/medium/viso/UIVisoBrowserBase.h \864 863 src/medium/viso/UIVisoContentBrowser.h \ 865 864 src/medium/viso/UIVisoCreator.h \ … … 1443 1442 src/medium/UIMediumSearchWidget.cpp \ 1444 1443 src/medium/UIMediumSelector.cpp \ 1445 src/medium/viso/UIVisoBrowserBase.cpp \1446 1444 src/medium/viso/UIVisoContentBrowser.cpp \ 1447 1445 src/medium/viso/UIVisoCreator.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.cpp
r102485 r102493 34 34 #include <QHeaderView> 35 35 #include <QMimeData> 36 #include <QLabel> 36 37 #include <QTableView> 37 38 #include <QTextStream> … … 41 42 #include "UIActionPool.h" 42 43 #include "UIFileSystemModel.h" 44 #include "UIFileTableNavigationWidget.h" 43 45 #include "UIPathOperations.h" 44 46 #include "UIVisoContentBrowser.h" … … 241 243 242 244 UIVisoContentBrowser::UIVisoContentBrowser(UIActionPool *pActionPool, QWidget *pParent) 243 : UIVisoBrowserBase(pActionPool,pParent)245 : QIWithRetranslateUI<QWidget>(pParent) 244 246 , m_pTableView(0) 245 247 , m_pModel(0) 246 248 , m_pTableProxyModel(0) 249 , m_pMainLayout(0) 250 , m_pToolBar(0) 251 , m_pNavigationWidget(0) 252 , m_pFileTableLabel(0) 253 , m_pActionPool(pActionPool) 247 254 , m_pRemoveAction(0) 248 255 , m_pRestoreAction(0) … … 250 257 , m_pRenameAction(0) 251 258 , m_pResetAction(0) 259 , m_pGoUp(0) 260 , m_pGoForward(0) 261 , m_pGoBackward(0) 252 262 { 253 263 prepareObjects(); … … 577 587 void UIVisoContentBrowser::prepareObjects() 578 588 { 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 580 612 581 613 m_pModel = new UIFileSystemModel(this); … … 713 745 void UIVisoContentBrowser::prepareConnections() 714 746 { 715 UIVisoBrowserBase::prepareConnections(); 747 if (m_pNavigationWidget) 748 connect(m_pNavigationWidget, &UIFileTableNavigationWidget::sigPathChanged, 749 this, &UIVisoContentBrowser::sltNavigationWidgetPathChange); 716 750 717 751 if (m_pTableView) 718 752 { 719 753 connect(m_pTableView, &UIVisoContentTableView::doubleClicked, 720 this, &UIViso BrowserBase::sltTableViewItemDoubleClick);754 this, &UIVisoContentBrowser::sltTableViewItemDoubleClick); 721 755 connect(m_pTableView, &UIVisoContentTableView::sigNewItemsDropped, 722 756 this, &UIVisoContentBrowser::sltDroppedItems); … … 1130 1164 } 1131 1165 1166 void UIVisoContentBrowser::sltNavigationWidgetPathChange(const QString &strPath) 1167 { 1168 setPathFromNavigationWidget(strPath); 1169 enableForwardBackwardActions(); 1170 } 1171 1172 void UIVisoContentBrowser::sltTableViewItemDoubleClick(const QModelIndex &index) 1173 { 1174 tableViewItemDoubleClick(index); 1175 } 1176 1177 void UIVisoContentBrowser::sltGoForward() 1178 { 1179 if (m_pNavigationWidget) 1180 m_pNavigationWidget->goForwardInHistory(); 1181 } 1182 1183 void UIVisoContentBrowser::sltGoBackward() 1184 { 1185 if (m_pNavigationWidget) 1186 m_pNavigationWidget->goBackwardInHistory(); 1187 } 1188 1132 1189 QList<UIFileSystemItem*> UIVisoContentBrowser::tableSelectedItems() 1133 1190 { … … 1227 1284 } 1228 1285 1286 void UIVisoContentBrowser::updateNavigationWidgetPath(const QString &strPath) 1287 { 1288 if (!m_pNavigationWidget) 1289 return; 1290 m_pNavigationWidget->setPath(strPath); 1291 } 1292 1293 void UIVisoContentBrowser::setFileTableLabelText(const QString &strText) 1294 { 1295 if (m_pFileTableLabel) 1296 m_pFileTableLabel->setText(strText); 1297 } 1298 1299 void 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 1229 1308 #include "UIVisoContentBrowser.moc" -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.h
r102485 r102493 43 43 /* Forward declarations: */ 44 44 class QFileInfo; 45 class QLabel; 45 46 class UIFileSystemItem; 46 47 class UIFileSystemModel; 47 48 class UIFileSystemProxyModel; 49 class UIFileTableNavigationWidget; 48 50 class UIVisoContentTableView; 49 51 50 52 /** A UIVisoBrowserBase extension to view content of a VISO as a file tree. */ 51 class UIVisoContentBrowser : public UIVisoBrowserBase53 class UIVisoContentBrowser : public QIWithRetranslateUI<QWidget> 52 54 { 53 55 Q_OBJECT; … … 72 74 * .viso file. */ 73 75 QStringList entryList(); 74 v irtual void showHideHiddenObjects(bool bShow) override final;76 void showHideHiddenObjects(bool bShow); 75 77 76 78 void parseVisoFileContent(const QString &strFileName); … … 94 96 void sltItemRenameAction(); 95 97 void sltGoUp(); 98 void sltNavigationWidgetPathChange(const QString &strPath); 99 void sltTableViewItemDoubleClick(const QModelIndex &index); 100 void sltGoForward(); 101 void sltGoBackward(); 96 102 97 103 protected: 98 104 99 105 void retranslateUi() final override; 100 v irtual void tableViewItemDoubleClick(const QModelIndex &index) final override;101 v irtual void setPathFromNavigationWidget(const QString &strPath) final override;102 v irtual 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()); 103 109 104 110 private slots: … … 111 117 private: 112 118 113 void prepareObjects();114 void prepareConnections();115 void prepareToolBar();116 void initializeModel();119 void prepareObjects(); 120 void prepareConnections(); 121 void prepareToolBar(); 122 void initializeModel(); 117 123 UIFileSystemItem *rootItem(); 118 124 /* Child of root. */ 119 125 UIFileSystemItem *startItem(); 120 121 QModelIndex convertIndexToTableIndex(const QModelIndex &index); 126 QModelIndex convertIndexToTableIndex(const QModelIndex &index); 122 127 /** 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); 125 130 /** 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); 130 135 /** Creates and entry for pItem consisting of a map item (key is viso path and value is host file system path) 131 136 * if @p bRemove is true then the value is the string ":remove:" which effectively removes the file object 132 137 * 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; 135 140 UIFileSystemItem* searchItemByPath(const QString &strPath); 136 void goToStart();141 void goToStart(); 137 142 /** Returns a list of items which are currecntly selected 138 143 * in the table view. */ 139 144 QList<UIFileSystemItem*> tableSelectedItems(); 145 const UIFileSystemItem* currentDirectoryItem() const; 146 140 147 /* 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); 145 152 /* 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; 155 164 /** keys of m_entryMap are iso locations and values are 156 165 * local location of file objects. these keys and values are 157 166 * 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; 165 181 }; 166 182
Note:
See TracChangeset
for help on using the changeset viewer.

