Changeset 76690 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jan 7, 2019 7:58:10 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICustomFileSystemModel.cpp
r76671 r76690 541 541 if (!rootItem()) 542 542 return QModelIndex(); 543 if (!rootItem()->child(0)) 544 return QModelIndex(); 543 545 return createIndex(rootItem()->child(0)->row(), 0, 544 546 rootItem()->child(0)); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICustomFileSystemModel.h
r76671 r76690 50 50 51 51 /** @p strName contains file object name which is assumed to be unique among a parent object's children. */ 52 explicitUICustomFileSystemItem(const QString &strName, UICustomFileSystemItem *parentItem, KFsObjType type);53 ~UICustomFileSystemItem();52 UICustomFileSystemItem(const QString &strName, UICustomFileSystemItem *parentItem, KFsObjType type); 53 virtual ~UICustomFileSystemItem(); 54 54 55 55 void reset(); 56 UICustomFileSystemItem *child(int row) const;56 virtual UICustomFileSystemItem *child(int row) const; 57 57 /** Searches for the child by path and returns it if found. */ 58 58 UICustomFileSystemItem *child(const QString &path) const; -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r76671 r76690 2724 2724 if (pVisoCreator->execute(true, false)) 2725 2725 { 2726 QStringList files = pVisoCreator-> pathList();2726 QStringList files = pVisoCreator->entryList(); 2727 2727 if (files.empty() || files[0].isEmpty()) 2728 2728 return QUuid(); -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.cpp
r76671 r76690 127 127 128 128 UICustomFileSystemItem* pAddedItem = new UICustomFileSystemItem(fileInfo.fileName(), pParentItem, 129 fileType(fileInfo));129 fileType(fileInfo)); 130 130 pAddedItem->setData(strPath, UICustomFileSystemModelColumn_LocalPath); 131 131 pAddedItem->setData(UIPathOperations::mergePaths(pParentItem->path(), fileInfo.fileName()), … … 137 137 pAddedItem->setIsSymLinkToADirectory(QFileInfo(fileInfo.symLinkTarget()).isDir()); 138 138 } 139 139 m_entryList << createAnIsoEntry(pAddedItem); 140 140 } 141 141 if (m_pTableProxyModel) … … 148 148 } 149 149 150 QStringList UIVisoContentBrowser::pathList() 151 { 152 if (!rootItem()) 153 return QStringList(); 154 155 UICustomFileSystemItem *pRoot = rootItem()->child(0); 156 157 if (!pRoot) 158 return QStringList(); 159 160 QStringList pathList; 161 for (int i = 0; i < pRoot->childCount(); ++i) 162 { 163 QString strEntry = QString("%1=%2").arg(pRoot->child(i)->data(UICustomFileSystemModelColumn_Path).toString()). 164 arg(pRoot->child(i)->data(UICustomFileSystemModelColumn_LocalPath).toString()); 165 pathList << strEntry; 166 } 167 return pathList; 168 } 169 150 QString UIVisoContentBrowser::createAnIsoEntry(UICustomFileSystemItem *pItem) 151 { 152 QString strEntry; 153 if (!pItem) 154 return strEntry; 155 if (pItem->data(UICustomFileSystemModelColumn_Path).toString().isEmpty() || 156 pItem->data(UICustomFileSystemModelColumn_LocalPath).toString().isEmpty()) 157 return strEntry; 158 strEntry = QString("%1=%2").arg(pItem->data(UICustomFileSystemModelColumn_Path).toString()). 159 arg(pItem->data(UICustomFileSystemModelColumn_LocalPath).toString()); 160 return strEntry; 161 } 162 163 QStringList UIVisoContentBrowser::entryList() 164 { 165 return m_entryList; 166 } 170 167 171 168 void UIVisoContentBrowser::retranslateUi() … … 240 237 UICustomFileSystemItem* pAddedItem = new UICustomFileSystemItem(strNewDirectoryName, pParentItem, 241 238 KFsObjType_Directory); 239 pAddedItem->setData(UIPathOperations::mergePaths(pParentItem->path(), strNewDirectoryName), UICustomFileSystemModelColumn_Path); 242 240 243 241 pAddedItem->setIsOpened(false); … … 482 480 UICustomFileSystemItem *newItem = new UICustomFileSystemItem(fileInfo.fileName(), 483 481 directoryItem, 484 482 fileType(fileInfo)); 485 483 newItem->setData(fileInfo.filePath(), UICustomFileSystemModelColumn_LocalPath); 486 484 … … 547 545 } 548 546 547 pItem->setData(UIPathOperations::mergePaths(pItem->parentItem()->path(), pItem->name()), UICustomFileSystemModelColumn_Path); 548 549 550 549 551 if (m_pTableProxyModel) 550 552 m_pTableProxyModel->invalidate(); 551 553 } 552 554 555 void UIVisoContentBrowser::reset() 556 { 557 m_entryList.clear(); 558 } 553 559 #include "UIVisoContentBrowser.moc" -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.h
r76671 r76690 38 38 39 39 /* Forward declarations: */ 40 class UICustomFileSystemItem; 40 41 class UICustomFileSystemModel; 41 class UICustomFileSystemItem;42 42 class UICustomFileSystemProxyModel; 43 43 class UIVisoContentTreeProxyModel; 44 class UICustomFileSystemItem; 44 45 45 46 class SHARED_LIBRARY_STUFF UIVisoContentBrowser : public QIWithRetranslateUI<UIVisoBrowserBase> … … 53 54 /** Adds file objests from the host file system. @p pathList consists of list of paths to there objects. */ 54 55 void addObjectsToViso(QStringList pathList); 55 QStringList pathList();56 QStringList entryList(); 56 57 virtual void showHideHiddenObjects(bool bShow) /* override */; 57 58 … … 82 83 void prepareConnections(); 83 84 void initializeModel(); 84 UICustomFileSystemItem *rootItem();85 UICustomFileSystemItem *rootItem(); 85 86 QModelIndex convertIndexToTableIndex(const QModelIndex &index); 86 87 QModelIndex convertIndexToTreeIndex(const QModelIndex &index); … … 89 90 void updateStartItemName(); 90 91 void renameFileObject(UICustomFileSystemItem *pItem); 92 QString createAnIsoEntry(UICustomFileSystemItem *pItem); 93 void reset(); 91 94 92 95 UICustomFileSystemModel *m_pModel; … … 95 98 QIToolButton *m_pNewDirectoryButton; 96 99 QString m_strVisoName; 100 QStringList m_entryList; 97 101 }; 98 102 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp
r76671 r76690 52 52 } 53 53 54 QStringList UIVisoCreator:: pathList()54 QStringList UIVisoCreator::entryList() 55 55 { 56 56 if (!m_pVisoBrowser) 57 57 return QStringList(); 58 return m_pVisoBrowser-> pathList();58 return m_pVisoBrowser->entryList(); 59 59 } 60 60 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.h
r76676 r76690 53 53 UIVisoCreator(QWidget *pParent = 0); 54 54 ~UIVisoCreator(); 55 QStringList pathList();55 QStringList entryList(); 56 56 57 57 #ifdef VBOX_WS_MAC
Note:
See TracChangeset
for help on using the changeset viewer.