6
6
#include < QSize>
7
7
#include < QObject>
8
8
9
+ #include " Settings.hpp"
10
+
9
11
#define PROGRAM_CONSTANTS ProgramConstants::Instance
10
12
11
13
enum class GameObjectTypes
@@ -26,10 +28,9 @@ enum class Languages
26
28
class ProgramConstants
27
29
{
28
30
private: // Data
29
- QSet<Qt::Key> keys = {};
30
- bool console = false ;
31
+ std::unique_ptr<Settings> SettingsFile = nullptr ;
31
32
public:
32
- inline static std::unique_ptr<ProgramConstants> Instance;
33
+ inline static std::unique_ptr<ProgramConstants> Instance = nullptr ;
33
34
34
35
// Folders
35
36
const QString RESOURCE_FOLDER = " Resources" ;
@@ -79,6 +80,13 @@ class ProgramConstants
79
80
const QVector<QString> USA_SHORT_NAMES = {" USA" , " SWG" , " AIR" , " LSR" };
80
81
const QVector<QString> PRC_SHORT_NAMES = {" PRC" , " TNK" , " INF" , " NUK" };
81
82
83
+ const QSet<Qt::Key> DEFAULT_ALLOWED_KEYS =
84
+ {
85
+ Qt::Key_R, Qt::Key_T, Qt::Key_Y, Qt::Key_U, Qt::Key_O, Qt::Key_I, Qt::Key_P,
86
+ Qt::Key_A, Qt::Key_S, Qt::Key_D, Qt::Key_F, Qt::Key_G, Qt::Key_H, Qt::Key_J, Qt::Key_K, Qt::Key_L,
87
+ Qt::Key_Z, Qt::Key_X, Qt::Key_C, Qt::Key_V, Qt::Key_B, Qt::Key_N, Qt::Key_M
88
+ };
89
+
82
90
const QMap<QChar, Qt::Key> KEYBOARD_KEYS =
83
91
{
84
92
{' Q' , Qt::Key_Q}, {' W' , Qt::Key_W}, {' E' , Qt::Key_E}, {' R' , Qt::Key_R}, {' T' , Qt::Key_T}, {' Y' , Qt::Key_Y}, {' U' , Qt::Key_U}, {' I' , Qt::Key_I}, {' O' , Qt::Key_O}, {' P' , Qt::Key_P},
@@ -92,7 +100,6 @@ class ProgramConstants
92
100
{Languages::Russian, {" ru" , " Русский" }}
93
101
};
94
102
95
-
96
103
const QMap<GameObjectTypes, QString> INGAME_ENTITIES_STRINGS =
97
104
{
98
105
{GameObjectTypes::Buildings, QObject::tr (" Buildings" )},
@@ -104,9 +111,9 @@ class ProgramConstants
104
111
public: // Methods
105
112
ProgramConstants ();
106
113
// / @brief Parse `Resource\Settings.json`.
107
- void InitializeSettingsJSON ();
114
+ void InitializeFileSettings ();
108
115
// / @brief Returns `QSet` of available keys from `QWEWRTY` keyboard to choice by user.
109
- const QSet<Qt::Key>& GetAllowedKeys ();
116
+ const QSet<Qt::Key> GetAllowedKeys ();
110
117
// / @brief Returns field status for console from settings file.
111
- bool IsConsoleEnabled ();
118
+ const bool IsConsoleEnabled ();
112
119
};
0 commit comments