Geometrize  1.0
An application for geometrizing images into geometric primitives
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

◆ GlobalPreferencesDialogImpl() [1/2]

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  }

◆ GlobalPreferencesDialogImpl() [2/2]

geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::GlobalPreferencesDialogImpl ( const GlobalPreferencesDialogImpl )
delete

◆ ~GlobalPreferencesDialogImpl()

geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::~GlobalPreferencesDialogImpl ( )
inline
Here is the call graph for this function:

Member Function Documentation

◆ getPrefs()

geometrize::preferences::GlobalPreferences& geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::getPrefs ( )
inlineprivate
170  {
172  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ onLanguageChange()

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::onLanguageChange ( )
inline
159  {
160  populateUi();
161  ui->retranslateUi(q);
162  }
Here is the call graph for this function:

◆ openCustomImageAlphaReplacementColorPicker()

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  }
Here is the call graph for this function:

◆ openCustomImageBackgroundBackgroundColorPicker()

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  }
Here is the call graph for this function:

◆ operator=()

GlobalPreferencesDialogImpl geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::operator= ( const GlobalPreferencesDialogImpl )
delete

◆ populateUi()

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::populateUi ( )
inlineprivate
166  {
167  }
Here is the caller graph for this function:

◆ setAutoLoadImageTaskSettings()

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setAutoLoadImageTaskSettings ( const bool  enabled)
inline
59  {
61  }
Here is the call graph for this function:

◆ setAutoSaveImageTaskSettings()

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setAutoSaveImageTaskSettings ( const bool  enabled)
inline
64  {
66  }
Here is the call graph for this function:

◆ setButtonColor()

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:

◆ setCustomImageTaskBackgroundOverrideColor()

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  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setGeometrizeLogo()

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setGeometrizeLogo ( const bool  enabled)
inline
44  {
46  }
Here is the call graph for this function:

◆ setImageTaskImageResize()

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setImageTaskImageResize ( const bool  enabled)
inline
138  {
140  }
Here is the call graph for this function:

◆ setImageTaskImageResizeThresholdHeight()

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setImageTaskImageResizeThresholdHeight ( const int  height)
inline
148  {
149  getPrefs().setImageTaskResizeThreshold(getPrefs().getImageTaskResizeThreshold().first, height);
150  }
Here is the call graph for this function:

◆ setImageTaskImageResizeThresholdWidth()

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setImageTaskImageResizeThresholdWidth ( const int  width)
inline
143  {
144  getPrefs().setImageTaskResizeThreshold(width, getPrefs().getImageTaskResizeThreshold().second);
145  }
Here is the call graph for this function:

◆ setMaxThreadsPerImageTask()

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setMaxThreadsPerImageTask ( const int  value)
inline
153  {
154  assert(value >= 0);
155  getPrefs().setImageTaskMaxThreads(static_cast<unsigned int>(value));
156  }
Here is the call graph for this function:

◆ setPopulateRecents()

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setPopulateRecents ( const bool  enabled)
inline
49  {
51  }
Here is the call graph for this function:

◆ setPopulateTemplates()

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setPopulateTemplates ( const bool  enabled)
inline
54  {
56  }
Here is the call graph for this function:

◆ setShouldReplaceTargetImageAlphaWithCustomColor()

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setShouldReplaceTargetImageAlphaWithCustomColor ( const bool  enabled)
inline
113  {
115  }
Here is the call graph for this function:

◆ setShouldUseCustomImageTaskBackgroundOverrideColor()

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setShouldUseCustomImageTaskBackgroundOverrideColor ( const bool  enabled)
inline
Here is the call graph for this function:

◆ setShowImageTaskConsoleByDefault()

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setShowImageTaskConsoleByDefault ( const bool  enabled)
inline
128  {
130  }
Here is the call graph for this function:

◆ setShowLaunchWindowConsoleByDefault()

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setShowLaunchWindowConsoleByDefault ( const bool  enabled)
inline
69  {
71  }
Here is the call graph for this function:

◆ setShowPixmapResultsByDefault()

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setShowPixmapResultsByDefault ( const bool  enabled)
inline
123  {
125  }
Here is the call graph for this function:

◆ setShowScriptEditorsByDefault()

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setShowScriptEditorsByDefault ( const bool  enabled)
inline
133  {
135  }
Here is the call graph for this function:

◆ setShowVectorResultsByDefault()

void geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setShowVectorResultsByDefault ( const bool  enabled)
inline
118  {
120  }
Here is the call graph for this function:

◆ setTargetImageAlphaReplacementColor()

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  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ syncUiWithPreferences()

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  }
Here is the call graph for this function:

Member Data Documentation

◆ q

GlobalPreferencesDialog* geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::q
private

◆ ui

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

