diff --git a/include/lrglobal.h b/include/lrglobal.h index b131207..be094a4 100644 --- a/include/lrglobal.h +++ b/include/lrglobal.h @@ -80,6 +80,13 @@ namespace Const{ QString extractClassName(QString className); enum RenderPass {FirstPass, SecondPass}; enum ArrangeType {AsNeeded, Force}; + enum PreviewHint{ShowAllPreviewBars=0, + HidePreviewToolBar=1, + HidePreviewMenuBar=2, + HidePreviewStatusBar=4, + HideAllPreviewBar=7}; + Q_DECLARE_FLAGS(PreviewHints, PreviewHint) + class ReportError : public std::runtime_error{ public: ReportError(const QString& message):std::runtime_error(message.toStdString()){} @@ -104,6 +111,6 @@ namespace Const{ } // namespace LimeReport - +Q_DECLARE_OPERATORS_FOR_FLAGS(LimeReport::PreviewHints) #endif // GLOBAL_H diff --git a/include/lrreportengine.h b/include/lrreportengine.h index afbbcdc..f89db86 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -71,7 +71,7 @@ public: bool printReport(QPrinter *printer=0); void printToFile(const QString& fileName); bool printToPDF(const QString& fileName); - void previewReport(); + void previewReport(PreviewHints hints = ShowAllPreviewBars); void designReport(); void setShowProgressDialog(bool value); IDataSourceManager* dataManager(); diff --git a/limereport/lrglobal.h b/limereport/lrglobal.h index b131207..be094a4 100644 --- a/limereport/lrglobal.h +++ b/limereport/lrglobal.h @@ -80,6 +80,13 @@ namespace Const{ QString extractClassName(QString className); enum RenderPass {FirstPass, SecondPass}; enum ArrangeType {AsNeeded, Force}; + enum PreviewHint{ShowAllPreviewBars=0, + HidePreviewToolBar=1, + HidePreviewMenuBar=2, + HidePreviewStatusBar=4, + HideAllPreviewBar=7}; + Q_DECLARE_FLAGS(PreviewHints, PreviewHint) + class ReportError : public std::runtime_error{ public: ReportError(const QString& message):std::runtime_error(message.toStdString()){} @@ -104,6 +111,6 @@ namespace Const{ } // namespace LimeReport - +Q_DECLARE_OPERATORS_FOR_FLAGS(LimeReport::PreviewHints) #endif // GLOBAL_H diff --git a/limereport/lrpreviewreportwindow.cpp b/limereport/lrpreviewreportwindow.cpp index 441b77a..53f78cb 100644 --- a/limereport/lrpreviewreportwindow.cpp +++ b/limereport/lrpreviewreportwindow.cpp @@ -136,6 +136,21 @@ void PreviewReportWindow::setErrorMessages(const QStringList &value){ m_previewReportWidget->setErrorMessages(value); } +void PreviewReportWindow::setToolBarVisible(bool value) +{ + ui->toolBar->setVisible(value); +} + +void PreviewReportWindow::setStatusBarVisible(bool value) +{ + ui->statusbar->setVisible(value); +} + +void PreviewReportWindow::setMenuVisible(bool value) +{ + ui->menubar->setVisible(value); +} + QSettings*PreviewReportWindow::settings() { if (m_settings){ @@ -312,4 +327,4 @@ void PreviewReportWindow::on_actionShowMessages_toggled(bool value) m_previewReportWidget->setErrorsMesagesVisible(value); } -}// namespace LimeReport \ No newline at end of file +}// namespace LimeReport diff --git a/limereport/lrpreviewreportwindow.h b/limereport/lrpreviewreportwindow.h index 995810c..5efacdd 100644 --- a/limereport/lrpreviewreportwindow.h +++ b/limereport/lrpreviewreportwindow.h @@ -59,6 +59,9 @@ public: void initPreview(int pagesCount); void setSettings(QSettings* value); void setErrorMessages(const QStringList& value); + void setToolBarVisible(bool value); + void setStatusBarVisible(bool value); + void setMenuVisible(bool value); QSettings* settings(); protected: void writeSetting(); diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 06fe5ab..c52eef2 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -307,7 +307,7 @@ bool ReportEnginePrivate::printToPDF(const QString &fileName) return false; } -void ReportEnginePrivate::previewReport() +void ReportEnginePrivate::previewReport(PreviewHints hints) { QTime start = QTime::currentTime(); try{ @@ -327,6 +327,11 @@ void ReportEnginePrivate::previewReport() if (!dataManager()->errorsList().isEmpty()){ w->setErrorMessages(dataManager()->errorsList()); } + + w->setMenuVisible(!hints.testFlag(HidePreviewMenuBar)); + w->setStatusBarVisible(!hints.testFlag(HidePreviewStatusBar)); + w->setToolBarVisible(!hints.testFlag(HidePreviewToolBar)); + m_activePreview = w; connect(w,SIGNAL(destroyed(QObject*)), this, SLOT(slotPreviewWindowDestroed(QObject*))); qDebug()<<"render time ="<printToPDF(fileName); } -void ReportEngine::previewReport() +void ReportEngine::previewReport(PreviewHints hints) { Q_D(ReportEngine); if (m_settings) d->setSettings(m_settings); - d->previewReport(); + d->previewReport(hints); } void ReportEngine::designReport() diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index afbbcdc..f89db86 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -71,7 +71,7 @@ public: bool printReport(QPrinter *printer=0); void printToFile(const QString& fileName); bool printToPDF(const QString& fileName); - void previewReport(); + void previewReport(PreviewHints hints = ShowAllPreviewBars); void designReport(); void setShowProgressDialog(bool value); IDataSourceManager* dataManager(); diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index e489cc9..a88e6ca 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -80,7 +80,7 @@ public: bool printReport(QPrinter *printer=0); void printToFile(const QString& fileName); bool printToPDF(const QString& fileName); - void previewReport(); + void previewReport(PreviewHints hints = ShowAllPreviewBars); void designReport(); void setSettings(QSettings* value); void setShowProgressDialog(bool value){m_showProgressDialog = value;}