Geometrize  1.0
An application for geometrizing images into geometric primitives
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
globalpreferences.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <array>
4 #include <cstdint>
5 #include <memory>
6 #include <string>
7 #include <utility>
8 
9 #include <QObject>
10 
11 namespace geometrize
12 {
13 
14 namespace preferences
15 {
16 class GlobalPreferences;
17 }
18 
19 }
20 
21 namespace geometrize
22 {
23 
24 namespace preferences
25 {
26 
32 
37 std::string getGlobalPreferencesConfigPath();
38 
43 class GlobalPreferences : public QObject
44 {
45  Q_OBJECT
46 public:
49  GlobalPreferences(const GlobalPreferences&) = delete;
51 
57  bool load(const std::string& filePath);
58 
64  bool save(const std::string& filePath);
65 
70  unsigned int getApplicationLaunchCount() const;
71 
76 
82 
87  void setShouldShowWelcomeScreenOnLaunch(bool show);
88 
94 
99  void setShouldGeometrizeAppLogoOnLaunch(bool geometrizeLogo);
100 
106 
111  void setShouldPopulateRecentItemsOnLaunch(bool populateRecents);
112 
117  bool shouldPopulateTemplatesOnLaunch() const;
118 
123  void setShouldPopulateTemplatesOnLaunch(bool populateTemplates);
124 
129  std::array<std::int32_t, 4> getCustomImageTaskBackgroundOverrideColor() const;
130 
138  void setCustomImageTaskBackgroundOverrideColor(std::int32_t r, std::int32_t g, std::int32_t b, std::int32_t a);
139 
145 
151 
156  std::array<std::int32_t, 4> getTargetImageAlphaReplacementColor() const;
157 
165  void setTargetImageAlphaReplacementColor(std::int32_t r, std::int32_t g, std::int32_t b, std::int32_t a);
166 
172 
178 
183  bool shouldAutoLoadImageTaskSettings() const;
184 
189  void setShouldAutoLoadImageTaskSettings(bool loadSettings);
190 
195  bool shouldAutoSaveImageTaskSettings() const;
196 
201  void setShouldAutoSaveImageTaskSettings(bool saveSettings);
202 
208 
213  void setShouldShowLaunchConsoleByDefault(bool showConsole);
214 
220 
225  void setShouldShowImageTaskVectorViewByDefault(bool showVectorView);
226 
232 
237  void setShouldShowImageTaskConsoleByDefault(bool showConsole);
238 
244 
249  void setShouldShowImageTaskScriptEditorByDefault(bool showScriptEditor);
250 
256 
261  void setShouldShowImageTaskPixmapViewByDefault(bool showPixmapView);
262 
267  bool isImageTaskImageResizeEnabled() const;
268 
273  void setImageTaskImageResizeEnabled(bool enabled);
274 
279  std::pair<std::uint32_t, std::uint32_t> getImageTaskResizeThreshold() const;
280 
286  void setImageTaskResizeThreshold(std::uint32_t width, std::uint32_t height);
287 
292  std::uint32_t getImageTaskMaxThreads() const;
293 
298  void setImageTaskMaxThreads(std::uint32_t maxThreads);
299 
304  std::string getLanguageIsoCode() const;
305 
310  void setLanguageIsoCode(const std::string& languageIsoCode);
311 
316  std::string getScriptIsoCode() const;
317 
322  void setScriptIsoCode(const std::string& scriptIsoCode);
323 
328  std::string getCountryIsoCode() const;
329 
334  void setCountryIsoCode(const std::string& countryIsoCode);
335 
343  std::string getLocaleName() const;
344 
352  void setLocaleName(const std::string& localeName);
353 
354 private:
356  std::unique_ptr<GlobalPreferencesImpl> d;
357 };
358 
359 }
360 
361 }
bool shouldGeometrizeAppLogoOnLaunch() const
shouldGeometrizeAppLogoOnLaunch Gets the preference for whether the app logo on the launch window sho...
Definition: globalpreferences.cpp:468
bool load(const std::string &filePath)
load Loads the global preferences from a file.
Definition: globalpreferences.cpp:448
std::string getLanguageIsoCode() const
getLanguageIsoCode Gets the ISO 639-1 language preference for the application.
Definition: globalpreferences.cpp:638
bool isImageTaskImageResizeEnabled() const
isImageTaskImageResizeEnabled Gets the preference for whether image tasks should resize images that a...
Definition: globalpreferences.cpp:608
~GlobalPreferences()
Definition: globalpreferences.cpp:434
void setScriptIsoCode(const std::string &scriptIsoCode)
setScriptIsoCode Sets the ISO-15924 script code preference for the application.
Definition: globalpreferences.cpp:653
void setShouldShowImageTaskConsoleByDefault(bool showConsole)
setShouldShowImageTaskConsoleByDefault Sets the preference for whether to show the console on the ima...
Definition: globalpreferences.cpp:583
bool shouldShowImageTaskPixmapViewByDefault() const
shouldShowImageTaskPixmapViewByDefault Gets the preference for whether to show the image task pixmap/...
Definition: globalpreferences.cpp:598
void setImageTaskResizeThreshold(std::uint32_t width, std::uint32_t height)
setImageTaskResizeThreshold Sets the maximum dimensions of an image that can be used in an image task...
Definition: globalpreferences.cpp:623
The GlobalPreferences class models the preferences associated with the application as a whole...
Definition: globalpreferences.h:43
std::array< std::int32_t, 4 > getTargetImageAlphaReplacementColor() const
getTargetImageAlphaReplacementColor Gets the preference for the color to replace the alpha of a targe...
Definition: globalpreferences.cpp:538
void setCustomImageTaskBackgroundOverrideColor(std::int32_t r, std::int32_t g, std::int32_t b, std::int32_t a)
setUseCustomImageTaskBackgroundOverrideColor Sets the preference for the custom image task background...
Definition: globalpreferences.cpp:503
std::string getCountryIsoCode() const
getCountryIsoCode Gets the ISO-3166 country code preference for the application.
Definition: globalpreferences.cpp:658
bool shouldShowLaunchConsoleByDefault() const
shouldShowLaunchConsoleByDefault Gets the preference for whether to show the console on the launch wi...
Definition: globalpreferences.cpp:558
void setShouldAutoSaveImageTaskSettings(bool saveSettings)
setShouldAutoSaveImageTaskSettings Sets the preference for whether to automatically save the last tas...
Definition: globalpreferences.cpp:533
std::unique_ptr< GlobalPreferencesImpl > d
Definition: globalpreferences.h:355
void setShouldShowLaunchConsoleByDefault(bool showConsole)
setShouldShowLaunchConsoleByDefault Sets the preference for whether to show the console on the launch...
Definition: globalpreferences.cpp:563
bool shouldPopulateTemplatesOnLaunch() const
shouldPopulateTemplatesOnLaunch Gets the preference for whether to populate the task templates on the...
Definition: globalpreferences.cpp:488
void setLanguageIsoCode(const std::string &languageIsoCode)
setLanguageIsoCode Sets the ISO 639-1 language preference for the application.
Definition: globalpreferences.cpp:643
bool shouldShowImageTaskScriptEditorByDefault() const
shouldShowImageTaskScriptEditorByDefault Gets the preference for whether to open the script editor wh...
Definition: globalpreferences.cpp:588
void setShouldShowImageTaskScriptEditorByDefault(bool showScriptEditor)
setShouldShowImageTaskScriptEditorByDefault Sets the preference for whether to open the script editor...
Definition: globalpreferences.cpp:593
bool shouldAutoLoadImageTaskSettings() const
shouldAutoLoadImageTaskSettings Gets the preference for whether to automatically load any previously ...
Definition: globalpreferences.cpp:518
bool shouldAutoSaveImageTaskSettings() const
shouldAutoSaveImageTaskSettings Gets the preference for whether to automatically save the last task s...
Definition: globalpreferences.cpp:528
void setCountryIsoCode(const std::string &countryIsoCode)
setCountryIsoCode Sets the ISO-3166 country code preference for the application.
Definition: globalpreferences.cpp:663
void setLocaleName(const std::string &localeName)
setLocaleName Sets the locale with the specified name, which must have the format "language[_script][...
Definition: globalpreferences.cpp:673
void setImageTaskMaxThreads(std::uint32_t maxThreads)
setImageTaskMaxThreads Sets the maximum number of threads the image task should use.
Definition: globalpreferences.cpp:633
bool save(const std::string &filePath)
save Saves the global preferences to a file.
Definition: globalpreferences.cpp:453
GlobalPreferences()
Definition: globalpreferences.cpp:430
void setTargetImageAlphaReplacementColor(std::int32_t r, std::int32_t g, std::int32_t b, std::int32_t a)
setTargetImageAlphaReplacementColor Sets the preference for the color to replace the alpha of a targe...
Definition: globalpreferences.cpp:543
void setShouldReplaceTargetImageAlphaWithCustomColor(bool useColor)
setShouldReplaceTargetImageAlphaWithCustomColor Sets the preference for whether to replace the alpha ...
Definition: globalpreferences.cpp:553
void setShouldShowWelcomeScreenOnLaunch(bool show)
setShouldShowWelcomeScreenOnLaunch Sets the preference for whether the welcome screen should be displ...
Definition: globalpreferences.cpp:463
std::pair< std::uint32_t, std::uint32_t > getImageTaskResizeThreshold() const
getImageTaskResizeThreshold Gets the maximum dimensions of an image that can be used in an image task...
Definition: globalpreferences.cpp:618
void setShouldPopulateTemplatesOnLaunch(bool populateTemplates)
setShouldPopulateTemplatesOnLaunch Sets the preference for whether to populate the task templates on ...
Definition: globalpreferences.cpp:493
geometrize::preferences::GlobalPreferences & getGlobalPreferences()
getGlobalPreferences Shorthand function that gets a reference to the shared global preferences object...
Definition: globalpreferences.cpp:32
void setShouldGeometrizeAppLogoOnLaunch(bool geometrizeLogo)
setShouldGeometrizeAppLogoOnLaunch Sets the preference for whether to geometrize the app logo on the ...
Definition: globalpreferences.cpp:473
bool shouldShowImageTaskConsoleByDefault() const
shouldShowImageTaskConsoleByDefault Gets the preference for whether to show the console on the image ...
Definition: globalpreferences.cpp:578
GlobalPreferences & operator=(const GlobalPreferences &)=delete
std::string getGlobalPreferencesConfigPath()
getGlobalPreferencesConfigPath Gets the absolute path to where the global preferences config file sho...
Definition: globalpreferences.cpp:23
unsigned int getApplicationLaunchCount() const
getApplicationLaunchCount
Definition: globalpreferences.cpp:438
bool shouldPopulateRecentItemsOnLaunch() const
shouldPopulateRecentItemsOnLaunch Gets the preference for whether the recent items list should be pop...
Definition: globalpreferences.cpp:478
void setImageTaskImageResizeEnabled(bool enabled)
setImageTaskImageResizeEnabled Sets the preference for whether image tasks should resize images that ...
Definition: globalpreferences.cpp:613
void setShouldAutoLoadImageTaskSettings(bool loadSettings)
setShouldAutoLoadImageTaskSettings Sets the preference for whether to automatically load any previous...
Definition: globalpreferences.cpp:523
void setShouldUseCustomImageTaskBackgroundOverrideColor(bool useColor)
setShouldUseCustomImageTaskBackgroundOverrideColor Sets the preference for whether to use the custom ...
Definition: globalpreferences.cpp:513
std::string getLocaleName() const
getLocaleName Gets the locale name in the format "language[_script][_country]". language is a lowerca...
Definition: globalpreferences.cpp:668
std::array< std::int32_t, 4 > getCustomImageTaskBackgroundOverrideColor() const
getCustomImageTaskBackgroundOverrideColor Gets the preference for the custom image task background ov...
Definition: globalpreferences.cpp:498
void setShouldShowImageTaskVectorViewByDefault(bool showVectorView)
setShouldShowImageTaskVectorViewByDefault Sets the preference for whether to show the image task vect...
Definition: globalpreferences.cpp:573
bool shouldUseImageAlphaReplacementColor() const
shouldUseImageAlphaReplacementColor Gets the preference for whether to replace the alpha of a target ...
Definition: globalpreferences.cpp:548
std::string getScriptIsoCode() const
getScriptIsoCode Gets the ISO-15924 script code preference for the application.
Definition: globalpreferences.cpp:648
void incrementApplicationLaunchCount()
incrementApplicationLaunchCount Increments the count for the number of times the application has been...
Definition: globalpreferences.cpp:443
void setShouldPopulateRecentItemsOnLaunch(bool populateRecents)
setShouldPopulateRecentItemsOnLaunch Sets the preference for whether the recent items list should be ...
Definition: globalpreferences.cpp:483
void setShouldShowImageTaskPixmapViewByDefault(bool showPixmapView)
setShouldShowImageTaskPixmapViewByDefault Sets the preference for whether to show the image task pixm...
Definition: globalpreferences.cpp:603
std::uint32_t getImageTaskMaxThreads() const
getImageTaskMaxThreads Gets the maximum number of threads the image task should use.
Definition: globalpreferences.cpp:628
bool shouldShowWelcomeScreenOnLaunch() const
shouldShowWelcomeScreenOnLaunch Gets the preference for whether the welcome screen should be displaye...
Definition: globalpreferences.cpp:458
bool shouldShowImageTaskVectorViewByDefault() const
shouldShowImageTaskVectorViewByDefault Gets the preference for whether to show the image task vector/...
Definition: globalpreferences.cpp:568
bool shouldUseCustomImageTaskBackgroundOverrideColor() const
shouldUseCustomImageTaskBackgroundOverrideColor Gets the preference for whether to use the custom ima...
Definition: globalpreferences.cpp:508