From 188ab54ee2b042dac413ae56277dd8fb4dccffbb Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 22 Mar 2017 14:42:09 +0300 Subject: [PATCH] ReportEnginePrivate has been changed to ReportEngine in PrewiewWindow and DesignerWindow --- include/lrpreviewreportwidget.h | 3 ++- include/lrreportengine.h | 4 ++++ limereport/lrpreviewreportwidget.cpp | 7 ++++--- limereport/lrpreviewreportwidget.h | 3 ++- limereport/lrpreviewreportwindow.cpp | 4 +++- limereport/lrpreviewreportwindow.h | 19 +++++++++++-------- limereport/lrreportdesignwidget.cpp | 6 +++--- limereport/lrreportdesignwidget.h | 2 +- limereport/lrreportdesignwindow.cpp | 4 ++-- limereport/lrreportdesignwindow.h | 4 ++-- limereport/lrreportengine.cpp | 9 ++++++--- limereport/lrreportengine.h | 4 ++++ 12 files changed, 44 insertions(+), 25 deletions(-) diff --git a/include/lrpreviewreportwidget.h b/include/lrpreviewreportwidget.h index 4e35ea6..e33f75f 100644 --- a/include/lrpreviewreportwidget.h +++ b/include/lrpreviewreportwidget.h @@ -12,6 +12,7 @@ class PreviewReportWidget; class PreviewReportWidgetPrivate; class ReportEnginePrivate; +class ReportEngine; class LIMEREPORT_EXPORT PreviewReportWidget : public QWidget { @@ -20,7 +21,7 @@ class LIMEREPORT_EXPORT PreviewReportWidget : public QWidget friend class PreviewReportWindow; friend class PreviewReportWidgetPrivate; public: - explicit PreviewReportWidget(ReportEnginePrivate *report, QWidget *parent = 0); + explicit PreviewReportWidget(ReportEngine *report, QWidget *parent = 0); ~PreviewReportWidget(); public slots: void refreshPages(); diff --git a/include/lrreportengine.h b/include/lrreportengine.h index 9bd87b5..cbeb76b 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -63,11 +63,15 @@ class DataSourceManager; class ReportEnginePrivate; class PageDesignIntf; class PageItemDesignIntf; +class ReportDesignWidget; +class PreviewReportWidget; typedef QList< QSharedPointer > ReportPages; class LIMEREPORT_EXPORT ReportEngine : public QObject{ Q_OBJECT + friend class ReportDesignWidget; + friend class PreviewReportWidget; public: static void setSettings(QSettings *value){m_settings=value;} public: diff --git a/limereport/lrpreviewreportwidget.cpp b/limereport/lrpreviewreportwidget.cpp index dcddb74..53f289a 100644 --- a/limereport/lrpreviewreportwidget.cpp +++ b/limereport/lrpreviewreportwidget.cpp @@ -60,14 +60,15 @@ PageItemDesignIntf::Ptr PreviewReportWidgetPrivate::currentPage() else return PageItemDesignIntf::Ptr(0); } -PreviewReportWidget::PreviewReportWidget(ReportEnginePrivate *report, QWidget *parent) : +PreviewReportWidget::PreviewReportWidget(ReportEngine *report, QWidget *parent) : QWidget(parent), ui(new Ui::PreviewReportWidget), d_ptr(new PreviewReportWidgetPrivate(this)) { ui->setupUi(this); - d_ptr->m_previewPage = report->createPreviewPage(); + d_ptr->m_report = report->d_ptr; + d_ptr->m_previewPage = d_ptr->m_report->createPreviewPage(); d_ptr->m_previewPage->setItemMode( LimeReport::PreviewMode ); - d_ptr->m_report = report; + ui->errorsView->setVisible(false); connect(ui->graphicsView->verticalScrollBar(),SIGNAL(valueChanged(int)), this, SLOT(slotSliderMoved(int))); diff --git a/limereport/lrpreviewreportwidget.h b/limereport/lrpreviewreportwidget.h index 4e35ea6..e33f75f 100644 --- a/limereport/lrpreviewreportwidget.h +++ b/limereport/lrpreviewreportwidget.h @@ -12,6 +12,7 @@ class PreviewReportWidget; class PreviewReportWidgetPrivate; class ReportEnginePrivate; +class ReportEngine; class LIMEREPORT_EXPORT PreviewReportWidget : public QWidget { @@ -20,7 +21,7 @@ class LIMEREPORT_EXPORT PreviewReportWidget : public QWidget friend class PreviewReportWindow; friend class PreviewReportWidgetPrivate; public: - explicit PreviewReportWidget(ReportEnginePrivate *report, QWidget *parent = 0); + explicit PreviewReportWidget(ReportEngine *report, QWidget *parent = 0); ~PreviewReportWidget(); public slots: void refreshPages(); diff --git a/limereport/lrpreviewreportwindow.cpp b/limereport/lrpreviewreportwindow.cpp index b000547..02ee7ad 100644 --- a/limereport/lrpreviewreportwindow.cpp +++ b/limereport/lrpreviewreportwindow.cpp @@ -34,6 +34,8 @@ #include "lrreportengine_p.h" #include "lrpreviewreportwidget.h" #include "lrpreviewreportwidget_p.h" +#include "items/editors/lrfonteditorwidget.h" +#include "items/editors/lrtextalignmenteditorwidget.h" #include #include @@ -43,7 +45,7 @@ namespace LimeReport{ -PreviewReportWindow::PreviewReportWindow(ReportEnginePrivate *report,QWidget *parent, QSettings *settings, Qt::WindowFlags flags) : +PreviewReportWindow::PreviewReportWindow(ReportEngine *report, QWidget *parent, QSettings *settings, Qt::WindowFlags flags) : QMainWindow(parent,flags), ui(new Ui::PreviewReportWindow), m_settings(settings), m_ownedSettings(false) { diff --git a/limereport/lrpreviewreportwindow.h b/limereport/lrpreviewreportwindow.h index 92b2829..e61bf76 100644 --- a/limereport/lrpreviewreportwindow.h +++ b/limereport/lrpreviewreportwindow.h @@ -34,15 +34,10 @@ #include #include #include +#include +#include -#include "lrpagedesignintf.h" -#include "lrreportrender.h" -#include "serializators/lrstorageintf.h" #include "serializators/lrxmlreader.h" -#include "lrpreviewreportwidget.h" - -#include "items/editors/lrfonteditorwidget.h" -#include "items/editors/lrtextalignmenteditorwidget.h" namespace LimeReport { @@ -50,11 +45,19 @@ namespace Ui { class PreviewReportWindow; } +class PreviewReportWidget; +class FontEditorWidget; +class TextAlignmentEditorWidget; +class ReportEngine; +class PageItemDesignIntf; +typedef QList< QSharedPointer > ReportPages; + + class PreviewReportWindow : public QMainWindow { Q_OBJECT public: - explicit PreviewReportWindow(ReportEnginePrivate *report, QWidget *parent = 0, QSettings* settings=0, Qt::WindowFlags flags=0); + explicit PreviewReportWindow(ReportEngine *report, QWidget *parent = 0, QSettings* settings=0, Qt::WindowFlags flags=0); ~PreviewReportWindow(); void setReportReader(ItemsReaderIntf::Ptr reader); void setPages(ReportPages pages); diff --git a/limereport/lrreportdesignwidget.cpp b/limereport/lrreportdesignwidget.cpp index 6a6ff0c..30c5137 100644 --- a/limereport/lrreportdesignwidget.cpp +++ b/limereport/lrreportdesignwidget.cpp @@ -48,7 +48,7 @@ namespace LimeReport { // ReportDesignIntf -ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow *mainWindow, QWidget *parent) : +ReportDesignWidget::ReportDesignWidget(ReportEngine *report, QMainWindow *mainWindow, QWidget *parent) : QWidget(parent), m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false) { m_tabWidget = new QTabWidget(this); @@ -63,7 +63,7 @@ ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow m_report->appendPage("page1"); } else { - m_report=report; + m_report=report->d_ptr; if (!m_report->pageCount()) m_report->appendPage("page1"); } @@ -74,7 +74,7 @@ ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentTabChanged(int))); //m_instance=this; - m_scriptEditor->setPlainText(report->scriptContext()->initScript()); + m_scriptEditor->setPlainText(m_report->scriptContext()->initScript()); m_zoomer = new GraphicsViewZoomer(activeView()); #ifdef Q_OS_WIN m_defaultFont = QFont("Arial",10); diff --git a/limereport/lrreportdesignwidget.h b/limereport/lrreportdesignwidget.h index 28a1998..46bfbda 100644 --- a/limereport/lrreportdesignwidget.h +++ b/limereport/lrreportdesignwidget.h @@ -150,7 +150,7 @@ protected: void createTabs(); private: bool eventFilter(QObject *target, QEvent *event); - ReportDesignWidget(ReportEnginePrivate* report,QMainWindow *mainWindow,QWidget *parent = 0); + ReportDesignWidget(ReportEngine* report,QMainWindow *mainWindow,QWidget *parent = 0); private: ReportEnginePrivate* m_report; QGraphicsView *m_view; diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index 358aa6b..82dba6a 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -62,7 +62,7 @@ namespace LimeReport{ ReportDesignWindow* ReportDesignWindow::m_instance=0; -ReportDesignWindow::ReportDesignWindow(ReportEnginePrivate *report, QWidget *parent, QSettings* settings) : +ReportDesignWindow::ReportDesignWindow(ReportEngine *report, QWidget *parent, QSettings* settings) : QMainWindow(parent), m_textAttibutesIsChanging(false), m_settings(settings), m_ownedSettings(false), m_progressDialog(0), m_showProgressDialog(true) { initReportEditor(report); @@ -437,7 +437,7 @@ void ReportDesignWindow::createMainMenu() m_recentFilesMenu->setDisabled(m_recentFiles.isEmpty()); } -void ReportDesignWindow::initReportEditor(ReportEnginePrivate* report) +void ReportDesignWindow::initReportEditor(ReportEngine* report) { m_reportDesignWidget=new ReportDesignWidget(report,this,this); setCentralWidget(m_reportDesignWidget); diff --git a/limereport/lrreportdesignwindow.h b/limereport/lrreportdesignwindow.h index 147f47f..94d5670 100644 --- a/limereport/lrreportdesignwindow.h +++ b/limereport/lrreportdesignwindow.h @@ -59,7 +59,7 @@ class ReportDesignWindow : public QMainWindow { Q_OBJECT public: - explicit ReportDesignWindow(ReportEnginePrivate* report, QWidget *parent = 0, QSettings* settings=0); + explicit ReportDesignWindow(ReportEngine *report, QWidget *parent = 0, QSettings* settings=0); ~ReportDesignWindow(); static ReportDesignWindow* instance(){return m_instance;} @@ -134,7 +134,7 @@ private: void createItemsActions(); void createObjectInspector(); void createObjectsBrowser(); - void initReportEditor(ReportEnginePrivate* report); + void initReportEditor(ReportEngine *report); void createDataWindow(); void createScriptWindow(); void updateRedoUndo(); diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 6f9c6e0..3bb60d1 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -371,7 +371,8 @@ void ReportEnginePrivate::previewReport(PreviewHints hints) ReportPages pages = renderToPages(); dataManager()->setDesignTime(true); if (pages.count()>0){ - PreviewReportWindow* w = new PreviewReportWindow(this,0,settings()); + Q_Q(ReportEngine); + PreviewReportWindow* w = new PreviewReportWindow(q,0,settings()); w->setWindowFlags(Qt::Dialog|Qt::WindowMaximizeButtonHint|Qt::WindowCloseButtonHint| Qt::WindowMinMaxButtonsHint); w->setAttribute(Qt::WA_DeleteOnClose,true); w->setWindowModality(Qt::ApplicationModal); @@ -405,7 +406,8 @@ void ReportEnginePrivate::previewReport(PreviewHints hints) PreviewReportWidget* ReportEnginePrivate::createPreviewWidget(QWidget* parent){ - PreviewReportWidget* widget = new PreviewReportWidget(this, parent); + Q_Q(ReportEngine); + PreviewReportWidget* widget = new PreviewReportWidget(q, parent); try{ dataManager()->setDesignTime(false); ReportPages pages = renderToPages(); @@ -478,7 +480,8 @@ PageDesignIntf* ReportEngine::createPreviewScene(QObject* parent){ void ReportEnginePrivate::designReport() { if (!m_designerWindow) { - m_designerWindow = new LimeReport::ReportDesignWindow(this,QApplication::activeWindow(),settings()); + Q_Q(ReportEngine); + m_designerWindow = new LimeReport::ReportDesignWindow(q,QApplication::activeWindow(),settings()); m_designerWindow->setAttribute(Qt::WA_DeleteOnClose,true); m_designerWindow->setWindowIcon(QIcon(":report/images/logo32")); m_designerWindow->setShowProgressDialog(m_showProgressDialog); diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index 9bd87b5..cbeb76b 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -63,11 +63,15 @@ class DataSourceManager; class ReportEnginePrivate; class PageDesignIntf; class PageItemDesignIntf; +class ReportDesignWidget; +class PreviewReportWidget; typedef QList< QSharedPointer > ReportPages; class LIMEREPORT_EXPORT ReportEngine : public QObject{ Q_OBJECT + friend class ReportDesignWidget; + friend class PreviewReportWidget; public: static void setSettings(QSettings *value){m_settings=value;} public: