VirtualBox

Changeset 51198 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
May 6, 2014 3:41:44 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: 6660: Advanced extra-data management framework: Integrate GUI_RecentFolderHD, GUI_RecentFolderCD, GUI_RecentFolderFD, GUI_RecentListHD, GUI_RecentListCD, GUI_RecentListFD.

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  
    158158}
    159159
     160QString UIExtraDataManager::recentFolderForHardDrives() const
     161{
     162    return extraDataString(GUI_RecentFolderHD);
     163}
     164
     165QString UIExtraDataManager::recentFolderForOpticalDisks() const
     166{
     167    return extraDataString(GUI_RecentFolderCD);
     168}
     169
     170QString UIExtraDataManager::recentFolderForFloppyDisks() const
     171{
     172    return extraDataString(GUI_RecentFolderFD);
     173}
     174
     175void UIExtraDataManager::setRecentFolderForHardDrives(const QString &strValue)
     176{
     177    setExtraDataString(GUI_RecentFolderHD, strValue);
     178}
     179
     180void UIExtraDataManager::setRecentFolderForOpticalDisks(const QString &strValue)
     181{
     182    setExtraDataString(GUI_RecentFolderCD, strValue);
     183}
     184
     185void UIExtraDataManager::setRecentFolderForFloppyDisks(const QString &strValue)
     186{
     187    setExtraDataString(GUI_RecentFolderFD, strValue);
     188}
     189
     190QStringList UIExtraDataManager::recentListOfHardDrives() const
     191{
     192    return extraDataStringList(GUI_RecentListHD);
     193}
     194
     195QStringList UIExtraDataManager::recentListOfOpticalDisks() const
     196{
     197    return extraDataStringList(GUI_RecentListCD);
     198}
     199
     200QStringList UIExtraDataManager::recentListOfFloppyDisks() const
     201{
     202    return extraDataStringList(GUI_RecentListFD);
     203}
     204
     205void UIExtraDataManager::setRecentListOfHardDrives(const QStringList &strValue)
     206{
     207    setExtraDataStringList(GUI_RecentListHD, strValue);
     208}
     209
     210void UIExtraDataManager::setRecentListOfOpticalDisks(const QStringList &strValue)
     211{
     212    setExtraDataStringList(GUI_RecentListCD, strValue);
     213}
     214
     215void UIExtraDataManager::setRecentListOfFloppyDisks(const QStringList &strValue)
     216{
     217    setExtraDataStringList(GUI_RecentListFD, strValue);
     218}
     219
    160220#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
    161221bool UIExtraDataManager::shouldWeAllowApplicationUpdate() const
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r51196 r51198  
    7575    /** Returns version for which user wants to prevent BETA warning. */
    7676    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);
    77103
    78104#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r51189 r51198  
    17591759            strTitle = tr("Please choose a virtual hard drive file");
    17601760            allType = tr("All virtual hard drive files (%1)");
    1761             strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderHD);
     1761            strLastFolder = gEDataManager->recentFolderForHardDrives();
    17621762            if (strLastFolder.isEmpty())
    1763                 strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderCD);
     1763                strLastFolder = gEDataManager->recentFolderForOpticalDisks();
    17641764            if (strLastFolder.isEmpty())
    1765                 strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderFD);
     1765                strLastFolder = gEDataManager->recentFolderForFloppyDisks();
    17661766            break;
    17671767        }
     
    17711771            strTitle = tr("Please choose a virtual optical disk file");
    17721772            allType = tr("All virtual optical disk files (%1)");
    1773             strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderCD);
     1773            strLastFolder = gEDataManager->recentFolderForOpticalDisks();
    17741774            if (strLastFolder.isEmpty())
    1775                 strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderHD);
     1775                strLastFolder = gEDataManager->recentFolderForFloppyDisks();
    17761776            if (strLastFolder.isEmpty())
    1777                 strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderFD);
     1777                strLastFolder = gEDataManager->recentFolderForHardDrives();
    17781778            break;
    17791779        }
     
    17831783            strTitle = tr("Please choose a virtual floppy disk file");
    17841784            allType = tr("All virtual floppy disk files (%1)");
    1785             strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderFD);
     1785            strLastFolder = gEDataManager->recentFolderForFloppyDisks();
    17861786            if (strLastFolder.isEmpty())
    1787                 strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderCD);
     1787                strLastFolder = gEDataManager->recentFolderForOpticalDisks();
    17881788            if (strLastFolder.isEmpty())
    1789                 strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderHD);
     1789                strLastFolder = gEDataManager->recentFolderForHardDrives();
    17901790            break;
    17911791        }
     
    18301830
    18311831    /* 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    }
    18371839
    18381840    /* 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    }
    18441849    if (recentMediumList.contains(strMediumLocation))
    18451850        recentMediumList.removeAll(strMediumLocation);
    18461851    recentMediumList.prepend(strMediumLocation);
    18471852    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    }
    18491860
    18501861    /* Open corresponding medium: */
     
    20102021
    20112022    /* Get recent-medium list: */
    2012     QString strRecentMediumAddress;
     2023    QStringList recentMediumList;
    20132024    switch (mediumType)
    20142025    {
    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;
    20182029        default: break;
    20192030    }
    2020     const QStringList recentMediumList = vboxGlobal().virtualBox().GetExtraData(strRecentMediumAddress).split(';');
    20212031    /* Prepare choose-recent-medium actions: */
    20222032    foreach (const QString &strRecentMediumLocationBase, recentMediumList)
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp

    r50906 r51198  
    3838#include "UIConverter.h"
    3939#include "UIMedium.h"
     40#include "UIExtraDataManager.h"
    4041
    4142/* COM includes: */
     
    33373338void UIMachineSettingsStorage::addRecentMediumActions(QMenu *pOpenMediumMenu, UIMediumType recentMediumType)
    33383339{
    3339     /* Compose recent-medium list address: */
    3340     QString strRecentMediumAddress;
     3340    /* Get recent-medium list: */
     3341    QStringList recentMediumList;
    33413342    switch (recentMediumType)
    33423343    {
    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    }
    33573349    /* For every list-item: */
    33583350    for (int index = 0; index < recentMediumList.size(); ++index)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette