summaryrefslogtreecommitdiff
path: root/noncore/apps/oxygen/datawidgetui.cpp
Unidiff
Diffstat (limited to 'noncore/apps/oxygen/datawidgetui.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/oxygen/datawidgetui.cpp76
1 files changed, 8 insertions, 68 deletions
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
@@ -7,9 +7,9 @@
7 * * 7 * *
8 **************************************************************************/ 8 **************************************************************************/
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>
14#include <qcombobox.h> 14#include <qcombobox.h>
15#include <qlayout.h> 15#include <qlayout.h>
@@ -21,26 +21,15 @@ dataWidgetUI::dataWidgetUI() : QDialog()
21{ 21{
22 this->setCaption("Chemical Data"); 22 this->setCaption("Chemical Data");
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 );
45 34
46 //read in all names of the 118 elements 35 //read in all names of the 118 elements
@@ -50,59 +39,10 @@ dataWidgetUI::dataWidgetUI() : QDialog()
50 QString foo = test.readEntry( "Name" ); 39 QString foo = test.readEntry( "Name" );
51 dataCombo->insertItem( foo ); 40 dataCombo->insertItem( foo );
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
76 45
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}