Changeset 76296 in vbox for trunk/src/VBox
- Timestamp:
- Dec 19, 2018 4:17:39 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/guestctrl
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.cpp
r76177 r76296 281 281 m_panelActionMap.insert(m_pOptionsPanel, m_pActionPool->action(UIActionIndex_M_FileManager_T_Options)); 282 282 connect(m_pOptionsPanel, &UIFileManagerOptionsPanel::sigOptionsChanged, 283 this, &UIFileManager::slt ListDirectoriesBeforeChanged);283 this, &UIFileManager::sltHandleOptionsUpdated); 284 284 pTopLayout->addWidget(m_pOptionsPanel); 285 285 } … … 519 519 } 520 520 521 void UIFileManager::sltListDirectoriesBeforeChanged()522 {523 if (m_pGuestFileTable)524 m_pGuestFileTable->relist();525 if (m_pHostFileTable)526 m_pHostFileTable->relist();527 }528 529 521 void UIFileManager::sltReceieveNewFileOperation(const CProgress &comProgress) 530 522 { … … 549 541 m_pOptionsPanel->update(); 550 542 } 543 544 if (m_pGuestFileTable) 545 m_pGuestFileTable->optionsUpdated(); 546 if (m_pHostFileTable) 547 m_pHostFileTable->optionsUpdated(); 551 548 } 552 549 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.h
r76177 r76296 116 116 void sltCopyHostToGuest(); 117 117 void sltPanelActionToggled(bool fChecked); 118 void sltListDirectoriesBeforeChanged();119 118 void sltReceieveNewFileOperation(const CProgress &comProgress); 120 119 void sltFileOperationComplete(QUuid progressId); -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerModel.cpp
r76177 r76296 29 29 # include "UIFileManagerTable.h" 30 30 # include "UIFileManager.h" 31 31 # include "VBoxGlobal.h" 32 32 33 33 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ … … 37 37 UIGuestControlFileProxyModel::UIGuestControlFileProxyModel(QObject *parent /* = 0 */) 38 38 :QSortFilterProxyModel(parent) 39 { 39 , m_fListDirectoriesOnTop(false) 40 { 41 } 42 43 void UIGuestControlFileProxyModel::setListDirectoriesOnTop(bool fListDirectoriesOnTop) 44 { 45 m_fListDirectoriesOnTop = fListDirectoriesOnTop; 46 } 47 48 bool UIGuestControlFileProxyModel::listDirectoriesOnTop() const 49 { 50 return m_fListDirectoriesOnTop; 40 51 } 41 52 … … 45 56 UIFileTableItem *pRightItem = static_cast<UIFileTableItem*>(right.internalPointer()); 46 57 47 UIFileManagerOptions *pOptions = UIFileManagerOptions::instance();48 49 58 if (pLeftItem && pRightItem) 50 59 { 51 60 /* List the directories before the files if options say so: */ 52 if ( pOptions && pOptions->bListDirectoriesOnTop)61 if (m_fListDirectoriesOnTop) 53 62 { 54 63 if ((pLeftItem->isDirectory() || pLeftItem->isSymLinkToADirectory()) && !pRightItem->isDirectory()) … … 87 96 : QAbstractItemModel(parent) 88 97 , m_pParent(qobject_cast<UIFileManagerTable*>(parent)) 98 , m_fShowHumanReadableSizes(false) 89 99 { 90 100 } … … 161 171 if (index.column() == UIFileManagerModelColumn_Size) 162 172 { 163 UIFileManagerOptions* pOptions = 164 UIFileManagerOptions::instance(); 165 if (pOptions && pOptions->bShowHumanReadableSizes) 173 if (m_fShowHumanReadableSizes) 166 174 { 167 175 qulonglong size = item->data(index.column()).toULongLong(); 168 return UIFileManagerTable::humanReadableSize(size);176 return vboxGlobal().formatSize(size); 169 177 } 170 178 else … … 305 313 endResetModel(); 306 314 } 315 316 void UIFileManagerModel::setShowHumanReadableSizes(bool fShowHumanReadableSizes) 317 { 318 m_fShowHumanReadableSizes = fShowHumanReadableSizes; 319 } 320 321 bool UIFileManagerModel::showHumanReadableSizes() const 322 { 323 return m_fShowHumanReadableSizes; 324 } -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerModel.h
r76177 r76296 51 51 UIGuestControlFileProxyModel(QObject *parent = 0); 52 52 53 void setListDirectoriesOnTop(bool fListDirectoriesOnTop); 54 bool listDirectoriesOnTop() const; 55 53 56 protected: 54 57 55 58 bool lessThan(const QModelIndex &left, const QModelIndex &right) const /* override */; 59 60 private: 61 62 bool m_fListDirectoriesOnTop; 56 63 }; 57 64 … … 87 94 void beginReset(); 88 95 void endReset(); 96 void setShowHumanReadableSizes(bool fShowHumanReadableSizes); 97 bool showHumanReadableSizes() const; 98 89 99 static const char* strUpDirectoryString; 90 100 … … 95 105 UIFileManagerTable *m_pParent; 96 106 UIFileTableItem *m_pRootItem; 107 bool m_fShowHumanReadableSizes; 108 97 109 }; 98 110 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.cpp
r76177 r76296 822 822 this, &UIFileManagerTable::sltSearchTextChanged); 823 823 } 824 optionsUpdated(); 824 825 } 825 826 … … 1481 1482 } 1482 1483 1484 void UIFileManagerTable::optionsUpdated() 1485 { 1486 UIFileManagerOptions *pOptions = UIFileManagerOptions::instance(); 1487 if (pOptions) 1488 { 1489 if (m_pProxyModel) 1490 m_pProxyModel->setListDirectoriesOnTop(pOptions->bListDirectoriesOnTop); 1491 if (m_pModel) 1492 m_pModel->setShowHumanReadableSizes(pOptions->bShowHumanReadableSizes); 1493 } 1494 relist(); 1495 } 1496 1497 1483 1498 void UIFileManagerTable::sltReceiveDirectoryStatistics(UIDirectoryStatistics statistics) 1484 1499 { -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.h
r76177 r76296 263 263 QStringList selectedItemPathList(); 264 264 virtual void refresh(); 265 void relist();266 265 static const unsigned m_iKiloByte; 267 266 static QString humanReadableSize(ULONG64 size); 267 /** Peroforms whatever is necessary after a UIFileManagerOptions change. */ 268 void optionsUpdated(); 268 269 269 270 public slots: … … 370 371 private: 371 372 373 void relist(); 372 374 void prepareObjects(); 373 375 /** @p itemIndex is assumed to be 'model' index not 'proxy model' index */
Note:
See TracChangeset
for help on using the changeset viewer.