-rw-r--r-- | noncore/apps/oxygen/calcdlg.ui | 29 | ||||
-rw-r--r-- | noncore/apps/oxygen/calcdlgui.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/oxygen/dataTable.cpp | 15 | ||||
-rw-r--r-- | noncore/apps/oxygen/datawidgetui.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/oxygen/oxygen.cpp | 5 |
5 files changed, 21 insertions, 32 deletions
diff --git a/noncore/apps/oxygen/calcdlg.ui b/noncore/apps/oxygen/calcdlg.ui index 2d30164..a8ed170 100644 --- a/noncore/apps/oxygen/calcdlg.ui +++ b/noncore/apps/oxygen/calcdlg.ui | |||
@@ -1,180 +1,173 @@ | |||
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>245</width> | 14 | <width>241</width> |
15 | <height>318</height> | 15 | <height>318</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Form1</string> | 20 | <string>Form1</string> |
21 | </property> | 21 | </property> |
22 | <widget> | 22 | <widget> |
23 | <class>QTabWidget</class> | 23 | <class>QTabWidget</class> |
24 | <property stdset="1"> | 24 | <property stdset="1"> |
25 | <name>name</name> | 25 | <name>name</name> |
26 | <cstring>TabWidget3</cstring> | 26 | <cstring>TabWidget3</cstring> |
27 | </property> | 27 | </property> |
28 | <property stdset="1"> | 28 | <property stdset="1"> |
29 | <name>geometry</name> | 29 | <name>geometry</name> |
30 | <rect> | 30 | <rect> |
31 | <x>0</x> | 31 | <x>0</x> |
32 | <y>0</y> | 32 | <y>0</y> |
33 | <width>240</width> | 33 | <width>240</width> |
34 | <height>320</height> | 34 | <height>320</height> |
35 | </rect> | 35 | </rect> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QWidget</class> | 38 | <class>QWidget</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>tab</cstring> | 41 | <cstring>tab</cstring> |
42 | </property> | 42 | </property> |
43 | <attribute> | 43 | <attribute> |
44 | <name>title</name> | 44 | <name>title</name> |
45 | <string>Tab 1</string> | 45 | <string>Molecular Weight</string> |
46 | </attribute> | 46 | </attribute> |
47 | <widget> | 47 | <widget> |
48 | <class>QLayoutWidget</class> | 48 | <class>QLayoutWidget</class> |
49 | <property stdset="1"> | 49 | <property stdset="1"> |
50 | <name>name</name> | 50 | <name>name</name> |
51 | <cstring>Layout6</cstring> | 51 | <cstring>Layout6</cstring> |
52 | </property> | 52 | </property> |
53 | <property stdset="1"> | 53 | <property stdset="1"> |
54 | <name>geometry</name> | 54 | <name>geometry</name> |
55 | <rect> | 55 | <rect> |
56 | <x>0</x> | 56 | <x>0</x> |
57 | <y>0</y> | 57 | <y>0</y> |
58 | <width>230</width> | 58 | <width>230</width> |
59 | <height>290</height> | 59 | <height>290</height> |
60 | </rect> | 60 | </rect> |
61 | </property> | 61 | </property> |
62 | <vbox> | 62 | <vbox> |
63 | <property stdset="1"> | 63 | <property stdset="1"> |
64 | <name>margin</name> | 64 | <name>margin</name> |
65 | <number>0</number> | 65 | <number>0</number> |
66 | </property> | 66 | </property> |
67 | <property stdset="1"> | 67 | <property stdset="1"> |
68 | <name>spacing</name> | 68 | <name>spacing</name> |
69 | <number>6</number> | 69 | <number>6</number> |
70 | </property> | 70 | </property> |
71 | <widget> | 71 | <widget> |
72 | <class>QLabel</class> | 72 | <class>QLabel</class> |
73 | <property stdset="1"> | 73 | <property stdset="1"> |
74 | <name>name</name> | 74 | <name>name</name> |
75 | <cstring>TextLabel2</cstring> | 75 | <cstring>TextLabel2</cstring> |
76 | </property> | 76 | </property> |
77 | <property stdset="1"> | 77 | <property stdset="1"> |
78 | <name>text</name> | 78 | <name>text</name> |
79 | <string>TextLabel2</string> | 79 | <string>chemical Formula</string> |
80 | </property> | 80 | </property> |
81 | </widget> | 81 | </widget> |
82 | <widget> | 82 | <widget> |
83 | <class>QLineEdit</class> | 83 | <class>QLineEdit</class> |
84 | <property stdset="1"> | 84 | <property stdset="1"> |
85 | <name>name</name> | 85 | <name>name</name> |
86 | <cstring>formula</cstring> | 86 | <cstring>formula</cstring> |
87 | </property> | 87 | </property> |
88 | </widget> | 88 | </widget> |
89 | <widget> | 89 | <widget> |
90 | <class>QLayoutWidget</class> | 90 | <class>QLayoutWidget</class> |
91 | <property stdset="1"> | 91 | <property stdset="1"> |
92 | <name>name</name> | 92 | <name>name</name> |
93 | <cstring>Layout3</cstring> | 93 | <cstring>Layout3</cstring> |
94 | </property> | 94 | </property> |
95 | <hbox> | 95 | <hbox> |
96 | <property stdset="1"> | 96 | <property stdset="1"> |
97 | <name>margin</name> | 97 | <name>margin</name> |
98 | <number>0</number> | 98 | <number>0</number> |
99 | </property> | 99 | </property> |
100 | <property stdset="1"> | 100 | <property stdset="1"> |
101 | <name>spacing</name> | 101 | <name>spacing</name> |
102 | <number>6</number> | 102 | <number>6</number> |
103 | </property> | 103 | </property> |
104 | <widget> | 104 | <widget> |
105 | <class>QPushButton</class> | 105 | <class>QPushButton</class> |
106 | <property stdset="1"> | 106 | <property stdset="1"> |
107 | <name>name</name> | 107 | <name>name</name> |
108 | <cstring>calculate</cstring> | 108 | <cstring>calculate</cstring> |
109 | </property> | 109 | </property> |
110 | <property stdset="1"> | 110 | <property stdset="1"> |
111 | <name>text</name> | 111 | <name>text</name> |
112 | <string>PushButton3</string> | 112 | <string>Calculate</string> |
113 | </property> | 113 | </property> |
114 | </widget> | 114 | </widget> |
115 | <widget> | 115 | <widget> |
116 | <class>QPushButton</class> | 116 | <class>QPushButton</class> |
117 | <property stdset="1"> | 117 | <property stdset="1"> |
118 | <name>name</name> | 118 | <name>name</name> |
119 | <cstring>clear_fields</cstring> | 119 | <cstring>clear_fields</cstring> |
120 | </property> | 120 | </property> |
121 | <property stdset="1"> | 121 | <property stdset="1"> |
122 | <name>text</name> | 122 | <name>text</name> |
123 | <string>PushButton4</string> | 123 | <string>Clear</string> |
124 | </property> | 124 | </property> |
125 | </widget> | 125 | </widget> |
126 | </hbox> | 126 | </hbox> |
127 | </widget> | 127 | </widget> |
128 | <widget> | 128 | <widget> |
129 | <class>QLabel</class> | 129 | <class>QLabel</class> |
130 | <property stdset="1"> | 130 | <property stdset="1"> |
131 | <name>name</name> | 131 | <name>name</name> |
132 | <cstring>TextLabel3</cstring> | 132 | <cstring>TextLabel3</cstring> |
133 | </property> | 133 | </property> |
134 | <property stdset="1"> | 134 | <property stdset="1"> |
135 | <name>text</name> | 135 | <name>text</name> |
136 | <string>TextLabel3</string> | 136 | <string>Molecular Weight (u):</string> |
137 | </property> | 137 | </property> |
138 | </widget> | 138 | </widget> |
139 | <widget> | 139 | <widget> |
140 | <class>QLineEdit</class> | 140 | <class>QLineEdit</class> |
141 | <property stdset="1"> | 141 | <property stdset="1"> |
142 | <name>name</name> | 142 | <name>name</name> |
143 | <cstring>result</cstring> | 143 | <cstring>result</cstring> |
144 | </property> | 144 | </property> |
145 | </widget> | 145 | </widget> |
146 | <widget> | 146 | <widget> |
147 | <class>QLabel</class> | 147 | <class>QLabel</class> |
148 | <property stdset="1"> | 148 | <property stdset="1"> |
149 | <name>name</name> | 149 | <name>name</name> |
150 | <cstring>TextLabel1</cstring> | 150 | <cstring>TextLabel1</cstring> |
151 | </property> | 151 | </property> |
152 | <property stdset="1"> | 152 | <property stdset="1"> |
153 | <name>text</name> | 153 | <name>text</name> |
154 | <string>TextLabel1</string> | 154 | <string>Elemental Composition (%):</string> |
155 | </property> | 155 | </property> |
156 | </widget> | 156 | </widget> |
157 | <widget> | 157 | <widget> |
158 | <class>QMultiLineEdit</class> | 158 | <class>QMultiLineEdit</class> |
159 | <property stdset="1"> | 159 | <property stdset="1"> |
160 | <name>name</name> | 160 | <name>name</name> |
161 | <cstring>anal_display</cstring> | 161 | <cstring>anal_display</cstring> |
162 | </property> | 162 | </property> |
163 | <property stdset="1"> | ||
164 | <name>readOnly</name> | ||
165 | <bool>true</bool> | ||
166 | </property> | ||
163 | </widget> | 167 | </widget> |
164 | </vbox> | 168 | </vbox> |
165 | </widget> | 169 | </widget> |
166 | </widget> | 170 | </widget> |
167 | <widget> | ||
168 | <class>QWidget</class> | ||
169 | <property stdset="1"> | ||
170 | <name>name</name> | ||
171 | <cstring>tab</cstring> | ||
172 | </property> | ||
173 | <attribute> | ||
174 | <name>title</name> | ||
175 | <string>Tab 2</string> | ||
176 | </attribute> | ||
177 | </widget> | ||
178 | </widget> | 171 | </widget> |
179 | </widget> | 172 | </widget> |
180 | </UI> | 173 | </UI> |
diff --git a/noncore/apps/oxygen/calcdlgui.cpp b/noncore/apps/oxygen/calcdlgui.cpp index ca3a9f2..f8dfde5 100644 --- a/noncore/apps/oxygen/calcdlgui.cpp +++ b/noncore/apps/oxygen/calcdlgui.cpp | |||
@@ -1,64 +1,64 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : Oxygen | 2 | application: : Oxygen |
3 | 3 | ||
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 | #include "oxygen.h" | 17 | #include "oxygen.h" |
18 | 18 | ||
19 | #include "calcdlgui.h" | 19 | #include "calcdlgui.h" |
20 | #include "kmolcalc.h" | 20 | #include "kmolcalc.h" |
21 | #include <qlineedit.h> | 21 | #include <qlineedit.h> |
22 | #include <qmultilineedit.h> | 22 | #include <qmultilineedit.h> |
23 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
24 | 24 | ||
25 | calcDlgUI::calcDlgUI() : CalcDlg() | 25 | calcDlgUI::calcDlgUI() : CalcDlg() |
26 | { | 26 | { |
27 | kmolcalc = new KMolCalc; | 27 | kmolcalc = new KMolCalc; |
28 | connect( calculate, SIGNAL( clicked() ), this, SLOT( calc() ) ); | 28 | connect( calculate, SIGNAL( clicked() ), this, SLOT( calc() ) ); |
29 | connect( clear_fields, SIGNAL( clicked() ), this, SLOT( clear() ) ); | 29 | connect( clear_fields, SIGNAL( clicked() ), this, SLOT( clear() ) ); |
30 | result->setReadOnly( true ); | 30 | result->setReadOnly( true ); |
31 | } | 31 | } |
32 | 32 | ||
33 | void calcDlgUI::calc() | 33 | void calcDlgUI::calc() |
34 | { | 34 | { |
35 | QString compound( formula->text() ); | 35 | QString compound( formula->text() ); |
36 | if ( compound.isEmpty() ) { | 36 | if ( compound.isEmpty() ) { |
37 | clear(); | 37 | clear(); |
38 | return; | 38 | return; |
39 | } | 39 | } |
40 | QString errors( kmolcalc->readFormula( compound ) ); | 40 | QString errors( kmolcalc->readFormula( compound ) ); |
41 | QString mw, ea; | 41 | QString mw, ea; |
42 | double weight = kmolcalc->getWeight(); | 42 | double weight = kmolcalc->getWeight(); |
43 | if ( errors == "OK" ) { | 43 | if ( errors == "OK" ) { |
44 | mw.setNum( weight ); | 44 | mw.setNum( weight ); |
45 | ea = kmolcalc->getEmpFormula() + " :\n" + kmolcalc->getEA(); | 45 | ea = kmolcalc->getEmpFormula() + " :\n" + kmolcalc->getEA(); |
46 | } else { | 46 | } else { |
47 | mw = "???"; | 47 | mw = "???"; |
48 | ea = tr( "ERROR: \n" ) + errors + "\n"; | 48 | ea = tr( "ERROR: \n" ).arg( errors )+ "\n"; |
49 | } | 49 | } |
50 | result->setText( mw ); | 50 | result->setText( mw ); |
51 | anal_display->setText( ea ); | 51 | anal_display->setText( ea ); |
52 | } | 52 | } |
53 | 53 | ||
54 | /** | 54 | /** |
55 | * * Clear all text entry / result fields. | 55 | * * Clear all text entry / result fields. |
56 | * */ | 56 | * */ |
57 | void calcDlgUI::clear() | 57 | void calcDlgUI::clear() |
58 | { | 58 | { |
59 | formula->clear(); | 59 | formula->clear(); |
60 | result->clear(); | 60 | result->clear(); |
61 | anal_display->clear(); | 61 | anal_display->clear(); |
62 | } | 62 | } |
63 | 63 | ||
64 | 64 | ||
diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp index 20c2985..98d3bd8 100644 --- a/noncore/apps/oxygen/dataTable.cpp +++ b/noncore/apps/oxygen/dataTable.cpp | |||
@@ -1,142 +1,141 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : Oxygen | 2 | application: : Oxygen |
3 | 3 | ||
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 <qwidget.h> | 21 | #include <qwidget.h> |
22 | #include <qhbox.h> | 22 | #include <qhbox.h> |
23 | #include <qlabel.h> | 23 | #include <qlabel.h> |
24 | #include <qfont.h> | 24 | #include <qfont.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
27 | 27 | ||
28 | OxydataWidget::OxydataWidget(QWidget *parent) : QWidget(parent) | 28 | OxydataWidget::OxydataWidget(QWidget *parent) : QWidget(parent) |
29 | { | 29 | { |
30 | QGridLayout *qgrid = new QGridLayout( this, 2,1 ); | 30 | QGridLayout *qgrid = new QGridLayout( this, 2,1 ); |
31 | 31 | ||
32 | QHBox *hbox = new QHBox( this ); | 32 | QHBox *hbox = new QHBox( this ); |
33 | left = new QLabel( hbox ); | 33 | left = new QLabel( hbox ); |
34 | middle = new QLabel( hbox ); | 34 | middle = new QLabel( hbox ); |
35 | right = new QLabel( hbox ); | 35 | right = new QLabel( hbox ); |
36 | 36 | ||
37 | right->setAlignment( AlignRight ); | 37 | right->setAlignment( AlignRight ); |
38 | middle->setAlignment( AlignHCenter ); | 38 | middle->setAlignment( AlignHCenter ); |
39 | 39 | ||
40 | QFont bf; | 40 | QFont bf; |
41 | bf.setBold( true ); | 41 | bf.setBold( true ); |
42 | bf.setPointSize( bf.pointSize()+2 ); | 42 | bf.setPointSize( bf.pointSize()+2 ); |
43 | middle->setFont( bf ); | 43 | middle->setFont( bf ); |
44 | 44 | ||
45 | DataTable = new OxydataTable( 9,2, this ); | 45 | DataTable = new OxydataTable( 9,2, this ); |
46 | DataTable->setColumnWidth ( 1 , ( parent->width()) ); | 46 | //DataTable->setColumnWidth ( 1 , ( parent->width())-10 ); |
47 | DataTable->setColumnWidth ( 0 , ( parent->width()) ); | ||
48 | setTable(); | 47 | setTable(); |
49 | 48 | ||
50 | qgrid->addWidget( hbox,0,0 ); | 49 | qgrid->addWidget( hbox,0,0 ); |
51 | qgrid->addWidget( DataTable,1,0 ); | 50 | qgrid->addWidget( DataTable,1,0 ); |
52 | } | 51 | } |
53 | 52 | ||
54 | void OxydataWidget::setElement( int el ) | 53 | void OxydataWidget::setElement( int el ) |
55 | { | 54 | { |
56 | Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); | 55 | Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); |
57 | 56 | ||
58 | configobj.setGroup( QString::number( el+1 )); | 57 | configobj.setGroup( QString::number( el+1 )); |
59 | 58 | ||
60 | left->setText( configobj.readEntry( "Symbol" ) ); | 59 | left->setText( configobj.readEntry( "Symbol" ) ); |
61 | middle->setText( configobj.readEntry( "Name" ) ); | 60 | middle->setText( configobj.readEntry( "Name" ) ); |
62 | right->setText( QString::number( el+1 ) ); | 61 | right->setText( QString::number( el+1 ) ); |
63 | 62 | ||
64 | 63 | ||
65 | DataTable->setText( 0,1,( configobj.readEntry( "Weight" ) )+" u" ); | 64 | DataTable->setText( 0,1,tr( "%1 u" ).arg( configobj.readEntry( "Weight" ) ) ); |
66 | DataTable->setText( 1,1,configobj.readEntry( "Block" ) ); | 65 | DataTable->setText( 1,1,configobj.readEntry( "Block" ) ); |
67 | DataTable->setText( 2,1,configobj.readEntry( "Group" ) ); | 66 | DataTable->setText( 2,1,configobj.readEntry( "Group" ) ); |
68 | DataTable->setText( 3,1,( configobj.readEntry( "EN" ) )+" J" ); | 67 | DataTable->setText( 3,1,tr( "%1 J").arg( configobj.readEntry( "EN" ) ) ); |
69 | DataTable->setText( 4,1,configobj.readEntry( "AR" )+" nm" ) ; | 68 | DataTable->setText( 4,1,tr( "%1 nm" ).arg( configobj.readEntry( "AR" ) ) ) ; |
70 | DataTable->setText( 5,1,configobj.readEntry( "IE" )+" J" ); | 69 | DataTable->setText( 5,1,tr( "%1 J" ).arg( configobj.readEntry( "IE" ) ) ); |
71 | DataTable->setText( 6,1,configobj.readEntry( "Density" ) ); | 70 | DataTable->setText( 6,1,configobj.readEntry( "Density" ) ); |
72 | DataTable->setText( 7,1,configobj.readEntry( "BP" )+" K" ); | 71 | DataTable->setText( 7,1,tr( "%1 K" ).arg( configobj.readEntry( "BP" ) ) ); |
73 | DataTable->setText( 8,1,configobj.readEntry( "MP" )+" K" ); | 72 | DataTable->setText( 8,1,tr( "%1 K" ).arg( configobj.readEntry( "MP" ) ) ); |
74 | } | 73 | } |
75 | 74 | ||
76 | void OxydataWidget::setTable() const | 75 | void OxydataWidget::setTable() const |
77 | { | 76 | { |
78 | DataTable->setText( 0,0, tr( "Weight:" ) ); | 77 | DataTable->setText( 0,0, tr( "Weight:" ) ); |
79 | DataTable->setText( 1,0, tr( "Block" )) ; | 78 | DataTable->setText( 1,0, tr( "Block" )) ; |
80 | DataTable->setText( 2,0, tr( "Group" )) ; | 79 | DataTable->setText( 2,0, tr( "Group" )) ; |
81 | DataTable->setText( 3,0, tr( "Electronegativity" )) ; | 80 | DataTable->setText( 3,0, tr( "Electronegativity" )) ; |
82 | DataTable->setText( 4,0, tr( "Atomic radius" )) ; | 81 | DataTable->setText( 4,0, tr( "Atomic radius" )) ; |
83 | DataTable->setText( 5,0, tr( "Ionizationenergie" )) ; | 82 | DataTable->setText( 5,0, tr( "Ionizationenergie" )) ; |
84 | DataTable->setText( 6,0, tr( "Density" )) ; | 83 | DataTable->setText( 6,0, tr( "Density" )) ; |
85 | DataTable->setText( 7,0, tr( "Boilingpoint" ) ); | 84 | DataTable->setText( 7,0, tr( "Boilingpoint" ) ); |
86 | DataTable->setText( 8,0, tr( "Meltingpoint" ) ); | 85 | DataTable->setText( 8,0, tr( "Meltingpoint" ) ); |
87 | 86 | ||
88 | } | 87 | } |
89 | 88 | ||
90 | OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent, | 89 | OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent, |
91 | const char *name) : QTable(numRows, numCols,parent, name) | 90 | const char *name) : QTable(numRows, numCols,parent, name) |
92 | { | 91 | { |
93 | 92 | ||
94 | for (int zeile = 0; zeile < numRows; zeile++) | 93 | for (int zeile = 0; zeile < numRows; zeile++) |
95 | for ( int spalte = 0; spalte < numCols; spalte++ ) | 94 | for ( int spalte = 0; spalte < numCols; spalte++ ) |
96 | { | 95 | { |
97 | OxydataQTI *testus = new OxydataQTI (this, OxydataQTI::Never, "hm" ); | 96 | OxydataQTI *testus = new OxydataQTI (this, OxydataQTI::Never, "hm" ); |
98 | setItem(zeile, spalte, (QTableItem*)testus); | 97 | setItem(zeile, spalte, (QTableItem*)testus); |
99 | } | 98 | } |
100 | 99 | ||
101 | 100 | ||
102 | this->setShowGrid( false ); | 101 | this->setShowGrid( false ); |
103 | this->setHScrollBarMode(QScrollView::AlwaysOff); | 102 | this->setHScrollBarMode(QScrollView::AlwaysOff); |
104 | this->horizontalHeader()->hide(); | 103 | this->horizontalHeader()->hide(); |
105 | this->verticalHeader()->hide(); | 104 | this->verticalHeader()->hide(); |
106 | this->setTopMargin( 0 ); | 105 | this->setTopMargin( 0 ); |
107 | this->setLeftMargin( 0 ); | 106 | this->setLeftMargin( 0 ); |
108 | } | 107 | } |
109 | 108 | ||
110 | void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected) | 109 | void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected) |
111 | { | 110 | { |
112 | if ( cr.width() == 0 || cr.height() == 0 ) | 111 | if ( cr.width() == 0 || cr.height() == 0 ) |
113 | return; | 112 | return; |
114 | selected = FALSE; | 113 | selected = FALSE; |
115 | 114 | ||
116 | QTableItem *itm = item( row, col ); | 115 | QTableItem *itm = item( row, col ); |
117 | QColorGroup colgrp = colorGroup(); | 116 | QColorGroup colgrp = colorGroup(); |
118 | if ( itm ) | 117 | if ( itm ) |
119 | { | 118 | { |
120 | if ( row%2 ) | 119 | if ( row%2 ) |
121 | colgrp.setColor( QColorGroup::Base, QColor( 180,200,210 ) ); | 120 | colgrp.setColor( QColorGroup::Base, QColor( 180,200,210 ) ); |
122 | else | 121 | else |
123 | colgrp.setColor( QColorGroup::Base, QColor( 230,235,235 ) ); | 122 | colgrp.setColor( QColorGroup::Base, QColor( 230,235,235 ) ); |
124 | p->save(); | 123 | p->save(); |
125 | itm->paint( p, colgrp, cr, selected ); | 124 | itm->paint( p, colgrp, cr, selected ); |
126 | p->restore(); | 125 | p->restore(); |
127 | } | 126 | } |
128 | } | 127 | } |
129 | 128 | ||
130 | OxydataQTI::OxydataQTI(QTable * table, EditType et, const QString & text ) | 129 | OxydataQTI::OxydataQTI(QTable * table, EditType et, const QString & text ) |
131 | : QTableItem ( table, et, text ) | 130 | : QTableItem ( table, et, text ) |
132 | { | 131 | { |
133 | } | 132 | } |
134 | 133 | ||
135 | int OxydataQTI::alignment() const | 134 | int OxydataQTI::alignment() const |
136 | { | 135 | { |
137 | if ( col()%2 ) | 136 | if ( col()%2 ) |
138 | { | 137 | { |
139 | return AlignRight | AlignVCenter; | 138 | return AlignRight | AlignVCenter; |
140 | }else return AlignLeft | AlignVCenter; | 139 | }else return AlignLeft | AlignVCenter; |
141 | }; | 140 | }; |
142 | 141 | ||
diff --git a/noncore/apps/oxygen/datawidgetui.cpp b/noncore/apps/oxygen/datawidgetui.cpp index 44cc43d..c7afa32 100644 --- a/noncore/apps/oxygen/datawidgetui.cpp +++ b/noncore/apps/oxygen/datawidgetui.cpp | |||
@@ -1,52 +1,52 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : Oxygen | 2 | application: : Oxygen |
3 | 3 | ||
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 "datawidgetui.h" | 18 | #include "datawidgetui.h" |
19 | #include "dataTable.h" | 19 | #include "dataTable.h" |
20 | 20 | ||
21 | #include <qpe/config.h> | 21 | #include <qpe/config.h> |
22 | #include <qstring.h> | 22 | #include <qstring.h> |
23 | #include <qcombobox.h> | 23 | #include <qcombobox.h> |
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qhbox.h> | 25 | #include <qhbox.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | 28 | ||
29 | dataWidgetUI::dataWidgetUI() : QWidget() | 29 | dataWidgetUI::dataWidgetUI() : QWidget() |
30 | { | 30 | { |
31 | this->setCaption( tr( "Chemical Data" )); | 31 | this->setCaption( tr( "Chemical Data" )); |
32 | QGridLayout *qgrid = new QGridLayout( this, 2,1 ); | 32 | QGridLayout *qgrid = new QGridLayout( this, 2,1 ); |
33 | 33 | ||
34 | dataCombo = new QComboBox( this ); | 34 | dataCombo = new QComboBox( this ); |
35 | 35 | ||
36 | //read in all names of the 118 elements | 36 | //read in all names of the 118 elements |
37 | Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); | 37 | Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); |
38 | for ( int i = 1 ; i < 119 ; i++ ) | 38 | for ( int i = 1 ; i < 119 ; i++ ) |
39 | { | 39 | { |
40 | configobj.setGroup( QString::number( i ) ); | 40 | configobj.setGroup( QString::number( i ) ); |
41 | QString foo = configobj.readEntry( "Name" ); | 41 | QString foo = configobj.readEntry( "Name" ); |
42 | dataCombo->insertItem( foo ); | 42 | dataCombo->insertItem( QString::number( i )+" - "+foo ); |
43 | } | 43 | } |
44 | 44 | ||
45 | OxydataWidget *oxyDW = new OxydataWidget(this); | 45 | OxydataWidget *oxyDW = new OxydataWidget(this); |
46 | connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) ); | 46 | connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) ); |
47 | oxyDW->setElement( 0 ); | 47 | oxyDW->setElement( 0 ); |
48 | 48 | ||
49 | qgrid->addWidget( dataCombo, 0,0); | 49 | qgrid->addWidget( dataCombo, 0,0); |
50 | qgrid->addWidget( oxyDW , 1,0 ); | 50 | qgrid->addWidget( oxyDW , 1,0 ); |
51 | } | 51 | } |
52 | 52 | ||
diff --git a/noncore/apps/oxygen/oxygen.cpp b/noncore/apps/oxygen/oxygen.cpp index bc99d89..a16bc77 100644 --- a/noncore/apps/oxygen/oxygen.cpp +++ b/noncore/apps/oxygen/oxygen.cpp | |||
@@ -1,42 +1,39 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | application: : Oxygen | 2 | application: : Oxygen |
3 | 3 | ||
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 | #include "oxygen.h" | 17 | #include "oxygen.h" |
18 | 18 | ||
19 | #include <qlabel.h> | ||
20 | #include <qapplication.h> | 19 | #include <qapplication.h> |
21 | #include <qpushbutton.h> | ||
22 | #include <qvbox.h> | ||
23 | #include <qtabwidget.h> | 20 | #include <qtabwidget.h> |
24 | #include "calcdlg.h" | 21 | #include "calcdlg.h" |
25 | #include "calcdlgui.h" | 22 | #include "calcdlgui.h" |
26 | #include "datawidgetui.h" | 23 | #include "datawidgetui.h" |
27 | #include "psewidget.h" | 24 | #include "psewidget.h" |
28 | 25 | ||
29 | Oxygen::Oxygen() : QMainWindow() | 26 | Oxygen::Oxygen() : QMainWindow() |
30 | { | 27 | { |
31 | PSEWidget *pse = new PSEWidget(); | 28 | PSEWidget *pse = new PSEWidget(); |
32 | calcDlgUI *CalcDlgUI = new calcDlgUI(); | 29 | calcDlgUI *CalcDlgUI = new calcDlgUI(); |
33 | dataWidgetUI *DataWidgetUI = new dataWidgetUI(); | 30 | dataWidgetUI *DataWidgetUI = new dataWidgetUI(); |
34 | 31 | ||
35 | this->setCaption( tr( "Oxygen" ) ); | 32 | this->setCaption( tr( "Oxygen" ) ); |
36 | 33 | ||
37 | QTabWidget *tabw = new QTabWidget( this , "qtab" ); | 34 | QTabWidget *tabw = new QTabWidget( this , "qtab" ); |
38 | tabw->addTab( pse, tr( "PSE" )); | 35 | tabw->addTab( pse, tr( "PSE" )); |
39 | tabw->addTab( DataWidgetUI , tr( "Data" ) ); | 36 | tabw->addTab( DataWidgetUI , tr( "Data" ) ); |
40 | tabw->addTab( CalcDlgUI, tr( "Calculations" ) ); | 37 | tabw->addTab( CalcDlgUI, tr( "Calculations" ) ); |
41 | setCentralWidget( tabw ); | 38 | setCentralWidget( tabw ); |
42 | } | 39 | } |