Diffstat (limited to 'noncore/apps/oxygen/psewidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/oxygen/psewidget.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp index d7126b9..d8e4086 100644 --- a/noncore/apps/oxygen/psewidget.cpp +++ b/noncore/apps/oxygen/psewidget.cpp | |||
@@ -19,24 +19,26 @@ | |||
19 | #include <qlayout.h> | 19 | #include <qlayout.h> |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qlist.h> | 21 | #include <qlist.h> |
22 | #include "dataTable.h" | 22 | #include "dataTable.h" |
23 | #include "psewidget.h" | 23 | #include "psewidget.h" |
24 | #include "oxyframe.h" | 24 | #include "oxyframe.h" |
25 | 25 | ||
26 | 26 | ||
27 | PSEWidget::PSEWidget() : QWidget() | 27 | PSEWidget::PSEWidget() : QWidget() |
28 | { | 28 | { |
29 | this->setCaption( tr( "Periodic System" ) ); | 29 | this->setCaption( tr( "Periodic System" ) ); |
30 | 30 | ||
31 | lastElement=1; | ||
32 | |||
31 | QVBoxLayout *vlay = new QVBoxLayout( this ); | 33 | QVBoxLayout *vlay = new QVBoxLayout( this ); |
32 | 34 | ||
33 | QGridLayout *grid = new QGridLayout( 18,10 ); | 35 | QGridLayout *grid = new QGridLayout( 18,10 ); |
34 | int h=0, v=0; | 36 | int h=0, v=0; |
35 | 37 | ||
36 | Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); | 38 | Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); |
37 | for( int n = 0 ; n < 109 ; n++ ) | 39 | for( int n = 0 ; n < 109 ; n++ ) |
38 | { | 40 | { |
39 | configobj.setGroup( QString::number( n+1 )); | 41 | configobj.setGroup( QString::number( n+1 )); |
40 | 42 | ||
41 | position( n+1,h,v ); | 43 | position( n+1,h,v ); |
42 | PSEframe.append( new OxyFrame( this , QString::number(n), configobj.readEntry( "Symbol" ) ) ); | 44 | PSEframe.append( new OxyFrame( this , QString::number(n), configobj.readEntry( "Symbol" ) ) ); |
@@ -61,32 +63,36 @@ QColor PSEWidget::PSEColor( QString block ) | |||
61 | if ( block == "s" ) c.setRgb( 213 , 233 , 231 ); | 63 | if ( block == "s" ) c.setRgb( 213 , 233 , 231 ); |
62 | else if ( block == "d" ) c.setRgb( 200,230,160 ); | 64 | else if ( block == "d" ) c.setRgb( 200,230,160 ); |
63 | else if ( block == "p" ) c.setRgb( 238,146,138 ); | 65 | else if ( block == "p" ) c.setRgb( 238,146,138 ); |
64 | else if ( block == "f" ) c.setRgb( 190 , 190 , 190 ); | 66 | else if ( block == "f" ) c.setRgb( 190 , 190 , 190 ); |
65 | return c; | 67 | return c; |
66 | }; | 68 | }; |
67 | 69 | ||
68 | void PSEWidget::inverseColor( QString number ) | 70 | void PSEWidget::inverseColor( QString number ) |
69 | { | 71 | { |
70 | Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); | 72 | Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); |
71 | configobj.setGroup( number ); | 73 | configobj.setGroup( number ); |
72 | QString block = configobj.readEntry( "Block" ); | 74 | QString block = configobj.readEntry( "Block" ); |
73 | QColor c; | 75 | QColor c, d; |
74 | if ( block == "s" ) c.setRgb( 213 , 233 , 231 ); | 76 | c = PSEColor( block ); |
75 | else if ( block == "d" ) c.setRgb( 200,230,160 ); | 77 | d = c.dark(); |
76 | else if ( block == "p" ) c.setRgb( 238,146,138 ); | 78 | |
77 | else if ( block == "f" ) c.setRgb( 190 , 190 , 190 ); | 79 | PSEframe.at( number.toUInt() )->setPalette( QPalette( d ) ); |
78 | c.dark(); | 80 | |
81 | configobj.setGroup( QString::number( lastElement+1 ) ); | ||
82 | block = configobj.readEntry( "Block" ); | ||
83 | c = PSEColor( block ); | ||
84 | PSEframe.at( lastElement )->setPalette( QPalette( c ) ); | ||
79 | 85 | ||
80 | PSEframe.at( number.toUInt() )->setPalette( QPalette( c ) ); | 86 | lastElement=number.toInt(); |
81 | } | 87 | } |
82 | 88 | ||
83 | void PSEWidget::slotShowElement(QString number) | 89 | void PSEWidget::slotShowElement(QString number) |
84 | { | 90 | { |
85 | oxyDW->setElement( number.toInt() ); | 91 | oxyDW->setElement( number.toInt() ); |
86 | }; | 92 | }; |
87 | 93 | ||
88 | void PSEWidget::position(int n, int& h, int& v) | 94 | void PSEWidget::position(int n, int& h, int& v) |
89 | { | 95 | { |
90 | //Hydrogen | 96 | //Hydrogen |
91 | if (n == 1) | 97 | if (n == 1) |
92 | { | 98 | { |