Changeset 57663 in vbox
- Timestamp:
- Sep 9, 2015 12:59:10 PM (9 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIThreadPool.cpp
r57631 r57663 272 272 } 273 273 274 UITask::UITask(const QVariant &data)275 : m_data(data)276 {277 }278 279 274 void UITask::start() 280 275 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIThreadPool.h
r57629 r57663 121 121 public: 122 122 123 /** Constructs worker-thread task. 124 * @param data defines inter-thread task data to be processed 125 * by worker-thread and returned back if necessary. */ 126 UITask(const QVariant &data); 127 128 /** Returns the inter-thread task data. */ 129 const QVariant& data() const { return m_data; } 130 /** Defines the inter-thread task @a data. */ 131 void setData(const QVariant &data) { m_data = data; } 123 /** Constructs worker-thread task. */ 124 UITask() {} 132 125 133 126 /** Starts the task. */ … … 139 132 * @remarks To be reimplemented in sub-class. */ 140 133 virtual void run() = 0; 141 142 private:143 144 /** Holds the inter-thread task data. */145 QVariant m_data;146 134 }; 147 135 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp
r57629 r57663 5 5 6 6 /* 7 * Copyright (C) 2013 Oracle Corporation7 * Copyright (C) 2013-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 38 38 39 39 40 41 /* GUI task prototype: Medium enumeration. 42 * Extends UITask interface to be executed by the UIThreadWorker. */ 40 /** UITask extension used for medium enumeration purposes. */ 43 41 class UITaskMediumEnumeration : public UITask 44 42 { … … 47 45 public: 48 46 49 /* Constructor:*/47 /** Constructs @a medium enumeration task. */ 50 48 UITaskMediumEnumeration(const UIMedium &medium) 51 : UITask(QVariant::fromValue(medium)) 52 {} 49 { 50 /* Store medium as property: */ 51 setProperty("medium", QVariant::fromValue(medium)); 52 } 53 53 54 54 private: 55 55 56 /* Helper: Run stuff: */ 57 void run(); 56 /** Contains medium enumeration task body. */ 57 void run() 58 { 59 /* Get medium: */ 60 UIMedium medium = property("medium").value<UIMedium>(); 61 /* Enumerate it: */ 62 medium.blockAndQueryState(); 63 /* Put it back: */ 64 setProperty("medium", QVariant::fromValue(medium)); 65 } 58 66 }; 59 60 void UITaskMediumEnumeration::run()61 {62 /* Get medium: */63 UIMedium medium = data().value<UIMedium>();64 /* Enumerate it: */65 medium.blockAndQueryState();66 /* Put medium back: */67 setData(QVariant::fromValue(medium));68 }69 67 70 68 … … 279 277 280 278 /* Get enumerated UIMedium: */ 281 const UIMedium uimedium = pTask-> data().value<UIMedium>();279 const UIMedium uimedium = pTask->property("medium").value<UIMedium>(); 282 280 const QString strUIMediumKey = uimedium.key(); 283 281 LogRel2(("GUI: UIMediumEnumerator: Medium with key={%s} enumerated\n", strUIMediumKey.toAscii().constData()));
Note:
See TracChangeset
for help on using the changeset viewer.