source: tspsg/src/globals.h @ ca3d2a30fa

0.1.3.145-beta1-symbian0.1.4.170-beta2-bb10appveyorimgbotreadme
Last change on this file since ca3d2a30fa was ca3d2a30fa, checked in by Oleksii Serdiuk, 15 years ago

+ Implemented saving the solution graph when saving solution as HTML (in SVG format).

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