Update Brazilian Portuguese translation
[dasher.git] / Src / Qt / QtDasherImpl.cc
blobeac8dfc18a1e6c50af9c69710fd3845cb5361b6d
1 #include "../Common/Common.h"
3 #include <iostream>
4 #include <qapplication.h>
5 #include <qobject.h>
6 #include <qpixmap.h>
7 #include "DasherInterface.h"
8 #include "QtDasherScreen.h"
9 #include "QtDasherImpl.h"
11 /* XPM */
12 static const char *qtdasher_xpm[] = {
13 "28 7 2 1",
14 "# c #303030",
15 " c None",
16 " ########################## ",
17 " ",
18 " # # ",
19 " # # # # ",
20 " # # # # ",
21 " # # # ",
22 " ########################## "
25 QtDasherImpl::QtDasherImpl()
26 :qtdasherwidget(0), icn(0), ref(0), qtdasherinterface(0) {
29 QtDasherImpl::~QtDasherImpl() {
30 delete qtdasherwidget;
31 delete icn;
34 QWidget *QtDasherImpl::inputMethod(QWidget *parent, Qt::WFlags f) {
35 if(!qtdasherwidget) {
36 qtdasherwidget = new QtDasherPlugin(parent, "Dasher", f);
38 return qtdasherwidget;
41 void QtDasherImpl::resetState() {
42 if(qtdasherwidget)
43 qtdasherwidget->resetState();
46 QPixmap *QtDasherImpl::icon() {
47 if(!icn)
48 icn = new QPixmap((const char **)qtdasher_xpm);
49 return icn;
52 QString QtDasherImpl::name() {
53 return qApp->translate("InputMethods", "Dasher");
56 void QtDasherImpl::onKeyPress(QObject *receiver, const char *slot) {
57 if(qtdasherwidget)
58 QObject::connect(qtdasherwidget, SIGNAL(key(ushort, ushort, ushort, bool, bool)), receiver, slot);
61 #ifndef QT_NO_COMPONENT
62 QRESULT QtDasherImpl::queryInterface(const QUuid &uuid, QUnknownInterface **iface) {
63 *iface = 0;
64 if(uuid == IID_QUnknown)
65 *iface = this;
66 else if(uuid == IID_InputMethod)
67 *iface = this;
69 if(*iface)
70 (*iface)->addRef();
71 return QS_OK;
74 Q_EXPORT_INTERFACE() {
75 Q_CREATE_INSTANCE(QtDasherImpl)
77 #endif