The FotoBox class Main class to control UI and controll the process.  
 More...
#include <fotobox.h>
|  | 
| static auto | calculateFontSize (double i_width, double i_widthFont) -> double | 
|  | calculate "maximum" fitting font size  More... 
 | 
|  | 
|  | 
| Ui::FotoBoxDialog * | m_ui | 
|  | 
| Countdown | m_countdown | 
|  | 
| QThread | m_workerThread | 
|  | 
| Buzzer | m_buzzer | 
|  | 
| Camera | m_camera | 
|  | 
| QPixmap | m_photo | 
|  | 
| const QString | m_photoDir | 
|  | 
| const std::vector< Qt::Key > | 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} | 
|  | 
| const std::vector< Qt::Key > | m_preferenceKey {Qt::Key_P, Qt::Key_S, Qt::Key_E} | 
|  | 
| const std::vector< Qt::Key > | m_quitKey {Qt::Key_Escape, Qt::Key_Q} | 
|  | 
The FotoBox class Main class to control UI and controll the process. 
Definition at line 30 of file fotobox.h.
◆ FotoBox() [1/3]
  
  | 
        
          | FotoBox::FotoBox::FotoBox | ( | QWidget * | parent = nullptr | ) |  |  | explicit | 
 
FotoBox constructor. 
- Parameters
- 
  
  
Definition at line 21 of file fotobox.cpp.
   23     , 
m_ui(
new Ui::FotoBoxDialog)
 
   33     setWindowTitle(QStringLiteral(
"%1 v%2 (Copyright 2016 %3)").arg(QApplication::applicationName(), QApplication::applicationVersion(), QApplication::organizationName()));
 
   39     setAttribute(Qt::WA_DeleteOnClose);
 
   42     connect(
m_ui->statusBar, &QStatusBar::messageChanged, 
this, [&](
const QString &i_message) { i_message.isNull() ? m_ui->statusBar->hide() : m_ui->statusBar->show(); });
 
   44     m_ui->statusBar->hide();
 
   50 #if defined(BUZZER_AVAILABLE) 
void countdown()
With or without countdown.
void buzzer()
creates a new Buzzer object
void buttons()
With or without buttons.
static PreferenceProvider & instance()
get instance (Meyers Singleton)
 
References FotoBox::PreferenceProvider::instance().
 
 
◆ ~FotoBox()
  
  | 
        
          | FotoBox::FotoBox::~FotoBox | ( |  | ) |  |  | override | 
 
 
◆ FotoBox() [2/3]
  
  | 
        
          | FotoBox::FotoBox::FotoBox | ( | const FotoBox & | other | ) |  |  | delete | 
 
 
◆ FotoBox() [3/3]
  
  | 
        
          | FotoBox::FotoBox::FotoBox | ( | FotoBox && | other | ) |  |  | delete | 
 
 
◆ buttons()
  
  | 
        
          | void FotoBox::FotoBox::buttons | ( |  | ) |  |  | private | 
 
With or without buttons. 
Definition at line 60 of file fotobox.cpp.
   64         connect(
m_ui->btnStart, &QPushButton::clicked, 
this, &FotoBox::start);
 
   65         connect(
m_ui->btnPreferencesDialog, &QPushButton::clicked, 
this, &FotoBox::preferenceDialog);
 
   66         connect(
m_ui->btnQuitApp, &QPushButton::clicked, QCoreApplication::instance(), &QCoreApplication::quit);
 
   69         QGuiApplication::setOverrideCursor(Qt::BlankCursor);
 
   71         m_ui->btnStart->hide();
 
   72         m_ui->btnPreferencesDialog->hide();
 
   73         m_ui->btnQuitApp->hide();
 
 
References FotoBox::PreferenceProvider::instance().
 
 
◆ buzzer()
  
  | 
        
          | void FotoBox::FotoBox::buzzer | ( |  | ) |  |  | private | 
 
creates a new Buzzer object 
Definition at line 77 of file fotobox.cpp.
   79 #if defined(BUZZER_AVAILABLE) 
