Mercurial > trustbridge
annotate ui/helpdialog.cpp @ 502:e551de11d8b6
Properly handle the case that the file does not exist.
TRUNCATE makes create file fail if the file does not exist
but we need TRUNCATE in the case that the file already exists
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 28 Apr 2014 09:18:07 +0000 |
parents | 17e1c8f37d72 |
children |
rev | line source |
---|---|
404 | 1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU GPL (v>=2) | |
5 * and comes with ABSOLUTELY NO WARRANTY! | |
6 * See LICENSE.txt for details. | |
7 */ | |
190
1a66a15d0df8
Added stub for help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
8 #include "helpdialog.h" |
1a66a15d0df8
Added stub for help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
9 #include <QDebug> |
192
103daf2d39c0
Added some content and a close button to the help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
190
diff
changeset
|
10 #include <QVBoxLayout> |
103daf2d39c0
Added some content and a close button to the help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
190
diff
changeset
|
11 #include <QTextEdit> |
103daf2d39c0
Added some content and a close button to the help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
190
diff
changeset
|
12 #include <QPushButton> |
190
1a66a15d0df8
Added stub for help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
13 |
1a66a15d0df8
Added stub for help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
14 HelpDialog::HelpDialog(QMainWindow *parent) : |
1a66a15d0df8
Added stub for help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
15 QDialog(parent) |
1a66a15d0df8
Added stub for help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
16 { |
1a66a15d0df8
Added stub for help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
17 setupGUI(); |
1a66a15d0df8
Added stub for help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
18 } |
1a66a15d0df8
Added stub for help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
19 |
1a66a15d0df8
Added stub for help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 void HelpDialog::setupGUI() |
1a66a15d0df8
Added stub for help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 { |
192
103daf2d39c0
Added some content and a close button to the help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
190
diff
changeset
|
22 QVBoxLayout *mainLayout = new QVBoxLayout(this); |
103daf2d39c0
Added some content and a close button to the help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
190
diff
changeset
|
23 QTextEdit *helpText = new QTextEdit; |
103daf2d39c0
Added some content and a close button to the help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
190
diff
changeset
|
24 helpText->setReadOnly(true); |
103daf2d39c0
Added some content and a close button to the help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
190
diff
changeset
|
25 helpText->setPlainText(tr("This dialog contains some text to help the user.")); |
103daf2d39c0
Added some content and a close button to the help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
190
diff
changeset
|
26 |
103daf2d39c0
Added some content and a close button to the help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
190
diff
changeset
|
27 QHBoxLayout *buttonLayout = new QHBoxLayout; |
103daf2d39c0
Added some content and a close button to the help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
190
diff
changeset
|
28 QPushButton *closeButton = new QPushButton(tr("Close")); |
103daf2d39c0
Added some content and a close button to the help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
190
diff
changeset
|
29 connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); |
103daf2d39c0
Added some content and a close button to the help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
190
diff
changeset
|
30 buttonLayout->insertStretch(0, 10); |
103daf2d39c0
Added some content and a close button to the help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
190
diff
changeset
|
31 buttonLayout->addWidget(closeButton); |
103daf2d39c0
Added some content and a close button to the help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
190
diff
changeset
|
32 |
103daf2d39c0
Added some content and a close button to the help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
190
diff
changeset
|
33 mainLayout->addWidget(helpText); |
103daf2d39c0
Added some content and a close button to the help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
190
diff
changeset
|
34 mainLayout->addLayout(buttonLayout); |
190
1a66a15d0df8
Added stub for help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 } |