Changeset 91445 in vbox for trunk/src/VBox
- Timestamp:
- Sep 28, 2021 6:16:17 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
r91414 r91445 2342 2342 default: break; 2343 2343 } 2344 emit sigRecentMediaListUpdated(enmMediumType); 2344 2345 } 2345 2346 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h
r91414 r91445 120 120 /** Notifies listeners about medium-enumeration finished. */ 121 121 void sigMediumEnumerationFinished(); 122 /** Notifies listeners about update of recently media list. */ 123 void sigRecentMediaListUpdated(UIMediumDeviceType enmMediumType); 122 124 /** @} */ 123 125 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.cpp
r91436 r91445 25 25 #include "QILineEdit.h" 26 26 #include "UICommon.h" 27 #include "UIExtraDataManager.h"28 27 #include "UIIconPool.h" 29 28 #include "UIFilePathSelector.h" … … 514 513 m_pImageSelector->setFileDialogFilters("ISO Images(*.iso *.ISO)"); 515 514 m_pImageSelector->setInitialPath(uiCommon().defaultFolderPathForType(UIMediumDeviceType_DVD)); 516 m_pImageSelector->setRecent PathList(gEDataManager->recentListOfOpticalDisks());515 m_pImageSelector->setRecentMediaListType(UIMediumDeviceType_DVD); 517 516 518 517 m_pMainLayout->addWidget(m_pImageSelector, iRow, 1, 1, 2); -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFilePathSelector.cpp
r91436 r91445 34 34 #include "QIToolButton.h" 35 35 #include "UICommon.h" 36 #include "UIExtraDataManager.h" 36 37 #include "UIIconPool.h" 37 38 #include "UIFilePathSelector.h" … … 65 66 , m_fToolTipOverriden(false) 66 67 , m_pCopyAction(new QAction(this)) 68 , m_enmRecentMediaListType(UIMediumDeviceType_Invalid) 67 69 { 68 70 #ifdef VBOX_WS_WIN … … 98 100 connect(this, static_cast<void(UIFilePathSelector::*)(int)>(&UIFilePathSelector::activated), this, &UIFilePathSelector::onActivated); 99 101 connect(m_pCopyAction, &QAction::triggered, this, &UIFilePathSelector::copyToClipboard); 102 connect(&uiCommon(), &UICommon::sigRecentMediaListUpdated, this, &UIFilePathSelector::sltRecentMediaListUpdated); 100 103 101 104 /* Editable by default: */ … … 194 197 } 195 198 196 void UIFilePathSelector::setRecentPathList(const QStringList &recentPathList) 197 { 198 while (count() >= static_cast<int>(RecentListSeparator)) 199 { 200 removeItem(count() - 1); 201 } 202 insertSeparator(RecentListSeparator); 203 204 foreach (const QString strPath, recentPathList) 205 addItem(strPath); 199 void UIFilePathSelector::setRecentMediaListType(UIMediumDeviceType enmMediumType) 200 { 201 m_enmRecentMediaListType = enmMediumType; 202 sltRecentMediaListUpdated(enmMediumType); 203 } 204 205 UIMediumDeviceType UIFilePathSelector::recentMediaListType() const 206 { 207 return m_enmRecentMediaListType; 206 208 } 207 209 … … 547 549 * and text have be corresponding real stored path 548 550 * which can be absolute or relative. */ 549 //if (lineEdit()->text() != m_strPath)551 if (lineEdit()->text() != m_strPath) 550 552 setItemText(PathId, m_strPath); 551 553 setItemIcon(PathId, QIcon()); … … 607 609 } 608 610 } 611 612 void UIFilePathSelector::sltRecentMediaListUpdated(UIMediumDeviceType enmMediumType) 613 { 614 /* Remove the recent media list from the end of the combo: */ 615 while (count() >= static_cast<int>(RecentListSeparator)) 616 { 617 removeItem(count() - 1); 618 } 619 620 621 if (enmMediumType != m_enmRecentMediaListType) 622 return; 623 QStringList recentMedia; 624 625 switch (enmMediumType) 626 { 627 case UIMediumDeviceType_DVD: 628 recentMedia = gEDataManager->recentListOfOpticalDisks(); 629 break; 630 case UIMediumDeviceType_Floppy: 631 recentMedia = gEDataManager->recentListOfFloppyDisks(); 632 break; 633 case UIMediumDeviceType_HardDisk: 634 recentMedia = gEDataManager->recentListOfHardDrives(); 635 break; 636 default: 637 break; 638 } 639 640 if (recentMedia.isEmpty()) 641 return; 642 643 insertSeparator(RecentListSeparator); 644 foreach (const QString strPath, recentMedia) 645 addItem(strPath); 646 647 } -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFilePathSelector.h
r91436 r91445 26 26 #include "QIWithRetranslateUI.h" 27 27 #include "UILibraryDefs.h" 28 #include "UIMediumDefs.h" 28 29 29 30 /* Forward declarations: */ … … 122 123 const QString& defaultPath() const; 123 124 124 void setRecentPathList(const QStringList &recentPathList); 125 void setRecentMediaListType(UIMediumDeviceType enmMediumType); 126 UIMediumDeviceType recentMediaListType() const; 125 127 126 128 public slots: … … 161 163 /** Refreshes combo-box text according to chosen path. */ 162 164 void refreshText(); 165 166 void sltRecentMediaListUpdated(UIMediumDeviceType enmMediumType); 163 167 164 168 private: … … 219 223 /** Path is set to m_strDefaultPath when it is reset. */ 220 224 QString m_strDefaultPath; 225 226 /** Holds whether medium type for recent media list. If it is UIMediumDeviceType_Invalid the recent list is not shown. */ 227 UIMediumDeviceType m_enmRecentMediaListType; 221 228 }; 222 229
Note:
See TracChangeset
for help on using the changeset viewer.