-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
66 lines (49 loc) · 1.91 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
* Copyright (C) 30-8-2016 Abdullateef Qallaa
*
* This file is part of Furqan project,
* hosted on GitHub: https://github.com/laateef/furqan,
* licensed under GPLv3.
*
* GNU General Public License Usage
* This file may be used under the terms of the GNU
* General Public License version 3.0 as published by the Free Software
* Foundation and appearing in the file LICENSE.md included in the
* packaging of this file. Please review the following information to
* ensure the GNU General Public License version 3.0 requirements will be
* met: http://www.gnu.org/copyleft/gpl.html.
*/
#include <QApplication>
#include <QSplashScreen>
#include "resourcemanager.h"
#include "settingwidget.h"
#include "mainwidget.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QCoreApplication::setOrganizationName("ShamSoft");
QCoreApplication::setApplicationName("Furqan");
QSplashScreen *splashScreen = RscMgr::createSplashScreen();
splashScreen->show();
// To show the splash at the very beginning.
app.processEvents();
RscMgr::settingHandler();
RscMgr::translatorHandler()->translate(RscMgr::settingHandler()->interfaceLanguage());
//initializing the database,
//this prevents uninitialized access using static QSqlDatabase static methods.
RscMgr::databaseHandler();
if (!RscMgr::databaseHandler()->connection().isOpen()) {
RscMgr::issueMessage(QObject::tr("Program couldn't open the current database, please select another one"), false);
if (!SettingWidget::changeTheCurrentDatabase()) {
RscMgr::issueMessage(QObject::tr("Database is damaged, Program cannot proceed"), false);
app.quit();
}
}
//initializing the models,
RscMgr::modelHandler();
MainWidget *widget = new MainWidget;
app.setStyleSheet(widget->styleSheet());
widget->show();
splashScreen->finish(widget);
return app.exec();
}