Changeset 51198 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 6, 2014 3:41:44 PM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r51197 r51198 158 158 } 159 159 160 QString UIExtraDataManager::recentFolderForHardDrives() const 161 { 162 return extraDataString(GUI_RecentFolderHD); 163 } 164 165 QString UIExtraDataManager::recentFolderForOpticalDisks() const 166 { 167 return extraDataString(GUI_RecentFolderCD); 168 } 169 170 QString UIExtraDataManager::recentFolderForFloppyDisks() const 171 { 172 return extraDataString(GUI_RecentFolderFD); 173 } 174 175 void UIExtraDataManager::setRecentFolderForHardDrives(const QString &strValue) 176 { 177 setExtraDataString(GUI_RecentFolderHD, strValue); 178 } 179 180 void UIExtraDataManager::setRecentFolderForOpticalDisks(const QString &strValue) 181 { 182 setExtraDataString(GUI_RecentFolderCD, strValue); 183 } 184 185 void UIExtraDataManager::setRecentFolderForFloppyDisks(const QString &strValue) 186 { 187 setExtraDataString(GUI_RecentFolderFD, strValue); 188 } 189 190 QStringList UIExtraDataManager::recentListOfHardDrives() const 191 { 192 return extraDataStringList(GUI_RecentListHD); 193 } 194 195 QStringList UIExtraDataManager::recentListOfOpticalDisks() const 196 { 197 return extraDataStringList(GUI_RecentListCD); 198 } 199 200 QStringList UIExtraDataManager::recentListOfFloppyDisks() const 201 { 202 return extraDataStringList(GUI_RecentListFD); 203 } 204 205 void UIExtraDataManager::setRecentListOfHardDrives(const QStringList &strValue) 206 { 207 setExtraDataStringList(GUI_RecentListHD, strValue); 208 } 209 210 void UIExtraDataManager::setRecentListOfOpticalDisks(const QStringList &strValue) 211 { 212 setExtraDataStringList(GUI_RecentListCD, strValue); 213 } 214 215 void UIExtraDataManager::setRecentListOfFloppyDisks(const QStringList &strValue) 216 { 217 setExtraDataStringList(GUI_RecentListFD, strValue); 218 } 219 160 220 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER 161 221 bool UIExtraDataManager::shouldWeAllowApplicationUpdate() const -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r51196 r51198 75 75 /** Returns version for which user wants to prevent BETA warning. */ 76 76 QString preventBETAwarningForVersion() const; 77 78 /** Returns recent hard-drive folder. */ 79 QString recentFolderForHardDrives() const; 80 /** Returns recent optical-disk folder. */ 81 QString recentFolderForOpticalDisks() const; 82 /** Returns recent floppy-disk folder. */ 83 QString recentFolderForFloppyDisks() const; 84 /** Defines recent hard-drive folder as @a strValue. */ 85 void setRecentFolderForHardDrives(const QString &strValue); 86 /** Defines recent optical-disk folder as @a strValue. */ 87 void setRecentFolderForOpticalDisks(const QString &strValue); 88 /** Defines recent floppy-disk folder as @a strValue. */ 89 void setRecentFolderForFloppyDisks(const QString &strValue); 90 91 /** Returns recent hard-drive list. */ 92 QStringList recentListOfHardDrives() const; 93 /** Returns recent optical-disk list. */ 94 QStringList recentListOfOpticalDisks() const; 95 /** Returns recent floppy-disk list. */ 96 QStringList recentListOfFloppyDisks() const; 97 /** Defines recent hard-drive list as @a strValue. */ 98 void setRecentListOfHardDrives(const QStringList &strValue); 99 /** Defines recent optical-disk list as @a strValue. */ 100 void setRecentListOfOpticalDisks(const QStringList &strValue); 101 /** Defines recent floppy-disk list as @a strValue. */ 102 void setRecentListOfFloppyDisks(const QStringList &strValue); 77 103 78 104 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r51189 r51198 1759 1759 strTitle = tr("Please choose a virtual hard drive file"); 1760 1760 allType = tr("All virtual hard drive files (%1)"); 1761 strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderHD);1761 strLastFolder = gEDataManager->recentFolderForHardDrives(); 1762 1762 if (strLastFolder.isEmpty()) 1763 strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderCD);1763 strLastFolder = gEDataManager->recentFolderForOpticalDisks(); 1764 1764 if (strLastFolder.isEmpty()) 1765 strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderFD);1765 strLastFolder = gEDataManager->recentFolderForFloppyDisks(); 1766 1766 break; 1767 1767 } … … 1771 1771 strTitle = tr("Please choose a virtual optical disk file"); 1772 1772 allType = tr("All virtual optical disk files (%1)"); 1773 strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderCD);1773 strLastFolder = gEDataManager->recentFolderForOpticalDisks(); 1774 1774 if (strLastFolder.isEmpty()) 1775 strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderHD);1775 strLastFolder = gEDataManager->recentFolderForFloppyDisks(); 1776 1776 if (strLastFolder.isEmpty()) 1777 strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderFD);1777 strLastFolder = gEDataManager->recentFolderForHardDrives(); 1778 1778 break; 1779 1779 } … … 1783 1783 strTitle = tr("Please choose a virtual floppy disk file"); 1784 1784 allType = tr("All virtual floppy disk files (%1)"); 1785 strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderFD);1785 strLastFolder = gEDataManager->recentFolderForFloppyDisks(); 1786 1786 if (strLastFolder.isEmpty()) 1787 strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderCD);1787 strLastFolder = gEDataManager->recentFolderForOpticalDisks(); 1788 1788 if (strLastFolder.isEmpty()) 1789 strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderHD);1789 strLastFolder = gEDataManager->recentFolderForHardDrives(); 1790 1790 break; 1791 1791 } … … 1830 1830 1831 1831 /* Remember the path of the last chosen medium: */ 1832 QString strRecentFolderKey = mediumType == UIMediumType_HardDisk ? GUI_RecentFolderHD : 1833 mediumType == UIMediumType_DVD ? GUI_RecentFolderCD : 1834 mediumType == UIMediumType_Floppy ? GUI_RecentFolderFD : 1835 QString(); 1836 vbox.SetExtraData(strRecentFolderKey, QFileInfo(strMediumLocation).absolutePath()); 1832 switch (mediumType) 1833 { 1834 case UIMediumType_HardDisk: gEDataManager->setRecentFolderForHardDrives(QFileInfo(strMediumLocation).absolutePath()); break; 1835 case UIMediumType_DVD: gEDataManager->setRecentFolderForOpticalDisks(QFileInfo(strMediumLocation).absolutePath()); break; 1836 case UIMediumType_Floppy: gEDataManager->setRecentFolderForFloppyDisks(QFileInfo(strMediumLocation).absolutePath()); break; 1837 default: break; 1838 } 1837 1839 1838 1840 /* Update recently used list: */ 1839 QString strRecentListKey = mediumType == UIMediumType_HardDisk ? GUI_RecentListHD : 1840 mediumType == UIMediumType_DVD ? GUI_RecentListCD : 1841 mediumType == UIMediumType_Floppy ? GUI_RecentListFD : 1842 QString(); 1843 QStringList recentMediumList = vbox.GetExtraData(strRecentListKey).split(';'); 1841 QStringList recentMediumList; 1842 switch (mediumType) 1843 { 1844 case UIMediumType_HardDisk: recentMediumList = gEDataManager->recentListOfHardDrives(); break; 1845 case UIMediumType_DVD: recentMediumList = gEDataManager->recentListOfOpticalDisks(); break; 1846 case UIMediumType_Floppy: recentMediumList = gEDataManager->recentListOfFloppyDisks(); break; 1847 default: break; 1848 } 1844 1849 if (recentMediumList.contains(strMediumLocation)) 1845 1850 recentMediumList.removeAll(strMediumLocation); 1846 1851 recentMediumList.prepend(strMediumLocation); 1847 1852 while(recentMediumList.size() > 5) recentMediumList.removeLast(); 1848 vbox.SetExtraData(strRecentListKey, recentMediumList.join(";")); 1853 switch (mediumType) 1854 { 1855 case UIMediumType_HardDisk: gEDataManager->setRecentListOfHardDrives(recentMediumList); break; 1856 case UIMediumType_DVD: gEDataManager->setRecentListOfOpticalDisks(recentMediumList); break; 1857 case UIMediumType_Floppy: gEDataManager->setRecentListOfFloppyDisks(recentMediumList); break; 1858 default: break; 1859 } 1849 1860 1850 1861 /* Open corresponding medium: */ … … 2010 2021 2011 2022 /* Get recent-medium list: */ 2012 QString strRecentMediumAddress;2023 QStringList recentMediumList; 2013 2024 switch (mediumType) 2014 2025 { 2015 case UIMediumType_HardDisk: strRecentMediumAddress = GUI_RecentListHD; break;2016 case UIMediumType_DVD: strRecentMediumAddress = GUI_RecentListCD; break;2017 case UIMediumType_Floppy: strRecentMediumAddress = GUI_RecentListFD; break;2026 case UIMediumType_HardDisk: recentMediumList = gEDataManager->recentListOfHardDrives(); break; 2027 case UIMediumType_DVD: recentMediumList = gEDataManager->recentListOfOpticalDisks(); break; 2028 case UIMediumType_Floppy: recentMediumList = gEDataManager->recentListOfFloppyDisks(); break; 2018 2029 default: break; 2019 2030 } 2020 const QStringList recentMediumList = vboxGlobal().virtualBox().GetExtraData(strRecentMediumAddress).split(';');2021 2031 /* Prepare choose-recent-medium actions: */ 2022 2032 foreach (const QString &strRecentMediumLocationBase, recentMediumList) -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r50906 r51198 38 38 #include "UIConverter.h" 39 39 #include "UIMedium.h" 40 #include "UIExtraDataManager.h" 40 41 41 42 /* COM includes: */ … … 3337 3338 void UIMachineSettingsStorage::addRecentMediumActions(QMenu *pOpenMediumMenu, UIMediumType recentMediumType) 3338 3339 { 3339 /* Compose recent-medium list address: */3340 QString strRecentMediumAddress;3340 /* Get recent-medium list: */ 3341 QStringList recentMediumList; 3341 3342 switch (recentMediumType) 3342 3343 { 3343 case UIMediumType_HardDisk: 3344 strRecentMediumAddress = GUI_RecentListHD; 3345 break; 3346 case UIMediumType_DVD: 3347 strRecentMediumAddress = GUI_RecentListCD; 3348 break; 3349 case UIMediumType_Floppy: 3350 strRecentMediumAddress = GUI_RecentListFD; 3351 break; 3352 default: 3353 break; 3354 } 3355 /* Get recent-medium list: */ 3356 QStringList recentMediumList = vboxGlobal().virtualBox().GetExtraData(strRecentMediumAddress).split(';'); 3344 case UIMediumType_HardDisk: recentMediumList = gEDataManager->recentListOfHardDrives(); break; 3345 case UIMediumType_DVD: recentMediumList = gEDataManager->recentListOfOpticalDisks(); break; 3346 case UIMediumType_Floppy: recentMediumList = gEDataManager->recentListOfFloppyDisks(); break; 3347 default: break; 3348 } 3357 3349 /* For every list-item: */ 3358 3350 for (int index = 0; index < recentMediumList.size(); ++index)
Note:
See TracChangeset
for help on using the changeset viewer.