summaryrefslogtreecommitdiff
path: root/noncore/apps/oxygen
Unidiff
Diffstat (limited to 'noncore/apps/oxygen') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/oxygen/calcdlgui.cpp1
-rw-r--r--noncore/apps/oxygen/dataTable.cpp3
-rw-r--r--noncore/apps/oxygen/datawidgetui.cpp5
-rw-r--r--noncore/apps/oxygen/kmolcalc.cpp3
-rw-r--r--noncore/apps/oxygen/oxyframe.cpp2
-rw-r--r--noncore/apps/oxygen/oxygen.cpp2
-rw-r--r--noncore/apps/oxygen/psewidget.cpp2
7 files changed, 0 insertions, 18 deletions
diff --git a/noncore/apps/oxygen/calcdlgui.cpp b/noncore/apps/oxygen/calcdlgui.cpp
index f8dfde5..2bb8337 100644
--- a/noncore/apps/oxygen/calcdlgui.cpp
+++ b/noncore/apps/oxygen/calcdlgui.cpp
@@ -1,41 +1,40 @@
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"
18 17
19#include "calcdlgui.h" 18#include "calcdlgui.h"
20#include "kmolcalc.h" 19#include "kmolcalc.h"
21#include <qlineedit.h> 20#include <qlineedit.h>
22#include <qmultilineedit.h> 21#include <qmultilineedit.h>
23#include <qpushbutton.h> 22#include <qpushbutton.h>
24 23
25calcDlgUI::calcDlgUI() : CalcDlg() 24calcDlgUI::calcDlgUI() : CalcDlg()
26{ 25{
27 kmolcalc = new KMolCalc; 26 kmolcalc = new KMolCalc;
28 connect( calculate, SIGNAL( clicked() ), this, SLOT( calc() ) ); 27 connect( calculate, SIGNAL( clicked() ), this, SLOT( calc() ) );
29 connect( clear_fields, SIGNAL( clicked() ), this, SLOT( clear() ) ); 28 connect( clear_fields, SIGNAL( clicked() ), this, SLOT( clear() ) );
30 result->setReadOnly( true ); 29 result->setReadOnly( true );
31} 30}
32 31
33void calcDlgUI::calc() 32void calcDlgUI::calc()
34{ 33{
35 QString compound( formula->text() ); 34 QString compound( formula->text() );
36 if ( compound.isEmpty() ) { 35 if ( compound.isEmpty() ) {
37 clear(); 36 clear();
38 return; 37 return;
39 } 38 }
40 QString errors( kmolcalc->readFormula( compound ) ); 39 QString errors( kmolcalc->readFormula( compound ) );
41 QString mw, ea; 40 QString mw, ea;
diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp
index e3906be..48e2b20 100644
--- a/noncore/apps/oxygen/dataTable.cpp
+++ b/noncore/apps/oxygen/dataTable.cpp
@@ -1,52 +1,49 @@
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>
22#include <qhbox.h> 21#include <qhbox.h>
23#include <qlabel.h> 22#include <qlabel.h>
24#include <qfont.h>
25#include <qlayout.h> 23#include <qlayout.h>
26#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
27 25
28#include <qstringlist.h>
29 26
30OxydataWidget::OxydataWidget(QWidget *parent, const char *name, const QStringList &list ) : QWidget( parent,name ), names( list ) 27OxydataWidget::OxydataWidget(QWidget *parent, const char *name, const QStringList &list ) : QWidget( parent,name ), names( list )
31{ 28{
32 QGridLayout *qgrid = new QGridLayout( this, 2,1 ); 29 QGridLayout *qgrid = new QGridLayout( this, 2,1 );
33 30
34 QHBox *hbox = new QHBox( this ); 31 QHBox *hbox = new QHBox( this );
35 left = new QLabel( hbox ); 32 left = new QLabel( hbox );
36 middle = new QLabel( hbox ); 33 middle = new QLabel( hbox );
37 right = new QLabel( hbox ); 34 right = new QLabel( hbox );
38 35
39 right->setAlignment( AlignRight ); 36 right->setAlignment( AlignRight );
40 middle->setAlignment( AlignHCenter ); 37 middle->setAlignment( AlignHCenter );
41 38
42 QFont bf; 39 QFont bf;
43 bf.setBold( true ); 40 bf.setBold( true );
44 bf.setPointSize( bf.pointSize()+2 ); 41 bf.setPointSize( bf.pointSize()+2 );
45 middle->setFont( bf ); 42 middle->setFont( bf );
46 43
47 DataTable = new OxydataTable( 9,2, this ); 44 DataTable = new OxydataTable( 9,2, this );
48 setTable(); 45 setTable();
49 46
50 qgrid->addWidget( hbox,0,0 ); 47 qgrid->addWidget( hbox,0,0 );
51 qgrid->addWidget( DataTable,1,0 ); 48 qgrid->addWidget( DataTable,1,0 );
52} 49}
diff --git a/noncore/apps/oxygen/datawidgetui.cpp b/noncore/apps/oxygen/datawidgetui.cpp
index e1d6e41..dcb80e5 100644
--- a/noncore/apps/oxygen/datawidgetui.cpp
+++ b/noncore/apps/oxygen/datawidgetui.cpp
@@ -1,51 +1,46 @@
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 "datawidgetui.h" 18#include "datawidgetui.h"
19#include "dataTable.h" 19#include "dataTable.h"
20 20
21#include <qpe/config.h>
22#include <qstring.h>
23#include <qcombobox.h> 21#include <qcombobox.h>
24#include <qlayout.h> 22#include <qlayout.h>
25#include <qhbox.h>
26#include <qlabel.h>
27#include <qpe/qpeapplication.h>
28 23
29dataWidgetUI::dataWidgetUI(const QStringList &list) : QWidget() 24dataWidgetUI::dataWidgetUI(const QStringList &list) : QWidget()
30{ 25{
31 names = list; 26 names = list;
32 27
33 this->setCaption( tr( "Chemical Data" )); 28 this->setCaption( tr( "Chemical Data" ));
34 QGridLayout *qgrid = new QGridLayout( this, 2,1 ); 29 QGridLayout *qgrid = new QGridLayout( this, 2,1 );
35 30
36 dataCombo = new QComboBox( this ); 31 dataCombo = new QComboBox( this );
37 32
38 //read in all names of the 118 elements 33 //read in all names of the 118 elements
39 int i = 0; 34 int i = 0;
40 for ( QStringList::ConstIterator it = names.begin() ; it != names.end() ; ++it,i++) 35 for ( QStringList::ConstIterator it = names.begin() ; it != names.end() ; ++it,i++)
41 { 36 {
42 dataCombo->insertItem( QString::number( i+1 )+" - "+*it ); 37 dataCombo->insertItem( QString::number( i+1 )+" - "+*it );
43 } 38 }
44 OxydataWidget *oxyDW = new OxydataWidget(this, "OxydataWidget_oxyDW", names); 39 OxydataWidget *oxyDW = new OxydataWidget(this, "OxydataWidget_oxyDW", names);
45 connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) ); 40 connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) );
46 oxyDW->setElement( 0 ); 41 oxyDW->setElement( 0 );
47 oxyDW->setLayout(); 42 oxyDW->setLayout();
48 43
49 qgrid->addWidget( dataCombo, 0,0); 44 qgrid->addWidget( dataCombo, 0,0);
50 qgrid->addWidget( oxyDW , 1,0 ); 45 qgrid->addWidget( oxyDW , 1,0 );
51} 46}
diff --git a/noncore/apps/oxygen/kmolcalc.cpp b/noncore/apps/oxygen/kmolcalc.cpp
index 7a47942..b9f5209 100644
--- a/noncore/apps/oxygen/kmolcalc.cpp
+++ b/noncore/apps/oxygen/kmolcalc.cpp
@@ -1,41 +1,38 @@
1/* 1/*
2 * kmolcalc.cpp 2 * kmolcalc.cpp
3 * 3 *
4 * Copyright (C) 2000,2001 Tomislav Gountchev <tomi@idiom.com> 4 * Copyright (C) 2000,2001 Tomislav Gountchev <tomi@idiom.com>
5 * Copyright (C) 2002 Carsten Niehaus <cniehaus@handhelds.org> 5 * Copyright (C) 2002 Carsten Niehaus <cniehaus@handhelds.org>
6 */ 6 */
7 7
8/** 8/**
9 * KMOLCALC is the calculation engine. It knows about a hashtable of user defined atomic 9 * KMOLCALC is the calculation engine. It knows about a hashtable of user defined atomic
10 * weights and group definitions ELSTABLE, and the currently processed formula, stored 10 * weights and group definitions ELSTABLE, and the currently processed formula, stored
11 * as a list of elements and their coefficients, ELEMENTS. 11 * as a list of elements and their coefficients, ELEMENTS.
12 */ 12 */
13 13
14#include "kmolcalc.h" 14#include "kmolcalc.h"
15#include <qdict.h>
16#include <qdir.h>
17#include <qfile.h>
18#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
19 16
20 17
21/** 18/**
22 * Construct a new calculator object. 19 * Construct a new calculator object.
23 */ 20 */
24KMolCalc::KMolCalc() { 21KMolCalc::KMolCalc() {
25 elements = new ElementList; 22 elements = new ElementList;
26 elstable = NULL; 23 elstable = NULL;
27 readElstable(); 24 readElstable();
28} 25}
29 26
30KMolCalc::~KMolCalc() { 27KMolCalc::~KMolCalc() {
31 delete elements; 28 delete elements;
32} 29}
33 30
34void KMolCalc::readElstable() { 31void KMolCalc::readElstable() {
35 weight = -1; // not calculated yet 32 weight = -1; // not calculated yet
36 if (elstable) delete elstable; 33 if (elstable) delete elstable;
37 elstable = new QDict<SubUnit> (197, TRUE); 34 elstable = new QDict<SubUnit> (197, TRUE);
38 elstable->setAutoDelete(TRUE); 35 elstable->setAutoDelete(TRUE);
39 mwfile = QPEApplication::qpeDir() +"share/oxygen/kmolweights"; 36 mwfile = QPEApplication::qpeDir() +"share/oxygen/kmolweights";
40 QFile f(mwfile); 37 QFile f(mwfile);
41 if (f.exists()) readMwfile(f); 38 if (f.exists()) readMwfile(f);
diff --git a/noncore/apps/oxygen/oxyframe.cpp b/noncore/apps/oxygen/oxyframe.cpp
index 5a4dbbe..8cc520e 100644
--- a/noncore/apps/oxygen/oxyframe.cpp
+++ b/noncore/apps/oxygen/oxyframe.cpp
@@ -1,41 +1,39 @@
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"
18 17
19#include <qpe/config.h>
20#include "oxyframe.h" 18#include "oxyframe.h"
21 19
22OxyFrame::OxyFrame(QWidget *parent, const char *name, QString symbol ) 20OxyFrame::OxyFrame(QWidget *parent, const char *name, QString symbol )
23 : QLabel(parent,name) 21 : QLabel(parent,name)
24{ 22{
25 N = name; 23 N = name;
26 this->setFrameStyle( QFrame::Box ); 24 this->setFrameStyle( QFrame::Box );
27 this->setLineWidth( 0 ); 25 this->setLineWidth( 0 );
28 this->setMidLineWidth( 1 ); 26 this->setMidLineWidth( 1 );
29 this->setFrameShadow( QFrame::Sunken ); 27 this->setFrameShadow( QFrame::Sunken );
30 setMinimumSize(6,6); 28 setMinimumSize(6,6);
31 setScaledContents( true ); 29 setScaledContents( true );
32 QFont font; 30 QFont font;
33 font.setWeight(QFont::Light); 31 font.setWeight(QFont::Light);
34 font.setPixelSize(3); 32 font.setPixelSize(3);
35 setFont( font ); 33 setFont( font );
36 setText( symbol ); 34 setText( symbol );
37} 35}
38 36
39void OxyFrame::mousePressEvent ( QMouseEvent* /*e*/ ){ 37void OxyFrame::mousePressEvent ( QMouseEvent* /*e*/ ){
40 emit num( N ); 38 emit num( N );
41}; 39};
diff --git a/noncore/apps/oxygen/oxygen.cpp b/noncore/apps/oxygen/oxygen.cpp
index 5bdc2aa..5ea97bf 100644
--- a/noncore/apps/oxygen/oxygen.cpp
+++ b/noncore/apps/oxygen/oxygen.cpp
@@ -1,46 +1,44 @@
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 <qapplication.h>
20#include <qtabwidget.h> 19#include <qtabwidget.h>
21 20
22#include "calcdlg.h"
23#include "calcdlgui.h" 21#include "calcdlgui.h"
24#include "datawidgetui.h" 22#include "datawidgetui.h"
25#include "psewidget.h" 23#include "psewidget.h"
26 24
27 25
28Oxygen::Oxygen( QWidget *parent, const char *name, WFlags f) : QMainWindow( parent, name, f ) 26Oxygen::Oxygen( QWidget *parent, const char *name, WFlags f) : QMainWindow( parent, name, f )
29{ 27{
30 loadNames(); 28 loadNames();
31 calcDlgUI *CalcDlgUI = new calcDlgUI(); 29 calcDlgUI *CalcDlgUI = new calcDlgUI();
32 PSEWidget *pse = new PSEWidget(names); 30 PSEWidget *pse = new PSEWidget(names);
33 dataWidgetUI *DataWidgetUI = new dataWidgetUI(names); 31 dataWidgetUI *DataWidgetUI = new dataWidgetUI(names);
34 32
35 setCaption( tr( "Oxygen" ) ); 33 setCaption( tr( "Oxygen" ) );
36 34
37 QTabWidget *tabw = new QTabWidget( this , "qtab" ); 35 QTabWidget *tabw = new QTabWidget( this , "qtab" );
38 tabw->addTab( pse, tr( "PSE" )); 36 tabw->addTab( pse, tr( "PSE" ));
39 tabw->addTab( DataWidgetUI , tr( "Data" ) ); 37 tabw->addTab( DataWidgetUI , tr( "Data" ) );
40 tabw->addTab( CalcDlgUI, tr( "Calculations" ) ); 38 tabw->addTab( CalcDlgUI, tr( "Calculations" ) );
41 setCentralWidget( tabw ); 39 setCentralWidget( tabw );
42} 40}
43 41
44void Oxygen::loadNames() 42void Oxygen::loadNames()
45{ 43{
46 names.clear(); 44 names.clear();
diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp
index be5185b..7f7ae0c 100644
--- a/noncore/apps/oxygen/psewidget.cpp
+++ b/noncore/apps/oxygen/psewidget.cpp
@@ -1,48 +1,46 @@
1/*************************************************************************** 1/***************************************************************************
2 application: : Oxygen 2 application: : Oxygen
3 3
4 begin : September 2002 4 begin : September 2002
5 copyright : ( C ) 2002, 2003 by Carsten Niehaus 5 copyright : ( C ) 2002, 2003 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#include <qlayout.h> 19#include <qlayout.h>
20#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
21#include <qlist.h>
22#include "dataTable.h" 21#include "dataTable.h"
23#include "psewidget.h" 22#include "psewidget.h"
24#include "oxyframe.h"
25 23
26 24
27PSEWidget::PSEWidget(const QStringList &list) : QWidget() 25PSEWidget::PSEWidget(const QStringList &list) : QWidget()
28{ 26{
29 this->setCaption( tr( "Periodic System" ) ); 27 this->setCaption( tr( "Periodic System" ) );
30 28
31 lastElement=1; 29 lastElement=1;
32 names = list; 30 names = list;
33 31
34 QVBoxLayout *vlay = new QVBoxLayout( this ); 32 QVBoxLayout *vlay = new QVBoxLayout( this );
35 33
36 QGridLayout *grid = new QGridLayout( 18,10 ); 34 QGridLayout *grid = new QGridLayout( 18,10 );
37 int h=0, v=0; 35 int h=0, v=0;
38 36
39 Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); 37 Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File );
40 for( int n = 0 ; n < 109 ; n++ ) 38 for( int n = 0 ; n < 109 ; n++ )
41 { 39 {
42 configobj.setGroup( QString::number( n+1 )); 40 configobj.setGroup( QString::number( n+1 ));
43 41
44 position( n+1,h,v ); 42 position( n+1,h,v );
45 PSEframe.append( new OxyFrame( this , QString::number(n), configobj.readEntry( "Symbol" ) ) ); 43 PSEframe.append( new OxyFrame( this , QString::number(n), configobj.readEntry( "Symbol" ) ) );
46 grid->addWidget( PSEframe.current() , v/40+1 , h/40 ); 44 grid->addWidget( PSEframe.current() , v/40+1 , h/40 );
47 PSEframe.current()->setMinimumHeight( 11 ); 45 PSEframe.current()->setMinimumHeight( 11 );
48 PSEframe.current()->setPalette( QPalette( PSEColor( configobj.readEntry( "Block" ) ) ) ); 46 PSEframe.current()->setPalette( QPalette( PSEColor( configobj.readEntry( "Block" ) ) ) );