mirror of
https://github.com/fralx/LimeReport.git
synced 2025-09-23 08:29:07 +03:00
Merge branch 'develop' into feature/pdf-signal
This commit is contained in:
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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()
|
||||
|
@@ -95,7 +95,7 @@ private:
|
||||
};
|
||||
|
||||
struct SQLEditResult{
|
||||
enum ResultMode{Query,SubQuery,SubProxy};
|
||||
enum ResultMode{Query, SubQuery, SubProxy, Undefined};
|
||||
QString connectionName;
|
||||
QString datasourceName;
|
||||
QString oldDatasourceName;
|
||||
|
@@ -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)
|
||||
|
@@ -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);
|
||||
|
@@ -707,6 +707,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();
|
||||
@@ -714,6 +715,9 @@ void ReportDesignWidget::editSetting()
|
||||
m_defaultFont = setting.defaultFont();
|
||||
m_useDarkTheme = setting.userDarkTheme();
|
||||
m_report->setSuppressFieldAndVarError(setting.suppressAbsentFieldsAndVarsWarnings());
|
||||
if (m_report->currentDesignerLanguage() != setting.designerLanguage() ){
|
||||
m_report->setCurrentDesignerLanguage(setting.designerLanguage());
|
||||
}
|
||||
applySettings();
|
||||
}
|
||||
}
|
||||
|
@@ -71,7 +71,6 @@ public:
|
||||
QSettings* settings();
|
||||
void restoreSetting();
|
||||
void setShowProgressDialog(bool value){m_showProgressDialog = value;}
|
||||
|
||||
private slots:
|
||||
void slotNewReport();
|
||||
void slotNewPage();
|
||||
|
@@ -964,6 +964,27 @@ void ReportEnginePrivate::activateLanguage(QLocale::Language language)
|
||||
}
|
||||
}
|
||||
|
||||
QList<QLocale::Language> ReportEnginePrivate::designerLanguages()
|
||||
{
|
||||
|
||||
QList<QLocale::Language> result;
|
||||
emit getAviableLanguages(&result);
|
||||
return result;
|
||||
}
|
||||
|
||||
QLocale::Language ReportEnginePrivate::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
|
||||
{
|
||||
return m_styleSheet;
|
||||
@@ -1145,8 +1166,17 @@ 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(loaded()), this, SIGNAL(loaded()));
|
||||
connect(d, SIGNAL(printedToPDF(QString)), this, SIGNAL(printedToPDF(QString)));
|
||||
|
||||
connect(d, SIGNAL(getAviableLanguages(QList<QLocale::Language>*)),
|
||||
this, SIGNAL(getAviableLanguages(QList<QLocale::Language>*)));
|
||||
connect(d, SIGNAL(currentDefaulLanguageChanged(QLocale::Language)),
|
||||
this, SIGNAL(currentDefaulLanguageChanged(QLocale::Language)));
|
||||
connect(d, SIGNAL(getCurrentDefaultLanguage()),
|
||||
this, SIGNAL(getCurrentDefaultLanguage()));
|
||||
|
||||
}
|
||||
|
||||
ReportEngine::~ReportEngine()
|
||||
@@ -1253,6 +1283,30 @@ bool ReportEngine::setReportLanguage(QLocale::Language language)
|
||||
return d->setReportLanguage(language);
|
||||
}
|
||||
|
||||
Qt::LayoutDirection ReportEngine::previewLayoutDirection()
|
||||
{
|
||||
Q_D(ReportEngine);
|
||||
return d->previewLayoutDirection();
|
||||
}
|
||||
|
||||
void ReportEngine::setPreviewLayoutDirection(const Qt::LayoutDirection& previewLayoutDirection)
|
||||
{
|
||||
Q_D(ReportEngine);
|
||||
d->setPreviewLayoutDirection(previewLayoutDirection);
|
||||
}
|
||||
|
||||
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,8 @@ public:
|
||||
bool setReportLanguage(QLocale::Language language);
|
||||
Qt::LayoutDirection previewLayoutDirection();
|
||||
void setPreviewLayoutDirection(const Qt::LayoutDirection& previewLayoutDirection);
|
||||
QList<QLocale::Language> designerLanguages();
|
||||
QLocale::Language currentDesignerLanguage();
|
||||
signals:
|
||||
void renderStarted();
|
||||
void renderFinished();
|
||||
@@ -120,8 +122,14 @@ signals:
|
||||
void onLoad(bool& loaded);
|
||||
void onSave();
|
||||
void saveFinished();
|
||||
|
||||
void loaded();
|
||||
void printedToPDF(QString fileName);
|
||||
|
||||
void getAviableLanguages(QList<QLocale::Language>* languages);
|
||||
void currentDefaulLanguageChanged(QLocale::Language);
|
||||
QLocale::Language getCurrentDefaultLanguage();
|
||||
|
||||
public slots:
|
||||
void cancelRender();
|
||||
protected:
|
||||
|
@@ -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,
|
||||
@@ -179,7 +183,9 @@ public:
|
||||
void setPreviewLayoutDirection(const Qt::LayoutDirection& previewLayoutDirection);
|
||||
QString styleSheet() const;
|
||||
void setStyleSheet(const QString &styleSheet);
|
||||
|
||||
QList<QLocale::Language> designerLanguages();
|
||||
QLocale::Language currentDesignerLanguage();
|
||||
void setCurrentDesignerLanguage(QLocale::Language language);
|
||||
signals:
|
||||
void pagesLoadFinished();
|
||||
void datasourceCollectionLoadFinished(const QString& collectionName);
|
||||
@@ -190,8 +196,14 @@ signals:
|
||||
void onLoad(bool& loaded);
|
||||
void onSave();
|
||||
void saveFinished();
|
||||
|
||||
void loaded();
|
||||
void printedToPDF(QString fileName);
|
||||
|
||||
void getAviableLanguages(QList<QLocale::Language>* languages);
|
||||
void currentDefaulLanguageChanged(QLocale::Language);
|
||||
QLocale::Language getCurrentDefaultLanguage();
|
||||
|
||||
public slots:
|
||||
bool slotLoadFromFile(const QString& fileName);
|
||||
void cancelRender();
|
||||
@@ -250,6 +262,7 @@ private:
|
||||
Qt::LayoutDirection m_previewLayoutDirection;
|
||||
LimeReportPluginInterface* m_designerFactory;
|
||||
QString m_styleSheet;
|
||||
QLocale::Language m_currentDesignerLanguage;
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -47,6 +47,15 @@ bool SettingDialog::suppressAbsentFieldsAndVarsWarnings()
|
||||
return ui->cbSuppressWarnings->isChecked();
|
||||
}
|
||||
|
||||
QLocale::Language SettingDialog::designerLanguage()
|
||||
{
|
||||
foreach (QLocale::Language language, m_aviableLanguages) {
|
||||
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,22 @@ void SettingDialog::setUseDarkTheme(bool value)
|
||||
ui->cbbUseDarkTheme->setChecked(value);
|
||||
}
|
||||
|
||||
void SettingDialog::setDesignerLanguages(QList<QLocale::Language> languages, QLocale::Language currentLanguage)
|
||||
{
|
||||
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) {
|
||||
if (language != currentLanguage)
|
||||
ui->designerLanguage->addItem(QLocale::languageToString(language));
|
||||
}
|
||||
ui->designerLanguage->setCurrentText(QLocale::languageToString(currentLanguage));
|
||||
}
|
||||
|
||||
} // namespace LimeReport
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#define LRSETTINGDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QLocale>
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
@@ -21,13 +22,17 @@ 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_aviableLanguages;
|
||||
QLocale::Language m_currentLanguage;
|
||||
};
|
||||
} // 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="Minimum">
|
||||
<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="hlLanguage">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblLanguage">
|
||||
<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">
|
||||
|
Reference in New Issue
Block a user