forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitem_group_window.h
177 lines (151 loc) · 5.46 KB
/
item_group_window.h
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#ifndef CATA_OBJECT_CREATOR_ITEM_GROUP_WINDOW_H
#define CATA_OBJECT_CREATOR_ITEM_GROUP_WINDOW_H
#include "listwidget_drag.h"
#include "simple_property_widget.h"
#include "flowlayout.h"
#include "item_group.h"
#include "QtWidgets/qlistwidget.h"
#include <QtWidgets/qlineedit.h>
#include "QtWidgets/qgridlayout.h"
#include <QtWidgets/qmainwindow.h>
#include "QtWidgets/qlabel.h"
#include <QtWidgets/qplaintextedit.h>
#include <QtWidgets/qtablewidget.h>
#include "QtWidgets/qpushbutton.h"
#include <QtWidgets/QScrollArea>
#include <QtWidgets/QSpinBox>
#include <QtWidgets/QComboBox>
namespace creator
{
class nested_group_container;
class item_group_window : public QWidget
{
public:
item_group_window( QWidget* parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );
void show() {
item_group_json.show();
QWidget::show();
}
void hide() {
item_group_json.hide();
QWidget::hide();
}
private:
QTextEdit item_group_json;
void write_json();
void items_search_return_pressed();
void group_search_return_pressed();
void group_list_populate_filtered( std::string searchQuery = "" );
void item_list_populate_filtered( std::string searchQuery = "" );
void set_item_tooltip( QListWidgetItem* new_item, const itype* tmpItype );
void set_group_tooltip( QListWidgetItem* new_item, const item_group_id tmpItype );
QLabel* id_label;
QLineEdit* id_box;
QLabel* comment_label;
QLineEdit* comment_box;
nested_group_container* group_container;
simple_property_widget* ammo_frame;
simple_property_widget* magazine_frame;
QComboBox* subtype;
QLineEdit* containerItem;
QComboBox* overflow;
QLabel* item_search_label;
QLineEdit* item_search_box;
ListWidget_Drag* item_list_total_box;
QLabel* group_search_label;
QLineEdit* group_search_box;
ListWidget_Drag* group_list_total_box;
//Top-level frame to hold the distributionCollections and/or entrieslist
QScrollArea* scrollArea;
protected:
bool event( QEvent* event ) override;
};
//Holds the most detailed data, an item or group and it's property
class itemGroupEntry : public QFrame
{
public:
explicit itemGroupEntry( QWidget* parent, QString entryText, bool group,
item_group_window* top_parent );
void get_json( JsonOut &jo );
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
private:
void delete_self();
void change_notify_top_parent();
void add_property_changed();
QLabel* title_label;
simple_property_widget* variant_frame;
simple_property_widget* contentsItem_frame;
simple_property_widget* contentsGroup_frame;
simple_property_widget* containerItem_frame;
simple_property_widget* ammoItem_frame;
simple_property_widget* entryWrapper_frame;
simple_property_widget* sealed_frame;
simple_property_widget* damage_frame;
simple_property_widget* charges_frame;
simple_property_widget* count_frame;
simple_property_widget* prob_frame;
FlowLayout* flowLayout;
QComboBox* add_property;
item_group_window* top_parent_widget;
protected:
bool event( QEvent* event ) override;
};
//Holds the properties for either a collection or a distribution
//May contain entriesLists
class distributionCollection : public QFrame
{
public:
explicit distributionCollection( bool isCollection,
item_group_window* top_parent = nullptr );
void get_json( JsonOut &jo );
void set_bg_color();
void set_depth( int d );
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
private:
void add_collection();
void add_distribution();
void add_entry( QString entryText, bool group );
void change_notify_top_parent( );
void delete_self();
item_group_window* top_parent_widget;
int depth;
QComboBox* entryType;
QVBoxLayout* verticalBox;
QSpinBox* prob;
protected:
void dragEnterEvent( QDragEnterEvent* event ) override;
void dragMoveEvent( QDragMoveEvent* event ) override;
void dropEvent( QDropEvent* event ) override;
};
//Top-level widget for items and distributions and collections
class nested_group_container : public QFrame
{
public:
explicit nested_group_container( QWidget* parent, item_group_window* top_parent );
void get_json( JsonOut &jo );
private:
void add_distribution();
void add_collection();
void change_notify_top_parent();
QFrame* items_container;
item_group_window* top_parent_widget;
QVBoxLayout* verticalBox;
private:
void add_entry( QString entryText, bool group );
protected:
void dragEnterEvent( QDragEnterEvent* event ) override;
void dragMoveEvent( QDragMoveEvent* event ) override;
void dropEvent( QDropEvent* event ) override;
};
class item_group_changed : public QEvent
{
public:
item_group_changed() : QEvent( registeredType() ) { }
static QEvent::Type eventType;
private:
static QEvent::Type registeredType();
};
}
#endif