Geometrize  1.0
An application for geometrizing images into geometric primitives
Classes | Functions
geometrize::preferences Namespace Reference

Classes

class  GlobalPreferences
 The GlobalPreferences class models the preferences associated with the application as a whole. These mostly represent application-wide settings that are edited via the tabbed preferences widget. More...
 
class  ImageTaskPreferences
 The ImageTaskPreferences class models the preferences associated with an image task. More...
 

Functions

std::string getGlobalPreferencesConfigPath ()
 getGlobalPreferencesConfigPath Gets the absolute path to where the global preferences config file should be read/written. More...
 
geometrize::preferences::GlobalPreferencesgetGlobalPreferences ()
 getGlobalPreferences Shorthand function that gets a reference to the shared global preferences object, which stores global application preferences. More...
 
std::string getImageTaskPreferencesAutoSavePath (const std::string &hashOfFirstTargetImage)
 getImageTaskPreferencesAutoSavePath Gets the absolute path to where the image task preferences config file should be read/written. More...
 

Function Documentation

◆ getGlobalPreferences()

geometrize::preferences::GlobalPreferences & geometrize::preferences::getGlobalPreferences ( )

getGlobalPreferences Shorthand function that gets a reference to the shared global preferences object, which stores global application preferences.

Returns
The global preferences object.
33 {
35  return prefs;
36 }
Here is the caller graph for this function:

◆ getGlobalPreferencesConfigPath()

std::string geometrize::preferences::getGlobalPreferencesConfigPath ( )

getGlobalPreferencesConfigPath Gets the absolute path to where the global preferences config file should be read/written.

Returns
The absolute path to the global preferences config file.
24 {
25  const QString configFilename{"global_preferences.json"};
26  const QString globalPreferencesFolder{QStandardPaths::writableLocation(QStandardPaths::StandardLocation::AppDataLocation)};
27  const QString globalPreferencesPath{QDir(globalPreferencesFolder).filePath(configFilename)};
28  const std::string globalPreferencesPathStr{globalPreferencesPath.toStdString()};
29  return globalPreferencesPathStr;
30 }
Here is the caller graph for this function:

◆ getImageTaskPreferencesAutoSavePath()

std::string geometrize::preferences::getImageTaskPreferencesAutoSavePath ( const std::string &  hashOfFirstTargetImage)

getImageTaskPreferencesAutoSavePath Gets the absolute path to where the image task preferences config file should be read/written.

Parameters
hashOfFirstTargetImageA string containing a hash of the first target image the task was set up to use. NOTE - this hash changes based on the target image, so modifying the "resize image" settings in the application will cause this to change.
Returns
The name of the autosave task settings file, including the file extension
The absolute path the image task auto save path.
25 {
26  const std::vector<std::string> autoSaveSearchPaths = geometrize::searchpaths::getAutosaveTaskSettingsSearchPaths();
27  if(autoSaveSearchPaths.empty()) {
28  assert(0 && "Image task autosave search paths should never be empty");
29  return "";
30  }
31  const auto autoSaveTaskSettingsFilename = geometrize::searchpaths::getAutosaveTaskSettingsFilename(hashOfFirstTargetImage);
32  return autoSaveSearchPaths[0] + QDir::separator().toLatin1() + autoSaveTaskSettingsFilename;
33 }
Here is the call graph for this function:
geometrize::searchpaths::getAutosaveTaskSettingsFilename
std::string getAutosaveTaskSettingsFilename(const std::string &hashOfFirstTargetImage)
getAutomaticTaskSettingsFilename Gets the name of a task settings file to be autosaved (e....
Definition: searchpaths.cpp:36
geometrize::preferences::GlobalPreferences
The GlobalPreferences class models the preferences associated with the application as a whole....
Definition: globalpreferences.h:44
geometrize::searchpaths::getAutosaveTaskSettingsSearchPaths
std::vector< std::string > getAutosaveTaskSettingsSearchPaths()
getAutosaveTaskSettingsSearchPaths Gets the directory paths that the program will search for autosave...
Definition: searchpaths.cpp:41