source: tspsg-svn/trunk/src/globals.h @ 82

Last change on this file since 82 was 82, checked in by laleppa, 15 years ago

+ Added the ability to select between using Native and Qt's File Dialog.

  • Updated translations to reflect changes.
  • Property svn:keywords set to Id URL
File size: 4.5 KB
RevLine 
[67]1/*!
2 * \file globals.h
3 * \author Copyright (C) 2007-2009 Lёppa <contacts[at]oleksii[dot]name>
[21]4 *
5 *  $Id: globals.h 82 2010-01-07 14:48:24Z laleppa $
6 *  $URL: https://tspsg.svn.sourceforge.net/svnroot/tspsg/trunk/src/globals.h $
7 *
[67]8 * \brief Contains TSPSG global defines.
9 *
10 *  <b>TSPSG: TSP Solver and Generator</b>
11 *
[21]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
[31]28#ifndef GLOBALS_H
29#define GLOBALS_H
[21]30
[31]31// INCLUDES
32#include <QtCore>
33#include <QtGui>
34
[42]35// Version info
36#include "version.h"
[54]37// OS and ARCH detection
[31]38#include "os.h"
39
40// DEFINES
[21]41// Default values
[64]42//! Default minimum for random numbers generation
[21]43#define DEF_RAND_MIN 1
[64]44//! Default maximum for random numbers generation
[21]45#define DEF_RAND_MAX 10
[64]46//! Default number of cities
[50]47#define DEF_NUM_CITIES 5
[82]48/*!
49 * \def DEF_USE_NATIVE_DIALOGS
50 * \brief Default for "Use native file dialog".
51 */
52#ifdef Q_OS_WINCE
53        #define DEF_USE_NATIVE_DIALOGS false
54#else
55        #define DEF_USE_NATIVE_DIALOGS true
56#endif // Q_OS_WINCE
57//! Default for "Automatically resize rows and columns to their contents"
58#define DEF_AUTOSIZE true
59//! Default for "Save main window state and position"
60#define DEF_SAVEPOS false
61//! Default for "Fractional random values"
[81]62#define DEF_FRACTIONAL_RANDOM false
[82]63//! Default for "Show solution steps' matrices for every solution step"
[78]64#define DEF_SHOW_MATRIX true
[82]65//! Default for "Show or hide solution steps' matrices based on number of cities in the task"
[78]66#define DEF_USE_SHOW_MATRIX_LIMIT true
[82]67//! Default for "Maximum number of cities to show solution steps' matrices"
68#define DEF_SHOW_MATRIX_LIMIT 15
69//! Default for "Scroll to the end of output after solving"
[81]70#define DEF_SCROLL_TO_END true
[64]71//! Default font name
[21]72#define DEF_FONT_FAMILY "Courier New"
[64]73//! Default font size
[42]74#define DEF_FONT_SIZE 10
[64]75//! Default font color
[21]76#define DEF_FONT_COLOR Qt::black
77
[64]78//! Maximum available number of cities
[78]79#define MAX_NUM_CITIES 50
[64]80//! Maximum allowed value for random generation limits
[57]81#define MAX_RAND_VALUE 1000
82
83// Paths
[64]84/*!
85 * \def PATH_I18N
86 * \brief Bath to internationalization files.
87 */
88/*!
89 * \def PATH_DOCS
90 * \brief Bath to documentation files.
91 */
[57]92#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
93        #define PATH_I18N "/usr/share/tspsg/i18n"
94        #define PATH_DOCS "/usr/share/doc/tspsg"
95#else
96        #define PATH_I18N "i18n"
97        #define PATH_DOCS "help"
98#endif // Q_OS_LINUX
99
[66]100//! TSPSG Task file signature - letters \c TSPT
[31]101#define TSPT quint32(0x54535054)
[64]102//! TSPSG Task file version
[31]103#define TSPT_VERSION quint8(1)
[64]104//! TSPSG Task file metadata version
[31]105#define TSPT_META_VERSION quint8(1)
[64]106//! TSPSG Task file metadata size in bytes (incl. version)
[31]107#define TSPT_META_SIZE 2
[66]108//! ZKomModRd Task file signature - letters \c ZK
[31]109#define ZKT quint16(0x5A4B)
[64]110//! ZKomModRd Task file version
[31]111#define ZKT_VERSION quint8(1)
112
[66]113/*!
114 * \def INFINITY
115 * \brief This value means infinity :-)
116 *
117 *  Some libraries already have \c INFINITY defined.
118 *  We need to redefine it for the \c INFINITY to always have the same value.
119 */
[64]120#ifdef INFINITY
121        #undef INFINITY
[27]122#endif
[64]123#define INFINITY 1.7E+308
124//! This string represents infinite value in the table
[42]125#define INFSTR "---"
[27]126
[81]127// FUNCTIONS
128/*!
[82]129 * \brief Checks whether \a x contains an integer value.
130 * \param x A value to check.
131 * \return \c true if \a x countains an integer, oherwise \c false.
[81]132 */
133inline bool isInteger(double x)
134{
135double i;
136        return (modf(x, &i) == 0.0);
137}
138
[64]139// Sanity checks
[57]140// Check that default number of cities is sane (<= MAX_NUM_CITIES)
[50]141#if DEF_NUM_CITIES > MAX_NUM_CITIES
142        #undef DEF_NUM_CITIES
143        #define DEF_NUM_CITIES MAX_NUM_CITIES
144#endif
[57]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
[50]155
[31]156#endif // GLOBALS_H
Note: See TracBrowser for help on using the repository browser.