summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/oxygen/calcdlg.ui220
-rw-r--r--noncore/apps/oxygen/dataTable.cpp2
2 files changed, 121 insertions, 101 deletions
diff --git a/noncore/apps/oxygen/calcdlg.ui b/noncore/apps/oxygen/calcdlg.ui
index 51bf334..60d312d 100644
--- a/noncore/apps/oxygen/calcdlg.ui
+++ b/noncore/apps/oxygen/calcdlg.ui
@@ -1,169 +1,187 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>CalcDlg</class> 2<class>CalcDlg</class>
3<widget> 3<widget>
4 <class>QWidget</class> 4 <class>QWidget</class>
5 <property stdset="1"> 5 <property stdset="1">
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>323</width>
15 <height>318</height> 15 <height>380</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <widget> 18 <property stdset="1">
19 <class>QTabWidget</class> 19 <name>caption</name>
20 <string>CalcDlg</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <grid>
20 <property stdset="1"> 29 <property stdset="1">
21 <name>name</name> 30 <name>margin</name>
22 <cstring>TabWidget3</cstring> 31 <number>-1</number>
23 </property> 32 </property>
24 <property stdset="1"> 33 <property stdset="1">
25 <name>geometry</name> 34 <name>spacing</name>
26 <rect> 35 <number>-1</number>
27 <x>0</x>
28 <y>0</y>
29 <width>240</width>
30 <height>320</height>
31 </rect>
32 </property> 36 </property>
33 <widget> 37 <widget row="0" column="0" >
34 <class>QWidget</class> 38 <class>QTabWidget</class>
35 <property stdset="1"> 39 <property stdset="1">
36 <name>name</name> 40 <name>name</name>
37 <cstring>tab</cstring> 41 <cstring>TabWidget3</cstring>
42 </property>
43 <property>
44 <name>layoutMargin</name>
45 </property>
46 <property>
47 <name>layoutSpacing</name>
38 </property> 48 </property>
39 <attribute>
40 <name>title</name>
41 <string>Molecular Weight</string>
42 </attribute>
43 <widget> 49 <widget>
44 <class>QLayoutWidget</class> 50 <class>QWidget</class>
45 <property stdset="1"> 51 <property stdset="1">
46 <name>name</name> 52 <name>name</name>
47 <cstring>Layout6</cstring> 53 <cstring>tab</cstring>
48 </property>
49 <property stdset="1">
50 <name>geometry</name>
51 <rect>
52 <x>0</x>
53 <y>0</y>
54 <width>230</width>
55 <height>290</height>
56 </rect>
57 </property> 54 </property>
55 <attribute>
56 <name>title</name>
57 <string>Molecular Weight</string>
58 </attribute>
58 <vbox> 59 <vbox>
59 <property stdset="1"> 60 <property stdset="1">
60 <name>margin</name> 61 <name>margin</name>
61 <number>0</number> 62 <number>-1</number>
62 </property> 63 </property>
63 <property stdset="1"> 64 <property stdset="1">
64 <name>spacing</name> 65 <name>spacing</name>
65 <number>6</number> 66 <number>-1</number>
66 </property> 67 </property>
67 <widget> 68 <widget>
68 <class>QLabel</class>
69 <property stdset="1">
70 <name>name</name>
71 <cstring>TextLabel2</cstring>
72 </property>
73 <property stdset="1">
74 <name>text</name>
75 <string>Chemical Formula</string>
76 </property>
77 </widget>
78 <widget>
79 <class>QLineEdit</class>
80 <property stdset="1">
81 <name>name</name>
82 <cstring>formula</cstring>
83 </property>
84 </widget>
85 <widget>
86 <class>QLayoutWidget</class> 69 <class>QLayoutWidget</class>
87 <property stdset="1"> 70 <property stdset="1">
88 <name>name</name> 71 <name>name</name>
89 <cstring>Layout3</cstring> 72 <cstring>Layout6</cstring>
90 </property> 73 </property>
91 <hbox> 74 <vbox>
92 <property stdset="1"> 75 <property stdset="1">
93 <name>margin</name> 76 <name>margin</name>
94 <number>0</number> 77 <number>0</number>
95 </property> 78 </property>
96 <property stdset="1"> 79 <property stdset="1">
97 <name>spacing</name> 80 <name>spacing</name>
98 <number>6</number> 81 <number>6</number>
99 </property> 82 </property>
100 <widget> 83 <widget>
101 <class>QPushButton</class> 84 <class>QLabel</class>
102 <property stdset="1"> 85 <property stdset="1">
103 <name>name</name> 86 <name>name</name>
104 <cstring>calculate</cstring> 87 <cstring>TextLabel2</cstring>
105 </property> 88 </property>
106 <property stdset="1"> 89 <property stdset="1">
107 <name>text</name> 90 <name>text</name>
108 <string>Calculate</string> 91 <string>Chemical Formula</string>
92 </property>
93 </widget>
94 <widget>
95 <class>QLineEdit</class>
96 <property stdset="1">
97 <name>name</name>
98 <cstring>formula</cstring>
109 </property> 99 </property>
110 </widget> 100 </widget>
111 <widget> 101 <widget>
112 <class>QPushButton</class> 102 <class>QLayoutWidget</class>
113 <property stdset="1"> 103 <property stdset="1">
114 <name>name</name> 104 <name>name</name>
115 <cstring>clear_fields</cstring> 105 <cstring>Layout3</cstring>
106 </property>
107 <hbox>
108 <property stdset="1">
109 <name>margin</name>
110 <number>0</number>
111 </property>
112 <property stdset="1">
113 <name>spacing</name>
114 <number>6</number>
115 </property>
116 <widget>
117 <class>QPushButton</class>
118 <property stdset="1">
119 <name>name</name>
120 <cstring>calculate</cstring>
121 </property>
122 <property stdset="1">
123 <name>text</name>
124 <string>Calculate</string>
125 </property>
126 </widget>
127 <widget>
128 <class>QPushButton</class>
129 <property stdset="1">
130 <name>name</name>
131 <cstring>clear_fields</cstring>
132 </property>
133 <property stdset="1">
134 <name>text</name>
135 <string>Clear</string>
136 </property>
137 </widget>
138 </hbox>
139 </widget>
140 <widget>
141 <class>QLabel</class>
142 <property stdset="1">
143 <name>name</name>
144 <cstring>TextLabel3</cstring>
116 </property> 145 </property>
117 <property stdset="1"> 146 <property stdset="1">
118 <name>text</name> 147 <name>text</name>
119 <string>Clear</string> 148 <string>Molecular Weight (u):</string>
120 </property> 149 </property>
121 </widget> 150 </widget>
122 </hbox> 151 <widget>
123 </widget> 152 <class>QLineEdit</class>
124 <widget> 153 <property stdset="1">
125 <class>QLabel</class> 154 <name>name</name>
126 <property stdset="1"> 155 <cstring>result</cstring>
127 <name>name</name> 156 </property>
128 <cstring>TextLabel3</cstring> 157 </widget>
129 </property> 158 <widget>
130 <property stdset="1"> 159 <class>QLabel</class>
131 <name>text</name> 160 <property stdset="1">
132 <string>Molecular Weight (u):</string> 161 <name>name</name>
133 </property> 162 <cstring>TextLabel1</cstring>
134 </widget> 163 </property>
135 <widget> 164 <property stdset="1">
136 <class>QLineEdit</class> 165 <name>text</name>
137 <property stdset="1"> 166 <string>Elemental Composition (%):</string>
138 <name>name</name> 167 </property>
139 <cstring>result</cstring> 168 </widget>
140 </property> 169 <widget>
141 </widget> 170 <class>QMultiLineEdit</class>
142 <widget> 171 <property stdset="1">
143 <class>QLabel</class> 172 <name>name</name>
144 <property stdset="1"> 173 <cstring>anal_display</cstring>
145 <name>name</name> 174 </property>
146 <cstring>TextLabel1</cstring> 175 <property stdset="1">
147 </property> 176 <name>readOnly</name>
148 <property stdset="1"> 177 <bool>true</bool>
149 <name>text</name> 178 </property>
150 <string>Elemental Composition (%):</string> 179 </widget>
151 </property> 180 </vbox>
152 </widget>
153 <widget>
154 <class>QMultiLineEdit</class>
155 <property stdset="1">
156 <name>name</name>
157 <cstring>anal_display</cstring>
158 </property>
159 <property stdset="1">
160 <name>readOnly</name>
161 <bool>true</bool>
162 </property>
163 </widget> 181 </widget>
164 </vbox> 182 </vbox>
165 </widget> 183 </widget>
166 </widget> 184 </widget>
167 </widget> 185 </grid>
168</widget> 186</widget>
169</UI> 187</UI>
diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp
index 48e2b20..798230a 100644
--- a/noncore/apps/oxygen/dataTable.cpp
+++ b/noncore/apps/oxygen/dataTable.cpp
@@ -4,146 +4,148 @@
4 begin : September 2002 4 begin : September 2002
5 copyright : ( C ) 2002 by Carsten Niehaus 5 copyright : ( C ) 2002 by Carsten Niehaus
6 email : cniehaus@handhelds.org 6 email : cniehaus@handhelds.org
7 **************************************************************************/ 7 **************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * ( at your option ) any later version. * 14 * ( at your option ) any later version. *
15 * * 15 * *
16 **************************************************************************/ 16 **************************************************************************/
17 17
18#include <qpe/config.h> 18#include <qpe/config.h>
19 19
20#include "dataTable.h" 20#include "dataTable.h"
21#include <qhbox.h> 21#include <qhbox.h>
22#include <qlabel.h> 22#include <qlabel.h>
23#include <qlayout.h> 23#include <qlayout.h>
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25 25
26 26
27OxydataWidget::OxydataWidget(QWidget *parent, const char *name, const QStringList &list ) : QWidget( parent,name ), names( list ) 27OxydataWidget::OxydataWidget(QWidget *parent, const char *name, const QStringList &list ) : QWidget( parent,name ), names( list )
28{ 28{
29 QGridLayout *qgrid = new QGridLayout( this, 2,1 ); 29 QGridLayout *qgrid = new QGridLayout( this, 2,1 );
30 30
31 QHBox *hbox = new QHBox( this ); 31 QHBox *hbox = new QHBox( this );
32 left = new QLabel( hbox ); 32 left = new QLabel( hbox );
33 middle = new QLabel( hbox ); 33 middle = new QLabel( hbox );
34 right = new QLabel( hbox ); 34 right = new QLabel( hbox );
35 35
36 right->setAlignment( AlignRight ); 36 right->setAlignment( AlignRight );
37 middle->setAlignment( AlignHCenter ); 37 middle->setAlignment( AlignHCenter );
38 38
39 QFont bf; 39 QFont bf;
40 bf.setBold( true ); 40 bf.setBold( true );
41 bf.setPointSize( bf.pointSize()+2 ); 41 bf.setPointSize( bf.pointSize()+2 );
42 middle->setFont( bf ); 42 middle->setFont( bf );
43 43
44 DataTable = new OxydataTable( 9,2, this ); 44 DataTable = new OxydataTable( 9,2, this );
45 setTable(); 45 setTable();
46 46
47 qgrid->addWidget( hbox,0,0 ); 47 qgrid->addWidget( hbox,0,0 );
48 qgrid->addWidget( DataTable,1,0 ); 48 qgrid->addWidget( DataTable,1,0 );
49} 49}
50 50
51void OxydataWidget::setElement( int el ) 51void OxydataWidget::setElement( int el )
52{ 52{
53 QStringList::ConstIterator it = names.at(el); 53 QStringList::ConstIterator it = names.at(el);
54 Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); 54 Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File );
55 55
56 configobj.setGroup( QString::number( el+1 )); 56 configobj.setGroup( QString::number( el+1 ));
57 57
58 left->setText( configobj.readEntry( "Symbol" ) ); 58 left->setText( configobj.readEntry( "Symbol" ) );
59 middle->setText( *it ); 59 middle->setText( *it );
60 right->setText( QString::number( el+1 ) ); 60 right->setText( QString::number( el+1 ) );
61 61
62 62
63 DataTable->setText( 0,1,tr( "%1 u" ).arg( configobj.readEntry( "Weight" ) ) ); 63 DataTable->setText( 0,1,tr( "%1 u" ).arg( configobj.readEntry( "Weight" ) ) );
64 DataTable->setText( 1,1,configobj.readEntry( "Block" ) ); 64 DataTable->setText( 1,1,configobj.readEntry( "Block" ) );
65 DataTable->setText( 2,1,configobj.readEntry( "Group" ) ); 65 DataTable->setText( 2,1,configobj.readEntry( "Group" ) );
66 DataTable->setText( 3,1,configobj.readEntry( "EN" ) ); 66 DataTable->setText( 3,1,configobj.readEntry( "EN" ) );
67 DataTable->setText( 4,1,tr( "%1 pm" ).arg( configobj.readEntry( "AR" ) ) ) ; 67 DataTable->setText( 4,1,tr( "%1 pm" ).arg( configobj.readEntry( "AR" ) ) ) ;
68 DataTable->setText( 5,1,tr( "%1 J" ).arg( configobj.readEntry( "IE" ) ) ); 68 DataTable->setText( 5,1,tr( "%1 J" ).arg( configobj.readEntry( "IE" ) ) );
69 DataTable->setText( 6,1,tr( "%1 g/cm^3" ).arg( configobj.readEntry( "Density" ) ) ); 69 DataTable->setText( 6,1,tr( "%1 g/cm^3" ).arg( configobj.readEntry( "Density" ) ) );
70 DataTable->setText( 7,1,tr( "%1 K" ).arg( configobj.readEntry( "BP" ) ) ); 70 DataTable->setText( 7,1,tr( "%1 K" ).arg( configobj.readEntry( "BP" ) ) );
71 DataTable->setText( 8,1,tr( "%1 K" ).arg( configobj.readEntry( "MP" ) ) ); 71 DataTable->setText( 8,1,tr( "%1 K" ).arg( configobj.readEntry( "MP" ) ) );
72} 72}
73 73
74void OxydataWidget::setTable() const 74void OxydataWidget::setTable() const
75{ 75{
76 DataTable->setText( 0,0, tr( "Weight" ) ); 76 DataTable->setText( 0,0, tr( "Weight" ) );
77 DataTable->setText( 1,0, tr( "Block" )) ; 77 DataTable->setText( 1,0, tr( "Block" )) ;
78 DataTable->setText( 2,0, tr( "Group" )) ; 78 DataTable->setText( 2,0, tr( "Group" )) ;
79 DataTable->setText( 3,0, tr( "Electronegativity" )) ; 79 DataTable->setText( 3,0, tr( "Electronegativity" )) ;
80 DataTable->setText( 4,0, tr( "Atomic radius" )) ; 80 DataTable->setText( 4,0, tr( "Atomic radius" )) ;
81 DataTable->setText( 5,0, tr( "Ionization Energy" )) ; 81 DataTable->setText( 5,0, tr( "Ionization Energy" )) ;
82 DataTable->setText( 6,0, tr( "Density" )) ; 82 DataTable->setText( 6,0, tr( "Density" )) ;
83 DataTable->setText( 7,0, tr( "Boiling point" ) ); 83 DataTable->setText( 7,0, tr( "Boiling point" ) );
84 DataTable->setText( 8,0, tr( "Melting point" ) ); 84 DataTable->setText( 8,0, tr( "Melting point" ) );
85} 85}
86 86
87void OxydataWidget::setLayout() 87void OxydataWidget::setLayout()
88{ 88{
89#warning this is not working and I have no idea why! 89#warning this is not working and I have no idea why!
90// DataTable->setColumnWidth ( 0 , this->width()/2 ); 90// DataTable->setColumnWidth ( 0 , this->width()/2 );
91// DataTable->setColumnWidth ( 1 , this->width()/2 ); 91// DataTable->setColumnWidth ( 1 , this->width()/2 );
92 92
93//X DataTable->setColumnWidth ( 0 , 110 ); 93//X DataTable->setColumnWidth ( 0 , 110 );
94//X DataTable->setColumnWidth ( 1 , 110 ); 94//X DataTable->setColumnWidth ( 1 , 110 );
95} 95}
96 96
97OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent, 97OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent,
98 const char *name) : QTable(numRows, numCols,parent, name) 98 const char *name) : QTable(numRows, numCols,parent, name)
99{ 99{
100 setColumnStretchable( 0, true );
101 setColumnStretchable( 1, true );
100 102
101 for (int zeile = 0; zeile < numRows; zeile++) 103 for (int zeile = 0; zeile < numRows; zeile++)
102 for ( int spalte = 0; spalte < numCols; spalte++ ) 104 for ( int spalte = 0; spalte < numCols; spalte++ )
103 { 105 {
104 OxydataQTI *testus = new OxydataQTI (this, OxydataQTI::Never, "hm" ); 106 OxydataQTI *testus = new OxydataQTI (this, OxydataQTI::Never, "hm" );
105 setItem(zeile, spalte, (QTableItem*)testus); 107 setItem(zeile, spalte, (QTableItem*)testus);
106 } 108 }
107 109
108 110
109 this->setShowGrid( false ); 111 this->setShowGrid( false );
110 this->setHScrollBarMode(QScrollView::AlwaysOff); 112 this->setHScrollBarMode(QScrollView::AlwaysOff);
111 this->horizontalHeader()->hide(); 113 this->horizontalHeader()->hide();
112 this->verticalHeader()->hide(); 114 this->verticalHeader()->hide();
113 this->setTopMargin( 0 ); 115 this->setTopMargin( 0 );
114 this->setLeftMargin( 0 ); 116 this->setLeftMargin( 0 );
115} 117}
116 118
117void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected) 119void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected)
118{ 120{
119 if ( cr.width() == 0 || cr.height() == 0 ) 121 if ( cr.width() == 0 || cr.height() == 0 )
120 return; 122 return;
121 selected = FALSE; 123 selected = FALSE;
122 124
123 QTableItem *itm = item( row, col ); 125 QTableItem *itm = item( row, col );
124 QColorGroup colgrp = colorGroup(); 126 QColorGroup colgrp = colorGroup();
125 if ( itm ) 127 if ( itm )
126 { 128 {
127 if ( row%2 ) 129 if ( row%2 )
128 colgrp.setColor( QColorGroup::Base, QColor( 180,200,210 ) ); 130 colgrp.setColor( QColorGroup::Base, QColor( 180,200,210 ) );
129 else 131 else
130 colgrp.setColor( QColorGroup::Base, QColor( 230,235,235 ) ); 132 colgrp.setColor( QColorGroup::Base, QColor( 230,235,235 ) );
131 p->save(); 133 p->save();
132 itm->paint( p, colgrp, cr, selected ); 134 itm->paint( p, colgrp, cr, selected );
133 p->restore(); 135 p->restore();
134 } 136 }
135} 137}
136 138
137OxydataQTI::OxydataQTI(QTable * table, EditType et, const QString & text ) 139OxydataQTI::OxydataQTI(QTable * table, EditType et, const QString & text )
138 : QTableItem ( table, et, text ) 140 : QTableItem ( table, et, text )
139{ 141{
140} 142}
141 143
142int OxydataQTI::alignment() const 144int OxydataQTI::alignment() const
143{ 145{
144 if ( col()%2 ) 146 if ( col()%2 )
145 { 147 {
146 return AlignRight | AlignVCenter; 148 return AlignRight | AlignVCenter;
147 }else return AlignLeft | AlignVCenter; 149 }else return AlignLeft | AlignVCenter;
148}; 150};
149 151