Initial commit. corresponds to 1.0-1 release
[flashstrobe] / src / mainwindow.h
diff --git a/src/mainwindow.h b/src/mainwindow.h
new file mode 100644 (file)
index 0000000..d23c00d
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+  Copyright (C) 2010 by Juan Carlos Torres <jucato@kdemail.net>
+
+  This program is free software; you can redistribute it and/or
+  modify it under the terms of the GNU General Public License as
+  published by the Free Software Foundation; either version 2 of
+  the License or (at your option) version 3 or any later version
+  accepted by the membership of KDE e.V. (or its successor appro-
+  ved by the membership of KDE e.V.), which shall act as a proxy
+  defined in Section 14 of version 3 of the license.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program. If not, see http://www.gnu.org/licenses/.
+*/
+
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QWidget>
+
+class Camera;
+class MusicPlayer;
+
+class QTimer;
+
+#include "ui_mainwindow.h"
+
+/**
+ * @brief Flash Strobe main window
+ *
+ * This is the main window for Flash Strobe. This simple
+ * class creates the widgets for controlling the flash
+ * and adds a MusicPlayer widget for playing music.
+ */
+class MainWindow : public QWidget
+{
+    Q_OBJECT
+
+    public:
+        MainWindow(QWidget* parent = 0);
+        ~MainWindow();
+
+    public slots:
+        /**
+         * Slot for changing the strobing frequency. The actual
+         * frequency is computed to and displayed as beats per minute (bpm)
+         *
+         * @param frequency Strobing frequency in hertz. Valid range is
+         *                  from 2 to 8 Hz (120 to 600 bpm)
+         */
+        void frequencyChanged(int frequency);
+
+        /**
+         * Slot to turn strobing on or off. Strobing frequency is
+         * set by the user. Flash intensity is fixed at 215 mA. The
+         * strobing repetition is controlled by a QTimer.
+         *
+         * @param checked Determines if strobing is on (@c true) or off (@c false)
+         */
+        void toggleStrobe(bool checked);
+
+        /**
+         * Slot to enable or disable the widgets, depending on certain
+         * conditions, such as the camera shutter state. If the shutter
+         * is closed, widgets are disabled. The MusicPlayer widgets are
+         * controlled independently of the overall application state.
+         *
+         * @param enable Specifies if widgets are enabled (@c true) or disabled (@c false)
+         */
+        void toggleAppState(bool enable);
+
+    private:
+        Ui::MainWindow* m_ui;
+
+        int m_timeout;
+
+        Camera* m_camera;
+        MusicPlayer* m_player;
+
+        QTimer* m_timer;
+};
+
+#endif