source: tspsg/src/globals.h @ 94cd045fad

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

+ Started adding a toolbar customization with the ude of QtToolbarDialog? (http://qt.nokia.com/products/appdev/add-on-products/catalog/4/Widgets/qttoolbardialog/).

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