-rw-r--r-- | noncore/tools/calc2/calc.cpp | 2 | ||||
-rw-r--r-- | noncore/tools/calc2/calc.pro | 50 |
2 files changed, 26 insertions, 26 deletions
diff --git a/noncore/tools/calc2/calc.cpp b/noncore/tools/calc2/calc.cpp index 883ab33..f75eb69 100644 --- a/noncore/tools/calc2/calc.cpp +++ b/noncore/tools/calc2/calc.cpp | |||
@@ -1,104 +1,104 @@ | |||
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 | 20 | ||
21 | #include <qvaluelist.h> | 21 | #include <qvaluelist.h> |
22 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
23 | #include <qdir.h> | 23 | #include <qdir.h> |
24 | #include <qwidgetstack.h> | 24 | #include <qwidgetstack.h> |
25 | 25 | ||
26 | #include "calc.h" | 26 | #include "calc.h" |
27 | #include "plugininterface.h" | 27 | #include "plugininterface.h" |
28 | 28 | ||
29 | calc::calc (QWidget * p = 0, const char *n = 0):QWidget (p, n) | 29 | calc::calc (QWidget * p, const char *n):QWidget (p, n) |
30 | { | 30 | { |
31 | setCaption (tr ("Calculator")); | 31 | setCaption (tr ("Calculator")); |
32 | 32 | ||
33 | // widgets | 33 | // widgets |
34 | LCD = new QLCDNumber (this); | 34 | LCD = new QLCDNumber (this); |
35 | LCD->setMaximumSize (QSize (240, 30)); | 35 | LCD->setMaximumSize (QSize (240, 30)); |
36 | LCD->setNumDigits(12); | 36 | LCD->setNumDigits(12); |
37 | LCD->setSegmentStyle(QLCDNumber::Filled); | 37 | LCD->setSegmentStyle(QLCDNumber::Filled); |
38 | pluginWidgetStack = new QWidgetStack (this); | 38 | pluginWidgetStack = new QWidgetStack (this); |
39 | 39 | ||
40 | // layout widgets | 40 | // layout widgets |
41 | calculatorLayout = new QVBoxLayout (this); | 41 | calculatorLayout = new QVBoxLayout (this); |
42 | calculatorLayout->addWidget (LCD); | 42 | calculatorLayout->addWidget (LCD); |
43 | calculatorLayout->addWidget (pluginWidgetStack); | 43 | calculatorLayout->addWidget (pluginWidgetStack); |
44 | 44 | ||
45 | // no formatting of display for now | 45 | // no formatting of display for now |
46 | connect (&engine, SIGNAL(display (double)), LCD, SLOT(display (double))); | 46 | connect (&engine, SIGNAL(display (double)), LCD, SLOT(display (double))); |
47 | connect (&engine, SIGNAL(display (const QString &)), LCD, SLOT(display (const QString &))); | 47 | connect (&engine, SIGNAL(display (const QString &)), LCD, SLOT(display (const QString &))); |
48 | connect (&engine, SIGNAL(setBinMode()), LCD, SLOT(setBinMode())); | 48 | connect (&engine, SIGNAL(setBinMode()), LCD, SLOT(setBinMode())); |
49 | connect (&engine, SIGNAL(setOctMode()), LCD, SLOT(setOctMode())); | 49 | connect (&engine, SIGNAL(setOctMode()), LCD, SLOT(setOctMode())); |
50 | connect (&engine, SIGNAL(setDecMode()), LCD, SLOT(setDecMode())); | 50 | connect (&engine, SIGNAL(setDecMode()), LCD, SLOT(setDecMode())); |
51 | connect (&engine, SIGNAL(setHexMode()), LCD, SLOT(setHexMode())); | 51 | connect (&engine, SIGNAL(setHexMode()), LCD, SLOT(setHexMode())); |
52 | 52 | ||
53 | #ifndef NO_PLUGINS | 53 | #ifndef NO_PLUGINS |
54 | // load plugins | 54 | // load plugins |
55 | QValueList < Plugin >::Iterator mit; | 55 | QValueList < Plugin >::Iterator mit; |
56 | for (mit = pluginList.begin (); mit != pluginList.end (); ++mit) { | 56 | for (mit = pluginList.begin (); mit != pluginList.end (); ++mit) { |
57 | (*mit).interface->release (); | 57 | (*mit).interface->release (); |
58 | (*mit).library->unload (); | 58 | (*mit).library->unload (); |
59 | delete (*mit).library; | 59 | delete (*mit).library; |
60 | } | 60 | } |
61 | pluginList.clear (); | 61 | pluginList.clear (); |
62 | 62 | ||
63 | QString path = QPEApplication::qpeDir() + "/plugins/calculator"; | 63 | QString path = QPEApplication::qpeDir() + "/plugins/calculator"; |
64 | QDir dir (path, "lib*.so"); | 64 | QDir dir (path, "lib*.so"); |
65 | QStringList list = dir.entryList (); | 65 | QStringList list = dir.entryList (); |
66 | 66 | ||
67 | QStringList::Iterator it; | 67 | QStringList::Iterator it; |
68 | for (it = list.begin (); it != list.end (); ++it) { | 68 | for (it = list.begin (); it != list.end (); ++it) { |
69 | CalcInterface *iface = 0; | 69 | CalcInterface *iface = 0; |
70 | QLibrary *lib = new QLibrary (path + "/" + *it); | 70 | QLibrary *lib = new QLibrary (path + "/" + *it); |
71 | 71 | ||
72 | Plugin plugin; | 72 | Plugin plugin; |
73 | plugin.pluginWidget = 0; | 73 | plugin.pluginWidget = 0; |
74 | 74 | ||
75 | if (lib->queryInterface (IID_Calc, (QUnknownInterface **) & iface) == | 75 | if (lib->queryInterface (IID_Calc, (QUnknownInterface **) & iface) == |
76 | QS_OK) { | 76 | QS_OK) { |
77 | plugin.library = lib; | 77 | plugin.library = lib; |
78 | plugin.interface = iface; | 78 | plugin.interface = iface; |
79 | plugin.pluginWidget = plugin.interface->getPlugin(&engine,pluginWidgetStack); | 79 | plugin.pluginWidget = plugin.interface->getPlugin(&engine,pluginWidgetStack); |
80 | if (plugin.pluginWidget) | 80 | if (plugin.pluginWidget) |
81 | pluginWidgetStack->addWidget (plugin.pluginWidget, pluginList.count()); | 81 | pluginWidgetStack->addWidget (plugin.pluginWidget, pluginList.count()); |
82 | pluginList.append (plugin); | 82 | pluginList.append (plugin); |
83 | } else { | 83 | } else { |
84 | delete lib; | 84 | delete lib; |
85 | } | 85 | } |
86 | } | 86 | } |
87 | setMode (1); | 87 | setMode (1); |
88 | #else | 88 | #else |
89 | // load simple interface | 89 | // load simple interface |
90 | #endif | 90 | #endif |
91 | } | 91 | } |
92 | 92 | ||
93 | calc::~calc () | 93 | calc::~calc () |
94 | { | 94 | { |
95 | #ifndef NO_PLUGINS | 95 | #ifndef NO_PLUGINS |
96 | QValueList < Plugin >::Iterator mit; | 96 | QValueList < Plugin >::Iterator mit; |
97 | for (mit = pluginList.begin (); mit != pluginList.end (); ++mit) { | 97 | for (mit = pluginList.begin (); mit != pluginList.end (); ++mit) { |
98 | (*mit).interface->release (); | 98 | (*mit).interface->release (); |
99 | (*mit).library->unload (); | 99 | (*mit).library->unload (); |
100 | delete (*mit).library; | 100 | delete (*mit).library; |
101 | } | 101 | } |
102 | #endif | 102 | #endif |
103 | } | 103 | } |
104 | 104 | ||
diff --git a/noncore/tools/calc2/calc.pro b/noncore/tools/calc2/calc.pro index 8dfba95..c9f5fa1 100644 --- a/noncore/tools/calc2/calc.pro +++ b/noncore/tools/calc2/calc.pro | |||
@@ -1,29 +1,29 @@ | |||
1 | #TEMPLATE = app | 1 | TEMPLATE = app |
2 | #CONFIG += qt release | 2 | CONFIG += qt release |
3 | ## Input | 3 | # Input |
4 | #HEADERS += calc.h plugininterface.h instruction.h engine.h stdinstructions.h | 4 | HEADERS += calc.h plugininterface.h instruction.h engine.h stdinstructions.h |
5 | #SOURCES += calc.cpp main.cpp engine.cpp | 5 | SOURCES += calc.cpp main.cpp engine.cpp |
6 | #INCLUDEPATH += $(OPIEDIR)/include | 6 | INCLUDEPATH += $(OPIEDIR)/include |
7 | #DEPENDPATH += $(OPIEDIR)/include | 7 | DEPENDPATH += $(OPIEDIR)/include |
8 | #LIBS += -lqpe -Wl,-export-dynamic | 8 | LIBS += -lqpe -Wl,-export-dynamic |
9 | #TARGET = calc | 9 | TARGET = calc |
10 | #DESTDIR = $(OPIEDIR)/bin | 10 | DESTDIR = $(OPIEDIR)/bin |
11 | # | 11 | |
12 | #TRANSLATIONS = ../../../i18n/de/calc.pro \ | 12 | TRANSLATIONS = ../../../i18n/de/calc.pro \ |
13 | # ../../../i18n/en/calc.pro \ | 13 | ../../../i18n/en/calc.pro \ |
14 | # ../../../i18n/es/calc.pro \ | 14 | ../../../i18n/es/calc.pro \ |
15 | # ../../../i18n/fr/calc.pro \ | 15 | ../../../i18n/fr/calc.pro \ |
16 | # ../../../i18n/hu/calc.pro \ | 16 | ../../../i18n/hu/calc.pro \ |
17 | # ../../../i18n/ja/calc.pro \ | 17 | ../../../i18n/ja/calc.pro \ |
18 | # ../../../i18n/ko/calc.pro \ | 18 | ../../../i18n/ko/calc.pro \ |
19 | # ../../../i18n/no/calc.pro \ | 19 | ../../../i18n/no/calc.pro \ |
20 | # ../../../i18n/pl/calc.pro \ | 20 | ../../../i18n/pl/calc.pro \ |
21 | # ../../../i18n/pt/calc.pro \ | 21 | ../../../i18n/pt/calc.pro \ |
22 | # ../../../i18n/pt_BR/calc.pro \ | 22 | ../../../i18n/pt_BR/calc.pro \ |
23 | # ../../../i18n/sl/calc.pro \ | 23 | ../../../i18n/sl/calc.pro \ |
24 | # ../../../i18n/zh_CN/calc.pro \ | 24 | ../../../i18n/zh_CN/calc.pro \ |
25 | # ../../../i18n/zh_TW/calc.pro | 25 | ../../../i18n/zh_TW/calc.pro |
26 | 26 | ||
27 | 27 | ||
28 | 28 | ||
29 | include ( $(OPIEDIR)/include.pro ) | 29 | include ( $(OPIEDIR)/include.pro ) |