diff --git a/.travis.yml b/.travis.yml
index 141d09c..4d1be7d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -24,3 +24,4 @@ script:
notifications:
email: false
+
diff --git a/README.md b/README.md
index 718878e..d58545a 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,5 @@
-LimeReport v1.3.10 [![Build Status](https://travis-ci.org/newsages/LimeReport.svg?branch=master)](https://travis-ci.org/newsages/LimeReport)
+LimeReport v1.3.10 [![Build Status](https://api.travis-ci.org/fralx/LimeReport.svg?branch=master)](https://travis-ci.org/fralx/LimeReport)
-----------
------------
-
-
##Features
* Multi-platform support
diff --git a/demo_r1/demo_r1.pro b/demo_r1/demo_r1.pro
index 5591daf..5b4ad00 100644
--- a/demo_r1/demo_r1.pro
+++ b/demo_r1/demo_r1.pro
@@ -1,15 +1,6 @@
include(../common.pri)
QT += core gui
-greaterThan(QT_MAJOR_VERSION, 4){
- QT += widgets printsupport
- DEFINES += HAVE_QT5
-}
-
-macx{
- CONFIG += app_bundle
-}
-
TARGET = LRDemo
TEMPLATE = app
@@ -27,8 +18,12 @@ RESOURCES += \
r1.qrc
EXTRA_DIR += $$PWD/demo_reports
-DEST_DIR = $${BUILD_DIR}/$${BUILD_TYPE}/demo
-REPORTS_DIR = $${DEST_DIR}/demo_reports
+DEST_DIR = $${BUILD_DIR}/$${BUILD_TYPE}/demo_r1
+REPORTS_DIR = $${DEST_DIR}
+
+macx{
+ CONFIG += app_bundle
+}
unix:{
LIBS += -L$${BUILD_DIR}/$${BUILD_TYPE}/lib -llimereport
@@ -36,7 +31,8 @@ unix:{
LIBS += -L$${BUILD_DIR}/$${BUILD_TYPE}/lib -lQtZint
}
DESTDIR = $$DEST_DIR
- QMAKE_POST_LINK += mkdir -p $$quote($$REPORTS_DIR) | $$QMAKE_COPY $$quote($$EXTRA_DIR)/* $$quote($$REPORTS_DIR) $$escape_expand(\n\t)
+# QMAKE_POST_LINK += mkdir -p $$quote($$REPORTS_DIR) |
+ QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR) $$quote($$REPORTS_DIR) $$escape_expand(\n\t)
linux{
#Link share lib to ../lib rpath
QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN
@@ -56,6 +52,11 @@ win32 {
DESTDIR = $$DEST_DIR
RC_FILE += mainicon.rc
- QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR) $$quote($$REPORTS_DIR) $$escape_expand(\\n\\t)
+ QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR\\*) $$quote($$REPORTS_DIR\\demo_reports) $$escape_expand(\\n\\t)
+ contains(CONFIG,zint){
+ LIBS += -L$${BUILD_DIR}/$${BUILD_TYPE}/lib -lQtZint
+ }
LIBS += -L$${BUILD_DIR}/$${BUILD_TYPE}/lib -llimereport
}
+
+
diff --git a/demo_r2/demo_r2.pro b/demo_r2/demo_r2.pro
new file mode 100644
index 0000000..c184847
--- /dev/null
+++ b/demo_r2/demo_r2.pro
@@ -0,0 +1,62 @@
+include(../common.pri)
+QT += core gui
+
+TARGET = LRDemo
+TEMPLATE = app
+
+SOURCES += main.cpp\
+ mainwindow.cpp
+
+HEADERS += mainwindow.h
+
+FORMS += mainwindow.ui
+
+INCLUDEPATH += $$PWD/../include
+DEPENDPATH += $$PWD/../include
+
+RESOURCES += \
+ demo_r2.qrc
+
+EXTRA_DIR += $$PWD/demo_reports
+DEST_DIR = $${BUILD_DIR}/$${BUILD_TYPE}/demo_r2
+REPORTS_DIR = $${DEST_DIR}
+
+macx{
+ CONFIG += app_bundle
+}
+
+unix:{
+ LIBS += -L$${BUILD_DIR}/$${BUILD_TYPE}/lib -llimereport
+ contains(CONFIG,zint){
+ LIBS += -L$${BUILD_DIR}/$${BUILD_TYPE}/lib -lQtZint
+ }
+ DESTDIR = $$DEST_DIR
+# QMAKE_POST_LINK += mkdir -p $$quote($$REPORTS_DIR) |
+ QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR) $$quote($$REPORTS_DIR) $$escape_expand(\n\t)
+linux{
+ #Link share lib to ../lib rpath
+ QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN
+ QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN/lib
+ QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN/../lib
+ QMAKE_LFLAGS_RPATH += #. .. ./libs
+}
+ target.path = $${DEST_DIR}
+ INSTALLS = target
+}
+
+win32 {
+ EXTRA_DIR ~= s,/,\\,g
+ DEST_DIR ~= s,/,\\,g
+ REPORTS_DIR ~= s,/,\\,g
+
+ DESTDIR = $$DEST_DIR
+ RC_FILE += mainicon.rc
+
+ QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR\\*) $$quote($$REPORTS_DIR\\demo_reports) $$escape_expand(\\n\\t)
+ contains(CONFIG,zint){
+ LIBS += -L$${BUILD_DIR}/$${BUILD_TYPE}/lib -lQtZint
+ }
+ LIBS += -L$${BUILD_DIR}/$${BUILD_TYPE}/lib -llimereport
+}
+
+
diff --git a/demo_r2/demo_r2.qrc b/demo_r2/demo_r2.qrc
new file mode 100644
index 0000000..efab479
--- /dev/null
+++ b/demo_r2/demo_r2.qrc
@@ -0,0 +1,21 @@
+
+
+ images/lr.png
+ images/logo.png
+ images/folder3.png
+ images/new_leaf1.png
+ images/logo1.png
+ images/design.png
+ images/PDF.png
+ images/ZoomIn.png
+ images/ZoomOut.png
+ images/First.png
+ images/Last.png
+ images/Next.png
+ images/Prev.png
+ images/Print.png
+ images/FitWidth.png
+ images/FitPage.png
+ images/OneToOne.png
+
+
diff --git a/demo_r2/demo_reports/categories.lrxml b/demo_r2/demo_reports/categories.lrxml
new file mode 100644
index 0000000..e1c3fd4
--- /dev/null
+++ b/demo_r2/demo_reports/categories.lrxml
@@ -0,0 +1,227 @@
+
+
+
diff --git a/demo_r2/demo_reports/change_item_from_script.lrxml b/demo_r2/demo_reports/change_item_from_script.lrxml
new file mode 100644
index 0000000..2e79dbc
--- /dev/null
+++ b/demo_r2/demo_reports/change_item_from_script.lrxml
@@ -0,0 +1,211 @@
+
+
+
diff --git a/demo_r2/demo_reports/demoReport1_report_header_group_subdetail.lrxml b/demo_r2/demo_reports/demoReport1_report_header_group_subdetail.lrxml
new file mode 100644
index 0000000..e036b0e
--- /dev/null
+++ b/demo_r2/demo_reports/demoReport1_report_header_group_subdetail.lrxml
@@ -0,0 +1,632 @@
+
+
+
diff --git a/demo_r2/demo_reports/northwind.db b/demo_r2/demo_reports/northwind.db
new file mode 100644
index 0000000..42a4ef6
Binary files /dev/null and b/demo_r2/demo_reports/northwind.db differ
diff --git a/demo_r2/images/First.png b/demo_r2/images/First.png
new file mode 100644
index 0000000..0c98969
Binary files /dev/null and b/demo_r2/images/First.png differ
diff --git a/demo_r2/images/FitPage.png b/demo_r2/images/FitPage.png
new file mode 100644
index 0000000..c79ca9d
Binary files /dev/null and b/demo_r2/images/FitPage.png differ
diff --git a/demo_r2/images/FitWidth.png b/demo_r2/images/FitWidth.png
new file mode 100644
index 0000000..899f3d1
Binary files /dev/null and b/demo_r2/images/FitWidth.png differ
diff --git a/demo_r2/images/Last.png b/demo_r2/images/Last.png
new file mode 100644
index 0000000..c705017
Binary files /dev/null and b/demo_r2/images/Last.png differ
diff --git a/demo_r2/images/Next.png b/demo_r2/images/Next.png
new file mode 100644
index 0000000..3b2dd70
Binary files /dev/null and b/demo_r2/images/Next.png differ
diff --git a/demo_r2/images/OneToOne.png b/demo_r2/images/OneToOne.png
new file mode 100644
index 0000000..4b7184b
Binary files /dev/null and b/demo_r2/images/OneToOne.png differ
diff --git a/demo_r2/images/PDF.png b/demo_r2/images/PDF.png
new file mode 100644
index 0000000..6e68818
Binary files /dev/null and b/demo_r2/images/PDF.png differ
diff --git a/demo_r2/images/Prev.png b/demo_r2/images/Prev.png
new file mode 100644
index 0000000..8912f07
Binary files /dev/null and b/demo_r2/images/Prev.png differ
diff --git a/demo_r2/images/Print.png b/demo_r2/images/Print.png
new file mode 100644
index 0000000..8ce4960
Binary files /dev/null and b/demo_r2/images/Print.png differ
diff --git a/demo_r2/images/ZoomIn.png b/demo_r2/images/ZoomIn.png
new file mode 100644
index 0000000..ecbff88
Binary files /dev/null and b/demo_r2/images/ZoomIn.png differ
diff --git a/demo_r2/images/ZoomOut.png b/demo_r2/images/ZoomOut.png
new file mode 100644
index 0000000..da1e2ef
Binary files /dev/null and b/demo_r2/images/ZoomOut.png differ
diff --git a/demo_r2/images/design.png b/demo_r2/images/design.png
new file mode 100644
index 0000000..24e41bb
Binary files /dev/null and b/demo_r2/images/design.png differ
diff --git a/demo_r2/images/folder3.png b/demo_r2/images/folder3.png
new file mode 100644
index 0000000..d857735
Binary files /dev/null and b/demo_r2/images/folder3.png differ
diff --git a/demo_r2/images/logo.png b/demo_r2/images/logo.png
new file mode 100644
index 0000000..a466bbb
Binary files /dev/null and b/demo_r2/images/logo.png differ
diff --git a/demo_r2/images/logo1.png b/demo_r2/images/logo1.png
new file mode 100644
index 0000000..29f3370
Binary files /dev/null and b/demo_r2/images/logo1.png differ
diff --git a/demo_r2/images/lr.png b/demo_r2/images/lr.png
new file mode 100644
index 0000000..2206744
Binary files /dev/null and b/demo_r2/images/lr.png differ
diff --git a/demo_r2/images/new_leaf1.png b/demo_r2/images/new_leaf1.png
new file mode 100644
index 0000000..d89f8d3
Binary files /dev/null and b/demo_r2/images/new_leaf1.png differ
diff --git a/demo_r2/main.cpp b/demo_r2/main.cpp
new file mode 100644
index 0000000..b48f94e
--- /dev/null
+++ b/demo_r2/main.cpp
@@ -0,0 +1,11 @@
+#include "mainwindow.h"
+#include
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ MainWindow w;
+ w.show();
+
+ return a.exec();
+}
diff --git a/demo_r2/main.ico b/demo_r2/main.ico
new file mode 100644
index 0000000..6bd0818
Binary files /dev/null and b/demo_r2/main.ico differ
diff --git a/demo_r2/mainicon.rc b/demo_r2/mainicon.rc
new file mode 100644
index 0000000..83c0128
--- /dev/null
+++ b/demo_r2/mainicon.rc
@@ -0,0 +1 @@
+DI_ICON1 ICON "main.ico"
diff --git a/demo_r2/mainwindow.cpp b/demo_r2/mainwindow.cpp
new file mode 100644
index 0000000..45e4b84
--- /dev/null
+++ b/demo_r2/mainwindow.cpp
@@ -0,0 +1,123 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+#include
+#include
+#include
+#include
+
+MainWindow::MainWindow(QWidget *parent) :
+ QMainWindow(parent),
+ ui(new Ui::MainWindow)
+{
+ ui->setupUi(this);
+ m_preview = m_report.createPreviewWidget();
+ connect(m_preview,SIGNAL(scalePercentChanged(int)), this, SLOT(slotScalePercentChanged(int)));
+ ui->groupBox_2->layout()->addWidget(m_preview);
+ buildReportsTree(QApplication::applicationDirPath()+"/demo_reports/", ui->treeWidget);
+ connect(ui->tbZoomIn, SIGNAL(clicked(bool)), m_preview, SLOT(zoomIn()));
+ connect(ui->tbZoomOut, SIGNAL(clicked(bool)), m_preview, SLOT(zoomOut()));
+ connect(ui->tbFirstPage, SIGNAL(clicked(bool)), m_preview, SLOT(firstPage()));
+ connect(ui->tbPrevPage, SIGNAL(clicked(bool)), m_preview, SLOT(priorPage()));
+ connect(ui->tbNextPage, SIGNAL(clicked(bool)), m_preview, SLOT(nextPage()));
+ connect(ui->tbLastPage, SIGNAL(clicked(bool)), m_preview, SLOT(lastPage()));
+ connect(ui->cbScalePercent, SIGNAL(currentIndexChanged(QString)), this, SLOT(scaleComboboxChanged(QString)));
+ connect(ui->tbFitWidth, SIGNAL(clicked(bool)), m_preview, SLOT(fitWidth()));
+ connect(ui->tbFitPage, SIGNAL(clicked(bool)), m_preview, SLOT(fitPage()));
+ connect(m_preview, SIGNAL(pagesSet(int)), this, SLOT(slotPagesSet(int)));
+ connect(m_preview, SIGNAL(pageChanged(int)), this, SLOT(slotPageChanged(int)));
+ connect(ui->tbPDFExport, SIGNAL(clicked(bool)), m_preview, SLOT(printToPDF()));
+ connect(ui->tbPrint, SIGNAL(clicked(bool)), m_preview, SLOT(print()));
+ initPercentCombobox();
+ enableUI(false);
+ QDesktopWidget *desktop = QApplication::desktop();
+
+ int screenWidth = desktop->screenGeometry().width();
+ int screenHeight = desktop->screenGeometry().height();
+
+ int x = screenWidth*0.1;
+ int y = screenHeight*0.1;
+
+ resize(screenWidth*0.8, screenHeight*0.8);
+ move(x, y);
+ if (QFile::exists(QApplication::applicationDirPath()+"/demo_reports/categories.lrxml")){
+ m_report.loadFromFile(QApplication::applicationDirPath()+"/demo_reports/categories.lrxml");
+ m_preview->refreshPages();
+ }
+}
+
+MainWindow::~MainWindow()
+{
+ delete ui;
+}
+
+void MainWindow::enableUI(bool value)
+{
+ ui->tbDesign->setEnabled(value);
+ ui->tbPrint->setEnabled(value);
+ ui->tbPDFExport->setEnabled(value);
+ ui->tbFirstPage->setEnabled(value);
+ ui->tbPrevPage->setEnabled(value);
+ ui->tbNextPage->setEnabled(value);
+ ui->tbLastPage->setEnabled(value);
+ ui->tbZoomIn->setEnabled(value);
+ ui->tbZoomOut->setEnabled(value);
+ ui->tbFitWidth->setEnabled(value);
+ ui->tbFitPage->setEnabled(value);
+ ui->tbOneToOne->setEnabled(value);
+ ui->sbPageNavigator->setEnabled(value);
+ ui->cbScalePercent->setEnabled(value);
+}
+
+void MainWindow::slotScalePercentChanged(int percent)
+{
+ ui->cbScalePercent->setCurrentText(QString("%1%").arg(percent));
+}
+
+void MainWindow::scaleComboboxChanged(QString text)
+{
+ m_preview->setScalePercent(text.remove(text.count()-1,1).toInt());
+}
+
+void MainWindow::slotPagesSet(int pagesCount)
+{
+ ui->sbPageNavigator->setSuffix(tr(" of %1").arg(pagesCount));
+ ui->sbPageNavigator->setMinimum(1);
+ ui->sbPageNavigator->setMaximum(pagesCount);
+ ui->sbPageNavigator->setValue(1);
+ enableUI(true);
+}
+
+void MainWindow::slotPageChanged(int page)
+{
+ ui->sbPageNavigator->setValue(page);
+}
+
+void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, int )
+{
+ m_report.loadFromFile(item->data(0,Qt::UserRole).toString());
+ m_preview->refreshPages();
+}
+
+void MainWindow::initPercentCombobox()
+{
+ for (int i = 10; i<310; i+=10){
+ ui->cbScalePercent->addItem(QString("%1%").arg(i));
+ }
+ ui->cbScalePercent->setCurrentIndex(4);
+}
+
+void MainWindow::on_sbPageNavigator_valueChanged(int arg1)
+{
+ m_preview->pageNavigatorChanged(arg1);
+}
+
+void MainWindow::on_tbDesign_clicked()
+{
+ m_report.designReport();
+ m_preview->refreshPages();
+}
+
+void MainWindow::on_tbOneToOne_clicked()
+{
+ m_preview->setScalePercent(100);
+}
diff --git a/demo_r2/mainwindow.h b/demo_r2/mainwindow.h
new file mode 100644
index 0000000..5d9d176
--- /dev/null
+++ b/demo_r2/mainwindow.h
@@ -0,0 +1,61 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include
+#include
+#include
+#include
+#include
+
+namespace Ui {
+class MainWindow;
+}
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ explicit MainWindow(QWidget *parent = 0);
+ ~MainWindow();
+private:
+ void enableUI(bool value);
+private slots:
+ void slotScalePercentChanged(int percent);
+ void scaleComboboxChanged(QString text);
+ void slotPagesSet(int pagesCount);
+ void slotPageChanged(int page);
+ void on_treeWidget_itemClicked(QTreeWidgetItem *item, int);
+ void on_sbPageNavigator_valueChanged(int arg1);
+ void on_tbDesign_clicked();
+ void on_tbOneToOne_clicked();
+private:
+ template< typename T >
+ void buildReportsTree(const QString &path, T* parentItem)
+ {
+ QDir reportsDir(path);
+ QStringList items = reportsDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
+ foreach( QString dir, items){
+ QTreeWidgetItem* listItem = new QTreeWidgetItem(parentItem);
+ listItem->setText(0,dir);
+ listItem->setIcon(0,QIcon(":/images/images/folder.png"));
+ buildReportsTree(reportsDir.path()+"/"+dir, listItem);
+ }
+ QStringList nameFilters;
+ nameFilters <<"*.lrxml";
+ items = reportsDir.entryList(nameFilters, QDir::Files);
+ foreach( QString file, items){
+ QTreeWidgetItem* listItem = new QTreeWidgetItem(parentItem);
+ listItem->setIcon(0,QIcon(":/images/images/report.png"));
+ listItem->setText(0,file);
+ listItem->setData(0,Qt::UserRole,reportsDir.path()+"/"+file);
+ }
+ }
+ void initPercentCombobox();
+private:
+ Ui::MainWindow *ui;
+ LimeReport::ReportEngine m_report;
+ LimeReport::PreviewReportWidget* m_preview;
+};
+
+#endif // MAINWINDOW_H
diff --git a/demo_r2/mainwindow.ui b/demo_r2/mainwindow.ui
new file mode 100644
index 0000000..84ccfc8
--- /dev/null
+++ b/demo_r2/mainwindow.ui
@@ -0,0 +1,587 @@
+
+
+ MainWindow
+
+
+
+ 0
+ 0
+ 1157
+ 554
+
+
+
+ Lime Report Demo
+
+
+
+ :/images/images/logo1.png:/images/images/logo1.png
+
+
+
+ -
+
+
-
+
+
-
+
+
+
+ 75
+ true
+
+
+
+ Reports
+
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 200
+ 16777215
+
+
+
+
+ 50
+ false
+
+
+
+ false
+
+
+ false
+
+
+
+ 1
+
+
+
+
+
+
+
+ -
+
+
+ 7
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 50
+ 59
+
+
+
+
+
+
+ :/images/images/logo1.png
+
+
+ true
+
+
+
+ -
+
+
+ 1
+
+
+ 5
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+
+
+
+
+
+ 127
+ 170
+ 24
+
+
+
+
+
+
+ 0
+ 189
+ 0
+
+
+
+
+
+
+
+
+ 127
+ 170
+ 24
+
+
+
+
+
+
+ 0
+ 189
+ 0
+
+
+
+
+
+
+
+
+ 190
+ 190
+ 190
+
+
+
+
+
+
+ 190
+ 190
+ 190
+
+
+
+
+
+
+
+
+ 14
+ 75
+ true
+
+
+
+ Lime Report
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 14
+ 75
+ true
+
+
+
+ DEMO
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+ 75
+ true
+
+
+
+ Preview
+
+
+
+ 4
+
+
-
+
+
+ 2
+
+
-
+
+
+
+ 6
+
+
+
+ ...
+
+
+
+ :/images/images/design.png:/images/images/design.png
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+
+ -
+
+
+ QFrame::VLine
+
+
+ QFrame::Sunken
+
+
+
+
+
+
+ -
+
+
+ ...
+
+
+
+ :/images/images/Print.png:/images/images/Print.png
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+
+ -
+
+
+ ...
+
+
+
+ :/images/images/PDF.png:/images/images/PDF.png
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+
+ -
+
+
+ QFrame::VLine
+
+
+ QFrame::Sunken
+
+
+
+
+
+
+ -
+
+
+ ...
+
+
+
+ :/images/images/ZoomIn.png:/images/images/ZoomIn.png
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+
+ -
+
+
+ ...
+
+
+
+ :/images/images/ZoomOut.png:/images/images/ZoomOut.png
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+
+ -
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ ...
+
+
+
+ :/images/images/OneToOne.png:/images/images/OneToOne.png
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+
+ -
+
+
+ ...
+
+
+
+ :/images/images/FitWidth.png:/images/images/FitWidth.png
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+
+ -
+
+
+ ...
+
+
+
+ :/images/images/FitPage.png:/images/images/FitPage.png
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+
+ -
+
+
+ QFrame::VLine
+
+
+ QFrame::Sunken
+
+
+
+
+
+
+ -
+
+
+ ...
+
+
+
+ :/images/images/First.png:/images/images/First.png
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+
+ -
+
+
+ ...
+
+
+
+ :/images/images/Prev.png:/images/images/Prev.png
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+
+ -
+
+
+ Page:
+
+
+ 10000000
+
+
+
+ -
+
+
+ ...
+
+
+
+ :/images/images/Next.png:/images/images/Next.png
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+
+ -
+
+
+ ...
+
+
+
+ :/images/images/Last.png:/images/images/Last.png
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/UserManualEn.pdf b/docs/UserManualEn.pdf
new file mode 100644
index 0000000..623eb32
Binary files /dev/null and b/docs/UserManualEn.pdf differ
diff --git a/docs/UserManualRu.pdf b/docs/UserManualRu.pdf
new file mode 100644
index 0000000..9d3e4b0
Binary files /dev/null and b/docs/UserManualRu.pdf differ
diff --git a/include/lrpreviewreportwidget.h b/include/lrpreviewreportwidget.h
index 220843b..d9cde20 100644
--- a/include/lrpreviewreportwidget.h
+++ b/include/lrpreviewreportwidget.h
@@ -24,20 +24,25 @@ public:
~PreviewReportWidget();
public slots:
void refreshPages();
- void slotZoomIn();
- void slotZoomOut();
+ void zoomIn();
+ void zoomOut();
- void slotFirstPage();
- void slotPriorPage();
- void slotNextPage();
- void slotLastPage();
+ void firstPage();
+ void priorPage();
+ void nextPage();
+ void lastPage();
- void slotPrint();
- void slotPrintToPDF();
- void slotPageNavigatorChanged(int value);
- void slotSaveToFile();
+ void print();
+ void printToPDF();
+ void pageNavigatorChanged(int value);
+ void saveToFile();
+ void setScalePercent(int percent);
+ void fitWidth();
+ void fitPage();
signals:
void pageChanged(int page);
+ void scalePercentChanged(int percent);
+ void pagesSet(int pageCount);
private slots:
void slotSliderMoved(int value);
void reportEngineDestroyed(QObject* object);
@@ -45,6 +50,7 @@ private:
void initPreview();
void setErrorsMesagesVisible(bool visible);
void setErrorMessages(const QStringList &value);
+ void emitPageSet();
private:
Ui::PreviewReportWidget *ui;
PreviewReportWidgetPrivate* d_ptr;
diff --git a/limereport.pro b/limereport.pro
index 9ec2517..2b46b10 100644
--- a/limereport.pro
+++ b/limereport.pro
@@ -9,7 +9,7 @@ SUBDIRS += \
CONFIG += ordered
-SUBDIRS += demo_r1
+SUBDIRS += demo_r1 demo_r2
diff --git a/limereport/images/FitPage.png b/limereport/images/FitPage.png
new file mode 100644
index 0000000..a630918
Binary files /dev/null and b/limereport/images/FitPage.png differ
diff --git a/limereport/images/FitWidth.png b/limereport/images/FitWidth.png
new file mode 100644
index 0000000..af2fed9
Binary files /dev/null and b/limereport/images/FitWidth.png differ
diff --git a/limereport/images/OneToOne.png b/limereport/images/OneToOne.png
new file mode 100644
index 0000000..0858cdf
Binary files /dev/null and b/limereport/images/OneToOne.png differ
diff --git a/limereport/limereport.pro b/limereport/limereport.pro
index 309a17a..341a3b4 100644
--- a/limereport/limereport.pro
+++ b/limereport/limereport.pro
@@ -32,7 +32,6 @@ unix:{
for(FILE,EXTRA_FILES){
QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($${DEST_INCLUDE_DIR}) $$escape_expand(\\n\\t) # inside of libs make /include/files
}
-
}
macx{
for(FILE,EXTRA_FILES){
@@ -40,21 +39,21 @@ unix:{
}
QMAKE_POST_LINK += mkdir -p $$quote($${DESTDIR}/include) $$escape_expand(\\n\\t)
}
- QMAKE_POST_LINK += $(COPY_DIR) $$quote($${DEST_INCLUDE_DIR}*) $$quote($${DESTDIR}/include)
+ QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($${DEST_INCLUDE_DIR}) $$quote($${DESTDIR})
}
win32 {
EXTRA_FILES ~= s,/,\\,g
BUILD_DIR ~= s,/,\\,g
DESTDIR = $${BUILD_DIR}/$${BUILD_TYPE}/lib
- DEST_DIR = $$DESTDIR/include/
+ DEST_DIR = $$DESTDIR/include
DEST_DIR ~= s,/,\\,g
DEST_INCLUDE_DIR ~= s,/,\\,g
for(FILE,EXTRA_FILES){
QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($${DEST_INCLUDE_DIR}) $$escape_expand(\\n\\t)
}
- QMAKE_POST_LINK += $(COPY_DIR) $$quote($${DEST_INCLUDE_DIR}*) $$quote($${DEST_DIR})
+ QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($${DEST_INCLUDE_DIR}\\*) $$quote($${DEST_DIR})
}
contains(CONFIG,zint){
diff --git a/limereport/lrpreviewreportwidget.cpp b/limereport/lrpreviewreportwidget.cpp
index 7becc8d..47b3fb9 100644
--- a/limereport/lrpreviewreportwidget.cpp
+++ b/limereport/lrpreviewreportwidget.cpp
@@ -46,9 +46,17 @@ void PreviewReportWidgetPrivate::setPages(ReportPages pages)
if (pages.at(0)) pages.at(0)->setSelected(true);
m_changingPage = false;
q_ptr->initPreview();
+ q_ptr->emitPageSet();
}
}
+PageItemDesignIntf::Ptr PreviewReportWidgetPrivate::currentPage()
+{
+ if (m_reportPages.count()>m_currentPage)
+ return m_reportPages.at(m_currentPage-1);
+ else return PageItemDesignIntf::Ptr(0);
+}
+
PreviewReportWidget::PreviewReportWidget(ReportEnginePrivate *report, QWidget *parent) :
QWidget(parent),
ui(new Ui::PreviewReportWidget), d_ptr(new PreviewReportWidgetPrivate(this))
@@ -75,9 +83,11 @@ PreviewReportWidget::~PreviewReportWidget()
void PreviewReportWidget::initPreview()
{
- ui->graphicsView->setScene(d_ptr->m_previewPage);
+ if (ui->graphicsView->scene()!=d_ptr->m_previewPage)
+ ui->graphicsView->setScene(d_ptr->m_previewPage);
+ ui->graphicsView->resetMatrix();
ui->graphicsView->centerOn(0, 0);
- ui->graphicsView->scale(0.5,0.5);
+ setScalePercent(d_ptr->m_scalePercent);
}
void PreviewReportWidget::setErrorsMesagesVisible(bool visible)
@@ -85,17 +95,20 @@ void PreviewReportWidget::setErrorsMesagesVisible(bool visible)
ui->errorsView->setVisible(visible);
}
-void PreviewReportWidget::slotZoomIn()
+void PreviewReportWidget::zoomIn()
{
- ui->graphicsView->scale(1.2,1.2);
+ d_ptr->m_scalePercent += 10;
+ setScalePercent(d_ptr->m_scalePercent);
}
-void PreviewReportWidget::slotZoomOut()
+void PreviewReportWidget::zoomOut()
{
- ui->graphicsView->scale(1/1.2,1/1.2);
+ if (d_ptr->m_scalePercent>0)
+ d_ptr->m_scalePercent -= 10;
+ setScalePercent(d_ptr->m_scalePercent);
}
-void PreviewReportWidget::slotFirstPage()
+void PreviewReportWidget::firstPage()
{
d_ptr->m_changingPage=true;
if ((!d_ptr->m_reportPages.isEmpty())&&(d_ptr->m_currentPage>1)){
@@ -106,7 +119,7 @@ void PreviewReportWidget::slotFirstPage()
d_ptr->m_changingPage=false;
}
-void PreviewReportWidget::slotPriorPage()
+void PreviewReportWidget::priorPage()
{
d_ptr->m_changingPage=true;
if ((!d_ptr->m_reportPages.isEmpty())&&(d_ptr->m_currentPage>1)){
@@ -117,7 +130,7 @@ void PreviewReportWidget::slotPriorPage()
d_ptr->m_changingPage=false;
}
-void PreviewReportWidget::slotNextPage()
+void PreviewReportWidget::nextPage()
{
d_ptr->m_changingPage=true;
if ((!d_ptr->m_reportPages.isEmpty())&&(d_ptr->m_reportPages.count()>(d_ptr->m_currentPage))){
@@ -128,7 +141,7 @@ void PreviewReportWidget::slotNextPage()
d_ptr->m_changingPage=false;
}
-void PreviewReportWidget::slotLastPage()
+void PreviewReportWidget::lastPage()
{
d_ptr->m_changingPage=true;
if ((!d_ptr->m_reportPages.isEmpty())&&(d_ptr->m_reportPages.count()>(d_ptr->m_currentPage))){
@@ -139,7 +152,7 @@ void PreviewReportWidget::slotLastPage()
d_ptr->m_changingPage=false;
}
-void PreviewReportWidget::slotPrint()
+void PreviewReportWidget::print()
{
QPrinter printer(QPrinter::HighResolution);
QPrintDialog dialog(&printer,QApplication::activeWindow());
@@ -150,10 +163,13 @@ void PreviewReportWidget::slotPrint()
printer,
PrintRange(dialog.printRange(),dialog.fromPage(),dialog.toPage())
);
+ foreach(PageItemDesignIntf::Ptr pageItem, d_ptr->m_reportPages){
+ d_ptr->m_previewPage->reactivatePageItem(pageItem);
+ }
}
}
-void PreviewReportWidget::slotPrintToPDF()
+void PreviewReportWidget::printToPDF()
{
QString fileName = QFileDialog::getSaveFileName(this,tr("PDF file name"),"","PDF(*.pdf)" );
if (!fileName.isEmpty()){
@@ -169,7 +185,7 @@ void PreviewReportWidget::slotPrintToPDF()
}
}
-void PreviewReportWidget::slotPageNavigatorChanged(int value)
+void PreviewReportWidget::pageNavigatorChanged(int value)
{
if (d_ptr->m_changingPage) return;
d_ptr->m_changingPage = true;
@@ -180,7 +196,7 @@ void PreviewReportWidget::slotPageNavigatorChanged(int value)
d_ptr->m_changingPage=false;
}
-void PreviewReportWidget::slotSaveToFile()
+void PreviewReportWidget::saveToFile()
{
QString fileName = QFileDialog::getSaveFileName(this,tr("Report file name"));
if (!fileName.isEmpty()){
@@ -192,6 +208,32 @@ void PreviewReportWidget::slotSaveToFile()
}
}
+void PreviewReportWidget::setScalePercent(int percent)
+{
+ ui->graphicsView->resetMatrix();
+ d_ptr->m_scalePercent = percent;
+ qreal scaleSize = percent/100.0;
+ ui->graphicsView->scale(scaleSize, scaleSize);
+ emit scalePercentChanged(percent);
+}
+
+void PreviewReportWidget::fitWidth()
+{
+ if (d_ptr->currentPage()){
+ qreal scalePercent = ui->graphicsView->viewport()->width() / ui->graphicsView->scene()->width();
+ setScalePercent(scalePercent*100);
+ }
+}
+
+void PreviewReportWidget::fitPage()
+{
+ if (d_ptr->currentPage()){
+ qreal vScale = ui->graphicsView->viewport()->width() / ui->graphicsView->scene()->width();
+ qreal hScale = ui->graphicsView->viewport()->height() / d_ptr->currentPage()->height();
+ setScalePercent(qMin(vScale,hScale)*100);
+ }
+}
+
void PreviewReportWidget::setErrorMessages(const QStringList &value)
{
foreach (QString line, value) {
@@ -199,6 +241,11 @@ void PreviewReportWidget::setErrorMessages(const QStringList &value)
}
}
+void PreviewReportWidget::emitPageSet()
+{
+ emit pagesSet(d_ptr->m_reportPages.count());
+}
+
void PreviewReportWidget::refreshPages()
{
if (d_ptr->m_report){
@@ -207,15 +254,7 @@ void PreviewReportWidget::refreshPages()
ReportPages pages = d_ptr->m_report->renderToPages();
d_ptr->m_report->dataManager()->setDesignTime(true);
if (pages.count()>0){
- d_ptr->m_reportPages = pages;
- if (!d_ptr->m_reportPages.isEmpty()){
- d_ptr->m_previewPage->setPageItems(d_ptr->m_reportPages);
- d_ptr->m_changingPage = true;
- d_ptr->m_currentPage = 1;
- if (pages.at(0)) pages.at(0)->setSelected(true);
- d_ptr->m_changingPage = false;
- }
- ui->graphicsView->centerOn(0, 0);
+ d_ptr->setPages(pages);
}
} catch (ReportError &exception){
d_ptr->m_report->saveError(exception.what());
diff --git a/limereport/lrpreviewreportwidget.h b/limereport/lrpreviewreportwidget.h
index 220843b..d9cde20 100644
--- a/limereport/lrpreviewreportwidget.h
+++ b/limereport/lrpreviewreportwidget.h
@@ -24,20 +24,25 @@ public:
~PreviewReportWidget();
public slots:
void refreshPages();
- void slotZoomIn();
- void slotZoomOut();
+ void zoomIn();
+ void zoomOut();
- void slotFirstPage();
- void slotPriorPage();
- void slotNextPage();
- void slotLastPage();
+ void firstPage();
+ void priorPage();
+ void nextPage();
+ void lastPage();
- void slotPrint();
- void slotPrintToPDF();
- void slotPageNavigatorChanged(int value);
- void slotSaveToFile();
+ void print();
+ void printToPDF();
+ void pageNavigatorChanged(int value);
+ void saveToFile();
+ void setScalePercent(int percent);
+ void fitWidth();
+ void fitPage();
signals:
void pageChanged(int page);
+ void scalePercentChanged(int percent);
+ void pagesSet(int pageCount);
private slots:
void slotSliderMoved(int value);
void reportEngineDestroyed(QObject* object);
@@ -45,6 +50,7 @@ private:
void initPreview();
void setErrorsMesagesVisible(bool visible);
void setErrorMessages(const QStringList &value);
+ void emitPageSet();
private:
Ui::PreviewReportWidget *ui;
PreviewReportWidgetPrivate* d_ptr;
diff --git a/limereport/lrpreviewreportwidget_p.h b/limereport/lrpreviewreportwidget_p.h
index 6d2a8b9..695b605 100644
--- a/limereport/lrpreviewreportwidget_p.h
+++ b/limereport/lrpreviewreportwidget_p.h
@@ -12,11 +12,13 @@ class PreviewReportWidget;
class PreviewReportWidgetPrivate
{
public:
- PreviewReportWidgetPrivate(PreviewReportWidget* previewReportWidget): q_ptr(previewReportWidget),
- m_currentPage(1), m_changingPage(false), m_priorScrolValue(0){}
+ PreviewReportWidgetPrivate(PreviewReportWidget* previewReportWidget):
+ m_currentPage(1), m_changingPage(false), m_priorScrolValue(0), m_scalePercent(50),
+ q_ptr(previewReportWidget) {}
bool pageIsVisible();
QRectF calcPageShift();
void setPages( ReportPages pages);
+ PageItemDesignIntf::Ptr currentPage();
public:
PageDesignIntf* m_previewPage;
ReportPages m_reportPages;
@@ -25,6 +27,7 @@ public:
int m_currentPage;
bool m_changingPage;
int m_priorScrolValue;
+ int m_scalePercent;
PreviewReportWidget* q_ptr;
};
diff --git a/limereport/lrpreviewreportwindow.cpp b/limereport/lrpreviewreportwindow.cpp
index b4ec3ac..c0b33fc 100644
--- a/limereport/lrpreviewreportwindow.cpp
+++ b/limereport/lrpreviewreportwindow.cpp
@@ -61,6 +61,13 @@ PreviewReportWindow::PreviewReportWindow(ReportEnginePrivate *report,QWidget *pa
setCentralWidget(m_previewReportWidget);
layout()->setContentsMargins(1,1,1,1);
connect(m_previewReportWidget,SIGNAL(pageChanged(int)), this,SLOT(slotPageChanged(int)) );
+
+
+ m_scalePercent = new QComboBox(this);
+ ui->toolBar->insertWidget(ui->actionZoomOut, m_scalePercent);
+ initPercentCombobox();
+ connect(m_previewReportWidget, SIGNAL(scalePercentChanged(int)), this, SLOT(slotScalePercentChanged(int)));
+ connect(m_scalePercent, SIGNAL(currentIndexChanged(QString)), this, SLOT(scaleComboboxChanged(QString)));
restoreSetting();
}
@@ -203,32 +210,32 @@ void PreviewReportWindow::moveEvent(QMoveEvent* e)
void PreviewReportWindow::slotPrint()
{
- m_previewReportWidget->slotPrint();
+ m_previewReportWidget->print();
}
void PreviewReportWindow::slotPriorPage()
{
- m_previewReportWidget->slotPriorPage();
+ m_previewReportWidget->priorPage();
}
void PreviewReportWindow::slotNextPage()
{
- m_previewReportWidget->slotNextPage();
+ m_previewReportWidget->nextPage();
}
void PreviewReportWindow::slotZoomIn()
{
- m_previewReportWidget->slotZoomIn();
+ m_previewReportWidget->zoomIn();
}
void PreviewReportWindow::slotZoomOut()
{
- m_previewReportWidget->slotZoomOut();
+ m_previewReportWidget->zoomOut();
}
void PreviewReportWindow::slotPageNavigatorChanged(int value)
{
- m_previewReportWidget->slotPageNavigatorChanged(value);
+ m_previewReportWidget->pageNavigatorChanged(value);
}
void PreviewReportWindow::slotShowErrors()
@@ -241,24 +248,32 @@ ItemsReaderIntf *PreviewReportWindow::reader()
return m_reader.data();
}
+void PreviewReportWindow::initPercentCombobox()
+{
+ for (int i = 10; i<310; i+=10){
+ m_scalePercent->addItem(QString("%1%").arg(i));
+ }
+ m_scalePercent->setCurrentIndex(4);
+}
+
void PreviewReportWindow::on_actionSaveToFile_triggered()
{
- m_previewReportWidget->slotSaveToFile();
+ m_previewReportWidget->saveToFile();
}
void PreviewReportWindow::slotFirstPage()
{
- m_previewReportWidget->slotFirstPage();
+ m_previewReportWidget->firstPage();
}
void PreviewReportWindow::slotLastPage()
{
- m_previewReportWidget->slotLastPage();
+ m_previewReportWidget->lastPage();
}
void PreviewReportWindow::slotPrintToPDF()
{
- m_previewReportWidget->slotPrintToPDF();
+ m_previewReportWidget->printToPDF();
}
void PreviewReportWindow::slotPageChanged(int pageIndex)
@@ -266,4 +281,35 @@ void PreviewReportWindow::slotPageChanged(int pageIndex)
m_pagesNavigator->setValue(pageIndex);
}
+void PreviewReportWindow::on_actionFit_page_width_triggered()
+{
+ m_previewReportWidget->fitWidth();
+}
+
+void PreviewReportWindow::on_actionFit_page_triggered()
+{
+ m_previewReportWidget->fitPage();
+}
+
+void PreviewReportWindow::on_actionOne_to_one_triggered()
+{
+ m_previewReportWidget->setScalePercent(100);
+}
+
+void PreviewReportWindow::scaleComboboxChanged(QString text)
+{
+ m_previewReportWidget->setScalePercent(text.remove(text.count()-1,1).toInt());
+}
+
+void PreviewReportWindow::slotScalePercentChanged(int percent)
+{
+ m_scalePercent->setCurrentText(QString("%1%").arg(percent));
+}
+
}// namespace LimeReport
+
+
+
+
+
+
diff --git a/limereport/lrpreviewreportwindow.h b/limereport/lrpreviewreportwindow.h
index c23d5dc..6a68f82 100644
--- a/limereport/lrpreviewreportwindow.h
+++ b/limereport/lrpreviewreportwindow.h
@@ -33,6 +33,7 @@
#include
#include
#include
+#include
#include "lrpagedesignintf.h"
#include "lrreportrender.h"
@@ -78,8 +79,15 @@ public slots:
void slotLastPage();
void slotPrintToPDF();
void slotPageChanged(int pageIndex);
+private slots:
+ void on_actionFit_page_width_triggered();
+ void on_actionFit_page_triggered();
+ void on_actionOne_to_one_triggered();
+ void scaleComboboxChanged(QString text);
+ void slotScalePercentChanged(int percent);
private:
ItemsReaderIntf* reader();
+ void initPercentCombobox();
//bool pageIsVisible(PageItemDesignIntf::Ptr page);
//QRectF calcPageShift(PageItemDesignIntf::Ptr page);
private:
@@ -91,6 +99,7 @@ private:
QSettings* m_settings;
bool m_ownedSettings;
PreviewReportWidget* m_previewReportWidget;
+ QComboBox* m_scalePercent;
};
} //namespace LimeReport
#endif // LRPREVIEWREPORTWINDOW_H
diff --git a/limereport/lrpreviewreportwindow.ui b/limereport/lrpreviewreportwindow.ui
index a7c2170..7618999 100644
--- a/limereport/lrpreviewreportwindow.ui
+++ b/limereport/lrpreviewreportwindow.ui
@@ -77,6 +77,9 @@
+
+
+
@@ -224,10 +227,37 @@
Print To PDF
+
+
+
+ :/report/images/FitWidth.png:/report/images/FitWidth.png
+
+
+ Fit page width
+
+
+
+
+
+ :/report/images/FitPage.png:/report/images/FitPage.png
+
+
+ Fit page
+
+
+
+
+
+ :/report/images/OneToOne.png:/report/images/OneToOne.png
+
+
+ One to one
+
+
-
+
diff --git a/limereport/report.qrc b/limereport/report.qrc
index 75b1d3b..a8e1b17 100644
--- a/limereport/report.qrc
+++ b/limereport/report.qrc
@@ -161,5 +161,8 @@
images/settings.png
images/grid.png
images/magnet.png
+ images/FitPage.png
+ images/FitWidth.png
+ images/OneToOne.png