VirtualBox

Changeset 78721 in vbox for trunk/src


Ignore:
Timestamp:
May 24, 2019 12:01:05 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:7127: Media-enumeration stuff: Style fixes, a bit of refactoring, renaming and similar things.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
15 edited

Legend:

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

    r78395 r78721  
    24932493}
    24942494
    2495 void VBoxGlobal::startMediumEnumeration(const CMediumVector &mediaList /* = CMediumVector() */)
     2495void VBoxGlobal::startMediaEnumeration(const CMediumVector &comMedia /* = CMediumVector() */)
    24962496{
    24972497    /* Make sure VBoxGlobal is already valid: */
    24982498    AssertReturnVoid(m_fValid);
     2499    /* Ignore the request during VBoxGlobal cleanup: */
     2500    if (s_fCleaningUp)
     2501        return;
     2502    /* Ignore the request during startup snapshot restoring: */
     2503    if (shouldRestoreCurrentSnapshot())
     2504        return;
    24992505
    25002506    /* Make sure medium-enumerator is already created: */
    25012507    if (!m_pMediumEnumerator)
    25022508        return;
    2503 
    25042509    /* Make sure enumeration is not already started: */
    25052510    if (isMediumEnumerationInProgress())
    25062511        return;
    25072512
    2508     /* Ignore the request during VBoxGlobal cleanup: */
    2509     if (s_fCleaningUp)
    2510         return;
    2511 
    2512     /* If asked to restore snapshot, don't do this till *after* we're done
    2513      * restoring or the code with have a heart attack. */
    2514     if (shouldRestoreCurrentSnapshot())
    2515         return;
    2516 
     2513    /* Redirect request to medium-enumerator under proper lock: */
    25172514    if (m_meCleanupProtectionToken.tryLockForRead())
    25182515    {
    2519         /* Redirect request to medium-enumerator: */
    25202516        if (m_pMediumEnumerator)
    2521             m_pMediumEnumerator->enumerateMedia(mediaList);
     2517            m_pMediumEnumerator->startMediaEnumeration(comMedia);
    25222518        m_meCleanupProtectionToken.unlock();
    25232519    }
     
    33113307    {
    33123308        /* UI medium may be new and not among our media, request enumeration: */
    3313         startMediumEnumeration();
     3309        startMediaEnumeration();
    33143310
    33153311        /* Search for corresponding UI medium again: */
     
    39393935void VBoxGlobal::sltGUILanguageChange(QString strLanguage)
    39403936{
    3941     /* Make sure medium-enumeration is not in progress! */
     3937    /* Make sure media-enumeration is not in progress! */
    39423938    AssertReturnVoid(!isMediumEnumerationInProgress());
    39433939    /* Load passed language: */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r77556 r78721  
    9292        void sigMediumDeleted(const QUuid &uMediumID);
    9393
    94         /** Notifies listeners about medium enumeration started. */
     94        /** Notifies listeners about media-enumeration started. */
    9595        void sigMediumEnumerationStarted();
    9696        /** Notifies listeners about medium with certain @a uMediumID enumerated. */
    9797        void sigMediumEnumerated(const QUuid &uMediumID);
    98         /** Notifies listeners about medium enumeration finished. */
     98        /** Notifies listeners about media-enumeration finished. */
    9999        void sigMediumEnumerationFinished();
    100100    /** @} */
     
    210210        bool showStartVMErrors() const { return m_fShowStartVMErrors; }
    211211
    212         /** Returns the --aggressive-caching / --no-aggressive-caching option value (whether medium-enumeration is required). */
     212        /** Returns the --aggressive-caching / --no-aggressive-caching option value (whether media-enumeration is required). */
    213213        bool agressiveCaching() const { return m_fAgressiveCaching; }
    214214
     
    476476    /** @name COM: Virtual Media stuff.
    477477     * @{ */
    478         /** Starts medium enumeration. */
    479         void startMediumEnumeration(const CMediumVector &mediaList = CMediumVector());
     478        /** Starts media-enumeration. */
     479        void startMediaEnumeration(const CMediumVector &mediaList = CMediumVector());
    480480        /** Calls refresh for each medium which has been already enumerated. */
    481481        void refreshMedia();
    482         /** Returns whether medium enumeration is in progress. */
     482        /** Returns whether media-enumeration is in progress. */
    483483        bool isMediumEnumerationInProgress() const;
    484484        /** Returns enumerated medium with certain @a uMediumID. */
     
    806806        bool     m_fShowStartVMErrors;
    807807
    808         /** Holds the --aggressive-caching / --no-aggressive-caching option value (whether medium-enumeration is required). */
     808        /** Holds the --aggressive-caching / --no-aggressive-caching option value (whether media-enumeration is required). */
    809809        bool  m_fAgressiveCaching;
    810810
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r78063 r78721  
    12491249    /* Cache medium data early if necessary: */
    12501250    if (vboxGlobal().agressiveCaching())
    1251         vboxGlobal().startMediumEnumeration();
     1251        vboxGlobal().startMediaEnumeration();
    12521252
    12531253    /* Prepare: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h

    r76941 r78721  
    115115#endif /* VBOX_WS_X11 */
    116116
    117         /** Handles signal about medium-enumeration finished. */
     117        /** Handles signal about media-enumeration finished. */
    118118        void sltHandleMediumEnumerationFinish();
    119119
     
    343343    /** Holds whether the dialog is polished. */
    344344    bool  m_fPolished                      : 1;
    345     /** Holds whether first medium enumeration handled. */
     345    /** Holds whether first media-enumeration handled. */
    346346    bool  m_fFirstMediumEnumerationHandled : 1;
    347347
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp

    r78421 r78721  
    4545
    4646
    47 /** UITask extension used for medium-enumeration purposes.
     47/** UITask extension used for media-enumeration purposes.
    4848  * @note Indeed property/setProperty API isn't thread-safe stuff.
    4949  *       This isn't dangerous for us since setter/getter API calls
     
    5858public:
    5959
    60     /** Constructs @a medium-enumeration task. */
     60    /** Constructs @a media-enumeration task. */
    6161    UITaskMediumEnumeration(const UIMedium &medium)
    6262        : UITask(UITask::Type_MediumEnumeration)
     
    6969private:
    7070
    71     /** Contains medium-enumeration task body. */
     71    /** Contains media-enumeration task body. */
    7272    virtual void run() /* override */
    7373    {
     
    174174}
    175175
    176 void UIMediumEnumerator::enumerateMedia(const CMediumVector &inputMedia /* = CMediumVector() */)
     176void UIMediumEnumerator::startMediaEnumeration(const CMediumVector &comMedia /* = CMediumVector() */)
    177177{
    178178    /* Make sure we are not already in progress: */
     
    183183    UIMediumMap media;
    184184    addNullMediumToMap(media);
    185     /* If @p inputMedia is empty we start the media enumeration with all
    186      * known hard disk media. Otherwise only passed inputMedia will be
    187      * enumerated. But be aware we will enumerate all the optical/floppy
    188      * media in any case to make them listed within the first run wizard
    189      * for now. But I think later we can add proper enumeration call to
    190      * the wizard instead and enumerate only inputMedia in 'else' case. */
    191     if (inputMedia.isEmpty())
     185    /* If @p comMedia is empty we start the media-enumeration with all
     186     * known hard disk media. Otherwise only passed comMedia will be
     187     * enumerated. But be aware we will enumerate all the optical media
     188     * in any case to make them listed within the first run wizard for
     189     * now. But I think later we can add proper enumeration call to the
     190     * wizard instead and enumerate only comMedia in 'else' case. */
     191    if (comMedia.isEmpty())
    192192    {
    193193        addMediaToMap(vboxGlobal().virtualBox().GetHardDisks(), media);
     
    201201        addMediaToMap(vboxGlobal().host().GetDVDDrives(), media);
    202202        addMediaToMap(vboxGlobal().virtualBox().GetDVDImages(), media);
    203         addMediaToMap(inputMedia, media);
     203        addMediaToMap(comMedia, media);
    204204    }
    205205
     
    208208        return;
    209209
    210     /* Remember new media map: */
     210    /* Replace existing media map: */
    211211    m_media = media;
    212212
    213     /* Notify listener: */
     213    /* Notify listener about enumeration started: */
    214214    LogRel(("GUI: UIMediumEnumerator: Medium-enumeration started...\n"));
    215215    m_fMediumEnumerationInProgress = true;
     
    219219    if (m_media.size() == 1)
    220220    {
    221         /* Notify listener: */
     221        /* Notify listener about enumeration finished instantly: */
    222222        LogRel(("GUI: UIMediumEnumerator: Medium-enumeration finished!\n"));
    223223        m_fMediumEnumerationInProgress = false;
     
    542542void UIMediumEnumerator::createMediumEnumerationTask(const UIMedium &guiMedium)
    543543{
    544     /* Prepare medium-enumeration task: */
     544    /* Prepare media-enumeration task: */
    545545    UITask *pTask = new UITaskMediumEnumeration(guiMedium);
    546546    /* Append to internal set: */
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h

    r78421 r78721  
    4646typedef QMap<QUuid, CMedium> CMediumMap;
    4747
    48 /** QObject extension operating as medium-enumeration object.
     48/** QObject extension operating as media-enumeration object.
    4949  * Manages access to cached UIMedium information via public API.
    5050  * Updates cache on corresponding Main events using thread-pool interface. */
     
    6060    void sigMediumDeleted(const QUuid &uMediumID);
    6161
    62     /** Notifies listeners about consolidated medium-enumeration process has started. */
     62    /** Notifies listeners about consolidated media-enumeration process has started. */
    6363    void sigMediumEnumerationStarted();
    6464    /** Notifies listeners about UIMedium with @a uMediumID updated. */
    6565    void sigMediumEnumerated(const QUuid &uMediumID);
    66     /** Notifies listeners about consolidated medium-enumeration process has finished. */
     66    /** Notifies listeners about consolidated media-enumeration process has finished. */
    6767    void sigMediumEnumerationFinished();
    6868
     
    8282    void deleteMedium(const QUuid &uMediumID);
    8383
    84     /** Returns whether consolidated medium-enumeration process is in progress. */
     84    /** Returns whether consolidated media-enumeration process is in progress. */
    8585    bool isMediumEnumerationInProgress() const { return m_fMediumEnumerationInProgress; }
    86     /** Makes a request to enumerate specified @a inputMedia.
    87       * @note  Empty list means that full/overall medium-enumeration is requested. */
    88     void enumerateMedia(const CMediumVector &inputMedia = CMediumVector());
     86    /** Makes a request to enumerate specified @a comMedia.
     87      * @note  Previous map will be replaced with the new one, values present in both
     88      *        maps will be merged from the previous to new one, keep that all in mind.
     89      * @note  Empty passed map means that full/overall media-enumeration is requested. */
     90    void startMediaEnumeration(const CMediumVector &comMedia = CMediumVector());
    8991    /** Refresh all the lightweight UIMedium information for all the cached UIMedium(s).
    9092      * @note  Please note that this is a lightweight version, which doesn't perform
     
    129131#endif /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
    130132
    131     /** Handles medium-enumeration @a pTask complete signal. */
     133    /** Handles media-enumeration @a pTask complete signal. */
    132134    void sltHandleMediumEnumerationTaskComplete(UITask *pTask);
    133135
    134136private:
    135137
    136     /** Creates medium-enumeration task for certain @a guiMedium. */
     138    /** Creates media-enumeration task for certain @a guiMedium. */
    137139    void createMediumEnumerationTask(const UIMedium &guiMedium);
    138140    /** Adds NULL UIMedium to specified @a outputMedia map. */
     
    184186#endif /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
    185187
    186     /** Holds whether consolidated medium-enumeration process is in progress. */
     188    /** Holds whether consolidated media-enumeration process is in progress. */
    187189    bool  m_fMediumEnumerationInProgress;
    188190
    189     /** Holds a set of current medium-enumeration tasks. */
     191    /** Holds a set of current media-enumeration tasks. */
    190192    QSet<UITask*>  m_tasks;
    191193
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp

    r78432 r78721  
    375375
    376376    /* If medium-item change allowed and
    377      * 1. medium-enumeration is not currently in progress or
     377     * 1. media-enumeration is not currently in progress or
    378378     * 2. if there is no currently medium-item selected
    379379     * we have to choose newly added medium-item as current one: */
     
    579579void UIMediumManagerWidget::sltRefreshAll()
    580580{
    581     /* Start medium-enumeration: */
    582     vboxGlobal().startMediumEnumeration();
     581    /* Start media-enumeration: */
     582    vboxGlobal().startMediaEnumeration();
    583583}
    584584
     
    694694    retranslateUi();
    695695
    696     /* Start medium-enumeration (if necessary): */
     696    /* Start media-enumeration (if necessary): */
    697697    if (!vboxGlobal().isMediumEnumerationInProgress())
    698         vboxGlobal().startMediumEnumeration();
    699     /* Emulate medium-enumeration otherwise: */
     698        vboxGlobal().startMediaEnumeration();
     699    /* Emulate media-enumeration otherwise: */
    700700    else
    701701    {
    702         /* Start medium-enumeration: */
     702        /* Start media-enumeration: */
    703703        sltHandleMediumEnumerationStart();
    704704
    705         /* Finish medium-enumeration (if necessary): */
     705        /* Finish media-enumeration (if necessary): */
    706706        if (!vboxGlobal().isMediumEnumerationInProgress())
    707707            sltHandleMediumEnumerationFinish();
     
    721721            this, &UIMediumManagerWidget::sltHandleMediumDeleted);
    722722
    723     /* Configure medium-enumeration connections: */
     723    /* Configure media-enumeration connections: */
    724724    connect(&vboxGlobal(), &VBoxGlobal::sigMediumEnumerationStarted,
    725725            this, &UIMediumManagerWidget::sltHandleMediumEnumerationStart);
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h

    r78432 r78721  
    5858
    5959/** Medium manager progress-bar.
    60   * Reflects medium-enumeration progress, stays hidden otherwise. */
     60  * Reflects media-enumeration progress, stays hidden otherwise. */
    6161class UIEnumerationProgressBar : public QWidget
    6262{
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp

    r77372 r78721  
    8181{
    8282    if (vboxGlobal().uiType() == VBoxGlobal::UIType_RuntimeUI)
    83         vboxGlobal().startMediumEnumeration();
     83        vboxGlobal().startMediaEnumeration();
    8484    configure();
    8585    finalize();
     
    233233void UIMediumSelector::prepareConnections()
    234234{
    235     /* Configure medium-enumeration connections: */
     235    /* Configure media-enumeration connections: */
    236236    connect(&vboxGlobal(), &VBoxGlobal::sigMediumEnumerationStarted,
    237237            this, &UIMediumSelector::sltHandleMediumEnumerationStart);
     
    496496{
    497497    /* Initialize media enumation: */
    498     vboxGlobal().startMediumEnumeration();
     498    vboxGlobal().startMediaEnumeration();
    499499    /* Update the search: */
    500500    m_pSearchWidget->search(m_pTreeWidget);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp

    r76606 r78721  
    210210    {
    211211        AssertReturn(m_pSession, false);
    212         vboxGlobal().startMediumEnumeration(m_pSession->getMachineMedia());
     212        vboxGlobal().startMediaEnumeration(m_pSession->getMachineMedia());
    213213    }
    214214    /* Prepare machine-logic: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.cpp

    r77647 r78721  
    169169    /* This is needed at least for some vm to show correct storage info. For the manager UI enumeration has been done already: */
    170170    if (vboxGlobal().uiType() == VBoxGlobal::UIType_RuntimeUI)
    171         vboxGlobal().startMediumEnumeration();
     171        vboxGlobal().startMediaEnumeration();
    172172}
    173173
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp

    r76606 r78721  
    670670#endif
    671671
    672     /* Allow to reset first-run flag just when medium enumeration was finished: */
     672    /* Allow to reset first-run flag just when media-enumeration was finished: */
    673673    connect(&vboxGlobal(), &VBoxGlobal::sigMediumEnumerationFinished,
    674674            this, &UISettingsDialogMachine::sltAllowResetFirstRunFlag);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp

    r78627 r78721  
    37113711     * lasted point, where we can start. The rest of the media checking is done
    37123712     * in a background thread. */
    3713     vboxGlobal().startMediumEnumeration();
     3713    vboxGlobal().startMediaEnumeration();
    37143714
    37153715    /* Layout created in the .ui file. */
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMediaComboBox.cpp

    r76606 r78721  
    5959{
    6060    if (!vboxGlobal().isMediumEnumerationInProgress())
    61         vboxGlobal().startMediumEnumeration();
     61        vboxGlobal().startMediaEnumeration();
    6262    else
    6363        refresh();
     
    206206            this, &UIMediaComboBox::sltHandleMediumDeleted);
    207207
    208     /* Setup medium-enumeration handlers: */
     208    /* Setup media-enumeration handlers: */
    209209    connect(&vboxGlobal(), &VBoxGlobal::sigMediumEnumerationStarted,
    210210            this, &UIMediaComboBox::sltHandleMediumEnumerationStart);
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMediaComboBox.h

    r76581 r78721  
    7373    void sltHandleMediumDeleted(const QUuid &uMediumId);
    7474
    75     /** Handles medium enumeration start. */
     75    /** Handles media-enumeration start. */
    7676    void sltHandleMediumEnumerationStart();
    7777
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