Skip to content

Commit

Permalink
Added structure for plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
mireq committed May 19, 2014
1 parent 1c6b176 commit 1da35b3
Show file tree
Hide file tree
Showing 9 changed files with 144 additions and 7 deletions.
3 changes: 2 additions & 1 deletion quickkeyboard.pro
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
TEMPLATE = subdirs
SUBDIRS = \
examples \
src
src \
src/plugin
47 changes: 47 additions & 0 deletions src/plugin/InputContext.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include "InputContext.h"
#include <QRectF>

#include <QDebug>

InputContext::InputContext():
m_visible(false)
{
}

InputContext::~InputContext()
{
}

bool InputContext::isValid() const
{
return true;
}

QRectF InputContext::keyboardRect() const
{
return QRectF();
}

void InputContext::showInputPanel()
{
qDebug() << "show";
m_visible = true;
QPlatformInputContext::showInputPanel();
}

void InputContext::hideInputPanel()
{
qDebug() << "hide";
m_visible = false;
QPlatformInputContext::hideInputPanel();
}

bool InputContext::isInputPanelVisible() const
{
return m_visible;
}

void InputContext::setFocusObject(QObject *object)
{
}

25 changes: 25 additions & 0 deletions src/plugin/InputContext.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef INPUTCONTEXT_CPP_Q5U7KLYO
#define INPUTCONTEXT_CPP_Q5U7KLYO

#include <qpa/qplatforminputcontext.h>

class InputContext: public QPlatformInputContext
{
Q_OBJECT
public:
InputContext();
~InputContext();

bool isValid() const;
QRectF keyboardRect() const;

void showInputPanel();
void hideInputPanel();
bool isInputPanelVisible() const;
void setFocusObject(QObject *object);

private:
bool m_visible;
}; /* ----- end of class InputContext ----- */

#endif /* end of include guard: INPUTCONTEXT_CPP_Q5U7KLYO */
16 changes: 16 additions & 0 deletions src/plugin/InputContextPlugin.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "InputContextPlugin.h"
#include "InputContext.h"

#include <QDebug>

QPlatformInputContext *InputContextPlugin::create(const QString &system, const QStringList &paramList)
{
Q_UNUSED(paramList);

qDebug() << "AAAAAA" << system;

if (system.compare(system, QStringLiteral("quickkeyboard"), Qt::CaseInsensitive) == 0) {
return new InputContext;
}
return 0;
}
16 changes: 16 additions & 0 deletions src/plugin/InputContextPlugin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef INPUTCONTEXTPLUGIN_H_NWSQGKER
#define INPUTCONTEXTPLUGIN_H_NWSQGKER

#include <qpa/qplatforminputcontextplugin_p.h>
#include "global.h"

class QUICKKEYBOARD_EXPORT InputContextPlugin: public QPlatformInputContextPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QPlatformInputContextFactoryInterface" FILE "kbd.json")
public:
QPlatformInputContext *create(const QString &system, const QStringList &paramList);
}; /* ----- end of class InputContextPlugin ----- */

#endif /* end of include guard: INPUTCONTEXTPLUGIN_H_NWSQGKER */

13 changes: 13 additions & 0 deletions src/plugin/global.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef GLOBAL_H_CTI1IPAP
#define GLOBAL_H_CTI1IPAP

#include <QtCore/QtGlobal>

#if defined(QUICKKEYBOARD_LIBRARY)
# define QUICKKEYBOARD_EXPORT Q_DECL_EXPORT
#else
# define QUICKKEYBOARD_EXPORT Q_DECL_IMPORT
#endif

#endif /* end of include guard: GLOBAL_H_CTI1IPAP */

3 changes: 3 additions & 0 deletions src/plugin/kbd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Keys": ["quickkeyboard"]
}
19 changes: 19 additions & 0 deletions src/plugin/plugin.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
QT += qml quick gui-private
CONFIG += plugin

TARGET = quickkeyboard
TEMPLATE = lib
DESTDIR = ../../platforminputcontexts

DEFINES += QUICKKEYBOARD_LIBRARY

include($$PWD/../components.pri)

HEADERS += global.h \
InputContextPlugin.h \
InputContext.h
SOURCES += InputContextPlugin.cpp \
InputContext.cpp

target.path = $$[QT_INSTALL_PLUGINS]/platforminputcontexts
INSTALLS += target
9 changes: 3 additions & 6 deletions src/src.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
CONFIG += plugin
QT += gui quick
DESTDIR = ../generic
TARGET = quickkeyboard
TEMPLATE = lib
include($$PWD/components.pri)
TEMPLATE = subdirs
SUBDIRS = \
plugin

0 comments on commit 1da35b3

Please sign in to comment.