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 "mem.h"
25#include "string_vector.h"
26
27// ruledit
28#include "values_dlg.h"
29
30#include "helpeditor.h"
31
32/**********************************************************************/
36{
37 QGridLayout *main_layout = new QGridLayout(this);
38 QPushButton *close_button;
39 int row = 0;
40 int i;
41
44
46
47 i = 0;
49 helps[i] = new QTextEdit(QString::fromUtf8(text));
50 helps[i]->setParent(this);
51 main_layout->addWidget(helps[i++], row++, 0);
53
54 close_button = new QPushButton(QString::fromUtf8(R__("Close")), this);
55 connect(close_button, SIGNAL(pressed()), this, SLOT(close_now()));
56 main_layout->addWidget(close_button, row++, 0);
57
58 setLayout(main_layout);
59}
60
61/**********************************************************************/
65{
66 int i;
67 int count = strvec_size(helptext);
68
69 for (i = 0; i < count; i++) {
71
72 hbytes = helps[i]->toPlainText().toUtf8();
73 strvec_set(helptext, i, hbytes.data());
74 }
75
76 free(helps);
77
79
80 done(0);
81}
82
83/**********************************************************************/
87{
88 // Both closes this dialog, and handles parent's own bookkeeping
90}
void close_now()
void close()
struct strvec * helptext
Definition helpeditor.h:37
QTextEdit ** helps
Definition helpeditor.h:40
helpeditor(values_dlg *parent_dlg, struct strvec *helptext_in)
values_dlg * pdlg
Definition helpeditor.h:38
void close_help()
char * incite_cost
Definition comments.c:75
#define R__(String)
Definition fcintl.h:75
#define fc_malloc(sz)
Definition mem.h:34
bool strvec_set(struct strvec *psv, size_t svindex, const char *string)
size_t strvec_size(const struct strvec *psv)
void strvec_remove_empty(struct strvec *psv)
#define strvec_iterate(psv, str)
#define strvec_iterate_end