Freeciv-3.2: /fast/freeciv/nightly/S3_2/tools/ruledit/req_vec_fix.h Source File

Freeciv-3.2

Loading...
Searching...
No Matches
req_vec_fix.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 2020 - The Freeciv Project contributors.
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#ifndef FC__REQ_VEC_FIX_H
15#define FC__REQ_VEC_FIX_H
16
17#ifdef HAVE_CONFIG_H
18#include <fc_config.h>
19#endif
20
21// Qt
22#include <QWidget>
23
24// common
25#include "requirements.h"
26
27class QButtonGroup;
28class QListWidgetItem;
29class QPushButton;
30class QStackedLayout;
31
32class ruledit_gui;
33
34// How serious a req_vec_problem is considered
35 enum req_vec_problem_seriousness {
36 RVPS_NO_PROBLEM,
37 RVPS_IMPROVE,
38 RVPS_REPAIR,
39};
40
41void mark_item(QListWidgetItem *item,
42 enum req_vec_problem_seriousness problem_level);
43
44/**********************************************************************/
48 class req_vec_fix_item
49{
50public:
51 /********************************************************************/
54 virtual void close() = 0;
55
56 /********************************************************************/
60 virtual const void *item() = 0;
61
62 /********************************************************************/
66 virtual void *item_working_copy() = 0;
67
68 /********************************************************************/
74 virtual const char *name() = 0;
75
76 /********************************************************************/
81 virtual struct req_vec_problem *find_next_problem() = 0;
82
83 /********************************************************************/
89 virtual void apply_accepted_changes() = 0;
90
91 /********************************************************************/
96 virtual void undo_accepted_changes() = 0;
97
98 /********************************************************************/
102 virtual int num_vectors() = 0;
103
104 /********************************************************************/
110 virtual requirement_vector_namer vector_namer() = 0;
111
112 /********************************************************************/
118 virtual requirement_vector_by_number vector_getter() = 0;
119
120 /********************************************************************/
125 virtual bool vector_in_item(const struct requirement_vector *vec) = 0;
126
127 /********************************************************************/
130 virtual ~req_vec_fix_item() {};
131};
132
133/**********************************************************************/
136 class req_vec_fix_problem : public QWidget
137{
138 Q_OBJECT
139
140public:
141 explicit req_vec_fix_problem(const struct req_vec_problem *problem,
142 req_vec_fix_item *item_info);
143
144private:
145 QButtonGroup *solutions;
146
147signals:
148 void solution_accepted(int selected_solution);
149
150private slots:
151 void accept_solution();
152};
153
154/**********************************************************************/
157 class req_vec_fix : public QWidget
158{
159 Q_OBJECT
160
161public:
162 explicit req_vec_fix(ruledit_gui *ui_in, req_vec_fix_item *item_info);
163 ~req_vec_fix();
164
165 const void *item();
166
167 bool refresh(void);
168
169signals:
170 /********************************************************************/
174 void req_vec_may_have_changed(const requirement_vector *vec);
175
176private:
177 struct req_vec_problem *current_problem;
178 req_vec_fix_item *item_info;
179 bool did_apply_a_solution;
180
181 ruledit_gui *ui;
182
183 req_vec_fix_problem *current_problem_viewer;
184 QStackedLayout *current_problem_area;
185 QPushButton *apply_changes, *abort, *close;
186
187private slots:
188 void apply_solution(int selected_solution);
189 void accept_applied_solutions();
190 void reject_applied_solutions();
191
192 void incoming_req_vec_change(const requirement_vector *vec);
193};
194
195#endif // FC__REQ_VEC_FIX_H
req_vec_fix_item
Definition req_vec_fix.h:49
req_vec_fix_item::vector_getter
virtual requirement_vector_by_number vector_getter()=0
req_vec_fix_item::vector_namer
virtual requirement_vector_namer vector_namer()=0
req_vec_fix_item::close
virtual void close()=0
req_vec_fix_item::undo_accepted_changes
virtual void undo_accepted_changes()=0
req_vec_fix_item::apply_accepted_changes
virtual void apply_accepted_changes()=0
req_vec_fix_item::vector_in_item
virtual bool vector_in_item(const struct requirement_vector *vec)=0
req_vec_fix_item::num_vectors
virtual int num_vectors()=0
req_vec_fix_item::name
virtual const char * name()=0
req_vec_fix_item::~req_vec_fix_item
virtual ~req_vec_fix_item()
Definition req_vec_fix.h:130
req_vec_fix_item::find_next_problem
virtual struct req_vec_problem * find_next_problem()=0
req_vec_fix_item::item_working_copy
virtual void * item_working_copy()=0
req_vec_fix_item::item
virtual const void * item()=0
req_vec_fix_problem
Definition req_vec_fix.h:137
req_vec_fix_problem::solution_accepted
void solution_accepted(int selected_solution)
req_vec_fix_problem::solutions
QButtonGroup * solutions
Definition req_vec_fix.h:145
req_vec_fix_problem::accept_solution
void accept_solution()
Definition req_vec_fix.cpp:132
req_vec_fix
Definition req_vec_fix.h:158
req_vec_fix::refresh
bool refresh(void)
Definition req_vec_fix.cpp:227
req_vec_fix::current_problem
struct req_vec_problem * current_problem
Definition req_vec_fix.h:177
req_vec_fix::close
QPushButton * close
Definition req_vec_fix.h:185
req_vec_fix::item
const void * item()
Definition req_vec_fix.cpp:218
req_vec_fix::~req_vec_fix
~req_vec_fix()
Definition req_vec_fix.cpp:203
req_vec_fix::accept_applied_solutions
void accept_applied_solutions()
Definition req_vec_fix.cpp:300
req_vec_fix::incoming_req_vec_change
void incoming_req_vec_change(const requirement_vector *vec)
Definition req_vec_fix.cpp:336
req_vec_fix::current_problem_viewer
req_vec_fix_problem * current_problem_viewer
Definition req_vec_fix.h:183
req_vec_fix::abort
QPushButton * abort
Definition req_vec_fix.h:185
req_vec_fix::current_problem_area
QStackedLayout * current_problem_area
Definition req_vec_fix.h:184
req_vec_fix::reject_applied_solutions
void reject_applied_solutions()
Definition req_vec_fix.cpp:321
req_vec_fix::ui
ruledit_gui * ui
Definition req_vec_fix.h:181
req_vec_fix::req_vec_may_have_changed
void req_vec_may_have_changed(const requirement_vector *vec)
req_vec_fix::apply_solution
void apply_solution(int selected_solution)
Definition req_vec_fix.cpp:264
req_vec_fix::item_info
req_vec_fix_item * item_info
Definition req_vec_fix.h:178
req_vec_fix::did_apply_a_solution
bool did_apply_a_solution
Definition req_vec_fix.h:179
req_vec_fix::apply_changes
QPushButton * apply_changes
Definition req_vec_fix.h:185
ruledit_gui
Definition ruledit_qt.h:97
incite_cost
char * incite_cost
Definition comments.c:74
slots
struct player_slot * slots
Definition player.c:51
req_vec_problem_seriousness
req_vec_problem_seriousness
Definition req_vec_fix.h:35
RVPS_NO_PROBLEM
@ RVPS_NO_PROBLEM
Definition req_vec_fix.h:36
RVPS_REPAIR
@ RVPS_REPAIR
Definition req_vec_fix.h:38
RVPS_IMPROVE
@ RVPS_IMPROVE
Definition req_vec_fix.h:37
mark_item
void mark_item(QListWidgetItem *item, enum req_vec_problem_seriousness problem_level)
Definition req_vec_fix.cpp:36
requirements.h
requirement_vector_namer
const char *(* requirement_vector_namer)(req_vec_num_in_item number)
Definition requirements.h:270
requirement_vector_by_number
struct requirement_vector *(* requirement_vector_by_number)(const void *parent_item, req_vec_num_in_item number)
Definition requirements.h:260
item
Definition climisc.h:80
req_vec_problem
Definition requirements.h:295