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