Geometrize  1.0
An application for geometrizing images into geometric primitives
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
Public Member Functions | Private Member Functions | Private Attributes | List of all members
geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl Class Reference
Collaboration diagram for geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl:
Collaboration graph
[legend]

Public Member Functions

 GlobalPreferencesDialogImpl (GlobalPreferencesDialog *pQ)
 
GlobalPreferencesDialogImpl operator= (const GlobalPreferencesDialogImpl &)=delete
 
 GlobalPreferencesDialogImpl (const GlobalPreferencesDialogImpl &)=delete
 
 ~GlobalPreferencesDialogImpl ()
 
void setGeometrizeLogo (const bool enabled)
 
void setPopulateRecents (const bool enabled)
 
void setPopulateTemplates (const bool enabled)
 
void setAutoLoadImageTaskSettings (const bool enabled)
 
void setAutoSaveImageTaskSettings (const bool enabled)
 
void setShowLaunchWindowConsoleByDefault (const bool enabled)
 
void openCustomImageBackgroundBackgroundColorPicker ()
 
void setCustomImageTaskBackgroundOverrideColor (const std::int32_t r, const std::int32_t g, const std::int32_t b, const std::int32_t a)
 
void openCustomImageAlphaReplacementColorPicker ()
 
void setTargetImageAlphaReplacementColor (const std::int32_t r, const std::int32_t g, const std::int32_t b, const std::int32_t a)
 
void setShouldUseCustomImageTaskBackgroundOverrideColor (const bool enabled)
 
void setShouldReplaceTargetImageAlphaWithCustomColor (const bool enabled)
 
void setShowVectorResultsByDefault (const bool enabled)
 
void setShowPixmapResultsByDefault (const bool enabled)
 
void setShowImageTaskConsoleByDefault (const bool enabled)
 
void setShowScriptEditorsByDefault (const bool enabled)
 
void setImageTaskImageResize (const bool enabled)
 
void setImageTaskImageResizeThresholdWidth (const int width)
 
void setImageTaskImageResizeThresholdHeight (const int height)
 
void setMaxThreadsPerImageTask (const int value)
 
void onLanguageChange ()
 

Private Member Functions

void populateUi ()
 
geometrize::preferences::GlobalPreferencesgetPrefs ()
 
void syncUiWithPreferences ()
 
void setButtonColor (QPushButton &button, const std::int32_t r, const std::int32_t g, const std::int32_t b, const std::int32_t a)
 

Private Attributes

std::unique_ptr
< Ui::GlobalPreferencesDialog > 
ui
 
GlobalPreferencesDialogq
 

Constructor & Destructor Documentation

geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::GlobalPreferencesDialogImpl ( GlobalPreferencesDialog pQ)
inline
24  : ui{std::make_unique<Ui::GlobalPreferencesDialog>()}, q{pQ}
25  {
26  q->setWindowFlags(q->windowFlags() & ~Qt::WindowContextHelpButtonHint); // Remove question mark from title bar
27  ui->setupUi(q);
28 
29  connect(ui->preferenceCategoryList, &QListWidget::currentRowChanged, [this](const int currentRow) {
30  ui->preferencePageStack->setCurrentIndex(currentRow);
31  });
32 
33  populateUi();
35  }
void syncUiWithPreferences()
Definition: globalpreferencesdialog.cpp:174
void populateUi()
Definition: globalpreferencesdialog.cpp:165
std::unique_ptr< Ui::GlobalPreferencesDialog > ui
Definition: globalpreferencesdialog.cpp:215
GlobalPreferencesDialog * q
Definition: globalpreferencesdialog.cpp:216

Here is the call graph for this function:

geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::GlobalPreferencesDialogImpl ( const GlobalPreferencesDialogImpl )
delete
geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::~GlobalPreferencesDialogImpl ( )
inline
39  {
41  }
bool save(const std::string &filePath)
save Saves the global preferences to a file.
Definition: globalpreferences.cpp:453
std::string getGlobalPreferencesConfigPath()
getGlobalPreferencesConfigPath Gets the absolute path to where the global preferences config file sho...
Definition: globalpreferences.cpp:23
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169

Here is the call graph for this function:

Member Function Documentation

geometrize::preferences::GlobalPreferences& geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::getPrefs ( )
inlineprivate
170  {
172  }
geometrize::preferences::GlobalPreferences & getGlobalPreferences()
getGlobalPreferences Shorthand function that gets a reference to the shared global preferences object...
Definition: globalpreferences.cpp:32

