-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathmain.cpp
57 lines (44 loc) · 1.54 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
/*!
* \file
* Точка входа
*/
#include "forms/form_main.h"
#include "global.h"
/*!
* (no comments)
* \param argc (no comments)
* \param argv (no comments)
* \return (no comments)
*/
int main (int argc, char* argv[])
{
// инициализация ресурсов (необязательный пункт)
Q_INIT_RESOURCE(resource);
QApplication app(argc, argv);
#ifndef Q_WS_MAC
// отображать иконки в меню для всех, кроме MacOS
app.setAttribute(Qt::AA_DontShowIconsInMenus, false);
#endif
// установка разделов для хранения конфигурации приложения
QCoreApplication::setOrganizationName("rsdn.ru");
QCoreApplication::setApplicationName("avalon");
QCoreApplication::setApplicationVersion(getVersionString());
// переводчик стандартных сообщений и диалогов
QString tr_file = "qt_" + QLocale::system().name();
QString tr_path = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
if (tr_file == "qt_ru_RU" && QFileInfo (tr_path + "/" + tr_file + ".qm").exists() == false)
{
tr_file = ":translations/qt_ru_RU.qm";
tr_path = "";
}
QTranslator qt_translator;
qt_translator.load(tr_file, tr_path);
app.installTranslator(&qt_translator);
// глобальные настройки
std::auto_ptr<AGlobal> global(AGlobal::getInstance());
// главная форма
AFormMain* form = new AFormMain();
form->show();
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
return app.exec();
}