-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.cpp
88 lines (76 loc) · 2.69 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/***************************************************************************
main.cpp - description
----------------------------------------------------
begin : 2003
copyright : (C) 2007 by Andreas Lindenau
email : DL4JAL@darc.de
main.cpp - description
----------------------------------------------------
begin : 2013
copyright : (C) 2014 by Andrey Sobol
email : andrey.sobol.nn@gmail.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <QApplication>
#include <QtGlobal>
#include <QLocale>
#include <QTranslator>
#include <QString>
#include <QtGui>
#include <QDir>
#include "mainwindow.h"
// FIXME: 1. Прыгает окно с графиком по ширине, когда давишь открытие диалога сохранения PDF.
int appstart;
int main(int argc, char *argv[])
{
int indexhfc = 0, indexqm = 0;
QString s;
char c[]="hfm9.hfc";
QApplication app(argc, argv);
QTranslator appTranslator;
QDir dir(argv[0]);
QString programpath(dir.absolutePath());
//qDebug(programpath);
appstart = 1;
//Load language and config files
if (argc > 1)
{
s = argv[1];
if(s.contains(".qm"))indexqm = 1;
if(s.contains(".hfc"))indexhfc = 1;
}
if (argc > 2)
{
s = argv[2];
if(s.contains(".qm"))indexqm = 2;
if(s.contains(".hfc"))indexhfc = 2;
}
if(indexqm){
//qDebug("QM Loaded");
s = argv[indexqm];
//qDebug(s);
if(appTranslator.load(s))qDebug("OK");
app.installTranslator(&appTranslator);
}
//Show main window
app.setQuitOnLastWindowClosed(true);
MainWindow *mainWin = new MainWindow();
mainWin->setWindowIcon(QIcon(":images/appicon.png"));
mainWin->show();
//The path for configuration files set
mainWin->setProgramPath(programpath);
if(indexhfc){
mainWin->loadConfig(argv[indexhfc]);
}else{
mainWin->loadConfig(c);
}
appstart = 0;
return app.exec();
}