00001
00002
00003
00004
00005
00006 #ifndef MARSYSTEMWRAPPER_H
00007 #define MARSYSTEMWRAPPER_H
00008
00009
00010 #include <QThread>
00011 #include <QVector>
00012 #include <QString>
00013 #include <QMutex>
00014 #include <QSemaphore>
00015 #include <QWaitCondition>
00016 #include <QTimer>
00017 #include <QMetaType>
00018 #include "common.h"
00019 #include "MarSystemManager.h"
00020
00021
00022 using namespace std;
00023 using namespace Marsyas;
00024 namespace MarsyasQt
00025 {
00034 class MarSystemQtWrapper: public QThread
00035 {
00036 Q_OBJECT
00037
00038 public:
00039 MarSystemQtWrapper(MarSystem* msys, bool withTimer = false);
00040 ~MarSystemQtWrapper();
00041 void tickForever();
00042 void trackctrl(MarControlPtr control);
00043
00044 QVector<MarControlPtr> getTrackedControls();
00045
00046 public slots:
00047 void updctrl(MarControlPtr control, MarControlPtr cval);
00048 void updctrl(std::string cname, MarControlPtr newcontrol)
00049 {
00050 MarControlPtr control = main_pnet_->getControl(cname);
00051 return updctrl(control, newcontrol);
00052 }
00053 void updctrl(char *cname, MarControlPtr newcontrol)
00054 {
00055 MarControlPtr control = main_pnet_->getControl(cname);
00056 return updctrl(control, newcontrol);
00057 }
00058 void emitTrackedControls();
00059
00060 MarControlPtr getctrl(string cname);
00061
00062 void play();
00063 void pause();
00064
00065 signals:
00066 void ctrlChanged(MarControlPtr cname);
00067
00068 protected:
00069 void run();
00070 private:
00071 QMutex mutex_;
00072 bool abort_;
00073 bool withTimer_;
00074
00075 QWaitCondition condition_;
00076 int counter_;
00077
00078
00079 MarSystem* main_pnet_;
00080
00081
00082
00083 QVector<MarControlPtr> control_names_;
00084 QVector<MarControlPtr> control_values_;
00085 QVector<MarControlPtr> tracked_controls_;
00086 bool pause_;
00087
00088 bool running_;
00089 };
00090 }
00091 #endif // MARSYSTEMWRAPPER_H