summaryrefslogtreecommitdiff
Unidiff
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
@@ -12,91 +12,91 @@
12#include "dataTable.h" 12#include "dataTable.h"
13#include <qwidget.h> 13#include <qwidget.h>
14#include <qhbox.h> 14#include <qhbox.h>
15#include <qlabel.h> 15#include <qlabel.h>
16#include <qfont.h> 16#include <qfont.h>
17#include <qlayout.h> 17#include <qlayout.h>
18 18
19OxydataWidget::OxydataWidget(QWidget *parent) : QWidget(parent) 19OxydataWidget::OxydataWidget(QWidget *parent) : QWidget(parent)
20{ 20{
21 QGridLayout *qgrid = new QGridLayout( this, 2,1 ); 21 QGridLayout *qgrid = new QGridLayout( this, 2,1 );
22 QHBox *hbox = new QHBox( this ); 22 QHBox *hbox = new QHBox( this );
23 left = new QLabel( hbox ); 23 left = new QLabel( hbox );
24 middle = new QLabel( hbox ); 24 middle = new QLabel( hbox );
25 right = new QLabel( hbox ); 25 right = new QLabel( hbox );
26 26
27 DataTable = new OxydataTable( 9,2, this ); 27 DataTable = new OxydataTable( 9,2, this );
28 28
29 QFont bf; 29 QFont bf;
30 bf.setBold( true ); 30 bf.setBold( true );
31 bf.setPointSize( bf.pointSize()+2 ); 31 bf.setPointSize( bf.pointSize()+2 );
32 middle->setFont( bf ); 32 middle->setFont( bf );
33 33
34 setTable(); 34 setTable();
35 35
36 qgrid->addWidget( hbox,0,0 ); 36 qgrid->addWidget( hbox,0,0 );
37 qgrid->addWidget( DataTable,1,0 ); 37 qgrid->addWidget( DataTable,1,0 );
38} 38}
39 39
40void OxydataWidget::setElement( int el ) 40void OxydataWidget::setElement( int el )
41{ 41{
42 Config configobj( "oxygendata" ); 42 Config configobj( "oxygendata" );
43 configobj.setGroup( QString::number( el+1 )); 43 configobj.setGroup( QString::number( el+1 ));
44 44
45 left->setText( configobj.readEntry( "Symbol" ) ); 45 left->setText( configobj.readEntry( "Symbol" ) );
46 middle->setText( configobj.readEntry( "Name" ) ); 46 middle->setText( configobj.readEntry( "Name" ) );
47 right->setText( QString::number( el+1 ) ); 47 right->setText( QString::number( el+1 ) );
48 48
49 DataTable->setText( 0,1,configobj.readEntry( "Weight" ) ); 49 DataTable->setText( 0,1,configobj.readEntry( "Weight" ) );
50 DataTable->setText( 1,1,configobj.readEntry( "Block" ) ); 50 DataTable->setText( 1,1,configobj.readEntry( "Block" ) );
51 DataTable->setText( 2,1,configobj.readEntry( "Group" ) ); 51 DataTable->setText( 2,1,configobj.readEntry( "Group" ) );
52 DataTable->setText( 3,1,configobj.readEntry( "EN" ) ); 52 DataTable->setText( 3,1,configobj.readEntry( "EN" ) );
53 DataTable->setText( 4,1,configobj.readEntry( "AR" ) ) ; 53 DataTable->setText( 4,1,configobj.readEntry( "AR" ) ) ;
54 DataTable->setText( 5,1,configobj.readEntry( "IE" ) ); 54 DataTable->setText( 5,1,configobj.readEntry( "IE" ) );
55 DataTable->setText( 6,1,configobj.readEntry( "Density" ) ); 55 DataTable->setText( 6,1,configobj.readEntry( "Density" ) );
56 DataTable->setText( 7,1,configobj.readEntry( "BP" ) ); 56 DataTable->setText( 7,1,configobj.readEntry( "BP" ) );
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" )) ;
64 DataTable->setText( 2,0, tr( "Group" )) ; 64 DataTable->setText( 2,0, tr( "Group" )) ;
65 DataTable->setText( 3,0, tr( "Electronegativity" )) ; 65 DataTable->setText( 3,0, tr( "Electronegativity" )) ;
66 DataTable->setText( 4,0, tr( "Atomic radius" )) ; 66 DataTable->setText( 4,0, tr( "Atomic radius" )) ;
67 DataTable->setText( 5,0, tr( "Ionizationenergie" )) ; 67 DataTable->setText( 5,0, tr( "Ionizationenergie" )) ;
68 DataTable->setText( 6,0, tr( "Density" )) ; 68 DataTable->setText( 6,0, tr( "Density" )) ;
69 DataTable->setText( 7,0, tr( "Boilingpoint" ) ); 69 DataTable->setText( 7,0, tr( "Boilingpoint" ) );
70 DataTable->setText( 8,0, tr( "Meltingpoint" ) ); 70 DataTable->setText( 8,0, tr( "Meltingpoint" ) );
71} 71}
72 72
73OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent, 73OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent,
74 const char *name) : QTable(numRows, numRows, parent, name) 74 const char *name) : QTable(numRows, numRows, parent, name)
75{ 75{
76 this->setShowGrid( false ); 76 this->setShowGrid( false );
77 this->setHScrollBarMode(QScrollView::AlwaysOff); 77 this->setHScrollBarMode(QScrollView::AlwaysOff);
78 this->horizontalHeader()->hide(); 78 this->horizontalHeader()->hide();
79 this->verticalHeader()->hide(); 79 this->verticalHeader()->hide();
80 this->setTopMargin( 0 ); 80 this->setTopMargin( 0 );
81 this->setLeftMargin( 0 ); 81 this->setLeftMargin( 0 );
82} 82}
83 83
84void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected) 84void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected)
85{ 85{
86 if ( cr.width() == 0 || cr.height() == 0 ) 86 if ( cr.width() == 0 || cr.height() == 0 )
87 return; 87 return;
88 selected = FALSE; 88 selected = FALSE;
89 89
90 QTableItem *itm = item( row, col ); 90 QTableItem *itm = item( row, col );
91 QColorGroup colgrp = colorGroup(); 91 QColorGroup colgrp = colorGroup();
92 if ( itm ) 92 if ( itm )
93 { 93 {
94 if ( row%2 ) 94 if ( row%2 )
95 colgrp.setColor( QColorGroup::Base, QColor( cyan ) ); 95 colgrp.setColor( QColorGroup::Base, QColor( cyan ) );
96 else 96 else
97 colgrp.setColor( QColorGroup::Base, QColor( white ) ); 97 colgrp.setColor( QColorGroup::Base, QColor( white ) );
98 p->save(); 98 p->save();
99 itm->paint( p, colgrp, cr, selected ); 99 itm->paint( p, colgrp, cr, selected );
100 p->restore(); 100 p->restore();
101 } 101 }
102} 102}
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
@@ -1,70 +1,70 @@
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 10
11#ifndef _DATATABLE_H 11#ifndef _DATATABLE_H
12#define _DATATABLE_H 12#define _DATATABLE_H
13 13
14#include <qwidget.h> 14#include <qwidget.h>
15#include <qtable.h> 15#include <qtable.h>
16 16
17class QLabel; 17class QLabel;
18class OxydataTable; 18class OxydataTable;
19 19
20/* 20/*
21 * A OxydataWidget shows all known data of an element. It can 21 * A OxydataWidget shows all known data of an element. It can
22 * be used for both the PSE and the pure Data-Dialog. It is 22 * be used for both the PSE and the pure Data-Dialog. It is
23 * a simple QHBox with 2 QStrings in it plus a OxydataTable 23 * a simple QHBox with 2 QStrings in it plus a OxydataTable
24 * which contains the rest of the data. 24 * which contains the rest of the data.
25 * 25 *
26 * Author: Carsten Niehaus <cniehaus@handhelds.org> 26 * Author: Carsten Niehaus <cniehaus@handhelds.org>
27 */ 27 */
28 28
29class OxydataWidget : public QWidget 29class OxydataWidget : public QWidget
30{ 30{
31 Q_OBJECT 31 Q_OBJECT
32 32
33 public: 33 public:
34 OxydataWidget(QWidget *parent=0); 34 OxydataWidget(QWidget *parent=0);
35 35
36 QLabel *left, *middle, *right; 36 QLabel *left, *middle, *right;
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 );
44}; 44};
45 45
46/* 46/*
47 * A OxydataTable is derived from QTable. I recoded the paintCell to have 47 * A OxydataTable is derived from QTable. I recoded the paintCell to have
48 * different colors in the backgound. Furthermore this widget never has a 48 * different colors in the backgound. Furthermore this widget never has a
49 * grid, thus I removed that code in paintCell. 49 * grid, thus I removed that code in paintCell.
50 * 50 *
51 * Author: Carsten Niehaus <cniehaus@handhelds.org> 51 * Author: Carsten Niehaus <cniehaus@handhelds.org>
52 */ 52 */
53 53
54class OxydataTable : public QTable 54class OxydataTable : public QTable
55{ 55{
56 Q_OBJECT 56 Q_OBJECT
57 57
58 public: 58 public:
59 OxydataTable( int numRows, int numCols, 59 OxydataTable( int numRows, int numCols,
60 QWidget *parent = 0, const char *name = 0 ); 60 QWidget *parent = 0, const char *name = 0 );
61 61
62 protected: 62 protected:
63 /* 63 /*
64 * This method is reimplemented form QTable. It implements the colourisation 64 * This method is reimplemented form QTable. It implements the colourisation
65 * of every second row. 65 * of every second row.
66 */ 66 */
67 virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected ); 67 virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected );
68}; 68};
69 69
70#endif 70#endif
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
@@ -1,42 +1,42 @@
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 "datawidgetui.h" 10#include "datawidgetui.h"
11 11
12#include <qpe/config.h> 12#include <qpe/config.h>
13#include <qstring.h> 13#include <qstring.h>
14#include <qcombobox.h> 14#include <qcombobox.h>
15#include <qlayout.h> 15#include <qlayout.h>
16#include <qhbox.h> 16#include <qhbox.h>
17#include <qlabel.h> 17#include <qlabel.h>
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
25 dataCombo = new QComboBox( this ); 25 dataCombo = new QComboBox( this );
26 OxydataWidget *oxyDW = new OxydataWidget(this); 26 OxydataWidget *oxyDW = new OxydataWidget(this);
27 oxyDW->setElement( 1 ); 27 oxyDW->setElement( 1 );
28 qgrid->addWidget( dataCombo, 0,0); 28 qgrid->addWidget( dataCombo, 0,0);
29 qgrid->addWidget( oxyDW , 1,0 ); 29 qgrid->addWidget( oxyDW , 1,0 );
30 30
31 connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) ); 31 connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) );
32 Config configobj( "oxygendata" ); 32 Config configobj( "oxygendata" );
33 33
34 //read in all names of the 118 elements 34 //read in all names of the 118 elements
35 for ( int i = 1 ; i < 119 ; i++ ) 35 for ( int i = 1 ; i < 119 ; i++ )
36 { 36 {
37 configobj.setGroup( QString::number( i ) ); 37 configobj.setGroup( QString::number( i ) );
38 QString foo = configobj.readEntry( "Name" ); 38 QString foo = configobj.readEntry( "Name" );
39 dataCombo->insertItem( foo ); 39 dataCombo->insertItem( foo );
40 } 40 }
41} 41}
42 42
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
@@ -1,24 +1,25 @@
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
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
@@ -1,29 +1,34 @@
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
16class OxyFrame : public QFrame 16class 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 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
@@ -1,63 +1,59 @@
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 <qlabel.h> 11#include <qlabel.h>
12#include <qapplication.h> 12#include <qapplication.h>
13#include <qpushbutton.h> 13#include <qpushbutton.h>
14#include <qvbox.h> 14#include <qvbox.h>
15#include "calcdlg.h" 15#include "calcdlg.h"
16#include "calcdlgui.h" 16#include "calcdlgui.h"
17#include "datawidgetui.h" 17#include "datawidgetui.h"
18#include "psewidget.h" 18#include "psewidget.h"
19 19
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 );
30 connect ( calcButton, SIGNAL( clicked() ), this, SLOT( slotCalculations() ) ); 28 connect ( calcButton, SIGNAL( clicked() ), this, SLOT( slotCalculations() ) );
31 QPushButton *pseButton = new QPushButton( "PSE", vbox ); 29 QPushButton *pseButton = new QPushButton( "PSE", vbox );
32 connect ( pseButton, SIGNAL( clicked() ), this, SLOT( slotPSE() ) ); 30 connect ( pseButton, SIGNAL( clicked() ), this, SLOT( slotPSE() ) );
33 31
34 setCentralWidget( vbox ); 32 setCentralWidget( vbox );
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();
62}; 58};
63 59
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
@@ -1,27 +1,26 @@
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 <qmainwindow.h> 10#include <qmainwindow.h>
11 11
12class QVBox; 12class QVBox;
13 13
14class Oxygen : public QMainWindow 14class Oxygen : public QMainWindow
15{ 15{
16 Q_OBJECT 16 Q_OBJECT
17 17
18 public: 18 public:
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
@@ -1,98 +1,94 @@
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>
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
31 QGridLayout *grid = new QGridLayout( 18,10 ); 24 QGridLayout *grid = new QGridLayout( 18,10 );
32 int h=0, v=0; 25 int h=0, v=0;
33 for( int n = 0 ; n < 118 ; n++ ) 26 for( int n = 0 ; n < 118 ; n++ )
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{
54 //Hydrogen 50 //Hydrogen
55 if (n == 1) 51 if (n == 1)
56 { 52 {
57 h=0; v=0; 53 h=0; v=0;
58 } 54 }
59 55
60 56
61 //Helium 57 //Helium
62 if (n == 2) 58 if (n == 2)
63 { 59 {
64 h=680; v=0; 60 h=680; v=0;
65 } 61 }
66 62
67 63
68 //Lithium 64 //Lithium
69 if (n == 3) 65 if (n == 3)
70 { 66 {
71 h=0; v=40; 67 h=0; v=40;
72 } 68 }
73 69
74 70
75 //Beryllium 71 //Beryllium
76 if (n == 4) 72 if (n == 4)
77 { 73 {
78 h=40; v=40; 74 h=40; v=40;
79 } 75 }
80 76
81 77
82 //Boron-->Neon or Aluminum --> Argon 78 //Boron-->Neon or Aluminum --> Argon
83 if ((n >= 5 && n <= 10) || (n >= 13 && n <= 18)) 79 if ((n >= 5 && n <= 10) || (n >= 13 && n <= 18))
84 for (int i = 1; i <= (6-(10-n)); i++) 80 for (int i = 1; i <= (6-(10-n)); i++)
85 { 81 {
86 h=((i*40)+440); 82 h=((i*40)+440);
87 v = 40; 83 v = 40;
88 if (n >= 13) 84 if (n >= 13)
89 { 85 {
90 v=80; 86 v=80;
91 h=(h-320); 87 h=(h-320);
92 } 88 }
93 } 89 }
94 90
95 91
96 //Sodium 92 //Sodium
97 if (n == 11) 93 if (n == 11)
98 { 94 {
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
@@ -1,84 +1,37 @@
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
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{
68 Q_OBJECT 20 Q_OBJECT
69 21
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;
76 29
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
84#endif 37#endif