The documentation for this class was generated from the following file:
geometrize::preferences::GlobalPreferences::setShouldShowImageTaskConsoleByDefault
void setShouldShowImageTaskConsoleByDefault(bool showConsole)
setShouldShowImageTaskConsoleByDefault Sets the preference for whether to show the console on the ima...
Definition: globalpreferences.cpp:583
geometrize::preferences::GlobalPreferences::setShouldReplaceTargetImageAlphaWithCustomColor
void setShouldReplaceTargetImageAlphaWithCustomColor(bool useColor)
setShouldReplaceTargetImageAlphaWithCustomColor Sets the preference for whether to replace the alpha ...
Definition: globalpreferences.cpp:553
geometrize::preferences::GlobalPreferences::setShouldShowImageTaskPixmapViewByDefault
void setShouldShowImageTaskPixmapViewByDefault(bool showPixmapView)
setShouldShowImageTaskPixmapViewByDefault Sets the preference for whether to show the image task pixm...
Definition: globalpreferences.cpp:603
geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::syncUiWithPreferences
void syncUiWithPreferences()
Definition: globalpreferencesdialog.cpp:174
geometrize::preferences::GlobalPreferences::setCustomImageTaskBackgroundOverrideColor
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
geometrize::preferences::GlobalPreferences::setShouldGeometrizeAppLogoOnLaunch
void setShouldGeometrizeAppLogoOnLaunch(bool geometrizeLogo)
setShouldGeometrizeAppLogoOnLaunch Sets the preference for whether to geometrize the app logo on the ...
Definition: globalpreferences.cpp:473
geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setCustomImageTaskBackgroundOverrideColor
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
geometrize::preferences::GlobalPreferences::setImageTaskResizeThreshold
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::setImageTaskMaxThreads
void setImageTaskMaxThreads(std::uint32_t maxThreads)
setImageTaskMaxThreads Sets the maximum number of threads the image task should use.
Definition: globalpreferences.cpp:633
geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::q
GlobalPreferencesDialog * q
Definition: globalpreferencesdialog.cpp:216
geometrize::preferences::GlobalPreferences::setShouldShowImageTaskVectorViewByDefault
void setShouldShowImageTaskVectorViewByDefault(bool showVectorView)
setShouldShowImageTaskVectorViewByDefault Sets the preference for whether to show the image task vect...
Definition: globalpreferences.cpp:573
geometrize::preferences::GlobalPreferences::setImageTaskImageResizeEnabled
void setImageTaskImageResizeEnabled(bool enabled)
setImageTaskImageResizeEnabled Sets the preference for whether image tasks should resize images that ...
Definition: globalpreferences.cpp:613
geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::getPrefs
geometrize::preferences::GlobalPreferences & getPrefs()
Definition: globalpreferencesdialog.cpp:169
geometrize::preferences::GlobalPreferences::getCustomImageTaskBackgroundOverrideColor
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::save
bool save(const std::string &filePath)
save Saves the global preferences to a file.
Definition: globalpreferences.cpp:453
geometrize::preferences::GlobalPreferences
The GlobalPreferences class models the preferences associated with the application as a whole....
Definition: globalpreferences.h:44
geometrize::preferences::GlobalPreferences::setShouldShowLaunchConsoleByDefault
void setShouldShowLaunchConsoleByDefault(bool showConsole)
setShouldShowLaunchConsoleByDefault Sets the preference for whether to show the console on the launch...
Definition: globalpreferences.cpp:563
geometrize::preferences::GlobalPreferences::setShouldPopulateTemplatesOnLaunch
void setShouldPopulateTemplatesOnLaunch(bool populateTemplates)
setShouldPopulateTemplatesOnLaunch Sets the preference for whether to populate the task templates on ...
Definition: globalpreferences.cpp:493
geometrize::preferences::GlobalPreferences::setShouldAutoSaveImageTaskSettings
void setShouldAutoSaveImageTaskSettings(bool saveSettings)
setShouldAutoSaveImageTaskSettings Sets the preference for whether to automatically save the last tas...
Definition: globalpreferences.cpp:533
geometrize::preferences::GlobalPreferences::setShouldPopulateRecentItemsOnLaunch
void setShouldPopulateRecentItemsOnLaunch(bool populateRecents)
setShouldPopulateRecentItemsOnLaunch Sets the preference for whether the recent items list should be ...
Definition: globalpreferences.cpp:483
geometrize::preferences::GlobalPreferences::setShouldShowImageTaskScriptEditorByDefault
void setShouldShowImageTaskScriptEditorByDefault(bool showScriptEditor)
setShouldShowImageTaskScriptEditorByDefault Sets the preference for whether to open the script editor...
Definition: globalpreferences.cpp:593
geometrize::preferences::GlobalPreferences::setShouldUseCustomImageTaskBackgroundOverrideColor
void setShouldUseCustomImageTaskBackgroundOverrideColor(bool useColor)
setShouldUseCustomImageTaskBackgroundOverrideColor Sets the preference for whether to use the custom ...
Definition: globalpreferences.cpp:513
geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::populateUi
void populateUi()
Definition: globalpreferencesdialog.cpp:165
geometrize::preferences::GlobalPreferences::getTargetImageAlphaReplacementColor
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
geometrize::preferences::GlobalPreferences::setShouldAutoLoadImageTaskSettings
void setShouldAutoLoadImageTaskSettings(bool loadSettings)
setShouldAutoLoadImageTaskSettings Sets the preference for whether to automatically load any previous...
Definition: globalpreferences.cpp:523
geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::ui
std::unique_ptr< Ui::GlobalPreferencesDialog > ui
Definition: globalpreferencesdialog.cpp:215
geometrize::preferences::GlobalPreferences::setTargetImageAlphaReplacementColor
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::getGlobalPreferences
geometrize::preferences::GlobalPreferences & getGlobalPreferences()
getGlobalPreferences Shorthand function that gets a reference to the shared global preferences object...
Definition: globalpreferences.cpp:32
geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setButtonColor
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
geometrize::preferences::getGlobalPreferencesConfigPath
std::string getGlobalPreferencesConfigPath()
getGlobalPreferencesConfigPath Gets the absolute path to where the global preferences config file sho...
Definition: globalpreferences.cpp:23
geometrize::dialog::GlobalPreferencesDialog::GlobalPreferencesDialogImpl::setTargetImageAlphaReplacementColor
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