From 225ee412896743da7181c6c7a4ac959cc9ffd1b6 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 6 Apr 2016 23:03:58 +0400 Subject: [PATCH] setPreviewWindowIcon, setPreviewWindowTitle added to LimeReport::ReportEngine --- include/lrreportengine.h | 2 ++ limereport/lrreportengine.cpp | 41 ++++++++++++++++++++++++++++++++--- limereport/lrreportengine.h | 2 ++ limereport/lrreportengine_p.h | 7 ++++++ 4 files changed, 49 insertions(+), 3 deletions(-) diff --git a/include/lrreportengine.h b/include/lrreportengine.h index 3506f1b..cbbfa49 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -89,6 +89,8 @@ public: void setReportName(const QString& name); QString reportName(); PreviewReportWidget *createPreviewWidget(QWidget *parent = 0); + void setPreviewWindowTitle(const QString& title); + void setPreviewWindowIcon(const QIcon& icon); signals: void renderStarted(); void renderFinished(); diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 3f34bc2..baa4e05 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -57,7 +57,8 @@ QSettings* ReportEngine::m_settings = 0; 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_showProgressDialog(true), m_reportName(""), m_activePreview(0), + m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")) { m_datasources= new DataSourceManager(this); m_datasources->setObjectName("datasources"); @@ -297,7 +298,9 @@ void ReportEnginePrivate::previewReport() w->setWindowFlags(Qt::Dialog|Qt::WindowMaximizeButtonHint|Qt::WindowCloseButtonHint| Qt::WindowMinMaxButtonsHint); w->setAttribute(Qt::WA_DeleteOnClose,true); w->setWindowModality(Qt::ApplicationModal); - w->setWindowIcon(QIcon(":/report/images/main.ico")); + //w->setWindowIcon(QIcon(":/report/images/main.ico")); + w->setWindowIcon(m_previewWindowIcon); + w->setWindowTitle(m_previewWindowTitle); w->setSettings(settings()); w->setPages(pages); if (!dataManager()->errorsList().isEmpty()){ @@ -379,7 +382,7 @@ void ReportEnginePrivate::designReport() { LimeReport::ReportDesignWindow* w = new LimeReport::ReportDesignWindow(this,QApplication::activeWindow(),settings()); w->setAttribute(Qt::WA_DeleteOnClose,true); - w->setWindowIcon(QIcon(":report/images/main")); + w->setWindowIcon(QIcon(":report/images/logo32")); w->setShowProgressDialog(m_showProgressDialog); #if defined(Q_OS_MAC) //w->showModal(); @@ -537,6 +540,26 @@ QString ReportEnginePrivate::renderToString() }else return QString(); } +QString ReportEnginePrivate::previewWindowTitle() const +{ + return m_previewWindowTitle; +} + +void ReportEnginePrivate::setPreviewWindowTitle(const QString &previewWindowTitle) +{ + m_previewWindowTitle = previewWindowTitle; +} + +QIcon ReportEnginePrivate::previewWindowIcon() const +{ + return m_previewWindowIcon; +} + +void ReportEnginePrivate::setPreviewWindowIcon(const QIcon &previewWindowIcon) +{ + m_previewWindowIcon = previewWindowIcon; +} + ReportPages ReportEnginePrivate::renderToPages() { m_reportRender = ReportRender::Ptr(new ReportRender); @@ -619,6 +642,18 @@ PreviewReportWidget* ReportEngine::createPreviewWidget(QWidget *parent) return d->createPreviewWidget(parent); } +void ReportEngine::setPreviewWindowTitle(const QString &title) +{ + Q_D(ReportEngine); + d->setPreviewWindowTitle(title); +} + +void ReportEngine::setPreviewWindowIcon(const QIcon &icon) +{ + Q_D(ReportEngine); + d->setPreviewWindowIcon(icon); +} + void ReportEngine::setShowProgressDialog(bool value) { Q_D(ReportEngine); diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index 3506f1b..cbbfa49 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -89,6 +89,8 @@ public: void setReportName(const QString& name); QString reportName(); PreviewReportWidget *createPreviewWidget(QWidget *parent = 0); + void setPreviewWindowTitle(const QString& title); + void setPreviewWindowIcon(const QIcon& icon); signals: void renderStarted(); void renderFinished(); diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index 9177639..80624e4 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -104,6 +104,11 @@ public: bool hasActivePreview(){return m_activePreview;} PageDesignIntf *createPreviewScene(QObject *parent); PreviewReportWidget *createPreviewWidget(QWidget *parent); + QIcon previewWindowIcon() const; + void setPreviewWindowIcon(const QIcon &previewWindowIcon); + QString previewWindowTitle() const; + void setPreviewWindowTitle(const QString &previewWindowTitle); + signals: void pagesLoadFinished(); void datasourceCollectionLoadFinished(const QString& collectionName); @@ -146,6 +151,8 @@ private: QString m_reportsDir; QString m_reportName; QMainWindow* m_activePreview; + QIcon m_previewWindowIcon; + QString m_previewWindowTitle; }; }