-
Notifications
You must be signed in to change notification settings - Fork 180
Expand file tree
/
Copy pathWingEditorDialogModel.h
More file actions
147 lines (124 loc) · 5.09 KB
/
WingEditorDialogModel.h
File metadata and controls
147 lines (124 loc) · 5.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#pragma once
#include "AbstractDialogModel.h"
#include "mission/util.h"
#include "mission/Editor.h"
#include <globalincs/linklist.h>
#include <ship/ship.h>
#include <playerman/player.h> // for max hotkeys
#include <playerman/managepilot.h> // for squad logos
#include "ui/widgets/sexp_tree.h"
#include "globalincs/pstypes.h"
#include <utility>
#include <QObject>
namespace fso::fred::dialogs {
//TODO: This dialog currently works on the wing data directly instead of model members
// so it does not support temporary changes. This will need to be changed in a future PR
/**
* @brief QTFred's Wing Editor's Model
*/
class WingEditorDialogModel : public AbstractDialogModel {
Q_OBJECT
public:
WingEditorDialogModel(QObject* parent, EditorViewport* viewport);
// The model in this dialog directly applies changes to the mission, so apply and reject are superfluous
bool apply() override { return true; }
void reject() override {}
int getCurrentWingIndex() const { return _currentWingIndex; };
bool wingIsValid() const;
bool isPlayerWing() const;
bool containsPlayerStart() const;
bool wingAllFighterBombers() const;
bool arrivalIsDockBay() const;
bool arrivalNeedsTarget() const;
bool departureIsDockBay() const;
bool departureNeedsTarget() const;
int getMaxWaveThreshold() const;
int getMinArrivalDistance() const;
std::pair<int, SCP_vector<SCP_string>> getLeaderList() const;
static std::vector<std::pair<int, std::string>> getHotkeyList();
static std::vector<std::pair<int, std::string>> getFormationList();
static std::vector<std::pair<int, std::string>> getArrivalLocationList();
static std::vector<std::pair<int, std::string>> getDepartureLocationList();
std::vector<std::pair<int, std::string>> getArrivalTargetList() const;
std::vector<std::pair<int, std::string>> getDepartureTargetList() const;
std::vector<std::string> getSquadLogoList() const { return squadLogoList; };
// Top section, first column
SCP_string getWingName() const;
void setWingName(const SCP_string& name);
SCP_string getWingDisplayName() const;
void setWingDisplayName(const SCP_string& name);
int getWingLeaderIndex() const;
void setWingLeaderIndex(int newLeaderIndex);
int getNumberOfWaves() const;
void setNumberOfWaves(int newTotalWaves);
int getWaveThreshold() const;
void setWaveThreshold(int newThreshhold);
int getHotkey() const;
void setHotkey(int newHotkeyIndex);
// Top section, second column
int getFormationId() const;
void setFormationId(int newFormationId);
float getFormationScale() const;
void setFormationScale(float newScale);
void alignWingFormation();
SCP_string getSquadLogo() const;
void setSquadLogo(const SCP_string& filename);
// Top section, third column
void selectPreviousWing();
void selectNextWing();
void deleteCurrentWing();
void disbandCurrentWing();
// Initial orders is handled by its own dialog, so no model function here
std::vector<std::pair<SCP_string, bool>> getWingFlags() const;
void setWingFlags(const std::vector<std::pair<SCP_string, bool>>& newFlags);
// Arrival controls
ArrivalLocation getArrivalType() const;
void setArrivalType(ArrivalLocation arrivalType);
int getArrivalDelay() const;
void setArrivalDelay(int delayIn);
int getMinWaveDelay() const;
void setMinWaveDelay(int newMin);
int getMaxWaveDelay() const;
void setMaxWaveDelay(int newMax);
int getArrivalTarget() const;
void setArrivalTarget(int targetIndex);
int getArrivalDistance() const;
void setArrivalDistance(int newDistance);
std::vector<std::pair<SCP_string, bool>> getArrivalPaths() const;
void setArrivalPaths(const std::vector<std::pair<SCP_string, bool>>& newFlags);
int getArrivalTree() const;
void setArrivalTree(int newTree);
bool getNoArrivalWarpFlag() const;
void setNoArrivalWarpFlag(bool flagIn);
bool getNoArrivalWarpAdjustFlag() const;
void setNoArrivalWarpAdjustFlag(bool flagIn);
// Departure controls
DepartureLocation getDepartureType() const;
void setDepartureType(DepartureLocation departureType);
int getDepartureDelay() const;
void setDepartureDelay(int delayIn);
int getDepartureTarget() const;
void setDepartureTarget(int targetIndex);
std::vector<std::pair<SCP_string, bool>> getDeparturePaths() const;
void setDeparturePaths(const std::vector<std::pair<SCP_string, bool>>& newFlags);
int getDepartureTree() const;
void setDepartureTree(int newTree);
bool getNoDepartureWarpFlag() const;
void setNoDepartureWarpFlag(bool flagIn);
bool getNoDepartureWarpAdjustFlag() const;
void setNoDepartureWarpAdjustFlag(bool flagIn);
signals:
void wingChanged();
private slots:
void onEditorSelectionChanged(int); // currentObjectChanged
void onEditorMissionChanged(); // missionChanged
private: // NOLINT(readability-redundant-access-specifiers)
void reloadFromCurWing();
wing* getCurrentWing() const;
static std::vector<std::pair<SCP_string, bool>> getDockBayPathsForWingMask(uint32_t mask, int anchorShipnum);
void prepareSquadLogoList();
int _currentWingIndex = -1;
SCP_string _currentWingName;
SCP_vector<SCP_string> squadLogoList;
};
} // namespace fso::fred::dialogs