author | cniehaus <cniehaus> | 2002-09-20 19:24:32 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2002-09-20 19:24:32 (UTC) |
commit | 681e6e75efaa5577d376d0bb191afdf323cb4e75 (patch) (unidiff) | |
tree | d35ee106655e5b288e73491a2701ddc0141f4fde | |
parent | c958d7cb5069e06b5cf9e9df6e78bcb644ce26a2 (diff) | |
download | opie-681e6e75efaa5577d376d0bb191afdf323cb4e75.zip opie-681e6e75efaa5577d376d0bb191afdf323cb4e75.tar.gz opie-681e6e75efaa5577d376d0bb191afdf323cb4e75.tar.bz2 |
before starting to hack QTableItem I wanted to have a safe point in cvs
-rw-r--r-- | noncore/apps/oxygen/calcdlgui.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/oxygen/dataTable.cpp | 24 | ||||
-rw-r--r-- | noncore/apps/oxygen/dataTable.h | 11 | ||||
-rw-r--r-- | noncore/apps/oxygen/datawidgetui.cpp | 25 | ||||
-rw-r--r-- | noncore/apps/oxygen/datawidgetui.h | 18 | ||||
-rw-r--r-- | noncore/apps/oxygen/main.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/oxygen/oxyframe.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/oxygen/oxyframe.h | 7 | ||||
-rw-r--r-- | noncore/apps/oxygen/oxygen.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/oxygen/psewidget.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/oxygen/psewidget.h | 7 |
11 files changed, 121 insertions, 11 deletions
diff --git a/noncore/apps/oxygen/calcdlgui.cpp b/noncore/apps/oxygen/calcdlgui.cpp index e40e2c7..b6dfff3 100644 --- a/noncore/apps/oxygen/calcdlgui.cpp +++ b/noncore/apps/oxygen/calcdlgui.cpp | |||
@@ -1,57 +1,65 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : Oxygen | ||
3 | |||
4 | begin : September 2002 | ||
5 | copyright : ( C ) 2002 by Carsten Niehaus | ||
6 | email : cniehaus@handhelds.org | ||
7 | **************************************************************************/ | ||
8 | |||
9 | /*************************************************************************** | ||
2 | * * | 10 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 11 | * 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 * | 12 | * 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 * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
7 | * * | 15 | * * |
8 | **************************************************************************/ | 16 | **************************************************************************/ |
9 | #include "oxygen.h" | 17 | #include "oxygen.h" |
10 | 18 | ||
11 | #include "calcdlgui.h" | 19 | #include "calcdlgui.h" |
12 | #include "kmolcalc.h" | 20 | #include "kmolcalc.h" |
13 | #include <qlineedit.h> | 21 | #include <qlineedit.h> |
14 | #include <qmultilineedit.h> | 22 | #include <qmultilineedit.h> |
15 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
16 | 24 | ||
17 | calcDlgUI::calcDlgUI() : CalcDlg() | 25 | calcDlgUI::calcDlgUI() : CalcDlg() |
18 | { | 26 | { |
19 | this->showMaximized(); | 27 | this->showMaximized(); |
20 | kmolcalc = new KMolCalc; | 28 | kmolcalc = new KMolCalc; |
21 | connect( calculate, SIGNAL( clicked() ), this, SLOT( calc() ) ); | 29 | connect( calculate, SIGNAL( clicked() ), this, SLOT( calc() ) ); |
22 | connect( clear_fields, SIGNAL( clicked() ), this, SLOT( clear() ) ); | 30 | connect( clear_fields, SIGNAL( clicked() ), this, SLOT( clear() ) ); |
23 | result->setReadOnly( true ); | 31 | result->setReadOnly( true ); |
24 | } | 32 | } |
25 | 33 | ||
26 | void calcDlgUI::calc() | 34 | void calcDlgUI::calc() |
27 | { | 35 | { |
28 | QString compound( formula->text() ); | 36 | QString compound( formula->text() ); |
29 | if ( compound.isEmpty() ) { | 37 | if ( compound.isEmpty() ) { |
30 | clear(); | 38 | clear(); |
31 | return; | 39 | return; |
32 | } | 40 | } |
33 | QString errors( kmolcalc->readFormula( compound ) ); | 41 | QString errors( kmolcalc->readFormula( compound ) ); |
34 | QString mw, ea; | 42 | QString mw, ea; |
35 | double weight = kmolcalc->getWeight(); | 43 | double weight = kmolcalc->getWeight(); |
36 | if ( errors == "OK" ) { | 44 | if ( errors == "OK" ) { |
37 | mw.setNum( weight ); | 45 | mw.setNum( weight ); |
38 | ea = kmolcalc->getEmpFormula() + " :\n" + kmolcalc->getEA(); | 46 | ea = kmolcalc->getEmpFormula() + " :\n" + kmolcalc->getEA(); |
39 | } else { | 47 | } else { |
40 | mw = "???"; | 48 | mw = "???"; |
41 | ea = tr( "ERROR: \n" ) + errors + "\n"; | 49 | ea = tr( "ERROR: \n" ) + errors + "\n"; |
42 | } | 50 | } |
43 | result->setText( mw ); | 51 | result->setText( mw ); |
44 | anal_display->setText( ea ); | 52 | anal_display->setText( ea ); |
45 | } | 53 | } |
46 | 54 | ||
47 | /** | 55 | /** |
48 | * * Clear all text entry / result fields. | 56 | * * Clear all text entry / result fields. |
49 | * */ | 57 | * */ |
50 | void calcDlgUI::clear() | 58 | void calcDlgUI::clear() |
51 | { | 59 | { |
52 | formula->clear(); | 60 | formula->clear(); |
53 | result->clear(); | 61 | result->clear(); |
54 | anal_display->clear(); | 62 | anal_display->clear(); |
55 | } | 63 | } |
56 | 64 | ||
57 | 65 | ||
diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp index 70b5a6a..ff01417 100644 --- a/noncore/apps/oxygen/dataTable.cpp +++ b/noncore/apps/oxygen/dataTable.cpp | |||
@@ -1,102 +1,122 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : Oxygen | ||
3 | |||
4 | begin : September 2002 | ||
5 | copyright : ( C ) 2002 by Carsten Niehaus | ||
6 | email : cniehaus@handhelds.org | ||
7 | **************************************************************************/ | ||
8 | |||
9 | /*************************************************************************** | ||
2 | * * | 10 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 11 | * 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 * | 12 | * 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 * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
7 | * * | 15 | * * |
8 | **************************************************************************/ | 16 | **************************************************************************/ |
9 | 17 | ||
10 | #include <qpe/config.h> | 18 | #include <qpe/config.h> |
11 | 19 | ||
12 | #include "dataTable.h" | 20 | #include "dataTable.h" |
13 | #include <qwidget.h> | 21 | #include <qwidget.h> |
14 | #include <qhbox.h> | 22 | #include <qhbox.h> |
15 | #include <qlabel.h> | 23 | #include <qlabel.h> |
16 | #include <qfont.h> | 24 | #include <qfont.h> |
17 | #include <qlayout.h> | 25 | #include <qlayout.h> |
18 | 26 | ||
19 | OxydataWidget::OxydataWidget(QWidget *parent) : QWidget(parent) | 27 | OxydataWidget::OxydataWidget(QWidget *parent) : QWidget(parent) |
20 | { | 28 | { |
21 | QGridLayout *qgrid = new QGridLayout( this, 2,1 ); | 29 | QGridLayout *qgrid = new QGridLayout( this, 2,1 ); |
30 | |||
22 | QHBox *hbox = new QHBox( this ); | 31 | QHBox *hbox = new QHBox( this ); |
23 | left = new QLabel( hbox ); | 32 | left = new QLabel( hbox ); |
24 | middle = new QLabel( hbox ); | 33 | middle = new QLabel( hbox ); |
25 | right = new QLabel( hbox ); | 34 | right = new QLabel( hbox ); |
26 | 35 | ||
27 | DataTable = new OxydataTable( 9,2, this ); | 36 | right->setAlignment( AlignRight ); |
28 | 37 | middle->setAlignment( AlignHCenter ); | |
38 | |||
29 | QFont bf; | 39 | QFont bf; |
30 | bf.setBold( true ); | 40 | bf.setBold( true ); |
31 | bf.setPointSize( bf.pointSize()+2 ); | 41 | bf.setPointSize( bf.pointSize()+2 ); |
32 | middle->setFont( bf ); | 42 | middle->setFont( bf ); |
33 | 43 | ||
44 | DataTable = new OxydataTable( 9,2, this ); | ||
45 | DataTable->setColumnWidth ( 1 , 118 ); | ||
46 | DataTable->setColumnWidth ( 0 , 118 ); | ||
34 | setTable(); | 47 | setTable(); |
35 | 48 | ||
36 | qgrid->addWidget( hbox,0,0 ); | 49 | qgrid->addWidget( hbox,0,0 ); |
37 | qgrid->addWidget( DataTable,1,0 ); | 50 | qgrid->addWidget( DataTable,1,0 ); |
38 | } | 51 | } |
39 | 52 | ||
40 | void OxydataWidget::setElement( int el ) | 53 | void OxydataWidget::setElement( int el ) |
41 | { | 54 | { |
42 | Config configobj( "oxygendata" ); | 55 | Config configobj( "oxygendata" ); |
43 | configobj.setGroup( QString::number( el+1 )); | 56 | configobj.setGroup( QString::number( el+1 )); |
44 | 57 | ||
45 | left->setText( configobj.readEntry( "Symbol" ) ); | 58 | left->setText( configobj.readEntry( "Symbol" ) ); |
46 | middle->setText( configobj.readEntry( "Name" ) ); | 59 | middle->setText( configobj.readEntry( "Name" ) ); |
47 | right->setText( QString::number( el+1 ) ); | 60 | right->setText( QString::number( el+1 ) ); |
48 | 61 | ||
49 | DataTable->setText( 0,1,configobj.readEntry( "Weight" ) ); | 62 | DataTable->setText( 0,1,configobj.readEntry( "Weight" ) ); |
50 | DataTable->setText( 1,1,configobj.readEntry( "Block" ) ); | 63 | DataTable->setText( 1,1,configobj.readEntry( "Block" ) ); |
51 | DataTable->setText( 2,1,configobj.readEntry( "Group" ) ); | 64 | DataTable->setText( 2,1,configobj.readEntry( "Group" ) ); |
52 | DataTable->setText( 3,1,configobj.readEntry( "EN" ) ); | 65 | DataTable->setText( 3,1,configobj.readEntry( "EN" ) ); |
53 | DataTable->setText( 4,1,configobj.readEntry( "AR" ) ) ; | 66 | DataTable->setText( 4,1,configobj.readEntry( "AR" ) ) ; |
54 | DataTable->setText( 5,1,configobj.readEntry( "IE" ) ); | 67 | DataTable->setText( 5,1,configobj.readEntry( "IE" ) ); |
55 | DataTable->setText( 6,1,configobj.readEntry( "Density" ) ); | 68 | DataTable->setText( 6,1,configobj.readEntry( "Density" ) ); |
56 | DataTable->setText( 7,1,configobj.readEntry( "BP" ) ); | 69 | DataTable->setText( 7,1,configobj.readEntry( "BP" ) ); |
57 | DataTable->setText( 8,1,configobj.readEntry( "MP" ) ); | 70 | DataTable->setText( 8,1,configobj.readEntry( "MP" ) ); |
58 | } | 71 | } |
59 | 72 | ||
60 | void OxydataWidget::setTable() const | 73 | void OxydataWidget::setTable() const |
61 | { | 74 | { |
62 | DataTable->setText( 0,0, tr( "Weight:" ) ); | 75 | DataTable->setText( 0,0, tr( "Weight:" ) ); |
63 | DataTable->setText( 1,0, tr( "Block" )) ; | 76 | DataTable->setText( 1,0, tr( "Block" )) ; |
64 | DataTable->setText( 2,0, tr( "Group" )) ; | 77 | DataTable->setText( 2,0, tr( "Group" )) ; |
65 | DataTable->setText( 3,0, tr( "Electronegativity" )) ; | 78 | DataTable->setText( 3,0, tr( "Electronegativity" )) ; |
66 | DataTable->setText( 4,0, tr( "Atomic radius" )) ; | 79 | DataTable->setText( 4,0, tr( "Atomic radius" )) ; |
67 | DataTable->setText( 5,0, tr( "Ionizationenergie" )) ; | 80 | DataTable->setText( 5,0, tr( "Ionizationenergie" )) ; |
68 | DataTable->setText( 6,0, tr( "Density" )) ; | 81 | DataTable->setText( 6,0, tr( "Density" )) ; |
69 | DataTable->setText( 7,0, tr( "Boilingpoint" ) ); | 82 | DataTable->setText( 7,0, tr( "Boilingpoint" ) ); |
70 | DataTable->setText( 8,0, tr( "Meltingpoint" ) ); | 83 | DataTable->setText( 8,0, tr( "Meltingpoint" ) ); |
71 | } | 84 | } |
72 | 85 | ||
73 | OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent, | 86 | OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent, |
74 | const char *name) : QTable(numRows, numRows, parent, name) | 87 | const char *name) : QTable(numRows, numRows, parent, name) |
75 | { | 88 | { |
76 | this->setShowGrid( false ); | 89 | this->setShowGrid( false ); |
77 | this->setHScrollBarMode(QScrollView::AlwaysOff); | 90 | this->setHScrollBarMode(QScrollView::AlwaysOff); |
78 | this->horizontalHeader()->hide(); | 91 | this->horizontalHeader()->hide(); |
79 | this->verticalHeader()->hide(); | 92 | this->verticalHeader()->hide(); |
80 | this->setTopMargin( 0 ); | 93 | this->setTopMargin( 0 ); |
81 | this->setLeftMargin( 0 ); | 94 | this->setLeftMargin( 0 ); |
82 | } | 95 | } |
83 | 96 | ||
97 | int OxydataTable::alignment() const | ||
98 | { | ||
99 | return AlignLeft | AlignVCenter; | ||
100 | }; | ||
101 | |||
102 | |||
103 | |||
84 | void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected) | 104 | void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected) |
85 | { | 105 | { |
86 | if ( cr.width() == 0 || cr.height() == 0 ) | 106 | if ( cr.width() == 0 || cr.height() == 0 ) |
87 | return; | 107 | return; |
88 | selected = FALSE; | 108 | selected = FALSE; |
89 | 109 | ||
90 | QTableItem *itm = item( row, col ); | 110 | QTableItem *itm = item( row, col ); |
91 | QColorGroup colgrp = colorGroup(); | 111 | QColorGroup colgrp = colorGroup(); |
92 | if ( itm ) | 112 | if ( itm ) |
93 | { | 113 | { |
94 | if ( row%2 ) | 114 | if ( row%2 ) |
95 | colgrp.setColor( QColorGroup::Base, QColor( 180,200,210 ) ); | 115 | colgrp.setColor( QColorGroup::Base, QColor( 180,200,210 ) ); |
96 | else | 116 | else |
97 | colgrp.setColor( QColorGroup::Base, QColor( 230,235,235 ) ); | 117 | colgrp.setColor( QColorGroup::Base, QColor( 230,235,235 ) ); |
98 | p->save(); | 118 | p->save(); |
99 | itm->paint( p, colgrp, cr, selected ); | 119 | itm->paint( p, colgrp, cr, selected ); |
100 | p->restore(); | 120 | p->restore(); |
101 | } | 121 | } |
102 | } | 122 | } |
diff --git a/noncore/apps/oxygen/dataTable.h b/noncore/apps/oxygen/dataTable.h index ccc4300..00063d4 100644 --- a/noncore/apps/oxygen/dataTable.h +++ b/noncore/apps/oxygen/dataTable.h | |||
@@ -1,70 +1,81 @@ | |||
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 | ||
17 | class QLabel; | 17 | class QLabel; |
18 | class OxydataTable; | 18 | class OxydataTable; |
19 | class QTableItem; | ||
19 | 20 | ||
20 | /* | 21 | /* |
21 | * A OxydataWidget shows all known data of an element. It can | 22 | * 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 | 23 | * 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 | 24 | * a simple QHBox with 2 QStrings in it plus a OxydataTable |
24 | * which contains the rest of the data. | 25 | * which contains the rest of the data. |
25 | * | 26 | * |
26 | * Author: Carsten Niehaus <cniehaus@handhelds.org> | 27 | * Author: Carsten Niehaus <cniehaus@handhelds.org> |
27 | */ | 28 | */ |
28 | 29 | ||
29 | class OxydataWidget : public QWidget | 30 | class OxydataWidget : public QWidget |
30 | { | 31 | { |
31 | Q_OBJECT | 32 | Q_OBJECT |
32 | 33 | ||
33 | public: | 34 | public: |
34 | OxydataWidget(QWidget *parent=0); | 35 | OxydataWidget(QWidget *parent=0); |
35 | 36 | ||
36 | QLabel *left, *middle, *right; | 37 | QLabel *left, *middle, *right; |
37 | 38 | ||
38 | private: | 39 | private: |
39 | OxydataTable *DataTable; | 40 | OxydataTable *DataTable; |
40 | void setTable() const; | 41 | void setTable() const; |
41 | 42 | ||
42 | public slots: | 43 | public slots: |
43 | void setElement( int ); | 44 | void setElement( int ); |
44 | }; | 45 | }; |
45 | 46 | ||
46 | /* | 47 | /* |
47 | * A OxydataTable is derived from QTable. I recoded the paintCell to have | 48 | * A OxydataTable is derived from QTable. I recoded the paintCell to have |
48 | * different colors in the backgound. Furthermore this widget never has a | 49 | * different colors in the backgound. Furthermore this widget never has a |
49 | * grid, thus I removed that code in paintCell. | 50 | * grid, thus I removed that code in paintCell. |
50 | * | 51 | * |
51 | * Author: Carsten Niehaus <cniehaus@handhelds.org> | 52 | * Author: Carsten Niehaus <cniehaus@handhelds.org> |
52 | */ | 53 | */ |
53 | 54 | ||
54 | class OxydataTable : public QTable | 55 | class OxydataTable : public QTable |
55 | { | 56 | { |
56 | Q_OBJECT | 57 | Q_OBJECT |
57 | 58 | ||
58 | public: | 59 | public: |
59 | OxydataTable( int numRows, int numCols, | 60 | OxydataTable( int numRows, int numCols, |
60 | QWidget *parent = 0, const char *name = 0 ); | 61 | QWidget *parent = 0, const char *name = 0 ); |
61 | 62 | ||
63 | virtual int alignment() const; | ||
64 | // virtual QTableItem *item( int row, int col ) const; | ||
65 | |||
62 | protected: | 66 | protected: |
63 | /* | 67 | /* |
64 | * This method is reimplemented form QTable. It implements the colourisation | 68 | * This method is reimplemented form QTable. It implements the colourisation |
65 | * of every second row. | 69 | * of every second row. |
66 | */ | 70 | */ |
67 | virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected ); | 71 | virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected ); |
68 | }; | 72 | }; |
69 | 73 | ||
74 | //X class OxydataQTI : QTableItem | ||
75 | //X { | ||
76 | //X Q_OBJECT | ||
77 | //X | ||
78 | //X public: | ||
79 | //X OxydataQTI( | ||
80 | |||
70 | #endif | 81 | #endif |
diff --git a/noncore/apps/oxygen/datawidgetui.cpp b/noncore/apps/oxygen/datawidgetui.cpp index 2e99c0b..4dab109 100644 --- a/noncore/apps/oxygen/datawidgetui.cpp +++ b/noncore/apps/oxygen/datawidgetui.cpp | |||
@@ -1,42 +1,51 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : Oxygen | ||
3 | |||
4 | begin : September 2002 | ||
5 | copyright : ( C ) 2002 by Carsten Niehaus | ||
6 | email : cniehaus@handhelds.org | ||
7 | **************************************************************************/ | ||
8 | |||
9 | /*************************************************************************** | ||
2 | * * | 10 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 11 | * 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 * | 12 | * 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 * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
7 | * * | 15 | * * |
8 | **************************************************************************/ | 16 | **************************************************************************/ |
9 | 17 | ||
10 | #include "datawidgetui.h" | 18 | #include "datawidgetui.h" |
19 | #include "dataTable.h" | ||
11 | 20 | ||
12 | #include <qpe/config.h> | 21 | #include <qpe/config.h> |
13 | #include <qstring.h> | 22 | #include <qstring.h> |
14 | #include <qcombobox.h> | 23 | #include <qcombobox.h> |
15 | #include <qlayout.h> | 24 | #include <qlayout.h> |
16 | #include <qhbox.h> | 25 | #include <qhbox.h> |
17 | #include <qlabel.h> | 26 | #include <qlabel.h> |
18 | 27 | ||
19 | dataWidgetUI::dataWidgetUI() : QWidget() | 28 | dataWidgetUI::dataWidgetUI() : QWidget() |
20 | { | 29 | { |
21 | this->setCaption( tr( "Chemical Data" )); | 30 | this->setCaption( tr( "Chemical Data" )); |
22 | |||
23 | QGridLayout *qgrid = new QGridLayout( this, 2,1 ); | 31 | QGridLayout *qgrid = new QGridLayout( this, 2,1 ); |
24 | 32 | ||
25 | dataCombo = new QComboBox( this ); | 33 | dataCombo = new QComboBox( this ); |
26 | OxydataWidget *oxyDW = new OxydataWidget(this); | ||
27 | oxyDW->setElement( 1 ); | ||
28 | qgrid->addWidget( dataCombo, 0,0); | ||
29 | qgrid->addWidget( oxyDW , 1,0 ); | ||
30 | |||
31 | connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) ); | ||
32 | Config configobj( "oxygendata" ); | ||
33 | 34 | ||
34 | //read in all names of the 118 elements | 35 | //read in all names of the 118 elements |
36 | Config configobj( "oxygendata" ); | ||
35 | for ( int i = 1 ; i < 119 ; i++ ) | 37 | for ( int i = 1 ; i < 119 ; i++ ) |
36 | { | 38 | { |
37 | configobj.setGroup( QString::number( i ) ); | 39 | configobj.setGroup( QString::number( i ) ); |
38 | QString foo = configobj.readEntry( "Name" ); | 40 | QString foo = configobj.readEntry( "Name" ); |
39 | dataCombo->insertItem( foo ); | 41 | dataCombo->insertItem( foo ); |
40 | } | 42 | } |
43 | |||
44 | OxydataWidget *oxyDW = new OxydataWidget(this); | ||
45 | connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) ); | ||
46 | oxyDW->setElement( 1 ); | ||
47 | |||
48 | qgrid->addWidget( dataCombo, 0,0); | ||
49 | qgrid->addWidget( oxyDW , 1,0 ); | ||
41 | } | 50 | } |
42 | 51 | ||
diff --git a/noncore/apps/oxygen/datawidgetui.h b/noncore/apps/oxygen/datawidgetui.h index 5399c81..cd716ad 100644 --- a/noncore/apps/oxygen/datawidgetui.h +++ b/noncore/apps/oxygen/datawidgetui.h | |||
@@ -1,25 +1,41 @@ | |||
1 | #ifndef DATAWIDGETUI_H | ||
2 | #define DATAWIDGETUI_H | ||
3 | |||
4 | |||
5 | /*************************************************************************** | ||
6 | application: : Oxygen | ||
7 | |||
8 | begin : September 2002 | ||
9 | copyright : ( C ) 2002 by Carsten Niehaus | ||
10 | email : cniehaus@handhelds.org | ||
11 | **************************************************************************/ | ||
1 | 12 | ||
2 | /*************************************************************************** | 13 | /*************************************************************************** |
3 | * * | 14 | * * |
4 | * This program is free software; you can redistribute it and/or modify * | 15 | * 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 * | 16 | * 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 * | 17 | * the Free Software Foundation; either version 2 of the License, or * |
7 | * ( at your option ) any later version. * | 18 | * ( at your option ) any later version. * |
8 | * * | 19 | * * |
9 | **************************************************************************/ | 20 | **************************************************************************/ |
10 | #include "dataTable.h" | 21 | |
22 | |||
23 | class OxydataWidget; | ||
24 | class OxydataTable; | ||
11 | 25 | ||
12 | class QComboBox; | 26 | class QComboBox; |
27 | #include <qwidget.h> | ||
13 | 28 | ||
14 | class dataWidgetUI : public QWidget | 29 | class dataWidgetUI : public QWidget |
15 | { | 30 | { |
16 | Q_OBJECT | 31 | Q_OBJECT |
17 | 32 | ||
18 | public: | 33 | public: |
19 | dataWidgetUI(); | 34 | dataWidgetUI(); |
20 | 35 | ||
21 | private: | 36 | private: |
22 | OxydataTable *DataTable; | 37 | OxydataTable *DataTable; |
23 | QComboBox *dataCombo; | 38 | QComboBox *dataCombo; |
24 | OxydataWidget *oxyDW; | 39 | OxydataWidget *oxyDW; |
25 | }; | 40 | }; |
41 | #endif | ||
diff --git a/noncore/apps/oxygen/main.cpp b/noncore/apps/oxygen/main.cpp index 31e44dc..c8fcdb4 100644 --- a/noncore/apps/oxygen/main.cpp +++ b/noncore/apps/oxygen/main.cpp | |||
@@ -1,21 +1,29 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : Oxygen | ||
3 | |||
4 | begin : September 2002 | ||
5 | copyright : ( C ) 2002 by Carsten Niehaus | ||
6 | email : cniehaus@handhelds.org | ||
7 | **************************************************************************/ | ||
8 | |||
9 | /*************************************************************************** | ||
2 | * * | 10 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 11 | * 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 * | 12 | * 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 * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
7 | * * | 15 | * * |
8 | **************************************************************************/ | 16 | **************************************************************************/ |
9 | 17 | ||
10 | 18 | ||
11 | #include <qpe/qpeapplication.h> | 19 | #include <qpe/qpeapplication.h> |
12 | #include "oxygen.h" | 20 | #include "oxygen.h" |
13 | 21 | ||
14 | int main(int argc, char **argv) | 22 | int main(int argc, char **argv) |
15 | { | 23 | { |
16 | QPEApplication app(argc, argv); | 24 | QPEApplication app(argc, argv); |
17 | Oxygen *oxi = new Oxygen(); | 25 | Oxygen *oxi = new Oxygen(); |
18 | app.setMainWidget(oxi); | 26 | app.setMainWidget(oxi); |
19 | oxi->showMaximized(); | 27 | oxi->showMaximized(); |
20 | return app.exec(); | 28 | return app.exec(); |
21 | } | 29 | } |
diff --git a/noncore/apps/oxygen/oxyframe.cpp b/noncore/apps/oxygen/oxyframe.cpp index a5f262e..c61c8e5 100644 --- a/noncore/apps/oxygen/oxyframe.cpp +++ b/noncore/apps/oxygen/oxyframe.cpp | |||
@@ -1,25 +1,33 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : Oxygen | ||
3 | |||
4 | begin : September 2002 | ||
5 | copyright : ( C ) 2002 by Carsten Niehaus | ||
6 | email : cniehaus@handhelds.org | ||
7 | **************************************************************************/ | ||
8 | |||
9 | /*************************************************************************** | ||
2 | * * | 10 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 11 | * 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 * | 12 | * 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 * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
7 | * * | 15 | * * |
8 | **************************************************************************/ | 16 | **************************************************************************/ |
9 | #include "oxygen.h" | 17 | #include "oxygen.h" |
10 | 18 | ||
11 | #include <qpe/config.h> | 19 | #include <qpe/config.h> |
12 | #include "oxyframe.h" | 20 | #include "oxyframe.h" |
13 | 21 | ||
14 | OxyFrame::OxyFrame(QWidget *parent, const char *name) : QFrame(parent,name) | 22 | OxyFrame::OxyFrame(QWidget *parent, const char *name) : QFrame(parent,name) |
15 | { | 23 | { |
16 | N = name; | 24 | N = name; |
17 | this->setFrameStyle( QFrame::Box ); | 25 | this->setFrameStyle( QFrame::Box ); |
18 | this->setLineWidth( 0 ); | 26 | this->setLineWidth( 0 ); |
19 | this->setMidLineWidth( 1 ); | 27 | this->setMidLineWidth( 1 ); |
20 | this->setFrameShadow( QFrame::Sunken ); | 28 | this->setFrameShadow( QFrame::Sunken ); |
21 | } | 29 | } |
22 | 30 | ||
23 | void OxyFrame::mousePressEvent ( QMouseEvent * e ){ | 31 | void OxyFrame::mousePressEvent ( QMouseEvent * e ){ |
24 | emit num( N ); | 32 | emit num( N ); |
25 | }; | 33 | }; |
diff --git a/noncore/apps/oxygen/oxyframe.h b/noncore/apps/oxygen/oxyframe.h index a19f13c..4543504 100644 --- a/noncore/apps/oxygen/oxyframe.h +++ b/noncore/apps/oxygen/oxyframe.h | |||
@@ -1,34 +1,41 @@ | |||
1 | /*************************************************************************** | ||
2 | application: : Oxygen | ||
3 | |||
4 | begin : September 2002 | ||
5 | copyright : ( C ) 2002 by Carsten Niehaus | ||
6 | email : cniehaus@handhelds.org | ||
7 | **************************************************************************/ | ||
1 | 8 | ||
2 | /*************************************************************************** | 9 | /*************************************************************************** |
3 | * * | 10 | * * |
4 | * This program is free software; you can redistribute it and/or modify * | 11 | * 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 * | 12 | * 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 * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
7 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
8 | * * | 15 | * * |
9 | **************************************************************************/ | 16 | **************************************************************************/ |
10 | #ifndef _OXYFRAME_H | 17 | #ifndef _OXYFRAME_H |
11 | #define _OXYFRAME_H | 18 | #define _OXYFRAME_H |
12 | 19 | ||
13 | 20 | ||
14 | #include <qframe.h> | 21 | #include <qframe.h> |
15 | 22 | ||
16 | class OxyFrame : public QFrame | 23 | class OxyFrame : public QFrame |
17 | { | 24 | { |
18 | Q_OBJECT | 25 | Q_OBJECT |
19 | 26 | ||
20 | public: | 27 | public: |
21 | OxyFrame( QWidget *parent=0, const char *name=0); | 28 | OxyFrame( QWidget *parent=0, const char *name=0); |
22 | 29 | ||
23 | void mousePressEvent( QMouseEvent *); | 30 | void mousePressEvent( QMouseEvent *); |
24 | 31 | ||
25 | QString N; | 32 | QString N; |
26 | 33 | ||
27 | signals: | 34 | signals: |
28 | /* | 35 | /* |
29 | * this signal emits the name ( the elemen-number ) | 36 | * this signal emits the name ( the elemen-number ) |
30 | */ | 37 | */ |
31 | void num(QString); | 38 | void num(QString); |
32 | }; | 39 | }; |
33 | 40 | ||
34 | #endif | 41 | #endif |
diff --git a/noncore/apps/oxygen/oxygen.cpp b/noncore/apps/oxygen/oxygen.cpp index 4e293c7..b3392e1 100644 --- a/noncore/apps/oxygen/oxygen.cpp +++ b/noncore/apps/oxygen/oxygen.cpp | |||
@@ -1,59 +1,67 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : Oxygen | ||
3 | |||
4 | begin : September 2002 | ||
5 | copyright : ( C ) 2002 by Carsten Niehaus | ||
6 | email : cniehaus@handhelds.org | ||
7 | **************************************************************************/ | ||
8 | |||
9 | /*************************************************************************** | ||
2 | * * | 10 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 11 | * 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 * | 12 | * 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 * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
7 | * * | 15 | * * |
8 | **************************************************************************/ | 16 | **************************************************************************/ |
9 | #include "oxygen.h" | 17 | #include "oxygen.h" |
10 | 18 | ||
11 | #include <qlabel.h> | 19 | #include <qlabel.h> |
12 | #include <qapplication.h> | 20 | #include <qapplication.h> |
13 | #include <qpushbutton.h> | 21 | #include <qpushbutton.h> |
14 | #include <qvbox.h> | 22 | #include <qvbox.h> |
15 | #include "calcdlg.h" | 23 | #include "calcdlg.h" |
16 | #include "calcdlgui.h" | 24 | #include "calcdlgui.h" |
17 | #include "datawidgetui.h" | 25 | #include "datawidgetui.h" |
18 | #include "psewidget.h" | 26 | #include "psewidget.h" |
19 | 27 | ||
20 | Oxygen::Oxygen() | 28 | Oxygen::Oxygen() |
21 | : QMainWindow() | 29 | : QMainWindow() |
22 | { | 30 | { |
23 | this->setCaption( tr( "Oxygen" ) ); | 31 | this->setCaption( tr( "Oxygen" ) ); |
24 | vbox = new QVBox( this ); | 32 | vbox = new QVBox( this ); |
25 | QPushButton *dataButton = new QPushButton( "Data", vbox ); | 33 | QPushButton *dataButton = new QPushButton( "Data", vbox ); |
26 | connect ( dataButton, SIGNAL( clicked() ), this, SLOT( slotData() ) ); | 34 | connect ( dataButton, SIGNAL( clicked() ), this, SLOT( slotData() ) ); |
27 | QPushButton *calcButton = new QPushButton( "Calculations", vbox ); | 35 | QPushButton *calcButton = new QPushButton( "Calculations", vbox ); |
28 | connect ( calcButton, SIGNAL( clicked() ), this, SLOT( slotCalculations() ) ); | 36 | connect ( calcButton, SIGNAL( clicked() ), this, SLOT( slotCalculations() ) ); |
29 | QPushButton *pseButton = new QPushButton( "PSE", vbox ); | 37 | QPushButton *pseButton = new QPushButton( "PSE", vbox ); |
30 | connect ( pseButton, SIGNAL( clicked() ), this, SLOT( slotPSE() ) ); | 38 | connect ( pseButton, SIGNAL( clicked() ), this, SLOT( slotPSE() ) ); |
31 | 39 | ||
32 | setCentralWidget( vbox ); | 40 | setCentralWidget( vbox ); |
33 | } | 41 | } |
34 | 42 | ||
35 | 43 | ||
36 | void Oxygen::close() const | 44 | void Oxygen::close() const |
37 | { | 45 | { |
38 | QApplication::exit(); | 46 | QApplication::exit(); |
39 | } | 47 | } |
40 | 48 | ||
41 | //SLOTS | 49 | //SLOTS |
42 | 50 | ||
43 | void Oxygen::slotCalculations() const{ | 51 | void Oxygen::slotCalculations() const{ |
44 | calcDlgUI *CalcDlgUI = new calcDlgUI(); | 52 | calcDlgUI *CalcDlgUI = new calcDlgUI(); |
45 | CalcDlgUI->show(); | 53 | CalcDlgUI->show(); |
46 | }; | 54 | }; |
47 | 55 | ||
48 | void Oxygen::slotData() const{ | 56 | void Oxygen::slotData() const{ |
49 | dataWidgetUI *DataWidgetUI = new dataWidgetUI(); | 57 | dataWidgetUI *DataWidgetUI = new dataWidgetUI(); |
50 | DataWidgetUI->showMaximized(); | 58 | DataWidgetUI->showMaximized(); |
51 | DataWidgetUI->show(); | 59 | DataWidgetUI->show(); |
52 | }; | 60 | }; |
53 | 61 | ||
54 | void Oxygen::slotPSE() const{ | 62 | void Oxygen::slotPSE() const{ |
55 | PSEWidget *pse = new PSEWidget(); | 63 | PSEWidget *pse = new PSEWidget(); |
56 | pse->showMaximized(); | 64 | pse->showMaximized(); |
57 | pse->show(); | 65 | pse->show(); |
58 | }; | 66 | }; |
59 | 67 | ||
diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp index 78e54d5..a3bb505 100644 --- a/noncore/apps/oxygen/psewidget.cpp +++ b/noncore/apps/oxygen/psewidget.cpp | |||
@@ -1,166 +1,174 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : Oxygen | ||
3 | |||
4 | begin : September 2002 | ||
5 | copyright : ( C ) 2002 by Carsten Niehaus | ||
6 | email : cniehaus@handhelds.org | ||
7 | **************************************************************************/ | ||
8 | |||
9 | /*************************************************************************** | ||
2 | * * | 10 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 11 | * 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 * | 12 | * 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 * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
7 | * * | 15 | * * |
8 | **************************************************************************/ | 16 | **************************************************************************/ |
9 | 17 | ||
10 | #include <qpe/config.h> | 18 | #include <qpe/config.h> |
11 | #include <qlayout.h> | 19 | #include <qlayout.h> |
12 | #include <qlist.h> | 20 | #include <qlist.h> |
13 | #include "dataTable.h" | 21 | #include "dataTable.h" |
14 | #include "psewidget.h" | 22 | #include "psewidget.h" |
15 | #include "oxyframe.h" | 23 | #include "oxyframe.h" |
16 | 24 | ||
17 | 25 | ||
18 | PSEWidget::PSEWidget() : QWidget() | 26 | PSEWidget::PSEWidget() : QWidget() |
19 | { | 27 | { |
20 | this->setCaption( tr( "Periodic System" ) ); | 28 | this->setCaption( tr( "Periodic System" ) ); |
21 | 29 | ||
22 | QVBoxLayout *vlay = new QVBoxLayout( this ); | 30 | QVBoxLayout *vlay = new QVBoxLayout( this ); |
23 | 31 | ||
24 | QGridLayout *grid = new QGridLayout( 18,10 ); | 32 | QGridLayout *grid = new QGridLayout( 18,10 ); |
25 | int h=0, v=0; | 33 | int h=0, v=0; |
26 | 34 | ||
27 | Config configobj( "oxygendata" ); | 35 | Config configobj( "oxygendata" ); |
28 | for( int n = 0 ; n < 118 ; n++ ) | 36 | for( int n = 0 ; n < 118 ; n++ ) |
29 | { | 37 | { |
30 | configobj.setGroup( QString::number( n+1 )); | 38 | configobj.setGroup( QString::number( n+1 )); |
31 | 39 | ||
32 | position( n+1,h,v ); | 40 | position( n+1,h,v ); |
33 | QList<OxyFrame> PSEframe; | 41 | QList<OxyFrame> PSEframe; |
34 | PSEframe.append( new OxyFrame( this , QString::number(n) ) ); | 42 | PSEframe.append( new OxyFrame( this , QString::number(n) ) ); |
35 | grid->addWidget( PSEframe.current() , v/40+1 , h/40 ); | 43 | grid->addWidget( PSEframe.current() , v/40+1 , h/40 ); |
36 | PSEframe.current()->setMinimumHeight( 11 ); | 44 | PSEframe.current()->setMinimumHeight( 11 ); |
37 | PSEframe.current()->setPalette( QPalette( PSEColor( configobj.readEntry( "Block" ) ) ) ); | 45 | PSEframe.current()->setPalette( QPalette( PSEColor( configobj.readEntry( "Block" ) ) ) ); |
38 | connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( slotShowElement(QString) )); | 46 | connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( slotShowElement(QString) )); |
39 | } | 47 | } |
40 | 48 | ||
41 | oxyDW = new OxydataWidget(this); | 49 | oxyDW = new OxydataWidget(this); |
42 | oxyDW->setElement( 1 ); | 50 | oxyDW->setElement( 1 ); |
43 | 51 | ||
44 | vlay->addLayout( grid ); | 52 | vlay->addLayout( grid ); |
45 | vlay->addWidget( oxyDW ); | 53 | vlay->addWidget( oxyDW ); |
46 | } | 54 | } |
47 | 55 | ||
48 | QColor PSEWidget::PSEColor( QString block ) | 56 | QColor PSEWidget::PSEColor( QString block ) |
49 | { | 57 | { |
50 | QColor c; | 58 | QColor c; |
51 | if ( block == "s" ) c.setRgb( 213 , 233 , 231 ); | 59 | if ( block == "s" ) c.setRgb( 213 , 233 , 231 ); |
52 | else if ( block == "d" ) c.setRgb( 200,230,160 ); | 60 | else if ( block == "d" ) c.setRgb( 200,230,160 ); |
53 | else if ( block == "p" ) c.setRgb( 238,146,138 ); | 61 | else if ( block == "p" ) c.setRgb( 238,146,138 ); |
54 | else if ( block == "f" ) c.setRgb( 190 , 190 , 190 ); | 62 | else if ( block == "f" ) c.setRgb( 190 , 190 , 190 ); |
55 | return c; | 63 | return c; |
56 | }; | 64 | }; |
57 | 65 | ||
58 | void PSEWidget::slotShowElement(QString number) | 66 | void PSEWidget::slotShowElement(QString number) |
59 | { | 67 | { |
60 | oxyDW->setElement( number.toInt() ); | 68 | oxyDW->setElement( number.toInt() ); |
61 | }; | 69 | }; |
62 | 70 | ||
63 | void PSEWidget::position(int n, int& h, int& v) | 71 | void PSEWidget::position(int n, int& h, int& v) |
64 | { | 72 | { |
65 | //Hydrogen | 73 | //Hydrogen |
66 | if (n == 1) | 74 | if (n == 1) |
67 | { | 75 | { |
68 | h=0; v=0; | 76 | h=0; v=0; |
69 | } | 77 | } |
70 | 78 | ||
71 | 79 | ||
72 | //Helium | 80 | //Helium |
73 | if (n == 2) | 81 | if (n == 2) |
74 | { | 82 | { |
75 | h=680; v=0; | 83 | h=680; v=0; |
76 | } | 84 | } |
77 | 85 | ||
78 | 86 | ||
79 | //Lithium | 87 | //Lithium |
80 | if (n == 3) | 88 | if (n == 3) |
81 | { | 89 | { |
82 | h=0; v=40; | 90 | h=0; v=40; |
83 | } | 91 | } |
84 | 92 | ||
85 | 93 | ||
86 | //Beryllium | 94 | //Beryllium |
87 | if (n == 4) | 95 | if (n == 4) |
88 | { | 96 | { |
89 | h=40; v=40; | 97 | h=40; v=40; |
90 | } | 98 | } |
91 | 99 | ||
92 | 100 | ||
93 | //Boron-->Neon or Aluminum --> Argon | 101 | //Boron-->Neon or Aluminum --> Argon |
94 | if ((n >= 5 && n <= 10) || (n >= 13 && n <= 18)) | 102 | if ((n >= 5 && n <= 10) || (n >= 13 && n <= 18)) |
95 | for (int i = 1; i <= (6-(10-n)); i++) | 103 | for (int i = 1; i <= (6-(10-n)); i++) |
96 | { | 104 | { |
97 | h=((i*40)+440); | 105 | h=((i*40)+440); |
98 | v = 40; | 106 | v = 40; |
99 | if (n >= 13) | 107 | if (n >= 13) |
100 | { | 108 | { |
101 | v=80; | 109 | v=80; |
102 | h=(h-320); | 110 | h=(h-320); |
103 | } | 111 | } |
104 | } | 112 | } |
105 | 113 | ||
106 | 114 | ||
107 | //Sodium | 115 | //Sodium |
108 | if (n == 11) | 116 | if (n == 11) |
109 | { | 117 | { |
110 | h=0; v=80; | 118 | h=0; v=80; |
111 | } | 119 | } |
112 | 120 | ||
113 | 121 | ||
114 | //Magnesium | 122 | //Magnesium |
115 | if (n == 12) | 123 | if (n == 12) |
116 | { | 124 | { |
117 | h=40; v=80; | 125 | h=40; v=80; |
118 | } | 126 | } |
119 | 127 | ||
120 | 128 | ||
121 | //Potassium --> Uuo without La and Ac | 129 | //Potassium --> Uuo without La and Ac |
122 | if ((n >= 19 && n <= 56) || (n >= 72 && n <= 88) || n >= 104) | 130 | if ((n >= 19 && n <= 56) || (n >= 72 && n <= 88) || n >= 104) |
123 | for (int i = 1; i <= 18; i++) | 131 | for (int i = 1; i <= 18; i++) |
124 | { | 132 | { |
125 | int f = n; | 133 | int f = n; |
126 | if (n > 18) | 134 | if (n > 18) |
127 | f = n-18; | 135 | f = n-18; |
128 | if (n > 36) | 136 | if (n > 36) |
129 | f = n-36; | 137 | f = n-36; |
130 | if (n > 54) | 138 | if (n > 54) |
131 | f = n-54; | 139 | f = n-54; |
132 | if (n > 71) | 140 | if (n > 71) |
133 | f = n-68; | 141 | f = n-68; |
134 | if (n > 86) | 142 | if (n > 86) |
135 | f = n-86; | 143 | f = n-86; |
136 | if (n > 103) | 144 | if (n > 103) |
137 | f = n-100; | 145 | f = n-100; |
138 | 146 | ||
139 | h=((f*40)-40); | 147 | h=((f*40)-40); |
140 | 148 | ||
141 | v = 120; | 149 | v = 120; |
142 | if (n >= 37) | 150 | if (n >= 37) |
143 | v=160; | 151 | v=160; |
144 | if (n >= 55) | 152 | if (n >= 55) |
145 | v=200; | 153 | v=200; |
146 | if (n >= 87) | 154 | if (n >= 87) |
147 | v=240; | 155 | v=240; |
148 | } | 156 | } |
149 | 157 | ||
150 | 158 | ||
151 | //Lanthanum --> Lutetium and Actinum --> Lawrencium | 159 | //Lanthanum --> Lutetium and Actinum --> Lawrencium |
152 | if ((n >= 57 && n <= 71) || (n >= 89 && n <= 103)) | 160 | if ((n >= 57 && n <= 71) || (n >= 89 && n <= 103)) |
153 | for (int i = 1; i <= 14; i++) | 161 | for (int i = 1; i <= 14; i++) |
154 | { | 162 | { |
155 | int f = n; | 163 | int f = n; |
156 | if (n > 56) | 164 | if (n > 56) |
157 | f = n-55; | 165 | f = n-55; |
158 | if (n > 88) | 166 | if (n > 88) |
159 | f = n-87; | 167 | f = n-87; |
160 | h=(f*40); | 168 | h=(f*40); |
161 | v = 290; | 169 | v = 290; |
162 | if (n >= 89) | 170 | if (n >= 89) |
163 | v=330; | 171 | v=330; |
164 | } | 172 | } |
165 | v += 10; | 173 | v += 10; |
166 | } | 174 | } |
diff --git a/noncore/apps/oxygen/psewidget.h b/noncore/apps/oxygen/psewidget.h index f69eeb3..fdf838e 100644 --- a/noncore/apps/oxygen/psewidget.h +++ b/noncore/apps/oxygen/psewidget.h | |||
@@ -1,38 +1,45 @@ | |||
1 | /*************************************************************************** | ||
2 | application: : Oxygen | ||
3 | |||
4 | begin : September 2002 | ||
5 | copyright : ( C ) 2002 by Carsten Niehaus | ||
6 | email : cniehaus@handhelds.org | ||
7 | **************************************************************************/ | ||
1 | 8 | ||
2 | /*************************************************************************** | 9 | /*************************************************************************** |
3 | * * | 10 | * * |
4 | * This program is free software; you can redistribute it and/or modify * | 11 | * 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 * | 12 | * 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 * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
7 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
8 | * * | 15 | * * |
9 | **************************************************************************/ | 16 | **************************************************************************/ |
10 | #ifndef _PSEWIDGET_H | 17 | #ifndef _PSEWIDGET_H |
11 | #define _PSEWIDGET_H | 18 | #define _PSEWIDGET_H |
12 | 19 | ||
13 | #include <qwidget.h> | 20 | #include <qwidget.h> |
14 | 21 | ||
15 | class QGridLayout; | 22 | class QGridLayout; |
16 | class OxydataWidget; | 23 | class OxydataWidget; |
17 | 24 | ||
18 | class PSEWidget : public QWidget | 25 | class PSEWidget : public QWidget |
19 | { | 26 | { |
20 | Q_OBJECT | 27 | Q_OBJECT |
21 | 28 | ||
22 | public: | 29 | public: |
23 | PSEWidget(); | 30 | PSEWidget(); |
24 | QGridLayout *bottom_grid; | 31 | QGridLayout *bottom_grid; |
25 | OxydataWidget *oxyDW; | 32 | OxydataWidget *oxyDW; |
26 | 33 | ||
27 | private: | 34 | private: |
28 | QGridLayout *maingrid; | 35 | QGridLayout *maingrid; |
29 | 36 | ||
30 | void position( int, int&, int& ); | 37 | void position( int, int&, int& ); |
31 | QColor PSEColor( QString ); | 38 | QColor PSEColor( QString ); |
32 | 39 | ||
33 | public slots: | 40 | public slots: |
34 | void slotShowElement(QString); | 41 | void slotShowElement(QString); |
35 | 42 | ||
36 | }; | 43 | }; |
37 | 44 | ||
38 | #endif | 45 | #endif |