source: tspsg-svn/trunk/src/globals.h @ 103

Last change on this file since 103 was 103, checked in by laleppa, 15 years ago

Merged with 0.1.2.100-alpha2 tag...

  • Property svn:keywords set to Id URL
File size: 3.8 KB
RevLine 
[67]1/*!
2 * \file globals.h
[97]3 * \author Copyright &copy; 2007-2010 Lёppa <contacts[at]oleksii[dot]name>
[21]4 *
5 *  $Id: globals.h 103 2010-04-08 22:58:55Z 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>
[98]34#include <limits>
[31]35
[42]36// Version info
37#include "version.h"
[54]38// OS and ARCH detection
[31]39#include "os.h"
[87]40// TSPSG Defaults
41#include "defaults.h"
[96]42#ifdef Q_OS_WIN32
43        // Vista/7 Eyecandy
44        #include "qtwin.h"
45#endif // Q_OS_WIN32
[31]46
47// DEFINES
[64]48//! Maximum available number of cities
[78]49#define MAX_NUM_CITIES 50
[64]50//! Maximum allowed value for random generation limits
[57]51#define MAX_RAND_VALUE 1000
52
53// Paths
[64]54/*!
[96]55 * \def PATH_L10N
[100]56 * \brief Path to internationalization files.
[64]57 */
[96]58#ifndef PATH_L10N
59        #define PATH_L10N "l10n"
60#endif // PATH_L10N
[64]61/*!
62 * \def PATH_DOCS
63 * \brief Bath to documentation files.
64 */
[96]65#ifndef PATH_DOCS
[57]66        #define PATH_DOCS "help"
[96]67#endif // PATH_DOCS
[57]68
[66]69//! TSPSG Task file signature - letters \c TSPT
[31]70#define TSPT quint32(0x54535054)
[64]71//! TSPSG Task file version
[31]72#define TSPT_VERSION quint8(1)
[64]73//! TSPSG Task file metadata version
[31]74#define TSPT_META_VERSION quint8(1)
[64]75//! TSPSG Task file metadata size in bytes (incl. version)
[31]76#define TSPT_META_SIZE 2
[66]77//! ZKomModRd Task file signature - letters \c ZK
[31]78#define ZKT quint16(0x5A4B)
[64]79//! ZKomModRd Task file version
[31]80#define ZKT_VERSION quint8(1)
81
[66]82/*!
83 * \def INFINITY
84 * \brief This value means infinity :-)
85 *
86 *  Some libraries already have \c INFINITY defined.
87 *  We need to redefine it for the \c INFINITY to always have the same value.
88 */
[64]89#ifdef INFINITY
90        #undef INFINITY
[27]91#endif
[98]92#define INFINITY std::numeric_limits<double>::infinity()
[64]93//! This string represents infinite value in the table
[42]94#define INFSTR "---"
[27]95
[81]96// FUNCTIONS
97/*!
[82]98 * \brief Checks whether \a x contains an integer value.
99 * \param x A value to check.
100 * \return \c true if \a x countains an integer, oherwise \c false.
[81]101 */
[89]102inline bool isInteger(double x)
[81]103{
[89]104double i;
[81]105        return (modf(x, &i) == 0.0);
106}
107
[98]108#ifdef Q_OS_WIN32
109/*!
110 * \brief Enables or disables a mask for the \a widget.
111 * \param widget A widget to toggle mask on.
112 * \param enable Set to \c true to enable mask or \c false to disable it.
113 *
114 *  This function is used to enable an outlined font effect for \c QLabel with a static text.
115 */
116void toggleStyle(QWidget *widget, bool enable);
117#endif // Q_OS_WIN32
118
[100]119#if defined(Q_OS_WINCE_WM) || defined(Q_OS_SYMBIAN)
120        //! This is defined on handheld (e.g., Windows Mobile, Symbian) devices.
121        #define HANDHELD
122#endif
123
[64]124// Sanity checks
[57]125// Check that default number of cities is sane (<= MAX_NUM_CITIES)
[50]126#if DEF_NUM_CITIES > MAX_NUM_CITIES
127        #undef DEF_NUM_CITIES
128        #define DEF_NUM_CITIES MAX_NUM_CITIES
129#endif
[57]130// Check that maximum for random generation is sane (<= MAX_RAND_VALUE)
131#if DEF_RAND_MAX > MAX_RAND_VALUE
132        #undef DEF_RAND_MAX
133        #define DEF_RAND_MAX MAX_RAND_VALUE
134#endif
135// Check that DEF_RAND_MIN <= DEF_RAND_MAX
136#if DEF_RAND_MIN > DEF_RAND_MAX
137        #undef DEF_RAND_MIN
138        #define DEF_RAND_MIN DEF_RAND_MAX
139#endif
[50]140
[31]141#endif // GLOBALS_H
Note: See TracBrowser for help on using the repository browser.