VirtualBox

Changeset 57663 in vbox


Ignore:
Timestamp:
Sep 9, 2015 12:59:10 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: Thread-pool: Get rid of personal storage, use Qt property storage instead.

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  
    272272}
    273273
    274 UITask::UITask(const QVariant &data)
    275     : m_data(data)
    276 {
    277 }
    278 
    279274void UITask::start()
    280275{
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIThreadPool.h

    r57629 r57663  
    121121public:
    122122
    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() {}
    132125
    133126    /** Starts the task. */
     
    139132      * @remarks To be reimplemented in sub-class. */
    140133    virtual void run() = 0;
    141 
    142 private:
    143 
    144     /** Holds the inter-thread task data. */
    145     QVariant m_data;
    146134};
    147135
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp

    r57629 r57663  
    55
    66/*
    7  * Copyright (C) 2013 Oracle Corporation
     7 * Copyright (C) 2013-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3838
    3939
    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. */
    4341class UITaskMediumEnumeration : public UITask
    4442{
     
    4745public:
    4846
    49     /* Constructor: */
     47    /** Constructs @a medium enumeration task. */
    5048    UITaskMediumEnumeration(const UIMedium &medium)
    51         : UITask(QVariant::fromValue(medium))
    52     {}
     49    {
     50        /* Store medium as property: */
     51        setProperty("medium", QVariant::fromValue(medium));
     52    }
    5353
    5454private:
    5555
    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    }
    5866};
    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 }
    6967
    7068
     
    279277
    280278    /* Get enumerated UIMedium: */
    281     const UIMedium uimedium = pTask->data().value<UIMedium>();
     279    const UIMedium uimedium = pTask->property("medium").value<UIMedium>();
    282280    const QString strUIMediumKey = uimedium.key();
    283281    LogRel2(("GUI: UIMediumEnumerator: Medium with key={%s} enumerated\n", strUIMediumKey.toAscii().constData()));
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