Recent: Reverse order to "most recent first"
[nomnom.git] / src / main.cpp
blob4e138b97d94925c8f6e90e6af8228f19df3639d0
1 /*
2 * Copyright (C) 2010 Toni Gundogdu.
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include "config.h"
20 #include <QApplication>
21 #include <QLibraryInfo>
22 #include <QDebug>
24 #include "util.h"
25 #include "Recent.h"
26 #include "Log.h"
27 // UI:
28 #include "Preferences.h"
29 #include "MainWindow.h"
31 // Global: Hosts (or websites) that quvi supports.
32 QMap<QString,QStringList> hosts;
34 // Global: quvi version.
35 QString quviVersion;
37 // Global: Language.
38 QMap<QString,QString> qmFiles;
39 QStringList qmLangNames;
41 // Global: Preferences.
42 SharedPreferences shPrefs;
44 // Global: Recent.
45 Recent recent;
47 // Global: Log.
48 Log log;
50 // Global: Feed.
51 NomNom::Feed feed;
53 int
54 main (int argc, char *argv[])
56 qsrand (time (NULL));
58 QApplication app(argc, argv);
60 #define APPNAME "NomNom"
61 #define APPDOMAIN "nomnom.sourceforge.net"
63 QCoreApplication::setOrganizationName (APPNAME);
64 QCoreApplication::setOrganizationDomain (APPDOMAIN);
65 QCoreApplication::setApplicationName (APPNAME);
66 QCoreApplication::setApplicationVersion (VERSION_LONG);
68 #ifdef _0
69 qDebug() << QLibraryInfo::location(QLibraryInfo::TranslationsPath);
70 qDebug() << "qt_"+QLocale::system().name();
71 #endif
73 // Load qt translation, chosen based on the system locale setting.
75 QTranslator qtTr;
77 qtTr.load("qt_" + QLocale::system().name(),
78 QLibraryInfo::location(QLibraryInfo::TranslationsPath));
80 app.installTranslator(&qtTr);
82 // Load NomNom translation, chosen based on user definition.
84 //: "English" is the default language. This string is not intended to be translated.
85 qmLangNames << QObject::tr ("English");
86 qmFiles = NomNom::find_qm(qmLangNames);
88 QTranslator *t = NomNom::load_qm();
89 if (t) QCoreApplication::installTranslator(t);
91 #ifdef _0
92 // Read preferences. Done in MainWindow ctor.
93 shPrefs.read();
94 #endif
96 // Read recent.
98 recent.read();
100 // Show main window.
102 (new MainWindow)->show();
104 return app.exec();
107 // vim: set ts=2 sw=2 tw=72 expandtab: