1 | /* |
---|
2 | * TSPSG: TSP Solver and Generator |
---|
3 | * Copyright (C) 2007-2009 Lёppa <contacts[at]oleksii[dot]name> |
---|
4 | * |
---|
5 | * $Id: globals.h 64 2009-10-20 09:40:16Z laleppa $ |
---|
6 | * $URL: https://tspsg.svn.sourceforge.net/svnroot/tspsg/trunk/src/globals.h $ |
---|
7 | * |
---|
8 | * This file is part of TSPSG. |
---|
9 | * |
---|
10 | * TSPSG is free software: you can redistribute it and/or modify |
---|
11 | * it under the terms of the GNU General Public License as published by |
---|
12 | * the Free Software Foundation, either version 3 of the License, or |
---|
13 | * (at your option) any later version. |
---|
14 | * |
---|
15 | * TSPSG is distributed in the hope that it will be useful, |
---|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
18 | * GNU General Public License for more details. |
---|
19 | * |
---|
20 | * You should have received a copy of the GNU General Public License |
---|
21 | * along with TSPSG. If not, see <http://www.gnu.org/licenses/>. |
---|
22 | */ |
---|
23 | |
---|
24 | #ifndef GLOBALS_H |
---|
25 | #define GLOBALS_H |
---|
26 | |
---|
27 | /*! |
---|
28 | * \file globals.h |
---|
29 | * \brief This file contains TSPSG global defines. |
---|
30 | */ |
---|
31 | |
---|
32 | // INCLUDES |
---|
33 | #include <QtCore> |
---|
34 | #include <QtGui> |
---|
35 | |
---|
36 | // Version info |
---|
37 | #include "version.h" |
---|
38 | // OS and ARCH detection |
---|
39 | #include "os.h" |
---|
40 | |
---|
41 | // DEFINES |
---|
42 | // Default values |
---|
43 | //! Default minimum for random numbers generation |
---|
44 | #define DEF_RAND_MIN 1 |
---|
45 | //! Default maximum for random numbers generation |
---|
46 | #define DEF_RAND_MAX 10 |
---|
47 | //! Default number of cities |
---|
48 | #define DEF_NUM_CITIES 5 |
---|
49 | //! Default font name |
---|
50 | #define DEF_FONT_FAMILY "Courier New" |
---|
51 | //! Default font size |
---|
52 | #define DEF_FONT_SIZE 10 |
---|
53 | //! Default font color |
---|
54 | #define DEF_FONT_COLOR Qt::black |
---|
55 | |
---|
56 | //! Maximum available number of cities |
---|
57 | #define MAX_NUM_CITIES 30 |
---|
58 | //! Maximum allowed value for random generation limits |
---|
59 | #define MAX_RAND_VALUE 1000 |
---|
60 | |
---|
61 | // Paths |
---|
62 | /*! |
---|
63 | * \def PATH_I18N |
---|
64 | * \brief Bath to internationalization files. |
---|
65 | */ |
---|
66 | /*! |
---|
67 | * \def PATH_DOCS |
---|
68 | * \brief Bath to documentation files. |
---|
69 | */ |
---|
70 | #if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) |
---|
71 | #define PATH_I18N "/usr/share/tspsg/i18n" |
---|
72 | #define PATH_DOCS "/usr/share/doc/tspsg" |
---|
73 | #else |
---|
74 | #define PATH_I18N "i18n" |
---|
75 | #define PATH_DOCS "help" |
---|
76 | #endif // Q_OS_LINUX |
---|
77 | |
---|
78 | //! TSPSG Task file signature - letters \p TSPT |
---|
79 | #define TSPT quint32(0x54535054) |
---|
80 | //! TSPSG Task file version |
---|
81 | #define TSPT_VERSION quint8(1) |
---|
82 | //! TSPSG Task file metadata version |
---|
83 | #define TSPT_META_VERSION quint8(1) |
---|
84 | //! TSPSG Task file metadata size in bytes (incl. version) |
---|
85 | #define TSPT_META_SIZE 2 |
---|
86 | //! ZKomModRd Task file signature - letters \p ZK |
---|
87 | #define ZKT quint16(0x5A4B) |
---|
88 | //! ZKomModRd Task file version |
---|
89 | #define ZKT_VERSION quint8(1) |
---|
90 | |
---|
91 | // Some libraries already have INFINITY defined. |
---|
92 | // We need to undefine it for INFINITY to have always the same value. |
---|
93 | #ifdef INFINITY |
---|
94 | #undef INFINITY |
---|
95 | #endif |
---|
96 | //! This value means infinity :-) |
---|
97 | #define INFINITY 1.7E+308 |
---|
98 | //! This string represents infinite value in the table |
---|
99 | #define INFSTR "---" |
---|
100 | |
---|
101 | // Sanity checks |
---|
102 | // Check that default number of cities is sane (<= MAX_NUM_CITIES) |
---|
103 | #if DEF_NUM_CITIES > MAX_NUM_CITIES |
---|
104 | #undef DEF_NUM_CITIES |
---|
105 | #define DEF_NUM_CITIES MAX_NUM_CITIES |
---|
106 | #endif |
---|
107 | // Check that maximum for random generation is sane (<= MAX_RAND_VALUE) |
---|
108 | #if DEF_RAND_MAX > MAX_RAND_VALUE |
---|
109 | #undef DEF_RAND_MAX |
---|
110 | #define DEF_RAND_MAX MAX_RAND_VALUE |
---|
111 | #endif |
---|
112 | // Check that DEF_RAND_MIN <= DEF_RAND_MAX |
---|
113 | #if DEF_RAND_MIN > DEF_RAND_MAX |
---|
114 | #undef DEF_RAND_MIN |
---|
115 | #define DEF_RAND_MIN DEF_RAND_MAX |
---|
116 | #endif |
---|
117 | |
---|
118 | #endif // GLOBALS_H |
---|