FotoBox
|
Preference class to change and store the application settings. More...
#include <preferences.h>
Public Member Functions | |
Preferences (QWidget *parent=nullptr) | |
Preferences constructor. More... | |
~Preferences () override | |
Preferences destructor. More... | |
Preferences (const Preferences &other)=delete | |
Preferences default copy constructor. More... | |
Preferences & | operator= (const Preferences &other)=delete |
Preferences default copy assignment. More... | |
Preferences (Preferences &&other)=delete | |
Preferences default move constructor. More... | |
Preferences & | operator= (Preferences &&other)=delete |
Preferences default move assignment. More... | |
Private Slots | |
void | startFotoBox () |
Start the FotoBox. More... | |
void | colorDialog () |
Open a color picker to choose background color for FotoBox. More... | |
void | commandLineOptionsDialog () |
Show help dialog for gphoto2/raspistill command line options. More... | |
void | chooseDirectory () |
Open a QFileDialog to choose the photo directory. More... | |
void | clearDirectoryContent () |
Clear directory content of the photo directory. More... | |
void | restoreDefaultPreferences () |
Restore default preferences. More... | |
void | showColor (const QString &i_colorName) |
Show the given color in QLineEdit. More... | |
void | verifyApplication (const QString &i_name) |
Check camera application availability and provide help if needed. More... | |
bool | verifyPath (const QString &i_path) |
Check if the path is useable. More... | |
Private Member Functions | |
void | windowPosition () |
Set the window position. More... | |
void | pigpioDeamon () |
Check if pigpio deamon is reachable. More... | |
void | stopCountdownMode () |
Stop countdown, stop mouse tracking and set normal window title name. More... | |
void | connectUi () |
Signal & Slot connect. More... | |
void | loadPreferences () |
Load application settings from INI file. More... | |
void | setButtonIcons () |
Set icons for all QToolButtons. More... | |
void | savePreferences () |
Save the preferences to QSettings. More... | |
void | mouseMoveEvent (QMouseEvent *event) override |
This event handler, for event event, can be reimplemented in a subclass to receive mouse move events for the widget. More... | |
auto | applicationAvailable (const QString &i_name, const QString &i_message) -> bool |
Check if application is installed and available. More... | |
auto | gphotoInfo (const QString &i_name) -> QString |
Read gphoto2 / libgphoto2 version and camera model. More... | |
Private Attributes | |
Ui::PreferencesDialog * | m_ui |
QSettings | m_settings |
Countdown | m_countdown |
Static Private Attributes | |
static constexpr int | COUNTDOWN_START_VALUE = 10 |
static constexpr int | DEFAULT_COUNTDOWN_START_VALUE = 3 |
static constexpr unsigned int | DEFAULT_INPUT_PIN = 24 |
static constexpr unsigned int | DEFAULT_OUTPUT_PIN = 17 |
static constexpr unsigned int | DEFAULT_QUERY_INTERVAL = 10 |
static constexpr int | DEFAULT_TIMEOUT = 30 |
Preference class to change and store the application settings.
Definition at line 25 of file preferences.h.
|
explicit |
Preferences constructor.
parent | QWidget |
Definition at line 27 of file preferences.cpp.
References connectUi(), FotoBox::Countdown::elapsed(), loadPreferences(), m_countdown, m_ui, pigpioDeamon(), restoreDefaultPreferences(), setButtonIcons(), FotoBox::Countdown::start(), startFotoBox(), FotoBox::Countdown::update(), and windowPosition().
|
override |
|
delete |
Preferences default copy constructor.
|
delete |
Preferences default move constructor.
|
private |
Check if application is installed and available.
i_name | QString name of the application to check |
i_message | QString error message to display in QLabel |
Definition at line 483 of file preferences.cpp.
|
privateslot |
Open a QFileDialog to choose the photo directory.
Definition at line 288 of file preferences.cpp.
Referenced by connectUi().
|
privateslot |
Clear directory content of the photo directory.
Definition at line 306 of file preferences.cpp.
Referenced by connectUi().
|
privateslot |
Open a color picker to choose background color for FotoBox.
Definition at line 256 of file preferences.cpp.
Referenced by connectUi().
|
privateslot |
Show help dialog for gphoto2/raspistill command line options.
official documentation and usefull examples
Definition at line 275 of file preferences.cpp.
Referenced by connectUi().
|
private |
Signal & Slot connect.
Definition at line 97 of file preferences.cpp.
References chooseDirectory(), clearDirectoryContent(), colorDialog(), commandLineOptionsDialog(), FotoBox::PreferenceProvider::instance(), m_ui, FotoBox::PreferenceProvider::setArgumentLine(), FotoBox::PreferenceProvider::setBackgroundColor(), FotoBox::PreferenceProvider::setCameraMode(), FotoBox::PreferenceProvider::setCountdown(), FotoBox::PreferenceProvider::setCountdownColor(), FotoBox::PreferenceProvider::setGrayscale(), FotoBox::PreferenceProvider::setInputPin(), FotoBox::PreferenceProvider::setOutputPin(), FotoBox::PreferenceProvider::setPhotoFolder(), FotoBox::PreferenceProvider::setPhotoName(), FotoBox::PreferenceProvider::setPrint(), FotoBox::PreferenceProvider::setPrinterName(), FotoBox::PreferenceProvider::setQueryInterval(), FotoBox::PreferenceProvider::setShowButtons(), FotoBox::PreferenceProvider::setTimeoutValue(), showColor(), startFotoBox(), stopCountdownMode(), verifyApplication(), and verifyPath().
Referenced by Preferences().
|
private |
Read gphoto2 / libgphoto2 version and camera model.
i_name | QString name of the application to check |
Definition at line 504 of file preferences.cpp.
|
private |
Load application settings from INI file.
Definition at line 212 of file preferences.cpp.
Referenced by Preferences().
|
overrideprivate |
This event handler, for event event, can be reimplemented in a subclass to receive mouse move events for the widget.
stopping auto accept dialog
Definition at line 184 of file preferences.cpp.
|
delete |
Preferences default copy assignment.
|
delete |
Preferences default move assignment.
|
private |
Check if pigpio deamon is reachable.
Definition at line 87 of file preferences.cpp.
References FotoBox::Buzzer::checkDeamon(), and m_ui.
Referenced by Preferences().
|
privateslot |
Restore default preferences.
Definition at line 419 of file preferences.cpp.
Referenced by Preferences().
|
private |
Save the preferences to QSettings.
Definition at line 377 of file preferences.cpp.
|
private |
Set icons for all QToolButtons.
Definition at line 161 of file preferences.cpp.
Referenced by Preferences().
|
privateslot |
Show the given color in QLineEdit.
i_colorName | QString hex name of the color |
Definition at line 360 of file preferences.cpp.
Referenced by connectUi().
|
privateslot |
Start the FotoBox.
Definition at line 170 of file preferences.cpp.
Referenced by connectUi(), and Preferences().
|
private |
Stop countdown, stop mouse tracking and set normal window title name.
Definition at line 192 of file preferences.cpp.
Referenced by connectUi().
|
privateslot |
Check camera application availability and provide help if needed.
gphoto2: set version and camera model
i_name | QString name of the application to check |
Definition at line 450 of file preferences.cpp.
Referenced by connectUi().
|
privateslot |
Check if the path is useable.
i_path | QString directory which stores the photos |
Definition at line 331 of file preferences.cpp.
Referenced by connectUi().
|
private |
Set the window position.
if the height of the Preference dialog is greater than the available screen height, start maximizing otherwise center the dialog
Definition at line 75 of file preferences.cpp.
Referenced by Preferences().
|
staticconstexprprivate |
Countdown start value (10 seconds)
Definition at line 172 of file preferences.h.
|
staticconstexprprivate |
Default countdown start value (3 seconds)
Definition at line 175 of file preferences.h.
|
staticconstexprprivate |
Default input PIN
Definition at line 178 of file preferences.h.
|
staticconstexprprivate |
Default output PIN
Definition at line 181 of file preferences.h.
|
staticconstexprprivate |
Default query interval
Definition at line 184 of file preferences.h.
|
staticconstexprprivate |
Default time out (QProcess timed out)
Definition at line 187 of file preferences.h.
|
private |
Countdown to "auto close dialog"
Definition at line 196 of file preferences.h.
Referenced by Preferences().
|
private |
Store and read settings (INI file)
Definition at line 193 of file preferences.h.
|
private |
User Interface
Definition at line 190 of file preferences.h.
Referenced by connectUi(), pigpioDeamon(), Preferences(), and ~Preferences().