Diffstat (limited to 'noncore/apps/checkbook/calcdlgui.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/checkbook/calcdlgui.cpp | 69 |
1 files changed, 36 insertions, 33 deletions
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 | ||