mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-24 04:33:03 +03:00
Fix #56 isBusy has been added to ReportEngine
This commit is contained in:
parent
86ccf6868c
commit
97bd5e4584
@ -107,7 +107,6 @@ void MainWindow::slotPagesSet(int pagesCount)
|
||||
|
||||
void MainWindow::slotPageChanged(int page)
|
||||
{
|
||||
// ui->sbPageNavigator->setValue(page);
|
||||
m_pageNavigator->setValue(page);
|
||||
}
|
||||
|
||||
@ -118,9 +117,11 @@ void MainWindow::slotPageNavigatorChanged(int page)
|
||||
|
||||
void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, int )
|
||||
{
|
||||
if (!m_report.isBusy()){
|
||||
m_report.loadFromFile(item->data(0,Qt::UserRole).toString());
|
||||
m_preview->refreshPages();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::initPercentCombobox()
|
||||
{
|
||||
|
@ -92,6 +92,7 @@ public:
|
||||
PreviewReportWidget *createPreviewWidget(QWidget *parent = 0);
|
||||
void setPreviewWindowTitle(const QString& title);
|
||||
void setPreviewWindowIcon(const QIcon& icon);
|
||||
bool isBusy();
|
||||
signals:
|
||||
void renderStarted();
|
||||
void renderFinished();
|
||||
|
@ -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_datasources->setObjectName("datasources");
|
||||
@ -409,6 +409,7 @@ void ReportEnginePrivate::cancelRender()
|
||||
{
|
||||
if (m_reportRender)
|
||||
m_reportRender->cancelRender();
|
||||
m_reportRendering = false;
|
||||
}
|
||||
|
||||
void ReportEnginePrivate::designReport()
|
||||
@ -579,6 +580,11 @@ void ReportEnginePrivate::setSuppressFieldAndVarError(bool suppressFieldAndVarEr
|
||||
m_reportSettings.setSuppressAbsentFieldsAndVarsWarnings(suppressFieldAndVarError);
|
||||
}
|
||||
|
||||
bool ReportEnginePrivate::isBusy()
|
||||
{
|
||||
return m_reportRendering;
|
||||
}
|
||||
|
||||
QString ReportEnginePrivate::previewWindowTitle() const
|
||||
{
|
||||
return m_previewWindowTitle;
|
||||
@ -601,6 +607,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();
|
||||
@ -608,11 +615,13 @@ ReportPages ReportEnginePrivate::renderToPages()
|
||||
connect(m_reportRender.data(),SIGNAL(pageRendered(int)),
|
||||
this, SIGNAL(renderPageFinished(int)));
|
||||
if (m_pages.count()){
|
||||
m_reportRendering = true;
|
||||
emit renderStarted();
|
||||
m_reportRender->setDatasources(dataManager());
|
||||
m_pages.at(0)->setReportSettings(&m_reportSettings);
|
||||
ReportPages result = m_reportRender->renderPageToPages(m_pages.at(0));
|
||||
emit renderFinished();
|
||||
m_reportRendering = false;
|
||||
return result;
|
||||
}else {
|
||||
return ReportPages();
|
||||
@ -695,6 +704,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);
|
||||
|
@ -92,6 +92,7 @@ public:
|
||||
PreviewReportWidget *createPreviewWidget(QWidget *parent = 0);
|
||||
void setPreviewWindowTitle(const QString& title);
|
||||
void setPreviewWindowIcon(const QIcon& icon);
|
||||
bool isBusy();
|
||||
signals:
|
||||
void renderStarted();
|
||||
void renderFinished();
|
||||
|
@ -115,7 +115,7 @@ public:
|
||||
|
||||
bool suppressFieldAndVarError() const;
|
||||
void setSuppressFieldAndVarError(bool suppressFieldAndVarError);
|
||||
|
||||
bool isBusy();
|
||||
signals:
|
||||
void pagesLoadFinished();
|
||||
void datasourceCollectionLoadFinished(const QString& collectionName);
|
||||
@ -163,6 +163,7 @@ private:
|
||||
QString m_previewWindowTitle;
|
||||
QPointer<ReportDesignWindow> m_designerWindow;
|
||||
ReportSettings m_reportSettings;
|
||||
bool m_reportRendering;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user