2016-07-21 12:46:05 +03:00
|
|
|
#include <QApplication>
|
|
|
|
#include <LimeReport>
|
2017-12-10 16:06:56 +03:00
|
|
|
#include <QTranslator>
|
2018-05-15 22:14:17 +03:00
|
|
|
#include <QDebug>
|
|
|
|
#include "designersettingmanager.h"
|
2016-07-21 12:46:05 +03:00
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
QApplication a(argc, argv);
|
2018-05-15 22:14:17 +03:00
|
|
|
DesignerSettingManager manager;
|
2017-12-10 16:06:56 +03:00
|
|
|
|
|
|
|
QTranslator limeReportTranslator;
|
2018-05-22 00:24:38 +03:00
|
|
|
QTranslator qtTranslator;
|
2017-12-10 16:06:56 +03:00
|
|
|
QString translationPath = QApplication::applicationDirPath();
|
|
|
|
translationPath.append("/languages");
|
2018-05-24 02:25:26 +03:00
|
|
|
Qt::LayoutDirection layoutDirection = QLocale::system().textDirection();
|
2018-05-15 22:14:17 +03:00
|
|
|
|
|
|
|
QString designerTranslation = QLocale(manager.getCurrentDefaultLanguage()).name();
|
|
|
|
|
2018-05-22 00:24:38 +03:00
|
|
|
if (limeReportTranslator.load("limereport_"+designerTranslation, translationPath)){
|
|
|
|
qtTranslator.load("qt_" + designerTranslation, translationPath);
|
|
|
|
a.installTranslator(&qtTranslator);
|
|
|
|
a.installTranslator(&limeReportTranslator);
|
|
|
|
Qt::LayoutDirection layoutDirection = QLocale(manager.getCurrentDefaultLanguage()).textDirection();
|
|
|
|
a.setLayoutDirection(layoutDirection);
|
|
|
|
}
|
2018-05-15 22:14:17 +03:00
|
|
|
|
2018-05-24 02:25:26 +03:00
|
|
|
LimeReport::ReportEngine report;
|
|
|
|
report.setPreviewLayoutDirection(layoutDirection);
|
2018-05-15 22:14:17 +03:00
|
|
|
|
2017-01-31 17:31:28 +03:00
|
|
|
if (a.arguments().count()>1){
|
|
|
|
report.loadFromFile(a.arguments().at(1));
|
|
|
|
}
|
2018-05-15 22:14:17 +03:00
|
|
|
QObject::connect(&report, SIGNAL(getAviableLanguages(QList<QLocale::Language>*)),
|
|
|
|
&manager, SLOT(getAviableLanguages(QList<QLocale::Language>*)));
|
|
|
|
|
|
|
|
QObject::connect(&report, SIGNAL(getCurrentDefaultLanguage()),
|
|
|
|
&manager, SLOT(getCurrentDefaultLanguage()));
|
|
|
|
|
|
|
|
QObject::connect(&report, SIGNAL(currentDefaulLanguageChanged(QLocale::Language)),
|
|
|
|
&manager, SLOT(currentDefaulLanguageChanged(QLocale::Language)));
|
|
|
|
|
2016-07-21 12:46:05 +03:00
|
|
|
report.designReport();
|
|
|
|
return a.exec();
|
|
|
|
}
|
2018-05-15 22:14:17 +03:00
|
|
|
|