Here is the call graph for this function:

Here is the caller graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::onLanguageChange ( )
inline
159  {
160  populateUi();
161  ui->retranslateUi(q);
162  }
void populateUi()
Definition: globalpreferencesdialog.cpp:165
std::unique_ptr< Ui::GlobalPreferencesDialog > ui
Definition: globalpreferencesdialog.cpp:215
GlobalPreferencesDialog * q
Definition: globalpreferencesdialog.cpp:216

Here is the call graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::openCustomImageAlphaReplacementColorPicker ( )
inline
91  {
92  const std::array<std::int32_t, 4> col = getPrefs().getTargetImageAlphaReplacementColor();
93  const QColor currentColor = QColor(col[0], col[1], col[2], col[3]);
94  const QColor result = QColorDialog::getColor(currentColor, q, tr("Color Picker"), QColorDialog::ColorDialogOption::ShowAlphaChannel);
95  if(!result.isValid()) {
96  return;
97  }
98  setTargetImageAlphaReplacementColor(result.red(), result.green(), result.blue(), result.alpha());
99  }
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 setTargetImageAlphaReplacementColor(const std::int32_t r, const std::int32_t g, const std::int32_t b, const std::int32_t a)
Definition: globalpreferencesdialog.cpp:101
GlobalPreferencesDialog * q
Definition: globalpreferencesdialog.cpp:216
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169

Here is the call graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::openCustomImageBackgroundBackgroundColorPicker ( )
inline
74  {
75  const std::array<std::int32_t, 4> col = getPrefs().getCustomImageTaskBackgroundOverrideColor();
76  const QColor currentColor = QColor(col[0], col[1], col[2], col[3]);
77  const QColor result = QColorDialog::getColor(currentColor, q, tr("Color Picker"), QColorDialog::ColorDialogOption::ShowAlphaChannel);
78  if(!result.isValid()) {
79  return;
80  }
81  setCustomImageTaskBackgroundOverrideColor(result.red(), result.green(), result.blue(), result.alpha());
82  }
void setCustomImageTaskBackgroundOverrideColor(const std::int32_t r, const std::int32_t g, const std::int32_t b, const std::int32_t a)
Definition: globalpreferencesdialog.cpp:84
GlobalPreferencesDialog * q
Definition: globalpreferencesdialog.cpp:216
std::array< std::int32_t, 4 > getCustomImageTaskBackgroundOverrideColor() const
getCustomImageTaskBackgroundOverrideColor Gets the preference for the custom image task background ov...
Definition: globalpreferences.cpp:498
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169

Here is the call graph for this function:

GlobalPreferencesDialogImpl geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::operator= ( const GlobalPreferencesDialogImpl )
delete
void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::populateUi ( )
inlineprivate
166  {
167  }

Here is the caller graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setAutoLoadImageTaskSettings ( const bool  enabled)
inline
59  {
61  }
void setShouldAutoLoadImageTaskSettings(bool loadSettings)
setShouldAutoLoadImageTaskSettings Sets the preference for whether to automatically load any previous...
Definition: globalpreferences.cpp:523
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169

Here is the call graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setAutoSaveImageTaskSettings ( const bool  enabled)
inline
64  {
66  }
void setShouldAutoSaveImageTaskSettings(bool saveSettings)
setShouldAutoSaveImageTaskSettings Sets the preference for whether to automatically save the last tas...
Definition: globalpreferences.cpp:533
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169

Here is the call graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setButtonColor ( QPushButton &  button,
const std::int32_t  r,
const std::int32_t  g,
const std::int32_t  b,
const std::int32_t  a 
)
inlineprivate
208  {
209  const QString buttonStyle = "QPushButton {border: 0.05em solid lightgray; background-color: rgba(" +
210  QString::number(r) + "," + QString::number(g) + "," + QString::number(b) + "," + QString::number(static_cast<float>(a) / 255.0f) + ") }";
211  button.setStyleSheet(buttonStyle);
212  button.update();
213  }

Here is the caller graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setCustomImageTaskBackgroundOverrideColor ( const std::int32_t  r,
const std::int32_t  g,
const std::int32_t  b,
const std::int32_t  a 
)
inline
85  {
87  setButtonColor(*ui->selectCustomImageBackgroundColorButton, r, g, b, a);
88  }
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
void setButtonColor(QPushButton &button, const std::int32_t r, const std::int32_t g, const std::int32_t b, const std::int32_t a)
Definition: globalpreferencesdialog.cpp:207
std::unique_ptr< Ui::GlobalPreferencesDialog > ui
Definition: globalpreferencesdialog.cpp:215
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169

