author | cniehaus <cniehaus> | 2002-09-19 19:34:26 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2002-09-19 19:34:26 (UTC) |
commit | aef34909dcfb2ffb637c9d3693e395c15b255cb2 (patch) (unidiff) | |
tree | 24790ee542408f594b1e6b018dd0013435f75d84 | |
parent | 04fd73b51c766027f2168ed8220f7cbb7ca1486c (diff) | |
download | opie-aef34909dcfb2ffb637c9d3693e395c15b255cb2.zip opie-aef34909dcfb2ffb637c9d3693e395c15b255cb2.tar.gz opie-aef34909dcfb2ffb637c9d3693e395c15b255cb2.tar.bz2 |
wow, this works now :)) Elemental: ich hab' dich!
-rw-r--r-- | noncore/apps/oxygen/oxyframe.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/oxygen/oxyframe.h | 5 | ||||
-rw-r--r-- | noncore/apps/oxygen/psewidget.cpp | 18 | ||||
-rw-r--r-- | noncore/apps/oxygen/psewidget.h | 3 |
4 files changed, 26 insertions, 3 deletions
diff --git a/noncore/apps/oxygen/oxyframe.cpp b/noncore/apps/oxygen/oxyframe.cpp index a7833be..d459d2b 100644 --- a/noncore/apps/oxygen/oxyframe.cpp +++ b/noncore/apps/oxygen/oxyframe.cpp | |||
@@ -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 | #include "oxygen.h" | 9 | #include "oxygen.h" |
10 | 10 | ||
11 | #include <qpe/config.h> | 11 | #include <qpe/config.h> |
12 | #include "oxyframe.h" | 12 | #include "oxyframe.h" |
13 | 13 | ||
14 | OxyFrame::OxyFrame(QWidget *parent, const char *name) : QFrame(parent,name) | 14 | OxyFrame::OxyFrame(QWidget *parent, const char *name) : QFrame(parent,name) |
15 | { | 15 | { |
16 | this->setFrameStyle( QFrame::Panel ); | 16 | this->setFrameStyle( QFrame::Panel ); |
17 | this->setLineWidth( 2 ); | 17 | this->setLineWidth( 2 ); |
18 | this->setFrameShadow( QFrame::Raised ); | 18 | this->setFrameShadow( QFrame::Raised ); |
19 | this->setBackgroundColor( QColor( cyan ) ); | 19 | this->setBackgroundColor( QColor( cyan ) ); |
20 | } | 20 | } |
21 | 21 | ||
22 | void OxyFrame::mousePressEvent ( QMouseEvent * e ){ | ||
23 | emit clicked(); | ||
24 | }; | ||
diff --git a/noncore/apps/oxygen/oxyframe.h b/noncore/apps/oxygen/oxyframe.h index 9c7dab5..6ff9e27 100644 --- a/noncore/apps/oxygen/oxyframe.h +++ b/noncore/apps/oxygen/oxyframe.h | |||
@@ -1,24 +1,29 @@ | |||
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 | #ifndef _OXYFRAME_H | 10 | #ifndef _OXYFRAME_H |
11 | #define _OXYFRAME_H | 11 | #define _OXYFRAME_H |
12 | 12 | ||
13 | 13 | ||
14 | #include <qframe.h> | 14 | #include <qframe.h> |
15 | 15 | ||
16 | class OxyFrame : public QFrame | 16 | class OxyFrame : public QFrame |
17 | { | 17 | { |
18 | Q_OBJECT | 18 | Q_OBJECT |
19 | 19 | ||
20 | public: | 20 | public: |
21 | OxyFrame( QWidget *parent=0, const char *name=0); | 21 | OxyFrame( QWidget *parent=0, const char *name=0); |
22 | |||
23 | void mousePressEvent( QMouseEvent *); | ||
24 | |||
25 | signals: | ||
26 | void clicked(); | ||
22 | }; | 27 | }; |
23 | 28 | ||
24 | #endif | 29 | #endif |
diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp index ab1467c..506e0cb 100644 --- a/noncore/apps/oxygen/psewidget.cpp +++ b/noncore/apps/oxygen/psewidget.cpp | |||
@@ -1,143 +1,155 @@ | |||
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 | ||
10 | #include <qpe/config.h> | 10 | #include <qpe/config.h> |
11 | #include <qlayout.h> | 11 | #include <qlayout.h> |
12 | #include <qlabel.h> | 12 | #include <qlabel.h> |
13 | #include <qlist.h> | 13 | #include <qlist.h> |
14 | #include <qvbox.h> | 14 | #include <qvbox.h> |
15 | #include "dataTable.h" | 15 | #include "dataTable.h" |
16 | #include "psewidget.h" | 16 | #include "psewidget.h" |
17 | #include "oxyframe.h" | 17 | #include "oxyframe.h" |
18 | 18 | ||
19 | 19 | ||
20 | Element::Element( const QString &name ) | 20 | /*Element::Element( const QString &name ) |
21 | { | 21 | { |
22 | } | 22 | }*/ |
23 | 23 | ||
24 | 24 | ||
25 | PSEWidget::PSEWidget() : QWidget() | 25 | PSEWidget::PSEWidget() : QWidget() |
26 | { | 26 | { |
27 | this->setCaption( "Periodic System" ); | 27 | this->setCaption( "Periodic System" ); |
28 | 28 | ||
29 | QGridLayout *grid = new QGridLayout( this, 18,10 ); | 29 | QVBoxLayout *vlay = new QVBoxLayout( this ); |
30 | |||
31 | QGridLayout *grid = new QGridLayout( 18,10 ); | ||
30 | int h=0, v=0; | 32 | int h=0, v=0; |
31 | for( int n = 0 ; n < 118 ; n++ ) | 33 | for( int n = 0 ; n < 118 ; n++ ) |
32 | { | 34 | { |
33 | position( n+1,h,v ); | 35 | position( n+1,h,v ); |
34 | QList<OxyFrame> PSEframe; | 36 | QList<OxyFrame> PSEframe; |
35 | PSEframe.append( new OxyFrame( this , QString::number( n ) ) ); | 37 | PSEframe.append( new OxyFrame( this , QString::number( n ) ) ); |
36 | grid->addWidget( PSEframe.current() , v/40+1 , h/40 ); | 38 | grid->addWidget( PSEframe.current() , v/40+1 , h/40 ); |
39 | PSEframe.current()->setMinimumHeight( 11 ); | ||
40 | connect( PSEframe.current(), SIGNAL( clicked() ), this, SLOT( slotShowElement() )); | ||
37 | } | 41 | } |
42 | |||
43 | OxydataWidget *oxyDW = new OxydataWidget(this); | ||
44 | oxyDW->setElement( 1 ); | ||
45 | |||
46 | vlay->addLayout( grid ); | ||
47 | vlay->addWidget( oxyDW ); | ||
38 | } | 48 | } |
39 | 49 | ||
50 | void PSEWidget::slotShowElement(){ qDebug( "ja genau" );}; | ||
51 | |||
40 | void PSEWidget::position(int n, int& h, int& v) | 52 | void PSEWidget::position(int n, int& h, int& v) |
41 | { | 53 | { |
42 | //Hydrogen | 54 | //Hydrogen |
43 | if (n == 1) | 55 | if (n == 1) |
44 | { | 56 | { |
45 | h=0; v=0; | 57 | h=0; v=0; |
46 | } | 58 | } |
47 | 59 | ||
48 | 60 | ||
49 | //Helium | 61 | //Helium |
50 | if (n == 2) | 62 | if (n == 2) |
51 | { | 63 | { |
52 | h=680; v=0; | 64 | h=680; v=0; |
53 | } | 65 | } |
54 | 66 | ||
55 | 67 | ||
56 | //Lithium | 68 | //Lithium |
57 | if (n == 3) | 69 | if (n == 3) |
58 | { | 70 | { |
59 | h=0; v=40; | 71 | h=0; v=40; |
60 | } | 72 | } |
61 | 73 | ||
62 | 74 | ||
63 | //Beryllium | 75 | //Beryllium |
64 | if (n == 4) | 76 | if (n == 4) |
65 | { | 77 | { |
66 | h=40; v=40; | 78 | h=40; v=40; |
67 | } | 79 | } |
68 | 80 | ||
69 | 81 | ||
70 | //Boron-->Neon or Aluminum --> Argon | 82 | //Boron-->Neon or Aluminum --> Argon |
71 | if ((n >= 5 && n <= 10) || (n >= 13 && n <= 18)) | 83 | if ((n >= 5 && n <= 10) || (n >= 13 && n <= 18)) |
72 | for (int i = 1; i <= (6-(10-n)); i++) | 84 | for (int i = 1; i <= (6-(10-n)); i++) |
73 | { | 85 | { |
74 | h=((i*40)+440); | 86 | h=((i*40)+440); |
75 | v = 40; | 87 | v = 40; |
76 | if (n >= 13) | 88 | if (n >= 13) |
77 | { | 89 | { |
78 | v=80; | 90 | v=80; |
79 | h=(h-320); | 91 | h=(h-320); |
80 | } | 92 | } |
81 | } | 93 | } |
82 | 94 | ||
83 | 95 | ||
84 | //Sodium | 96 | //Sodium |
85 | if (n == 11) | 97 | if (n == 11) |
86 | { | 98 | { |
87 | h=0; v=80; | 99 | h=0; v=80; |
88 | } | 100 | } |
89 | 101 | ||
90 | 102 | ||
91 | //Magnesium | 103 | //Magnesium |
92 | if (n == 12) | 104 | if (n == 12) |
93 | { | 105 | { |
94 | h=40; v=80; | 106 | h=40; v=80; |
95 | } | 107 | } |
96 | 108 | ||
97 | 109 | ||
98 | //Potassium --> Uuo without La and Ac | 110 | //Potassium --> Uuo without La and Ac |
99 | if ((n >= 19 && n <= 56) || (n >= 72 && n <= 88) || n >= 104) | 111 | if ((n >= 19 && n <= 56) || (n >= 72 && n <= 88) || n >= 104) |
100 | for (int i = 1; i <= 18; i++) | 112 | for (int i = 1; i <= 18; i++) |
101 | { | 113 | { |
102 | int f = n; | 114 | int f = n; |
103 | if (n > 18) | 115 | if (n > 18) |
104 | f = n-18; | 116 | f = n-18; |
105 | if (n > 36) | 117 | if (n > 36) |
106 | f = n-36; | 118 | f = n-36; |
107 | if (n > 54) | 119 | if (n > 54) |
108 | f = n-54; | 120 | f = n-54; |
109 | if (n > 71) | 121 | if (n > 71) |
110 | f = n-68; | 122 | f = n-68; |
111 | if (n > 86) | 123 | if (n > 86) |
112 | f = n-86; | 124 | f = n-86; |
113 | if (n > 103) | 125 | if (n > 103) |
114 | f = n-100; | 126 | f = n-100; |
115 | 127 | ||
116 | h=((f*40)-40); | 128 | h=((f*40)-40); |
117 | 129 | ||
118 | v = 120; | 130 | v = 120; |
119 | if (n >= 37) | 131 | if (n >= 37) |
120 | v=160; | 132 | v=160; |
121 | if (n >= 55) | 133 | if (n >= 55) |
122 | v=200; | 134 | v=200; |
123 | if (n >= 87) | 135 | if (n >= 87) |
124 | v=240; | 136 | v=240; |
125 | } | 137 | } |
126 | 138 | ||
127 | 139 | ||
128 | //Lanthanum --> Lutetium and Actinum --> Lawrencium | 140 | //Lanthanum --> Lutetium and Actinum --> Lawrencium |
129 | if ((n >= 57 && n <= 71) || (n >= 89 && n <= 103)) | 141 | if ((n >= 57 && n <= 71) || (n >= 89 && n <= 103)) |
130 | for (int i = 1; i <= 14; i++) | 142 | for (int i = 1; i <= 14; i++) |
131 | { | 143 | { |
132 | int f = n; | 144 | int f = n; |
133 | if (n > 56) | 145 | if (n > 56) |
134 | f = n-55; | 146 | f = n-55; |
135 | if (n > 88) | 147 | if (n > 88) |
136 | f = n-87; | 148 | f = n-87; |
137 | h=(f*40); | 149 | h=(f*40); |
138 | v = 290; | 150 | v = 290; |
139 | if (n >= 89) | 151 | if (n >= 89) |
140 | v=330; | 152 | v=330; |
141 | } | 153 | } |
142 | v += 10; | 154 | v += 10; |
143 | } | 155 | } |
diff --git a/noncore/apps/oxygen/psewidget.h b/noncore/apps/oxygen/psewidget.h index 3ea58e3..2a1e85c 100644 --- a/noncore/apps/oxygen/psewidget.h +++ b/noncore/apps/oxygen/psewidget.h | |||
@@ -1,81 +1,84 @@ | |||
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 | #ifndef _PSEWIDGET_H | 10 | #ifndef _PSEWIDGET_H |
11 | #define _PSEWIDGET_H | 11 | #define _PSEWIDGET_H |
12 | 12 | ||
13 | #include <qwidget.h> | 13 | #include <qwidget.h> |
14 | 14 | ||
15 | class QGridLayout; | 15 | class QGridLayout; |
16 | 16 | ||
17 | class Element | 17 | class Element |
18 | { | 18 | { |
19 | public: | 19 | public: |
20 | Element(const QString &elnum); | 20 | Element(const QString &elnum); |
21 | ~Element(); | 21 | ~Element(); |
22 | 22 | ||
23 | void setName( QString c){ name = c;}; | 23 | void setName( QString c){ name = c;}; |
24 | void setWeight( QString c){ weight = c;}; | 24 | void setWeight( QString c){ weight = c;}; |
25 | void setDensityName( QString c){density = c;}; | 25 | void setDensityName( QString c){density = c;}; |
26 | void setGroup( QString c){group = c;}; | 26 | void setGroup( QString c){group = c;}; |
27 | void setIE( QString c){ie = c;}; | 27 | void setIE( QString c){ie = c;}; |
28 | void setNum( QString c){num = c;}; | 28 | void setNum( QString c){num = c;}; |
29 | void setAZ( QString c){az = c;}; | 29 | void setAZ( QString c){az = c;}; |
30 | void setDate( QString c){date = c;}; | 30 | void setDate( QString c){date = c;}; |
31 | void setEN( QString c){en = c;}; | 31 | void setEN( QString c){en = c;}; |
32 | void setMP( QString c){mp = c;}; | 32 | void setMP( QString c){mp = c;}; |
33 | void setBP( QString c){bp = c;}; | 33 | void setBP( QString c){bp = c;}; |
34 | void setAR( QString c){ar = c;}; | 34 | void setAR( QString c){ar = c;}; |
35 | 35 | ||
36 | QString elname() const{ return name; }; | 36 | QString elname() const{ return name; }; |
37 | QString elweight() const{ return weight; }; | 37 | QString elweight() const{ return weight; }; |
38 | QString eldensity() const{ return density; }; | 38 | QString eldensity() const{ return density; }; |
39 | QString elgroup() const{ return group; }; | 39 | QString elgroup() const{ return group; }; |
40 | QString elie() const{ return ie; }; | 40 | QString elie() const{ return ie; }; |
41 | QString elnum() const{ return num; }; | 41 | QString elnum() const{ return num; }; |
42 | QString elaz() const{ return az; }; | 42 | QString elaz() const{ return az; }; |
43 | QString eldate() const{ return date; }; | 43 | QString eldate() const{ return date; }; |
44 | QString elen() const{ return en; }; | 44 | QString elen() const{ return en; }; |
45 | QString elmp() const{ return mp; }; | 45 | QString elmp() const{ return mp; }; |
46 | QString elbp() const{ return bp; }; | 46 | QString elbp() const{ return bp; }; |
47 | QString elar() const{ return ar; }; | 47 | QString elar() const{ return ar; }; |
48 | 48 | ||
49 | private: | 49 | private: |
50 | QString name, // The name of the element | 50 | QString name, // The name of the element |
51 | weight, // weight | 51 | weight, // weight |
52 | density, // density | 52 | density, // density |
53 | group, // group | 53 | group, // group |
54 | ie, // ionisationenergie | 54 | ie, // ionisationenergie |
55 | num, // number ( e.g. Carbon is 6 ) | 55 | num, // number ( e.g. Carbon is 6 ) |
56 | az, // state of aggregation | 56 | az, // state of aggregation |
57 | date, // date of discovery | 57 | date, // date of discovery |
58 | en, // electronegativity | 58 | en, // electronegativity |
59 | mp, // meltingpoint | 59 | mp, // meltingpoint |
60 | bp, // boilingpoint | 60 | bp, // boilingpoint |
61 | ar; // atomic radius | 61 | ar; // atomic radius |
62 | }; | 62 | }; |
63 | 63 | ||
64 | class QGridLayout; | 64 | class QGridLayout; |
65 | 65 | ||
66 | class PSEWidget : public QWidget | 66 | class PSEWidget : public QWidget |
67 | { | 67 | { |
68 | Q_OBJECT | 68 | Q_OBJECT |
69 | 69 | ||
70 | public: | 70 | public: |
71 | PSEWidget(); | 71 | PSEWidget(); |
72 | QGridLayout *bottom_grid; | 72 | QGridLayout *bottom_grid; |
73 | 73 | ||
74 | private: | 74 | private: |
75 | QGridLayout *maingrid; | 75 | QGridLayout *maingrid; |
76 | 76 | ||
77 | void position( int, int&, int& ); | 77 | void position( int, int&, int& ); |
78 | 78 | ||
79 | public slots: | ||
80 | void slotShowElement(); | ||
81 | |||
79 | }; | 82 | }; |
80 | 83 | ||
81 | #endif | 84 | #endif |