mirror of
https://github.com/fralx/LimeReport.git
synced 2025-11-25 08:28:06 +03:00
Render indicator has been added
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
enum PrintType{ Printer, PDF, Display};
|
||||
enum PrintType{ Printer, PDF, Screen};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -81,7 +81,7 @@ int main(int argc, char *argv[])
|
||||
if (parser.value(typeOption).compare("Printer",Qt::CaseInsensitive) == 0)
|
||||
printType = Printer;
|
||||
if (parser.value(typeOption).compare("Display",Qt::CaseInsensitive) == 0)
|
||||
printType = Display;
|
||||
printType = Screen;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ int main(int argc, char *argv[])
|
||||
report.printReport(&printer);
|
||||
}
|
||||
break;
|
||||
case Display:
|
||||
case Screen:
|
||||
report.previewReport();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -162,24 +162,18 @@ void MainWindow::on_pushButton_2_clicked()
|
||||
#ifdef BUILD_WITH_EASY_PROFILER
|
||||
profiler::dumpBlocksToFile("test.prof");
|
||||
#endif
|
||||
// QPrinter* printer = new QPrinter;
|
||||
// QPrintDialog dialog(printer);
|
||||
// if (dialog.exec()){
|
||||
// QMap<QString, QPrinter*> printers;
|
||||
// printers.insert("default",printer);
|
||||
// report->printReport(printers);
|
||||
// }
|
||||
|
||||
report->setShowProgressDialog(true);
|
||||
|
||||
report->previewReport();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::renderStarted()
|
||||
{
|
||||
if (report->isShowProgressDialog()) {
|
||||
if (!report->isShowProgressDialog()) {
|
||||
m_currentPage = 0;
|
||||
m_progressDialog = new QProgressDialog(tr("Start render"), tr("Cancel"), 0, 0, this);
|
||||
// m_progressDialog->setWindowModality(Qt::WindowModal);
|
||||
connect(m_progressDialog, SIGNAL(canceled()), report, SLOT(cancelRender()));
|
||||
QApplication::processEvents();
|
||||
m_progressDialog->show();
|
||||
|
||||
@@ -263,6 +263,34 @@ void ReportEnginePrivate::slotDesignerWindowDestroyed(QObject* window)
|
||||
dataManager()->setDesignTime(false);
|
||||
}
|
||||
|
||||
void ReportEnginePrivate::slotRenderStarted()
|
||||
{
|
||||
if (m_showProgressDialog) {
|
||||
m_progressDialog = new QProgressDialog(tr("Start render"), tr("Cancel"), 0, 0, 0);
|
||||
connect(m_progressDialog, SIGNAL(canceled()), this, SLOT(cancelRender()));
|
||||
connect(this, SIGNAL(renderPageFinished(int)), this, SLOT(slotPageRenderFinished(int)));
|
||||
connect(this, SIGNAL(renderFinished()), this, SLOT(slotRenderFinished()));
|
||||
m_progressDialog->show();
|
||||
}
|
||||
}
|
||||
|
||||
void ReportEnginePrivate::slotPageRenderFinished(int renderedPageCount)
|
||||
{
|
||||
if (m_progressDialog) {
|
||||
m_progressDialog->setLabelText(QString::number(renderedPageCount) + tr(" page rendered"));
|
||||
m_progressDialog->setValue(renderedPageCount);
|
||||
}
|
||||
}
|
||||
|
||||
void ReportEnginePrivate::slotRenderFinished()
|
||||
{
|
||||
if (m_progressDialog){
|
||||
m_progressDialog->close();
|
||||
delete m_progressDialog;
|
||||
m_progressDialog = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void ReportEnginePrivate::clearReport()
|
||||
{
|
||||
foreach (PageDesignIntf* page, m_pages)
|
||||
@@ -560,6 +588,7 @@ void ReportEnginePrivate::previewReport(QPrinter* printer, PreviewHints hints)
|
||||
{
|
||||
try {
|
||||
dataManager()->setDesignTime(false);
|
||||
connect(this, SIGNAL(renderStarted()), this, SLOT(slotRenderStarted()));
|
||||
ReportPages pages = renderToPages();
|
||||
dataManager()->setDesignTime(true);
|
||||
showPreviewWindow(pages, hints, printer);
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <QMainWindow>
|
||||
#include <QObject>
|
||||
#include <QSharedPointer>
|
||||
#include <QProgressDialog>
|
||||
|
||||
class QFileSystemWatcher;
|
||||
|
||||
@@ -315,11 +316,16 @@ protected:
|
||||
PageDesignIntf* createPage(const QString& pageName = "", bool preview = false);
|
||||
bool showPreviewWindow(ReportPages pages, PreviewHints hints, QPrinter* printer);
|
||||
void internalPrintPages(ReportPages pages, QPrinter& printer);
|
||||
|
||||
protected slots:
|
||||
void slotDataSourceCollectionLoaded(const QString& collectionName);
|
||||
|
||||
private slots:
|
||||
void slotPreviewWindowDestroyed(QObject* window);
|
||||
void slotDesignerWindowDestroyed(QObject* window);
|
||||
void slotRenderStarted();
|
||||
void slotPageRenderFinished(int renderedPageCount);
|
||||
void slotRenderFinished();
|
||||
|
||||
private:
|
||||
// ICollectionContainer
|
||||
@@ -391,6 +397,7 @@ private:
|
||||
QColor m_previewPageBackgroundColor;
|
||||
QVector<WatermarkSetting> m_watermarks;
|
||||
BaseDesignIntf* createWatermark(PageDesignIntf* page, WatermarkSetting watermarkSetting);
|
||||
QProgressDialog* m_progressDialog = 0;
|
||||
bool m_saveToFileVisible;
|
||||
bool m_printToPdfVisible;
|
||||
bool m_printVisible;
|
||||
|
||||
Reference in New Issue
Block a user