Here is the call graph for this function:

Here is the caller graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setGeometrizeLogo ( const bool  enabled)
inline
44  {
46  }
void setShouldGeometrizeAppLogoOnLaunch(bool geometrizeLogo)
setShouldGeometrizeAppLogoOnLaunch Sets the preference for whether to geometrize the app logo on the ...
Definition: globalpreferences.cpp:473
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169

Here is the call graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setImageTaskImageResize ( const bool  enabled)
inline
138  {
140  }
void setImageTaskImageResizeEnabled(bool enabled)
setImageTaskImageResizeEnabled Sets the preference for whether image tasks should resize images that ...
Definition: globalpreferences.cpp:613
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169

Here is the call graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setImageTaskImageResizeThresholdHeight ( const int  height)
inline
148  {
149  getPrefs().setImageTaskResizeThreshold(getPrefs().getImageTaskResizeThreshold().first, height);
150  }
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
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169

Here is the call graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setImageTaskImageResizeThresholdWidth ( const int  width)
inline
143  {
144  getPrefs().setImageTaskResizeThreshold(width, getPrefs().getImageTaskResizeThreshold().second);
145  }
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
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169

Here is the call graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setMaxThreadsPerImageTask ( const int  value)
inline
153  {
154  assert(value >= 0);
155  getPrefs().setImageTaskMaxThreads(static_cast<unsigned int>(value));
156  }
void setImageTaskMaxThreads(std::uint32_t maxThreads)
setImageTaskMaxThreads Sets the maximum number of threads the image task should use.
Definition: globalpreferences.cpp:633
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169

Here is the call graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setPopulateRecents ( const bool  enabled)
inline
49  {
51  }
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169
void setShouldPopulateRecentItemsOnLaunch(bool populateRecents)
setShouldPopulateRecentItemsOnLaunch Sets the preference for whether the recent items list should be ...
Definition: globalpreferences.cpp:483

Here is the call graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setPopulateTemplates ( const bool  enabled)
inline
54  {
56  }
void setShouldPopulateTemplatesOnLaunch(bool populateTemplates)
setShouldPopulateTemplatesOnLaunch Sets the preference for whether to populate the task templates on ...
Definition: globalpreferences.cpp:493
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169

Here is the call graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setShouldReplaceTargetImageAlphaWithCustomColor ( const bool  enabled)
inline
113  {
115  }
void setShouldReplaceTargetImageAlphaWithCustomColor(bool useColor)
setShouldReplaceTargetImageAlphaWithCustomColor Sets the preference for whether to replace the alpha ...
Definition: globalpreferences.cpp:553
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169

Here is the call graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setShouldUseCustomImageTaskBackgroundOverrideColor ( const bool  enabled)
inline
108  {
110  }
void setShouldUseCustomImageTaskBackgroundOverrideColor(bool useColor)
setShouldUseCustomImageTaskBackgroundOverrideColor Sets the preference for whether to use the custom ...
Definition: globalpreferences.cpp:513
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169

Here is the call graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setShowImageTaskConsoleByDefault ( const bool  enabled)
inline
128  {
130  }
void setShouldShowImageTaskConsoleByDefault(bool showConsole)
setShouldShowImageTaskConsoleByDefault Sets the preference for whether to show the console on the ima...
Definition: globalpreferences.cpp:583
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169

Here is the call graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setShowLaunchWindowConsoleByDefault ( const bool  enabled)
inline
69  {
71  }
void setShouldShowLaunchConsoleByDefault(bool showConsole)
setShouldShowLaunchConsoleByDefault Sets the preference for whether to show the console on the launch...
Definition: globalpreferences.cpp:563
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169

Here is the call graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setShowPixmapResultsByDefault ( const bool  enabled)
inline
123  {
125  }
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169
void setShouldShowImageTaskPixmapViewByDefault(bool showPixmapView)
setShouldShowImageTaskPixmapViewByDefault Sets the preference for whether to show the image task pixm...
Definition: globalpreferences.cpp:603

