Initial commit. corresponds to 1.0-1 release
[flashstrobe] / src / mainwindow.h
1 /*
2   Copyright (C) 2010 by Juan Carlos Torres <jucato@kdemail.net>
3
4   This program is free software; you can redistribute it and/or
5   modify it under the terms of the GNU General Public License as
6   published by the Free Software Foundation; either version 2 of
7   the License or (at your option) version 3 or any later version
8   accepted by the membership of KDE e.V. (or its successor appro-
9   ved by the membership of KDE e.V.), which shall act as a proxy
10   defined in Section 14 of version 3 of the license.
11
12   This program is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15   GNU General Public License for more details.
16
17   You should have received a copy of the GNU General Public License
18   along with this program. If not, see http://www.gnu.org/licenses/.
19 */
20
21
22 #ifndef MAINWINDOW_H
23 #define MAINWINDOW_H
24
25 #include <QWidget>
26
27 class Camera;
28 class MusicPlayer;
29
30 class QTimer;
31
32 #include "ui_mainwindow.h"
33
34 /**
35  * @brief Flash Strobe main window
36  *
37  * This is the main window for Flash Strobe. This simple
38  * class creates the widgets for controlling the flash
39  * and adds a MusicPlayer widget for playing music.
40  */
41 class MainWindow : public QWidget
42 {
43     Q_OBJECT
44
45     public:
46         MainWindow(QWidget* parent = 0);
47         ~MainWindow();
48
49     public slots:
50         /**
51          * Slot for changing the strobing frequency. The actual
52          * frequency is computed to and displayed as beats per minute (bpm)
53          *
54          * @param frequency Strobing frequency in hertz. Valid range is
55          *                  from 2 to 8 Hz (120 to 600 bpm)
56          */
57         void frequencyChanged(int frequency);
58
59         /**
60          * Slot to turn strobing on or off. Strobing frequency is
61          * set by the user. Flash intensity is fixed at 215 mA. The
62          * strobing repetition is controlled by a QTimer.
63          *
64          * @param checked Determines if strobing is on (@c true) or off (@c false)
65          */
66         void toggleStrobe(bool checked);
67
68         /**
69          * Slot to enable or disable the widgets, depending on certain
70          * conditions, such as the camera shutter state. If the shutter
71          * is closed, widgets are disabled. The MusicPlayer widgets are
72          * controlled independently of the overall application state.
73          *
74          * @param enable Specifies if widgets are enabled (@c true) or disabled (@c false)
75          */
76         void toggleAppState(bool enable);
77
78     private:
79         Ui::MainWindow* m_ui;
80
81         int m_timeout;
82
83         Camera* m_camera;
84         MusicPlayer* m_player;
85
86         QTimer* m_timer;
87 };
88
89 #endif