mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-23 20:22:58 +03:00
Designer interface setting added
This commit is contained in:
parent
c2d731eef9
commit
e9c44f0eb6
@ -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<QLocale::Language>* designerLanguages();
|
||||
QLocale::Language currentDesignerLanguage();
|
||||
signals:
|
||||
void renderStarted();
|
||||
void renderFinished();
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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<QLocale::Language>* 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<QLocale::Language>*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);
|
||||
|
@ -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<QLocale::Language>* designerLanguages();
|
||||
QLocale::Language currentDesignerLanguage();
|
||||
signals:
|
||||
void renderStarted();
|
||||
void renderFinished();
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <QObject>
|
||||
#include <QSharedPointer>
|
||||
#include <QMainWindow>
|
||||
#include <QLocale>
|
||||
#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<QLocale::Language>* 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<QLocale::Language>* 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<QLocale::Language> m_designerLanguages;
|
||||
QLocale::Language m_currentDesignerLanguage;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -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<QLocale::Language>* 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
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define LRSETTINGDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QLocale>
|
||||
|
||||
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<QLocale::Language>* languages, QLocale::Language currentLanguage);
|
||||
private:
|
||||
Ui::SettingDialog *ui;
|
||||
QList<QLocale::Language>* m_designerLanguages;
|
||||
};
|
||||
} // namespace LimeReport
|
||||
|
||||
|
@ -6,10 +6,16 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>351</width>
|
||||
<height>318</height>
|
||||
<width>397</width>
|
||||
<height>378</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Designer setting</string>
|
||||
</property>
|
||||
@ -108,6 +114,27 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Language</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="designerLanguage">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbbUseDarkTheme">
|
||||
<property name="text">
|
||||
|
Loading…
Reference in New Issue
Block a user