Freeciv-3.2: /fast/freeciv/nightly/S3_2/tools/ruledit/helpeditor.cpp Source File

Freeciv-3.2

Loading...
Searching...
No Matches
helpeditor.cpp
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18// Qt
19#include <QGridLayout>
20#include <QPushButton>
21
22// utility
23#include "fcintl.h"
24#include "string_vector.h"
25
26// ruledit
27#include "values_dlg.h"
28
29#include "helpeditor.h"
30
31/**********************************************************************/
34helpeditor::helpeditor(values_dlg *parent_dlg, struct strvec *helptext_in) : QDialog()
35{
36 QGridLayout *main_layout = new QGridLayout(this);
37 QPushButton *close_button;
38 int row = 0;
39
40 pdlg = parent_dlg;
41 helptext = helptext_in;
42
43 area = new QTextEdit();
44 area->setParent(this);
45 area->setReadOnly(true);
46 main_layout->addWidget(area, row++, 0);
47
48 strvec_iterate(helptext, text) {
49 area->append(QString::fromUtf8(text));
50 area->append("\n\n");
51 } strvec_iterate_end;
52
53 close_button = new QPushButton(QString::fromUtf8(R__("Close")), this);
54 connect(close_button, SIGNAL(pressed()), this, SLOT(close_now()));
55 main_layout->addWidget(close_button, row++, 0);
56
57 setLayout(main_layout);
58}
59
60/**********************************************************************/
63 void helpeditor::close()
64{
65 done(0);
66}
67
68/**********************************************************************/
71 void helpeditor::close_now()
72{
73 // Both closes this dialog, and handles parent's own bookkeeping
74 pdlg->close_help();
75}
helpeditor::close_now
void close_now()
Definition helpeditor.cpp:71
helpeditor::close
void close()
Definition helpeditor.cpp:63
helpeditor::helptext
struct strvec * helptext
Definition helpeditor.h:37
helpeditor::area
QTextEdit * area
Definition helpeditor.h:40
helpeditor::helpeditor
helpeditor(values_dlg *parent_dlg, struct strvec *helptext_in)
Definition helpeditor.cpp:34
helpeditor::pdlg
values_dlg * pdlg
Definition helpeditor.h:38
values_dlg
Definition values_dlg.h:28
values_dlg::close_help
void close_help()
Definition values_dlg.cpp:47
incite_cost
char * incite_cost
Definition comments.c:74
fcintl.h
R__
#define R__(String)
Definition fcintl.h:75
helpeditor.h
string_vector.h
strvec_iterate
#define strvec_iterate(psv, str)
Definition string_vector.h:61
strvec_iterate_end
#define strvec_iterate_end
Definition string_vector.h:68
strvec
Definition string_vector.c:29
values_dlg.h