VirtualBox

Changeset 73017 in vbox


Ignore:
Timestamp:
Jul 10, 2018 8:35:25 AM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: Factor out a function in VBoxGlobal to keep track of recent virtual media

Location:
trunk/src/VBox/Frontends/VirtualBox/src/globals
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r72927 r73017  
    25112511    CVirtualBox comVBox = virtualBox();
    25122512
    2513     /* Remember the path of the last chosen medium: */
    2514     switch (enmMediumType)
    2515     {
    2516         case UIMediumType_HardDisk: gEDataManager->setRecentFolderForHardDrives(QFileInfo(strMediumLocation).absolutePath()); break;
    2517         case UIMediumType_DVD:      gEDataManager->setRecentFolderForOpticalDisks(QFileInfo(strMediumLocation).absolutePath()); break;
    2518         case UIMediumType_Floppy:   gEDataManager->setRecentFolderForFloppyDisks(QFileInfo(strMediumLocation).absolutePath()); break;
    2519         default: break;
    2520     }
    2521 
    2522     /* Update recently used list: */
    2523     QStringList recentMediumList;
    2524     switch (enmMediumType)
    2525     {
    2526         case UIMediumType_HardDisk: recentMediumList = gEDataManager->recentListOfHardDrives(); break;
    2527         case UIMediumType_DVD:      recentMediumList = gEDataManager->recentListOfOpticalDisks(); break;
    2528         case UIMediumType_Floppy:   recentMediumList = gEDataManager->recentListOfFloppyDisks(); break;
    2529         default: break;
    2530     }
    2531     if (recentMediumList.contains(strMediumLocation))
    2532         recentMediumList.removeAll(strMediumLocation);
    2533     recentMediumList.prepend(strMediumLocation);
    2534     while(recentMediumList.size() > 5)
    2535         recentMediumList.removeLast();
    2536     switch (enmMediumType)
    2537     {
    2538         case UIMediumType_HardDisk: gEDataManager->setRecentListOfHardDrives(recentMediumList); break;
    2539         case UIMediumType_DVD:      gEDataManager->setRecentListOfOpticalDisks(recentMediumList); break;
    2540         case UIMediumType_Floppy:   gEDataManager->setRecentListOfFloppyDisks(recentMediumList); break;
    2541         default: break;
    2542     }
     2513    updateRecentlyUsedMediumListAndFolder(enmMediumType, strMediumLocation);
    25432514
    25442515    /* Open corresponding medium: */
     
    31013072    return fUseHtml ? guiMedium.detailsHTML(true /* no diffs? */, fPredictDiff) :
    31023073                      guiMedium.details(true /* no diffs? */, fPredictDiff);
     3074}
     3075
     3076void VBoxGlobal::updateRecentlyUsedMediumListAndFolder(UIMediumType enmMediumType, QString strMediumLocation)
     3077{
     3078       /* Remember the path of the last chosen medium: */
     3079    switch (enmMediumType)
     3080    {
     3081        case UIMediumType_HardDisk: gEDataManager->setRecentFolderForHardDrives(QFileInfo(strMediumLocation).absolutePath()); break;
     3082        case UIMediumType_DVD:      gEDataManager->setRecentFolderForOpticalDisks(QFileInfo(strMediumLocation).absolutePath()); break;
     3083        case UIMediumType_Floppy:   gEDataManager->setRecentFolderForFloppyDisks(QFileInfo(strMediumLocation).absolutePath()); break;
     3084        default: break;
     3085    }
     3086
     3087    /* Update recently used list: */
     3088    QStringList recentMediumList;
     3089    switch (enmMediumType)
     3090    {
     3091        case UIMediumType_HardDisk: recentMediumList = gEDataManager->recentListOfHardDrives(); break;
     3092        case UIMediumType_DVD:      recentMediumList = gEDataManager->recentListOfOpticalDisks(); break;
     3093        case UIMediumType_Floppy:   recentMediumList = gEDataManager->recentListOfFloppyDisks(); break;
     3094        default: break;
     3095    }
     3096    if (recentMediumList.contains(strMediumLocation))
     3097        recentMediumList.removeAll(strMediumLocation);
     3098    recentMediumList.prepend(strMediumLocation);
     3099    while(recentMediumList.size() > 5)
     3100        recentMediumList.removeLast();
     3101    switch (enmMediumType)
     3102    {
     3103        case UIMediumType_HardDisk: gEDataManager->setRecentListOfHardDrives(recentMediumList); break;
     3104        case UIMediumType_DVD:      gEDataManager->setRecentListOfOpticalDisks(recentMediumList); break;
     3105        case UIMediumType_Floppy:   gEDataManager->setRecentListOfFloppyDisks(recentMediumList); break;
     3106        default: break;
     3107    }
    31033108}
    31043109
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r72903 r73017  
    532532          * @param  fUseHtml      Brings whether HTML subsets should be used in the generated output. */
    533533        QString details(const CMedium &comMedium, bool fPredictDiff, bool fUseHtml = true);
     534
     535        /** Update extra data related to recently used/referred media.
     536          * @param  enmMediumType       Passes the medium type.
     537          * @param  strMediumLocation   Passes the medium location. */
     538        void updateRecentlyUsedMediumListAndFolder(UIMediumType enmMediumType, QString strMediumLocation);
    534539    /** @} */
    535540
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