- Timestamp:
- Nov 29, 2023 12:06:14 PM (18 months ago)
- svn:sync-xref-src-repo-rev:
- 160514
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICustomFileSystemModel.cpp
r102363 r102378 62 62 63 63 if (parent) 64 { 64 65 parent->appendChild(this); 66 setParentModel(parent->parentModel()); 67 } 65 68 } 66 69 … … 207 210 QString UICustomFileSystemItem::path(bool fRemoveTrailingDelimiters /* = false */) const 208 211 { 212 const QChar delimiter('/'); 209 213 Q_UNUSED(fRemoveTrailingDelimiters); 210 214 const UICustomFileSystemItem *pParent = this; 211 215 QStringList path; 212 213 216 while(pParent && pParent->parentItem()) 214 217 { 215 printf("ffff %s %d\n", qPrintable(pParent->fileObjectName()), isDriveItem());216 218 path.prepend(pParent->fileObjectName()); 217 219 pParent = pParent->parentItem(); 218 220 } 219 220 return UIPathOperations::removeMultipleDelimiters(path.join("/")); 221 QString strPath = UIPathOperations::removeMultipleDelimiters(path.join(delimiter)); 222 if (m_pParentModel && m_pParentModel->isWindowsFileSystem()) 223 { 224 if (!strPath.isEmpty() && strPath.at(0) == delimiter) 225 strPath.remove(0, 1); 226 } 227 return UIPathOperations::addTrailingDelimiters(strPath); 221 228 } 222 229 … … 300 307 } 301 308 309 void UICustomFileSystemItem::setParentModel(UICustomFileSystemModel *pModel) 310 { 311 m_pParentModel = pModel; 312 } 313 314 UICustomFileSystemModel *UICustomFileSystemItem::parentModel() 315 { 316 return m_pParentModel; 317 } 302 318 303 319 /********************************************************************************************************************************* … … 401 417 : QAbstractItemModel(parent) 402 418 , m_fShowHumanReadableSizes(false) 419 , m_fIsWindowFileSystemModel(false) 403 420 { 404 421 m_pRootItem = new UICustomFileSystemItem(QString(), 0, KFsObjType_Directory); 422 m_pRootItem->setParentModel(this); 405 423 } 406 424 … … 666 684 pParent->removeChild(pItem); 667 685 } 686 687 void UICustomFileSystemModel::setIsWindowsFileSystem(bool fIsWindowsFileSystem) 688 { 689 m_fIsWindowFileSystemModel = fIsWindowsFileSystem; 690 } 691 692 bool UICustomFileSystemModel::isWindowsFileSystem() const 693 { 694 return m_fIsWindowFileSystemModel; 695 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICustomFileSystemModel.h
r102363 r102378 40 40 /* COM includes: */ 41 41 #include "COMEnums.h" 42 43 class UICustomFileSystemModel; 42 44 43 45 enum UICustomFileSystemModelData … … 127 129 128 130 void appendChild(UICustomFileSystemItem *child); 131 void setParentModel(UICustomFileSystemModel *pModel); 132 UICustomFileSystemModel *parentModel(); 133 129 134 QList<UICustomFileSystemItem*> m_childItems; 130 135 QMap<UICustomFileSystemModelData, QVariant> m_itemData; … … 135 140 /** True if this is a symlink and the target is a directory */ 136 141 bool m_fIsTargetADirectory; 137 KFsObjType m_type;142 KFsObjType m_type; 138 143 /** True if only this item represents a DOS style drive letter item */ 139 144 bool m_fIsDriveItem; … … 141 146 bool m_fIsHidden; 142 147 QString m_strToolTip; 148 /** Pointer to the parent model. */ 149 UICustomFileSystemModel *m_pParentModel; 150 friend UICustomFileSystemModel; 143 151 }; 144 152 … … 214 222 const UICustomFileSystemItem* rootItem() const; 215 223 224 void setIsWindowsFileSystem(bool fIsWindowsFileSystem); 225 bool isWindowsFileSystem() const; 226 216 227 static const char* strUpDirectoryString; 217 228 … … 220 231 UICustomFileSystemItem *m_pRootItem; 221 232 void setupModelData(const QStringList &lines, UICustomFileSystemItem *parent); 222 bool m_fShowHumanReadableSizes; 233 bool m_fShowHumanReadableSizes; 234 bool m_fIsWindowFileSystemModel; 223 235 }; 224 236 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPathOperations.cpp
r98103 r102378 162 162 return true; 163 163 } 164 165 /* static */ const QString UIPathOperations::replaceDosDelimeter(const QString &path) 166 { 167 QString newPath(path); 168 return newPath.replace(dosDelimiter, delimiter); 169 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPathOperations.h
r98103 r102378 61 61 /** Tries to determine if the path starts with DOS style drive letters. */ 62 62 static bool doesPathStartWithDriveLetter(const QString &path); 63 63 static const QString replaceDosDelimeter(const QString &path); 64 64 }; 65 65 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.cpp
r102363 r102378 427 427 , pszMinimumGuestAdditionVersion("6.1") 428 428 { 429 setModelFileSystem(isWindowsFileSystem()); 429 430 if (!m_comMachine.isNull()) 430 431 m_strTableName = m_comMachine.GetName(); … … 432 433 prepareGuestSessionPanel(); 433 434 prepareActionConnections(); 434 435 435 connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineStateChange, 436 436 this, &UIFileManagerGuestTable::sltMachineStateChange); … … 1590 1590 } 1591 1591 1592 bool UIFileManagerGuestTable::is FileSystemWindows() const1593 { 1594 if (!m_com Guest.isOk())1592 bool UIFileManagerGuestTable::isWindowsFileSystem() const 1593 { 1594 if (!m_comMachine.isOk()) 1595 1595 return false; 1596 return m_com Guest.GetOSTypeId().contains("windows", Qt::CaseInsensitive);1596 return m_comMachine.GetOSTypeId().contains("windows", Qt::CaseInsensitive); 1597 1597 } 1598 1598 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.h
r102363 r102378 102 102 virtual void setState(); 103 103 virtual void setSessionDependentWidgetsEnabled(); 104 virtual bool is FileSystemWindows() const override final;104 virtual bool isWindowsFileSystem() const override final; 105 105 106 106 private slots: -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerHostTable.cpp
r102363 r102378 136 136 :UIFileManagerTable(pActionPool, pParent) 137 137 { 138 setModelFileSystem(isWindowsFileSystem()); 138 139 initializeFileTree(); 139 140 prepareToolbar(); … … 261 262 } 262 263 263 bool UIFileManagerHostTable::is FileSystemWindows() const264 bool UIFileManagerHostTable::isWindowsFileSystem() const 264 265 { 265 266 return uiCommon().hostOperatingSystem().contains("windows", Qt::CaseInsensitive); -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerHostTable.h
r102363 r102378 74 74 virtual void createFileViewContextMenu(const QWidget *pWidget, const QPoint &point) override final; 75 75 virtual void toggleForwardBackwardActions() override final; 76 virtual bool is FileSystemWindows() const override final;76 virtual bool isWindowsFileSystem() const override final; 77 77 /** @name Copy/Cut host-to-host stuff. Currently not implemented. 78 78 * @{ */ -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.cpp
r102363 r102378 461 461 if (!m_pModel) 462 462 return; 463 463 464 connect(m_pModel, &UICustomFileSystemModel::sigItemRenamed, 464 465 this, &UIFileManagerTable::sltHandleItemRenameAttempt); … … 552 553 return; 553 554 554 constQString startPath("/");555 QString startPath("/"); 555 556 /* On Unix-like systems startItem represents the root directory. On Windows it is like "my computer" under which 556 557 * drives are listed: */ … … 561 562 562 563 m_pModel->signalUpdate(); 563 updateCurrentLocationEdit(startPath);564 564 m_pView->setRootIndex(m_pProxyModel->mapFromSource(m_pModel->rootIndex())); 565 updateCurrentLocationEdit(currentDirectoryPath()); 565 566 } 566 567 … … 1345 1346 } 1346 1347 1348 void UIFileManagerTable::setModelFileSystem(bool fIsWindowsFileSystem) 1349 { 1350 if (m_pModel) 1351 m_pModel->setIsWindowsFileSystem(fIsWindowsFileSystem); 1352 } 1353 1347 1354 #include "UIFileManagerTable.moc" -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.h
r102363 r102378 227 227 virtual void toggleForwardBackwardActions() = 0; 228 228 virtual bool event(QEvent *pEvent) RT_OVERRIDE; 229 virtual bool is FileSystemWindows() const = 0;229 virtual bool isWindowsFileSystem() const = 0; 230 230 /** @name Copy/Cut guest-to-guest (host-to-host) stuff. 231 231 * @{ */ … … 252 252 QHBoxLayout* toolBarLayout(); 253 253 void setSessionWidgetsEnabled(bool fEnabled); 254 void setModelFileSystem(bool fIsWindowsFileSystem); 254 255 255 256 QILabel *m_pLocationLabel; -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.h
r100955 r102378 51 51 class QIToolBar; 52 52 class UIActionPool; 53 class UIFileManagerHostTable; 53 54 class UIVisoHostBrowser; 54 55 class UIVisoContentBrowser; … … 152 153 /** @} */ 153 154 154 QVBoxLayout *m_pMainLayout; 155 UIVisoHostBrowser *m_pHostBrowser; 156 UIVisoContentBrowser *m_pVISOContentBrowser; 155 QVBoxLayout *m_pMainLayout; 156 UIVisoHostBrowser *m_pHostBrowser; 157 UIVisoContentBrowser *m_pVISOContentBrowser; 158 UIFileManagerHostTable *m_pHostFileBrowser; 157 159 158 160 QIToolBar *m_pToolBar; -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFileTableNavigationWidget.cpp
r100324 r102378 115 115 UIFileManagerBreadCrumbs::UIFileManagerBreadCrumbs(QWidget *pParent /* = 0 */) 116 116 :QLabel(pParent) 117 , m_pathSeparator( '/')117 , m_pathSeparator(UIPathOperations::delimiter) 118 118 { 119 119 float fFontMult = 1.f; … … 139 139 m_strPath = strPath; 140 140 141 const QChar separator( '/');141 const QChar separator(UIPathOperations::delimiter); 142 142 clear(); 143 143 … … 146 146 147 147 QStringList folderList = UIPathOperations::pathTrail(strPath); 148 folderList.push_front(separator); 148 if (!strPath.isEmpty() && strPath.at(0) == UIPathOperations::delimiter) 149 folderList.push_front(separator); 149 150 150 151 QString strLabelText; … … 154 155 for (int i = 0; i < folderList.size(); ++i) 155 156 { 156 QString strFolder = UIPathOperations::removeTrailingDelimiters(folderList.at(i));157 QString strFolder = folderList.at(i); 157 158 if (i != 0) 158 159 strPathUpto[i] = strPathUpto[i - 1]; 159 if (i == 0 || i == folderList.size() - 1) 160 strPathUpto[i].append(QString("%1").arg(strFolder)); 161 else 162 strPathUpto[i].append(QString("%1%2").arg(strFolder).arg(separator)); 160 strPathUpto[i].append(QString("%1%2").arg(strFolder).arg(separator)); 163 161 } 164 162 … … 166 164 for (int i = folderList.size() - 1; i >= 0; --i) 167 165 { 168 QString strFolder = UIPathOperations::removeTrailingDelimiters(folderList.at(i)).replace( '/', m_pathSeparator);166 QString strFolder = UIPathOperations::removeTrailingDelimiters(folderList.at(i)).replace(UIPathOperations::delimiter, m_pathSeparator); 169 167 QString strWord = QString("<a href=\"%1\" style=\"color:black;text-decoration:none;\">%2</a>").arg(strPathUpto[i]).arg(strFolder); 170 168 … … 214 212 , m_pAddressLineEdit(0) 215 213 , m_pSwitchButton(0) 216 , m_pathSeparator( '/')214 , m_pathSeparator(UIPathOperations::delimiter) 217 215 { 218 216 prepare(); … … 232 230 { 233 231 QString strNativeLocation(strLocation); 234 strNativeLocation.replace( '/', m_pathSeparator);232 strNativeLocation.replace(UIPathOperations::delimiter, m_pathSeparator); 235 233 int itemIndex = m_pHistoryComboBox->findText(strNativeLocation, 236 234 Qt::MatchExactly | Qt::MatchCaseSensitive); … … 369 367 void UIFileTableNavigationWidget::sltHandlePathChange(const QString &strPath) 370 368 { 371 emit sigPathChanged( QDir::fromNativeSeparators(strPath));369 emit sigPathChanged(UIPathOperations::replaceDosDelimeter(strPath)); 372 370 } 373 371
Note:
See TracChangeset
for help on using the changeset viewer.