summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/oxygen/datawidgetui.cpp120
-rw-r--r--noncore/apps/oxygen/datawidgetui.h6
-rw-r--r--noncore/apps/oxygen/oxyframe.cpp2
-rw-r--r--noncore/apps/oxygen/oxygen.cpp119
-rw-r--r--noncore/apps/oxygen/oxygen.h3
-rw-r--r--noncore/apps/oxygen/psewidget.cpp5
-rw-r--r--noncore/apps/oxygen/psewidget.h5
7 files changed, 132 insertions, 128 deletions
diff --git a/noncore/apps/oxygen/datawidgetui.cpp b/noncore/apps/oxygen/datawidgetui.cpp
index 91d669f..e1d6e41 100644
--- a/noncore/apps/oxygen/datawidgetui.cpp
+++ b/noncore/apps/oxygen/datawidgetui.cpp
@@ -1,169 +1,53 @@
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> 21#include <qpe/config.h>
22#include <qstring.h> 22#include <qstring.h>
23#include <qcombobox.h> 23#include <qcombobox.h>
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qhbox.h> 25#include <qhbox.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28 28
29dataWidgetUI::dataWidgetUI() : QWidget() 29dataWidgetUI::dataWidgetUI(const QStringList &list) : QWidget()
30{ 30{
31 31 names = list;
32 names = 0;
33 loadNames();
34 32
35 this->setCaption( tr( "Chemical Data" )); 33 this->setCaption( tr( "Chemical Data" ));
36 QGridLayout *qgrid = new QGridLayout( this, 2,1 ); 34 QGridLayout *qgrid = new QGridLayout( this, 2,1 );
37 35
38 dataCombo = new QComboBox( this ); 36 dataCombo = new QComboBox( this );
39 37
40 //read in all names of the 118 elements 38 //read in all names of the 118 elements
41 int i = 0; 39 int i = 0;
42 for ( QStringList::ConstIterator it = names.begin() ; it != names.end() ; ++it,i++) 40 for ( QStringList::ConstIterator it = names.begin() ; it != names.end() ; ++it,i++)
43 { 41 {
44 dataCombo->insertItem( QString::number( i+1 )+" - "+*it ); 42 dataCombo->insertItem( QString::number( i+1 )+" - "+*it );
45 } 43 }
46 QStringList::ConstIterator it = names.begin();
47 OxydataWidget *oxyDW = new OxydataWidget(this, "OxydataWidget_oxyDW", names); 44 OxydataWidget *oxyDW = new OxydataWidget(this, "OxydataWidget_oxyDW", names);
48 connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) ); 45 connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) );
49 oxyDW->setElement( 0 ); 46 oxyDW->setElement( 0 );
50 oxyDW->setLayout(); 47 oxyDW->setLayout();
51 48
52 qgrid->addWidget( dataCombo, 0,0); 49 qgrid->addWidget( dataCombo, 0,0);
53 qgrid->addWidget( oxyDW , 1,0 ); 50 qgrid->addWidget( oxyDW , 1,0 );
54} 51}
55 52
56void dataWidgetUI::loadNames()
57{
58 names.clear();
59 names.append( tr("Hydrogen") );
60 names.append( tr("Helium") );
61 names.append( tr("Lithium") );
62 names.append( tr("Beryllium") );
63 names.append( tr("Boron") );
64 names.append( tr("Carbon") );
65 names.append( tr("Nitrogen") );
66 names.append( tr("Oxygen") );
67 names.append( tr("Fluorine") );
68 names.append( tr("Neon") );
69 names.append( tr("Sodium") );
70 names.append( tr("Magnesium") );
71 names.append( tr("Aluminum") );
72 names.append( tr("Silicon") );
73 names.append( tr("Phosphorus") );
74 names.append( tr("Sulfur") );
75 names.append( tr("Chlorine") );
76 names.append( tr("Argon") );
77 names.append( tr("Potassium") );
78 names.append( tr("Calcium") );
79 names.append( tr("Scandium") );
80 names.append( tr("Titanium") );
81 names.append( tr("Vanadium") );
82 names.append( tr("Chromium") );
83 names.append( tr("Manganese") );
84 names.append( tr("Iron") );
85 names.append( tr("Cobalt") );
86 names.append( tr("Nickel") );
87 names.append( tr("Copper") );
88 names.append( tr("Zinc") );
89 names.append( tr("Gallium") );
90 names.append( tr("Germanium") );
91 names.append( tr("Arsenic") );
92 names.append( tr("Selenium") );
93 names.append( tr("Bromine") );
94 names.append( tr("Krypton") );
95 names.append( tr("Rubidium") );
96 names.append( tr("Strontium") );
97 names.append( tr("Yttrium") );
98 names.append( tr("Zirconium") );
99 names.append( tr("Niobium") );
100 names.append( tr("Molybdenum") );
101 names.append( tr("Technetium") );
102 names.append( tr("Ruthenium") );
103 names.append( tr("Rhodium") );
104 names.append( tr("Palladium") );
105 names.append( tr("Silver") );
106 names.append( tr("Cadmium") );
107 names.append( tr("Indium") );
108 names.append( tr("Tin") );
109 names.append( tr("Antimony") );
110 names.append( tr("Tellurium") );
111 names.append( tr("Iodine") );
112 names.append( tr("Xenon") );
113 names.append( tr("Cesium") );
114 names.append( tr("Barium") );
115 names.append( tr("Lanthanum") );
116 names.append( tr("Cerium") );
117 names.append( tr("Praseodymium") );
118 names.append( tr("Neodymium") );
119 names.append( tr("Promethium") );
120 names.append( tr("Samarium") );
121 names.append( tr("Europium") );
122 names.append( tr("Gadolinium") );
123 names.append( tr("Terbium") );
124 names.append( tr("Dysprosium") );
125 names.append( tr("Holmium") );
126 names.append( tr("Erbium") );
127 names.append( tr("Thulium") );
128 names.append( tr("Ytterbium") );
129 names.append( tr("Lutetium") );
130 names.append( tr("Hafnium") );
131 names.append( tr("Tantalum") );
132 names.append( tr("Tungsten") );
133 names.append( tr("Rhenium") );
134 names.append( tr("Osmium") );
135 names.append( tr("Iridium") );
136 names.append( tr("Platinum") );
137 names.append( tr("Gold") );
138 names.append( tr("Mercury") );
139 names.append( tr("Thallium") );
140 names.append( tr("Lead") );
141 names.append( tr("Bismuth") );
142 names.append( tr("Polonium") );
143 names.append( tr("Astatine") );
144 names.append( tr("Radon") );
145 names.append( tr("Francium") );
146 names.append( tr("Radium") );
147 names.append( tr("Actinium") );
148 names.append( tr("Thorium") );
149 names.append( tr("Protactinium") );
150 names.append( tr("Uranium") );
151 names.append( tr("Neptunium") );
152 names.append( tr("Plutonium") );
153 names.append( tr("Americium") );
154 names.append( tr("Curium") );
155 names.append( tr("Berkelium") );
156 names.append( tr("Californium") );
157 names.append( tr("Einsteinium") );
158 names.append( tr("Fermium") );
159 names.append( tr("Mendelevium") );
160 names.append( tr("Nobelium") );
161 names.append( tr("Lawrencium") );
162 names.append( tr("Rutherfordium") );
163 names.append( tr("Dubnium") );
164 names.append( tr("Seaborgium") );
165 names.append( tr("Bohrium") );
166 names.append( tr("Hassium") );
167 names.append( tr("Meitnerium") );
168}
169 53
diff --git a/noncore/apps/oxygen/datawidgetui.h b/noncore/apps/oxygen/datawidgetui.h
index a2b48fa..3797418 100644
--- a/noncore/apps/oxygen/datawidgetui.h
+++ b/noncore/apps/oxygen/datawidgetui.h
@@ -1,46 +1,44 @@
1#ifndef DATAWIDGETUI_H 1#ifndef DATAWIDGETUI_H
2#define DATAWIDGETUI_H 2#define DATAWIDGETUI_H
3 3
4 4
5/*************************************************************************** 5/***************************************************************************
6 application: : Oxygen 6 application: : Oxygen
7 7
8 begin : September 2002 8 begin : September 2002
9 copyright : ( C ) 2002 by Carsten Niehaus 9 copyright : ( C ) 2002 by Carsten Niehaus
10 email : cniehaus@handhelds.org 10 email : cniehaus@handhelds.org
11 **************************************************************************/ 11 **************************************************************************/
12 12
13/*************************************************************************** 13/***************************************************************************
14 * * 14 * *
15 * This program is free software; you can redistribute it and/or modify * 15 * This program is free software; you can redistribute it and/or modify *
16 * it under the terms of the GNU General Public License as published by * 16 * it under the terms of the GNU General Public License as published by *
17 * the Free Software Foundation; either version 2 of the License, or * 17 * the Free Software Foundation; either version 2 of the License, or *
18 * ( at your option ) any later version. * 18 * ( at your option ) any later version. *
19 * * 19 * *
20 **************************************************************************/ 20 **************************************************************************/
21 21
22 22
23class OxydataWidget; 23class OxydataWidget;
24class OxydataTable; 24class OxydataTable;
25 25
26class QComboBox; 26class QComboBox;
27class QStringList; 27class QStringList;
28 28
29#include <qwidget.h> 29#include <qwidget.h>
30 30
31class dataWidgetUI : public QWidget 31class dataWidgetUI : public QWidget
32{ 32{
33 Q_OBJECT 33 Q_OBJECT
34 34
35 public: 35 public:
36 dataWidgetUI(); 36 dataWidgetUI(const QStringList &list=0);
37 QStringList names;
38 37
39 private: 38 private:
40 OxydataTable *DataTable; 39 OxydataTable *DataTable;
41 QComboBox *dataCombo; 40 QComboBox *dataCombo;
42 OxydataWidget *oxyDW; 41 OxydataWidget *oxyDW;
43 42 QStringList names;
44 void loadNames();
45}; 43};
46#endif 44#endif
diff --git a/noncore/apps/oxygen/oxyframe.cpp b/noncore/apps/oxygen/oxyframe.cpp
index 2ce40e7..5a4dbbe 100644
--- a/noncore/apps/oxygen/oxyframe.cpp
+++ b/noncore/apps/oxygen/oxyframe.cpp
@@ -1,41 +1,41 @@
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 <qpe/config.h> 19#include <qpe/config.h>
20#include "oxyframe.h" 20#include "oxyframe.h"
21 21
22OxyFrame::OxyFrame(QWidget *parent, const char *name, QString symbol ) 22OxyFrame::OxyFrame(QWidget *parent, const char *name, QString symbol )
23 : QLabel(parent,name) 23 : QLabel(parent,name)
24{ 24{
25 N = name; 25 N = name;
26 this->setFrameStyle( QFrame::Box ); 26 this->setFrameStyle( QFrame::Box );
27 this->setLineWidth( 0 ); 27 this->setLineWidth( 0 );
28 this->setMidLineWidth( 1 ); 28 this->setMidLineWidth( 1 );
29 this->setFrameShadow( QFrame::Sunken ); 29 this->setFrameShadow( QFrame::Sunken );
30 setMinimumSize(6,6); 30 setMinimumSize(6,6);
31 setScaledContents( true ); 31 setScaledContents( true );
32 QFont font; 32 QFont font;
33 font.setWeight(QFont::Light); 33 font.setWeight(QFont::Light);
34 font.setPixelSize(3); 34 font.setPixelSize(3);
35 setFont( font ); 35 setFont( font );
36 setText( symbol ); 36 setText( symbol );
37} 37}
38 38
39void OxyFrame::mousePressEvent ( QMouseEvent * e ){ 39void OxyFrame::mousePressEvent ( QMouseEvent* /*e*/ ){
40 emit num( N ); 40 emit num( N );
41}; 41};
diff --git a/noncore/apps/oxygen/oxygen.cpp b/noncore/apps/oxygen/oxygen.cpp
index 22d1833..215cc19 100644
--- a/noncore/apps/oxygen/oxygen.cpp
+++ b/noncore/apps/oxygen/oxygen.cpp
@@ -1,42 +1,157 @@
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> 19#include <qapplication.h>
20#include <qtabwidget.h> 20#include <qtabwidget.h>
21 21
22#include "calcdlg.h" 22#include "calcdlg.h"
23#include "calcdlgui.h" 23#include "calcdlgui.h"
24#include "datawidgetui.h" 24#include "datawidgetui.h"
25#include "psewidget.h" 25#include "psewidget.h"
26 26
27 27
28Oxygen::Oxygen() : QMainWindow() 28Oxygen::Oxygen() : QMainWindow()
29{ 29{
30 PSEWidget *pse = new PSEWidget(); 30 loadNames();
31 calcDlgUI *CalcDlgUI = new calcDlgUI(); 31 calcDlgUI *CalcDlgUI = new calcDlgUI();
32 dataWidgetUI *DataWidgetUI = new dataWidgetUI(); 32 PSEWidget *pse = new PSEWidget(names);
33 dataWidgetUI *DataWidgetUI = new dataWidgetUI(names);
33 34
34 this->setCaption( tr( "Oxygen" ) ); 35 this->setCaption( tr( "Oxygen" ) );
35 36
36 QTabWidget *tabw = new QTabWidget( this , "qtab" ); 37 QTabWidget *tabw = new QTabWidget( this , "qtab" );
37 tabw->addTab( pse, tr( "PSE" )); 38 tabw->addTab( pse, tr( "PSE" ));
38 tabw->addTab( DataWidgetUI , tr( "Data" ) ); 39 tabw->addTab( DataWidgetUI , tr( "Data" ) );
39 tabw->addTab( CalcDlgUI, tr( "Calculations" ) ); 40 tabw->addTab( CalcDlgUI, tr( "Calculations" ) );
40 setCentralWidget( tabw ); 41 setCentralWidget( tabw );
41} 42}
42 43
44void Oxygen::loadNames()
45{
46 names.clear();
47 names.append( tr("Hydrogen") );
48 names.append( tr("Helium") );
49 names.append( tr("Lithium") );
50 names.append( tr("Beryllium") );
51 names.append( tr("Boron") );
52 names.append( tr("Carbon") );
53 names.append( tr("Nitrogen") );
54 names.append( tr("Oxygen") );
55 names.append( tr("Fluorine") );
56 names.append( tr("Neon") );
57 names.append( tr("Sodium") );
58 names.append( tr("Magnesium") );
59 names.append( tr("Aluminum") );
60 names.append( tr("Silicon") );
61 names.append( tr("Phosphorus") );
62 names.append( tr("Sulfur") );
63 names.append( tr("Chlorine") );
64 names.append( tr("Argon") );
65 names.append( tr("Potassium") );
66 names.append( tr("Calcium") );
67 names.append( tr("Scandium") );
68 names.append( tr("Titanium") );
69 names.append( tr("Vanadium") );
70 names.append( tr("Chromium") );
71 names.append( tr("Manganese") );
72 names.append( tr("Iron") );
73 names.append( tr("Cobalt") );
74 names.append( tr("Nickel") );
75 names.append( tr("Copper") );
76 names.append( tr("Zinc") );
77 names.append( tr("Gallium") );
78 names.append( tr("Germanium") );
79 names.append( tr("Arsenic") );
80 names.append( tr("Selenium") );
81 names.append( tr("Bromine") );
82 names.append( tr("Krypton") );
83 names.append( tr("Rubidium") );
84 names.append( tr("Strontium") );
85 names.append( tr("Yttrium") );
86 names.append( tr("Zirconium") );
87 names.append( tr("Niobium") );
88 names.append( tr("Molybdenum") );
89 names.append( tr("Technetium") );
90 names.append( tr("Ruthenium") );
91 names.append( tr("Rhodium") );
92 names.append( tr("Palladium") );
93 names.append( tr("Silver") );
94 names.append( tr("Cadmium") );
95 names.append( tr("Indium") );
96 names.append( tr("Tin") );
97 names.append( tr("Antimony") );
98 names.append( tr("Tellurium") );
99 names.append( tr("Iodine") );
100 names.append( tr("Xenon") );
101 names.append( tr("Cesium") );
102 names.append( tr("Barium") );
103 names.append( tr("Lanthanum") );
104 names.append( tr("Cerium") );
105 names.append( tr("Praseodymium") );
106 names.append( tr("Neodymium") );
107 names.append( tr("Promethium") );
108 names.append( tr("Samarium") );
109 names.append( tr("Europium") );
110 names.append( tr("Gadolinium") );
111 names.append( tr("Terbium") );
112 names.append( tr("Dysprosium") );
113 names.append( tr("Holmium") );
114 names.append( tr("Erbium") );
115 names.append( tr("Thulium") );
116 names.append( tr("Ytterbium") );
117 names.append( tr("Lutetium") );
118 names.append( tr("Hafnium") );
119 names.append( tr("Tantalum") );
120 names.append( tr("Tungsten") );
121 names.append( tr("Rhenium") );
122 names.append( tr("Osmium") );
123 names.append( tr("Iridium") );
124 names.append( tr("Platinum") );
125 names.append( tr("Gold") );
126 names.append( tr("Mercury") );
127 names.append( tr("Thallium") );
128 names.append( tr("Lead") );
129 names.append( tr("Bismuth") );
130 names.append( tr("Polonium") );
131 names.append( tr("Astatine") );
132 names.append( tr("Radon") );
133 names.append( tr("Francium") );
134 names.append( tr("Radium") );
135 names.append( tr("Actinium") );
136 names.append( tr("Thorium") );
137 names.append( tr("Protactinium") );
138 names.append( tr("Uranium") );
139 names.append( tr("Neptunium") );
140 names.append( tr("Plutonium") );
141 names.append( tr("Americium") );
142 names.append( tr("Curium") );
143 names.append( tr("Berkelium") );
144 names.append( tr("Californium") );
145 names.append( tr("Einsteinium") );
146 names.append( tr("Fermium") );
147 names.append( tr("Mendelevium") );
148 names.append( tr("Nobelium") );
149 names.append( tr("Lawrencium") );
150 names.append( tr("Rutherfordium") );
151 names.append( tr("Dubnium") );
152 names.append( tr("Seaborgium") );
153 names.append( tr("Bohrium") );
154 names.append( tr("Hassium") );
155 names.append( tr("Meitnerium") );
156}
157
diff --git a/noncore/apps/oxygen/oxygen.h b/noncore/apps/oxygen/oxygen.h
index 36ee9bc..57fe9fe 100644
--- a/noncore/apps/oxygen/oxygen.h
+++ b/noncore/apps/oxygen/oxygen.h
@@ -1,21 +1,24 @@
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
10class QStringList;
11
10#include <qmainwindow.h> 12#include <qmainwindow.h>
11 13
12class Oxygen : public QMainWindow 14class Oxygen : public QMainWindow
13{ 15{
14 Q_OBJECT 16 Q_OBJECT
15 17
16 public: 18 public:
17 Oxygen(); 19 Oxygen();
18 20
19 private: 21 private:
20 void loadNames(); 22 void loadNames();
23 QStringList names;
21}; 24};
diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp
index d8e4086..b396046 100644
--- a/noncore/apps/oxygen/psewidget.cpp
+++ b/noncore/apps/oxygen/psewidget.cpp
@@ -1,197 +1,198 @@
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#include <qlayout.h> 19#include <qlayout.h>
20#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
21#include <qlist.h> 21#include <qlist.h>
22#include "dataTable.h" 22#include "dataTable.h"
23#include "psewidget.h" 23#include "psewidget.h"
24#include "oxyframe.h" 24#include "oxyframe.h"
25 25
26 26
27PSEWidget::PSEWidget() : QWidget() 27PSEWidget::PSEWidget(const QStringList &list) : QWidget()
28{ 28{
29 this->setCaption( tr( "Periodic System" ) ); 29 this->setCaption( tr( "Periodic System" ) );
30 30
31 lastElement=1; 31 lastElement=1;
32 names = list;
32 33
33 QVBoxLayout *vlay = new QVBoxLayout( this ); 34 QVBoxLayout *vlay = new QVBoxLayout( this );
34 35
35 QGridLayout *grid = new QGridLayout( 18,10 ); 36 QGridLayout *grid = new QGridLayout( 18,10 );
36 int h=0, v=0; 37 int h=0, v=0;
37 38
38 Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); 39 Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File );
39 for( int n = 0 ; n < 109 ; n++ ) 40 for( int n = 0 ; n < 109 ; n++ )
40 { 41 {
41 configobj.setGroup( QString::number( n+1 )); 42 configobj.setGroup( QString::number( n+1 ));
42 43
43 position( n+1,h,v ); 44 position( n+1,h,v );
44 PSEframe.append( new OxyFrame( this , QString::number(n), configobj.readEntry( "Symbol" ) ) ); 45 PSEframe.append( new OxyFrame( this , QString::number(n), configobj.readEntry( "Symbol" ) ) );
45 grid->addWidget( PSEframe.current() , v/40+1 , h/40 ); 46 grid->addWidget( PSEframe.current() , v/40+1 , h/40 );
46 PSEframe.current()->setMinimumHeight( 11 ); 47 PSEframe.current()->setMinimumHeight( 11 );
47 PSEframe.current()->setPalette( QPalette( PSEColor( configobj.readEntry( "Block" ) ) ) ); 48 PSEframe.current()->setPalette( QPalette( PSEColor( configobj.readEntry( "Block" ) ) ) );
48 connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( slotShowElement(QString) )); 49 connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( slotShowElement(QString) ));
49 connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( inverseColor(QString) )); 50 connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( inverseColor(QString) ));
50 } 51 }
51 52
52 oxyDW = new OxydataWidget(this); 53 oxyDW = new OxydataWidget(this, "PSEWidget_oxyDW", names);
53 oxyDW->setElement( 0 ); 54 oxyDW->setElement( 0 );
54 oxyDW->setLayout(); 55 oxyDW->setLayout();
55 56
56 vlay->addLayout( grid ); 57 vlay->addLayout( grid );
57 vlay->addWidget( oxyDW ); 58 vlay->addWidget( oxyDW );
58} 59}
59 60
60QColor PSEWidget::PSEColor( QString block ) 61QColor PSEWidget::PSEColor( QString block )
61{ 62{
62 QColor c; 63 QColor c;
63 if ( block == "s" ) c.setRgb( 213 , 233 , 231 ); 64 if ( block == "s" ) c.setRgb( 213 , 233 , 231 );
64 else if ( block == "d" ) c.setRgb( 200,230,160 ); 65 else if ( block == "d" ) c.setRgb( 200,230,160 );
65 else if ( block == "p" ) c.setRgb( 238,146,138 ); 66 else if ( block == "p" ) c.setRgb( 238,146,138 );
66 else if ( block == "f" ) c.setRgb( 190 , 190 , 190 ); 67 else if ( block == "f" ) c.setRgb( 190 , 190 , 190 );
67 return c; 68 return c;
68}; 69};
69 70
70void PSEWidget::inverseColor( QString number) 71void PSEWidget::inverseColor( QString number)
71{ 72{
72 Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); 73 Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File );
73 configobj.setGroup( number ); 74 configobj.setGroup( number );
74 QString block = configobj.readEntry( "Block" ); 75 QString block = configobj.readEntry( "Block" );
75 QColor c, d; 76 QColor c, d;
76 c = PSEColor( block ); 77 c = PSEColor( block );
77 d = c.dark(); 78 d = c.dark();
78 79
79 PSEframe.at( number.toUInt() )->setPalette( QPalette( d ) ); 80 PSEframe.at( number.toUInt() )->setPalette( QPalette( d ) );
80 81
81 configobj.setGroup( QString::number( lastElement+1 ) ); 82 configobj.setGroup( QString::number( lastElement+1 ) );
82 block = configobj.readEntry( "Block" ); 83 block = configobj.readEntry( "Block" );
83 c = PSEColor( block ); 84 c = PSEColor( block );
84 PSEframe.at( lastElement )->setPalette( QPalette( c ) ); 85 PSEframe.at( lastElement )->setPalette( QPalette( c ) );
85 86
86 lastElement=number.toInt(); 87 lastElement=number.toInt();
87} 88}
88 89
89void PSEWidget::slotShowElement(QString number) 90void PSEWidget::slotShowElement(QString number)
90{ 91{
91 oxyDW->setElement( number.toInt() ); 92 oxyDW->setElement( number.toInt() );
92}; 93};
93 94
94void PSEWidget::position(int n, int& h, int& v) 95void PSEWidget::position(int n, int& h, int& v)
95{ 96{
96 //Hydrogen 97 //Hydrogen
97 if (n == 1) 98 if (n == 1)
98 { 99 {
99 h=0; v=0; 100 h=0; v=0;
100 } 101 }
101 102
102 103
103 //Helium 104 //Helium
104 if (n == 2) 105 if (n == 2)
105 { 106 {
106 h=680; v=0; 107 h=680; v=0;
107 } 108 }
108 109
109 110
110 //Lithium 111 //Lithium
111 if (n == 3) 112 if (n == 3)
112 { 113 {
113 h=0; v=40; 114 h=0; v=40;
114 } 115 }
115 116
116 117
117 //Beryllium 118 //Beryllium
118 if (n == 4) 119 if (n == 4)
119 { 120 {
120 h=40; v=40; 121 h=40; v=40;
121 } 122 }
122 123
123 124
124 //Boron-->Neon or Aluminum --> Argon 125 //Boron-->Neon or Aluminum --> Argon
125 if ((n >= 5 && n <= 10) || (n >= 13 && n <= 18)) 126 if ((n >= 5 && n <= 10) || (n >= 13 && n <= 18))
126 for (int i = 1; i <= (6-(10-n)); i++) 127 for (int i = 1; i <= (6-(10-n)); i++)
127 { 128 {
128 h=((i*40)+440); 129 h=((i*40)+440);
129 v = 40; 130 v = 40;
130 if (n >= 13) 131 if (n >= 13)
131 { 132 {
132 v=80; 133 v=80;
133 h=(h-320); 134 h=(h-320);
134 } 135 }
135 } 136 }
136 137
137 138
138 //Sodium 139 //Sodium
139 if (n == 11) 140 if (n == 11)
140 { 141 {
141 h=0; v=80; 142 h=0; v=80;
142 } 143 }
143 144
144 145
145 //Magnesium 146 //Magnesium
146 if (n == 12) 147 if (n == 12)
147 { 148 {
148 h=40; v=80; 149 h=40; v=80;
149 } 150 }
150 151
151 152
152 //Potassium --> Uuo without La and Ac 153 //Potassium --> Uuo without La and Ac
153 if ((n >= 19 && n <= 56) || (n >= 72 && n <= 88) || n >= 104) 154 if ((n >= 19 && n <= 56) || (n >= 72 && n <= 88) || n >= 104)
154 for (int i = 1; i <= 18; i++) 155 for (int i = 1; i <= 18; i++)
155 { 156 {
156 int f = n; 157 int f = n;
157 if (n > 18) 158 if (n > 18)
158 f = n-18; 159 f = n-18;
159 if (n > 36) 160 if (n > 36)
160 f = n-36; 161 f = n-36;
161 if (n > 54) 162 if (n > 54)
162 f = n-54; 163 f = n-54;
163 if (n > 71) 164 if (n > 71)
164 f = n-68; 165 f = n-68;
165 if (n > 86) 166 if (n > 86)
166 f = n-86; 167 f = n-86;
167 if (n > 103) 168 if (n > 103)
168 f = n-100; 169 f = n-100;
169 170
170 h=((f*40)-40); 171 h=((f*40)-40);
171 172
172 v = 120; 173 v = 120;
173 if (n >= 37) 174 if (n >= 37)
174 v=160; 175 v=160;
175 if (n >= 55) 176 if (n >= 55)
176 v=200; 177 v=200;
177 if (n >= 87) 178 if (n >= 87)
178 v=240; 179 v=240;
179 } 180 }
180 181
181 182
182 //Lanthanum --> Lutetium and Actinum --> Lawrencium 183 //Lanthanum --> Lutetium and Actinum --> Lawrencium
183 if ((n >= 57 && n <= 71) || (n >= 89 && n <= 103)) 184 if ((n >= 57 && n <= 71) || (n >= 89 && n <= 103))
184 for (int i = 1; i <= 14; i++) 185 for (int i = 1; i <= 14; i++)
185 { 186 {
186 int f = n; 187 int f = n;
187 if (n > 56) 188 if (n > 56)
188 f = n-55; 189 f = n-55;
189 if (n > 88) 190 if (n > 88)
190 f = n-87; 191 f = n-87;
191 h=(f*40); 192 h=(f*40);
192 v = 290; 193 v = 290;
193 if (n >= 89) 194 if (n >= 89)
194 v=330; 195 v=330;
195 } 196 }
196 v += 10; 197 v += 10;
197} 198}
diff --git a/noncore/apps/oxygen/psewidget.h b/noncore/apps/oxygen/psewidget.h
index ddeab9d..42a2e38 100644
--- a/noncore/apps/oxygen/psewidget.h
+++ b/noncore/apps/oxygen/psewidget.h
@@ -1,53 +1,56 @@
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#ifndef _PSEWIDGET_H 17#ifndef _PSEWIDGET_H
18#define _PSEWIDGET_H 18#define _PSEWIDGET_H
19 19
20#include <qwidget.h> 20#include <qwidget.h>
21#include <qlist.h> 21#include <qlist.h>
22#include "oxyframe.h" 22#include "oxyframe.h"
23 23
24class QGridLayout; 24class QGridLayout;
25class QStringList;
26
25class OxydataWidget; 27class OxydataWidget;
26class PSEframe; 28class PSEframe;
27 29
28class PSEWidget : public QWidget 30class PSEWidget : public QWidget
29{ 31{
30 Q_OBJECT 32 Q_OBJECT
31 33
32 public: 34 public:
33 PSEWidget(); 35 PSEWidget(const QStringList &list=0);
34 QGridLayout *bottom_grid; 36 QGridLayout *bottom_grid;
35 OxydataWidget *oxyDW; 37 OxydataWidget *oxyDW;
36 38
37 QList<OxyFrame> PSEframe; 39 QList<OxyFrame> PSEframe;
38 40
39 int lastElement; 41 int lastElement;
40 42
41 private: 43 private:
42 QGridLayout *maingrid; 44 QGridLayout *maingrid;
43 45
44 void position( int, int&, int& ); 46 void position( int, int&, int& );
45 QColor PSEColor( QString ); 47 QColor PSEColor( QString );
48 QStringList names;
46 49
47 public slots: 50 public slots:
48 void slotShowElement(QString); 51 void slotShowElement(QString);
49 void inverseColor( QString ); 52 void inverseColor( QString );
50 53
51}; 54};
52 55
53#endif 56#endif