Here is the call graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setShowScriptEditorsByDefault ( const bool  enabled)
inline
133  {
135  }
void setShouldShowImageTaskScriptEditorByDefault(bool showScriptEditor)
setShouldShowImageTaskScriptEditorByDefault Sets the preference for whether to open the script editor...
Definition: globalpreferences.cpp:593
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169

Here is the call graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setShowVectorResultsByDefault ( const bool  enabled)
inline
118  {
120  }
void setShouldShowImageTaskVectorViewByDefault(bool showVectorView)
setShouldShowImageTaskVectorViewByDefault Sets the preference for whether to show the image task vect...
Definition: globalpreferences.cpp:573
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169

Here is the call graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setTargetImageAlphaReplacementColor ( const std::int32_t  r,
const std::int32_t  g,
const std::int32_t  b,
const std::int32_t  a 
)
inline
102  {
104  setButtonColor(*ui->selectTargetImageAlphaReplacementColorButton, r, g, b, a);
105  }
void setButtonColor(QPushButton &button, const std::int32_t r, const std::int32_t g, const std::int32_t b, const std::int32_t a)
Definition: globalpreferencesdialog.cpp:207
std::unique_ptr< Ui::GlobalPreferencesDialog > ui
Definition: globalpreferencesdialog.cpp:215
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
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169

Here is the call graph for this function:

Here is the caller graph for this function:

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::syncUiWithPreferences ( )
inlineprivate
175  {
177 
178  ui->geometrizeLogo->setChecked(prefs.shouldGeometrizeAppLogoOnLaunch());
179  ui->populateRecents->setChecked(prefs.shouldPopulateRecentItemsOnLaunch());
180  ui->populateTemplates->setChecked(prefs.shouldPopulateTemplatesOnLaunch());
181 
182  ui->autoLoadImageTaskSettings->setChecked(prefs.shouldAutoLoadImageTaskSettings());
183  ui->autoSaveImageTaskSettings->setChecked(prefs.shouldAutoSaveImageTaskSettings());
184 
185  ui->useCustomImageTaskBackgroundColor->setChecked(prefs.shouldUseCustomImageTaskBackgroundOverrideColor());
186 
187  const std::array<std::int32_t, 4> bgCol = prefs.getCustomImageTaskBackgroundOverrideColor();
188  setButtonColor(*ui->selectCustomImageBackgroundColorButton, bgCol[0], bgCol[1], bgCol[2], bgCol[3]);
189 
190  ui->replaceTargetImageAlphaWithCustomColor->setChecked(prefs.shouldUseImageAlphaReplacementColor());
191 
192  const std::array<std::int32_t, 4> alphaCol = prefs.getTargetImageAlphaReplacementColor();
193  setButtonColor(*ui->selectTargetImageAlphaReplacementColorButton, alphaCol[0], alphaCol[1], alphaCol[2], alphaCol[3]);
194 
195  ui->showLaunchWindowConsoleByDefault->setChecked(prefs.shouldShowLaunchConsoleByDefault());
196  ui->showVectorResultsByDefault->setChecked(prefs.shouldShowImageTaskVectorViewByDefault());
197  ui->showPixmapResultsByDefault->setChecked(prefs.shouldShowImageTaskPixmapViewByDefault());
198  ui->showImageTaskConsoleByDefault->setChecked(prefs.shouldShowImageTaskConsoleByDefault());
199  ui->showScriptEditorsByDefault->setChecked(prefs.shouldShowImageTaskScriptEditorByDefault());
200 
201  ui->imageResize->setChecked(prefs.isImageTaskImageResizeEnabled());
202  ui->resizeWidth->setValue(prefs.getImageTaskResizeThreshold().first);
203  ui->resizeHeight->setValue(prefs.getImageTaskResizeThreshold().second);
204  ui->maxThreadsPerImageTask->setValue(prefs.getImageTaskMaxThreads());
205  }
The GlobalPreferences class models the preferences associated with the application as a whole...
Definition: globalpreferences.h:43
void setButtonColor(QPushButton &button, const std::int32_t r, const std::int32_t g, const std::int32_t b, const std::int32_t a)
Definition: globalpreferencesdialog.cpp:207
std::unique_ptr< Ui::GlobalPreferencesDialog > ui
Definition: globalpreferencesdialog.cpp:215
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

GlobalPreferencesDialog* geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::q
private
std::unique_ptr<Ui::GlobalPreferencesDialog> geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::ui
private

The documentation for this class was generated from the following file: