-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathConfiguration.h
More file actions
252 lines (203 loc) · 7.8 KB
/
Configuration.h
File metadata and controls
252 lines (203 loc) · 7.8 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
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
#ifndef CONFIGURATION_H
#define CONFIGURATION_H
#include <QColor>
#include <QFont>
#include <QRectF>
#include <chrono>
#include "HelperStructures.h"
static constexpr uint8_t MAX_UNDO_STACK_SIZE = 100;
static auto versionList = QString(FULL_VERSION).split('.');
static uint8_t MAJOR_VERSION = versionList.at(0).toInt();
static uint8_t MINOR_VERSION = versionList.at(1).toInt();
static uint8_t PATCH_VERSION = versionList.at(2).toInt();
static uint8_t BUILD_VERSION = versionList.at(3).toInt();
namespace file
{
static constexpr const SaveFormat SAVE_FORMAT = SaveFormat::BINARY;
static constexpr auto JSON_COMPONENTS_IDENTIFIER = "components";
static constexpr auto JSON_TYPE_IDENTIFIER = "type";
static constexpr auto JSON_MAJOR_VERSION_IDENTIFIER = "major";
static constexpr auto JSON_MINOR_VERSION_IDENTIFIER = "minor";
static constexpr auto JSON_PATCH_VERSION_IDENTIFIER = "patch";
static constexpr auto JSON_COMPATIBLE_MAJOR_VERSION_IDENTIFIER = "comp_major";
static constexpr auto JSON_COMPATIBLE_MINOR_VERSION_IDENTIFIER = "comp_minor";
static constexpr auto JSON_COMPATIBLE_PATCH_VERSION_IDENTIFIER = "comp_patch";
namespace runtime_config
{
static constexpr auto RUNTIME_CONFIG_RELATIVE_PATH = "/runtime_config.json";
static constexpr auto JSON_WELCOME_DIALOG_ENABLED_IDENTIFIER = "show_welcome_dialog_on_startup";
static constexpr auto JSON_RECENT_FILES_IDENTIFIER = "recent_files";
static constexpr auto JSON_LAST_FILE_PATH_IDENTIFIER = "last_file_path";
} // namespace runtime_config
} // namespace
namespace gui
{
static constexpr auto DEFAULT_WINDOW_TITLE = "Linkuit Studio - Untitled";
static constexpr auto OPEN_FILE_DIALOG_TITLE = "Open Circuit File";
static constexpr auto SAVE_FILE_DIALOG_TITLE = "Save Circuit File";
static constexpr bool SHOW_WELCOME_DIALOG_ON_STARTUP = true;
static constexpr std::chrono::milliseconds SHOW_WELCOME_DIALOG_DELAY{300};
static constexpr std::chrono::milliseconds PROCESSING_OVERLAY_TIMEOUT{100};
static constexpr bool FADE_OUT_GUI_ON_CTRL = true;
static constexpr std::chrono::milliseconds FADE_OUT_GUI_TIMEOUT{1000};
static constexpr uint32_t FADE_ANIMATION_DURATION{200};
static constexpr uint32_t PIE_MENU_ANIMATION_DURATION{100};
} // namespace
namespace canvas
{
static constexpr QColor BACKGROUND_COLOR(0, 39, 43);
static constexpr QColor GRID_COLOR(0, 45, 50);
static constexpr uint8_t GRID_SIZE = 20;
static constexpr uint8_t ZOOM_SPEED = 5;
static constexpr int32_t DEFAULT_ZOOM_LEVEL = 250;
static constexpr int32_t MIN_ZOOM_LEVEL = 90;
static constexpr int32_t MAX_ZOOM_LEVEL = 300;
static constexpr int32_t MIN_GRID_ZOOM_LEVEL = 200;
static constexpr QRectF DIMENSIONS(-32000, -32000, 64000, 64000);
} // namespace
namespace simulation
{
static constexpr std::chrono::milliseconds PROPAGATION_DELAY(1);
} // namespace
namespace components
{
enum zvalues
{
WIRE = 0,
CONPOINT,
GATE,
INPUT,
OUTPUT,
TEXT_LABEL,
FRONT
};
static constexpr QColor FILL_COLOR(0, 100, 70);
static constexpr QColor SELECTED_BORDER_COLOR(255, 255, 255);
static constexpr QColor SELECTED_COMPONENT_COLOR(255, 255, 255);
static constexpr QColor HIGH_COLOR(0, 204, 143);
static constexpr uint8_t BORDER_WIDTH = 2;
// Minimal levels of detail to show component details
static constexpr double SMALL_TEXT_MIN_LOD = 0.4f;
static constexpr double DESCRIPTION_TEXT_MIN_LOD = 0.3f;
static constexpr double COMPONENT_DETAILS_MIN_LOD = 0.2f;
static constexpr Direction DEFAULT_DIRECTION = Direction::RIGHT;
namespace gates
{
static constexpr auto AND_TEXT = "&";
static constexpr auto OR_TEXT = "≥1";
static constexpr auto XOR_TEXT = "=1";
static constexpr auto NOT_TEXT = "1";
static constexpr auto BUFFER_TEXT = "1";
static constexpr uint8_t DEFAULT_INPUT_COUNT = 2;
static constexpr uint8_t MIN_INPUT_COUNT = 1;
static constexpr uint8_t MAX_INPUT_COUNT = 9;
static constexpr uint8_t GRID_WIDTH = 3;
static const QFont FONT("Calibri", 25, QFont::Light);
static constexpr QColor FONT_COLOR(255, 255, 255);
} // namespace
namespace wires
{
// The height or width of the wire bounding rect
static constexpr uint8_t BOUNDING_RECT_SIZE = 20;
static constexpr QColor WIRE_LOW_COLOR(0, 64, 45);
static constexpr QColor WIRE_HIGH_COLOR(0, 143, 100);
static constexpr uint8_t WIRE_WIDTH = 2;
} // namespace
namespace conpoints
{
static constexpr double MIN_VISIBLE_LOD = 0.2f;
static constexpr QColor CONPOINTS_LOW_COLOR(0, 88, 61);
static constexpr QColor CONPOINTS_HIGH_COLOR(0, 204, 143);
static constexpr uint32_t SIZE = 6;
} // namespace
namespace diodes
{
static constexpr uint32_t SIZE = 15;
} // namespace
namespace text_label
{
static const QFont FONT("Quicksand", 12, QFont::Medium);
static constexpr QColor FONT_COLOR(255, 255, 255);
} // namespace
namespace inputs
{
static constexpr uint32_t BUTTON_TOGGLE_TICKS(500);
// The default clock mode (whether the clock should toggle at timeout or pulse)
static constexpr ClockMode DEFAULT_CLOCK_MODE = ClockMode::PULSE;
// The default pulse duration
static constexpr uint32_t DEFAULT_CLOCK_PULSE_TICKS = 100;
// The default amount of ticks to pass before the clock timeouts
static constexpr uint32_t DEFAULT_CLOCK_TOGGLE_TICKS = 500;
namespace constant
{
static constexpr LogicState DEFAULT_STATE = LogicState::HIGH;
static const QFont FONT("Quicksand", 10, QFont::Medium);
static constexpr QColor LOW_FONT_COLOR(255, 255, 255);
static constexpr QColor HIGH_FONT_COLOR(255, 255, 255);
}
} // namespace
namespace outputs
{
static constexpr QColor DEFAULT_COLOR_LOW(0, 100, 70);
static constexpr QColor DEFAULT_COLOR_HIGH(0, 204, 143);
static constexpr QColor GREEN_COLOR_LOW(22, 100, 22);
static constexpr QColor GREEN_COLOR_HIGH(0, 255, 0);
static constexpr QColor RED_COLOR_LOW(131, 33, 33);
static constexpr QColor RED_COLOR_HIGH(200, 50, 50);
static constexpr QColor BLUE_COLOR_LOW(5, 51, 97);
static constexpr QColor BLUE_COLOR_HIGH(10, 100, 190);
static constexpr QColor YELLOW_COLOR_LOW(134, 134, 9);
static constexpr QColor YELLOW_COLOR_HIGH(240, 240, 50);
} // namespace
namespace multiplexer
{
static constexpr uint8_t MIN_BIT_WIDTH = 1;
static constexpr uint8_t MAX_BIT_WIDTH = 5;
static constexpr uint8_t DEFAULT_BIT_WIDTH = 2;
} // namespace
namespace encoder_decoder
{
static constexpr uint8_t MIN_INPUT_COUNT = 3;
static constexpr uint8_t MAX_INPUT_COUNT = 5;
static constexpr uint8_t DEFAULT_INPUT_COUNT = 3;
} // namespace
namespace shift_register
{
static constexpr uint8_t MIN_BIT_WIDTH = 2;
static constexpr uint8_t MAX_BIT_WIDTH = 32;
static constexpr uint8_t DEFAULT_BIT_WIDTH = 4;
static const QFont FONT("Quicksand", 10, QFont::Medium);
static constexpr QColor LOW_FONT_COLOR(255, 255, 255);
static constexpr QColor HIGH_FONT_COLOR(255, 255, 255);
} // namespace
namespace counter
{
static constexpr uint8_t MIN_BIT_WIDTH = 2;
static constexpr uint8_t MAX_BIT_WIDTH = 32;
static constexpr uint8_t DEFAULT_BIT_WIDTH = 4;
} // namespace
namespace complex_logic
{
static constexpr auto HALF_ADDER_TEXT = "HA";
static constexpr auto FULL_ADDER_TEXT = "FA";
static constexpr auto RS_FLIPFLOP_TEXT = "RS";
static constexpr auto D_FLIPFLOP_TEXT = "FF";
static constexpr auto T_FLIPFLOP_TEXT = "TF";
static constexpr auto JK_FLIPFLOP_TEXT = "JK";
static constexpr auto RS_MS_FLIPFLOP_TEXT = "RS-MS";
static constexpr auto D_MS_FLIPFLOP_TEXT = "FF-MS";
static constexpr auto JK_MS_FLIPFLOP_TEXT = "JK-MS";
static constexpr auto MULTIPLEXER_TEXT = "MUX";
static constexpr auto DEMULTIPLEXER_TEXT = "DEMUX";
static constexpr auto DECODER_TEXT = "";
static constexpr auto ENCODER_TEXT = "";
static constexpr auto COUNTER_TEXT = "COUNT";
static constexpr auto CLOCK_SYMBOL_STRING{">"};
static const QFont FONT("Source Sans Pro");
static constexpr uint8_t DEFAULT_DESCRIPTION_FONT_SIZE = 20;
static const QFont CONNECTOR_FONT("Calibri", 10, QFont::Light);
static constexpr QColor FONT_COLOR(255, 255, 255);
static constexpr QColor SMALL_TEXT_FONT_COLOR(225, 225, 225);
} // namespace
} // namespace
#endif // CONFIGURATION_H