source: tspsg/src/globals.h @ 2940c14782

appveyorimgbotreadme
Last change on this file since 2940c14782 was 2940c14782, checked in by Oleksii Serdiuk, 11 years ago

Relicensed TSP Solver and Generator under GPLv2 license.

Due to potential conflicts between GPLv3 and app stores.

  • Property mode set to 100644
File size: 4.5 KB
Line 
1/*!
2 * \file globals.h
3 * \author Copyright &copy; 2007-2013 Oleksii Serdiuk <contacts[at]oleksii[dot]name>
4 *
5 *  $Id: $Format:%h %ai %an$ $
6 *  $URL: http://tspsg.info/ $
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 2 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 <QtGlobal>
33#if QT_VERSION < QT_VERSION_CHECK(4,5,0)
34#   error You are using Qt version < 4.5 but minimum required version is 4.5.0. Compilation aborted.
35#endif
36#if defined(Q_OS_WINCE_WM) || defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
37    //! This is defined on handheld devices (e.g., Windows Mobile, Symbian).
38#   define HANDHELD
39#   define QT_NO_STATUSTIP
40#endif
41#if defined(QT_NO_SVG) && !defined(NOSVG)
42#   define NOSVG
43#endif
44
45// TSPSG Defaults
46#include "defaults.h"
47
48// DEFINES
49//! Maximum available number of cities
50#define MAX_NUM_CITIES 50
51//! Maximum allowed value for random generation limits
52#define MAX_RAND_VALUE 1000
53
54// Paths
55/*!
56 * \def PATH_L10N
57 * \brief Path to internationalization files.
58 */
59#ifndef PATH_L10N
60#   define PATH_L10N "l10n"
61#endif // PATH_L10N
62/*!
63 * \def PATH_DOCS
64 * \brief Path to documentation files.
65 */
66#ifndef PATH_DOCS
67#   define PATH_DOCS "help"
68#endif // PATH_DOCS
69
70//! TSPSG Task file signature - letters \c TSPT
71#define TSPT quint32(0x54535054)
72//! TSPSG Task file version
73#define TSPT_VERSION quint8(1)
74//! TSPSG Task file metadata version
75#define TSPT_META_VERSION quint8(1)
76//! TSPSG Task file metadata size in bytes (incl. version)
77#define TSPT_META_SIZE 2
78//! ZKomModRd Task file signature - letters \c ZK
79#define ZKT quint16(0x5A4B)
80//! ZKomModRd Task file version
81#define ZKT_VERSION quint8(1)
82
83//! This string represents infinite value in the table
84#define INFSTR "---"
85
86//! Number of centimeters in 1 inch
87#define CM_IN_INCH 2.54
88//! Factor for high quality graph generation
89#define HQ_FACTOR 2
90
91/*!
92 * \brief Checks whether the updater app is installed/available.
93 * \return \c true if updater app is available, oherwise \c false.
94 * \note The updater app is only available under Windows at this moment.
95 *  On other systems this function always returns \c false.
96 */
97bool hasUpdater();
98
99class QSettings;
100class QObject;
101/*!
102 * \brief Creates QSettings instance with TSPSG-specific options.
103 * \param parent A QObject which will become parent for new QSetting instance.
104 * \return A pointer to new QSettings instance.
105 */
106QSettings *initSettings(QObject *parent);
107
108#ifndef HANDHELD
109class QWidget;
110/*!
111 * \brief Enables or disables a mask for the \a widget.
112 * \param widget A widget to toggle mask on.
113 * \param enable Set to \c true to enable mask or \c false to disable it.
114 *
115 *  This function is used to enable an outlined font effect for \c QLabel with a static text.
116 */
117void toggleStyle(QWidget *widget, bool enable);
118#endif // HANDHELD
119
120#ifndef DOXYGEN_EXCLUDE
121
122#ifdef HANDHELD
123#   define ICON_SIZE "48x48"
124#   define ICON_FORMAT "png"
125#else
126#   define ICON_SIZE "128x128"
127#   define ICON_FORMAT "png"
128#endif
129
130#if QT_VERSION >= QT_VERSION_CHECK(4,6,0)
131#   define GET_ICON(x) QIcon::fromTheme(x, QIcon(":/images/icons/"ICON_SIZE"/"x"."ICON_FORMAT))
132#else
133#   define GET_ICON(x) QIcon(":/images/icons/"ICON_SIZE"/"x"."ICON_FORMAT)
134// No QVariant::toReal() member in Qt < 4.6
135// A quick hack to maintain compatibility with Qt 4.5.x
136#   define toReal toDouble
137#endif
138
139// Sanity checks
140// Check that default number of cities is sane (<= MAX_NUM_CITIES)
141#if DEF_NUM_CITIES > MAX_NUM_CITIES
142#   undef DEF_NUM_CITIES
143#   define DEF_NUM_CITIES MAX_NUM_CITIES
144#endif
145// Check that maximum for random generation is sane (<= MAX_RAND_VALUE)
146#if DEF_RAND_MAX > MAX_RAND_VALUE
147#   undef DEF_RAND_MAX
148#   define DEF_RAND_MAX MAX_RAND_VALUE
149#endif
150// Check that DEF_RAND_MIN <= DEF_RAND_MAX
151#if DEF_RAND_MIN > DEF_RAND_MAX
152#   undef DEF_RAND_MIN
153#   define DEF_RAND_MIN DEF_RAND_MAX
154#endif
155
156#endif // DOXYGEN_EXCLUDE
157
158#endif // GLOBALS_H
Note: See TracBrowser for help on using the repository browser.