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

Freeciv-3.1

Loading...
Searching...
No Matches
requirers_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// Qt
19#include <QGridLayout>
20#include <QPushButton>
21
22// utility
23#include "fcintl.h"
24
25#include "requirers_dlg.h"
26
27/**********************************************************************/
30requirers_dlg::requirers_dlg(ruledit_gui *ui_in) : QDialog()
31{
32 QGridLayout *main_layout = new QGridLayout(this);
33 QPushButton *close_button;
34 int row = 0;
35
36 ui = ui_in;
37
38 area = new QTextEdit();
39 area->setParent(this);
40 area->setReadOnly(true);
41 main_layout->addWidget(area, row++, 0);
42
43 close_button = new QPushButton(QString::fromUtf8(R__("Close")), this);
44 connect(close_button, SIGNAL(pressed()), this, SLOT(close_now()));
45 main_layout->addWidget(close_button, row++, 0);
46
47 setLayout(main_layout);
48}
49
50/**********************************************************************/
53 void requirers_dlg::clear(const char *title)
54{
55 char buffer[256];
56
57 fc_snprintf(buffer, sizeof(buffer), R__("Removing %s"), title);
58
59 setWindowTitle(QString::fromUtf8(buffer));
60 area->clear();
61}
62
63/**********************************************************************/
66 void requirers_dlg::add(const char *msg)
67{
68 char buffer[2048];
69
70 /* TRANS: %s could be any of a number of ruleset items (e.g., tech,
71 * unit type, ... */
72 fc_snprintf(buffer, sizeof(buffer), R__("Needed by %s"), msg);
73
74 area->append(QString::fromUtf8(buffer));
75}
76
77/**********************************************************************/
80 void requirers_dlg::close_now()
81{
82 done(0);
83}
requirers_dlg::close_now
void close_now()
Definition requirers_dlg.cpp:80
requirers_dlg::area
QTextEdit * area
Definition requirers_dlg.h:39
requirers_dlg::clear
void clear(const char *title)
Definition requirers_dlg.cpp:53
requirers_dlg::requirers_dlg
requirers_dlg(ruledit_gui *ui_in)
Definition requirers_dlg.cpp:30
requirers_dlg::ui
ruledit_gui * ui
Definition requirers_dlg.h:37
requirers_dlg::add
void add(const char *msg)
Definition requirers_dlg.cpp:66
ruledit_gui
Definition ruledit_qt.h:96
fcintl.h
R__
#define R__(String)
Definition fcintl.h:75
title
const char * title
Definition repodlgs.c:1313
requirers_dlg.h
fc_snprintf
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:969