![]() |
Mixxx
|
00001 // 00002 // C++ Implementation: controlobjecthreadmainp.cpp 00003 // 00004 // Description: 00005 // 00006 // 00007 // Author: Tue Haste Andersen <haste@diku.dk>, (C) 2004 00008 // 00009 // Copyright: See COPYING file that comes with this distribution 00010 // 00011 // 00012 00013 #include <QApplication> 00014 #include <QtDebug> 00015 //Added by qt3to4: 00016 #include <QEvent> 00017 #include "controlobjectthreadmain.h" 00018 #include "controlobject.h" 00019 #include "controlevent.h" 00020 00021 ControlObjectThreadMain::ControlObjectThreadMain(ControlObject * pControlObject, QObject* pParent) 00022 : ControlObjectThread(pControlObject, pParent) { 00023 setObjectName("ControlObjectThreadMain"); 00024 installEventFilter(this); 00025 } 00026 00027 ControlObjectThreadMain::~ControlObjectThreadMain() { 00028 } 00029 00030 bool ControlObjectThreadMain::eventFilter(QObject * o, QEvent * e) 00031 { 00032 // Handle events 00033 if (e->type() == MIXXXEVENT_CONTROL) 00034 { 00035 ControlEvent * ce = (ControlEvent *)e; 00036 00037 m_dataMutex.lock(); 00038 m_dValue = ce->value(); 00039 m_dataMutex.unlock(); 00040 00041 //qDebug() << "ControlEvent " << ce->value(); 00042 emit(valueChanged(ce->value())); 00043 } 00044 else 00045 { 00046 // standard event processing 00047 return QObject::eventFilter(o,e); 00048 } 00049 return true; 00050 } 00051 00052 bool ControlObjectThreadMain::setExtern(double v) 00053 { 00054 //qDebug() << "set extern main"; 00055 QApplication::postEvent(this, new ControlEvent(v)); 00056 return true; 00057 }