summaryrefslogtreecommitdiffstats
path: root/src/plugins/generic
diff options
context:
space:
mode:
authorSamuel Gaist <samuel.gaist@edeltech.ch>2014-02-10 11:00:00 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-11 16:03:02 +0100
commitbe51772d023161c81978b3a63b6379d4ebb8013f (patch)
tree96c199bde48335be06f773ac7b8f3e603d582a3f /src/plugins/generic
parent2a68cffa843572b2a90780758c5c4eaa7c694c48 (diff)
Cleanup TSLib plugin
This patch cleans up the coding style and includes Change-Id: I710d4a60795e9975d4f8ee79599018e05d85debe Reviewed-by: Jørgen Lind <jorgen.lind@digia.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src/plugins/generic')
-rw-r--r--src/plugins/generic/tslib/qtslib.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/plugins/generic/tslib/qtslib.cpp b/src/plugins/generic/tslib/qtslib.cpp
index 773939b485..9905d9cc9e 100644
--- a/src/plugins/generic/tslib/qtslib.cpp
+++ b/src/plugins/generic/tslib/qtslib.cpp
@@ -48,8 +48,6 @@
#include <QPoint>
#include <qpa/qwindowsysteminterface.h>
-#include <Qt>
-
#include <errno.h>
#include <tslib.h>
@@ -65,21 +63,21 @@ QTsLibMouseHandler::QTsLibMouseHandler(const QString &key,
setObjectName(QLatin1String("TSLib Mouse Handler"));
QByteArray device = qgetenv("TSLIB_TSDEVICE");
- if (device.isEmpty())
- device = QByteArrayLiteral("/dev/input/event1");
if (specification.startsWith("/dev/"))
device = specification.toLocal8Bit();
+ if (device.isEmpty())
+ device = QByteArrayLiteral("/dev/input/event1");
+
m_dev = ts_open(device.constData(), 1);
if (!m_dev) {
qErrnoWarning(errno, "ts_open() failed");
return;
}
- if (ts_config(m_dev)) {
+ if (ts_config(m_dev))
perror("Error configuring\n");
- }
m_rawMode = !key.compare(QLatin1String("TslibRaw"), Qt::CaseInsensitive);
@@ -89,7 +87,6 @@ QTsLibMouseHandler::QTsLibMouseHandler(const QString &key,
connect(m_notify, SIGNAL(activated(int)), this, SLOT(readMouseData()));
} else {
qWarning("Cannot open mouse input device '%s': %s", device.constData(), strerror(errno));
- return;
}
}
@@ -103,12 +100,10 @@ QTsLibMouseHandler::~QTsLibMouseHandler()
static bool get_sample(struct tsdev *dev, struct ts_sample *sample, bool rawMode)
{
- if (rawMode) {
+ if (rawMode)
return (ts_read_raw(dev, sample, 1) == 1);
- } else {
- int ret = ts_read(dev, sample, 1);
- return ( ret == 1);
- }
+ else
+ return (ts_read(dev, sample, 1) == 1);
}