summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/oxygen/calcdlg.ui203
-rw-r--r--noncore/apps/oxygen/calcdlgui.cpp2
-rw-r--r--noncore/apps/oxygen/kmolcalc.cpp40
-rw-r--r--noncore/apps/oxygen/kmolcalc.h5
4 files changed, 99 insertions, 151 deletions
diff --git a/noncore/apps/oxygen/calcdlg.ui b/noncore/apps/oxygen/calcdlg.ui
index e0b19f9..5b0c53e 100644
--- a/noncore/apps/oxygen/calcdlg.ui
+++ b/noncore/apps/oxygen/calcdlg.ui
@@ -13,4 +13,4 @@
13 <y>0</y> 13 <y>0</y>
14 <width>218</width> 14 <width>275</width>
15 <height>274</height> 15 <height>357</height>
16 </rect> 16 </rect>
@@ -36,6 +36,6 @@
36 <rect> 36 <rect>
37 <x>10</x> 37 <x>0</x>
38 <y>0</y> 38 <y>0</y>
39 <width>200</width> 39 <width>270</width>
40 <height>260</height> 40 <height>350</height>
41 </rect> 41 </rect>
@@ -67,6 +67,6 @@
67 <rect> 67 <rect>
68 <x>2</x> 68 <x>0</x>
69 <y>2</y> 69 <y>0</y>
70 <width>180</width> 70 <width>260</width>
71 <height>220</height> 71 <height>320</height>
72 </rect> 72 </rect>
@@ -82,22 +82,2 @@
82 <widget> 82 <widget>
83 <class>QLabel</class>
84 <property stdset="1">
85 <name>name</name>
86 <cstring>TextLabel1_4</cstring>
87 </property>
88 <property stdset="1">
89 <name>geometry</name>
90 <rect>
91 <x>1</x>
92 <y>1</y>
93 <width>298</width>
94 <height>16</height>
95 </rect>
96 </property>
97 <property stdset="1">
98 <name>text</name>
99 <string>Formula:</string>
100 </property>
101 </widget>
102 <widget>
103 <class>QLayoutWidget</class> 83 <class>QLayoutWidget</class>
@@ -111,8 +91,8 @@
111 <x>0</x> 91 <x>0</x>
112 <y>50</y> 92 <y>0</y>
113 <width>175</width> 93 <width>260</width>
114 <height>30</height> 94 <height>320</height>
115 </rect> 95 </rect>
116 </property> 96 </property>
117 <hbox> 97 <vbox>
118 <property stdset="1"> 98 <property stdset="1">
@@ -126,6 +106,6 @@
126 <widget> 106 <widget>
127 <class>QPushButton</class> 107 <class>QLabel</class>
128 <property stdset="1"> 108 <property stdset="1">
129 <name>name</name> 109 <name>name</name>
130 <cstring>calculate</cstring> 110 <cstring>TextLabel1_4</cstring>
131 </property> 111 </property>
@@ -133,10 +113,56 @@
133 <name>text</name> 113 <name>text</name>
134 <string>Calculate</string> 114 <string>Formula:</string>
115 </property>
116 </widget>
117 <widget>
118 <class>QLineEdit</class>
119 <property stdset="1">
120 <name>name</name>
121 <cstring>formula</cstring>
122 </property>
123 </widget>
124 <widget>
125 <class>QLayoutWidget</class>
126 <property stdset="1">
127 <name>name</name>
128 <cstring>Layout7</cstring>
135 </property> 129 </property>
130 <hbox>
131 <property stdset="1">
132 <name>margin</name>
133 <number>0</number>
134 </property>
135 <property stdset="1">
136 <name>spacing</name>
137 <number>6</number>
138 </property>
139 <widget>
140 <class>QPushButton</class>
141 <property stdset="1">
142 <name>name</name>
143 <cstring>calculate</cstring>
144 </property>
145 <property stdset="1">
146 <name>text</name>
147 <string>Calculate</string>
148 </property>
149 </widget>
150 <widget>
151 <class>QPushButton</class>
152 <property stdset="1">
153 <name>name</name>
154 <cstring>clear_fields</cstring>
155 </property>
156 <property stdset="1">
157 <name>text</name>
158 <string>Clear</string>
159 </property>
160 </widget>
161 </hbox>
136 </widget> 162 </widget>
137 <widget> 163 <widget>
138 <class>QPushButton</class> 164 <class>QLabel</class>
139 <property stdset="1"> 165 <property stdset="1">
140 <name>name</name> 166 <name>name</name>
141 <cstring>clear_fields</cstring> 167 <cstring>TextLabel2_4</cstring>
142 </property> 168 </property>
@@ -144,74 +170,35 @@
144 <name>text</name> 170 <name>text</name>
145 <string>Clear</string> 171 <string>Result:</string>
146 </property> 172 </property>
147 </widget> 173 </widget>
148 </hbox> 174 <widget>
149 </widget> 175 <class>QLineEdit</class>
150 <widget> 176 <property stdset="1">
151 <class>QLineEdit</class> 177 <name>name</name>
152 <property stdset="1"> 178 <cstring>result</cstring>
153 <name>name</name> 179 </property>
154 <cstring>formula</cstring> 180 </widget>
155 </property> 181 <widget>
156 <property stdset="1"> 182 <class>QLabel</class>
157 <name>geometry</name> 183 <property stdset="1">
158 <rect> 184 <name>name</name>
159 <x>0</x> 185 <cstring>TextLabel1</cstring>
160 <y>20</y> 186 </property>
161 <width>170</width> 187 <property stdset="1">
162 <height>22</height> 188 <name>text</name>
163 </rect> 189 <string>Elemental composition (%):</string>
164 </property> 190 </property>
165 </widget> 191 </widget>
166 <widget> 192 <widget>
167 <class>QMultiLineEdit</class> 193 <class>QMultiLineEdit</class>
168 <property stdset="1"> 194 <property stdset="1">
169 <name>name</name> 195 <name>name</name>
170 <cstring>anal_display</cstring> 196 <cstring>anal_display</cstring>
171 </property> 197 </property>
172 <property stdset="1"> 198 <property stdset="1">
173 <name>geometry</name> 199 <name>readOnly</name>
174 <rect> 200 <bool>true</bool>
175 <x>0</x> 201 </property>
176 <y>130</y> 202 </widget>
177 <width>170</width> 203 </vbox>
178 <height>80</height>
179 </rect>
180 </property>
181 </widget>
182 <widget>
183 <class>QLineEdit</class>
184 <property stdset="1">
185 <name>name</name>
186 <cstring>result</cstring>
187 </property>
188 <property stdset="1">
189 <name>geometry</name>
190 <rect>
191 <x>0</x>
192 <y>100</y>
193 <width>170</width>
194 <height>22</height>
195 </rect>
196 </property>
197 </widget>
198 <widget>
199 <class>QLabel</class>
200 <property stdset="1">
201 <name>name</name>
202 <cstring>TextLabel2_4</cstring>
203 </property>
204 <property stdset="1">
205 <name>geometry</name>
206 <rect>
207 <x>1</x>
208 <y>86</y>
209 <width>298</width>
210 <height>16</height>
211 </rect>
212 </property>
213 <property stdset="1">
214 <name>text</name>
215 <string>Result:</string>
216 </property>
217 </widget> 204 </widget>
diff --git a/noncore/apps/oxygen/calcdlgui.cpp b/noncore/apps/oxygen/calcdlgui.cpp
index e9b40d3..e40e2c7 100644
--- a/noncore/apps/oxygen/calcdlgui.cpp
+++ b/noncore/apps/oxygen/calcdlgui.cpp
@@ -18,2 +18,3 @@ calcDlgUI::calcDlgUI() : CalcDlg()
18{ 18{
19 this->showMaximized();
19 kmolcalc = new KMolCalc; 20 kmolcalc = new KMolCalc;
@@ -21,2 +22,3 @@ calcDlgUI::calcDlgUI() : CalcDlg()
21 connect( clear_fields, SIGNAL( clicked() ), this, SLOT( clear() ) ); 22 connect( clear_fields, SIGNAL( clicked() ), this, SLOT( clear() ) );
23 result->setReadOnly( true );
22} 24}
diff --git a/noncore/apps/oxygen/kmolcalc.cpp b/noncore/apps/oxygen/kmolcalc.cpp
index 7257c4a..0ba52da 100644
--- a/noncore/apps/oxygen/kmolcalc.cpp
+++ b/noncore/apps/oxygen/kmolcalc.cpp
@@ -3,3 +3,3 @@
3 * 3 *
4 * Copyright (C) 2000 Tomislav Gountchev <tomi@idiom.com> 4 * Copyright (C) 2000,2001 Tomislav Gountchev <tomi@idiom.com>
5 * Copyright (C) 2002 Carsten Niehaus <cniehaus@handhelds.org> 5 * Copyright (C) 2002 Carsten Niehaus <cniehaus@handhelds.org>
@@ -38,24 +38,5 @@ void KMolCalc::readElstable() {
38 elstable->setAutoDelete(TRUE); 38 elstable->setAutoDelete(TRUE);
39 QStringList files = "/home/opie/opie/noncore/apps/oxigen/kmolweights"; 39 mwfile = "/home/opie/opie/noncore/apps/oxygen/kmolweights";
40 mwfile = "/home/opie/opie/noncore/apps/oxigen/kmolweights";
41 QFile f(mwfile); 40 QFile f(mwfile);
42 QString* latest_f = &mwfile;
43 for (uint i=0; i<files.count(); i++) {
44 if (QFileInfo(QFile(files[i])).lastModified() > QFileInfo(QFile(*latest_f)).lastModified()) {
45 latest_f = &files[i];
46 }
47 }
48 QFile lf(*latest_f);
49 if (f.exists()) readMwfile(f); 41 if (f.exists()) readMwfile(f);
50 if (!f.exists()) {
51 readMwfile(lf);
52 writeElstable();
53 } else if (QFileInfo(f).lastModified() < QFileInfo(lf).lastModified()) {
54 // announce
55 QMessageBox::information
56 (0, "Warning:", "Found new global Mw file.\nLocal definitions will be updated.", QMessageBox::Ok);
57 readMwfile(lf);
58 writeElstable();
59 }
60
61} 42}
@@ -190,19 +171,2 @@ void KMolCalc::readMwfile(QFile& f) {
190/** 171/**
191 * Save the element definitions file.
192 */
193void KMolCalc::writeElstable() {
194 QFile f(mwfile);
195 if (! f.open(IO_WriteOnly)) return; //ERROR
196 QTextStream fs (&f);
197 QString line;
198 QDictIterator<SubUnit> it(*elstable);
199 while (it.current()) {
200 it.current()->writeOut(line);
201 fs << line << endl;
202 ++it;
203 }
204 f.close();
205}
206
207/**
208 * Remove a group or element definition from ELSTABLE. 172 * Remove a group or element definition from ELSTABLE.
diff --git a/noncore/apps/oxygen/kmolcalc.h b/noncore/apps/oxygen/kmolcalc.h
index c3e02f3..c589133 100644
--- a/noncore/apps/oxygen/kmolcalc.h
+++ b/noncore/apps/oxygen/kmolcalc.h
@@ -80,7 +80,2 @@ public:
80 /** 80 /**
81 * Save the element definitions file.
82 */
83 void writeElstable();
84
85 /**
86 * Read the element definitions file and construct ELSTABLE. 81 * Read the element definitions file and construct ELSTABLE.