Freeciv21
Develop your civilization from humble roots to a global empire
unithudselector.h
Go to the documentation of this file.
1 /**************************************************************************
2  Copyright (c) 1996-2020 Freeciv21 and Freeciv contributors. This file is
3  part of Freeciv21. Freeciv21 is free software: you can redistribute it
4  and/or modify it under the terms of the GNU General Public License as
5  published by the Free Software Foundation, either version 3 of the
6  License, or (at your option) any later version. You should have received
7  a copy of the GNU General Public License along with Freeciv21. If not,
8  see https://www.gnu.org/licenses/.
9 **************************************************************************/
10 #pragma once
11 
12 // Qt
13 #include <QDialog>
14 #include <QElapsedTimer>
15 #include <QLabel>
16 #include <QLineEdit>
17 #include <QMessageBox>
18 #include <QRubberBand>
19 #include <QTableWidget>
20 // utility
21 #include "fc_types.h"
22 // client
23 #include "dialogs.h"
24 #include "shortcuts.h"
25 
26 class QComboBox;
27 class QFontMetrics;
28 class QHBoxLayout;
29 class QIcon;
30 class QItemSelection;
31 class QKeyEvent;
32 class QMouseEvent;
33 class QMoveEvent;
34 class QObject;
35 class QPaintEvent;
36 class QPushButton;
37 class QRadioButton;
38 class QTimerEvent;
39 class QVBoxLayout;
40 class move_widget;
41 class scale_widget;
42 struct tile;
43 struct unit;
44 struct unit_list;
45 
46 void show_new_turn_info();
48 
49 /****************************************************************************
50  Widget allowing quick select given type of units
51 ****************************************************************************/
52 class unit_hud_selector : public qfc_dialog {
53  Q_OBJECT
54  QVBoxLayout *main_layout;
55  QComboBox *unit_sel_type;
56  QPushButton *select;
57  QPushButton *cancel;
58 
59 public:
60  unit_hud_selector(QWidget *parent);
61  ~unit_hud_selector() override;
62  void show_me();
63 private slots:
64  void select_units(int x = 0);
65  void select_units(bool x);
66  void uhs_select();
67  void uhs_cancel();
68 
69 protected:
70  void keyPressEvent(QKeyEvent *event) override;
71 
72 private:
73  bool activity_filter(struct unit *punit);
74  bool hp_filter(struct unit *punit);
75  bool island_filter(struct unit *punit);
76  bool type_filter(struct unit *punit);
77 
78  QRadioButton *any_activity;
79  QRadioButton *fortified;
80  QRadioButton *idle;
81  QRadioButton *sentried;
82 
83  QRadioButton *any;
84  QRadioButton *full_mp;
85  QRadioButton *full_hp;
86  QRadioButton *full_hp_mp;
87 
88  QRadioButton *this_tile;
89  QRadioButton *this_continent;
90  QRadioButton *main_continent;
91  QRadioButton *anywhere;
92 
93  QRadioButton *this_type;
94  QRadioButton *any_type;
95  QLabel result_label;
96 };
QRadioButton * this_continent
QComboBox * unit_sel_type
QRadioButton * sentried
QVBoxLayout * main_layout
QRadioButton * anywhere
QRadioButton * main_continent
QRadioButton * full_hp_mp
QPushButton * cancel
bool island_filter(struct unit *punit)
Filter by location.
bool type_filter(struct unit *punit)
Filter by type.
unit_hud_selector(QWidget *parent)
Constructor for unit_hud_selector.
void uhs_select()
Selects and closes widget.
~unit_hud_selector() override
Unit_hud_selector destructor.
QRadioButton * full_mp
void select_units(int x=0)
Shows number of selected units on label.
QRadioButton * fortified
QRadioButton * this_tile
QRadioButton * any_type
QRadioButton * any_activity
QPushButton * select
QRadioButton * any
bool activity_filter(struct unit *punit)
Filter by activity.
bool hp_filter(struct unit *punit)
Filter by hp/mp.
QRadioButton * full_hp
QRadioButton * this_type
void show_me()
Shows and moves to center unit_hud_selector.
void uhs_cancel()
Closes current widget.
QRadioButton * idle
void keyPressEvent(QKeyEvent *event) override
Key press event for unit_hud_selector.
enum event_type event
Definition: events.cpp:68
int Unit_type_id
Definition: fc_types.h:299
Definition: tile.h:42
Definition: unit.h:134
bool has_player_unit_type(Unit_type_id utype)
Returns true if player has any unit of unit_type.
Definition: hudwidget.cpp:51
void show_new_turn_info()
Shows new turn information with big font.
Definition: hudwidget.cpp:1305