Freeciv-3.2
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/**********************************************************************/
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/**********************************************************************/
53void 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/**********************************************************************/
66void 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/**********************************************************************/
81{
82 done(0);
83}
QTextEdit * area
void clear(const char *title)
requirers_dlg(ruledit_gui *ui_in)
ruledit_gui * ui
void add(const char *msg)
char * incite_cost
Definition comments.c:75
#define R__(String)
Definition fcintl.h:75
const char * title
Definition repodlgs.c:1314
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:974