summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/oxygen/calcdlg.ui4
-rw-r--r--noncore/apps/oxygen/dataTable.cpp10
-rw-r--r--noncore/apps/oxygen/dataTable.h3
-rw-r--r--noncore/apps/oxygen/datawidgetui.cpp1
-rw-r--r--noncore/apps/oxygen/psewidget.cpp1
5 files changed, 15 insertions, 4 deletions
diff --git a/noncore/apps/oxygen/calcdlg.ui b/noncore/apps/oxygen/calcdlg.ui
index a8ed170..c817a47 100644
--- a/noncore/apps/oxygen/calcdlg.ui
+++ b/noncore/apps/oxygen/calcdlg.ui
@@ -1,127 +1,127 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>CalcDlg</class> 2<class>CalcDlg</class>
3<widget> 3<widget>
4 <class>QWidget</class> 4 <class>QWidget</class>
5 <property stdset="1"> 5 <property stdset="1">
6 <name>name</name> 6 <name>name</name>
7 <cstring>CalcDlg</cstring> 7 <cstring>CalcDlg</cstring>
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>241</width> 14 <width>237</width>
15 <height>318</height> 15 <height>318</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>Form1</string> 20 <string>Form1</string>
21 </property> 21 </property>
22 <widget> 22 <widget>
23 <class>QTabWidget</class> 23 <class>QTabWidget</class>
24 <property stdset="1"> 24 <property stdset="1">
25 <name>name</name> 25 <name>name</name>
26 <cstring>TabWidget3</cstring> 26 <cstring>TabWidget3</cstring>
27 </property> 27 </property>
28 <property stdset="1"> 28 <property stdset="1">
29 <name>geometry</name> 29 <name>geometry</name>
30 <rect> 30 <rect>
31 <x>0</x> 31 <x>0</x>
32 <y>0</y> 32 <y>0</y>
33 <width>240</width> 33 <width>240</width>
34 <height>320</height> 34 <height>320</height>
35 </rect> 35 </rect>
36 </property> 36 </property>
37 <widget> 37 <widget>
38 <class>QWidget</class> 38 <class>QWidget</class>
39 <property stdset="1"> 39 <property stdset="1">
40 <name>name</name> 40 <name>name</name>
41 <cstring>tab</cstring> 41 <cstring>tab</cstring>
42 </property> 42 </property>
43 <attribute> 43 <attribute>
44 <name>title</name> 44 <name>title</name>
45 <string>Molecular Weight</string> 45 <string>Molecular Weight</string>
46 </attribute> 46 </attribute>
47 <widget> 47 <widget>
48 <class>QLayoutWidget</class> 48 <class>QLayoutWidget</class>
49 <property stdset="1"> 49 <property stdset="1">
50 <name>name</name> 50 <name>name</name>
51 <cstring>Layout6</cstring> 51 <cstring>Layout6</cstring>
52 </property> 52 </property>
53 <property stdset="1"> 53 <property stdset="1">
54 <name>geometry</name> 54 <name>geometry</name>
55 <rect> 55 <rect>
56 <x>0</x> 56 <x>0</x>
57 <y>0</y> 57 <y>0</y>
58 <width>230</width> 58 <width>230</width>
59 <height>290</height> 59 <height>290</height>
60 </rect> 60 </rect>
61 </property> 61 </property>
62 <vbox> 62 <vbox>
63 <property stdset="1"> 63 <property stdset="1">
64 <name>margin</name> 64 <name>margin</name>
65 <number>0</number> 65 <number>0</number>
66 </property> 66 </property>
67 <property stdset="1"> 67 <property stdset="1">
68 <name>spacing</name> 68 <name>spacing</name>
69 <number>6</number> 69 <number>6</number>
70 </property> 70 </property>
71 <widget> 71 <widget>
72 <class>QLabel</class> 72 <class>QLabel</class>
73 <property stdset="1"> 73 <property stdset="1">
74 <name>name</name> 74 <name>name</name>
75 <cstring>TextLabel2</cstring> 75 <cstring>TextLabel2</cstring>
76 </property> 76 </property>
77 <property stdset="1"> 77 <property stdset="1">
78 <name>text</name> 78 <name>text</name>
79 <string>chemical Formula</string> 79 <string>Chemical Formula</string>
80 </property> 80 </property>
81 </widget> 81 </widget>
82 <widget> 82 <widget>
83 <class>QLineEdit</class> 83 <class>QLineEdit</class>
84 <property stdset="1"> 84 <property stdset="1">
85 <name>name</name> 85 <name>name</name>
86 <cstring>formula</cstring> 86 <cstring>formula</cstring>
87 </property> 87 </property>
88 </widget> 88 </widget>
89 <widget> 89 <widget>
90 <class>QLayoutWidget</class> 90 <class>QLayoutWidget</class>
91 <property stdset="1"> 91 <property stdset="1">
92 <name>name</name> 92 <name>name</name>
93 <cstring>Layout3</cstring> 93 <cstring>Layout3</cstring>
94 </property> 94 </property>
95 <hbox> 95 <hbox>
96 <property stdset="1"> 96 <property stdset="1">
97 <name>margin</name> 97 <name>margin</name>
98 <number>0</number> 98 <number>0</number>
99 </property> 99 </property>
100 <property stdset="1"> 100 <property stdset="1">
101 <name>spacing</name> 101 <name>spacing</name>
102 <number>6</number> 102 <number>6</number>
103 </property> 103 </property>
104 <widget> 104 <widget>
105 <class>QPushButton</class> 105 <class>QPushButton</class>
106 <property stdset="1"> 106 <property stdset="1">
107 <name>name</name> 107 <name>name</name>
108 <cstring>calculate</cstring> 108 <cstring>calculate</cstring>
109 </property> 109 </property>
110 <property stdset="1"> 110 <property stdset="1">
111 <name>text</name> 111 <name>text</name>
112 <string>Calculate</string> 112 <string>Calculate</string>
113 </property> 113 </property>
114 </widget> 114 </widget>
115 <widget> 115 <widget>
116 <class>QPushButton</class> 116 <class>QPushButton</class>
117 <property stdset="1"> 117 <property stdset="1">
118 <name>name</name> 118 <name>name</name>
119 <cstring>clear_fields</cstring> 119 <cstring>clear_fields</cstring>
120 </property> 120 </property>
121 <property stdset="1"> 121 <property stdset="1">
122 <name>text</name> 122 <name>text</name>
123 <string>Clear</string> 123 <string>Clear</string>
124 </property> 124 </property>
125 </widget> 125 </widget>
126 </hbox> 126 </hbox>
127 </widget> 127 </widget>
diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp
index 98d3bd8..82b425e 100644
--- a/noncore/apps/oxygen/dataTable.cpp
+++ b/noncore/apps/oxygen/dataTable.cpp
@@ -1,134 +1,142 @@
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> 21#include <qwidget.h>
22#include <qhbox.h> 22#include <qhbox.h>
23#include <qlabel.h> 23#include <qlabel.h>
24#include <qfont.h> 24#include <qfont.h>
25#include <qlayout.h> 25#include <qlayout.h>
26#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
27 27
28OxydataWidget::OxydataWidget(QWidget *parent) : QWidget(parent) 28OxydataWidget::OxydataWidget(QWidget *parent) : QWidget(parent)
29{ 29{
30 QGridLayout *qgrid = new QGridLayout( this, 2,1 ); 30 QGridLayout *qgrid = new QGridLayout( this, 2,1 );
31 31
32 QHBox *hbox = new QHBox( this ); 32 QHBox *hbox = new QHBox( this );
33 left = new QLabel( hbox ); 33 left = new QLabel( hbox );
34 middle = new QLabel( hbox ); 34 middle = new QLabel( hbox );
35 right = new QLabel( hbox ); 35 right = new QLabel( hbox );
36 36
37 right->setAlignment( AlignRight ); 37 right->setAlignment( AlignRight );
38 middle->setAlignment( AlignHCenter ); 38 middle->setAlignment( AlignHCenter );
39 39
40 QFont bf; 40 QFont bf;
41 bf.setBold( true ); 41 bf.setBold( true );
42 bf.setPointSize( bf.pointSize()+2 ); 42 bf.setPointSize( bf.pointSize()+2 );
43 middle->setFont( bf ); 43 middle->setFont( bf );
44 44
45 DataTable = new OxydataTable( 9,2, this ); 45 DataTable = new OxydataTable( 9,2, this );
46 //DataTable->setColumnWidth ( 1 , ( parent->width())-10 );
47 setTable(); 46 setTable();
48 47
49 qgrid->addWidget( hbox,0,0 ); 48 qgrid->addWidget( hbox,0,0 );
50 qgrid->addWidget( DataTable,1,0 ); 49 qgrid->addWidget( DataTable,1,0 );
51} 50}
52 51
53void OxydataWidget::setElement( int el ) 52void OxydataWidget::setElement( int el )
54{ 53{
55 Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); 54 Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File );
56 55
57 configobj.setGroup( QString::number( el+1 )); 56 configobj.setGroup( QString::number( el+1 ));
58 57
59 left->setText( configobj.readEntry( "Symbol" ) ); 58 left->setText( configobj.readEntry( "Symbol" ) );
60 middle->setText( configobj.readEntry( "Name" ) ); 59 middle->setText( configobj.readEntry( "Name" ) );
61 right->setText( QString::number( el+1 ) ); 60 right->setText( QString::number( el+1 ) );
62 61
63 62
64 DataTable->setText( 0,1,tr( "%1 u" ).arg( configobj.readEntry( "Weight" ) ) ); 63 DataTable->setText( 0,1,tr( "%1 u" ).arg( configobj.readEntry( "Weight" ) ) );
65 DataTable->setText( 1,1,configobj.readEntry( "Block" ) ); 64 DataTable->setText( 1,1,configobj.readEntry( "Block" ) );
66 DataTable->setText( 2,1,configobj.readEntry( "Group" ) ); 65 DataTable->setText( 2,1,configobj.readEntry( "Group" ) );
67 DataTable->setText( 3,1,tr( "%1 J").arg( configobj.readEntry( "EN" ) ) ); 66 DataTable->setText( 3,1,tr( "%1 J").arg( configobj.readEntry( "EN" ) ) );
68 DataTable->setText( 4,1,tr( "%1 nm" ).arg( configobj.readEntry( "AR" ) ) ) ; 67 DataTable->setText( 4,1,tr( "%1 nm" ).arg( configobj.readEntry( "AR" ) ) ) ;
69 DataTable->setText( 5,1,tr( "%1 J" ).arg( configobj.readEntry( "IE" ) ) ); 68 DataTable->setText( 5,1,tr( "%1 J" ).arg( configobj.readEntry( "IE" ) ) );
70 DataTable->setText( 6,1,configobj.readEntry( "Density" ) ); 69 DataTable->setText( 6,1,configobj.readEntry( "Density" ) );
71 DataTable->setText( 7,1,tr( "%1 K" ).arg( configobj.readEntry( "BP" ) ) ); 70 DataTable->setText( 7,1,tr( "%1 K" ).arg( configobj.readEntry( "BP" ) ) );
72 DataTable->setText( 8,1,tr( "%1 K" ).arg( configobj.readEntry( "MP" ) ) ); 71 DataTable->setText( 8,1,tr( "%1 K" ).arg( configobj.readEntry( "MP" ) ) );
73} 72}
74 73
75void OxydataWidget::setTable() const 74void OxydataWidget::setTable() const
76{ 75{
77 DataTable->setText( 0,0, tr( "Weight:" ) ); 76 DataTable->setText( 0,0, tr( "Weight:" ) );
78 DataTable->setText( 1,0, tr( "Block" )) ; 77 DataTable->setText( 1,0, tr( "Block" )) ;
79 DataTable->setText( 2,0, tr( "Group" )) ; 78 DataTable->setText( 2,0, tr( "Group" )) ;
80 DataTable->setText( 3,0, tr( "Electronegativity" )) ; 79 DataTable->setText( 3,0, tr( "Electronegativity" )) ;
81 DataTable->setText( 4,0, tr( "Atomic radius" )) ; 80 DataTable->setText( 4,0, tr( "Atomic radius" )) ;
82 DataTable->setText( 5,0, tr( "Ionizationenergie" )) ; 81 DataTable->setText( 5,0, tr( "Ionizationenergie" )) ;
83 DataTable->setText( 6,0, tr( "Density" )) ; 82 DataTable->setText( 6,0, tr( "Density" )) ;
84 DataTable->setText( 7,0, tr( "Boilingpoint" ) ); 83 DataTable->setText( 7,0, tr( "Boilingpoint" ) );
85 DataTable->setText( 8,0, tr( "Meltingpoint" ) ); 84 DataTable->setText( 8,0, tr( "Meltingpoint" ) );
85}
86
87void OxydataWidget::setLayout()
88{
89#warning this is not working and I have no idea why!
90// DataTable->setColumnWidth ( 0 , this->width()/2 );
91// DataTable->setColumnWidth ( 1 , this->width()/2 );
86 92
93 DataTable->setColumnWidth ( 0 , 110 );
94 DataTable->setColumnWidth ( 1 , 110 );
87} 95}
88 96
89OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent, 97OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent,
90 const char *name) : QTable(numRows, numCols,parent, name) 98 const char *name) : QTable(numRows, numCols,parent, name)
91{ 99{
92 100
93 for (int zeile = 0; zeile < numRows; zeile++) 101 for (int zeile = 0; zeile < numRows; zeile++)
94 for ( int spalte = 0; spalte < numCols; spalte++ ) 102 for ( int spalte = 0; spalte < numCols; spalte++ )
95 { 103 {
96 OxydataQTI *testus = new OxydataQTI (this, OxydataQTI::Never, "hm" ); 104 OxydataQTI *testus = new OxydataQTI (this, OxydataQTI::Never, "hm" );
97 setItem(zeile, spalte, (QTableItem*)testus); 105 setItem(zeile, spalte, (QTableItem*)testus);
98 } 106 }
99 107
100 108
101 this->setShowGrid( false ); 109 this->setShowGrid( false );
102 this->setHScrollBarMode(QScrollView::AlwaysOff); 110 this->setHScrollBarMode(QScrollView::AlwaysOff);
103 this->horizontalHeader()->hide(); 111 this->horizontalHeader()->hide();
104 this->verticalHeader()->hide(); 112 this->verticalHeader()->hide();
105 this->setTopMargin( 0 ); 113 this->setTopMargin( 0 );
106 this->setLeftMargin( 0 ); 114 this->setLeftMargin( 0 );
107} 115}
108 116
109void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected) 117void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected)
110{ 118{
111 if ( cr.width() == 0 || cr.height() == 0 ) 119 if ( cr.width() == 0 || cr.height() == 0 )
112 return; 120 return;
113 selected = FALSE; 121 selected = FALSE;
114 122
115 QTableItem *itm = item( row, col ); 123 QTableItem *itm = item( row, col );
116 QColorGroup colgrp = colorGroup(); 124 QColorGroup colgrp = colorGroup();
117 if ( itm ) 125 if ( itm )
118 { 126 {
119 if ( row%2 ) 127 if ( row%2 )
120 colgrp.setColor( QColorGroup::Base, QColor( 180,200,210 ) ); 128 colgrp.setColor( QColorGroup::Base, QColor( 180,200,210 ) );
121 else 129 else
122 colgrp.setColor( QColorGroup::Base, QColor( 230,235,235 ) ); 130 colgrp.setColor( QColorGroup::Base, QColor( 230,235,235 ) );
123 p->save(); 131 p->save();
124 itm->paint( p, colgrp, cr, selected ); 132 itm->paint( p, colgrp, cr, selected );
125 p->restore(); 133 p->restore();
126 } 134 }
127} 135}
128 136
129OxydataQTI::OxydataQTI(QTable * table, EditType et, const QString & text ) 137OxydataQTI::OxydataQTI(QTable * table, EditType et, const QString & text )
130 : QTableItem ( table, et, text ) 138 : QTableItem ( table, et, text )
131{ 139{
132} 140}
133 141
134int OxydataQTI::alignment() const 142int OxydataQTI::alignment() const
diff --git a/noncore/apps/oxygen/dataTable.h b/noncore/apps/oxygen/dataTable.h
index a4a3b18..f2eb71d 100644
--- a/noncore/apps/oxygen/dataTable.h
+++ b/noncore/apps/oxygen/dataTable.h
@@ -1,84 +1,85 @@
1 1
2/*************************************************************************** 2/***************************************************************************
3 * * 3 * *
4 * This program is free software; you can redistribute it and/or modify * 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 * 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 * 6 * the Free Software Foundation; either version 2 of the License, or *
7 * ( at your option ) any later version. * 7 * ( at your option ) any later version. *
8 * * 8 * *
9 **************************************************************************/ 9 **************************************************************************/
10 10
11#ifndef _DATATABLE_H 11#ifndef _DATATABLE_H
12#define _DATATABLE_H 12#define _DATATABLE_H
13 13
14#include <qwidget.h> 14#include <qwidget.h>
15#include <qtable.h> 15#include <qtable.h>
16 16
17class QLabel; 17class QLabel;
18class OxydataTable; 18class OxydataTable;
19 19
20/* 20/*
21 * A OxydataWidget shows all known data of an element. It can 21 * A OxydataWidget shows all known data of an element. It can
22 * be used for both the PSE and the pure Data-Dialog. It is 22 * be used for both the PSE and the pure Data-Dialog. It is
23 * a simple QHBox with 2 QStrings in it plus a OxydataTable 23 * a simple QHBox with 2 QStrings in it plus a OxydataTable
24 * which contains the rest of the data. 24 * which contains the rest of the data.
25 * 25 *
26 * Author: Carsten Niehaus <cniehaus@handhelds.org> 26 * Author: Carsten Niehaus <cniehaus@handhelds.org>
27 */ 27 */
28 28
29class OxydataWidget : public QWidget 29class OxydataWidget : public QWidget
30{ 30{
31 Q_OBJECT 31 Q_OBJECT
32 32
33 public: 33 public:
34 OxydataWidget(QWidget *parent=0); 34 OxydataWidget(QWidget *parent=0);
35 35
36 QLabel *left, *middle, *right; 36 QLabel *left, *middle, *right;
37 void setLayout();
37 38
38 private: 39 private:
39 OxydataTable *DataTable;
40 void setTable() const; 40 void setTable() const;
41 OxydataTable *DataTable;
41 42
42 public slots: 43 public slots:
43 void setElement( int ); 44 void setElement( int );
44}; 45};
45 46
46/* 47/*
47 * A OxydataTable is derived from QTable. I recoded the paintCell to have 48 * A OxydataTable is derived from QTable. I recoded the paintCell to have
48 * different colors in the backgound. Furthermore this widget never has a 49 * different colors in the backgound. Furthermore this widget never has a
49 * grid, thus I removed that code in paintCell. 50 * grid, thus I removed that code in paintCell.
50 * 51 *
51 * Author: Carsten Niehaus <cniehaus@handhelds.org> 52 * Author: Carsten Niehaus <cniehaus@handhelds.org>
52 */ 53 */
53 54
54class OxydataTable : public QTable 55class OxydataTable : public QTable
55{ 56{
56 Q_OBJECT 57 Q_OBJECT
57 58
58 public: 59 public:
59 OxydataTable( int numRows, int numCols, 60 OxydataTable( int numRows, int numCols,
60 QWidget *parent = 0, const char *name = 0 ); 61 QWidget *parent = 0, const char *name = 0 );
61 62
62 protected: 63 protected:
63 /* 64 /*
64 * This method is reimplemented form QTable. It implements the colourisation 65 * This method is reimplemented form QTable. It implements the colourisation
65 * of every second row. 66 * of every second row.
66 */ 67 */
67 virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected ); 68 virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected );
68}; 69};
69/* 70/*
70 * A OxydataQTI is a QTableItem which has the ability to set an alignment. 71 * A OxydataQTI is a QTableItem which has the ability to set an alignment.
71 * In Oxygen we only have two colums so I can use the simple col()%2. 72 * In Oxygen we only have two colums so I can use the simple col()%2.
72 * 73 *
73 * Author: Robert Gogolok <robertgogolok@gmx.de> 74 * Author: Robert Gogolok <robertgogolok@gmx.de>
74 */ 75 */
75 76
76class OxydataQTI : public QTableItem 77class OxydataQTI : public QTableItem
77{ 78{
78 public: 79 public:
79 OxydataQTI(QTable * table, EditType et, const QString & text ); 80 OxydataQTI(QTable * table, EditType et, const QString & text );
80 81
81 virtual int alignment() const; 82 virtual int alignment() const;
82}; 83};
83 84
84#endif 85#endif
diff --git a/noncore/apps/oxygen/datawidgetui.cpp b/noncore/apps/oxygen/datawidgetui.cpp
index c7afa32..99c4fd7 100644
--- a/noncore/apps/oxygen/datawidgetui.cpp
+++ b/noncore/apps/oxygen/datawidgetui.cpp
@@ -1,52 +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() : QWidget()
30{ 30{
31 this->setCaption( tr( "Chemical Data" )); 31 this->setCaption( tr( "Chemical Data" ));
32 QGridLayout *qgrid = new QGridLayout( this, 2,1 ); 32 QGridLayout *qgrid = new QGridLayout( this, 2,1 );
33 33
34 dataCombo = new QComboBox( this ); 34 dataCombo = new QComboBox( this );
35 35
36 //read in all names of the 118 elements 36 //read in all names of the 118 elements
37 Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); 37 Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File );
38 for ( int i = 1 ; i < 119 ; i++ ) 38 for ( int i = 1 ; i < 119 ; i++ )
39 { 39 {
40 configobj.setGroup( QString::number( i ) ); 40 configobj.setGroup( QString::number( i ) );
41 QString foo = configobj.readEntry( "Name" ); 41 QString foo = configobj.readEntry( "Name" );
42 dataCombo->insertItem( QString::number( i )+" - "+foo ); 42 dataCombo->insertItem( QString::number( i )+" - "+foo );
43 } 43 }
44 44
45 OxydataWidget *oxyDW = new OxydataWidget(this); 45 OxydataWidget *oxyDW = new OxydataWidget(this);
46 connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) ); 46 connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) );
47 oxyDW->setElement( 0 ); 47 oxyDW->setElement( 0 );
48 oxyDW->setLayout();
48 49
49 qgrid->addWidget( dataCombo, 0,0); 50 qgrid->addWidget( dataCombo, 0,0);
50 qgrid->addWidget( oxyDW , 1,0 ); 51 qgrid->addWidget( oxyDW , 1,0 );
51} 52}
52 53
diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp
index ba9b71a..18b41c3 100644
--- a/noncore/apps/oxygen/psewidget.cpp
+++ b/noncore/apps/oxygen/psewidget.cpp
@@ -4,96 +4,97 @@
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() : QWidget()
28{ 28{
29 this->setCaption( tr( "Periodic System" ) ); 29 this->setCaption( tr( "Periodic System" ) );
30 30
31 QVBoxLayout *vlay = new QVBoxLayout( this ); 31 QVBoxLayout *vlay = new QVBoxLayout( this );
32 32
33 QGridLayout *grid = new QGridLayout( 18,10 ); 33 QGridLayout *grid = new QGridLayout( 18,10 );
34 int h=0, v=0; 34 int h=0, v=0;
35 35
36 Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); 36 Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File );
37 for( int n = 0 ; n < 118 ; n++ ) 37 for( int n = 0 ; n < 118 ; n++ )
38 { 38 {
39 configobj.setGroup( QString::number( n+1 )); 39 configobj.setGroup( QString::number( n+1 ));
40 40
41 position( n+1,h,v ); 41 position( n+1,h,v );
42 QList<OxyFrame> PSEframe; 42 QList<OxyFrame> PSEframe;
43 PSEframe.append( new OxyFrame( this , QString::number(n) ) ); 43 PSEframe.append( new OxyFrame( this , QString::number(n) ) );
44 grid->addWidget( PSEframe.current() , v/40+1 , h/40 ); 44 grid->addWidget( PSEframe.current() , v/40+1 , h/40 );
45 PSEframe.current()->setMinimumHeight( 11 ); 45 PSEframe.current()->setMinimumHeight( 11 );
46 PSEframe.current()->setPalette( QPalette( PSEColor( configobj.readEntry( "Block" ) ) ) ); 46 PSEframe.current()->setPalette( QPalette( PSEColor( configobj.readEntry( "Block" ) ) ) );
47 connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( slotShowElement(QString) )); 47 connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( slotShowElement(QString) ));
48 } 48 }
49 49
50 oxyDW = new OxydataWidget(this); 50 oxyDW = new OxydataWidget(this);
51 oxyDW->setElement( 0 ); 51 oxyDW->setElement( 0 );
52 oxyDW->setLayout();
52 53
53 vlay->addLayout( grid ); 54 vlay->addLayout( grid );
54 vlay->addWidget( oxyDW ); 55 vlay->addWidget( oxyDW );
55} 56}
56 57
57QColor PSEWidget::PSEColor( QString block ) 58QColor PSEWidget::PSEColor( QString block )
58{ 59{
59 QColor c; 60 QColor c;
60 if ( block == "s" ) c.setRgb( 213 , 233 , 231 ); 61 if ( block == "s" ) c.setRgb( 213 , 233 , 231 );
61 else if ( block == "d" ) c.setRgb( 200,230,160 ); 62 else if ( block == "d" ) c.setRgb( 200,230,160 );
62 else if ( block == "p" ) c.setRgb( 238,146,138 ); 63 else if ( block == "p" ) c.setRgb( 238,146,138 );
63 else if ( block == "f" ) c.setRgb( 190 , 190 , 190 ); 64 else if ( block == "f" ) c.setRgb( 190 , 190 , 190 );
64 return c; 65 return c;
65}; 66};
66 67
67void PSEWidget::slotShowElement(QString number) 68void PSEWidget::slotShowElement(QString number)
68{ 69{
69 oxyDW->setElement( number.toInt() ); 70 oxyDW->setElement( number.toInt() );
70}; 71};
71 72
72void PSEWidget::position(int n, int& h, int& v) 73void PSEWidget::position(int n, int& h, int& v)
73{ 74{
74 //Hydrogen 75 //Hydrogen
75 if (n == 1) 76 if (n == 1)
76 { 77 {
77 h=0; v=0; 78 h=0; v=0;
78 } 79 }
79 80
80 81
81 //Helium 82 //Helium
82 if (n == 2) 83 if (n == 2)
83 { 84 {
84 h=680; v=0; 85 h=680; v=0;
85 } 86 }
86 87
87 88
88 //Lithium 89 //Lithium
89 if (n == 3) 90 if (n == 3)
90 { 91 {
91 h=0; v=40; 92 h=0; v=40;
92 } 93 }
93 94
94 95
95 //Beryllium 96 //Beryllium
96 if (n == 4) 97 if (n == 4)
97 { 98 {
98 h=40; v=40; 99 h=40; v=40;
99 } 100 }