1 /**
2  * Mandelbulber v2, a 3D fractal generator       ,=#MKNmMMKmmßMNWy,
3  *                                             ,B" ]L,,p%%%,,,§;, "K
4  * Copyright (C) 2014-21 Mandelbulber Team     §R-==%w["'~5]m%=L.=~5N
5  *                                        ,=mm=§M ]=4 yJKA"/-Nsaj  "Bw,==,,
6  * This file is part of Mandelbulber.    §R.r= jw",M  Km .mM  FW ",§=ß., ,TN
7  *                                     ,4R =%["w[N=7]J '"5=],""]]M,w,-; T=]M
8  * Mandelbulber is free software:     §R.ß~-Q/M=,=5"v"]=Qf,'§"M= =,M.§ Rz]M"Kw
9  * you can redistribute it and/or     §w "xDY.J ' -"m=====WeC=\ ""%""y=%"]"" §
10  * modify it under the terms of the    "§M=M =D=4"N #"%==A%p M§ M6  R' #"=~.4M
11  * GNU General Public License as        §W =, ][T"]C  §  § '§ e===~ U  !§[Z ]N
12  * published by the                    4M",,Jm=,"=e~  §  §  j]]""N  BmM"py=ßM
13  * Free Software Foundation,          ]§ T,M=& 'YmMMpM9MMM%=w=,,=MT]M m§;'§,
14  * either version 3 of the License,    TWw [.j"5=~N[=§%=%W,T ]R,"=="Y[LFT ]N
15  * or (at your option)                   TW=,-#"%=;[  =Q:["V""  ],,M.m == ]N
16  * any later version.                      J§"mr"] ,=,," =="""J]= M"M"]==ß"
17  *                                          §= "=C=4 §"eM "=B:m|4"]#F,§~
18  * Mandelbulber is distributed in            "9w=,,]w em%wJ '"~" ,=,,ß"
19  * the hope that it will be useful,                 . "K=  ,=RMMMßM"""
20  * but WITHOUT ANY WARRANTY;                            .'''
21  * without even the implied warranty
22  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23  *
24  * See the GNU General Public License for more details.
25  * You should have received a copy of the GNU General Public License
26  * along with Mandelbulber. If not, see <http://www.gnu.org/licenses/>.
27  *
28  * ###########################################################################
29  *
30  * Authors: Krzysztof Marczak (buddhi1980@gmail.com)
31  *
32  * system data - place for system functions and definition of default file paths
33  */
34 
35 #ifndef MANDELBULBER2_SRC_SYSTEM_HPP_
36 #define MANDELBULBER2_SRC_SYSTEM_HPP_
37 
38 #define MANDELBULBER_VERSION 2.26
39 #define MANDELBULBER_VERSION_STRING "2.26"
40 
41 #define DO_QUOTE(X) #X
42 #define QUOTE(X) DO_QUOTE(X)
43 
44 #ifndef SHARED_DIR
45 #ifdef CUSTOM_PREFIX
46 #define SHARED_DIR QUOTE(CUSTOM_PREFIX) "/share/mandelbulber2"
47 #endif
48 #endif
49 
50 #ifndef SHARED_DOC_DIR
51 #ifdef CUSTOM_PREFIX
52 #define SHARED_DOC_DIR QUOTE(CUSTOM_PREFIX) "/share/doc/mandelbulber2"
53 #endif
54 #endif
55 
56 #ifdef _WIN32 /* WINDOWS */
57 // #include <windows.h>
58 #define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
59 #endif
60 
61 #ifndef SHARED_DIR
62 #ifdef _WIN32
63 #elif __APPLE__
64 #define SHARED_DIR QDir::homePath() + "/share/mandelbulber2"
65 #endif
66 #endif
67 
68 #ifndef SHARED_DOC_DIR
69 #ifdef _WIN32
70 #elif __APPLE__
71 #define SHARED_DOC_DIR QDir::homePath() + "/share/doc/mandelbulber2"
72 #endif
73 #endif
74 
75 #include <cstdio>
76 #include <cstdlib>
77 #include <utility>
78 
79 #include <QApplication>
80 #include <QElapsedTimer>
81 #include <QFileInfo>
82 #include <QThread>
83 
84 // compatibility with qt version < 5.5
85 #ifndef qInfo
86 #define qInfo qDebug
87 #endif
88 
89 using namespace std;
90 
91 bool InitSystem();
92 void handle_winch(int sig);
93 int get_cpu_count();
94 bool CreateDefaultFolders();
95 void ClearNetRenderCache();
96 void DeleteOldChache(const QString &directoryPath, int days);
97 bool CreateFolder(const QString &name);
98 void DeleteAllFilesFromDirectory(const QString &folder, const QString &filterExpression,
99 	QRegExp::PatternSyntax pattern = QRegExp::Wildcard);
100 void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg);
101 void UpdateDefaultPaths();
102 void UpdateUIStyle();
103 void UpdateUISkin();
104 void UpdateLanguage();
105 void RetrieveToolbarPresets(bool force);
106 void RetrieveExampleMaterials(bool force);
107 void CalcPreferredFontSize(bool noGui);
108 bool IsOutputTty();
109 bool PutClangFormatFileToDataDirectoryHidden();
110 
111 #endif /* MANDELBULBER2_SRC_SYSTEM_HPP_ */
112