-rw-r--r-- | noncore/apps/checkbook/calcdlg.ui | 44 | ||||
-rw-r--r-- | noncore/apps/checkbook/calcdlgui.cpp | 69 | ||||
-rw-r--r-- | noncore/apps/checkbook/calcdlgui.h | 29 | ||||
-rw-r--r-- | noncore/apps/checkbook/kmolcalc.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/checkbook/oxygen.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/checkbook/oxygen.pro | 4 |
6 files changed, 84 insertions, 71 deletions
diff --git a/noncore/apps/checkbook/calcdlg.ui b/noncore/apps/checkbook/calcdlg.ui index 7637ca8..e0b19f9 100644 --- a/noncore/apps/checkbook/calcdlg.ui +++ b/noncore/apps/checkbook/calcdlg.ui | |||
@@ -13,3 +13,3 @@ | |||
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>222</width> | 14 | <width>218</width> |
15 | <height>274</height> | 15 | <height>274</height> |
@@ -102,22 +102,2 @@ | |||
102 | <widget> | 102 | <widget> |
103 | <class>QLabel</class> | ||
104 | <property stdset="1"> | ||
105 | <name>name</name> | ||
106 | <cstring>TextLabel2_4</cstring> | ||
107 | </property> | ||
108 | <property stdset="1"> | ||
109 | <name>geometry</name> | ||
110 | <rect> | ||
111 | <x>1</x> | ||
112 | <y>86</y> | ||
113 | <width>298</width> | ||
114 | <height>16</height> | ||
115 | </rect> | ||
116 | </property> | ||
117 | <property stdset="1"> | ||
118 | <name>text</name> | ||
119 | <string>Result:</string> | ||
120 | </property> | ||
121 | </widget> | ||
122 | <widget> | ||
123 | <class>QLayoutWidget</class> | 103 | <class>QLayoutWidget</class> |
@@ -205,3 +185,3 @@ | |||
205 | <name>name</name> | 185 | <name>name</name> |
206 | <cstring>LineEdit2</cstring> | 186 | <cstring>result</cstring> |
207 | </property> | 187 | </property> |
@@ -217,2 +197,22 @@ | |||
217 | </widget> | 197 | </widget> |
198 | <widget> | ||
199 | <class>QLabel</class> | ||
200 | <property stdset="1"> | ||
201 | <name>name</name> | ||
202 | <cstring>TextLabel2_4</cstring> | ||
203 | </property> | ||
204 | <property stdset="1"> | ||
205 | <name>geometry</name> | ||
206 | <rect> | ||
207 | <x>1</x> | ||
208 | <y>86</y> | ||
209 | <width>298</width> | ||
210 | <height>16</height> | ||
211 | </rect> | ||
212 | </property> | ||
213 | <property stdset="1"> | ||
214 | <name>text</name> | ||
215 | <string>Result:</string> | ||
216 | </property> | ||
217 | </widget> | ||
218 | </widget> | 218 | </widget> |
diff --git a/noncore/apps/checkbook/calcdlgui.cpp b/noncore/apps/checkbook/calcdlgui.cpp index a86374b..e9b40d3 100644 --- a/noncore/apps/checkbook/calcdlgui.cpp +++ b/noncore/apps/checkbook/calcdlgui.cpp | |||
@@ -7,46 +7,49 @@ | |||
7 | * * | 7 | * * |
8 | * ***********************************************************************/ | 8 | **************************************************************************/ |
9 | #include "oxygen.h" | 9 | #include "oxygen.h" |
10 | 10 | ||
11 | #include <qmenubar.h> | 11 | #include "calcdlgui.h" |
12 | #include <qstatusbar.h> | 12 | #include "kmolcalc.h" |
13 | #include <qpopupmenu.h> | 13 | #include <qlineedit.h> |
14 | #include <qlabel.h> | 14 | #include <qmultilineedit.h> |
15 | #include <qapplication.h> | ||
16 | #include <qpushbutton.h> | 15 | #include <qpushbutton.h> |
17 | #include <qfile.h> | ||
18 | #include <qdir.h> | ||
19 | #include <qvbox.h> | ||
20 | #include "calcdlg.h" | ||
21 | 16 | ||
22 | Oxygen::Oxygen() | 17 | calcDlgUI::calcDlgUI() : CalcDlg() |
23 | : QMainWindow() | ||
24 | { | 18 | { |
25 | this->setCaption( "Oxygen" ); | 19 | kmolcalc = new KMolCalc; |
26 | vbox = new QVBox( this ); | 20 | connect( calculate, SIGNAL( clicked() ), this, SLOT( calc() ) ); |
27 | QPushButton *setButton = new QPushButton( "Settings", vbox ); | 21 | connect( clear_fields, SIGNAL( clicked() ), this, SLOT( clear() ) ); |
28 | connect ( setButton, SIGNAL( clicked() ), this, SLOT( slotSettings() ) ); | ||
29 | QPushButton *calcButton = new QPushButton( "Calculations", vbox ); | ||
30 | connect ( calcButton, SIGNAL( clicked() ), this, SLOT( slotCalculations() ) ); | ||
31 | QPushButton *pseButton = new QPushButton( "PSE", vbox ); | ||
32 | connect ( pseButton, SIGNAL( clicked() ), this, SLOT( slotPSE() ) ); | ||
33 | |||
34 | setCentralWidget( vbox ); | ||
35 | } | 22 | } |
36 | 23 | ||
37 | 24 | void calcDlgUI::calc() | |
38 | void Oxygen::close() | ||
39 | { | 25 | { |
40 | QApplication::exit(); | 26 | QString compound( formula->text() ); |
27 | if ( compound.isEmpty() ) { | ||
28 | clear(); | ||
29 | return; | ||
30 | } | ||
31 | QString errors( kmolcalc->readFormula( compound ) ); | ||
32 | QString mw, ea; | ||
33 | double weight = kmolcalc->getWeight(); | ||
34 | if ( errors == "OK" ) { | ||
35 | mw.setNum( weight ); | ||
36 | ea = kmolcalc->getEmpFormula() + " :\n" + kmolcalc->getEA(); | ||
37 | } else { | ||
38 | mw = "???"; | ||
39 | ea = tr( "ERROR: \n" ) + errors + "\n"; | ||
40 | } | ||
41 | result->setText( mw ); | ||
42 | anal_display->setText( ea ); | ||
41 | } | 43 | } |
42 | 44 | ||
43 | //SLOTS | 45 | /** |
44 | 46 | * * Clear all text entry / result fields. | |
45 | void Oxygen::slotCalculations(){ | 47 | * */ |
46 | CalcDlgUI *calcDlgUI = new calcDlgUI(); | 48 | void calcDlgUI::clear() |
47 | calcDlgUI->show(); | 49 | { |
48 | }; | 50 | formula->clear(); |
51 | result->clear(); | ||
52 | anal_display->clear(); | ||
53 | } | ||
49 | 54 | ||
50 | void Oxygen::slotSettings(){ }; | ||
51 | void Oxygen::slotPSE(){ }; | ||
52 | 55 | ||
diff --git a/noncore/apps/checkbook/calcdlgui.h b/noncore/apps/checkbook/calcdlgui.h index 1e923ee..33a1ec1 100644 --- a/noncore/apps/checkbook/calcdlgui.h +++ b/noncore/apps/checkbook/calcdlgui.h | |||
@@ -1,11 +1,17 @@ | |||
1 | 1 | ||
2 | #include <qpe/resource.h> | 2 | /*************************************************************************** |
3 | #include <qmainwindow.h> | 3 | * * |
4 | #include <qtoolbar.h> | 4 | * This program is free software; you can redistribute it and/or modify * |
5 | * it under the terms of the GNU General Public License as published by * | ||
6 | * the Free Software Foundation; either version 2 of the License, or * | ||
7 | * ( at your option ) any later version. * | ||
8 | * * | ||
9 | **************************************************************************/ | ||
5 | #include <qstring.h> | 10 | #include <qstring.h> |
6 | #include <qpopupmenu.h> | 11 | #include "calcdlg.h" |
7 | 12 | ||
8 | class QVBox; | 13 | class QVBox; |
14 | class KMolCalc; | ||
9 | 15 | ||
10 | class Oxygen : public QMainWindow | 16 | class calcDlgUI : public CalcDlg |
11 | { | 17 | { |
@@ -14,9 +20,8 @@ class Oxygen : public QMainWindow | |||
14 | public: | 20 | public: |
15 | Oxygen(); | 21 | calcDlgUI(); |
16 | QVBox *vbox; | 22 | KMolCalc *kmolcalc; |
17 | private slots: | 23 | |
18 | void slotCalculations(); | 24 | public slots: |
19 | void slotSettings(); | 25 | void calc(); |
20 | void slotPSE(); | 26 | void clear(); |
21 | void close(); | ||
22 | }; | 27 | }; |
diff --git a/noncore/apps/checkbook/kmolcalc.cpp b/noncore/apps/checkbook/kmolcalc.cpp index e5ab736..50e1375 100644 --- a/noncore/apps/checkbook/kmolcalc.cpp +++ b/noncore/apps/checkbook/kmolcalc.cpp | |||
@@ -4,2 +4,3 @@ | |||
4 | * Copyright (C) 2000 Tomislav Gountchev <tomi@idiom.com> | 4 | * Copyright (C) 2000 Tomislav Gountchev <tomi@idiom.com> |
5 | * Copyright (C) 2002 Carsten Niehaus <cniehaus@handhelds.org> | ||
5 | */ | 6 | */ |
@@ -15,2 +16,3 @@ | |||
15 | #include <qdir.h> | 16 | #include <qdir.h> |
17 | #include <qfile.h> | ||
16 | #include <iostream.h> | 18 | #include <iostream.h> |
@@ -37,3 +39,3 @@ void KMolCalc::readElstable() { | |||
37 | QStringList files;// = // KGlobal::dirs()->findAllResources("appdata", "kmolweights"); | 39 | QStringList files;// = // KGlobal::dirs()->findAllResources("appdata", "kmolweights"); |
38 | // mwfile = locateLocal("data", "kmol")+"/kmolweights"; | 40 | mwfile = "/home/opie/opie/noncore/apps/oxigen/kmolweights"; |
39 | QFile f(mwfile); | 41 | QFile f(mwfile); |
diff --git a/noncore/apps/checkbook/oxygen.cpp b/noncore/apps/checkbook/oxygen.cpp index a86374b..81897e9 100644 --- a/noncore/apps/checkbook/oxygen.cpp +++ b/noncore/apps/checkbook/oxygen.cpp | |||
@@ -20,2 +20,3 @@ | |||
20 | #include "calcdlg.h" | 20 | #include "calcdlg.h" |
21 | #include "calcdlgui.h" | ||
21 | 22 | ||
@@ -45,4 +46,4 @@ void Oxygen::close() | |||
45 | void Oxygen::slotCalculations(){ | 46 | void Oxygen::slotCalculations(){ |
46 | CalcDlgUI *calcDlgUI = new calcDlgUI(); | 47 | calcDlgUI *CalcDlgUI = new calcDlgUI(); |
47 | calcDlgUI->show(); | 48 | CalcDlgUI->show(); |
48 | }; | 49 | }; |
diff --git a/noncore/apps/checkbook/oxygen.pro b/noncore/apps/checkbook/oxygen.pro index f8e0197..c5448e7 100644 --- a/noncore/apps/checkbook/oxygen.pro +++ b/noncore/apps/checkbook/oxygen.pro | |||
@@ -4,3 +4,4 @@ HEADERS = oxygen.h \ | |||
4 | kmolcalc.h \ | 4 | kmolcalc.h \ |
5 | kmolelements.h | 5 | kmolelements.h \ |
6 | calcdlgui.h | ||
6 | 7 | ||
@@ -9,2 +10,3 @@ SOURCES = main.cpp \ | |||
9 | kmolcalc.cpp \ | 10 | kmolcalc.cpp \ |
11 | calcdlgui.cpp \ | ||
10 | kmolelements.cpp | 12 | kmolelements.cpp |