Changeset 100082 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jun 6, 2023 10:14:19 AM (20 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICustomFileSystemModel.cpp
r100081 r100082 53 53 , m_fIsHidden(false) 54 54 { 55 for (int i = static_cast<int>(UICustomFileSystemModel Column_Name);56 i < static_cast<int>(UICustomFileSystemModel Column_Max); ++i)57 m_itemData[static_cast<UICustomFileSystemModel Column>(i)] = QVariant();58 m_itemData[UICustomFileSystemModel Column_Name] = strName;55 for (int i = static_cast<int>(UICustomFileSystemModelData_Name); 56 i < static_cast<int>(UICustomFileSystemModelData_Max); ++i) 57 m_itemData[static_cast<UICustomFileSystemModelData>(i)] = QVariant(); 58 m_itemData[UICustomFileSystemModelData_Name] = strName; 59 59 if (parent) 60 60 parent->appendChild(this); … … 132 132 QVariant UICustomFileSystemItem::data(int column) const 133 133 { 134 return m_itemData.value(static_cast<UICustomFileSystemModel Column>(column), QVariant());134 return m_itemData.value(static_cast<UICustomFileSystemModelData>(column), QVariant()); 135 135 } 136 136 137 137 QString UICustomFileSystemItem::name() const 138 138 { 139 QVariant data = m_itemData.value(UICustomFileSystemModel Column_Name, QVariant());139 QVariant data = m_itemData.value(UICustomFileSystemModelData_Name, QVariant()); 140 140 if (!data.canConvert(QMetaType::QString)) 141 141 return QString(); … … 145 145 void UICustomFileSystemItem::setData(const QVariant &data, int index) 146 146 { 147 m_itemData[static_cast<UICustomFileSystemModel Column>(index)] = data;148 } 149 150 void UICustomFileSystemItem::setData(const QVariant &data, UICustomFileSystemModel ColumnenmColumn)147 m_itemData[static_cast<UICustomFileSystemModelData>(index)] = data; 148 } 149 150 void UICustomFileSystemItem::setData(const QVariant &data, UICustomFileSystemModelData enmColumn) 151 151 { 152 152 m_itemData[enmColumn] = data; … … 199 199 QString UICustomFileSystemItem::path(bool fRemoveTrailingDelimiters /* = false */) const 200 200 { 201 const QString &strPath = m_itemData.value(UICustomFileSystemModel Column_ISOPath, QString()).toString();201 const QString &strPath = m_itemData.value(UICustomFileSystemModelData_ISOPath, QString()).toString(); 202 202 203 203 if (fRemoveTrailingDelimiters) … … 211 211 if (path.isNull() || path.isEmpty()) 212 212 return; 213 m_itemData[UICustomFileSystemModel Column_ISOPath] = path;213 m_itemData[UICustomFileSystemModelData_ISOPath] = path; 214 214 } 215 215 … … 307 307 308 308 /* If the sort column is QDateTime than handle it correctly: */ 309 if (sortColumn() == UICustomFileSystemModel Column_ChangeTime)310 { 311 QVariant dataLeft = pLeftItem->data(UICustomFileSystemModel Column_ChangeTime);312 QVariant dataRight = pRightItem->data(UICustomFileSystemModel Column_ChangeTime);309 if (sortColumn() == UICustomFileSystemModelData_ChangeTime) 310 { 311 QVariant dataLeft = pLeftItem->data(UICustomFileSystemModelData_ChangeTime); 312 QVariant dataRight = pRightItem->data(UICustomFileSystemModelData_ChangeTime); 313 313 QDateTime leftDateTime = dataLeft.toDateTime(); 314 314 QDateTime rightDateTime = dataRight.toDateTime(); … … 316 316 } 317 317 /* When we show human readble sizes in size column sorting gets confused, so do it here: */ 318 else if(sortColumn() == UICustomFileSystemModel Column_Size)319 { 320 qulonglong leftSize = pLeftItem->data(UICustomFileSystemModel Column_Size).toULongLong();321 qulonglong rightSize = pRightItem->data(UICustomFileSystemModel Column_Size).toULongLong();318 else if(sortColumn() == UICustomFileSystemModelData_Size) 319 { 320 qulonglong leftSize = pLeftItem->data(UICustomFileSystemModelData_Size).toULongLong(); 321 qulonglong rightSize = pRightItem->data(UICustomFileSystemModelData_Size).toULongLong(); 322 322 return (leftSize < rightSize); 323 323 … … 436 436 { 437 437 /* dont show anything but the name for up directories: */ 438 if (item->isUpDirectory() && index.column() != UICustomFileSystemModel Column_Name)438 if (item->isUpDirectory() && index.column() != UICustomFileSystemModelData_Name) 439 439 return QVariant(); 440 440 /* Format date/time column: */ … … 446 446 } 447 447 /* Decide whether to show human-readable file object sizes: */ 448 if (index.column() == UICustomFileSystemModel Column_Size)448 if (index.column() == UICustomFileSystemModelData_Size) 449 449 { 450 450 if (m_fShowHumanReadableSizes) … … 618 618 { 619 619 m_pRootItem = new UICustomFileSystemItem(UICustomFileSystemModel::tr("Name"), 0, KFsObjType_Directory); 620 m_pRootItem->setData(UICustomFileSystemModel::tr("Size"), UICustomFileSystemModel Column_Size);621 m_pRootItem->setData(UICustomFileSystemModel::tr("Change Time"), UICustomFileSystemModel Column_ChangeTime);622 m_pRootItem->setData(UICustomFileSystemModel::tr("Owner"), UICustomFileSystemModel Column_Owner);623 m_pRootItem->setData(UICustomFileSystemModel::tr("Permissions"), UICustomFileSystemModel Column_Permissions);624 m_pRootItem->setData(UICustomFileSystemModel::tr("Local Path"), UICustomFileSystemModel Column_LocalPath);625 m_pRootItem->setData(UICustomFileSystemModel::tr("Path"), UICustomFileSystemModel Column_ISOPath);626 } 620 m_pRootItem->setData(UICustomFileSystemModel::tr("Size"), UICustomFileSystemModelData_Size); 621 m_pRootItem->setData(UICustomFileSystemModel::tr("Change Time"), UICustomFileSystemModelData_ChangeTime); 622 m_pRootItem->setData(UICustomFileSystemModel::tr("Owner"), UICustomFileSystemModelData_Owner); 623 m_pRootItem->setData(UICustomFileSystemModel::tr("Permissions"), UICustomFileSystemModelData_Permissions); 624 m_pRootItem->setData(UICustomFileSystemModel::tr("Local Path"), UICustomFileSystemModelData_LocalPath); 625 m_pRootItem->setData(UICustomFileSystemModel::tr("Path"), UICustomFileSystemModelData_ISOPath); 626 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICustomFileSystemModel.h
r100081 r100082 41 41 #include "COMEnums.h" 42 42 43 enum UICustomFileSystemModel Column44 { 45 UICustomFileSystemModel Column_Name = 0,46 UICustomFileSystemModel Column_Size,47 UICustomFileSystemModel Column_ChangeTime,48 UICustomFileSystemModel Column_Owner,49 UICustomFileSystemModel Column_Permissions,50 UICustomFileSystemModel Column_ISOPath,51 UICustomFileSystemModel Column_LocalPath,52 UICustomFileSystemModel Column_Max43 enum UICustomFileSystemModelData 44 { 45 UICustomFileSystemModelData_Name = 0, 46 UICustomFileSystemModelData_Size, 47 UICustomFileSystemModelData_ChangeTime, 48 UICustomFileSystemModelData_Owner, 49 UICustomFileSystemModelData_Permissions, 50 UICustomFileSystemModelData_ISOPath, 51 UICustomFileSystemModelData_LocalPath, 52 UICustomFileSystemModelData_Max 53 53 }; 54 54 … … 75 75 QVariant data(int column) const; 76 76 void setData(const QVariant &data, int index); 77 void setData(const QVariant &data, UICustomFileSystemModel ColumnenmColumn);77 void setData(const QVariant &data, UICustomFileSystemModelData enmColumn); 78 78 int row() const; 79 79 UICustomFileSystemItem *parentItem(); … … 121 121 /** Used to find children by name */ 122 122 QMap<QString, UICustomFileSystemItem*> m_childMap; 123 QMap<UICustomFileSystemModel Column, QVariant> m_itemData;123 QMap<UICustomFileSystemModelData, QVariant> m_itemData; 124 124 UICustomFileSystemItem *m_parentItem; 125 125 bool m_bIsOpened; -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.cpp
r99391 r100082 559 559 if (!item) 560 560 continue; 561 item->setData(static_cast<qulonglong>(fsInfo.GetObjectSize()), UICustomFileSystemModel Column_Size);562 item->setData(changeTime, UICustomFileSystemModel Column_ChangeTime);563 item->setData(fsInfo.GetUserName(), UICustomFileSystemModel Column_Owner);564 item->setData(permissionString(fsInfo), UICustomFileSystemModel Column_Permissions);561 item->setData(static_cast<qulonglong>(fsInfo.GetObjectSize()), UICustomFileSystemModelData_Size); 562 item->setData(changeTime, UICustomFileSystemModelData_ChangeTime); 563 item->setData(fsInfo.GetUserName(), UICustomFileSystemModelData_Owner); 564 item->setData(permissionString(fsInfo), UICustomFileSystemModelData_Permissions); 565 565 item->setPath(UIPathOperations::removeTrailingDelimiters(UIPathOperations::mergePaths(strPath, fsInfo.GetName()))); 566 566 item->setIsOpened(false); -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerHostTable.cpp
r98103 r100082 161 161 continue; 162 162 163 item->setData(fileInfo.size(), UICustomFileSystemModel Column_Size);164 item->setData(fileInfo.lastModified(), UICustomFileSystemModel Column_ChangeTime);165 item->setData(fileInfo.owner(), UICustomFileSystemModel Column_Owner);166 item->setData(permissionString(fileInfo.permissions()), UICustomFileSystemModel Column_Permissions);163 item->setData(fileInfo.size(), UICustomFileSystemModelData_Size); 164 item->setData(fileInfo.lastModified(), UICustomFileSystemModelData_ChangeTime); 165 item->setData(fileInfo.owner(), UICustomFileSystemModelData_Owner); 166 item->setData(permissionString(fileInfo.permissions()), UICustomFileSystemModelData_Permissions); 167 167 item->setPath(fileInfo.absoluteFilePath()); 168 168 /* if the item is a symlink set the target path and -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.cpp
r100081 r100082 824 824 connect(m_pView, &UIGuestControlFileView::customContextMenuRequested, 825 825 this, &UIFileManagerTable::sltCreateFileViewContextMenu); 826 m_pView->hideColumn(UICustomFileSystemModel Column_ISOPath);827 m_pView->hideColumn(UICustomFileSystemModel Column_LocalPath);826 m_pView->hideColumn(UICustomFileSystemModelData_ISOPath); 827 m_pView->hideColumn(UICustomFileSystemModelData_LocalPath); 828 828 m_sessionWidgets << m_pView; 829 829 } … … 1217 1217 { 1218 1218 /* Restore the previous name. relist the view: */ 1219 pItem->setData(strOldName, static_cast<int>(UICustomFileSystemModel Column_Name));1219 pItem->setData(strOldName, static_cast<int>(UICustomFileSystemModelData_Name)); 1220 1220 relist(); 1221 1221 emit sigLogOutput(QString(pItem->path()).append(" could not be renamed"), QString(), FileManagerLogType_Error); … … 1308 1308 if (pRootItem) 1309 1309 { 1310 pRootItem->setData(UIFileManager::tr("Name"), UICustomFileSystemModel Column_Name);1311 pRootItem->setData(UIFileManager::tr("Size"), UICustomFileSystemModel Column_Size);1312 pRootItem->setData(UIFileManager::tr("Change Time"), UICustomFileSystemModel Column_ChangeTime);1313 pRootItem->setData(UIFileManager::tr("Owner"), UICustomFileSystemModel Column_Owner);1314 pRootItem->setData(UIFileManager::tr("Permissions"), UICustomFileSystemModel Column_Permissions);1310 pRootItem->setData(UIFileManager::tr("Name"), UICustomFileSystemModelData_Name); 1311 pRootItem->setData(UIFileManager::tr("Size"), UICustomFileSystemModelData_Size); 1312 pRootItem->setData(UIFileManager::tr("Change Time"), UICustomFileSystemModelData_ChangeTime); 1313 pRootItem->setData(UIFileManager::tr("Owner"), UICustomFileSystemModelData_Owner); 1314 pRootItem->setData(UIFileManager::tr("Permissions"), UICustomFileSystemModelData_Permissions); 1315 1315 } 1316 1316 } -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.cpp
r100081 r100082 209 209 UICustomFileSystemItem* pAddedItem = new UICustomFileSystemItem(fileInfo.fileName(), pParentItem, 210 210 fileType(fileInfo)); 211 pAddedItem->setData(strPath, UICustomFileSystemModel Column_LocalPath);211 pAddedItem->setData(strPath, UICustomFileSystemModelData_LocalPath); 212 212 pAddedItem->setData(UIPathOperations::mergePaths(pParentItem->path(), fileInfo.fileName()), 213 UICustomFileSystemModel Column_ISOPath);213 UICustomFileSystemModelData_ISOPath); 214 214 pAddedItem->setIsOpened(false); 215 215 if (fileInfo.isSymLink()) … … 233 233 if (!pItem) 234 234 return; 235 if (pItem->data(UICustomFileSystemModel Column_ISOPath).toString().isEmpty())236 return; 237 238 239 if (!bRemove && pItem->data(UICustomFileSystemModel Column_LocalPath).toString().isEmpty())235 if (pItem->data(UICustomFileSystemModelData_ISOPath).toString().isEmpty()) 236 return; 237 238 239 if (!bRemove && pItem->data(UICustomFileSystemModelData_LocalPath).toString().isEmpty()) 240 240 return; 241 241 if (!bRemove) 242 m_entryMap.insert(pItem->data(UICustomFileSystemModel Column_ISOPath).toString(),243 pItem->data(UICustomFileSystemModel Column_LocalPath).toString());242 m_entryMap.insert(pItem->data(UICustomFileSystemModelData_ISOPath).toString(), 243 pItem->data(UICustomFileSystemModelData_LocalPath).toString()); 244 244 else 245 m_entryMap.insert(pItem->data(UICustomFileSystemModel Column_ISOPath).toString(),245 m_entryMap.insert(pItem->data(UICustomFileSystemModelData_ISOPath).toString(), 246 246 ":remove:"); 247 247 } … … 263 263 if (pRootItem) 264 264 { 265 pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Name"), UICustomFileSystemModel Column_Name);266 pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Size"), UICustomFileSystemModel Column_Size);267 pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Change Time"), UICustomFileSystemModel Column_ChangeTime);268 pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Owner"), UICustomFileSystemModel Column_Owner);269 pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Permissions"), UICustomFileSystemModel Column_Permissions);270 pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Local Path"), UICustomFileSystemModel Column_LocalPath);271 pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "ISO Path"), UICustomFileSystemModel Column_ISOPath);265 pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Name"), UICustomFileSystemModelData_Name); 266 pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Size"), UICustomFileSystemModelData_Size); 267 pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Change Time"), UICustomFileSystemModelData_ChangeTime); 268 pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Owner"), UICustomFileSystemModelData_Owner); 269 pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Permissions"), UICustomFileSystemModelData_Permissions); 270 pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "Local Path"), UICustomFileSystemModelData_LocalPath); 271 pRootItem->setData(QApplication::translate("UIVisoCreatorWidget", "ISO Path"), UICustomFileSystemModelData_ISOPath); 272 272 } 273 273 } … … 321 321 UICustomFileSystemItem* pAddedItem = new UICustomFileSystemItem(strNewDirectoryName, pParentItem, 322 322 KFsObjType_Directory); 323 pAddedItem->setData(UIPathOperations::mergePaths(pParentItem->path(), strNewDirectoryName), UICustomFileSystemModel Column_ISOPath);323 pAddedItem->setData(UIPathOperations::mergePaths(pParentItem->path(), strNewDirectoryName), UICustomFileSystemModelData_ISOPath); 324 324 325 325 pAddedItem->setIsOpened(false); … … 341 341 if (!pItem) 342 342 continue; 343 QString strIsoPath = pItem->data(UICustomFileSystemModel Column_ISOPath).toString();343 QString strIsoPath = pItem->data(UICustomFileSystemModelData_ISOPath).toString(); 344 344 if (strIsoPath.isEmpty()) 345 345 continue; … … 401 401 m_pTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers); 402 402 /* Show only the 0th column that is "name': */ 403 m_pTreeView->hideColumn(UICustomFileSystemModel Column_Owner);404 m_pTreeView->hideColumn(UICustomFileSystemModel Column_Permissions);405 m_pTreeView->hideColumn(UICustomFileSystemModel Column_Size);406 m_pTreeView->hideColumn(UICustomFileSystemModel Column_ChangeTime);407 m_pTreeView->hideColumn(UICustomFileSystemModel Column_ISOPath);408 m_pTreeView->hideColumn(UICustomFileSystemModel Column_LocalPath);403 m_pTreeView->hideColumn(UICustomFileSystemModelData_Owner); 404 m_pTreeView->hideColumn(UICustomFileSystemModelData_Permissions); 405 m_pTreeView->hideColumn(UICustomFileSystemModelData_Size); 406 m_pTreeView->hideColumn(UICustomFileSystemModelData_ChangeTime); 407 m_pTreeView->hideColumn(UICustomFileSystemModelData_ISOPath); 408 m_pTreeView->hideColumn(UICustomFileSystemModelData_LocalPath); 409 409 } 410 410 … … 436 436 m_pTableView->setModel(m_pTableProxyModel); 437 437 setTableRootIndex(); 438 m_pTableView->hideColumn(UICustomFileSystemModel Column_Owner);439 m_pTableView->hideColumn(UICustomFileSystemModel Column_Permissions);440 m_pTableView->hideColumn(UICustomFileSystemModel Column_Size);441 m_pTableView->hideColumn(UICustomFileSystemModel Column_ChangeTime);438 m_pTableView->hideColumn(UICustomFileSystemModelData_Owner); 439 m_pTableView->hideColumn(UICustomFileSystemModelData_Permissions); 440 m_pTableView->hideColumn(UICustomFileSystemModelData_Size); 441 m_pTableView->hideColumn(UICustomFileSystemModelData_ChangeTime); 442 442 443 443 m_pTableView->setSortingEnabled(true); … … 527 527 if (pItem) 528 528 { 529 QString strPath = pItem->data(UICustomFileSystemModel Column_ISOPath).toString();529 QString strPath = pItem->data(UICustomFileSystemModelData_ISOPath).toString(); 530 530 updateLocationSelectorText(strPath); 531 531 } … … 648 648 should be empty: */ 649 649 if (directoryItem->type() != KFsObjType_Directory || 650 directoryItem->data(UICustomFileSystemModel Column_LocalPath).toString().isEmpty())651 return; 652 QDir directory(directoryItem->data(UICustomFileSystemModel Column_LocalPath).toString());650 directoryItem->data(UICustomFileSystemModelData_LocalPath).toString().isEmpty()) 651 return; 652 QDir directory(directoryItem->data(UICustomFileSystemModelData_LocalPath).toString()); 653 653 if (directory.exists() && !directoryItem->isOpened()) 654 654 { … … 662 662 directoryItem, 663 663 fileType(fileInfo)); 664 newItem->setData(fileInfo.filePath(), UICustomFileSystemModel Column_LocalPath);664 newItem->setData(fileInfo.filePath(), UICustomFileSystemModelData_LocalPath); 665 665 666 666 newItem->setData(UIPathOperations::mergePaths(directoryItem->path(), fileInfo.fileName()), 667 UICustomFileSystemModel Column_ISOPath);667 UICustomFileSystemModelData_ISOPath); 668 668 if (fileInfo.isSymLink()) 669 669 { … … 698 698 const QString strName(QDir::toNativeSeparators("/")); 699 699 700 rootItem()->child(0)->setData(strName, UICustomFileSystemModel Column_Name);700 rootItem()->child(0)->setData(strName, UICustomFileSystemModelData_Name); 701 701 /* If the table root index is the start item then we have to update the location selector text here: */ 702 702 if (m_pTableProxyModel->mapToSource(m_pTableView->rootIndex()).internalPointer() == rootItem()->child(0)) … … 735 735 { 736 736 /* Restore the previous name in case the @strNewName is a duplicate: */ 737 pItem->setData(strOldName, static_cast<int>(UICustomFileSystemModel Column_Name));738 } 739 740 pItem->setData(UIPathOperations::mergePaths(pItem->parentItem()->path(), pItem->name()), UICustomFileSystemModel Column_ISOPath);737 pItem->setData(strOldName, static_cast<int>(UICustomFileSystemModelData_Name)); 738 } 739 740 pItem->setData(UIPathOperations::mergePaths(pItem->parentItem()->path(), pItem->name()), UICustomFileSystemModelData_ISOPath); 741 741 if (m_pTableProxyModel) 742 742 m_pTableProxyModel->invalidate();
Note:
See TracChangeset
for help on using the changeset viewer.