summaryrefslogtreecommitdiff
path: root/noncore/apps/oxygen/psewidget.cpp
Unidiff
Diffstat (limited to 'noncore/apps/oxygen/psewidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/oxygen/psewidget.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp
index f7725e3..78e54d5 100644
--- a/noncore/apps/oxygen/psewidget.cpp
+++ b/noncore/apps/oxygen/psewidget.cpp
@@ -20,29 +20,44 @@ PSEWidget::PSEWidget() : QWidget()
20 this->setCaption( tr( "Periodic System" ) ); 20 this->setCaption( tr( "Periodic System" ) );
21 21
22 QVBoxLayout *vlay = new QVBoxLayout( this ); 22 QVBoxLayout *vlay = new QVBoxLayout( this );
23 23
24 QGridLayout *grid = new QGridLayout( 18,10 ); 24 QGridLayout *grid = new QGridLayout( 18,10 );
25 int h=0, v=0; 25 int h=0, v=0;
26
27 Config configobj( "oxygendata" );
26 for( int n = 0 ; n < 118 ; n++ ) 28 for( int n = 0 ; n < 118 ; n++ )
27 { 29 {
30 configobj.setGroup( QString::number( n+1 ));
31
28 position( n+1,h,v ); 32 position( n+1,h,v );
29 QList<OxyFrame> PSEframe; 33 QList<OxyFrame> PSEframe;
30 PSEframe.append( new OxyFrame( this , QString::number(n) ) ); 34 PSEframe.append( new OxyFrame( this , QString::number(n) ) );
31 grid->addWidget( PSEframe.current() , v/40+1 , h/40 ); 35 grid->addWidget( PSEframe.current() , v/40+1 , h/40 );
32 PSEframe.current()->setMinimumHeight( 11 ); 36 PSEframe.current()->setMinimumHeight( 11 );
37 PSEframe.current()->setPalette( QPalette( PSEColor( configobj.readEntry( "Block" ) ) ) );
33 connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( slotShowElement(QString) )); 38 connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( slotShowElement(QString) ));
34 } 39 }
35 40
36 oxyDW = new OxydataWidget(this); 41 oxyDW = new OxydataWidget(this);
37 oxyDW->setElement( 1 ); 42 oxyDW->setElement( 1 );
38 43
39 vlay->addLayout( grid ); 44 vlay->addLayout( grid );
40 vlay->addWidget( oxyDW ); 45 vlay->addWidget( oxyDW );
41} 46}
42 47
48QColor PSEWidget::PSEColor( QString block )
49{
50 QColor c;
51 if ( block == "s" ) c.setRgb( 213 , 233 , 231 );
52 else if ( block == "d" ) c.setRgb( 200,230,160 );
53 else if ( block == "p" ) c.setRgb( 238,146,138 );
54 else if ( block == "f" ) c.setRgb( 190 , 190 , 190 );
55 return c;
56};
57
43void PSEWidget::slotShowElement(QString number) 58void PSEWidget::slotShowElement(QString number)
44{ 59{
45 oxyDW->setElement( number.toInt() ); 60 oxyDW->setElement( number.toInt() );
46}; 61};
47 62
48void PSEWidget::position(int n, int& h, int& v) 63void PSEWidget::position(int n, int& h, int& v)