Changeset 77932 in vbox
- Timestamp:
- Mar 28, 2019 10:17:11 AM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
r77377 r77932 207 207 const char *UIExtraDataDefs::GUI_GuestControl_FileManagerShowHumanReadableSizes = "ShowHumanReadableSizes"; 208 208 const char *UIExtraDataDefs::GUI_GuestControl_FileManagerShowHiddenObjects = "ShowHiddenObjects"; 209 const char *UIExtraDataDefs::GUI_GuestControl_FileManagerShowBreadCrumbs = "ShowBreadCrumbs"; 209 210 210 211 /* Virtual Machine: Close dialog: */ -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r77822 r77932 383 383 extern const char *GUI_GuestControl_FileManagerShowHumanReadableSizes; 384 384 extern const char *GUI_GuestControl_FileManagerShowHiddenObjects; 385 extern const char *GUI_GuestControl_FileManagerShowBreadCrumbs; 385 386 /** @} */ 386 387 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r77845 r77932 4274 4274 bool fShowDeleteConfirmation, 4275 4275 bool fShowHumanReadableSizes, 4276 bool fShowHiddenObjects) 4276 bool fShowHiddenObjects, 4277 bool fShowBreadCrumbs) 4277 4278 { 4278 4279 /* Serialize passed values: */ … … 4287 4288 if (fShowHiddenObjects) 4288 4289 data << GUI_GuestControl_FileManagerShowHiddenObjects; 4290 if (fShowBreadCrumbs) 4291 data << GUI_GuestControl_FileManagerShowBreadCrumbs; 4292 4289 4293 /* Re-cache corresponding extra-data: */ 4290 4294 setExtraDataStringList(GUI_GuestControl_FileManagerOptions, data); … … 4330 4334 { 4331 4335 if (data[i] == GUI_GuestControl_FileManagerShowHiddenObjects) 4336 return true; 4337 } 4338 return false; 4339 } 4340 4341 bool UIExtraDataManager::fileManagerShowBreadCrumbs() 4342 { 4343 const QStringList data = extraDataStringList(GUI_GuestControl_FileManagerOptions); 4344 for (int i = 0; i < data.size(); ++i) 4345 { 4346 if (data[i] == GUI_GuestControl_FileManagerShowBreadCrumbs) 4332 4347 return true; 4333 4348 } -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r77845 r77932 670 670 bool fShowDeleteConfirmation, 671 671 bool fshowHumanReadableSizes, 672 bool fShowHiddenObjects); 672 bool fShowHiddenObjects, 673 bool fShowBreadCrumbs); 673 674 bool fileManagerListDirectoriesFirst(); 674 675 bool fileManagerShowDeleteConfirmation(); 675 676 bool fileManagerShowHumanReadableSizes(); 676 677 bool fileManagerShowHiddenObjects(); 678 bool fileManagerShowBreadCrumbs(); 677 679 /** @} */ 678 680 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.cpp
r77870 r77932 94 94 , fShowHumanReadableSizes(true) 95 95 , fShowHiddenObjects(true) 96 , fShowBreadCrumbs(false) 96 97 { 97 98 } … … 690 691 pOptions->fAskDeleteConfirmation, 691 692 pOptions->fShowHumanReadableSizes, 692 pOptions->fShowHiddenObjects); 693 pOptions->fShowHiddenObjects, 694 pOptions->fShowBreadCrumbs); 693 695 } 694 696 } … … 733 735 pOptions->fShowHumanReadableSizes = gEDataManager->fileManagerShowHumanReadableSizes(); 734 736 pOptions->fShowHiddenObjects = gEDataManager->fileManagerShowHiddenObjects(); 737 pOptions->fShowBreadCrumbs = gEDataManager->fileManagerShowBreadCrumbs(); 735 738 } 736 739 } -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.h
r77528 r77932 68 68 bool fShowHumanReadableSizes; 69 69 bool fShowHiddenObjects; 70 bool fShowBreadCrumbs; 70 71 71 72 private: -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.cpp
r77647 r77932 164 164 { 165 165 if (m_pLocationLabel) 166 m_pLocationLabel->setText(UIFileManager::tr("Guest System"));166 m_pLocationLabel->setText(UIFileManager::tr("Guest File System")); 167 167 UIFileManagerTable::retranslateUi(); 168 168 } … … 170 170 void UIFileManagerGuestTable::readDirectory(const QString& strPath, 171 171 UICustomFileSystemItem *parent, bool isStartDir /*= false*/) 172 173 172 { 174 173 if (!parent) -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerHostTable.cpp
r77871 r77932 172 172 { 173 173 if (m_pLocationLabel) 174 m_pLocationLabel->setText(UIFileManager::tr("Host System"));174 m_pLocationLabel->setText(UIFileManager::tr("Host File System")); 175 175 UIFileManagerTable::retranslateUi(); 176 176 } -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerOptionsPanel.cpp
r77528 r77932 31 31 , m_pHumanReabableSizesCheckBox(0) 32 32 , m_pShowHiddenObjectsCheckBox(0) 33 , m_pShowBreadCrumbsCheckBox(0) 33 34 , m_pFileManagerOptions(pFileManagerOptions) 34 35 { … … 82 83 m_pListDirectoriesOnTopCheckBox = new QCheckBox; 83 84 if (m_pListDirectoriesOnTopCheckBox) 84 {85 85 mainLayout()->addWidget(m_pListDirectoriesOnTopCheckBox, 0, Qt::AlignLeft); 86 }87 86 88 87 m_pDeleteConfirmationCheckBox = new QCheckBox; 89 88 if (m_pDeleteConfirmationCheckBox) 90 {91 89 mainLayout()->addWidget(m_pDeleteConfirmationCheckBox, 0, Qt::AlignLeft); 92 }93 90 94 91 m_pHumanReabableSizesCheckBox = new QCheckBox; 95 92 if (m_pHumanReabableSizesCheckBox) 96 {97 93 mainLayout()->addWidget(m_pHumanReabableSizesCheckBox, 0, Qt::AlignLeft); 98 }99 94 100 95 m_pShowHiddenObjectsCheckBox = new QCheckBox; 101 96 if (m_pShowHiddenObjectsCheckBox) 102 {103 97 mainLayout()->addWidget(m_pShowHiddenObjectsCheckBox, 0, Qt::AlignLeft); 104 } 98 99 m_pShowBreadCrumbsCheckBox = new QCheckBox; 100 if (m_pShowBreadCrumbsCheckBox) 101 mainLayout()->addWidget(m_pShowBreadCrumbsCheckBox, 0, Qt::AlignLeft); 105 102 106 103 /* Set initial checkbox status wrt. options: */ … … 115 112 if (m_pShowHiddenObjectsCheckBox) 116 113 m_pShowHiddenObjectsCheckBox->setChecked(m_pFileManagerOptions->fShowHiddenObjects); 114 if (m_pShowBreadCrumbsCheckBox) 115 m_pShowBreadCrumbsCheckBox->setChecked(m_pFileManagerOptions->fShowBreadCrumbs); 117 116 118 117 } … … 153 152 } 154 153 154 void UIFileManagerOptionsPanel::sltShowBreadCrumbsCheckBoxToggled(bool bChecked) 155 { 156 if (!m_pFileManagerOptions) 157 return; 158 m_pFileManagerOptions->fShowBreadCrumbs = bChecked; 159 emit sigOptionsChanged(); 160 } 161 155 162 void UIFileManagerOptionsPanel::prepareConnections() 156 163 { … … 169 176 this, &UIFileManagerOptionsPanel::sltShowHiddenObjectsCheckBoxToggled); 170 177 178 if (m_pShowBreadCrumbsCheckBox) 179 connect(m_pShowBreadCrumbsCheckBox, &QCheckBox::toggled, 180 this, &UIFileManagerOptionsPanel::sltShowBreadCrumbsCheckBoxToggled); 171 181 } 172 182 … … 199 209 m_pShowHiddenObjectsCheckBox->setToolTip(UIFileManager::tr("Show hidden files/directories")); 200 210 } 201 } 211 212 if (m_pShowBreadCrumbsCheckBox) 213 { 214 m_pShowBreadCrumbsCheckBox->setText(UIFileManager::tr("Bread crumbs instead of location widget")); 215 m_pShowBreadCrumbsCheckBox->setToolTip(UIFileManager::tr("Bread crumbs instead of location widget")); 216 } 217 } -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerOptionsPanel.h
r77528 r77932 63 63 void sltHumanReabableSizesCheckBoxToogled(bool bChecked); 64 64 void sltShowHiddenObjectsCheckBoxToggled(bool bChecked); 65 void sltShowBreadCrumbsCheckBoxToggled(bool bChecked); 65 66 66 67 private: … … 70 71 QCheckBox *m_pHumanReabableSizesCheckBox; 71 72 QCheckBox *m_pShowHiddenObjectsCheckBox; 73 QCheckBox *m_pShowBreadCrumbsCheckBox; 72 74 UIFileManagerOptions *m_pFileManagerOptions; 73 75 }; -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.cpp
r77904 r77932 30 30 #include "QILabel.h" 31 31 #include "QILineEdit.h" 32 #include "QIToolButton.h" 32 33 #include "VBoxGlobal.h" 33 34 #include "UIActionPool.h" … … 49 50 50 51 /********************************************************************************************************************************* 52 * UIFileManagerBreadCrumbs definition. * 53 *********************************************************************************************************************************/ 54 /** A QLineEdit extension. It shows the current path as text and hightligts the folder name 55 * as the mouse hovers over it. Clicking on the highlighted folder name make the file table tp 56 * navigate to that folder. */ 57 class UIFileManagerBreadCrumbs : public QLineEdit 58 { 59 Q_OBJECT; 60 61 signals: 62 63 void sigNavitatePath(const QString &strPath); 64 65 public: 66 67 UIFileManagerBreadCrumbs(QWidget *pParent = 0); 68 void setPath(const QString &strPath); 69 70 protected: 71 72 virtual void mouseMoveEvent(QMouseEvent *pEvent) /* override */; 73 virtual void mousePressEvent(QMouseEvent *pEvent) /* override */; 74 virtual void focusOutEvent(QFocusEvent *pEvent) /* override */; 75 76 private: 77 }; 78 79 80 /********************************************************************************************************************************* 51 81 * UIGuestControlFileView definition. * 52 82 *********************************************************************************************************************************/ … … 138 168 QILabel *m_pQuestionLabel; 139 169 }; 170 171 172 /********************************************************************************************************************************* 173 * UIFileManagerBreadCrumbs implementation. * 174 *********************************************************************************************************************************/ 175 176 UIFileManagerBreadCrumbs::UIFileManagerBreadCrumbs(QWidget *pParent /* = 0 */) 177 :QLineEdit(pParent) 178 { 179 180 } 181 182 void UIFileManagerBreadCrumbs::setPath(const QString &strPath) 183 { 184 clear(); 185 setText(strPath); 186 } 187 188 void UIFileManagerBreadCrumbs::mouseMoveEvent(QMouseEvent *pEvent) 189 { 190 QChar cSeparator('/'); 191 int iCharPos = this->cursorPositionAt(pEvent->pos()); 192 QString strLeft = text().left(iCharPos); 193 int iLeftSeparator = strLeft.lastIndexOf(cSeparator); 194 int iRightSeparator = text().indexOf(cSeparator, iLeftSeparator + 1); 195 if (iRightSeparator == -1) 196 iRightSeparator = text().length(); 197 /* A special case for leading sperator aka. root folder: */ 198 if (iRightSeparator == 0) 199 setSelection(iLeftSeparator + 1, 1); 200 else 201 setSelection(iLeftSeparator + 1, iRightSeparator - iLeftSeparator - 1); 202 } 203 204 void UIFileManagerBreadCrumbs::mousePressEvent(QMouseEvent *pEvent) 205 { 206 QChar cSeparator('/'); 207 int iCharPos = this->cursorPositionAt(pEvent->pos()); 208 // QString strLeft = text().left(iCharPos); 209 // int iLeftSeparator = strLeft.lastIndexOf(cSeparator); 210 int iRightSeparator = text().indexOf(cSeparator, iCharPos); 211 QString strPath; 212 if (iRightSeparator == 0) 213 strPath = cSeparator; 214 else 215 strPath = text().left(iRightSeparator); 216 emit sigNavitatePath(strPath); 217 } 218 219 void UIFileManagerBreadCrumbs::focusOutEvent(QFocusEvent *pEvent) 220 { 221 deselect(); 222 QLineEdit::focusOutEvent(pEvent); 223 } 224 225 226 /********************************************************************************************************************************* 227 * UIFileManagerPathButton implementation. * 228 *********************************************************************************************************************************/ 229 230 // UIFileManagerPathButton::UIFileManagerPathButton(QWidget *pParent /* = 0 */, const QString &strPath /* = QString() */) 231 // :QIToolButton(pParent) 232 // , m_strPath(strPath) 233 // { 234 // setText(m_strPath); 235 // } 140 236 141 237 … … 379 475 , m_pLocationComboBox(0) 380 476 , m_pWarningLabel(0) 477 , m_pBreadCrumbsWidget(0) 381 478 { 382 479 prepareObjects(); … … 437 534 } 438 535 439 536 m_pBreadCrumbsWidget = new UIFileManagerBreadCrumbs; 537 if (m_pBreadCrumbsWidget) 538 { 539 m_pMainLayout->addWidget(m_pBreadCrumbsWidget, 1, 1, 1, 4); 540 m_pBreadCrumbsWidget->setReadOnly(true); 541 QSizePolicy sizePolicy; 542 sizePolicy.setControlType(QSizePolicy::ComboBox); 543 m_pBreadCrumbsWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); 544 connect(m_pBreadCrumbsWidget, &UIFileManagerBreadCrumbs::sigNavitatePath, 545 this, &UIFileManagerTable::sltHandleBreadCrumbsClick); 546 } 547 548 UIFileManagerOptions *pOptions = UIFileManagerOptions::instance(); 549 if (pOptions) 550 showHideBreadCrumbs(pOptions->fShowBreadCrumbs); 551 else 552 showHideBreadCrumbs(false); 440 553 m_pModel = new UICustomFileSystemModel(this); 441 554 if (!m_pModel) … … 519 632 } 520 633 m_pLocationComboBox->setCurrentIndex(itemIndex); 634 635 if (m_pBreadCrumbsWidget) 636 { 637 m_pBreadCrumbsWidget->setPath(strLocation); 638 } 521 639 } 522 640 … … 895 1013 sigLogOutput(QString(pItem->path()).append(" could not be renamed"), FileManagerLogType_Error); 896 1014 } 1015 } 1016 1017 void UIFileManagerTable::sltHandleBreadCrumbsClick(const QString& strPath) 1018 { 1019 goIntoDirectory(UIPathOperations::pathTrail(strPath)); 897 1020 } 898 1021 … … 1170 1293 if (m_pModel) 1171 1294 m_pModel->setShowHumanReadableSizes(pOptions->fShowHumanReadableSizes); 1295 showHideBreadCrumbs(pOptions->fShowBreadCrumbs); 1172 1296 } 1173 1297 relist(); … … 1256 1380 } 1257 1381 1382 void UIFileManagerTable::showHideBreadCrumbs(bool fShow) 1383 { 1384 if (m_pLocationComboBox) 1385 m_pLocationComboBox->setVisible(!fShow); 1386 if (m_pBreadCrumbsWidget) 1387 m_pBreadCrumbsWidget->setVisible(fShow); 1388 } 1389 1258 1390 #include "UIFileManagerTable.moc" -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.h
r77868 r77932 52 52 class UICustomFileSystemModel; 53 53 class UICustomFileSystemProxyModel; 54 class UIFileManagerBreadCrumbs; 54 55 class UIGuestControlFileView; 55 56 class UIToolBar; … … 258 259 * sltRename() for more details. */ 259 260 void sltHandleItemRenameAttempt(UICustomFileSystemItem *pItem, QString strOldName, QString strNewName); 261 void sltHandleBreadCrumbsClick(const QString& strPath); 260 262 261 263 private: … … 282 284 * if deletion can continue */ 283 285 bool checkIfDeleteOK(); 286 void showHideBreadCrumbs(bool fShow); 284 287 285 288 UICustomFileSystemModel *m_pModel; … … 292 295 QILabel *m_pWarningLabel; 293 296 297 UIFileManagerBreadCrumbs *m_pBreadCrumbsWidget; 298 294 299 friend class UICustomFileSystemModel; 295 300 };
Note:
See TracChangeset
for help on using the changeset viewer.