author | cniehaus <cniehaus> | 2002-12-26 16:27:41 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2002-12-26 16:27:41 (UTC) |
commit | 4ccadc49c02a7412fd82eeb98eba3c7cd7f5c05f (patch) (unidiff) | |
tree | 6bcf36b728b6c9db70c00ccf2c16f7b082581124 /noncore | |
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 @@ | |||
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>CalcDlg</cstring> | 7 | <cstring>CalcDlg</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>237</width> | 14 | <width>237</width> |
15 | <height>318</height> | 15 | <height>318</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>Form1</string> | ||
21 | </property> | ||
22 | <widget> | 18 | <widget> |
23 | <class>QTabWidget</class> | 19 | <class>QTabWidget</class> |
24 | <property stdset="1"> | 20 | <property stdset="1"> |
25 | <name>name</name> | 21 | <name>name</name> |
26 | <cstring>TabWidget3</cstring> | 22 | <cstring>TabWidget3</cstring> |
27 | </property> | 23 | </property> |
28 | <property stdset="1"> | 24 | <property stdset="1"> |
29 | <name>geometry</name> | 25 | <name>geometry</name> |
30 | <rect> | 26 | <rect> |
31 | <x>0</x> | 27 | <x>0</x> |
32 | <y>0</y> | 28 | <y>0</y> |
33 | <width>240</width> | 29 | <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 @@ | |||
18 | #include <qpe/config.h> | 18 | #include <qpe/config.h> |
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 | |||
31 | lastElement=1; | ||
30 | 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 ); |
@@ -56,37 +58,41 @@ PSEWidget::PSEWidget() : QWidget() | |||
56 | } | 58 | } |
57 | 59 | ||
58 | QColor PSEWidget::PSEColor( QString block ) | 60 | QColor PSEWidget::PSEColor( QString block ) |
59 | { | 61 | { |
60 | QColor c; | 62 | QColor c; |
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 | |
79 | 81 | configobj.setGroup( QString::number( lastElement+1 ) ); | |
80 | PSEframe.at( number.toUInt() )->setPalette( QPalette( c ) ); | 82 | block = configobj.readEntry( "Block" ); |
83 | c = PSEColor( block ); | ||
84 | PSEframe.at( lastElement )->setPalette( QPalette( c ) ); | ||
85 | |||
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 | { |
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; | |||
27 | 27 | ||
28 | class PSEWidget : public QWidget | 28 | class PSEWidget : public QWidget |
29 | { | 29 | { |
30 | Q_OBJECT | 30 | Q_OBJECT |
31 | 31 | ||
32 | public: | 32 | public: |
33 | PSEWidget(); | 33 | PSEWidget(); |
34 | QGridLayout *bottom_grid; | 34 | QGridLayout *bottom_grid; |
35 | OxydataWidget *oxyDW; | 35 | OxydataWidget *oxyDW; |
36 | 36 | ||
37 | QList<OxyFrame> PSEframe; | 37 | QList<OxyFrame> PSEframe; |
38 | 38 | ||
39 | int lastElement; | ||
40 | |||
39 | private: | 41 | private: |
40 | QGridLayout *maingrid; | 42 | QGridLayout *maingrid; |
41 | 43 | ||
42 | void position( int, int&, int& ); | 44 | void position( int, int&, int& ); |
43 | QColor PSEColor( QString ); | 45 | QColor PSEColor( QString ); |
44 | 46 | ||
45 | public slots: | 47 | public slots: |
46 | void slotShowElement(QString); | 48 | void slotShowElement(QString); |
47 | void inverseColor( QString ); | 49 | void inverseColor( QString ); |
48 | 50 | ||
49 | }; | 51 | }; |
50 | 52 | ||