From e9c44f0eb6a52cd773fe6a99c61ad6136545b117 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 10 Apr 2018 16:28:48 +0300 Subject: [PATCH 1/6] Designer interface setting added --- include/lrreportengine.h | 4 ++ limereport/lrreportdesignwidget.cpp | 2 + limereport/lrreportengine.cpp | 60 +++++++++++++++++++++++++++++ limereport/lrreportengine.h | 4 ++ limereport/lrreportengine_p.h | 15 +++++++- limereport/lrsettingdialog.cpp | 19 +++++++++ limereport/lrsettingdialog.h | 4 ++ limereport/lrsettingdialog.ui | 31 ++++++++++++++- 8 files changed, 136 insertions(+), 3 deletions(-) diff --git a/include/lrreportengine.h b/include/lrreportengine.h index 589e359..97549f5 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -113,6 +113,10 @@ public: bool setReportLanguage(QLocale::Language language); Qt::LayoutDirection previewLayoutDirection(); void setPreviewLayoutDirection(const Qt::LayoutDirection& previewLayoutDirection); + void addDesignerLanguage(QLocale::Language language); + void removeDesignerLanguage(QLocale::Language language); + QList* designerLanguages(); + QLocale::Language currentDesignerLanguage(); signals: void renderStarted(); void renderFinished(); diff --git a/limereport/lrreportdesignwidget.cpp b/limereport/lrreportdesignwidget.cpp index 2da64da..9fc328d 100644 --- a/limereport/lrreportdesignwidget.cpp +++ b/limereport/lrreportdesignwidget.cpp @@ -712,6 +712,7 @@ void ReportDesignWidget::editSetting() setting.setDefaultFont(m_defaultFont); setting.setSuppressAbsentFieldsAndVarsWarnings(m_report->suppressFieldAndVarError()); setting.setUseDarkTheme(m_useDarkTheme); + setting.setDesignerLanguages(m_report->designerLanguages(), m_report->currentDesignerLanguage()); if (setting.exec()){ m_horizontalGridStep = setting.horizontalGridStep(); @@ -719,6 +720,7 @@ void ReportDesignWidget::editSetting() m_defaultFont = setting.defaultFont(); m_useDarkTheme = setting.userDarkTheme(); m_report->setSuppressFieldAndVarError(setting.suppressAbsentFieldsAndVarsWarnings()); + m_report->setCurrentDesignerLanguage(setting.designerLanguage()); applySettings(); } } diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index d938b2e..0c8d92f 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -950,6 +950,42 @@ void ReportEnginePrivate::activateLanguage(QLocale::Language language) } } +QString ReportEnginePrivate::getLanguagesDir() const +{ + return m_languagesDir; +} + +void ReportEnginePrivate::setLanguagesDir(const QString& languagesDir) +{ + m_languagesDir = languagesDir; +} + +void ReportEnginePrivate::addDesignerLanguage(QLocale::Language language) +{ + if (!m_designerLanguages.contains(language)) + m_designerLanguages.append(language); +} + +void ReportEnginePrivate::removeDesignerLanguage(QLocale::Language language) +{ + m_designerLanguages.removeAll(language); +} + +QList* ReportEnginePrivate::designerLanguages() +{ + return &m_designerLanguages; +} + +QLocale::Language ReportEnginePrivate::currentDesignerLanguage() +{ + return m_currentDesignerLanguage; +} + +void ReportEnginePrivate::setCurrentDesignerLanguage(QLocale::Language language) +{ + m_currentDesignerLanguage = language; +} + QString ReportEnginePrivate::styleSheet() const { return m_styleSheet; @@ -1237,6 +1273,30 @@ bool ReportEngine::setReportLanguage(QLocale::Language language) return d->setReportLanguage(language); } +void ReportEngine::addDesignerLanguage(QLocale::Language language) +{ + Q_D(ReportEngine); + d->addDesignerLanguage(language); +} + +void ReportEngine::removeDesignerLanguage(QLocale::Language language) +{ + Q_D(ReportEngine); + d->removeDesignerLanguage(language); +} + +QList*ReportEngine::designerLanguages() +{ + Q_D(ReportEngine); + return d->designerLanguages(); +} + +QLocale::Language ReportEngine::currentDesignerLanguage() +{ + Q_D(ReportEngine); + return d->currentDesignerLanguage(); +} + void ReportEngine::setShowProgressDialog(bool value) { Q_D(ReportEngine); diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index 589e359..97549f5 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -113,6 +113,10 @@ public: bool setReportLanguage(QLocale::Language language); Qt::LayoutDirection previewLayoutDirection(); void setPreviewLayoutDirection(const Qt::LayoutDirection& previewLayoutDirection); + void addDesignerLanguage(QLocale::Language language); + void removeDesignerLanguage(QLocale::Language language); + QList* designerLanguages(); + QLocale::Language currentDesignerLanguage(); signals: void renderStarted(); void renderFinished(); diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index 95ed764..eb4f611 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -33,6 +33,7 @@ #include #include #include +#include #include "lrreportengine.h" #include "lrcollection.h" #include "lrglobal.h" @@ -83,6 +84,9 @@ public: virtual void setSuppressFieldAndVarError(bool suppressFieldAndVarError) = 0; virtual void setStyleSheet(const QString& styleSheet) = 0; virtual QString styleSheet() const = 0; + virtual QList* designerLanguages() = 0; + virtual QLocale::Language currentDesignerLanguage() = 0; + virtual void setCurrentDesignerLanguage(QLocale::Language language) = 0; }; class ReportEnginePrivate : public QObject, public ICollectionContainer, public ITranslationContainer, @@ -178,7 +182,13 @@ public: void setPreviewLayoutDirection(const Qt::LayoutDirection& previewLayoutDirection); QString styleSheet() const; void setStyleSheet(const QString &styleSheet); - + QString getLanguagesDir() const; + void setLanguagesDir(const QString& languagesDir); + void addDesignerLanguage(QLocale::Language language); + void removeDesignerLanguage(QLocale::Language language); + QList* designerLanguages(); + QLocale::Language currentDesignerLanguage(); + void setCurrentDesignerLanguage(QLocale::Language language); signals: void pagesLoadFinished(); void datasourceCollectionLoadFinished(const QString& collectionName); @@ -247,6 +257,9 @@ private: Qt::LayoutDirection m_previewLayoutDirection; LimeReportPluginInterface* m_designerFactory; QString m_styleSheet; + QString m_languagesDir; + QList m_designerLanguages; + QLocale::Language m_currentDesignerLanguage; }; } diff --git a/limereport/lrsettingdialog.cpp b/limereport/lrsettingdialog.cpp index ee34440..c1272f1 100644 --- a/limereport/lrsettingdialog.cpp +++ b/limereport/lrsettingdialog.cpp @@ -47,6 +47,15 @@ bool SettingDialog::suppressAbsentFieldsAndVarsWarnings() return ui->cbSuppressWarnings->isChecked(); } +QLocale::Language SettingDialog::designerLanguage() +{ + foreach (QLocale::Language language, *m_designerLanguages) { + if (ui->designerLanguage->currentText().compare(QLocale::languageToString(language)) == 0) + return language; + } + return QLocale().language(); +} + void SettingDialog::setSuppressAbsentFieldsAndVarsWarnings(bool value){ ui->cbSuppressWarnings->setChecked(value); } @@ -72,4 +81,14 @@ void SettingDialog::setUseDarkTheme(bool value) ui->cbbUseDarkTheme->setChecked(value); } +void SettingDialog::setDesignerLanguages(QList* languages, QLocale::Language currentLanguage) +{ + m_designerLanguages = languages; + ui->designerLanguage->addItem(QLocale::languageToString(currentLanguage)); + foreach (QLocale::Language language, *languages) { + if (language != currentLanguage) + ui->designerLanguage->addItem(QLocale::languageToString(language)); + } +} + } // namespace LimeReport diff --git a/limereport/lrsettingdialog.h b/limereport/lrsettingdialog.h index db908f9..20bbb0b 100644 --- a/limereport/lrsettingdialog.h +++ b/limereport/lrsettingdialog.h @@ -2,6 +2,7 @@ #define LRSETTINGDIALOG_H #include +#include namespace LimeReport{ @@ -21,13 +22,16 @@ public: QFont defaultFont(); bool userDarkTheme(); bool suppressAbsentFieldsAndVarsWarnings(); + QLocale::Language designerLanguage(); void setSuppressAbsentFieldsAndVarsWarnings(bool value); void setHorizontalGridStep(int value); void setVerticalGridStep(int value); void setDefaultFont(const QFont& value); void setUseDarkTheme(bool value); + void setDesignerLanguages(QList* languages, QLocale::Language currentLanguage); private: Ui::SettingDialog *ui; + QList* m_designerLanguages; }; } // namespace LimeReport diff --git a/limereport/lrsettingdialog.ui b/limereport/lrsettingdialog.ui index b0dd1ed..688ad14 100644 --- a/limereport/lrsettingdialog.ui +++ b/limereport/lrsettingdialog.ui @@ -6,10 +6,16 @@ 0 0 - 351 - 318 + 397 + 378 + + + 0 + 0 + + Designer setting @@ -108,6 +114,27 @@ + + + + + + Language + + + + + + + + 0 + 0 + + + + + + From 3d8588316be1cb5e5ae1a447969a4a6e89259e16 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 15 May 2018 22:12:36 +0300 Subject: [PATCH 2/6] Dark theme fixed --- 3rdparty/dark_style_sheet/qdarkstyle/style.qss | 1 + 1 file changed, 1 insertion(+) diff --git a/3rdparty/dark_style_sheet/qdarkstyle/style.qss b/3rdparty/dark_style_sheet/qdarkstyle/style.qss index 59941f4..fd9d694 100644 --- a/3rdparty/dark_style_sheet/qdarkstyle/style.qss +++ b/3rdparty/dark_style_sheet/qdarkstyle/style.qss @@ -952,6 +952,7 @@ QDockWidget { QDockWidget::title{ background: #383838; padding-left: 5px; + margin-top: 4px; } From 8df8182875ca671a8fedae8cbbb0f57ab4826121 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 15 May 2018 22:14:17 +0300 Subject: [PATCH 3/6] Language settings has been added to designer --- designer/designer.pro | 6 +++- designer/designersettingmanager.cpp | 37 +++++++++++++++++++++++ designer/designersettingmanager.h | 27 +++++++++++++++++ designer/main.cpp | 25 +++++++++++++-- include/lrreportengine.h | 7 +++-- limereport/lrreportdesignwidget.cpp | 4 ++- limereport/lrreportdesignwindow.h | 1 - limereport/lrreportengine.cpp | 47 ++++++++++++----------------- limereport/lrreportengine.h | 7 +++-- limereport/lrreportengine_p.h | 13 +++----- limereport/lrsettingdialog.cpp | 16 +++++++--- limereport/lrsettingdialog.h | 5 +-- limereport/lrsettingdialog.ui | 6 ++-- 13 files changed, 145 insertions(+), 56 deletions(-) create mode 100644 designer/designersettingmanager.cpp create mode 100644 designer/designersettingmanager.h diff --git a/designer/designer.pro b/designer/designer.pro index 4062e6f..d5abd1b 100644 --- a/designer/designer.pro +++ b/designer/designer.pro @@ -8,7 +8,8 @@ contains(CONFIG,release) { } TEMPLATE = app -SOURCES += main.cpp +SOURCES += main.cpp \ + designersettingmanager.cpp INCLUDEPATH += $$PWD/../include DEPENDPATH += $$PWD/../include @@ -61,3 +62,6 @@ win32 { } } +HEADERS += \ + designersettingmanager.h + diff --git a/designer/designersettingmanager.cpp b/designer/designersettingmanager.cpp new file mode 100644 index 0000000..925143f --- /dev/null +++ b/designer/designersettingmanager.cpp @@ -0,0 +1,37 @@ +#include "designersettingmanager.h" + +DesignerSettingManager::DesignerSettingManager(QObject *parent) : QObject(parent) +{ + m_setting = new QSettings("LimeReport",QCoreApplication::applicationName()); +} + +DesignerSettingManager::~DesignerSettingManager() +{ + delete m_setting; +} + +void DesignerSettingManager::getAviableLanguages(QList* languages) +{ + languages->append(QLocale::Russian); + languages->append(QLocale::English); + languages->append(QLocale::Arabic); +} + +QLocale::Language DesignerSettingManager::getCurrentDefaultLanguage() +{ + m_setting->beginGroup("ReportDesigner"); + QVariant v = m_setting->value("DesignerLanguage"); + m_setting->endGroup(); + if (v.isValid()){ + return static_cast(v.toInt()) ; + } else { + return QLocale::system().language(); + } +} + +void DesignerSettingManager::currentDefaulLanguageChanged(QLocale::Language language) +{ + m_setting->beginGroup("ReportDesigner"); + m_setting->setValue("DesignerLanguage", (int)language); + m_setting->endGroup(); +} diff --git a/designer/designersettingmanager.h b/designer/designersettingmanager.h new file mode 100644 index 0000000..2f07d79 --- /dev/null +++ b/designer/designersettingmanager.h @@ -0,0 +1,27 @@ +#ifndef DESIGNERSETTINGMANAGER_H +#define DESIGNERSETTINGMANAGER_H + +#include +#include +#include +#include + +class DesignerSettingManager : public QObject +{ + Q_OBJECT +public: + explicit DesignerSettingManager(QObject *parent = 0); + ~DesignerSettingManager(); + void setApplicationInstance(QApplication* application); +signals: + +public slots: + void getAviableLanguages(QList* languages); + QLocale::Language getCurrentDefaultLanguage(); + void currentDefaulLanguageChanged(QLocale::Language language); +private: + QApplication* m_app; + QSettings* m_setting; +}; + +#endif // DESIGNERSETTINGMANAGER_H diff --git a/designer/main.cpp b/designer/main.cpp index 9132b47..eeadf9b 100644 --- a/designer/main.cpp +++ b/designer/main.cpp @@ -1,25 +1,46 @@ #include #include #include +#include +#include "designersettingmanager.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); + DesignerSettingManager manager; QTranslator limeReportTranslator; QString translationPath = QApplication::applicationDirPath(); translationPath.append("/languages"); - limeReportTranslator.load("limereport_"+QLocale::system().name(),translationPath); + + QString designerTranslation = QLocale(manager.getCurrentDefaultLanguage()).name(); + + limeReportTranslator.load("limereport_"+designerTranslation, translationPath); a.installTranslator(&limeReportTranslator); QTranslator qtTranslator; - qtTranslator.load("qt_" + QLocale::system().name(),translationPath); + qtTranslator.load("qt_" + designerTranslation, translationPath); a.installTranslator(&qtTranslator); + Qt::LayoutDirection layoutDirection = QLocale(manager.getCurrentDefaultLanguage()).textDirection(); + LimeReport::ReportEngine report; + a.setLayoutDirection(layoutDirection); + report.setPreviewLayoutDirection(layoutDirection); + if (a.arguments().count()>1){ report.loadFromFile(a.arguments().at(1)); } + QObject::connect(&report, SIGNAL(getAviableLanguages(QList*)), + &manager, SLOT(getAviableLanguages(QList*))); + + QObject::connect(&report, SIGNAL(getCurrentDefaultLanguage()), + &manager, SLOT(getCurrentDefaultLanguage())); + + QObject::connect(&report, SIGNAL(currentDefaulLanguageChanged(QLocale::Language)), + &manager, SLOT(currentDefaulLanguageChanged(QLocale::Language))); + report.designReport(); return a.exec(); } + diff --git a/include/lrreportengine.h b/include/lrreportengine.h index 97549f5..e6db8d0 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -113,9 +113,7 @@ public: bool setReportLanguage(QLocale::Language language); Qt::LayoutDirection previewLayoutDirection(); void setPreviewLayoutDirection(const Qt::LayoutDirection& previewLayoutDirection); - void addDesignerLanguage(QLocale::Language language); - void removeDesignerLanguage(QLocale::Language language); - QList* designerLanguages(); + QList designerLanguages(); QLocale::Language currentDesignerLanguage(); signals: void renderStarted(); @@ -124,6 +122,9 @@ signals: void onLoad(bool& loaded); void onSave(); void saveFinished(); + void getAviableLanguages(QList* languages); + void currentDefaulLanguageChanged(QLocale::Language); + QLocale::Language getCurrentDefaultLanguage(); public slots: void cancelRender(); protected: diff --git a/limereport/lrreportdesignwidget.cpp b/limereport/lrreportdesignwidget.cpp index 9fc328d..c32e608 100644 --- a/limereport/lrreportdesignwidget.cpp +++ b/limereport/lrreportdesignwidget.cpp @@ -720,7 +720,9 @@ void ReportDesignWidget::editSetting() m_defaultFont = setting.defaultFont(); m_useDarkTheme = setting.userDarkTheme(); m_report->setSuppressFieldAndVarError(setting.suppressAbsentFieldsAndVarsWarnings()); - m_report->setCurrentDesignerLanguage(setting.designerLanguage()); + if (m_report->currentDesignerLanguage() != setting.designerLanguage() ){ + m_report->setCurrentDesignerLanguage(setting.designerLanguage()); + } applySettings(); } } diff --git a/limereport/lrreportdesignwindow.h b/limereport/lrreportdesignwindow.h index 6f3dba6..1beb45a 100644 --- a/limereport/lrreportdesignwindow.h +++ b/limereport/lrreportdesignwindow.h @@ -71,7 +71,6 @@ public: QSettings* settings(); void restoreSetting(); void setShowProgressDialog(bool value){m_showProgressDialog = value;} - private slots: void slotNewReport(); void slotNewPage(); diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index c9ae526..5d57a65 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -950,40 +950,25 @@ void ReportEnginePrivate::activateLanguage(QLocale::Language language) } } -QString ReportEnginePrivate::getLanguagesDir() const +QList ReportEnginePrivate::designerLanguages() { - return m_languagesDir; -} -void ReportEnginePrivate::setLanguagesDir(const QString& languagesDir) -{ - m_languagesDir = languagesDir; -} - -void ReportEnginePrivate::addDesignerLanguage(QLocale::Language language) -{ - if (!m_designerLanguages.contains(language)) - m_designerLanguages.append(language); -} - -void ReportEnginePrivate::removeDesignerLanguage(QLocale::Language language) -{ - m_designerLanguages.removeAll(language); -} - -QList* ReportEnginePrivate::designerLanguages() -{ - return &m_designerLanguages; + QList result; + emit getAviableLanguages(&result); + return result; } QLocale::Language ReportEnginePrivate::currentDesignerLanguage() { - return m_currentDesignerLanguage; + QLocale::Language result = emit getCurrentDefaultLanguage(); + return result; } void ReportEnginePrivate::setCurrentDesignerLanguage(QLocale::Language language) { m_currentDesignerLanguage = language; + QMessageBox::information(m_designerWindow, tr("Warning") ,tr("The language will change after the application is restarted")); + emit currentDefaulLanguageChanged(language); } QString ReportEnginePrivate::styleSheet() const @@ -1167,6 +1152,12 @@ ReportEngine::ReportEngine(QObject *parent) connect(d, SIGNAL(onSave()), this, SIGNAL(onSave())); connect(d, SIGNAL(onLoad(bool&)), this, SIGNAL(onLoad(bool&))); connect(d, SIGNAL(saveFinished()), this, SIGNAL(saveFinished())); + connect(d, SIGNAL(getAviableLanguages(QList*)), + this, SIGNAL(getAviableLanguages(QList*))); + connect(d, SIGNAL(currentDefaulLanguageChanged(QLocale::Language)), + this, SIGNAL(currentDefaulLanguageChanged(QLocale::Language))); + connect(d, SIGNAL(getCurrentDefaultLanguage()), + this, SIGNAL(getCurrentDefaultLanguage())); } ReportEngine::~ReportEngine() @@ -1273,19 +1264,19 @@ bool ReportEngine::setReportLanguage(QLocale::Language language) return d->setReportLanguage(language); } -void ReportEngine::addDesignerLanguage(QLocale::Language language) +Qt::LayoutDirection ReportEngine::previewLayoutDirection() { Q_D(ReportEngine); - d->addDesignerLanguage(language); + return d->previewLayoutDirection(); } -void ReportEngine::removeDesignerLanguage(QLocale::Language language) +void ReportEngine::setPreviewLayoutDirection(const Qt::LayoutDirection& previewLayoutDirection) { Q_D(ReportEngine); - d->removeDesignerLanguage(language); + d->setPreviewLayoutDirection(previewLayoutDirection); } -QList*ReportEngine::designerLanguages() +QList ReportEngine::designerLanguages() { Q_D(ReportEngine); return d->designerLanguages(); diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index 97549f5..e6db8d0 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -113,9 +113,7 @@ public: bool setReportLanguage(QLocale::Language language); Qt::LayoutDirection previewLayoutDirection(); void setPreviewLayoutDirection(const Qt::LayoutDirection& previewLayoutDirection); - void addDesignerLanguage(QLocale::Language language); - void removeDesignerLanguage(QLocale::Language language); - QList* designerLanguages(); + QList designerLanguages(); QLocale::Language currentDesignerLanguage(); signals: void renderStarted(); @@ -124,6 +122,9 @@ signals: void onLoad(bool& loaded); void onSave(); void saveFinished(); + void getAviableLanguages(QList* languages); + void currentDefaulLanguageChanged(QLocale::Language); + QLocale::Language getCurrentDefaultLanguage(); public slots: void cancelRender(); protected: diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index eb4f611..69fa30f 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -84,7 +84,7 @@ public: virtual void setSuppressFieldAndVarError(bool suppressFieldAndVarError) = 0; virtual void setStyleSheet(const QString& styleSheet) = 0; virtual QString styleSheet() const = 0; - virtual QList* designerLanguages() = 0; + virtual QList designerLanguages() = 0; virtual QLocale::Language currentDesignerLanguage() = 0; virtual void setCurrentDesignerLanguage(QLocale::Language language) = 0; }; @@ -182,11 +182,7 @@ public: void setPreviewLayoutDirection(const Qt::LayoutDirection& previewLayoutDirection); QString styleSheet() const; void setStyleSheet(const QString &styleSheet); - QString getLanguagesDir() const; - void setLanguagesDir(const QString& languagesDir); - void addDesignerLanguage(QLocale::Language language); - void removeDesignerLanguage(QLocale::Language language); - QList* designerLanguages(); + QList designerLanguages(); QLocale::Language currentDesignerLanguage(); void setCurrentDesignerLanguage(QLocale::Language language); signals: @@ -199,6 +195,9 @@ signals: void onLoad(bool& loaded); void onSave(); void saveFinished(); + void getAviableLanguages(QList* languages); + void currentDefaulLanguageChanged(QLocale::Language); + QLocale::Language getCurrentDefaultLanguage(); public slots: bool slotLoadFromFile(const QString& fileName); void cancelRender(); @@ -257,8 +256,6 @@ private: Qt::LayoutDirection m_previewLayoutDirection; LimeReportPluginInterface* m_designerFactory; QString m_styleSheet; - QString m_languagesDir; - QList m_designerLanguages; QLocale::Language m_currentDesignerLanguage; }; diff --git a/limereport/lrsettingdialog.cpp b/limereport/lrsettingdialog.cpp index c1272f1..b05fa74 100644 --- a/limereport/lrsettingdialog.cpp +++ b/limereport/lrsettingdialog.cpp @@ -49,7 +49,7 @@ bool SettingDialog::suppressAbsentFieldsAndVarsWarnings() QLocale::Language SettingDialog::designerLanguage() { - foreach (QLocale::Language language, *m_designerLanguages) { + foreach (QLocale::Language language, m_aviableLanguages) { if (ui->designerLanguage->currentText().compare(QLocale::languageToString(language)) == 0) return language; } @@ -81,14 +81,22 @@ void SettingDialog::setUseDarkTheme(bool value) ui->cbbUseDarkTheme->setChecked(value); } -void SettingDialog::setDesignerLanguages(QList* languages, QLocale::Language currentLanguage) +void SettingDialog::setDesignerLanguages(QList languages, QLocale::Language currentLanguage) { - m_designerLanguages = languages; + m_aviableLanguages = languages; + m_currentLanguage = currentLanguage; + + if (languages.isEmpty()) { + ui->designerLanguage->setVisible(false); + ui->lblLanguage->setVisible(false); + return; + } ui->designerLanguage->addItem(QLocale::languageToString(currentLanguage)); - foreach (QLocale::Language language, *languages) { + foreach (QLocale::Language language, languages) { if (language != currentLanguage) ui->designerLanguage->addItem(QLocale::languageToString(language)); } + ui->designerLanguage->setCurrentText(QLocale::languageToString(currentLanguage)); } } // namespace LimeReport diff --git a/limereport/lrsettingdialog.h b/limereport/lrsettingdialog.h index 20bbb0b..d4c89e3 100644 --- a/limereport/lrsettingdialog.h +++ b/limereport/lrsettingdialog.h @@ -28,10 +28,11 @@ public: void setVerticalGridStep(int value); void setDefaultFont(const QFont& value); void setUseDarkTheme(bool value); - void setDesignerLanguages(QList* languages, QLocale::Language currentLanguage); + void setDesignerLanguages(QList languages, QLocale::Language currentLanguage); private: Ui::SettingDialog *ui; - QList* m_designerLanguages; + QList m_aviableLanguages; + QLocale::Language m_currentLanguage; }; } // namespace LimeReport diff --git a/limereport/lrsettingdialog.ui b/limereport/lrsettingdialog.ui index 688ad14..fa7da68 100644 --- a/limereport/lrsettingdialog.ui +++ b/limereport/lrsettingdialog.ui @@ -11,7 +11,7 @@ - + 0 0 @@ -115,9 +115,9 @@ - + - + Language From 91827a27f2a9eb14fe4a1eef30e595ee4febdb05 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 16 May 2018 11:00:15 +0300 Subject: [PATCH 4/6] FontEditor fixed --- limereport/items/editors/lrfonteditorwidget.cpp | 4 ++-- limereport/items/editors/lrfonteditorwidget.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/limereport/items/editors/lrfonteditorwidget.cpp b/limereport/items/editors/lrfonteditorwidget.cpp index 2d6bcad..be54949 100644 --- a/limereport/items/editors/lrfonteditorwidget.cpp +++ b/limereport/items/editors/lrfonteditorwidget.cpp @@ -106,9 +106,9 @@ bool FontEditorWidget::ignoreSlots() const } -void FontEditorWidget::slotFontChanged(const QFont /*&font*/) +void FontEditorWidget::slotFontChanged(const QFont& /*font*/) { - // if (page()) page()->setFont(font); + //if (page()) page()->setFont(font); } void FontEditorWidget::slotFontSizeChanged(const QString &value) diff --git a/limereport/items/editors/lrfonteditorwidget.h b/limereport/items/editors/lrfonteditorwidget.h index c5de288..d319ff0 100644 --- a/limereport/items/editors/lrfonteditorwidget.h +++ b/limereport/items/editors/lrfonteditorwidget.h @@ -53,7 +53,7 @@ protected: QFontComboBox* fontNameEditor(){return m_fontNameEditor;} virtual void initEditor(); protected slots: - virtual void slotFontChanged(const QFont); + virtual void slotFontChanged(const QFont&); virtual void slotFontSizeChanged(const QString& value); virtual void slotFontAttribsChanged(bool); void slotPropertyChanged(const QString& objectName, const QString& property, const QVariant &oldValue, const QVariant &newValue); From 16a5da084a4d73eff0ae57fab169fcaedb83d35e Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 21 May 2018 18:54:55 +0300 Subject: [PATCH 5/6] ru.ts updated --- translations/limereport_ru.ts | 454 +++++++++++++++++++++++++++++++++- 1 file changed, 450 insertions(+), 4 deletions(-) diff --git a/translations/limereport_ru.ts b/translations/limereport_ru.ts index 7d0f7ef..d66a67a 100644 --- a/translations/limereport_ru.ts +++ b/translations/limereport_ru.ts @@ -1,6 +1,60 @@ + + $ClassName$ + + $ClassName$ + + + + + ChartItemEditor + + Series editor + + + + Series + + + + Add + + + + Delete + + + + Name + Имя + + + Values field + + + + Color + + + + Type + Тип + + + Labels field + + + + Ok + Ок + + + Series name + + + LRVariableDialog @@ -23,6 +77,21 @@ Attention Внимание + + Mandatory + + + + + LanguageSelectDialog + + Dialog + + + + Language + + LimeReport::AboutDialog @@ -319,6 +388,10 @@ p, li { white-space: pre-wrap; } Start new page Начинать новую страницу + + Keep top space + + LimeReport::BaseDesignIntf @@ -350,6 +423,10 @@ p, li { white-space: pre-wrap; } All borders Внешние границы + + Create Horizontal Layout + + LimeReport::ConnectionDesc @@ -440,6 +517,10 @@ p, li { white-space: pre-wrap; } already exists! уже существует! + + Port + + LimeReport::DataBand @@ -447,6 +528,10 @@ p, li { white-space: pre-wrap; } Data Данные + + Use alternate background color + + LimeReport::DataBrowser @@ -595,6 +680,37 @@ p, li { white-space: pre-wrap; } Внешние переменные + + LimeReport::DialogDesignerManager + + Edit Widgets + + + + Widget Box + + + + Object Inspector + Инспектор объектов + + + Property Editor + + + + Signals && Slots Editor + + + + Resource Editor + + + + Action Editor + + + LimeReport::EnumPropItem @@ -785,6 +901,42 @@ p, li { white-space: pre-wrap; } VerticalUniform Вертикально равномерно + + Pie + + + + VerticalBar + + + + HorizontalBar + + + + LegendAlignTop + + + + LegendAlignCenter + + + + LegendAlignBottom + + + + TitleAlignLeft + + + + TitleAlignRight + + + + TitleAlignCenter + + LimeReport::FlagsPropItem @@ -894,6 +1046,10 @@ p, li { white-space: pre-wrap; } Image Изображение + + Watermark + + LimeReport::ItemLocationPropItem @@ -1007,6 +1163,14 @@ p, li { white-space: pre-wrap; } Page Footer Нижний колонтитул + + Print on first page + + + + Print on last page + + LimeReport::PageHeader @@ -1021,6 +1185,22 @@ p, li { white-space: pre-wrap; } Paste Вставить + + Page is TOC + + + + Reset page number + + + + Full page + + + + Set page size to printer + + LimeReport::PreviewReportWidget @@ -1553,6 +1733,66 @@ p, li { white-space: pre-wrap; } Property value Значение + + endlessHeight + + + + extendedHeight + + + + isExtendedInDesignMode + + + + pageIsTOC + + + + setPageSizeToPrinter + + + + fillInSecondPass + + + + chartTitle + + + + chartType + + + + drawLegendBorder + + + + labelsField + + + + legendAlign + + + + series + + + + titleAlign + + + + watermark + + + + keepTopSpace + + LimeReport::RectMMPropItem @@ -1594,6 +1834,10 @@ p, li { white-space: pre-wrap; } Wrong file format Неверный формат файла + + Translations + + LimeReport::ReportDesignWindow @@ -1687,11 +1931,11 @@ p, li { white-space: pre-wrap; } Hide left panel - Спрятать левую панель + Спрятать левую панель Hide right panel - Спрятать правую панель + Спрятать правую панель Report Tools @@ -1837,6 +2081,46 @@ p, li { white-space: pre-wrap; } Report has been modified! Do you want save the report? Отчет был изменен! Сохранить изменения? + + Hide left panel | Alt+L + + + + Hide right panel | Alt+R + + + + Delete dialog + + + + Add new dialog + + + + Widget Box + + + + Property Editor + + + + Action Editor + + + + Resource Editor + + + + SignalSlot Editor + + + + Dialog Designer Tools + + LimeReport::ReportEnginePrivate @@ -1858,6 +2142,22 @@ p, li { white-space: pre-wrap; } This preview is no longer valid. Файл отчета "%1" изменил имя или был удален. + + Designer not found! + + + + Language %1 already exists + + + + Warning + Предупреждение + + + The language will change after the application is restarted + + LimeReport::ReportFooter @@ -2042,12 +2342,31 @@ This preview is no longer valid. Диалог %1 уже существует + + LimeReport::ScriptEditor + + Form + Форма + + + Data + Данные + + + Functions + Функции + + LimeReport::ScriptEngineContext Dialog with name: %1 can`t be created Диалог %1 не может быть создан + + Error + Ошибка + LimeReport::ScriptEngineManager @@ -2103,6 +2422,50 @@ This preview is no longer valid. GENERAL ОБЩИЕ + + Function manger with name "%1" already exists! + + + + FieldName + + + + Field %1 not found in %2! + + + + Datasource + Источник данных + + + ValueField + + + + KeyField + + + + KeyFieldValue + + + + Unique identifier + + + + Content + Содержимое + + + Indent + + + + datasourceName + + LimeReport::SettingDialog @@ -2138,6 +2501,14 @@ This preview is no longer valid. Suppress absent fields and variables warning Не выводить сообщения об отсутствии полей или переменных + + Language + + + + Use dark theme + + LimeReport::SubDetailBand @@ -2221,6 +2592,14 @@ This preview is no longer valid. TextItem " %1 " not found! Текстовый элемент %1 не найден! + + Transparent + + + + Watermark + + LimeReport::TextItemEditor @@ -2234,7 +2613,7 @@ This preview is no longer valid. Functions - Функции + Функции Editor settings @@ -2250,7 +2629,7 @@ This preview is no longer valid. Data - Данные + Данные ... @@ -2269,6 +2648,53 @@ This preview is no longer valid. + + LimeReport::TranslationEditor + + Form + Форма + + + Languages + + + + ... + ... + + + Pages + + + + Strings + + + + Source Text + + + + Translation + + + + Checked + + + + Report Item + + + + Property + + + + Source text + + + LimeReport::VariablesHolder @@ -2486,5 +2912,25 @@ This preview is no longer valid. Object with name %1 already exists! Объект %1 уже существует! + + Chart Item + + + + First + + + + Second + + + + Thrid + + + + Datasource manager not found + + From c32281fb7965c7e12b1bad7762c6119038e755a5 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 21 May 2018 21:10:16 +0300 Subject: [PATCH 6/6] Fix re-enabling subdetail checkbox #109 --- include/lrreportengine.h | 1 + limereport/databrowser/lrdatabrowser.cpp | 69 ++++++++++++++-------- limereport/databrowser/lrdatabrowser.h | 5 ++ limereport/databrowser/lrsqleditdialog.cpp | 3 +- limereport/databrowser/lrsqleditdialog.h | 2 +- 5 files changed, 54 insertions(+), 26 deletions(-) diff --git a/include/lrreportengine.h b/include/lrreportengine.h index e6db8d0..6eed25a 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -122,6 +122,7 @@ signals: void onLoad(bool& loaded); void onSave(); void saveFinished(); + void loaded(); void getAviableLanguages(QList* languages); void currentDefaulLanguageChanged(QLocale::Language); QLocale::Language getCurrentDefaultLanguage(); diff --git a/limereport/databrowser/lrdatabrowser.cpp b/limereport/databrowser/lrdatabrowser.cpp index 3dcd795..50eaa6a 100644 --- a/limereport/databrowser/lrdatabrowser.cpp +++ b/limereport/databrowser/lrdatabrowser.cpp @@ -96,31 +96,10 @@ void DataBrowser::slotAddConnection() void DataBrowser::slotSQLEditingFinished(SQLEditResult result) { if (result.dialogMode==SQLEditDialog::AddMode) { - switch (result.resultMode) { - case SQLEditResult::Query: - addQuery(result); - break; - case SQLEditResult::SubQuery: - addSubQuery(result); - break; - case SQLEditResult::SubProxy: - addProxy(result); - default: - break; - } + addDatasource(result); } else { - switch(result.resultMode){ - case SQLEditResult::Query: - changeQuery(result); - break; - case SQLEditResult::SubQuery: - changeSubQuery(result); - break; - case SQLEditResult::SubProxy: - changeProxy(result); - } + applyChanges(result); } - updateDataTree(); } @@ -661,6 +640,50 @@ void DataBrowser::changeProxy(SQLEditResult result) } } +SQLEditResult::ResultMode DataBrowser::currentDatasourceType(const QString& datasourceName) +{ + if (m_report->dataManager()->isQuery(datasourceName)) return SQLEditResult::Query; + if (m_report->dataManager()->isSubQuery(datasourceName)) return SQLEditResult::SubQuery; + if (m_report->dataManager()->isProxy(datasourceName)) return SQLEditResult::SubProxy; + return SQLEditResult::Undefined; +} + + +void DataBrowser::applyChanges(SQLEditResult result) +{ + if (result.resultMode == currentDatasourceType(result.datasourceName)){ + switch(result.resultMode){ + case SQLEditResult::Query: + changeQuery(result); + break; + case SQLEditResult::SubQuery: + changeSubQuery(result); + break; + case SQLEditResult::SubProxy: + changeProxy(result); + } + } else { + removeDatasource(result.datasourceName); + addDatasource(result); + } +} + +void DataBrowser::addDatasource(SQLEditResult result) +{ + switch (result.resultMode) { + case SQLEditResult::Query: + addQuery(result); + break; + case SQLEditResult::SubQuery: + addSubQuery(result); + break; + case SQLEditResult::SubProxy: + addProxy(result); + default: + break; + } +} + void DataBrowser::addConnectionDesc(ConnectionDesc *connection) { m_report->dataManager()->addConnectionDesc(connection); diff --git a/limereport/databrowser/lrdatabrowser.h b/limereport/databrowser/lrdatabrowser.h index 7d0a91e..3e4bfd3 100644 --- a/limereport/databrowser/lrdatabrowser.h +++ b/limereport/databrowser/lrdatabrowser.h @@ -106,6 +106,11 @@ private: void addProxy(SQLEditResult result); void changeProxy(SQLEditResult result); + + SQLEditResult::ResultMode currentDatasourceType(const QString& datasourceName); + void applyChanges(SQLEditResult result); + void addDatasource(SQLEditResult result); + void addConnectionDesc(ConnectionDesc *connection); void changeConnectionDesc(ConnectionDesc *connection); bool checkConnectionDesc(ConnectionDesc *connection); diff --git a/limereport/databrowser/lrsqleditdialog.cpp b/limereport/databrowser/lrsqleditdialog.cpp index f74ae6c..ae0d297 100644 --- a/limereport/databrowser/lrsqleditdialog.cpp +++ b/limereport/databrowser/lrsqleditdialog.cpp @@ -179,7 +179,7 @@ void SQLEditDialog::setDataSources(LimeReport::DataSourceManager *dataSources, Q { m_datasources=dataSources; if (!datasourceName.isEmpty()){ - ui->cbSubdetail->setEnabled(false); + ui->cbSubdetail->setEnabled(true); initQueryMode(); m_oldDatasourceName=datasourceName; ui->leDatasourceName->setText(datasourceName); @@ -278,7 +278,6 @@ void SQLEditDialog::initSubQueryMode() ui->leMaster->setVisible(true); ui->leMaster->setEnabled(true); ui->lbMaster->setVisible(true); - } void SQLEditDialog::initProxyMode() diff --git a/limereport/databrowser/lrsqleditdialog.h b/limereport/databrowser/lrsqleditdialog.h index 269f3f4..0f6759a 100644 --- a/limereport/databrowser/lrsqleditdialog.h +++ b/limereport/databrowser/lrsqleditdialog.h @@ -95,7 +95,7 @@ private: }; struct SQLEditResult{ - enum ResultMode{Query,SubQuery,SubProxy}; + enum ResultMode{Query, SubQuery, SubProxy, Undefined}; QString connectionName; QString datasourceName; QString oldDatasourceName;