GpgFrontend-Doxygen/docs/latex/GlobalSettingStation_8h_source.tex
2022-05-09 03:59:26 +08:00

116 lines
7.9 KiB
TeX

\hypertarget{GlobalSettingStation_8h_source}{}\doxysection{Global\+Setting\+Station.\+h}
\label{GlobalSettingStation_8h_source}\index{src/core/function/GlobalSettingStation.h@{src/core/function/GlobalSettingStation.h}}
\begin{DoxyCode}{0}
\DoxyCodeLine{1 }
\DoxyCodeLine{29 \textcolor{preprocessor}{\#ifndef GPGFRONTEND\_GLOBALSETTINGSTATION\_H}}
\DoxyCodeLine{30 \textcolor{preprocessor}{\#define GPGFRONTEND\_GLOBALSETTINGSTATION\_H}}
\DoxyCodeLine{31 }
\DoxyCodeLine{32 \textcolor{preprocessor}{\#include <openssl/x509.h>}}
\DoxyCodeLine{33 }
\DoxyCodeLine{34 \textcolor{preprocessor}{\#include <boost/filesystem/operations.hpp>}}
\DoxyCodeLine{35 \textcolor{preprocessor}{\#include <boost/filesystem/path.hpp>}}
\DoxyCodeLine{36 }
\DoxyCodeLine{37 \textcolor{preprocessor}{\#include "{}GpgFrontendBuildInstallInfo.h"{}}}
\DoxyCodeLine{38 \textcolor{preprocessor}{\#include "{}core/GpgFrontendCore.h"{}}}
\DoxyCodeLine{39 \textcolor{preprocessor}{\#include "{}core/GpgFunctionObject.h"{}}}
\DoxyCodeLine{40 }
\DoxyCodeLine{41 \textcolor{keyword}{namespace }\mbox{\hyperlink{namespaceGpgFrontend}{GpgFrontend}} \{}
\DoxyCodeLine{42 }
\DoxyCodeLine{47 \textcolor{keyword}{class }GPGFRONTEND\_CORE\_EXPORT \mbox{\hyperlink{classGpgFrontend_1_1GlobalSettingStation}{GlobalSettingStation}}}
\DoxyCodeLine{48 : \textcolor{keyword}{public} \mbox{\hyperlink{classGpgFrontend_1_1SingletonFunctionObject}{SingletonFunctionObject}}<GlobalSettingStation> \{}
\DoxyCodeLine{49 \textcolor{keyword}{public}:}
\DoxyCodeLine{54 \textcolor{keyword}{explicit} \mbox{\hyperlink{classGpgFrontend_1_1GlobalSettingStation}{GlobalSettingStation}}(}
\DoxyCodeLine{55 \textcolor{keywordtype}{int} channel = \mbox{\hyperlink{classGpgFrontend_1_1SingletonFunctionObject_a50e2b3794d6553f4231eaec72d9d0a50}{SingletonFunctionObject::GetDefaultChannel}}()) \textcolor{keyword}{noexcept};}
\DoxyCodeLine{56 }
\DoxyCodeLine{61 \mbox{\hyperlink{classGpgFrontend_1_1GlobalSettingStation_af700161900e623a0ea14261d51616451}{\string~GlobalSettingStation}}() noexcept override;}
\DoxyCodeLine{62 }
\DoxyCodeLine{68 libconfig::Setting \&GetUISettings() noexcept \{ \textcolor{keywordflow}{return} ui\_cfg\_.getRoot(); \}}
\DoxyCodeLine{69 }
\DoxyCodeLine{75 [[nodiscard]] std::filesystem::path \mbox{\hyperlink{classGpgFrontend_1_1GlobalSettingStation_ae9d1da3d01c4a834120968636596c3c3}{GetAppDir}}()\textcolor{keyword}{ const }\{ \textcolor{keywordflow}{return} app\_path\_; \}}
\DoxyCodeLine{76 }
\DoxyCodeLine{77 [[nodiscard]] std::filesystem::path GetAppDataPath()\textcolor{keyword}{ const }\{}
\DoxyCodeLine{78 \textcolor{keywordflow}{return} app\_data\_path\_;}
\DoxyCodeLine{79 \}}
\DoxyCodeLine{80 }
\DoxyCodeLine{86 [[nodiscard]] std::filesystem::path \mbox{\hyperlink{classGpgFrontend_1_1GlobalSettingStation_a7da9b08291ef2391892f5c9375b8db23}{GetLogDir}}()\textcolor{keyword}{ const }\{}
\DoxyCodeLine{87 \textcolor{keywordflow}{return} app\_log\_path\_;}
\DoxyCodeLine{88 \}}
\DoxyCodeLine{89 }
\DoxyCodeLine{95 [[nodiscard]] std::filesystem::path \mbox{\hyperlink{classGpgFrontend_1_1GlobalSettingStation_af484ca46c5df831a9dd76f3a88d66332}{GetStandaloneDatabaseDir}}()\textcolor{keyword}{ const }\{}
\DoxyCodeLine{96 \textcolor{keyword}{auto} db\_path = app\_configure\_path\_ / \textcolor{stringliteral}{"{}db"{}};}
\DoxyCodeLine{97 \textcolor{keywordflow}{if} (!std::filesystem::exists(db\_path)) \{}
\DoxyCodeLine{98 std::filesystem::create\_directory(db\_path);}
\DoxyCodeLine{99 \}}
\DoxyCodeLine{100 \textcolor{keywordflow}{return} db\_path;}
\DoxyCodeLine{101 \}}
\DoxyCodeLine{102 }
\DoxyCodeLine{103 [[nodiscard]] std::filesystem::path GetAppConfigPath()\textcolor{keyword}{ const }\{}
\DoxyCodeLine{104 \textcolor{keywordflow}{return} app\_configure\_path\_;}
\DoxyCodeLine{105 \}}
\DoxyCodeLine{106 }
\DoxyCodeLine{112 [[nodiscard]] std::filesystem::path \mbox{\hyperlink{classGpgFrontend_1_1GlobalSettingStation_aa93b21af9ac6649d5749c83c809f5b00}{GetStandaloneGpgBinDir}}()\textcolor{keyword}{ const }\{}
\DoxyCodeLine{113 \textcolor{keywordflow}{return} app\_resource\_path\_ / \textcolor{stringliteral}{"{}gpg1.4"{}} / \textcolor{stringliteral}{"{}gpg"{}};}
\DoxyCodeLine{114 \}}
\DoxyCodeLine{115 }
\DoxyCodeLine{121 [[nodiscard]] std::filesystem::path \mbox{\hyperlink{classGpgFrontend_1_1GlobalSettingStation_a0b3780564305e9b210d66ef377c21565}{GetLocaleDir}}()\textcolor{keyword}{ const }\{}
\DoxyCodeLine{122 \textcolor{keywordflow}{return} app\_locale\_path\_;}
\DoxyCodeLine{123 \}}
\DoxyCodeLine{124 }
\DoxyCodeLine{130 [[nodiscard]] std::filesystem::path \mbox{\hyperlink{classGpgFrontend_1_1GlobalSettingStation_afc1aa3dec55ae4e741f92fce1140a2d0}{GetResourceDir}}()\textcolor{keyword}{ const }\{}
\DoxyCodeLine{131 \textcolor{keywordflow}{return} app\_resource\_path\_;}
\DoxyCodeLine{132 \}}
\DoxyCodeLine{133 }
\DoxyCodeLine{139 [[nodiscard]] std::filesystem::path \mbox{\hyperlink{classGpgFrontend_1_1GlobalSettingStation_a385ae4ab6ad5b17742a5405fa693d789}{GetCertsDir}}()\textcolor{keyword}{ const }\{}
\DoxyCodeLine{140 \textcolor{keywordflow}{return} app\_resource\_path\_ / \textcolor{stringliteral}{"{}certs"{}};}
\DoxyCodeLine{141 \}}
\DoxyCodeLine{142 }
\DoxyCodeLine{147 \textcolor{keywordtype}{void} SyncSettings() noexcept;}
\DoxyCodeLine{148 }
\DoxyCodeLine{149 private:}
\DoxyCodeLine{150 std::filesystem::path app\_path\_ =}
\DoxyCodeLine{151 qApp-\/>applicationDirPath().toStdString(); }
\DoxyCodeLine{152 std::filesystem::path app\_data\_path\_ =}
\DoxyCodeLine{153 QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)}
\DoxyCodeLine{154 .toStdString(); }
\DoxyCodeLine{155 std::filesystem::path app\_log\_path\_ =}
\DoxyCodeLine{156 app\_data\_path\_ / "{}logs"{}; }
\DoxyCodeLine{157 std::filesystem::path app\_data\_objs\_path\_ =}
\DoxyCodeLine{158 app\_data\_path\_ / "{}objs"{}; }
\DoxyCodeLine{159 }
\DoxyCodeLine{160 \textcolor{preprocessor}{\#ifdef LINUX\_INSTALL\_BUILD}}
\DoxyCodeLine{161 std::filesystem::path app\_resource\_path\_ =}
\DoxyCodeLine{162 std::filesystem::path(APP\_LOCALSTATE\_PATH) /}
\DoxyCodeLine{163 \textcolor{stringliteral}{"{}gpgfrontend"{}}; }
\DoxyCodeLine{164 \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{165 std::filesystem::path app\_resource\_path\_ =}
\DoxyCodeLine{166 RESOURCE\_DIR\_BOOST\_PATH(app\_path\_); }
\DoxyCodeLine{167 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{168 }
\DoxyCodeLine{169 \textcolor{preprocessor}{\#ifdef LINUX\_INSTALL\_BUILD}}
\DoxyCodeLine{170 std::filesystem::path app\_locale\_path\_ =}
\DoxyCodeLine{171 std::string(APP\_LOCALE\_PATH); }
\DoxyCodeLine{172 \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{173 std::filesystem::path app\_locale\_path\_ =}
\DoxyCodeLine{174 app\_resource\_path\_ / \textcolor{stringliteral}{"{}locales"{}}; }
\DoxyCodeLine{175 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{176 }
\DoxyCodeLine{177 std::filesystem::path app\_configure\_path\_ =}
\DoxyCodeLine{178 QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation)}
\DoxyCodeLine{179 .toStdString(); }
\DoxyCodeLine{180 std::filesystem::path ui\_config\_dir\_path\_ =}
\DoxyCodeLine{181 app\_configure\_path\_ /}
\DoxyCodeLine{182 \textcolor{stringliteral}{"{}UserInterface"{}}; }
\DoxyCodeLine{183 std::filesystem::path ui\_config\_path\_ =}
\DoxyCodeLine{184 ui\_config\_dir\_path\_ / \textcolor{stringliteral}{"{}ui.cfg"{}}; }
\DoxyCodeLine{185 }
\DoxyCodeLine{186 libconfig::Config \mbox{\hyperlink{classGpgFrontend_1_1GlobalSettingStation_a1818e08063d6a886975f77354fc5d85c}{ui\_cfg\_}}; }
\DoxyCodeLine{187 }
\DoxyCodeLine{192 \textcolor{keywordtype}{void} init\_app\_secure\_key();}
\DoxyCodeLine{193 \};}
\DoxyCodeLine{194 \} \textcolor{comment}{// namespace GpgFrontend}}
\DoxyCodeLine{195 }
\DoxyCodeLine{196 \textcolor{preprocessor}{\#endif }\textcolor{comment}{// GPGFRONTEND\_GLOBALSETTINGSTATION\_H}}
\end{DoxyCode}