Created a website for Flash Strobe on Maemo Garage
[flashstrobe] / src / main.cpp
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  * Flash Strobe - Strobe light application for the N900
23  *
24  * Use the N900's flash LEDs as a strobe light. The user can set the
25  * frequency of the strobing in beats per minute (bpm). Additionally,
26  * the user can open any audio file to play in the background. The
27  * camera shutters need to be kept open. For  best results, close any
28  * program using the camera.
29  *
30  * 18  Do not point the flash at anyone's eyes
31  */
32
33 #include "camera.h"
34 #include "mainwindow.h"
35
36 #include <QApplication>
37 #include <QMessageBox>
38
39 int main(int argc, char **argv)
40 {
41     QApplication app(argc, argv);
42     char device[15] = "/dev/video0";
43
44     // First check if there is even a camera at all. If none is found, notify the user and quit
45     if (Camera::open(device) == -1)
46     {
47         QMessageBox msg;
48         msg.setWindowTitle(QObject::tr("No Camera"));
49         msg.setText(QObject::tr("There was no camera found on this device. The program will now close"));
50         msg.exec();
51
52         return -1;
53     }
54     else
55     {
56         app.setApplicationName("flashstrobe");
57         MainWindow window;
58         window.show();
59
60         return app.exec();
61     }
62 }