-rw-r--r-- | noncore/apps/oxygen/psewidget.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp index d742e9c..2fd61bc 100644 --- a/noncore/apps/oxygen/psewidget.cpp +++ b/noncore/apps/oxygen/psewidget.cpp | |||
@@ -1,101 +1,101 @@ | |||
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 | ||
27 | PSEWidget::PSEWidget() : QWidget() | 27 | PSEWidget::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 < 109 ; 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), configobj.readEntry( "Symbol" ) ) ); | 43 | PSEframe.append( new OxyFrame( this , QString::number(n), configobj.readEntry( "Symbol" ) ) ); |
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 | oxyDW->setLayout(); |
53 | 53 | ||
54 | vlay->addLayout( grid ); | 54 | vlay->addLayout( grid ); |
55 | vlay->addWidget( oxyDW ); | 55 | vlay->addWidget( oxyDW ); |
56 | } | 56 | } |
57 | 57 | ||
58 | QColor PSEWidget::PSEColor( QString block ) | 58 | QColor PSEWidget::PSEColor( QString block ) |
59 | { | 59 | { |
60 | QColor c; | 60 | QColor c; |
61 | if ( block == "s" ) c.setRgb( 213 , 233 , 231 ); | 61 | if ( block == "s" ) c.setRgb( 213 , 233 , 231 ); |
62 | else if ( block == "d" ) c.setRgb( 200,230,160 ); | 62 | else if ( block == "d" ) c.setRgb( 200,230,160 ); |
63 | else if ( block == "p" ) c.setRgb( 238,146,138 ); | 63 | else if ( block == "p" ) c.setRgb( 238,146,138 ); |
64 | else if ( block == "f" ) c.setRgb( 190 , 190 , 190 ); | 64 | else if ( block == "f" ) c.setRgb( 190 , 190 , 190 ); |
65 | return c; | 65 | return c; |
66 | }; | 66 | }; |
67 | 67 | ||
68 | void PSEWidget::slotShowElement(QString number) | 68 | void PSEWidget::slotShowElement(QString number) |
69 | { | 69 | { |
70 | oxyDW->setElement( number.toInt() ); | 70 | oxyDW->setElement( number.toInt() ); |
71 | }; | 71 | }; |
72 | 72 | ||
73 | void PSEWidget::position(int n, int& h, int& v) | 73 | void PSEWidget::position(int n, int& h, int& v) |
74 | { | 74 | { |
75 | //Hydrogen | 75 | //Hydrogen |
76 | if (n == 1) | 76 | if (n == 1) |
77 | { | 77 | { |
78 | h=0; v=0; | 78 | h=0; v=0; |
79 | } | 79 | } |
80 | 80 | ||
81 | 81 | ||
82 | //Helium | 82 | //Helium |
83 | if (n == 2) | 83 | if (n == 2) |
84 | { | 84 | { |
85 | h=680; v=0; | 85 | h=680; v=0; |
86 | } | 86 | } |
87 | 87 | ||
88 | 88 | ||
89 | //Lithium | 89 | //Lithium |
90 | if (n == 3) | 90 | if (n == 3) |
91 | { | 91 | { |
92 | h=0; v=40; | 92 | h=0; v=40; |
93 | } | 93 | } |
94 | 94 | ||
95 | 95 | ||
96 | //Beryllium | 96 | //Beryllium |
97 | if (n == 4) | 97 | if (n == 4) |
98 | { | 98 | { |
99 | h=40; v=40; | 99 | h=40; v=40; |
100 | } | 100 | } |
101 | 101 | ||