]> git.sesse.net Git - kdenlive/blobdiff - src/jogshuttle.h
jogshuttle: use call by reference
[kdenlive] / src / jogshuttle.h
index 9a6ecc0287c5dbb01483b724f49c492e6dc411c7..b136639abf4727d37e9511fcf965dd61971b6c81 100644 (file)
 #ifndef SHUTTLE_H
 #define SHUTTLE_H
 
-#include <qthread.h>
+#include <QThread>
 #include <QObject>
+#include <QMap>
 
 #include <linux/input.h>
-
+#include <sys/time.h>
+#include <media_ctrl/mediactrl.h>
 
 typedef struct input_event EV;
 
@@ -34,7 +36,7 @@ class ShuttleThread : public QThread
 
 public:
     virtual void run();
-    void init(QObject *parent, QString device);
+    void init(QObject *parent, const QString &device);
     QObject *m_parent;
     int shuttlevalue;
     int shuttlecounter;
@@ -45,20 +47,33 @@ public:
 
 private:
     bool m_isWorking;
+    void handle_event(const struct media_ctrl_event& ev);
+    void jog(const struct media_ctrl_event& ev);
+    void shuttle(const struct media_ctrl_event& ev);
+    void key(const struct media_ctrl_event& ev);
+
+#ifdef USE_DEPRECATED
     void handle_event(EV ev);
     void jog(unsigned int value);
     void shuttle(int value);
     void key(unsigned short code, unsigned int value);
+#endif
 };
 
+typedef QMap<QString, QString> DeviceMap;
+typedef QMap<QString, QString>::iterator DeviceMapIter;
 
 class JogShuttle: public QObject
 {
-Q_OBJECT public:
-    explicit JogShuttle(QString device, QObject * parent = 0);
+    Q_OBJECT
+public:
+    explicit JogShuttle(const QString &device, QObject * parent = 0);
     ~JogShuttle();
     void stopDevice();
-    void initDevice(QString device);
+    void initDevice(const QString &device);
+    static QString canonicalDevice(const QString& device);
+    static DeviceMap enumerateDevices(const QString& devPath);
+    static int keysCount(const QString& devPath);
 
 protected:
     virtual void customEvent(QEvent * e);