summaryrefslogtreecommitdiff
authorcniehaus <cniehaus>2002-12-01 13:02:00 (UTC)
committer cniehaus <cniehaus>2002-12-01 13:02:00 (UTC)
commit5e82b4c17131cdc1b8be57e312f594d1a55520aa (patch) (unidiff)
treefad787c83503127f1e1b67b743730f250f9dd6e3
parentbeb043f41e232e9dc8768e5fd619c2b80e805f73 (diff)
downloadopie-5e82b4c17131cdc1b8be57e312f594d1a55520aa.zip
opie-5e82b4c17131cdc1b8be57e312f594d1a55520aa.tar.gz
opie-5e82b4c17131cdc1b8be57e312f594d1a55520aa.tar.bz2
is that the way it should be, Holger?
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/oxygen/psewidget.cpp6
-rw-r--r--noncore/apps/oxygen/psewidget.h6
2 files changed, 11 insertions, 1 deletions
diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp
index 2fd61bc..eb4093b 100644
--- a/noncore/apps/oxygen/psewidget.cpp
+++ b/noncore/apps/oxygen/psewidget.cpp
@@ -1,163 +1,167 @@
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() : 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 < 109 ; 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;
43 PSEframe.append( new OxyFrame( this , QString::number(n), configobj.readEntry( "Symbol" ) ) ); 42 PSEframe.append( new OxyFrame( this , QString::number(n), configobj.readEntry( "Symbol" ) ) );
44 grid->addWidget( PSEframe.current() , v/40+1 , h/40 ); 43 grid->addWidget( PSEframe.current() , v/40+1 , h/40 );
45 PSEframe.current()->setMinimumHeight( 11 ); 44 PSEframe.current()->setMinimumHeight( 11 );
46 PSEframe.current()->setPalette( QPalette( PSEColor( configobj.readEntry( "Block" ) ) ) ); 45 PSEframe.current()->setPalette( QPalette( PSEColor( configobj.readEntry( "Block" ) ) ) );
47 connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( slotShowElement(QString) )); 46 connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( slotShowElement(QString) ));
48 } 47 }
49 48
50 oxyDW = new OxydataWidget(this); 49 oxyDW = new OxydataWidget(this);
51 oxyDW->setElement( 0 ); 50 oxyDW->setElement( 0 );
52 oxyDW->setLayout(); 51 oxyDW->setLayout();
53 52
54 vlay->addLayout( grid ); 53 vlay->addLayout( grid );
55 vlay->addWidget( oxyDW ); 54 vlay->addWidget( oxyDW );
56} 55}
57 56
58QColor PSEWidget::PSEColor( QString block ) 57QColor PSEWidget::PSEColor( QString block )
59{ 58{
60 QColor c; 59 QColor c;
61 if ( block == "s" ) c.setRgb( 213 , 233 , 231 ); 60 if ( block == "s" ) c.setRgb( 213 , 233 , 231 );
62 else if ( block == "d" ) c.setRgb( 200,230,160 ); 61 else if ( block == "d" ) c.setRgb( 200,230,160 );
63 else if ( block == "p" ) c.setRgb( 238,146,138 ); 62 else if ( block == "p" ) c.setRgb( 238,146,138 );
64 else if ( block == "f" ) c.setRgb( 190 , 190 , 190 ); 63 else if ( block == "f" ) c.setRgb( 190 , 190 , 190 );
65 return c; 64 return c;
66}; 65};
67 66
67void PSEWidget::inverseColor( QString number )
68{
69 //foo
70}
71
68void PSEWidget::slotShowElement(QString number) 72void PSEWidget::slotShowElement(QString number)
69{ 73{
70 oxyDW->setElement( number.toInt() ); 74 oxyDW->setElement( number.toInt() );
71}; 75};
72 76
73void PSEWidget::position(int n, int& h, int& v) 77void PSEWidget::position(int n, int& h, int& v)
74{ 78{
75 //Hydrogen 79 //Hydrogen
76 if (n == 1) 80 if (n == 1)
77 { 81 {
78 h=0; v=0; 82 h=0; v=0;
79 } 83 }
80 84
81 85
82 //Helium 86 //Helium
83 if (n == 2) 87 if (n == 2)
84 { 88 {
85 h=680; v=0; 89 h=680; v=0;
86 } 90 }
87 91
88 92
89 //Lithium 93 //Lithium
90 if (n == 3) 94 if (n == 3)
91 { 95 {
92 h=0; v=40; 96 h=0; v=40;
93 } 97 }
94 98
95 99
96 //Beryllium 100 //Beryllium
97 if (n == 4) 101 if (n == 4)
98 { 102 {
99 h=40; v=40; 103 h=40; v=40;
100 } 104 }
101 105
102 106
103 //Boron-->Neon or Aluminum --> Argon 107 //Boron-->Neon or Aluminum --> Argon
104 if ((n >= 5 && n <= 10) || (n >= 13 && n <= 18)) 108 if ((n >= 5 && n <= 10) || (n >= 13 && n <= 18))
105 for (int i = 1; i <= (6-(10-n)); i++) 109 for (int i = 1; i <= (6-(10-n)); i++)
106 { 110 {
107 h=((i*40)+440); 111 h=((i*40)+440);
108 v = 40; 112 v = 40;
109 if (n >= 13) 113 if (n >= 13)
110 { 114 {
111 v=80; 115 v=80;
112 h=(h-320); 116 h=(h-320);
113 } 117 }
114 } 118 }
115 119
116 120
117 //Sodium 121 //Sodium
118 if (n == 11) 122 if (n == 11)
119 { 123 {
120 h=0; v=80; 124 h=0; v=80;
121 } 125 }
122 126
123 127
124 //Magnesium 128 //Magnesium
125 if (n == 12) 129 if (n == 12)
126 { 130 {
127 h=40; v=80; 131 h=40; v=80;
128 } 132 }
129 133
130 134
131 //Potassium --> Uuo without La and Ac 135 //Potassium --> Uuo without La and Ac
132 if ((n >= 19 && n <= 56) || (n >= 72 && n <= 88) || n >= 104) 136 if ((n >= 19 && n <= 56) || (n >= 72 && n <= 88) || n >= 104)
133 for (int i = 1; i <= 18; i++) 137 for (int i = 1; i <= 18; i++)
134 { 138 {
135 int f = n; 139 int f = n;
136 if (n > 18) 140 if (n > 18)
137 f = n-18; 141 f = n-18;
138 if (n > 36) 142 if (n > 36)
139 f = n-36; 143 f = n-36;
140 if (n > 54) 144 if (n > 54)
141 f = n-54; 145 f = n-54;
142 if (n > 71) 146 if (n > 71)
143 f = n-68; 147 f = n-68;
144 if (n > 86) 148 if (n > 86)
145 f = n-86; 149 f = n-86;
146 if (n > 103) 150 if (n > 103)
147 f = n-100; 151 f = n-100;
148 152
149 h=((f*40)-40); 153 h=((f*40)-40);
150 154
151 v = 120; 155 v = 120;
152 if (n >= 37) 156 if (n >= 37)
153 v=160; 157 v=160;
154 if (n >= 55) 158 if (n >= 55)
155 v=200; 159 v=200;
156 if (n >= 87) 160 if (n >= 87)
157 v=240; 161 v=240;
158 } 162 }
159 163
160 164
161 //Lanthanum --> Lutetium and Actinum --> Lawrencium 165 //Lanthanum --> Lutetium and Actinum --> Lawrencium
162 if ((n >= 57 && n <= 71) || (n >= 89 && n <= 103)) 166 if ((n >= 57 && n <= 71) || (n >= 89 && n <= 103))
163 for (int i = 1; i <= 14; i++) 167 for (int i = 1; i <= 14; i++)
diff --git a/noncore/apps/oxygen/psewidget.h b/noncore/apps/oxygen/psewidget.h
index fdf838e..d8d2c5f 100644
--- a/noncore/apps/oxygen/psewidget.h
+++ b/noncore/apps/oxygen/psewidget.h
@@ -1,45 +1,51 @@
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>
22#include "oxyframe.h"
21 23
22class QGridLayout; 24class QGridLayout;
23class OxydataWidget; 25class OxydataWidget;
26class PSEframe;
24 27
25class PSEWidget : public QWidget 28class PSEWidget : public QWidget
26{ 29{
27 Q_OBJECT 30 Q_OBJECT
28 31
29 public: 32 public:
30 PSEWidget(); 33 PSEWidget();
31 QGridLayout *bottom_grid; 34 QGridLayout *bottom_grid;
32 OxydataWidget *oxyDW; 35 OxydataWidget *oxyDW;
33 36
37 void inverseColor( QString );
38 QList<OxyFrame> PSEframe;
39
34 private: 40 private:
35 QGridLayout *maingrid; 41 QGridLayout *maingrid;
36 42
37 void position( int, int&, int& ); 43 void position( int, int&, int& );
38 QColor PSEColor( QString ); 44 QColor PSEColor( QString );
39 45
40 public slots: 46 public slots:
41 void slotShowElement(QString); 47 void slotShowElement(QString);
42 48
43}; 49};
44 50
45#endif 51#endif