source: tspsg/src/globals.h @ 7bb19df196

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

Finished toolbar customization feature.
It is not available on handheld devices (mainly, because the customization dialog is too big for a small screen).

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