Initial commit. corresponds to 1.0-1 release
[flashstrobe] / src / main.cpp
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644 (file)
index 0000000..003a002
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+  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/.
+*/
+
+/**
+ * Flash Strobe - Strobe light application for the N900
+ *
+ * Use the N900's flash LEDs as a strobe light. The user can set the
+ * frequency of the strobing in beats per minute (bpm). Additionally,
+ * the user can open any audio file to play in the background. The
+ * camera shutters need to be kept open. For  best results, close any
+ * program using the camera.
+ *
+ * 18  Do not point the flash at anyone's eyes
+ */
+
+#include "camera.h"
+#include "mainwindow.h"
+
+#include <QApplication>
+#include <QMessageBox>
+
+int main(int argc, char **argv)
+{
+    QApplication app(argc, argv);
+    char device[15] = "/dev/video0";
+
+    // First check if there is even a camera at all. If none is found, notify the user and quit
+    if (Camera::open(device) == -1)
+    {
+        QMessageBox msg;
+        msg.setWindowTitle(QObject::tr("No Camera"));
+        msg.setText(QObject::tr("There was no camera found on this device. The program will now close"));
+        msg.exec();
+
+        return -1;
+    }
+    else
+    {
+        app.setApplicationName("flashstrobe");
+        MainWindow window;
+        window.show();
+
+        return app.exec();
+    }
+}