Freeciv21
Develop your civilization from humble roots to a global empire
tab_tech.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__TAB_TECH_H
15 #define FC__TAB_TECH_H
16 
17 #include <fc_config.h>
18 
19 // Qt
20 #include <QWidget>
21 
22 // common
23 #include "tech.h"
24 
25 class QGridLayout;
26 class QLabel;
27 class QLineEdit;
28 class QListWidget;
29 class QMenu;
30 class QRadioButton;
31 class QToolButton;
32 
33 class ruledit_gui;
34 
35 class tab_tech : public QWidget {
36  Q_OBJECT
37 
38 public:
39  explicit tab_tech(ruledit_gui *ui_in);
40  void refresh();
41  static void techs_to_menu(QMenu *fill_menu);
42  static QString tech_name(struct advance *padv);
43 
44 private:
46  void update_tech_info(struct advance *adv);
47  QMenu *prepare_req_button(QToolButton *button, enum tech_req rn);
48  bool initialize_new_tech(struct advance *padv);
49 
50  QLineEdit *name;
51  QLineEdit *rname;
52  QToolButton *req1_button;
53  QToolButton *req2_button;
54  QToolButton *root_req_button;
55  QMenu *req1;
56  QMenu *req2;
57  QMenu *root_req;
58  QListWidget *tech_list;
59  QRadioButton *same_name;
60 
61  struct advance *selected;
62 
63 private slots:
64  void name_given();
65  void select_tech();
66  void req1_jump();
67  void req2_jump();
68  void root_req_jump();
69  void req1_menu(QAction *action);
70  void req2_menu(QAction *action);
71  void root_req_menu(QAction *action);
72  void add_now();
73  void delete_now();
74  void same_name_toggle(bool checked);
75  void edit_effects();
76 };
77 
78 #endif // FC__TAB_TECH_H
QToolButton * root_req_button
Definition: tab_tech.h:54
ruledit_gui * ui
Definition: tab_tech.h:45
void same_name_toggle(bool checked)
Toggled whether rule_name and name should be kept identical.
Definition: tab_tech.cpp:458
bool initialize_new_tech(struct advance *padv)
Initialize new tech for use.
Definition: tab_tech.cpp:402
void select_tech()
User selected tech from the list.
Definition: tab_tech.cpp:250
QToolButton * req1_button
Definition: tab_tech.h:52
QLineEdit * rname
Definition: tab_tech.h:51
void req1_menu(QAction *action)
User selected tech to be req1.
Definition: tab_tech.cpp:296
void edit_effects()
User wants to edit effects.
Definition: tab_tech.cpp:469
void refresh()
Refresh the information.
Definition: tab_tech.cpp:139
struct advance * selected
Definition: tab_tech.h:61
void delete_now()
User requested tech deletion.
Definition: tab_tech.cpp:382
QMenu * req1
Definition: tab_tech.h:55
static void techs_to_menu(QMenu *fill_menu)
Fill menu with all possible tech values.
Definition: tab_tech.cpp:191
QLineEdit * name
Definition: tab_tech.h:50
void add_now()
User requested new tech.
Definition: tab_tech.cpp:421
QMenu * prepare_req_button(QToolButton *button, enum tech_req rn)
Build tech req button.
Definition: tab_tech.cpp:161
void req2_jump()
Req2 of the current tech selected.
Definition: tab_tech.cpp:275
void req2_menu(QAction *action)
User selected tech to be req2.
Definition: tab_tech.cpp:314
void root_req_menu(QAction *action)
User selected tech to be root_req.
Definition: tab_tech.cpp:332
void req1_jump()
Req1 of the current tech selected.
Definition: tab_tech.cpp:265
void root_req_jump()
Root req of the current tech selected.
Definition: tab_tech.cpp:285
void name_given()
User entered name for tech.
Definition: tab_tech.cpp:350
QToolButton * req2_button
Definition: tab_tech.h:53
QMenu * root_req
Definition: tab_tech.h:57
tab_tech(ruledit_gui *ui_in)
Setup tab_tech object.
Definition: tab_tech.cpp:41
static QString tech_name(struct advance *padv)
Display name of the tech.
Definition: tab_tech.cpp:202
QListWidget * tech_list
Definition: tab_tech.h:58
QRadioButton * same_name
Definition: tab_tech.h:59
QMenu * req2
Definition: tab_tech.h:56
void update_tech_info(struct advance *adv)
Update info of the tech.
Definition: tab_tech.cpp:214
Definition: tech.h:113
tech_req
Definition: tech.h:104