changeset 143:d010168e50de

add classwizard and standarddialogs example
author mandel
date Wed, 10 Jun 2009 16:58:49 +0000
parents bd316478744c
children 3e13dc673db8
files examples/dialogs/CMakeLists.txt examples/dialogs/classwizard/CMakeLists.txt examples/dialogs/classwizard/build.bat examples/dialogs/classwizard/build.sh examples/dialogs/classwizard/classwizard.qrc examples/dialogs/classwizard/images/background.png examples/dialogs/classwizard/images/banner.png examples/dialogs/classwizard/images/logo1.png examples/dialogs/classwizard/images/logo2.png examples/dialogs/classwizard/images/logo3.png examples/dialogs/classwizard/images/watermark1.png examples/dialogs/classwizard/images/watermark2.png examples/dialogs/classwizard/main.d examples/dialogs/standarddialogs/CMakeLists.txt examples/dialogs/standarddialogs/build.bat examples/dialogs/standarddialogs/build.sh examples/dialogs/standarddialogs/dialog.d examples/dialogs/standarddialogs/main.d
diffstat 18 files changed, 566 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/examples/dialogs/CMakeLists.txt	Sun Jun 07 19:16:40 2009 +0000
+++ b/examples/dialogs/CMakeLists.txt	Wed Jun 10 16:58:49 2009 +0000
@@ -1,1 +1,2 @@
-add_subdirectory(trivialwizard)
\ No newline at end of file
+add_subdirectory(trivialwizard)
+add_subdirectory(standarddialogs)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/dialogs/classwizard/CMakeLists.txt	Wed Jun 10 16:58:49 2009 +0000
@@ -0,0 +1,1 @@
+build_example(classwizard main.d classwizard.d RESOURCES classwizard.qrc)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/dialogs/classwizard/build.bat	Wed Jun 10 16:58:49 2009 +0000
@@ -0,0 +1,2 @@
+../../../tools/drcc/drcc classwizard.qrc > qrc_classwizard.d
+dmd main.d classwizard.d qrc_classwizard.d libqtdcore.lib libqtdgui.lib -I../../../ -I../../../qt/d1 -ofclasswizard
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/dialogs/classwizard/build.sh	Wed Jun 10 16:58:49 2009 +0000
@@ -0,0 +1,4 @@
+#! /bin/bash
+
+../../../tools/drcc/drcc classwizard.qrc > qrc_classwizard.d
+dmd main.d classwizard.d qrc_classwizard.d -I../../../ -I../../../qt/d1 -L-L../../../lib -L-lqtdgui -L-lqtdcore -L-lQtCore -L-lQtGui -ofclasswizard
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/dialogs/classwizard/classwizard.qrc	Wed Jun 10 16:58:49 2009 +0000
@@ -0,0 +1,11 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+    <file>images/background.png</file>
+    <file>images/banner.png</file>
+    <file>images/logo1.png</file>
+    <file>images/logo2.png</file>
+    <file>images/logo3.png</file>
+    <file>images/watermark1.png</file>
+    <file>images/watermark2.png</file>
+</qresource>
+</RCC>
Binary file examples/dialogs/classwizard/images/background.png has changed
Binary file examples/dialogs/classwizard/images/banner.png has changed
Binary file examples/dialogs/classwizard/images/logo1.png has changed
Binary file examples/dialogs/classwizard/images/logo2.png has changed
Binary file examples/dialogs/classwizard/images/logo3.png has changed
Binary file examples/dialogs/classwizard/images/watermark1.png has changed
Binary file examples/dialogs/classwizard/images/watermark2.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/dialogs/classwizard/main.d	Wed Jun 10 16:58:49 2009 +0000
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+module main;
+
+
+import qt.gui.QApplication;
+import qt.core.QTranslator;
+import qt.core.QLocale;
+import qt.core.QLibraryInfo;
+
+
+import classwizard;
+import qrc_classwizard;
+
+
+int main(string[] args)
+{
+	scope app = new QApplication(args);
+
+	string translatorFileName = "qt_";
+	translatorFileName ~= QLocale.system().name();
+	QTranslator translator = new QTranslator(app);
+	if (translator.load(translatorFileName, QLibraryInfo.location(QLibraryInfo.TranslationsPath)))
+		app.installTranslator(translator);
+
+	scope wizard = new ClassWizard;
+	wizard.show();
+	return app.exec();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/dialogs/standarddialogs/CMakeLists.txt	Wed Jun 10 16:58:49 2009 +0000
@@ -0,0 +1,1 @@
+build_example(standarddialogs main.d dialog.d)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/dialogs/standarddialogs/build.bat	Wed Jun 10 16:58:49 2009 +0000
@@ -0,0 +1,1 @@
+dmd main.d dialog.d libqtdcore.lib libqtdgui.lib -I../../../ -I../../../qt/d1 -ofstandarddialogs
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/dialogs/standarddialogs/build.sh	Wed Jun 10 16:58:49 2009 +0000
@@ -0,0 +1,3 @@
+#! /bin/bash
+
+dmd main.d dialog.d -I../../../ -I../../../qt/d1 -L-L../../../lib -L-lqtdgui -L-lqtdcore -L-lQtCore -L-lQtGui -ofstandarddialogs
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/dialogs/standarddialogs/dialog.d	Wed Jun 10 16:58:49 2009 +0000
@@ -0,0 +1,410 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+module dialog;
+
+
+import qt.gui.QDialog;
+import qt.gui.QCheckBox;
+import qt.gui.QLabel;
+import qt.gui.QMessageBox;
+import qt.gui.QGridLayout;
+import qt.gui.QErrorMessage;
+import qt.gui.QFileDialog;
+import qt.gui.QLineEdit;
+import qt.gui.QInputDialog;
+import qt.gui.QColorDialog;
+import qt.gui.QFontDialog;
+import qt.gui.QFileDialog;
+import qt.core.QFile;
+
+import tango.text.convert.Format;
+
+
+char[] MESSAGE = tr("<p>Message boxes have a caption, a text, "
+               "and any number of buttons, each with standard or custom texts."
+               "<p>Click a button to close the message box. Pressing the Esc button "
+               "will activate the detected escape button (if any).");
+
+
+class Dialog : public QDialog
+{
+public:
+
+	this(QWidget parent = null)
+	{
+		super(parent);
+		errorMessageDialog = new QErrorMessage(this);
+
+		int frameStyle = QFrame.Sunken | QFrame.Panel;
+
+		integerLabel = new QLabel;
+		integerLabel.setFrameStyle(frameStyle);
+		QPushButton integerButton = new QPushButton(tr("QInputget&Int()"));
+
+		doubleLabel = new QLabel;
+		doubleLabel.setFrameStyle(frameStyle);
+		QPushButton doubleButton = new QPushButton(tr("QInputget&Double()"));
+
+		itemLabel = new QLabel;
+		itemLabel.setFrameStyle(frameStyle);
+		QPushButton itemButton = new QPushButton(tr("QInputgetIte&m()"));
+
+		textLabel = new QLabel;
+		textLabel.setFrameStyle(frameStyle);
+		QPushButton textButton = new QPushButton(tr("QInputget&Text()"));
+
+		colorLabel = new QLabel;
+		colorLabel.setFrameStyle(frameStyle);
+		QPushButton colorButton = new QPushButton(tr("QColorget&Color()"));
+
+		fontLabel = new QLabel;
+		fontLabel.setFrameStyle(frameStyle);
+		QPushButton fontButton = new QPushButton(tr("QFontget&Font()"));
+
+		directoryLabel = new QLabel;
+		directoryLabel.setFrameStyle(frameStyle);
+		QPushButton directoryButton = new QPushButton(tr("QFilegetE&xistingDirectory()"));
+
+		openFileNameLabel = new QLabel;
+		openFileNameLabel.setFrameStyle(frameStyle);
+		QPushButton openFileNameButton = new QPushButton(tr("QFileget&OpenFileName()"));
+
+		openFileNamesLabel = new QLabel;
+		openFileNamesLabel.setFrameStyle(frameStyle);
+		QPushButton openFileNamesButton = new QPushButton(tr("QFile&getOpenFileNames()"));
+
+		saveFileNameLabel = new QLabel;
+		saveFileNameLabel.setFrameStyle(frameStyle);
+		QPushButton saveFileNameButton = new QPushButton(tr("QFileget&SaveFileName()"));
+
+		criticalLabel = new QLabel;
+		criticalLabel.setFrameStyle(frameStyle);
+		QPushButton criticalButton = new QPushButton(tr("QMessageBox.critica&l()"));
+
+		informationLabel = new QLabel;
+		informationLabel.setFrameStyle(frameStyle);
+		QPushButton informationButton = new QPushButton(tr("QMessageBox.i&nformation()"));
+
+		questionLabel = new QLabel;
+		questionLabel.setFrameStyle(frameStyle);
+		QPushButton questionButton = new QPushButton(tr("QMessageBox.&question()"));
+
+		warningLabel = new QLabel;
+		warningLabel.setFrameStyle(frameStyle);
+		QPushButton warningButton = new QPushButton(tr("QMessageBox.&warning()"));
+
+		errorLabel = new QLabel;
+		errorLabel.setFrameStyle(frameStyle);
+		QPushButton errorButton = new QPushButton(tr("QErrorMessage.show&M&essage()"));
+
+		integerButton.clicked.connect(&this.setInteger);
+		doubleButton.clicked.connect(&this.setDouble);
+		itemButton.clicked.connect(&this.setItem);
+		textButton.clicked.connect(&this.setText);
+		colorButton.clicked.connect(&this.setColor);
+		fontButton.clicked.connect(&this.setFont);
+		directoryButton.clicked.connect(&this.setExistingDirectory);
+		openFileNameButton.clicked.connect(&this.setOpenFileName);
+		openFileNamesButton.clicked.connect(&this.setOpenFileNames);
+		saveFileNameButton.clicked.connect(&this.setSaveFileName);
+		criticalButton.clicked.connect(&this.criticalMessage);
+		informationButton.clicked.connect(&this.informationMessage);
+		questionButton.clicked.connect(&this.questionMessage);
+		warningButton.clicked.connect(&this.warningMessage);
+		errorButton.clicked.connect(&this.errorMessage);
+
+		native = new QCheckBox(this);
+		native.setText("Use native file dialog.");
+		native.setChecked(true);
+		
+		version(windows) {} else
+		{
+			version(mac) {} else
+			{
+				native.hide();
+			}
+		}
+
+		QGridLayout layout = new QGridLayout;
+		layout.setColumnStretch(1, 1);
+		layout.setColumnMinimumWidth(1, 250);
+		layout.addWidget(integerButton, 0, 0);
+		layout.addWidget(integerLabel, 0, 1);
+		layout.addWidget(doubleButton, 1, 0);
+		layout.addWidget(doubleLabel, 1, 1);
+		layout.addWidget(itemButton, 2, 0);
+		layout.addWidget(itemLabel, 2, 1);
+		layout.addWidget(textButton, 3, 0);
+		layout.addWidget(textLabel, 3, 1);
+		layout.addWidget(colorButton, 4, 0);
+		layout.addWidget(colorLabel, 4, 1);
+		layout.addWidget(fontButton, 5, 0);
+		layout.addWidget(fontLabel, 5, 1);
+		layout.addWidget(directoryButton, 6, 0);
+		layout.addWidget(directoryLabel, 6, 1);
+		layout.addWidget(openFileNameButton, 7, 0);
+		layout.addWidget(openFileNameLabel, 7, 1);
+		layout.addWidget(openFileNamesButton, 8, 0);
+		layout.addWidget(openFileNamesLabel, 8, 1);
+		layout.addWidget(saveFileNameButton, 9, 0);
+		layout.addWidget(saveFileNameLabel, 9, 1);
+		layout.addWidget(criticalButton, 10, 0);
+		layout.addWidget(criticalLabel, 10, 1);
+		layout.addWidget(informationButton, 11, 0);
+		layout.addWidget(informationLabel, 11, 1);
+		layout.addWidget(questionButton, 12, 0);
+		layout.addWidget(questionLabel, 12, 1);
+		layout.addWidget(warningButton, 13, 0);
+		layout.addWidget(warningLabel, 13, 1);
+		layout.addWidget(errorButton, 14, 0);
+		layout.addWidget(errorLabel, 14, 1);
+		layout.addWidget(native, 15, 0);
+		setLayout(layout);
+
+		setWindowTitle(tr("Standard Dialogs"));
+	}
+
+private:
+
+	void setInteger()
+	{
+		bool ok;
+		int i = QInputDialog.getInt(this, tr("QInputgetInteger()"), tr("Percentage:"), 25, 0, 100, 1, ok);
+		if (ok)
+			integerLabel.setText(Format(tr("%"), i));
+	}
+
+	void setDouble()
+	{
+		bool ok;
+		double d = QInputDialog.getDouble(this, tr("QInputgetDouble()"),
+						tr("Amount:"), 37.56, -10000, 10000, 2, ok);
+		if (ok)
+			doubleLabel.setText(Format("${}", d));
+	}
+
+	void setItem()
+	{
+		string[] items =  [tr("Spring"), tr("Summer"), tr("Fall"), tr("Winter")];
+
+		bool ok;
+		string item = QInputDialog.getItem(this, tr("QInputgetItem()"),
+						tr("Season:"), items, 0, false, ok);
+		if (ok && item.length)
+			itemLabel.setText(item);
+	}
+
+	void setText()
+	{
+		bool ok;
+		string text = QInputDialog.getText(this, tr("QInputgetText()"),
+						tr("User name:"), QLineEdit_EchoMode.Normal,
+		QDir.home().dirName(), ok);
+		if (ok && text.length)
+			textLabel.setText(text);
+	}
+
+	void setColor()
+	{
+		QColor color = QColorDialog.getColor(QColor.Green, this);
+		if (color.isValid()) {
+			colorLabel.setText(color.name());
+			colorLabel.setPalette(new QPalette(color));
+			colorLabel.setAutoFillBackground(true);
+		}
+	}
+
+	void setFont()
+	{
+		bool ok;
+		QFont font = QFontDialog.getFont(&ok, new QFont(fontLabel.text()), this);
+		if (ok) {
+			fontLabel.setText(font.key());
+			fontLabel.setFont(font);
+		}
+	}
+
+	void setExistingDirectory()
+	{
+		int options = QFileDialog_Option.DontResolveSymlinks | QFileDialog_Option.ShowDirsOnly;
+		if (!native.isChecked())
+			options |= QFileDialog_Option.DontUseNativeDialog;
+		string directory = QFileDialog.getExistingDirectory(this,
+						tr("QFilegetExistingDirectory()"),
+						directoryLabel.text(),
+						options);
+		if (directory.length)
+			directoryLabel.setText(directory);
+	}
+
+	void setOpenFileName()
+	{
+		int options;
+		if (!native.isChecked())
+			options |= QFileDialog_Option.DontUseNativeDialog;
+		string selectedFilter;
+		string fileName = QFileDialog.getOpenFileName(this,
+						tr("QFilegetOpenFileName()"),
+						openFileNameLabel.text(),
+						tr("All Files (*);;Text Files (*.txt)"),
+						selectedFilter,
+						options);
+		if (fileName.length)
+			openFileNameLabel.setText(fileName);
+	}
+
+	void setOpenFileNames()
+	{
+		int options;
+		if (!native.isChecked())
+			options |= QFileDialog_Option.DontUseNativeDialog;
+		string selectedFilter;
+		string[] files = QFileDialog.getOpenFileNames(
+						this, tr("QFilegetOpenFileNames()"),
+						openFilesPath,
+						tr("All Files (*);;Text Files (*.txt)"),
+						selectedFilter,
+						options);
+		if (files.length) {
+			openFilesPath = files[0];
+			openFileNamesLabel.setText(Format("{}", files));
+		}
+	}
+
+	void setSaveFileName()
+	{
+		int options;
+		if (!native.isChecked())
+			options |= QFileDialog_Option.DontUseNativeDialog;
+		string selectedFilter;
+		string fileName = QFileDialog.getSaveFileName(this,
+						tr("QFilegetSaveFileName()"),
+						saveFileNameLabel.text(),
+						tr("All Files (*);;Text Files (*.txt)"),
+						selectedFilter,
+						options);
+		if (fileName.length)
+			saveFileNameLabel.setText(fileName);
+	}
+
+	void criticalMessage()
+	{
+		QMessageBox.StandardButton reply;
+		reply = QMessageBox.critical(this, tr("QMessageBox.critical()"),
+						MESSAGE,
+						QMessageBox.Abort | QMessageBox.Retry | QMessageBox.Ignore);
+		if (reply == QMessageBox.Abort)
+			criticalLabel.setText(tr("Abort"));
+		else if (reply == QMessageBox.Retry)
+			criticalLabel.setText(tr("Retry"));
+		else
+			criticalLabel.setText(tr("Ignore"));
+	}
+
+	void informationMessage()
+	{
+		QMessageBox.StandardButton reply;
+		reply = QMessageBox.information(this, tr("QMessageBox.information()"), MESSAGE);
+		if (reply == QMessageBox.Ok)
+			informationLabel.setText(tr("OK"));
+		else
+			informationLabel.setText(tr("Escape"));
+	}
+
+	void questionMessage()
+	{
+		QMessageBox.StandardButton reply;
+		reply = QMessageBox.question(this, tr("QMessageBox.question()"),
+						MESSAGE,
+						QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel);
+		if (reply == QMessageBox.Yes)
+			questionLabel.setText(tr("Yes"));
+		else if (reply == QMessageBox.No)
+			questionLabel.setText(tr("No"));
+		else
+			questionLabel.setText(tr("Cancel"));
+	}
+
+	void warningMessage()
+	{
+		auto msgBox = new QMessageBox(QMessageBox.Warning, tr("QMessageBox.warning()"), MESSAGE, 0, this);
+		msgBox.addButton(tr("Save &Again"), QMessageBox.AcceptRole);
+		msgBox.addButton(tr("&Continue"), QMessageBox.RejectRole);
+		if (msgBox.exec() == QMessageBox.AcceptRole)
+			warningLabel.setText(tr("Save Again"));
+		else
+			warningLabel.setText(tr("Continue"));
+	}
+
+	void errorMessage()
+	{
+		errorMessageDialog.showMessage(
+				tr("This dialog shows and remembers error messages. "
+				"If the checkbox is checked (as it is by default), "
+				"the shown message will be shown again, "
+				"but if the user unchecks the box the message "
+				"will not appear again if QErrorMessage.showMessage() "
+				"is called with the same message."));
+		errorLabel.setText(tr("If the box is unchecked, the message won't appear again."));
+	}
+
+private:
+
+	QCheckBox native;
+	QLabel integerLabel;
+	QLabel doubleLabel;
+	QLabel itemLabel;
+	QLabel textLabel;
+	QLabel colorLabel;
+	QLabel fontLabel;
+	QLabel directoryLabel;
+	QLabel openFileNameLabel;
+	QLabel openFileNamesLabel;
+	QLabel saveFileNameLabel;
+	QLabel criticalLabel;
+	QLabel informationLabel;
+	QLabel questionLabel;
+	QLabel warningLabel;
+	QLabel errorLabel;
+	QErrorMessage errorMessageDialog;
+
+	char[] openFilesPath;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/dialogs/standarddialogs/main.d	Wed Jun 10 16:58:49 2009 +0000
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+module main;
+
+
+import qt.core.QTranslator;
+import qt.core.QLocale;
+import qt.core.QLibraryInfo;
+import qt.gui.QApplication;
+
+import dialog;
+
+
+int main(string[] args)
+{
+	scope app = new QApplication(args);
+
+	string translatorFileName = "qt_";
+	translatorFileName ~= QLocale.system().name();
+	QTranslator translator = new QTranslator(app);
+	if (translator.load(translatorFileName, QLibraryInfo.location(QLibraryInfo.TranslationsPath)))
+		app.installTranslator(translator);
+
+	auto dialog = new Dialog;
+	return dialog.exec();
+}