summaryrefslogtreecommitdiff
path: root/noncore/apps/oxygen/psewidget.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/oxygen/psewidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/oxygen/psewidget.cpp20
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 @@
#include <qlayout.h>
#include <qpe/qpeapplication.h>
#include <qlist.h>
#include "dataTable.h"
#include "psewidget.h"
#include "oxyframe.h"
PSEWidget::PSEWidget() : QWidget()
{
this->setCaption( tr( "Periodic System" ) );
+ lastElement=1;
+
QVBoxLayout *vlay = new QVBoxLayout( this );
QGridLayout *grid = new QGridLayout( 18,10 );
int h=0, v=0;
Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File );
for( int n = 0 ; n < 109 ; n++ )
{
configobj.setGroup( QString::number( n+1 ));
position( n+1,h,v );
PSEframe.append( new OxyFrame( this , QString::number(n), configobj.readEntry( "Symbol" ) ) );
@@ -61,32 +63,36 @@ QColor PSEWidget::PSEColor( QString block )
if ( block == "s" ) c.setRgb( 213 , 233 , 231 );
else if ( block == "d" ) c.setRgb( 200,230,160 );
else if ( block == "p" ) c.setRgb( 238,146,138 );
else if ( block == "f" ) c.setRgb( 190 , 190 , 190 );
return c;
};
void PSEWidget::inverseColor( QString number )
{
Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File );
configobj.setGroup( number );
QString block = configobj.readEntry( "Block" );
- QColor c;
- if ( block == "s" ) c.setRgb( 213 , 233 , 231 );
- else if ( block == "d" ) c.setRgb( 200,230,160 );
- else if ( block == "p" ) c.setRgb( 238,146,138 );
- else if ( block == "f" ) c.setRgb( 190 , 190 , 190 );
- c.dark();
+ QColor c, d;
+ c = PSEColor( block );
+ d = c.dark();
+
+ PSEframe.at( number.toUInt() )->setPalette( QPalette( d ) );
+
+ configobj.setGroup( QString::number( lastElement+1 ) );
+ block = configobj.readEntry( "Block" );
+ c = PSEColor( block );
+ PSEframe.at( lastElement )->setPalette( QPalette( c ) );
- PSEframe.at( number.toUInt() )->setPalette( QPalette( c ) );
+ lastElement=number.toInt();
}
void PSEWidget::slotShowElement(QString number)
{
oxyDW->setElement( number.toInt() );
};
void PSEWidget::position(int n, int& h, int& v)
{
//Hydrogen
if (n == 1)
{