summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/oxygen/psewidget.cpp13
-rw-r--r--noncore/apps/oxygen/psewidget.h2
2 files changed, 13 insertions, 2 deletions
diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp
index eb4093b..d7126b9 100644
--- a/noncore/apps/oxygen/psewidget.cpp
+++ b/noncore/apps/oxygen/psewidget.cpp
@@ -23,71 +23,82 @@
#include "psewidget.h"
#include "oxyframe.h"
PSEWidget::PSEWidget() : QWidget()
{
this->setCaption( tr( "Periodic System" ) );
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" ) ) );
grid->addWidget( PSEframe.current() , v/40+1 , h/40 );
PSEframe.current()->setMinimumHeight( 11 );
PSEframe.current()->setPalette( QPalette( PSEColor( configobj.readEntry( "Block" ) ) ) );
connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( slotShowElement(QString) ));
+ connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( inverseColor(QString) ));
}
oxyDW = new OxydataWidget(this);
oxyDW->setElement( 0 );
oxyDW->setLayout();
vlay->addLayout( grid );
vlay->addWidget( oxyDW );
}
QColor PSEWidget::PSEColor( QString 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 );
return c;
};
void PSEWidget::inverseColor( QString number )
{
- //foo
+ 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();
+
+ PSEframe.at( number.toUInt() )->setPalette( QPalette( c ) );
}
void PSEWidget::slotShowElement(QString number)
{
oxyDW->setElement( number.toInt() );
};
void PSEWidget::position(int n, int& h, int& v)
{
//Hydrogen
if (n == 1)
{
h=0; v=0;
}
//Helium
if (n == 2)
{
h=680; v=0;
}
//Lithium
diff --git a/noncore/apps/oxygen/psewidget.h b/noncore/apps/oxygen/psewidget.h
index d8d2c5f..cfb629d 100644
--- a/noncore/apps/oxygen/psewidget.h
+++ b/noncore/apps/oxygen/psewidget.h
@@ -13,39 +13,39 @@
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
#ifndef _PSEWIDGET_H
#define _PSEWIDGET_H
#include <qwidget.h>
#include <qlist.h>
#include "oxyframe.h"
class QGridLayout;
class OxydataWidget;
class PSEframe;
class PSEWidget : public QWidget
{
Q_OBJECT
public:
PSEWidget();
QGridLayout *bottom_grid;
OxydataWidget *oxyDW;
- void inverseColor( QString );
QList<OxyFrame> PSEframe;
private:
QGridLayout *maingrid;
void position( int, int&, int& );
QColor PSEColor( QString );
public slots:
void slotShowElement(QString);
+ void inverseColor( QString );
};
#endif