mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-23 20:22:58 +03:00
Merge branch 'master' into feature/speed_up
# Conflicts: # limereport/lrbanddesignintf.cpp # limereport/lrreportengine.cpp
This commit is contained in:
commit
544dbbf94e
555
.travis.yml
555
.travis.yml
@ -1,27 +1,548 @@
|
||||
language: cpp
|
||||
matrix:
|
||||
include:
|
||||
- env: Qt4.8.5_Ubuntu_14.04
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: cpp
|
||||
compiler: gcc
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- qt4-default
|
||||
|
||||
compiler:
|
||||
- gcc
|
||||
script:
|
||||
- qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
sudo: required
|
||||
dist: trusty
|
||||
- env: Qt4.8.5_Ubuntu_14.04
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: cpp
|
||||
compiler: clang
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- qt4-default
|
||||
|
||||
env:
|
||||
- QT_BASE=56
|
||||
script:
|
||||
- qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
before_install:
|
||||
- if [ "$QT_BASE" = "56" ]; then sudo add-apt-repository ppa:beineri/opt-qt562-trusty -y; fi
|
||||
- sudo apt-get update -qq
|
||||
- env: Qt5.1.1_Ubuntu_14.04
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: cpp
|
||||
compiler: gcc
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt511-trusty'
|
||||
packages:
|
||||
- qt51base
|
||||
- qt51script
|
||||
- qt51tools
|
||||
|
||||
install:
|
||||
- if [ "$QT_BASE" = "56" ]; then sudo apt-get install -qq qt56base qt56script qt56tools ; source /opt/qt56/bin/qt56-env.sh; fi
|
||||
script:
|
||||
- source /opt/qt51/bin/qt51-env.sh
|
||||
- /opt/qt51/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.1.1_Ubuntu_14.04
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: cpp
|
||||
compiler: clang
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt511-trusty'
|
||||
packages:
|
||||
- qt51base
|
||||
- qt51script
|
||||
- qt51tools
|
||||
|
||||
script:
|
||||
- qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
script:
|
||||
- source /opt/qt51/bin/qt51-env.sh
|
||||
- /opt/qt51/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.2.1_Ubuntu_14.04
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: cpp
|
||||
compiler: gcc
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt521-trusty'
|
||||
packages:
|
||||
- qt52base
|
||||
- qt52script
|
||||
- qt52tools
|
||||
|
||||
script:
|
||||
- source /opt/qt52/bin/qt52-env.sh
|
||||
- /opt/qt52/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.2.1_Ubuntu_14.04
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: cpp
|
||||
compiler: clang
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt521-trusty'
|
||||
packages:
|
||||
- qt52base
|
||||
- qt52script
|
||||
- qt52tools
|
||||
|
||||
script:
|
||||
- source /opt/qt52/bin/qt52-env.sh
|
||||
- /opt/qt52/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.3.2_Ubuntu_14.04
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: cpp
|
||||
compiler: gcc
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt532-trusty'
|
||||
packages:
|
||||
- qt53base
|
||||
- qt53script
|
||||
- qt53tools
|
||||
|
||||
script:
|
||||
- source /opt/qt53/bin/qt53-env.sh
|
||||
- /opt/qt53/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.3.2_Ubuntu_14.04
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: cpp
|
||||
compiler: clang
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt532-trusty'
|
||||
packages:
|
||||
- qt53base
|
||||
- qt53script
|
||||
- qt53tools
|
||||
|
||||
script:
|
||||
- source /opt/qt53/bin/qt53-env.sh
|
||||
- /opt/qt53/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.4.2_Ubuntu_14.04
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: cpp
|
||||
compiler: gcc
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt542-trusty'
|
||||
packages:
|
||||
- qt54base
|
||||
- qt54script
|
||||
- qt54tools
|
||||
|
||||
script:
|
||||
- source /opt/qt54/bin/qt54-env.sh
|
||||
- /opt/qt54/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.4.2_Ubuntu_14.04
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: cpp
|
||||
compiler: clang
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt542-trusty'
|
||||
packages:
|
||||
- qt54base
|
||||
- qt54script
|
||||
- qt54tools
|
||||
|
||||
script:
|
||||
- source /opt/qt54/bin/qt54-env.sh
|
||||
- /opt/qt54/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.5.1_Ubuntu_14.04
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: cpp
|
||||
compiler: gcc
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt551-trusty'
|
||||
packages:
|
||||
- qt55base
|
||||
- qt55script
|
||||
- qt55tools
|
||||
|
||||
script:
|
||||
- source /opt/qt55/bin/qt55-env.sh
|
||||
- /opt/qt55/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.5.1_Ubuntu_14.04
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: cpp
|
||||
compiler: clang
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt551-trusty'
|
||||
packages:
|
||||
- qt55base
|
||||
- qt55script
|
||||
- qt55tools
|
||||
|
||||
script:
|
||||
- source /opt/qt55/bin/qt55-env.sh
|
||||
- /opt/qt55/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.6.3_Ubuntu_14.04
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: cpp
|
||||
compiler: gcc
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt563-trusty'
|
||||
packages:
|
||||
- qt56base
|
||||
- qt56script
|
||||
- qt56tools
|
||||
|
||||
script:
|
||||
- source /opt/qt56/bin/qt56-env.sh
|
||||
- /opt/qt56/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.6.3_Ubuntu_14.04
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: cpp
|
||||
compiler: clang
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt563-trusty'
|
||||
packages:
|
||||
- qt56base
|
||||
- qt56script
|
||||
- qt56tools
|
||||
|
||||
script:
|
||||
- source /opt/qt56/bin/qt56-env.sh
|
||||
- /opt/qt56/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.7.1_Ubuntu_14.04
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: cpp
|
||||
compiler: gcc
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt571-trusty'
|
||||
packages:
|
||||
- qt57base
|
||||
- qt57script
|
||||
- qt57tools
|
||||
|
||||
script:
|
||||
- source /opt/qt57/bin/qt57-env.sh
|
||||
- /opt/qt57/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.7.1_Ubuntu_14.04
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: cpp
|
||||
compiler: clang
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt571-trusty'
|
||||
packages:
|
||||
- qt57base
|
||||
- qt57script
|
||||
- qt57tools
|
||||
|
||||
script:
|
||||
- source /opt/qt57/bin/qt57-env.sh
|
||||
- /opt/qt57/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.8.0_Ubuntu_14.04
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: cpp
|
||||
compiler: gcc
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt58-trusty'
|
||||
packages:
|
||||
- qt58base
|
||||
- qt58script
|
||||
- qt58tools
|
||||
|
||||
script:
|
||||
- source /opt/qt58/bin/qt58-env.sh
|
||||
- /opt/qt58/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.8.0_Ubuntu_14.04
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: cpp
|
||||
compiler: clang
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt58-trusty'
|
||||
packages:
|
||||
- qt58base
|
||||
- qt58script
|
||||
- qt58tools
|
||||
|
||||
script:
|
||||
- source /opt/qt58/bin/qt58-env.sh
|
||||
- /opt/qt58/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.9.7_Ubuntu_14.04
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: cpp
|
||||
compiler: gcc
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt597-trusty'
|
||||
packages:
|
||||
- qt59base
|
||||
- qt59script
|
||||
- qt59tools
|
||||
|
||||
script:
|
||||
- source /opt/qt59/bin/qt59-env.sh
|
||||
- /opt/qt59/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.9.7_Ubuntu_14.04
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: cpp
|
||||
compiler: clang
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt597-trusty'
|
||||
packages:
|
||||
- qt59base
|
||||
- qt59script
|
||||
- qt59tools
|
||||
|
||||
script:
|
||||
- source /opt/qt59/bin/qt59-env.sh
|
||||
- /opt/qt59/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.10.1_Ubuntu_14.04
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: cpp
|
||||
compiler: gcc
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt-5.10.1-trusty'
|
||||
packages:
|
||||
- qt510base
|
||||
- qt510script
|
||||
- qt510tools
|
||||
|
||||
script:
|
||||
- source /opt/qt510/bin/qt510-env.sh
|
||||
- /opt/qt510/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.10.1_Ubuntu_14.04
|
||||
os: linux
|
||||
dist: trusty
|
||||
language: cpp
|
||||
compiler: clang
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt-5.10.1-trusty'
|
||||
packages:
|
||||
- qt510base
|
||||
- qt510script
|
||||
- qt510tools
|
||||
|
||||
script:
|
||||
- source /opt/qt510/bin/qt510-env.sh
|
||||
- /opt/qt510/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.11.3_Ubuntu_18.04
|
||||
os: linux
|
||||
dist: bionic
|
||||
language: cpp
|
||||
compiler: gcc
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt-5.11.3-bionic'
|
||||
packages:
|
||||
- qt511base
|
||||
- qt511script
|
||||
- qt511tools
|
||||
- mesa-common-dev
|
||||
- libgl1-mesa-dev
|
||||
|
||||
script:
|
||||
- source /opt/qt511/bin/qt511-env.sh
|
||||
- /opt/qt511/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.11.3_Ubuntu_18.04
|
||||
os: linux
|
||||
dist: bionic
|
||||
language: cpp
|
||||
compiler: clang
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt-5.11.3-bionic'
|
||||
packages:
|
||||
- qt511base
|
||||
- qt511script
|
||||
- qt511tools
|
||||
- mesa-common-dev
|
||||
- libgl1-mesa-dev
|
||||
|
||||
script:
|
||||
- source /opt/qt511/bin/qt511-env.sh
|
||||
- /opt/qt511/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.12.3_Ubuntu_18.04
|
||||
os: linux
|
||||
dist: bionic
|
||||
language: cpp
|
||||
compiler: gcc
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt-5.12.3-bionic'
|
||||
packages:
|
||||
- qt512base
|
||||
- qt512script
|
||||
- qt512tools
|
||||
- mesa-common-dev
|
||||
- libgl1-mesa-dev
|
||||
|
||||
script:
|
||||
- source /opt/qt512/bin/qt512-env.sh
|
||||
- /opt/qt512/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
- env: Qt5.12.3_Ubuntu_18.04
|
||||
os: linux
|
||||
dist: bionic
|
||||
language: cpp
|
||||
compiler: clang
|
||||
cache: ccache
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:beineri/opt-qt-5.12.3-bionic'
|
||||
packages:
|
||||
- qt512base
|
||||
- qt512script
|
||||
- qt512tools
|
||||
- mesa-common-dev
|
||||
- libgl1-mesa-dev
|
||||
|
||||
script:
|
||||
- source /opt/qt512/bin/qt512-env.sh
|
||||
- /opt/qt512/bin/qmake -r limereport.pro
|
||||
- make
|
||||
- make check
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
|
@ -66,7 +66,8 @@ HEADERS += $$PWD/../backend/aztec.h \
|
||||
$$PWD/../backend/sjis.h \
|
||||
$$PWD/../backend/stdint_msvc.h \
|
||||
$$PWD/../backend/zint.h \
|
||||
$$PWD/qzint.h
|
||||
$$PWD/qzint.h \
|
||||
$$PWD/qzint_global.h
|
||||
|
||||
SOURCES += $$PWD/../backend/2of5.c \
|
||||
$$PWD/../backend/auspost.c \
|
||||
|
@ -3,10 +3,14 @@
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#ifdef HAVE_STATIC_BUILD
|
||||
# define QZINTSHARED_EXPORT /**/
|
||||
#else
|
||||
#if defined(QZINT_LIBRARY)
|
||||
# define QZINTSHARED_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
# define QZINTSHARED_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // QZINT_GLOBAL_H
|
||||
|
@ -1,8 +1,11 @@
|
||||
|
||||
# LimeReport v1.5.0 [![Build Status](https://api.travis-ci.org/fralx/LimeReport.svg?branch=master)](https://travis-ci.org/fralx/LimeReport) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/bc31412ea4814f30825b5ed3723e9a70)](https://app.codacy.com/app/fralx/LimeReport?utm_source=github.com&utm_medium=referral&utm_content=fralx/LimeReport&utm_campaign=Badge_Grade_Dashboard)
|
||||
|
||||
## Official LimeReport web site [http://limereport.ru](http://limereport.ru)
|
||||
|
||||
### Features
|
||||
## Donation [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/arinalex)
|
||||
|
||||
## Features
|
||||
|
||||
* Multi-platform support
|
||||
* Pure Qt4/Qt5 compatible code
|
||||
|
@ -127,7 +127,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
|
||||
|
||||
LIMEREPORT_VERSION_MAJOR = 1
|
||||
LIMEREPORT_VERSION_MINOR = 5
|
||||
LIMEREPORT_VERSION_RELEASE = 4
|
||||
LIMEREPORT_VERSION_RELEASE = 13
|
||||
|
||||
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
|
||||
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"
|
||||
|
@ -92,6 +92,10 @@ namespace Const{
|
||||
const QString EOW("~!@#$%^&*()+{}|:\"<>?,/;'[]\\-=");
|
||||
const int DEFAULT_TAB_INDENTION = 4;
|
||||
const int DOCKWIDGET_MARGINS = 4;
|
||||
|
||||
const char SCRIPT_SIGN = 'S';
|
||||
const char FIELD_SIGN = 'D';
|
||||
const char VARIABLE_SIGN = 'V';
|
||||
}
|
||||
QString extractClassName(QString className);
|
||||
QString escapeSimbols(const QString& value);
|
||||
|
@ -16,9 +16,14 @@ SUBDIRS += \
|
||||
limereport \
|
||||
demo_r1 \
|
||||
demo_r2 \
|
||||
console \
|
||||
designer
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4){
|
||||
greaterThan(QT_MINOR_VERSION, 1){
|
||||
SUBDIRS += console
|
||||
}
|
||||
}
|
||||
|
||||
!contains(CONFIG, embedded_designer){
|
||||
!contains(CONFIG, static_build){
|
||||
SUBDIRS += designer_plugin
|
||||
|
@ -11,7 +11,7 @@ class PDFExporter : public QObject, public ReportExporterInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PDFExporter(ReportEnginePrivate *parent = nullptr);
|
||||
explicit PDFExporter(ReportEnginePrivate *parent = NULL);
|
||||
// ReportExporterInterface interface
|
||||
bool exportPages(ReportPages pages, const QString &fileName, const QMap<QString, QVariant> ¶ms);
|
||||
QString exporterName()
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
int childrenCount();
|
||||
int layoutSpacing() const;
|
||||
void setLayoutSpacing(int layoutSpacing);
|
||||
qreal layoutSpacingMM(){ return m_layoutSpacing * unitFactor();}
|
||||
qreal layoutSpacingMM(){ return m_layoutSpacing * Const::mmFACTOR;}
|
||||
protected:
|
||||
void beforeDelete();
|
||||
void childAddedEvent(BaseDesignIntf *child);
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "lrglobal.h"
|
||||
#include "lrdatasourcemanager.h"
|
||||
#include "lrpagedesignintf.h"
|
||||
#include "lrimageitemeditor.h"
|
||||
|
||||
namespace{
|
||||
|
||||
@ -83,9 +84,15 @@ void ImageItem::loadPictureFromVariant(QVariant& data){
|
||||
|
||||
void ImageItem::preparePopUpMenu(QMenu &menu)
|
||||
{
|
||||
QAction* editAction = menu.addAction(QIcon(":/report/images/edit_pecil2.png"),tr("Edit"));
|
||||
menu.insertAction(menu.actions().at(0),editAction);
|
||||
menu.insertSeparator(menu.actions().at(1));
|
||||
|
||||
menu.addSeparator();
|
||||
QAction* action = menu.addAction(tr("Watermark"));
|
||||
action->setCheckable(true);
|
||||
action->setChecked(isWatermark());
|
||||
|
||||
}
|
||||
|
||||
void ImageItem::processPopUpAction(QAction *action)
|
||||
@ -93,9 +100,26 @@ void ImageItem::processPopUpAction(QAction *action)
|
||||
if (action->text().compare(tr("Watermark")) == 0){
|
||||
page()->setPropertyToSelectedItems("watermark",action->isChecked());
|
||||
}
|
||||
if (action->text().compare(tr("Edit")) == 0){
|
||||
this->showEditorDialog();
|
||||
}
|
||||
ItemDesignIntf::processPopUpAction(action);
|
||||
}
|
||||
|
||||
QImage getFileByResourcePath(QString resourcePath){
|
||||
QFileInfo resourceFile(resourcePath);
|
||||
if (resourceFile.exists())
|
||||
return QImage(resourcePath);
|
||||
return QImage();
|
||||
}
|
||||
|
||||
QImage ImageItem::drawImage()
|
||||
{
|
||||
if (image().isNull())
|
||||
return getFileByResourcePath(m_resourcePath);
|
||||
return image();
|
||||
}
|
||||
|
||||
bool ImageItem::useExternalPainter() const
|
||||
{
|
||||
return m_useExternalPainter;
|
||||
@ -110,6 +134,13 @@ void ImageItem::setUseExternalPainter(bool value)
|
||||
}
|
||||
}
|
||||
|
||||
QWidget *ImageItem::defaultEditor()
|
||||
{
|
||||
ImageItemEditor* editor = new ImageItemEditor(this);
|
||||
editor->setAttribute(Qt::WA_DeleteOnClose);
|
||||
return editor;
|
||||
}
|
||||
|
||||
void ImageItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight)
|
||||
{
|
||||
|
||||
@ -220,8 +251,8 @@ void ImageItem::setAutoSize(bool autoSize)
|
||||
if (m_autoSize != autoSize){
|
||||
m_autoSize = autoSize;
|
||||
if (m_autoSize && !m_picture.isNull()){
|
||||
setWidth(image().width());
|
||||
setHeight(image().height());
|
||||
setWidth(drawImage().width());
|
||||
setHeight(drawImage().height());
|
||||
setPossibleResizeDirectionFlags(Fixed);
|
||||
} else {
|
||||
setPossibleResizeDirectionFlags(AllDirections);
|
||||
@ -271,10 +302,10 @@ void ImageItem::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option
|
||||
QPointF point = rect().topLeft();
|
||||
QImage img;
|
||||
|
||||
if (m_scale && !image().isNull()){
|
||||
img = image().scaled(rect().width(), rect().height(), keepAspectRatio() ? Qt::KeepAspectRatio : Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
if (m_scale && !drawImage().isNull()){
|
||||
img = drawImage().scaled(rect().width(), rect().height(), keepAspectRatio() ? Qt::KeepAspectRatio : Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
} else {
|
||||
img = image();
|
||||
img = drawImage();
|
||||
}
|
||||
|
||||
qreal shiftHeight = rect().height() - img.height();
|
||||
@ -328,9 +359,9 @@ void ImageItem::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option
|
||||
|
||||
void ImageItem::setImage(QImage value)
|
||||
{
|
||||
if (m_picture!=value){
|
||||
if (m_picture != value){
|
||||
QImage oldValue = m_picture;
|
||||
m_picture=value;
|
||||
m_picture = value;
|
||||
if (m_autoSize){
|
||||
setWidth(m_picture.width());
|
||||
setHeight(m_picture.height());
|
||||
@ -340,6 +371,19 @@ void ImageItem::setImage(QImage value)
|
||||
}
|
||||
}
|
||||
|
||||
QImage ImageItem::image(){
|
||||
return m_picture;
|
||||
}
|
||||
|
||||
void ImageItem::setResourcePath(const QString &value){
|
||||
if (m_resourcePath != value){
|
||||
QString oldValue = m_resourcePath;
|
||||
m_resourcePath = value;
|
||||
update();
|
||||
notify("resourcePath", oldValue, value);
|
||||
}
|
||||
}
|
||||
|
||||
ImageItem::Format ImageItem::format() const
|
||||
{
|
||||
return m_format;
|
||||
|
@ -61,8 +61,8 @@ public:
|
||||
ImageItem(QObject *owner, QGraphicsItem *parent);
|
||||
virtual void paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
void setImage(QImage value);
|
||||
QImage image(){return m_picture;}
|
||||
void setResourcePath(const QString &value){m_resourcePath=value;}
|
||||
QImage image();
|
||||
void setResourcePath(const QString &value);
|
||||
QString resourcePath() const;
|
||||
QString datasource() const;
|
||||
void setDatasource(const QString &datasource);
|
||||
@ -89,6 +89,7 @@ public:
|
||||
bool useExternalPainter() const;
|
||||
void setUseExternalPainter(bool value);
|
||||
|
||||
QWidget* defaultEditor();
|
||||
protected:
|
||||
BaseDesignIntf* createSameTypeItem(QObject *owner, QGraphicsItem *parent);
|
||||
void updateItemSize(DataSourceManager *dataManager, RenderPass pass, int maxHeight);
|
||||
@ -97,6 +98,7 @@ protected:
|
||||
void loadPictureFromVariant(QVariant& data);
|
||||
void preparePopUpMenu(QMenu &menu);
|
||||
void processPopUpAction(QAction *action);
|
||||
QImage drawImage();
|
||||
private:
|
||||
QImage m_picture;
|
||||
bool m_useExternalPainter;
|
||||
@ -110,7 +112,6 @@ private:
|
||||
bool m_center;
|
||||
Format m_format;
|
||||
QString m_variable;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
70
limereport/items/lrimageitemeditor.cpp
Normal file
70
limereport/items/lrimageitemeditor.cpp
Normal file
@ -0,0 +1,70 @@
|
||||
#include "lrimageitemeditor.h"
|
||||
#include "ui_lrimageitemeditor.h"
|
||||
#include "lrimageitem.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QFileDialog>
|
||||
|
||||
ImageItemEditor::ImageItemEditor(LimeReport::ImageItem *item, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::ImageItemEditor), m_item(item)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
m_image = QPixmap::fromImage(m_item->image());
|
||||
ui->resourcePath->setText(m_item->resourcePath());
|
||||
updateImage();
|
||||
}
|
||||
|
||||
ImageItemEditor::~ImageItemEditor()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ImageItemEditor::updateImage()
|
||||
{
|
||||
ui->imageViewer->setPixmap(m_image);
|
||||
if (m_image.isNull() && !ui->resourcePath->text().isEmpty()){
|
||||
if (m_resourcePathImage.isNull())
|
||||
m_resourcePathImage = QPixmap(ui->resourcePath->text());
|
||||
ui->imageViewer->setPixmap(m_resourcePathImage);
|
||||
}
|
||||
}
|
||||
|
||||
void ImageItemEditor::on_tbLoadImage_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Select image file"));
|
||||
m_image = QPixmap(fileName);
|
||||
updateImage();
|
||||
}
|
||||
|
||||
void ImageItemEditor::on_tbClearImage_clicked()
|
||||
{
|
||||
m_image = QPixmap();
|
||||
updateImage();
|
||||
}
|
||||
|
||||
void ImageItemEditor::on_buttonBox_accepted()
|
||||
{
|
||||
m_item->setImage(m_image.toImage());
|
||||
m_item->setResourcePath(ui->resourcePath->text());
|
||||
this->close();
|
||||
}
|
||||
|
||||
void ImageItemEditor::on_buttonBox_rejected()
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
||||
void ImageItemEditor::on_toolButton_clicked()
|
||||
{
|
||||
ui->resourcePath->setText(QFileDialog::getOpenFileName(this, tr("Select image file")));
|
||||
m_resourcePathImage = QPixmap(ui->resourcePath->text());
|
||||
if (!m_resourcePathImage.isNull() && m_image.isNull())
|
||||
ui->imageViewer->setPixmap(m_resourcePathImage);
|
||||
}
|
||||
|
||||
void ImageItemEditor::on_tbResourcePath_clicked()
|
||||
{
|
||||
ui->resourcePath->setText("");
|
||||
updateImage();
|
||||
}
|
37
limereport/items/lrimageitemeditor.h
Normal file
37
limereport/items/lrimageitemeditor.h
Normal file
@ -0,0 +1,37 @@
|
||||
#ifndef LRIMAGEITEMEDITOR_H
|
||||
#define LRIMAGEITEMEDITOR_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class ImageItemEditor;
|
||||
}
|
||||
|
||||
namespace LimeReport {
|
||||
class ImageItem;
|
||||
}
|
||||
|
||||
class ImageItemEditor : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ImageItemEditor(LimeReport::ImageItem* item, QWidget *parent = NULL);
|
||||
~ImageItemEditor();
|
||||
private:
|
||||
void updateImage();
|
||||
private:
|
||||
Ui::ImageItemEditor *ui;
|
||||
LimeReport::ImageItem* m_item;
|
||||
QPixmap m_image;
|
||||
QPixmap m_resourcePathImage;
|
||||
private slots:
|
||||
void on_tbLoadImage_clicked();
|
||||
void on_tbClearImage_clicked();
|
||||
void on_buttonBox_accepted();
|
||||
void on_buttonBox_rejected();
|
||||
void on_toolButton_clicked();
|
||||
void on_tbResourcePath_clicked();
|
||||
};
|
||||
|
||||
#endif // LRIMAGEITEMEDITOR_H
|
170
limereport/items/lrimageitemeditor.ui
Normal file
170
limereport/items/lrimageitemeditor.ui
Normal file
@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ImageItemEditor</class>
|
||||
<widget class="QWidget" name="ImageItemEditor">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>358</width>
|
||||
<height>403</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Image Item Editor</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="items.qrc">
|
||||
<normaloff>:/items/images/imageItem3.png</normaloff>:/items/images/imageItem3.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Image</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbLoadImage">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../report.qrc">
|
||||
<normaloff>:/report/images/folder</normaloff>:/report/images/folder</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbClearImage">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../objectinspector/lobjectinspector.qrc">
|
||||
<normaloff>:/items/clear.png</normaloff>:/items/clear.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="imageViewer">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../../demo_r2/demo_r2.qrc">:/images/images/logo.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Resource path</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="resourcePath"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../report.qrc">
|
||||
<normaloff>:/report/images/folder</normaloff>:/report/images/folder</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbResourcePath">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../objectinspector/lobjectinspector.qrc">
|
||||
<normaloff>:/items/clear.png</normaloff>:/items/clear.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../demo_r2/demo_r2.qrc"/>
|
||||
<include location="../report.qrc"/>
|
||||
<include location="items.qrc"/>
|
||||
<include location="../objectinspector/lobjectinspector.qrc"/>
|
||||
<include location="../report.qrc"/>
|
||||
<include location="items.qrc"/>
|
||||
<include location="../objectinspector/lobjectinspector.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
@ -36,6 +36,7 @@ SOURCES += \
|
||||
$$REPORT_PATH/items/editors/lritemsborderseditorwidget.cpp \
|
||||
$$REPORT_PATH/items/lrsimpletagparser.cpp \
|
||||
$$REPORT_PATH/items/lrimageitem.cpp \
|
||||
$$REPORT_PATH/items/lrimageitemeditor.cpp \
|
||||
$$REPORT_PATH/items/lrtextitemeditor.cpp \
|
||||
$$REPORT_PATH/items/lrshapeitem.cpp \
|
||||
$$REPORT_PATH/items/lrtextitem.cpp \
|
||||
@ -108,6 +109,7 @@ HEADERS += \
|
||||
$$REPORT_PATH/items/lrtextitemeditor.h \
|
||||
$$REPORT_PATH/items/lrshapeitem.h \
|
||||
$$REPORT_PATH/items/lrimageitem.h \
|
||||
$$REPORT_PATH/items/lrimageitemeditor.h \
|
||||
$$REPORT_PATH/items/lrsimpletagparser.h \
|
||||
$$REPORT_PATH/items/lrverticallayout.h \
|
||||
$$REPORT_PATH/items/lrlayoutmarker.h \
|
||||
@ -171,6 +173,7 @@ FORMS += \
|
||||
$$REPORT_PATH/lraboutdialog.ui \
|
||||
$$REPORT_PATH/lrsettingdialog.ui \
|
||||
$$REPORT_PATH/items/lrchartitemeditor.ui \
|
||||
$$REPORT_PATH/items/lrimageitemeditor.ui \
|
||||
$$REPORT_PATH/scripteditor/lrscripteditor.ui
|
||||
|
||||
RESOURCES += \
|
||||
|
@ -177,7 +177,7 @@ BandDesignIntf::BandDesignIntf(BandsType bandType, const QString &xmlTypeName, Q
|
||||
if (parentItem) setWidth(parentItem->width());
|
||||
}
|
||||
|
||||
setBackgroundMode(BGMode::TransparentMode);
|
||||
setBackgroundMode(BaseDesignIntf::TransparentMode);
|
||||
setFillTransparentInDesignMode(false);
|
||||
setHeight(100);
|
||||
setFixedPos(true);
|
||||
@ -362,7 +362,7 @@ void BandDesignIntf::setDataSourceName(const QString &datasource){
|
||||
m_dataSourceName=datasource;
|
||||
}
|
||||
|
||||
void BandDesignIntf::setKeepBottomSpaceOption(bool value){
|
||||
void BandDesignIntf::setKeepBottomSpace(bool value){
|
||||
if (m_keepBottomSpace!=value){
|
||||
m_keepBottomSpace=value;
|
||||
if (!isLoading())
|
||||
@ -594,7 +594,11 @@ void BandDesignIntf::preparePopUpMenu(QMenu &menu)
|
||||
|
||||
currAction = menu.addAction(tr("Keep bottom space"));
|
||||
currAction->setCheckable(true);
|
||||
currAction->setChecked(keepBottomSpaceOption());
|
||||
currAction->setChecked(keepBottomSpace());
|
||||
|
||||
currAction = menu.addAction(tr("Keep top space"));
|
||||
currAction->setCheckable(true);
|
||||
currAction->setChecked(keepTopSpace());
|
||||
|
||||
currAction = menu.addAction(tr("Print if empty"));
|
||||
currAction->setCheckable(true);
|
||||
@ -619,6 +623,9 @@ void BandDesignIntf::processPopUpAction(QAction *action)
|
||||
if (action->text().compare(tr("Keep bottom space")) == 0){
|
||||
setProperty("keepBottomSpace", action->isChecked());
|
||||
}
|
||||
if (action->text().compare(tr("Keep top space")) == 0){
|
||||
setProperty("keepTopSpace",action->isChecked());
|
||||
}
|
||||
|
||||
if (action->text().compare(tr("Print if empty")) == 0){
|
||||
setProperty("printIfEmpty", action->isChecked());
|
||||
@ -1116,10 +1123,10 @@ void BandDesignIntf::setKeepFooterTogether(bool value)
|
||||
|
||||
void BandDesignIntf::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight)
|
||||
{
|
||||
qreal spaceBorder=0;
|
||||
if (keepBottomSpaceOption()) spaceBorder = bottomSpace();
|
||||
qreal spaceBorder = 0;
|
||||
if (keepBottomSpace()) spaceBorder = bottomSpace();
|
||||
spaceBorder = spaceBorder > 0 ? spaceBorder : 0;
|
||||
if (borderLines()!=0){
|
||||
if (borderLines() != 0){
|
||||
spaceBorder += borderLineSize();
|
||||
}
|
||||
|
||||
@ -1131,14 +1138,14 @@ void BandDesignIntf::updateItemSize(DataSourceManager* dataManager, RenderPass p
|
||||
arrangeSubItems(pass, dataManager);
|
||||
if (autoHeight()){
|
||||
if (!keepTopSpace()) {
|
||||
qreal minTop = findMinTop() + m_shiftItems;
|
||||
qreal minTop = findMinTop() + m_shiftItems - spaceBorder;
|
||||
foreach (BaseDesignIntf* item, childBaseItems()) {
|
||||
item->setY(item->y() - minTop);
|
||||
}
|
||||
}
|
||||
setHeight(findMaxBottom()+spaceBorder);
|
||||
setHeight(findMaxBottom() + spaceBorder);
|
||||
}
|
||||
if ((maxHeight>0)&&(height()>maxHeight)){
|
||||
if ((maxHeight > 0) && (height() > maxHeight)){
|
||||
trimToMaxHeight(maxHeight);
|
||||
setHeight(maxHeight);
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ class BandDesignIntf : public ItemsContainerDesignInft
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool autoHeight READ autoHeight WRITE setAutoHeight )
|
||||
Q_PROPERTY(int bandIndex READ bandIndex WRITE setBandIndex DESIGNABLE false )
|
||||
Q_PROPERTY(bool keepBottomSpace READ keepBottomSpaceOption WRITE setKeepBottomSpaceOption )
|
||||
Q_PROPERTY(bool keepBottomSpace READ keepBottomSpace WRITE setKeepBottomSpace )
|
||||
Q_PROPERTY(bool keepTopSpace READ keepTopSpace WRITE setKeepTopSpace)
|
||||
Q_PROPERTY(QString parentBand READ parentBandName WRITE setParentBandName DESIGNABLE false )
|
||||
Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
|
||||
@ -164,8 +164,8 @@ public:
|
||||
QString datasourceName();
|
||||
void setDataSourceName(const QString& datasourceName);
|
||||
|
||||
void setKeepBottomSpaceOption(bool value);
|
||||
bool keepBottomSpaceOption() const {return m_keepBottomSpace;}
|
||||
void setKeepBottomSpace(bool value);
|
||||
bool keepBottomSpace() const {return m_keepBottomSpace;}
|
||||
|
||||
bool keepTopSpace() const;
|
||||
void setKeepTopSpace(bool value);
|
||||
|
@ -97,7 +97,9 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q
|
||||
|
||||
QRectF BaseDesignIntf::boundingRect() const
|
||||
{
|
||||
return rect();
|
||||
qreal halfpw = pen().widthF() / 2;
|
||||
halfpw += 2;
|
||||
return rect().adjusted(-halfpw, -halfpw, halfpw, halfpw);
|
||||
}
|
||||
|
||||
BaseDesignIntf::~BaseDesignIntf(void) {
|
||||
|
@ -262,7 +262,7 @@ public:
|
||||
|
||||
QString itemTypeName() const;
|
||||
void setItemTypeName(const QString &itemTypeName);
|
||||
void emitObjectNamePropertyChanged(const QString& oldName, const QString& newName);
|
||||
|
||||
int borderLineSize() const;
|
||||
void setBorderLineSize(int value);
|
||||
void showEditorDialog();
|
||||
@ -303,7 +303,9 @@ public:
|
||||
|
||||
bool fillTransparentInDesignMode() const;
|
||||
void setFillTransparentInDesignMode(bool fillTransparentInDesignMode);
|
||||
|
||||
void emitPosChanged(QPointF oldPos, QPointF newPos);
|
||||
void emitObjectNamePropertyChanged(const QString& oldName, const QString& newName);
|
||||
|
||||
bool isGeometryLocked() const;
|
||||
void setGeometryLocked(bool itemLocked);
|
||||
|
@ -92,6 +92,10 @@ namespace Const{
|
||||
const QString EOW("~!@#$%^&*()+{}|:\"<>?,/;'[]\\-=");
|
||||
const int DEFAULT_TAB_INDENTION = 4;
|
||||
const int DOCKWIDGET_MARGINS = 4;
|
||||
|
||||
const char SCRIPT_SIGN = 'S';
|
||||
const char FIELD_SIGN = 'D';
|
||||
const char VARIABLE_SIGN = 'V';
|
||||
}
|
||||
QString extractClassName(QString className);
|
||||
QString escapeSimbols(const QString& value);
|
||||
|
@ -278,6 +278,7 @@ void PageDesignIntf::setPageItem(PageItemDesignIntf::Ptr pageItem)
|
||||
|
||||
void PageDesignIntf::setPageItems(QList<PageItemDesignIntf::Ptr> pages)
|
||||
{
|
||||
m_currentPage = 0;
|
||||
if (!m_pageItem.isNull()) {
|
||||
removeItem(m_pageItem.data());
|
||||
m_pageItem.clear();
|
||||
@ -1459,15 +1460,24 @@ void PageDesignIntf::sendToBack()
|
||||
}
|
||||
}
|
||||
|
||||
bool PageDesignIntf::selectionContainsBand(){
|
||||
foreach(QGraphicsItem * item,selectedItems()){
|
||||
BandDesignIntf *band = dynamic_cast<BandDesignIntf *>(item);
|
||||
if (band) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void PageDesignIntf::alignToLeft()
|
||||
{
|
||||
if ((selectedItems().count() > 0) && m_firstSelectedItem) {
|
||||
CommandGroup::Ptr cm = CommandGroup::create();
|
||||
bool moveInBand = selectionContainsBand();
|
||||
foreach(QGraphicsItem * item, selectedItems()) {
|
||||
BaseDesignIntf *bdItem = dynamic_cast<BaseDesignIntf *>(item);
|
||||
if (bdItem && !bdItem->isGeometryLocked()) {
|
||||
QRectF oldGeometry = bdItem->geometry();
|
||||
bdItem->setPos(QPoint(m_firstSelectedItem->pos().x(), item->pos().y()));
|
||||
bdItem->setPos(QPointF(moveInBand ? 0 : m_firstSelectedItem->pos().x(), item->pos().y()));
|
||||
CommandIf::Ptr command = PropertyChangedCommand::create(this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
|
||||
cm->addCommand(command, false);
|
||||
}
|
||||
@ -1480,11 +1490,19 @@ void PageDesignIntf::alignToRigth()
|
||||
{
|
||||
if ((selectedItems().count() > 0) && m_firstSelectedItem) {
|
||||
CommandGroup::Ptr cm = CommandGroup::create();
|
||||
bool moveInBand = selectionContainsBand();
|
||||
foreach(QGraphicsItem * item, selectedItems()) {
|
||||
BaseDesignIntf *bdItem = dynamic_cast<BaseDesignIntf *>(item);
|
||||
if (bdItem && !bdItem->isGeometryLocked()) {
|
||||
if (bdItem && !bdItem->isGeometryLocked() && !bdItem->isBand()) {
|
||||
QRectF oldGeometry = bdItem->geometry();
|
||||
bdItem->setPos(QPoint(m_firstSelectedItem->geometry().right() - bdItem->width(), bdItem->pos().y()));
|
||||
if (moveInBand && dynamic_cast<BandDesignIntf*>(bdItem->parent()))
|
||||
{
|
||||
bdItem->setPos(QPointF(dynamic_cast<BandDesignIntf*>(bdItem->parent())->geometry().width() - bdItem->width(),
|
||||
bdItem->pos().y()));
|
||||
} else {
|
||||
qreal x = m_firstSelectedItem->geometry().right() - bdItem->width();
|
||||
bdItem->setPos(QPointF(x+1, bdItem->pos().y()));
|
||||
}
|
||||
CommandIf::Ptr command = PropertyChangedCommand::create(this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
|
||||
cm->addCommand(command, false);
|
||||
}
|
||||
@ -1497,11 +1515,18 @@ void PageDesignIntf::alignToVCenter()
|
||||
{
|
||||
if ((selectedItems().count() > 0) && m_firstSelectedItem) {
|
||||
CommandGroup::Ptr cm = CommandGroup::create();
|
||||
bool moveInBand = selectionContainsBand();
|
||||
foreach(QGraphicsItem * item, selectedItems()) {
|
||||
BaseDesignIntf *bdItem = dynamic_cast<BaseDesignIntf *>(item);
|
||||
if (bdItem && !bdItem->isGeometryLocked()) {
|
||||
if (bdItem && !bdItem->isGeometryLocked() && !bdItem->isBand()) {
|
||||
QRectF oldGeometry = bdItem->geometry();
|
||||
bdItem->setPos(QPoint((m_firstSelectedItem->geometry().right() - m_firstSelectedItem->width() / 2) - bdItem->width() / 2, bdItem->pos().y()));
|
||||
if (moveInBand && dynamic_cast<BandDesignIntf*>(bdItem->parent())){
|
||||
bdItem->setPos(QPointF((dynamic_cast<BandDesignIntf*>(bdItem->parent())->geometry().width() / 2) - bdItem->width() / 2,
|
||||
bdItem->pos().y()));
|
||||
} else {
|
||||
qreal x = (m_firstSelectedItem->geometry().right() - m_firstSelectedItem->width() / 2) - bdItem->width() / 2;
|
||||
bdItem->setPos(QPointF(x+1, bdItem->pos().y()));
|
||||
}
|
||||
CommandIf::Ptr command = PropertyChangedCommand::create(this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
|
||||
cm->addCommand(command, false);
|
||||
}
|
||||
@ -1514,11 +1539,16 @@ void PageDesignIntf::alignToTop()
|
||||
{
|
||||
if ((selectedItems().count() > 0) && m_firstSelectedItem) {
|
||||
CommandGroup::Ptr cm = CommandGroup::create();
|
||||
bool moveInBand = selectionContainsBand();
|
||||
foreach(QGraphicsItem * item, selectedItems()) {
|
||||
BaseDesignIntf *bdItem = dynamic_cast<BaseDesignIntf *>(item);
|
||||
if (bdItem && !bdItem->isGeometryLocked()) {
|
||||
if (bdItem && !bdItem->isGeometryLocked() && !bdItem->isBand()) {
|
||||
QRectF oldGeometry = bdItem->geometry();
|
||||
bdItem->setPos(QPoint(bdItem->pos().x(), m_firstSelectedItem->pos().y()));
|
||||
if (moveInBand){
|
||||
bdItem->setPos(QPointF(0, m_firstSelectedItem->pos().y()));
|
||||
} else {
|
||||
bdItem->setPos(QPointF(bdItem->pos().x(), m_firstSelectedItem->pos().y()));
|
||||
}
|
||||
CommandIf::Ptr command = PropertyChangedCommand::create(this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
|
||||
cm->addCommand(command, false);
|
||||
}
|
||||
@ -1531,11 +1561,17 @@ void PageDesignIntf::alignToBottom()
|
||||
{
|
||||
if ((selectedItems().count() > 0) && m_firstSelectedItem) {
|
||||
CommandGroup::Ptr cm = CommandGroup::create();
|
||||
bool moveInBand = selectionContainsBand();
|
||||
foreach(QGraphicsItem * item, selectedItems()) {
|
||||
BaseDesignIntf *bdItem = dynamic_cast<BaseDesignIntf *>(item);
|
||||
if (bdItem && !bdItem->isGeometryLocked()) {
|
||||
if (bdItem && !bdItem->isGeometryLocked() && !bdItem->isBand()) {
|
||||
QRectF oldGeometry = bdItem->geometry();
|
||||
bdItem->setPos(QPoint(bdItem->pos().x(), m_firstSelectedItem->geometry().bottom() - bdItem->height()));
|
||||
if (moveInBand && dynamic_cast<BandDesignIntf*>(bdItem->parent())){
|
||||
bdItem->setPos(QPointF(bdItem->pos().x(), dynamic_cast<BandDesignIntf*>(bdItem->parent())->height() - bdItem->height()));
|
||||
} else {
|
||||
qreal y = m_firstSelectedItem->geometry().bottom() - bdItem->height();
|
||||
bdItem->setPos(QPointF(bdItem->pos().x(), y+1));
|
||||
}
|
||||
CommandIf::Ptr command = PropertyChangedCommand::create(this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
|
||||
cm->addCommand(command, false);
|
||||
}
|
||||
@ -1548,11 +1584,17 @@ void PageDesignIntf::alignToHCenter()
|
||||
{
|
||||
if ((selectedItems().count() > 0) && m_firstSelectedItem) {
|
||||
CommandGroup::Ptr cm = CommandGroup::create();
|
||||
bool moveInBand = selectionContainsBand();
|
||||
foreach(QGraphicsItem * item, selectedItems()) {
|
||||
BaseDesignIntf *bdItem = dynamic_cast<BaseDesignIntf *>(item);
|
||||
if (bdItem && !bdItem->isGeometryLocked()) {
|
||||
if (bdItem && !bdItem->isGeometryLocked() && !bdItem->isBand()) {
|
||||
QRectF oldGeometry = bdItem->geometry();
|
||||
bdItem->setPos(QPoint(bdItem->pos().x(), (m_firstSelectedItem->geometry().bottom() - m_firstSelectedItem->height() / 2) - bdItem->height() / 2));
|
||||
if (moveInBand && dynamic_cast<BandDesignIntf*>(bdItem->parent())){
|
||||
bdItem->setPos(QPointF(bdItem->pos().x(), (dynamic_cast<BandDesignIntf*>(bdItem->parent())->height() / 2) - bdItem->height() / 2));
|
||||
} else {
|
||||
qreal y = (m_firstSelectedItem->geometry().bottom() - m_firstSelectedItem->height() / 2) - bdItem->height() / 2;
|
||||
bdItem->setPos(QPointF(bdItem->pos().x(), y+1));
|
||||
}
|
||||
CommandIf::Ptr command = PropertyChangedCommand::create(this, bdItem->objectName(), "geometry", oldGeometry, bdItem->geometry());
|
||||
cm->addCommand(command, false);
|
||||
}
|
||||
@ -2136,7 +2178,7 @@ bool PosChangedCommand::doIt()
|
||||
if (reportItem && (reportItem->pos() != m_newPos[i].pos)){
|
||||
QPointF oldValue = reportItem->pos();
|
||||
reportItem->setPos(m_newPos[i].pos);
|
||||
emit reportItem->posChanged(reportItem, oldValue, reportItem->pos());
|
||||
reportItem->emitPosChanged(oldValue, reportItem->pos());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,6 +282,7 @@ namespace LimeReport {
|
||||
void changeSelectedGroupProperty(const QString& name,const QVariant& value);
|
||||
void activateItemToJoin(QRectF itemRect, QList<ItemProjections>& items);
|
||||
void selectAllChildren(BaseDesignIntf* item);
|
||||
bool selectionContainsBand();
|
||||
private:
|
||||
enum JoinType{Width, Height};
|
||||
LimeReport::PageItemDesignIntf::Ptr m_pageItem;
|
||||
@ -322,6 +323,7 @@ namespace LimeReport {
|
||||
bool m_magneticMovement;
|
||||
ReportSettings* m_reportSettings;
|
||||
PageItemDesignIntf* m_currentPage;
|
||||
|
||||
};
|
||||
|
||||
class AbstractPageCommand : public CommandIf{
|
||||
|
@ -82,12 +82,12 @@ private:
|
||||
|
||||
class PageView: public QGraphicsView{
|
||||
public:
|
||||
PageView(QWidget *parent = nullptr): QGraphicsView(parent),
|
||||
PageView(QWidget *parent = NULL): QGraphicsView(parent),
|
||||
m_horizontalRuller(0), m_verticalRuller(0)
|
||||
{
|
||||
setViewportMargins(20,20,0,0);
|
||||
}
|
||||
PageView(QGraphicsScene *scene, QWidget *parent = nullptr):
|
||||
PageView(QGraphicsScene *scene, QWidget *parent = NULL):
|
||||
QGraphicsView(scene, parent),
|
||||
m_horizontalRuller(0), m_verticalRuller(0)
|
||||
{
|
||||
|
@ -304,7 +304,7 @@ void ReportEnginePrivate::internalPrintPages(ReportPages pages, QPrinter &printe
|
||||
{
|
||||
m_cancelPrinting = false;
|
||||
int currenPage = 1;
|
||||
QMap<QString, QSharedPointer<PrintProcessor>> printProcessors;
|
||||
QMap<QString, QSharedPointer<PrintProcessor> > printProcessors;
|
||||
printProcessors.insert("default",QSharedPointer<PrintProcessor>(new PrintProcessor(&printer)));
|
||||
emit printingStarted(printer.toPage() - printer.fromPage());
|
||||
foreach(PageItemDesignIntf::Ptr page, pages){
|
||||
|
@ -465,15 +465,13 @@ QString ScriptEngineManager::expandScripts(QString context, QVariant& varValue,
|
||||
|
||||
if (context.contains(rx)){
|
||||
|
||||
if (ScriptEngineManager::instance().dataManager()!=dataManager())
|
||||
if (ScriptEngineManager::instance().dataManager() != dataManager())
|
||||
ScriptEngineManager::instance().setDataManager(dataManager());
|
||||
|
||||
ScriptEngineType* se = ScriptEngineManager::instance().scriptEngine();
|
||||
|
||||
if (reportItem){
|
||||
|
||||
ScriptValueType svThis;
|
||||
|
||||
#ifdef USE_QJSENGINE
|
||||
svThis = getJSValue(*se, reportItem);
|
||||
se->globalObject().setProperty("THIS",svThis);
|
||||
@ -490,29 +488,37 @@ QString ScriptEngineManager::expandScripts(QString context, QVariant& varValue,
|
||||
|
||||
ScriptExtractor scriptExtractor(context);
|
||||
if (scriptExtractor.parse()){
|
||||
for(int i=0; i<scriptExtractor.count();++i){
|
||||
QString scriptBody = expandDataFields(scriptExtractor.bodyAt(i),EscapeSymbols, varValue, reportItem);
|
||||
scriptBody = expandUserVariables(scriptBody, FirstPass, EscapeSymbols, varValue);
|
||||
ScriptValueType value = se->evaluate(scriptBody);
|
||||
#ifdef USE_QJSENGINE
|
||||
if (!value.isError()){
|
||||
varValue = value.toVariant();
|
||||
context.replace(scriptExtractor.scriptAt(i),value.toString());
|
||||
} else {
|
||||
context.replace(scriptExtractor.scriptAt(i),value.toString());
|
||||
}
|
||||
#else
|
||||
if (!se->hasUncaughtException()) {
|
||||
varValue = value.toVariant();
|
||||
context.replace(scriptExtractor.scriptAt(i),value.toString());
|
||||
} else {
|
||||
context.replace(scriptExtractor.scriptAt(i),se->uncaughtException().toString());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
context = replaceScripts(context, varValue, reportItem, se, scriptExtractor.scriptTree());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
QString ScriptEngineManager::replaceScripts(QString context, QVariant &varValue, QObject *reportItem, ScriptEngineType* se, ScriptNode *scriptTree)
|
||||
{
|
||||
foreach(ScriptNode* item, scriptTree->children()){
|
||||
QString scriptBody = expandDataFields(item->body(), EscapeSymbols, varValue, reportItem);
|
||||
if (item->children().size() > 0)
|
||||
scriptBody = replaceScripts(scriptBody, varValue, reportItem, se, item);
|
||||
scriptBody = expandUserVariables(scriptBody, FirstPass, EscapeSymbols, varValue);
|
||||
ScriptValueType value = se->evaluate(scriptBody);
|
||||
#ifdef USE_QJSENGINE
|
||||
if (!value.isError()){
|
||||
varValue = value.toVariant();
|
||||
context.replace(item->script(), value.toString());
|
||||
} else {
|
||||
context.replace(item->script(), value.toString());
|
||||
}
|
||||
#else
|
||||
if (!se->hasUncaughtException()) {
|
||||
varValue = value.toVariant();
|
||||
context.replace(item->script(), value.toString());
|
||||
} else {
|
||||
context.replace(item->script(), se->uncaughtException().toString());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
@ -530,7 +536,7 @@ QVariant ScriptEngineManager::evaluateScript(const QString& script){
|
||||
|
||||
ScriptExtractor scriptExtractor(script);
|
||||
if (scriptExtractor.parse()){
|
||||
QString scriptBody = expandDataFields(scriptExtractor.bodyAt(0),EscapeSymbols, varValue, 0);
|
||||
QString scriptBody = expandDataFields(scriptExtractor.scriptTree()[0].body(), EscapeSymbols, varValue, 0);
|
||||
scriptBody = expandUserVariables(scriptBody, FirstPass, EscapeSymbols, varValue);
|
||||
ScriptValueType value = se->evaluate(scriptBody);
|
||||
#ifdef USE_QJSENGINE
|
||||
@ -976,12 +982,11 @@ ScriptEngineManager::ScriptEngineManager()
|
||||
bool ScriptExtractor::parse()
|
||||
{
|
||||
int currentPos = 0;
|
||||
parse(currentPos,None);
|
||||
return m_scriptsBody.count()>0;
|
||||
|
||||
parse(currentPos, None, m_scriptTree);
|
||||
return m_scriptTree->children().count() > 0;
|
||||
}
|
||||
|
||||
bool ScriptExtractor::parse(int &curPos,const State& state)
|
||||
bool ScriptExtractor::parse(int &curPos, const State& state, ScriptNode* scriptNode)
|
||||
{
|
||||
while (curPos<m_context.length()){
|
||||
switch (state) {
|
||||
@ -990,13 +995,13 @@ bool ScriptExtractor::parse(int &curPos,const State& state)
|
||||
return true;
|
||||
} else {
|
||||
if (m_context[curPos]=='{')
|
||||
extractBracket(curPos);
|
||||
extractBracket(curPos, scriptNode);
|
||||
}
|
||||
case None:
|
||||
if (m_context[curPos]=='$'){
|
||||
int startPos = curPos;
|
||||
if (isStartScriptLexem(curPos))
|
||||
extractScript(curPos,substring(m_context,startPos,curPos));
|
||||
extractScript(curPos, substring(m_context,startPos,curPos), scriptNode->createChildNode());
|
||||
if (isStartFieldLexem(curPos) || isStartVariableLexem(curPos))
|
||||
skipField(curPos);
|
||||
}
|
||||
@ -1008,13 +1013,13 @@ bool ScriptExtractor::parse(int &curPos,const State& state)
|
||||
return false;
|
||||
}
|
||||
|
||||
void ScriptExtractor::extractScript(int &curPos, const QString& startStr)
|
||||
void ScriptExtractor::extractScript(int &curPos, const QString& startStr, ScriptNode* scriptNode)
|
||||
{
|
||||
int startPos = curPos;
|
||||
if (extractBracket(curPos)){
|
||||
if (extractBracket(curPos, scriptNode)){
|
||||
QString scriptBody = substring(m_context,startPos+1,curPos);
|
||||
m_scriptsBody.push_back(scriptBody);
|
||||
m_scriptsStartLex.push_back(startStr+'{');
|
||||
scriptNode->setBody(scriptBody);
|
||||
scriptNode->setStartLex(startStr+'{');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1028,10 +1033,10 @@ void ScriptExtractor::skipField(int &curPos){
|
||||
}
|
||||
}
|
||||
|
||||
bool ScriptExtractor::extractBracket(int &curPos)
|
||||
bool ScriptExtractor::extractBracket(int &curPos, ScriptNode* scriptNode)
|
||||
{
|
||||
curPos++;
|
||||
return parse(curPos,OpenBracketFound);
|
||||
return parse(curPos,OpenBracketFound, scriptNode);
|
||||
}
|
||||
|
||||
bool ScriptExtractor::isStartLexem(int& curPos, QChar value){
|
||||
@ -1064,16 +1069,16 @@ bool ScriptExtractor::isStartLexem(int& curPos, QChar value){
|
||||
|
||||
bool ScriptExtractor::isStartScriptLexem(int& curPos)
|
||||
{
|
||||
return isStartLexem(curPos, SCRIPT_SIGN);
|
||||
return isStartLexem(curPos, Const::SCRIPT_SIGN);
|
||||
}
|
||||
|
||||
bool ScriptExtractor::isStartFieldLexem(int& curPos){
|
||||
return isStartLexem(curPos, FIELD_SIGN);
|
||||
return isStartLexem(curPos, Const::FIELD_SIGN);
|
||||
}
|
||||
|
||||
bool ScriptExtractor::isStartVariableLexem(int &curPos)
|
||||
{
|
||||
return isStartLexem(curPos, VARIABLE_SIGN);
|
||||
return isStartLexem(curPos, Const::VARIABLE_SIGN);
|
||||
}
|
||||
|
||||
|
||||
@ -1930,7 +1935,7 @@ bool DatasourceFunctions::isEOF(const QString &datasourceName)
|
||||
bool DatasourceFunctions::invalidate(const QString& datasourceName)
|
||||
{
|
||||
if (m_dataManager && m_dataManager->dataSource(datasourceName)){
|
||||
m_dataManager->dataSourceHolder(datasourceName)->invalidate(IDataSource::DatasourceMode::RENDER_MODE);
|
||||
m_dataManager->dataSourceHolder(datasourceName)->invalidate(IDataSource::RENDER_MODE);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -396,6 +396,47 @@ private:
|
||||
QMap<QString, IWrapperCreator*> m_wrappersFactory;
|
||||
};
|
||||
|
||||
class ScriptNode{
|
||||
public:
|
||||
QString body(){return m_body;}
|
||||
void setBody(const QString& body){ m_body = body;}
|
||||
void setStartLex(const QString startLex){ m_startLex = startLex;}
|
||||
QString script(){return m_startLex + m_body + '}';}
|
||||
ScriptNode* createChildNode(){
|
||||
ScriptNode* result = new ScriptNode();
|
||||
m_children.append(result);
|
||||
return result;
|
||||
}
|
||||
QVector<ScriptNode*> children() const {return m_children;}
|
||||
private:
|
||||
QVector<ScriptNode*> m_children;
|
||||
QString m_body;
|
||||
QString m_startLex;
|
||||
};
|
||||
|
||||
class ScriptExtractor
|
||||
{
|
||||
public:
|
||||
enum State{None,BuksFound,SFound,StartScriptFound,OpenBracketFound,CloseBracketFound,DFound,VFound, SignFound};
|
||||
explicit ScriptExtractor(const QString& value):
|
||||
m_context(value), m_scriptTree(new ScriptNode()){}
|
||||
bool parse();
|
||||
ScriptNode* scriptTree(){return m_scriptTree;}
|
||||
private:
|
||||
bool isStartLexem(int &curPos, QChar value);
|
||||
bool parse(int& curPos, const State &state, ScriptNode *scriptNode);
|
||||
void skipField(int &curPos);
|
||||
void extractScript(int& curPos, const QString &startStr, ScriptNode *scriptNode);
|
||||
bool extractBracket(int& curPos, ScriptNode *scriptNode);
|
||||
bool isStartScriptLexem(int &curPos);
|
||||
bool isStartFieldLexem(int &curPos);
|
||||
bool isStartVariableLexem(int &curPos);
|
||||
QString substring(const QString& value, int start, int end);
|
||||
private:
|
||||
QString m_context;
|
||||
ScriptNode* m_scriptTree;
|
||||
};
|
||||
|
||||
class ScriptEngineManager : public QObject, public Singleton<ScriptEngineManager>, public IScriptEngineManager
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -423,6 +464,9 @@ public:
|
||||
QString expandUserVariables(QString context, RenderPass pass, ExpandType expandType, QVariant &varValue);
|
||||
QString expandDataFields(QString context, ExpandType expandType, QVariant &varValue, QObject* reportItem);
|
||||
QString expandScripts(QString context, QVariant &varValue, QObject* reportItem);
|
||||
|
||||
QString replaceScripts(QString context, QVariant& varValue, QObject *reportItem, ScriptEngineType *se, ScriptNode* scriptTree);
|
||||
|
||||
QVariant evaluateScript(const QString &script);
|
||||
void addBookMark(const QString &uniqKey, const QString &content);
|
||||
int findPageIndexByBookmark(const QString& uniqKey);
|
||||
@ -466,36 +510,6 @@ private:
|
||||
ScriptFunctionsManager* m_functionManager;
|
||||
};
|
||||
|
||||
class ScriptExtractor
|
||||
{
|
||||
public:
|
||||
enum State{None,BuksFound,SFound,StartScriptFound,OpenBracketFound,CloseBracketFound,DFound,VFound, SignFound};
|
||||
explicit ScriptExtractor(const QString& value):m_context(value){}
|
||||
bool parse();
|
||||
int count(){return m_scriptsBody.count();}
|
||||
QString bodyAt(int index){return m_scriptsBody[index];}
|
||||
QString scriptAt(int index){return m_scriptsStartLex[index]+m_scriptsBody[index]+'}';}
|
||||
|
||||
private:
|
||||
static const char SCRIPT_SIGN = 'S';
|
||||
static const char FIELD_SIGN = 'D';
|
||||
static const char VARIABLE_SIGN = 'V';
|
||||
|
||||
bool isStartLexem(int &curPos, QChar value);
|
||||
bool parse(int& curPos, const State &state);
|
||||
void skipField(int &curPos);
|
||||
void extractScript(int& curPos, const QString &startStr);
|
||||
bool extractBracket(int& curPos);
|
||||
bool isStartScriptLexem(int &curPos);
|
||||
bool isStartFieldLexem(int &curPos);
|
||||
bool isStartVariableLexem(int &curPos);
|
||||
QString substring(const QString& value, int start, int end);
|
||||
private:
|
||||
QString m_context;
|
||||
QVector<QString> m_scriptsBody;
|
||||
QVector<QString> m_scriptsStartLex;
|
||||
|
||||
};
|
||||
|
||||
#ifdef USE_QTSCRIPTENGINE
|
||||
class QFontPrototype : public QObject, public QScriptable {
|
||||
|
@ -99,7 +99,7 @@ namespace LimeReport{
|
||||
#endif
|
||||
private:
|
||||
bool m_valid;
|
||||
void invalidate(){m_object=0; m_objects=0; m_valid = false; m_name = ""; m_value=QVariant(), m_isClass=false;}
|
||||
void invalidate(){m_object=0; m_objects=0; m_valid = false; m_name = ""; m_value=QVariant(); m_isClass=false;}
|
||||
|
||||
protected:
|
||||
void beginChangeValue(){ m_changingValue = true; }
|
||||
@ -140,4 +140,7 @@ namespace LimeReport{
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(LimeReport::ObjectPropItem*)
|
||||
|
||||
#endif // LROBJECTPROPITEM_H
|
||||
|
Binary file not shown.
@ -55,6 +55,29 @@
|
||||
<translation>Название ряда</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ImageItemEditor</name>
|
||||
<message>
|
||||
<source>Image Item Editor</source>
|
||||
<translation>Редакор изображения</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Image</source>
|
||||
<translation>Изображение</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>...</source>
|
||||
<translation>...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Resource path</source>
|
||||
<translation>Путь к русурсам</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Select image file</source>
|
||||
<translation>Выбрать файл изображения</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LRVariableDialog</name>
|
||||
<message>
|
||||
@ -392,6 +415,10 @@ p, li { white-space: pre-wrap; }
|
||||
<source>Copy</source>
|
||||
<translation>Копировать</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Keep top space</source>
|
||||
<translation>Сохранять отступ сверху</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LimeReport::BaseDesignIntf</name>
|
||||
@ -433,7 +460,7 @@ p, li { white-space: pre-wrap; }
|
||||
</message>
|
||||
<message>
|
||||
<source>Lock item geometry</source>
|
||||
<translation>Блокировать изменения геометрии</translation>
|
||||
<translation>Заблокировать геометрию элемента</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@ -1003,11 +1030,11 @@ p, li { white-space: pre-wrap; }
|
||||
</message>
|
||||
<message>
|
||||
<source>Scale</source>
|
||||
<translation>Масштабировать</translation>
|
||||
<translation>Масштаб</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Split</source>
|
||||
<translation>Разделять на части</translation>
|
||||
<translation>Разделить</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@ -1130,6 +1157,10 @@ p, li { white-space: pre-wrap; }
|
||||
<source>Watermark</source>
|
||||
<translation>Водный знак</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Edit</source>
|
||||
<translation>Правка</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LimeReport::ItemLocationPropItem</name>
|
||||
@ -1249,7 +1280,7 @@ p, li { white-space: pre-wrap; }
|
||||
</message>
|
||||
<message>
|
||||
<source>Translate properties</source>
|
||||
<translation>Переводить имена свойств</translation>
|
||||
<translation>Свойства перевода</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@ -1329,10 +1360,6 @@ p, li { white-space: pre-wrap; }
|
||||
<source>Report</source>
|
||||
<translation>Отчет</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>toolBar</source>
|
||||
<translation>Панель инструментов</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Print</source>
|
||||
<translation>Печать</translation>
|
||||
@ -1433,10 +1460,6 @@ p, li { white-space: pre-wrap; }
|
||||
<source>Show toolbar</source>
|
||||
<translation>Показать панель инструментов</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>toolBar_2</source>
|
||||
<translation>Редактирование</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>InsertTextItem</source>
|
||||
<translation>Вставить текстовый элемент</translation>
|
||||
@ -1457,6 +1480,14 @@ p, li { white-space: pre-wrap; }
|
||||
<source>Del</source>
|
||||
<translation>Удалить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MainToolBar</source>
|
||||
<translation>Основная панель инструментов</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>EditModeTools</source>
|
||||
<translation>Панель инструментов редактирования</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>LimeReport::ProxyHolder</name>
|
||||
@ -1881,7 +1912,7 @@ p, li { white-space: pre-wrap; }
|
||||
</message>
|
||||
<message>
|
||||
<source>setPageSizeToPrinter</source>
|
||||
<translation>Отправить параметры страницы в принтер</translation>
|
||||
<translation>Оправитьпараметры страницы в принтер</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>fillInSecondPass</source>
|
||||
@ -1961,11 +1992,11 @@ p, li { white-space: pre-wrap; }
|
||||
</message>
|
||||
<message>
|
||||
<source>option3</source>
|
||||
<translation></translation>
|
||||
<translation>Опция 3</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>units</source>
|
||||
<translation>Единицы измерения</translation>
|
||||
<translation>Еденицы измерения</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>geometryLocked</source>
|
||||
@ -1973,7 +2004,7 @@ p, li { white-space: pre-wrap; }
|
||||
</message>
|
||||
<message>
|
||||
<source>printBehavior</source>
|
||||
<translation>Режим печати</translation>
|
||||
<translation>Поведение при печати</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@ -2301,15 +2332,15 @@ p, li { white-space: pre-wrap; }
|
||||
</message>
|
||||
<message>
|
||||
<source>Lock selected items</source>
|
||||
<translation>Заблокировать выбранные элементы</translation>
|
||||
<translation>Заблокировать выделенные элементы</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unlock selected items</source>
|
||||
<translation>Разблокировать выбранные элементы</translation>
|
||||
<translation>Разблокировать выделенные элементы</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Select one level items</source>
|
||||
<translation>Выбрать все элементы одного уровня</translation>
|
||||
<translation>Выделить элементы одного уровня</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@ -2482,7 +2513,7 @@ This preview is no longer valid.</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>CSV</source>
|
||||
<translation></translation>
|
||||
<translation>CSV</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Separator</source>
|
||||
@ -2494,7 +2525,7 @@ This preview is no longer valid.</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>Use first row as header</source>
|
||||
<translation>Первая строка как заголовок</translation>
|
||||
<translation>Использовать первую строку в качестве заголовка</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@ -2729,7 +2760,7 @@ This preview is no longer valid.</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>Report units</source>
|
||||
<translation>Единицы измерения</translation>
|
||||
<translation>Еденицы измерения</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@ -3146,18 +3177,18 @@ This preview is no longer valid.</source>
|
||||
<source>Export to PDF</source>
|
||||
<translation>Экспортировать в PDF</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Dark</source>
|
||||
<translation>Темная</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Light</source>
|
||||
<translation>Светаля</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Default</source>
|
||||
<translation>По умолчанию</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>margin</source>
|
||||
<translation>Поля</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>''</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Millimeters</source>
|
||||
<translation>Миллиметры</translation>
|
||||
@ -3167,12 +3198,12 @@ This preview is no longer valid.</source>
|
||||
<translation>Дюймы</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Dark</source>
|
||||
<translation>Темная</translation>
|
||||
<source>margin</source>
|
||||
<translation>Поля</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Light</source>
|
||||
<translation>Светлая</translation>
|
||||
<source>''</source>
|
||||
<translation>''</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
Loading…
Reference in New Issue
Block a user