summaryrefslogtreecommitdiff
authorcniehaus <cniehaus>2002-09-19 17:45:45 (UTC)
committer cniehaus <cniehaus>2002-09-19 17:45:45 (UTC)
commitf034f7d2269058ca43c2eb8af8bb8e793e1b1850 (patch) (side-by-side diff)
treea427e8bc2d86cc6df19df9f40876070b8945dbc6
parent5c9f3605d3598eb8d5e472f2834c98a9ec8e02d8 (diff)
downloadopie-f034f7d2269058ca43c2eb8af8bb8e793e1b1850.zip
opie-f034f7d2269058ca43c2eb8af8bb8e793e1b1850.tar.gz
opie-f034f7d2269058ca43c2eb8af8bb8e793e1b1850.tar.bz2
make sure I safe this. Imagine a headcrash ;)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/oxygen/oxyframe.cpp5
-rw-r--r--noncore/apps/oxygen/oxyframe.h2
-rw-r--r--noncore/apps/oxygen/psewidget.cpp126
-rw-r--r--noncore/apps/oxygen/psewidget.h5
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
@@ -14,3 +14,8 @@
OxyFrame::OxyFrame(QWidget *parent, const char *name) : QFrame(parent,name)
{
+ this->setFrameStyle( QFrame::Panel );
+ this->setLineWidth( 2 );
+ this->setFrameShadow( QFrame::Raised );
+ this->setBackgroundColor( QColor( cyan ) );
}
+
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
@@ -20,6 +20,4 @@ class OxyFrame : public QFrame
public:
OxyFrame( QWidget *parent=0, const char *name=0);
-
-
};
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
@@ -10,5 +10,8 @@
#include <qpe/config.h>
#include <qlayout.h>
+#include <qlabel.h>
#include <qlist.h>
+#include <qvbox.h>
+#include "dataTable.h"
#include "psewidget.h"
#include "oxyframe.h"
@@ -19,11 +22,122 @@ Element::Element( const QString &name )
}
+
PSEWidget::PSEWidget() : QWidget()
{
- QList<Element> elements;
- elements.setAutoDelete( TRUE );
- elements.append( new Element( "1" ) );
-
- maingrid = new QGridLayout( 18 , 10 , -1 , "maingridlayout" );
- OxyFrame *configobj = new OxyFrame(this);
+ this->setCaption( "Periodic System" );
+
+ QGridLayout *grid = new QGridLayout( this, 18,10 );
+ int h=0, v=0;
+ for( int n = 0 ; n < 118 ; n++ )
+ {
+ position( n+1,h,v );
+ QList<OxyFrame> PSEframe;
+ PSEframe.append( new OxyFrame( this , QString::number( n ) ) );
+ grid->addWidget( PSEframe.current() , v/40+1 , h/40 );
+ }
+}
+
+void PSEWidget::position(int n, int& h, int& v)
+{
+ //Hydrogen
+ if (n == 1)
+ {
+ h=0; v=0;
+ }
+
+
+ //Helium
+ if (n == 2)
+ {
+ h=680; v=0;
+ }
+
+
+ //Lithium
+ if (n == 3)
+ {
+ h=0; v=40;
+ }
+
+
+ //Beryllium
+ if (n == 4)
+ {
+ h=40; v=40;
+ }
+
+
+ //Boron-->Neon or Aluminum --> Argon
+ if ((n >= 5 && n <= 10) || (n >= 13 && n <= 18))
+ for (int i = 1; i <= (6-(10-n)); i++)
+ {
+ h=((i*40)+440);
+ v = 40;
+ if (n >= 13)
+ {
+ v=80;
+ h=(h-320);
+ }
+ }
+
+
+ //Sodium
+ if (n == 11)
+ {
+ h=0; v=80;
+ }
+
+
+ //Magnesium
+ if (n == 12)
+ {
+ h=40; v=80;
+ }
+
+
+ //Potassium --> Uuo without La and Ac
+ if ((n >= 19 && n <= 56) || (n >= 72 && n <= 88) || n >= 104)
+ for (int i = 1; i <= 18; i++)
+ {
+ int f = n;
+ if (n > 18)
+ f = n-18;
+ if (n > 36)
+ f = n-36;
+ if (n > 54)
+ f = n-54;
+ if (n > 71)
+ f = n-68;
+ if (n > 86)
+ f = n-86;
+ if (n > 103)
+ f = n-100;
+
+ h=((f*40)-40);
+
+ v = 120;
+ if (n >= 37)
+ v=160;
+ if (n >= 55)
+ v=200;
+ if (n >= 87)
+ v=240;
+ }
+
+
+ //Lanthanum --> Lutetium and Actinum --> Lawrencium
+ if ((n >= 57 && n <= 71) || (n >= 89 && n <= 103))
+ for (int i = 1; i <= 14; i++)
+ {
+ int f = n;
+ if (n > 56)
+ f = n-55;
+ if (n > 88)
+ f = n-87;
+ h=(f*40);
+ v = 290;
+ if (n >= 89)
+ v=330;
+ }
+ v += 10;
}
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
@@ -62,4 +62,6 @@ class Element
};
+class QGridLayout;
+
class PSEWidget : public QWidget
{
@@ -68,7 +70,10 @@ class PSEWidget : public QWidget
public:
PSEWidget();
+ QGridLayout *bottom_grid;
private:
QGridLayout *maingrid;
+
+ void position( int, int&, int& );
};