digiKam
digikam_globals.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2009-09-08
7  * Description : global macros, variables and flags
8  *
9  * Copyright (C) 2009-2010 by Andi Clemens <andi dot clemens at gmail dot com>
10  * Copyright (C) 2009-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_GLOBALS_H
26 #define DIGIKAM_GLOBALS_H
27 
28 // Qt includes
29 
30 #include <QStringList>
31 #include <QDateTime>
32 #include <QIODevice>
33 #include <QProcessEnvironment>
34 
35 // Local includes
36 
37 #include "digikam_export.h"
38 
39 class QWidget;
40 class QObject;
41 class QShortcut;
42 class QKeySequence;
43 class QApplication;
44 class QDate;
45 
49 #define CLAMP0255(a) qBound(0,a,255)
50 #define CLAMP065535(a) qBound(0,a,65535)
51 #define CLAMP(x,l,u) qBound(l,x,u)
52 #define MAX3(a, b, c) (qMax(qMax(a,b),c))
53 #define MIN3(a, b, c) (qMin(qMin(a,b),c))
54 
58 #define DEG2RAD 0.017453292519943
59 
63 #define QT_ENDL Qt::endl
64 
69 #define QT_KEEP_EMPTY_PARTS Qt::KeepEmptyParts
70 #define QT_SKIP_EMPTY_PARTS Qt::SkipEmptyParts
71 
72 namespace Digikam
73 {
74 
78 static const int RatingMin = 0;
79 static const int RatingMax = 5;
80 static const int NoRating = -1;
81 
82 // --------------------------------------------------------
83 
87 static const int NUM_SEGMENTS_16BIT = 65536;
88 static const int NUM_SEGMENTS_8BIT = 256;
89 static const int MAX_SEGMENT_16BIT = NUM_SEGMENTS_16BIT - 1;
90 static const int MAX_SEGMENT_8BIT = NUM_SEGMENTS_8BIT - 1;
91 
92 // --------------------------------------------------------
93 
98 static const int AUTOEXPANDDELAY = 800;
99 
100 // --------------------------------------------------------
101 
103 {
117 };
118 
119 // --------------------------------------------------------
120 
122 {
130 };
131 
132 // --------------------------------------------------------
133 
135 {
136  RGB = 0,
141  LRGBAC
142 };
143 
145 {
148 };
149 
151 {
154 };
155 
156 // --------------------------------------------------------
157 
159 {
166 };
167 
168 // --------------------------------------------------------
169 
173 DIGIKAM_EXPORT QShortcut* defineShortcut(QWidget* const w, const QKeySequence& key, const QObject* receiver, const char* slot);
174 
181 DIGIKAM_EXPORT QStringList supportedImageMimeTypes(QIODevice::OpenModeFlag mode, QString& allTypes);
182 
186 DIGIKAM_EXPORT bool isReadableImageFile(const QString& filePath);
187 
191 DIGIKAM_EXPORT void showRawCameraList();
192 
196 DIGIKAM_EXPORT QString toolButtonStyleSheet();
197 
198 // --- Static functions for the bundles ---
199 
203 DIGIKAM_EXPORT bool isRunningInAppImageBundle();
204 
212 DIGIKAM_EXPORT QProcessEnvironment adjustedEnvironmentForAppImage();
213 
218 DIGIKAM_EXPORT void tryInitDrMingw();
219 
223 DIGIKAM_EXPORT QString macOSBundlePrefix();
224 
228 DIGIKAM_EXPORT void unloadQtTranslationFiles(QApplication& app);
229 
233 DIGIKAM_EXPORT void loadStdQtTranslationFiles(QApplication& app);
234 
238 DIGIKAM_EXPORT void loadEcmQtTranslationFiles(QApplication& app);
239 
243 DIGIKAM_EXPORT void installQtTranslationFiles(QApplication& app);
244 
248 DIGIKAM_EXPORT QDateTime startOfDay(const QDate&);
249 
250 } // namespace Digikam
251 
252 #endif // DIGIKAM_GLOBALS_H
Definition: datefolderview.cpp:43
ChannelType
Definition: digikam_globals.h:159
@ ColorChannels
Definition: digikam_globals.h:165
@ GreenChannel
Definition: digikam_globals.h:162
@ RedChannel
Definition: digikam_globals.h:161
@ AlphaChannel
Definition: digikam_globals.h:164
@ LuminosityChannel
Definition: digikam_globals.h:160
@ BlueChannel
Definition: digikam_globals.h:163
QString toolButtonStyleSheet()
Definition: digikam_globals.cpp:196
HistogramRenderingType
Definition: digikam_globals.h:151
@ FullImageHistogram
Full image histogram rendering.
Definition: digikam_globals.h:152
@ ImageSelectionHistogram
Image selection histogram rendering.
Definition: digikam_globals.h:153
HistogramBoxType
Definition: digikam_globals.h:135
@ LRGBAC
Definition: digikam_globals.h:141
@ LRGBA
Definition: digikam_globals.h:139
@ RGBA
Definition: digikam_globals.h:137
@ RGB
Definition: digikam_globals.h:136
@ LRGB
Definition: digikam_globals.h:138
@ LRGBC
Definition: digikam_globals.h:140
DIGIKAM_EXPORT void tryInitDrMingw()
Definition: digikam_globals_bundles.cpp:148
QShortcut * defineShortcut(QWidget *const w, const QKeySequence &key, const QObject *receiver, const char *slot)
Definition: digikam_globals.cpp:29
bool isReadableImageFile(const QString &filePath)
Definition: digikam_globals.cpp:162
DIGIKAM_EXPORT void loadStdQtTranslationFiles(QApplication &app)
Definition: digikam_globals_bundles.cpp:244
void showRawCameraList()
Definition: digikam_globals.cpp:190
HistogramScale
Definition: digikam_globals.h:145
@ LinScaleHistogram
Linear scale.
Definition: digikam_globals.h:146
@ LogScaleHistogram
Logarithmic scale.
Definition: digikam_globals.h:147
DIGIKAM_EXPORT bool isRunningInAppImageBundle()
Definition: digikam_globals_bundles.cpp:29
DIGIKAM_EXPORT void loadEcmQtTranslationFiles(QApplication &app)
Definition: digikam_globals_bundles.cpp:318
DIGIKAM_EXPORT QProcessEnvironment adjustedEnvironmentForAppImage()
Definition: digikam_globals_bundles.cpp:44
QDateTime startOfDay(const QDate &date)
Definition: digikam_globals.cpp:223
ColorLabel
Definition: digikam_globals.h:103
@ LastColorLabel
Definition: digikam_globals.h:115
@ BlackLabel
Definition: digikam_globals.h:112
@ RedLabel
Definition: digikam_globals.h:105
@ NumberOfColorLabels
Definition: digikam_globals.h:116
@ WhiteLabel
Definition: digikam_globals.h:113
@ GrayLabel
Definition: digikam_globals.h:111
@ GreenLabel
Definition: digikam_globals.h:108
@ FirstColorLabel
Definition: digikam_globals.h:114
@ BlueLabel
Definition: digikam_globals.h:109
@ YellowLabel
Definition: digikam_globals.h:107
@ OrangeLabel
Definition: digikam_globals.h:106
@ MagentaLabel
Definition: digikam_globals.h:110
@ NoColorLabel
Definition: digikam_globals.h:104
DIGIKAM_EXPORT void unloadQtTranslationFiles(QApplication &app)
Definition: digikam_globals_bundles.cpp:221
DIGIKAM_EXPORT void installQtTranslationFiles(QApplication &app)
Definition: digikam_globals_bundles.cpp:449
PickLabel
Definition: digikam_globals.h:122
@ FirstPickLabel
Definition: digikam_globals.h:127
@ NoPickLabel
Definition: digikam_globals.h:123
@ AcceptedLabel
Definition: digikam_globals.h:126
@ LastPickLabel
Definition: digikam_globals.h:128
@ PendingLabel
Definition: digikam_globals.h:125
@ RejectedLabel
Definition: digikam_globals.h:124
@ NumberOfPickLabels
Definition: digikam_globals.h:129
QStringList supportedImageMimeTypes(QIODevice::OpenModeFlag mode, QString &allTypes)
Definition: digikam_globals.cpp:39
DIGIKAM_EXPORT QString macOSBundlePrefix()
Definition: digikam_globals_bundles.cpp:216