Upgrade to "3.0 (quilt)" source format
[fmit.git] / src / main.cpp
1 // Copyright 2004 "Gilles Degottex"
2
3 // This file is part of "fmit"
4
5 // "fmit" is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // "fmit" is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
19
20 #include "config.h"
21
22 #include <iostream>
23 using namespace std;
24 #include <signal.h>
25 #include <qapplication.h>
26 #include <qtextcodec.h>
27 #include <GL/glut.h>
28
29 #include <CppAddons/CAMath.h>
30
31 #include "CustomInstrumentTunerForm.h"
32 CustomInstrumentTunerForm* g_main_form = NULL;
33
34 void signal_interrupt(int sig)
35 {
36         cerr << "Interrupt" << endl;
37
38         delete g_main_form;
39
40         exit(sig);
41 }
42 void signal_term(int sig)
43 {
44         cerr << "No No ! Pleeeeeease ... *argl*" << endl;
45         cerr << endl;
46         cerr << PACKAGE_NAME << " nastily killed with signal " << sig << endl;
47
48         exit(sig);
49 }
50
51 int main(int argc, char** argv)
52 {
53         cerr << "Free Music Instrument Tuner version " << PACKAGE_VERSION << " built at " << __DATE__ << " " << __TIME__ << endl;
54         cerr << "Install directory '" << PREFIX << "'" << endl;
55
56         signal(SIGINT, signal_interrupt);
57         signal(SIGTERM, signal_term);
58
59         QApplication a(argc, argv, true);
60
61         glutInit(&argc, argv);
62
63 //      if(a.argc()>1)
64 //      {
65 //              if(a.argc()>2 && (QString(a.argv()[1])=="-d" || QString(a.argv()[1])=="--device"))
66 //              {
67 //                      cerr << "used device: " << a.argv()[2] << endl;
68 //              }
69 //      }
70
71 //      cerr << "LANG=" << QTextCodec::locale() << endl;
72
73         QTranslator tr_fmit(0);
74         tr_fmit.load(QString(PACKAGE_NAME)+"_"+QTextCodec::locale(), QString(PREFIX)+"/"+PACKAGE_NAME+"/tr");
75         a.installTranslator(&tr_fmit);
76
77         g_main_form = new CustomInstrumentTunerForm();
78
79         g_main_form->show();
80
81         a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
82         a.exec();
83
84         delete g_main_form;
85
86         return 0;
87 }
88