author | cniehaus <cniehaus> | 2002-09-19 10:29:38 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2002-09-19 10:29:38 (UTC) |
commit | 7bf6b71e9d7eadc9311af6a839b3425297346c2c (patch) (unidiff) | |
tree | 2b9a08cfec6ace06c6c4321cfb4c6f654b809287 | |
parent | acf131576d76536872a6999274db19a20cb76a4d (diff) | |
download | opie-7bf6b71e9d7eadc9311af6a839b3425297346c2c.zip opie-7bf6b71e9d7eadc9311af6a839b3425297346c2c.tar.gz opie-7bf6b71e9d7eadc9311af6a839b3425297346c2c.tar.bz2 |
* nothing is hardcoded anylonger (thanks Max for the .conf-hint)
* removing obsolete includes
* making the PSE-data-widget a QWidget instead of a QDialog
* removing one obsolete slot
* making oxyDW private
-rw-r--r-- | noncore/apps/oxygen/dataTable.cpp | 27 | ||||
-rw-r--r-- | noncore/apps/oxygen/datawidgetui.cpp | 16 | ||||
-rw-r--r-- | noncore/apps/oxygen/datawidgetui.h | 8 | ||||
-rw-r--r-- | noncore/apps/oxygen/psewidget.cpp | 2 |
4 files changed, 21 insertions, 32 deletions
diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp index 642a8be..5c7b35c 100644 --- a/noncore/apps/oxygen/dataTable.cpp +++ b/noncore/apps/oxygen/dataTable.cpp | |||
@@ -1,112 +1,111 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * ( at your option ) any later version. * | 6 | * ( at your option ) any later version. * |
7 | * * | 7 | * * |
8 | **************************************************************************/ | 8 | **************************************************************************/ |
9 | 9 | ||
10 | #include <qpe/config.h> | 10 | #include <qpe/config.h> |
11 | 11 | ||
12 | #include "dataTable.h" | 12 | #include "dataTable.h" |
13 | #include <qwidget.h> | 13 | #include <qwidget.h> |
14 | #include <qhbox.h> | 14 | #include <qhbox.h> |
15 | #include <qvbox.h> | ||
16 | #include <qlabel.h> | 15 | #include <qlabel.h> |
17 | #include <qfont.h> | 16 | #include <qfont.h> |
18 | #include <qlayout.h> | 17 | #include <qlayout.h> |
19 | 18 | ||
20 | OxydataWidget::OxydataWidget(QWidget *parent) : QWidget(parent) | 19 | OxydataWidget::OxydataWidget(QWidget *parent) : QWidget(parent) |
21 | { | 20 | { |
22 | QGridLayout *qgrid = new QGridLayout( this, 2,1 ); | 21 | QGridLayout *qgrid = new QGridLayout( this, 2,1 ); |
23 | QHBox *hbox = new QHBox( this ); | 22 | QHBox *hbox = new QHBox( this ); |
24 | left = new QLabel( hbox ); | 23 | left = new QLabel( hbox ); |
25 | middle = new QLabel( hbox ); | 24 | middle = new QLabel( hbox ); |
26 | right = new QLabel( hbox ); | 25 | right = new QLabel( hbox ); |
27 | 26 | ||
28 | DataTable = new OxydataTable( 9,2, this ); | 27 | DataTable = new OxydataTable( 9,2, this ); |
29 | 28 | ||
30 | QFont bf; | 29 | QFont bf; |
31 | bf.setBold( true ); | 30 | bf.setBold( true ); |
32 | bf.setPointSize( bf.pointSize()+2 ); | 31 | bf.setPointSize( bf.pointSize()+2 ); |
33 | middle->setFont( bf ); | 32 | middle->setFont( bf ); |
34 | 33 | ||
35 | setTable(); | 34 | setTable(); |
36 | 35 | ||
37 | qgrid->addWidget( hbox,0,0 ); | 36 | qgrid->addWidget( hbox,0,0 ); |
38 | qgrid->addWidget( DataTable,1,0 ); | 37 | qgrid->addWidget( DataTable,1,0 ); |
39 | } | 38 | } |
40 | 39 | ||
41 | void OxydataWidget::setElement( int el ) | 40 | void OxydataWidget::setElement( int el ) |
42 | { | 41 | { |
43 | Config test( "/home/opie/Settings/oxygendata", Config::File ); | 42 | Config configobj( "oxygendata" ); |
44 | test.setGroup( QString::number( el+1 )); | 43 | configobj.setGroup( QString::number( el+1 )); |
45 | 44 | ||
46 | left->setText( test.readEntry( "Symbol" ) ); | 45 | left->setText( configobj.readEntry( "Symbol" ) ); |
47 | middle->setText( test.readEntry( "Name" ) ); | 46 | middle->setText( configobj.readEntry( "Name" ) ); |
48 | right->setText( QString::number( el+1 ) ); | 47 | right->setText( QString::number( el+1 ) ); |
49 | 48 | ||
50 | QString weight = test.readEntry( "Weight" ); | 49 | QString weight = configobj.readEntry( "Weight" ); |
51 | DataTable->setText( 0,1,weight ); | 50 | DataTable->setText( 0,1,weight ); |
52 | QString block = test.readEntry( "Block" ); | 51 | QString block = configobj.readEntry( "Block" ); |
53 | DataTable->setText( 1,1,block ); | 52 | DataTable->setText( 1,1,block ); |
54 | QString grp = test.readEntry( "Group" ); | 53 | QString grp = configobj.readEntry( "Group" ); |
55 | DataTable->setText( 2,1,grp ); | 54 | DataTable->setText( 2,1,grp ); |
56 | QString en = test.readEntry( "EN" ); | 55 | QString en = configobj.readEntry( "EN" ); |
57 | DataTable->setText( 3,1,en ); | 56 | DataTable->setText( 3,1,en ); |
58 | QString ar = test.readEntry( "AR" ); | 57 | QString ar = configobj.readEntry( "AR" ); |
59 | DataTable->setText( 4,1,ar ) ; | 58 | DataTable->setText( 4,1,ar ) ; |
60 | QString ion = test.readEntry( "IE" ); | 59 | QString ion = configobj.readEntry( "IE" ); |
61 | DataTable->setText( 5,1,ion ); | 60 | DataTable->setText( 5,1,ion ); |
62 | QString dens = test.readEntry( "Density" ); | 61 | QString dens = configobj.readEntry( "Density" ); |
63 | DataTable->setText( 6,1,dens ); | 62 | DataTable->setText( 6,1,dens ); |
64 | QString bp = test.readEntry( "BP" ); | 63 | QString bp = configobj.readEntry( "BP" ); |
65 | DataTable->setText( 7,1,bp ); | 64 | DataTable->setText( 7,1,bp ); |
66 | QString mp = test.readEntry( "MP" ); | 65 | QString mp = configobj.readEntry( "MP" ); |
67 | DataTable->setText( 8,1,mp ); | 66 | DataTable->setText( 8,1,mp ); |
68 | } | 67 | } |
69 | 68 | ||
70 | void OxydataWidget::setTable() | 69 | void OxydataWidget::setTable() |
71 | { | 70 | { |
72 | DataTable->setText( 0,0, tr( "Weight:" ) ); | 71 | DataTable->setText( 0,0, tr( "Weight:" ) ); |
73 | DataTable->setText( 1,0, tr( "Block" )) ; | 72 | DataTable->setText( 1,0, tr( "Block" )) ; |
74 | DataTable->setText( 2,0, tr( "Group" )) ; | 73 | DataTable->setText( 2,0, tr( "Group" )) ; |
75 | DataTable->setText( 3,0, tr( "Electronegativity" )) ; | 74 | DataTable->setText( 3,0, tr( "Electronegativity" )) ; |
76 | DataTable->setText( 4,0, tr( "Atomic radius" )) ; | 75 | DataTable->setText( 4,0, tr( "Atomic radius" )) ; |
77 | DataTable->setText( 5,0, tr( "Ionizationenergie" )) ; | 76 | DataTable->setText( 5,0, tr( "Ionizationenergie" )) ; |
78 | DataTable->setText( 6,0, tr( "Density" )) ; | 77 | DataTable->setText( 6,0, tr( "Density" )) ; |
79 | DataTable->setText( 7,0, tr( "Boilingpoint" ) ); | 78 | DataTable->setText( 7,0, tr( "Boilingpoint" ) ); |
80 | DataTable->setText( 8,0, tr( "Meltingpoint" ) ); | 79 | DataTable->setText( 8,0, tr( "Meltingpoint" ) ); |
81 | } | 80 | } |
82 | 81 | ||
83 | OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent, | 82 | OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent, |
84 | const char *name) : QTable(numRows, numRows, parent, name) | 83 | const char *name) : QTable(numRows, numRows, parent, name) |
85 | { | 84 | { |
86 | this->setShowGrid( false ); | 85 | this->setShowGrid( false ); |
87 | this->setHScrollBarMode(QScrollView::AlwaysOff); | 86 | this->setHScrollBarMode(QScrollView::AlwaysOff); |
88 | this->horizontalHeader()->hide(); | 87 | this->horizontalHeader()->hide(); |
89 | this->verticalHeader()->hide(); | 88 | this->verticalHeader()->hide(); |
90 | this->setTopMargin( 0 ); | 89 | this->setTopMargin( 0 ); |
91 | this->setLeftMargin( 0 ); | 90 | this->setLeftMargin( 0 ); |
92 | } | 91 | } |
93 | 92 | ||
94 | void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected) | 93 | void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected) |
95 | { | 94 | { |
96 | if ( cr.width() == 0 || cr.height() == 0 ) | 95 | if ( cr.width() == 0 || cr.height() == 0 ) |
97 | return; | 96 | return; |
98 | selected = FALSE; | 97 | selected = FALSE; |
99 | 98 | ||
100 | QTableItem *itm = item( row, col ); | 99 | QTableItem *itm = item( row, col ); |
101 | QColorGroup colgrp = colorGroup(); | 100 | QColorGroup colgrp = colorGroup(); |
102 | if ( itm ) | 101 | if ( itm ) |
103 | { | 102 | { |
104 | if ( row%2 ) | 103 | if ( row%2 ) |
105 | colgrp.setColor( QColorGroup::Base, QColor( cyan ) ); | 104 | colgrp.setColor( QColorGroup::Base, QColor( cyan ) ); |
106 | else | 105 | else |
107 | colgrp.setColor( QColorGroup::Base, QColor( white ) ); | 106 | colgrp.setColor( QColorGroup::Base, QColor( white ) ); |
108 | p->save(); | 107 | p->save(); |
109 | itm->paint( p, colgrp, cr, selected ); | 108 | itm->paint( p, colgrp, cr, selected ); |
110 | p->restore(); | 109 | p->restore(); |
111 | } | 110 | } |
112 | } | 111 | } |
diff --git a/noncore/apps/oxygen/datawidgetui.cpp b/noncore/apps/oxygen/datawidgetui.cpp index fa3f40d..8188515 100644 --- a/noncore/apps/oxygen/datawidgetui.cpp +++ b/noncore/apps/oxygen/datawidgetui.cpp | |||
@@ -1,48 +1,42 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * ( at your option ) any later version. * | 6 | * ( at your option ) any later version. * |
7 | * * | 7 | * * |
8 | **************************************************************************/ | 8 | **************************************************************************/ |
9 | #include "oxygen.h" | 9 | |
10 | #include "datawidgetui.h" | 10 | #include "datawidgetui.h" |
11 | 11 | ||
12 | #include <qpe/config.h> | 12 | #include <qpe/config.h> |
13 | #include <qstring.h> | 13 | #include <qstring.h> |
14 | #include <qcombobox.h> | 14 | #include <qcombobox.h> |
15 | #include <qlayout.h> | 15 | #include <qlayout.h> |
16 | #include <qtable.h> | ||
17 | #include <qhbox.h> | 16 | #include <qhbox.h> |
18 | #include <qlabel.h> | 17 | #include <qlabel.h> |
19 | 18 | ||
20 | dataWidgetUI::dataWidgetUI() : QDialog() | 19 | dataWidgetUI::dataWidgetUI() : QWidget() |
21 | { | 20 | { |
22 | this->setCaption("Chemical Data"); | 21 | this->setCaption("Chemical Data"); |
23 | 22 | ||
24 | QGridLayout *qgrid = new QGridLayout( this, 2,1 ); | 23 | QGridLayout *qgrid = new QGridLayout( this, 2,1 ); |
25 | 24 | ||
26 | dataCombo = new QComboBox( this ); | 25 | dataCombo = new QComboBox( this ); |
27 | OxydataWidget *oxyDW = new OxydataWidget(this); | 26 | OxydataWidget *oxyDW = new OxydataWidget(this); |
28 | oxyDW->setElement( 1 ); | 27 | oxyDW->setElement( 1 ); |
29 | qgrid->addWidget( dataCombo, 0,0); | 28 | qgrid->addWidget( dataCombo, 0,0); |
30 | qgrid->addWidget( oxyDW , 1,0 ); | 29 | qgrid->addWidget( oxyDW , 1,0 ); |
31 | 30 | ||
32 | connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) ); | 31 | connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) ); |
33 | Config test( "/home/opie/Settings/oxygendata", Config::File ); | 32 | Config configobj( "oxygendata" ); |
34 | 33 | ||
35 | //read in all names of the 118 elements | 34 | //read in all names of the 118 elements |
36 | for ( int i = 1 ; i < 119 ; i++ ) | 35 | for ( int i = 1 ; i < 119 ; i++ ) |
37 | { | 36 | { |
38 | test.setGroup( QString::number( i ) ); | 37 | configobj.setGroup( QString::number( i ) ); |
39 | QString foo = test.readEntry( "Name" ); | 38 | QString foo = configobj.readEntry( "Name" ); |
40 | dataCombo->insertItem( foo ); | 39 | dataCombo->insertItem( foo ); |
41 | } | 40 | } |
42 | } | 41 | } |
43 | 42 | ||
44 | |||
45 | |||
46 | void dataWidgetUI::slotShowData(int number){ | ||
47 | oxyDW->setElement( 6 ); | ||
48 | } | ||
diff --git a/noncore/apps/oxygen/datawidgetui.h b/noncore/apps/oxygen/datawidgetui.h index 20622db..5399c81 100644 --- a/noncore/apps/oxygen/datawidgetui.h +++ b/noncore/apps/oxygen/datawidgetui.h | |||
@@ -1,29 +1,25 @@ | |||
1 | 1 | ||
2 | /*************************************************************************** | 2 | /*************************************************************************** |
3 | * * | 3 | * * |
4 | * This program is free software; you can redistribute it and/or modify * | 4 | * This program is free software; you can redistribute it and/or modify * |
5 | * it under the terms of the GNU General Public License as published by * | 5 | * it under the terms of the GNU General Public License as published by * |
6 | * the Free Software Foundation; either version 2 of the License, or * | 6 | * the Free Software Foundation; either version 2 of the License, or * |
7 | * ( at your option ) any later version. * | 7 | * ( at your option ) any later version. * |
8 | * * | 8 | * * |
9 | **************************************************************************/ | 9 | **************************************************************************/ |
10 | #include "dataTable.h" | 10 | #include "dataTable.h" |
11 | #include <qdialog.h> | ||
12 | 11 | ||
13 | class QComboBox; | 12 | class QComboBox; |
14 | 13 | ||
15 | class dataWidgetUI : public QDialog | 14 | class dataWidgetUI : public QWidget |
16 | { | 15 | { |
17 | Q_OBJECT | 16 | Q_OBJECT |
18 | 17 | ||
19 | public: | 18 | public: |
20 | dataWidgetUI(); | 19 | dataWidgetUI(); |
21 | OxydataWidget *oxyDW; | ||
22 | 20 | ||
23 | private: | 21 | private: |
24 | OxydataTable *DataTable; | 22 | OxydataTable *DataTable; |
25 | QComboBox *dataCombo; | 23 | QComboBox *dataCombo; |
26 | 24 | OxydataWidget *oxyDW; | |
27 | private slots: | ||
28 | void slotShowData(int); | ||
29 | }; | 25 | }; |
diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp index f48cebe..cf55635 100644 --- a/noncore/apps/oxygen/psewidget.cpp +++ b/noncore/apps/oxygen/psewidget.cpp | |||
@@ -1,19 +1,19 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * ( at your option ) any later version. * | 6 | * ( at your option ) any later version. * |
7 | * * | 7 | * * |
8 | **************************************************************************/ | 8 | **************************************************************************/ |
9 | 9 | ||
10 | #include <qpe/config.h> | 10 | #include <qpe/config.h> |
11 | #include <qlayout.h> | 11 | #include <qlayout.h> |
12 | #include "psewidget.h" | 12 | #include "psewidget.h" |
13 | #include "oxyframe.h" | 13 | #include "oxyframe.h" |
14 | 14 | ||
15 | PSEWidget::PSEWidget() : QWidget() | 15 | PSEWidget::PSEWidget() : QWidget() |
16 | { | 16 | { |
17 | maingrid = new QGridLayout( 18 , 10 , -1 , "maingridlayout" ); | 17 | maingrid = new QGridLayout( 18 , 10 , -1 , "maingridlayout" ); |
18 | OxyFrame *test = new OxyFrame(this); | 18 | OxyFrame *configobj = new OxyFrame(this); |
19 | } | 19 | } |