-rw-r--r-- | noncore/apps/oxygen/calcdlg.ui | 252 | ||||
-rw-r--r-- | noncore/apps/oxygen/calcdlgui.cpp | 1 | ||||
-rw-r--r-- | noncore/apps/oxygen/dataTable.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/oxygen/oxygen.cpp | 49 | ||||
-rw-r--r-- | noncore/apps/oxygen/oxygen.h | 8 |
5 files changed, 115 insertions, 199 deletions
diff --git a/noncore/apps/oxygen/calcdlg.ui b/noncore/apps/oxygen/calcdlg.ui index b4e54f1..2d30164 100644 --- a/noncore/apps/oxygen/calcdlg.ui +++ b/noncore/apps/oxygen/calcdlg.ui | |||
@@ -1,230 +1,180 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>CalcDlg</class> | 2 | <class>CalcDlg</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>CalcDlg</cstring> | 7 | <cstring>CalcDlg</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>253</width> | 14 | <width>245</width> |
15 | <height>352</height> | 15 | <height>318</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Calculations</string> | 20 | <string>Form1</string> |
21 | </property> | ||
22 | <property> | ||
23 | <name>layoutMargin</name> | ||
24 | </property> | ||
25 | <property> | ||
26 | <name>layoutSpacing</name> | ||
27 | </property> | 21 | </property> |
28 | <widget> | 22 | <widget> |
29 | <class>QTabWidget</class> | 23 | <class>QTabWidget</class> |
30 | <property stdset="1"> | 24 | <property stdset="1"> |
31 | <name>name</name> | 25 | <name>name</name> |
32 | <cstring>TabWidgetMain</cstring> | 26 | <cstring>TabWidget3</cstring> |
33 | </property> | 27 | </property> |
34 | <property stdset="1"> | 28 | <property stdset="1"> |
35 | <name>geometry</name> | 29 | <name>geometry</name> |
36 | <rect> | 30 | <rect> |
37 | <x>0</x> | 31 | <x>0</x> |
38 | <y>0</y> | 32 | <y>0</y> |
39 | <width>250</width> | 33 | <width>240</width> |
40 | <height>350</height> | 34 | <height>320</height> |
41 | </rect> | 35 | </rect> |
42 | </property> | 36 | </property> |
43 | <property> | ||
44 | <name>layoutMargin</name> | ||
45 | </property> | ||
46 | <property> | ||
47 | <name>layoutSpacing</name> | ||
48 | </property> | ||
49 | <widget> | 37 | <widget> |
50 | <class>QWidget</class> | 38 | <class>QWidget</class> |
51 | <property stdset="1"> | 39 | <property stdset="1"> |
52 | <name>name</name> | 40 | <name>name</name> |
53 | <cstring>tabMain</cstring> | 41 | <cstring>tab</cstring> |
54 | </property> | 42 | </property> |
55 | <attribute> | 43 | <attribute> |
56 | <name>title</name> | 44 | <name>title</name> |
57 | <string>Molweight</string> | 45 | <string>Tab 1</string> |
58 | </attribute> | 46 | </attribute> |
59 | <widget> | 47 | <widget> |
60 | <class>QFrame</class> | 48 | <class>QLayoutWidget</class> |
61 | <property stdset="1"> | 49 | <property stdset="1"> |
62 | <name>name</name> | 50 | <name>name</name> |
63 | <cstring>FrameSystemTime</cstring> | 51 | <cstring>Layout6</cstring> |
64 | </property> | 52 | </property> |
65 | <property stdset="1"> | 53 | <property stdset="1"> |
66 | <name>geometry</name> | 54 | <name>geometry</name> |
67 | <rect> | 55 | <rect> |
68 | <x>0</x> | 56 | <x>0</x> |
69 | <y>0</y> | 57 | <y>0</y> |
70 | <width>240</width> | 58 | <width>230</width> |
71 | <height>310</height> | 59 | <height>290</height> |
72 | </rect> | 60 | </rect> |
73 | </property> | 61 | </property> |
74 | <property stdset="1"> | 62 | <vbox> |
75 | <name>frameShape</name> | ||
76 | <enum>StyledPanel</enum> | ||
77 | </property> | ||
78 | <property stdset="1"> | ||
79 | <name>frameShadow</name> | ||
80 | <enum>Raised</enum> | ||
81 | </property> | ||
82 | <widget> | ||
83 | <class>QLayoutWidget</class> | ||
84 | <property stdset="1"> | 63 | <property stdset="1"> |
85 | <name>name</name> | 64 | <name>margin</name> |
86 | <cstring>Layout7</cstring> | 65 | <number>0</number> |
87 | </property> | 66 | </property> |
88 | <property stdset="1"> | 67 | <property stdset="1"> |
89 | <name>geometry</name> | 68 | <name>spacing</name> |
90 | <rect> | 69 | <number>6</number> |
91 | <x>0</x> | ||
92 | <y>0</y> | ||
93 | <width>240</width> | ||
94 | <height>310</height> | ||
95 | </rect> | ||
96 | </property> | 70 | </property> |
97 | <vbox> | 71 | <widget> |
72 | <class>QLabel</class> | ||
98 | <property stdset="1"> | 73 | <property stdset="1"> |
99 | <name>margin</name> | 74 | <name>name</name> |
100 | <number>0</number> | 75 | <cstring>TextLabel2</cstring> |
101 | </property> | 76 | </property> |
102 | <property stdset="1"> | 77 | <property stdset="1"> |
103 | <name>spacing</name> | 78 | <name>text</name> |
104 | <number>6</number> | 79 | <string>TextLabel2</string> |
105 | </property> | 80 | </property> |
106 | <widget> | 81 | </widget> |
107 | <class>QLabel</class> | 82 | <widget> |
108 | <property stdset="1"> | 83 | <class>QLineEdit</class> |
109 | <name>name</name> | 84 | <property stdset="1"> |
110 | <cstring>TextLabel1_4</cstring> | 85 | <name>name</name> |
111 | </property> | 86 | <cstring>formula</cstring> |
112 | <property stdset="1"> | 87 | </property> |
113 | <name>text</name> | 88 | </widget> |
114 | <string>Formula:</string> | 89 | <widget> |
115 | </property> | 90 | <class>QLayoutWidget</class> |
116 | </widget> | 91 | <property stdset="1"> |
117 | <widget> | 92 | <name>name</name> |
118 | <class>QLineEdit</class> | 93 | <cstring>Layout3</cstring> |
94 | </property> | ||
95 | <hbox> | ||
119 | <property stdset="1"> | 96 | <property stdset="1"> |
120 | <name>name</name> | 97 | <name>margin</name> |
121 | <cstring>formula</cstring> | 98 | <number>0</number> |
122 | </property> | 99 | </property> |
123 | </widget> | ||
124 | <widget> | ||
125 | <class>QLayoutWidget</class> | ||
126 | <property stdset="1"> | 100 | <property stdset="1"> |
127 | <name>name</name> | 101 | <name>spacing</name> |
128 | <cstring>Layout7</cstring> | 102 | <number>6</number> |
129 | </property> | 103 | </property> |
130 | <hbox> | 104 | <widget> |
105 | <class>QPushButton</class> | ||
131 | <property stdset="1"> | 106 | <property stdset="1"> |
132 | <name>margin</name> | 107 | <name>name</name> |
133 | <number>0</number> | 108 | <cstring>calculate</cstring> |
134 | </property> | 109 | </property> |
135 | <property stdset="1"> | 110 | <property stdset="1"> |
136 | <name>spacing</name> | 111 | <name>text</name> |
137 | <number>6</number> | 112 | <string>PushButton3</string> |
138 | </property> | 113 | </property> |
139 | <widget> | 114 | </widget> |
140 | <class>QPushButton</class> | 115 | <widget> |
141 | <property stdset="1"> | 116 | <class>QPushButton</class> |
142 | <name>name</name> | 117 | <property stdset="1"> |
143 | <cstring>calculate</cstring> | 118 | <name>name</name> |
144 | </property> | 119 | <cstring>clear_fields</cstring> |
145 | <property stdset="1"> | 120 | </property> |
146 | <name>text</name> | 121 | <property stdset="1"> |
147 | <string>Calculate</string> | 122 | <name>text</name> |
148 | </property> | 123 | <string>PushButton4</string> |
149 | </widget> | 124 | </property> |
150 | <widget> | 125 | </widget> |
151 | <class>QPushButton</class> | 126 | </hbox> |
152 | <property stdset="1"> | 127 | </widget> |
153 | <name>name</name> | 128 | <widget> |
154 | <cstring>clear_fields</cstring> | 129 | <class>QLabel</class> |
155 | </property> | 130 | <property stdset="1"> |
156 | <property stdset="1"> | 131 | <name>name</name> |
157 | <name>text</name> | 132 | <cstring>TextLabel3</cstring> |
158 | <string>Clear</string> | 133 | </property> |
159 | </property> | 134 | <property stdset="1"> |
160 | </widget> | 135 | <name>text</name> |
161 | </hbox> | 136 | <string>TextLabel3</string> |
162 | </widget> | 137 | </property> |
163 | <widget> | 138 | </widget> |
164 | <class>QLabel</class> | 139 | <widget> |
165 | <property stdset="1"> | 140 | <class>QLineEdit</class> |
166 | <name>name</name> | 141 | <property stdset="1"> |
167 | <cstring>TextLabel2_4</cstring> | 142 | <name>name</name> |
168 | </property> | 143 | <cstring>result</cstring> |
169 | <property stdset="1"> | 144 | </property> |
170 | <name>text</name> | 145 | </widget> |
171 | <string>Result:</string> | 146 | <widget> |
172 | </property> | 147 | <class>QLabel</class> |
173 | </widget> | 148 | <property stdset="1"> |
174 | <widget> | 149 | <name>name</name> |
175 | <class>QLineEdit</class> | 150 | <cstring>TextLabel1</cstring> |
176 | <property stdset="1"> | 151 | </property> |
177 | <name>name</name> | 152 | <property stdset="1"> |
178 | <cstring>result</cstring> | 153 | <name>text</name> |
179 | </property> | 154 | <string>TextLabel1</string> |
180 | </widget> | 155 | </property> |
181 | <widget> | 156 | </widget> |
182 | <class>QLabel</class> | 157 | <widget> |
183 | <property stdset="1"> | 158 | <class>QMultiLineEdit</class> |
184 | <name>name</name> | 159 | <property stdset="1"> |
185 | <cstring>TextLabel1</cstring> | 160 | <name>name</name> |
186 | </property> | 161 | <cstring>anal_display</cstring> |
187 | <property stdset="1"> | 162 | </property> |
188 | <name>text</name> | 163 | </widget> |
189 | <string>Elemental composition (%):</string> | 164 | </vbox> |
190 | </property> | ||
191 | </widget> | ||
192 | <widget> | ||
193 | <class>QMultiLineEdit</class> | ||
194 | <property stdset="1"> | ||
195 | <name>name</name> | ||
196 | <cstring>anal_display</cstring> | ||
197 | </property> | ||
198 | <property stdset="1"> | ||
199 | <name>readOnly</name> | ||
200 | <bool>true</bool> | ||
201 | </property> | ||
202 | </widget> | ||
203 | </vbox> | ||
204 | </widget> | ||
205 | </widget> | 165 | </widget> |
206 | </widget> | 166 | </widget> |
207 | <widget> | 167 | <widget> |
208 | <class>QWidget</class> | 168 | <class>QWidget</class> |
209 | <property stdset="1"> | 169 | <property stdset="1"> |
210 | <name>name</name> | 170 | <name>name</name> |
211 | <cstring>tabNtp</cstring> | 171 | <cstring>tab</cstring> |
212 | </property> | 172 | </property> |
213 | <attribute> | 173 | <attribute> |
214 | <name>title</name> | 174 | <name>title</name> |
215 | <string>Nernst</string> | 175 | <string>Tab 2</string> |
216 | </attribute> | 176 | </attribute> |
217 | <grid> | ||
218 | <property stdset="1"> | ||
219 | <name>margin</name> | ||
220 | <number>1</number> | ||
221 | </property> | ||
222 | <property stdset="1"> | ||
223 | <name>spacing</name> | ||
224 | <number>2</number> | ||
225 | </property> | ||
226 | </grid> | ||
227 | </widget> | 177 | </widget> |
228 | </widget> | 178 | </widget> |
229 | </widget> | 179 | </widget> |
230 | </UI> | 180 | </UI> |
diff --git a/noncore/apps/oxygen/calcdlgui.cpp b/noncore/apps/oxygen/calcdlgui.cpp index b6dfff3..ca3a9f2 100644 --- a/noncore/apps/oxygen/calcdlgui.cpp +++ b/noncore/apps/oxygen/calcdlgui.cpp | |||
@@ -1,65 +1,64 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : Oxygen | 2 | application: : Oxygen |
3 | 3 | ||
4 | begin : September 2002 | 4 | begin : September 2002 |
5 | copyright : ( C ) 2002 by Carsten Niehaus | 5 | copyright : ( C ) 2002 by Carsten Niehaus |
6 | email : cniehaus@handhelds.org | 6 | email : cniehaus@handhelds.org |
7 | **************************************************************************/ | 7 | **************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
15 | * * | 15 | * * |
16 | **************************************************************************/ | 16 | **************************************************************************/ |
17 | #include "oxygen.h" | 17 | #include "oxygen.h" |
18 | 18 | ||
19 | #include "calcdlgui.h" | 19 | #include "calcdlgui.h" |
20 | #include "kmolcalc.h" | 20 | #include "kmolcalc.h" |
21 | #include <qlineedit.h> | 21 | #include <qlineedit.h> |
22 | #include <qmultilineedit.h> | 22 | #include <qmultilineedit.h> |
23 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
24 | 24 | ||
25 | calcDlgUI::calcDlgUI() : CalcDlg() | 25 | calcDlgUI::calcDlgUI() : CalcDlg() |
26 | { | 26 | { |
27 | this->showMaximized(); | ||
28 | kmolcalc = new KMolCalc; | 27 | kmolcalc = new KMolCalc; |
29 | connect( calculate, SIGNAL( clicked() ), this, SLOT( calc() ) ); | 28 | connect( calculate, SIGNAL( clicked() ), this, SLOT( calc() ) ); |
30 | connect( clear_fields, SIGNAL( clicked() ), this, SLOT( clear() ) ); | 29 | connect( clear_fields, SIGNAL( clicked() ), this, SLOT( clear() ) ); |
31 | result->setReadOnly( true ); | 30 | result->setReadOnly( true ); |
32 | } | 31 | } |
33 | 32 | ||
34 | void calcDlgUI::calc() | 33 | void calcDlgUI::calc() |
35 | { | 34 | { |
36 | QString compound( formula->text() ); | 35 | QString compound( formula->text() ); |
37 | if ( compound.isEmpty() ) { | 36 | if ( compound.isEmpty() ) { |
38 | clear(); | 37 | clear(); |
39 | return; | 38 | return; |
40 | } | 39 | } |
41 | QString errors( kmolcalc->readFormula( compound ) ); | 40 | QString errors( kmolcalc->readFormula( compound ) ); |
42 | QString mw, ea; | 41 | QString mw, ea; |
43 | double weight = kmolcalc->getWeight(); | 42 | double weight = kmolcalc->getWeight(); |
44 | if ( errors == "OK" ) { | 43 | if ( errors == "OK" ) { |
45 | mw.setNum( weight ); | 44 | mw.setNum( weight ); |
46 | ea = kmolcalc->getEmpFormula() + " :\n" + kmolcalc->getEA(); | 45 | ea = kmolcalc->getEmpFormula() + " :\n" + kmolcalc->getEA(); |
47 | } else { | 46 | } else { |
48 | mw = "???"; | 47 | mw = "???"; |
49 | ea = tr( "ERROR: \n" ) + errors + "\n"; | 48 | ea = tr( "ERROR: \n" ) + errors + "\n"; |
50 | } | 49 | } |
51 | result->setText( mw ); | 50 | result->setText( mw ); |
52 | anal_display->setText( ea ); | 51 | anal_display->setText( ea ); |
53 | } | 52 | } |
54 | 53 | ||
55 | /** | 54 | /** |
56 | * * Clear all text entry / result fields. | 55 | * * Clear all text entry / result fields. |
57 | * */ | 56 | * */ |
58 | void calcDlgUI::clear() | 57 | void calcDlgUI::clear() |
59 | { | 58 | { |
60 | formula->clear(); | 59 | formula->clear(); |
61 | result->clear(); | 60 | result->clear(); |
62 | anal_display->clear(); | 61 | anal_display->clear(); |
63 | } | 62 | } |
64 | 63 | ||
65 | 64 | ||
diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp index 45c2ffd..e027c16 100644 --- a/noncore/apps/oxygen/dataTable.cpp +++ b/noncore/apps/oxygen/dataTable.cpp | |||
@@ -1,143 +1,143 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : Oxygen | 2 | application: : Oxygen |
3 | 3 | ||
4 | begin : September 2002 | 4 | begin : September 2002 |
5 | copyright : ( C ) 2002 by Carsten Niehaus | 5 | copyright : ( C ) 2002 by Carsten Niehaus |
6 | email : cniehaus@handhelds.org | 6 | email : cniehaus@handhelds.org |
7 | **************************************************************************/ | 7 | **************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
15 | * * | 15 | * * |
16 | **************************************************************************/ | 16 | **************************************************************************/ |
17 | 17 | ||
18 | #include <qpe/config.h> | 18 | #include <qpe/config.h> |
19 | 19 | ||
20 | #include "dataTable.h" | 20 | #include "dataTable.h" |
21 | #include <qwidget.h> | 21 | #include <qwidget.h> |
22 | #include <qhbox.h> | 22 | #include <qhbox.h> |
23 | #include <qlabel.h> | 23 | #include <qlabel.h> |
24 | #include <qfont.h> | 24 | #include <qfont.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
27 | 27 | ||
28 | OxydataWidget::OxydataWidget(QWidget *parent) : QWidget(parent) | 28 | OxydataWidget::OxydataWidget(QWidget *parent) : QWidget(parent) |
29 | { | 29 | { |
30 | QGridLayout *qgrid = new QGridLayout( this, 2,1 ); | 30 | QGridLayout *qgrid = new QGridLayout( this, 2,1 ); |
31 | 31 | ||
32 | QHBox *hbox = new QHBox( this ); | 32 | QHBox *hbox = new QHBox( this ); |
33 | left = new QLabel( hbox ); | 33 | left = new QLabel( hbox ); |
34 | middle = new QLabel( hbox ); | 34 | middle = new QLabel( hbox ); |
35 | right = new QLabel( hbox ); | 35 | right = new QLabel( hbox ); |
36 | 36 | ||
37 | right->setAlignment( AlignRight ); | 37 | right->setAlignment( AlignRight ); |
38 | middle->setAlignment( AlignHCenter ); | 38 | middle->setAlignment( AlignHCenter ); |
39 | 39 | ||
40 | QFont bf; | 40 | QFont bf; |
41 | bf.setBold( true ); | 41 | bf.setBold( true ); |
42 | bf.setPointSize( bf.pointSize()+2 ); | 42 | bf.setPointSize( bf.pointSize()+2 ); |
43 | middle->setFont( bf ); | 43 | middle->setFont( bf ); |
44 | 44 | ||
45 | DataTable = new OxydataTable( 9,2, this ); | 45 | DataTable = new OxydataTable( 9,2, this ); |
46 | DataTable->setColumnWidth ( 1 , 118 ); | 46 | // DataTable->setColumnWidth ( 1 , 118 ); |
47 | DataTable->setColumnWidth ( 0 , 118 ); | 47 | // DataTable->setColumnWidth ( 0 , 118 ); |
48 | setTable(); | 48 | setTable(); |
49 | 49 | ||
50 | qgrid->addWidget( hbox,0,0 ); | 50 | qgrid->addWidget( hbox,0,0 ); |
51 | qgrid->addWidget( DataTable,1,0 ); | 51 | qgrid->addWidget( DataTable,1,0 ); |
52 | } | 52 | } |
53 | 53 | ||
54 | void OxydataWidget::setElement( int el ) | 54 | void OxydataWidget::setElement( int el ) |
55 | { | 55 | { |
56 | Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); | 56 | Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); |
57 | 57 | ||
58 | configobj.setGroup( QString::number( el+1 )); | 58 | configobj.setGroup( QString::number( el+1 )); |
59 | 59 | ||
60 | left->setText( configobj.readEntry( "Symbol" ) ); | 60 | left->setText( configobj.readEntry( "Symbol" ) ); |
61 | middle->setText( configobj.readEntry( "Name" ) ); | 61 | middle->setText( configobj.readEntry( "Name" ) ); |
62 | right->setText( QString::number( el+1 ) ); | 62 | right->setText( QString::number( el+1 ) ); |
63 | 63 | ||
64 | 64 | ||
65 | DataTable->setText( 0,1,configobj.readEntry( "Weight" ) ); | 65 | DataTable->setText( 0,1,configobj.readEntry( "Weight" ) ); |
66 | DataTable->setText( 1,1,configobj.readEntry( "Block" ) ); | 66 | DataTable->setText( 1,1,configobj.readEntry( "Block" ) ); |
67 | DataTable->setText( 2,1,configobj.readEntry( "Group" ) ); | 67 | DataTable->setText( 2,1,configobj.readEntry( "Group" ) ); |
68 | DataTable->setText( 3,1,configobj.readEntry( "EN" ) ); | 68 | DataTable->setText( 3,1,configobj.readEntry( "EN" ) ); |
69 | DataTable->setText( 4,1,configobj.readEntry( "AR" ) ) ; | 69 | DataTable->setText( 4,1,configobj.readEntry( "AR" ) ) ; |
70 | DataTable->setText( 5,1,configobj.readEntry( "IE" ) ); | 70 | DataTable->setText( 5,1,configobj.readEntry( "IE" ) ); |
71 | DataTable->setText( 6,1,configobj.readEntry( "Density" ) ); | 71 | DataTable->setText( 6,1,configobj.readEntry( "Density" ) ); |
72 | DataTable->setText( 7,1,configobj.readEntry( "BP" ) ); | 72 | DataTable->setText( 7,1,configobj.readEntry( "BP" ) ); |
73 | DataTable->setText( 8,1,configobj.readEntry( "MP" ) ); | 73 | DataTable->setText( 8,1,configobj.readEntry( "MP" ) ); |
74 | 74 | ||
75 | } | 75 | } |
76 | 76 | ||
77 | void OxydataWidget::setTable() const | 77 | void OxydataWidget::setTable() const |
78 | { | 78 | { |
79 | DataTable->setText( 0,0, tr( "Weight:" ) ); | 79 | DataTable->setText( 0,0, tr( "Weight:" ) ); |
80 | DataTable->setText( 1,0, tr( "Block" )) ; | 80 | DataTable->setText( 1,0, tr( "Block" )) ; |
81 | DataTable->setText( 2,0, tr( "Group" )) ; | 81 | DataTable->setText( 2,0, tr( "Group" )) ; |
82 | DataTable->setText( 3,0, tr( "Electronegativity" )) ; | 82 | DataTable->setText( 3,0, tr( "Electronegativity" )) ; |
83 | DataTable->setText( 4,0, tr( "Atomic radius" )) ; | 83 | DataTable->setText( 4,0, tr( "Atomic radius" )) ; |
84 | DataTable->setText( 5,0, tr( "Ionizationenergie" )) ; | 84 | DataTable->setText( 5,0, tr( "Ionizationenergie" )) ; |
85 | DataTable->setText( 6,0, tr( "Density" )) ; | 85 | DataTable->setText( 6,0, tr( "Density" )) ; |
86 | DataTable->setText( 7,0, tr( "Boilingpoint" ) ); | 86 | DataTable->setText( 7,0, tr( "Boilingpoint" ) ); |
87 | DataTable->setText( 8,0, tr( "Meltingpoint" ) ); | 87 | DataTable->setText( 8,0, tr( "Meltingpoint" ) ); |
88 | 88 | ||
89 | } | 89 | } |
90 | 90 | ||
91 | OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent, | 91 | OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent, |
92 | const char *name) : QTable(numRows, numCols,parent, name) | 92 | const char *name) : QTable(numRows, numCols,parent, name) |
93 | { | 93 | { |
94 | 94 | ||
95 | for (int zeile = 0; zeile < numRows; zeile++) | 95 | for (int zeile = 0; zeile < numRows; zeile++) |
96 | for ( int spalte = 0; spalte < numCols; spalte++ ) | 96 | for ( int spalte = 0; spalte < numCols; spalte++ ) |
97 | { | 97 | { |
98 | OxydataQTI *testus = new OxydataQTI (this, OxydataQTI::Never, "hm" ); | 98 | OxydataQTI *testus = new OxydataQTI (this, OxydataQTI::Never, "hm" ); |
99 | setItem(zeile, spalte, (QTableItem*)testus); | 99 | setItem(zeile, spalte, (QTableItem*)testus); |
100 | } | 100 | } |
101 | 101 | ||
102 | 102 | ||
103 | this->setShowGrid( false ); | 103 | this->setShowGrid( false ); |
104 | this->setHScrollBarMode(QScrollView::AlwaysOff); | 104 | this->setHScrollBarMode(QScrollView::AlwaysOff); |
105 | this->horizontalHeader()->hide(); | 105 | this->horizontalHeader()->hide(); |
106 | this->verticalHeader()->hide(); | 106 | this->verticalHeader()->hide(); |
107 | this->setTopMargin( 0 ); | 107 | this->setTopMargin( 0 ); |
108 | this->setLeftMargin( 0 ); | 108 | this->setLeftMargin( 0 ); |
109 | } | 109 | } |
110 | 110 | ||
111 | void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected) | 111 | void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected) |
112 | { | 112 | { |
113 | if ( cr.width() == 0 || cr.height() == 0 ) | 113 | if ( cr.width() == 0 || cr.height() == 0 ) |
114 | return; | 114 | return; |
115 | selected = FALSE; | 115 | selected = FALSE; |
116 | 116 | ||
117 | QTableItem *itm = item( row, col ); | 117 | QTableItem *itm = item( row, col ); |
118 | QColorGroup colgrp = colorGroup(); | 118 | QColorGroup colgrp = colorGroup(); |
119 | if ( itm ) | 119 | if ( itm ) |
120 | { | 120 | { |
121 | if ( row%2 ) | 121 | if ( row%2 ) |
122 | colgrp.setColor( QColorGroup::Base, QColor( 180,200,210 ) ); | 122 | colgrp.setColor( QColorGroup::Base, QColor( 180,200,210 ) ); |
123 | else | 123 | else |
124 | colgrp.setColor( QColorGroup::Base, QColor( 230,235,235 ) ); | 124 | colgrp.setColor( QColorGroup::Base, QColor( 230,235,235 ) ); |
125 | p->save(); | 125 | p->save(); |
126 | itm->paint( p, colgrp, cr, selected ); | 126 | itm->paint( p, colgrp, cr, selected ); |
127 | p->restore(); | 127 | p->restore(); |
128 | } | 128 | } |
129 | } | 129 | } |
130 | 130 | ||
131 | OxydataQTI::OxydataQTI(QTable * table, EditType et, const QString & text ) | 131 | OxydataQTI::OxydataQTI(QTable * table, EditType et, const QString & text ) |
132 | : QTableItem ( table, et, text ) | 132 | : QTableItem ( table, et, text ) |
133 | { | 133 | { |
134 | } | 134 | } |
135 | 135 | ||
136 | int OxydataQTI::alignment() const | 136 | int OxydataQTI::alignment() const |
137 | { | 137 | { |
138 | if ( col()%2 ) | 138 | if ( col()%2 ) |
139 | { | 139 | { |
140 | return AlignRight | AlignVCenter; | 140 | return AlignRight | AlignVCenter; |
141 | }else return AlignLeft | AlignVCenter; | 141 | }else return AlignLeft | AlignVCenter; |
142 | }; | 142 | }; |
143 | 143 | ||
diff --git a/noncore/apps/oxygen/oxygen.cpp b/noncore/apps/oxygen/oxygen.cpp index b3392e1..bc99d89 100644 --- a/noncore/apps/oxygen/oxygen.cpp +++ b/noncore/apps/oxygen/oxygen.cpp | |||
@@ -1,67 +1,42 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : Oxygen | 2 | application: : Oxygen |
3 | 3 | ||
4 | begin : September 2002 | 4 | begin : September 2002 |
5 | copyright : ( C ) 2002 by Carsten Niehaus | 5 | copyright : ( C ) 2002 by Carsten Niehaus |
6 | email : cniehaus@handhelds.org | 6 | email : cniehaus@handhelds.org |
7 | **************************************************************************/ | 7 | **************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
15 | * * | 15 | * * |
16 | **************************************************************************/ | 16 | **************************************************************************/ |
17 | #include "oxygen.h" | 17 | #include "oxygen.h" |
18 | 18 | ||
19 | #include <qlabel.h> | 19 | #include <qlabel.h> |
20 | #include <qapplication.h> | 20 | #include <qapplication.h> |
21 | #include <qpushbutton.h> | 21 | #include <qpushbutton.h> |
22 | #include <qvbox.h> | 22 | #include <qvbox.h> |
23 | #include <qtabwidget.h> | ||
23 | #include "calcdlg.h" | 24 | #include "calcdlg.h" |
24 | #include "calcdlgui.h" | 25 | #include "calcdlgui.h" |
25 | #include "datawidgetui.h" | 26 | #include "datawidgetui.h" |
26 | #include "psewidget.h" | 27 | #include "psewidget.h" |
27 | 28 | ||
28 | Oxygen::Oxygen() | 29 | Oxygen::Oxygen() : QMainWindow() |
29 | : QMainWindow() | ||
30 | { | 30 | { |
31 | this->setCaption( tr( "Oxygen" ) ); | 31 | PSEWidget *pse = new PSEWidget(); |
32 | vbox = new QVBox( this ); | ||
33 | QPushButton *dataButton = new QPushButton( "Data", vbox ); | ||
34 | connect ( dataButton, SIGNAL( clicked() ), this, SLOT( slotData() ) ); | ||
35 | QPushButton *calcButton = new QPushButton( "Calculations", vbox ); | ||
36 | connect ( calcButton, SIGNAL( clicked() ), this, SLOT( slotCalculations() ) ); | ||
37 | QPushButton *pseButton = new QPushButton( "PSE", vbox ); | ||
38 | connect ( pseButton, SIGNAL( clicked() ), this, SLOT( slotPSE() ) ); | ||
39 | |||
40 | setCentralWidget( vbox ); | ||
41 | } | ||
42 | |||
43 | |||
44 | void Oxygen::close() const | ||
45 | { | ||
46 | QApplication::exit(); | ||
47 | } | ||
48 | |||
49 | //SLOTS | ||
50 | |||
51 | void Oxygen::slotCalculations() const{ | ||
52 | calcDlgUI *CalcDlgUI = new calcDlgUI(); | 32 | calcDlgUI *CalcDlgUI = new calcDlgUI(); |
53 | CalcDlgUI->show(); | ||
54 | }; | ||
55 | |||
56 | void Oxygen::slotData() const{ | ||
57 | dataWidgetUI *DataWidgetUI = new dataWidgetUI(); | 33 | dataWidgetUI *DataWidgetUI = new dataWidgetUI(); |
58 | DataWidgetUI->showMaximized(); | 34 | |
59 | DataWidgetUI->show(); | 35 | this->setCaption( tr( "Oxygen" ) ); |
60 | }; | 36 | |
61 | 37 | QTabWidget *tabw = new QTabWidget( this , "qtab" ); | |
62 | void Oxygen::slotPSE() const{ | 38 | tabw->addTab( pse, tr( "PSE" )); |
63 | PSEWidget *pse = new PSEWidget(); | 39 | tabw->addTab( DataWidgetUI , tr( "Data" ) ); |
64 | pse->showMaximized(); | 40 | tabw->addTab( CalcDlgUI, tr( "Calculations" ) ); |
65 | pse->show(); | 41 | setCentralWidget( tabw ); |
66 | }; | 42 | } |
67 | |||
diff --git a/noncore/apps/oxygen/oxygen.h b/noncore/apps/oxygen/oxygen.h index 2a10666..782cc3e 100644 --- a/noncore/apps/oxygen/oxygen.h +++ b/noncore/apps/oxygen/oxygen.h | |||
@@ -1,26 +1,18 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * ( at your option ) any later version. * | 6 | * ( at your option ) any later version. * |
7 | * * | 7 | * * |
8 | **************************************************************************/ | 8 | **************************************************************************/ |
9 | 9 | ||
10 | #include <qmainwindow.h> | 10 | #include <qmainwindow.h> |
11 | 11 | ||
12 | class QVBox; | ||
13 | |||
14 | class Oxygen : public QMainWindow | 12 | class Oxygen : public QMainWindow |
15 | { | 13 | { |
16 | Q_OBJECT | 14 | Q_OBJECT |
17 | 15 | ||
18 | public: | 16 | public: |
19 | Oxygen(); | 17 | Oxygen(); |
20 | QVBox *vbox; | ||
21 | private slots: | ||
22 | void slotCalculations() const; | ||
23 | void slotData() const; | ||
24 | void slotPSE() const; | ||
25 | void close() const; | ||
26 | }; | 18 | }; |