0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-23 16:22:58 +03:00
# Conflicts:
#	3rdparty/zint-2.4.4/backend_qt4/Zint.pro
#	demo_r1/demo_r1.pro
#	demo_r2/demo_r2.pro
#	designer/designer.pro
#	translations/limereport_ru.ts
This commit is contained in:
arne krüger 2018-03-09 19:01:07 +01:00
commit 85f4fcf7ae
72 changed files with 9216 additions and 712 deletions

View File

@ -1,7 +1,15 @@
DEFINES += NO_PNG
TEMPLATE = lib
contains(CONFIG, static_build){
CONFIG += staticlib
DEFINES += HAVE_STATIC_BUILD
}
!contains(CONFIG, staticlib){
CONFIG += dll
DEFINES += QZINT_LIBRARY
}
include(../../../common.pri)
@ -18,8 +26,6 @@ unix{
INCLUDEPATH += $$PWD/../backend
DEFINES += _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS ZINT_VERSION=\\\"$$VERSION\\\"
DEFINES += QZINT_LIBRARY
#TARGET = QtZint
CONFIG(debug, debug|release) {
TARGET = QtZintd

View File

@ -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

View File

@ -1,5 +1,13 @@
CONFIG += build_translations
CONFIG += zint
!contains(CONFIG, no_zint){
CONFIG += zint
}
ZINT_PATH = $$PWD/3rdparty/zint-2.4.4
contains(CONFIG,zint){
DEFINES += HAVE_ZINT
}
greaterThan(QT_MAJOR_VERSION, 4) {
QT += uitools
@ -8,8 +16,6 @@ lessThan(QT_MAJOR_VERSION, 5){
CONFIG += uitools
}
ZINT_PATH = $$PWD/3rdparty/zint-2.4.4
CONFIG(release, debug|release){
message(Release)
BUILD_TYPE = release
@ -56,7 +62,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
LIMEREPORT_VERSION_MAJOR = 1
LIMEREPORT_VERSION_MINOR = 4
LIMEREPORT_VERSION_RELEASE = 8
LIMEREPORT_VERSION_RELEASE = 63
LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"'
DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\"
@ -82,3 +88,5 @@ lessThan(QT_MAJOR_VERSION, 5){
DEFINES += HAVE_UI_LOADER
}
}

View File

@ -33,27 +33,30 @@ unix:{
LIBS += -llimereport
}
contains(CONFIG,zint){
LIBS += -L$${DEST_LIBS}
!contains(CONFIG, static_build){
contains(CONFIG,zint){
LIBS += -L$${DEST_LIBS}
CONFIG(debug, debug|release) {
LIBS += -lQtZintd
} else {
LIBS += -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
CONFIG(debug, debug|release) {
LIBS += -lQtZintd
} else {
LIBS += -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 {
@ -65,20 +68,24 @@ win32 {
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$${DEST_LIBS}
CONFIG(debug, debug|release) {
LIBS += -lQtZintd
} else {
LIBS += -lQtZint
}
!contains(CONFIG, static_build){
contains(CONFIG,zint){
LIBS += -L$${DEST_LIBS}
CONFIG(debug, debug|release) {
LIBS += -lQtZintd
} else {
LIBS += -lQtZint
}
}
}
LIBS += -L$${DEST_LIBS}
CONFIG(debug, debug|release) {
LIBS += -llimereportd
} else {
LIBS += -llimereport
}
CONFIG(debug, debug|release) {
LIBS += -llimereportd
} else {
LIBS += -llimereport
}
}

View File

@ -32,23 +32,25 @@ unix:{
} else {
LIBS += -llimereport
}
contains(CONFIG,zint){
LIBS += -L$${DEST_LIBS}
CONFIG(debug, debug|release) {
LIBS += -lQtZintd
} else {
LIBS += -lQtZint
}
}
!contains(CONFIG, static_build){
contains(CONFIG,zint){
LIBS += -L$${DEST_LIBS}
CONFIG(debug, debug|release) {
LIBS += -lQtZintd
} else {
LIBS += -lQtZint
}
}
}
DESTDIR = $$DEST_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
}
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
}
@ -60,22 +62,24 @@ win32 {
DESTDIR = $$DEST_DIR
RC_FILE += mainicon.rc
contains(CONFIG,zint){
LIBS += -L$${DEST_LIBS}
CONFIG(debug, debug|release) {
LIBS += -lQtZintd
} else {
LIBS += -lQtZint
}
}
!contains(CONFIG, static_build){
contains(CONFIG,zint){
LIBS += -L$${DEST_LIBS}
CONFIG(debug, debug|release) {
LIBS += -lQtZintd
} else {
LIBS += -lQtZint
}
}
}
LIBS += -L$${DEST_LIBS}
CONFIG(debug, debug|release) {
CONFIG(debug, debug|release) {
LIBS += -llimereportd
} else {
LIBS += -llimereport
}
QMAKE_POST_LINK += $$QMAKE_COPY_DIR \"$$EXTRA_DIR\" \"$$REPORTS_DIR\\demo_reports\" $$escape_expand(\\n\\t)
}

View File

@ -23,14 +23,16 @@ unix:{
} else {
LIBS += -llimereport
}
contains(CONFIG,zint){
LIBS += -L$${DEST_LIBS}
CONFIG(debug, debug|release) {
LIBS += -lQtZintd
} else {
LIBS += -lQtZint
}
}
!contains(CONFIG, static_build){
contains(CONFIG,zint){
LIBS += -L$${DEST_LIBS}
CONFIG(debug, debug|release) {
LIBS += -lQtZintd
} else {
LIBS += -lQtZint
}
}
}
DESTDIR = $$DEST_DIR
linux{
#Link share lib to ../lib rpath
@ -50,15 +52,17 @@ win32 {
DESTDIR = $$DEST_DIR
RC_FILE += mainicon.rc
contains(CONFIG,zint){
LIBS += -L$${DEST_LIBS}
CONFIG(debug, debug|release) {
LIBS += -lQtZintd
} else {
LIBS += -lQtZint
}
!contains(CONFIG, static_build){
contains(CONFIG,zint){
LIBS += -L$${DEST_LIBS}
CONFIG(debug, debug|release) {
LIBS += -lQtZintd
} else {
LIBS += -lQtZint
}
}
}
LIBS += -L$${DEST_LIBS}
CONFIG(debug, debug|release) {
LIBS += -llimereportd

View File

@ -1,9 +1,21 @@
#include <QApplication>
#include <LimeReport>
#include <QTranslator>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTranslator limeReportTranslator;
QString translationPath = QApplication::applicationDirPath();
translationPath.append("/languages");
limeReportTranslator.load("limereport_"+QLocale::system().name(),translationPath);
a.installTranslator(&limeReportTranslator);
QTranslator qtTranslator;
qtTranslator.load("qt_" + QLocale::system().name(),translationPath);
a.installTranslator(&qtTranslator);
LimeReport::ReportEngine report;
if (a.arguments().count()>1){
report.loadFromFile(a.arguments().at(1));

View File

@ -27,8 +27,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
****************************************************************************/
#ifndef GLOBAL_H
#define GLOBAL_H
#ifndef LRGLOBAL_H
#define LRGLOBAL_H
#include "qglobal.h"
#include <stdexcept>
#include <QString>
@ -76,6 +76,7 @@ namespace Const{
const qreal SELECTION_OPACITY = 0.3;
const QString FIELD_RX = "\\$D\\s*\\{\\s*([^{}]*)\\s*\\}";
const QString VARIABLE_RX = "\\$V\\s*\\{\\s*([^{}]*)\\s*\\}";
const QString NAMED_VARIABLE_RX = "\\$V\\s*\\{\\s*(%1)\\s*\\}";
const QString SCRIPT_RX = "\\$S\\s*\\{(.*)\\}";
//const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(((?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))(\\w+\\.?\\w+)((?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,\\s*\\\"(\\w+)\\\"\\s*\\)";
@ -84,7 +85,8 @@ namespace Const{
//const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:((?:(?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"?\\$S\\s*\\{\\s*)|(?:\\\"))((?:\\w+\\.?\\w+)|(?:\\w+))(?:(?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,)|(?:))\\s*\\\"(\\w+)\\\"\\s*\\)";
//const QString GROUP_FUNCTION_PARAM_RX = "\\((?:(.+),(.+))|(?:\\\"(\\w+)\\\")\\)";
const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:(?:(?:\\\")|(?:))(\\w+)(?:(?:\\\")|(?:)))|(?:(?:(?:\\\")|(?:))(\\s*\\$\\w\\s*\\{.+\\}\\s*)(?:(?:\\\")|(?:))\\s*,\\s*(?:(?:\\\")|(?:))(\\w+)(?:(?:\\\")|(?:))))\\)";
//const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:(?:(?:\\\")|(?:))(\\w+)(?:(?:\\\")|(?:)))|(?:(?:(?:\\\")|(?:))(\\s*\\$\\w\\s*\\{.+\\}\\s*)(?:(?:\\\")|(?:))\\s*,\\s*(?:(?:\\\")|(?:))(\\w+)(?:(?:\\\")|(?:))))\\)";
const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*((?:(?:\\\")|(?:))(?:(?:\\$(?:(?:D\\{\\s*\\w*.\\w*\\s*\\})|(?:V\\{\\s*\\w*\\s*\\})|(?:S\\{.+\\})))|(?:\\w*))(?:(?:\\\")|(?:)))(?:(?:\\s*,\\s*(?:\\\"(\\w*)\\\"))|(?:))\\)";
const int DATASOURCE_INDEX = 3;//4;
const int VALUE_INDEX = 2; //2;
const int EXPRESSION_ARGUMENT_INDEX = 1;//3;

View File

@ -102,6 +102,8 @@ public:
bool resultIsEditable();
bool isBusy();
void setPassPharse(QString& passPharse);
Qt::LayoutDirection previewLayoutDirection();
void setPreviewLayoutDirection(const Qt::LayoutDirection& previewLayoutDirection);
signals:
void renderStarted();
void renderFinished();

View File

@ -1,9 +1,15 @@
TEMPLATE = subdirs
!contains(CONFIG, no_zint){
CONFIG += zint
}
include(common.pri)
contains(CONFIG, zint){
SUBDIRS += 3rdparty
}
export($$CONFIG)
SUBDIRS += \
limereport

View File

@ -151,10 +151,11 @@ bool GroupBandHeader::isNeedToClose(DataSourceManager* dataManager)
IDataSource* ds = dataManager->dataSource(datasourceName);
if (ds){
if (ds->data(m_groupFiledName).isNull() && m_groupFieldValue.isNull()) return false;
if (!ds->data(m_groupFiledName).isValid()) return false;
return ds->data(m_groupFiledName)!=m_groupFieldValue;
}
} else {
dataManager->putError(tr("Datasource \"%1\" not found !!!").arg(datasourceName));
dataManager->putError(tr("Datasource \"%1\" not found!").arg(datasourceName));
}
}

View File

@ -46,6 +46,7 @@ class SubDetailBand : public DataBandDesignIntf
public:
SubDetailBand(QObject* owner = 0, QGraphicsItem* parent=0);
bool isUnique() const {return false;}
int bandNestingLevel(){ return 1;}
bool isHasHeader() const;
bool isHasFooter() const;
private:
@ -63,6 +64,8 @@ class SubDetailHeaderBand : public BandDesignIntf
public:
SubDetailHeaderBand(QObject* owner = 0, QGraphicsItem* parent=0);
bool isUnique() const;
bool isHeader() const {return true;}
int bandNestingLevel(){ return 1;}
protected:
QColor bandColor() const;
private:
@ -79,6 +82,7 @@ public:
SubDetailFooterBand(QObject* owner = 0, QGraphicsItem* parent=0);
virtual bool isUnique() const;
bool isFooter() const{return true;}
int bandNestingLevel(){ return 1;}
protected:
QColor bandColor() const;
private:

View File

@ -1,5 +1,5 @@
#ifndef TEAROFFBAND_H
#define TEAROFFBAND_H
#ifndef LRTEAROFFBAND_H
#define LRTEAROFFBAND_H
#include "lrbanddesignintf.h"
namespace LimeReport {

View File

@ -95,7 +95,7 @@ void ConnectionDialog::checkFieldsFill()
{
if (ui->leConnectionName->text().isEmpty()){throw LimeReport::ReportError(tr("Connection Name is empty"));}
if (!m_changeMode&&QSqlDatabase::connectionNames().contains(ui->leConnectionName->text())) {
throw LimeReport::ReportError(tr("Connection with name ")+ui->leConnectionName->text()+tr(" already exists "));
throw LimeReport::ReportError(tr("Connection with name ")+ui->leConnectionName->text()+tr(" already exists! "));
}
}
@ -117,6 +117,8 @@ ConnectionDesc *ConnectionDialog::uiToConnection(LimeReport::ConnectionDesc* con
result = new LimeReport::ConnectionDesc();
result ->setName(ConnectionDesc::connectionNameForReport(ui->leConnectionName->text()));
result ->setHost(ui->leServerName->text());
if (!ui->lePort->text().isEmpty())
result->setPort(ui->lePort->text().toInt());
result ->setDriver(ui->cbbDrivers->currentText());
result ->setUserName(ui->leUserName->text());
result ->setPassword(ui->lePassword->text());
@ -139,6 +141,7 @@ void ConnectionDialog::connectionToUI()
ui->cbbDrivers->setCurrentIndex(ui->cbbDrivers->findText(m_connection->driver()));
ui->cbAutoConnect->setChecked(m_connection->autoconnect());
ui->cbbKeepCredentials->setChecked(!m_connection->keepDBCredentials());
ui->lePort->setText(m_connection->port()!=-1?QString::number(m_connection->port()):"");
}
void ConnectionDialog::on_toolButton_clicked()

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>420</width>
<height>294</height>
<height>323</height>
</rect>
</property>
<property name="windowTitle">
@ -17,7 +17,7 @@
<iconset resource="lrdatabrowser.qrc">
<normaloff>:/databrowser/images/database_disconnected</normaloff>:/databrowser/images/database_disconnected</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
@ -44,88 +44,106 @@
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="lbDriver">
<property name="text">
<string>Driver</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="cbbDrivers"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbServer">
<property name="text">
<string>Server </string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="leServerName">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbUser">
<property name="text">
<string>User</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="leUserName">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lbPassword">
<property name="text">
<string>Password</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lePassword">
<property name="text">
<string/>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="lbDatabase">
<property name="text">
<string>Database</string>
</property>
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>2</number>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLineEdit" name="leDataBase">
<widget class="QLabel" name="lbDriver">
<property name="text">
<string>Driver</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbServer">
<property name="text">
<string>Server </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Port</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbUser">
<property name="text">
<string>User</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbPassword">
<property name="text">
<string>Password</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbDatabase">
<property name="text">
<string>Database</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QComboBox" name="cbbDrivers"/>
</item>
<item>
<widget class="QLineEdit" name="leServerName">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton">
<widget class="QLineEdit" name="lePort"/>
</item>
<item>
<widget class="QLineEdit" name="leUserName">
<property name="text">
<string>...</string>
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lePassword">
<property name="text">
<string/>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QLineEdit" name="leDataBase">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>

View File

@ -131,7 +131,7 @@ void DataBrowser::slotDeleteConnection()
QMessageBox::critical(
this,
tr("Attention"),
tr("Do you really want to delete \"%1\" connection ?").arg(getConnectionName(NameForUser)),
tr("Do you really want to delete \"%1\" connection?").arg(getConnectionName(NameForUser)),
QMessageBox::Ok|QMessageBox::No,
QMessageBox::No
) == QMessageBox::Ok
@ -395,7 +395,7 @@ void DataBrowser::slotDeleteDatasource()
QMessageBox::critical(
this,
tr("Attention"),
tr("Do you really want to delete \"%1\" datasource ?").arg(datasourceName),
tr("Do you really want to delete \"%1\" datasource?").arg(datasourceName),
QMessageBox::Ok|QMessageBox::No,
QMessageBox::No
) == QMessageBox::Ok
@ -702,7 +702,7 @@ void DataBrowser::on_dataTree_currentItemChanged(QTreeWidgetItem *current, QTree
Q_UNUSED(previous)
if (current&&(current->type() == DataBrowserTree::Connection)) {
bool internalConnection = m_report->dataManager()->connectionByName(ConnectionDesc::connectionNameForReport(current->text(0)));
if (m_report->dataManager()->isConnectionConnected(current->text(0))){
if (m_report->dataManager()->isConnectionConnected(ConnectionDesc::connectionNameForReport(current->text(0)))){
ui->pbConnect->setIcon(QIcon(":/databrowser/images/plug-connect.png"));
} else {
ui->pbConnect->setIcon(QIcon(":/databrowser/images/plug-disconnect.png"));
@ -766,7 +766,7 @@ void DataBrowser::on_deleteVariable_clicked()
{
QString varName = getVariable();
if (!varName.isEmpty()){
if (QMessageBox::critical(this,tr("Attention"),QString(tr("Do you really want to delete variable \"%1\" ?")).arg(varName),
if (QMessageBox::critical(this,tr("Attention"),QString(tr("Do you really want to delete variable \"%1\"?")).arg(varName),
QMessageBox::Ok|QMessageBox::Cancel, QMessageBox::Cancel
)==QMessageBox::Ok){
m_report->dataManager()->deleteVariable(varName);

View File

@ -147,11 +147,11 @@ void SQLEditDialog::hideEvent(QHideEvent *)
void SQLEditDialog::check()
{
if (ui->leDatasourceName->text().isEmpty()) throw LimeReport::ReportError(tr("Datasource Name is empty !"));
if (ui->textEditSQL->toPlainText().isEmpty() && (!ui->rbProxy) ) throw LimeReport::ReportError(tr("SQL is empty !"));
if (ui->leDatasourceName->text().isEmpty()) throw LimeReport::ReportError(tr("Datasource Name is empty!"));
if (ui->textEditSQL->toPlainText().isEmpty() && (!ui->rbProxy) ) throw LimeReport::ReportError(tr("SQL is empty!"));
if (m_dialogMode==AddMode){
if (m_datasources->containsDatasource(ui->leDatasourceName->text())){
throw LimeReport::ReportError(QString(tr("Datasource with name: \"%1\" already exists !")).arg(ui->leDatasourceName->text()));
throw LimeReport::ReportError(QString(tr("Datasource with name: \"%1\" already exists!")).arg(ui->leDatasourceName->text()));
}
}
}

View File

@ -63,7 +63,7 @@ bool lessThen(BaseDesignIntf *c1, BaseDesignIntf* c2){
HorizontalLayout::HorizontalLayout(QObject *owner, QGraphicsItem *parent)
: LayoutDesignIntf(xmlTag, owner, parent),m_isRelocating(false),m_layoutType(Layout)
{
setPossibleResizeDirectionFlags(ResizeBottom);
setPossibleResizeDirectionFlags(AllDirections);
m_layoutMarker = new LayoutMarker(this);
m_layoutMarker->setParentItem(this);
m_layoutMarker->setColor(Qt::red);
@ -86,6 +86,7 @@ BaseDesignIntf *HorizontalLayout::createSameTypeItem(QObject *owner, QGraphicsIt
void HorizontalLayout::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event)
LayoutDesignIntf::hoverEnterEvent(event);
// if ((itemMode() & LayoutEditMode) || isSelected()){
// setChildVisibility(false);
// }
@ -94,6 +95,7 @@ void HorizontalLayout::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
void HorizontalLayout::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event)
LayoutDesignIntf::hoverLeaveEvent(event);
// setChildVisibility(true);
}
@ -101,7 +103,7 @@ void HorizontalLayout::geometryChangedEvent(QRectF newRect, QRectF )
{
m_layoutMarker->setHeight(newRect.height());
relocateChildren();
if (m_layoutType == Table && !m_isRelocating){
if (/*m_layoutType == Table && */!m_isRelocating){
divideSpace();
}
}
@ -203,6 +205,36 @@ void HorizontalLayout::setBorderLinesFlags(BaseDesignIntf::BorderLines flags)
relocateChildren();
}
QVariant HorizontalLayout::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant& value)
{
if (change == QGraphicsItem::ItemSelectedHasChanged){
m_isRelocating = true;
foreach(BaseDesignIntf* item, m_children){
item->setVisible(!value.toBool());
}
m_isRelocating = false;
}
return LayoutDesignIntf::itemChange(change, value);
}
void HorizontalLayout::paint(QPainter* ppainter, const QStyleOptionGraphicsItem* option, QWidget* widget)
{
if (isSelected()){
foreach( BaseDesignIntf* item, m_children){
ppainter->save();
ppainter->setPen(Qt::red);
ppainter->drawRect(
QRectF(item->pos().x(),item->pos().y(),
item->rect().bottomRight().rx(),
item->rect().bottomRight().ry()
)
);
ppainter->restore();
}
}
LayoutDesignIntf::paint(ppainter, option, widget);
}
void HorizontalLayout::restoreChild(BaseDesignIntf* item){
if (m_children.contains(item)) return;
@ -257,9 +289,22 @@ void HorizontalLayout::addChild(BaseDesignIntf *item, bool updateSize)
item->setFixedPos(true);
item->setPossibleResizeDirectionFlags(ResizeRight | ResizeBottom);
connect(item,SIGNAL(destroyed(QObject*)),this,SLOT(slotOnChildDestroy(QObject*)));
connect(item,SIGNAL(geometryChanged(QObject*,QRectF,QRectF)),this,SLOT(slotOnChildGeometryChanged(QObject*,QRectF,QRectF)));
connect(item, SIGNAL(itemVisibleHasChanged(BaseDesignIntf*)),this,SLOT(slotOnChildVisibleHasChanged(BaseDesignIntf*)));
connect(
item, SIGNAL(destroyed(QObject*)),
this, SLOT(slotOnChildDestroy(QObject*))
);
connect(
item,SIGNAL(geometryChanged(QObject*,QRectF,QRectF)),
this,SLOT(slotOnChildGeometryChanged(QObject*,QRectF,QRectF))
);
connect(
item, SIGNAL(itemVisibleHasChanged(BaseDesignIntf*)),
this,SLOT(slotOnChildVisibleHasChanged(BaseDesignIntf*))
);
connect(
item, SIGNAL(itemSelectedHasBeenChanged(BaseDesignIntf*,bool)),
this, SLOT(slotOnChildSelectionHasChanged(BaseDesignIntf*,bool))
);
if (updateSize){
relocateChildren();
@ -292,7 +337,8 @@ void HorizontalLayout::objectLoadFinished()
void HorizontalLayout::updateLayoutSize()
{
int w = ((borderLines() != 0) ? borderLineSize() : 0)*2;
int spaceBorder = (borderLines() != 0) ? borderLineSize() : 0;
int w = spaceBorder*2;
qreal h = 0;
foreach(BaseDesignIntf* item, m_children){
if (item->isVisible()){
@ -300,7 +346,7 @@ void HorizontalLayout::updateLayoutSize()
w+=item->width();
}
}
if (h>0) setHeight(h);
if (h>0) setHeight(h+spaceBorder*2);
setWidth(w);
}
@ -317,7 +363,7 @@ void HorizontalLayout::relocateChildren()
qreal curX = spaceBorder;
m_isRelocating = true;
foreach (BaseDesignIntf* item, m_children) {
if (item->isVisible()){
if (item->isVisible() || itemMode() == DesignMode){
item->setPos(curX,spaceBorder);
curX+=item->width();
item->setHeight(height()-(spaceBorder * 2));
@ -418,14 +464,23 @@ BaseDesignIntf* HorizontalLayout::findPrior(BaseDesignIntf* item){
void HorizontalLayout::divideSpace(){
m_isRelocating = true;
qreal itemsSumSize = 0;
int visibleItemsCount = 0;
int spaceBorder = (borderLines() != 0) ? borderLineSize() : 0;
foreach(BaseDesignIntf* item, m_children){
itemsSumSize += item->width();
if (item->isVisible() || itemMode() == DesignMode ){
itemsSumSize += item->width();
visibleItemsCount++;
}
}
qreal delta = (width() - itemsSumSize)/m_children.size();
qreal delta = (width() - (itemsSumSize+spaceBorder*2)) / (visibleItemsCount!=0 ? visibleItemsCount : 1);
for (int i=0; i<m_children.size(); ++i){
m_children[i]->setWidth(m_children[i]->width()+(delta));
if (m_children[i]->isVisible() || itemMode() == DesignMode)
m_children[i]->setWidth(m_children[i]->width()+delta);
if ((i+1)<m_children.size())
m_children[i+1]->setPos(m_children[i+1]->pos().x()+delta*(i+1),m_children[i+1]->pos().y());
if (m_children[i+1]->isVisible() || itemMode() == DesignMode)
m_children[i+1]->setPos(m_children[i+1]->pos().x()+delta*(i+1),m_children[i+1]->pos().y());
}
m_isRelocating = false;
}
@ -463,6 +518,11 @@ void HorizontalLayout::slotOnChildVisibleHasChanged(BaseDesignIntf *)
}
}
void HorizontalLayout::slotOnChildSelectionHasChanged(BaseDesignIntf* item, bool value)
{
item->setZValue(value ? item->zValue()+1 : item->zValue()-1);
}
HorizontalLayout::LayoutType HorizontalLayout::layoutType() const
{
return m_layoutType;

View File

@ -74,6 +74,7 @@ public:
bool isEmpty() const;
LayoutType layoutType() const;
void setLayoutType(const LayoutType &layoutType);
bool isSplittable() const { return true;}
protected:
void collectionLoadFinished(const QString &collectionName);
void objectLoadFinished();
@ -95,11 +96,15 @@ protected:
void setItemAlign(const ItemAlign &itemAlign);
void setBorderLinesFlags(BorderLines flags);
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
void paint(QPainter* ppainter, const QStyleOptionGraphicsItem* option, QWidget* widget);
private slots:
void slotOnChildDestroy(QObject *child);
void slotOnChildGeometryChanged(QObject*item, QRectF newGeometry, QRectF oldGeometry);
void slotOnChildItemAlignChanged(BaseDesignIntf* item, const ItemAlign&, const ItemAlign&);
void slotOnChildVisibleHasChanged(BaseDesignIntf*);
void slotOnChildSelectionHasChanged(BaseDesignIntf* item, bool value);
//void slotOnPosChanged(QObject*, QPointF newPos, QPointF );
private:
void divideSpace();

View File

@ -47,7 +47,7 @@ bool VARIABLE_IS_NOT_USED registred = LimeReport::DesignElementsFactory::instanc
namespace LimeReport{
ImageItem::ImageItem(QObject* owner,QGraphicsItem* parent)
:ItemDesignIntf(xmlTag,owner,parent),m_autoSize(false), m_scale(true), m_keepAspectRatio(true), m_center(true){}
:ItemDesignIntf(xmlTag,owner,parent),m_autoSize(false), m_scale(true), m_keepAspectRatio(true), m_center(true), m_format(Binary){}
BaseDesignIntf *ImageItem::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
{
@ -65,8 +65,21 @@ void ImageItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass,
if (data.isValid()){
if (data.type()==QVariant::Image){
m_picture = data.value<QImage>();
} else
m_picture.loadFromData(data.toByteArray());
} else {
switch (m_format) {
default:
case Binary:
m_picture.loadFromData(data.toByteArray());
break;
case Hex:
m_picture.loadFromData(QByteArray::fromHex(data.toByteArray()));
break;
case Base64:
m_picture.loadFromData(QByteArray::fromBase64(data.toByteArray()));
break;
}
}
}
}
} else if (!m_resourcePath.isEmpty()){
@ -267,6 +280,19 @@ void ImageItem::setImage(QImage value)
}
}
ImageItem::Format ImageItem::format() const
{
return m_format;
}
void ImageItem::setFormat(Format format)
{
if (m_format!=format){
Format oldValue = m_format;
m_format=format;
update();
notify("format",oldValue,format);
}
}
}

View File

@ -36,16 +36,24 @@ namespace LimeReport{
class ImageItem : public LimeReport::ItemDesignIntf
{
Q_OBJECT
Q_ENUMS(Format)
Q_PROPERTY(QImage image READ image WRITE setImage)
Q_PROPERTY(int opacity READ opacity WRITE setOpacity)
Q_PROPERTY(QString datasource READ datasource WRITE setDatasource)
Q_PROPERTY(QString field READ field WRITE setField)
Q_PROPERTY(Format format READ format WRITE setFormat)
Q_PROPERTY(bool autoSize READ autoSize WRITE setAutoSize)
Q_PROPERTY(bool scale READ scale WRITE setScale)
Q_PROPERTY(bool keepAspectRatio READ keepAspectRatio WRITE setKeepAspectRatio)
Q_PROPERTY(bool center READ center WRITE setCenter)
Q_PROPERTY(QString resourcePath READ resourcePath WRITE setResourcePath)
public:
enum Format {
Binary = 0,
Hex = 1,
Base64 = 2
};
ImageItem(QObject *owner, QGraphicsItem *parent);
virtual void paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void setImage(QImage value);
@ -65,6 +73,8 @@ public:
void setKeepAspectRatio(bool keepAspectRatio);
bool center() const;
void setCenter(bool center);
Format format() const;
void setFormat(Format format);
qreal minHeight() const;
@ -82,6 +92,7 @@ private:
bool m_scale;
bool m_keepAspectRatio;
bool m_center;
Format m_format;
};
}

View File

@ -48,8 +48,8 @@ namespace{
LimeReport::ItemLocationPropItem::ItemLocationPropItem(QObject* object, ObjectsList* objects, const QString &name, const QString &displayName, const QVariant &value, ObjectPropItem* parent, bool readonly)
:LimeReport::ObjectPropItem(object, objects, name, displayName, value, parent, readonly){
m_locationMap.insert("Band",LimeReport::ItemDesignIntf::Band);
m_locationMap.insert("Page",LimeReport::ItemDesignIntf::Page);
m_locationMap.insert(tr("Band"),LimeReport::ItemDesignIntf::Band);
m_locationMap.insert(tr("Page"),LimeReport::ItemDesignIntf::Page);
}

View File

@ -113,16 +113,16 @@ void TextItem::processPopUpAction(QAction *action)
this->showEditorDialog();
}
if (action->text().compare(tr("Auto height")) == 0){
setProperty("autoHeight",action->isChecked());
page()->setPropertyToSelectedItems("autoHeight",action->isChecked());
}
if (action->text().compare(tr("Allow HTML")) == 0){
setProperty("allowHTML",action->isChecked());
page()->setPropertyToSelectedItems("allowHTML",action->isChecked());
}
if (action->text().compare(tr("Allow HTML in fields")) == 0){
setProperty("allowHTMLInFields",action->isChecked());
page()->setPropertyToSelectedItems("allowHTMLInFields",action->isChecked());
}
if (action->text().compare(tr("Stretch to max height")) == 0){
setProperty("stretchToMaxHeight",action->isChecked());
page()->setPropertyToSelectedItems("stretchToMaxHeight",action->isChecked());
}
}
@ -576,7 +576,7 @@ void TextItem::setFollowTo(const QString &followTo)
QMessageBox::critical(
0,
tr("Error"),
tr("TextItem \" %1 \" not found !")
tr("TextItem \" %1 \" not found!")
.arg(m_followTo)
);
notify("followTo",followTo,"");
@ -777,46 +777,48 @@ bool TextItem::canBeSplitted(int height) const
return height > m_firstLineSize;
}
QString TextItem::getTextPart(int height, int skipHeight){
int linesHeight = 0;
QString TextItem::extractText(QTextBlock& curBlock, int height){
int curLine = 0;
int textPos = 0;
int linesHeight = 0;
QString resultText;
for (;curBlock != curBlock.document()->end() || curLine<=curBlock.lineCount(); curBlock = curBlock.next(), curLine = 0, resultText += '\n' ){
linesHeight+=curBlock.blockFormat().topMargin();
for (;curLine < curBlock.layout()->lineCount(); curLine++){
linesHeight += curBlock.layout()->lineAt(curLine).height() + lineSpacing();
if (height > 0 && linesHeight > (height-borderLineSize() * 2)) {goto loop_exit;}
resultText += curBlock.text().mid(curBlock.layout()->lineAt(curLine).textStart(),
curBlock.layout()->lineAt(curLine).textLength());
}
}
loop_exit: return resultText;
}
TextPtr text = textDocument();
QString TextItem::getTextPart(int height, int skipHeight){
QTextBlock curBlock = text->begin();
QString resultText = "";
TextPtr text = textDocument();
text->size().height();
QTextBlock curBlock = text->begin();
QTextCursor cursor(text.data());
cursor.movePosition(QTextCursor::Start);
if (skipHeight > 0){
for (;curBlock != text->end(); curBlock=curBlock.next()){
for (curLine = 0; curLine < curBlock.layout()->lineCount(); curLine++){
linesHeight += curBlock.layout()->lineAt(curLine).height() + lineSpacing();
if (linesHeight > (skipHeight-(/*fakeMarginSize()*2+*/borderLineSize() * 2))) {goto loop_exit;}
}
}
loop_exit:;
resultText = extractText(curBlock, skipHeight);
cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, resultText.length());
}
linesHeight = 0;
resultText = extractText(curBlock, height);
cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, resultText.length());
for (;curBlock != text->end() || curLine<curBlock.lineCount(); curBlock = curBlock.next(), curLine = 0, resultText += '\n'){
for (; curLine<curBlock.layout()->lineCount(); curLine++){
if (resultText == "") textPos= curBlock.layout()->lineAt(curLine).textStart();
linesHeight += curBlock.layout()->lineAt(curLine).height() + lineSpacing();
if ( (height>0) && (linesHeight>(height-(/*fakeMarginSize()*2+*/borderLineSize()*2))) ) {
linesHeight-=curBlock.layout()->lineAt(curLine).height();
goto loop_exit1;
}
resultText+=curBlock.text().mid(curBlock.layout()->lineAt(curLine).textStart(),
curBlock.layout()->lineAt(curLine).textLength());
}
if (allowHTML()){
resultText = cursor.selection().toHtml();
resultText.remove("<!--StartFragment-->");
resultText.remove("<!--EndFragment-->");
} else {
resultText = cursor.selection().toPlainText();
}
loop_exit1:;
resultText.chop(1);
QScopedPointer<HtmlContext> context(new HtmlContext(m_strText));
return context->extendTextByTags(resultText,textPos);
return resultText;
}
void TextItem::restoreLinksEvent()

View File

@ -181,7 +181,7 @@ private:
QString formatDateTime(const QDateTime &value);
QString formatNumber(const double value);
QString formatFieldValue();
QString extractText(QTextBlock& curBlock, int height);
TextPtr textDocument() const;
private:
QString m_strText;
@ -208,6 +208,7 @@ private:
TextItem* m_follower;
qreal m_textIndent;
Qt::LayoutDirection m_textLayoutDirection;
};
}

View File

@ -91,6 +91,10 @@ SOURCES += \
$$REPORT_PATH/lrsettingdialog.cpp \
$$REPORT_PATH/scriptbrowser/lrscriptbrowser.cpp \
$$REPORT_PATH/lritemscontainerdesignitf.cpp
contains(CONFIG, staticlib){
SOURCES += $$REPORT_PATH/lrfactoryinitializer.cpp
}
contains(CONFIG, zint){
SOURCES += $$REPORT_PATH/items/lrbarcodeitem.cpp
@ -159,6 +163,7 @@ HEADERS += \
$$REPORT_PATH/items/lrshapeitem.h \
$$REPORT_PATH/items/lrimageitem.h \
$$REPORT_PATH/items/lrsimpletagparser.h \
$$REPORT_PATH/lrfactoryinitializer.h \
$$REPORT_PATH/lrbanddesignintf.h \
$$REPORT_PATH/lrpageitemdesignintf.h \
$$REPORT_PATH/lrbandsmanager.h \
@ -191,7 +196,11 @@ HEADERS += \
$$REPORT_PATH/lrpreviewreportwidget_p.h \
$$REPORT_PATH/scriptbrowser/lrscriptbrowser.h \
$$REPORT_PATH/lritemscontainerdesignitf.h
contains(CONFIG, staticlib){
HEADERS += $$REPORT_PATH/lrfactoryinitializer.h
}
contains(CONFIG,zint){
HEADERS += $$REPORT_PATH/items/lrbarcodeitem.h
}
@ -209,8 +218,6 @@ FORMS += \
$$REPORT_PATH/lrsettingdialog.ui \
$$REPORT_PATH/scriptbrowser/lrscriptbrowser.ui \
RESOURCES += \
$$REPORT_PATH/objectinspector/lobjectinspector.qrc \
$$REPORT_PATH/databrowser/lrdatabrowser.qrc \

View File

@ -10,8 +10,15 @@ CONFIG(debug, debug|release) {
TEMPLATE = lib
CONFIG += lib
CONFIG += dll
contains(CONFIG, static_build){
CONFIG += staticlib
}
!contains(CONFIG, staticlib){
CONFIG += lib
CONFIG += dll
}
CONFIG += create_prl
CONFIG += link_prl
@ -23,6 +30,12 @@ macx{
DEFINES += LIMEREPORT_EXPORTS
contains(CONFIG, staticlib){
DEFINES += HAVE_STATIC_BUILD
message(STATIC_BUILD)
DEFINES -= LIMEREPORT_EXPORTS
}
EXTRA_FILES += \
$$PWD/lrglobal.cpp \
$$PWD/lrglobal.h \
@ -83,7 +96,7 @@ contains(CONFIG,zint){
####Automatically build required translation files (*.qm)
contains(CONFIG,build_translations){
LANGUAGES = ru es_ES ar
LANGUAGES = ru es_ES ar fr zh
defineReplace(prependAll) {
for(a,$$1):result += $$2$${a}$$3

View File

@ -99,6 +99,11 @@ void BandMarker::mousePressEvent(QGraphicsSceneMouseEvent *event)
}
}
void BandMarker::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
m_band->contextMenuEvent(event);
}
BandDesignIntf::BandDesignIntf(BandsType bandType, const QString &xmlTypeName, QObject* owner, QGraphicsItem *parent) :
ItemsContainerDesignInft(xmlTypeName, owner,parent),
m_bandType(bandType),
@ -122,7 +127,8 @@ BandDesignIntf::BandDesignIntf(BandsType bandType, const QString &xmlTypeName, Q
m_startNewPage(false),
m_startFromNewPage(false),
m_printAlways(false),
m_repeatOnEachRow(false)
m_repeatOnEachRow(false),
m_bottomSpace()
{
setPossibleResizeDirectionFlags(ResizeBottom);
setPossibleMoveFlags(TopBotom);
@ -145,6 +151,8 @@ BandDesignIntf::BandDesignIntf(BandsType bandType, const QString &xmlTypeName, Q
m_bandNameLabel->setVisible(false);
if (scene()) scene()->addItem(m_bandNameLabel);
m_alternateBackgroundColor = backgroundColor();
connect(this, SIGNAL(propertyObjectNameChanged(QString, QString)),
this, SLOT(slotPropertyObjectNameChanged(const QString&,const QString&)));
}
BandDesignIntf::~BandDesignIntf()
@ -159,6 +167,21 @@ BandDesignIntf::~BandDesignIntf()
delete m_bandNameLabel;
}
int extractItemIndex(const BaseDesignIntf* item){
QString objectName = extractClassName(item->metaObject()->className());
QString value = item->objectName().right(item->objectName().size() - objectName.size());
return value.toInt();
}
QString BandDesignIntf::translateBandName(const BaseDesignIntf* item) const{
QString defaultBandName = extractClassName(item->metaObject()->className()).toLatin1()+QString::number(extractItemIndex(item));
if (item->objectName().compare(defaultBandName) == 0){
return tr(extractClassName(item->metaObject()->className()).toLatin1())+QString::number(extractItemIndex(item));
} else {
return item->objectName();
}
}
void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
@ -170,8 +193,7 @@ void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
if (itemMode() & DesignMode){
painter->save();
QString bandText = objectName();
if (parentBand()) bandText+=QLatin1String(" connected to ")+parentBand()->objectName();
QString bandText = bandTitle();
QFont font("Arial", 7 * Const::fontFACTOR, -1, true);
QFontMetrics fontMetrics(font);
@ -202,6 +224,23 @@ void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
BaseDesignIntf::paint(painter,option,widget);
}
void BandDesignIntf::translateBandsName()
{
tr("DataBand");
tr("DataHeaderBand");
tr("DataFooterBand");
tr("ReportHeader");
tr("ReportFooter");
tr("PageHeader");
tr("PageFooter");
tr("SubDetailBand");
tr("SubDetailHeaderBand");
tr("SubDetailFooterBand");
tr("GroupBandHeader");
tr("GroupBandFooter");
tr("TearOffBand");
}
BandDesignIntf::BandsType BandDesignIntf::bandType() const
{
return m_bandType;
@ -209,8 +248,8 @@ BandDesignIntf::BandsType BandDesignIntf::bandType() const
QString BandDesignIntf::bandTitle() const
{
QString result = objectName();
if (parentBand()) result +=tr(" connected to ")+parentBand()->objectName();
QString result = translateBandName(this);
if (parentBand()) result +=tr(" connected to ") + translateBandName(parentBand());
return result;
}
@ -229,9 +268,15 @@ void BandDesignIntf::setBandIndex(int value)
m_bandIndex=value;
}
void BandDesignIntf::changeBandIndex(int value)
void BandDesignIntf::changeBandIndex(int value, bool firstTime)
{
int indexOffset = value - m_bandIndex;
int indexOffset;
if (firstTime && bandHeader())
value += 1;
indexOffset = value - m_bandIndex;
foreach(BandDesignIntf* band, childBands()){
int newIndex = band->bandIndex()+indexOffset;
band->changeBandIndex(newIndex);
@ -252,6 +297,14 @@ void BandDesignIntf::setDataSourceName(const QString &datasource){
m_dataSourceName=datasource;
}
void BandDesignIntf::setKeepBottomSpaceOption(bool value){
if (m_keepBottomSpace!=value){
m_keepBottomSpace=value;
if (!isLoading())
notify("keepBottomSpace",!value,value);
}
}
void BandDesignIntf::addChildBand(BandDesignIntf *band)
{
m_childBands.append(band);
@ -293,6 +346,16 @@ bool BandDesignIntf::isConnectedToBand(BandDesignIntf::BandsType bandType) const
return false;
}
int BandDesignIntf::maxChildIndex(BandDesignIntf::BandsType bandType) const{
int curIndex = bandIndex();
foreach(BandDesignIntf* childBand, childBands()){
if ( (childBand->bandIndex() > bandIndex()) && (childBand->bandType() < bandType) ){
curIndex = std::max(curIndex,childBand->maxChildIndex());
}
}
return curIndex;
}
int BandDesignIntf::maxChildIndex(QSet<BandDesignIntf::BandsType> ignoredBands) const{
int curIndex = bandIndex();
foreach(BandDesignIntf* childBand, childBands()){
@ -416,13 +479,25 @@ void BandDesignIntf::preparePopUpMenu(QMenu &menu)
}
menu.addSeparator();
QAction* autoHeightAction = menu.addAction(tr("Auto height"));
autoHeightAction->setCheckable(true);
autoHeightAction->setChecked(autoHeight());
QAction* currAction = menu.addAction(tr("Auto height"));
currAction->setCheckable(true);
currAction->setChecked(autoHeight());
QAction* autoSplittableAction = menu.addAction(tr("Splittable"));
autoSplittableAction->setCheckable(true);
autoSplittableAction->setChecked(isSplittable());
currAction = menu.addAction(tr("Splittable"));
currAction->setCheckable(true);
currAction->setChecked(isSplittable());
currAction = menu.addAction(tr("Keep bottom space"));
currAction->setCheckable(true);
currAction->setChecked(keepBottomSpaceOption());
currAction = menu.addAction(tr("Start from new page"));
currAction->setCheckable(true);
currAction->setChecked(startFromNewPage());
currAction = menu.addAction(tr("Start new page"));
currAction->setCheckable(true);
currAction->setChecked(startNewPage());
}
void BandDesignIntf::processPopUpAction(QAction *action)
@ -433,13 +508,23 @@ void BandDesignIntf::processPopUpAction(QAction *action)
if (action->text().compare(tr("Splittable")) == 0){
setProperty("splittable",action->isChecked());
}
if (action->text().compare(tr("Keep bottom space")) == 0){
setProperty("keepBottomSpace",action->isChecked());
}
if (action->text().compare(tr("Start new page")) == 0){
setProperty("startNewPage",action->isChecked());
}
if (action->text().compare(tr("Start from new page")) == 0){
setProperty("startFromNewPage",action->isChecked());
}
}
BaseDesignIntf* BandDesignIntf::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent)
{
int maxBottom = 0;
BandDesignIntf* upperPart = dynamic_cast<BandDesignIntf*>(createSameTypeItem(owner,parent));
BaseDesignIntf* upperItem;
upperPart->m_bottomSpace = this->bottomSpace();
BaseDesignIntf* upperItem = 0;
upperPart->initFromItem(this);
@ -485,6 +570,7 @@ bool itemLessThen(QGraphicsItem* i1, QGraphicsItem* i2){
BaseDesignIntf *BandDesignIntf::cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent)
{
BandDesignIntf* bottomPart = dynamic_cast<BandDesignIntf*>(createSameTypeItem(owner,parent));
bottomPart->m_bottomSpace = this->bottomSpace();
bottomPart->initFromItem(this);
QList<QGraphicsItem*> bandItems;
@ -497,30 +583,28 @@ BaseDesignIntf *BandDesignIntf::cloneBottomPart(int height, QObject *owner, QGra
if (item){
if (item->geometry().top()>height){
BaseDesignIntf* tmpItem = item->cloneItem(item->itemMode(),bottomPart,bottomPart);
tmpItem->setPos(tmpItem->pos().x(),tmpItem->pos().y()-height);
tmpItem->setPos(tmpItem->pos().x(), (tmpItem->pos().y()-height)+borderLineSize());
}
else if ((item->geometry().top()<height) && (item->geometry().bottom()>height)){
int sliceHeight = height-item->geometry().top();
if (item->canBeSplitted(sliceHeight)) {
if (item->isSplittable() && item->canBeSplitted(sliceHeight)) {
BaseDesignIntf* tmpItem=item->cloneBottomPart(sliceHeight,bottomPart,bottomPart);
tmpItem->setPos(tmpItem->pos().x(),0);
if (tmpItem->pos().y()<0) tmpItem->setPos(tmpItem->pos().x(),0);
qreal sizeOffset = (m_slicedItems.value(tmpItem->objectName())->height()+tmpItem->height()) - item->height();
qreal bottomOffset = (height - m_slicedItems.value(tmpItem->objectName())->pos().y())-m_slicedItems.value(tmpItem->objectName())->height();
moveItemsDown(item->pos().y()+item->height(), sizeOffset + bottomOffset);
}
else if (item->isSplittable()){
BaseDesignIntf* tmpItem = item->cloneItem(item->itemMode(),bottomPart,bottomPart);
tmpItem->setPos(tmpItem->pos().x(),0);
tmpItem->setPos(tmpItem->pos().x(),borderLineSize());
BaseDesignIntf* slicedItem = m_slicedItems.value(tmpItem->objectName());
if (slicedItem){
qreal sizeOffset = (slicedItem->height()+tmpItem->height()) - item->height();
qreal bottomOffset = (height - slicedItem->pos().y())-m_slicedItems.value(tmpItem->objectName())->height();
moveItemsDown(item->pos().y()+item->height(), sizeOffset + bottomOffset);
}
} else {
if ((item->geometry().bottom()-height)>height){
BaseDesignIntf* tmpItem = item->cloneItem(item->itemMode(),bottomPart,bottomPart);
tmpItem->setPos(tmpItem->pos().x(),0);
tmpItem->setPos(tmpItem->pos().x(),borderLineSize());
tmpItem->setHeight((this->height()-height));
} else {
BaseDesignIntf* tmpItem = item->cloneEmpty((this->height()-height),bottomPart,bottomPart);
if (tmpItem)
tmpItem->setPos(tmpItem->pos().x(),0);
tmpItem->setPos(tmpItem->pos().x(),borderLineSize());
}
}
}
@ -570,7 +654,7 @@ void BandDesignIntf::trimToMaxHeight(int maxHeight)
void BandDesignIntf::setBandTypeText(const QString &value){
m_bandTypeText=value;
m_bandNameLabel->updateLabel();
m_bandNameLabel->updateLabel(bandTitle());
}
QSet<BandDesignIntf::BandsType> BandDesignIntf::groupBands()
@ -628,7 +712,7 @@ QVariant BandDesignIntf::itemChange(QGraphicsItem::GraphicsItemChange change, co
m_bandMarker->update(0,0,
m_bandMarker->boundingRect().width(),
m_bandMarker->boundingRect().width());
m_bandNameLabel->updateLabel();
m_bandNameLabel->updateLabel(bandTitle());
m_bandNameLabel->setVisible(value.toBool());
}
@ -682,6 +766,18 @@ void BandDesignIntf::setAlternateBackgroundColor(const QColor &alternateBackgrou
m_alternateBackgroundColor = alternateBackgroundColor;
}
qreal BandDesignIntf::bottomSpace() const
{
return m_bottomSpace.isValid() ? m_bottomSpace.value() : height()-findMaxBottom();
}
void BandDesignIntf::slotPropertyObjectNameChanged(const QString &, const QString& newName)
{
update();
if (m_bandNameLabel)
m_bandNameLabel->updateLabel(newName);
}
bool BandDesignIntf::repeatOnEachRow() const
{
return m_repeatOnEachRow;
@ -709,7 +805,11 @@ bool BandDesignIntf::startFromNewPage() const
void BandDesignIntf::setStartFromNewPage(bool startWithNewPage)
{
m_startFromNewPage = startWithNewPage;
if (m_startFromNewPage != startWithNewPage){
m_startFromNewPage = startWithNewPage;
if (!isLoading())
notify("startFromNewPage", !startWithNewPage, startWithNewPage);
}
}
bool BandDesignIntf::startNewPage() const
@ -719,7 +819,11 @@ bool BandDesignIntf::startNewPage() const
void BandDesignIntf::setStartNewPage(bool startNewPage)
{
m_startNewPage = startNewPage;
if (m_startNewPage != startNewPage){
m_startNewPage = startNewPage;
if (!isLoading())
notify("startNewPage", !startNewPage, startNewPage);
}
}
void BandDesignIntf::setAutoHeight(bool value){
@ -816,7 +920,8 @@ void BandDesignIntf::setKeepFooterTogether(bool value)
void BandDesignIntf::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight)
{
qreal spaceBorder=0;
if (keepBottomSpaceOption()) spaceBorder=height()-findMaxBottom();
if (keepBottomSpaceOption()) spaceBorder = bottomSpace();
spaceBorder = spaceBorder>0 ? spaceBorder : 0;
if (borderLines()!=0){
spaceBorder += borderLineSize();
}
@ -836,7 +941,7 @@ void BandDesignIntf::updateItemSize(DataSourceManager* dataManager, RenderPass p
void BandDesignIntf::updateBandNameLabel()
{
if (m_bandNameLabel) m_bandNameLabel->updateLabel();
if (m_bandNameLabel) m_bandNameLabel->updateLabel(bandTitle());
}
QColor BandDesignIntf::selectionColor() const
@ -879,7 +984,7 @@ QRectF BandNameLabel::boundingRect() const
return m_rect;
}
void BandNameLabel::updateLabel()
void BandNameLabel::updateLabel(const QString& bandName)
{
QFont font("Arial",7*Const::fontFACTOR,-1,true);
QFontMetrics fontMetrics(font);
@ -887,7 +992,7 @@ void BandNameLabel::updateLabel()
m_rect = QRectF(
m_band->pos().x()+10,
m_band->pos().y()-(fontMetrics.height()+10),
fontMetrics.width(m_band->bandTitle())+20,fontMetrics.height()+10
fontMetrics.width(bandName)+20,fontMetrics.height()+10
);
update();
}

View File

@ -63,6 +63,7 @@ public:
qreal height(){return m_rect.height();}
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
private:
QRectF m_rect;
QColor m_color;
@ -74,7 +75,7 @@ public:
explicit BandNameLabel(BandDesignIntf* band, QGraphicsItem* parent=0);
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
QRectF boundingRect() const;
void updateLabel();
void updateLabel(const QString &bandName);
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
private:
QRectF m_rect;
@ -82,6 +83,18 @@ private:
BandDesignIntf* m_band;
};
class InitializedValue{
public:
InitializedValue(): m_value(-1), m_isInitialized(false){}
InitializedValue(qreal value): m_value(value), m_isInitialized(true){}
qreal value() const { return m_value;}
void setValue( qreal value){ m_value = value; m_isInitialized = true;}
bool isValid() const{ return m_isInitialized;}
private:
qreal m_value;
bool m_isInitialized;
};
class BandDesignIntf : public ItemsContainerDesignInft
{
Q_OBJECT
@ -121,6 +134,7 @@ public:
~BandDesignIntf();
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void translateBandsName();
virtual BandsType bandType() const;
virtual QString bandTitle() const;
virtual QIcon bandIcon() const;
@ -131,13 +145,13 @@ public:
virtual QColor selectionColor() const;
int bandIndex() const;
void setBandIndex(int value);
void changeBandIndex(int value);
void changeBandIndex(int value, bool firstTime = false);
void setBandType(BandsType value){m_bandType=value;}
QString datasourceName();
void setDataSourceName(const QString& datasourceName);
void setKeepBottomSpaceOption(bool value){m_keepBottomSpace=value;}
void setKeepBottomSpaceOption(bool value);
bool keepBottomSpaceOption() const {return m_keepBottomSpace;}
void addChildBand(BandDesignIntf* band);
@ -151,8 +165,10 @@ public:
bool isConnectedToBand(BandDesignIntf::BandsType bandType) const;
int minChildIndex(BandsType bandType);
int maxChildIndex(BandDesignIntf::BandsType bandType) const;
int maxChildIndex(QSet<BandsType> ignoredBands = QSet<BandDesignIntf::BandsType>()) const;
BandDesignIntf* parentBand() const {return m_parentBand;}
QList<BandDesignIntf*> childBands() const{return m_childBands;}
@ -165,6 +181,7 @@ public:
virtual bool isHeader() const {return false;}
virtual bool isGroupHeader() const {return false;}
virtual bool isData() const {return false;}
virtual int bandNestingLevel(){return 0;}
bool isBand(){return true;}
void setTryToKeepTogether(bool value);
@ -217,9 +234,9 @@ public:
void setRepeatOnEachRow(bool repeatOnEachRow);
QColor alternateBackgroundColor() const;
void setAlternateBackgroundColor(const QColor &alternateBackgroundColor);
qreal bottomSpace() const;
signals:
void bandRendered(BandDesignIntf* band);
void bandRendered(BandDesignIntf* band);
protected:
void trimToMaxHeight(int maxHeight);
void setBandTypeText(const QString& value);
@ -240,8 +257,10 @@ protected:
void moveItemsDown(qreal startPos, qreal offset);
void preparePopUpMenu(QMenu &menu);
void processPopUpAction(QAction *action);
QString translateBandName(const BaseDesignIntf *item) const;
private slots:
void childBandDeleted(QObject* band);
void slotPropertyObjectNameChanged(const QString&,const QString&);
private:
QString m_bandTypeText;
BandsType m_bandType;
@ -270,7 +289,8 @@ private:
bool m_printAlways;
bool m_repeatOnEachRow;
QMap<QString,BaseDesignIntf*> m_slicedItems;
QColor m_alternateBackgroundColor;
QColor m_alternateBackgroundColor;
InitializedValue m_bottomSpace;
};
class DataBandDesignIntf : public BandDesignIntf{

View File

@ -628,10 +628,10 @@ QPointF BaseDesignIntf::modifyPosForAlignedItem(const QPointF& pos){
result.setX(leftBorder);
break;
case RightItemAlign:
result.setX(parent->width()-rightBorder);
result.setX(parent->width() - (rightBorder + width()));
break;
case CenterItemAlign:
result.setX((avaibleSpace-width())/2);
result.setX((avaibleSpace-width()) / 2 + leftBorder);
break;
case ParentWidthItemAlign:
result.setX(leftBorder);
@ -1008,6 +1008,7 @@ QVariant BaseDesignIntf::itemChange(QGraphicsItem::GraphicsItemChange change, co
}
if (change == QGraphicsItem::ItemSelectedChange) {
turnOnSelectionMarker(value.toBool());
emit itemSelectedHasBeenChanged(this, value.toBool());
}
if (change == QGraphicsItem::ItemParentHasChanged) {
parentChangedEvent(dynamic_cast<BaseDesignIntf*>(value.value<QGraphicsItem*>()));
@ -1152,6 +1153,7 @@ void BaseDesignIntf::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
void BaseDesignIntf::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
if (!(flags() & QGraphicsItem::ItemIsSelectable)) return;
PageDesignIntf* page = dynamic_cast<PageDesignIntf*>(scene());
if (!page->selectedItems().contains(this)){
page->clearSelection();

View File

@ -341,7 +341,6 @@ protected:
virtual void preparePopUpMenu(QMenu& menu){Q_UNUSED(menu)}
virtual void processPopUpAction(QAction* action){Q_UNUSED(action)}
private:
void updateSelectionMarker();
int resizeDirectionFlags(QPointF position);
@ -401,6 +400,7 @@ signals:
void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
void posChanged(QObject* object, QPointF newPos, QPointF oldPos);
void itemSelected(LimeReport::BaseDesignIntf *item);
void itemSelectedHasBeenChanged(BaseDesignIntf *item, bool value);
void loadCollectionFinished(const QString& collectionName);
void objectLoaded(QObject* object);
void objectChanged(QObject* object);

View File

@ -57,21 +57,21 @@ IDataSource * ModelHolder::dataSource(IDataSource::DatasourceMode mode)
}
QueryHolder::QueryHolder(QString queryText, QString connectionName, DataSourceManager *dataManager)
: m_query(0), m_queryText(queryText), m_connectionName(connectionName),
: m_queryText(queryText), m_connectionName(connectionName),
m_mode(IDataSource::RENDER_MODE), m_dataManager(dataManager), m_prepared(true)
{
extractParams();
}
QueryHolder::~QueryHolder()
{
if (m_query) delete m_query;
}
QueryHolder::~QueryHolder(){}
bool QueryHolder::runQuery(IDataSource::DatasourceMode mode)
{
m_mode = mode;
QSqlDatabase db = QSqlDatabase::database(m_connectionName);
QSqlQuery query(db);
if (!db.isValid()) {
setLastError(QObject::tr("Invalid connection! %1").arg(m_connectionName));
return false;
@ -82,16 +82,12 @@ bool QueryHolder::runQuery(IDataSource::DatasourceMode mode)
if (!m_prepared) return false;
}
if (!m_query){
m_query = new QSqlQuery(db);
m_query->prepare(m_preparedSQL);
}
fillParams(m_query);
m_query->exec();
query.prepare(m_preparedSQL);
fillParams(&query);
query.exec();
QSqlQueryModel *model = new QSqlQueryModel;
model->setQuery(*m_query);
model->setQuery(query);
while (model->canFetchMore())
model->fetchMore();
@ -102,7 +98,7 @@ bool QueryHolder::runQuery(IDataSource::DatasourceMode mode)
setLastError(model->lastError().text());
delete model;
return false;
} else setLastError("");
} else { setLastError("");}
setDatasource(IDataSource::Ptr(new ModelToDataSource(model,true)));
return true;
@ -118,11 +114,10 @@ void QueryHolder::setConnectionName(QString connectionName)
m_connectionName=connectionName;
}
void QueryHolder::invalidate(IDataSource::DatasourceMode mode){
void QueryHolder::invalidate(IDataSource::DatasourceMode mode, bool dbWillBeClosed){
QSqlDatabase db = QSqlDatabase::database(m_connectionName);
if (!db.isValid()){
if (!db.isValid() || dbWillBeClosed){
setLastError(QObject::tr("Invalid connection! %1").arg(m_connectionName));
delete m_query;
m_dataSource.clear();
} else {
runQuery(mode);
@ -197,10 +192,6 @@ void QueryHolder::setQueryText(QString queryText)
{
m_queryText=queryText;
m_prepared = false;
if (m_query) {
delete m_query;
m_query = 0;
}
}
IDataSource* QueryHolder::dataSource(IDataSource::DatasourceMode mode)
@ -350,13 +341,13 @@ void ModelToDataSource::slotModelDestroed()
ConnectionDesc::ConnectionDesc(QSqlDatabase db, QObject *parent)
: QObject(parent), m_connectionName(db.connectionName()), m_connectionHost(db.hostName()), m_connectionDriver(db.driverName()),
m_databaseName(db.databaseName()), m_user(db.userName()), m_password(db.password()), m_autoconnect(false),
m_databaseName(db.databaseName()), m_user(db.userName()), m_password(db.password()), m_port(-1), m_autoconnect(false),
m_internal(false), m_keepDBCredentials(true)
{}
ConnectionDesc::ConnectionDesc(QObject *parent)
:QObject(parent),m_connectionName(""),m_connectionHost(""),m_connectionDriver(""),
m_databaseName(""), m_user(""), m_password(""), m_autoconnect(false),
:QObject(parent),m_connectionName(""),m_connectionHost(""), m_connectionDriver(""),
m_databaseName(""), m_user(""), m_password(""), m_port(-1), m_autoconnect(false),
m_internal(false), m_keepDBCredentials(true)
{}
@ -391,6 +382,16 @@ QString ConnectionDesc::connectionNameForReport(const QString &connectionName)
return connectionName.compare(tr("defaultConnection")) == 0 ? QSqlDatabase::defaultConnection : connectionName;
}
int ConnectionDesc::port() const
{
return m_port;
}
void ConnectionDesc::setPort(int port)
{
m_port = port;
}
bool ConnectionDesc::keepDBCredentials() const
{
return m_keepDBCredentials;
@ -421,7 +422,7 @@ void SubQueryHolder::setMasterDatasource(const QString &value)
void SubQueryHolder::extractParams()
{
if (!dataManager()->containsDatasource(m_masterDatasource)){
setLastError(QObject::tr("Master datasource \"%1\" not found!!!").arg(m_masterDatasource));
setLastError(QObject::tr("Master datasource \"%1\" not found!").arg(m_masterDatasource));
setPrepared(false);
} else {
m_preparedSQL = replaceFields(replaceVariables(queryText()));
@ -552,9 +553,10 @@ IDataSource *ProxyHolder::dataSource(IDataSource::DatasourceMode mode)
return m_datasource.data();
}
void ProxyHolder::invalidate(IDataSource::DatasourceMode mode)
void ProxyHolder::invalidate(IDataSource::DatasourceMode mode, bool dbWillBeClosed)
{
Q_UNUSED(mode)
Q_UNUSED(dbWillBeClosed);
if (m_model && m_model->isInvalid()){
m_invalid = true;
m_lastError = tr("Datasource has been invalidated");
@ -638,11 +640,26 @@ QVariant MasterDetailProxyModel::masterData(QString fieldName) const
bool CallbackDatasource::next(){
if (!m_eof){
bool nextRowExists = checkNextRecord(m_currentRow);
if (m_currentRow>-1){
if (!m_getDataFromCache && nextRowExists){
for (int i = 0; i < m_columnCount; ++i ){
m_valuesCache[columnNameByIndex(i)] = data(columnNameByIndex(i));
}
}
}
if (!nextRowExists){
m_eof = true;
return false;
}
m_currentRow++;
bool result = false;
emit changePos(CallbackInfo::Next,result);
bool result = true;
if (!m_getDataFromCache)
emit changePos(CallbackInfo::Next,result);
m_getDataFromCache = false;
if (m_rowCount != -1){
if (m_rowCount>0 && m_currentRow<m_rowCount){
if (m_rowCount > 0 && m_currentRow < m_rowCount){
m_eof = false;
} else {
m_eof = true;
@ -655,6 +672,21 @@ bool CallbackDatasource::next(){
} else return false;
}
bool CallbackDatasource::prior(){
if (m_currentRow !=-1) {
if (!m_getDataFromCache && !m_valuesCache.isEmpty()){
m_getDataFromCache = true;
m_currentRow--;
m_eof = false;
return true;
} else {
return false;
}
} else {
return false;
}
}
void CallbackDatasource::first(){
m_currentRow = 0;
m_eof=checkIfEmpty();
@ -673,12 +705,19 @@ void CallbackDatasource::first(){
QVariant CallbackDatasource::data(const QString& columnName)
{
CallbackInfo info;
info.dataType = CallbackInfo::ColumnData;
info.columnName = columnName;
info.index = m_currentRow;
QVariant result;
emit getCallbackData(info,result);
if (!bof())
{
if (!m_getDataFromCache){
CallbackInfo info;
info.dataType = CallbackInfo::ColumnData;
info.columnName = columnName;
info.index = m_currentRow;
emit getCallbackData(info,result);
} else {
result = m_valuesCache[columnName];
}
}
return result;
}
@ -728,7 +767,7 @@ QString CallbackDatasource::columnNameByIndex(int columnIndex)
int CallbackDatasource::columnIndexByName(QString name)
{
for (int i=0;i<m_headers.size();++i) {
if (m_headers[i].compare(name) == 0)
if (m_headers[i].compare(name, Qt::CaseInsensitive) == 0)
return i;
}
// if (m_headers.size()==0){
@ -741,8 +780,9 @@ int CallbackDatasource::columnIndexByName(QString name)
}
bool CallbackDatasource::checkNextRecord(int recordNum){
if (m_rowCount>0 && m_currentRow<m_rowCount){
return true;
if (bof()) checkIfEmpty();
if (m_rowCount > 0) {
return (m_currentRow < (m_rowCount-1));
} else {
QVariant result = false;
CallbackInfo info;
@ -762,7 +802,10 @@ bool CallbackDatasource::checkIfEmpty(){
CallbackInfo info;
info.dataType = CallbackInfo::RowCount;
emit getCallbackData(info, recordCount);
if (recordCount.toInt()>0) return false;
if (recordCount.toInt()>0) {
m_rowCount = recordCount.toInt();
return false;
}
info.dataType = CallbackInfo::IsEmpty;
emit getCallbackData(info,isEmpty);
return isEmpty.toBool();

View File

@ -74,7 +74,7 @@ public:
virtual bool isOwned() const = 0;
virtual bool isEditable() const = 0;
virtual bool isRemovable() const = 0;
virtual void invalidate(IDataSource::DatasourceMode mode) = 0;
virtual void invalidate(IDataSource::DatasourceMode mode, bool dbWillBeClosed = false) = 0;
virtual void update() = 0;
virtual void clearErrors() = 0;
virtual ~IDataSourceHolder(){}
@ -91,7 +91,7 @@ public:
QString lastError() const { return m_dataSource->lastError(); }
bool isEditable() const { return false; }
bool isRemovable() const { return false; }
void invalidate(IDataSource::DatasourceMode mode){Q_UNUSED(mode)}
void invalidate(IDataSource::DatasourceMode mode, bool dbWillBeClosed = false){Q_UNUSED(mode) Q_UNUSED(dbWillBeClosed)}
void update(){}
void clearErrors(){}
signals:
@ -111,6 +111,7 @@ class ConnectionDesc : public QObject{
Q_PROPERTY(QString host READ host WRITE setHost)
Q_PROPERTY(bool autoconnect READ autoconnect WRITE setAutoconnect)
Q_PROPERTY(bool keepDBCredentials READ keepDBCredentials WRITE setKeepDBCredentials)
Q_PROPERTY(int port READ port WRITE setPort)
public:
typedef QSharedPointer<ConnectionDesc> Ptr;
ConnectionDesc(QSqlDatabase db, QObject* parent=0);
@ -135,6 +136,8 @@ public:
void setInternal(bool value) {m_internal = value;}
bool keepDBCredentials() const;
void setKeepDBCredentials(bool keepDBCredentials);
int port() const;
void setPort(int port);
public:
static QString connectionNameForUser(const QString& connectionName);
static QString connectionNameForReport(const QString& connectionName);
@ -147,6 +150,7 @@ private:
QString m_databaseName;
QString m_user;
QString m_password;
int m_port;
bool m_autoconnect;
bool m_internal;
bool m_keepDBCredentials;
@ -199,8 +203,8 @@ public:
bool isRemovable() const { return true; }
bool isPrepared() const {return m_prepared;}
QString lastError() const { return m_lastError; }
void setLastError(QString value){m_lastError=value; if (m_query) {delete m_query; m_query=0;}}
void invalidate(IDataSource::DatasourceMode mode);
void setLastError(QString value){m_lastError=value;}
void invalidate(IDataSource::DatasourceMode mode, bool dbWillBeClosed = false);
void update();
void clearErrors(){setLastError("");}
DataSourceManager* dataManager() const {return m_dataManager;}
@ -211,7 +215,6 @@ protected:
virtual void extractParams();
QString replaceVariables(QString query);
QMap<QString,QString> m_aliasesToParam;
QSqlQuery* m_query;
QString m_preparedSQL;
private:
QString m_queryText;
@ -330,7 +333,7 @@ public:
bool isEditable() const { return true; }
bool isRemovable() const { return true; }
QString lastError() const { return m_lastError; }
void invalidate(IDataSource::DatasourceMode mode);
void invalidate(IDataSource::DatasourceMode mode, bool dbWillBeClosed = false);
void update(){}
void clearErrors(){m_lastError = "";}
DataSourceManager* dataManager() const {return m_dataManger;}
@ -380,10 +383,11 @@ private:
class CallbackDatasource :public ICallbackDatasource, public IDataSource {
Q_OBJECT
public:
CallbackDatasource(): m_currentRow(-1), m_eof(false), m_columnCount(-1), m_rowCount(-1){}
CallbackDatasource(): m_currentRow(-1), m_eof(false), m_columnCount(-1),
m_rowCount(-1), m_getDataFromCache(false){}
bool next();
bool hasNext(){ if (!m_eof) return checkNextRecord(m_currentRow); else return false;}
bool prior(){ if (m_currentRow !=-1) {m_currentRow--; return true;} else return false;}
bool prior();
void first();
void last(){}
bool bof(){return m_currentRow == -1;}
@ -404,6 +408,8 @@ private:
bool m_eof;
int m_columnCount;
int m_rowCount;
QHash<QString, QVariant> m_valuesCache;
bool m_getDataFromCache;
};
class CallbackDatasourceHolder :public QObject, public IDataSourceHolder{
@ -417,7 +423,7 @@ public:
bool isOwned() const {return m_owned;}
bool isEditable() const {return false;}
bool isRemovable() const {return false;}
void invalidate(IDataSource::DatasourceMode mode){Q_UNUSED(mode)}
void invalidate(IDataSource::DatasourceMode mode, bool dbWillBeClosed = false){Q_UNUSED(mode) Q_UNUSED(dbWillBeClosed)}
~CallbackDatasourceHolder(){delete m_datasource;}
void update(){}
void clearErrors(){}

View File

@ -226,6 +226,18 @@ DataSourceManager::DataSourceManager(QObject *parent) :
m_groupFunctionFactory.registerFunctionCreator(QLatin1String("MAX"),new ConstructorGroupFunctionCreator<MaxGroupFunction>);
setSystemVariable(QLatin1String("#PAGE"),1,FirstPass);
setSystemVariable(QLatin1String("#PAGE_COUNT"),0,SecondPass);
setSystemVariable(QLatin1String("#IS_LAST_PAGEFOOTER"),false,FirstPass);
setSystemVariable(QLatin1String("#IS_FIRST_PAGEFOOTER"),false,FirstPass);
connect(&m_reportVariables, SIGNAL(variableHasBeenAdded(QString)),
this, SLOT(slotVariableHasBeenAdded(QString)) );
connect(&m_reportVariables, SIGNAL(variableHasBeenChanged(QString)),
this, SLOT(slotVariableHasBeenChanged(QString)));
connect(&m_userVariables, SIGNAL(variableHasBeenAdded(QString)),
this, SLOT(slotVariableHasBeenAdded(QString)) );
connect(&m_userVariables, SIGNAL(variableHasBeenChanged(QString)),
this, SLOT(slotVariableHasBeenChanged(QString)));
m_datasourcesModel.setDataSourceManager(this);
}
@ -258,7 +270,11 @@ void DataSourceManager::clearGroupFuntionsExpressions()
QString DataSourceManager::getExpression(QString index)
{
return m_groupFunctionsExpressions.at(index.toInt());
bool ok = false;
int i = index.toInt(&ok);
if (ok && m_groupFunctionsExpressions.size()>i)
return m_groupFunctionsExpressions.at(index.toInt());
else return "";
}
bool DataSourceManager::designTime() const
@ -580,7 +596,7 @@ QList<ConnectionDesc *>& DataSourceManager::conections()
bool DataSourceManager::dataSourceIsValid(const QString &name)
{
if (m_datasources.value(name.toLower())) return !m_datasources.value(name.toLower())->isInvalid();
else throw ReportError(tr("Datasource \"%1\" not found !").arg(name));
else throw ReportError(tr("Datasource \"%1\" not found!").arg(name));
}
bool DataSourceManager::isQuery(const QString &dataSourceName)
@ -634,15 +650,18 @@ void DataSourceManager::removeConnection(const QString &connectionName)
{
QList<ConnectionDesc*>::iterator cit = m_connections.begin();
while( cit != m_connections.end() ){
if ( ((*cit)->name().compare(connectionName) == 0) && (*cit)->isInternal() ){
if ( ((*cit)->name().compare(connectionName) == 0) ){
if ((*cit)->isInternal())
{
QSqlDatabase db = QSqlDatabase::database(connectionName);
db.close();
}
QSqlDatabase::removeDatabase(connectionName);
delete (*cit);
cit = m_connections.erase(cit);
} else {
cit++;
}
delete (*cit);
cit = m_connections.erase(cit);
}
emit datasourcesChanged();
}
@ -660,7 +679,7 @@ void DataSourceManager::addConnectionDesc(ConnectionDesc * connection)
}
}
} else {
throw ReportError(tr("connection with name \"%1\" already exists !").arg(connection->name()));
throw ReportError(tr("Connection with name \"%1\" already exists!").arg(connection->name()));
}
}
@ -685,7 +704,7 @@ void DataSourceManager::putHolder(const QString& name, IDataSourceHolder *dataSo
name.toLower(),
dataSource
);
} else throw ReportError(tr("datasource with name \"%1\" already exists !").arg(name));
} else throw ReportError(tr("Datasource with name \"%1\" already exists!").arg(name));
}
void DataSourceManager::putQueryDesc(QueryDesc* queryDesc)
@ -694,7 +713,7 @@ void DataSourceManager::putQueryDesc(QueryDesc* queryDesc)
m_queries.append(queryDesc);
connect(queryDesc, SIGNAL(queryTextChanged(QString,QString)),
this, SLOT(slotQueryTextChanged(QString,QString)));
} else throw ReportError(tr("datasource with name \"%1\" already exists !").arg(queryDesc->queryName()));
} else throw ReportError(tr("Datasource with name \"%1\" already exists!").arg(queryDesc->queryName()));
}
void DataSourceManager::putSubQueryDesc(SubQueryDesc *subQueryDesc)
@ -703,14 +722,14 @@ void DataSourceManager::putSubQueryDesc(SubQueryDesc *subQueryDesc)
m_subqueries.append(subQueryDesc);
connect(subQueryDesc, SIGNAL(queryTextChanged(QString,QString)),
this, SLOT(slotQueryTextChanged(QString,QString)));
} else throw ReportError(tr("datasource with name \"%1\" already exists !").arg(subQueryDesc->queryName()));
} else throw ReportError(tr("Datasource with name \"%1\" already exists!").arg(subQueryDesc->queryName()));
}
void DataSourceManager::putProxyDesc(ProxyDesc *proxyDesc)
{
if (!containsDatasource(proxyDesc->name())){
m_proxies.append(proxyDesc);
} else throw ReportError(tr("datasource with name \"%1\" already exists !").arg(proxyDesc->name()));
} else throw ReportError(tr("Datasource with name \"%1\" already exists!").arg(proxyDesc->name()));
}
bool DataSourceManager::initAndOpenDB(QSqlDatabase& db, ConnectionDesc& connectionDesc){
@ -721,6 +740,8 @@ bool DataSourceManager::initAndOpenDB(QSqlDatabase& db, ConnectionDesc& connecti
db.setHostName(replaceVariables(connectionDesc.host()));
db.setUserName(replaceVariables(connectionDesc.userName()));
db.setPassword(replaceVariables(connectionDesc.password()));
if (connectionDesc.port()!=-1)
db.setPort(connectionDesc.port());
if (!connectionDesc.keepDBCredentials() && m_dbCredentialsProvider){
if (!m_dbCredentialsProvider->getUserName(connectionDesc.name()).isEmpty())
@ -942,7 +963,7 @@ IDataSource *DataSourceManager::dataSource(const QString &name)
return holder->dataSource(designTime()?IDataSource::DESIGN_MODE:IDataSource::RENDER_MODE);
}
} else {
setLastError(tr("Datasource \"%1\" not found !").arg(name));
setLastError(tr("Datasource \"%1\" not found!").arg(name));
return 0;
}
}
@ -1229,6 +1250,32 @@ void DataSourceManager::slotQueryTextChanged(const QString &queryName, const QSt
}
}
void DataSourceManager::invalidateQueriesContainsVariable(const QString& variableName)
{
if (!variableIsSystem(variableName)){
foreach (const QString& datasourceName, dataSourceNames()){
QueryHolder* holder = dynamic_cast<QueryHolder*>(m_datasources.value(datasourceName));
if (holder){
QRegExp rx(QString(Const::NAMED_VARIABLE_RX).arg(variableName));
if (holder->queryText().contains(rx))
holder->invalidate(designTime()?IDataSource::DESIGN_MODE:IDataSource::RENDER_MODE);
}
}
}
}
void DataSourceManager::slotVariableHasBeenAdded(const QString& variableName)
{
//qDebug()<< "variable has been added"<< variableName;
invalidateQueriesContainsVariable(variableName);
}
void DataSourceManager::slotVariableHasBeenChanged(const QString& variableName)
{
//qDebug()<< "variable has been changed"<< variableName;
invalidateQueriesContainsVariable(variableName);
}
void DataSourceManager::clear(ClearMethod method)
{
DataSourcesMap::iterator dit;

View File

@ -224,9 +224,12 @@ protected:
void setLastError(const QString& value);
void invalidateLinkedDatasources(QString datasourceName);
bool checkConnection(QSqlDatabase db);
void invalidateQueriesContainsVariable(const QString& variableName);
private slots:
void slotConnectionRenamed(const QString& oldName,const QString& newName);
void slotQueryTextChanged(const QString& queryName, const QString& queryText);
void slotVariableHasBeenAdded(const QString& variableName);
void slotVariableHasBeenChanged(const QString& variableName);
private:
explicit DataSourceManager(QObject *parent = 0);
bool initAndOpenDB(QSqlDatabase &db, ConnectionDesc &connectionDesc);

View File

@ -0,0 +1,430 @@
#include "bands/lrdataband.h"
#include "bands/lrgroupbands.h"
#include "bands/lrpagefooter.h"
#include "bands/lrpageheader.h"
#include "bands/lrreportheader.h"
#include "bands/lrreportfooter.h"
#include "bands/lrsubdetailband.h"
#include "bands/lrtearoffband.h"
#include "items/lrtextitem.h"
#ifdef HAVE_ZINT
#include "items/lrbarcodeitem.h"
#endif
#include "items/lrhorizontallayout.h"
#include "items/lrimageitem.h"
#include "items/lrshapeitem.h"
#include "lrdesignelementsfactory.h"
#include "objectinspector/lrobjectpropitem.h"
#include "objectinspector/propertyItems/lrboolpropitem.h"
#include "objectinspector/propertyItems/lrcolorpropitem.h"
#include "objectinspector/propertyItems/lrcontentpropitem.h"
#include "objectinspector/propertyItems/lrdatasourcepropitem.h"
#include "objectinspector/propertyItems/lrenumpropitem.h"
#include "objectinspector/propertyItems/lrflagspropitem.h"
#include "objectinspector/propertyItems/lrfontpropitem.h"
#include "objectinspector/propertyItems/lrgroupfieldpropitem.h"
#include "objectinspector/propertyItems/lrimagepropitem.h"
#include "objectinspector/propertyItems/lrintpropitem.h"
#include "objectinspector/propertyItems/lrqrealpropitem.h"
#include "objectinspector/propertyItems/lrrectproptem.h"
#include "objectinspector/propertyItems/lrstringpropitem.h"
#include "items/lralignpropitem.h"
#include "items/lrsubitemparentpropitem.h"
#include "serializators/lrxmlbasetypesserializators.h"
#include "serializators/lrxmlqrectserializator.h"
#include "serializators/lrxmlserializatorsfactory.h"
void initResources(){
Q_INIT_RESOURCE(report);
Q_INIT_RESOURCE(lobjectinspector);
Q_INIT_RESOURCE(lrdatabrowser);
Q_INIT_RESOURCE(items);
Q_INIT_RESOURCE(lrscriptbrowser);
}
namespace LimeReport{
BaseDesignIntf * createDataBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::DataBand(owner,parent);
}
BaseDesignIntf * createHeaderDataBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::DataHeaderBand(owner,parent);
}
BaseDesignIntf * createFooterDataBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::DataFooterBand(owner,parent);
}
BaseDesignIntf* createGroupHeaderBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::GroupBandHeader(owner,parent);
}
BaseDesignIntf * createGroupFooterBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::GroupBandFooter(owner,parent);
}
BaseDesignIntf * createPageHeaderBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::PageHeader(owner,parent);
}
BaseDesignIntf * createPageFooterBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::PageFooter(owner,parent);
}
BaseDesignIntf * createSubDetailBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::SubDetailBand(owner,parent);
}
BaseDesignIntf * createSubDetailHeaderBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::SubDetailHeaderBand(owner,parent);
}
BaseDesignIntf * createSubDetailFooterBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::SubDetailFooterBand(owner,parent);
}
BaseDesignIntf * createTearOffBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::TearOffBand(owner,parent);
}
BaseDesignIntf * createTextItem(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::TextItem(owner,parent);
}
#ifdef HAVE_ZINT
BaseDesignIntf * createBarcodeItem(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new BarcodeItem(owner,parent);
}
#endif
BaseDesignIntf* createHLayout(QObject *owner, LimeReport::BaseDesignIntf *parent)
{
return new HorizontalLayout(owner, parent);
}
BaseDesignIntf * createImageItem(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new ImageItem(owner,parent);
}
BaseDesignIntf * createShapeItem(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new ShapeItem(owner,parent);
}
void initReportItems(){
initResources();
DesignElementsFactory::instance().registerCreator(
"TextItem",
LimeReport::ItemAttribs(QObject::tr("Text Item"),"TextItem"),
createTextItem
);
#ifdef HAVE_ZINT
DesignElementsFactory::instance().registerCreator(
"BarcodeItem",
LimeReport::ItemAttribs(QObject::tr("Barcode Item"),"Item"),
createBarcodeItem
);
#endif
DesignElementsFactory::instance().registerCreator(
"HLayout",
LimeReport::ItemAttribs(QObject::tr("HLayout"), LimeReport::Const::bandTAG),
createHLayout
);
DesignElementsFactory::instance().registerCreator(
"ImageItem", LimeReport::ItemAttribs(QObject::tr("Image Item"),"Item"), createImageItem
);
DesignElementsFactory::instance().registerCreator(
"ShapeItem", LimeReport::ItemAttribs(QObject::tr("Shape Item"),"Item"), createShapeItem
);
DesignElementsFactory::instance().registerCreator(
"Data",
LimeReport::ItemAttribs(QObject::tr("Data"),LimeReport::Const::bandTAG),
createDataBand
);
DesignElementsFactory::instance().registerCreator(
"DataHeader",
LimeReport::ItemAttribs(QObject::tr("DataHeader"),LimeReport::Const::bandTAG),
createHeaderDataBand
);
DesignElementsFactory::instance().registerCreator(
"DataFooter",
LimeReport::ItemAttribs(QObject::tr("DataFooter"),LimeReport::Const::bandTAG),
createFooterDataBand
);
DesignElementsFactory::instance().registerCreator(
"GroupHeader",
LimeReport::ItemAttribs(QObject::tr("GroupHeader"),LimeReport::Const::bandTAG),
createGroupHeaderBand
);
DesignElementsFactory::instance().registerCreator(
"GroupFooter",
LimeReport::ItemAttribs(QObject::tr("GroupFooter"),LimeReport::Const::bandTAG),
createGroupFooterBand
);
DesignElementsFactory::instance().registerCreator(
"PageFooter",
LimeReport::ItemAttribs(QObject::tr("Page Footer"),LimeReport::Const::bandTAG),
createPageFooterBand
);
DesignElementsFactory::instance().registerCreator(
"PageHeader",
LimeReport::ItemAttribs(QObject::tr("Page Header"),LimeReport::Const::bandTAG),
createPageHeaderBand
);
DesignElementsFactory::instance().registerCreator(
"SubDetail",
LimeReport::ItemAttribs(QObject::tr("SubDetail"),LimeReport::Const::bandTAG),
createSubDetailBand
);
DesignElementsFactory::instance().registerCreator(
"SubDetailHeader",
LimeReport::ItemAttribs(QObject::tr("SubDetailHeader"),LimeReport::Const::bandTAG),
createSubDetailHeaderBand
);
DesignElementsFactory::instance().registerCreator(
"SubDetailFooter",
LimeReport::ItemAttribs(QObject::tr("SubDetailFooter"),LimeReport::Const::bandTAG),
createSubDetailFooterBand
);
DesignElementsFactory::instance().registerCreator(
"TearOffBand",
LimeReport::ItemAttribs(QObject::tr("Tear-off Band"),LimeReport::Const::bandTAG),
createTearOffBand
);
}
ObjectPropItem * createBoolPropItem(
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
{
return new LimeReport::BoolPropItem(object, objects, name, displayName, data, parent, readonly);
}
ObjectPropItem * createColorPropItem(
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
{
return new ColorPropItem(object, objects, name, displayName, data, parent, readonly);
}
ObjectPropItem * createContentPropItem(
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
{
return new ContentPropItem(object, objects, name, displayName, data, parent, readonly);
}
ObjectPropItem * createDatasourcePropItem(
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
{
return new LimeReport::DatasourcePropItem(object, objects, name, displayName, data, parent, readonly);
}
ObjectPropItem* createFieldPropItem(QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly){
return new LimeReport::FieldPropItem(object, objects, name, displayName, data, parent, readonly);
}
ObjectPropItem * createEnumPropItem(
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
{
return new LimeReport::EnumPropItem(object, objects, name, displayName, data, parent, readonly);
}
ObjectPropItem * createFlagsPropItem(
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
{
return new LimeReport::FlagsPropItem(object, objects, name, displayName, data, parent, readonly);
}
ObjectPropItem * createFontPropItem(
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
{
return new LimeReport::FontPropItem(object, objects, name, displayName, data, parent, readonly);
}
ObjectPropItem* createGroupFieldPropItem(QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly){
return new LimeReport::GroupFieldPropItem(object, objects, name, displayName, data, parent, readonly);
}
ObjectPropItem * createImagePropItem(
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
{
return new LimeReport::ImagePropItem(object, objects, name, displayName, data, parent, readonly);
}
ObjectPropItem * createIntPropItem(
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
{
return new LimeReport::IntPropItem(object, objects, name, displayName, data, parent, readonly);
}
ObjectPropItem * createQRealPropItem(
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
{
return new LimeReport::QRealPropItem(object, objects, name, displayName, data, parent, readonly);
}
ObjectPropItem * createReqtItem(
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly
){
return new LimeReport::RectPropItem(object, objects, name, displayName, data, parent, readonly);
}
ObjectPropItem * createReqtMMItem(
QObject*object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly
){
return new LimeReport::RectMMPropItem(object, objects, name, displayName, data, parent, readonly);
}
ObjectPropItem * createStringPropItem(
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
{
return new LimeReport::StringPropItem(object, objects, name, displayName, data, parent, readonly);
}
ObjectPropItem * createAlignItem(
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly
){
return new LimeReport::AlignmentPropItem(object, objects, name, displayName, data, parent, readonly);
}
ObjectPropItem * createLocationPropItem(
QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
{
return new LimeReport::ItemLocationPropItem(object, objects, name, displayName, data, parent, readonly);
}
void initObjectInspectorProperties()
{
ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("bool",""),QObject::tr("bool"),createBoolPropItem
);
ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("QColor",""),QObject::tr("QColor"),createColorPropItem
);
ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("content","LimeReport::TextItem"),QObject::tr("content"),createContentPropItem
);
ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("datasource","LimeReport::DataBandDesignIntf"),QObject::tr("datasource"),createDatasourcePropItem
);
ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("datasource","LimeReport::ImageItem"),QObject::tr("datasource"),createDatasourcePropItem
);
ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("field","LimeReport::ImageItem"),QObject::tr("field"),createFieldPropItem
);
ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("enum",""),QObject::tr("enum"),createEnumPropItem
);
ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("flags",""),QObject::tr("flags"),createFlagsPropItem
);
ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("QFont",""),QObject::tr("QFont"),createFontPropItem
);
ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("groupFieldName","LimeReport::GroupBandHeader"),QObject::tr("field"),createGroupFieldPropItem
);
ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("QImage",""),QObject::tr("QImage"),createImagePropItem
);
ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("int",""),QObject::tr("int"),createIntPropItem
);
ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("qreal",""),QObject::tr("qreal"),createQRealPropItem
);
ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("double",""),QObject::tr("qreal"),createQRealPropItem
);
ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("QRect",""),QObject::tr("QRect"),createReqtItem
);
ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("QRectF",""),QObject::tr("QRectF"),createReqtItem
);
ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("geometry","LimeReport::BaseDesignIntf"),QObject::tr("geometry"),createReqtMMItem
);
ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("QString",""),QObject::tr("QString"),createStringPropItem
);
ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("alignment","LimeReport::TextItem"),QObject::tr("alignment"),createAlignItem
);
ObjectPropFactory::instance().registerCreator(
LimeReport::APropIdent("itemLocation","LimeReport::ItemDesignIntf"),QObject::tr("itemLocation"),createLocationPropItem
);
}
SerializatorIntf * createIntSerializator(QDomDocument *doc, QDomElement *node){
return new LimeReport::XmlIntSerializator(doc,node);
}
SerializatorIntf * createQRealSerializator(QDomDocument *doc, QDomElement *node){
return new LimeReport::XmlQRealSerializator(doc,node);
}
SerializatorIntf * createQStringSerializator(QDomDocument *doc, QDomElement *node){
return new LimeReport::XmlQStringSerializator(doc,node);
}
SerializatorIntf * createEnumAndFlagsSerializator(QDomDocument *doc, QDomElement *node){
return new LimeReport::XmlEnumAndFlagsSerializator(doc,node);
}
SerializatorIntf * createBoolSerializator(QDomDocument *doc, QDomElement *node){
return new LimeReport::XmlBoolSerializator(doc,node);
}
SerializatorIntf * createFontSerializator(QDomDocument *doc, QDomElement *node){
return new LimeReport::XmlFontSerializator(doc,node);
}
SerializatorIntf * createQSizeFSerializator(QDomDocument *doc, QDomElement *node){
return new LimeReport::XmlQSizeFSerializator(doc,node);
}
SerializatorIntf * createQImageSerializator(QDomDocument *doc, QDomElement *node){
return new LimeReport::XmlQImageSerializator(doc,node);
}
SerializatorIntf * createQColorSerializator(QDomDocument *doc, QDomElement *node){
return new LimeReport::XmlColorSerializator(doc,node);
}
SerializatorIntf* createQByteArraySerializator(QDomDocument *doc, QDomElement *node){
return new LimeReport::XmlQByteArraySerializator(doc,node);
}
SerializatorIntf* createQVariantSerializator(QDomDocument *doc, QDomElement *node){
return new LimeReport::XmlQVariantSerializator(doc,node);
}
SerializatorIntf * createQRectSerializator(QDomDocument *doc, QDomElement *node){
return new LimeReport::XMLQRectSerializator(doc,node);
}
void initSerializators()
{
XMLAbstractSerializatorFactory::instance().registerCreator("QString", createQStringSerializator);
XMLAbstractSerializatorFactory::instance().registerCreator("int", createIntSerializator);
XMLAbstractSerializatorFactory::instance().registerCreator("enumAndFlags",createEnumAndFlagsSerializator);
XMLAbstractSerializatorFactory::instance().registerCreator("bool", createBoolSerializator);
XMLAbstractSerializatorFactory::instance().registerCreator("QFont", createFontSerializator);
XMLAbstractSerializatorFactory::instance().registerCreator("QSizeF", createQSizeFSerializator);
XMLAbstractSerializatorFactory::instance().registerCreator("QImage", createQImageSerializator);
XMLAbstractSerializatorFactory::instance().registerCreator("qreal", createQRealSerializator);
XMLAbstractSerializatorFactory::instance().registerCreator("double", createQRealSerializator);
XMLAbstractSerializatorFactory::instance().registerCreator("QColor", createQColorSerializator);
XMLAbstractSerializatorFactory::instance().registerCreator("QByteArray", createQByteArraySerializator);
XMLAbstractSerializatorFactory::instance().registerCreator("QVariant", createQVariantSerializator);
XMLAbstractSerializatorFactory::instance().registerCreator("QRect", createQRectSerializator);
XMLAbstractSerializatorFactory::instance().registerCreator("QRectF", createQRectSerializator);
}
} //namespace LimeReport

View File

@ -0,0 +1,6 @@
void initResources();
namespace LimeReport{
void initReportItems();
void initObjectInspectorProperties();
void initSerializators();
} // namespace LimeReport

View File

@ -27,8 +27,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
****************************************************************************/
#ifndef GLOBAL_H
#define GLOBAL_H
#ifndef LRGLOBAL_H
#define LRGLOBAL_H
#include "qglobal.h"
#include <stdexcept>
#include <QString>
@ -76,6 +76,7 @@ namespace Const{
const qreal SELECTION_OPACITY = 0.3;
const QString FIELD_RX = "\\$D\\s*\\{\\s*([^{}]*)\\s*\\}";
const QString VARIABLE_RX = "\\$V\\s*\\{\\s*([^{}]*)\\s*\\}";
const QString NAMED_VARIABLE_RX = "\\$V\\s*\\{\\s*(%1)\\s*\\}";
const QString SCRIPT_RX = "\\$S\\s*\\{(.*)\\}";
//const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(((?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))(\\w+\\.?\\w+)((?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,\\s*\\\"(\\w+)\\\"\\s*\\)";
@ -84,7 +85,8 @@ namespace Const{
//const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:((?:(?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"?\\$S\\s*\\{\\s*)|(?:\\\"))((?:\\w+\\.?\\w+)|(?:\\w+))(?:(?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,)|(?:))\\s*\\\"(\\w+)\\\"\\s*\\)";
//const QString GROUP_FUNCTION_PARAM_RX = "\\((?:(.+),(.+))|(?:\\\"(\\w+)\\\")\\)";
const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:(?:(?:\\\")|(?:))(\\w+)(?:(?:\\\")|(?:)))|(?:(?:(?:\\\")|(?:))(\\s*\\$\\w\\s*\\{.+\\}\\s*)(?:(?:\\\")|(?:))\\s*,\\s*(?:(?:\\\")|(?:))(\\w+)(?:(?:\\\")|(?:))))\\)";
//const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:(?:(?:\\\")|(?:))(\\w+)(?:(?:\\\")|(?:)))|(?:(?:(?:\\\")|(?:))(\\s*\\$\\w\\s*\\{.+\\}\\s*)(?:(?:\\\")|(?:))\\s*,\\s*(?:(?:\\\")|(?:))(\\w+)(?:(?:\\\")|(?:))))\\)";
const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*((?:(?:\\\")|(?:))(?:(?:\\$(?:(?:D\\{\\s*\\w*.\\w*\\s*\\})|(?:V\\{\\s*\\w*\\s*\\})|(?:S\\{.+\\})))|(?:\\w*))(?:(?:\\\")|(?:)))(?:(?:\\s*,\\s*(?:\\\"(\\w*)\\\"))|(?:))\\)";
const int DATASOURCE_INDEX = 3;//4;
const int VALUE_INDEX = 2; //2;
const int EXPRESSION_ARGUMENT_INDEX = 1;//3;

View File

@ -1,5 +1,5 @@
#ifndef GRAPHICSVIEWZOOM_H
#define GRAPHICSVIEWZOOM_H
#ifndef LRGRAPHICSVIEWZOOM_H
#define LRGRAPHICSVIEWZOOM_H
#include <QObject>
#include <QGraphicsView>

View File

@ -59,6 +59,7 @@ void ItemDesignIntf::setItemLocation(LocationType location)
setParentItem(parentBand);
setParent(dynamic_cast<BandDesignIntf*>(parentBand));
setPos(parentPos);
emit itemLocationChanged(this, dynamic_cast<BandDesignIntf*>(parentBand));
} else {
m_itemLocation=Page;
}
@ -69,6 +70,7 @@ void ItemDesignIntf::setItemLocation(LocationType location)
setParentItem(page);
setParent(page);
setPos(parentPos);
emit itemLocationChanged(this, page);
}
}
notify("locationType",oldValue,location);
@ -95,8 +97,8 @@ BaseDesignIntf *ItemDesignIntf::cloneEmpty(int height, QObject *owner, QGraphics
QGraphicsItem * ItemDesignIntf::bandByPos()
{
foreach(QGraphicsItem *item,collidingItems()){
if (dynamic_cast<BandDesignIntf*>(item)){
foreach(QGraphicsItem *item, scene()->items()){
if (dynamic_cast<BandDesignIntf*>(item) && item->collidesWithItem(this)){
return item;
}
}

View File

@ -50,6 +50,8 @@ public:
void setStretchToMaxHeight(bool value);
bool stretchToMaxHeight(){return m_stretchToMaxHeight;}
BaseDesignIntf* cloneEmpty(int height, QObject *owner, QGraphicsItem *parent);
signals:
void itemLocationChanged(BaseDesignIntf* item, BaseDesignIntf* parent);
protected:
QGraphicsItem* bandByPos();
virtual void initFlags();

View File

@ -91,7 +91,7 @@ void ItemsContainerDesignInft::arrangeSubItems(RenderPass pass, DataSourceManage
}
}
qreal ItemsContainerDesignInft::findMaxBottom()
qreal ItemsContainerDesignInft::findMaxBottom() const
{
qreal maxBottom=0;
foreach(QGraphicsItem* item,childItems()){
@ -103,7 +103,7 @@ qreal ItemsContainerDesignInft::findMaxBottom()
return maxBottom;
}
qreal ItemsContainerDesignInft::findMaxHeight()
qreal ItemsContainerDesignInft::findMaxHeight() const
{
qreal maxHeight=0;
foreach(QGraphicsItem* item,childItems()){

View File

@ -1,5 +1,5 @@
#ifndef ITEMSCONTAINERDESIGNITF_H
#define ITEMSCONTAINERDESIGNITF_H
#ifndef LRITEMSCONTAINERDESIGNITF_H
#define LRITEMSCONTAINERDESIGNITF_H
#include "lrbasedesignintf.h"
@ -44,8 +44,8 @@ public:
protected:
void snapshotItemsLayout();
void arrangeSubItems(RenderPass pass, DataSourceManager *dataManager, ArrangeType type = AsNeeded);
qreal findMaxBottom();
qreal findMaxHeight();
qreal findMaxBottom() const;
qreal findMaxHeight() const;
private:
QVector<PItemSortContainer> m_containerItems;

View File

@ -125,7 +125,7 @@ void PageDesignIntf::updatePageRect()
m_pageItem->setRightMargin(5);
m_pageItem->setObjectName("ReportPage1");
connect(m_pageItem.data(), SIGNAL(itemSelected(LimeReport::BaseDesignIntf *)), this, SIGNAL(itemSelected(LimeReport::BaseDesignIntf *)));
connect(m_pageItem.data(), SIGNAL(geometryChanged(QObject *, QRectF, QRectF)), this, SLOT(slotPageGeomertyChanged(QObject *, QRectF, QRectF)));
connect(m_pageItem.data(), SIGNAL(geometryChanged(QObject *, QRectF, QRectF)), this, SLOT(slotPageGeometryChanged(QObject *, QRectF, QRectF)));
connect(m_pageItem.data(), SIGNAL(objectLoaded(QObject *)), this, SLOT(slotPageItemLoaded(QObject *)));
}
this->setSceneRect(-Const::SCENE_MARGIN, -Const::SCENE_MARGIN,
@ -777,7 +777,7 @@ QStringList PageDesignIntf::possibleParentItems()
return itemsList;
}
void PageDesignIntf::slotPageGeomertyChanged(QObject *, QRectF /*newGeometry*/, QRectF)
void PageDesignIntf::slotPageGeometryChanged(QObject *, QRectF /*newGeometry*/, QRectF)
{
if (!m_isLoading){
pageItem()->relocateBands();
@ -1071,6 +1071,14 @@ void PageDesignIntf::setReportSettings(ReportSettings *reportSettings)
m_pageItem->setReportSettings(m_reportSettings);
}
void PageDesignIntf::setPropertyToSelectedItems(const char* name, const QVariant& value)
{
foreach(QGraphicsItem* gi, selectedItems()){
BaseDesignIntf* item = dynamic_cast<BaseDesignIntf*>(gi);
if(item && item->metaObject()->indexOfProperty(name) != -1 ) item->setProperty(name,value);
}
}
bool PageDesignIntf::magneticMovement() const
{
return m_magneticMovement;

View File

@ -182,6 +182,8 @@ namespace LimeReport {
ReportSettings *getReportSettings() const;
void setReportSettings(ReportSettings *reportSettings);
void setPropertyToSelectedItems(const char *name, const QVariant &value);
protected:
virtual void keyPressEvent(QKeyEvent *event);
@ -252,7 +254,7 @@ namespace LimeReport {
void setTextAlign(const Qt::Alignment& alignment);
void setBorders(const BaseDesignIntf::BorderLines& border);
private slots:
void slotPageGeomertyChanged(QObject*, QRectF, QRectF );
void slotPageGeometryChanged(QObject*, QRectF, QRectF );
void slotItemPropertyChanged(QString propertyName, const QVariant &oldValue, const QVariant &newValue);
void slotItemPropertyObjectNameChanged(const QString& oldName, const QString& newName);
void bandDeleted(QObject* band);

View File

@ -202,10 +202,16 @@ int PageItemDesignIntf::calcBandIndex(BandDesignIntf::BandsType bandType, BandDe
int bandIndex=-1;
qSort(m_bands.begin(),m_bands.end(),bandSortBandLessThenByIndex);
foreach(BandDesignIntf* band,m_bands){
if ((band->bandType()==BandDesignIntf::GroupHeader)&&(band->bandType()>bandType)) break;
if ((band->bandType()<=bandType)){
if (bandIndex<=band->bandIndex()) bandIndex=band->maxChildIndex()+1;
}
if ((band->bandType() == BandDesignIntf::GroupHeader) && ( band->bandType() > bandType)) break;
if ((band->bandType() <= bandType)){
if (bandIndex <= band->bandIndex()) {
if (bandType != BandDesignIntf::Data){
bandIndex=band->maxChildIndex(bandType)+1;
} else {
bandIndex=band->maxChildIndex()+1;
}
}
} else { increaseBandIndex = true; break;}
}
if (bandIndex==-1) {
@ -222,7 +228,7 @@ int PageItemDesignIntf::calcBandIndex(BandDesignIntf::BandsType bandType, BandDe
switch (bandType) {
case BandDesignIntf::SubDetailBand:
bandIndex = parentBand->maxChildIndex() + 1;
bandIndex = parentBand->maxChildIndex(bandType) + 1;
increaseBandIndex = true;
break;
case BandDesignIntf::SubDetailHeader:
@ -364,7 +370,8 @@ void PageItemDesignIntf::relocateBands()
if (!(itemMode() & DesignMode)){
while ( (bandIndex < m_bands.count()) &&
((m_bands[bandIndex]->bandType() == BandDesignIntf::TearOffBand) ||
(m_bands[bandIndex]->bandType() == BandDesignIntf::PageFooter))
(m_bands[bandIndex]->bandType() == BandDesignIntf::PageFooter) ||
m_bands[bandIndex]->bandType() == BandDesignIntf::ReportFooter )
){
bandIndex++;
}
@ -588,8 +595,9 @@ void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry
}
}
if (curIndex != band->bandIndex()){
bandToSwap->changeBandIndex(band->bandIndex());
band->changeBandIndex(curIndex);
int swapIndex = bandToSwap->maxChildIndex();
bandToSwap->changeBandIndex(band->bandIndex(),true);
band->changeBandIndex(swapIndex,true);
}
relocateBands();

View File

@ -51,8 +51,16 @@ namespace LimeReport {
ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow *mainWindow, QWidget *parent) :
QWidget(parent), m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false)
{
#ifdef HAVE_QT5
m_tabWidget = new QTabWidget(this);
#endif
#ifdef HAVE_QT4
m_tabWidget = new LimeReportTabWidget(this);
#endif
m_tabWidget->setTabPosition(QTabWidget::South);
m_tabWidget->setMovable(true);
connect(m_tabWidget->tabBar(), SIGNAL(tabMoved(int,int)), this, SLOT(slotTabMoved(int,int)));
QVBoxLayout* mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(m_tabWidget);
setLayout(mainLayout);
@ -152,7 +160,9 @@ void ReportDesignWidget::createTabs(){
view->centerOn(0,0);
view->scale(0.5,0.5);
connectPage(m_report->pageAt(i));
m_tabWidget->addTab(view,QIcon(),tr("Page")+QString::number(i+1));
m_tabWidget->addTab(view,QIcon(),m_report->pageAt(i)->pageItem()->objectName());
connect(m_report->pageAt(i)->pageItem(), SIGNAL(propertyObjectNameChanged(QString,QString)),
this, SLOT(slotPagePropertyObjectNameChanged(QString,QString)));
}
m_scriptEditor = new QTextEdit(this);
m_tabWidget->addTab(m_scriptEditor,QIcon(),tr("Script"));
@ -257,7 +267,7 @@ void ReportDesignWidget::slotItemSelected(BaseDesignIntf *item){
}
void ReportDesignWidget::saveToFile(const QString &fileName){
m_report->scriptContext()->setInitScript(m_scriptEditor->toPlainText());
prepareReport();
if (m_report->saveToFile(fileName)) {
m_report->emitSaveFinished();
}
@ -265,7 +275,7 @@ void ReportDesignWidget::saveToFile(const QString &fileName){
bool ReportDesignWidget::save()
{
m_report->scriptContext()->setInitScript(m_scriptEditor->toPlainText());
prepareReport();
if (!m_report->reportFileName().isEmpty()){
if (m_report->saveToFile()){
m_report->emitSaveFinished();
@ -454,15 +464,21 @@ void ReportDesignWidget::setBorders(const BaseDesignIntf::BorderLines& borders)
activePage()->setBorders(borders);
}
void ReportDesignWidget::prepareReport()
{
m_report->scriptContext()->setInitScript(m_scriptEditor->toPlainText());
report()->clearSelection();
}
void ReportDesignWidget::previewReport()
{
report()->scriptContext()->setInitScript(m_scriptEditor->toPlainText());
prepareReport();
report()->previewReport();
}
void ReportDesignWidget::printReport()
{
report()->scriptContext()->setInitScript(m_scriptEditor->toPlainText());
prepareReport();
setCursor(Qt::WaitCursor);
report()->printReport();
setCursor(Qt::ArrowCursor);
@ -476,8 +492,10 @@ void ReportDesignWidget::addPage()
PageDesignIntf* page = m_report->appendPage("page"+QString::number(m_report->pageCount()+1));
view->setScene(page);
int index = m_report->pageCount()-1;
m_tabWidget->insertTab(index,view,QIcon(),tr("Page")+QString::number(m_report->pageCount()));
m_tabWidget->insertTab(index,view,QIcon(),page->pageItem()->objectName());
m_tabWidget->setCurrentIndex(index);
connect(page->pageItem(), SIGNAL(propertyObjectNameChanged(QString,QString)),
this, SLOT(slotPagePropertyObjectNameChanged(QString,QString)));
connectPage(page);
view->scale(0.5,0.5);
view->centerOn(0,0);
@ -608,6 +626,41 @@ void ReportDesignWidget::slotCurrentTabChanged(int index)
emit activePageChanged();
}
void ReportDesignWidget::slotPagePropertyObjectNameChanged(const QString &oldValue, const QString &newValue)
{
for (int i = 0; i < m_tabWidget->count(); ++i ){
if (m_tabWidget->tabText(i).compare(oldValue) == 0){
QGraphicsView* view = dynamic_cast<QGraphicsView*>(m_tabWidget->widget(i));
if (view){
PageDesignIntf* page = dynamic_cast<PageDesignIntf*>(view->scene());
if (page->pageItem() == sender())
m_tabWidget->setTabText(i, newValue);
}
}
}
}
void ReportDesignWidget::slotTabMoved(int from, int to)
{
Q_UNUSED(from)
Q_UNUSED(to)
QList<PageDesignIntf*> pages;
for ( int i = 0; i < m_tabWidget->tabBar()->count(); ++i){
QGraphicsView* view = dynamic_cast<QGraphicsView*>(m_tabWidget->widget(i));
if (view){
PageDesignIntf* page = dynamic_cast<PageDesignIntf*>(view->scene());
if (page){
pages.append(page);
}
}
}
m_report->reorderPages(pages);
}
bool ReportDesignWidget::eventFilter(QObject *target, QEvent *event)
{
if (event->type() == QEvent::Wheel){

View File

@ -42,6 +42,16 @@
#include "lrreportengine_p.h"
#include "lrgraphicsviewzoom.h"
#ifdef HAVE_QT4
QT_BEGIN_NAMESPACE
class LimeReportTabWidget: public QTabWidget{
Q_OBJECT
public:
explicit LimeReportTabWidget(QWidget *parent = 0):QTabWidget(parent){}
QTabBar* tabBar() const{ return QTabWidget::tabBar();}
};
QT_END_NAMESPACE
#endif
namespace LimeReport {
@ -128,6 +138,8 @@ private slots:
void slotDatasourceCollectionLoaded(const QString&);
void slotSceneRectChanged(QRectF);
void slotCurrentTabChanged(int index);
void slotPagePropertyObjectNameChanged(const QString& oldValue, const QString& newValue);
void slotTabMoved(int from, int to);
signals:
void insertModeStarted();
void itemInserted(LimeReport::PageDesignIntf*,QPointF,const QString&);
@ -156,7 +168,12 @@ private:
QGraphicsView *m_view;
QTextEdit* m_scriptEditor;
QMainWindow *m_mainWindow;
#ifdef HAVE_QT5
QTabWidget* m_tabWidget;
#endif
#ifdef HAVE_QT4
LimeReportTabWidget* m_tabWidget;
#endif
GraphicsViewZoomer* m_zoomer;
QFont m_defaultFont;
int m_verticalGridStep;
@ -164,6 +181,7 @@ private:
bool m_useGrid;
bool m_useMagnet;
// static ReportDesignWidget* m_instance;
void prepareReport();
};
}

View File

@ -217,16 +217,16 @@ void ReportDesignWindow::createActions()
m_aboutAction->setIcon(QIcon(":/report/images/copyright"));
connect(m_aboutAction,SIGNAL(triggered()),this,SLOT(slotShowAbout()));
m_hideLeftPanel = new QAction(tr("Hide left panel"),this);
m_hideLeftPanel = new QAction(tr("Hide left panel | Alt+L"),this);
m_hideLeftPanel->setCheckable(true);
// m_hideLeftPanel->setChecked(true);
m_hideLeftPanel->setIcon(QIcon(":/report/images/hideLeftPanel"));
m_hideLeftPanel->setShortcut(QKeySequence(Qt::ALT + Qt::Key_L));
connect(m_hideLeftPanel,SIGNAL(toggled(bool)), this, SLOT(slotHideLeftPanel(bool)));
m_hideRightPanel = new QAction(tr("Hide right panel"),this);
m_hideRightPanel = new QAction(tr("Hide right panel | Alt+R"),this);
m_hideRightPanel->setCheckable(true);
// m_hideRightPanel->setChecked(true);
m_hideRightPanel->setIcon(QIcon(":/report/images/hideRightPanel"));
m_hideRightPanel->setShortcut(QKeySequence(Qt::ALT + Qt::Key_R));
connect(m_hideRightPanel,SIGNAL(toggled(bool)), this, SLOT(slotHideRightPanel(bool)));
}
@ -683,7 +683,7 @@ bool ReportDesignWindow::checkNeedToSave()
{
if (m_reportDesignWidget->isNeedToSave()){
QMessageBox::StandardButton button = QMessageBox::question(
this,"",tr("Report has been modified ! Do you want save the report ?"),
this,"",tr("Report has been modified! Do you want save the report?"),
QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel, QMessageBox::Yes
);
switch (button) {
@ -1058,8 +1058,10 @@ void ReportDesignWindow::slotBandAdded(PageDesignIntf *, BandDesignIntf * band)
break;
case BandDesignIntf::ReportFooter:
m_newReportFooter->setDisabled(true);
break;
case BandDesignIntf::TearOffBand:
m_newTearOffBand->setDisabled(true);
break;
default:
break;
}
@ -1267,7 +1269,7 @@ bool ObjectNameValidator::validate(const QString &propName, const QVariant &prop
BaseDesignIntf* bd = dynamic_cast<BaseDesignIntf*>(object);
if (bd){
if (bd->page()->reportItemByName(propValue.toString())){
msg = QString(QObject::tr("Object with name %1 already exists").arg(propValue.toString()));
msg = QString(QObject::tr("Object with name %1 already exists!").arg(propValue.toString()));
return false;
} else (bd->emitObjectNamePropertyChanged(object->objectName(),propValue.toString()));
}

View File

@ -50,7 +50,9 @@
#include "lrpreviewreportwindow.h"
#include "lrpreviewreportwidget.h"
#include "lrpreviewreportwidget_p.h"
#ifdef HAVE_STATIC_BUILD
#include "lrfactoryinitializer.h"
#endif
namespace LimeReport{
QSettings* ReportEngine::m_settings = 0;
@ -63,8 +65,15 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) :
m_reportRendering(false), m_resultIsEditable(true), m_passPhrase("HjccbzHjlbyfCkjy"),
m_fileWatcher( new QFileSystemWatcher( this ) )
{
#ifdef HAVE_STATIC_BUILD
initResources();
initReportItems();
initObjectInspectorProperties();
initSerializators();
#endif
m_datasources = new DataSourceManager(this);
m_datasources->setReportSettings(&m_reportSettings);
scriptManager()->setDataManager(m_datasources);
m_scriptEngineContext = new ScriptEngineContext(this);
m_datasources->setObjectName("datasources");
connect(m_datasources,SIGNAL(loadCollectionFinished(QString)),this,SLOT(slotDataSourceCollectionLoaded(QString)));
@ -98,6 +107,7 @@ PageDesignIntf *ReportEnginePrivate::createPage(const QString &pageName)
{
PageDesignIntf* page =new PageDesignIntf();
page->setObjectName(pageName);
page->pageItem()->setObjectName("Report"+pageName);
page->setReportEditor(this);
page->setReportSettings(&m_reportSettings);
return page;
@ -355,7 +365,7 @@ bool ReportEnginePrivate::printToPDF(const QString &fileName)
void ReportEnginePrivate::previewReport(PreviewHints hints)
{
QTime start = QTime::currentTime();
// QTime start = QTime::currentTime();
try{
dataManager()->setDesignTime(false);
ReportPages pages = renderToPages();
@ -370,6 +380,7 @@ void ReportEnginePrivate::previewReport(PreviewHints hints)
w->setWindowTitle(m_previewWindowTitle);
w->setSettings(settings());
w->setPages(pages);
w->setLayoutDirection(m_previewLayoutDirection);
if (!dataManager()->errorsList().isEmpty()){
w->setErrorMessages(dataManager()->errorsList());
}
@ -384,7 +395,6 @@ void ReportEnginePrivate::previewReport(PreviewHints hints)
m_activePreview = w;
connect(w,SIGNAL(destroyed(QObject*)), this, SLOT(slotPreviewWindowDestroyed(QObject*)));
qDebug()<<"render time ="<<start.msecsTo(QTime::currentTime());
w->exec();
}
} catch (ReportError &exception){
@ -707,11 +717,38 @@ QString ReportEnginePrivate::renderToString()
}else return QString();
}
Qt::LayoutDirection ReportEnginePrivate::previewLayoutDirection()
{
return m_previewLayoutDirection;
}
void ReportEnginePrivate::setPreviewLayoutDirection(const Qt::LayoutDirection& layoutDirection)
{
m_previewLayoutDirection = layoutDirection;
}
void ReportEnginePrivate::setPassPhrase(const QString &passPhrase)
{
m_passPhrase = passPhrase;
}
void ReportEnginePrivate::reorderPages(const QList<PageDesignIntf *>& reorderedPages)
{
m_pages.clear();
foreach(PageDesignIntf* page, reorderedPages){
m_pages.append(page);
}
}
void ReportEnginePrivate::clearSelection()
{
foreach (PageDesignIntf* page, m_pages) {
foreach(QGraphicsItem* item, page->selectedItems()){
item->setSelected(false);
}
}
}
bool ReportEnginePrivate::resultIsEditable() const
{
return m_resultIsEditable;
@ -896,6 +933,18 @@ void ReportEngine::setPassPharse(QString &passPharse)
d->setPassPhrase(passPharse);
}
Qt::LayoutDirection ReportEngine::previewLayoutDirection()
{
Q_D(ReportEngine);
return d->previewLayoutDirection();
}
void ReportEngine::setPreviewLayoutDirection(const Qt::LayoutDirection& layoutDirection)
{
Q_D(ReportEngine);
return d->setPreviewLayoutDirection(layoutDirection);
}
void ReportEngine::setShowProgressDialog(bool value)
{
Q_D(ReportEngine);

View File

@ -102,6 +102,8 @@ public:
bool resultIsEditable();
bool isBusy();
void setPassPharse(QString& passPharse);
Qt::LayoutDirection previewLayoutDirection();
void setPreviewLayoutDirection(const Qt::LayoutDirection& previewLayoutDirection);
signals:
void renderStarted();
void renderFinished();

View File

@ -128,7 +128,10 @@ public:
void setResultEditable(bool value);
void setPassPhrase(const QString &passPhrase);
void reorderPages(const QList<PageDesignIntf *> &reorderedPages);
void clearSelection();
Qt::LayoutDirection previewLayoutDirection();
void setPreviewLayoutDirection(const Qt::LayoutDirection& previewLayoutDirection);
signals:
void pagesLoadFinished();
void datasourceCollectionLoadFinished(const QString& collectionName);
@ -181,8 +184,8 @@ private:
bool m_reportRendering;
bool m_resultIsEditable;
QString m_passPhrase;
QFileSystemWatcher *m_fileWatcher;
Qt::LayoutDirection m_previewLayoutDirection;
};
}

View File

@ -148,7 +148,7 @@ void ReportRender::renameChildItems(BaseDesignIntf *item){
ReportRender::ReportRender(QObject *parent)
:QObject(parent), m_renderPageItem(0), m_pageCount(0),
m_lastDataBand(0), m_lastRenderedFooter(0), m_currentColumn(0)
m_lastDataBand(0), m_lastRenderedFooter(0), m_currentColumn(0), m_newPageStarted(false)
{
initColumns();
}
@ -247,8 +247,6 @@ void ReportRender::renderPage(PageDesignIntf* patternPage)
clearPageMap();
startNewPage();
renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader), 0, StartNewPageAsNeeded);
BandDesignIntf* lastRenderedBand = 0;
@ -311,6 +309,8 @@ void ReportRender::initVariables()
{
m_datasources->setReportVariable("#PAGE",1);
m_datasources->setReportVariable("#PAGE_COUNT",0);
m_datasources->setReportVariable("#IS_LAST_PAGEFOOTER",false);
m_datasources->setReportVariable("#IS_FIRST_PAGEFOOTER",false);
}
#ifdef HAVE_UI_LOADER
@ -330,68 +330,87 @@ void ReportRender::clearPageMap()
m_renderedPages.clear();
}
void ReportRender::extractGroupsFunction(BandDesignIntf *band)
{
foreach(BaseDesignIntf* item,band->childBaseItems()){
ContentItemDesignIntf* contentItem = dynamic_cast<ContentItemDesignIntf*>(item);
if (contentItem&&(contentItem->content().contains(QRegExp("\\$S\\s*\\{.*\\}")))){
foreach(const QString &functionName, m_datasources->groupFunctionNames()){
QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName));
QRegExp rxName(QString(Const::GROUP_FUNCTION_NAME_RX).arg(functionName));
if (rx.indexIn(contentItem->content())>=0){
int pos = 0;
while ( (pos = rx.indexIn(contentItem->content(),pos)) != -1){
QVector<QString> captures = normalizeCaptures(rx);
if (captures.size()>=3){
int dsIndex = captures.size() == 3 ? Const::DATASOURCE_INDEX - 1 : Const::DATASOURCE_INDEX;
BandDesignIntf* dataBand = m_patternPageItem->bandByName(captures.at(dsIndex));
if (dataBand){
GroupFunction* gf = datasources()->addGroupFunction(functionName,captures.at(Const::VALUE_INDEX),band->objectName(),dataBand->objectName());
if (gf){
connect(dataBand,SIGNAL(bandRendered(BandDesignIntf*)),gf,SLOT(slotBandRendered(BandDesignIntf*)));
}
} else {
GroupFunction* gf = datasources()->addGroupFunction(functionName,captures.at(Const::VALUE_INDEX),band->objectName(),captures.at(dsIndex));
gf->setInvalid(tr("Databand \"%1\" not found").arg(captures.at(dsIndex)));
void ReportRender::extractGroupFuntionsFromItem(ContentItemDesignIntf* contentItem, BandDesignIntf* band){
if ( contentItem && contentItem->content().contains(QRegExp("\\$S\\s*\\{.*\\}"))){
foreach(const QString &functionName, m_datasources->groupFunctionNames()){
QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName));
QRegExp rxName(QString(Const::GROUP_FUNCTION_NAME_RX).arg(functionName));
if (rx.indexIn(contentItem->content())>=0){
int pos = 0;
while ( (pos = rx.indexIn(contentItem->content(),pos)) != -1){
QVector<QString> captures = normalizeCaptures(rx);
if (captures.size()>=3){
int dsIndex = captures.size() == 3 ? Const::DATASOURCE_INDEX - 1 : Const::DATASOURCE_INDEX;
BandDesignIntf* dataBand = m_patternPageItem->bandByName(captures.at(dsIndex));
if (dataBand){
GroupFunction* gf = datasources()->addGroupFunction(functionName,captures.at(Const::VALUE_INDEX),band->objectName(),dataBand->objectName());
if (gf){
connect(dataBand,SIGNAL(bandRendered(BandDesignIntf*)),gf,SLOT(slotBandRendered(BandDesignIntf*)));
}
} else {
GroupFunction* gf = datasources()->addGroupFunction(functionName,captures.at(Const::VALUE_INDEX),band->objectName(),captures.at(dsIndex));
gf->setInvalid(tr("Databand \"%1\" not found").arg(captures.at(dsIndex)));
}
pos += rx.matchedLength();
}
} else if (rxName.indexIn(contentItem->content())>=0){
GroupFunction* gf = datasources()->addGroupFunction(functionName,rxName.cap(1),band->objectName(),"");
gf->setInvalid(tr("Wrong using function %1").arg(functionName));
pos += rx.matchedLength();
}
} else if (rxName.indexIn(contentItem->content())>=0){
GroupFunction* gf = datasources()->addGroupFunction(functionName,rxName.cap(1),band->objectName(),"");
gf->setInvalid(tr("Wrong using function %1").arg(functionName));
}
}
}
}
void ReportRender::replaceGroupsFunction(BandDesignIntf *band)
{
foreach(BaseDesignIntf* item,band->childBaseItems()){
void ReportRender::extractGroupFunctionsFromContainer(BaseDesignIntf* baseItem, BandDesignIntf* band){
foreach (BaseDesignIntf* item, baseItem->childBaseItems()) {
ContentItemDesignIntf* contentItem = dynamic_cast<ContentItemDesignIntf*>(item);
if (contentItem){
QString content = contentItem->content();
foreach(const QString &functionName, m_datasources->groupFunctionNames()){
QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName));
if (rx.indexIn(content)>=0){
int pos = 0;
while ( (pos = rx.indexIn(content,pos))!= -1 ){
QVector<QString> captures = normalizeCaptures(rx);
if (captures.size() >= 3){
QString expressionIndex = datasources()->putGroupFunctionsExpressions(captures.at(Const::VALUE_INDEX));
content.replace(captures.at(0),QString("%1(%2,%3)").arg(functionName).arg('"'+expressionIndex+'"').arg('"'+band->objectName()+'"'));
}
pos += rx.matchedLength();
if (contentItem) extractGroupFuntionsFromItem(contentItem, band);
else extractGroupFunctionsFromContainer(item, band);
}
}
void ReportRender::extractGroupFunctions(BandDesignIntf *band)
{
extractGroupFunctionsFromContainer(band, band);
}
void ReportRender::replaceGroupFunctionsInItem(ContentItemDesignIntf* contentItem, BandDesignIntf* band){
if (contentItem){
QString content = contentItem->content();
foreach(const QString &functionName, m_datasources->groupFunctionNames()){
QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName));
if (rx.indexIn(content)>=0){
int pos = 0;
while ( (pos = rx.indexIn(content,pos))!= -1 ){
QVector<QString> captures = normalizeCaptures(rx);
if (captures.size() >= 3){
QString expressionIndex = datasources()->putGroupFunctionsExpressions(captures.at(Const::VALUE_INDEX));
content.replace(captures.at(0),QString("%1(%2,%3)").arg(functionName).arg('"'+expressionIndex+'"').arg('"'+band->objectName()+'"'));
}
contentItem->setContent(content);
pos += rx.matchedLength();
}
contentItem->setContent(content);
}
}
}
}
void ReportRender::replaceGroupFunctionsInContainer(BaseDesignIntf* baseItem, BandDesignIntf* band)
{
foreach(BaseDesignIntf* item, baseItem->childBaseItems()){
ContentItemDesignIntf* contentItem = dynamic_cast<ContentItemDesignIntf*>(item);
if (contentItem) replaceGroupFunctionsInItem(contentItem, band);
else replaceGroupFunctionsInContainer(item, band);
}
}
void ReportRender::replaceGroupsFunction(BandDesignIntf *band)
{
replaceGroupFunctionsInContainer(band, band);
}
BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesignIntf* bandData, ReportRender::DataRenderMode mode, bool isLast)
{
QApplication::processEvents();
@ -413,7 +432,6 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign
if (patternBand->isFooter())
m_lastRenderedFooter = patternBand;
bandClone->setBackgroundColor(
(datasources()->variable(QLatin1String("line_")+patternBand->objectName().toLower()).toInt() %2 !=0 ?
bandClone->backgroundColor():
@ -431,6 +449,8 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign
if (!bandClone->isEmpty() || patternBand->printIfEmpty()){
if (!registerBand(bandClone)){
if (patternBand && patternBand->isHeader() && patternBand->reprintOnEachPage())
m_reprintableBands.removeOne(patternBand);
if (bandClone->canBeSplitted(m_maxHeightByColumn[m_currentColumn])){
bandClone = sliceBand(bandClone,patternBand,isLast);
} else {
@ -488,6 +508,7 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand)
IDataSource* bandDatasource = 0;
m_lastRenderedFooter = 0;
if (!dataBand->datasourceName().isEmpty())
bandDatasource = datasources()->dataSource(dataBand->datasourceName());
@ -507,7 +528,7 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand)
if (dataBand->bandHeader() && dataBand->bandHeader()->reprintOnEachPage())
m_reprintableBands.append(dataBand->bandHeader());
renderChildHeader(dataBand,PrintNotAlwaysPrintable);
//renderChildHeader(dataBand,PrintNotAlwaysPrintable);
renderGroupHeader(dataBand, bandDatasource, true);
bool firstTime = true;
@ -537,6 +558,7 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand)
renderBand(header, 0, StartNewPageAsNeeded);
renderBand(dataBand, rawData, StartNewPageAsNeeded, !bandDatasource->hasNext());
m_newPageStarted = false;
renderChildBands(dataBand);
}
@ -557,7 +579,10 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand)
m_reprintableBands.removeOne(dataBand->bandHeader());
renderGroupFooter(dataBand);
if (bandDatasource->prior()){
renderGroupFooter(dataBand);
bandDatasource->next();
}
if (footer && !footer->printAlways())
renderBand(footer, 0, StartNewPageAsNeeded);
@ -614,9 +639,9 @@ void ReportRender::renderPageItems(PageItemDesignIntf* patternPage)
}
m_renderPageItem->restoreLinks();
m_renderPageItem->updateSubItemsSize(FirstPass,m_datasources);
// foreach(BaseDesignIntf* item, pageItems){
// item->updateItemSize(m_datasources);
// }
foreach(BaseDesignIntf* item, pageItems){
item->setZValue(item->zValue()-100000);
}
}
qreal ReportRender::calcPageFooterHeight(PageItemDesignIntf *patternPage)
@ -638,7 +663,8 @@ void ReportRender::renderChildHeader(BandDesignIntf *parent, BandPrintMode print
if (band->metaObject()->indexOfProperty("printAlways")>0){
printAlways=band->property("printAlways").toBool();
}
if (printAlways == (printMode==PrintAlwaysPrintable) ) renderBand(band, 0, StartNewPageAsNeeded);
if (printAlways == (printMode == PrintAlwaysPrintable))
renderBand(band, 0, StartNewPageAsNeeded);
}
}
@ -662,9 +688,9 @@ void ReportRender::renderChildBands(BandDesignIntf *parentBand)
if (!band->datasourceName().isEmpty())
ds = m_datasources->dataSource(band->datasourceName());
if (ds) ds->first();
renderChildHeader(band,PrintAlwaysPrintable);
//renderChildHeader(band,PrintAlwaysPrintable);
renderDataBand(band);
renderChildFooter(band,PrintAlwaysPrintable);
//renderChildFooter(band,PrintAlwaysPrintable);
closeFooterGroup(band);
}
}
@ -675,7 +701,7 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da
IGroupBand* gb = dynamic_cast<IGroupBand*>(band);
if (gb&&gb->isNeedToClose(m_datasources)){
if (band->childBands().count()>0){
dataSource->prior();
bool didGoBack = dataSource->prior();
foreach (BandDesignIntf* subBand, band->childrenByType(BandDesignIntf::GroupHeader)) {
foreach(BandDesignIntf* footer, subBand->childrenByType(BandDesignIntf::GroupFooter)){
renderBand(footer, 0);
@ -687,7 +713,9 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da
renderBand(footer, 0, StartNewPageAsNeeded);
}
dataSource->next();
if (didGoBack){
dataSource->next();
}
}
closeDataGroup(band);
// if (gb->isNeedToStartNewPage()){
@ -697,13 +725,19 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da
}
if (gb && !gb->isStarted()){
if (band->reprintOnEachPage())
if (band->reprintOnEachPage()){
m_reprintableBands.append(band);
}
gb->startGroup(m_datasources);
openDataGroup(band);
if (!firstTime && gb->startNewPage()){
if (!firstTime && gb->startNewPage() && !m_newPageStarted){
if (gb->resetPageNumber()) resetPageNumber(BandReset);
renderBand(band, 0, ForcedStartPage);
if (band->reprintOnEachPage()){
savePage();
startNewPage();
} else {
renderBand(band, 0, ForcedStartPage);
}
} else {
renderBand(band, 0, StartNewPageAsNeeded);
}
@ -743,7 +777,7 @@ void ReportRender::initGroups()
{
m_datasources->clearGroupFunction();
foreach(BandDesignIntf* band, m_patternPageItem->childBands()){
if (band->isFooter()) extractGroupsFunction(band);
if (band->isFooter()) extractGroupFunctions(band);
if (band->isHeader()){
IGroupBand* gb = dynamic_cast<IGroupBand*>(band);
if (gb) gb->closeGroup();
@ -818,6 +852,14 @@ void ReportRender::closeDataGroup(BandDesignIntf *band)
if (groupBand){
groupBand->closeGroup();
if (band->reprintOnEachPage()) m_reprintableBands.removeOne(band);
QList<BandDesignIntf*>::Iterator it = m_reprintableBands.begin();
while (it != m_reprintableBands.end()){
if ((*it)->bandIndex()>band->bandIndex())
it = m_reprintableBands.erase(it);
else
it++;
}
}
closeGroup(band);
}
@ -857,7 +899,8 @@ bool ReportRender::registerBand(BandDesignIntf *band, bool registerInChildren)
}
}
if ( (band->columnsCount()>1) && !band->isHeader()){
if ( (band->columnsCount()>1) &&
(!band->isHeader() || (band->bandNestingLevel()>0 && band->columnsFillDirection() != BandDesignIntf::Horizontal ))){
if (m_maxHeightByColumn.size()!=band->columnsCount()){
for(int i=1;i<band->columnsCount();++i){
@ -885,7 +928,8 @@ bool ReportRender::registerBand(BandDesignIntf *band, bool registerInChildren)
m_maxHeightByColumn[m_currentColumn]-=band->height();
}
if (band->isHeader() && band->columnsCount()>1){
if ( (band->columnsCount()>1) &&
(band->isHeader() && (band->bandNestingLevel()==0 || band->columnsFillDirection()==BandDesignIntf::Horizontal))){
qreal bandPos = m_currentStartDataPos[m_currentColumn];
m_currentStartDataPos[m_currentColumn]+=band->height();
@ -1042,8 +1086,9 @@ void ReportRender::startNewColumn(){
void ReportRender::startNewPage()
{
m_renderPageItem=0;
m_currentColumn=0;
m_renderPageItem = 0;
m_currentColumn = 0;
m_newPageStarted = true;
initColumns();
initRenderPage();
@ -1065,14 +1110,13 @@ void ReportRender::startNewPage()
m_dataAreaSize = m_maxHeightByColumn[m_currentColumn];
m_renderedDataBandCount = 0;
foreach (BandDesignIntf* band, m_reprintableBands) {
renderBand(band, 0);
}
checkLostHeadersOnPrevPage();
pasteGroups();
renderPageItems(m_patternPageItem);
}
void ReportRender::resetPageNumber(ResetPageNuberType resetType)
@ -1205,6 +1249,11 @@ void ReportRender::moveTearOffBand(){
void ReportRender::savePage(bool isLast)
{
m_datasources->setReportVariable("#IS_LAST_PAGEFOOTER",isLast);
m_datasources->setReportVariable("#IS_FIRST_PAGEFOOTER",m_datasources->variable("#PAGE").toInt()==1);
renderPageItems(m_patternPageItem);
checkFooterGroup(m_lastDataBand);
cutGroups();
rearrangeColumnsItems();

View File

@ -40,6 +40,7 @@ namespace LimeReport{
class PageDesignIntf;
class BandDesignIntf;
class ContentItemDesignIntf;
class GroupBandsHolder: public QList<BandDesignIntf*>{
public:
@ -86,9 +87,7 @@ signals:
public slots:
void cancelRender();
private:
void baseDesignIntfToScript(BaseDesignIntf* item);
void renderPage(PageDesignIntf *patternPage);
void initDatasources();
void initDatasource(const QString &name);
@ -112,9 +111,12 @@ private:
void renderChildBands(BandDesignIntf* parentBand);
void renderGroupHeader(BandDesignIntf* parentBand, IDataSource* dataSource, bool firstTime);
void renderGroupFooter(BandDesignIntf* parentBand);
void initGroups();
void extractGroupsFunction(BandDesignIntf* band);
void extractGroupFuntionsFromItem(ContentItemDesignIntf* contentItem, BandDesignIntf* band);
void extractGroupFunctionsFromContainer(BaseDesignIntf* baseItem, BandDesignIntf* band);
void extractGroupFunctions(BandDesignIntf* band);
void replaceGroupFunctionsInItem(ContentItemDesignIntf* contentItem, BandDesignIntf* band);
void replaceGroupFunctionsInContainer(BaseDesignIntf* baseItem, BandDesignIntf* band);
void replaceGroupsFunction(BandDesignIntf* band);
void popPageFooterGroupValues(BandDesignIntf* dataBand);
@ -183,6 +185,8 @@ private:
QList<PagesRange> m_ranges;
QVector<BandDesignIntf*> m_columnedBandItems;
unsigned long long m_curentNameIndex;
bool m_newPageStarted;
};
} // namespace LimeReport

View File

@ -216,7 +216,11 @@ QScriptValue setVariable(QScriptContext* pcontext, QScriptEngine* /*pengine*/){
ScriptEngineManager* sm = qscriptvalue_cast<ScriptEngineManager*>(pcontext->callee().data());
DataSourceManager* dm = sm->dataManager();
dm->changeVariable(name,value);
if (dm->containsVariable(name))
dm->changeVariable(name,value);
else
dm->addVariable(name, value);
return QScriptValue();
}
@ -268,6 +272,35 @@ QScriptValue currencyUSBasedFormat(QScriptContext* pcontext, QScriptEngine* peng
return pengine->newVariant(vTempStr);
}
#endif
/*
* sectotimeFormat(int seconds, string format)
* - convert seconds to time format without day border!
*
* examples (base: 60 days 7 Minutes 2 Seconds = 5184422 seconds):
* (3600 * 24 * 60) + (7 * 60) + 2 seconds with format hh:mm:ss = 1440:07:02
* (3600 * 24 * 60) + (7 * 60) + 2 seconds with format mm:s = 86407:2
* (3600 * 24 * 60) + (7 * 60) + 2 seconds with format ss = 5184422
*/
QScriptValue sectotimeFormat(QScriptContext* pcontext, QScriptEngine* pengine){
// simplify values
QVariant value = pcontext->argument(0).toVariant();
QString format = (pcontext->argumentCount()>1)?pcontext->argument(1).toString().toLatin1():"hh:mm:ss";
// algorithm adapted from: https://stackoverflow.com/a/25697134/4954370
int seconds = value.toInt();
int minutes = seconds / 60;
int hours = minutes / 60;
// replace the following formats: hh, mm, ss, h, m, s
bool hasHour = format.contains("h");
bool hasMinute = format.contains("m");
for(int len = 2; len; len--) {
if(hasHour) format.replace(QString('h').repeated(len), QString::number(hours).rightJustified(len, '0'));
if(hasMinute) format.replace(QString('m').repeated(len), QString::number(hasHour ? minutes % 60 : minutes).rightJustified(len, '0'));
format.replace(QString('s').repeated(len), QString::number(hasMinute ? seconds % 60 : seconds).rightJustified(len, '0'));
}
return QScriptValue(format);
}
QScriptValue dateFormat(QScriptContext* pcontext, QScriptEngine* pengine){
QVariant value = pcontext->argument(0).toVariant();
QString format = (pcontext->argumentCount()>1)?pcontext->argument(1).toString().toLatin1():"dd.MM.yyyy";
@ -427,7 +460,7 @@ void ScriptEngineManager::setDataManager(DataSourceManager *dataManager){
if (m_dataManager){
foreach(QString func, m_dataManager->groupFunctionNames()){
if (isFunctionExists(func)) deleteFunction(func);
addFunction(func, groupFunction,"GROUP FUNCTIONS", func+"(\""+tr("Value")+"\",\""+tr("BandName")+"\")");
addFunction(func, groupFunction,tr("GROUP FUNCTIONS"), func+"(\""+tr("Value")+"\",\""+tr("BandName")+"\")");
}
foreach(ScriptFunctionDesc func, m_functions){
if (func.type==ScriptFunctionDesc::Native)
@ -551,9 +584,9 @@ QString ScriptEngineManager::expandScripts(QString context, QVariant& varValue,
if (reportItem){
QScriptValue svThis = se->globalObject().property("THIS");
if (svThis.isValid()){
se->newQObject(svThis, this);
se->newQObject(svThis, reportItem);
} else {
svThis = se->newQObject(this);
svThis = se->newQObject(reportItem);
se->globalObject().setProperty("THIS",svThis);
}
}
@ -612,22 +645,23 @@ ScriptEngineManager::ScriptEngineManager()
m_scriptEngine = new QScriptEngine;
//addFunction("dateToStr",dateToStr,"DATE", "dateToStr(\"value\",\"format\")");
addFunction("line",line,"SYSTEM", "line(\""+tr("BandName")+"\")");
addFunction("numberFormat",numberFormat,"NUMBER", "numberFormat(\""+tr("Value")+"\",\""+tr("Format")+"\",\""+
addFunction("line",line,tr("SYSTEM"), "line(\""+tr("BandName")+"\")");
addFunction("numberFormat",numberFormat,tr("NUMBER"), "numberFormat(\""+tr("Value")+"\",\""+tr("Format")+"\",\""+
tr("Precision")+"\",\""+
tr("Locale")+"\")");
addFunction("dateFormat",dateFormat,"DATE&TIME", "dateFormat(\""+tr("Value")+"\",\""+tr("Format")+"\")");
addFunction("timeFormat",timeFormat,"DATE&TIME", "dateFormat(\""+tr("Value")+"\",\""+tr("Format")+"\")");
addFunction("dateTimeFormat", dateTimeFormat, "DATE&TIME", "dateTimeFormat(\""+tr("Value")+"\",\""+tr("Format")+"\")");
addFunction("date",date,"DATE&TIME","date()");
addFunction("now",now,"DATE&TIME","now()");
addFunction("sectotimeFormat",sectotimeFormat,tr("DATE&TIME"), "sectotimeFormat(\""+tr("Seconds")+"\",\""+tr("Format")+"\")");
addFunction("dateFormat",dateFormat,tr("DATE&TIME"), "dateFormat(\""+tr("Value")+"\",\""+tr("Format")+"\")");
addFunction("timeFormat",timeFormat,tr("DATE&TIME"), "dateFormat(\""+tr("Value")+"\",\""+tr("Format")+"\")");
addFunction("dateTimeFormat", dateTimeFormat, tr("DATE&TIME"), "dateTimeFormat(\""+tr("Value")+"\",\""+tr("Format")+"\")");
addFunction("date",date,tr("DATE&TIME"),"date()");
addFunction("now",now,tr("DATE&TIME"),"now()");
#if QT_VERSION>0x040800
addFunction("currencyFormat",currencyFormat,"NUMBER","currencyFormat(\""+tr("Value")+"\",\""+tr("Locale")+"\")");
addFunction("currencyUSBasedFormat",currencyUSBasedFormat,"NUMBER","currencyUSBasedFormat(\""+tr("Value")+",\""+tr("CurrencySymbol")+"\")");
addFunction("currencyFormat",currencyFormat,tr("NUMBER"),"currencyFormat(\""+tr("Value")+"\",\""+tr("Locale")+"\")");
addFunction("currencyUSBasedFormat",currencyUSBasedFormat,tr("NUMBER"),"currencyUSBasedFormat(\""+tr("Value")+",\""+tr("CurrencySymbol")+"\")");
#endif
addFunction("setVariable", setVariable, "GENERAL", "setVariable(\""+tr("Name")+"\",\""+tr("Value")+"\")");
addFunction("getVariable", getVariable, "GENERAL", "getVariable(\""+tr("Name")+"\")");
addFunction("getField", getField, "GENERAL", "getField(\""+tr("Name")+"\")");
addFunction("setVariable", setVariable, tr("GENERAL"), "setVariable(\""+tr("Name")+"\",\""+tr("Value")+"\")");
addFunction("getVariable", getVariable, tr("GENERAL"), "getVariable(\""+tr("Name")+"\")");
addFunction("getField", getField, tr("GENERAL"), "getField(\""+tr("Name")+"\")");
QScriptValue colorCtor = m_scriptEngine->newFunction(constructColor);
m_scriptEngine->globalObject().setProperty("QColor", colorCtor);

View File

@ -61,8 +61,9 @@ void VariablesHolder::addVariable(const QString& name, const QVariant& value, Va
m_varNames.insert(name,varValue);
if (type==VarDesc::Report)
m_userVariables.append(varValue);
emit variableHasBeenAdded(name);
} else {
throw ReportError(tr("variable with name ")+name+tr(" already exists !!"));
throw ReportError(tr("variable with name ")+name+tr(" already exists!"));
}
}
@ -77,7 +78,7 @@ VarDesc::VarType VariablesHolder::variableType(const QString &name)
{
if (m_varNames.contains(name))
return m_varNames.value(name)->varType();
else throw ReportError(tr("variable with name ")+name+tr(" does not exists !!"));
else throw ReportError(tr("variable with name ")+name+tr(" does not exists!"));
}
void VariablesHolder::deleteVariable(const QString &name)
@ -86,6 +87,7 @@ void VariablesHolder::deleteVariable(const QString &name)
m_userVariables.removeOne(m_varNames.value(name));
delete m_varNames.value(name);
m_varNames.remove(name);
emit variableHasBennDeleted(name);
}
}
@ -93,8 +95,9 @@ void VariablesHolder::changeVariable(const QString &name, const QVariant &value)
{
if(m_varNames.contains(name)) {
m_varNames.value(name)->setValue(value);
emit variableHasBeenChanged(name);
} else
throw ReportError(tr("variable with name ")+name+tr(" does not exists !!"));
throw ReportError(tr("variable with name ")+name+tr(" does not exists!"));
}
void VariablesHolder::clearUserVariables()
@ -142,7 +145,7 @@ RenderPass VariablesHolder::variablePass(const QString &name)
{
if (m_varNames.contains(name))
return m_varNames.value(name)->renderPass();
else throw ReportError(tr("variable with name ")+name+tr(" does not exists !!"));
else throw ReportError(tr("variable with name ")+name+tr(" does not exists!"));
}
}// namespace LimeReport

View File

@ -27,8 +27,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
****************************************************************************/
#ifndef VARIABLEHOLDER_H
#define VARIABLEHOLDER_H
#ifndef LRVARIABLEHOLDER_H
#define LRVARIABLEHOLDER_H
#include <QObject>
#include <QMap>
@ -92,6 +92,9 @@ public:
int userVariablesCount();
VarDesc* userVariableAt(int index);
signals:
void variableHasBeenAdded(const QString& variableName);
void variableHasBeenChanged(const QString& variableName);
void variableHasBennDeleted(const QString& variableName);
private:
QMap<QString,VarDesc*> m_varNames;
QList<VarDesc*> m_userVariables;

View File

@ -27,8 +27,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
****************************************************************************/
#ifndef ATEXTITEMPROPERTYEDITOR_H
#define ATEXTITEMPROPERTYEDITOR_H
#ifndef LRTEXTITEMPROPERTYEDITOR_H
#define LRTEXTITEMPROPERTYEDITOR_H
#include <QDialog>
#include <QWidget>

View File

@ -83,6 +83,57 @@ void QObjectPropertyModel::translatePropertyName()
tr("shape");
tr("shapeBrush");
tr("shapeBrushColor");
tr("gridStep");
tr("fullPage");
tr("oldPrintMode");
tr("borderColor");
tr("resetPageNumber");
tr("alternateBackgroundColor");
tr("backgroundBrushStyle");
tr("columnCount");
tr("startFromNewPage");
tr("startNewPage");
tr("adaptFontToSize");
tr("allowHTML");
tr("allowHTMLInFields");
tr("backgroundBrushStyle");
tr("followTo");
tr("format");
tr("lineSpacing");
tr("textIndent");
tr("textLayoutDirection");
tr("underlineLineSize");
tr("underlines");
tr("valueType");
tr("securityLevel");
tr("testValue");
tr("whitespace");
tr("resourcePath");
tr("scale");
tr("cornerRadius");
tr("shapeColor");
tr("layoutType");
tr("barcodeType");
tr("barcodeWidth");
tr("foregroundColor");
tr("inputMode");
tr("pdf417CodeWords");
tr("autoSize");
tr("center");
tr("field");
tr("image");
tr("keepAspectRatio");
tr("columnsCount");
tr("useAlternateBackgroundColor");
tr("printBeforePageHeader");
tr("maxScalePercent");
tr("printOnFirstPage");
tr("printOnLastPage");
tr("printAlways");
tr("repeatOnEachRow");
tr("condition");
tr("groupFieldName");
tr("keepGroupTogether");
}
void QObjectPropertyModel::clearObjectsList()

View File

@ -74,7 +74,8 @@ void LimeReport::PropertyDelegate::paint(QPainter *painter, const QStyleOptionVi
option.rect.y()+option.rect.height()
);
painter->save();
painter->setPen(option.palette.color(QPalette::Dark));
QColor color = static_cast<QRgb>(QApplication::style()->styleHint(QStyle::SH_Table_GridLineColor, &option));
painter->setPen(color);
painter->drawLine(start,end);
painter->restore();
}

View File

@ -1,5 +1,5 @@
#ifndef CONTENTPROPITEM_H
#define CONTENTPROPITEM_H
#ifndef LRCONTENTPROPITEM_H
#define LRCONTENTPROPITEM_H
#include "lrstringpropitem.h"
#include "objectinspector/editors/lrbuttonlineeditor.h"

View File

@ -54,10 +54,10 @@ QWidget *EnumPropItem::createProperyEditor(QWidget *parent) const
QStringList enumValues;
QMetaEnum propEnum = object()->metaObject()->property(object()->metaObject()->indexOfProperty(propertyName().toLatin1())).enumerator();
for (int i=0;i<propEnum.keyCount();i++){
if (m_acceptableValues.isEmpty()) enumValues.append(propEnum.key(i));
if (m_acceptableValues.isEmpty()) enumValues.append(tr(propEnum.key(i)));
else {
if (m_acceptableValues.contains(propEnum.value(i))){
enumValues.append(propEnum.key(i));
enumValues.append(tr(propEnum.key(i)));
}
}
}
@ -75,6 +75,65 @@ void EnumPropItem::slotEnumChanged(const QString &text)
}
}
void EnumPropItem::initTranslation()
{
QMetaEnum propEnum = object()->metaObject()->property(object()->metaObject()->indexOfProperty(propertyName().toLatin1())).enumerator();
for (int i=0;i<propEnum.keyCount();i++){
m_translation.insert(QString(tr(propEnum.key(i))), QString(propEnum.key(i)));
}
}
void EnumPropItem::translateEnumItemName()
{
tr("Default");
tr("Portrait");
tr("Landscape");
tr("NoneAutoWidth");
tr("MaxWordLength");
tr("MaxStringLength");
tr("TransparentMode");
tr("OpaqueMode");
tr("Angle0");
tr("Angle90");
tr("Angle180");
tr("Angle270");
tr("Angle45");
tr("Angle315");
tr("DateTime");
tr("Double");
tr("NoBrush");
tr("SolidPattern");
tr("Dense1Pattern");
tr("Dense2Pattern");
tr("Dense3Pattern");
tr("Dense4Pattern");
tr("Dense5Pattern");
tr("Dense6Pattern");
tr("Dense7Pattern");
tr("HorPattern");
tr("VerPattern");
tr("CrossPattern");
tr("BDiagPattern");
tr("FDiagPattern");
tr("LeftToRight");
tr("RightToLeft");
tr("LayoutDirectionAuto");
tr("LeftItemAlign");
tr("RightItemAlign");
tr("CenterItemAlign");
tr("ParentWidthItemAlign");
tr("DesignedItemAlign");
tr("HorizontalLine");
tr("VerticalLine");
tr("Ellipse");
tr("Rectangle");
tr("Page");
tr("Band");
tr("Horizontal");
tr("Vertical");
tr("VerticalUniform");
}
void EnumPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
{
ComboBoxEditor *editor=qobject_cast<ComboBoxEditor *>(propertyEditor);
@ -90,13 +149,13 @@ void EnumPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *mod
QString EnumPropItem::nameByType(int value) const
{
QMetaEnum propEnum = object()->metaObject()->property(object()->metaObject()->indexOfProperty(propertyName().toLatin1())).enumerator();
return propEnum.valueToKey(value);
return tr(propEnum.valueToKey(value));
}
int EnumPropItem::typeByName(const QString &value) const
{
QMetaEnum propEnum = object()->metaObject()->property(object()->metaObject()->indexOfProperty(propertyName().toLatin1())).enumerator();
return propEnum.keyToValue(value.toLatin1());
return propEnum.keyToValue(m_translation.value(value).toLatin1());
}
QString EnumPropItem::displayValue() const

View File

@ -31,17 +31,18 @@
#define LRENUMPROPITEM_H
#include "lrobjectpropitem.h"
#include <QMap>
namespace LimeReport{
class EnumPropItem : public ObjectPropItem
{
Q_OBJECT
public:
EnumPropItem():ObjectPropItem(), m_settingValue(false){}
EnumPropItem():ObjectPropItem(), m_settingValue(false){initTranslation();}
EnumPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly)
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly),m_settingValue(false){}
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly),m_settingValue(false){initTranslation();}
EnumPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly, QVector<int> acceptableValues)
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly),m_acceptableValues(acceptableValues),m_settingValue(false){}
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly),m_acceptableValues(acceptableValues),m_settingValue(false){initTranslation();}
QWidget* createProperyEditor(QWidget *parent) const;
QString displayValue() const;
void setPropertyEditorData(QWidget * propertyEditor, const QModelIndex &) const;
@ -52,9 +53,13 @@ protected:
int typeByName(const QString& propertyValue) const;
private slots:
void slotEnumChanged(const QString& text);
private:
void initTranslation();
void translateEnumItemName();
private:
QVector<int> m_acceptableValues;
bool m_settingValue;
QMap<QString, QString> m_translation;
};
}
#endif // LRENUMPROPITEM_H

View File

@ -59,12 +59,14 @@ void FlagsPropItem::createChildren()
QMetaEnum propEnum = object()->metaObject()->property(object()->metaObject()->indexOfProperty(propertyName().toLatin1())).enumerator();
for (int i=0;i<propEnum.keyCount();i++)
{
this->appendItem(new LimeReport::FlagPropItem(
object(), objects(), QString(propEnum.key(i)), QString(propEnum.key(i)),
bool((propertyValue().toInt() & propEnum.keyToValue(propEnum.key(i)))==propEnum.keyToValue(propEnum.key(i))),
this, false
)
);
if ( propEnum.keyToValue(propEnum.key(i)) !=0 ) {
this->appendItem(new LimeReport::FlagPropItem(
object(), objects(), QString(propEnum.key(i)), tr(propEnum.key(i)),
bool((propertyValue().toInt() & propEnum.keyToValue(propEnum.key(i)))==propEnum.keyToValue(propEnum.key(i))),
this, false
)
);
}
}
}
@ -94,10 +96,10 @@ QString FlagsPropItem::displayValue() const
QMetaEnum propEnum = object()->metaObject()->property(object()->metaObject()->indexOfProperty(propertyName().toLatin1())).enumerator();
for (int i=0;i<propEnum.keyCount();i++)
{
if ( (propertyValue().toInt() & propEnum.keyToValue(propEnum.key(i)))==propEnum.keyToValue(propEnum.key(i) ))
if ((propEnum.keyToValue(propEnum.key(i)) == 0) ? propertyValue().toInt() == 0 : (propertyValue().toInt() & propEnum.keyToValue(propEnum.key(i))) == propEnum.keyToValue(propEnum.key(i)))
{
if (result.isEmpty()) result+=propEnum.key(i);
else result=result+" | "+propEnum.key(i);
if (result.isEmpty()) result+= tr(propEnum.key(i));
else result=result+" | "+tr(propEnum.key(i));
}
}
@ -114,6 +116,15 @@ void FlagsPropItem::slotEnumChanged(QString /*text*/)
{
}
void FlagsPropItem::translateFlagsItem()
{
tr("NoLine");
tr("TopLine");
tr("BottomLine");
tr("LeftLine");
tr("RightLine");
}
FlagPropItem::FlagPropItem(QObject* object, ObjectsList* objects, const QString &propName, const QString &displayName, const QVariant &value, ObjectPropItem* parent, bool readonly)
:BoolPropItem(object, objects, propName,displayName,value,parent,readonly)
{
@ -130,8 +141,8 @@ void FlagPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *mod
bool value = qobject_cast<CheckBoxEditor*>(propertyEditor)->isChecked();
model->setData(index,value);
int flags = object()->property(parent()->propertyName().toLatin1()).toInt();
if (value) flags=flags | valueByName(displayName());
else if (flags&valueByName(displayName())) flags=flags ^ valueByName(displayName());
if (value) flags = flags | valueByName(propertyName());
else if (flags & valueByName(propertyName())) flags = flags ^ valueByName(propertyName());
setValueToObject(parent()->propertyName(),flags);
parent()->setPropertyValue(flags);
}

View File

@ -46,6 +46,8 @@ public:
virtual void setPropertyValue(QVariant propertyValue);
private slots:
void slotEnumChanged(QString);
private:
void translateFlagsItem();
private:
QSet<int> m_acceptableValues;
QString nameByType(int propertyValue) const;

View File

@ -94,6 +94,11 @@ void ObjectBrowser::fillNode(QTreeWidgetItem* parentNode, BaseDesignIntf* report
treeItem->setIcon(0,QIcon(":/items/"+extractClassName(item->metaObject()->className())));
connect(item, SIGNAL(propertyObjectNameChanged(QString,QString)),
this, SLOT(slotPropertyObjectNameChanged(QString,QString)));
ItemDesignIntf* i = dynamic_cast<ItemDesignIntf*>(item);
if (i){
connect(i, SIGNAL(itemLocationChanged(BaseDesignIntf*,BaseDesignIntf*)),
this, SLOT(slotItemParentChanged(BaseDesignIntf*,BaseDesignIntf*)));
}
m_itemsMap.insert(item,treeItem);
parentNode->addChild(treeItem);
if (!item->childBaseItems().isEmpty())
@ -278,6 +283,19 @@ void ObjectBrowser::slotActivePageUpdated(LimeReport::PageDesignIntf *)
buildTree();
}
void ObjectBrowser::slotItemParentChanged(BaseDesignIntf* item, BaseDesignIntf* parent)
{
if (m_itemsMap.contains(item) && m_itemsMap.contains(parent)){
m_itemsMap.value(item)->parent()->removeChild(m_itemsMap.value(item));
m_itemsMap.value(parent)->addChild(m_itemsMap.value(item));
m_changingItemSelection = true;
m_itemsMap.value(item)->setSelected(true);
item->setSelected(true);
m_changingItemSelection = false;
}
}
void ObjectBrowserNode::setObject(QObject *value)
{
m_object = value;

View File

@ -75,6 +75,7 @@ private slots:
void slotMultiItemSelected();
void slotItemDoubleClicked(QTreeWidgetItem* item,int);
void slotActivePageUpdated(LimeReport::PageDesignIntf*);
void slotItemParentChanged(BaseDesignIntf* item, BaseDesignIntf* parent);
private:
ReportDesignWidget* m_report;
QMainWindow* m_mainWindow;

View File

@ -398,6 +398,70 @@ p, li { white-space: pre-wrap; }
<source>Splittable</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>DataBand</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>DataHeaderBand</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>DataFooterBand</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ReportHeader</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ReportFooter</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>PageHeader</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>PageFooter</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SubDetailBand</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SubDetailHeaderBand</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SubDetailFooterBand</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>GroupBandHeader</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>GroupBandFooter</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>TearOffBand</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Keep bottom space</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Start from new page</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Start new page</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::BaseDesignIntf</name>
@ -497,7 +561,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<source> already exists </source>
<translation type="unfinished">موجود مسبقاً</translation>
<translation type="obsolete">موجود مسبقاً</translation>
</message>
<message>
<source>...</source>
@ -519,6 +583,10 @@ p, li { white-space: pre-wrap; }
<source>defaultConnection</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> already exists! </source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::ContentItemDesignIntf</name>
@ -587,7 +655,7 @@ p, li { white-space: pre-wrap; }
<message>
<source>Do you really want to delete &quot;%1&quot; connection ?</source>
<oldsource>Do you really want delete &quot;%1&quot; connection ?</oldsource>
<translation>هل ترغب في حذف الإتصال &quot;%1&quot; ?</translation>
<translation type="vanished">هل ترغب في حذف الإتصال &quot;%1&quot; ?</translation>
</message>
<message>
<source>User variables</source>
@ -600,7 +668,7 @@ p, li { white-space: pre-wrap; }
<message>
<source>Do you really want to delete &quot;%1&quot; datasource ?</source>
<oldsource>Do you really want delete &quot;%1&quot; datasource ?</oldsource>
<translation>هل ترغب في حذف مصدر البيانات &quot;%1&quot; ?</translation>
<translation type="vanished">هل ترغب في حذف مصدر البيانات &quot;%1&quot; ?</translation>
</message>
<message>
<source>Do you really want delete variable &quot;%1&quot; ?</source>
@ -616,7 +684,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<source>Do you really want to delete variable &quot;%1&quot; ?</source>
<translation type="unfinished">هل ترغب في حذف المتغير &quot;%1&quot; ?</translation>
<translation type="obsolete">هل ترغب في حذف المتغير &quot;%1&quot; ?</translation>
</message>
<message>
<source>Grab variable</source>
@ -630,6 +698,18 @@ p, li { white-space: pre-wrap; }
<source>External variables</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you really want to delete &quot;%1&quot; connection?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you really want to delete &quot;%1&quot; datasource?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you really want to delete variable &quot;%1&quot;?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::DataFooterBand</name>
@ -653,16 +733,16 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<source>Datasource &quot;%1&quot; not found !</source>
<translation>الإتصال &quot;%1&quot; غير موجود !</translation>
<translation type="vanished">الإتصال &quot;%1&quot; غير موجود !</translation>
</message>
<message>
<source>connection with name &quot;%1&quot; already exists !</source>
<translation>الإتصال بأسم &quot;%1&quot; موجود مسبقاً !</translation>
<translation type="vanished">الإتصال بأسم &quot;%1&quot; موجود مسبقاً !</translation>
</message>
<message>
<source>datasource with name &quot;%1&quot; already exists !</source>
<oldsource>data source with name &quot;%1&quot; already exists !!</oldsource>
<translation>مصدر البيانات بأسم &quot;%1&quot; موجود مسبقاً !</translation>
<translation type="vanished">مصدر البيانات بأسم &quot;%1&quot; موجود مسبقاً !</translation>
</message>
<message>
<source>invalid connection</source>
@ -676,6 +756,18 @@ p, li { white-space: pre-wrap; }
<source>Database &quot;%1&quot; not found</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Datasource &quot;%1&quot; not found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Connection with name &quot;%1&quot; already exists!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Datasource with name &quot;%1&quot; already exists!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::DataSourceModel</name>
@ -692,6 +784,220 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::EnumPropItem</name>
<message>
<source>Default</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Portrait</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Landscape</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>NoneAutoWidth</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MaxWordLength</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MaxStringLength</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>TransparentMode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>OpaqueMode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Angle0</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Angle90</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Angle180</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Angle270</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Angle45</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Angle315</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>DateTime</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Double</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>NoBrush</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SolidPattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Dense1Pattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Dense2Pattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Dense3Pattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Dense4Pattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Dense5Pattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Dense6Pattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Dense7Pattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>HorPattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>VerPattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CrossPattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>BDiagPattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>FDiagPattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>LeftToRight</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>RightToLeft</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>LayoutDirectionAuto</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>LeftItemAlign</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>RightItemAlign</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CenterItemAlign</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ParentWidthItemAlign</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>DesignedItemAlign</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>HorizontalLine</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>VerticalLine</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Ellipse</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Rectangle</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Page</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Band</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Horizontal</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Vertical</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>VerticalUniform</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::FlagsPropItem</name>
<message>
<source>NoLine</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>TopLine</source>
<translation type="unfinished">خط علوي</translation>
</message>
<message>
<source>BottomLine</source>
<translation type="unfinished">خط سفلي</translation>
</message>
<message>
<source>LeftLine</source>
<translation type="unfinished">خط أيسر</translation>
</message>
<message>
<source>RightLine</source>
<translation type="unfinished">خط أيمن</translation>
</message>
</context>
<context>
<name>LimeReport::FontEditorWidget</name>
<message>
@ -748,7 +1054,7 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
<message>
<source>Datasource &quot;%1&quot; not found !!!</source>
<source>Datasource &quot;%1&quot; not found!</source>
<translation type="unfinished"></translation>
</message>
</context>
@ -778,6 +1084,17 @@ p, li { white-space: pre-wrap; }
<translation>صورة</translation>
</message>
</context>
<context>
<name>LimeReport::ItemLocationPropItem</name>
<message>
<source>Band</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Page</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::ItemsAlignmentEditorWidget</name>
<message>
@ -1252,6 +1569,202 @@ p, li { white-space: pre-wrap; }
<source>bottomMargin</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>gridStep</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>fullPage</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>oldPrintMode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>borderColor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>resetPageNumber</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>alternateBackgroundColor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>backgroundBrushStyle</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>startFromNewPage</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>startNewPage</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>adaptFontToSize</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>allowHTML</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>allowHTMLInFields</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>followTo</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>format</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>lineSpacing</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>textIndent</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>textLayoutDirection</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>underlineLineSize</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>underlines</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>valueType</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>securityLevel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>testValue</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>whitespace</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>resourcePath</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>scale</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>cornerRadius</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>shapeColor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>layoutType</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>barcodeType</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>barcodeWidth</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>foregroundColor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>inputMode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>pdf417CodeWords</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>autoSize</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>center</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>field</source>
<translation type="unfinished">الحقل</translation>
</message>
<message>
<source>image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>keepAspectRatio</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>columnsCount</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>useAlternateBackgroundColor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>printBeforePageHeader</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>maxScalePercent</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>printOnFirstPage</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>printOnLastPage</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>printAlways</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>repeatOnEachRow</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>condition</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>groupFieldName</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>keepGroupTogether</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::RectMMPropItem</name>
@ -1281,10 +1794,6 @@ p, li { white-space: pre-wrap; }
<source>Report file name</source>
<translation>أسم التقرير</translation>
</message>
<message>
<source>Page</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Script</source>
<translation type="unfinished"></translation>
@ -1490,7 +1999,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<source>Report has been modified ! Do you want save the report ?</source>
<translation>تم تعديل التقرير ! هل تريد حفظ التعديلات ?</translation>
<translation type="vanished">تم تعديل التقرير ! هل تريد حفظ التعديلات ?</translation>
</message>
<message>
<source>Report file name</source>
@ -1552,6 +2061,10 @@ p, li { white-space: pre-wrap; }
<source>Script Browser</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Report has been modified! Do you want save the report?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::ReportEnginePrivate</name>
@ -1667,15 +2180,15 @@ This preview is no longer valid.</source>
</message>
<message>
<source>Datasource Name is empty !</source>
<translation type="unfinished">أسم مصدر البيانات فارغ !</translation>
<translation type="obsolete">أسم مصدر البيانات فارغ !</translation>
</message>
<message>
<source>SQL is empty !</source>
<translation type="unfinished">SQL فارغة !</translation>
<translation type="obsolete">SQL فارغة !</translation>
</message>
<message>
<source>Datasource with name: &quot;%1&quot; already exists !</source>
<translation type="unfinished">مصدر البيانات بأسم: &quot;%1&quot; موجود مسبقاً !</translation>
<translation type="obsolete">مصدر البيانات بأسم: &quot;%1&quot; موجود مسبقاً !</translation>
</message>
<message>
<source>Datasource with name %1 already exist</source>
@ -1709,6 +2222,18 @@ This preview is no longer valid.</source>
<source>defaultConnection</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Datasource Name is empty!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SQL is empty!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Datasource with name: &quot;%1&quot; already exists!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::ScriptBrowser</name>
@ -1802,6 +2327,26 @@ This preview is no longer valid.</source>
<source>Variable %1 not found</source>
<translation type="unfinished">المتغير %1 غير موجود</translation>
</message>
<message>
<source>GROUP FUNCTIONS</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SYSTEM</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>NUMBER</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>DATE&amp;TIME</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>GENERAL</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::SettingDialog</name>
@ -1917,7 +2462,7 @@ This preview is no longer valid.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>TextItem &quot; %1 &quot; not found !</source>
<source>TextItem &quot; %1 &quot; not found!</source>
<translation type="unfinished"></translation>
</message>
</context>
@ -1976,11 +2521,19 @@ This preview is no longer valid.</source>
</message>
<message>
<source> already exists !!</source>
<translation type="unfinished">موجود مسبقاً !!</translation>
<translation type="obsolete">موجود مسبقاً !!</translation>
</message>
<message>
<source> does not exists !!</source>
<translation type="unfinished">غير موجود !!</translation>
<translation type="obsolete">غير موجود !!</translation>
</message>
<message>
<source> already exists!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> does not exists!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
@ -2154,7 +2707,7 @@ This preview is no longer valid.</source>
</message>
<message>
<source>Master datasource &quot;%1&quot; not found!</source>
<translation type="vanished">مصدر البيانات الرئيسي &quot;%1&quot; غير موجود!</translation>
<translation>مصدر البيانات الرئيسي &quot;%1&quot; غير موجود!</translation>
</message>
<message>
<source>Child</source>
@ -2178,7 +2731,7 @@ This preview is no longer valid.</source>
</message>
<message>
<source>Object with name %1 already exists</source>
<translation>أسم الكائن %1 уже موجود مسبقاً</translation>
<translation type="vanished">أسم الكائن %1 уже موجود مسبقاً</translation>
</message>
<message>
<source>Function %1 not found or have wrong arguments</source>
@ -2232,10 +2785,6 @@ This preview is no longer valid.</source>
<source>content</source>
<translation>المحتوى</translation>
</message>
<message>
<source>Master datasource &quot;%1&quot; not found!!!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Master datasouce &quot;%1&quot; not found!</source>
<translation type="unfinished"></translation>
@ -2292,6 +2841,10 @@ This preview is no longer valid.</source>
<source>Wrong file format</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Object with name %1 already exists!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SQLEditDialog</name>

View File

@ -265,6 +265,70 @@ p, li { white-space: pre-wrap; }
<source>Splittable</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>DataBand</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>DataHeaderBand</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>DataFooterBand</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ReportHeader</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ReportFooter</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>PageHeader</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>PageFooter</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SubDetailBand</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SubDetailHeaderBand</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SubDetailFooterBand</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>GroupBandHeader</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>GroupBandFooter</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>TearOffBand</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Keep bottom space</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Start from new page</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Start new page</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::BaseDesignIntf</name>
@ -372,7 +436,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<source> already exists </source>
<translation>ya existe</translation>
<translation type="vanished">ya existe</translation>
</message>
<message>
<source>Use default application connection</source>
@ -386,6 +450,10 @@ p, li { white-space: pre-wrap; }
<source>defaultConnection</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> already exists! </source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::ContentItemDesignIntf</name>
@ -457,7 +525,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<source>Do you really want to delete &quot;%1&quot; connection ?</source>
<translation>Realmente quieres borrar la conexion &quot;%1&quot;?</translation>
<translation type="vanished">Realmente quieres borrar la conexion &quot;%1&quot;?</translation>
</message>
<message>
<source>User variables</source>
@ -467,14 +535,6 @@ p, li { white-space: pre-wrap; }
<source>System variables</source>
<translation>Variables del sistema</translation>
</message>
<message>
<source>Do you really want to delete &quot;%1&quot; datasource ?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you really want to delete variable &quot;%1&quot; ?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
@ -491,6 +551,18 @@ p, li { white-space: pre-wrap; }
<source>External variables</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you really want to delete &quot;%1&quot; connection?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you really want to delete &quot;%1&quot; datasource?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you really want to delete variable &quot;%1&quot;?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::DataFooterBand</name>
@ -516,18 +588,6 @@ p, li { white-space: pre-wrap; }
<source>Variable &quot;%1&quot; not found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Datasource &quot;%1&quot; not found !</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>connection with name &quot;%1&quot; already exists !</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>datasource with name &quot;%1&quot; already exists !</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>invalid connection</source>
<translation type="unfinished"></translation>
@ -536,6 +596,18 @@ p, li { white-space: pre-wrap; }
<source>Database &quot;%1&quot; not found</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Datasource &quot;%1&quot; not found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Connection with name &quot;%1&quot; already exists!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Datasource with name &quot;%1&quot; already exists!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::DataSourceModel</name>
@ -552,6 +624,220 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::EnumPropItem</name>
<message>
<source>Default</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Portrait</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Landscape</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>NoneAutoWidth</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MaxWordLength</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MaxStringLength</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>TransparentMode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>OpaqueMode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Angle0</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Angle90</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Angle180</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Angle270</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Angle45</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Angle315</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>DateTime</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Double</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>NoBrush</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SolidPattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Dense1Pattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Dense2Pattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Dense3Pattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Dense4Pattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Dense5Pattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Dense6Pattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Dense7Pattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>HorPattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>VerPattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CrossPattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>BDiagPattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>FDiagPattern</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>LeftToRight</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>RightToLeft</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>LayoutDirectionAuto</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>LeftItemAlign</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>RightItemAlign</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CenterItemAlign</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ParentWidthItemAlign</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>DesignedItemAlign</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>HorizontalLine</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>VerticalLine</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Ellipse</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Rectangle</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Page</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Band</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Horizontal</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Vertical</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>VerticalUniform</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::FlagsPropItem</name>
<message>
<source>NoLine</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>TopLine</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>BottomLine</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>LeftLine</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>RightLine</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::FontEditorWidget</name>
<message>
@ -608,7 +894,7 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
<message>
<source>Datasource &quot;%1&quot; not found !!!</source>
<source>Datasource &quot;%1&quot; not found!</source>
<translation type="unfinished"></translation>
</message>
</context>
@ -638,6 +924,17 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::ItemLocationPropItem</name>
<message>
<source>Band</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Page</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::ItemsAlignmentEditorWidget</name>
<message>
@ -1089,6 +1386,202 @@ p, li { white-space: pre-wrap; }
<source>Warning</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>gridStep</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>fullPage</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>oldPrintMode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>borderColor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>resetPageNumber</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>alternateBackgroundColor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>backgroundBrushStyle</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>startFromNewPage</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>startNewPage</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>adaptFontToSize</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>allowHTML</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>allowHTMLInFields</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>followTo</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>format</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>lineSpacing</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>textIndent</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>textLayoutDirection</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>underlineLineSize</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>underlines</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>valueType</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>securityLevel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>testValue</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>whitespace</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>resourcePath</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>scale</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>cornerRadius</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>shapeColor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>layoutType</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>barcodeType</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>barcodeWidth</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>foregroundColor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>inputMode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>pdf417CodeWords</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>autoSize</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>center</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>field</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>keepAspectRatio</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>columnsCount</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>useAlternateBackgroundColor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>printBeforePageHeader</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>maxScalePercent</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>printOnFirstPage</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>printOnLastPage</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>printAlways</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>repeatOnEachRow</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>condition</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>groupFieldName</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>keepGroupTogether</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::RectMMPropItem</name>
@ -1118,10 +1611,6 @@ p, li { white-space: pre-wrap; }
<source>Report file name</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Page</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Script</source>
<translation type="unfinished"></translation>
@ -1333,10 +1822,6 @@ p, li { white-space: pre-wrap; }
<source>Data Browser</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Report has been modified ! Do you want save the report ?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Report file name</source>
<translation type="unfinished"></translation>
@ -1377,6 +1862,10 @@ p, li { white-space: pre-wrap; }
<source>Tear-off Band</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Report has been modified! Do you want save the report?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::ReportEnginePrivate</name>
@ -1506,18 +1995,6 @@ This preview is no longer valid.</source>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Datasource Name is empty !</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SQL is empty !</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Datasource with name: &quot;%1&quot; already exists !</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Datasource with name %1 already exist</source>
<translation type="unfinished"></translation>
@ -1534,6 +2011,18 @@ This preview is no longer valid.</source>
<source>defaultConnection</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Datasource Name is empty!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SQL is empty!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Datasource with name: &quot;%1&quot; already exists!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::ScriptBrowser</name>
@ -1623,6 +2112,26 @@ This preview is no longer valid.</source>
<source>Name</source>
<translation type="unfinished">Nombre</translation>
</message>
<message>
<source>GROUP FUNCTIONS</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SYSTEM</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>NUMBER</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>DATE&amp;TIME</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>GENERAL</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::SettingDialog</name>
@ -1738,7 +2247,7 @@ This preview is no longer valid.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>TextItem &quot; %1 &quot; not found !</source>
<source>TextItem &quot; %1 &quot; not found!</source>
<translation type="unfinished"></translation>
</message>
</context>
@ -1797,11 +2306,19 @@ This preview is no longer valid.</source>
</message>
<message>
<source> already exists !!</source>
<translation type="unfinished">ya existe !!</translation>
<translation type="obsolete">ya existe !!</translation>
</message>
<message>
<source> does not exists !!</source>
<translation type="unfinished">no existe !!</translation>
<translation type="obsolete">no existe !!</translation>
</message>
<message>
<source> already exists!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> does not exists!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
@ -1886,10 +2403,6 @@ This preview is no longer valid.</source>
<source>Invalid connection! %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Master datasource &quot;%1&quot; not found!!!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Master datasouce &quot;%1&quot; not found!</source>
<translation type="unfinished"></translation>
@ -1914,10 +2427,6 @@ This preview is no longer valid.</source>
<source>Selected elements have different parent containers</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Object with name %1 already exists</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Function %1 not found or have wrong arguments</source>
<translation type="unfinished"></translation>
@ -2006,5 +2515,13 @@ This preview is no longer valid.</source>
<source>Tear-off Band</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Master datasource &quot;%1&quot; not found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Object with name %1 already exists!</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff