Changeset 75480 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Nov 15, 2018 12:26:08 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/guestctrl
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManager.cpp
r75425 r75480 113 113 : bListDirectoriesOnTop(true) 114 114 , bAskDeleteConfirmation(false) 115 , bShowHumanReadableSizes(true) 115 116 { 116 117 } … … 255 256 } 256 257 257 // m_pFileOperationsList = new UIFileOperationsList;258 // if (m_pFileOperationsList)259 // {260 // m_pTabWidget->addTab(m_pFileOperationsList, "File Operatiions");261 // m_pFileOperationsList->header()->hide();262 // }263 258 pTopLayout->addLayout(pFileTableContainerLayout); 264 259 m_pSessionPanel = new UIGuestControlFileManagerSessionPanel(this /* manager dialog */, 0 /*parent */); … … 277 272 m_pSettingsPanel->hide(); 278 273 m_panelActionMap.insert(m_pSettingsPanel, m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_Settings)); 279 connect(m_pSettingsPanel, &UIGuestControlFileManagerSettingsPanel::sig ListDirectoriesFirstChanged,274 connect(m_pSettingsPanel, &UIGuestControlFileManagerSettingsPanel::sigSettingsChanged, 280 275 this, &UIGuestControlFileManager::sltListDirectoriesBeforeChanged); 281 276 pTopLayout->addWidget(m_pSettingsPanel); 282 277 } 278 279 m_pVerticalSplitter->addWidget(pTopWidget); 283 280 284 281 m_pOperationsPanel = … … 288 285 m_pOperationsPanel->hide(); 289 286 m_panelActionMap.insert(m_pOperationsPanel, m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_FileOperations)); 290 pTopLayout->addWidget(m_pOperationsPanel); 291 } 292 293 m_pVerticalSplitter->addWidget(pTopWidget); 287 } 294 288 295 289 m_pLogPanel = new UIGuestControlFileManagerLogPanel(this /* manager dialog */, 0 /*parent */); … … 299 293 m_panelActionMap.insert(m_pLogPanel, m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_Log)); 300 294 } 295 301 296 m_pVerticalSplitter->addWidget(pTopWidget); 297 m_pVerticalSplitter->addWidget(m_pOperationsPanel); 302 298 m_pVerticalSplitter->addWidget(m_pLogPanel); 303 299 m_pVerticalSplitter->setCollapsible(m_pVerticalSplitter->indexOf(pTopWidget), false); 300 m_pVerticalSplitter->setCollapsible(m_pVerticalSplitter->indexOf(m_pOperationsPanel), false); 304 301 m_pVerticalSplitter->setCollapsible(m_pVerticalSplitter->indexOf(m_pLogPanel), false); 305 302 m_pVerticalSplitter->setStretchFactor(0, 3); 306 303 m_pVerticalSplitter->setStretchFactor(1, 1); 304 m_pVerticalSplitter->setStretchFactor(2, 1); 307 305 } 308 306 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManager.h
r75425 r75480 69 69 bool bListDirectoriesOnTop; 70 70 bool bAskDeleteConfirmation; 71 bool bShowHumanReadableSizes; 71 72 72 73 private: -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerOperationsPanel.cpp
r75425 r75480 169 169 if (m_pTableWidget) 170 170 { 171 m_pTableWidget->setColumnCount(1); 171 m_pTableWidget->setColumnCount(TableColumn_Max); 172 QStringList headers; 173 headers << "Progress" << "Information"; 174 m_pTableWidget->setHorizontalHeaderLabels(headers); 172 175 mainLayout()->addWidget(m_pTableWidget); 173 176 } -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerOperationsPanel.h
r75425 r75480 58 58 private: 59 59 60 enum TableColumn 61 { 62 TableColumn_Progress, 63 TableColumn_Info, 64 TableColumn_Max 65 }; 66 60 67 /** @name Member variables. 61 68 * @{ */ -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerSettingsPanel.cpp
r75425 r75480 42 42 , m_pListDirectoriesOnTopCheckBox(0) 43 43 , m_pDeleteConfirmationCheckBox(0) 44 , m_pHumanReabableSizesCheckBox(0) 44 45 , m_pFileManagerSettings(pFileManagerSettings) 45 46 { … … 60 61 if (m_pListDirectoriesOnTopCheckBox) 61 62 { 62 m_pListDirectoriesOnTopCheckBox->setChecked(true);63 63 mainLayout()->addWidget(m_pListDirectoriesOnTopCheckBox, 0, Qt::AlignLeft); 64 64 } … … 67 67 if (m_pDeleteConfirmationCheckBox) 68 68 { 69 m_pDeleteConfirmationCheckBox->setChecked(false);70 69 mainLayout()->addWidget(m_pDeleteConfirmationCheckBox, 0, Qt::AlignLeft); 71 70 } 72 71 73 72 m_pHumanReabableSizesCheckBox = new QCheckBox; 73 if (m_pHumanReabableSizesCheckBox) 74 { 75 mainLayout()->addWidget(m_pHumanReabableSizesCheckBox, 0, Qt::AlignLeft); 76 } 77 /* Set initial checkbox status wrt. settings: */ 78 if (m_pFileManagerSettings) 79 { 80 if (m_pListDirectoriesOnTopCheckBox) 81 m_pListDirectoriesOnTopCheckBox->setChecked(m_pFileManagerSettings->bListDirectoriesOnTop); 82 if (m_pDeleteConfirmationCheckBox) 83 m_pDeleteConfirmationCheckBox->setChecked(m_pFileManagerSettings->bAskDeleteConfirmation); 84 if (m_pHumanReabableSizesCheckBox) 85 m_pHumanReabableSizesCheckBox->setChecked(m_pFileManagerSettings->bShowHumanReadableSizes); 86 } 74 87 retranslateUi(); 75 88 mainLayout()->addStretch(2); 76 89 } 77 90 78 void UIGuestControlFileManagerSettingsPanel::sltListDirectoryCheckBoxToogled(bool fChecked)91 void UIGuestControlFileManagerSettingsPanel::sltListDirectoryCheckBoxToogled(bool bChecked) 79 92 { 80 93 if (!m_pFileManagerSettings) 81 94 return; 82 m_pFileManagerSettings->bListDirectoriesOnTop = fChecked; 83 emit sigListDirectoriesFirstChanged(); 95 m_pFileManagerSettings->bListDirectoriesOnTop = bChecked; 96 emit sigSettingsChanged(); 97 } 98 99 void UIGuestControlFileManagerSettingsPanel::sltDeleteConfirmationCheckBoxToogled(bool bChecked) 100 { 101 if (!m_pFileManagerSettings) 102 return; 103 m_pFileManagerSettings->bAskDeleteConfirmation = bChecked; 104 emit sigSettingsChanged(); 105 } 106 107 void UIGuestControlFileManagerSettingsPanel::sltHumanReabableSizesCheckBoxToogled(bool bChecked) 108 { 109 if (!m_pFileManagerSettings) 110 return; 111 m_pFileManagerSettings->bShowHumanReadableSizes = bChecked; 112 emit sigSettingsChanged(); 84 113 } 85 114 … … 89 118 connect(m_pListDirectoriesOnTopCheckBox, &QCheckBox::toggled, 90 119 this, &UIGuestControlFileManagerSettingsPanel::sltListDirectoryCheckBoxToogled); 120 if (m_pDeleteConfirmationCheckBox) 121 connect(m_pDeleteConfirmationCheckBox, &QCheckBox::toggled, 122 this, &UIGuestControlFileManagerSettingsPanel::sltDeleteConfirmationCheckBoxToogled); 123 if (m_pHumanReabableSizesCheckBox) 124 connect(m_pHumanReabableSizesCheckBox, &QCheckBox::toggled, 125 this, &UIGuestControlFileManagerSettingsPanel::sltHumanReabableSizesCheckBoxToogled); 91 126 } 92 127 … … 94 129 { 95 130 UIGuestControlFileManagerPanel::retranslateUi(); 131 if (m_pListDirectoriesOnTopCheckBox) 132 { 133 m_pListDirectoriesOnTopCheckBox->setText(UIGuestControlFileManager::tr("List directories on top")); 134 m_pListDirectoriesOnTopCheckBox->setToolTip(UIGuestControlFileManager::tr("List directories before files")); 135 } 96 136 97 m_pListDirectoriesOnTopCheckBox->setText(UIGuestControlFileManager::tr("List directories on top")); 98 m_pListDirectoriesOnTopCheckBox->setToolTip(UIGuestControlFileManager::tr("List directories before files")); 137 if (m_pDeleteConfirmationCheckBox) 138 { 139 m_pDeleteConfirmationCheckBox->setText(UIGuestControlFileManager::tr("Ask before delete")); 140 m_pDeleteConfirmationCheckBox->setToolTip(UIGuestControlFileManager::tr("List directories before files")); 141 } 99 142 100 m_pDeleteConfirmationCheckBox->setText(UIGuestControlFileManager::tr("Ask before delete")); 101 m_pDeleteConfirmationCheckBox->setToolTip(UIGuestControlFileManager::tr("List directories before files")); 143 if (m_pHumanReabableSizesCheckBox) 144 { 145 m_pHumanReabableSizesCheckBox->setText(UIGuestControlFileManager::tr("Human readable sizes")); 146 m_pHumanReabableSizesCheckBox->setToolTip(UIGuestControlFileManager::tr("List directories before files")); 147 } 102 148 } -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerSettingsPanel.h
r75425 r75480 42 42 signals: 43 43 44 void sig ListDirectoriesFirstChanged();44 void sigSettingsChanged(); 45 45 46 46 protected: … … 54 54 private slots: 55 55 56 void sltListDirectoryCheckBoxToogled(bool fChecked); 56 void sltListDirectoryCheckBoxToogled(bool bChecked); 57 void sltDeleteConfirmationCheckBoxToogled(bool bChecked); 58 void sltHumanReabableSizesCheckBoxToogled(bool bChecked); 57 59 58 60 private: … … 60 62 QCheckBox *m_pListDirectoriesOnTopCheckBox; 61 63 QCheckBox *m_pDeleteConfirmationCheckBox; 64 QCheckBox *m_pHumanReabableSizesCheckBox; 65 62 66 UIGuestControlFileManagerSettings *m_pFileManagerSettings; 63 67 }; -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileModel.cpp
r75425 r75480 131 131 { 132 132 /* dont show anything but the name for up directories: */ 133 if (item->isUpDirectory() && index.column() != 0)133 if (item->isUpDirectory() && index.column() != UIGuestControlFileModelColumn_Name) 134 134 return QVariant(); 135 135 /* Format date/time column: */ … … 140 140 return dateTime.toString("dd.MM.yyyy hh:mm:ss"); 141 141 } 142 /* Decide whether to show human-readable file object sizes: */ 143 if (index.column() == UIGuestControlFileModelColumn_Size) 144 { 145 UIGuestControlFileManagerSettings* pSettings = 146 UIGuestControlFileManagerSettings::instance(); 147 if (pSettings && pSettings->bShowHumanReadableSizes) 148 { 149 qulonglong size = item->data(index.column()).toULongLong(); 150 return UIGuestControlFileTable::humanReadableSize(size); 151 } 152 else 153 return item->data(index.column()); 154 } 142 155 return item->data(index.column()); 143 156 } 144 157 /* Show the up directory array: */ 145 158 if (role == Qt::DecorationRole && index.column() == 0) 146 159 { … … 274 287 endResetModel(); 275 288 } 276 277 bool UIGuestControlFileModel::insertRows(int position, int rows, const QModelIndex &parent)278 {279 UIFileTableItem *parentItem = static_cast<UIFileTableItem*>(parent.internalPointer());280 281 if (!parentItem)282 return false;283 beginInsertRows(parent, position, position + rows -1);284 285 QList<QVariant> data;286 data << "New Item" << 0 << QDateTime::currentDateTime();287 UIFileTableItem *newItem = new UIFileTableItem(data, parentItem, FileObjectType_Directory);288 parentItem->appendChild(newItem);289 endInsertRows();290 291 return true;292 } -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileModel.h
r75425 r75480 29 29 class UIFileTableItem; 30 30 class UIGuestControlFileTable; 31 32 enum UIGuestControlFileModelColumn 33 { 34 UIGuestControlFileModelColumn_Name = 0, 35 UIGuestControlFileModelColumn_Size, 36 UIGuestControlFileModelColumn_ChangeTime, 37 UIGuestControlFileModelColumn_Owner, 38 UIGuestControlFileModelColumn_Permissions, 39 UIGuestControlFileModelColumn_Max 40 }; 31 41 32 42 /** A QSortFilterProxyModel extension used in file tables. Modifies some … … 77 87 void beginReset(); 78 88 void endReset(); 79 bool insertRows(int position, int rows, const QModelIndex &parent);80 89 static const char* strUpDirectoryString; 81 90 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileTable.cpp
r75425 r75480 432 432 *********************************************************************************************************************************/ 433 433 434 UIFileTableItem::UIFileTableItem(const Q List<QVariant> &data,434 UIFileTableItem::UIFileTableItem(const QVector<QVariant> &data, 435 435 UIFileTableItem *parent, FileObjectType type) 436 436 : m_itemData(data) … … 756 756 /* Root item: */ 757 757 const QString startPath("/"); 758 QList<QVariant> headData; 759 headData << "Name" << "Size" << "Change Time" << "Owner" << "Permissions"; 758 QVector<QVariant> headData; 759 headData.resize(UIGuestControlFileModelColumn_Max); 760 headData[UIGuestControlFileModelColumn_Name] = "Name"; 761 headData[UIGuestControlFileModelColumn_Size] = "Size"; 762 headData[UIGuestControlFileModelColumn_ChangeTime] = "Change Time"; 763 headData[UIGuestControlFileModelColumn_Owner] = "Owner"; 764 headData[UIGuestControlFileModelColumn_Permissions] = "Permissions"; 760 765 m_pRootItem = new UIFileTableItem(headData, 0, FileObjectType_Directory); 761 QList<QVariant> startDirData; 762 startDirData << startPath << 4096 << QDateTime() << "" << ""; 763 UIFileTableItem* startItem = new UIFileTableItem(startDirData, m_pRootItem, FileObjectType_Directory); 764 766 UIFileTableItem* startItem = new UIFileTableItem(createTreeItemData(startPath, 4096, QDateTime(), 767 "" /* owner */, "" /* permissions */), 768 m_pRootItem, FileObjectType_Directory); 765 769 startItem->setPath(startPath); 766 770 m_pRootItem->appendChild(startItem); … … 785 789 for (int i = 0; i < m_driveLetterList.size(); ++i) 786 790 { 787 QList<QVariant> data; 788 789 data << m_driveLetterList[i] << 4096 << QDateTime() << ""; 790 UIFileTableItem* driveItem = new UIFileTableItem(data, startItem, FileObjectType_Directory); 791 UIFileTableItem* driveItem = new UIFileTableItem(createTreeItemData(m_driveLetterList[i], 4096, 792 QDateTime(), QString(), QString()), 793 startItem, FileObjectType_Directory); 791 794 driveItem->setPath(m_driveLetterList[i]); 792 795 startItem->appendChild(driveItem); … … 808 811 if (!map.contains(UIGuestControlFileModel::strUpDirectoryString) && !isStartDir) 809 812 { 810 QList<QVariant> data; 811 data << UIGuestControlFileModel::strUpDirectoryString << 4096 << ""; 812 UIFileTableItem *item = new UIFileTableItem(data, parent, FileObjectType_Directory); 813 QVector<QVariant> data; 814 UIFileTableItem *item = new UIFileTableItem(createTreeItemData(UIGuestControlFileModel::strUpDirectoryString, 4096, 815 QDateTime(), QString(), QString()) 816 , parent, FileObjectType_Directory); 813 817 item->setIsOpened(false); 814 818 map.insert(UIGuestControlFileModel::strUpDirectoryString, item); … … 1299 1303 } 1300 1304 1305 1306 QVector<QVariant> UIGuestControlFileTable::createTreeItemData(const QString &strName, ULONG64 size, const QDateTime &changeTime, 1307 const QString &strOwner, const QString &strPermissions) 1308 { 1309 QVector<QVariant> data; 1310 data.resize(UIGuestControlFileModelColumn_Max); 1311 data[UIGuestControlFileModelColumn_Name] = strName; 1312 data[UIGuestControlFileModelColumn_Size] = (qulonglong)size; 1313 data[UIGuestControlFileModelColumn_ChangeTime] = changeTime; 1314 data[UIGuestControlFileModelColumn_Owner] = strOwner; 1315 data[UIGuestControlFileModelColumn_Permissions] = strPermissions; 1316 return data; 1317 } 1318 1301 1319 QString UIGuestControlFileTable::fileTypeString(FileObjectType type) 1302 1320 { … … 1395 1413 m_pSearchLineEdit->blockSignals(false); 1396 1414 } 1415 1397 1416 #include "UIGuestControlFileTable.moc" -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileTable.h
r75425 r75480 168 168 * the name of the file object which is the file name including extension or name of the 169 169 * directory */ 170 explicit UIFileTableItem(const Q List<QVariant> &data,170 explicit UIFileTableItem(const QVector<QVariant> &data, 171 171 UIFileTableItem *parentItem, FileObjectType type); 172 172 ~UIFileTableItem(); … … 220 220 QMap<QString, UIFileTableItem*> m_childMap; 221 221 /** It is required that m_itemData[0] is name (QString) of the file object */ 222 Q List<QVariant> m_itemData;222 QVector<QVariant> m_itemData; 223 223 UIFileTableItem *m_parentItem; 224 224 bool m_bIsOpened; … … 263 263 static QString humanReadableSize(ULONG64 size); 264 264 265 public slots: 266 267 void sltReceiveDirectoryStatistics(UIDirectoryStatistics statictics); 268 void sltCreateNewDirectory(); 269 /* index is passed by the item view and represents the double clicked object's 'proxy' model index */ 270 void sltItemDoubleClicked(const QModelIndex &index); 271 void sltItemClicked(const QModelIndex &index); 272 void sltGoUp(); 273 void sltGoHome(); 274 void sltRefresh(); 275 void sltDelete(); 276 void sltRename(); 277 void sltCopy(); 278 void sltCut(); 279 void sltPaste(); 280 void sltShowProperties(); 281 void sltSelectAll(); 282 void sltInvertSelection(); 265 283 266 284 protected: … … 296 314 CGuestFsObjInfo guestFsObjectInfo(const QString& path, CGuestSession &comGuestSession) const; 297 315 void setSelectionDependentActionsEnabled(bool fIsEnabled); 316 /** Creates a QList out of the parameters wrt. UIGuestControlFileModelColumn enum */ 317 QVector<QVariant> createTreeItemData(const QString &strName, ULONG64 size, const QDateTime &changeTime, 318 const QString &strOwner, const QString &strPermissions); 298 319 299 320 UIFileTableItem *m_pRootItem; … … 308 329 /** The set of actions which need some selection to work on. Like cut, copy etc. */ 309 330 QSet<QAction*> m_selectionDependentActions; 310 311 public slots:312 313 void sltReceiveDirectoryStatistics(UIDirectoryStatistics statictics);314 void sltCreateNewDirectory();315 /* index is passed by the item view and represents the double clicked object's 'proxy' model index */316 void sltItemDoubleClicked(const QModelIndex &index);317 void sltItemClicked(const QModelIndex &index);318 void sltGoUp();319 void sltGoHome();320 void sltRefresh();321 void sltDelete();322 void sltRename();323 void sltCopy();324 void sltCut();325 void sltPaste();326 void sltShowProperties();327 void sltSelectAll();328 void sltInvertSelection();329 331 330 332 private slots: … … 353 355 /* Searches the content of m_pSearchLineEdit within the current items' names and selects the item if found. */ 354 356 void performSelectionSearch(const QString &strSearchText); 355 /* Clears the m_pSearchLineEdit and hides it. */357 /** Clears the m_pSearchLineEdit and hides it. */ 356 358 void disableSelectionSearch(); 357 358 359 UIGuestControlFileModel *m_pModel; 359 360 UIGuestControlFileView *m_pView; -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestFileTable.cpp
r75425 r75480 197 197 while (fsInfo.isOk()) 198 198 { 199 Q List<QVariant> data;199 QVector<QVariant> data; 200 200 QDateTime changeTime = QDateTime::fromMSecsSinceEpoch(fsInfo.GetChangeTime()/1000000); 201 201 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIHostFileTable.cpp
r75425 r75480 221 221 222 222 const QFileInfo &fileInfo = entries.at(i); 223 QList<QVariant> data; 224 data << fileInfo.fileName() << fileInfo.size() 225 << fileInfo.lastModified() << fileInfo.owner() << 226 permissionString(fileInfo.permissions()); 227 UIFileTableItem *item = new UIFileTableItem(data, parent, fileType(fileInfo)); 223 UIFileTableItem *item = new UIFileTableItem(createTreeItemData(fileInfo.fileName(), fileInfo.size(), 224 fileInfo.lastModified(), fileInfo.owner(), 225 permissionString(fileInfo.permissions())), 226 parent, fileType(fileInfo)); 228 227 if (!item) 229 228 continue;
Note:
See TracChangeset
for help on using the changeset viewer.