0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 16:44:39 +03:00

Merge branch 'develop'

This commit is contained in:
Arin Alexander 2019-10-16 22:59:20 +03:00
commit 315c43776c
14 changed files with 177 additions and 34 deletions

View File

@ -127,7 +127,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MAJOR = 1
LIMEREPORT_VERSION_MINOR = 5 LIMEREPORT_VERSION_MINOR = 5
LIMEREPORT_VERSION_RELEASE = 19 LIMEREPORT_VERSION_RELEASE = 20
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}' LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\" DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"

View File

@ -77,7 +77,7 @@ MainWindow::MainWindow(QWidget *parent) :
int index = m_customers->record().indexOf("CustomerID"); int index = m_customers->record().indexOf("CustomerID");
m_orders->bindValue(":id",m_customers->value(index)); m_orders->bindValue(":id",m_customers->value(index));
m_orders->exec(); m_orders->exec();
}; }
} }
LimeReport::ICallbackDatasource * callbackDatasource = report->dataManager()->createCallbackDatasource("master"); LimeReport::ICallbackDatasource * callbackDatasource = report->dataManager()->createCallbackDatasource("master");
@ -156,18 +156,21 @@ void MainWindow::on_pushButton_2_clicked()
// printers.insert("default",printer); // printers.insert("default",printer);
// report->printReport(printers); // report->printReport(printers);
// } // }
report->setShowProgressDialog(true);
report->previewReport(); report->previewReport();
} }
} }
void MainWindow::renderStarted() void MainWindow::renderStarted()
{ {
m_currentPage = 0; if (report->isShowProgressDialog()){
m_progressDialog = new QProgressDialog(tr("Start render"),tr("Cancel"),0,0,this); m_currentPage = 0;
m_progressDialog->setWindowModality(Qt::WindowModal); m_progressDialog = new QProgressDialog(tr("Start render"),tr("Cancel"),0,0,this);
connect(m_progressDialog, SIGNAL(canceled()), report, SLOT(cancelRender())); //m_progressDialog->setWindowModality(Qt::WindowModal);
m_progressDialog->show(); connect(m_progressDialog, SIGNAL(canceled()), report, SLOT(cancelRender()));
QApplication::processEvents(); QApplication::processEvents();
m_progressDialog->show();
}
} }
void MainWindow::renderPageFinished(int renderedPageCount) void MainWindow::renderPageFinished(int renderedPageCount)

View File

@ -164,6 +164,7 @@ public:
void designReport(); void designReport();
ReportDesignWindowInterface* getDesignerWindow(); ReportDesignWindowInterface* getDesignerWindow();
void setShowProgressDialog(bool value); void setShowProgressDialog(bool value);
bool isShowProgressDialog();
IDataSourceManager* dataManager(); IDataSourceManager* dataManager();
IScriptEngineManager* scriptManager(); IScriptEngineManager* scriptManager();
bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange = false); bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange = false);

View File

