summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/calculator/calculatorimpl.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/noncore/tools/calculator/calculatorimpl.cpp b/noncore/tools/calculator/calculatorimpl.cpp
index 05cb9b5..21c1e2e 100644
--- a/noncore/tools/calculator/calculatorimpl.cpp
+++ b/noncore/tools/calculator/calculatorimpl.cpp
@@ -1,190 +1,185 @@
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/* 21/*
22 * 01/14/2002 Charles-Edouard Ruault <ce@ruault.com> 22 * 01/14/2002 Charles-Edouard Ruault <ce@ruault.com>
23 * Added support for Temperature conversions. 23 * Added support for Temperature conversions.
24 */ 24 */
25// Sat 03-09-2002 L.J. Potter added the inlined pixmaps here 25// Sat 03-09-2002 L.J. Potter added the inlined pixmaps here
26 26
27#include "calculatorimpl.h" 27#include "calculatorimpl.h"
28 28
29/* OPIE */ 29/* OPIE */
30#include <opie2/odebug.h> 30#include <opie2/odebug.h>
31#include <qpe/resource.h>
32#include <qpe/qmath.h> 31#include <qpe/qmath.h>
33#include <qpe/qpeapplication.h> 32#include <qpe/qpeapplication.h>
34using namespace Opie::Core; 33using namespace Opie::Core;
35 34
36/* QT */ 35/* QT */
37#include <qpushbutton.h> 36#include <qpushbutton.h>
38#include <qcombobox.h> 37#include <qcombobox.h>
39#include <qlabel.h> 38#include <qlabel.h>
40#include <qfont.h> 39#include <qfont.h>
41#include <qlayout.h> 40#include <qlayout.h>
42#include <qstringlist.h> 41#include <qstringlist.h>
43#include <qfile.h> 42#include <qfile.h>
44#include <qtextstream.h> 43#include <qtextstream.h>
45#include <qmessagebox.h> 44#include <qmessagebox.h>
46 45
47/* STD */ 46/* STD */
48#include <math.h> 47#include <math.h>
49 48
50/* XPM */ 49/* XPM */
51static char *oneoverx_xpm[] = { 50static char *oneoverx_xpm[] = {
52/* width height num_colors chars_per_pixel */ 51/* width height num_colors chars_per_pixel */
53" 13 11 2 1", 52" 13 11 2 1",
54/* colors */ 53/* colors */
55". c None", 54". c None",
56"# c #000000", 55"# c #000000",
57/* pixels */ 56/* pixels */
58"......#......", 57"......#......",
59".....##......", 58".....##......",
60"......#......" 59"......#......"
61".....###.....", 60".....###.....",
62".............", 61".............",
63"..#########..", 62"..#########..",
64".............", 63".............",
65"....##.##....", 64"....##.##....",
66"......#......", 65"......#......",
67"......#......", 66"......#......",
68"....##.##....", 67"....##.##....",
69}; 68};
70/* XPM */ 69/* XPM */
71static char *ythrootofx_xpm[] = { 70static char *ythrootofx_xpm[] = {
72/* width height num_colors chars_per_pixel */ 71/* width height num_colors chars_per_pixel */
73" 13 11 2 1", 72" 13 11 2 1",
74/* colors */ 73/* colors */
75". c None", 74". c None",
76"# c #000000", 75"# c #000000",
77/* pixels */ 76/* pixels */
78"#.#..........", 77"#.#..........",
79"#.#..........", 78"#.#..........",
80"###...#######", 79"###...#######",
81"..#..#.......", 80"..#..#.......",
82"###..#.......", 81"###..#.......",
83".....#.#...#.", 82".....#.#...#.",
84".#..#...#.#..", 83".#..#...#.#..",
85"#.#.#....#...", 84"#.#.#....#...",
86"..#.#...#.#..", 85"..#.#...#.#..",
87"...#...#...#.", 86"...#...#...#.",
88"...#........." 87"...#........."
89}; 88};
90/* XPM */ 89/* XPM */
91static char *xtopowerofy_xpm[] = { 90static char *xtopowerofy_xpm[] = {
92/* width height num_colors chars_per_pixel */ 91/* width height num_colors chars_per_pixel */
93" 9 8 2 1", 92" 9 8 2 1",
94/* colors */ 93/* colors */
95". c None", 94". c None",
96"# c #000000", 95"# c #000000",
97/* pixels */ 96/* pixels */
98"......#.#", 97"......#.#",
99"......#.#", 98"......#.#",
100"......###", 99"......###",
101"#...#...#", 100"#...#...#",
102".#.#..###", 101".#.#..###",
103"..#......", 102"..#......",
104".#.#.....", 103".#.#.....",
105"#...#...." 104"#...#...."
106}; 105};
107 106
108CalculatorImpl::CalculatorImpl( QWidget * parent, const char * name, 107CalculatorImpl::CalculatorImpl( QWidget * parent, const char * name,
109 WFlags f ) 108 WFlags f )
110 : Calculator( parent, name, f ) 109 : Calculator( parent, name, f )
111{ 110{
112// xtopowerofy = Resource::loadPixmap("xtopowerofy");
113// ythrootofx = Resource::loadPixmap("ythrootofx");
114// oneoverx = Resource::loadPixmap("oneoverx");
115
116 memMark = new QLabel( "m", LCD ); 111 memMark = new QLabel( "m", LCD );
117 memMark->setFont( QFont( "helvetica", 12, QFont::Bold, TRUE ) ); 112 memMark->setFont( QFont( "helvetica", 12, QFont::Bold, TRUE ) );
118 memMark->resize( 12, 12 ); 113 memMark->resize( 12, 12 );
119 memMark->move( 4, 2 ); 114 memMark->move( 4, 2 );
120 memMark->hide(); 115 memMark->hide();
121 mem = 0; 116 mem = 0;
122 117
123 PushButtonMR->setEnabled( FALSE ); 118 PushButtonMR->setEnabled( FALSE );
124 119
125 current_mode = max_mode = conversion_mode_count = 0; 120 current_mode = max_mode = conversion_mode_count = 0;
126 last_conversion = -1; 121 last_conversion = -1;
127 122
128 // translation trick mode - with this stuff parsed in from a file is translatable 123 // translation trick mode - with this stuff parsed in from a file is translatable
129 QObject::tr("Standard"); 124 QObject::tr("Standard");
130 QObject::tr("Weight"); 125 QObject::tr("Weight");
131 QObject::tr("Distance"); 126 QObject::tr("Distance");
132 QObject::tr("Area"); 127 QObject::tr("Area");
133 QObject::tr("Temperatures"); 128 QObject::tr("Temperatures");
134 QObject::tr("Volume"); 129 QObject::tr("Volume");
135 QObject::tr("acres"); 130 QObject::tr("acres");
136 QObject::tr("°C"); 131 QObject::tr("C");
137 QObject::tr("carats"); 132 QObject::tr("carats");
138 QObject::tr("cm"); 133 QObject::tr("cm");
139 QObject::tr("cu cm"); 134 QObject::tr("cu cm");
140 QObject::tr("cu ft"); 135 QObject::tr("cu ft");
141 QObject::tr("cu in"); 136 QObject::tr("cu in");
142 QObject::tr("°F"); 137 QObject::tr("F");
143 QObject::tr("fl oz (US)"); 138 QObject::tr("fl oz (US)");
144 QObject::tr("ft"); 139 QObject::tr("ft");
145 QObject::tr("g"); 140 QObject::tr("g");
146 QObject::tr("gal (US)"); 141 QObject::tr("gal (US)");
147 QObject::tr("hectares"); 142 QObject::tr("hectares");
148 QObject::tr("in"); 143 QObject::tr("in");
149 QObject::tr("kg"); 144 QObject::tr("kg");
150 QObject::tr("km"); 145 QObject::tr("km");
151 QObject::tr("l"); 146 QObject::tr("l");
152 QObject::tr("lb"); 147 QObject::tr("lb");
153 QObject::tr("Lg tons"); 148 QObject::tr("Lg tons");
154 QObject::tr("m"); 149 QObject::tr("m");
155 QObject::tr("mg"); 150 QObject::tr("mg");
156 QObject::tr("mi"); 151 QObject::tr("mi");
157 QObject::tr("ml"); 152 QObject::tr("ml");
158 QObject::tr("mm"); 153 QObject::tr("mm");
159 QObject::tr("naut. mi"); 154 QObject::tr("naut. mi");
160 QObject::tr("oz"); 155 QObject::tr("oz");
161 QObject::tr("points"); 156 QObject::tr("points");
162 QObject::tr("pt"); 157 QObject::tr("pt");
163 QObject::tr("qt"); 158 QObject::tr("qt");
164 QObject::tr("sq cm"); 159 QObject::tr("sq cm");
165 QObject::tr("sq ft"); 160 QObject::tr("sq ft");
166 QObject::tr("sq in"); 161 QObject::tr("sq in");
167 QObject::tr("sq km"); 162 QObject::tr("sq km");
168 QObject::tr("sq m"); 163 QObject::tr("sq m");
169 QObject::tr("sq mi"); 164 QObject::tr("sq mi");
170 QObject::tr("sq mm"); 165 QObject::tr("sq mm");
171 QObject::tr("sq yd"); 166 QObject::tr("sq yd");
172 QObject::tr("st"); 167 QObject::tr("st");
173 QObject::tr("St tons"); 168 QObject::tr("St tons");
174 QObject::tr("tblspoon"); 169 QObject::tr("tblspoon");
175 QObject::tr("teaspoons"); 170 QObject::tr("teaspoons");
176 QObject::tr("tonnes"); 171 QObject::tr("tonnes");
177 QObject::tr("yd"); 172 QObject::tr("yd");
178 173
179 174
180//bgr_command.insert( PushButtonFunction); 175//bgr_command.insert( PushButtonFunction);
181 bgr_command.insert( PushButtonMPlus); 176 bgr_command.insert( PushButtonMPlus);
182 bgr_command.insert( PushButtonMR); 177 bgr_command.insert( PushButtonMR);
183 bgr_command.insert( PushButtonMC); 178 bgr_command.insert( PushButtonMC);
184 bgr_command.insert( PushButtonCE); 179 bgr_command.insert( PushButtonCE);
185 connect( &bgr_command, SIGNAL(clicked(int) ), this, SLOT(command_buttons(int))); 180 connect( &bgr_command, SIGNAL(clicked(int) ), this, SLOT(command_buttons(int)));
186 181
187 bgr_digits.insert(PushButton0); 182 bgr_digits.insert(PushButton0);
188 bgr_digits.insert(PushButton1); 183 bgr_digits.insert(PushButton1);
189 bgr_digits.insert(PushButton2); 184 bgr_digits.insert(PushButton2);
190 bgr_digits.insert(PushButton3); 185 bgr_digits.insert(PushButton3);