void queryPin()
Query the Raspberry Pi pin.
auto initialise() -> bool
Initialises the library and sets the GPIO mode.
void triggered()
Buzzer was pressed.
void startBuzzer()
signal: start query pin with Buzzer class
static constexpr int STATUSBAR_MSG_TIMEOUT
 
References FotoBox::Buzzer::queryPin(), and FotoBox::Buzzer::triggered().
 
 
◆ calculateFontSize()
  
  | 
        
          | auto FotoBox::FotoBox::calculateFontSize | ( | double | i_width, |  
          |  |  | double | i_widthFont |  
          |  | ) |  | -> double |  | staticprivate | 
 
calculate "maximum" fitting font size 
- Parameters
- 
  
    | i_width | double |  | i_widthFont | double |  
 
- Returns
- best fitting fontsize 
Definition at line 280 of file fotobox.cpp.
  282     auto factor = i_width / i_widthFont;
 
  283     if ((factor < 1) || (factor > 
COMPARE)) {
 
static constexpr double COMPARE
 
 
 
◆ closeFullscreenWindowOnMac()
  
  | 
        
          | void FotoBox::FotoBox::closeFullscreenWindowOnMac | ( |  | ) |  |  | private | 
 
Is used as a workaround for macOS to close a fullscreen window. 
close the window again, using the native MacOS API (https://bugreports.qt.io/browse/QTBUG-46701) 
Definition at line 16 of file fotoboxmac.mm.
   19     const auto *view = 
reinterpret_cast<NSView *
>(winId());
 
   24     const auto *window = view.window;
 
 
 
 
◆ countdown()
  
  | 
        
          | void FotoBox::FotoBox::countdown | ( |  | ) |  |  | private | 
 
 
◆ drawText()
  
  | 
        
          | void FotoBox::FotoBox::drawText | ( | const QString & | i_text | ) |  |  | private | 
 
Draw text on the QPixmap. 
- See also
- m_photo 
- Parameters
- 
  
  
Definition at line 260 of file fotobox.cpp.
  269     QFont font = painter.font();
 
  271     font.setPointSizeF(font.pointSizeF() * size);
 
  272     painter.setFont(font);
 
  275     painter.drawText(
m_photo.rect(), Qt::AlignCenter, i_text);
 
static auto calculateFontSize(double i_width, double i_widthFont) -> double
calculate "maximum" fitting font size
 
References FotoBox::PreferenceProvider::instance().
 
 
◆ keyPressEvent()
  
  | 
        
          | void FotoBox::FotoBox::keyPressEvent | ( | QKeyEvent * | event | ) |  |  | overrideprivate | 
 
filter key press events 
Enter -> take a photo / Escape -> quit application 
- Parameters
- 
  
  
Definition at line 151 of file fotobox.cpp.
  154     if (!event->isAutoRepeat()) {
 
  156         if (std::any_of(
m_triggerKey.cbegin(), 
m_triggerKey.cend(), [&](
const Qt::Key i_key) -> 
bool { return event->key() == i_key; })) {
 
  168         if (std::any_of(
m_quitKey.cbegin(), 
m_quitKey.cend(), [&](
const Qt::Key i_key) -> 
bool { return event->key() == i_key; })) {
 
  169             if (event->modifiers() == Qt::ShiftModifier) {
 
  170                 QCoreApplication::quit();
 
  172             m_ui->statusBar->showMessage(tr(
"To quit the application, please hold down the Shift key while press Escape key."), 
STATUSBAR_MSG_TIMEOUT);
 
void start()
signal: start FotoBox
void preferenceDialog()
show preference dialog and close dialog
const std::vector< Qt::Key > m_quitKey
const std::vector< Qt::Key > m_triggerKey
const std::vector< Qt::Key > m_preferenceKey
 
 
 
◆ loadPhoto()
  
  | 
        
          | void FotoBox::FotoBox::loadPhoto | ( | const QString & | i_filePath | ) |  |  | private | 
 
 
◆ mouseReleaseEvent()
  
  | 
        
          | void FotoBox::FotoBox::mouseReleaseEvent | ( | QMouseEvent * | event | ) |  |  | overrideprivate | 
 
This event handler, for event event, can be reimplemented in a subclass to receive mouse release events for the widget. 
no buttons on UI and left click 
- See also
- emit start() 
- Parameters
- 
  
  
Definition at line 178 of file fotobox.cpp.
  186     QWidget::mouseReleaseEvent(event);
 
 
References FotoBox::PreferenceProvider::instance().
 
 
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ photo
  
  | 
        
          | void FotoBox::FotoBox::photo | ( |  | ) |  |  | privateslot | 
 
trigger camera to shot a photo and try to show it 
Definition at line 208 of file fotobox.cpp.
  211     m_ui->lcdCountdown->hide();
 
  212     QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
 
  215     m_ui->lblPhoto->show();
 
  216     m_ui->lblPhoto->clear();
 
  217     m_ui->lblPhoto->repaint();
 
  231 #if defined(BUZZER_AVAILABLE) 
auto currentPhoto() const -> QString
return member
auto shootPhoto() -> bool
shoot a photo with gphoto2
auto reset() -> bool
Reset countdown (reset.
void loadPhoto(const QString &i_filePath)
try to load the photo to QPixmap
 
References FotoBox::PreferenceProvider::instance().
 
 
◆ preferenceDialog
  
  | 
        
          | void FotoBox::FotoBox::preferenceDialog | ( |  | ) |  |  | privateslot | 
 
show preference dialog and close dialog 
Definition at line 189 of file fotobox.cpp.
  192     auto *dialog = 
new Preferences;
 
  195     QApplication::restoreOverrideCursor();
 
  200 #if defined(Q_OS_MACOS) 
void closeFullscreenWindowOnMac()
Is used as a workaround for macOS to close a fullscreen window.
 
 
 
◆ start
  
  | 
        
          | void FotoBox::FotoBox::start | ( |  | ) |  |  | signal | 
 
 
◆ startBuzzer
  
  | 
        
          | void FotoBox::FotoBox::startBuzzer | ( |  | ) |  |  | signal | 
 
signal: start query pin with Buzzer class 
 
 
◆ COMPARE
  
  | 
        
          | constexpr double FotoBox::FotoBox::COMPARE = 1.25 |  | staticconstexprprivate | 
 
 
◆ m_buzzer
  
  | 
        
          | Buzzer FotoBox::FotoBox::m_buzzer |  | private | 
 
buzzer using pigpio library 
Definition at line 151 of file fotobox.h.
 
 
◆ m_camera
  
  | 
        
          | Camera FotoBox::FotoBox::m_camera |  | private | 
 
 
◆ m_countdown
◆ m_photo
  
  | 
        
          | QPixmap FotoBox::FotoBox::m_photo |  | private | 
 
store / load the photo 
Definition at line 157 of file fotobox.h.
 
 
◆ m_photoDir
  
  | 
        
          | const QString FotoBox::FotoBox::m_photoDir |  | private | 
 
 
◆ m_preferenceKey
  
  | 
        
          | const std::vector<Qt::Key> FotoBox::FotoBox::m_preferenceKey {Qt::Key_P, Qt::Key_S, Qt::Key_E} |  | private | 
 
keyboard shortcut to go back to preference dialog 
Definition at line 167 of file fotobox.h.
 
 
◆ m_quitKey
  
  | 
        
          | const std::vector<Qt::Key> FotoBox::FotoBox::m_quitKey {Qt::Key_Escape, Qt::Key_Q} |  | private | 
 
keyboard shortcut to quit the application 
Definition at line 170 of file fotobox.h.
 
 
◆ m_triggerKey
  
  | 
        
          | const std::vector<Qt::Key> FotoBox::FotoBox::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} |  | private | 
 
 
◆ m_ui
  
  | 
        
          | Ui::FotoBoxDialog* FotoBox::FotoBox::m_ui |  | private | 
 
 
◆ m_workerThread
  
  | 
        
          | QThread FotoBox::FotoBox::m_workerThread |  | private | 
 
 
◆ STATUSBAR_MSG_TIMEOUT
  
  | 
        
          | constexpr int FotoBox::FotoBox::STATUSBAR_MSG_TIMEOUT = 8000 |  | staticconstexprprivate | 
 
status bar timout value 
Definition at line 136 of file fotobox.h.
 
 
The documentation for this class was generated from the following files: