TSP Solver and Generator
globals.h
Go to the documentation of this file.
1 
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) || defined(Q_OS_BLACKBERRY)
37 # 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
50 #define MAX_NUM_CITIES 50
51 #define MAX_RAND_VALUE 1000
53 
54 // Paths
59 #ifndef PATH_L10N
60 # define PATH_L10N "l10n"
61 #endif // PATH_L10N
62 
66 #ifndef PATH_DOCS
67 # define PATH_DOCS "help"
68 #endif // PATH_DOCS
69 
71 #define TSPT quint32(0x54535054)
72 #define TSPT_VERSION quint8(1)
74 #define TSPT_META_VERSION quint8(1)
76 #define TSPT_META_SIZE 2
78 #define ZKT quint16(0x5A4B)
80 #define ZKT_VERSION quint8(1)
82 
84 #define INFSTR "---"
85 
87 #define CM_IN_INCH 2.54
88 #define HQ_FACTOR 2
90 
97 bool hasUpdater();
98 
99 class QSettings;
100 class QObject;
107 
108 #ifndef HANDHELD
109 class QWidget;
117 void toggleStyle(QWidget *widget, bool enable);
118 #endif // HANDHELD
119 
120 #ifndef DOXYGEN_EXCLUDE
121 
122 #if defined(HANDHELD) && !defined(Q_OS_BLACKBERRY)
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
QSettings * initSettings(QObject *parent)
Creates QSettings instance with TSPSG-specific options.
Definition: globals.cpp:44
bool hasUpdater()
Checks whether the updater app is installed/available.
Definition: globals.cpp:35
QObject * parent() const
void toggleStyle(QWidget *widget, bool enable)
Enables or disables a mask for the widget.
Definition: globals.cpp:66
Contains TSPSG defaults.