summaryrefslogtreecommitdiff
authorcniehaus <cniehaus>2002-09-19 19:34:26 (UTC)
committer cniehaus <cniehaus>2002-09-19 19:34:26 (UTC)
commitaef34909dcfb2ffb637c9d3693e395c15b255cb2 (patch) (side-by-side diff)
tree24790ee542408f594b1e6b018dd0013435f75d84
parent04fd73b51c766027f2168ed8220f7cbb7ca1486c (diff)
downloadopie-aef34909dcfb2ffb637c9d3693e395c15b255cb2.zip
opie-aef34909dcfb2ffb637c9d3693e395c15b255cb2.tar.gz
opie-aef34909dcfb2ffb637c9d3693e395c15b255cb2.tar.bz2
wow, this works now :)) Elemental: ich hab' dich!
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/oxygen/oxyframe.cpp3
-rw-r--r--noncore/apps/oxygen/oxyframe.h5
-rw-r--r--noncore/apps/oxygen/psewidget.cpp18
-rw-r--r--noncore/apps/oxygen/psewidget.h3
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 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
#include "oxygen.h"
#include <qpe/config.h>
#include "oxyframe.h"
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 ) );
}
+void OxyFrame::mousePressEvent ( QMouseEvent * e ){
+ emit clicked();
+};
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 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
#ifndef _OXYFRAME_H
#define _OXYFRAME_H
#include <qframe.h>
class OxyFrame : public QFrame
{
Q_OBJECT
public:
OxyFrame( QWidget *parent=0, const char *name=0);
+
+ void mousePressEvent( QMouseEvent *);
+
+ signals:
+ void clicked();
};
#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,103 +1,115 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
#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"
-Element::Element( const QString &name )
+/*Element::Element( const QString &name )
{
-}
+}*/
PSEWidget::PSEWidget() : QWidget()
{
this->setCaption( "Periodic System" );
- QGridLayout *grid = new QGridLayout( this, 18,10 );
+ QVBoxLayout *vlay = new QVBoxLayout( this );
+
+ QGridLayout *grid = new QGridLayout( 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 );
+ PSEframe.current()->setMinimumHeight( 11 );
+ connect( PSEframe.current(), SIGNAL( clicked() ), this, SLOT( slotShowElement() ));
}
+
+ OxydataWidget *oxyDW = new OxydataWidget(this);
+ oxyDW->setElement( 1 );
+
+ vlay->addLayout( grid );
+ vlay->addWidget( oxyDW );
}
+void PSEWidget::slotShowElement(){ qDebug( "ja genau" );};
+
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)
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
@@ -15,67 +15,70 @@
class QGridLayout;
class Element
{
public:
Element(const QString &elnum);
~Element();
void setName( QString c){ name = c;};
void setWeight( QString c){ weight = c;};
void setDensityName( QString c){density = c;};
void setGroup( QString c){group = c;};
void setIE( QString c){ie = c;};
void setNum( QString c){num = c;};
void setAZ( QString c){az = c;};
void setDate( QString c){date = c;};
void setEN( QString c){en = c;};
void setMP( QString c){mp = c;};
void setBP( QString c){bp = c;};
void setAR( QString c){ar = c;};
QString elname() const{ return name; };
QString elweight() const{ return weight; };
QString eldensity() const{ return density; };
QString elgroup() const{ return group; };
QString elie() const{ return ie; };
QString elnum() const{ return num; };
QString elaz() const{ return az; };
QString eldate() const{ return date; };
QString elen() const{ return en; };
QString elmp() const{ return mp; };
QString elbp() const{ return bp; };
QString elar() const{ return ar; };
private:
QString name, // The name of the element
weight, // weight
density, // density
group, // group
ie, // ionisationenergie
num, // number ( e.g. Carbon is 6 )
az, // state of aggregation
date, // date of discovery
en, // electronegativity
mp, // meltingpoint
bp, // boilingpoint
ar; // atomic radius
};
class QGridLayout;
class PSEWidget : public QWidget
{
Q_OBJECT
public:
PSEWidget();
QGridLayout *bottom_grid;
private:
QGridLayout *maingrid;
void position( int, int&, int& );
+ public slots:
+ void slotShowElement();
+
};
#endif