author | cniehaus <cniehaus> | 2002-12-26 16:27:41 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2002-12-26 16:27:41 (UTC) |
commit | 4ccadc49c02a7412fd82eeb98eba3c7cd7f5c05f (patch) (side-by-side diff) | |
tree | 6bcf36b728b6c9db70c00ccf2c16f7b082581124 | |
parent | 6ba7eeea65ba60d022c0d9d041660ceffb2b76f6 (diff) | |
download | opie-4ccadc49c02a7412fd82eeb98eba3c7cd7f5c05f.zip opie-4ccadc49c02a7412fd82eeb98eba3c7cd7f5c05f.tar.gz opie-4ccadc49c02a7412fd82eeb98eba3c7cd7f5c05f.tar.bz2 |
adding a nice feature: now the user sees which element he is looking at
-rw-r--r-- | noncore/apps/oxygen/calcdlg.ui | 4 | ||||
-rw-r--r-- | noncore/apps/oxygen/psewidget.cpp | 24 | ||||
-rw-r--r-- | noncore/apps/oxygen/psewidget.h | 2 |
3 files changed, 17 insertions, 13 deletions
diff --git a/noncore/apps/oxygen/calcdlg.ui b/noncore/apps/oxygen/calcdlg.ui index c817a47..51bf334 100644 --- a/noncore/apps/oxygen/calcdlg.ui +++ b/noncore/apps/oxygen/calcdlg.ui @@ -6,28 +6,24 @@ <name>name</name> <cstring>CalcDlg</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> <width>237</width> <height>318</height> </rect> </property> - <property stdset="1"> - <name>caption</name> - <string>Form1</string> - </property> <widget> <class>QTabWidget</class> <property stdset="1"> <name>name</name> <cstring>TabWidget3</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> <width>240</width> 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 @@ -18,24 +18,26 @@ #include <qpe/config.h> #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 ); @@ -56,37 +58,41 @@ PSEWidget::PSEWidget() : QWidget() } 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 ) +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(); - - PSEframe.at( number.toUInt() )->setPalette( QPalette( c ) ); + 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 ) ); + + 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) { diff --git a/noncore/apps/oxygen/psewidget.h b/noncore/apps/oxygen/psewidget.h index cfb629d..ddeab9d 100644 --- a/noncore/apps/oxygen/psewidget.h +++ b/noncore/apps/oxygen/psewidget.h @@ -27,24 +27,26 @@ class PSEframe; class PSEWidget : public QWidget { Q_OBJECT public: PSEWidget(); QGridLayout *bottom_grid; OxydataWidget *oxyDW; QList<OxyFrame> PSEframe; + int lastElement; + private: QGridLayout *maingrid; void position( int, int&, int& ); QColor PSEColor( QString ); public slots: void slotShowElement(QString); void inverseColor( QString ); }; |