@ -158,6 +158,7 @@ void AbstractLayout::beforeDelete()
#endif #endif
BaseDesignIntf *bi = dynamic_cast<BaseDesignIntf*>(item); BaseDesignIntf *bi = dynamic_cast<BaseDesignIntf*>(item);
if (bi) { if (bi) {
bi->disconnect(this);
bi->setParentItem(parentItem()); bi->setParentItem(parentItem());
bi->setParent(parent()); bi->setParent(parent());
bi->setVisible(true); bi->setVisible(true);

View File

@ -525,6 +525,7 @@ void DataSourceManager::addQuery(const QString &name, const QString &sqlText, co
putQueryDesc(queryDecs); putQueryDesc(queryDecs);
putHolder(name,new QueryHolder(sqlText, connectionName, this)); putHolder(name,new QueryHolder(sqlText, connectionName, this));
m_hasChanges = true; m_hasChanges = true;
m_varToDataSource.clear();
emit datasourcesChanged(); emit datasourcesChanged();
} }
@ -534,6 +535,7 @@ void DataSourceManager::addSubQuery(const QString &name, const QString &sqlText,
putSubQueryDesc(subQueryDesc); putSubQueryDesc(subQueryDesc);
putHolder(name,new SubQueryHolder(sqlText, connectionName, masterDatasource, this)); putHolder(name,new SubQueryHolder(sqlText, connectionName, masterDatasource, this));
m_hasChanges = true; m_hasChanges = true;
m_varToDataSource.clear();
emit datasourcesChanged(); emit datasourcesChanged();
} }
@ -1373,18 +1375,31 @@ void DataSourceManager::slotQueryTextChanged(const QString &queryName, const QSt
if (holder){ if (holder){
holder->setQueryText(queryText); holder->setQueryText(queryText);
} }
m_varToDataSource.clear();
} }
void DataSourceManager::invalidateQueriesContainsVariable(const QString& variableName) void DataSourceManager::invalidateQueriesContainsVariable(const QString& variableName)
{ {
if (!variableIsSystem(variableName)){ if (!variableIsSystem(variableName)){
foreach (const QString& datasourceName, dataSourceNames()){
QueryHolder* holder = dynamic_cast<QueryHolder*>(m_datasources.value(datasourceName)); if (m_varToDataSource.contains(variableName)){
if (holder){ foreach(QString datasourceName, m_varToDataSource.value(variableName)){
QRegExp rx(QString(Const::NAMED_VARIABLE_RX).arg(variableName)); QueryHolder* holder = dynamic_cast<QueryHolder*>(m_datasources.value(datasourceName));
if (holder->queryText().contains(rx)) if (holder) holder->invalidate(designTime() ? IDataSource::DESIGN_MODE : IDataSource::RENDER_MODE);
holder->invalidate(designTime()?IDataSource::DESIGN_MODE:IDataSource::RENDER_MODE);
} }
} else {
QVector<QString> datasources;
foreach (const QString& datasourceName, dataSourceNames()){
QueryHolder* holder = dynamic_cast<QueryHolder*>(m_datasources.value(datasourceName));
if (holder){
QRegExp rx(QString(Const::NAMED_VARIABLE_RX).arg(variableName));
if (holder->queryText().contains(rx)){
holder->invalidate(designTime() ? IDataSource::DESIGN_MODE : IDataSource::RENDER_MODE);
datasources.append(datasourceName);
}
}
}
m_varToDataSource.insert(variableName, datasources);
} }
} }
} }
@ -1413,6 +1428,8 @@ void DataSourceManager::slotCSVTextChanged(const QString &csvName, const QString
void DataSourceManager::clear(ClearMethod method) void DataSourceManager::clear(ClearMethod method)
{ {
m_varToDataSource.clear();
DataSourcesMap::iterator dit; DataSourcesMap::iterator dit;
for( dit = m_datasources.begin(); dit != m_datasources.end(); ){ for( dit = m_datasources.begin(); dit != m_datasources.end(); ){
bool owned = (*dit)->isOwned() && (*dit)->isRemovable(); bool owned = (*dit)->isOwned() && (*dit)->isRemovable();

View File

@ -280,6 +280,9 @@ private:
QHash<QString,int> m_groupFunctionsExpressionsMap; QHash<QString,int> m_groupFunctionsExpressionsMap;
QVector<QString> m_groupFunctionsExpressions; QVector<QString> m_groupFunctionsExpressions;
IDbCredentialsProvider* m_dbCredentialsProvider; IDbCredentialsProvider* m_dbCredentialsProvider;
QMap< QString, QVector<QString> > m_varToDataSource;
bool m_hasChanges; bool m_hasChanges;
}; };

View File

@ -42,6 +42,9 @@
#include <QFileDialog> #include <QFileDialog>
#include <QScrollBar> #include <QScrollBar>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QLabel>
#include <QMessageBox>
#include <QToolButton>
namespace LimeReport{ namespace LimeReport{
@ -51,6 +54,25 @@ PreviewReportWindow::PreviewReportWindow(ReportEngine *report, QWidget *parent,
m_scalePercentChanging(false) m_scalePercentChanging(false)
{ {
ui->setupUi(this); ui->setupUi(this);
m_progressWidget = new QWidget(ui->statusbar);
QHBoxLayout* progressLayout = new QHBoxLayout();
progressLayout->setMargin(0);
progressLayout->addWidget(new QLabel(tr("Printing")));
m_progressBar = new QProgressBar(ui->statusbar);
m_progressBar->setMaximumWidth(100);
m_progressBar->setMaximumHeight(ui->statusbar->fontMetrics().height());
progressLayout->addWidget(m_progressBar);
QToolButton* tbCancel = new QToolButton();
tbCancel->setIcon(QIcon(":/report/images/closebox"));
tbCancel->setAutoRaise(true);
connect(tbCancel, SIGNAL(clicked(bool)), this, SLOT(slotCancelPrinting(bool)));
progressLayout->addWidget(tbCancel);
progressLayout->setSizeConstraint(QLayout::SetFixedSize);
m_progressWidget->setLayout(progressLayout);
m_progressWidget->setVisible(false);
ui->statusbar->addPermanentWidget(m_progressWidget);
setWindowTitle("Lime Report Preview"); setWindowTitle("Lime Report Preview");
m_pagesNavigator = new QSpinBox(this); m_pagesNavigator = new QSpinBox(this);
m_pagesNavigator->setMaximum(10000000); m_pagesNavigator->setMaximum(10000000);
@ -73,6 +95,10 @@ PreviewReportWindow::PreviewReportWindow(ReportEngine *report, QWidget *parent,
connect(m_previewReportWidget, SIGNAL(onSave(bool&, LimeReport::IPreparedPages*)), connect(m_previewReportWidget, SIGNAL(onSave(bool&, LimeReport::IPreparedPages*)),
this, SIGNAL(onSave(bool&, LimeReport::IPreparedPages*))); this, SIGNAL(onSave(bool&, LimeReport::IPreparedPages*)));
connect(m_previewReportWidget->d_ptr->m_report, SIGNAL(printingStarted(int)), this, SLOT(slotPrintingStarted(int)));
connect(m_previewReportWidget->d_ptr->m_report, SIGNAL(pagePrintingFinished(int)), this, SLOT(slotPagePrintingFinished(int)));
connect(m_previewReportWidget->d_ptr->m_report, SIGNAL(printingFinished()), this, SLOT(slotPrintingFinished()));
m_fontEditor = new FontEditorWidgetForPage(m_previewReportWidget->d_ptr->m_previewPage,tr("Font"),this); m_fontEditor = new FontEditorWidgetForPage(m_previewReportWidget->d_ptr->m_previewPage,tr("Font"),this);
m_fontEditor->setObjectName("fontTools"); m_fontEditor->setObjectName("fontTools");
m_fontEditor->setIconSize(ui->toolBar->iconSize()); m_fontEditor->setIconSize(ui->toolBar->iconSize());
@ -260,8 +286,12 @@ void PreviewReportWindow::exec()
if (deleteOnClose) delete this; if (deleteOnClose) delete this;
} }
void PreviewReportWindow::closeEvent(QCloseEvent *) void PreviewReportWindow::closeEvent(QCloseEvent* e)
{ {
if (m_progressBar->isVisible()){
QMessageBox::critical(this, tr("Attention"), tr("The printing is in process"));
e->setAccepted(false);
}
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
writeSetting(); writeSetting();
#endif #endif
@ -515,5 +545,27 @@ void PreviewReportWindow::slotItemInserted(PageDesignIntf *, QPointF, const QStr
slotActivateItemSelectionMode(); slotActivateItemSelectionMode();
} }
void PreviewReportWindow::slotPrintingStarted(int pageCount)
{
m_progressBar->setMinimum(1);
m_progressBar->setMaximum(pageCount);
m_progressWidget->setVisible(true);
}
void PreviewReportWindow::slotPagePrintingFinished(int pageIndex)
{
m_progressBar->setValue(pageIndex);
}
void PreviewReportWindow::slotPrintingFinished()
{
m_progressWidget->setVisible(false);
}
void PreviewReportWindow::slotCancelPrinting(bool)
{
m_previewReportWidget->d_ptr->m_report->cancelPrinting();
}
}// namespace LimeReport }// namespace LimeReport

View File

@ -37,6 +37,7 @@
#include <QSettings> #include <QSettings>
#include <QEventLoop> #include <QEventLoop>
#include <QPrinter> #include <QPrinter>
#include <QProgressBar>
#include "serializators/lrxmlreader.h" #include "serializators/lrxmlreader.h"
#include "lrpreparedpagesintf.h" #include "lrpreparedpagesintf.h"
@ -118,6 +119,10 @@ private slots:
void on_actionShow_Toolbar_triggered(); void on_actionShow_Toolbar_triggered();
void slotCurrentPageChanged(int page); void slotCurrentPageChanged(int page);
void slotItemInserted(LimeReport::PageDesignIntf* report, QPointF pos, const QString& ItemType); void slotItemInserted(LimeReport::PageDesignIntf* report, QPointF pos, const QString& ItemType);
void slotPrintingStarted(int pageCount);
void slotPagePrintingFinished(int pageIndex);
void slotPrintingFinished();
void slotCancelPrinting(bool);
signals: signals:
void onSave(bool& saved, LimeReport::IPreparedPages* pages); void onSave(bool& saved, LimeReport::IPreparedPages* pages);
private: private:
@ -139,6 +144,8 @@ private:
ScaleType m_previewScaleType; ScaleType m_previewScaleType;
int m_previewScalePercent; int m_previewScalePercent;
bool m_scalePercentChanging; bool m_scalePercentChanging;
QProgressBar* m_progressBar;
QWidget* m_progressWidget;
}; };
} //namespace LimeReport } //namespace LimeReport
#endif // LRPREVIEWREPORTWINDOW_H #endif // LRPREVIEWREPORTWINDOW_H

View File

@ -726,7 +726,10 @@ void ReportDesignWidget::previewReport()
#ifdef HAVE_QTDESIGNER_INTEGRATION #ifdef HAVE_QTDESIGNER_INTEGRATION
updateDialogs(); updateDialogs();
#endif #endif
bool showProgressDialog = report()->isShowProgressDialog();
report()->setShowProgressDialog(false);
report()->previewReport(); report()->previewReport();
report()->setShowProgressDialog(showProgressDialog);
} }
void ReportDesignWidget::printReport() void ReportDesignWidget::printReport()

View File

@ -65,6 +65,38 @@ namespace LimeReport{
ReportDesignWindow* ReportDesignWindow::m_instance=0; ReportDesignWindow* ReportDesignWindow::m_instance=0;
void ReportDesignWindow::createProgressBar()
{
m_progressWidget = new QWidget(m_statusBar);
QHBoxLayout* progressLayout = new QHBoxLayout();
progressLayout->setMargin(0);
m_progressLabel = new QLabel(tr("Rendered %1 pages").arg(0));
progressLayout->addWidget(m_progressLabel);
m_progressBar = new QProgressBar(m_statusBar);
m_progressBar->setFormat("%v pages");
m_progressBar->setAlignment(Qt::AlignCenter);
m_progressBar->setMaximumWidth(100);
m_progressBar->setMaximumHeight(m_statusBar->fontMetrics().height());
m_progressBar->setMinimum(0);
m_progressBar->setMaximum(0);
m_progressBar->setTextVisible(true);
progressLayout->addWidget(m_progressBar);
QToolButton* tbCancel = new QToolButton();
tbCancel->setToolTip(tr("Cancel report rendering"));
tbCancel->setIcon(QIcon(":/report/images/closebox"));
tbCancel->setAutoRaise(true);
connect(tbCancel, SIGNAL(clicked(bool)), this, SLOT(slotCancelRendering(bool)));
progressLayout->addWidget(tbCancel);
progressLayout->setSizeConstraint(QLayout::SetFixedSize);
m_progressWidget->setLayout(progressLayout);
m_progressWidget->setVisible(false);
m_statusBar->addPermanentWidget(m_progressWidget);
connect(dynamic_cast<QObject*>(m_reportDesignWidget->report()), SIGNAL(renderStarted()), this, SLOT(renderStarted()));
connect(dynamic_cast<QObject*>(m_reportDesignWidget->report()), SIGNAL(renderPageFinished(int)), this, SLOT(renderPageFinished(int)));
connect(dynamic_cast<QObject*>(m_reportDesignWidget->report()), SIGNAL(renderFinished()), this, SLOT(renderFinished()));
}
ReportDesignWindow::ReportDesignWindow(ReportEnginePrivateInterface* report, QWidget *parent, QSettings* settings) : ReportDesignWindow::ReportDesignWindow(ReportEnginePrivateInterface* report, QWidget *parent, QSettings* settings) :
ReportDesignWindowInterface(parent), m_textAttibutesIsChanging(false), m_settings(settings), m_ownedSettings(false), ReportDesignWindowInterface(parent), m_textAttibutesIsChanging(false), m_settings(settings), m_ownedSettings(false),
m_progressDialog(0), m_showProgressDialog(true), m_editorTabType(ReportDesignWidget::Page), m_reportItemIsLocked(false) m_progressDialog(0), m_showProgressDialog(true), m_editorTabType(ReportDesignWidget::Page), m_reportItemIsLocked(false)
@ -77,6 +109,7 @@ ReportDesignWindow::ReportDesignWindow(ReportEnginePrivateInterface* report, QWi
createDataWindow(); createDataWindow();
createScriptWindow(); createScriptWindow();
createObjectsBrowser(); createObjectsBrowser();
#ifdef HAVE_QTDESIGNER_INTEGRATION #ifdef HAVE_QTDESIGNER_INTEGRATION
createDialogWidgetBox(); createDialogWidgetBox();
createDialogPropertyEditor(); createDialogPropertyEditor();
@ -100,7 +133,8 @@ ReportDesignWindow::ReportDesignWindow(ReportEnginePrivateInterface* report, QWi
showDefaultToolBars(); showDefaultToolBars();
restoreSetting(); restoreSetting();
m_hideLeftPanel->setChecked(isDockAreaVisible(Qt::LeftDockWidgetArea)); m_hideLeftPanel->setChecked(isDockAreaVisible(Qt::LeftDockWidgetArea));
m_hideRightPanel->setChecked(isDockAreaVisible(Qt::RightDockWidgetArea)); m_hideRightPanel->setChecked(isDockAreaVisible(Qt::RightDockWidgetArea));
createProgressBar();
} }
ReportDesignWindow::~ReportDesignWindow() ReportDesignWindow::~ReportDesignWindow()
@ -515,9 +549,6 @@ void ReportDesignWindow::initReportEditor(ReportEnginePrivateInterface* report)
this, SLOT(slotBandAdded(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*))); this, SLOT(slotBandAdded(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)));
connect(m_reportDesignWidget, SIGNAL(bandDeleted(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)), connect(m_reportDesignWidget, SIGNAL(bandDeleted(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)),
this, SLOT(slotBandDeleted(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*))); this, SLOT(slotBandDeleted(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)));
connect(dynamic_cast<QObject*>(report), SIGNAL(renderStarted()), this, SLOT(renderStarted()));
connect(dynamic_cast<QObject*>(report), SIGNAL(renderPageFinished(int)), this, SLOT(renderPageFinished(int)));
connect(dynamic_cast<QObject*>(report), SIGNAL(renderFinished()), this, SLOT(renderFinished()));
connect(m_reportDesignWidget, SIGNAL(pageAdded(PageDesignIntf*)), this, SLOT(slotPageAdded(PageDesignIntf*))); connect(m_reportDesignWidget, SIGNAL(pageAdded(PageDesignIntf*)), this, SLOT(slotPageAdded(PageDesignIntf*)));
connect(m_reportDesignWidget, SIGNAL(pageDeleted()), this, SLOT(slotPageDeleted())); connect(m_reportDesignWidget, SIGNAL(pageDeleted()), this, SLOT(slotPageDeleted()));
} }
@ -1377,26 +1408,17 @@ void ReportDesignWindow::slotActivePageChanged()
void ReportDesignWindow::renderStarted() void ReportDesignWindow::renderStarted()
{ {
if (m_showProgressDialog){ m_progressWidget->setVisible(true);
m_progressDialog = new QProgressDialog(tr("Rendering report"),tr("Abort"),0,0,this);
m_progressDialog->open(dynamic_cast<QObject*>(m_reportDesignWidget->report()), SLOT(cancelRender()));
QApplication::processEvents();
}
} }
void ReportDesignWindow::renderPageFinished(int renderedPageCount) void ReportDesignWindow::renderPageFinished(int renderedPageCount)
{ {
if (m_progressDialog) m_progressLabel->setText(tr("Rendered %1 pages").arg(renderedPageCount));
m_progressDialog->setLabelText(QString::number(renderedPageCount)+tr(" page rendered"));
} }
void ReportDesignWindow::renderFinished() void ReportDesignWindow::renderFinished()
{ {
if (m_progressDialog){ m_progressWidget->setVisible(false);
m_progressDialog->close();
delete m_progressDialog;
}
m_progressDialog = 0;
} }
void ReportDesignWindow::slotShowAbout() void ReportDesignWindow::slotShowAbout()
@ -1536,8 +1558,18 @@ void ReportDesignWindow::slotSelectOneLevelItems()
m_reportDesignWidget->selectOneLevelItems(); m_reportDesignWidget->selectOneLevelItems();
} }
void ReportDesignWindow::slotCancelRendering(bool)
{
m_reportDesignWidget->report()->cancelRender();
}
void ReportDesignWindow::closeEvent(QCloseEvent * event) void ReportDesignWindow::closeEvent(QCloseEvent * event)
{ {
if (m_progressWidget->isVisible()){
QMessageBox::critical(this, tr("Attention"), tr("The rendering is in process"));
event->ignore();
return;
}
if (checkNeedToSave()){ if (checkNeedToSave()){
m_dataBrowser->closeAllDataWindows(); m_dataBrowser->closeAllDataWindows();
writeState(); writeState();

View File

@ -128,6 +128,8 @@ private slots:
void slotLockSelectedItems(); void slotLockSelectedItems();
void slotUnlockSelectedItems(); void slotUnlockSelectedItems();
void slotSelectOneLevelItems(); void slotSelectOneLevelItems();
void slotCancelRendering(bool);
protected: protected:
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
void resizeEvent(QResizeEvent *); void resizeEvent(QResizeEvent *);
@ -281,6 +283,12 @@ private:
QMap<QDockWidget*, bool> m_leftDocVisibleState; QMap<QDockWidget*, bool> m_leftDocVisibleState;
QMap<QDockWidget*, bool> m_rightDocVisibleState; QMap<QDockWidget*, bool> m_rightDocVisibleState;
QSortFilterProxyModel* m_filterModel; QSortFilterProxyModel* m_filterModel;
QWidget* m_progressWidget;
QProgressBar* m_progressBar;
QLabel* m_progressLabel;
void createProgressBar();
}; };
class ObjectNameValidator : public ValidatorIntf{ class ObjectNameValidator : public ValidatorIntf{

View File

@ -302,11 +302,16 @@ bool ReportEnginePrivate::printPages(ReportPages pages, QPrinter *printer)
void ReportEnginePrivate::internalPrintPages(ReportPages pages, QPrinter &printer) void ReportEnginePrivate::internalPrintPages(ReportPages pages, QPrinter &printer)
{ {
m_cancelPrinting = false;
int currenPage = 1; int currenPage = 1;
m_cancelPrinting = false;
QMap<QString, QSharedPointer<PrintProcessor> > printProcessors; QMap<QString, QSharedPointer<PrintProcessor> > printProcessors;
printProcessors.insert("default",QSharedPointer<PrintProcessor>(new PrintProcessor(&printer))); printProcessors.insert("default",QSharedPointer<PrintProcessor>(new PrintProcessor(&printer)));
emit printingStarted(printer.toPage() - printer.fromPage());
int pageCount = (printer.printRange() == QPrinter::AllPages) ?
pages.size() :
printer.toPage() - printer.fromPage();
emit printingStarted(pageCount);
foreach(PageItemDesignIntf::Ptr page, pages){ foreach(PageItemDesignIntf::Ptr page, pages){
if ( !m_cancelPrinting && if ( !m_cancelPrinting &&
((printer.printRange() == QPrinter::AllPages) || ((printer.printRange() == QPrinter::AllPages) ||
@ -708,7 +713,7 @@ bool ReportEnginePrivate::slotLoadFromFile(const QString &fileName)
} }
EASY_END_BLOCK; EASY_END_BLOCK;
return true; return true;
}; }
} }
m_lastError = reader->lastError(); m_lastError = reader->lastError();
EASY_END_BLOCK; EASY_END_BLOCK;
@ -1652,6 +1657,12 @@ void ReportEngine::setShowProgressDialog(bool value)
d->setShowProgressDialog(value); d->setShowProgressDialog(value);
} }
bool ReportEngine::isShowProgressDialog()
{
Q_D(ReportEngine);
return d->isShowProgressDialog();
}
IDataSourceManager *ReportEngine::dataManager() IDataSourceManager *ReportEngine::dataManager()
{ {
Q_D(ReportEngine); Q_D(ReportEngine);

View File

@ -164,6 +164,7 @@ public:
void designReport(); void designReport();
ReportDesignWindowInterface* getDesignerWindow(); ReportDesignWindowInterface* getDesignerWindow();
void setShowProgressDialog(bool value); void setShowProgressDialog(bool value);
bool isShowProgressDialog();
IDataSourceManager* dataManager(); IDataSourceManager* dataManager();
IScriptEngineManager* scriptManager(); IScriptEngineManager* scriptManager();
bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange = false); bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange = false);

View File

@ -110,6 +110,9 @@ public:
virtual QList<QLocale::Language> designerLanguages() = 0; virtual QList<QLocale::Language> designerLanguages() = 0;
virtual QLocale::Language currentDesignerLanguage() = 0; virtual QLocale::Language currentDesignerLanguage() = 0;
virtual void setCurrentDesignerLanguage(QLocale::Language language) = 0; virtual void setCurrentDesignerLanguage(QLocale::Language language) = 0;
virtual void cancelRender() = 0;
virtual void setShowProgressDialog(bool value) = 0;
virtual bool isShowProgressDialog() const = 0;
}; };
class PrintProcessor{ class PrintProcessor{
@ -179,6 +182,7 @@ public:
void designReport(); void designReport();
void setSettings(QSettings* value); void setSettings(QSettings* value);
void setShowProgressDialog(bool value){m_showProgressDialog = value;} void setShowProgressDialog(bool value){m_showProgressDialog = value;}
bool isShowProgressDialog() const {return m_showProgressDialog;}
QSettings* settings(); QSettings* settings();
bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange); bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange);
bool loadFromByteArray(QByteArray *data, const QString& name = ""); bool loadFromByteArray(QByteArray *data, const QString& name = "");