Freeciv-3.1: /fast/freeciv/nightly/S3_1/tools/ruledit/values_dlg.cpp Source File

Freeciv-3.1

Loading...
Searching...
No Matches
values_dlg.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// utility
19#include "string_vector.h"
20
21// ruledit
22#include "helpeditor.h"
23
24#include "values_dlg.h"
25
26
27/**********************************************************************/
30values_dlg::values_dlg() : QDialog()
31{
32 help = nullptr;
33}
34
35/**********************************************************************/
38 void values_dlg::open_help(struct strvec **helptext)
39{
40 if (help == nullptr) {
41 // Create the strvec if it does not exist
42 if (*helptext == nullptr) {
43 *helptext = strvec_new();
44 }
45
46 // Make sure there's at least one element to edit
47 if (strvec_size(*helptext) == 0) {
48 strvec_append(*helptext, "");
49 }
50
51 help = new helpeditor(this, *helptext);
52
53 help->show();
54 }
55}
56
57/**********************************************************************/
60 void values_dlg::close_help()
61{
62 if (help != nullptr) {
63 help->close();
64
65 help = nullptr;
66 }
67}
helpeditor
Definition helpeditor.h:29
helpeditor::close
void close()
Definition helpeditor.cpp:64
values_dlg::close_help
void close_help()
Definition values_dlg.cpp:60
values_dlg::help
helpeditor * help
Definition values_dlg.h:37
values_dlg::values_dlg
values_dlg()
Definition values_dlg.cpp:30
values_dlg::open_help
void open_help(struct strvec **help)
Definition values_dlg.cpp:38
helpeditor.h
strvec_append
void strvec_append(struct strvec *psv, const char *string)
Definition string_vector.c:278
strvec_new
struct strvec * strvec_new(void)
Definition string_vector.c:58
strvec_size
size_t strvec_size(const struct strvec *psv)
Definition string_vector.c:343
string_vector.h
strvec
Definition string_vector.c:29
values_dlg.h