source: tspsg/src/globals.h @ 0948070876

appveyorimgbotreadme
Last change on this file since 0948070876 was 7ed8b57eea, checked in by Oleksii Serdiuk, 11 years ago

[BB10] UI fixes:

  • added proxy style and stylesheet to fix some UI issues on BlackBerry?;
  • removed style selection option because most styles have UI issues and removed About Qt menu item because About Qt dialog is too big;
  • load bigger (128x128) icons on BlackBerry? 10;
  • removed printing related items from menu as there's no printer;
  • made dialogs to be shown maximized;
  • made solution graph smaller;
  • made font smaller;
  • made output text color black;
  • start editing table cells on single tap;
  • don't show keyboard in about dialog.

Cherry-picks from
aa64ad40827cde0a444cd8198b0f3457aa191f8f
95b0ef73dcb4517ac2ae08867494204bbe8d7ea6
ccdffe3a5f84f12fba2e2f19ab249c31f1fcf35d
628500a5d687889823197e476953859d529af4f0

  • Property mode set to 100644
File size: 4.6 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) || defined(Q_OS_BLACKBERRY)
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#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
Note: See TracBrowser for help on using the repository browser.