Migrate tslib to new plugin format

Also rename the binary and avoid crashes when tslib initialization
fails.

Change-Id: Ia7ccf7c997e1b1484bd475626ca16c9a9642466e
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
Laszlo Agocs 2012-05-24 13:41:36 +03:00 committed by Qt by Nokia
parent dacc3f2852
commit 22ef98c0b1
4 changed files with 17 additions and 6 deletions

View File

@ -46,6 +46,9 @@ QT_BEGIN_NAMESPACE
class QTsLibPlugin : public QGenericPlugin class QTsLibPlugin : public QGenericPlugin
{ {
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QGenericPluginFactoryInterface" FILE "tslib.json")
public: public:
QTsLibPlugin(); QTsLibPlugin();
@ -73,6 +76,6 @@ QObject* QTsLibPlugin::create(const QString &key,
return 0; return 0;
} }
Q_EXPORT_PLUGIN2(qtslibplugin, QTsLibPlugin)
QT_END_NAMESPACE QT_END_NAMESPACE
#include "main.moc"

View File

@ -69,12 +69,15 @@ QTsLibMouseHandler::QTsLibMouseHandler(const QString &key,
device = specification.toLocal8Bit(); device = specification.toLocal8Bit();
m_dev = ts_open(device.constData(), 1); 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"); perror("Error configuring\n");
} }
m_rawMode = !key.compare(QLatin1String("TslibRaw"), Qt::CaseInsensitive); m_rawMode = !key.compare(QLatin1String("TslibRaw"), Qt::CaseInsensitive);
int fd = ts_fd(m_dev); int fd = ts_fd(m_dev);

View File

@ -0,0 +1,3 @@
{
"Keys": [ "Tslib", "TslibRaw" ]
}

View File

@ -1,4 +1,4 @@
TARGET = qlinuxinputplugin TARGET = qtslibplugin
load(qt_plugin) load(qt_plugin)
DESTDIR = $$QT.gui.plugins/generic DESTDIR = $$QT.gui.plugins/generic
@ -11,3 +11,5 @@ SOURCES = main.cpp \
qtslib.cpp qtslib.cpp
LIBS += -lts LIBS += -lts
OTHER_FILES += tslib.json