source: tspsg/src/globals.h @ e2abfd326f

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

+ Translatable About dialog.

  • Improved installation rules in .pro file.
  • Disabled SVG and JPEG support. They aren't needed at this point.
  • Fixed a bug when labels were hardly visible under Windows Vista/7 whith translucency on and a dark background behind the application.
  • Fixed a bug when Main Window area was blank if the application was compiled using Qt < 4.6.0.
  • Property mode set to 100644
File size: 3.6 KB
RevLine 
[e0fcac5f2c]1/*!
2 * \file globals.h
[f19df0a3e5]3 * \author Copyright &copy; 2007-2010 Lёppa <contacts[at]oleksii[dot]name>
[aecdf994f9]4 *
5 *  $Id$
6 *  $URL$
7 *
[e0fcac5f2c]8 * \brief Contains TSPSG global defines.
9 *
10 *  <b>TSPSG: TSP Solver and Generator</b>
11 *
[aecdf994f9]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
[993d5af6f6]28#ifndef GLOBALS_H
29#define GLOBALS_H
[aecdf994f9]30
[993d5af6f6]31// INCLUDES
32#include <QtCore>
33#include <QtGui>
[e2abfd326f]34#include <limits>
[993d5af6f6]35
[430bd7f7e9]36// Version info
37#include "version.h"
[c10297cf73]38// OS and ARCH detection
[993d5af6f6]39#include "os.h"
[1757eb594b]40// TSPSG Defaults
41#include "defaults.h"
[162d5c5f94]42#ifdef Q_OS_WIN32
43        // Vista/7 Eyecandy
44        #include "qtwin.h"
45#endif // Q_OS_WIN32
[993d5af6f6]46
47// DEFINES
[bc1b8837b6]48//! Maximum available number of cities
[1fbf016a09]49#define MAX_NUM_CITIES 50
[bc1b8837b6]50//! Maximum allowed value for random generation limits
[2fb523720a]51#define MAX_RAND_VALUE 1000
52
53// Paths
[bc1b8837b6]54/*!
[162d5c5f94]55 * \def PATH_L10N
[bc1b8837b6]56 * \brief Bath to internationalization files.
57 */
[162d5c5f94]58#ifndef PATH_L10N
59        #define PATH_L10N "l10n"
60#endif // PATH_L10N
[bc1b8837b6]61/*!
62 * \def PATH_DOCS
63 * \brief Bath to documentation files.
64 */
[162d5c5f94]65#ifndef PATH_DOCS
[2fb523720a]66        #define PATH_DOCS "help"
[162d5c5f94]67#endif // PATH_DOCS
[2fb523720a]68
[85ad815b0b]69//! TSPSG Task file signature - letters \c TSPT
[993d5af6f6]70#define TSPT quint32(0x54535054)
[bc1b8837b6]71//! TSPSG Task file version
[993d5af6f6]72#define TSPT_VERSION quint8(1)
[bc1b8837b6]73//! TSPSG Task file metadata version
[993d5af6f6]74#define TSPT_META_VERSION quint8(1)
[bc1b8837b6]75//! TSPSG Task file metadata size in bytes (incl. version)
[993d5af6f6]76#define TSPT_META_SIZE 2
[85ad815b0b]77//! ZKomModRd Task file signature - letters \c ZK
[993d5af6f6]78#define ZKT quint16(0x5A4B)
[bc1b8837b6]79//! ZKomModRd Task file version
[993d5af6f6]80#define ZKT_VERSION quint8(1)
81
[85ad815b0b]82/*!
83 * \def INFINITY
84 * \brief This value means infinity :-)
85 *
86 *  Some libraries already have \c INFINITY defined.
87 *  We need to redefine it for the \c INFINITY to always have the same value.
88 */
[bc1b8837b6]89#ifdef INFINITY
90        #undef INFINITY
[5587b87fac]91#endif
[e2abfd326f]92#define INFINITY std::numeric_limits<double>::infinity()
[bc1b8837b6]93//! This string represents infinite value in the table
[430bd7f7e9]94#define INFSTR "---"
[5587b87fac]95
[f1fb54b9f7]96// FUNCTIONS
97/*!
[946f442ab0]98 * \brief Checks whether \a x contains an integer value.
99 * \param x A value to check.
100 * \return \c true if \a x countains an integer, oherwise \c false.
[f1fb54b9f7]101 */
[e4ae9e95f7]102inline bool isInteger(double x)
[f1fb54b9f7]103{
[e4ae9e95f7]104double i;
[f1fb54b9f7]105        return (modf(x, &i) == 0.0);
106}
107
[e2abfd326f]108#ifdef Q_OS_WIN32
109/*!
110 * \brief Enables or disables a mask for the \a widget.
111 * \param widget A widget to toggle mask on.
112 * \param enable Set to \c true to enable mask or \c false to disable it.
113 *
114 *  This function is used to enable an outlined font effect for \c QLabel with a static text.
115 */
116void toggleStyle(QWidget *widget, bool enable);
117#endif // Q_OS_WIN32
118
[bc1b8837b6]119// Sanity checks
[2fb523720a]120// Check that default number of cities is sane (<= MAX_NUM_CITIES)
[aaf2113307]121#if DEF_NUM_CITIES > MAX_NUM_CITIES
122        #undef DEF_NUM_CITIES
123        #define DEF_NUM_CITIES MAX_NUM_CITIES
124#endif
[2fb523720a]125// Check that maximum for random generation is sane (<= MAX_RAND_VALUE)
126#if DEF_RAND_MAX > MAX_RAND_VALUE
127        #undef DEF_RAND_MAX
128        #define DEF_RAND_MAX MAX_RAND_VALUE
129#endif
130// Check that DEF_RAND_MIN <= DEF_RAND_MAX
131#if DEF_RAND_MIN > DEF_RAND_MAX
132        #undef DEF_RAND_MIN
133        #define DEF_RAND_MIN DEF_RAND_MAX
134#endif
[aaf2113307]135
[993d5af6f6]136#endif // GLOBALS_H
Note: See TracBrowser for help on using the repository browser.