summaryrefslogtreecommitdiff
path: root/noncore/apps/oxygen
Unidiff
Diffstat (limited to 'noncore/apps/oxygen') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/oxygen/dataTable.cpp77
-rw-r--r--noncore/apps/oxygen/dataTable.h31
-rw-r--r--noncore/apps/oxygen/datawidgetui.cpp76
-rw-r--r--noncore/apps/oxygen/datawidgetui.h5
4 files changed, 116 insertions, 73 deletions
diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp
index bb786ea..642a8be 100644
--- a/noncore/apps/oxygen/dataTable.cpp
+++ b/noncore/apps/oxygen/dataTable.cpp
@@ -9,3 +9,74 @@
9 9
10#include <qpe/config.h>
11
10#include "dataTable.h" 12#include "dataTable.h"
13#include <qwidget.h>
14#include <qhbox.h>
15#include <qvbox.h>
16#include <qlabel.h>
17#include <qfont.h>
18#include <qlayout.h>
19
20OxydataWidget::OxydataWidget(QWidget *parent) : QWidget(parent)
21{
22 QGridLayout *qgrid = new QGridLayout( this, 2,1 );
23 QHBox *hbox = new QHBox( this );
24 left = new QLabel( hbox );
25 middle = new QLabel( hbox );
26 right = new QLabel( hbox );
27
28 DataTable = new OxydataTable( 9,2, this );
29
30 QFont bf;
31 bf.setBold( true );
32 bf.setPointSize( bf.pointSize()+2 );
33 middle->setFont( bf );
34
35 setTable();
36
37 qgrid->addWidget( hbox,0,0 );
38 qgrid->addWidget( DataTable,1,0 );
39}
40
41void OxydataWidget::setElement( int el )
42{
43 Config test( "/home/opie/Settings/oxygendata", Config::File );
44 test.setGroup( QString::number( el+1 ));
45
46 left->setText( test.readEntry( "Symbol" ) );
47 middle->setText( test.readEntry( "Name" ) );
48 right->setText( QString::number( el+1 ) );
49
50 QString weight = test.readEntry( "Weight" );
51 DataTable->setText( 0,1,weight );
52 QString block = test.readEntry( "Block" );
53 DataTable->setText( 1,1,block );
54 QString grp = test.readEntry( "Group" );
55 DataTable->setText( 2,1,grp );
56 QString en = test.readEntry( "EN" );
57 DataTable->setText( 3,1,en );
58 QString ar = test.readEntry( "AR" );
59 DataTable->setText( 4,1,ar ) ;
60 QString ion = test.readEntry( "IE" );
61 DataTable->setText( 5,1,ion );
62 QString dens = test.readEntry( "Density" );
63 DataTable->setText( 6,1,dens );
64 QString bp = test.readEntry( "BP" );
65 DataTable->setText( 7,1,bp );
66 QString mp = test.readEntry( "MP" );
67 DataTable->setText( 8,1,mp );
68}
69
70void OxydataWidget::setTable()
71{
72 DataTable->setText( 0,0, tr( "Weight:" ) );
73 DataTable->setText( 1,0, tr( "Block" )) ;
74 DataTable->setText( 2,0, tr( "Group" )) ;
75 DataTable->setText( 3,0, tr( "Electronegativity" )) ;
76 DataTable->setText( 4,0, tr( "Atomic radius" )) ;
77 DataTable->setText( 5,0, tr( "Ionizationenergie" )) ;
78 DataTable->setText( 6,0, tr( "Density" )) ;
79 DataTable->setText( 7,0, tr( "Boilingpoint" ) );
80 DataTable->setText( 8,0, tr( "Meltingpoint" ) );
81}
11 82
@@ -14,2 +85,8 @@ OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent,
14{ 85{
86 this->setShowGrid( false );
87 this->setHScrollBarMode(QScrollView::AlwaysOff);
88 this->horizontalHeader()->hide();
89 this->verticalHeader()->hide();
90 this->setTopMargin( 0 );
91 this->setLeftMargin( 0 );
15} 92}
diff --git a/noncore/apps/oxygen/dataTable.h b/noncore/apps/oxygen/dataTable.h
index 908d241..624e8bd 100644
--- a/noncore/apps/oxygen/dataTable.h
+++ b/noncore/apps/oxygen/dataTable.h
@@ -13,4 +13,33 @@
13 13
14#include <qwidget.h>
14#include <qtable.h> 15#include <qtable.h>
15 16
17class QLabel;
18class OxydataTable;
19
20class OxydataWidget : public QWidget
21{
22 Q_OBJECT
23
24 public:
25 OxydataWidget(QWidget *parent=0);
26
27 QLabel *left, *middle, *right;
28
29 private:
30 OxydataTable *DataTable;
31 void setTable();
32
33 public slots:
34 void setElement( int );
35};
36
37/*
38 * A OxydataTable is derived from QTable. I recoded the paintCell to have
39 * different colors in the backgound. Furthermore this widget never has a
40 * grid, thus I removed that code in paintCell.
41 *
42 * Author: Carsten Niehaus <cniehaus@handhelds.org>
43 */
44
16class OxydataTable : public QTable 45class OxydataTable : public QTable
@@ -28,3 +57,3 @@ class OxydataTable : public QTable
28 */ 57 */
29 virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected ); 58 virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected );
30}; 59};
diff --git a/noncore/apps/oxygen/datawidgetui.cpp b/noncore/apps/oxygen/datawidgetui.cpp
index 7256777..fa3f40d 100644
--- a/noncore/apps/oxygen/datawidgetui.cpp
+++ b/noncore/apps/oxygen/datawidgetui.cpp
@@ -9,5 +9,5 @@
9#include "oxygen.h" 9#include "oxygen.h"
10#include "datawidgetui.h"
10 11
11#include <qpe/config.h> 12#include <qpe/config.h>
12#include "datawidgetui.h"
13#include <qstring.h> 13#include <qstring.h>
@@ -23,22 +23,11 @@ dataWidgetUI::dataWidgetUI() : QDialog()
23 23
24 QVBoxLayout *vbox = new QVBoxLayout( this ); 24 QGridLayout *qgrid = new QGridLayout( this, 2,1 );
25 25
26 dataCombo = new QComboBox( this ); 26 dataCombo = new QComboBox( this );
27 DataTable = new OxydataTable( 8,2, this ); 27 OxydataWidget *oxyDW = new OxydataWidget(this);
28 DataTable->setShowGrid( false ); 28 oxyDW->setElement( 1 );
29 DataTable->setHScrollBarMode(QScrollView::AlwaysOff); 29 qgrid->addWidget( dataCombo, 0,0);
30 30 qgrid->addWidget( oxyDW , 1,0 );
31 QHBox *hbox = new QHBox( this );
32 left = new QLabel( hbox );
33 middle = new QLabel( hbox );
34 right = new QLabel( hbox );
35
36 vbox->addWidget( dataCombo );
37 vbox->addWidget( hbox );
38 vbox->addWidget( DataTable );
39 31
40 DataTable->show(); 32 connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) );
41 dataCombo->show();
42
43 connect ( dataCombo, SIGNAL( activated(int) ), this, SLOT( slotShowData(int) ) );
44 Config test( "/home/opie/Settings/oxygendata", Config::File ); 33 Config test( "/home/opie/Settings/oxygendata", Config::File );
@@ -52,24 +41,4 @@ dataWidgetUI::dataWidgetUI() : QDialog()
52 } 41 }
53
54 createTableLayout();
55 slotShowData( 1 ); //this way we do always get data here
56
57} 42}
58 43
59void dataWidgetUI::createTableLayout(){
60 DataTable->horizontalHeader()->hide();
61 DataTable->verticalHeader()->hide();
62 DataTable->setTopMargin( 0 );
63 DataTable->setLeftMargin( 0 );
64
65 DataTable->setText( 0,0,"Weight:" );
66 DataTable->setText( 1,0,"Block" );
67 DataTable->setText( 2,0,"Group" );
68 DataTable->setText( 3,0,"Electronegativity" );
69 DataTable->setText( 4,0,"Atomic radius" );
70 DataTable->setText( 5,0,"Ionizationenergie" );
71 DataTable->setText( 6,0,"Density" );
72 DataTable->setText( 7,0, tr( "Boilingpoint" ) );
73 DataTable->setText( 8,0, tr( "Meltingpoint" ) );
74}
75 44
@@ -77,32 +46,3 @@ void dataWidgetUI::createTableLayout(){
77void dataWidgetUI::slotShowData(int number){ 46void dataWidgetUI::slotShowData(int number){
78 Config test( "/home/opie/Settings/oxygendata", Config::File ); 47 oxyDW->setElement( 6 );
79 test.setGroup( QString::number( number+1 ));
80
81 left->setText( test.readEntry( "Symbol" ) );
82 middle->setText( test.readEntry( "Name" ) );
83 right->setText( QString::number( number+1 ) );
84
85 QFont bf;
86 bf.setBold( true );
87 bf.setPointSize( bf.pointSize()+2 );
88 middle->setFont( bf );
89
90 QString weight = test.readEntry( "Weight" );
91 DataTable->setText( 0,1,weight );
92 QString block = test.readEntry( "Block" );
93 DataTable->setText( 1,1,block );
94 QString grp = test.readEntry( "Group" );
95 DataTable->setText( 2,1,grp );
96 QString en = test.readEntry( "EN" );
97 DataTable->setText( 3,1,en );
98 QString ar = test.readEntry( "AR" );
99 DataTable->setText( 4,1,ar ) ;
100 QString ion = test.readEntry( "IE" );
101 DataTable->setText( 5,1,ion );
102 QString dens = test.readEntry( "Density" );
103 DataTable->setText( 6,1,dens );
104 QString bp = test.readEntry( "BP" );
105 DataTable->setText( 7,1,bp );
106 QString mp = test.readEntry( "MP" );
107 DataTable->setText( 7,1,mp );
108} 48}
diff --git a/noncore/apps/oxygen/datawidgetui.h b/noncore/apps/oxygen/datawidgetui.h
index 64599a7..20622db 100644
--- a/noncore/apps/oxygen/datawidgetui.h
+++ b/noncore/apps/oxygen/datawidgetui.h
@@ -12,5 +12,3 @@
12 12
13class QTable;
14class QComboBox; 13class QComboBox;
15class QLabel;
16 14
@@ -22,8 +20,7 @@ class dataWidgetUI : public QDialog
22 dataWidgetUI(); 20 dataWidgetUI();
21 OxydataWidget *oxyDW;
23 22
24 private: 23 private:
25 void createTableLayout();
26 OxydataTable *DataTable; 24 OxydataTable *DataTable;
27 QComboBox *dataCombo; 25 QComboBox *dataCombo;
28 QLabel *left, *middle, *right;
29 26