Freeciv21
Develop your civilization from humble roots to a global empire
effect_edit.h
Go to the documentation of this file.
1 /*__ ___ ***************************************
2 / \ / \ Copyright (c) 1996-2020 Freeciv21 and Freeciv
3 \_ \ / __/ contributors. This file is part of Freeciv21.
4  _\ \ / /__ Freeciv21 is free software: you can redistribute it
5  \___ \____/ __/ and/or modify it under the terms of the GNU General
6  \_ _/ Public License as published by the Free Software
7  | @ @ \_ Foundation, either version 3 of the License,
8  | or (at your option) any later version.
9  _/ /\ You should have received a copy of the GNU
10  /o) (o/\ \_ General Public License along with Freeciv21.
11  \_____/ / If not, see https://www.gnu.org/licenses/.
12  \____/ ********************************************************/
13 
14 #ifndef FC__EFFECT_EDIT_H
15 #define FC__EFFECT_EDIT_H
16 
17 #include <fc_config.h>
18 
19 // Qt
20 #include <QDialog>
21 #include <QListWidget>
22 #include <QToolButton>
23 
24 // common
25 #include "requirements.h"
26 
27 class QSpinBox;
28 
29 class ruledit_gui;
30 
33  EFMC_NONE, // No requirements
34  EFMC_ALL // Any requirements
35 };
36 
38  struct universal *filter;
40  class effect_edit *edit;
41  int num;
42 };
43 
44 class effect_edit : public QDialog {
45  Q_OBJECT
46 
47 public:
48  explicit effect_edit(ruledit_gui *ui_in, const QString &target,
49  struct universal *filter_in,
50  enum effect_filter_main_class efmc_in);
51  ~effect_edit() override;
52  void refresh();
53  void add(const char *msg);
54  void add_effect_to_list(struct effect *peffect,
55  struct effect_list_fill_data *data);
56 
57  struct universal *filter_get();
58 
60 
61 private:
63 
64  QString name;
65  QListWidget *list_widget;
66  struct universal filter;
67  struct effect_list *effects;
68 
69  struct effect *selected;
70  int selected_nbr = -1;
71 
72  QToolButton *edit_type_button;
73  QSpinBox *value_box;
74 
75 private slots:
76  void select_effect();
77  void fill_active();
78  void edit_reqs();
79  void close_now();
80 
81  void effect_type_menu(QAction *action);
82  void set_value(int value);
83 
84 protected:
85  void closeEvent(QCloseEvent *event) override;
86 };
87 
88 #endif // FC__EFFECT_EDIT_H
struct effect_list * effects
Definition: effect_edit.h:67
QToolButton * edit_type_button
Definition: effect_edit.h:72
void close_now()
User pushed close button.
QString name
Definition: effect_edit.h:64
void fill_active()
Fill active menus from selected effect.
void edit_reqs()
User wants to edit requirements.
enum effect_filter_main_class efmc
Definition: effect_edit.h:59
void add_effect_to_list(struct effect *peffect, struct effect_list_fill_data *data)
Add entry to effect list.
void add(const char *msg)
void set_value(int value)
Read value from spinbox to effect.
~effect_edit() override
Effect edit destructor.
int selected_nbr
Definition: effect_edit.h:70
struct universal filter
Definition: effect_edit.h:66
QListWidget * list_widget
Definition: effect_edit.h:65
void closeEvent(QCloseEvent *event) override
User clicked windows close button.
struct universal * filter_get()
Getter for filter.
QSpinBox * value_box
Definition: effect_edit.h:73
void refresh()
Refresh the information.
ruledit_gui * ui
Definition: effect_edit.h:62
void effect_type_menu(QAction *action)
User selected type for the effect.
effect_edit(ruledit_gui *ui_in, const QString &target, struct universal *filter_in, enum effect_filter_main_class efmc_in)
Setup effect_edit object.
Definition: effect_edit.cpp:36
struct effect * selected
Definition: effect_edit.h:69
void select_effect()
User selected effect from the list.
effect_filter_main_class
Definition: effect_edit.h:31
@ EFMC_ALL
Definition: effect_edit.h:34
@ EFMC_NORMAL
Definition: effect_edit.h:32
@ EFMC_NONE
Definition: effect_edit.h:33
enum event_type event
Definition: events.cpp:68
struct universal * filter
Definition: effect_edit.h:38
enum effect_filter_main_class efmc
Definition: effect_edit.h:39
class effect_edit * edit
Definition: effect_edit.h:40
int value
Definition: effects.h:336