VirtualBox

Changeset 31759 in vbox


Ignore:
Timestamp:
Aug 18, 2010 12:18:20 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
64940
Message:

FE/Qt: 3601: While the warning about the wrong color depth is shown, all other updates should be performed (x11 host, 1st try).

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

Legend:

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

    r31017 r31759  
    38843884        public:
    38853885            RemindEvent (ulong aRealBPP)
    3886                 : mRealBPP (aRealBPP) {}
     3886                : VBoxAsyncEvent(100), mRealBPP (aRealBPP) {}
    38873887            void handle()
    38883888            {
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r31533 r31759  
    49004900 */
    49014901
     4902VBoxAsyncEvent::VBoxAsyncEvent(uint uDelay)
     4903    : QEvent((QEvent::Type)VBoxDefs::AsyncEventType)
     4904    , m_uDelay(uDelay)
     4905{
     4906}
     4907
     4908void VBoxAsyncEvent::post()
     4909{
     4910    UIAsyncEventPoster::post(this);
     4911}
     4912
     4913uint VBoxAsyncEvent::delay() const
     4914{
     4915    return m_uDelay;
     4916}
     4917
     4918UIAsyncEventPoster* UIAsyncEventPoster::m_spInstance = 0;
     4919
     4920void UIAsyncEventPoster::post(VBoxAsyncEvent *pAsyncEvent)
     4921{
     4922    if (!m_spInstance)
     4923        new UIAsyncEventPoster(pAsyncEvent);
     4924}
     4925
     4926UIAsyncEventPoster::UIAsyncEventPoster(VBoxAsyncEvent *pAsyncEvent)
     4927    : m_pAsyncEvent(pAsyncEvent)
     4928{
     4929    m_spInstance = this;
     4930    QTimer::singleShot(m_pAsyncEvent->delay(), this, SLOT(sltPostAsyncEvent()));
     4931}
     4932
     4933UIAsyncEventPoster::~UIAsyncEventPoster()
     4934{
     4935    m_spInstance = 0;
     4936}
     4937
     4938void UIAsyncEventPoster::sltPostAsyncEvent()
     4939{
     4940    if (m_pAsyncEvent)
     4941        QApplication::postEvent(&vboxGlobal(), m_pAsyncEvent);
     4942    m_pAsyncEvent = 0;
     4943    deleteLater();
     4944}
    49024945
    49034946/**
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r31533 r31759  
    816816////////////////////////////////////////////////////////////////////////////////
    817817
    818 /**
    819  *  Generic asyncronous event.
    820  *
    821  *  This abstract class is intended to provide a conveinent way to execute
    822  *  code on the main GUI thread asynchronously to the calling party. This is
    823  *  done by putting necessary actions to the #handle() function in a subclass
    824  *  and then posting an instance of the subclass using #post(). The instance
    825  *  must be allocated on the heap using the <tt>new</tt> operation and will be
    826  *  automatically deleted after processing. Note that if you don't call #post()
    827  *  on the created instance, you have to delete it yourself.
    828  */
     818/* Generic asyncronous event.
     819 * This abstract class is intended to provide a conveinent way
     820 * to execute code on the main GUI thread asynchronously to the calling party.
     821 * This is done by putting necessary actions to the handle() function
     822 * in a subclass and then posting an instance of the subclass using post().
     823 * The instance must be allocated on the heap and will be automatically deleted after processing. */
    829824class VBoxAsyncEvent : public QEvent
    830825{
    831826public:
    832827
    833     VBoxAsyncEvent() : QEvent ((QEvent::Type) VBoxDefs::AsyncEventType) {}
    834 
    835     /**
    836      *  Worker function. Gets executed on the GUI thread when the posted event
    837      *  is processed by the main event loop.
    838      */
     828    /* VBoxAsyncEvent constructor: */
     829    VBoxAsyncEvent(uint uDelay = 0);
     830
     831    /* Worker function. Gets executed on the GUI thread when
     832     * the posted event is processed by the main event loop. */
    839833    virtual void handle() = 0;
    840834
    841     /**
    842      *  Posts this event to the main event loop.
    843      *  The caller loses ownership of this object after this method returns
    844      *  and must not delete the object.
    845      */
    846     void post()
    847     {
    848         QApplication::postEvent (&vboxGlobal(), this);
    849     }
     835    /* Posts this event to the main event loop. The caller loses ownership of
     836     * this object after this method returns and must not delete the object. */
     837    void post();
     838
     839    /* Returns delay for this event: */
     840    uint delay() const;
     841
     842private:
     843
     844    uint m_uDelay;
     845};
     846
     847/* Asyncronous event poster.
     848 * This class is used to post async event into VBoxGlobal event handler
     849 * taking into account delay set during async event creation procedure. */
     850class UIAsyncEventPoster : public QObject
     851{
     852    Q_OBJECT;
     853
     854public:
     855
     856    /* Async event poster creator: */
     857    static void post(VBoxAsyncEvent *pAsyncEvent);
     858
     859protected:
     860
     861    /* Constructor/destructor: */
     862    UIAsyncEventPoster(VBoxAsyncEvent *pAsyncEvent);
     863    ~UIAsyncEventPoster();
     864
     865private slots:
     866
     867    /* Async event poster: */
     868    void sltPostAsyncEvent();
     869
     870private:
     871
     872    static UIAsyncEventPoster *m_spInstance;
     873    VBoxAsyncEvent *m_pAsyncEvent;
    850874};
    851875
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.cpp

    r30753 r31759  
    193193        public:
    194194            RemindEvent (ulong aRealBPP)
    195                 : mRealBPP (aRealBPP) {}
     195                : VBoxAsyncEvent(100), mRealBPP (aRealBPP) {}
    196196            void handle()
    197197            {
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette