Merge branch 'master' into 1.4

# Conflicts:
#	limereport/lrreportengine.cpp
This commit is contained in:
Arin Alexander 2016-12-13 12:51:47 +03:00
commit 791efd136e
5 changed files with 24 additions and 5 deletions

View File

@ -107,7 +107,6 @@ void MainWindow::slotPagesSet(int pagesCount)
void MainWindow::slotPageChanged(int page)
{
// ui->sbPageNavigator->setValue(page);
m_pageNavigator->setValue(page);
}
@ -118,8 +117,10 @@ void MainWindow::slotPageNavigatorChanged(int page)
void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, int )
{
m_report.loadFromFile(item->data(0,Qt::UserRole).toString());
m_preview->refreshPages();
if (!m_report.isBusy()){
m_report.loadFromFile(item->data(0,Qt::UserRole).toString());
m_preview->refreshPages();
}
}
void MainWindow::initPercentCombobox()

View File

@ -98,6 +98,7 @@ public:
PreviewReportWidget *createPreviewWidget(QWidget *parent = 0);
void setPreviewWindowTitle(const QString& title);
void setPreviewWindowIcon(const QIcon& icon);
bool isBusy();
signals:
void renderStarted();
void renderFinished();

View File

@ -58,7 +58,7 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) :
QObject(parent), m_fileName(""), m_settings(0), m_ownedSettings(false),
m_printer(new QPrinter(QPrinter::HighResolution)), m_printerSelected(false),
m_showProgressDialog(true), m_reportName(""), m_activePreview(0),
m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview"))
m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")), m_reportRendering(false)
{
m_datasources= new DataSourceManager(this);
m_scriptEngineContext = new ScriptEngineContext(this);
@ -457,6 +457,7 @@ void ReportEnginePrivate::cancelRender()
{
if (m_reportRender)
m_reportRender->cancelRender();
m_reportRendering = false;
}
PageDesignIntf* ReportEngine::createPreviewScene(QObject* parent){
@ -634,6 +635,11 @@ void ReportEnginePrivate::setSuppressFieldAndVarError(bool suppressFieldAndVarEr
m_reportSettings.setSuppressAbsentFieldsAndVarsWarnings(suppressFieldAndVarError);
}
bool ReportEnginePrivate::isBusy()
{
return m_reportRendering;
}
QString ReportEnginePrivate::previewWindowTitle() const
{
return m_previewWindowTitle;
@ -656,6 +662,7 @@ void ReportEnginePrivate::setPreviewWindowIcon(const QIcon &previewWindowIcon)
ReportPages ReportEnginePrivate::renderToPages()
{
if (m_reportRendering) return ReportPages();
m_reportRender = ReportRender::Ptr(new ReportRender);
dataManager()->clearErrors();
dataManager()->connectAllDatabases();
@ -664,6 +671,7 @@ ReportPages ReportEnginePrivate::renderToPages()
this, SIGNAL(renderPageFinished(int)));
if (m_pages.count()){
ReportPages result;
m_reportRendering = true;
emit renderStarted();
m_reportRender->setDatasources(dataManager());
m_reportRender->setScriptContext(scriptContext());
@ -676,6 +684,7 @@ ReportPages ReportEnginePrivate::renderToPages()
m_reportRender->secondRenderPass(result);
emit renderFinished();
m_reportRender.clear();
m_reportRendering = false;
return result;
} else {
return ReportPages();
@ -763,6 +772,12 @@ void ReportEngine::setPreviewWindowIcon(const QIcon &icon)
d->setPreviewWindowIcon(icon);
}
bool ReportEngine::isBusy()
{
Q_D(ReportEngine);
return d->isBusy();
}
void ReportEngine::setShowProgressDialog(bool value)
{
Q_D(ReportEngine);

View File

@ -98,6 +98,7 @@ public:
PreviewReportWidget *createPreviewWidget(QWidget *parent = 0);
void setPreviewWindowTitle(const QString& title);
void setPreviewWindowIcon(const QIcon& icon);
bool isBusy();
signals:
void renderStarted();
void renderFinished();

View File

@ -121,7 +121,7 @@ public:
bool suppressFieldAndVarError() const;
void setSuppressFieldAndVarError(bool suppressFieldAndVarError);
bool isBusy();
signals:
void pagesLoadFinished();
void datasourceCollectionLoadFinished(const QString& collectionName);
@ -170,6 +170,7 @@ private:
QString m_previewWindowTitle;
QPointer<ReportDesignWindow> m_designerWindow;
ReportSettings m_reportSettings;
bool m_reportRendering;
};
}