FotoBox
fotobox.h
Go to the documentation of this file.
1 /* fotobox.h
2  *
3  * Copyright (c) 2016 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 #ifndef FOTOBOX_H
9 #define FOTOBOX_H
10 
11 #include "buzzer.h"
12 #include "camera.h"
13 #include "countdown.h"
14 
15 #include <QDialog>
16 #include <QThread>
17 
18 class QKeyEvent;
19 
20 namespace Ui {
21 class FotoBoxDialog;
22 } //namespace Ui
23 
24 namespace FotoBox {
25 
30 class FotoBox : public QDialog
31 {
32  Q_OBJECT
33 
34 public:
39  explicit FotoBox(QWidget *parent = nullptr);
40 
44  ~FotoBox() override;
45 
49  FotoBox(const FotoBox &other) = delete;
50 
54  FotoBox &operator=(const FotoBox &other) = delete;
55 
59  FotoBox(FotoBox &&other) = delete;
60 
64  FotoBox &operator=(FotoBox &&other) = delete;
65 
66 private Q_SLOTS:
70  void photo();
71 
75  void preferenceDialog();
76 
77 private:
78 #if defined(Q_OS_MACOS)
83  void closeFullscreenWindowOnMac();
84 #endif
85 
91  void keyPressEvent(QKeyEvent *event) override;
92 
98  void mouseReleaseEvent(QMouseEvent *event) override;
99 
103  void buttons();
104 
108  void countdown();
109 
113  void buzzer();
114 
119  void loadPhoto(const QString &i_filePath);
120 
125  void drawText(const QString &i_text);
126 
133  auto static calculateFontSize(double i_width, double i_widthFont) -> double;
134 
136  static constexpr int STATUSBAR_MSG_TIMEOUT = 8000;
137 
139  static constexpr double COMPARE = 1.25;
140 
142  Ui::FotoBoxDialog *m_ui;
143 
146 
148  QThread m_workerThread;
149 
152 
155 
157  QPixmap m_photo;
158 
160  const QString m_photoDir;
161 
163  const std::vector<Qt::Key>
164  m_triggerKey{Qt::Key_N, Qt::Key_Return, Qt::Key_Enter, Qt::Key_PageDown, Qt::Key_PageUp, Qt::Key_Left, Qt::Key_Right, Qt::Key_Up, Qt::Key_Down, Qt::Key_Space, Qt::Key_Backspace};
165 
167  const std::vector<Qt::Key> m_preferenceKey{Qt::Key_P, Qt::Key_S, Qt::Key_E};
168 
170  const std::vector<Qt::Key> m_quitKey{Qt::Key_Escape, Qt::Key_Q};
171 
172 Q_SIGNALS:
176  void start();
177 
181  void startBuzzer();
182 };
183 
184 } // end namespace FotoBox
185 
186 #endif // FOTOBOX_H
This class handles the buzzer.
Definition: buzzer.h:27
The Camera class Use gphoto2 to send commands to camera.
Definition: camera.h:21
The Countdown class.
Definition: countdown.h:21
Buzzer m_buzzer
Definition: fotobox.h:151
void startBuzzer()
signal: start query pin with Buzzer class
void start()
signal: start FotoBox
QThread m_workerThread
Definition: fotobox.h:148
FotoBox(const FotoBox &other)=delete
FotoBox default copy constructor.
FotoBox & operator=(const FotoBox &other)=delete
FotoBox default copy assignment.
const QString m_photoDir
Definition: fotobox.h:160
QPixmap m_photo
Definition: fotobox.h:157
Camera m_camera
Definition: fotobox.h:154
Ui::FotoBoxDialog * m_ui
Definition: fotobox.h:142
FotoBox(FotoBox &&other)=delete
FotoBox default move constructor.
Countdown m_countdown
Definition: fotobox.h:145
FotoBox & operator=(FotoBox &&other)=delete
FotoBox default move assignment.
Definition: fotobox.h:20