author | cniehaus <cniehaus> | 2002-09-19 20:47:36 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2002-09-19 20:47:36 (UTC) |
commit | 65ba4e3610c94ba1de71a41dd6bf69662555e206 (patch) (unidiff) | |
tree | 696c3d7317a3c5a13f14160d9281fe4e889cf5bc | |
parent | f4162d2283ebf0327645e0ac66b539cf87565d0b (diff) | |
download | opie-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
-rw-r--r-- | noncore/apps/oxygen/dataTable.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/oxygen/dataTable.h | 2 | ||||
-rw-r--r-- | noncore/apps/oxygen/datawidgetui.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/oxygen/oxyframe.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/oxygen/oxyframe.h | 7 | ||||
-rw-r--r-- | noncore/apps/oxygen/oxygen.cpp | 14 | ||||
-rw-r--r-- | noncore/apps/oxygen/oxygen.h | 9 | ||||
-rw-r--r-- | noncore/apps/oxygen/psewidget.cpp | 20 | ||||
-rw-r--r-- | noncore/apps/oxygen/psewidget.h | 53 |
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 | |||
@@ -36,49 +36,49 @@ OxydataWidget::OxydataWidget(QWidget *parent) : QWidget(parent) | |||
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 | ||
40 | void OxydataWidget::setElement( int el ) | 40 | void 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 | ||
60 | void OxydataWidget::setTable() | 60 | void 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 | ||
73 | OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent, | 73 | OxydataTable::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 | ||
84 | void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected) | 84 | void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected) |
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 | |||
@@ -16,49 +16,49 @@ | |||
16 | 16 | ||
17 | class QLabel; | 17 | class QLabel; |
18 | class OxydataTable; | 18 | class 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 | ||
29 | class OxydataWidget : public QWidget | 29 | class 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 | ||
54 | class OxydataTable : public QTable | 54 | class 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 |
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 | ||
19 | dataWidgetUI::dataWidgetUI() : QWidget() | 19 | dataWidgetUI::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 | ||
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 | 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 | ||
22 | void OxyFrame::mousePressEvent ( QMouseEvent * e ){ | 23 | void 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 | ||
16 | class OxyFrame : public QFrame | 16 | class 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 | ||
20 | Oxygen::Oxygen() | 20 | Oxygen::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 | ||
38 | void Oxygen::close() | 36 | void Oxygen::close() const |
39 | { | 37 | { |
40 | QApplication::exit(); | 38 | QApplication::exit(); |
41 | } | 39 | } |
42 | 40 | ||
43 | //SLOTS | 41 | //SLOTS |
44 | 42 | ||
45 | void Oxygen::slotCalculations(){ | 43 | void Oxygen::slotCalculations() const{ |
46 | calcDlgUI *CalcDlgUI = new calcDlgUI(); | 44 | calcDlgUI *CalcDlgUI = new calcDlgUI(); |
47 | CalcDlgUI->show(); | 45 | CalcDlgUI->show(); |
48 | }; | 46 | }; |
49 | 47 | ||
50 | void Oxygen::slotData(){ | 48 | void 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 | ||
56 | void Oxygen::slotSettings(){ }; | 54 | void Oxygen::slotPSE() const{ |
57 | |||
58 | void 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 | ||
12 | class QVBox; | 12 | class QVBox; |
13 | 13 | ||
14 | class Oxygen : public QMainWindow | 14 | class 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,74 +1,70 @@ | |||
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 | |||
25 | PSEWidget::PSEWidget() : QWidget() | 18 | PSEWidget::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 | ||
50 | void PSEWidget::slotShowElement(){ qDebug( "ja genau" );}; | 43 | void PSEWidget::slotShowElement(QString number) |
44 | { | ||
45 | oxyDW->setElement( number.toInt() ); | ||
46 | }; | ||
51 | 47 | ||
52 | void PSEWidget::position(int n, int& h, int& v) | 48 | void 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 | ||
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 | ||
15 | class QGridLayout; | 15 | class QGridLayout; |
16 | 16 | class OxydataWidget; | |
17 | class 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 | |||
64 | class QGridLayout; | ||
65 | 17 | ||
66 | class PSEWidget : public QWidget | 18 | class 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 |