Debian Codegraph @

src/defines.h

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 /***************************************************************************
2 * Copyright (C) 2009 by The qGo Project *
3 * *
4 * This file is part of qGo. *
5 * *
6 * qGo is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, see <http://www.gnu.org/licenses/> *
18 * or write to the Free Software Foundation, Inc., *
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
20 ***************************************************************************/
21
22
23 #ifndef DEFINES_H
24 #define DEFINES_H
25
26 #include <QtCore>
27
28 /*
29 * Global defines
30 */
31
32 #define PACKAGE "qGo"
33 #define VERSION "2.1.0"
34
35 #define DEFAULT_BOARD_SIZE 19
36 #define BOARD_X 500
37 #define BOARD_Y 500
38 #define PASS_XY -1
39
40 #define WHITE_STONES_NB 8
41
42 #define CONSOLECMDPREFIX "--->"
43
44 //3 looked a little small
45 #define SMALL_STONE_TERR_DIVISOR 2.5
46
47 /*
48 * GNUgo default level
49 */
50 #define DEFAULT_ENGINE "gnugo"
•51 #define DEFAULT_ENGINE_PATH "/usr/bin/"
52 #define DEFAULT_ENGINE_OPTIONS "--mode gtp --quiet --level 10"
53
54
55 /*
56 * Enum definitions
57 */
58 enum StoneColor { stoneNone = 0x0, stoneWhite = 0x1, stoneBlack = 0x2, stoneErase = 0x3 };
59 enum MarkType { markNone = 0x00, markTerrBlack = 0x04, markTerrWhite = 0x08, markTerrDame = 0x0c,
60 markSquare = 0x10, markCircle = 0x20, markTriangle = 0x30, markCross = 0x40,
61 markText = 0x50, markNumber = 0x60, markKoMarker = 0x80, markAll = 0xfc };
62
63 enum GameMode { modeLocal, modeObserve, modeMatch, modeTeach, modeEdit, modeReview, modeUndefined };
64 enum GamePhase { phaseInit, phaseOngoing, phaseEdit, phaseNavTo, phaseScore, phaseEnded};
65 enum Codec { codecNone, codecBig5, codecEucJP, codecJIS, codecSJIS, codecEucKr, codecGBK, codecTscii };
66 enum Language { None, German, French, Italian, Danish, Dutch, Czech, Chinese, Portugese, Polish, Russian, Turkish };
67 enum player_type {HUMAN=0,COMPUTER} ;
68 enum assessType { noREQ, FREE, RATED, TEACHING };
69
70 enum State { stateVarBegin, stateNode, stateVarEnd };
71 enum Property { moveBlack, moveWhite, editBlack, editWhite, editErase, comment, editMark, unknownProp, nodeName, timeLeft, openMoves, nextMove};
72 enum TimeSystem { none, absolute, byoyomi, canadian, tvasia };
73
74 /*
75 * Game server enums
76 * We rely on the fact that the known types come first,
77 * followed by TypeDEFAULT, followed by other types
78 *
79 * Note that a list of user-visible strings corresponding to these types
80 * is maintained in login.cpp; that list must be in the same order.
81 */
82 enum ConnectionType { TypeIGS, TypeWING, TypeLGS, TypeORO, TypeTYGEM, TypeEWEIQI, TypeTOM,
83 TypeDEFAULT, TypeNone, TypeUNKNOWN,
84 TypeNNGS, TypeCTN, TypeCWS}; // These are not implemented
85
86 /* This should really probably have access functions or
87 * something and then friend the mainwindow settings code so
88 * that only it can change it */
89 struct _preferences
90 {
91 bool nmatch_black;
92 bool nmatch_white;
93 bool nmatch_nigiri;
94 QString nmatch_handicap;
95 bool draw_ko_marker;
96 bool number_current_move;
97 bool terr_stone_mark;
98 bool observe_outside_on_doubleclick;
99
100 int playerslist_sortcolumn;
101 bool playerslist_sortascending;
102 int gameslist_sortcolumn;
103 bool gameslist_sortascending;
104
105 int default_size;
106 int default_komi;
107 bool warn_about_codecs;
108 bool simple_player_names;
109
110 int default_stonesmaintime;
111 int default_stonestime;
112 int default_stones;
113 int default_byomaintime;
114 int default_byoperiodtime;
115 int default_byoperiods;
116 int default_asiamaintime;
117 int default_asiaperiodtime;
118 int default_asiaperiods;
119 void fill(void)
120 {
121 QSettings settings;
122 QVariant var;
123
124 nmatch_black = settings.value("NMATCH_BLACK").toBool();
125 nmatch_white = settings.value("NMATCH_WHITE").toBool();
126 nmatch_nigiri = settings.value("NMATCH_NIGIRI").toBool();
127 nmatch_handicap = settings.value("NMATCH_HANDICAP").toString();
128
129 draw_ko_marker = (settings.value("KOMARKER") == 1);
130 number_current_move = (settings.value("NUMBER_CURRENT_MOVE") == 1);
131 terr_stone_mark = (settings.value("TERR_STONE_MARK") == 1);
132 observe_outside_on_doubleclick = (settings.value("OBSERVEOUTSIDE") == 1);
133
134 playerslist_sortcolumn = settings.value("PLAYERSLIST_SORTCOLUMN").toInt();
135 playerslist_sortascending = settings.value("PLAYERSLIST_SORTASCENDING").toBool();
136 gameslist_sortcolumn = settings.value("GAMESLIST_SORTCOLUMN").toInt();
137 gameslist_sortascending = settings.value("GAMESLIST_SORTASCENDING").toBool();
138
139 default_size = settings.value("DEFAULT_SIZE").toInt();
140 default_komi = settings.value("DEFAULT_KOMI").toInt();
141 simple_player_names = settings.value("SIMPLEPLAYERNAMES").toBool();
142
143 warn_about_codecs = !settings.value("DONT_WARN_ABOUT_CODECS").toBool();
144
145 if((var = settings.value("DEFAULT_STONESMAIN")) == QVariant())
146 default_stonesmaintime = 600;
147 else
148 default_stonesmaintime = var.toInt();
149 if((var = settings.value("DEFAULT_STONEST")) == QVariant())
150 default_stonestime = 600;
151 else
152 default_stonestime = var.toInt();
153 if((var = settings.value("DEFAULT_STONES")) == QVariant())
154 default_stones = 25;
155 else
156 default_stones = var.toInt();
157 if((var = settings.value("DEFAULT_BYOMAIN")) == QVariant())
158 default_byomaintime = 600;
159 else
160 default_byomaintime = var.toInt();
161 if((var = settings.value("DEFAULT_BYOPERIODT")) == QVariant())
162 default_byoperiodtime = 30;
163 else
164 default_byoperiodtime = var.toInt();
165 if((var = settings.value("DEFAULT_BYOPERIODS")) == QVariant())
166 default_byoperiods = 3;
167 else
168 default_byoperiods = var.toInt();
169 if((var = settings.value("DEFAULT_TVASIAMAIN")) == QVariant())
170 default_asiamaintime = 30;
171 else
172 default_asiamaintime = var.toInt();
173 if((var = settings.value("DEFAULT_TVASIAPERIODT")) == QVariant())
174 default_asiaperiodtime = 30;
175 else
176 default_asiaperiodtime = var.toInt();
177 if((var = settings.value("DEFAULT_TVASIAPERIODS")) == QVariant())
178 default_asiaperiods = 4;
179 else
180 default_asiaperiods = var.toInt();
181
182
183 }
184 void save(void)
185 {
186 QSettings settings;
187
188 settings.setValue("PLAYERSLIST_SORTCOLUMN", playerslist_sortcolumn);
189 settings.setValue("PLAYERSLIST_SORTASCENDING", playerslist_sortascending);
190 settings.setValue("GAMESLIST_SORTCOLUMN", gameslist_sortcolumn);
191 settings.setValue("GAMESLIST_SORTASCENDING", gameslist_sortascending);
192
193 settings.setValue("DONT_WARN_ABOUT_CODECS", !warn_about_codecs);
194
195 settings.setValue("DEFAULT_STONESMAIN", default_stonesmaintime);
196 settings.setValue("DEFAULT_STONEST", default_stonestime);
197 settings.setValue("DEFAULT_STONES", default_stones);
198 settings.setValue("DEFAULT_BYOMAIN", default_byomaintime);
199 settings.setValue("DEFAULT_BYOPERIODT", default_byoperiodtime);
200 settings.setValue("DEFAULT_BYOPERIODS", default_byoperiods);
201 settings.setValue("DEFAULT_TVASIAMAIN", default_asiamaintime);
202 settings.setValue("DEFAULT_TVASIAPERIODT", default_asiaperiodtime);
203 settings.setValue("DEFAULT_TVASIAPERIODS", default_asiaperiods);
204 }
205 };
206
207 /* There's only one of each of these, and they're both
208 * used in weird places, so we'll make them global */
209 extern _preferences preferences;
210 extern class ConnectionWidget * connectionWidget;
211
212 #ifdef Q_OS_WIN
213 extern QString applicationPath;
214 #endif
215
216 #ifdef Q_OS_WIN
217 #define SOUND_PATH_PREFIX "sounds/"
218 #define TRANSLATIONS_PATH "translations/"
219 #elif defined(Q_OS_MAC)
220 #define SOUND_PATH_PREFIX "qGo.app/Contents/Resources/Sounds/"
221 #define TRANSLATIONS_PATH "qGo.app/Contents/Resources/Translations/"
222 #else
223 #define SOUND_PATH_PREFIX "/usr/share/qgo/sounds/"
224 #define TRANSLATIONS_PATH "/usr/share/qgo/languages"
225 #endif
226
227 #endif