author | zecke <zecke> | 2004-02-05 17:15:20 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-02-05 17:15:20 (UTC) |
commit | f6487edaaad38c6454fc50697d7884f0bc627489 (patch) (unidiff) | |
tree | 26b2ea805710488c84a731fef576467047fb80fd /inputmethods/keyboard | |
parent | 416c72588577bca18ba1c9180701143e7e572eed (diff) | |
download | opie-f6487edaaad38c6454fc50697d7884f0bc627489.zip opie-f6487edaaad38c6454fc50697d7884f0bc627489.tar.gz opie-f6487edaaad38c6454fc50697d7884f0bc627489.tar.bz2 |
More janitor....
remove ulong ref because we use Q_REFCOUNT which also takes
care of initializing the refcount to 0
"And if you save yourself
You will make him happy
He'll keep you in a jar
And you'll think you're happy
He'll give you breathing holes"
-rw-r--r-- | inputmethods/keyboard/keyboardimpl.cpp | 2 | ||||
-rw-r--r-- | inputmethods/keyboard/keyboardimpl.h | 1 |
2 files changed, 1 insertions, 2 deletions
diff --git a/inputmethods/keyboard/keyboardimpl.cpp b/inputmethods/keyboard/keyboardimpl.cpp index 701d35f..86d0427 100644 --- a/inputmethods/keyboard/keyboardimpl.cpp +++ b/inputmethods/keyboard/keyboardimpl.cpp | |||
@@ -1,130 +1,130 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qapplication.h> | 20 | #include <qapplication.h> |
21 | #include <qpixmap.h> | 21 | #include <qpixmap.h> |
22 | #include "keyboard.h" | 22 | #include "keyboard.h" |
23 | #include "keyboardimpl.h" | 23 | #include "keyboardimpl.h" |
24 | 24 | ||
25 | /* XPM */ | 25 | /* XPM */ |
26 | static const char * const kb_xpm[] = { | 26 | static const char * const kb_xpm[] = { |
27 | "28 13 4 1", | 27 | "28 13 4 1", |
28 | " c None", | 28 | " c None", |
29 | ". c #4C4C4C", | 29 | ". c #4C4C4C", |
30 | "+ c #FFF7DD", | 30 | "+ c #FFF7DD", |
31 | "@ c #D6CFBA", | 31 | "@ c #D6CFBA", |
32 | " .......................... ", | 32 | " .......................... ", |
33 | " .+++.+++.+++.+++.+++.++++. ", | 33 | " .+++.+++.+++.+++.+++.++++. ", |
34 | " .+@@.+@@.+@@.+@@.+@@.+@@@. ", | 34 | " .+@@.+@@.+@@.+@@.+@@.+@@@. ", |
35 | " .......................... ", | 35 | " .......................... ", |
36 | " .+++++.+++.+++.+++.++++++. ", | 36 | " .+++++.+++.+++.+++.++++++. ", |
37 | " .+@@@@.+@@.+@@.+@@.+@@@@@. ", | 37 | " .+@@@@.+@@.+@@.+@@.+@@@@@. ", |
38 | " .......................... ", | 38 | " .......................... ", |
39 | " .++++++.+++.+++.+++.+++++. ", | 39 | " .++++++.+++.+++.+++.+++++. ", |
40 | " .+@@@@@.+@@.+@@.+@@.+@@@@. ", | 40 | " .+@@@@@.+@@.+@@.+@@.+@@@@. ", |
41 | " .......................... ", | 41 | " .......................... ", |
42 | " .++++.++++++++++++++.++++. ", | 42 | " .++++.++++++++++++++.++++. ", |
43 | " .+@@@.+@@@@@@@@@@@@@.+@@@. ", | 43 | " .+@@@.+@@@@@@@@@@@@@.+@@@. ", |
44 | " .......................... "}; | 44 | " .......................... "}; |
45 | 45 | ||
46 | 46 | ||
47 | /* XPM */ | 47 | /* XPM */ |
48 | static const char * const ipti_xpm[] = { | 48 | static const char * const ipti_xpm[] = { |
49 | "28 13 4 1", | 49 | "28 13 4 1", |
50 | " c None", | 50 | " c None", |
51 | ". c #4C4C4C", | 51 | ". c #4C4C4C", |
52 | "+ c #FFF7DD", | 52 | "+ c #FFF7DD", |
53 | "@ c #D6CFBA", | 53 | "@ c #D6CFBA", |
54 | " ......................... ", | 54 | " ......................... ", |
55 | " .+++.+++.+++.+++.+++.+++. ", | 55 | " .+++.+++.+++.+++.+++.+++. ", |
56 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", | 56 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", |
57 | " ......................... ", | 57 | " ......................... ", |
58 | " .+++.+++.+++.+++.+++.+++. ", | 58 | " .+++.+++.+++.+++.+++.+++. ", |
59 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", | 59 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", |
60 | " ......................... ", | 60 | " ......................... ", |
61 | " .+++.+++.+++.+++.+++.+++. ", | 61 | " .+++.+++.+++.+++.+++.+++. ", |
62 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", | 62 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", |
63 | " ......................... ", | 63 | " ......................... ", |
64 | " .+++.+++.+++.+++.+++.+++. ", | 64 | " .+++.+++.+++.+++.+++.+++. ", |
65 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", | 65 | " .+@@.+@@.+@@.+@@.+@@.+@@. ", |
66 | " ......................... "}; | 66 | " ......................... "}; |
67 | 67 | ||
68 | KeyboardImpl::KeyboardImpl() | 68 | KeyboardImpl::KeyboardImpl() |
69 | : input(0), icn(0), ref(0) | 69 | : input(0), icn(0) |
70 | { | 70 | { |
71 | } | 71 | } |
72 | 72 | ||
73 | KeyboardImpl::~KeyboardImpl() | 73 | KeyboardImpl::~KeyboardImpl() |
74 | { | 74 | { |
75 | delete input; | 75 | delete input; |
76 | delete icn; | 76 | delete icn; |
77 | } | 77 | } |
78 | 78 | ||
79 | QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) | 79 | QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) |
80 | { | 80 | { |
81 | if ( !input ) | 81 | if ( !input ) |
82 | input = new KeyboardInput::Keyboard( parent, "Keyboard", f ); | 82 | input = new KeyboardInput::Keyboard( parent, "Keyboard", f ); |
83 | return input; | 83 | return input; |
84 | } | 84 | } |
85 | 85 | ||
86 | void KeyboardImpl::resetState() | 86 | void KeyboardImpl::resetState() |
87 | { | 87 | { |
88 | if ( input ) | 88 | if ( input ) |
89 | input->resetState(); | 89 | input->resetState(); |
90 | } | 90 | } |
91 | 91 | ||
92 | QPixmap *KeyboardImpl::icon() | 92 | QPixmap *KeyboardImpl::icon() |
93 | { | 93 | { |
94 | if ( !icn ) | 94 | if ( !icn ) |
95 | icn = new QPixmap( (const char **)kb_xpm ); | 95 | icn = new QPixmap( (const char **)kb_xpm ); |
96 | return icn; | 96 | return icn; |
97 | } | 97 | } |
98 | 98 | ||
99 | QString KeyboardImpl::name() | 99 | QString KeyboardImpl::name() |
100 | { | 100 | { |
101 | return qApp->translate( "InputMethods", "Keyboard" ); | 101 | return qApp->translate( "InputMethods", "Keyboard" ); |
102 | } | 102 | } |
103 | 103 | ||
104 | void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) | 104 | void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) |
105 | { | 105 | { |
106 | if ( input ) | 106 | if ( input ) |
107 | QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); | 107 | QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); |
108 | } | 108 | } |
109 | 109 | ||
110 | #ifndef QT_NO_COMPONENT | 110 | #ifndef QT_NO_COMPONENT |
111 | QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | 111 | QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
112 | { | 112 | { |
113 | *iface = 0; | 113 | *iface = 0; |
114 | if ( uuid == IID_QUnknown ) | 114 | if ( uuid == IID_QUnknown ) |
115 | *iface = this; | 115 | *iface = this; |
116 | else if ( uuid == IID_InputMethod ) | 116 | else if ( uuid == IID_InputMethod ) |
117 | *iface = this; | 117 | *iface = this; |
118 | else | 118 | else |
119 | return QS_FALSE; | 119 | return QS_FALSE; |
120 | 120 | ||
121 | if ( *iface ) | 121 | if ( *iface ) |
122 | (*iface)->addRef(); | 122 | (*iface)->addRef(); |
123 | return QS_OK; | 123 | return QS_OK; |
124 | } | 124 | } |
125 | 125 | ||
126 | Q_EXPORT_INTERFACE() | 126 | Q_EXPORT_INTERFACE() |
127 | { | 127 | { |
128 | Q_CREATE_INSTANCE( KeyboardImpl ) | 128 | Q_CREATE_INSTANCE( KeyboardImpl ) |
129 | } | 129 | } |
130 | #endif | 130 | #endif |
diff --git a/inputmethods/keyboard/keyboardimpl.h b/inputmethods/keyboard/keyboardimpl.h index d33a822..644070c 100644 --- a/inputmethods/keyboard/keyboardimpl.h +++ b/inputmethods/keyboard/keyboardimpl.h | |||
@@ -1,60 +1,59 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef KEYBOARDIMPL_H | 20 | #ifndef KEYBOARDIMPL_H |
21 | #define KEYBOARDIMPL_H | 21 | #define KEYBOARDIMPL_H |
22 | 22 | ||
23 | #include <qpe/inputmethodinterface.h> | 23 | #include <qpe/inputmethodinterface.h> |
24 | 24 | ||
25 | namespace KeyboardInput | 25 | namespace KeyboardInput |
26 | { | 26 | { |
27 | class Keyboard; | 27 | class Keyboard; |
28 | } | 28 | } |
29 | 29 | ||
30 | class QPixmap; | 30 | class QPixmap; |
31 | 31 | ||
32 | namespace | 32 | namespace |
33 | { | 33 | { |
34 | 34 | ||
35 | class KeyboardImpl : public InputMethodInterface | 35 | class KeyboardImpl : public InputMethodInterface |
36 | { | 36 | { |
37 | public: | 37 | public: |
38 | KeyboardImpl(); | 38 | KeyboardImpl(); |
39 | virtual ~KeyboardImpl(); | 39 | virtual ~KeyboardImpl(); |
40 | 40 | ||
41 | #ifndef QT_NO_COMPONENT | 41 | #ifndef QT_NO_COMPONENT |
42 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | 42 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); |
43 | Q_REFCOUNT | 43 | Q_REFCOUNT |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | virtual QWidget *inputMethod( QWidget *parent, Qt::WFlags f ); | 46 | virtual QWidget *inputMethod( QWidget *parent, Qt::WFlags f ); |
47 | virtual void resetState(); | 47 | virtual void resetState(); |
48 | virtual QPixmap *icon(); | 48 | virtual QPixmap *icon(); |
49 | virtual QString name(); | 49 | virtual QString name(); |
50 | virtual void onKeyPress( QObject *receiver, const char *slot ); | 50 | virtual void onKeyPress( QObject *receiver, const char *slot ); |
51 | 51 | ||
52 | private: | 52 | private: |
53 | KeyboardInput::Keyboard *input; | 53 | KeyboardInput::Keyboard *input; |
54 | QPixmap *icn; | 54 | QPixmap *icn; |
55 | ulong ref; | ||
56 | }; | 55 | }; |
57 | 56 | ||
58 | } // anonymous namespace | 57 | } // anonymous namespace |
59 | 58 | ||
60 | #endif | 59 | #endif |