Changeset 78299 in vbox for trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h
- Timestamp:
- Apr 25, 2019 5:11:49 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h
r78298 r78299 35 35 class UIThreadPool; 36 36 37 /* Typedefs:*/37 /** A map of CMedium objects ordered by their IDs. */ 38 38 typedef QMap<QUuid, CMedium> CMediumMap; 39 39 40 /* Medium-enumerator prototype. 41 * Manages access to medium information using thread-pool interface. */ 40 /** QObject extension operating as medium-enumeration object. 41 * Manages access to cached UIMedium information via public API. 42 * Updates cache on corresponding Main events using thread-pool interface. */ 42 43 class SHARED_LIBRARY_STUFF UIMediumEnumerator : public QIWithRetranslateUI3<QObject> 43 44 { … … 46 47 signals: 47 48 48 /* Notifiers: Medium-operations stuff:*/49 /** Notifies listeners about UIMedium with @a uMediumID created. */ 49 50 void sigMediumCreated(const QUuid &uMediumID); 51 /** Notifies listeners about UIMedium with @a uMediumID deleted. */ 50 52 void sigMediumDeleted(const QUuid &uMediumID); 51 53 52 /* Notifiers: Medium-enumeration stuff:*/54 /** Notifies listeners about consolidated medium-enumeration process has started. */ 53 55 void sigMediumEnumerationStarted(); 56 /** Notifies listeners about UIMedium with @a uMediumID updated. */ 54 57 void sigMediumEnumerated(const QUuid &uMediumID); 58 /** Notifies listeners about consolidated medium-enumeration process has finished. */ 55 59 void sigMediumEnumerationFinished(); 56 60 … … 60 64 UIMediumEnumerator(); 61 65 62 /* API: Medium-access stuff:*/66 /** Returns cached UIMedium ID list. */ 63 67 QList<QUuid> mediumIDs() const; 68 /** Returns a wrapper of cached UIMedium with specified @a uMediumID. */ 64 69 UIMedium medium(const QUuid &uMediumID) const; 70 71 /** Creates UIMedium thus caching it internally on the basis of passed @a guiMedium information. */ 65 72 void createMedium(const UIMedium &guiMedium); 73 /** Deletes UIMedium with specified @a uMediumID thus removing it from internal cache. */ 66 74 void deleteMedium(const QUuid &uMediumID); 67 75 68 /* API: Medium-enumeration stuff:*/76 /** Returns whether consolidated medium-enumeration process is in progress. */ 69 77 bool isMediumEnumerationInProgress() const { return m_fMediumEnumerationInProgress; } 78 /** Makes a request to enumerate specified @a inputMedia. 79 * @note Empty list means that full/overall medium-enumeration is requested. */ 70 80 void enumerateMedia(const CMediumVector &inputMedia = CMediumVector()); 81 /** Refresh all the lightweight UIMedium information for all the cached UIMedium(s). 82 * @note Please note that this is a lightweight version, which doesn't perform 83 * heavy state/accessibility checks thus doesn't require to be performed 84 * by a worker COM-aware thread. */ 71 85 void refreshMedia(); 72 86 … … 78 92 private slots: 79 93 80 /** Handles machine-data-change and snapshot-change events . */94 /** Handles machine-data-change and snapshot-change events for a machine with specified @a uMachineID. */ 81 95 void sltHandleMachineUpdate(const QUuid &uMachineID); 82 /** Handles machine-[un]registration events. */ 96 /** Handles machine-[un]registration events for a machine with specified @a uMachineID. 97 * @param fRegistered Specifies whether the machine was registered or unregistered otherwise. */ 83 98 void sltHandleMachineRegistration(const QUuid &uMachineID, const bool fRegistered); 84 /** Handles snapshot-deleted events . */99 /** Handles snapshot-deleted events for a machine with specified @a uMachineID and a snapshot with specified @a uSnapshotID. */ 85 100 void sltHandleSnapshotDeleted(const QUuid &uMachineID, const QUuid &uSnapshotID); 86 101 87 /* Handler: Medium-enumeration stuff:*/102 /** Handles medium-enumeration @a pTask complete signal. */ 88 103 void sltHandleMediumEnumerationTaskComplete(UITask *pTask); 89 104 90 105 private: 91 106 92 /* Helpers: Medium-enumeration stuff:*/107 /** Creates medium-enumeration task for certain @a guiMedium. */ 93 108 void createMediumEnumerationTask(const UIMedium &guiMedium); 109 /** Adds NULL UIMedium to specified @a outputMedia map. */ 94 110 void addNullMediumToMap(UIMediumMap &outputMedia); 111 /** Adds @a inputMedia to specified @a outputMedia map. */ 95 112 void addMediaToMap(const CMediumVector &inputMedia, UIMediumMap &outputMedia); 96 113 97 /* Helpers: Medium re-caching stuff: */ 114 /** Updates usage for machine with specified @a uMachineID on the basis of cached data. 115 * @param previousUIMediumIDs Brings UIMedium IDs used in cached data. 116 * @param fTakeIntoAccountCurrentStateOnly Brings whether we should take into accound current VM state only. */ 98 117 void calculateCachedUsage(const QUuid &uMachineID, 99 118 QList<QUuid> &previousUIMediumIDs, 100 119 const bool fTakeIntoAccountCurrentStateOnly) const; 120 /** Updates usage for machine with specified @a uMachineID on the basis of actual data. 121 * @param currentCMediums Brings CMedium used in actual data. 122 * @param currentCMediumIDs Brings CMedium IDs used in actual data. 123 * @param fTakeIntoAccountCurrentStateOnly Brings whether we should take into accound current VM state only. */ 101 124 void calculateActualUsage(const QUuid &uMachineID, 102 125 CMediumMap ¤tCMediums, 103 126 QList<QUuid> ¤tCMediumIDs, 104 127 const bool fTakeIntoAccountCurrentStateOnly) const; 128 /** Updates usage for machine specified by its @a comSnapshot reference on the basis of actual data. 129 * @param currentCMediums Brings CMedium used in actual data. 130 * @param currentCMediumIDs Brings CMedium IDs used in actual data. */ 105 131 void calculateActualUsage(const CSnapshot &comSnapshot, 106 132 CMediumMap ¤tCMediums, 107 133 QList<QUuid> ¤tCMediumIDs) const; 134 /** Updates usage for machine specified by own @a comMachine reference on the basis of actual data. 135 * @param currentCMediums Brings CMedium used in actual data. 136 * @param currentCMediumIDs Brings CMedium IDs used in actual data. */ 108 137 void calculateActualUsage(const CMachine &comMachine, 109 138 CMediumMap ¤tCMediums, 110 139 QList<QUuid> ¤tCMediumIDs) const; 140 141 /** Updates cache using known changes in cached data. 142 * @param previousUIMediumIDs Brings UIMedium IDs used in cached data. */ 111 143 void recacheFromCachedUsage(const QList<QUuid> &previousUIMediumIDs); 144 /** Updates cache using known changes in actual data. 145 * @param currentCMediums Brings CMedium used in actual data. 146 * @param currentCMediumIDs Brings CMedium IDs used in actual data. */ 112 147 void recacheFromActualUsage(const CMediumMap ¤tCMediums, 113 148 const QList<QUuid> ¤tCMediumIDs); 114 149 115 /* Variables:*/150 /** Holds whether consolidated medium-enumeration process is in progress. */ 116 151 bool m_fMediumEnumerationInProgress; 152 153 /** Holds a set of current medium-enumeration tasks. */ 117 154 QSet<UITask*> m_tasks; 155 156 /** Holds a map of current cached (enumerated) media. */ 118 157 UIMediumMap m_media; 119 158 };
Note:
See TracChangeset
for help on using the changeset viewer.