Initial revision.
[secretnotes] / src / main.cpp
1 /*
2  *  This file is part of Secret Notes.
3  *  Copyright (C) 2010 Janusz Sobczak
4  *
5  *  Secret Notes 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 3 of the License, or
8  *  (at your option) any later version.
9  *
10  *  Secret Notes 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 Secret Notes.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 #include <QtGui/QApplication>
19 #include "mainwindow.h"
20 #include <QTranslator>
21 #include <QLocale>
22
23 /* convert preprocesor variable to string */
24 #define TOSTRING_(x) #x
25 #define TOSTRING(x) TOSTRING_(x)
26
27 int main(int argc, char *argv[])
28 {
29     QApplication a(argc, argv);
30     QString translationDir;
31 #if defined(PREFIX)
32     translationDir = QString(TOSTRING(PREFIX))+QString("/share/secretnotes");
33 #endif
34     QTranslator translator;
35     translator.load(QString("secretnotes_")+QLocale::system().name(),
36                     translationDir);
37
38     a.installTranslator(&translator);
39     MainWindow w;
40     w.show();
41     return a.exec();
42 }