summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Rogalsky <ed.rogalsky@googlemail.com>2014-03-08 20:18:42 (GMT)
committerEd Rogalsky <ed.rogalsky@googlemail.com>2014-03-08 20:18:42 (GMT)
commita7a883757867c177be234cb2a05bb9ce47cc562c (patch)
treea6a5a09a3794c3effe1424b0e791d805eeb6be8d
parent12444d4f7225efd002aea05a68cab73380760480 (diff)
jogshuttle: use call by reference
mark old methods as deprecated
-rw-r--r--src/jogshuttle.cpp11
-rw-r--r--src/jogshuttle.h11
2 files changed, 13 insertions, 9 deletions
diff --git a/src/jogshuttle.cpp b/src/jogshuttle.cpp
index 6982222..1d6688e 100644
--- a/src/jogshuttle.cpp
+++ b/src/jogshuttle.cpp
@@ -148,7 +148,7 @@ void ShuttleThread::run()
media_ctrl_close(&mc);
}
-void ShuttleThread::handle_event(struct media_ctrl_event ev)
+void ShuttleThread::handle_event(const struct media_ctrl_event& ev)
{
if (ev.type == MEDIA_CTRL_EVENT_KEY)
key(ev);
@@ -158,7 +158,7 @@ void ShuttleThread::handle_event(struct media_ctrl_event ev)
shuttle(ev);
}
-void ShuttleThread::key(struct media_ctrl_event ev)
+void ShuttleThread::key(const struct media_ctrl_event& ev)
{
if (ev.value == KEY_PRESS) {
int code = ev.index + 1;
@@ -167,7 +167,7 @@ void ShuttleThread::key(struct media_ctrl_event ev)
}
}
-void ShuttleThread::shuttle(struct media_ctrl_event ev)
+void ShuttleThread::shuttle(const struct media_ctrl_event& ev)
{
int value = ev.value / 2;
@@ -180,7 +180,7 @@ void ShuttleThread::shuttle(struct media_ctrl_event ev)
new QEvent((QEvent::Type) (JOG_STOP + (value))));
}
-void ShuttleThread::jog(struct media_ctrl_event ev)
+void ShuttleThread::jog(const struct media_ctrl_event& ev)
{
if (ev.value < 0)
QApplication::postEvent(m_parent, new QEvent((QEvent::Type) JOG_BACK1));
@@ -188,6 +188,7 @@ void ShuttleThread::jog(struct media_ctrl_event ev)
QApplication::postEvent(m_parent, new QEvent((QEvent::Type) JOG_FWD1));
}
+#ifdef USE_DEPRECATED
void ShuttleThread::handle_event(EV ev)
{
switch (ev.type) {
@@ -273,7 +274,7 @@ void ShuttleThread::jog(unsigned int value)
jogvalue = value;
if (shuttlecounter > 0) shuttlecounter++;
}
-
+#endif // USE_DEPRECATED
JogShuttle::JogShuttle(const QString &device, QObject *parent) :
QObject(parent)
diff --git a/src/jogshuttle.h b/src/jogshuttle.h
index 82f1bae..b136639 100644
--- a/src/jogshuttle.h
+++ b/src/jogshuttle.h
@@ -47,14 +47,17 @@ 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 handle_event(struct media_ctrl_event ev);
- void jog(struct media_ctrl_event ev);
void jog(unsigned int value);
void shuttle(int value);
- void shuttle(struct media_ctrl_event ev);
void key(unsigned short code, unsigned int value);
- void key(struct media_ctrl_event ev);
+#endif
};
typedef QMap<QString, QString> DeviceMap;