comparison examples/dialogs/standarddialogs/dialog.d @ 215:8aaa84d48451

Improve examples.
author SokoL_SD
date Tue, 14 Jul 2009 15:25:45 +0000
parents 7ea67ec3cf29
children 256ab6cb8e85
comparison
equal deleted inserted replaced
214:11f1760d1700 215:8aaa84d48451
53 import qt.gui.QColorDialog; 53 import qt.gui.QColorDialog;
54 import qt.gui.QFontDialog; 54 import qt.gui.QFontDialog;
55 import qt.gui.QFileDialog; 55 import qt.gui.QFileDialog;
56 import qt.core.QFile; 56 import qt.core.QFile;
57 57
58 version(Tango) 58 import std.string;
59 import tango.text.convert.Format;
60 else
61 import std.string;
62 59
63 60
64 string MESSAGE = tr("<p>Message boxes have a caption, a text, " 61 string MESSAGE = tr("<p>Message boxes have a caption, a text, "
65 "and any number of buttons, each with standard or custom texts." 62 "and any number of buttons, each with standard or custom texts."
66 "<p>Click a button to close the message box. Pressing the Esc button " 63 "<p>Click a button to close the message box. Pressing the Esc button "
210 void setInteger() 207 void setInteger()
211 { 208 {
212 bool ok; 209 bool ok;
213 int i = QInputDialog.getInt(this, tr("QInputgetInteger()"), tr("Percentage:"), 25, 0, 100, 1, ok); 210 int i = QInputDialog.getInt(this, tr("QInputgetInteger()"), tr("Percentage:"), 25, 0, 100, 1, ok);
214 if (ok) 211 if (ok)
215 version(Tango) 212 integerLabel.setText(format("%d", i));
216 integerLabel.setText(Format("{}", i));
217 else
218 integerLabel.setText(format("%d", i));
219 } 213 }
220 214
221 void setDouble() 215 void setDouble()
222 { 216 {
223 bool ok; 217 bool ok;
224 double d = QInputDialog.getDouble(this, tr("QInputgetDouble()"), 218 double d = QInputDialog.getDouble(this, tr("QInputgetDouble()"),
225 tr("Amount:"), 37.56, -10000, 10000, 2, ok); 219 tr("Amount:"), 37.56, -10000, 10000, 2, ok);
226 if (ok) 220 if (ok)
227 version(Tango) 221 integerLabel.setText(format("%g", d));
228 doubleLabel.setText(Format("${}", d));
229 else
230 integerLabel.setText(format("%g", d));
231 } 222 }
232 223
233 void setItem() 224 void setItem()
234 { 225 {
235 string[] items = [tr("Spring"), tr("Summer"), tr("Fall"), tr("Winter")]; 226 string[] items = [tr("Spring"), tr("Summer"), tr("Fall"), tr("Winter")];
312 tr("All Files (*);;Text Files (*.txt)"), 303 tr("All Files (*);;Text Files (*.txt)"),
313 selectedFilter, 304 selectedFilter,
314 options); 305 options);
315 if (files.length) { 306 if (files.length) {
316 openFilesPath = files[0]; 307 openFilesPath = files[0];
317 version(Tango) 308 openFileNamesLabel.setText(join(files, "; "));
318 openFileNamesLabel.setText(Format("{}", files));
319 else
320 {
321 openFileNamesLabel.setText(join(files, "; "));
322 }
323 } 309 }
324 } 310 }
325 311
326 void setSaveFileName() 312 void setSaveFileName()
327 { 313 {