summaryrefslogtreecommitdiff
path: root/noncore/apps/oxygen/calcdlgui.cpp
Unidiff
Diffstat (limited to 'noncore/apps/oxygen/calcdlgui.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/oxygen/calcdlgui.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/noncore/apps/oxygen/calcdlgui.cpp b/noncore/apps/oxygen/calcdlgui.cpp
index e40e2c7..b6dfff3 100644
--- a/noncore/apps/oxygen/calcdlgui.cpp
+++ b/noncore/apps/oxygen/calcdlgui.cpp
@@ -1,57 +1,65 @@
1/*************************************************************************** 1/***************************************************************************
2 application: : Oxygen
3
4 begin : September 2002
5 copyright : ( C ) 2002 by Carsten Niehaus
6 email : cniehaus@handhelds.org
7 **************************************************************************/
8
9/***************************************************************************
2 * * 10 * *
3 * 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 *
4 * 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 *
5 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
6 * ( at your option ) any later version. * 14 * ( at your option ) any later version. *
7 * * 15 * *
8 **************************************************************************/ 16 **************************************************************************/
9#include "oxygen.h" 17#include "oxygen.h"
10 18
11#include "calcdlgui.h" 19#include "calcdlgui.h"
12#include "kmolcalc.h" 20#include "kmolcalc.h"
13#include <qlineedit.h> 21#include <qlineedit.h>
14#include <qmultilineedit.h> 22#include <qmultilineedit.h>
15#include <qpushbutton.h> 23#include <qpushbutton.h>
16 24
17calcDlgUI::calcDlgUI() : CalcDlg() 25calcDlgUI::calcDlgUI() : CalcDlg()
18{ 26{
19 this->showMaximized(); 27 this->showMaximized();
20 kmolcalc = new KMolCalc; 28 kmolcalc = new KMolCalc;
21 connect( calculate, SIGNAL( clicked() ), this, SLOT( calc() ) ); 29 connect( calculate, SIGNAL( clicked() ), this, SLOT( calc() ) );
22 connect( clear_fields, SIGNAL( clicked() ), this, SLOT( clear() ) ); 30 connect( clear_fields, SIGNAL( clicked() ), this, SLOT( clear() ) );
23 result->setReadOnly( true ); 31 result->setReadOnly( true );
24} 32}
25 33
26void calcDlgUI::calc() 34void calcDlgUI::calc()
27{ 35{
28 QString compound( formula->text() ); 36 QString compound( formula->text() );
29 if ( compound.isEmpty() ) { 37 if ( compound.isEmpty() ) {
30 clear(); 38 clear();
31 return; 39 return;
32 } 40 }
33 QString errors( kmolcalc->readFormula( compound ) ); 41 QString errors( kmolcalc->readFormula( compound ) );
34 QString mw, ea; 42 QString mw, ea;
35 double weight = kmolcalc->getWeight(); 43 double weight = kmolcalc->getWeight();
36 if ( errors == "OK" ) { 44 if ( errors == "OK" ) {
37 mw.setNum( weight ); 45 mw.setNum( weight );
38 ea = kmolcalc->getEmpFormula() + " :\n" + kmolcalc->getEA(); 46 ea = kmolcalc->getEmpFormula() + " :\n" + kmolcalc->getEA();
39 } else { 47 } else {
40 mw = "???"; 48 mw = "???";
41 ea = tr( "ERROR: \n" ) + errors + "\n"; 49 ea = tr( "ERROR: \n" ) + errors + "\n";
42 } 50 }
43 result->setText( mw ); 51 result->setText( mw );
44 anal_display->setText( ea ); 52 anal_display->setText( ea );
45} 53}
46 54
47/** 55/**
48 * * Clear all text entry / result fields. 56 * * Clear all text entry / result fields.
49 * */ 57 * */
50void calcDlgUI::clear() 58void calcDlgUI::clear()
51{ 59{
52 formula->clear(); 60 formula->clear();
53 result->clear(); 61 result->clear();
54 anal_display->clear(); 62 anal_display->clear();
55} 63}
56 64
57 65