author | cniehaus <cniehaus> | 2002-09-19 17:45:45 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2002-09-19 17:45:45 (UTC) |
commit | f034f7d2269058ca43c2eb8af8bb8e793e1b1850 (patch) (unidiff) | |
tree | a427e8bc2d86cc6df19df9f40876070b8945dbc6 | |
parent | 5c9f3605d3598eb8d5e472f2834c98a9ec8e02d8 (diff) | |
download | opie-f034f7d2269058ca43c2eb8af8bb8e793e1b1850.zip opie-f034f7d2269058ca43c2eb8af8bb8e793e1b1850.tar.gz opie-f034f7d2269058ca43c2eb8af8bb8e793e1b1850.tar.bz2 |
make sure I safe this. Imagine a headcrash ;)
-rw-r--r-- | noncore/apps/oxygen/oxyframe.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/oxygen/oxyframe.h | 2 | ||||
-rw-r--r-- | noncore/apps/oxygen/psewidget.cpp | 126 | ||||
-rw-r--r-- | noncore/apps/oxygen/psewidget.h | 5 |
4 files changed, 130 insertions, 8 deletions
diff --git a/noncore/apps/oxygen/oxyframe.cpp b/noncore/apps/oxygen/oxyframe.cpp index 060f9ca..a7833be 100644 --- a/noncore/apps/oxygen/oxyframe.cpp +++ b/noncore/apps/oxygen/oxyframe.cpp | |||
@@ -12,5 +12,10 @@ | |||
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 ); | ||
17 | this->setLineWidth( 2 ); | ||
18 | this->setFrameShadow( QFrame::Raised ); | ||
19 | this->setBackgroundColor( QColor( cyan ) ); | ||
16 | } | 20 | } |
21 | |||
diff --git a/noncore/apps/oxygen/oxyframe.h b/noncore/apps/oxygen/oxyframe.h index 01f888d..9c7dab5 100644 --- a/noncore/apps/oxygen/oxyframe.h +++ b/noncore/apps/oxygen/oxyframe.h | |||
@@ -18,9 +18,7 @@ class OxyFrame : public QFrame | |||
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 | |||
24 | }; | 22 | }; |
25 | 23 | ||
26 | #endif | 24 | #endif |
diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp index 4e002d1..ab1467c 100644 --- a/noncore/apps/oxygen/psewidget.cpp +++ b/noncore/apps/oxygen/psewidget.cpp | |||
@@ -8,22 +8,136 @@ | |||
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 <qlist.h> | 13 | #include <qlist.h> |
14 | #include <qvbox.h> | ||
15 | #include "dataTable.h" | ||
13 | #include "psewidget.h" | 16 | #include "psewidget.h" |
14 | #include "oxyframe.h" | 17 | #include "oxyframe.h" |
15 | 18 | ||
16 | 19 | ||
17 | Element::Element( const QString &name ) | 20 | Element::Element( const QString &name ) |
18 | { | 21 | { |
19 | } | 22 | } |
20 | 23 | ||
24 | |||
21 | PSEWidget::PSEWidget() : QWidget() | 25 | PSEWidget::PSEWidget() : QWidget() |
22 | { | 26 | { |
23 | QList<Element> elements; | 27 | this->setCaption( "Periodic System" ); |
24 | elements.setAutoDelete( TRUE ); | 28 | |
25 | elements.append( new Element( "1" ) ); | 29 | QGridLayout *grid = new QGridLayout( this, 18,10 ); |
26 | 30 | int h=0, v=0; | |
27 | maingrid = new QGridLayout( 18 , 10 , -1 , "maingridlayout" ); | 31 | for( int n = 0 ; n < 118 ; n++ ) |
28 | OxyFrame *configobj = new OxyFrame(this); | 32 | { |
33 | position( n+1,h,v ); | ||
34 | QList<OxyFrame> PSEframe; | ||
35 | PSEframe.append( new OxyFrame( this , QString::number( n ) ) ); | ||
36 | grid->addWidget( PSEframe.current() , v/40+1 , h/40 ); | ||
37 | } | ||
38 | } | ||
39 | |||
40 | void PSEWidget::position(int n, int& h, int& v) | ||
41 | { | ||
42 | //Hydrogen | ||
43 | if (n == 1) | ||
44 | { | ||
45 | h=0; v=0; | ||
46 | } | ||
47 | |||
48 | |||
49 | //Helium | ||
50 | if (n == 2) | ||
51 | { | ||
52 | h=680; v=0; | ||
53 | } | ||
54 | |||
55 | |||
56 | //Lithium | ||
57 | if (n == 3) | ||
58 | { | ||
59 | h=0; v=40; | ||
60 | } | ||
61 | |||
62 | |||
63 | //Beryllium | ||
64 | if (n == 4) | ||
65 | { | ||
66 | h=40; v=40; | ||
67 | } | ||
68 | |||
69 | |||
70 | //Boron-->Neon or Aluminum --> Argon | ||
71 | if ((n >= 5 && n <= 10) || (n >= 13 && n <= 18)) | ||
72 | for (int i = 1; i <= (6-(10-n)); i++) | ||
73 | { | ||
74 | h=((i*40)+440); | ||
75 | v = 40; | ||
76 | if (n >= 13) | ||
77 | { | ||
78 | v=80; | ||
79 | h=(h-320); | ||
80 | } | ||
81 | } | ||
82 | |||
83 | |||
84 | //Sodium | ||
85 | if (n == 11) | ||
86 | { | ||
87 | h=0; v=80; | ||
88 | } | ||
89 | |||
90 | |||
91 | //Magnesium | ||
92 | if (n == 12) | ||
93 | { | ||
94 | h=40; v=80; | ||
95 | } | ||
96 | |||
97 | |||
98 | //Potassium --> Uuo without La and Ac | ||
99 | if ((n >= 19 && n <= 56) || (n >= 72 && n <= 88) || n >= 104) | ||
100 | for (int i = 1; i <= 18; i++) | ||
101 | { | ||
102 | int f = n; | ||
103 | if (n > 18) | ||
104 | f = n-18; | ||
105 | if (n > 36) | ||
106 | f = n-36; | ||
107 | if (n > 54) | ||
108 | f = n-54; | ||
109 | if (n > 71) | ||
110 | f = n-68; | ||
111 | if (n > 86) | ||
112 | f = n-86; | ||
113 | if (n > 103) | ||
114 | f = n-100; | ||
115 | |||
116 | h=((f*40)-40); | ||
117 | |||
118 | v = 120; | ||
119 | if (n >= 37) | ||
120 | v=160; | ||
121 | if (n >= 55) | ||
122 | v=200; | ||
123 | if (n >= 87) | ||
124 | v=240; | ||
125 | } | ||
126 | |||
127 | |||
128 | //Lanthanum --> Lutetium and Actinum --> Lawrencium | ||
129 | if ((n >= 57 && n <= 71) || (n >= 89 && n <= 103)) | ||
130 | for (int i = 1; i <= 14; i++) | ||
131 | { | ||
132 | int f = n; | ||
133 | if (n > 56) | ||
134 | f = n-55; | ||
135 | if (n > 88) | ||
136 | f = n-87; | ||
137 | h=(f*40); | ||
138 | v = 290; | ||
139 | if (n >= 89) | ||
140 | v=330; | ||
141 | } | ||
142 | v += 10; | ||
29 | } | 143 | } |
diff --git a/noncore/apps/oxygen/psewidget.h b/noncore/apps/oxygen/psewidget.h index 9f574ce..3ea58e3 100644 --- a/noncore/apps/oxygen/psewidget.h +++ b/noncore/apps/oxygen/psewidget.h | |||
@@ -60,17 +60,22 @@ class Element | |||
60 | bp, // boilingpoint | 60 | bp, // boilingpoint |
61 | ar; // atomic radius | 61 | ar; // atomic radius |
62 | }; | 62 | }; |
63 | 63 | ||
64 | class QGridLayout; | ||
65 | |||
64 | class PSEWidget : public QWidget | 66 | class PSEWidget : public QWidget |
65 | { | 67 | { |
66 | Q_OBJECT | 68 | Q_OBJECT |
67 | 69 | ||
68 | public: | 70 | public: |
69 | PSEWidget(); | 71 | PSEWidget(); |
72 | QGridLayout *bottom_grid; | ||
70 | 73 | ||
71 | private: | 74 | private: |
72 | QGridLayout *maingrid; | 75 | QGridLayout *maingrid; |
76 | |||
77 | void position( int, int&, int& ); | ||
73 | 78 | ||
74 | }; | 79 | }; |
75 | 80 | ||
76 | #endif | 81 | #endif |