aboutsummaryrefslogtreecommitdiff
path: root/src/kristall.hpp
diff options
context:
space:
mode:
authorFelix (xq) Queißner <git@mq32.de>2021-03-06 20:26:21 +0100
committerFelix (xq) Queißner <git@mq32.de>2021-03-06 20:29:50 +0100
commit0396fdb01d12e51bd2cc63478819b366c0453d29 (patch)
tree082fcd53b7b61c0dc2a0dc6b676729e155c07fd2 /src/kristall.hpp
parent21c821c49ef82d1e84b0b9c8c3d357dc559479d4 (diff)
downloadkristall-0396fdb01d12e51bd2cc63478819b366c0453d29.tar.gz
Moves all globals into a structure that can be deleted before the app exists. Fixes #193.
Diffstat (limited to 'src/kristall.hpp')
-rw-r--r--src/kristall.hpp64
1 files changed, 38 insertions, 26 deletions
diff --git a/src/kristall.hpp b/src/kristall.hpp
index f9d1c15..096c6e9 100644
--- a/src/kristall.hpp
+++ b/src/kristall.hpp
@@ -117,36 +117,53 @@ class MainWindow;
///
namespace kristall
{
- extern ProtocolSetup protocols;
-
- extern QSettings * settings;
- extern IdentityCollection identities;
- extern QClipboard * clipboard;
- extern FavouriteCollection favourites;
- extern GenericSettings options;
-
- extern DocumentStyle document_style;
+ //! Whether emojis are supprted in current build configuration
+ extern const bool EMOJIS_SUPPORTED;
- extern CacheHandler cache;
+ struct Trust
+ {
+ SslTrust gemini;
+ SslTrust https;
+ };
- namespace trust {
- extern SslTrust gemini;
- extern SslTrust https;
- }
+ struct Dirs
+ {
- namespace dirs {
- extern QDir config_root;
- extern QDir cache_root;
+ QDir config_root;
+ QDir cache_root;
//! Contains files per host
- extern QDir offline_pages;
+ QDir offline_pages;
//! Contains custom UI themes for kristall
- extern QDir themes;
+ QDir themes;
//! Contains custom document styles / presets
- extern QDir styles;
- }
+ QDir styles;
+ };
+
+ struct Globals
+ {
+
+ ProtocolSetup protocols;
+
+ QSettings * settings;
+ IdentityCollection identities;
+ QClipboard * clipboard;
+ FavouriteCollection favourites;
+ GenericSettings options;
+
+ DocumentStyle document_style;
+
+ CacheHandler cache;
+
+ Trust trust;
+
+ Dirs dirs;
+ };
+
+ //! returns the instance of the globals structure
+ Globals & globals();
//! Forwards the current settings to all windows
void applySettings();
@@ -176,11 +193,6 @@ namespace kristall
//! Opens a new window with the given list of urls.
//! If the list is empty, no new tab will spawned.
MainWindow * openNewWindow(QVector<QUrl> const & urls);
-
- extern QString default_font_family, default_font_family_fixed;
-
- //! Whether emojis are supprted in current build configuration
- extern const bool EMOJIS_SUPPORTED;
}
#endif // KRISTALL_HPP