Mixxx

/home/maxime/Projets/Mixxx/1.10/mixxx/src/controlobjectthread.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           controlobjectthread.h  -  description
00003                              -------------------
00004     begin                : Thu Sep 23 2004
00005     copyright            : (C) 2004 by Tue Haste Andersen
00006     email                : haste@diku.dk
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef CONTROLOBJECTTHREAD_H
00019 #define CONTROLOBJECTTHREAD_H
00020 
00021 #include <qmutex.h>
00022 #include <qobject.h>
00023 #include <qmutex.h>
00024 #include <qwaitcondition.h>
00025 #include <QQueue>
00026 
00027 class ControlObject;
00028 
00029 
00039 class ControlObjectThread : public QObject
00040 {
00041     Q_OBJECT
00042 public:
00043     ControlObjectThread(ControlObject *pControlObject, QObject* pParent=NULL);
00044     virtual ~ControlObjectThread();
00046     double get();
00050     virtual bool setExtern(double v);
00053     void add(double v);
00056     void sub(double v);
00059     static bool update();
00061     void emitValueChanged();
00062 
00063 
00064     // FIXME: Dangerous GED hack
00065     ControlObject* getControlObject();
00066 
00067 public slots:
00070     void slotSet(double v);
00071 
00072         // The danger signal! This is for safety in wierd shutdown scenarios where the
00073         // ControlObject dies to avoid segfaults.
00074         void slotParentDead();
00075 
00076 signals:
00077     void valueChanged(double);
00078 
00079 protected:
00081     double m_dValue;
00083     static QMutex m_sqMutex;
00085     QMutex m_dataMutex;
00087     ControlObject *m_pControlObject;
00088 
00089 private:
00091     virtual void updateControlObject();
00092 
00094     static QWaitCondition m_sqWait;
00096     static QQueue<ControlObjectThread*> m_sqQueue;
00097 };
00098 
00099 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines