summaryrefslogtreecommitdiff
path: root/examples/inputmethod
Side-by-side diff
Diffstat (limited to 'examples/inputmethod') (more/less context) (ignore whitespace changes)
-rw-r--r--examples/inputmethod/config.in2
-rw-r--r--examples/inputmethod/exampleboardimpl.cpp5
-rw-r--r--examples/inputmethod/inputmethod.pro2
3 files changed, 5 insertions, 4 deletions
diff --git a/examples/inputmethod/config.in b/examples/inputmethod/config.in
index c0aa7e8..85b9725 100644
--- a/examples/inputmethod/config.in
+++ b/examples/inputmethod/config.in
@@ -1,4 +1,4 @@
config EXAMPLE_BOARD
boolean "Input Method Example"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && EXAMPLES
+ depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && EXAMPLES
diff --git a/examples/inputmethod/exampleboardimpl.cpp b/examples/inputmethod/exampleboardimpl.cpp
index 36989a2..6c7196b 100644
--- a/examples/inputmethod/exampleboardimpl.cpp
+++ b/examples/inputmethod/exampleboardimpl.cpp
@@ -1,54 +1,55 @@
#include <qwidget.h>
#include <qcheckbox.h>
#include <qlabel.h>
#include <qsignalmapper.h>
#include <qpushbutton.h>
-#include <qpe/resource.h>
+
+#include <opie2/oresource.h>
#include "exampleboardimpl.h"
ExampleBoard::ExampleBoard(QWidget* par, WFlags fl )
: QHBox(par, "name", fl )
{
QCheckBox *box1 = new QCheckBox(tr("Alt"),this);
connect(box1,SIGNAL(toggled(bool)),
this,SLOT(slotAlt(bool)));
m_alt = box1;
box1 = new QCheckBox(tr("Shift"),this );
connect(box1,SIGNAL(toggled(bool)),
this,SLOT(slotShift(bool)));
m_shi = box1;
box1 = new QCheckBox(tr("Ctrl","Control Shortcut on keyboard"),this );
connect(box1,SIGNAL(toggled(bool)),
this,SLOT(slotCtrl(bool)));
m_ctrl = box1;
QSignalMapper *map = new QSignalMapper(this);
QPushButton *btn = new QPushButton("a",this);
map->setMapping(btn,0);
connect(btn,SIGNAL(clicked()),map,SLOT(map()));
btn = new QPushButton("b",this);
map->setMapping(btn,1);
connect(btn,SIGNAL(clicked()),map,SLOT(map()));
btn = new QPushButton("c",this);
map->setMapping(btn,2);
connect(btn,SIGNAL(clicked()),map,SLOT(map()));
connect(map,SIGNAL(mapped(int)),
this,SLOT(slotKey(int)));
resetState();
}
ExampleBoard::~ExampleBoard(){
}
void ExampleBoard::resetState(){
m_state = 0;
m_shi->setChecked(false);
m_ctrl->setChecked(false);
m_alt->setChecked(false);
}
void ExampleBoard::slotKey(int _ke){
@@ -73,85 +74,85 @@ void ExampleBoard::slotShift(bool b){
m_state |= ShiftButton;
else
m_state &= ~ShiftButton;
}
void ExampleBoard::slotAlt(bool b){
if(b)
m_state |= AltButton;
else
m_state &= ~AltButton;
}
void ExampleBoard::slotCtrl(bool b){
if(b)
m_state |= ControlButton;
else
m_state &= ~ControlButton;
}
ExampleboardImpl::ExampleboardImpl()
: m_pickboard(0), m_icn(0)
{
}
ExampleboardImpl::~ExampleboardImpl()
{
delete m_pickboard;
delete m_icn;
}
QWidget *ExampleboardImpl::inputMethod( QWidget *parent, Qt::WFlags f )
{
if ( !m_pickboard )
m_pickboard = new ExampleBoard( parent, f );
return m_pickboard;
}
void ExampleboardImpl::resetState()
{
if ( m_pickboard )
m_pickboard->resetState();
}
QPixmap *ExampleboardImpl::icon()
{
if ( !m_icn )
- m_icn = new QPixmap(Resource::loadPixmap("Tux"));
+ m_icn = new QPixmap(Opie::Core::OResource::loadPixmap("Tux", Opie::Core::OResource::SmallIcon));
return m_icn;
}
QString ExampleboardImpl::name()
{
return QObject::tr("Example Input");
}
void ExampleboardImpl::onKeyPress( QObject *receiver, const char *slot )
{
if ( m_pickboard )
QObject::connect( m_pickboard, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot );
}
#ifndef QT_NO_COMPONENT
QRESULT ExampleboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
{
*iface = 0;
if ( uuid == IID_QUnknown )
*iface = this;
else if ( uuid == IID_InputMethod )
*iface = this;
else
return QS_FALSE;
if ( *iface )
(*iface)->addRef();
return QS_OK;
}
Q_EXPORT_INTERFACE()
{
Q_CREATE_INSTANCE( ExampleboardImpl )
}
#endif
diff --git a/examples/inputmethod/inputmethod.pro b/examples/inputmethod/inputmethod.pro
index ea98dd5..56881ff 100644
--- a/examples/inputmethod/inputmethod.pro
+++ b/examples/inputmethod/inputmethod.pro
@@ -1,12 +1,12 @@
TEMPLATE = lib
CONFIG += qt plugin warn_on
HEADERS = exampleboardimpl.h
SOURCES = exampleboardimpl.cpp
TARGET = example_board
DESTDIR = $(OPIEDIR)/plugins/inputmethods
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += ../../launcher
-LIBS += -lqpe
+LIBS += -lqpe -lopiecore2
VERSION = 1.0.0
include( $(OPIEDIR)/include.pro )