summaryrefslogtreecommitdiff
authorcniehaus <cniehaus>2002-09-20 21:45:30 (UTC)
committer cniehaus <cniehaus>2002-09-20 21:45:30 (UTC)
commitd5db444cb70986baceda8ad1e01b0fb8384d12b4 (patch) (unidiff)
tree65cab6b3cfb9c67336ce4f3e61d3e9df2476d8ca
parent20c93734a4eada53d056f13558cbf60d6eff5bac (diff)
downloadopie-d5db444cb70986baceda8ad1e01b0fb8384d12b4.zip
opie-d5db444cb70986baceda8ad1e01b0fb8384d12b4.tar.gz
opie-d5db444cb70986baceda8ad1e01b0fb8384d12b4.tar.bz2
from now on I consider Oxygen as almost done :)
* the strange display-bug in the QTable is fixed. Now there are really only two colums and not a million or so * now the alingment is correct. I reimplemented virtual void alignment() in a class derived from QTableItem * s/setElement( 1 )/setElement( 0 )/ as that method starts with 0 and not 1 Credits to Robert Gogolok who did most of the reimplementation of the alignment.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/oxygen/dataTable.cpp35
-rw-r--r--noncore/apps/oxygen/dataTable.h23
-rw-r--r--noncore/apps/oxygen/datawidgetui.cpp2
-rw-r--r--noncore/apps/oxygen/psewidget.cpp2
4 files changed, 42 insertions, 20 deletions
diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp
index ff01417..f034c45 100644
--- a/noncore/apps/oxygen/dataTable.cpp
+++ b/noncore/apps/oxygen/dataTable.cpp
@@ -1,122 +1,141 @@
1/*************************************************************************** 1/***************************************************************************
2 application: : Oxygen 2 application: : Oxygen
3 3
4 begin : September 2002 4 begin : September 2002
5 copyright : ( C ) 2002 by Carsten Niehaus 5 copyright : ( C ) 2002 by Carsten Niehaus
6 email : cniehaus@handhelds.org 6 email : cniehaus@handhelds.org
7 **************************************************************************/ 7 **************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * 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 *
12 * 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 *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * ( at your option ) any later version. * 14 * ( at your option ) any later version. *
15 * * 15 * *
16 **************************************************************************/ 16 **************************************************************************/
17 17
18#include <qpe/config.h> 18#include <qpe/config.h>
19 19
20#include "dataTable.h" 20#include "dataTable.h"
21#include <qwidget.h> 21#include <qwidget.h>
22#include <qhbox.h> 22#include <qhbox.h>
23#include <qlabel.h> 23#include <qlabel.h>
24#include <qfont.h> 24#include <qfont.h>
25#include <qlayout.h> 25#include <qlayout.h>
26 26
27OxydataWidget::OxydataWidget(QWidget *parent) : QWidget(parent) 27OxydataWidget::OxydataWidget(QWidget *parent) : QWidget(parent)
28{ 28{
29 QGridLayout *qgrid = new QGridLayout( this, 2,1 ); 29 QGridLayout *qgrid = new QGridLayout( this, 2,1 );
30 30
31 QHBox *hbox = new QHBox( this ); 31 QHBox *hbox = new QHBox( this );
32 left = new QLabel( hbox ); 32 left = new QLabel( hbox );
33 middle = new QLabel( hbox ); 33 middle = new QLabel( hbox );
34 right = new QLabel( hbox ); 34 right = new QLabel( hbox );
35 35
36 right->setAlignment( AlignRight ); 36 right->setAlignment( AlignRight );
37 middle->setAlignment( AlignHCenter ); 37 middle->setAlignment( AlignHCenter );
38 38
39 QFont bf; 39 QFont bf;
40 bf.setBold( true ); 40 bf.setBold( true );
41 bf.setPointSize( bf.pointSize()+2 ); 41 bf.setPointSize( bf.pointSize()+2 );
42 middle->setFont( bf ); 42 middle->setFont( bf );
43 43
44 DataTable = new OxydataTable( 9,2, this ); 44 DataTable = new OxydataTable( 9,2, this );
45 DataTable->setColumnWidth ( 1 , 118 ); 45 DataTable->setColumnWidth ( 1 , 118 );
46 DataTable->setColumnWidth ( 0 , 118 ); 46 DataTable->setColumnWidth ( 0 , 118 );
47 setTable(); 47 setTable();
48 48
49 qgrid->addWidget( hbox,0,0 ); 49 qgrid->addWidget( hbox,0,0 );
50 qgrid->addWidget( DataTable,1,0 ); 50 qgrid->addWidget( DataTable,1,0 );
51} 51}
52 52
53void OxydataWidget::setElement( int el ) 53void OxydataWidget::setElement( int el )
54{ 54{
55 Config configobj( "oxygendata" ); 55 Config configobj( "oxygendata" );
56 configobj.setGroup( QString::number( el+1 )); 56 configobj.setGroup( QString::number( el+1 ));
57 57
58 left->setText( configobj.readEntry( "Symbol" ) ); 58 left->setText( configobj.readEntry( "Symbol" ) );
59 middle->setText( configobj.readEntry( "Name" ) ); 59 middle->setText( configobj.readEntry( "Name" ) );
60 right->setText( QString::number( el+1 ) ); 60 right->setText( QString::number( el+1 ) );
61 61
62
62 DataTable->setText( 0,1,configobj.readEntry( "Weight" ) ); 63 DataTable->setText( 0,1,configobj.readEntry( "Weight" ) );
63 DataTable->setText( 1,1,configobj.readEntry( "Block" ) ); 64 DataTable->setText( 1,1,configobj.readEntry( "Block" ) );
64 DataTable->setText( 2,1,configobj.readEntry( "Group" ) ); 65 DataTable->setText( 2,1,configobj.readEntry( "Group" ) );
65 DataTable->setText( 3,1,configobj.readEntry( "EN" ) ); 66 DataTable->setText( 3,1,configobj.readEntry( "EN" ) );
66 DataTable->setText( 4,1,configobj.readEntry( "AR" ) ) ; 67 DataTable->setText( 4,1,configobj.readEntry( "AR" ) ) ;
67 DataTable->setText( 5,1,configobj.readEntry( "IE" ) ); 68 DataTable->setText( 5,1,configobj.readEntry( "IE" ) );
68 DataTable->setText( 6,1,configobj.readEntry( "Density" ) ); 69 DataTable->setText( 6,1,configobj.readEntry( "Density" ) );
69 DataTable->setText( 7,1,configobj.readEntry( "BP" ) ); 70 DataTable->setText( 7,1,configobj.readEntry( "BP" ) );
70 DataTable->setText( 8,1,configobj.readEntry( "MP" ) ); 71 DataTable->setText( 8,1,configobj.readEntry( "MP" ) );
72
71} 73}
72 74
73void OxydataWidget::setTable() const 75void OxydataWidget::setTable() const
74{ 76{
75 DataTable->setText( 0,0, tr( "Weight:" ) ); 77 DataTable->setText( 0,0, tr( "Weight:" ) );
76 DataTable->setText( 1,0, tr( "Block" )) ; 78 DataTable->setText( 1,0, tr( "Block" )) ;
77 DataTable->setText( 2,0, tr( "Group" )) ; 79 DataTable->setText( 2,0, tr( "Group" )) ;
78 DataTable->setText( 3,0, tr( "Electronegativity" )) ; 80 DataTable->setText( 3,0, tr( "Electronegativity" )) ;
79 DataTable->setText( 4,0, tr( "Atomic radius" )) ; 81 DataTable->setText( 4,0, tr( "Atomic radius" )) ;
80 DataTable->setText( 5,0, tr( "Ionizationenergie" )) ; 82 DataTable->setText( 5,0, tr( "Ionizationenergie" )) ;
81 DataTable->setText( 6,0, tr( "Density" )) ; 83 DataTable->setText( 6,0, tr( "Density" )) ;
82 DataTable->setText( 7,0, tr( "Boilingpoint" ) ); 84 DataTable->setText( 7,0, tr( "Boilingpoint" ) );
83 DataTable->setText( 8,0, tr( "Meltingpoint" ) ); 85 DataTable->setText( 8,0, tr( "Meltingpoint" ) );
86
84} 87}
85 88
86OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent, 89OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent,
87 const char *name) : QTable(numRows, numRows, parent, name) 90 const char *name) : QTable(numRows, numCols,parent, name)
88{ 91{
92
93 for (int zeile = 0; zeile < numRows; zeile++)
94 for ( int spalte = 0; spalte < numCols; spalte++ )
95 {
96 OxydataQTI *testus = new OxydataQTI (this, OxydataQTI::Never, "hm" );
97 setItem(zeile, spalte, (QTableItem*)testus);
98 }
99
100
89 this->setShowGrid( false ); 101 this->setShowGrid( false );
90 this->setHScrollBarMode(QScrollView::AlwaysOff); 102 this->setHScrollBarMode(QScrollView::AlwaysOff);
91 this->horizontalHeader()->hide(); 103 this->horizontalHeader()->hide();
92 this->verticalHeader()->hide(); 104 this->verticalHeader()->hide();
93 this->setTopMargin( 0 ); 105 this->setTopMargin( 0 );
94 this->setLeftMargin( 0 ); 106 this->setLeftMargin( 0 );
95} 107}
96 108
97int OxydataTable::alignment() const
98{
99 return AlignLeft | AlignVCenter;
100};
101
102
103
104void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected) 109void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected)
105{ 110{
106 if ( cr.width() == 0 || cr.height() == 0 ) 111 if ( cr.width() == 0 || cr.height() == 0 )
107 return; 112 return;
108 selected = FALSE; 113 selected = FALSE;
109 114
110 QTableItem *itm = item( row, col ); 115 QTableItem *itm = item( row, col );
111 QColorGroup colgrp = colorGroup(); 116 QColorGroup colgrp = colorGroup();
112 if ( itm ) 117 if ( itm )
113 { 118 {
114 if ( row%2 ) 119 if ( row%2 )
115 colgrp.setColor( QColorGroup::Base, QColor( 180,200,210 ) ); 120 colgrp.setColor( QColorGroup::Base, QColor( 180,200,210 ) );
116 else 121 else
117 colgrp.setColor( QColorGroup::Base, QColor( 230,235,235 ) ); 122 colgrp.setColor( QColorGroup::Base, QColor( 230,235,235 ) );
118 p->save(); 123 p->save();
119 itm->paint( p, colgrp, cr, selected ); 124 itm->paint( p, colgrp, cr, selected );
120 p->restore(); 125 p->restore();
121 } 126 }
122} 127}
128
129OxydataQTI::OxydataQTI(QTable * table, EditType et, const QString & text )
130 : QTableItem ( table, et, text )
131{
132}
133
134int OxydataQTI::alignment() const
135{
136 if ( col()%2 )
137 {
138 return AlignRight | AlignVCenter;
139 }else return AlignLeft | AlignVCenter;
140};
141
diff --git a/noncore/apps/oxygen/dataTable.h b/noncore/apps/oxygen/dataTable.h
index 00063d4..a4a3b18 100644
--- a/noncore/apps/oxygen/dataTable.h
+++ b/noncore/apps/oxygen/dataTable.h
@@ -1,81 +1,84 @@
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;
19class QTableItem;
20 19
21/* 20/*
22 * A OxydataWidget shows all known data of an element. It can 21 * A OxydataWidget shows all known data of an element. It can
23 * 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
24 * a simple QHBox with 2 QStrings in it plus a OxydataTable 23 * a simple QHBox with 2 QStrings in it plus a OxydataTable
25 * which contains the rest of the data. 24 * which contains the rest of the data.
26 * 25 *
27 * Author: Carsten Niehaus <cniehaus@handhelds.org> 26 * Author: Carsten Niehaus <cniehaus@handhelds.org>
28 */ 27 */
29 28
30class OxydataWidget : public QWidget 29class OxydataWidget : public QWidget
31{ 30{
32 Q_OBJECT 31 Q_OBJECT
33 32
34 public: 33 public:
35 OxydataWidget(QWidget *parent=0); 34 OxydataWidget(QWidget *parent=0);
36 35
37 QLabel *left, *middle, *right; 36 QLabel *left, *middle, *right;
38 37
39 private: 38 private:
40 OxydataTable *DataTable; 39 OxydataTable *DataTable;
41 void setTable() const; 40 void setTable() const;
42 41
43 public slots: 42 public slots:
44 void setElement( int ); 43 void setElement( int );
45}; 44};
46 45
47/* 46/*
48 * 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
49 * different colors in the backgound. Furthermore this widget never has a 48 * different colors in the backgound. Furthermore this widget never has a
50 * grid, thus I removed that code in paintCell. 49 * grid, thus I removed that code in paintCell.
51 * 50 *
52 * Author: Carsten Niehaus <cniehaus@handhelds.org> 51 * Author: Carsten Niehaus <cniehaus@handhelds.org>
53 */ 52 */
54 53
55class OxydataTable : public QTable 54class OxydataTable : public QTable
56{ 55{
57 Q_OBJECT 56 Q_OBJECT
58 57
59 public: 58 public:
60 OxydataTable( int numRows, int numCols, 59 OxydataTable( int numRows, int numCols,
61 QWidget *parent = 0, const char *name = 0 ); 60 QWidget *parent = 0, const char *name = 0 );
62 61
63 virtual int alignment() const;
64// virtual QTableItem *item( int row, int col ) const;
65
66 protected: 62 protected:
67 /* 63 /*
68 * This method is reimplemented form QTable. It implements the colourisation 64 * This method is reimplemented form QTable. It implements the colourisation
69 * of every second row. 65 * of every second row.
70 */ 66 */
71 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 );
72}; 68};
69/*
70 * A OxydataQTI is a QTableItem which has the ability to set an alignment.
71 * In Oxygen we only have two colums so I can use the simple col()%2.
72 *
73 * Author: Robert Gogolok <robertgogolok@gmx.de>
74 */
73 75
74//X class OxydataQTI : QTableItem 76class OxydataQTI : public QTableItem
75//X { 77{
76//X Q_OBJECT 78 public:
77//X 79 OxydataQTI(QTable * table, EditType et, const QString & text );
78//X public: 80
79//X OxydataQTI( 81 virtual int alignment() const;
82};
80 83
81#endif 84#endif
diff --git a/noncore/apps/oxygen/datawidgetui.cpp b/noncore/apps/oxygen/datawidgetui.cpp
index 4dab109..422b6f8 100644
--- a/noncore/apps/oxygen/datawidgetui.cpp
+++ b/noncore/apps/oxygen/datawidgetui.cpp
@@ -1,51 +1,51 @@
1/*************************************************************************** 1/***************************************************************************
2 application: : Oxygen 2 application: : Oxygen
3 3
4 begin : September 2002 4 begin : September 2002
5 copyright : ( C ) 2002 by Carsten Niehaus 5 copyright : ( C ) 2002 by Carsten Niehaus
6 email : cniehaus@handhelds.org 6 email : cniehaus@handhelds.org
7 **************************************************************************/ 7 **************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * 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 *
12 * 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 *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * ( at your option ) any later version. * 14 * ( at your option ) any later version. *
15 * * 15 * *
16 **************************************************************************/ 16 **************************************************************************/
17 17
18#include "datawidgetui.h" 18#include "datawidgetui.h"
19#include "dataTable.h" 19#include "dataTable.h"
20 20
21#include <qpe/config.h> 21#include <qpe/config.h>
22#include <qstring.h> 22#include <qstring.h>
23#include <qcombobox.h> 23#include <qcombobox.h>
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qhbox.h> 25#include <qhbox.h>
26#include <qlabel.h> 26#include <qlabel.h>
27 27
28dataWidgetUI::dataWidgetUI() : QWidget() 28dataWidgetUI::dataWidgetUI() : QWidget()
29{ 29{
30 this->setCaption( tr( "Chemical Data" )); 30 this->setCaption( tr( "Chemical Data" ));
31 QGridLayout *qgrid = new QGridLayout( this, 2,1 ); 31 QGridLayout *qgrid = new QGridLayout( this, 2,1 );
32 32
33 dataCombo = new QComboBox( this ); 33 dataCombo = new QComboBox( this );
34 34
35 //read in all names of the 118 elements 35 //read in all names of the 118 elements
36 Config configobj( "oxygendata" ); 36 Config configobj( "oxygendata" );
37 for ( int i = 1 ; i < 119 ; i++ ) 37 for ( int i = 1 ; i < 119 ; i++ )
38 { 38 {
39 configobj.setGroup( QString::number( i ) ); 39 configobj.setGroup( QString::number( i ) );
40 QString foo = configobj.readEntry( "Name" ); 40 QString foo = configobj.readEntry( "Name" );
41 dataCombo->insertItem( foo ); 41 dataCombo->insertItem( foo );
42 } 42 }
43 43
44 OxydataWidget *oxyDW = new OxydataWidget(this); 44 OxydataWidget *oxyDW = new OxydataWidget(this);
45 connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) ); 45 connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) );
46 oxyDW->setElement( 1 ); 46 oxyDW->setElement( 0 );
47 47
48 qgrid->addWidget( dataCombo, 0,0); 48 qgrid->addWidget( dataCombo, 0,0);
49 qgrid->addWidget( oxyDW , 1,0 ); 49 qgrid->addWidget( oxyDW , 1,0 );
50} 50}
51 51
diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp
index a3bb505..449afef 100644
--- a/noncore/apps/oxygen/psewidget.cpp
+++ b/noncore/apps/oxygen/psewidget.cpp
@@ -1,146 +1,146 @@
1/*************************************************************************** 1/***************************************************************************
2 application: : Oxygen 2 application: : Oxygen
3 3
4 begin : September 2002 4 begin : September 2002
5 copyright : ( C ) 2002 by Carsten Niehaus 5 copyright : ( C ) 2002 by Carsten Niehaus
6 email : cniehaus@handhelds.org 6 email : cniehaus@handhelds.org
7 **************************************************************************/ 7 **************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * 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 *
12 * 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 *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * ( at your option ) any later version. * 14 * ( at your option ) any later version. *
15 * * 15 * *
16 **************************************************************************/ 16 **************************************************************************/
17 17
18#include <qpe/config.h> 18#include <qpe/config.h>
19#include <qlayout.h> 19#include <qlayout.h>
20#include <qlist.h> 20#include <qlist.h>
21#include "dataTable.h" 21#include "dataTable.h"
22#include "psewidget.h" 22#include "psewidget.h"
23#include "oxyframe.h" 23#include "oxyframe.h"
24 24
25 25
26PSEWidget::PSEWidget() : QWidget() 26PSEWidget::PSEWidget() : QWidget()
27{ 27{
28 this->setCaption( tr( "Periodic System" ) ); 28 this->setCaption( tr( "Periodic System" ) );
29 29
30 QVBoxLayout *vlay = new QVBoxLayout( this ); 30 QVBoxLayout *vlay = new QVBoxLayout( this );
31 31
32 QGridLayout *grid = new QGridLayout( 18,10 ); 32 QGridLayout *grid = new QGridLayout( 18,10 );
33 int h=0, v=0; 33 int h=0, v=0;
34 34
35 Config configobj( "oxygendata" ); 35 Config configobj( "oxygendata" );
36 for( int n = 0 ; n < 118 ; n++ ) 36 for( int n = 0 ; n < 118 ; n++ )
37 { 37 {
38 configobj.setGroup( QString::number( n+1 )); 38 configobj.setGroup( QString::number( n+1 ));
39 39
40 position( n+1,h,v ); 40 position( n+1,h,v );
41 QList<OxyFrame> PSEframe; 41 QList<OxyFrame> PSEframe;
42 PSEframe.append( new OxyFrame( this , QString::number(n) ) ); 42 PSEframe.append( new OxyFrame( this , QString::number(n) ) );
43 grid->addWidget( PSEframe.current() , v/40+1 , h/40 ); 43 grid->addWidget( PSEframe.current() , v/40+1 , h/40 );
44 PSEframe.current()->setMinimumHeight( 11 ); 44 PSEframe.current()->setMinimumHeight( 11 );
45 PSEframe.current()->setPalette( QPalette( PSEColor( configobj.readEntry( "Block" ) ) ) ); 45 PSEframe.current()->setPalette( QPalette( PSEColor( configobj.readEntry( "Block" ) ) ) );
46 connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( slotShowElement(QString) )); 46 connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( slotShowElement(QString) ));
47 } 47 }
48 48
49 oxyDW = new OxydataWidget(this); 49 oxyDW = new OxydataWidget(this);
50 oxyDW->setElement( 1 ); 50 oxyDW->setElement( 0 );
51 51
52 vlay->addLayout( grid ); 52 vlay->addLayout( grid );
53 vlay->addWidget( oxyDW ); 53 vlay->addWidget( oxyDW );
54} 54}
55 55
56QColor PSEWidget::PSEColor( QString block ) 56QColor PSEWidget::PSEColor( QString block )
57{ 57{
58 QColor c; 58 QColor c;
59 if ( block == "s" ) c.setRgb( 213 , 233 , 231 ); 59 if ( block == "s" ) c.setRgb( 213 , 233 , 231 );
60 else if ( block == "d" ) c.setRgb( 200,230,160 ); 60 else if ( block == "d" ) c.setRgb( 200,230,160 );
61 else if ( block == "p" ) c.setRgb( 238,146,138 ); 61 else if ( block == "p" ) c.setRgb( 238,146,138 );
62 else if ( block == "f" ) c.setRgb( 190 , 190 , 190 ); 62 else if ( block == "f" ) c.setRgb( 190 , 190 , 190 );
63 return c; 63 return c;
64}; 64};
65 65
66void PSEWidget::slotShowElement(QString number) 66void PSEWidget::slotShowElement(QString number)
67{ 67{
68 oxyDW->setElement( number.toInt() ); 68 oxyDW->setElement( number.toInt() );
69}; 69};
70 70
71void PSEWidget::position(int n, int& h, int& v) 71void PSEWidget::position(int n, int& h, int& v)
72{ 72{
73 //Hydrogen 73 //Hydrogen
74 if (n == 1) 74 if (n == 1)
75 { 75 {
76 h=0; v=0; 76 h=0; v=0;
77 } 77 }
78 78
79 79
80 //Helium 80 //Helium
81 if (n == 2) 81 if (n == 2)
82 { 82 {
83 h=680; v=0; 83 h=680; v=0;
84 } 84 }
85 85
86 86
87 //Lithium 87 //Lithium
88 if (n == 3) 88 if (n == 3)
89 { 89 {
90 h=0; v=40; 90 h=0; v=40;
91 } 91 }
92 92
93 93
94 //Beryllium 94 //Beryllium
95 if (n == 4) 95 if (n == 4)
96 { 96 {
97 h=40; v=40; 97 h=40; v=40;
98 } 98 }
99 99
100 100
101 //Boron-->Neon or Aluminum --> Argon 101 //Boron-->Neon or Aluminum --> Argon
102 if ((n >= 5 && n <= 10) || (n >= 13 && n <= 18)) 102 if ((n >= 5 && n <= 10) || (n >= 13 && n <= 18))
103 for (int i = 1; i <= (6-(10-n)); i++) 103 for (int i = 1; i <= (6-(10-n)); i++)
104 { 104 {
105 h=((i*40)+440); 105 h=((i*40)+440);
106 v = 40; 106 v = 40;
107 if (n >= 13) 107 if (n >= 13)
108 { 108 {
109 v=80; 109 v=80;
110 h=(h-320); 110 h=(h-320);
111 } 111 }
112 } 112 }
113 113
114 114
115 //Sodium 115 //Sodium
116 if (n == 11) 116 if (n == 11)
117 { 117 {
118 h=0; v=80; 118 h=0; v=80;
119 } 119 }
120 120
121 121
122 //Magnesium 122 //Magnesium
123 if (n == 12) 123 if (n == 12)
124 { 124 {
125 h=40; v=80; 125 h=40; v=80;
126 } 126 }
127 127
128 128
129 //Potassium --> Uuo without La and Ac 129 //Potassium --> Uuo without La and Ac
130 if ((n >= 19 && n <= 56) || (n >= 72 && n <= 88) || n >= 104) 130 if ((n >= 19 && n <= 56) || (n >= 72 && n <= 88) || n >= 104)
131 for (int i = 1; i <= 18; i++) 131 for (int i = 1; i <= 18; i++)
132 { 132 {
133 int f = n; 133 int f = n;
134 if (n > 18) 134 if (n > 18)
135 f = n-18; 135 f = n-18;
136 if (n > 36) 136 if (n > 36)
137 f = n-36; 137 f = n-36;
138 if (n > 54) 138 if (n > 54)
139 f = n-54; 139 f = n-54;
140 if (n > 71) 140 if (n > 71)
141 f = n-68; 141 f = n-68;
142 if (n > 86) 142 if (n > 86)
143 f = n-86; 143 f = n-86;
144 if (n > 103) 144 if (n > 103)
145 f = n-100; 145 f = n-100;
146 146