FotoBox
preferenceprovider.cpp
Go to the documentation of this file.
1 /* preferenceprovider.cpp
2  *
3  * Copyright (c) 2018 Thomas Kais
4  *
5  * This file is subject to the terms and conditions defined in
6  * file 'COPYING', which is part of this source code package.
7  */
8 #include "preferenceprovider.h"
9 
10 namespace FotoBox {
11 
13 {
14  //thread safe static initializer
15  static PreferenceProvider instance;
16  return instance;
17 }
18 
19 PreferenceProvider::PreferenceProvider(QObject* /*parent*/) : QObject(nullptr)
20 {
21 
22 }
23 
24 //Qt Porperty
25 auto PreferenceProvider::photoFolder() const -> QString
26 {
27  return m_photoFolder;
28 }
29 
30 void PreferenceProvider::setPhotoFolder(const QString& i_value)
31 {
32  if (m_photoFolder == i_value) {
33  return;
34  }
35 
36  m_photoFolder = i_value;
38 }
39 
40 auto PreferenceProvider::photoName() const -> QString
41 {
42  return m_photoName;
43 }
44 
45 void PreferenceProvider::setPhotoName(const QString& i_value)
46 {
47  if (m_photoName == i_value) {
48  return;
49  }
50 
51  m_photoName = i_value;
53 }
54 
55 auto PreferenceProvider::countdown() const -> int
56 {
57  return m_countdown;
58 }
59 
60 void PreferenceProvider::setCountdown(const int i_value)
61 {
62  if (m_countdown == i_value) {
63  return;
64  }
65 
66  m_countdown = i_value;
68 }
69 
70 auto PreferenceProvider::countdownColor() const -> QString
71 {
72  return m_countdownColor;
73 }
74 
75 void PreferenceProvider::setCountdownColor(const QString& i_value)
76 {
77  if (m_countdownColor == i_value) {
78  return;
79  }
80 
81  m_countdownColor = i_value;
83 }
84 
85 auto PreferenceProvider::backgroundColor() const -> QString
86 {
87  return m_backgroundColor;
88 }
89 
90 void PreferenceProvider::setBackgroundColor(const QString& i_value)
91 {
92  if (m_backgroundColor == i_value) {
93  return;
94  }
95 
96  m_backgroundColor = i_value;
98 }
99 
100 auto PreferenceProvider::cameraMode() const -> QString
101 {
102  return m_cameraMode;
103 }
104 
105 void PreferenceProvider::setCameraMode(const QString& i_value)
106 {
107  if (m_cameraMode == i_value) {
108  return;
109  }
110 
111  m_cameraMode = i_value;
113 }
114 
115 auto PreferenceProvider::argumentLine() const -> QString
116 {
117  return m_argumentLine;
118 }
119 
120 void PreferenceProvider::setArgumentLine(const QString& i_value)
121 {
122  if (m_argumentLine == i_value) {
123  return;
124  }
125 
126  m_argumentLine = i_value;
128 }
129 
130 auto PreferenceProvider::inputPin() const -> unsigned int
131 {
132  return m_inputPin;
133 }
134 
135 void PreferenceProvider::setInputPin(const unsigned int i_value)
136 {
137  if (m_inputPin == i_value) {
138  return;
139  }
140 
141  m_inputPin = i_value;
142  Q_EMIT inputPinChanged(m_inputPin);
143 }
144 
145 auto PreferenceProvider::outputPin() const -> unsigned int
146 {
147  return m_outputPin;
148 }
149 
150 void PreferenceProvider::setOutputPin(const unsigned int i_value)
151 {
152  if (m_outputPin == i_value) {
153  return;
154  }
155 
156  m_outputPin = i_value;
158 }
159 
160 auto PreferenceProvider::queryInterval() const -> unsigned int
161 {
162  return m_queryInterval;
163 }
164 
165 void PreferenceProvider::setQueryInterval(const unsigned int i_value)
166 {
167  if (m_queryInterval == i_value) {
168  return;
169  }
170 
171  m_queryInterval = i_value;
173 }
174 
176 {
177  return m_timeoutValue;
178 }
179 
180 void PreferenceProvider::setTimeoutValue(const int i_value)
181 {
182  if (m_timeoutValue == i_value) {
183  return;
184  }
185 
186  m_timeoutValue = i_value;
188 }
189 
190 auto PreferenceProvider::grayscale() const -> bool
191 {
192  return m_grayscale;
193 }
194 
196 {
197  if (m_grayscale == i_value) {
198  return;
199  }
200 
201  m_grayscale = i_value;
203 }
204 
206 {
207  return m_showButtons;
208 }
209 
210 void PreferenceProvider::setShowButtons(const bool i_value)
211 {
212  if (m_showButtons == i_value) {
213  return;
214  }
215 
216  m_showButtons = i_value;
218 }
219 
220 auto PreferenceProvider::print() const -> bool
221 {
222  return m_print;
223 }
224 
225 void PreferenceProvider::setPrint(const bool i_value)
226 {
227  if (m_print == i_value) {
228  return;
229  }
230 
231  m_print = i_value;
232  Q_EMIT printChanged(m_print);
233 }
234 
235 auto PreferenceProvider::printerName() const -> QString
236 {
237  return m_printerName;
238 }
239 
240 void PreferenceProvider::setPrinterName(const QString& i_value)
241 {
242  if (m_printerName == i_value) {
243  return;
244  }
245 
246  m_printerName = i_value;
248 }
249 
250 } // end namespace FotoBox
Preference who stores the preferences.
void inputPinChanged(unsigned int)
signal: pigpio GPIO input pin has changed
void argumentLineChanged(QString)
signal: camera framework arguments has changed
void setOutputPin(unsigned int i_value)
set pigpio GPIO output pin
void setInputPin(unsigned int i_value)
set pigpio GPIO input pin
void backgroundColorChanged(QString)
signal: background color of the FotoBox UI has changed
void photoNameChanged(QString)
signal: photo name template has changed
void setQueryInterval(unsigned int i_value)
set how often the pin should be queried
void cameraModeChanged(QString)
signal: the camera framework to be used has changed
void setTimeoutValue(int i_value)
set timeout value for the camera framework
void setCountdown(int i_value)
set countdown until photo is taken
void printChanged(bool)
signal: print has changed
void setCameraMode(const QString &i_value)
set the camera framework to be used
void setArgumentLine(const QString &i_value)
set camera framework arguments
void setPhotoFolder(const QString &i_value)
set photo output directory
void setPhotoName(const QString &i_value)
set photo name template
void photoFolderChanged(QString)
signal: photo output directory has changed
void setPrinterName(const QString &i_value)
set printer name
void showButtonsChanged(bool)
signal: whether buttons are displayed on the UI has changed
void setShowButtons(bool i_value)
set whether buttons are displayed on the UI
void setCountdownColor(const QString &i_value)
set font color of the countdown
void countdownChanged(int)
signal: countdown until photo is taken has changed
static PreferenceProvider & instance()
get instance (Meyers Singleton)
void setGrayscale(bool i_value)
set grayscale bool (monochrome photography)
void timeoutValueChanged(int)
signal: timeout value for the camera framework has changed
void grayscaleChanged(bool)
signal: grayscale (monochrome photography) has changed
void outputPinChanged(unsigned int)
signal: pigpio GPIO output pin has changed
void countdownColorChanged(QString)
signal: font color of the countdown has changed
void setPrint(bool i_value)
set print on or off
void queryIntervalChanged(unsigned int)
signal: how often the pin should be queried has changed
void setBackgroundColor(const QString &i_value)
set background color of the FotoBox UI
PreferenceProvider(QObject *parent=nullptr)
hide Preferences default constructor (Singleton)
void printerNameChanged(QString)
signal: printer name has changed