summaryrefslogtreecommitdiff
authorcniehaus <cniehaus>2002-09-19 20:47:36 (UTC)
committer cniehaus <cniehaus>2002-09-19 20:47:36 (UTC)
commit65ba4e3610c94ba1de71a41dd6bf69662555e206 (patch) (unidiff)
tree696c3d7317a3c5a13f14160d9281fe4e889cf5bc
parentf4162d2283ebf0327645e0ac66b539cf87565d0b (diff)
downloadopie-65ba4e3610c94ba1de71a41dd6bf69662555e206.zip
opie-65ba4e3610c94ba1de71a41dd6bf69662555e206.tar.gz
opie-65ba4e3610c94ba1de71a41dd6bf69662555e206.tar.bz2
* codecleanup
* adding some const * if you click on a "element" you will now really get the information * removed obsolete class
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/oxygen/dataTable.cpp2
-rw-r--r--noncore/apps/oxygen/dataTable.h2
-rw-r--r--noncore/apps/oxygen/datawidgetui.cpp2
-rw-r--r--noncore/apps/oxygen/oxyframe.cpp5
-rw-r--r--noncore/apps/oxygen/oxyframe.h7
-rw-r--r--noncore/apps/oxygen/oxygen.cpp14
-rw-r--r--noncore/apps/oxygen/oxygen.h9
-rw-r--r--noncore/apps/oxygen/psewidget.cpp20
-rw-r--r--noncore/apps/oxygen/psewidget.h53
9 files changed, 32 insertions, 82 deletions
diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp
index 7516b06..870ac56 100644
--- a/noncore/apps/oxygen/dataTable.cpp
+++ b/noncore/apps/oxygen/dataTable.cpp
@@ -57,7 +57,7 @@ void OxydataWidget::setElement( int el )
57 DataTable->setText( 8,1,configobj.readEntry( "MP" ) ); 57 DataTable->setText( 8,1,configobj.readEntry( "MP" ) );
58} 58}
59 59
60void OxydataWidget::setTable() 60void OxydataWidget::setTable() const
61{ 61{
62 DataTable->setText( 0,0, tr( "Weight:" ) ); 62 DataTable->setText( 0,0, tr( "Weight:" ) );
63 DataTable->setText( 1,0, tr( "Block" )) ; 63 DataTable->setText( 1,0, tr( "Block" )) ;
diff --git a/noncore/apps/oxygen/dataTable.h b/noncore/apps/oxygen/dataTable.h
index bdcaa99..ccc4300 100644
--- a/noncore/apps/oxygen/dataTable.h
+++ b/noncore/apps/oxygen/dataTable.h
@@ -37,7 +37,7 @@ class OxydataWidget : public QWidget
37 37
38 private: 38 private:
39 OxydataTable *DataTable; 39 OxydataTable *DataTable;
40 void setTable(); 40 void setTable() const;
41 41
42 public slots: 42 public slots:
43 void setElement( int ); 43 void setElement( int );
diff --git a/noncore/apps/oxygen/datawidgetui.cpp b/noncore/apps/oxygen/datawidgetui.cpp
index 8188515..2e99c0b 100644
--- a/noncore/apps/oxygen/datawidgetui.cpp
+++ b/noncore/apps/oxygen/datawidgetui.cpp
@@ -18,7 +18,7 @@
18 18
19dataWidgetUI::dataWidgetUI() : QWidget() 19dataWidgetUI::dataWidgetUI() : QWidget()
20{ 20{
21 this->setCaption("Chemical Data"); 21 this->setCaption( tr( "Chemical Data" ));
22 22
23 QGridLayout *qgrid = new QGridLayout( this, 2,1 ); 23 QGridLayout *qgrid = new QGridLayout( this, 2,1 );
24 24
diff --git a/noncore/apps/oxygen/oxyframe.cpp b/noncore/apps/oxygen/oxyframe.cpp
index d459d2b..2d7fc84 100644
--- a/noncore/apps/oxygen/oxyframe.cpp
+++ b/noncore/apps/oxygen/oxyframe.cpp
@@ -13,12 +13,13 @@
13 13
14OxyFrame::OxyFrame(QWidget *parent, const char *name) : QFrame(parent,name) 14OxyFrame::OxyFrame(QWidget *parent, const char *name) : QFrame(parent,name)
15{ 15{
16 N = name;
16 this->setFrameStyle( QFrame::Panel ); 17 this->setFrameStyle( QFrame::Panel );
17 this->setLineWidth( 2 ); 18 this->setLineWidth( 2 );
18 this->setFrameShadow( QFrame::Raised ); 19 this->setFrameShadow( QFrame::Raised );
19 this->setBackgroundColor( QColor( cyan ) ); 20 this->setBackgroundColor( QColor( green ) );
20} 21}
21 22
22void OxyFrame::mousePressEvent ( QMouseEvent * e ){ 23void OxyFrame::mousePressEvent ( QMouseEvent * e ){
23 emit clicked(); 24 emit num( N );
24}; 25};
diff --git a/noncore/apps/oxygen/oxyframe.h b/noncore/apps/oxygen/oxyframe.h
index 6ff9e27..a19f13c 100644
--- a/noncore/apps/oxygen/oxyframe.h
+++ b/noncore/apps/oxygen/oxyframe.h
@@ -22,8 +22,13 @@ class OxyFrame : public QFrame
22 22
23 void mousePressEvent( QMouseEvent *); 23 void mousePressEvent( QMouseEvent *);
24 24
25 QString N;
26
25 signals: 27 signals:
26 void clicked(); 28 /*
29 * this signal emits the name ( the elemen-number )
30 */
31 void num(QString);
27}; 32};
28 33
29#endif 34#endif
diff --git a/noncore/apps/oxygen/oxygen.cpp b/noncore/apps/oxygen/oxygen.cpp
index 2574841..4e293c7 100644
--- a/noncore/apps/oxygen/oxygen.cpp
+++ b/noncore/apps/oxygen/oxygen.cpp
@@ -20,10 +20,8 @@
20Oxygen::Oxygen() 20Oxygen::Oxygen()
21 : QMainWindow() 21 : QMainWindow()
22{ 22{
23 this->setCaption( "Oxygen" ); 23 this->setCaption( tr( "Oxygen" ) );
24 vbox = new QVBox( this ); 24 vbox = new QVBox( this );
25 QPushButton *setButton = new QPushButton( "Settings", vbox );
26 connect ( setButton, SIGNAL( clicked() ), this, SLOT( slotSettings() ) );
27 QPushButton *dataButton = new QPushButton( "Data", vbox ); 25 QPushButton *dataButton = new QPushButton( "Data", vbox );
28 connect ( dataButton, SIGNAL( clicked() ), this, SLOT( slotData() ) ); 26 connect ( dataButton, SIGNAL( clicked() ), this, SLOT( slotData() ) );
29 QPushButton *calcButton = new QPushButton( "Calculations", vbox ); 27 QPushButton *calcButton = new QPushButton( "Calculations", vbox );
@@ -35,27 +33,25 @@ Oxygen::Oxygen()
35} 33}
36 34
37 35
38void Oxygen::close() 36void Oxygen::close() const
39{ 37{
40 QApplication::exit(); 38 QApplication::exit();
41} 39}
42 40
43//SLOTS 41//SLOTS
44 42
45void Oxygen::slotCalculations(){ 43void Oxygen::slotCalculations() const{
46 calcDlgUI *CalcDlgUI = new calcDlgUI(); 44 calcDlgUI *CalcDlgUI = new calcDlgUI();
47 CalcDlgUI->show(); 45 CalcDlgUI->show();
48}; 46};
49 47
50void Oxygen::slotData(){ 48void Oxygen::slotData() const{
51 dataWidgetUI *DataWidgetUI = new dataWidgetUI(); 49 dataWidgetUI *DataWidgetUI = new dataWidgetUI();
52 DataWidgetUI->showMaximized(); 50 DataWidgetUI->showMaximized();
53 DataWidgetUI->show(); 51 DataWidgetUI->show();
54}; 52};
55 53
56void Oxygen::slotSettings(){ }; 54void Oxygen::slotPSE() const{
57
58void Oxygen::slotPSE(){
59 PSEWidget *pse = new PSEWidget(); 55 PSEWidget *pse = new PSEWidget();
60 pse->showMaximized(); 56 pse->showMaximized();
61 pse->show(); 57 pse->show();
diff --git a/noncore/apps/oxygen/oxygen.h b/noncore/apps/oxygen/oxygen.h
index 71914eb..2a10666 100644
--- a/noncore/apps/oxygen/oxygen.h
+++ b/noncore/apps/oxygen/oxygen.h
@@ -19,9 +19,8 @@ class Oxygen : public QMainWindow
19 Oxygen(); 19 Oxygen();
20 QVBox *vbox; 20 QVBox *vbox;
21 private slots: 21 private slots:
22 void slotCalculations(); 22 void slotCalculations() const;
23 void slotSettings(); 23 void slotData() const;
24 void slotData(); 24 void slotPSE() const;
25 void slotPSE(); 25 void close() const;
26 void close();
27}; 26};
diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp
index 506e0cb..f7725e3 100644
--- a/noncore/apps/oxygen/psewidget.cpp
+++ b/noncore/apps/oxygen/psewidget.cpp
@@ -9,22 +9,15 @@
9 9
10#include <qpe/config.h> 10#include <qpe/config.h>
11#include <qlayout.h> 11#include <qlayout.h>
12#include <qlabel.h>
13#include <qlist.h> 12#include <qlist.h>
14#include <qvbox.h>
15#include "dataTable.h" 13#include "dataTable.h"
16#include "psewidget.h" 14#include "psewidget.h"
17#include "oxyframe.h" 15#include "oxyframe.h"
18 16
19 17
20/*Element::Element( const QString &name )
21{
22}*/
23
24
25PSEWidget::PSEWidget() : QWidget() 18PSEWidget::PSEWidget() : QWidget()
26{ 19{
27 this->setCaption( "Periodic System" ); 20 this->setCaption( tr( "Periodic System" ) );
28 21
29 QVBoxLayout *vlay = new QVBoxLayout( this ); 22 QVBoxLayout *vlay = new QVBoxLayout( this );
30 23
@@ -34,20 +27,23 @@ PSEWidget::PSEWidget() : QWidget()
34 { 27 {
35 position( n+1,h,v ); 28 position( n+1,h,v );
36 QList<OxyFrame> PSEframe; 29 QList<OxyFrame> PSEframe;
37 PSEframe.append( new OxyFrame( this , QString::number( n ) ) ); 30 PSEframe.append( new OxyFrame( this , QString::number(n) ) );
38 grid->addWidget( PSEframe.current() , v/40+1 , h/40 ); 31 grid->addWidget( PSEframe.current() , v/40+1 , h/40 );
39 PSEframe.current()->setMinimumHeight( 11 ); 32 PSEframe.current()->setMinimumHeight( 11 );
40 connect( PSEframe.current(), SIGNAL( clicked() ), this, SLOT( slotShowElement() )); 33 connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( slotShowElement(QString) ));
41 } 34 }
42 35
43 OxydataWidget *oxyDW = new OxydataWidget(this); 36 oxyDW = new OxydataWidget(this);
44 oxyDW->setElement( 1 ); 37 oxyDW->setElement( 1 );
45 38
46 vlay->addLayout( grid ); 39 vlay->addLayout( grid );
47 vlay->addWidget( oxyDW ); 40 vlay->addWidget( oxyDW );
48} 41}
49 42
50void PSEWidget::slotShowElement(){ qDebug( "ja genau" );}; 43void PSEWidget::slotShowElement(QString number)
44{
45 oxyDW->setElement( number.toInt() );
46};
51 47
52void PSEWidget::position(int n, int& h, int& v) 48void PSEWidget::position(int n, int& h, int& v)
53{ 49{
diff --git a/noncore/apps/oxygen/psewidget.h b/noncore/apps/oxygen/psewidget.h
index 2a1e85c..a7a8603 100644
--- a/noncore/apps/oxygen/psewidget.h
+++ b/noncore/apps/oxygen/psewidget.h
@@ -13,55 +13,7 @@
13#include <qwidget.h> 13#include <qwidget.h>
14 14
15class QGridLayout; 15class QGridLayout;
16 16class OxydataWidget;
17class Element
18{
19 public:
20 Element(const QString &elnum);
21 ~Element();
22
23 void setName( QString c){ name = c;};
24 void setWeight( QString c){ weight = c;};
25 void setDensityName( QString c){density = c;};
26 void setGroup( QString c){group = c;};
27 void setIE( QString c){ie = c;};
28 void setNum( QString c){num = c;};
29 void setAZ( QString c){az = c;};
30 void setDate( QString c){date = c;};
31 void setEN( QString c){en = c;};
32 void setMP( QString c){mp = c;};
33 void setBP( QString c){bp = c;};
34 void setAR( QString c){ar = c;};
35
36 QString elname() const{ return name; };
37 QString elweight() const{ return weight; };
38 QString eldensity() const{ return density; };
39 QString elgroup() const{ return group; };
40 QString elie() const{ return ie; };
41 QString elnum() const{ return num; };
42 QString elaz() const{ return az; };
43 QString eldate() const{ return date; };
44 QString elen() const{ return en; };
45 QString elmp() const{ return mp; };
46 QString elbp() const{ return bp; };
47 QString elar() const{ return ar; };
48
49 private:
50 QString name, // The name of the element
51 weight, // weight
52 density, // density
53 group, // group
54 ie, // ionisationenergie
55 num, // number ( e.g. Carbon is 6 )
56 az, // state of aggregation
57 date, // date of discovery
58 en, // electronegativity
59 mp, // meltingpoint
60 bp, // boilingpoint
61 ar; // atomic radius
62};
63
64class QGridLayout;
65 17
66class PSEWidget : public QWidget 18class PSEWidget : public QWidget
67{ 19{
@@ -70,6 +22,7 @@ class PSEWidget : public QWidget
70 public: 22 public:
71 PSEWidget(); 23 PSEWidget();
72 QGridLayout *bottom_grid; 24 QGridLayout *bottom_grid;
25 OxydataWidget *oxyDW;
73 26
74 private: 27 private:
75 QGridLayout *maingrid; 28 QGridLayout *maingrid;
@@ -77,7 +30,7 @@ class PSEWidget : public QWidget
77 void position( int, int&, int& ); 30 void position( int, int&, int& );
78 31
79 public slots: 32 public slots:
80 void slotShowElement(); 33 void slotShowElement(QString);
81 34
82}; 35};
83 36