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);
|
2022-05-07 21:07:43 +03:00
|
|
|
|
2018-05-15 22:14:17 +03:00
|
|
|
DesignerSettingManager manager;
|
2017-12-10 16:06:56 +03:00
|
|
|
|
|
|
|
QTranslator limeReportTranslator;
|
2019-01-26 23:45:20 +03:00
|
|
|
QTranslator qtBaseTranslator;
|
2022-04-27 23:44:32 +03:00
|
|
|
QTranslator qtDesignerTranslator;
|
|
|
|
QTranslator qtLinguistTranslator;
|
|
|
|
|
2017-12-10 16:06:56 +03:00
|
|
|
QString translationPath = QApplication::applicationDirPath();
|
2019-01-26 23:45:20 +03:00
|
|
|
translationPath.append("/translations");
|
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)){
|
2023-05-01 09:26:41 +03:00
|
|
|
static_cast<void>(qtBaseTranslator.load("qtbase_" + designerTranslation, translationPath));
|
|
|
|
static_cast<void>(qtDesignerTranslator.load("designer_"+designerTranslation,translationPath));
|
2022-04-27 23:44:32 +03:00
|
|
|
|
2019-01-26 23:45:20 +03:00
|
|
|
a.installTranslator(&qtBaseTranslator);
|
2022-04-27 23:44:32 +03:00
|
|
|
a.installTranslator(&qtDesignerTranslator);
|
2018-05-22 00:24:38 +03:00
|
|
|
a.installTranslator(&limeReportTranslator);
|
2022-04-27 23:44:32 +03:00
|
|
|
|
2018-05-22 00:24:38 +03:00
|
|
|
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));
|
|
|
|
}
|
2019-06-11 21:55:59 +03:00
|
|
|
QObject::connect(&report, SIGNAL(getAvailableDesignerLanguages(QList<QLocale::Language>*)),
|
2019-06-11 21:28:58 +03:00
|
|
|
&manager, SLOT(getAvailableLanguages(QList<QLocale::Language>*)));
|
2018-05-15 22:14:17 +03:00
|
|
|
|
2019-06-11 21:55:59 +03:00
|
|
|
QObject::connect(&report, SIGNAL(getCurrentDefaultDesignerLanguage()),
|
2018-05-15 22:14:17 +03:00
|
|
|
&manager, SLOT(getCurrentDefaultLanguage()));
|
|
|
|
|
2019-06-11 21:55:59 +03:00
|
|
|
QObject::connect(&report, SIGNAL(currentDefaultDesignerLanguageChanged(QLocale::Language)),
|
2019-06-11 21:28:58 +03:00
|
|
|
&manager, SLOT(currentDefaultLanguageChanged(QLocale::Language)));
|
2018-05-15 22:14:17 +03:00
|
|
|
|
2020-01-09 21:22:58 +03:00
|
|
|
report.setShowDesignerModal(false);
|
2016-07-21 12:46:05 +03:00
|
|
|
report.designReport();
|
|
|
|
return a.exec();
|
|
|
|
}
|
2018-05-15 22:14:17 +03:00
|
|
|
|