comparison examples/dialogs/standarddialogs/dialog.d @ 211:7ea67ec3cf29

another fixes in examples
author SokoL_SD
date Tue, 14 Jul 2009 12:50:04 +0000
parents 3e13dc673db8
children 8aaa84d48451
comparison
equal deleted inserted replaced
210:3ea0efe4d31e 211:7ea67ec3cf29
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 import tango.text.convert.Format; 58 version(Tango)
59 59 import tango.text.convert.Format;
60 60 else
61 char[] MESSAGE = tr("<p>Message boxes have a caption, a text, " 61 import std.string;
62
63
64 string MESSAGE = tr("<p>Message boxes have a caption, a text, "
62 "and any number of buttons, each with standard or custom texts." 65 "and any number of buttons, each with standard or custom texts."
63 "<p>Click a button to close the message box. Pressing the Esc button " 66 "<p>Click a button to close the message box. Pressing the Esc button "
64 "will activate the detected escape button (if any)."); 67 "will activate the detected escape button (if any).");
65 68
66 69
207 void setInteger() 210 void setInteger()
208 { 211 {
209 bool ok; 212 bool ok;
210 int i = QInputDialog.getInt(this, tr("QInputgetInteger()"), tr("Percentage:"), 25, 0, 100, 1, ok); 213 int i = QInputDialog.getInt(this, tr("QInputgetInteger()"), tr("Percentage:"), 25, 0, 100, 1, ok);
211 if (ok) 214 if (ok)
212 integerLabel.setText(Format("{}", i)); 215 version(Tango)
216 integerLabel.setText(Format("{}", i));
217 else
218 integerLabel.setText(format("%d", i));
213 } 219 }
214 220
215 void setDouble() 221 void setDouble()
216 { 222 {
217 bool ok; 223 bool ok;
218 double d = QInputDialog.getDouble(this, tr("QInputgetDouble()"), 224 double d = QInputDialog.getDouble(this, tr("QInputgetDouble()"),
219 tr("Amount:"), 37.56, -10000, 10000, 2, ok); 225 tr("Amount:"), 37.56, -10000, 10000, 2, ok);
220 if (ok) 226 if (ok)
221 doubleLabel.setText(Format("${}", d)); 227 version(Tango)
228 doubleLabel.setText(Format("${}", d));
229 else
230 integerLabel.setText(format("%g", d));
222 } 231 }
223 232
224 void setItem() 233 void setItem()
225 { 234 {
226 string[] items = [tr("Spring"), tr("Summer"), tr("Fall"), tr("Winter")]; 235 string[] items = [tr("Spring"), tr("Summer"), tr("Fall"), tr("Winter")];
303 tr("All Files (*);;Text Files (*.txt)"), 312 tr("All Files (*);;Text Files (*.txt)"),
304 selectedFilter, 313 selectedFilter,
305 options); 314 options);
306 if (files.length) { 315 if (files.length) {
307 openFilesPath = files[0]; 316 openFilesPath = files[0];
308 openFileNamesLabel.setText(Format("{}", files)); 317 version(Tango)
318 openFileNamesLabel.setText(Format("{}", files));
319 else
320 {
321 openFileNamesLabel.setText(join(files, "; "));
322 }
309 } 323 }
310 } 324 }
311 325
312 void setSaveFileName() 326 void setSaveFileName()
313 { 327 {
404 QLabel questionLabel; 418 QLabel questionLabel;
405 QLabel warningLabel; 419 QLabel warningLabel;
406 QLabel errorLabel; 420 QLabel errorLabel;
407 QErrorMessage errorMessageDialog; 421 QErrorMessage errorMessageDialog;
408 422
409 char[] openFilesPath; 423 string openFilesPath;
410 } 424 }