From 2034aa15c82570c989dfe5ab3647c55e8106e852 Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Tue, 1 Nov 2016 20:42:45 +0300 Subject: [PATCH 001/136] QJSEngine has been added --- common.pri | 8 +- demo_r1/mainwindow.cpp | 4 +- include/lrglobal.h | 14 + include/lrreportengine.h | 1 + include/lrscriptenginemanagerintf.h | 11 +- limereport/items/lrtextitemeditor.cpp | 2 +- limereport/lrglobal.h | 14 + limereport/lritemdesignintf.cpp | 22 +- limereport/lrreportengine.cpp | 2 +- limereport/lrreportengine.h | 1 + limereport/lrreportrender.cpp | 2 +- limereport/lrscriptenginemanager.cpp | 463 +++++++++++++++++-- limereport/lrscriptenginemanager.h | 98 +++- limereport/lrscriptenginemanagerintf.h | 11 +- limereport/scriptbrowser/lrscriptbrowser.cpp | 2 +- 15 files changed, 595 insertions(+), 60 deletions(-) diff --git a/common.pri b/common.pri index 8eee2c5..78398e5 100644 --- a/common.pri +++ b/common.pri @@ -1,6 +1,6 @@ CONFIG += build_translations CONFIG += zint - +#CONFIG += qjsengine #greaterThan(QT_MAJOR_VERSION, 4) { # QT += uitools #} @@ -68,11 +68,15 @@ TRANSLATIONS_PATH = $$PWD/translations greaterThan(QT_MAJOR_VERSION, 4) { DEFINES+=HAVE_QT5 - QT+= printsupport widgets + QT+= printsupport widgets qml contains(QT,uitools){ message(uitools) DEFINES += HAVE_UI_LOADER } + contains(CONFIG, qjsengine){ + message(qjsengine) + DEFINES += USE_QJSENGINE + } } lessThan(QT_MAJOR_VERSION, 5){ diff --git a/demo_r1/mainwindow.cpp b/demo_r1/mainwindow.cpp index b5afab8..0634a15 100644 --- a/demo_r1/mainwindow.cpp +++ b/demo_r1/mainwindow.cpp @@ -93,8 +93,8 @@ MainWindow::MainWindow(QWidget *parent) : report->dataManager()->addModel("string_list",stringListModel,true); QStringList strList; strList<<"value1"<<"value2"; - QScriptValue value = qScriptValueFromSequence(report->scriptManager()->scriptEngine(),strList); - report->scriptManager()->scriptEngine()->globalObject().setProperty("test_list",value); + //QScriptValue value = qScriptValueFromSequence(report->scriptManager()->scriptEngine(),strList); + //report->scriptManager()->scriptEngine()->globalObject().setProperty("test_list",value); } diff --git a/include/lrglobal.h b/include/lrglobal.h index e64cd43..ea1d3ce 100644 --- a/include/lrglobal.h +++ b/include/lrglobal.h @@ -42,6 +42,12 @@ # define LIMEREPORT_EXPORT /**/ #endif +#ifdef USE_QJSENGINE +#include +#else +#include +#endif + namespace LimeReport { #ifdef __GNUC__ @@ -83,6 +89,7 @@ namespace Const{ const QString GROUP_FUNCTION_RX = "(%1\\s*"+GROUP_FUNCTION_PARAM_RX+")"; const QString GROUP_FUNCTION_NAME_RX = "%1\\s*\\((.*[^\\)])\\)"; const int SCENE_MARGIN = 50; + const QString FUNCTION_MANAGER_NAME = "LimeReport"; } QString extractClassName(QString className); enum RenderPass {FirstPass, SecondPass}; @@ -117,6 +124,13 @@ namespace Const{ typedef QStyleOptionViewItem StyleOptionViewItem; #endif +#ifdef USE_QJSENGINE + typedef QJSEngine ScriptEngineType; + typedef QJSValue ScriptValueType; +#else + typedef QScriptEngine ScriptEngineType; + typedef QScriptValue ScriptValueType; +#endif } // namespace LimeReport diff --git a/include/lrreportengine.h b/include/lrreportengine.h index 814d831..804e764 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -33,6 +33,7 @@ #include #include #include +//#include #include "lrglobal.h" #include "lrdatasourcemanagerintf.h" diff --git a/include/lrscriptenginemanagerintf.h b/include/lrscriptenginemanagerintf.h index d7662ff..4c2767a 100644 --- a/include/lrscriptenginemanagerintf.h +++ b/include/lrscriptenginemanagerintf.h @@ -30,15 +30,19 @@ #ifndef LRSCRIPTENGINEMANAGERINTF_H #define LRSCRIPTENGINEMANAGERINTF_H -#include +//#include +#include "lrglobal.h" namespace LimeReport{ + class IScriptEngineManager{ public: - virtual QScriptEngine* scriptEngine() = 0; - virtual bool addFunction(const QString& name, QScriptEngine::FunctionSignature function, + virtual ScriptEngineType* scriptEngine() = 0; +#ifndef USE_QJSENGINE + virtual bool addFunction(const QString& name, ScriptEngineType::FunctionSignature function, const QString& category="", const QString& description="") = 0; +#endif virtual bool addFunction(const QString &name, const QString& script, const QString &category="", const QString &description="") = 0; virtual const QString& lastError() const = 0; @@ -46,4 +50,5 @@ public: }; } //namespace LimeReport + #endif // LRSCRIPTENGINEMANAGERINTF_H diff --git a/limereport/items/lrtextitemeditor.cpp b/limereport/items/lrtextitemeditor.cpp index e2b6778..cba99ff 100644 --- a/limereport/items/lrtextitemeditor.cpp +++ b/limereport/items/lrtextitemeditor.cpp @@ -133,7 +133,7 @@ void TextItemEditor::initUI() ui->tabWidget->setVisible(false); } - foreach (LimeReport::ScriptFunctionDesc functionDesc, se.functionsDescriber()) { + foreach (LimeReport::ScriptFunctionDesc functionDesc, se.functionsDescribers()) { dataWords< +#else +#include +#endif + namespace LimeReport { #ifdef __GNUC__ @@ -83,6 +89,7 @@ namespace Const{ const QString GROUP_FUNCTION_RX = "(%1\\s*"+GROUP_FUNCTION_PARAM_RX+")"; const QString GROUP_FUNCTION_NAME_RX = "%1\\s*\\((.*[^\\)])\\)"; const int SCENE_MARGIN = 50; + const QString FUNCTION_MANAGER_NAME = "LimeReport"; } QString extractClassName(QString className); enum RenderPass {FirstPass, SecondPass}; @@ -117,6 +124,13 @@ namespace Const{ typedef QStyleOptionViewItem StyleOptionViewItem; #endif +#ifdef USE_QJSENGINE + typedef QJSEngine ScriptEngineType; + typedef QJSValue ScriptValueType; +#else + typedef QScriptEngine ScriptEngineType; + typedef QScriptValue ScriptValueType; +#endif } // namespace LimeReport diff --git a/limereport/lritemdesignintf.cpp b/limereport/lritemdesignintf.cpp index db18eb2..655c39b 100644 --- a/limereport/lritemdesignintf.cpp +++ b/limereport/lritemdesignintf.cpp @@ -215,27 +215,27 @@ QString ContentItemDesignIntf::expandScripts(QString context, DataSourceManager* if (context.contains(rx)){ ScriptEngineManager::instance().setDataManager(dataManager); - QScriptEngine* se = ScriptEngineManager::instance().scriptEngine(); + ScriptEngineType* se = ScriptEngineManager::instance().scriptEngine(); - QScriptValue svThis = se->globalObject().property("THIS"); - if (svThis.isValid()){ - se->newQObject(svThis, this); - } else { - svThis = se->newQObject(this); - se->globalObject().setProperty("THIS",svThis); - } + //QJSValue svThis = se->globalObject().property("THIS"); + //if (!svThis.isUndefined()){ + // se->newQObject(svThis, this); + //} else { + ScriptValueType svThis = se->newQObject(this); + se->globalObject().setProperty("THIS",svThis); + //} ScriptExtractor scriptExtractor(context); if (scriptExtractor.parse()){ for(int i=0; ievaluate(scriptBody); - if (!se->hasUncaughtException()) { + ScriptValueType value = se->evaluate(scriptBody); + if (!value.isError()) { m_varValue = value.toVariant(); context.replace(scriptExtractor.scriptAt(i),value.toString()); } else { - context.replace(scriptExtractor.scriptAt(i),se->uncaughtException().toString()); + context.replace(scriptExtractor.scriptAt(i),value.toString()); } } } diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 7ff4095..2ce78ee 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -775,7 +775,7 @@ IDataSourceManager *ReportEngine::dataManager() return d->dataManagerIntf(); } -IScriptEngineManager* ReportEngine::scriptManager() +IScriptEngineManager *ReportEngine::scriptManager() { Q_D(ReportEngine); return d->scriptManagerIntf(); diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index 814d831..804e764 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -33,6 +33,7 @@ #include #include #include +//#include #include "lrglobal.h" #include "lrdatasourcemanagerintf.h" diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 42dacef..1f4924c 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -167,7 +167,7 @@ void ReportRender::setScriptContext(ScriptEngineContext* scriptContext) bool ReportRender::runInitScript(){ if (m_scriptEngineContext){ - QScriptValue res = ScriptEngineManager::instance().scriptEngine()->evaluate(m_scriptEngineContext->initScript()); + ScriptValueType res = ScriptEngineManager::instance().scriptEngine()->evaluate(m_scriptEngineContext->initScript()); if (res.isBool()) return res.toBool(); } return true; diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index 976aa22..6aaedca 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -181,7 +181,7 @@ void ScriptEngineModel::updateModel() beginResetModel(); m_rootNode->clear(); QMap categories; - foreach(ScriptFunctionDesc funcDesc, m_scriptManager->functionsDescriber()){ + foreach(ScriptFunctionDesc funcDesc, m_scriptManager->functionsDescribers()){ ScriptEngineNode* categ; QString categoryName = (!funcDesc.category.isEmpty())?funcDesc.category:"NO CATEGORY"; if (categories.contains(categoryName)){ @@ -328,6 +328,44 @@ void ScriptEngineManager::deleteFunction(const QString &functionsName) } } +bool ScriptEngineManager::addFunction(const JSFunctionDesc &functionDescriber) +{ + ScriptValueType functionManager = scriptEngine()->globalObject().property(functionDescriber.managerName()); +#ifdef USE_QJSENGINE + if (functionManager.isUndefined()){ +#else + if (!functionManager.isValid()){ +#endif + functionManager = scriptEngine()->newQObject(functionDescriber.manager()); + scriptEngine()->globalObject().setProperty( + functionDescriber.managerName(), + functionManager + ); + } + + if (functionManager.toQObject() == functionDescriber.manager()){ + ScriptValueType checkWrapper = scriptEngine()->evaluate(functionDescriber.scriptWrapper()); + if (!checkWrapper.isError()){ + ScriptFunctionDesc funct; + funct.name = functionDescriber.name(); + funct.description = functionDescriber.description(); + funct.category = functionDescriber.category(); + funct.type = ScriptFunctionDesc::Native; + m_functions.append(funct); + if (m_model) + m_model->updateModel(); + return true; + } else { + m_lastError = checkWrapper.toString(); + return false; + } + } else { + m_lastError = tr("Function manger with name \"%1\" already exists !"); + return false; + } + +} + bool ScriptEngineManager::containsFunction(const QString& functionName){ foreach (ScriptFunctionDesc funct, m_functions) { if (funct.name.compare(functionName)== 0){ @@ -337,7 +375,8 @@ bool ScriptEngineManager::containsFunction(const QString& functionName){ return false; } -bool ScriptEngineManager::addFunction(const QString& name, +#ifndef USE_QJSENGINE +Q_DECL_DEPRECATED bool ScriptEngineManager::addFunction(const QString& name, QScriptEngine::FunctionSignature function, const QString& category, const QString& description) @@ -360,23 +399,23 @@ bool ScriptEngineManager::addFunction(const QString& name, return false; } } +#endif bool ScriptEngineManager::addFunction(const QString& name, const QString& script, const QString& category, const QString& description) { - QScriptSyntaxCheckResult cr = m_scriptEngine->checkSyntax(script); - if (cr.state() == QScriptSyntaxCheckResult::Valid){ + ScriptValueType functionValue = m_scriptEngine->evaluate(script); + if (!functionValue.isError()){ ScriptFunctionDesc funct; - funct.scriptValue = m_scriptEngine->evaluate(script); + funct.scriptValue = functionValue; funct.name = name; funct.category = category; funct.description = description; funct.type = ScriptFunctionDesc::Script; - funct.scriptValue.setData(m_scriptEngine->toScriptValue(this)); m_functions.append(funct); m_model->updateModel(); return true; } else { - m_lastError = cr.errorMessage(); + m_lastError = functionValue.toString(); return false; } } @@ -395,12 +434,18 @@ void ScriptEngineManager::setDataManager(DataSourceManager *dataManager){ m_dataManager = dataManager; if (m_dataManager){ foreach(QString func, m_dataManager->groupFunctionNames()){ - if (isFunctionExists(func)) deleteFunction(func); - addFunction(func, groupFunction,"GROUP FUNCTIONS", func+"(\""+tr("FieldName")+"\",\""+tr("BandName")+"\")"); - } - foreach(ScriptFunctionDesc func, m_functions){ - if (func.type==ScriptFunctionDesc::Native) - m_scriptEngine->globalObject().setProperty(func.name,func.scriptValue); + JSFunctionDesc describer( + func, + "GROUP FUNCTIONS", + func+"(\""+tr("FieldName")+"\",\""+tr("BandName")+"\")", + LimeReport::Const::FUNCTION_MANAGER_NAME, + m_functionManager, + QString("function %1(fieldName,bandName){\ + return %2.calcGroupFunction(\"%1\",fieldName,bandName);}" + ).arg(func) + .arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ); + addFunction(describer); } } } @@ -411,27 +456,211 @@ void ScriptEngineManager::updateModel() } +bool ScriptEngineManager::createLineFunction() +{ + JSFunctionDesc fd; + + fd.setManager(m_functionManager); + fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); + fd.setCategory("SYSTEM"); + fd.setName("line"); + fd.setDescription("line(\""+tr("BandName")+"\")"); + fd.setScriptWrapper(QString("function line(bandName){ return %1.line(bandName);}").arg(LimeReport::Const::FUNCTION_MANAGER_NAME)); + + return addFunction(fd); + +} + +bool ScriptEngineManager::createNumberFomatFunction() +{ + JSFunctionDesc fd; + + fd.setManager(m_functionManager); + fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); + fd.setCategory("NUMBER"); + fd.setName("numberFormat"); + fd.setDescription("numberFormat(\""+tr("Value")+"\",\""+tr("Format")+"\",\""+ + tr("Precision")+"\",\""+ + tr("Locale")+"\")" + ); + fd.setScriptWrapper(QString("function numberFormat(value, format, precision, locale){" + " if(typeof(format)==='undefined') format = \"f\"; " + " if(typeof(precision)==='undefined') precision=2; " + " if(typeof(locale)==='undefined') locale=\"\"; " + "return %1.numberFormat(value,format,precision,locale);}" + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ); + return addFunction(fd); +} + +bool ScriptEngineManager::createDateFormatFunction(){ +// addFunction("dateFormat",dateFormat,"DATE&TIME", "dateFormat(\""+tr("Value")+"\",\""+tr("Format")+"\")"); + JSFunctionDesc fd; + + fd.setManager(m_functionManager); + fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); + fd.setCategory("DATE&TIME"); + fd.setName("dateFormat"); + fd.setDescription("dateFormat(\""+tr("Value")+"\",\""+tr("Format")+"\")"); + fd.setScriptWrapper(QString("function dateFormat(value, format){" + " if(typeof(format)==='undefined') format = \"dd.MM.yyyy\"; " + "return %1.dateFormat(value,format);}" + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ); + return addFunction(fd); +} + +bool ScriptEngineManager::createTimeFormatFunction(){ +// addFunction("timeFormat",timeFormat,"DATE&TIME", "dateFormat(\""+tr("Value")+"\",\""+tr("Format")+"\")"); + JSFunctionDesc fd; + + fd.setManager(m_functionManager); + fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); + fd.setCategory("DATE&TIME"); + fd.setName("timeFormat"); + fd.setDescription("timeFormat(\""+tr("Value")+"\",\""+tr("Format")+"\")"); + fd.setScriptWrapper(QString("function timeFormat(value, format){" + " if(typeof(format)==='undefined') format = \"hh:mm\"; " + "return %1.timeFormat(value,format);}" + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ); + return addFunction(fd); +} + +bool ScriptEngineManager::createDateTimeFormatFunction(){ +// addFunction("dateTimeFormat", dateTimeFormat, "DATE&TIME", "dateTimeFormat(\""+tr("Value")+"\",\""+tr("Format")+"\")"); + JSFunctionDesc fd; + + fd.setManager(m_functionManager); + fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); + fd.setCategory("DATE&TIME"); + fd.setName("dateTimeFormat"); + fd.setDescription("dateTimeFormat(\""+tr("Value")+"\",\""+tr("Format")+"\")"); + fd.setScriptWrapper(QString("function dateTimeFormat(value, format){" + " if(typeof(format)==='undefined') format = \"dd.MM.yyyy hh:mm\"; " + "return %1.dateTimeFormat(value,format);}" + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ); + return addFunction(fd); +} + +bool ScriptEngineManager::createDateFunction(){ +// addFunction("date",date,"DATE&TIME","date()"); + JSFunctionDesc fd; + + fd.setManager(m_functionManager); + fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); + fd.setCategory("DATE&TIME"); + fd.setName("date"); + fd.setDescription("date()"); + fd.setScriptWrapper(QString("function date(){" + "return %1.date();}" + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ); + return addFunction(fd); +} + + +bool ScriptEngineManager::createNowFunction(){ +// addFunction("now",now,"DATE&TIME","now()"); + JSFunctionDesc fd; + + fd.setManager(m_functionManager); + fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); + fd.setCategory("DATE&TIME"); + fd.setName("now"); + fd.setDescription("now()"); + fd.setScriptWrapper(QString("function now(){" + "return %1.now();}" + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ); + return addFunction(fd); +} + +bool ScriptEngineManager::createCurrencyFormatFunction(){ +// addFunction("currencyFormat",currencyFormat,"NUMBER","currencyFormat(\""+tr("Value")+"\",\""+tr("Locale")+"\")"); + JSFunctionDesc fd; + + fd.setManager(m_functionManager); + fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); + fd.setCategory("NUMBER"); + fd.setName("currencyFormat"); + fd.setDescription("currencyFormat(\""+tr("Value")+"\",\""+tr("Locale")+"\")"); + fd.setScriptWrapper(QString("function currencyFormat(value, locale){" + " if(typeof(locale)==='undefined') locale = \"\"; " + "return %1.currencyFormat(value,locale);}" + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ); + return addFunction(fd); +} + +bool ScriptEngineManager::createCurrencyUSBasedFormatFunction(){ +// addFunction("currencyUSBasedFormat",currencyUSBasedFormat,"NUMBER","currencyUSBasedFormat(\""+tr("Value")+",\""+tr("CurrencySymbol")+"\")"); + JSFunctionDesc fd; + + fd.setManager(m_functionManager); + fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); + fd.setCategory("NUMBER"); + fd.setName("currencyUSBasedFormat"); + fd.setDescription("currencyUSBasedFormat(\""+tr("Value")+",\""+tr("CurrencySymbol")+"\")"); + fd.setScriptWrapper(QString("function currencyUSBasedFormat(value, currencySymbol){" + " if(typeof(currencySymbol)==='undefined') currencySymbol = \"\"; " + "return %1.currencyFormat(value,currencySymbol);}" + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ); + return addFunction(fd); +} + +bool ScriptEngineManager::createSetVariableFunction(){ +// addFunction("setVariable", setVariable, "GENERAL", "setVariable(\""+tr("Name")+"\",\""+tr("Value")+"\")"); + JSFunctionDesc fd; + + fd.setManager(m_functionManager); + fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); + fd.setCategory("GENERAL"); + fd.setName("setVariable"); + fd.setDescription("setVariable(\""+tr("Name")+"\",\""+tr("Value")+"\")"); + fd.setScriptWrapper(QString("function setVariable(name, value){" + "return %1.setVariable(name,value);}" + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ); + return addFunction(fd); +} + ScriptEngineManager::ScriptEngineManager() :m_model(0), m_dataManager(0) { - m_scriptEngine = new QScriptEngine; + m_scriptEngine = new ScriptEngineType; + m_functionManager = new ScriptFunctionsManager(this); + m_functionManager->setScriptEngineManager(this); - //addFunction("dateToStr",dateToStr,"DATE", "dateToStr(\"value\",\"format\")"); - addFunction("line",line,"SYSTEM", "line(\""+tr("BandName")+"\")"); - addFunction("numberFormat",numberFormat,"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()"); + createLineFunction(); + createNumberFomatFunction(); + createDateFormatFunction(); + createTimeFormatFunction(); + createDateTimeFormatFunction(); + createDateFunction(); + createNowFunction(); #if QT_VERSION>0x040800 - addFunction("currencyFormat",currencyFormat,"NUMBER","currencyFormat(\""+tr("Value")+"\",\""+tr("Locale")+"\")"); - addFunction("currencyUSBasedFormat",currencyUSBasedFormat,"NUMBER","currencyUSBasedFormat(\""+tr("Value")+",\""+tr("CurrencySymbol")+"\")"); + createCurrencyFormatFunction(); + createCurrencyUSBasedFormatFunction(); #endif - addFunction("setVariable", setVariable, "GENERAL", "setVariable(\""+tr("Name")+"\",\""+tr("Value")+"\")"); + createSetVariableFunction(); +// addFunction("line",line,"SYSTEM", "line(\""+tr("BandName")+"\")"); +// addFunction("numberFormat",numberFormat,"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("currencyFormat",currencyFormat,"NUMBER","currencyFormat(\""+tr("Value")+"\",\""+tr("Locale")+"\")"); +// addFunction("currencyUSBasedFormat",currencyUSBasedFormat,"NUMBER","currencyUSBasedFormat(\""+tr("Value")+",\""+tr("CurrencySymbol")+"\")"); +// addFunction("setVariable", setVariable, "GENERAL", "setVariable(\""+tr("Name")+"\",\""+tr("Value")+"\")"); +#ifndef USE_QJSENGINE QScriptValue colorCtor = m_scriptEngine->newFunction(constructColor); m_scriptEngine->globalObject().setProperty("QColor", colorCtor); @@ -439,7 +668,7 @@ ScriptEngineManager::ScriptEngineManager() m_scriptEngine->setDefaultPrototype(qMetaTypeId(), fontProto); QScriptValue fontConstructor = m_scriptEngine->newFunction(QFontPrototype::constructorQFont, fontProto); m_scriptEngine->globalObject().setProperty("QFont", fontConstructor); - +#endif // foreach(QString func, dataManager()->groupFunctionNames()){ // addFunction(func, groupFunction,"GROUP FUNCTIONS", func+"(\""+tr("FieldName")+"\",\""+tr("BandName")+"\")"); // } @@ -753,5 +982,183 @@ DialogDescriber::Ptr DialogDescriber::create(const QString& name, const QByteArr return res; } +QString JSFunctionDesc::name() const +{ + return m_name; +} + +void JSFunctionDesc::setName(const QString &name) +{ + m_name = name; +} + +QString JSFunctionDesc::category() const +{ + return m_category; +} + +void JSFunctionDesc::setCategory(const QString &category) +{ + m_category = category; +} + +QString JSFunctionDesc::description() const +{ + return m_description; +} + +void JSFunctionDesc::setDescription(const QString &description) +{ + m_description = description; +} + +QString JSFunctionDesc::managerName() const +{ + return m_managerName; +} + +void JSFunctionDesc::setManagerName(const QString &managerName) +{ + m_managerName = managerName; +} + +QObject *JSFunctionDesc::manager() const +{ + return m_manager; +} + +void JSFunctionDesc::setManager(QObject *manager) +{ + m_manager = manager; +} + +QString JSFunctionDesc::scriptWrapper() const +{ + return m_scriptWrapper; +} + +void JSFunctionDesc::setScriptWrapper(const QString &scriptWrapper) +{ + m_scriptWrapper = scriptWrapper; +} + +QVariant ScriptFunctionsManager::calcGroupFunction(const QString &name, const QString &fieldName, const QString &bandName) +{ + if (m_scriptEngineManager->dataManager()){ + GroupFunction* gf = m_scriptEngineManager->dataManager()->groupFunction(name,fieldName,bandName); + if (gf){ + if (gf->isValid()){ + return gf->calculate(); + }else{ + return gf->error(); + } + } + else { + return QString(QObject::tr("Function %1 not found or have wrong arguments").arg(name)); + } + } else { + return QString(QObject::tr("Datasource manager not found")); + } +} + +QVariant ScriptFunctionsManager::line(const QString &bandName) +{ + QString varName = QLatin1String("line_")+bandName.toLower(); + QVariant res; + if (scriptEngineManager()->dataManager()->variable(varName).isValid()){ + res=scriptEngineManager()->dataManager()->variable(varName); + } else res=QString("Variable line for band %1 not found").arg(bandName); + return res; +} + +QVariant ScriptFunctionsManager::numberFormat(QVariant value, const char &format, int precision, const QString& locale) +{ + return (locale.isEmpty())?QString::number(value.toDouble(),format,precision): + QLocale(locale).toString(value.toDouble(),format,precision); +} + +QVariant ScriptFunctionsManager::dateFormat(QVariant value, const QString &format) +{ + return QLocale().toString(value.toDate(),format); +} + +QVariant ScriptFunctionsManager::timeFormat(QVariant value, const QString &format) +{ + return QLocale().toString(value.toTime(),format); +} + +QVariant ScriptFunctionsManager::dateTimeFormat(QVariant value, const QString &format) +{ + return QLocale().toString(value.toDateTime(),format); +} + +QVariant ScriptFunctionsManager::date() +{ + return QDate::currentDate(); +} + +QVariant ScriptFunctionsManager::now() +{ + return QDateTime::currentDateTime(); +} + +QVariant ScriptFunctionsManager::currencyFormat(QVariant value, const QString &locale) +{ + QString l = (!locale.isEmpty())?locale:QLocale::system().name(); + return QLocale(l).toCurrencyString(value.toDouble()); +} + +QVariant ScriptFunctionsManager::currencyUSBasedFormat(QVariant value, const QString ¤cySymbol) +{ + QString CurrencySymbol = (!currencySymbol.isEmpty())?currencySymbol:QLocale::system().currencySymbol(); + // Format it using USA locale + QString vTempStr=QLocale(QLocale::English, QLocale::UnitedStates).toCurrencyString(value.toDouble()); + // Replace currency symbol if necesarry + if (CurrencySymbol!="") vTempStr.replace("$", CurrencySymbol); + return vTempStr; +} + +void ScriptFunctionsManager::setVariable(const QString &name, QVariant value) +{ + DataSourceManager* dm = scriptEngineManager()->dataManager(); + dm->changeVariable(name,value); +} +#ifdef USE_QJSENGINE +QFont ScriptFunctionsManager::font(const QString &family, int pointSize, bool bold, bool italic, bool underLine) +{ + QFont result (family, pointSize); + result.setBold(bold); + result.setItalic(italic); + result.setUnderline(underLine); + return result; +} +#endif +QFont ScriptFunctionsManager::font(QVariantMap params){ + if (!params.contains("family")){ + return QFont(); + } else { + QFont result(params.value("family").toString()); + if (params.contains("pointSize")) + result.setPointSize(params.value("pointSize").toInt()); + if (params.contains("bold")) + result.setBold(params.value("bold").toBool()); + if (params.contains("italic")) + result.setItalic(params.value("italic").toBool()); + if (params.contains("underline")) + result.setUnderline(params.value("underline").toBool()); + return result; + } +} + +ScriptEngineManager *ScriptFunctionsManager::scriptEngineManager() const +{ + return m_scriptEngineManager; +} + +void ScriptFunctionsManager::setScriptEngineManager(ScriptEngineManager *scriptEngineManager) +{ + m_scriptEngineManager = scriptEngineManager; +} + } //namespace LimeReport diff --git a/limereport/lrscriptenginemanager.h b/limereport/lrscriptenginemanager.h index 0c738d9..63a2f45 100644 --- a/limereport/lrscriptenginemanager.h +++ b/limereport/lrscriptenginemanager.h @@ -39,11 +39,15 @@ #include #include + +//#include + #ifdef HAVE_UI_LOADER #include #endif #include "base/lrsingleton.h" +#include "lrglobal.h" #include "lrscriptenginemanagerintf.h" #include "lrcollection.h" @@ -53,7 +57,7 @@ class DataSourceManager; struct ScriptFunctionDesc{ enum FuncType {Native,Script}; - QScriptValue scriptValue; + ScriptValueType scriptValue; QString name; QString description; QString category; @@ -169,22 +173,91 @@ private: QString m_initScript; }; +class JSFunctionDesc{ +public: + JSFunctionDesc(){} + JSFunctionDesc(const QString& functionName, + const QString& functionCategory, + const QString& functionDescription, + const QString& functionManagerName, + QObject* functionManger, + const QString& functionScriptWrapper + ): m_name(functionName), m_category(functionCategory), m_description(functionDescription), + m_managerName(functionManagerName), m_manager(functionManger), m_scriptWrapper(functionScriptWrapper) + {} + QString name() const; + void setName(const QString &name); + + QString category() const; + void setCategory(const QString &category); + + QString description() const; + void setDescription(const QString &description); + + QString managerName() const; + void setManagerName(const QString &managerName); + + QObject *manager() const; + void setManager(QObject *manager); + + QString scriptWrapper() const; + void setScriptWrapper(const QString &scriptWrapper); + +private: + QString m_name; + QString m_category; + QString m_description; + QString m_managerName; + QObject* m_manager; + QString m_scriptWrapper; +}; + +class ScriptFunctionsManager : public QObject{ + Q_OBJECT +public: + explicit ScriptFunctionsManager(QObject* parent = 0):QObject(parent){} + Q_INVOKABLE QVariant calcGroupFunction(const QString& name, const QString& fieldName, const QString& bandName); + Q_INVOKABLE QVariant line(const QString& bandName); + Q_INVOKABLE QVariant numberFormat(QVariant value, const char &format, int precision, const QString &locale); + Q_INVOKABLE QVariant dateFormat(QVariant value, const QString& format); + Q_INVOKABLE QVariant timeFormat(QVariant value, const QString& format); + Q_INVOKABLE QVariant dateTimeFormat(QVariant value, const QString& format); + Q_INVOKABLE QVariant date(); + Q_INVOKABLE QVariant now(); + Q_INVOKABLE QVariant currencyFormat(QVariant value, const QString& locale); + Q_INVOKABLE QVariant currencyUSBasedFormat(QVariant value, const QString& currencySymbol); + Q_INVOKABLE void setVariable(const QString& name, QVariant value); + Q_INVOKABLE QVariant color(const QString& color){ return QColor(color);} +#ifdef USE_QJSENGINE + Q_INVOKABLE QFont font(const QString& family, int pointSize = -1, bool bold = false, bool italic = false, bool underLine = false); +#endif + Q_INVOKABLE QFont font(QVariantMap params); + ScriptEngineManager *scriptEngineManager() const; + void setScriptEngineManager(ScriptEngineManager *scriptEngineManager); + static QColor createQColor(const QString& color){ return QColor(color);} +private: + ScriptEngineManager* m_scriptEngineManager; +}; + class ScriptEngineManager : public QObject, public Singleton, public IScriptEngineManager { Q_OBJECT public: - QScriptEngine* scriptEngine(){return m_scriptEngine;} - ~ScriptEngineManager(); friend class Singleton; + ScriptEngineType* scriptEngine(){return m_scriptEngine;} + ~ScriptEngineManager(); bool isFunctionExists(const QString& functionName) const; void deleteFunction(const QString& functionsName); - bool addFunction(const QString& name, QScriptEngine::FunctionSignature function, - const QString& category="", const QString& description=""); + + bool addFunction(const JSFunctionDesc& functionsDescriber); +#ifndef USE_QJSENGINE + bool addFunction(const QString &name, QScriptEngine::FunctionSignature function, const QString &category, const QString &description); +#endif bool addFunction(const QString &name, const QString& script, const QString &category="", const QString &description=""); const QString& lastError() const {return m_lastError;} QStringList functionsNames(); - const QList& functionsDescriber(){return m_functions;} + const QList& functionsDescribers(){return m_functions;} ScriptEngineModel* model(){return m_model;} void setContext(ScriptEngineContext* context){m_context=context;} DataSourceManager* dataManager() const {return m_dataManager;} @@ -195,14 +268,25 @@ protected: bool containsFunction(const QString &functionName); private: Q_DISABLE_COPY(ScriptEngineManager) + bool createLineFunction(); + bool createNumberFomatFunction(); + bool createDateFormatFunction(); + bool createTimeFormatFunction(); + bool createDateTimeFormatFunction(); + bool createDateFunction(); + bool createNowFunction(); + bool createCurrencyFormatFunction(); + bool createCurrencyUSBasedFormatFunction(); + bool createSetVariableFunction(); private: ScriptEngineManager(); - QScriptEngine* m_scriptEngine; + ScriptEngineType* m_scriptEngine; QString m_lastError; QList m_functions; ScriptEngineModel* m_model; ScriptEngineContext* m_context; DataSourceManager* m_dataManager; + ScriptFunctionsManager* m_functionManager; }; class ScriptExtractor diff --git a/limereport/lrscriptenginemanagerintf.h b/limereport/lrscriptenginemanagerintf.h index d7662ff..4c2767a 100644 --- a/limereport/lrscriptenginemanagerintf.h +++ b/limereport/lrscriptenginemanagerintf.h @@ -30,15 +30,19 @@ #ifndef LRSCRIPTENGINEMANAGERINTF_H #define LRSCRIPTENGINEMANAGERINTF_H -#include +//#include +#include "lrglobal.h" namespace LimeReport{ + class IScriptEngineManager{ public: - virtual QScriptEngine* scriptEngine() = 0; - virtual bool addFunction(const QString& name, QScriptEngine::FunctionSignature function, + virtual ScriptEngineType* scriptEngine() = 0; +#ifndef USE_QJSENGINE + virtual bool addFunction(const QString& name, ScriptEngineType::FunctionSignature function, const QString& category="", const QString& description="") = 0; +#endif virtual bool addFunction(const QString &name, const QString& script, const QString &category="", const QString &description="") = 0; virtual const QString& lastError() const = 0; @@ -46,4 +50,5 @@ public: }; } //namespace LimeReport + #endif // LRSCRIPTENGINEMANAGERINTF_H diff --git a/limereport/scriptbrowser/lrscriptbrowser.cpp b/limereport/scriptbrowser/lrscriptbrowser.cpp index ea38798..8719229 100644 --- a/limereport/scriptbrowser/lrscriptbrowser.cpp +++ b/limereport/scriptbrowser/lrscriptbrowser.cpp @@ -66,7 +66,7 @@ void ScriptBrowser::updateFunctionTree() { ScriptEngineManager* sm = reportEditor()->scriptManager(); QMap categ; - foreach(ScriptFunctionDesc fd, sm->functionsDescriber()){ + foreach(ScriptFunctionDesc fd, sm->functionsDescribers()){ QString functionCategory = (fd.category!="") ? fd.category : tr("NO CATEGORY"); if (categ.contains(functionCategory)){ QTreeWidgetItem* item = new QTreeWidgetItem(categ.value(fd.category),QStringList(fd.name)); From db87e5dc9ec9689e5286a31f98f2ea11bfe52e69 Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Wed, 2 Nov 2016 11:15:05 +0300 Subject: [PATCH 002/136] Build with uitools has been fixed --- limereport/lrreportrender.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 1f4924c..6791398 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -295,9 +295,9 @@ void ReportRender::initVariables() #ifdef HAVE_UI_LOADER void ReportRender::initDialogs(){ if (m_scriptEngineContext){ - QScriptEngine* se = ScriptEngineManager::instance().scriptEngine(); + ScriptEngineType* se = ScriptEngineManager::instance().scriptEngine(); foreach(DialogDescriber::Ptr dialog, m_scriptEngineContext->dialogsDescriber()){ - QScriptValue sv = se->newQObject(m_scriptEngineContext->getDialog(dialog->name())); + ScriptValueType sv = se->newQObject(m_scriptEngineContext->getDialog(dialog->name())); se->globalObject().setProperty(dialog->name(),sv); } } From cf1b2a4146181f4224c5a7fb3abfd9d2bfc91d8f Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Wed, 2 Nov 2016 14:54:36 +0300 Subject: [PATCH 003/136] qjsengine and uitools are switched on --- common.pri | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/common.pri b/common.pri index 78398e5..fcefb93 100644 --- a/common.pri +++ b/common.pri @@ -1,12 +1,12 @@ CONFIG += build_translations CONFIG += zint -#CONFIG += qjsengine -#greaterThan(QT_MAJOR_VERSION, 4) { -# QT += uitools -#} -#lessThan(QT_MAJOR_VERSION, 5){ -# CONFIG += uitools -#} +CONFIG += qjsengine +greaterThan(QT_MAJOR_VERSION, 4) { + QT += uitools +} +lessThan(QT_MAJOR_VERSION, 5){ + CONFIG += uitools +} ZINT_PATH = $$PWD/3rdparty/zint-2.4.4 From 5b95b9b3d69ad3b62c0c6e80503ef590be284951 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 4 Nov 2016 01:11:45 +0300 Subject: [PATCH 004/136] followTo has been added followTo has been added --- limereport/items/lrtextitem.cpp | 176 ++++++++++++++++++++++++-------- limereport/items/lrtextitem.h | 25 ++++- limereport/lrbanddesignintf.cpp | 1 + limereport/lrbasedesignintf.cpp | 29 +++++- limereport/lrbasedesignintf.h | 6 ++ limereport/lrpageinitintf.h | 9 ++ limereport/lrreportrender.cpp | 12 ++- 7 files changed, 202 insertions(+), 56 deletions(-) create mode 100644 limereport/lrpageinitintf.h diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 7d61562..041a737 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include "lrpagedesignintf.h" @@ -57,7 +58,7 @@ namespace LimeReport{ TextItem::TextItem(QObject *owner, QGraphicsItem *parent) : ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0), m_trimValue(true), m_allowHTML(false), - m_allowHTMLInFields(false) + m_allowHTMLInFields(false), m_followTo(""), m_follower(0) { m_text = new QTextDocument(); @@ -265,8 +266,13 @@ void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, i setWidth(m_textSize.width() + fakeMarginSize()*2); } - if ((m_textSize.height()>height()) && (m_autoHeight) ){ - setHeight(m_textSize.height()+borderLineSize()*2); + if (m_textSize.height()>height()) { + if (m_autoHeight) + setHeight(m_textSize.height()+borderLineSize()*2); + else if (hasFollower() && !content().isEmpty()){ + follower()->setContent(getTextPart(0,height())); + setContent(getTextPart(height(),0)); + } } BaseDesignIntf::updateItemSize(dataManager, pass, maxHeight); } @@ -353,6 +359,7 @@ void TextItem::setLineSpacing(int value) void TextItem::initText() { + if (!m_text) return; QTextOption to; to.setAlignment(m_alignment); @@ -454,6 +461,66 @@ QString TextItem::formatFieldValue() } } +QString TextItem::followTo() const +{ + return m_followTo; +} + +void TextItem::setFollowTo(const QString &followTo) +{ + if (m_followTo != followTo){ + QString oldValue = m_followTo; + m_followTo = followTo; + if (!isLoading()){ + TextItem* fi = scene()->findChild(followTo); + if (fi && initFollower(followTo)){ + notify("followTo",oldValue,followTo); + } else { + m_followTo = ""; + QMessageBox::critical( + 0, + tr("Error"), + tr("TextItem \" %1 \" already has folower \" %2 \" ") + .arg(fi->objectName()) + .arg(fi->follower()->objectName()) + ); + notify("followTo",followTo,""); + } + } + } +} + +void TextItem::setFollower(TextItem *follower) +{ + if (!m_follower){ + m_follower = follower; + } +} + +bool TextItem::hasFollower() +{ + return m_follower != 0; +} + +bool TextItem::initFollower(QString follower) +{ + TextItem* fi = scene()->findChild(follower); + if (fi){ + if (!fi->hasFollower()){ + fi->setFollower(this); + return true; + } + } + return false; +} + +void TextItem::pageObjectHasBeenLoaded() +{ + if (!m_followTo.isEmpty()){ + initFollower(m_followTo); + } +} + TextItem::ValueType TextItem::valueType() const { return m_valueType; @@ -537,6 +604,7 @@ bool TextItem::isNeedUpdateSize(RenderPass pass) const Q_UNUSED(pass) bool res = (m_textSize.height()>geometry().height()&&autoHeight()) || (m_textSize.width()>geometry().width()&&autoWidth()) || + m_follower || isNeedExpandContent(); return res; } @@ -557,6 +625,7 @@ void TextItem::setAlignment(Qt::Alignment value) void TextItem::expandContent(DataSourceManager* dataManager, RenderPass pass) { + QString context=content(); ExpandType expandType = (allowHTML() && !allowHTMLInFields())?ReplaceHTMLSymbols:NoEscapeSymbols; switch(pass){ @@ -575,6 +644,7 @@ void TextItem::expandContent(DataSourceManager* dataManager, RenderPass pass) } else { setContent(context); } + } void TextItem::setAutoHeight(bool value) @@ -611,63 +681,79 @@ bool TextItem::canBeSplitted(int height) const return height>(m_text->begin().layout()->lineAt(0).height()); } -BaseDesignIntf *TextItem::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent) -{ +QString TextItem::getTextPart(int height, int skipHeight){ int linesHeight=0; - QString tmpText=""; - TextItem* upperPart = dynamic_cast(cloneItem(itemMode(),owner,parent)); + int curLine=0; + int textPos=0; - for (QTextBlock it=m_text->begin();it!=m_text->end();it=it.next()){ - for (int i=0;ilineCount();i++){ - linesHeight+=it.layout()->lineAt(i).height()+lineSpacing(); - if (linesHeight>(height-(fakeMarginSize()*2+borderLineSize()*2))) { - linesHeight-=it.layout()->lineAt(i).height(); - goto loop_exit; + QTextBlock curBlock = m_text->begin(); + QString resultText=""; + + if (skipHeight>0){ + for (;curBlock!=m_text->end();curBlock=curBlock.next()){ + for (curLine=0;curLinelineCount();curLine++){ + linesHeight+=curBlock.layout()->lineAt(curLine).height()+lineSpacing(); + if (linesHeight>(skipHeight-(/*fakeMarginSize()*2+*/borderLineSize()*2))) {goto loop_exit;} + } + } + loop_exit:; + } + + linesHeight = 0; + qDebug()<end()); + for (;curBlock!=m_text->end() || curLinelineCount();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; } - tmpText+=it.text().mid(it.layout()->lineAt(i).textStart(),it.layout()->lineAt(i).textLength())+'\n'; + resultText+=curBlock.text().mid(curBlock.layout()->lineAt(curLine).textStart(), + curBlock.layout()->lineAt(curLine).textLength()); } } - loop_exit: - tmpText.chop(1); + loop_exit1:; + + resultText.chop(1); - upperPart->setHeight(linesHeight+fakeMarginSize()*2+borderLineSize()*2); QScopedPointer context(new HtmlContext(m_strText)); - upperPart->setContent(context->extendTextByTags(tmpText,0)); + return context->extendTextByTags(resultText,textPos); +} + +void TextItem::restoreLinksEvent() +{ + if (!followTo().isEmpty()){ + BaseDesignIntf* pi = dynamic_cast(parentItem()); + if (pi){ + foreach (BaseDesignIntf* bi, pi->childBaseItems()) { + if (bi->patternName().compare(followTo())==0){ + TextItem* ti = dynamic_cast(bi); + if (ti){ + ti->setFollower(this); + } + } + } + } + } +} + +BaseDesignIntf *TextItem::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent) +{ + TextItem* upperPart = dynamic_cast(cloneItem(itemMode(),owner,parent)); + upperPart->setContent(getTextPart(height,0)); upperPart->initText(); + upperPart->setHeight(upperPart->textSize().height()+borderLineSize()*2); return upperPart; } BaseDesignIntf *TextItem::cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent) { TextItem* bottomPart = dynamic_cast(cloneItem(itemMode(),owner,parent)); - int linesHeight=0; - int curLine=0; - QTextBlock curBlock; - - QString tmpText=""; - - for (curBlock=m_text->begin();curBlock!=m_text->end();curBlock=curBlock.next()){ - for (curLine=0;curLinelineCount();curLine++){ - linesHeight+=curBlock.layout()->lineAt(curLine).height()+lineSpacing(); - if (linesHeight>(height-(fakeMarginSize()*2+borderLineSize()*2))) {goto loop_exit;} - } - } - loop_exit:; - - int textPos=0; - for (;curBlock!=m_text->end();curBlock=curBlock.next(),curLine=0){ - for (;curLinelineCount();curLine++){ - if (tmpText=="") textPos= curBlock.layout()->lineAt(curLine).textStart(); - tmpText+=curBlock.text().mid(curBlock.layout()->lineAt(curLine).textStart(), - curBlock.layout()->lineAt(curLine).textLength()) + "\n"; - } - } - tmpText.chop(1); - - QScopedPointer context(new HtmlContext(m_strText)); - bottomPart->setContent(context->extendTextByTags(tmpText,textPos)); + bottomPart->setContent(getTextPart(0,height)); bottomPart->initText(); - bottomPart->setHeight(bottomPart->m_textSize.height()+borderLineSize()*2); + bottomPart->setHeight(bottomPart->textSize().height()+borderLineSize()*2); return bottomPart; } diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index 07c3412..bda15d8 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -32,15 +32,16 @@ #include #include #include -#include "lritemdesignintf.h" -#include - #include +#include "lritemdesignintf.h" +#include "lritemdesignintf.h" +#include "lrpageinitintf.h" + namespace LimeReport { class Tag; -class TextItem : public LimeReport::ContentItemDesignIntf { +class TextItem : public LimeReport::ContentItemDesignIntf, IPageInit { Q_OBJECT Q_ENUMS(AutoWidth) Q_ENUMS(AngleType) @@ -66,6 +67,7 @@ class TextItem : public LimeReport::ContentItemDesignIntf { Q_PROPERTY(bool allowHTMLInFields READ allowHTMLInFields WRITE setAllowHTMLInFields) Q_PROPERTY(QString format READ format WRITE setFormat) Q_PROPERTY(ValueType valueType READ valueType WRITE setValueType) + Q_PROPERTY(QString followTo READ followTo WRITE setFollowTo) public: enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength}; @@ -140,12 +142,25 @@ public: ValueType valueType() const; void setValueType(const ValueType valueType); + QSizeF textSize(){ return m_textSize;} + QString followTo() const; + void setFollowTo(const QString &followTo); + void setFollower(TextItem* follower); + bool hasFollower(); + TextItem* follower(){ return m_follower;} + bool initFollower(QString follower); + + // IPageInit interface + void pageObjectHasBeenLoaded(); + protected: void updateLayout(); bool isNeedExpandContent() const; QString replaceBR(QString text); QString replaceReturns(QString text); int fakeMarginSize(); + QString getTextPart(int height, int skipHeight); + void restoreLinksEvent(); private: void initText(); void setTextFont(const QFont &value); @@ -174,6 +189,8 @@ private: QString m_format; ValueType m_valueType; + QString m_followTo; + TextItem* m_follower; }; } diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index a55f74c..c7b3dcc 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -889,6 +889,7 @@ void BandDesignIntf::updateItemSize(DataSourceManager* dataManager, RenderPass p if (borderLines()!=0){ spaceBorder += borderLineSize(); } + restoreLinks(); snapshotItemsLayout(); arrangeSubItems(pass, dataManager); if (autoHeight()){ diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 8b632d5..a901997 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -76,7 +76,8 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q m_itemAlign(DesignedItemAlign), m_changingItemAlign(false), m_borderColor(Qt::black), - m_reportSettings(0) + m_reportSettings(0), + m_patternName("") { setGeometry(QRectF(0, 0, m_width, m_height)); if (BaseDesignIntf *item = dynamic_cast(parent)) { @@ -672,6 +673,16 @@ void BaseDesignIntf::turnOnSelectionMarker(bool value) } } +QString BaseDesignIntf::patternName() const +{ + return m_patternName; +} + +void BaseDesignIntf::setPatternName(const QString &patternName) +{ + m_patternName = patternName; +} + ReportSettings *BaseDesignIntf::reportSettings() const { return m_reportSettings; @@ -737,7 +748,7 @@ void BaseDesignIntf::emitObjectNamePropertyChanged(const QString &oldName, const int BaseDesignIntf::borderLineSize() const { - return m_borderLineSize; + return 0 /*m_borderLineSize*/; } void BaseDesignIntf::setBorderLineSize(int value) @@ -987,6 +998,19 @@ void BaseDesignIntf::parentChangedEvent(BaseDesignIntf *) } +void BaseDesignIntf::restoreLinks() +{ +#ifdef HAVE_QT5 + foreach(QObject * child, children()) { +#else + foreach(QObject * child, QObject::children()) { +#endif + BaseDesignIntf *childItem = dynamic_cast(child); + if (childItem) {childItem->restoreLinks();} + } + restoreLinksEvent(); +} + QPainterPath BaseDesignIntf::shape() const { QPainterPath path; @@ -1229,6 +1253,7 @@ void BaseDesignIntf::collectionLoadFinished(const QString &collectionName) BaseDesignIntf *BaseDesignIntf::cloneItem(ItemMode mode, QObject *owner, QGraphicsItem *parent) { BaseDesignIntf *clone = cloneItemWOChild(mode, owner, parent); + clone->setPatternName(this->objectName()); #ifdef HAVE_QT5 foreach(QObject * child, children()) { #else diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index f31bf73..dae9cf4 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -249,6 +249,8 @@ public: ReportSettings* reportSettings() const; void setReportSettings(ReportSettings *reportSettings); void setZValueProperty(qreal value); + QString patternName() const; + void setPatternName(const QString &patternName); Q_INVOKABLE QString setItemWidth(qreal width); Q_INVOKABLE QString setItemHeight(qreal height); @@ -258,6 +260,7 @@ public: Q_INVOKABLE qreal getItemPosY(); Q_INVOKABLE QString setItemPosX(qreal xValue); Q_INVOKABLE QString setItemPosY(qreal yValue); + protected: //ICollectionContainer @@ -283,6 +286,8 @@ protected: virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value); virtual void childAddedEvent(BaseDesignIntf* child); virtual void parentChangedEvent(BaseDesignIntf*); + void restoreLinks(); + virtual void restoreLinksEvent(){} void drawTopLine(QPainter *painter, QRectF rect) const; void drawBootomLine(QPainter *painter, QRectF rect) const; @@ -359,6 +364,7 @@ private: bool m_changingItemAlign; QColor m_borderColor; ReportSettings* m_reportSettings; + QString m_patternName; signals: void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry); void posChanged(QObject* object, QPointF newPos, QPointF oldPos); diff --git a/limereport/lrpageinitintf.h b/limereport/lrpageinitintf.h new file mode 100644 index 0000000..346138b --- /dev/null +++ b/limereport/lrpageinitintf.h @@ -0,0 +1,9 @@ +#ifndef LRPAGEINITINTF_H +#define LRPAGEINITINTF_H + +class IPageInit{ +public: + virtual void pageObjectHasBeenLoaded() = 0; +}; + +#endif // LRPAGEINITINTF_H diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 42dacef..3d39635 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -204,7 +204,6 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) resetPageNumber(PageReset); } - //m_pageCount = 1; m_renderCanceled = false; BandDesignIntf* reportFooter = m_patternPageItem->bandByType(BandDesignIntf::ReportFooter); m_reportFooterHeight = 0; @@ -225,9 +224,7 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) QMessageBox::critical(0,tr("Error"),exception.what()); return; } - clearPageMap(); - startNewPage(); renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader),StartNewPageAsNeeded); @@ -543,15 +540,21 @@ void ReportRender::renderPageFooter(PageItemDesignIntf *patternPage) void ReportRender::renderPageItems(PageItemDesignIntf* patternPage) { + QList pageItems; foreach (BaseDesignIntf* item, patternPage->childBaseItems()) { ItemDesignIntf* id = dynamic_cast(item); if (id&&id->itemLocation()==ItemDesignIntf::Page){ BaseDesignIntf* cloneItem = item->cloneItem(m_renderPageItem->itemMode(), m_renderPageItem, m_renderPageItem); - cloneItem->updateItemSize(m_datasources); + pageItems.append(cloneItem); + //cloneItem->updateItemSize(m_datasources); } } + m_renderPageItem->restoreLinks(); + foreach(BaseDesignIntf* item, pageItems){ + item->updateItemSize(m_datasources); + } } qreal ReportRender::calcPageFooterHeight(PageItemDesignIntf *patternPage) @@ -978,7 +981,6 @@ void ReportRender::startNewPage() renderBand(band); } checkLostHeadersOnPrevPage(); - pasteGroups(); renderPageItems(m_patternPageItem); } From 97c1eb3f771bfcf1a21b78217c38c07554631ae4 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 4 Nov 2016 21:42:15 +0300 Subject: [PATCH 005/136] Dialogs for QJSEngine has been fixed. Child objects registration has been added --- limereport/lrreportrender.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 6791398..fc08cc9 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -293,11 +293,24 @@ void ReportRender::initVariables() } #ifdef HAVE_UI_LOADER + +#ifdef USE_QJSENGINE +void registerChildObjects(ScriptEngineType* se, ScriptValueType* sv){ + foreach(QObject* obj, sv->toQObject()->children()){ + ScriptValueType child = se->newQObject(obj); + sv->setProperty(obj->objectName(),child); + registerChildObjects(se, &child); + } +} +#endif void ReportRender::initDialogs(){ if (m_scriptEngineContext){ ScriptEngineType* se = ScriptEngineManager::instance().scriptEngine(); foreach(DialogDescriber::Ptr dialog, m_scriptEngineContext->dialogsDescriber()){ ScriptValueType sv = se->newQObject(m_scriptEngineContext->getDialog(dialog->name())); +#ifdef USE_QJSENGINE + registerChildObjects(se,&sv); +#endif se->globalObject().setProperty(dialog->name(),sv); } } From be67e6309bf96a0a86a6e8bbe344d39edaa394b9 Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Wed, 2 Nov 2016 00:21:45 +0300 Subject: [PATCH 006/136] pri file has been refactored pri file refactored --- limereport/limereport.pri | 99 ++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 49 deletions(-) diff --git a/limereport/limereport.pri b/limereport/limereport.pri index ae11f9e..37f2234 100644 --- a/limereport/limereport.pri +++ b/limereport/limereport.pri @@ -11,7 +11,6 @@ INCLUDEPATH += \ $$REPORT_PATH/databrowser SOURCES += \ - $$REPORT_PATH/items/lrtextitem.cpp \ $$REPORT_PATH/bands/lrpageheader.cpp \ $$REPORT_PATH/bands/lrpagefooter.cpp \ $$REPORT_PATH/bands/lrreportheader.cpp \ @@ -20,31 +19,31 @@ SOURCES += \ $$REPORT_PATH/bands/lrgroupbands.cpp \ $$REPORT_PATH/bands/lrsubdetailband.cpp \ $$REPORT_PATH/bands/lrtearoffband.cpp \ - $$REPORT_PATH/objectinspector/lrobjectinspectorwidget.cpp \ - $$REPORT_PATH/objectinspector/lrobjectitemmodel.cpp \ - $$REPORT_PATH/objectinspector/lrobjectpropitem.cpp \ - $$REPORT_PATH/objectinspector/lrpropertydelegate.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrstringpropitem.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrrectproptem.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrintpropitem.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrenumpropitem.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrboolpropitem.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrflagspropitem.cpp \ - $$REPORT_PATH/objectinspector/editors/lrtextitempropertyeditor.cpp \ - $$REPORT_PATH/objectinspector/editors/lrcomboboxeditor.cpp \ - $$REPORT_PATH/objectinspector/editors/lrcheckboxeditor.cpp \ - $$REPORT_PATH/objectinspector/editors/lrbuttonlineeditor.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrfontpropitem.cpp \ - $$REPORT_PATH/objectinspector/editors/lrfonteditor.cpp \ - $$REPORT_PATH/objectinspector/editors/lrimageeditor.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrimagepropitem.cpp \ - $$REPORT_PATH/objectinspector/lrbasedesignobjectmodel.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrqrealpropitem.cpp \ - $$REPORT_PATH/objectinspector/editors/lrcoloreditor.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrcolorpropitem.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrdatasourcepropitem.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrgroupfieldpropitem.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrcontentpropitem.cpp \ + $$REPORT_PATH/objectinspector/editors/lrtextitempropertyeditor.cpp \ + $$REPORT_PATH/objectinspector/editors/lrcomboboxeditor.cpp \ + $$REPORT_PATH/objectinspector/editors/lrcheckboxeditor.cpp \ + $$REPORT_PATH/objectinspector/editors/lrbuttonlineeditor.cpp \ + $$REPORT_PATH/objectinspector/editors/lrfonteditor.cpp \ + $$REPORT_PATH/objectinspector/editors/lrimageeditor.cpp \ + $$REPORT_PATH/objectinspector/editors/lrcoloreditor.cpp \ + $$REPORT_PATH/objectinspector/lrbasedesignobjectmodel.cpp \ + $$REPORT_PATH/objectinspector/lrobjectinspectorwidget.cpp \ + $$REPORT_PATH/objectinspector/lrobjectitemmodel.cpp \ + $$REPORT_PATH/objectinspector/lrobjectpropitem.cpp \ + $$REPORT_PATH/objectinspector/lrpropertydelegate.cpp \ $$REPORT_PATH/objectsbrowser/lrobjectbrowser.cpp \ $$REPORT_PATH/databrowser/lrdatabrowser.cpp \ $$REPORT_PATH/databrowser/lrsqleditdialog.cpp \ @@ -67,6 +66,7 @@ SOURCES += \ $$REPORT_PATH/items/lrimageitem.cpp \ $$REPORT_PATH/items/lrtextitemeditor.cpp \ $$REPORT_PATH/items/lrshapeitem.cpp \ + $$REPORT_PATH/items/lrtextitem.cpp \ $$REPORT_PATH/lrbanddesignintf.cpp \ $$REPORT_PATH/lrpageitemdesignintf.cpp \ $$REPORT_PATH/lrpagedesignintf.cpp \ @@ -97,30 +97,21 @@ contains(CONFIG, zint){ HEADERS += \ $$REPORT_PATH/base/lrsingleton.h \ + $$REPORT_PATH/base/lrsimpleabstractfactory.h \ + $$REPORT_PATH/base/lrattribsabstractfactory.h \ $$REPORT_PATH/bands/lrpageheader.h \ $$REPORT_PATH/bands/lrpagefooter.h \ $$REPORT_PATH/bands/lrreportheader.h \ $$REPORT_PATH/bands/lrreportfooter.h \ $$REPORT_PATH/bands/lrdataband.h \ $$REPORT_PATH/bands/lrtearoffband.h \ - $$REPORT_PATH/objectinspector/lrobjectinspectorwidget.h \ - $$REPORT_PATH/objectinspector/lrobjectitemmodel.h \ - $$REPORT_PATH/objectinspector/lrobjectpropitem.h \ - $$REPORT_PATH/objectinspector/lrpropertydelegate.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrstringpropitem.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrrectproptem.h \ + $$REPORT_PATH/bands/lrsubdetailband.h \ + $$REPORT_PATH/bands/lrgroupbands.h \ $$REPORT_PATH/databrowser/lrdatabrowser.h \ $$REPORT_PATH/databrowser/lrsqleditdialog.h \ $$REPORT_PATH/databrowser/lrconnectiondialog.h \ $$REPORT_PATH/databrowser/lrvariabledialog.h \ $$REPORT_PATH/databrowser/lrdatabrowsertree.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrdatasourcepropitem.h \ - $$REPORT_PATH/lrbanddesignintf.h \ - $$REPORT_PATH/lrpageitemdesignintf.h \ - $$REPORT_PATH/lrbandsmanager.h \ - $$REPORT_PATH/lrglobal.h \ - $$REPORT_PATH/base/lrsimpleabstractfactory.h \ - $$REPORT_PATH/base/lrattribsabstractfactory.h \ $$REPORT_PATH/serializators/lrserializatorintf.h \ $$REPORT_PATH/serializators/lrstorageintf.h \ $$REPORT_PATH/serializators/lrxmlqrectserializator.h \ @@ -128,29 +119,49 @@ HEADERS += \ $$REPORT_PATH/serializators/lrxmlbasetypesserializators.h \ $$REPORT_PATH/serializators/lrxmlreader.h \ $$REPORT_PATH/serializators/lrxmlwriter.h \ - $$REPORT_PATH/lrbasedesignintf.h \ - $$REPORT_PATH/lritemdesignintf.h \ - $$REPORT_PATH/lrdesignelementsfactory.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrstringpropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrrectproptem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrdatasourcepropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrfontpropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrimagepropitem.h \ $$REPORT_PATH/objectinspector/propertyItems/lrintpropitem.h \ $$REPORT_PATH/objectinspector/propertyItems/lrenumpropitem.h \ $$REPORT_PATH/objectinspector/propertyItems/lrboolpropitem.h \ $$REPORT_PATH/objectinspector/propertyItems/lrflagspropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrgroupfieldpropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrcontentpropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrqrealpropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrcolorpropitem.h \ $$REPORT_PATH/objectinspector/editors/lrtextitempropertyeditor.h \ $$REPORT_PATH/objectinspector/editors/lrcomboboxeditor.h \ $$REPORT_PATH/objectinspector/editors/lrcheckboxeditor.h \ $$REPORT_PATH/objectinspector/editors/lrbuttonlineeditor.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrgroupfieldpropitem.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrcontentpropitem.h \ + $$REPORT_PATH/objectinspector/editors/lrimageeditor.h \ + $$REPORT_PATH/objectinspector/editors/lrcoloreditor.h \ + $$REPORT_PATH/objectinspector/editors/lrfonteditor.h \ + $$REPORT_PATH/objectinspector/lrbasedesignobjectmodel.h \ + $$REPORT_PATH/objectinspector/lrobjectinspectorwidget.h \ + $$REPORT_PATH/objectinspector/lrobjectitemmodel.h \ + $$REPORT_PATH/objectinspector/lrobjectpropitem.h \ + $$REPORT_PATH/objectinspector/lrpropertydelegate.h \ $$REPORT_PATH/objectsbrowser/lrobjectbrowser.h \ - $$REPORT_PATH/items/lrtextitem.h \ - $$REPORT_PATH/items/lrsubitemparentpropitem.h \ - $$REPORT_PATH/items/lralignpropitem.h \ - $$REPORT_PATH/items/lrhorizontallayout.h \ $$REPORT_PATH/items/editors/lritemeditorwidget.h \ $$REPORT_PATH/items/editors/lrfonteditorwidget.h \ $$REPORT_PATH/items/editors/lrtextalignmenteditorwidget.h \ $$REPORT_PATH/items/editors/lritemsaligneditorwidget.h \ $$REPORT_PATH/items/editors/lritemsborderseditorwidget.h \ + $$REPORT_PATH/items/lrtextitem.h \ + $$REPORT_PATH/items/lrsubitemparentpropitem.h \ + $$REPORT_PATH/items/lralignpropitem.h \ + $$REPORT_PATH/items/lrhorizontallayout.h \ + $$REPORT_PATH/items/lrtextitemeditor.h \ + $$REPORT_PATH/items/lrshapeitem.h \ + $$REPORT_PATH/items/lrimageitem.h \ + $$REPORT_PATH/items/lrsimpletagparser.h \ + $$REPORT_PATH/lrbanddesignintf.h \ + $$REPORT_PATH/lrpageitemdesignintf.h \ + $$REPORT_PATH/lrbandsmanager.h \ + $$REPORT_PATH/lrglobal.h \ $$REPORT_PATH/lrdatadesignintf.h \ $$REPORT_PATH/lrcollection.h \ $$REPORT_PATH/lrpagedesignintf.h \ @@ -158,26 +169,15 @@ HEADERS += \ $$REPORT_PATH/lrreportengine_p.h \ $$REPORT_PATH/lrdatasourcemanager.h \ $$REPORT_PATH/lrreportdesignwindow.h \ - $$REPORT_PATH/items/lrsimpletagparser.h \ - $$REPORT_PATH/bands/lrsubdetailband.h \ $$REPORT_PATH/lrreportrender.h \ $$REPORT_PATH/lrpreviewreportwindow.h \ $$REPORT_PATH/lrpreviewreportwidget.h \ $$REPORT_PATH/lrpreviewreportwidget_p.h \ $$REPORT_PATH/lrgraphicsviewzoom.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrfontpropitem.h \ - $$REPORT_PATH/objectinspector/editors/lrfonteditor.h \ - $$REPORT_PATH/items/lrimageitem.h \ - $$REPORT_PATH/objectinspector/editors/lrimageeditor.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrimagepropitem.h \ - $$REPORT_PATH/items/lrtextitemeditor.h \ - $$REPORT_PATH/objectinspector/lrbasedesignobjectmodel.h \ + $$REPORT_PATH/lrbasedesignintf.h \ + $$REPORT_PATH/lritemdesignintf.h \ + $$REPORT_PATH/lrdesignelementsfactory.h \ $$REPORT_PATH/lrscriptenginemanager.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrqrealpropitem.h \ - $$REPORT_PATH/items/lrshapeitem.h \ - $$REPORT_PATH/objectinspector/editors/lrcoloreditor.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrcolorpropitem.h \ - $$REPORT_PATH/bands/lrgroupbands.h \ $$REPORT_PATH/lrvariablesholder.h \ $$REPORT_PATH/lrgroupfunctions.h \ $$REPORT_PATH/lrreportengine.h \ @@ -204,6 +204,7 @@ FORMS += \ $$REPORT_PATH/lraboutdialog.ui \ $$REPORT_PATH/lrsettingdialog.ui + RESOURCES += \ $$REPORT_PATH/objectinspector/lobjectinspector.qrc \ $$REPORT_PATH/databrowser/lrdatabrowser.qrc \ From 0055790bcd0edffff30c2d096e8616703d2fb8b3 Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Tue, 8 Nov 2016 01:09:35 +0300 Subject: [PATCH 007/136] setDefaultDatabasePath() has been added to DataSourceManager --- include/lrdatasourcemanagerintf.h | 1 + limereport/lrdatasourcemanager.cpp | 70 +++++++++++++++++++--------- limereport/lrdatasourcemanager.h | 5 +- limereport/lrdatasourcemanagerintf.h | 1 + 4 files changed, 55 insertions(+), 22 deletions(-) diff --git a/include/lrdatasourcemanagerintf.h b/include/lrdatasourcemanagerintf.h index 7ff5aee..85cf388 100644 --- a/include/lrdatasourcemanagerintf.h +++ b/include/lrdatasourcemanagerintf.h @@ -40,6 +40,7 @@ namespace LimeReport{ class IDataSourceManager{ public: virtual void setReportVariable(const QString& name, const QVariant& value)=0; + virtual void setDefaultDatabasePath(const QString &defaultDatabasePath)=0; virtual void deleteVariable(const QString& name)=0; virtual bool containsVariable(const QString& variableName)=0; virtual QVariant variable(const QString& variableName)=0; diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index 1b228ea..b6c25d3 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include namespace LimeReport{ @@ -227,6 +228,16 @@ DataSourceManager::DataSourceManager(QObject *parent) : setSystemVariable(QLatin1String("#PAGE_COUNT"),0,SecondPass); m_datasourcesModel.setDataSourceManager(this); } + +QString DataSourceManager::defaultDatabasePath() const +{ + return m_defaultDatabasePath; +} + +void DataSourceManager::setDefaultDatabasePath(const QString &defaultDatabasePath) +{ + m_defaultDatabasePath = defaultDatabasePath; +} bool DataSourceManager::designTime() const { return m_designTime; @@ -364,7 +375,8 @@ QString DataSourceManager::replaceVariables(QString value){ QString var=rx.cap(0); var.remove("$V{"); var.remove("}"); - if (variableNames().contains(var)){ + + if (variable(var).isValid()){ value.replace(pos,rx.cap(0).length(),variable(var).toString()); } else { value.replace(pos,rx.cap(0).length(),QString(tr("Variable \"%1\" not found!").arg(var))); @@ -670,28 +682,11 @@ bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) dataSourceHolder(datasourceName)->clearErrors(); } - if (!QSqlDatabase::contains(connectionDesc->name())){ - { - QSqlDatabase db = QSqlDatabase::addDatabase(connectionDesc->driver(),connectionDesc->name()); - db.setHostName(replaceVariables(connectionDesc->host())); - db.setUserName(replaceVariables(connectionDesc->userName())); - db.setPassword(replaceVariables(connectionDesc->password())); - db.setDatabaseName(replaceVariables(connectionDesc->databaseName())); - connected=db.open(); - if (!connected) lastError=db.lastError().text(); - } - } else { - connected = QSqlDatabase::database(connectionDesc->name()).isOpen(); - } - if (!connected) { - QSqlDatabase::removeDatabase(connectionDesc->name()); - setLastError(lastError); - return false; - } else { + if (QSqlDatabase::contains(connectionDesc->name())){ foreach(QString datasourceName, dataSourceNames()){ if (isQuery(datasourceName)){ QueryHolder* qh = dynamic_cast(dataSourceHolder(datasourceName)); - if (qh){ + if (qh && qh->connectionName().compare(connectionDesc->name())==0){ qh->invalidate(designTime()?IDataSource::DESIGN_MODE:IDataSource::RENDER_MODE); invalidateChildren(datasourceName); } @@ -705,8 +700,41 @@ bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) } } } - if (designTime()) emit datasourcesChanged(); + + QSqlDatabase::removeDatabase(connectionDesc->name()); } + + QSqlDatabase db = QSqlDatabase::addDatabase(connectionDesc->driver(),connectionDesc->name()); + db.setHostName(replaceVariables(connectionDesc->host())); + db.setUserName(replaceVariables(connectionDesc->userName())); + db.setPassword(replaceVariables(connectionDesc->password())); + QString dbName = replaceVariables(connectionDesc->databaseName()); + if (connectionDesc->driver().compare("QSQLITE")==0){ + if (!defaultDatabasePath().isEmpty()){ + dbName = !QFileInfo(dbName).exists() ? + defaultDatabasePath()+QFileInfo(dbName).fileName() : + dbName; + } + if (QFileInfo(dbName).exists()){ + db.setDatabaseName(dbName); + connected=db.open(); + } else { + lastError = tr("Database \"%1\" not found").arg(dbName); + } + } else { + db.setDatabaseName(dbName); + connected=db.open(); + if (!connected) lastError=db.lastError().text(); + } + + if (designTime()) emit datasourcesChanged(); + + if (!connected) { + QSqlDatabase::removeDatabase(connectionDesc->name()); + setLastError(lastError); + return false; + } + return true; } diff --git a/limereport/lrdatasourcemanager.h b/limereport/lrdatasourcemanager.h index 3e44687..1567ae5 100644 --- a/limereport/lrdatasourcemanager.h +++ b/limereport/lrdatasourcemanager.h @@ -189,6 +189,9 @@ public: QSharedPointer previewSQL(const QString& connectionName, const QString& sqlText, QString masterDatasource=""); void updateDatasourceModel(); bool isNeedUpdateDatasourceModel(){ return m_needUpdate;} + QString defaultDatabasePath() const; + void setDefaultDatabasePath(const QString &defaultDatabasePath); + signals: void loadCollectionFinished(const QString& collectionName); void cleared(); @@ -208,7 +211,6 @@ protected: virtual QObject *elementAt(const QString& collectionName,int index); virtual void collectionLoadFinished(const QString& collectionName); - void setSystemVariable(const QString& name, const QVariant& value, RenderPass pass); void setLastError(const QString& value); void invalidateLinkedDatasources(QString datasourceName); @@ -236,6 +238,7 @@ private: QStringList m_errorsList; bool m_designTime; bool m_needUpdate; + QString m_defaultDatabasePath; }; } diff --git a/limereport/lrdatasourcemanagerintf.h b/limereport/lrdatasourcemanagerintf.h index 7ff5aee..85cf388 100644 --- a/limereport/lrdatasourcemanagerintf.h +++ b/limereport/lrdatasourcemanagerintf.h @@ -40,6 +40,7 @@ namespace LimeReport{ class IDataSourceManager{ public: virtual void setReportVariable(const QString& name, const QVariant& value)=0; + virtual void setDefaultDatabasePath(const QString &defaultDatabasePath)=0; virtual void deleteVariable(const QString& name)=0; virtual bool containsVariable(const QString& variableName)=0; virtual QVariant variable(const QString& variableName)=0; From 33959d38820bb73724b6247c5b14fa8d40750cc8 Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Wed, 16 Nov 2016 01:31:06 +0300 Subject: [PATCH 008/136] Icons have been changed --- limereport/images/addBand1.png | Bin 450 -> 205 bytes limereport/images/addBand2.png | Bin 0 -> 229 bytes limereport/images/delete2.png | Bin 0 -> 460 bytes limereport/images/edit_control_4_24.png | Bin 0 -> 290 bytes limereport/images/hlayuot_4_24.png | Bin 0 -> 210 bytes limereport/items/images/barcode4.png | Bin 0 -> 171 bytes limereport/items/images/barcode5.png | Bin 0 -> 221 bytes limereport/items/images/imageItem4.png | Bin 0 -> 259 bytes limereport/items/images/insert-text_6.png | Bin 409 -> 226 bytes limereport/items/images/shapes7.png | Bin 0 -> 648 bytes limereport/items/items.qrc | 14 +++++++++----- limereport/report.qrc | 12 ++++++++---- 12 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 limereport/images/addBand2.png create mode 100644 limereport/images/delete2.png create mode 100644 limereport/images/edit_control_4_24.png create mode 100644 limereport/images/hlayuot_4_24.png create mode 100644 limereport/items/images/barcode4.png create mode 100644 limereport/items/images/barcode5.png create mode 100644 limereport/items/images/imageItem4.png create mode 100644 limereport/items/images/shapes7.png diff --git a/limereport/images/addBand1.png b/limereport/images/addBand1.png index d83b77efb9ed0a6dc50ab59eaff2a053a6440b8b..d559323d0a60a5d0758e9a4f3487c0ac9ad041f8 100644 GIT binary patch delta 119 zcmX@ae3o&73aes(Pl)Tp5=FUypUFEI7#J8!g8YIR9G=}s196hP-CYzopr04gaX5&!@I delta 365 zcmX@hc!+s|N&ri`qpu?a!^VE@KZ&di3=9g%9znhg3{`3j3=J&|48MRv4KElNN(~qo zUL`OvSj}Ky5HFasE6@fgVG!UG;;LJ+N@1|qNbw8{HfEIBcz8V0CMPrOl2c@s zV0q;T6kMkGvoX;%h?VD=(H%RM_T`0E?wto25@#70xic^iWSDQ3Nk7|v$1*Rc=`e+QG z)c^ng1AZp&04ioI3GxeOaCmkj4a7H=O_6OYjVm$m8n`EtkLbjeRjv*44lM@v9B#f06ni=_A9VFFMRasS4RTWy#9n3Wg zkmFLQ5|9yDyzxb%!?nW>9{ihnHZsac8BbtjnDmOr<8Ov4nJa0`PlBg3pYAU*6Qp1!W^54ico#Kp63_U!RbWQq!>L-TnXk_V#~s z=S(eNTGrRd8aXd`MykCu|7Hd`c1wkgtP&CuA{RsrHX2zO7#MIQ{ZPnTw6b}D(eb)0 zmp8w6+slYQoo{!*fxkiUq@=g*@5r4qc~2O=`F?%Bc$$m6zKdA0WB8F%XLAl5JpaZ) zSKi>^q#wUu+c)d1mIL9#K<^m-(AmH9!Jq&2{~vE@U|r6-|G)8*DF37cAkesxb^O4A z0}Y4%AN$a%cwO{h`r|Z}v+O4PivqdbbR`_c9-KM3MyBV3%$ZXMJ0>kI{OGx6yMBbZm3CJ0StErPgg&ebxsLQ0JUPj ABme*a literal 0 HcmV?d00001 diff --git a/limereport/images/edit_control_4_24.png b/limereport/images/edit_control_4_24.png new file mode 100644 index 0000000000000000000000000000000000000000..1964712e14ae1cce622edb14638d38f94aa0eee4 GIT binary patch literal 290 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjY)RhkE(~!D6B$geFx@c(if|Tq zL>4nJa0`PlBg3pYAU*6Qp1!W^54icogarSek#7SEt@m_s4DmRgoFKu<%qua`vQXIf zfAHZ8u0NMQe70$Uch~E}z?2`Sz3&J7@Hvw8#O{U1v{s)ZQgQL|{?k-_w)8zYn9jKJ zpvxxK4LcOBDQ#-*i0IbnV|H5E-8yB%y7lXidp%~>*-^AeXcA*@Z?DSpgr)@x7e1_a zc0OF6xdS@h(>g$o_S*T?ayr8p!fD>ECuI>Dz^bI^H`>JzDRPHR-B e96Ne}m0_OtRJ%^OQ&m8xGkCiCxvX4nJaD4z_MyE9<_s4MR=LEu4!2T6pHtBaSZV|o}3`T%EF**q@K6v zWqk>2_a}ejB;n)g+co~1+=&q@@hr5}v-tgVX@0@CLwkZXUOiHuDR|}Z0U&UBtsu2E z;Yw2=x0|lS)&?nt#dZ$*=QmFMf8>=Us|zE8@Js29syCni0b0f2>FVdQ&MBb@0LlVI Ah5!Hn literal 0 HcmV?d00001 diff --git a/limereport/items/images/barcode4.png b/limereport/items/images/barcode4.png new file mode 100644 index 0000000000000000000000000000000000000000..635b9776295b6e20e651fe2cfa8e9a0f5ef2672a GIT binary patch literal 171 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjY)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYYs>cdx@v7EBga(enBI~q7Al3fkGCZE{-7{$CDEzSev?s9 z-rL5g7G+&^r74ixO;=)T!<|EYv(k8c1RiQPb?Pp2Klp%=p`=M;TUG9hc|bE5JYD@< J);T3K0RTn6GE4vf literal 0 HcmV?d00001 diff --git a/limereport/items/images/barcode5.png b/limereport/items/images/barcode5.png new file mode 100644 index 0000000000000000000000000000000000000000..5c195c28867b6b448441fd5a87f66f1a06af7c72 GIT binary patch literal 221 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjY)RhkE(~!D6B$geFx@c(if|Tq zL>4nJa0`PlBg3pYAU*6Qp1!W^54icoBup(8gzo}{vOHZJLp+WrCoC{bNJ&UY=$M`H zYra^U{we#jCzu}VoUwKdJ^WaGrlA1{T(s(FTgbX$!(q3_lbx5fR|@n-8Dt%Nu(^RT zEaotS(d>|hJia*j2ij~Mno0$~8loB&@Vf;I@@!b(erEzRL*%c$*OGsq`U13-!PC{x JWt~$(6973cM&tkh literal 0 HcmV?d00001 diff --git a/limereport/items/images/imageItem4.png b/limereport/items/images/imageItem4.png new file mode 100644 index 0000000000000000000000000000000000000000..589cc691ba697da4a478ed56a744f467df390cbb GIT binary patch literal 259 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjY)RhkE(~!D6B$geFx@c(if|Tq zL>4nJaD4z_MyE9<_s4#Uy#^?N&_z3Qh2IaSZV|o}3`@szLBr$Lx$> z^JlT?pRzxD;s6jd>Fh9gFA~brKR<;n-T0zaM?q9T*@4D|ZyK0$bsWrQ1bMTmb?lPi zOGur}98usIkoDof@UP->aylbL#~E87pL;sZ4b> z(big#Y7xf0B2mMSdqu8=TjZBdm(1G&8~7OBEZ1AOXQ}%_pxYQcUHx3vIVCg!0AZnA A8~^|S literal 0 HcmV?d00001 diff --git a/limereport/items/images/insert-text_6.png b/limereport/items/images/insert-text_6.png index 0d68f8e8768dbfc049d43b4bc2dda169b8b38f76..ac5982ddd05c60bba10c7d988bda4034e8200c7a 100644 GIT binary patch delta 182 zcmbQq{D^Uagfs^m0|Uc@a@!w3iY>|8-Gw2JVIqU+6{b6e6L%=o^NUGy+9uh|1j^=n zx;Tb-98XS=c-0_ytYdb@ulcjs^iSEJJ#hdCnsjy;ycY@O>7Sp%mTr8}sv{$hk=yR% zCT2bt$xBZQ8f>^Pm>$+SqGp!hc*JGh_0CY^FTodAuqq#55=#NS%G|oWRD45bDP46hOx7_4S6Fo+k-*%fF5l+X(B32_C|`5UeCmzn2I zQc0U>9J@#_Yn5riMk|ou2CIUN)&)RvllA}q|3k|a7=fyJN`m}?84iiDv2ckWp1tJ7 zLZ2tSxY-fvqHzXCa&1s;*b3=FJ>Ak4V^tp>>P>?NMQuIvxESwt1p(qf-I z1Pa-Ex;TbNTux3nznC}Q!>*kacgk-w)GWI1B0ilpUXO@geCy9eR$RY diff --git a/limereport/items/images/shapes7.png b/limereport/items/images/shapes7.png new file mode 100644 index 0000000000000000000000000000000000000000..a9920f5451c95bc16b54f4ae68df5b601d391253 GIT binary patch literal 648 zcmV;30(bq1P)K*e7pTG$&^`gY0q_JsU!Xm{%_Bsi{ zHr^^7X)|7D_xomNzZnz#XH)R={$RbvuJW%SpSHg%lXJ$~V|UE&ja2Y*>1CGmyebX; z>!e3h;D_usL4dhB%XBb!Re*0G`k4|4@V!a!nGr;R!%{Lp_RWB-jzf+)oc`-D3_S4( zTzg2ZbBo$_%bVw)roEx1eevk?8r)|-$*wek(;v{EQ`1w}lhrI0%DVUL+5LYm&5yX>a_G8oOUn!#7)UW^lB%eK#|gSuHszKy9^m70Q>qfVN`^EY5FsK?_Yw6nJ2BKEY-z z0VJ7O)TF_KRAC*`q&~I~;N43*G5F|m#mQp}&1^az!NN0L3OuxuTW4mpn)n15QdR%g zs}Vzq=q->~4T>nO=A@$*X*IZYtf?X3uTl0qwz$yhSS)M3-`<{s2PzWa__}>$_9J+x z2Q`t@kV;-}i2Y-N5O917zYN{sKH5bR5`goG+x+-$RCrO~f&Kj2`1a~exzletZwK6) za4%|le03ZEnH`rp7Zz&A5N*3Yk~)L0u>TPTK9xSK+YuF7M2kj8MMH#Ikn_m>;si2Z iuoWmRXlQYEC%^y}fe*{3!pVLB0000images/insert-text_5.png images/shape5.png images/imageItem1.png - images/imageItem2.png + images/imageItem2.png images/settings.png images/settings2.png - images/hlayuot_3_24.png + images/hlayuot_3_24.png images/addBand1.png images/DataBand.png images/PageHeader.png @@ -34,8 +34,12 @@ images/GroupHeader16.png images/ReportPage16.png images/insert-text_6.png - images/barcode3.png - images/shape6.png - images/imageItem3.png + images/barcode3.png + images/shape6.png + images/imageItem3.png + images/barcode4.png + images/imageItem4.png + images/shapes7.png + images/barcode5.png diff --git a/limereport/report.qrc b/limereport/report.qrc index 6dfc6fe..0f74519 100644 --- a/limereport/report.qrc +++ b/limereport/report.qrc @@ -121,11 +121,11 @@ images/text_bold1.png images/text_italic1.png images/text_underline1.png - images/edit_control_3_24.png + images/edit_control_3_24.png images/edit_layout_4_24.png - images/hlayuot_3_24.png - images/addBand1.png - images/delete1.png + images/hlayuot_3_24.png + images/addBand1.png + images/delete1.png images/copy2.png images/new_leaf1.png images/paste1.png @@ -170,5 +170,9 @@ images/toolbar.png images/not_checked.png images/checked.png + images/hlayuot_4_24.png + images/delete2.png + images/addBand2.png + images/edit_control_4_24.png From 2fb47a5830d2dc8615f5fb98957015d0a6d5379a Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 17 Nov 2016 00:37:37 +0300 Subject: [PATCH 009/136] Connect connection has been refactored --- limereport/items/items.qrc | 2 +- limereport/lrdatadesignintf.cpp | 10 ++++ limereport/lrdatadesignintf.h | 1 + limereport/lrdatasourcemanager.cpp | 90 ++++++++++++++++++------------ limereport/lrdatasourcemanager.h | 1 + 5 files changed, 67 insertions(+), 37 deletions(-) diff --git a/limereport/items/items.qrc b/limereport/items/items.qrc index aec5e59..07cc670 100644 --- a/limereport/items/items.qrc +++ b/limereport/items/items.qrc @@ -11,7 +11,7 @@ images/insert-text_5.png images/shape5.png images/imageItem1.png - images/imageItem2.png + images/imageItem2.png images/settings.png images/settings2.png images/hlayuot_3_24.png diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index b9a15dd..3b24e66 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -369,6 +369,16 @@ void ConnectionDesc::setName(const QString &value) m_connectionName=value; } +bool ConnectionDesc::isEqual(const QSqlDatabase &db) +{ + return (db.databaseName() == m_databaseName) && + (db.driverName() == m_connectionDriver) && + (db.hostName() == m_connectionHost) && + (db.connectionName() == m_connectionName) && + (db.userName() == m_user) && + (db.password() == m_password); +} + QueryDesc::QueryDesc(QString queryName, QString queryText, QString connection) :m_queryName(queryName), m_queryText(queryText), m_connectionName(connection) {} diff --git a/limereport/lrdatadesignintf.h b/limereport/lrdatadesignintf.h index e53056f..abe26bb 100644 --- a/limereport/lrdatadesignintf.h +++ b/limereport/lrdatadesignintf.h @@ -129,6 +129,7 @@ public: QString password(){return m_password;} void setAutoconnect(bool value){m_autoconnect=value;} bool autoconnect(){return m_autoconnect;} + bool isEqual(const QSqlDatabase& db); signals: void nameChanged(const QString& oldName,const QString& newName); private: diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index b6c25d3..42ec024 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -634,6 +634,7 @@ bool DataSourceManager::checkConnectionDesc(ConnectionDesc *connection) QSqlDatabase::removeDatabase(connection->name()); return true; } + QSqlDatabase::removeDatabase(connection->name()); return false; } @@ -672,8 +673,38 @@ void DataSourceManager::putProxyDesc(ProxyDesc *proxyDesc) } else throw ReportError(tr("datasource with name \"%1\" already exists !").arg(proxyDesc->name())); } +bool DataSourceManager::initAndOpenDB(QSqlDatabase& db, ConnectionDesc& connectionDesc){ + + bool connected = false; + db.setHostName(replaceVariables(connectionDesc.host())); + db.setUserName(replaceVariables(connectionDesc.userName())); + db.setPassword(replaceVariables(connectionDesc.password())); + + QString dbName = replaceVariables(connectionDesc.databaseName()); + if (connectionDesc.driver().compare("QSQLITE")==0){ + if (!defaultDatabasePath().isEmpty()){ + dbName = !QFileInfo(dbName).exists() ? + defaultDatabasePath()+QFileInfo(dbName).fileName() : + dbName; + } + if (QFileInfo(dbName).exists()){ + db.setDatabaseName(dbName); + } else { + setLastError(tr("Database \"%1\" not found").arg(dbName)); + return false; + } + } else { + db.setDatabaseName(dbName); + } + + connected=db.open(); + if (!connected) setLastError(db.lastError().text()); + return connected; +} + bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) { + bool connected = false; clearErrors(); QString lastError =""; @@ -682,11 +713,31 @@ bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) dataSourceHolder(datasourceName)->clearErrors(); } - if (QSqlDatabase::contains(connectionDesc->name())){ + if (!QSqlDatabase::contains(connectionDesc->name())){ + QSqlDatabase db = QSqlDatabase::addDatabase(connectionDesc->driver(),connectionDesc->name()); + connected=initAndOpenDB(db, *connectionDesc); + if (!connected){ + setLastError(db.lastError().text()); + return false; + } + } else { + QSqlDatabase db = QSqlDatabase::database(connectionDesc->name()); + if (!connectionDesc->isEqual(db)){ + db.close(); + connected = initAndOpenDB(db, *connectionDesc); + } else { + connected = db.isOpen(); + } + } + + if (!connected) { + QSqlDatabase::removeDatabase(connectionDesc->name()); + return false; + } else { foreach(QString datasourceName, dataSourceNames()){ if (isQuery(datasourceName)){ QueryHolder* qh = dynamic_cast(dataSourceHolder(datasourceName)); - if (qh && qh->connectionName().compare(connectionDesc->name())==0){ + if (qh){ qh->invalidate(designTime()?IDataSource::DESIGN_MODE:IDataSource::RENDER_MODE); invalidateChildren(datasourceName); } @@ -700,41 +751,8 @@ bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) } } } - - QSqlDatabase::removeDatabase(connectionDesc->name()); + if (designTime()) emit datasourcesChanged(); } - - QSqlDatabase db = QSqlDatabase::addDatabase(connectionDesc->driver(),connectionDesc->name()); - db.setHostName(replaceVariables(connectionDesc->host())); - db.setUserName(replaceVariables(connectionDesc->userName())); - db.setPassword(replaceVariables(connectionDesc->password())); - QString dbName = replaceVariables(connectionDesc->databaseName()); - if (connectionDesc->driver().compare("QSQLITE")==0){ - if (!defaultDatabasePath().isEmpty()){ - dbName = !QFileInfo(dbName).exists() ? - defaultDatabasePath()+QFileInfo(dbName).fileName() : - dbName; - } - if (QFileInfo(dbName).exists()){ - db.setDatabaseName(dbName); - connected=db.open(); - } else { - lastError = tr("Database \"%1\" not found").arg(dbName); - } - } else { - db.setDatabaseName(dbName); - connected=db.open(); - if (!connected) lastError=db.lastError().text(); - } - - if (designTime()) emit datasourcesChanged(); - - if (!connected) { - QSqlDatabase::removeDatabase(connectionDesc->name()); - setLastError(lastError); - return false; - } - return true; } diff --git a/limereport/lrdatasourcemanager.h b/limereport/lrdatasourcemanager.h index 1567ae5..fcf0f99 100644 --- a/limereport/lrdatasourcemanager.h +++ b/limereport/lrdatasourcemanager.h @@ -220,6 +220,7 @@ private slots: void slotQueryTextChanged(const QString& queryName, const QString& queryText); private: explicit DataSourceManager(QObject *parent = 0); + bool initAndOpenDB(QSqlDatabase &db, ConnectionDesc &connectionDesc); Q_DISABLE_COPY(DataSourceManager) private: QList m_connections; From e9b32ec7d737ebb3b371d69a76bdd887931b8f3a Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 17 Nov 2016 00:50:36 +0300 Subject: [PATCH 010/136] Version has been changed --- common.pri | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common.pri b/common.pri index 8eee2c5..2847ef6 100644 --- a/common.pri +++ b/common.pri @@ -55,8 +55,8 @@ OBJECTS_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/obj RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 -LIMEREPORT_VERSION_MINOR = 3 -LIMEREPORT_VERSION_RELEASE = 11 +LIMEREPORT_VERSION_MINOR = 4 +LIMEREPORT_VERSION_RELEASE = 1 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" From 61653c9bb36bb17aae7560827e37da6ed2daba90 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 18 Nov 2016 01:12:23 +0300 Subject: [PATCH 011/136] Calculated condition has been added to group band header --- limereport/bands/lrgroupbands.cpp | 49 ++++++++-- limereport/bands/lrgroupbands.h | 6 ++ limereport/lrbasedesignintf.cpp | 149 ++++++++++++++++++++++++++++- limereport/lrbasedesignintf.h | 10 ++ limereport/lritemdesignintf.cpp | 151 ------------------------------ limereport/lritemdesignintf.h | 13 +-- 6 files changed, 203 insertions(+), 175 deletions(-) diff --git a/limereport/bands/lrgroupbands.cpp b/limereport/bands/lrgroupbands.cpp index 965982b..74b55eb 100644 --- a/limereport/bands/lrgroupbands.cpp +++ b/limereport/bands/lrgroupbands.cpp @@ -31,7 +31,6 @@ #include "lrglobal.h" #include "lrdatasourcemanager.h" - const QString xmlTagHeader = QLatin1String("GroupHeader"); const QString xmlTagFooter = QLatin1String("GroupFooter"); @@ -98,6 +97,8 @@ void GroupBandHeader::startGroup(DataSourceManager* dataManager) if (ds && ds->columnIndexByName(m_groupFiledName)!=-1) m_groupFieldValue=ds->data(m_groupFiledName); } + + if (!m_condition.isEmpty()) m_conditionValue = calcCondition(dataManager); } QColor GroupBandHeader::bandColor() const @@ -114,20 +115,47 @@ QString GroupBandHeader::findDataSourceName(BandDesignIntf* parentBand){ } +QString GroupBandHeader::condition() const +{ + return m_condition; +} + +void GroupBandHeader::setCondition(const QString &condition) +{ + m_condition = condition; +} + +QString GroupBandHeader::calcCondition(DataSourceManager* dataManager){ + QString result = m_condition; + if (!m_condition.isEmpty()){ + result=expandUserVariables(result, FirstPass, NoEscapeSymbols, dataManager); + result=expandScripts(result, dataManager); + result=expandDataFields(result, NoEscapeSymbols, dataManager); + } + return result; +} + bool GroupBandHeader::isNeedToClose(DataSourceManager* dataManager) { if (!m_groupStarted) return false; - if (m_groupFiledName.isNull() || m_groupFiledName.isEmpty()) + if ((m_groupFiledName.isNull() || m_groupFiledName.isEmpty()) && condition().isEmpty()){ dataManager->putError(tr("Group field not found")); - QString datasourceName = findDataSourceName(parentBand()); - if (dataManager->containsDatasource(datasourceName)){ - IDataSource* ds = dataManager->dataSource(datasourceName); - if (ds){ - if (ds->data(m_groupFiledName).isNull() && m_groupFieldValue.isNull()) return false; - return ds->data(m_groupFiledName)!=m_groupFieldValue; - } + return false; + } + + if (!m_condition.isEmpty()){ + return m_conditionValue != calcCondition(dataManager); } else { - dataManager->putError(tr("Datasource \"%1\" not found !!!").arg(datasourceName)); + QString datasourceName = findDataSourceName(parentBand()); + if (dataManager->containsDatasource(datasourceName)){ + IDataSource* ds = dataManager->dataSource(datasourceName); + if (ds){ + if (ds->data(m_groupFiledName).isNull() && m_groupFieldValue.isNull()) return false; + return ds->data(m_groupFiledName)!=m_groupFieldValue; + } + } else { + dataManager->putError(tr("Datasource \"%1\" not found !!!").arg(datasourceName)); + } } return false; @@ -141,6 +169,7 @@ bool GroupBandHeader::isStarted() void GroupBandHeader::closeGroup() { m_groupFieldValue=QVariant(); + m_conditionValue=""; m_groupStarted=false; } diff --git a/limereport/bands/lrgroupbands.h b/limereport/bands/lrgroupbands.h index 9fa3eaa..42285d8 100644 --- a/limereport/bands/lrgroupbands.h +++ b/limereport/bands/lrgroupbands.h @@ -43,6 +43,7 @@ class GroupBandHeader : public BandDesignIntf, public IGroupBand{ Q_PROPERTY(bool startNewPage READ startNewPage WRITE setStartNewPage) Q_PROPERTY(bool resetPageNumber READ resetPageNumber WRITE setResetPageNumber) Q_PROPERTY(bool reprintOnEachPage READ reprintOnEachPage WRITE setReprintOnEachPage) + Q_PROPERTY(QString condition READ condition WRITE setCondition) public: GroupBandHeader(QObject* owner = 0, QGraphicsItem* parent=0); virtual bool isUnique() const; @@ -57,6 +58,8 @@ public: void setResetPageNumber(bool resetPageNumber); bool isHeader() const{return true;} bool isGroupHeader() const {return true;} + QString condition() const; + void setCondition(const QString &condition); private: virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0); void startGroup(DataSourceManager* dataManager); @@ -65,12 +68,15 @@ private: void closeGroup(); int index(); QString findDataSourceName(BandDesignIntf *parentBand); + QString calcCondition(DataSourceManager *dataManager); private: QVariant m_groupFieldValue; QString m_groupFiledName; bool m_groupStarted; //bool m_startNewPage; bool m_resetPageNumber; + QString m_condition; + QString m_conditionValue; }; class GroupBandFooter : public BandDesignIntf{ diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 8b632d5..2f00d93 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -85,9 +85,6 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q m_font = QFont("Arial",10); } initFlags(); - - - //connect(this,SIGNAL(objectNameChanged(QString)),this,SLOT(slotObjectNameChanged(QString))); } QRectF BaseDesignIntf::boundingRect() const @@ -242,6 +239,152 @@ QFont BaseDesignIntf::transformToSceneFont(const QFont& value) const return f; } +QString BaseDesignIntf::escapeSimbols(const QString &value) +{ + QString result = value; + result.replace("\"","\\\""); + result.replace('\n',"\\n"); + return result; +} + +QString BaseDesignIntf::replaceHTMLSymbols(const QString &value) +{ + QString result = value; + result.replace("<","<"); + result.replace(">",">"); + return result; +} + +QString BaseDesignIntf::expandDataFields(QString context, ExpandType expandType, DataSourceManager* dataManager) +{ + QRegExp rx(Const::FIELD_RX); + + if (context.contains(rx)){ + while ((rx.indexIn(context))!=-1){ + QString field=rx.cap(1); + + if (dataManager->containsField(field)) { + QString fieldValue; + m_varValue = dataManager->fieldData(field); + if (expandType == EscapeSymbols) { + if (dataManager->fieldData(field).isNull()) { + fieldValue="\"\""; + } else { + fieldValue = escapeSimbols(m_varValue.toString()); + switch (dataManager->fieldData(field).type()) { + case QVariant::Char: + case QVariant::String: + case QVariant::StringList: + case QVariant::Date: + case QVariant::DateTime: + fieldValue = "\""+fieldValue+"\""; + break; + default: + break; + } + } + } else { + if (expandType == ReplaceHTMLSymbols) + fieldValue = replaceHTMLSymbols(m_varValue.toString()); + else fieldValue = m_varValue.toString(); + } + + context.replace(rx.cap(0),fieldValue); + + } else { + QString error = QString("Field %1 not found in %2 !!! ").arg(field).arg(this->objectName()); + dataManager->putError(error); + if (!reportSettings() || !reportSettings()->suppressAbsentFieldsAndVarsWarnings()) + context.replace(rx.cap(0),error); + else + context.replace(rx.cap(0),""); + } + } + } + + return context; +} + +QString BaseDesignIntf::expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager* dataManager) +{ + QRegExp rx(Const::VARIABLE_RX); + if (context.contains(rx)){ + int pos = 0; + while ((pos = rx.indexIn(context,pos))!=-1){ + QString variable=rx.cap(1); + pos += rx.matchedLength(); + if (dataManager->containsVariable(variable) ){ + try { + if (pass==dataManager->variablePass(variable)){ + m_varValue = dataManager->variable(variable); + switch (expandType){ + case EscapeSymbols: + context.replace(rx.cap(0),escapeSimbols(m_varValue.toString())); + break; + case NoEscapeSymbols: + context.replace(rx.cap(0),m_varValue.toString()); + break; + case ReplaceHTMLSymbols: + context.replace(rx.cap(0),replaceHTMLSymbols(m_varValue.toString())); + break; + } + pos=0; + } + } catch (ReportError e){ + dataManager->putError(e.what()); + if (!reportSettings() || reportSettings()->suppressAbsentFieldsAndVarsWarnings()) + context.replace(rx.cap(0),e.what()); + else + context.replace(rx.cap(0),""); + } + } else { + QString error; + error = tr("Variable %1 not found").arg(variable); + dataManager->putError(error); + if (!reportSettings() || reportSettings()->suppressAbsentFieldsAndVarsWarnings()) + context.replace(rx.cap(0),error); + else + context.replace(rx.cap(0),""); + } + } + } + return context; +} + +QString BaseDesignIntf::expandScripts(QString context, DataSourceManager* dataManager) +{ + QRegExp rx(Const::SCRIPT_RX); + + if (context.contains(rx)){ + ScriptEngineManager::instance().setDataManager(dataManager); + QScriptEngine* se = ScriptEngineManager::instance().scriptEngine(); + + QScriptValue svThis = se->globalObject().property("THIS"); + if (svThis.isValid()){ + se->newQObject(svThis, this); + } else { + svThis = se->newQObject(this); + se->globalObject().setProperty("THIS",svThis); + } + + ScriptExtractor scriptExtractor(context); + if (scriptExtractor.parse()){ + for(int i=0; ievaluate(scriptBody); + if (!se->hasUncaughtException()) { + m_varValue = value.toVariant(); + context.replace(scriptExtractor.scriptAt(i),value.toString()); + } else { + context.replace(scriptExtractor.scriptAt(i),se->uncaughtException().toString()); + } + } + } + } + return context; +} + void BaseDesignIntf::setupPainter(QPainter *painter) const { if (!painter) { diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index f31bf73..cae3d77 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -116,6 +116,7 @@ public: }; enum ObjectState {ObjectLoading, ObjectLoaded, ObjectCreated}; enum ItemAlign {LeftItemAlign,RightItemAlign,CenterItemAlign,ParentWidthItemAlign,DesignedItemAlign}; + enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols}; Q_DECLARE_FLAGS(BorderLines, BorderSide) Q_DECLARE_FLAGS(ItemMode,ItemModes) friend class SelectionMarker; @@ -305,6 +306,15 @@ protected: virtual bool drawDesignBorders() const {return true;} virtual QColor selectionMarkerColor(){ return Const::SELECTION_COLOR;} + + QString escapeSimbols(const QString& value); + QString replaceHTMLSymbols(const QString& value); + virtual QString expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager *dataManager); + virtual QString expandDataFields(QString context, ExpandType expandType, DataSourceManager *dataManager); + virtual QString expandScripts(QString context, DataSourceManager *dataManager); + + QVariant m_varValue; + private: void updateSelectionMarker(); int resizeDirectionFlags(QPointF position); diff --git a/limereport/lritemdesignintf.cpp b/limereport/lritemdesignintf.cpp index db18eb2..5987086 100644 --- a/limereport/lritemdesignintf.cpp +++ b/limereport/lritemdesignintf.cpp @@ -113,157 +113,6 @@ void ItemDesignIntf::initFlags() } } -QString ContentItemDesignIntf::expandDataFields(QString context, ExpandType expandType, DataSourceManager* dataManager) -{ - QRegExp rx(Const::FIELD_RX); - - if (context.contains(rx)){ - while ((rx.indexIn(context))!=-1){ - QString field=rx.cap(1); - - if (dataManager->containsField(field)) { - QString fieldValue; - m_varValue = dataManager->fieldData(field); - if (expandType == EscapeSymbols) { - if (dataManager->fieldData(field).isNull()) { - fieldValue="\"\""; - } else { - fieldValue = escapeSimbols(m_varValue.toString()); - switch (dataManager->fieldData(field).type()) { - case QVariant::Char: - case QVariant::String: - case QVariant::StringList: - case QVariant::Date: - case QVariant::DateTime: - fieldValue = "\""+fieldValue+"\""; - break; - default: - break; - } - } - } else { - if (expandType == ReplaceHTMLSymbols) - fieldValue = replaceHTMLSymbols(m_varValue.toString()); - else fieldValue = m_varValue.toString(); - } - - context.replace(rx.cap(0),fieldValue); - - } else { - QString error = QString("Field %1 not found in %2 !!! ").arg(field).arg(this->objectName()); - dataManager->putError(error); - if (!reportSettings() || !reportSettings()->suppressAbsentFieldsAndVarsWarnings()) - context.replace(rx.cap(0),error); - else - context.replace(rx.cap(0),""); - } - } - } - - return context; -} - -QString ContentItemDesignIntf::expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager* dataManager) -{ - QRegExp rx(Const::VARIABLE_RX); - if (context.contains(rx)){ - int pos = 0; - while ((pos = rx.indexIn(context,pos))!=-1){ - QString variable=rx.cap(1); - pos += rx.matchedLength(); - if (dataManager->containsVariable(variable) ){ - try { - if (pass==dataManager->variablePass(variable)){ - m_varValue = dataManager->variable(variable); - switch (expandType){ - case EscapeSymbols: - context.replace(rx.cap(0),escapeSimbols(m_varValue.toString())); - break; - case NoEscapeSymbols: - context.replace(rx.cap(0),m_varValue.toString()); - break; - case ReplaceHTMLSymbols: - context.replace(rx.cap(0),replaceHTMLSymbols(m_varValue.toString())); - break; - } - pos=0; - } - } catch (ReportError e){ - dataManager->putError(e.what()); - if (!reportSettings() || reportSettings()->suppressAbsentFieldsAndVarsWarnings()) - context.replace(rx.cap(0),e.what()); - else - context.replace(rx.cap(0),""); - } - } else { - QString error; - error = tr("Variable %1 not found").arg(variable); - dataManager->putError(error); - if (!reportSettings() || reportSettings()->suppressAbsentFieldsAndVarsWarnings()) - context.replace(rx.cap(0),error); - else - context.replace(rx.cap(0),""); - } - } - } - return context; -} - -QString ContentItemDesignIntf::expandScripts(QString context, DataSourceManager* dataManager) -{ - QRegExp rx(Const::SCRIPT_RX); - - if (context.contains(rx)){ - ScriptEngineManager::instance().setDataManager(dataManager); - QScriptEngine* se = ScriptEngineManager::instance().scriptEngine(); - - QScriptValue svThis = se->globalObject().property("THIS"); - if (svThis.isValid()){ - se->newQObject(svThis, this); - } else { - svThis = se->newQObject(this); - se->globalObject().setProperty("THIS",svThis); - } - - ScriptExtractor scriptExtractor(context); - if (scriptExtractor.parse()){ - for(int i=0; ievaluate(scriptBody); - if (!se->hasUncaughtException()) { - m_varValue = value.toVariant(); - context.replace(scriptExtractor.scriptAt(i),value.toString()); - } else { - context.replace(scriptExtractor.scriptAt(i),se->uncaughtException().toString()); - } - } - } - } - return context; -} - -QString ContentItemDesignIntf::content() const -{ - return ""; -} - -QString ContentItemDesignIntf::escapeSimbols(const QString &value) -{ - QString result = value; - result.replace("\"","\\\""); - result.replace('\n',"\\n"); - return result; -} - -QString ContentItemDesignIntf::replaceHTMLSymbols(const QString &value) -{ - QString result = value; - result.replace("<","<"); - result.replace(">",">"); - return result; -} - Spacer::Spacer(QObject *owner, QGraphicsItem *parent) :ItemDesignIntf("Spacer",owner,parent){} diff --git a/limereport/lritemdesignintf.h b/limereport/lritemdesignintf.h index e6f6170..a9c8d7a 100644 --- a/limereport/lritemdesignintf.h +++ b/limereport/lritemdesignintf.h @@ -73,17 +73,8 @@ class ContentItemDesignIntf : public ItemDesignIntf public: ContentItemDesignIntf(const QString& xmlTypeName, QObject* owner = 0,QGraphicsItem* parent = 0) :ItemDesignIntf(xmlTypeName,owner,parent){} - virtual QString content() const; - virtual void setContent(const QString& value)=0; - enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols}; -protected: - QString escapeSimbols(const QString& value); - QString replaceHTMLSymbols(const QString& value); - virtual QString expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager *dataManager); - virtual QString expandDataFields(QString context, ExpandType expandType, DataSourceManager *dataManager); - virtual QString expandScripts(QString context, DataSourceManager *dataManager); - - QVariant m_varValue; + virtual QString content() const = 0; + virtual void setContent(const QString& value) = 0; }; class LayoutDesignIntf : public ItemDesignIntf{ From b4dea2fcfdfb335b30e12eb0be086aa02e4d7764 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 18 Nov 2016 01:14:01 +0300 Subject: [PATCH 012/136] New demo reports have been added --- demo_r1/demo_reports/simple_group.lrxml | 624 ++++++++++++++++++++++++ demo_r1/demo_reports/simple_list.lrxml | 511 +++++++++++++++++++ 2 files changed, 1135 insertions(+) create mode 100644 demo_r1/demo_reports/simple_group.lrxml create mode 100644 demo_r1/demo_reports/simple_list.lrxml diff --git a/demo_r1/demo_reports/simple_group.lrxml b/demo_r1/demo_reports/simple_group.lrxml new file mode 100644 index 0000000..3cb4b68 --- /dev/null +++ b/demo_r1/demo_reports/simple_group.lrxml @@ -0,0 +1,624 @@ + + + + + + + page1 + + + + + + + + ReportPage1 + + + + DataBand1 + + + + TextItem1 + + + + + DataBand1 + + + + + + + $D{customers.CompanyName} + + + + + + + + + + + + + + + + + + + + + + + TextItem5 + + + + + DataBand1 + + + + + + + $D{customers.Address} + + + + + + + + + + + + + + + + + + + + + + + TextItem6 + + + + + DataBand1 + + + + + + + $D{customers.Phone} + + + + + + + + + + + + + + + + + + + + + + + TextItem7 + + + + + DataBand1 + + + + + + + $D{customers.Fax} + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + + + + customers + + + + + + + + + + + + DataHeaderBand1 + + + + TextItem2 + + + + + DataHeaderBand1 + + + + + + + Company + + + + + + + + + + + + + + + + + + + + + + + TextItem4 + + + + + DataHeaderBand1 + + + + + + + Address + + + + + + + + + + + + + + + + + + + + + + + TextItem8 + + + + + DataHeaderBand1 + + + + + + + Phone + + + + + + + + + + + + + + + + + + + + + + + TextItem9 + + + + + DataHeaderBand1 + + + + + + + Fax + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + DataBand1 + + + + + + + + + + ReportHeader2 + + + + TextItem3 + + + + + ReportHeader2 + + + + + + + Customers + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + + + + + + + PageFooter9 + + + + TextItem10 + + + + + PageFooter9 + + + + + + + Page $V{#PAGE} of $V{#PAGE_COUNT} + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + + + + + + + + GroupBandHeader1 + + + + TextItem11 + + + + + GroupBandHeader1 + + + + + + + $S{$D{customers.CompanyName}.substring(0,1).toUpperCase();} + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + DataBand1 + + + + + + + + + $S{$D{customers.CompanyName}.substring(0,1).toUpperCase();} + + + GroupBandFooter11 + + + + TextItem12 + + + + + GroupBandFooter11 + + + + + + + Count: $S{COUNT($D{customers.CompanyName},"DataBand1")} + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + GroupBandHeader1 + + + + + + + + + + + + + + + + + + + + + + + + + datasources + + + + northwind.db + QSQLITE + D:/Work/C_Projects/LimeReportGitHub/build/5.6.1/win32/release/demo_r1/demo_reports/northwind.db + + + + + + + + + + customers + Select * from customers + northwind.db + + + + + + + + + + + + + + diff --git a/demo_r1/demo_reports/simple_list.lrxml b/demo_r1/demo_reports/simple_list.lrxml new file mode 100644 index 0000000..1ed49dd --- /dev/null +++ b/demo_r1/demo_reports/simple_list.lrxml @@ -0,0 +1,511 @@ + + + + + + + page1 + + + + + + + + ReportPage1 + + + + DataBand1 + + + + TextItem1 + + + + + DataBand1 + + + + + + + $D{customers.CompanyName} + + + + + + + + + + + + + + + + + + + + + + + TextItem5 + + + + + DataBand1 + + + + + + + $D{customers.Address} + + + + + + + + + + + + + + + + + + + + + + + TextItem6 + + + + + DataBand1 + + + + + + + $D{customers.Phone} + + + + + + + + + + + + + + + + + + + + + + + TextItem7 + + + + + DataBand1 + + + + + + + $D{customers.Fax} + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + + + + customers + + + + + + + + + + + + DataHeaderBand1 + + + + TextItem2 + + + + + DataHeaderBand1 + + + + + + + Company + + + + + + + + + + + + + + + + + + + + + + + TextItem4 + + + + + DataHeaderBand1 + + + + + + + Address + + + + + + + + + + + + + + + + + + + + + + + TextItem8 + + + + + DataHeaderBand1 + + + + + + + Phone + + + + + + + + + + + + + + + + + + + + + + + TextItem9 + + + + + DataHeaderBand1 + + + + + + + Fax + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + DataBand1 + + + + + + + + + + ReportHeader2 + + + + TextItem3 + + + + + ReportHeader2 + + + + + + + Customers + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + + + + + + + PageFooter9 + + + + TextItem10 + + + + + PageFooter9 + + + + + + + Page $V{#PAGE} of $V{#PAGE_COUNT} + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + datasources + + + + northwind.db + QSQLITE + D:/Work/C_Projects/LimeReportGitHub/build/5.6.1/win32/release/demo_r1/demo_reports/northwind.db + + + + + + + + + + customers + Select * from customers + northwind.db + + + + + + + + + + + + + + From dc5ee3d98bf3949990dd7fecea956e2403772f26 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 25 Nov 2016 23:54:23 +0300 Subject: [PATCH 013/136] Debug messages have been removed --- limereport/items/lrtextitem.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 041a737..d3d658b 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -700,8 +700,7 @@ QString TextItem::getTextPart(int height, int skipHeight){ } linesHeight = 0; - qDebug()<end()); + for (;curBlock!=m_text->end() || curLinelineCount();curLine++){ if (resultText=="") textPos= curBlock.layout()->lineAt(curLine).textStart(); From 21e3a6fbf97a290177e9541a41e42ddf9c8d93d3 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 26 Nov 2016 00:50:30 +0300 Subject: [PATCH 014/136] Release version has been changed --- common.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.pri b/common.pri index c15fe14..c44c200 100644 --- a/common.pri +++ b/common.pri @@ -48,7 +48,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 3 -LIMEREPORT_VERSION_RELEASE = 11 +LIMEREPORT_VERSION_RELEASE = 12 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" From 229e8f529d7488c4a499dcf4877a620036af0fac Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 5 Dec 2016 22:58:52 +0300 Subject: [PATCH 015/136] resourcePath property has been added to ImageItem --- limereport/items/lrimageitem.cpp | 30 ++++++++++++++++++++---------- limereport/items/lrimageitem.h | 8 +++++--- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/limereport/items/lrimageitem.cpp b/limereport/items/lrimageitem.cpp index a8e255e..38e4441 100644 --- a/limereport/items/lrimageitem.cpp +++ b/limereport/items/lrimageitem.cpp @@ -56,16 +56,21 @@ BaseDesignIntf *ImageItem::createSameTypeItem(QObject *owner, QGraphicsItem *par void ImageItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight) { - if (!m_datasource.isEmpty() && !m_field.isEmpty() && m_picture.isNull()){ - IDataSource* ds = dataManager->dataSource(m_datasource); - if (ds) { - QVariant data = ds->data(m_field); - if (data.isValid()){ - if (data.type()==QVariant::Image){ - m_picture = data.value(); - } else - m_picture.loadFromData(data.toByteArray()); - } + + if (m_picture.isNull()){ + if (!m_datasource.isEmpty() && !m_field.isEmpty()){ + IDataSource* ds = dataManager->dataSource(m_datasource); + if (ds) { + QVariant data = ds->data(m_field); + if (data.isValid()){ + if (data.type()==QVariant::Image){ + m_picture = data.value(); + } else + m_picture.loadFromData(data.toByteArray()); + } + } + } else if (!m_resourcePath.isEmpty()){ + m_picture = QImage(m_resourcePath); } } if (m_autoSize){ @@ -80,6 +85,11 @@ bool ImageItem::isNeedUpdateSize(RenderPass) const return m_picture.isNull() || m_autoSize; } +QString ImageItem::resourcePath() const +{ + return m_resourcePath; +} + qreal ImageItem::minHeight() const{ if (!m_picture.isNull() && autoSize()) { diff --git a/limereport/items/lrimageitem.h b/limereport/items/lrimageitem.h index 4e3fa23..631f292 100644 --- a/limereport/items/lrimageitem.h +++ b/limereport/items/lrimageitem.h @@ -44,12 +44,14 @@ class ImageItem : public LimeReport::ItemDesignIntf 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: ImageItem(QObject *owner, QGraphicsItem *parent); virtual void paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget); void setImage(QImage value); QImage image(){return m_picture;} - void setContent(const QString &value){m_content=value;} + void setResourcePath(const QString &value){m_resourcePath=value;} + QString resourcePath() const; QString datasource() const; void setDatasource(const QString &datasource); QString field() const; @@ -72,8 +74,8 @@ protected: bool isNeedUpdateSize(RenderPass) const; bool drawDesignBorders() const {return m_picture.isNull();} private: - QImage m_picture; - QString m_content; + QImage m_picture; + QString m_resourcePath; QString m_datasource; QString m_field; bool m_autoSize; From 54562d80cda143e58c243842d1099fc5a6762642 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 5 Dec 2016 23:00:32 +0300 Subject: [PATCH 016/136] checkIfEmpty has been refactored --- limereport/lrdatadesignintf.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index 3b24e66..f20f891 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -736,11 +736,15 @@ bool CallbackDatasource::checkIfEmpty(){ if (m_rowCount == 0) { return true; } else { - QVariant result = true; + QVariant isEmpty = true; + QVariant recordCount = 0; CallbackInfo info; + info.dataType = CallbackInfo::RowCount; + emit getCallbackData(info, recordCount); + if (recordCount.toInt()>0) return false; info.dataType = CallbackInfo::IsEmpty; - emit getCallbackData(info,result); - return result.toBool(); + emit getCallbackData(info,isEmpty); + return isEmpty.toBool(); } } From bca10198039e7549ae8b78076f3f4422a7705b6e Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 6 Dec 2016 00:16:50 +0300 Subject: [PATCH 017/136] Path to database has been fixed --- demo_r1/demo_reports/simple_group.lrxml | 118 +++++++++++++----------- demo_r1/demo_reports/simple_list.lrxml | 96 ++++++++++--------- 2 files changed, 118 insertions(+), 96 deletions(-) diff --git a/demo_r1/demo_reports/simple_group.lrxml b/demo_r1/demo_reports/simple_group.lrxml index 3cb4b68..e41daf7 100644 --- a/demo_r1/demo_reports/simple_group.lrxml +++ b/demo_r1/demo_reports/simple_group.lrxml @@ -5,28 +5,28 @@ page1 - + - + ReportPage1 - + DataBand1 - + TextItem1 - + DataBand1 - + @@ -37,7 +37,7 @@ - + @@ -53,15 +53,16 @@ + TextItem5 - + DataBand1 - + @@ -72,7 +73,7 @@ - + @@ -88,15 +89,16 @@ + TextItem6 - + DataBand1 - + @@ -107,7 +109,7 @@ - + @@ -123,15 +125,16 @@ + TextItem7 - + DataBand1 - + @@ -142,7 +145,7 @@ - + @@ -158,12 +161,13 @@ + ReportPage1 - + @@ -185,16 +189,16 @@ DataHeaderBand1 - + TextItem2 - + DataHeaderBand1 - + @@ -205,7 +209,7 @@ - + @@ -221,15 +225,16 @@ + TextItem4 - + DataHeaderBand1 - + @@ -240,7 +245,7 @@ - + @@ -256,15 +261,16 @@ + TextItem8 - + DataHeaderBand1 - + @@ -275,7 +281,7 @@ - + @@ -291,15 +297,16 @@ + TextItem9 - + DataHeaderBand1 - + @@ -310,7 +317,7 @@ - + @@ -326,12 +333,13 @@ + ReportPage1 - + @@ -348,16 +356,16 @@ ReportHeader2 - + TextItem3 - + ReportHeader2 - + @@ -368,7 +376,7 @@ - + @@ -384,12 +392,13 @@ + ReportPage1 - + @@ -402,16 +411,16 @@ PageFooter9 - + TextItem10 - + PageFooter9 - + @@ -422,7 +431,7 @@ - + @@ -438,12 +447,13 @@ + ReportPage1 - + @@ -457,16 +467,16 @@ GroupBandHeader1 - + TextItem11 - + GroupBandHeader1 - + @@ -477,7 +487,7 @@ - + @@ -493,12 +503,13 @@ + ReportPage1 - + @@ -517,16 +528,16 @@ GroupBandFooter11 - + TextItem12 - + GroupBandFooter11 - + @@ -537,7 +548,7 @@ - + @@ -553,12 +564,13 @@ + ReportPage1 - + @@ -572,7 +584,7 @@ - + @@ -595,7 +607,7 @@ northwind.db QSQLITE - D:/Work/C_Projects/LimeReportGitHub/build/5.6.1/win32/release/demo_r1/demo_reports/northwind.db + ./demo_reports/northwind.db diff --git a/demo_r1/demo_reports/simple_list.lrxml b/demo_r1/demo_reports/simple_list.lrxml index 1ed49dd..8cdc401 100644 --- a/demo_r1/demo_reports/simple_list.lrxml +++ b/demo_r1/demo_reports/simple_list.lrxml @@ -5,28 +5,28 @@ page1 - + - + ReportPage1 - + DataBand1 - + TextItem1 - + DataBand1 - + @@ -37,7 +37,7 @@ - + @@ -53,15 +53,16 @@ + TextItem5 - + DataBand1 - + @@ -72,7 +73,7 @@ - + @@ -88,15 +89,16 @@ + TextItem6 - + DataBand1 - + @@ -107,7 +109,7 @@ - + @@ -123,15 +125,16 @@ + TextItem7 - + DataBand1 - + @@ -142,7 +145,7 @@ - + @@ -158,12 +161,13 @@ + ReportPage1 - + @@ -185,16 +189,16 @@ DataHeaderBand1 - + TextItem2 - + DataHeaderBand1 - + @@ -205,7 +209,7 @@ - + @@ -221,15 +225,16 @@ + TextItem4 - + DataHeaderBand1 - + @@ -240,7 +245,7 @@ - + @@ -256,15 +261,16 @@ + TextItem8 - + DataHeaderBand1 - + @@ -275,7 +281,7 @@ - + @@ -291,15 +297,16 @@ + TextItem9 - + DataHeaderBand1 - + @@ -310,7 +317,7 @@ - + @@ -326,12 +333,13 @@ + ReportPage1 - + @@ -348,16 +356,16 @@ ReportHeader2 - + TextItem3 - + ReportHeader2 - + @@ -368,7 +376,7 @@ - + @@ -384,12 +392,13 @@ + ReportPage1 - + @@ -402,16 +411,16 @@ PageFooter9 - + TextItem10 - + PageFooter9 - + @@ -422,7 +431,7 @@ - + @@ -438,12 +447,13 @@ + ReportPage1 - + @@ -459,7 +469,7 @@ - + @@ -482,7 +492,7 @@ northwind.db QSQLITE - D:/Work/C_Projects/LimeReportGitHub/build/5.6.1/win32/release/demo_r1/demo_reports/northwind.db + ./demo_reports/northwind.db From 6d31f205667bba6cbaa6ca6cb0599aec321018af Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 6 Dec 2016 00:17:39 +0300 Subject: [PATCH 018/136] OneSlotDS has been added to demo_r1 --- demo_r1/mainwindow.cpp | 35 +++++++++++++++++++++++++++++++++-- demo_r1/mainwindow.h | 1 + 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/demo_r1/mainwindow.cpp b/demo_r1/mainwindow.cpp index b5afab8..bc96811 100644 --- a/demo_r1/mainwindow.cpp +++ b/demo_r1/mainwindow.cpp @@ -76,14 +76,16 @@ MainWindow::MainWindow(QWidget *parent) : this, SLOT(slotGetCallbackData(LimeReport::CallbackInfo,QVariant&))); connect(callbackDatasource, SIGNAL(changePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)), this, SLOT(slotChangePos(const LimeReport::CallbackInfo::ChangePosType&,bool&))); - //report->dataManager()->addCallbackDatasource(callbackDatasource,"master"); callbackDatasource = report->dataManager()->createCallbackDatasouce("detail"); connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)), this, SLOT(slotGetCallbackChildData(LimeReport::CallbackInfo,QVariant&))); connect(callbackDatasource, SIGNAL(changePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)), this, SLOT(slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosType&,bool&))); - //report->dataManager()->addCallbackDatasource(callbackDatasource,"detail"); + + callbackDatasource = report->dataManager()->createCallbackDatasouce("oneSlotDS"); + connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)), + this, SLOT(slotOneSlotDS(LimeReport::CallbackInfo,QVariant&))); QStringList simpleData; simpleData << "value1" << "value2" << "value3"; @@ -208,3 +210,32 @@ void MainWindow::slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosTyp if (type == LimeReport::CallbackInfo::First) result = ds->first(); else result = ds->next(); } + +void MainWindow::slotOneSlotDS(LimeReport::CallbackInfo info, QVariant &data) +{ + QStringList columns; + columns << "Name" << "Value" << "Image"; + switch (info.dataType) { + case LimeReport::CallbackInfo::RowCount: + data = 4; + break; + case LimeReport::CallbackInfo::ColumnCount: + data = columns.size(); + break; +// case LimeReport::CallbackInfo::IsEmpty: +// data = false; +// break; + case LimeReport::CallbackInfo::ColumnHeaderData: { + data = columns.at(info.index); + break; + } + case LimeReport::CallbackInfo::ColumnData: + if (info.columnName == "Image") + data = QImage(":/report//images/logo32"); + else { + data = info.columnName+" "+QString::number(info.index); + } + break; + default: break; + } +} diff --git a/demo_r1/mainwindow.h b/demo_r1/mainwindow.h index e5bbd32..e8d7ff1 100644 --- a/demo_r1/mainwindow.h +++ b/demo_r1/mainwindow.h @@ -57,6 +57,7 @@ private slots: void slotChangePos(const LimeReport::CallbackInfo::ChangePosType& type, bool& result); void slotGetCallbackChildData(LimeReport::CallbackInfo info, QVariant& data); void slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosType& type, bool& result); + void slotOneSlotDS(LimeReport::CallbackInfo info, QVariant& data); private: void prepareData(QSqlQuery* ds, LimeReport::CallbackInfo info, QVariant &data); private: From 114e69054104d1d692701bf335a849978e46d879 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 6 Dec 2016 01:08:30 +0300 Subject: [PATCH 019/136] travis build: ppa:beineri/opt-qt561-trusty --> ppa:beineri/opt-qt562-trusty --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b89e1f8..dadebf9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ env: - QT_BASE=56 before_install: - - if [ "$QT_BASE" = "56" ]; then sudo add-apt-repository ppa:beineri/opt-qt561-trusty -y; fi + - if [ "$QT_BASE" = "56" ]; then sudo add-apt-repository ppa:beineri/opt-qt562-trusty -y; fi - sudo apt-get update -qq install: From 80fa86a3ca1cc62143f4d27fd44c590f74bb4985 Mon Sep 17 00:00:00 2001 From: lchauvinQt Date: Tue, 6 Dec 2016 16:28:28 +0100 Subject: [PATCH 020/136] Fix random crash while scrolling into the viewer, avoid the index out of range when the " m_currentPage " is not valid --- limereport/lrpreviewreportwidget.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/limereport/lrpreviewreportwidget.cpp b/limereport/lrpreviewreportwidget.cpp index b405710..d614193 100644 --- a/limereport/lrpreviewreportwidget.cpp +++ b/limereport/lrpreviewreportwidget.cpp @@ -16,6 +16,8 @@ namespace LimeReport { bool PreviewReportWidgetPrivate::pageIsVisible(){ QGraphicsView* view = q_ptr->ui->graphicsView; + if ( m_currentPage-1 >= m_reportPages.size() || m_currentPage <= 0 ) + return false; PageItemDesignIntf::Ptr page = m_reportPages.at(m_currentPage-1); return page->mapToScene(page->rect()).boundingRect().intersects( view->mapToScene(view->viewport()->geometry()).boundingRect() From a73bc9041751546155713332debcd8b88f279b87 Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Wed, 7 Dec 2016 20:35:56 +0300 Subject: [PATCH 021/136] travis build: ppa:beineri/opt-qt561-trusty --> ppa:beineri/opt-qt562-trusty --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b89e1f8..dadebf9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ env: - QT_BASE=56 before_install: - - if [ "$QT_BASE" = "56" ]; then sudo add-apt-repository ppa:beineri/opt-qt561-trusty -y; fi + - if [ "$QT_BASE" = "56" ]; then sudo add-apt-repository ppa:beineri/opt-qt562-trusty -y; fi - sudo apt-get update -qq install: From 32bf7765ec0256d2c2893b4080c61165d813eb99 Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Wed, 7 Dec 2016 23:04:15 +0300 Subject: [PATCH 022/136] Render empty data band has been fixed --- limereport/items/lrtextitem.h | 2 +- limereport/lrreportrender.cpp | 99 +++++++++++++++++++++-------------- limereport/lrreportrender.h | 2 +- 3 files changed, 62 insertions(+), 41 deletions(-) diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index bda15d8..27b78f7 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -101,7 +101,7 @@ public: bool canBeSplitted(int height) const; bool isSplittable() const { return true;} - bool isEmpty() const{return m_text->isEmpty();} + bool isEmpty() const{return m_strText.trimmed().isEmpty() /*m_text->isEmpty()*/;} BaseDesignIntf* cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent); BaseDesignIntf* cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent); BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0); diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 3d39635..64c02d3 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -227,7 +227,7 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) clearPageMap(); startNewPage(); - renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader),StartNewPageAsNeeded); + renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader), 0, StartNewPageAsNeeded); BandDesignIntf* lastRenderedBand = 0; for (int i=0;idataBandCount() && !m_renderCanceled;i++){ @@ -238,13 +238,13 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) } if (reportFooter) - renderBand(reportFooter,StartNewPageAsNeeded); + renderBand(reportFooter, 0, StartNewPageAsNeeded); if (lastRenderedBand && lastRenderedBand->keepFooterTogether()) closeFooterGroup(lastRenderedBand); BandDesignIntf* tearOffBand = m_patternPageItem->bandByType(BandDesignIntf::TearOffBand); if (tearOffBand) - renderBand(tearOffBand,StartNewPageAsNeeded); + renderBand(tearOffBand, 0, StartNewPageAsNeeded); savePage(true); @@ -359,7 +359,7 @@ void ReportRender::replaceGroupsFunction(BandDesignIntf *band) } } -void ReportRender::renderBand(BandDesignIntf *patternBand, ReportRender::DataRenderMode mode, bool isLast) +BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesignIntf* bandData, ReportRender::DataRenderMode mode, bool isLast) { QApplication::processEvents(); if (patternBand){ @@ -372,7 +372,14 @@ void ReportRender::renderBand(BandDesignIntf *patternBand, ReportRender::DataRen if (patternBand->isFooter()) m_lastRenderedFooter = patternBand; - BandDesignIntf* bandClone=renderData(patternBand); + BandDesignIntf* bandClone = 0; + + if (bandData){ + bandClone = bandData; + } else { + bandClone=renderData(patternBand); + } + bandClone->setBackgroundColor( (datasources()->variable(QLatin1String("line_")+patternBand->objectName().toLower()).toInt()%2!=0 ? patternBand->backgroundColor(): @@ -424,10 +431,16 @@ void ReportRender::renderBand(BandDesignIntf *patternBand, ReportRender::DataRen } } } - } else {delete bandClone;} + } else { + delete bandClone; + return 0; + } + if (patternBand->isFooter()) datasources()->clearGroupFunctionValues(patternBand->objectName()); + return bandClone; } + return 0; } void ReportRender::renderDataBand(BandDesignIntf *dataBand) @@ -440,7 +453,7 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) BandDesignIntf* header = dataBand->bandHeader(); BandDesignIntf* footer = dataBand->bandFooter(); - if (header && header->printAlways()) renderBand(header); + if (header && header->printAlways()) renderBand(header, 0); if(bandDatasource && !bandDatasource->eof() && !m_renderCanceled){ @@ -448,7 +461,7 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) datasources()->setReportVariable(varName,1); if (header && !header->printAlways()) - renderBand(header); + renderBand(header, 0); if (dataBand->bandHeader() && dataBand->bandHeader()->reprintOnEachPage()) m_reprintableBands.append(dataBand->bandHeader()); @@ -458,28 +471,35 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) bool firstTime = true; + while(!bandDatasource->eof() && !m_renderCanceled){ - if ((firstTime && dataBand->startFromNewPage()) || - (!firstTime && dataBand->startNewPage())) { - savePage(); - startNewPage(); + BandDesignIntf* rawData = renderData(dataBand); + + if (!rawData->isEmpty() || dataBand->printIfEmpty()){ + + if ((firstTime && dataBand->startFromNewPage()) || + (!firstTime && dataBand->startNewPage())) { + savePage(); + startNewPage(); + } + + if (dataBand->tryToKeepTogether()) openDataGroup(dataBand); + + if (dataBand->keepFooterTogether() && !bandDatasource->hasNext()) + openFooterGroup(dataBand); + + datasources()->updateChildrenData(dataBand->datasourceName()); + m_lastDataBand = dataBand; + + if (header && !firstTime && header->repeatOnEachRow()) + renderBand(header, 0, StartNewPageAsNeeded); + + if (renderBand(dataBand, rawData, StartNewPageAsNeeded, !bandDatasource->hasNext()) ) + renderChildBands(dataBand); + } - if (dataBand->tryToKeepTogether()) openDataGroup(dataBand); - - if (dataBand->keepFooterTogether() && !bandDatasource->hasNext()) - openFooterGroup(dataBand); - - datasources()->updateChildrenData(dataBand->datasourceName()); - m_lastDataBand = dataBand; - - if (header && !firstTime && header->repeatOnEachRow()) - renderBand(header,StartNewPageAsNeeded); - - renderBand(dataBand,StartNewPageAsNeeded,!bandDatasource->hasNext()); - renderChildBands(dataBand); - bandDatasource->next(); datasources()->setReportVariable(varName,datasources()->variable(varName).toInt()+1); @@ -499,16 +519,16 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) renderGroupFooter(dataBand); if (footer && !footer->printAlways()) - renderBand(footer,StartNewPageAsNeeded); + renderBand(footer, 0, StartNewPageAsNeeded); datasources()->deleteVariable(varName); } else if (bandDatasource==0) { - renderBand(dataBand,StartNewPageAsNeeded); + renderBand(dataBand, 0, StartNewPageAsNeeded); } if (footer && footer->printAlways()) - renderBand(footer,StartNewPageAsNeeded); + renderBand(footer, 0, StartNewPageAsNeeded); } void ReportRender::renderPageHeader(PageItemDesignIntf *patternPage) @@ -518,7 +538,7 @@ void ReportRender::renderPageHeader(PageItemDesignIntf *patternPage) if (m_datasources->variable("#PAGE").toInt()!=1 || band->property("printOnFirstPage").toBool() ) - renderBand(band); + renderBand(band, 0); } } @@ -576,7 +596,7 @@ void ReportRender::renderChildHeader(BandDesignIntf *parent, BandPrintMode print if (band->metaObject()->indexOfProperty("printAlways")>0){ printAlways=band->property("printAlways").toBool(); } - if (printAlways == (printMode==PrintAlwaysPrintable) ) renderBand(band,StartNewPageAsNeeded); + if (printAlways == (printMode==PrintAlwaysPrintable) ) renderBand(band, 0, StartNewPageAsNeeded); } } @@ -589,7 +609,7 @@ void ReportRender::renderChildFooter(BandDesignIntf *parent, BandPrintMode print } if ( (band != m_lastRenderedFooter) && (printAlways == (printMode == PrintAlwaysPrintable)) ) - renderBand(band,StartNewPageAsNeeded); + renderBand(band, 0, StartNewPageAsNeeded); } } @@ -614,13 +634,13 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da dataSource->prior(); foreach (BandDesignIntf* subBand, band->childrenByType(BandDesignIntf::GroupHeader)) { foreach(BandDesignIntf* footer, subBand->childrenByType(BandDesignIntf::GroupFooter)){ - renderBand(footer); + renderBand(footer, 0); closeDataGroup(subBand); } } foreach (BandDesignIntf* footer, band->childrenByType(BandDesignIntf::GroupFooter)) { - renderBand(footer,StartNewPageAsNeeded); + renderBand(footer, 0, StartNewPageAsNeeded); } dataSource->next(); @@ -639,9 +659,9 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da openDataGroup(band); if (!firstTime && gb->startNewPage()){ if (gb->resetPageNumber()) resetPageNumber(BandReset); - renderBand(band,ForcedStartPage); + renderBand(band, 0, ForcedStartPage); } else { - renderBand(band,StartNewPageAsNeeded); + renderBand(band, 0, StartNewPageAsNeeded); } } @@ -656,7 +676,7 @@ void ReportRender::renderGroupFooter(BandDesignIntf *parentBand) if (gb && gb->isStarted()){ if (band->reprintOnEachPage()) m_reprintableBands.removeOne(band); if (band->childBands().count()>0){ - renderBand(band->childBands().at(0),StartNewPageAsNeeded); + renderBand(band->childBands().at(0), 0, StartNewPageAsNeeded); } closeDataGroup(band); } @@ -970,7 +990,7 @@ void ReportRender::startNewPage() m_currentIndex=0; renderPageHeader(m_patternPageItem); - //renderPageFooter(m_patternPageItem); + m_pageFooterHeight = calcPageFooterHeight(m_patternPageItem); m_maxHeightByColumn[m_currentColumn] -= m_pageFooterHeight; m_currentIndex=10; @@ -978,8 +998,9 @@ void ReportRender::startNewPage() m_renderedDataBandCount = 0; foreach (BandDesignIntf* band, m_reprintableBands) { - renderBand(band); + renderBand(band, 0); } + checkLostHeadersOnPrevPage(); pasteGroups(); renderPageItems(m_patternPageItem); diff --git a/limereport/lrreportrender.h b/limereport/lrreportrender.h index ab128d8..89807ca 100644 --- a/limereport/lrreportrender.h +++ b/limereport/lrreportrender.h @@ -96,7 +96,7 @@ private: void initVariables(); bool runInitScript(); void clearPageMap(); - void renderBand(BandDesignIntf *patternBand, DataRenderMode mode = NotStartNewPage, bool isLast = false); + BandDesignIntf* renderBand(BandDesignIntf *patternBand, BandDesignIntf *bandData, DataRenderMode mode = NotStartNewPage, bool isLast = false); void renderDataBand(BandDesignIntf* dataBand); void renderPageHeader(PageItemDesignIntf* patternPage); void renderPageFooter(PageItemDesignIntf* patternPage); From fcf9590745a6252495698c11572b86e0d5b792cd Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 12 Dec 2016 23:24:49 +0300 Subject: [PATCH 023/136] QTextDocument is created as needed --- limereport/items/lrtextitem.cpp | 167 ++++++++++++++++---------------- limereport/items/lrtextitem.h | 9 +- 2 files changed, 87 insertions(+), 89 deletions(-) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 6edd28f..50ca003 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -59,8 +59,6 @@ TextItem::TextItem(QObject *owner, QGraphicsItem *parent) : ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0), m_trimValue(true), m_allowHTML(false), m_allowHTMLInFields(false) { - m_text = new QTextDocument(); - PageItemDesignIntf* pageItem = dynamic_cast(parent); BaseDesignIntf* parentItem = dynamic_cast(parent); while (!pageItem && parentItem){ @@ -77,7 +75,7 @@ TextItem::TextItem(QObject *owner, QGraphicsItem *parent) TextItem::~TextItem() { - delete m_text; + } int TextItem::fakeMarginSize(){ @@ -95,6 +93,8 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q QSizeF tmpSize = rect().size()-m_textSize; + TextPtr text = textDocument(); + if (!painter->clipRegion().isEmpty()){ QRegion clipReg=painter->clipRegion().xored(painter->clipRegion().subtracted(rect().toRect())); painter->setClipRegion(clipReg); @@ -106,22 +106,22 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q switch (m_angle){ case Angle0: hOffset = fakeMarginSize(); - if ((tmpSize.height()>0) && (m_alignment & Qt::AlignVCenter)){ - vOffset = tmpSize.height()/2; + if ((tmpSize.height() > 0) && (m_alignment & Qt::AlignVCenter)){ + vOffset = tmpSize.height() / 2; } - if ((tmpSize.height()>0) && (m_alignment & Qt::AlignBottom)) // allow html + if ((tmpSize.height() > 0) && (m_alignment & Qt::AlignBottom)) // allow html vOffset = tmpSize.height(); painter->translate(hOffset,vOffset); break; case Angle90: - hOffset = width()-fakeMarginSize(); + hOffset = width() - fakeMarginSize(); vOffset = fakeMarginSize(); if (m_alignment & Qt::AlignVCenter){ - hOffset = (width()-m_text->size().height())/2+m_text->size().height(); + hOffset = (width() - text->size().height()) / 2 + text->size().height(); } if (m_alignment & Qt::AlignBottom){ - hOffset = (m_text->size().height()); + hOffset = (text->size().height()); } painter->translate(hOffset,vOffset); painter->rotate(90); @@ -129,59 +129,45 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q case Angle180: hOffset = width()-fakeMarginSize(); vOffset = height()-fakeMarginSize(); - if ((tmpSize.width()>0) && (m_alignment & Qt::AlignVCenter)){ - vOffset = tmpSize.height()/2+m_text->size().height(); + if ((tmpSize.width() > 0) && (m_alignment & Qt::AlignVCenter)){ + vOffset = tmpSize.height() / 2 + text->size().height(); } - if ((tmpSize.height()>0) && (m_alignment & Qt::AlignBottom)){ - vOffset = (m_text->size().height()); + if ((tmpSize.height() > 0) && (m_alignment & Qt::AlignBottom)){ + vOffset = (text->size().height()); } painter->translate(hOffset,vOffset); painter->rotate(180); break; case Angle270: hOffset = fakeMarginSize(); - vOffset = height()-fakeMarginSize(); + vOffset = height() - fakeMarginSize(); if (m_alignment & Qt::AlignVCenter){ - hOffset = (width()-m_text->size().height())/2; + hOffset = (width() - text->size().height()) / 2; } if (m_alignment & Qt::AlignBottom){ - hOffset = (width()-m_text->size().height()); + hOffset = (width() - text->size().height()); } painter->translate(hOffset,vOffset); painter->rotate(270); break; case Angle45: - painter->translate(width()/2,0); + painter->translate(width() / 2,0); painter->rotate(45); - m_text->setTextWidth(sqrt(2*(pow(width()/2,2)))); + text->setTextWidth(sqrt( 2 * (pow(width() / 2, 2)))); break; case Angle315: - painter->translate(0,height()/2); + painter->translate(0,height() / 2); painter->rotate(315); - m_text->setTextWidth(sqrt(2*(pow(height()/2,2)))); + text->setTextWidth(sqrt( 2 * (pow(height() / 2, 2)))); break; } -// for(QTextBlock it=m_text->begin();it!=m_text->end();it=it.next()){ -// for (int i=0;ilineCount();i++){ -// painter->setOpacity(qreal(foregroundOpacity())/100); -// it.layout()->lineAt(i).draw(painter,QPointF(0,0)); -// } -// } - painter->setOpacity(qreal(foregroundOpacity())/100); - //m_text->setDefaultTextOption(); QAbstractTextDocumentLayout::PaintContext ctx; ctx.palette.setColor(QPalette::Text, fontColor()); - m_text->documentLayout()->draw(painter,ctx); - -// m_layout.draw(ppainter,QPointF(marginSize(),0),); -// ppainter->setFont(transformToSceneFont(font())); -// QTextOption o; -// o.setAlignment(alignment()); -// ppainter->drawText(rect(), content(), o); + text->documentLayout()->draw(painter,ctx); painter->restore(); BaseDesignIntf::paint(painter, style, widget); @@ -193,11 +179,11 @@ QString TextItem::content() const{ void TextItem::Init() { - m_autoWidth=NoneAutoWidth; - m_alignment= Qt::AlignLeft|Qt::AlignTop; - m_autoHeight=false; -// m_text->setDefaultFont(transformToSceneFont(font())); - m_textSize=QSizeF(); + m_autoWidth = NoneAutoWidth; + m_alignment = Qt::AlignLeft|Qt::AlignTop; + m_autoHeight = false; + m_textSize = QSizeF(); + m_firstLineSize = 0; m_foregroundOpacity = 100; m_valueType = Default; } @@ -207,20 +193,14 @@ void TextItem::setContent(const QString &value) if (m_strText.compare(value)!=0){ QString oldValue = m_strText; m_strText=value; - if (allowHTML()) - m_text->setHtml(replaceReturns(value.trimmed())); - else - m_text->setPlainText(value); - //m_text->setTextWidth(width()); - //m_textSize=m_text->size(); + if (itemMode() == DesignMode){ - initText(); + initTextSizes(); } if (!isLoading()){ - update(rect()); - notify("content",oldValue,value); - //updateLayout(); + update(rect()); + notify("content",oldValue,value); } } } @@ -230,7 +210,7 @@ void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, i if (isNeedExpandContent()) expandContent(dataManager, pass); if (!isLoading()) - initText(); + initTextSizes(); if (m_textSize.width()>width() && ((m_autoWidth==MaxWordLength)||(m_autoWidth==MaxStringLength))){ setWidth(m_textSize.width() + fakeMarginSize()*2); @@ -276,24 +256,12 @@ QString TextItem::replaceReturns(QString text) return result; } -void TextItem::initText() +void TextItem::initTextSizes() { - QTextOption to; - to.setAlignment(m_alignment); - - if (m_autoWidth!=MaxStringLength) - to.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); - else to.setWrapMode(QTextOption::NoWrap); - - m_text->setDocumentMargin(0); - m_text->setDefaultTextOption(to); - m_text->setDefaultFont(transformToSceneFont(font())); - if ((m_angle==Angle0)||(m_angle==Angle180)){ - m_text->setTextWidth(rect().width()-fakeMarginSize()*2); - } else { - m_text->setTextWidth(rect().height()-fakeMarginSize()*2); - } - m_textSize=m_text->size(); + TextPtr text = textDocument(); + m_textSize= text->size(); + if (text->begin().isValid() && text->begin().layout()->lineAt(0).isValid()) + m_firstLineSize = text->begin().layout()->lineAt(0).height(); } QString TextItem::formatDateTime(const QDateTime &value) @@ -357,6 +325,37 @@ QString TextItem::formatFieldValue() } } +TextItem::TextPtr TextItem::textDocument() +{ + TextPtr text(new QTextDocument); + QTextOption to; + to.setAlignment(m_alignment); + + if (m_autoWidth!=MaxStringLength) + to.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); + else to.setWrapMode(QTextOption::NoWrap); + + text->setDocumentMargin(0); + text->setDefaultTextOption(to); + text->setDefaultFont(transformToSceneFont(font())); + + if (allowHTML()) + text->setHtml(replaceReturns(m_strText.trimmed())); + else + text->setPlainText(m_strText); + + if ((m_angle==Angle0)||(m_angle==Angle180)){ + text->setTextWidth(rect().width()-fakeMarginSize()*2); + } else { + text->setTextWidth(rect().height()-fakeMarginSize()*2); + } + + m_textSize = text->size(); + + return text; + +} + TextItem::ValueType TextItem::valueType() const { return m_valueType; @@ -400,13 +399,7 @@ void TextItem::setAllowHTML(bool allowHTML) { if (m_allowHTML!=allowHTML){ m_allowHTML = allowHTML; - if (m_text){ - if (allowHTML) - m_text->setHtml(m_strText); - else - m_text->setPlainText(m_strText); - update(); - } + update(); notify("allowHTML",!m_allowHTML,allowHTML); } } @@ -429,7 +422,7 @@ void TextItem::geometryChangedEvent(QRectF , QRectF) // m_text->setTextWidth(rect().height()-fakeMarginSize()*2); // } // m_textSize=m_text->size(); - if (itemMode() == DesignMode) initText(); + if (itemMode() == DesignMode) initTextSizes(); } bool TextItem::isNeedUpdateSize(RenderPass pass) const @@ -448,7 +441,7 @@ void TextItem::setAlignment(Qt::Alignment value) m_alignment=value; //m_layout.setTextOption(QTextOption(m_alignment)); if (!isLoading()){ - initText(); + initTextSizes(); update(rect()); notify("alignment",QVariant(oldValue),QVariant(value)); } @@ -497,16 +490,17 @@ void TextItem::setAutoWidth(TextItem::AutoWidth value) bool TextItem::canBeSplitted(int height) const { - return height>(m_text->begin().layout()->lineAt(0).height()); + return height>m_firstLineSize; } BaseDesignIntf *TextItem::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent) { + TextPtr text = textDocument(); int linesHeight=0; QString tmpText=""; TextItem* upperPart = dynamic_cast(cloneItem(itemMode(),owner,parent)); - for (QTextBlock it=m_text->begin();it!=m_text->end();it=it.next()){ + for (QTextBlock it=text->begin();it!=text->end();it=it.next()){ for (int i=0;ilineCount();i++){ linesHeight+=it.layout()->lineAt(i).height(); if (linesHeight>(height-(fakeMarginSize()*2+borderLineSize()*2))) { @@ -522,12 +516,13 @@ BaseDesignIntf *TextItem::cloneUpperPart(int height, QObject *owner, QGraphicsIt upperPart->setHeight(linesHeight+fakeMarginSize()*2+borderLineSize()*2); QScopedPointer context(new HtmlContext(m_strText)); upperPart->setContent(context->extendTextByTags(tmpText,0)); - upperPart->initText(); + upperPart->initTextSizes(); return upperPart; } BaseDesignIntf *TextItem::cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent) { + TextPtr text = textDocument(); TextItem* bottomPart = dynamic_cast(cloneItem(itemMode(),owner,parent)); int linesHeight=0; int curLine=0; @@ -535,7 +530,7 @@ BaseDesignIntf *TextItem::cloneBottomPart(int height, QObject *owner, QGraphicsI QString tmpText=""; - for (curBlock=m_text->begin();curBlock!=m_text->end();curBlock=curBlock.next()){ + for (curBlock=text->begin();curBlock!=text->end();curBlock=curBlock.next()){ for (curLine=0;curLinelineCount();curLine++){ linesHeight+=curBlock.layout()->lineAt(curLine).height(); if (linesHeight>(height-(fakeMarginSize()*2+borderLineSize()*2))) {goto loop_exit;} @@ -544,7 +539,7 @@ BaseDesignIntf *TextItem::cloneBottomPart(int height, QObject *owner, QGraphicsI loop_exit:; int textPos=0; - for (;curBlock!=m_text->end();curBlock=curBlock.next(),curLine=0){ + for (;curBlock!=text->end();curBlock=curBlock.next(),curLine=0){ for (;curLinelineCount();curLine++){ if (tmpText=="") textPos= curBlock.layout()->lineAt(curLine).textStart(); tmpText+=curBlock.text().mid(curBlock.layout()->lineAt(curLine).textStart(), @@ -555,7 +550,7 @@ BaseDesignIntf *TextItem::cloneBottomPart(int height, QObject *owner, QGraphicsI QScopedPointer context(new HtmlContext(m_strText)); bottomPart->setContent(context->extendTextByTags(tmpText,textPos)); - bottomPart->initText(); + bottomPart->initTextSizes(); bottomPart->setHeight(bottomPart->m_textSize.height()+borderLineSize()*2); return bottomPart; } @@ -577,7 +572,7 @@ void TextItem::objectLoadFinished() { ItemDesignIntf::objectLoadFinished(); if (itemMode() == DesignMode || !isNeedExpandContent()){ - initText(); + initTextSizes(); } } @@ -586,7 +581,7 @@ void TextItem::setTextItemFont(QFont value) if (font()!=value){ QFont oldValue = font(); setFont(value); - m_text->setDefaultFont(transformToSceneFont(value)); + update(); notify("font",oldValue,value); } } @@ -648,7 +643,7 @@ void TextItem::setAngle(const AngleType& value) AngleType oldValue = m_angle; m_angle = value; if (!isLoading()){ - initText(); + initTextSizes(); update(); notify("angle",oldValue,value); } diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index 39a878e..df8be9e 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -95,7 +95,7 @@ public: bool canBeSplitted(int height) const; bool isSplittable() const { return true;} - bool isEmpty() const{return m_text->isEmpty();} + bool isEmpty() const{return m_strText.isEmpty();} BaseDesignIntf* cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent); BaseDesignIntf* cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent); BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0); @@ -135,19 +135,22 @@ protected: QString replaceReturns(QString text); int fakeMarginSize(); private: - void initText(); + void initTextSizes(); QString formatDateTime(const QDateTime &value); QString formatNumber(const double value); QString formatFieldValue(); + typedef QSharedPointer TextPtr; + TextPtr textDocument(); private: QString m_strText; //QTextLayout m_layout; - QTextDocument* m_text; + //QTextDocument* m_text; Qt::Alignment m_alignment; bool m_autoHeight; AutoWidth m_autoWidth; QSizeF m_textSize; + qreal m_firstLineSize; AngleType m_angle; int m_foregroundOpacity; bool m_trimValue; From 46c830212fb4bbc4affbe36e024e1a8de061ac1d Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 12 Dec 2016 23:41:38 +0300 Subject: [PATCH 024/136] Render child bands has been fixed --- limereport/lrreportrender.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 64c02d3..196d3ad 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -495,8 +495,8 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) if (header && !firstTime && header->repeatOnEachRow()) renderBand(header, 0, StartNewPageAsNeeded); - if (renderBand(dataBand, rawData, StartNewPageAsNeeded, !bandDatasource->hasNext()) ) - renderChildBands(dataBand); + renderBand(dataBand, rawData, StartNewPageAsNeeded, !bandDatasource->hasNext()); + renderChildBands(dataBand); } From eeea8c264391431f9a8cd21839278b2b3cc3f190 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 13 Dec 2016 00:07:50 +0300 Subject: [PATCH 025/136] QTextDocument is created as needed --- limereport/items/lrtextitem.cpp | 264 +++++++++++++++----------------- limereport/items/lrtextitem.h | 15 +- 2 files changed, 135 insertions(+), 144 deletions(-) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index d3d658b..5b76d0e 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -60,8 +60,6 @@ TextItem::TextItem(QObject *owner, QGraphicsItem *parent) : ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0), m_trimValue(true), m_allowHTML(false), m_allowHTMLInFields(false), m_followTo(""), m_follower(0) { - m_text = new QTextDocument(); - PageItemDesignIntf* pageItem = dynamic_cast(parent); BaseDesignIntf* parentItem = dynamic_cast(parent); while (!pageItem && parentItem){ @@ -76,12 +74,9 @@ TextItem::TextItem(QObject *owner, QGraphicsItem *parent) Init(); } -TextItem::~TextItem() -{ - delete m_text; -} +TextItem::~TextItem(){} -int TextItem::fakeMarginSize(){ +int TextItem::fakeMarginSize() const{ return marginSize()+5; } @@ -89,6 +84,9 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q Q_UNUSED(widget); Q_UNUSED(style); + + TextPtr text = textDocument(); + painter->save(); setupPainter(painter); @@ -103,38 +101,38 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q painter->setClipRect(rect()); } - qreal hOffset = 0, vOffset=0; + qreal hOffset = 0, vOffset = 0; switch (m_angle){ case Angle0: hOffset = fakeMarginSize(); - if ((tmpSize.height()>0) && (m_alignment & Qt::AlignVCenter)){ - vOffset = tmpSize.height()/2; + if ((tmpSize.height() > 0) && (m_alignment & Qt::AlignVCenter)){ + vOffset = tmpSize.height() / 2; } - if ((tmpSize.height()>0) && (m_alignment & Qt::AlignBottom)) // allow html + if ((tmpSize.height() > 0) && (m_alignment & Qt::AlignBottom)) // allow html vOffset = tmpSize.height(); painter->translate(hOffset,vOffset); break; case Angle90: - hOffset = width()-fakeMarginSize(); + hOffset = width() - fakeMarginSize(); vOffset = fakeMarginSize(); if (m_alignment & Qt::AlignVCenter){ - hOffset = (width()-m_text->size().height())/2+m_text->size().height(); + hOffset = (width() - text->size().height()) / 2 + text->size().height(); } if (m_alignment & Qt::AlignBottom){ - hOffset = (m_text->size().height()); + hOffset = (text->size().height()); } painter->translate(hOffset,vOffset); painter->rotate(90); break; case Angle180: - hOffset = width()-fakeMarginSize(); - vOffset = height()-fakeMarginSize(); + hOffset = width() - fakeMarginSize(); + vOffset = height() - fakeMarginSize(); if ((tmpSize.width()>0) && (m_alignment & Qt::AlignVCenter)){ - vOffset = tmpSize.height()/2+m_text->size().height(); + vOffset = tmpSize.height() / 2+ text->size().height(); } if ((tmpSize.height()>0) && (m_alignment & Qt::AlignBottom)){ - vOffset = (m_text->size().height()); + vOffset = (text->size().height()); } painter->translate(hOffset,vOffset); painter->rotate(180); @@ -143,11 +141,11 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q hOffset = fakeMarginSize(); vOffset = height()-fakeMarginSize(); if (m_alignment & Qt::AlignVCenter){ - hOffset = (width()-m_text->size().height())/2; + hOffset = (width() - text->size().height())/2; } if (m_alignment & Qt::AlignBottom){ - hOffset = (width()-m_text->size().height()); + hOffset = (width() - text->size().height()); } painter->translate(hOffset,vOffset); painter->rotate(270); @@ -155,12 +153,12 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q case Angle45: painter->translate(width()/2,0); painter->rotate(45); - m_text->setTextWidth(sqrt(2*(pow(width()/2,2)))); + text->setTextWidth(sqrt(2*(pow(width()/2,2)))); break; case Angle315: painter->translate(0,height()/2); painter->rotate(315); - m_text->setTextWidth(sqrt(2*(pow(height()/2,2)))); + text->setTextWidth(sqrt(2*(pow(height()/2,2)))); break; } @@ -176,7 +174,8 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q painter->setOpacity(qreal(foregroundOpacity())/100); QAbstractTextDocumentLayout::PaintContext ctx; ctx.palette.setColor(QPalette::Text, fontColor()); - for(QTextBlock it=m_text->begin();it!=m_text->end();it=it.next()){ + + for(QTextBlock it = text->begin(); it != text->end(); it=it.next()){ it.blockFormat().setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight); for (int i=0;ilineCount();i++){ QTextLine line = it.layout()->lineAt(i); @@ -187,7 +186,8 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q } } } - m_text->documentLayout()->draw(painter,ctx); + + text->documentLayout()->draw(painter,ctx); if (m_underlines){ if (lineHeight<0) lineHeight = painter->fontMetrics().height(); @@ -196,19 +196,6 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q } } - //painter->setOpacity(qreal(foregroundOpacity())/100); - - //m_text->setDefaultTextOption(); - //QAbstractTextDocumentLayout::PaintContext ctx; - //ctx.palette.setColor(QPalette::Text, fontColor()); - //m_text->documentLayout()->draw(painter,ctx); - -// m_layout.draw(ppainter,QPointF(marginSize(),0),); -// ppainter->setFont(transformToSceneFont(font())); -// QTextOption o; -// o.setAlignment(alignment()); -// ppainter->drawText(rect(), content(), o); - painter->restore(); BaseDesignIntf::paint(painter, style, widget); } @@ -219,11 +206,11 @@ QString TextItem::content() const{ void TextItem::Init() { - m_autoWidth=NoneAutoWidth; - m_alignment= Qt::AlignLeft|Qt::AlignTop; - m_autoHeight=false; -// m_text->setDefaultFont(transformToSceneFont(font())); - m_textSize=QSizeF(); + m_autoWidth = NoneAutoWidth; + m_alignment = Qt::AlignLeft|Qt::AlignTop; + m_autoHeight = false; + m_textSize = QSizeF(); + m_firstLineSize = 0; m_foregroundOpacity = 100; m_underlines = false; m_adaptFontToSize = false; @@ -237,18 +224,13 @@ void TextItem::setContent(const QString &value) if (m_strText.compare(value)!=0){ QString oldValue = m_strText; m_strText=value; - if (allowHTML()) - m_text->setHtml(replaceReturns(value.trimmed())); - else - m_text->setPlainText(value); - //m_text->setTextWidth(width()); - //m_textSize=m_text->size(); + if (itemMode() == DesignMode){ - initText(); + initTextSizes(); } if (!isLoading()){ - initText(); + initTextSizes(); update(rect()); notify("content",oldValue,value); } @@ -260,7 +242,7 @@ void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, i if (isNeedExpandContent()) expandContent(dataManager, pass); if (!isLoading()) - initText(); + initTextSizes(); if (m_textSize.width()>width() && ((m_autoWidth==MaxWordLength)||(m_autoWidth==MaxStringLength))){ setWidth(m_textSize.width() + fakeMarginSize()*2); @@ -311,24 +293,25 @@ QString TextItem::replaceReturns(QString text) return result; } -void TextItem::setTextFont(const QFont& value){ - m_text->setDefaultFont(value); +void TextItem::setTextFont(TextPtr text, const QFont& value) { + text->setDefaultFont(value); if ((m_angle==Angle0)||(m_angle==Angle180)){ - m_text->setTextWidth(rect().width()-fakeMarginSize()*2); + text->setTextWidth(rect().width()-fakeMarginSize()*2); } else { - m_text->setTextWidth(rect().height()-fakeMarginSize()*2); + text->setTextWidth(rect().height()-fakeMarginSize()*2); } } -void TextItem::adaptFontSize(){ +void TextItem::adaptFontSize(TextPtr text) { QFont _font = transformToSceneFont(font()); do{ - setTextFont(_font); + setTextFont(text,_font); if (_font.pixelSize()>2) _font.setPixelSize(_font.pixelSize()-1); else break; - } while(m_text->size().height()>this->height() || m_text->size().width()>(this->width())-fakeMarginSize()*2); + } while(text->size().height()>this->height() || text->size().width()>(this->width()) - fakeMarginSize() * 2); } + int TextItem::underlineLineSize() const { return m_underlineLineSize; @@ -351,53 +334,18 @@ void TextItem::setLineSpacing(int value) { int oldValue = m_lineSpacing; m_lineSpacing = value; - initText(); + initTextSizes(); update(); notify("lineSpacing",oldValue,value); } -void TextItem::initText() +void TextItem::initTextSizes() { - if (!m_text) return; - QTextOption to; - to.setAlignment(m_alignment); - - if (m_autoWidth!=MaxStringLength) - if (m_adaptFontToSize && (!(m_autoHeight || m_autoWidth))) - to.setWrapMode(QTextOption::WordWrap); - else - to.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); - else to.setWrapMode(QTextOption::NoWrap); - - m_text->setDocumentMargin(0); - m_text->setDefaultTextOption(to); - - QFont _font = transformToSceneFont(font()); - if (m_adaptFontToSize && (!(m_autoHeight || m_autoWidth))){ - adaptFontSize(); - } else { - setTextFont(transformToSceneFont(font())); - } - - if ((m_angle==Angle0)||(m_angle==Angle180)){ - m_text->setTextWidth(rect().width()-fakeMarginSize()*2); - } else { - m_text->setTextWidth(rect().height()-fakeMarginSize()*2); - } - - for ( QTextBlock block = m_text->begin(); block.isValid(); block = block.next()) - { - QTextCursor tc = QTextCursor(block); - QTextBlockFormat fmt = block.blockFormat(); - - if(fmt.lineHeight() != m_lineSpacing) { - fmt.setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight); - tc.setBlockFormat( fmt ); - } - } - - m_textSize=m_text->size(); + TextPtr text = textDocument(); + m_textSize= text->size(); + if (text->begin().isValid() && text->begin().layout()->lineAt(0).isValid()) + m_firstLineSize = text->begin().layout()->lineAt(0).height(); } QString TextItem::formatDateTime(const QDateTime &value) @@ -461,6 +409,52 @@ QString TextItem::formatFieldValue() } } +TextItem::TextPtr TextItem::textDocument() +{ + TextPtr text(new QTextDocument); + + if (allowHTML()) + text->setHtml(m_strText); + else + text->setPlainText(m_strText); + + QTextOption to; + to.setAlignment(m_alignment); + + if (m_autoWidth!=MaxStringLength) + if (m_adaptFontToSize && (!(m_autoHeight || m_autoWidth))) + to.setWrapMode(QTextOption::WordWrap); + else + to.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); + else to.setWrapMode(QTextOption::NoWrap); + + text->setDocumentMargin(0); + text->setDefaultTextOption(to); + + QFont _font = transformToSceneFont(font()); + if (m_adaptFontToSize && (!(m_autoHeight || m_autoWidth))){ + adaptFontSize(text); + } else { + setTextFont(text,_font); + } + + text->documentLayout(); + + for ( QTextBlock block = text->begin(); block.isValid(); block = block.next()) + { + QTextCursor tc = QTextCursor(block); + QTextBlockFormat fmt = block.blockFormat(); + + if(fmt.lineHeight() != m_lineSpacing) { + fmt.setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight); + tc.setBlockFormat( fmt ); + } + } + + return text; + +} + QString TextItem::followTo() const { return m_followTo; @@ -564,13 +558,14 @@ void TextItem::setAllowHTML(bool allowHTML) { if (m_allowHTML!=allowHTML){ m_allowHTML = allowHTML; - if (m_text){ - if (allowHTML) - m_text->setHtml(m_strText); - else - m_text->setPlainText(m_strText); - update(); - } +// if (m_text){ +// if (allowHTML) +// m_text->setHtml(m_strText); +// else +// m_text->setPlainText(m_strText); +// update(); +// } + update(); notify("allowHTML",!m_allowHTML,allowHTML); } } @@ -588,16 +583,7 @@ void TextItem::setTrimValue(bool value) void TextItem::geometryChangedEvent(QRectF , QRectF) -{ -// if ((m_angle==Angle0)||(m_angle==Angle180)){ -// m_text->setTextWidth(rect().width()-fakeMarginSize()*2); -// } else { -// m_text->setTextWidth(rect().height()-fakeMarginSize()*2); -// } - if (itemMode() == DesignMode) initText(); - else if (adaptFontToSize()) initText(); - -} +{} bool TextItem::isNeedUpdateSize(RenderPass pass) const { @@ -616,7 +602,6 @@ void TextItem::setAlignment(Qt::Alignment value) m_alignment=value; //m_layout.setTextOption(QTextOption(m_alignment)); if (!isLoading()){ - initText(); update(rect()); notify("alignment",QVariant(oldValue),QVariant(value)); } @@ -625,7 +610,6 @@ void TextItem::setAlignment(Qt::Alignment value) void TextItem::expandContent(DataSourceManager* dataManager, RenderPass pass) { - QString context=content(); ExpandType expandType = (allowHTML() && !allowHTMLInFields())?ReplaceHTMLSymbols:NoEscapeSymbols; switch(pass){ @@ -670,7 +654,7 @@ void TextItem::setAdaptFontToSize(bool value) if (m_adaptFontToSize!=value){ bool oldValue = m_adaptFontToSize; m_adaptFontToSize=value; - initText(); +// initText(); invalidateRect(rect()); notify("updateFontToSize",oldValue,value); } @@ -678,22 +662,25 @@ void TextItem::setAdaptFontToSize(bool value) bool TextItem::canBeSplitted(int height) const { - return height>(m_text->begin().layout()->lineAt(0).height()); + QFontMetrics fm(font()); + return height > m_firstLineSize; } QString TextItem::getTextPart(int height, int skipHeight){ - int linesHeight=0; - int curLine=0; - int textPos=0; + int linesHeight = 0; + int curLine = 0; + int textPos = 0; - QTextBlock curBlock = m_text->begin(); - QString resultText=""; + TextPtr text = textDocument(); - if (skipHeight>0){ - for (;curBlock!=m_text->end();curBlock=curBlock.next()){ - for (curLine=0;curLinelineCount();curLine++){ - linesHeight+=curBlock.layout()->lineAt(curLine).height()+lineSpacing(); - if (linesHeight>(skipHeight-(/*fakeMarginSize()*2+*/borderLineSize()*2))) {goto loop_exit;} + QTextBlock curBlock = text->begin(); + QString resultText = ""; + + 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:; @@ -701,10 +688,10 @@ QString TextItem::getTextPart(int height, int skipHeight){ linesHeight = 0; - for (;curBlock!=m_text->end() || curLinelineCount();curLine++){ - if (resultText=="") textPos= curBlock.layout()->lineAt(curLine).textStart(); - linesHeight+=curBlock.layout()->lineAt(curLine).height()+lineSpacing(); + for (;curBlock != text->end() || curLinelineCount(); 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; @@ -742,7 +729,7 @@ BaseDesignIntf *TextItem::cloneUpperPart(int height, QObject *owner, QGraphicsIt { TextItem* upperPart = dynamic_cast(cloneItem(itemMode(),owner,parent)); upperPart->setContent(getTextPart(height,0)); - upperPart->initText(); + upperPart->initTextSizes(); upperPart->setHeight(upperPart->textSize().height()+borderLineSize()*2); return upperPart; } @@ -751,7 +738,7 @@ BaseDesignIntf *TextItem::cloneBottomPart(int height, QObject *owner, QGraphicsI { TextItem* bottomPart = dynamic_cast(cloneItem(itemMode(),owner,parent)); bottomPart->setContent(getTextPart(0,height)); - bottomPart->initText(); + bottomPart->initTextSizes(); bottomPart->setHeight(bottomPart->textSize().height()+borderLineSize()*2); return bottomPart; } @@ -773,7 +760,7 @@ void TextItem::objectLoadFinished() { ItemDesignIntf::objectLoadFinished(); if (itemMode() == DesignMode || !isNeedExpandContent()){ - initText(); + initTextSizes(); } } @@ -782,7 +769,7 @@ void TextItem::setTextItemFont(QFont value) if (font()!=value){ QFont oldValue = font(); setFont(value); - m_text->setDefaultFont(transformToSceneFont(value)); + update(); notify("font",oldValue,value); } } @@ -844,7 +831,6 @@ void TextItem::setAngle(const AngleType& value) AngleType oldValue = m_angle; m_angle = value; if (!isLoading()){ - initText(); update(); notify("angle",oldValue,value); } diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index 27b78f7..adab6b3 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -153,30 +153,35 @@ public: // IPageInit interface void pageObjectHasBeenLoaded(); + typedef QSharedPointer TextPtr; + protected: void updateLayout(); bool isNeedExpandContent() const; QString replaceBR(QString text); QString replaceReturns(QString text); - int fakeMarginSize(); + int fakeMarginSize() const; QString getTextPart(int height, int skipHeight); void restoreLinksEvent(); private: - void initText(); - void setTextFont(const QFont &value); - void adaptFontSize(); + void initTextSizes(); + void setTextFont(TextPtr text, const QFont &value); + void adaptFontSize(TextPtr text); QString formatDateTime(const QDateTime &value); QString formatNumber(const double value); QString formatFieldValue(); + + TextPtr textDocument(); private: QString m_strText; //QTextLayout m_layout; - QTextDocument* m_text; + //QTextDocument* m_text; Qt::Alignment m_alignment; bool m_autoHeight; AutoWidth m_autoWidth; QSizeF m_textSize; + qreal m_firstLineSize; AngleType m_angle; int m_foregroundOpacity; bool m_underlines; From 97bd5e458438a990a1fdaa7aac18304339d55ec9 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 13 Dec 2016 12:47:46 +0300 Subject: [PATCH 026/136] Fix #56 isBusy has been added to ReportEngine --- demo_r2/mainwindow.cpp | 7 ++++--- include/lrreportengine.h | 1 + limereport/lrreportengine.cpp | 17 ++++++++++++++++- limereport/lrreportengine.h | 1 + limereport/lrreportengine_p.h | 3 ++- 5 files changed, 24 insertions(+), 5 deletions(-) diff --git a/demo_r2/mainwindow.cpp b/demo_r2/mainwindow.cpp index 23c4d35..5ad3ac4 100644 --- a/demo_r2/mainwindow.cpp +++ b/demo_r2/mainwindow.cpp @@ -107,7 +107,6 @@ void MainWindow::slotPagesSet(int pagesCount) void MainWindow::slotPageChanged(int page) { -// ui->sbPageNavigator->setValue(page); m_pageNavigator->setValue(page); } @@ -118,8 +117,10 @@ void MainWindow::slotPageNavigatorChanged(int page) void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, int ) { - m_report.loadFromFile(item->data(0,Qt::UserRole).toString()); - m_preview->refreshPages(); + if (!m_report.isBusy()){ + m_report.loadFromFile(item->data(0,Qt::UserRole).toString()); + m_preview->refreshPages(); + } } void MainWindow::initPercentCombobox() diff --git a/include/lrreportengine.h b/include/lrreportengine.h index 48ce408..ca6d153 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -92,6 +92,7 @@ public: PreviewReportWidget *createPreviewWidget(QWidget *parent = 0); void setPreviewWindowTitle(const QString& title); void setPreviewWindowIcon(const QIcon& icon); + bool isBusy(); signals: void renderStarted(); void renderFinished(); diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index b924f43..fca8f82 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -58,7 +58,7 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) : QObject(parent), m_fileName(""), m_settings(0), m_ownedSettings(false), m_printer(new QPrinter(QPrinter::HighResolution)), m_printerSelected(false), m_showProgressDialog(true), m_reportName(""), m_activePreview(0), - m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")) + m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")), m_reportRendering(false) { m_datasources= new DataSourceManager(this); m_datasources->setObjectName("datasources"); @@ -409,6 +409,7 @@ void ReportEnginePrivate::cancelRender() { if (m_reportRender) m_reportRender->cancelRender(); + m_reportRendering = false; } void ReportEnginePrivate::designReport() @@ -579,6 +580,11 @@ void ReportEnginePrivate::setSuppressFieldAndVarError(bool suppressFieldAndVarEr m_reportSettings.setSuppressAbsentFieldsAndVarsWarnings(suppressFieldAndVarError); } +bool ReportEnginePrivate::isBusy() +{ + return m_reportRendering; +} + QString ReportEnginePrivate::previewWindowTitle() const { return m_previewWindowTitle; @@ -601,6 +607,7 @@ void ReportEnginePrivate::setPreviewWindowIcon(const QIcon &previewWindowIcon) ReportPages ReportEnginePrivate::renderToPages() { + if (m_reportRendering) return ReportPages(); m_reportRender = ReportRender::Ptr(new ReportRender); dataManager()->clearErrors(); dataManager()->connectAllDatabases(); @@ -608,11 +615,13 @@ ReportPages ReportEnginePrivate::renderToPages() connect(m_reportRender.data(),SIGNAL(pageRendered(int)), this, SIGNAL(renderPageFinished(int))); if (m_pages.count()){ + m_reportRendering = true; emit renderStarted(); m_reportRender->setDatasources(dataManager()); m_pages.at(0)->setReportSettings(&m_reportSettings); ReportPages result = m_reportRender->renderPageToPages(m_pages.at(0)); emit renderFinished(); + m_reportRendering = false; return result; }else { return ReportPages(); @@ -695,6 +704,12 @@ void ReportEngine::setPreviewWindowIcon(const QIcon &icon) d->setPreviewWindowIcon(icon); } +bool ReportEngine::isBusy() +{ + Q_D(ReportEngine); + return d->isBusy(); +} + void ReportEngine::setShowProgressDialog(bool value) { Q_D(ReportEngine); diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index 48ce408..ca6d153 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -92,6 +92,7 @@ public: PreviewReportWidget *createPreviewWidget(QWidget *parent = 0); void setPreviewWindowTitle(const QString& title); void setPreviewWindowIcon(const QIcon& icon); + bool isBusy(); signals: void renderStarted(); void renderFinished(); diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index ecadd87..42a10af 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -115,7 +115,7 @@ public: bool suppressFieldAndVarError() const; void setSuppressFieldAndVarError(bool suppressFieldAndVarError); - + bool isBusy(); signals: void pagesLoadFinished(); void datasourceCollectionLoadFinished(const QString& collectionName); @@ -163,6 +163,7 @@ private: QString m_previewWindowTitle; QPointer m_designerWindow; ReportSettings m_reportSettings; + bool m_reportRendering; }; } From edd2c43545ad9071878b76ec8313246740ee8b00 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 20 Dec 2016 01:33:58 +0300 Subject: [PATCH 027/136] beforeRender, afterData, afterRender signals have been added getVariable, getField functions have been added --- limereport/lrbanddesignintf.cpp | 1 + limereport/lrbasedesignintf.cpp | 2 +- limereport/lrbasedesignintf.h | 4 ++ limereport/lrreportrender.cpp | 73 +++++++++++++++++++++++----- limereport/lrreportrender.h | 3 ++ limereport/lrscriptenginemanager.cpp | 24 +++++++++ 6 files changed, 93 insertions(+), 14 deletions(-) diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index c7b3dcc..2fe29b8 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -357,6 +357,7 @@ bool BandDesignIntf::canBeSplitted(int height) const bool BandDesignIntf::isEmpty() const { + if (!isVisible()) return true; foreach(QGraphicsItem* qgItem,childItems()){ BaseDesignIntf* item = dynamic_cast(qgItem); if ((item)&&(!item->isEmpty())) return false; diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 3a3056b..7025a0f 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -818,7 +818,7 @@ void BaseDesignIntf::turnOnSelectionMarker(bool value) QString BaseDesignIntf::patternName() const { - return m_patternName; + return (m_patternName.isEmpty()) ? objectName() : m_patternName; } void BaseDesignIntf::setPatternName(const QString &patternName) diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index 71e2736..d9bdf3f 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -387,6 +387,10 @@ signals: void propertyesChanged(QVector propertyNames); void itemAlignChanged(BaseDesignIntf* item, const ItemAlign& oldValue, const ItemAlign& newValue); void itemVisibleHasChanged(BaseDesignIntf* item); + + void beforeRender(); + void afterData(); + void afterRender(); }; } //namespace LimeReport diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 196d3ad..1f656eb 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -167,6 +167,7 @@ void ReportRender::setScriptContext(ScriptEngineContext* scriptContext) bool ReportRender::runInitScript(){ if (m_scriptEngineContext){ + ScriptEngineManager::instance().scriptEngine()->pushContext(); QScriptValue res = ScriptEngineManager::instance().scriptEngine()->evaluate(m_scriptEngineContext->initScript()); if (res.isBool()) return res.toBool(); } @@ -213,6 +214,14 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) #ifdef HAVE_UI_LOADER initDialogs(); #endif + + if (m_scriptEngineContext){ + + foreach (BaseDesignIntf* item, patternPage->pageItem()->childBaseItems()){ + baseDesignIntfToScript(item); + } + } + if (runInitScript()){ clearPageMap(); @@ -224,6 +233,7 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) QMessageBox::critical(0,tr("Error"),exception.what()); return; } + clearPageMap(); startNewPage(); @@ -242,12 +252,13 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) if (lastRenderedBand && lastRenderedBand->keepFooterTogether()) closeFooterGroup(lastRenderedBand); - BandDesignIntf* tearOffBand = m_patternPageItem->bandByType(BandDesignIntf::TearOffBand); - if (tearOffBand) - renderBand(tearOffBand, 0, StartNewPageAsNeeded); + BandDesignIntf* tearOffBand = m_patternPageItem->bandByType(BandDesignIntf::TearOffBand); + if (tearOffBand) + renderBand(tearOffBand, 0, StartNewPageAsNeeded); savePage(true); + ScriptEngineManager::instance().scriptEngine()->popContext(); } } @@ -364,14 +375,6 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign QApplication::processEvents(); if (patternBand){ - if (mode == ForcedStartPage){ - savePage(); - startNewPage(); - } - - if (patternBand->isFooter()) - m_lastRenderedFooter = patternBand; - BandDesignIntf* bandClone = 0; if (bandData){ @@ -380,13 +383,24 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign bandClone=renderData(patternBand); } + if (mode == ForcedStartPage){ + savePage(); + startNewPage(); + } + + if (patternBand->isFooter()) + m_lastRenderedFooter = patternBand; + + bandClone->setBackgroundColor( (datasources()->variable(QLatin1String("line_")+patternBand->objectName().toLower()).toInt()%2!=0 ? - patternBand->backgroundColor(): - patternBand->alternateBackgroundColor() + bandClone->backgroundColor(): + bandClone->alternateBackgroundColor() ) ); + patternBand->emitBandRendered(bandClone); + emit(patternBand->afterRender()); if ( isLast && bandClone->keepFooterTogether() && bandClone->sliceLastRow() ){ if (m_maxHeightByColumn[m_currentColumn] < (bandClone->height()+m_reportFooterHeight)) @@ -960,10 +974,18 @@ BandDesignIntf *ReportRender::saveUppperPartReturnBottom(BandDesignIntf *band, i BandDesignIntf *ReportRender::renderData(BandDesignIntf *patternBand) { BandDesignIntf* bandClone = dynamic_cast(patternBand->cloneItem(PreviewMode)); + + baseDesignIntfToScript(bandClone); + emit(patternBand->beforeRender()); + if (patternBand->isFooter()){ replaceGroupsFunction(bandClone); } bandClone->updateItemSize(m_datasources); + + baseDesignIntfToScript(bandClone); + emit(patternBand->afterData()); + return bandClone; } @@ -1194,4 +1216,29 @@ void ReportRender::cancelRender(){ m_renderCanceled = true; } +void ReportRender::baseDesignIntfToScript(BaseDesignIntf *item) +{ + if ( item ) { + + if (item->metaObject()->indexOfSignal("beforeRender()")!=-1) + item->disconnect(SIGNAL(beforeRender())); + if (item->metaObject()->indexOfSignal("afterData()")!=-1) + item->disconnect(SIGNAL(afterData())); + if (item->metaObject()->indexOfSignal("afterRender()")!=-1) + item->disconnect(SIGNAL(afterRender())); + + QScriptEngine* engine = ScriptEngineManager::instance().scriptEngine(); + QScriptValue sItem = engine->globalObject().property(item->patternName()); + if (sItem.isValid()){ + engine->newQObject(sItem, item); + } else { + sItem = engine->newQObject(item); + engine->globalObject().setProperty(item->patternName(),sItem); + } + foreach(BaseDesignIntf* child, item->childBaseItems()){ + baseDesignIntfToScript(child); + } + } +} + } diff --git a/limereport/lrreportrender.h b/limereport/lrreportrender.h index 89807ca..16e8176 100644 --- a/limereport/lrreportrender.h +++ b/limereport/lrreportrender.h @@ -86,6 +86,9 @@ signals: public slots: void cancelRender(); private: + + void baseDesignIntfToScript(BaseDesignIntf* item); + void renderPage(PageDesignIntf *patternPage); void initDatasources(); void initDatasource(const QString &name); diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index 976aa22..d24de0e 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -220,6 +220,28 @@ QScriptValue setVariable(QScriptContext* pcontext, QScriptEngine* /*pengine*/){ return QScriptValue(); } +QScriptValue getVariable(QScriptContext* pcontext, QScriptEngine* pengine){ + + QString name = pcontext->argument(0).toString(); + + ScriptEngineManager* sm = qscriptvalue_cast(pcontext->callee().data()); + DataSourceManager* dm = sm->dataManager(); + QScriptValue res = pengine->newVariant(dm->variable(name)); + + return res; +} + +QScriptValue getField(QScriptContext* pcontext, QScriptEngine* pengine){ + + QString name = pcontext->argument(0).toString(); + + ScriptEngineManager* sm = qscriptvalue_cast(pcontext->callee().data()); + DataSourceManager* dm = sm->dataManager(); + QScriptValue res = pengine->newVariant(dm->fieldData(name)); + + return res; +} + QScriptValue numberFormat(QScriptContext* pcontext, QScriptEngine* pengine){ QVariant value = pcontext->argument(0).toVariant(); char format = (pcontext->argumentCount()>1)?pcontext->argument(1).toString()[0].toLatin1():'f'; @@ -431,6 +453,8 @@ ScriptEngineManager::ScriptEngineManager() addFunction("currencyUSBasedFormat",currencyUSBasedFormat,"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")+"\")"); QScriptValue colorCtor = m_scriptEngine->newFunction(constructColor); m_scriptEngine->globalObject().setProperty("QColor", colorCtor); From dd214ca247a9b17049cdde7b762c118244e90437 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 21 Dec 2016 18:21:20 +0300 Subject: [PATCH 028/136] init script error message has been added --- limereport/lrreportrender.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 1f656eb..e768e10 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -167,9 +167,17 @@ void ReportRender::setScriptContext(ScriptEngineContext* scriptContext) bool ReportRender::runInitScript(){ if (m_scriptEngineContext){ - ScriptEngineManager::instance().scriptEngine()->pushContext(); - QScriptValue res = ScriptEngineManager::instance().scriptEngine()->evaluate(m_scriptEngineContext->initScript()); + QScriptEngine* engine = ScriptEngineManager::instance().scriptEngine(); + engine->pushContext(); + QScriptValue res = engine->evaluate(m_scriptEngineContext->initScript()); if (res.isBool()) return res.toBool(); + if (engine->hasUncaughtException()) { + QMessageBox::critical(0,tr("Error"), + QString("Line %1: %2 ").arg(engine->uncaughtExceptionLineNumber()) + .arg(engine->uncaughtException().toString()) + ); + return false; + } } return true; } From 7da0cfd7e2768f3e4ed7d0e1c87abb9c65169383 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 21 Dec 2016 22:09:10 +0300 Subject: [PATCH 029/136] backgroundBrushStyle property has been added --- limereport/items/lrshapeitem.cpp | 2 +- limereport/items/lrtextitem.h | 1 + limereport/lrbanddesignintf.cpp | 36 ++++++++++++++------------ limereport/lrbanddesignintf.h | 3 ++- limereport/lrbasedesignintf.cpp | 44 +++++++++++++++++--------------- limereport/lrbasedesignintf.h | 43 +++++++++++++++++++++---------- 6 files changed, 77 insertions(+), 52 deletions(-) diff --git a/limereport/items/lrshapeitem.cpp b/limereport/items/lrshapeitem.cpp index f52b1c8..a1b37d9 100644 --- a/limereport/items/lrshapeitem.cpp +++ b/limereport/items/lrshapeitem.cpp @@ -85,7 +85,7 @@ void ShapeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, pen.setStyle(m_penStyle); painter->setPen(pen); QBrush brush(m_shapeBrushColor,m_shapeBrushType); - + brush.setTransform(painter->worldTransform().inverted()); painter->setBrush(brush); painter->setBackground(QBrush(Qt::NoBrush)); painter->setOpacity(qreal(m_opacity)/100); diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index adab6b3..535bcd4 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -68,6 +68,7 @@ class TextItem : public LimeReport::ContentItemDesignIntf, IPageInit { Q_PROPERTY(QString format READ format WRITE setFormat) Q_PROPERTY(ValueType valueType READ valueType WRITE setValueType) Q_PROPERTY(QString followTo READ followTo WRITE setFollowTo) + Q_PROPERTY(BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle) public: enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength}; diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index 2fe29b8..c6993ad 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -183,16 +183,20 @@ BandDesignIntf::~BandDesignIntf() delete m_bandNameLabel; } -void BandDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget) +void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { - if (backgroundColor()!=Qt::white) { - ppainter->fillRect(rect(),backgroundColor()); + + if ( !(backgroundColor() == Qt::white && backgroundBrushStyle() == SolidPattern) ) { + QBrush brush(backgroundColor(), static_cast(backgroundBrushStyle())); + brush.setTransform(painter->worldTransform().inverted()); + painter->fillRect(rect(), brush); } - if (itemMode()&DesignMode){ - ppainter->save(); + + if (itemMode() & DesignMode){ + painter->save(); QString bandText = objectName(); if (parentBand()) bandText+=QLatin1String(" connected to ")+parentBand()->objectName(); - QFont font("Arial",7*Const::fontFACTOR,-1,true); + QFont font("Arial", 7 * Const::fontFACTOR, -1, true); QFontMetrics fontMetrics(font); QVector bandNameRects; @@ -204,22 +208,22 @@ void BandDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *o //if (isSelected()) ppainter->setPen(QColor(167,244,167)); // else ppainter->setPen(QColor(220,220,220)); - ppainter->setFont(font); + painter->setFont(font); for (int i=0;isetRenderHint(QPainter::Antialiasing); - ppainter->setBrush(bandColor()); - ppainter->setOpacity(Const::BAND_NAME_AREA_OPACITY); - ppainter->drawRoundedRect(labelRect,8,8); - ppainter->setOpacity(Const::BAND_NAME_TEXT_OPACITY); - ppainter->setPen(Qt::black); - ppainter->drawText(bandNameRects[i],Qt::AlignHCenter,bandText); + painter->setRenderHint(QPainter::Antialiasing); + painter->setBrush(bandColor()); + painter->setOpacity(Const::BAND_NAME_AREA_OPACITY); + painter->drawRoundedRect(labelRect,8,8); + painter->setOpacity(Const::BAND_NAME_TEXT_OPACITY); + painter->setPen(Qt::black); + painter->drawText(bandNameRects[i],Qt::AlignHCenter,bandText); } } - ppainter->restore(); + painter->restore(); } - BaseDesignIntf::paint(ppainter,option,widget); + BaseDesignIntf::paint(painter,option,widget); } BandDesignIntf::BandsType BandDesignIntf::bandType() const diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index 1f21919..fea245a 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -92,6 +92,7 @@ class BandDesignIntf : public BaseDesignIntf Q_PROPERTY(bool keepBottomSpace READ keepBottomSpaceOption WRITE setKeepBottomSpaceOption ) Q_PROPERTY(QString parentBand READ parentBandName WRITE setParentBandName DESIGNABLE false ) Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor) + Q_PROPERTY(BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle) Q_PROPERTY(bool printIfEmpty READ printIfEmpty WRITE setPrintIfEmpty) Q_ENUMS(BandColumnsLayoutType) friend class BandMarker; @@ -121,7 +122,7 @@ public: BandDesignIntf(BandsType bandType, const QString& xmlTypeName, QObject* owner = 0, QGraphicsItem* parent=0); ~BandDesignIntf(); - void paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget); + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); virtual BandsType bandType() const; virtual QString bandTitle() const; virtual QIcon bandIcon() const; diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 7025a0f..77967f4 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -64,14 +64,13 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q m_BGMode(OpaqueMode), m_opacity(100), m_borderLinesFlags(0), - m_hintFrame(0), m_storageTypeName(storageTypeName), m_itemMode(DesignMode), m_objectState(ObjectCreated), m_selectionMarker(0), m_joinMarker(0), - m_backgroundBrush(Solid), - m_backgroundBrushcolor(Qt::white), + m_backgroundBrushStyle(SolidPattern), + m_backgroundColor(Qt::white), m_margin(4), m_itemAlign(DesignedItemAlign), m_changingItemAlign(false), @@ -122,21 +121,23 @@ QString BaseDesignIntf::parentReportItemName() const else return ""; } -void BaseDesignIntf::setBackgroundBrushMode(BaseDesignIntf::BrushMode value) +void BaseDesignIntf::setBackgroundBrushStyle(BrushStyle value) { - if ( value != m_backgroundBrush ){ - m_backgroundBrush=value; + if ( value != m_backgroundBrushStyle ){ + BrushStyle oldValue = m_backgroundBrushStyle; + m_backgroundBrushStyle=value; if (!isLoading()) update(); + notify("backgroundBrushStyle", static_cast(oldValue), static_cast(value)); } } void BaseDesignIntf::setBackgroundColor(QColor value) { - if (value != m_backgroundBrushcolor){ - QColor oldValue = m_backgroundBrushcolor; - m_backgroundBrushcolor=value; + if (value != m_backgroundColor){ + QColor oldValue = m_backgroundColor; + m_backgroundColor=value; if (!isLoading()) update(); - notify("backgroundColor",oldValue,m_backgroundBrushcolor); + notify("backgroundColor", oldValue, value); } } @@ -496,7 +497,6 @@ void BaseDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *o Q_UNUSED(option); Q_UNUSED(widget); setupPainter(ppainter); - drawBorder(ppainter, rect()); if (isSelected()) {drawSelection(ppainter, rect());} drawResizeZone(ppainter); @@ -512,24 +512,28 @@ QColor calcColor(QColor color){ return Qt::white; else return Qt::black; -}; +} -void BaseDesignIntf::prepareRect(QPainter *ppainter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/) +void BaseDesignIntf::prepareRect(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/) { - ppainter->save(); + painter->save(); + + QBrush brush(m_backgroundColor,static_cast(m_backgroundBrushStyle)); + brush.setTransform(painter->worldTransform().inverted()); + if (isSelected() && (opacity() == 100) && (m_BGMode!=TransparentMode)) { - ppainter->fillRect(rect(), QBrush(QColor(m_backgroundBrushcolor))); + painter->fillRect(rect(), brush); } else { if (m_BGMode == OpaqueMode) { - ppainter->setOpacity(qreal(m_opacity) / 100); - ppainter->fillRect(rect(), QBrush(m_backgroundBrushcolor)); + painter->setOpacity(qreal(m_opacity) / 100); + painter->fillRect(rect(), brush); } else if (itemMode() & DesignMode){ - ppainter->setOpacity(0.1); - ppainter->fillRect(rect(), QBrush(QPixmap(":/report/empty"))); + painter->setOpacity(0.1); + painter->fillRect(rect(), QBrush(QPixmap(":/report/images/empty"))); } } - ppainter->restore(); + painter->restore(); } void BaseDesignIntf::hoverMoveEvent(QGraphicsSceneHoverEvent *event) diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index d9bdf3f..d6b32f6 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -83,7 +83,7 @@ class BaseDesignIntf : Q_INTERFACES(QGraphicsItem) Q_ENUMS(BGMode) Q_ENUMS(Qt::BrushStyle) - Q_ENUMS(BrushMode) + Q_ENUMS(BrushStyle) Q_ENUMS(ItemAlign) Q_FLAGS(BorderLines) Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometryProperty NOTIFY geometryChanged) @@ -96,8 +96,23 @@ class BaseDesignIntf : Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor) public: - enum BGMode { TransparentMode,OpaqueMode}; - enum BrushMode{Solid,None}; + enum BGMode { TransparentMode, OpaqueMode}; + + enum BrushStyle{ NoBrush, + SolidPattern, + Dense1Pattern, + Dense2Pattern, + Dense3Pattern, + Dense4Pattern, + Dense5Pattern, + Dense6Pattern, + Dense7Pattern, + HorPattern, + VerPattern, + CrossPattern, + BDiagPattern, + FDiagPattern }; + enum ResizeFlags { Fixed = 0, ResizeLeft = 1, ResizeRight = 2, @@ -124,13 +139,13 @@ public: BaseDesignIntf(const QString& storageTypeName, QObject* owner = 0, QGraphicsItem* parent = 0); virtual ~BaseDesignIntf(); - void setParentReportItem(const QString& value); + void setParentReportItem(const QString& value); QString parentReportItemName() const; - BrushMode backgroundBrushMode() const {return m_backgroundBrush;} - void setBackgroundBrushMode(BrushMode value); - QColor backgroundColor() const {return m_backgroundBrushcolor;} - void setBackgroundColor(QColor value); + BrushStyle backgroundBrushStyle() const {return m_backgroundBrushStyle;} + void setBackgroundBrushStyle(BrushStyle value); + QColor backgroundColor() const {return m_backgroundColor;} + void setBackgroundColor(QColor value); QPen pen() const; void setPen(QPen& pen); @@ -155,7 +170,7 @@ public: virtual QSizeF sizeMM() const; void paint(QPainter* ppainter, const QStyleOptionGraphicsItem* option, QWidget* widget); - void prepareRect(QPainter* ppainter, const QStyleOptionGraphicsItem*, QWidget*); + void prepareRect(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*); virtual QPainterPath shape() const; void setFixedPos(bool fixedPos); @@ -329,13 +344,13 @@ private: void turnOnSelectionMarker(bool value); private: QPointF m_startPos; - //QPointF m_startScenePos; int m_resizeHandleSize; int m_selectionPenSize; int m_possibleResizeDirectionFlags; int m_possibleMoveDirectionFlags; int m_resizeDirectionFlags; - qreal m_width, m_height; + qreal m_width; + qreal m_height; QPen m_pen; QFont m_font; QColor m_fontColor; @@ -357,7 +372,6 @@ private: QRectF m_rightRect; QVector m_resizeAreas; - QFrame* m_hintFrame; QString m_storageTypeName; ItemMode m_itemMode; @@ -365,8 +379,9 @@ private: SelectionMarker* m_selectionMarker; Marker* m_joinMarker; - BrushMode m_backgroundBrush; - QColor m_backgroundBrushcolor; + BrushStyle m_backgroundBrushStyle; + QColor m_backgroundColor; + RenderPass m_currentPass; int m_margin; QString m_itemTypeName; From 3807ac0c576732a43801c07ebf25fdd1fe1e0e8a Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 22 Dec 2016 02:08:27 +0300 Subject: [PATCH 030/136] limereport.pri for static building and aliases have been added --- demo_r1/mainwindow.cpp | 6 ++-- limereport.pri | 5 +++ limereport/LRCallbackDS | 1 + limereport/LRDataManager | 1 + limereport/LRScriptManager | 1 + limereport/LimeReport | 1 + qzint.pri | 64 ++++++++++++++++++++++++++++++++++++++ 7 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 limereport.pri create mode 100644 limereport/LRCallbackDS create mode 100644 limereport/LRDataManager create mode 100644 limereport/LRScriptManager create mode 100644 limereport/LimeReport create mode 100644 qzint.pri diff --git a/demo_r1/mainwindow.cpp b/demo_r1/mainwindow.cpp index bc96811..d695a4e 100644 --- a/demo_r1/mainwindow.cpp +++ b/demo_r1/mainwindow.cpp @@ -33,8 +33,8 @@ #include #include #include -#include "lrreportengine.h" -#include "lrcallbackdatasourceintf.h" +#include +#include #include #include @@ -104,6 +104,8 @@ MainWindow::MainWindow(QWidget *parent) : MainWindow::~MainWindow() { delete ui; + delete m_customers; + delete m_orders; } void MainWindow::on_pushButton_clicked() diff --git a/limereport.pri b/limereport.pri new file mode 100644 index 0000000..a7f272f --- /dev/null +++ b/limereport.pri @@ -0,0 +1,5 @@ +CONFIG += zint +include(./limereport/limereport.pri) +contains(CONFIG, zint){ + include(./qzint.pri) +} diff --git a/limereport/LRCallbackDS b/limereport/LRCallbackDS new file mode 100644 index 0000000..fd5f8c4 --- /dev/null +++ b/limereport/LRCallbackDS @@ -0,0 +1 @@ +#include "lrcallbackdatasourceintf.h" \ No newline at end of file diff --git a/limereport/LRDataManager b/limereport/LRDataManager new file mode 100644 index 0000000..720a2ed --- /dev/null +++ b/limereport/LRDataManager @@ -0,0 +1 @@ +#include "lrdatasourcemanagerintf.h" \ No newline at end of file diff --git a/limereport/LRScriptManager b/limereport/LRScriptManager new file mode 100644 index 0000000..05ab2f8 --- /dev/null +++ b/limereport/LRScriptManager @@ -0,0 +1 @@ +#include "lrscriptenginemanagerintf.h" \ No newline at end of file diff --git a/limereport/LimeReport b/limereport/LimeReport new file mode 100644 index 0000000..037cf8c --- /dev/null +++ b/limereport/LimeReport @@ -0,0 +1 @@ +#include "lrreportengine.h" diff --git a/qzint.pri b/qzint.pri new file mode 100644 index 0000000..51a6a50 --- /dev/null +++ b/qzint.pri @@ -0,0 +1,64 @@ +DEFINES += _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS ZINT_VERSION=\\\"$$ZINT_VERSION\\\" NO_PNG + +!contains(DEFINES, NO_PNG) { + LIBS += -lpng +} + +INCLUDEPATH += \ + $$ZINT_PATH/backend \ + $$ZINT_PATH/backend_qt4 + +HEADERS += $$ZINT_PATH/backend/aztec.h \ + $$ZINT_PATH/backend/code1.h \ + $$ZINT_PATH/backend/code49.h \ + $$ZINT_PATH/backend/common.h \ + $$ZINT_PATH/backend/composite.h \ + $$ZINT_PATH/backend/dmatrix.h \ + $$ZINT_PATH/backend/font.h \ + $$ZINT_PATH/backend/gb2312.h \ + $$ZINT_PATH/backend/gridmtx.h \ + $$ZINT_PATH/backend/gs1.h \ + $$ZINT_PATH/backend/large.h \ + $$ZINT_PATH/backend/maxicode.h \ + $$ZINT_PATH/backend/maxipng.h \ + $$ZINT_PATH/backend/ms_stdint.h \ + $$ZINT_PATH/backend/pdf417.h \ + $$ZINT_PATH/backend/qr.h \ + $$ZINT_PATH/backend/reedsol.h \ + $$ZINT_PATH/backend/rss.h \ + $$ZINT_PATH/backend/sjis.h \ + $$ZINT_PATH/backend/zint.h \ + $$ZINT_PATH/backend_qt4/qzint.h + +SOURCES += $$ZINT_PATH/backend/2of5.c \ + $$ZINT_PATH/backend/auspost.c \ + $$ZINT_PATH/backend/aztec.c \ + $$ZINT_PATH/backend/code.c \ + $$ZINT_PATH/backend/code1.c \ + $$ZINT_PATH/backend/code128.c \ + $$ZINT_PATH/backend/code16k.c \ + $$ZINT_PATH/backend/code49.c \ + $$ZINT_PATH/backend/common.c \ + $$ZINT_PATH/backend/composite.c \ + $$ZINT_PATH/backend/dmatrix.c \ + $$ZINT_PATH/backend/gridmtx.c \ + $$ZINT_PATH/backend/gs1.c \ + $$ZINT_PATH/backend/imail.c \ + $$ZINT_PATH/backend/large.c \ + $$ZINT_PATH/backend/library.c \ + $$ZINT_PATH/backend/maxicode.c \ + $$ZINT_PATH/backend/medical.c \ + $$ZINT_PATH/backend/pdf417.c \ + $$ZINT_PATH/backend/plessey.c \ + $$ZINT_PATH/backend/postal.c \ + $$ZINT_PATH/backend/ps.c \ + $$ZINT_PATH/backend/qr.c \ + $$ZINT_PATH/backend/reedsol.c \ + $$ZINT_PATH/backend/render.c \ + $$ZINT_PATH/backend/rss.c \ + $$ZINT_PATH/backend/svg.c \ + $$ZINT_PATH/backend/telepen.c \ + $$ZINT_PATH/backend/upcean.c \ + $$ZINT_PATH/backend/dllversion.c \ + $$ZINT_PATH/backend/png.c \ + $$ZINT_PATH/backend_qt4/qzint.cpp From 658a6e7e09f16814e09852d8ff4783657fdc6eaa Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 24 Dec 2016 11:49:56 +0300 Subject: [PATCH 031/136] followTo has been fixed --- limereport/items/lrtextitem.cpp | 38 +++++++++++++++++++++++++-------- limereport/items/lrtextitem.h | 1 + 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 5b76d0e..2152143 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -223,7 +223,10 @@ void TextItem::setContent(const QString &value) { if (m_strText.compare(value)!=0){ QString oldValue = m_strText; - m_strText=value; + if (m_trimValue) + m_strText=value.trimmed(); + else + m_strText=value; if (itemMode() == DesignMode){ initTextSizes(); @@ -466,17 +469,29 @@ void TextItem::setFollowTo(const QString &followTo) QString oldValue = m_followTo; m_followTo = followTo; if (!isLoading()){ - TextItem* fi = scene()->findChild(followTo); - if (fi && initFollower(followTo)){ - notify("followTo",oldValue,followTo); - } else { - m_followTo = ""; + TextItem* fi = scene()->findChild(oldValue); + if (fi) fi->clearFollower(); + fi = scene()->findChild(followTo); + if (fi && fi != this){ + if (initFollower(followTo)){ + notify("followTo",oldValue,followTo); + } else { + m_followTo = ""; + QMessageBox::critical( + 0, + tr("Error"), + tr("TextItem \" %1 \" already has folower \" %2 \" ") + .arg(fi->objectName()) + .arg(fi->follower()->objectName()) + ); + notify("followTo",followTo,""); + } + } else if (m_followTo != ""){ QMessageBox::critical( 0, tr("Error"), - tr("TextItem \" %1 \" already has folower \" %2 \" ") - .arg(fi->objectName()) - .arg(fi->follower()->objectName()) + tr("TextItem \" %1 \" not found !") + .arg(m_followTo) ); notify("followTo",followTo,""); } @@ -491,6 +506,11 @@ void TextItem::setFollower(TextItem *follower) } } +void TextItem::clearFollower() +{ + m_follower = 0; +} + bool TextItem::hasFollower() { return m_follower != 0; diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index 535bcd4..065724e 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -147,6 +147,7 @@ public: QString followTo() const; void setFollowTo(const QString &followTo); void setFollower(TextItem* follower); + void clearFollower(); bool hasFollower(); TextItem* follower(){ return m_follower;} bool initFollower(QString follower); From 081b4224684756b26d9fad24390b2be169221cc6 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 24 Dec 2016 14:01:35 +0300 Subject: [PATCH 032/136] COUNT function can be called with only one databand argument --- include/lrglobal.h | 11 +++++++++-- limereport/lrglobal.h | 11 +++++++++-- limereport/lrgroupfunctions.cpp | 5 ++++- limereport/lrreportrender.cpp | 2 +- limereport/lrscriptenginemanager.cpp | 13 +++++++++++-- 5 files changed, 34 insertions(+), 8 deletions(-) diff --git a/include/lrglobal.h b/include/lrglobal.h index e64cd43..3a01927 100644 --- a/include/lrglobal.h +++ b/include/lrglobal.h @@ -77,9 +77,16 @@ namespace Const{ const QString FIELD_RX = "\\$D\\s*\\{\\s*([^{}]*)\\s*\\}"; const QString VARIABLE_RX = "\\$V\\s*\\{\\s*([^{}]*)\\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*\\)"; - const int DATASOURCE_INDEX = 6; + + //const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(((?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))(\\w+\\.?\\w+)((?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,\\s*\\\"(\\w+)\\\"\\s*\\)"; + //const int DATASOURCE_INDEX = 6; + //const int VALUE_INDEX = 2; + + const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:((?:(?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))((?:\\w+\\.?\\w+)|(?:\\w+))(?:(?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,)|(?:))\\s*\\\"(\\w+)\\\"\\s*\\)"; + const int DATASOURCE_INDEX = 4; const int VALUE_INDEX = 2; + const int EXPRESSION_ARGUMENT_INDEX = 3; + const QString GROUP_FUNCTION_RX = "(%1\\s*"+GROUP_FUNCTION_PARAM_RX+")"; const QString GROUP_FUNCTION_NAME_RX = "%1\\s*\\((.*[^\\)])\\)"; const int SCENE_MARGIN = 50; diff --git a/limereport/lrglobal.h b/limereport/lrglobal.h index e64cd43..3a01927 100644 --- a/limereport/lrglobal.h +++ b/limereport/lrglobal.h @@ -77,9 +77,16 @@ namespace Const{ const QString FIELD_RX = "\\$D\\s*\\{\\s*([^{}]*)\\s*\\}"; const QString VARIABLE_RX = "\\$V\\s*\\{\\s*([^{}]*)\\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*\\)"; - const int DATASOURCE_INDEX = 6; + + //const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(((?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))(\\w+\\.?\\w+)((?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,\\s*\\\"(\\w+)\\\"\\s*\\)"; + //const int DATASOURCE_INDEX = 6; + //const int VALUE_INDEX = 2; + + const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:((?:(?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))((?:\\w+\\.?\\w+)|(?:\\w+))(?:(?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,)|(?:))\\s*\\\"(\\w+)\\\"\\s*\\)"; + const int DATASOURCE_INDEX = 4; const int VALUE_INDEX = 2; + const int EXPRESSION_ARGUMENT_INDEX = 3; + const QString GROUP_FUNCTION_RX = "(%1\\s*"+GROUP_FUNCTION_PARAM_RX+")"; const QString GROUP_FUNCTION_NAME_RX = "%1\\s*\\((.*[^\\)])\\)"; const int SCENE_MARGIN = 50; diff --git a/limereport/lrgroupfunctions.cpp b/limereport/lrgroupfunctions.cpp index 821b969..d21b4f8 100644 --- a/limereport/lrgroupfunctions.cpp +++ b/limereport/lrgroupfunctions.cpp @@ -57,7 +57,10 @@ void GroupFunction::slotBandRendered(BandDesignIntf *band) ContentItemDesignIntf* item = dynamic_cast(band->childByName(m_data)); if (item) m_values.push_back(item->content()); - else setInvalid(tr("Item \"%1\" not found").arg(m_data)); + else if (m_name.compare("COUNT",Qt::CaseInsensitive) == 0) { + m_values.push_back(1); + } else setInvalid(tr("Item \"%1\" not found").arg(m_data)); + break; } default: diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index e768e10..4158f49 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -368,7 +368,7 @@ void ReportRender::replaceGroupsFunction(BandDesignIntf *band) if (rx.indexIn(content)>=0){ int pos = 0; while ( (pos = rx.indexIn(content,pos))!= -1 ){ - content.replace(rx.capturedTexts().at(0),QString("%1(%2,%3)").arg(functionName).arg('"'+rx.cap(4)+'"').arg('"'+band->objectName()+'"')); + content.replace(rx.capturedTexts().at(0),QString("%1(%2,%3)").arg(functionName).arg('"'+rx.cap(Const::EXPRESSION_ARGUMENT_INDEX)+'"').arg('"'+band->objectName()+'"')); pos += rx.matchedLength(); } contentItem->setContent(content); diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index d24de0e..aeca592 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -302,8 +302,17 @@ QScriptValue callGroupFunction(const QString& functionName, QScriptContext* pcon ScriptEngineManager* sm = qscriptvalue_cast(pcontext->callee().data()); DataSourceManager* dm = sm->dataManager(); - QString expression = pcontext->argument(0).toString(); - QString band = pcontext->argument(1).toString(); + QString expression; + QString band; + + if (functionName.compare("COUNT",Qt::CaseInsensitive) == 0 && pcontext->argumentCount()==1){ + expression = " "; + band = pcontext->argument(0).toString(); + } else { + expression = pcontext->argument(0).toString(); + band = pcontext->argument(1).toString(); + } + QScriptValue res; GroupFunction* gf = dm->groupFunction(functionName,expression,band); if (gf){ From f6134008392f3f1708d89a4e82e67a1874af8b24 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 5 Jan 2017 14:39:20 +0300 Subject: [PATCH 033/136] Fix: #57 Callback DataSource initialized before signals/slots are connected --- limereport/lrreportengine.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index fca8f82..3cfa6d3 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -609,9 +609,12 @@ ReportPages ReportEnginePrivate::renderToPages() { if (m_reportRendering) return ReportPages(); m_reportRender = ReportRender::Ptr(new ReportRender); + dataManager()->clearErrors(); dataManager()->connectAllDatabases(); dataManager()->setDesignTime(false); + dataManager()->updateDatasourceModel(); + connect(m_reportRender.data(),SIGNAL(pageRendered(int)), this, SIGNAL(renderPageFinished(int))); if (m_pages.count()){ From 2af7c5c7ddd109d3b9afbe3774f1001bb4e6f9ab Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 5 Jan 2017 14:46:06 +0300 Subject: [PATCH 034/136] Fix: #57 Callback DataSource initialized before signals/slots are connected --- limereport/lrreportengine.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index a7eaa36..62d75bb 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -664,9 +664,12 @@ ReportPages ReportEnginePrivate::renderToPages() { if (m_reportRendering) return ReportPages(); m_reportRender = ReportRender::Ptr(new ReportRender); + dataManager()->clearErrors(); dataManager()->connectAllDatabases(); dataManager()->setDesignTime(false); + dataManager()->updateDatasourceModel(); + connect(m_reportRender.data(),SIGNAL(pageRendered(int)), this, SIGNAL(renderPageFinished(int))); if (m_pages.count()){ From 6e895e9423f533884d28683dc857ce900517c384 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 9 Jan 2017 18:29:56 +0300 Subject: [PATCH 035/136] "Datasource not found" suppressed for empty data source at subdetail band --- limereport/lrreportrender.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 4158f49..2b061d8 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -638,7 +638,9 @@ void ReportRender::renderChildFooter(BandDesignIntf *parent, BandPrintMode print void ReportRender::renderChildBands(BandDesignIntf *parentBand) { foreach(BandDesignIntf* band,parentBand->childrenByType(BandDesignIntf::SubDetailBand)){ - IDataSource* ds = m_datasources->dataSource(band->datasourceName()); + IDataSource* ds = 0; + if (!band->datasourceName().isEmpty()) + ds = m_datasources->dataSource(band->datasourceName()); if (ds) ds->first(); renderChildHeader(band,PrintAlwaysPrintable); renderDataBand(band); From e327c64fedc3b5b2daf46c7ef3f9b2c1df88872d Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 20 Jan 2017 23:07:54 +0300 Subject: [PATCH 036/136] textIndent property has been added to TextItem --- limereport/items/lrtextitem.cpp | 18 +++++++++++++++++- limereport/items/lrtextitem.h | 5 +++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 2152143..32f868a 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -58,7 +58,7 @@ namespace LimeReport{ TextItem::TextItem(QObject *owner, QGraphicsItem *parent) : ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0), m_trimValue(true), m_allowHTML(false), - m_allowHTMLInFields(false), m_followTo(""), m_follower(0) + m_allowHTMLInFields(false), m_followTo(""), m_follower(0), m_textIndent(0) { PageItemDesignIntf* pageItem = dynamic_cast(parent); BaseDesignIntf* parentItem = dynamic_cast(parent); @@ -447,6 +447,7 @@ TextItem::TextPtr TextItem::textDocument() { QTextCursor tc = QTextCursor(block); QTextBlockFormat fmt = block.blockFormat(); + fmt.setTextIndent(m_textIndent); if(fmt.lineHeight() != m_lineSpacing) { fmt.setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight); @@ -458,6 +459,21 @@ TextItem::TextPtr TextItem::textDocument() } +qreal TextItem::textIndent() const +{ + return m_textIndent; +} + +void TextItem::setTextIndent(const qreal &textIndent) +{ + if (m_textIndent != textIndent){ + qreal oldValue = m_textIndent; + m_textIndent = textIndent; + update(); + notify("textIndent", oldValue, textIndent); + } +} + QString TextItem::followTo() const { return m_followTo; diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index 065724e..fc5f062 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -69,6 +69,7 @@ class TextItem : public LimeReport::ContentItemDesignIntf, IPageInit { Q_PROPERTY(ValueType valueType READ valueType WRITE setValueType) Q_PROPERTY(QString followTo READ followTo WRITE setFollowTo) Q_PROPERTY(BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle) + Q_PROPERTY(qreal textIndent READ textIndent WRITE setTextIndent) public: enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength}; @@ -157,6 +158,9 @@ public: typedef QSharedPointer TextPtr; + qreal textIndent() const; + void setTextIndent(const qreal &textIndent); + protected: void updateLayout(); bool isNeedExpandContent() const; @@ -198,6 +202,7 @@ private: ValueType m_valueType; QString m_followTo; TextItem* m_follower; + qreal m_textIndent; }; } From 0261a11b30428c63c8da9470a40175e0dd2fcfac Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 20 Jan 2017 23:26:18 +0300 Subject: [PATCH 037/136] textLayoutDirection property has been added to TextItem --- limereport/items/lrtextitem.cpp | 56 ++++++++++++++++++++++++--------- limereport/items/lrtextitem.h | 21 +++++++------ 2 files changed, 53 insertions(+), 24 deletions(-) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 32f868a..8328079 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -58,7 +58,7 @@ namespace LimeReport{ TextItem::TextItem(QObject *owner, QGraphicsItem *parent) : ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0), m_trimValue(true), m_allowHTML(false), - m_allowHTMLInFields(false), m_followTo(""), m_follower(0), m_textIndent(0) + m_allowHTMLInFields(false), m_followTo(""), m_follower(0), m_textIndent(0), m_textLayoutDirection(Qt::LayoutDirectionAuto) { PageItemDesignIntf* pageItem = dynamic_cast(parent); BaseDesignIntf* parentItem = dynamic_cast(parent); @@ -92,7 +92,7 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q setupPainter(painter); prepareRect(painter,style,widget); - QSizeF tmpSize = rect().size()-m_textSize; + QSizeF tmpSize = rect().size()-text->size(); if (!painter->clipRegion().isEmpty()){ QRegion clipReg=painter->clipRegion().xored(painter->clipRegion().subtracted(rect().toRect())); @@ -228,12 +228,13 @@ void TextItem::setContent(const QString &value) else m_strText=value; - if (itemMode() == DesignMode){ - initTextSizes(); - } +// if (itemMode() == DesignMode && (autoHeight())){ +// initTextSizes(); +// } if (!isLoading()){ - initTextSizes(); + if (autoHeight() || autoWidth()) + initTextSizes(); update(rect()); notify("content",oldValue,value); } @@ -244,7 +245,7 @@ void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, i { if (isNeedExpandContent()) expandContent(dataManager, pass); - if (!isLoading()) + if (!isLoading() && (autoHeight() || autoWidth()) ) initTextSizes(); if (m_textSize.width()>width() && ((m_autoWidth==MaxWordLength)||(m_autoWidth==MaxStringLength))){ @@ -296,7 +297,7 @@ QString TextItem::replaceReturns(QString text) return result; } -void TextItem::setTextFont(TextPtr text, const QFont& value) { +void TextItem::setTextFont(TextPtr text, const QFont& value) const { text->setDefaultFont(value); if ((m_angle==Angle0)||(m_angle==Angle180)){ text->setTextWidth(rect().width()-fakeMarginSize()*2); @@ -305,7 +306,7 @@ void TextItem::setTextFont(TextPtr text, const QFont& value) { } } -void TextItem::adaptFontSize(TextPtr text) { +void TextItem::adaptFontSize(TextPtr text) const{ QFont _font = transformToSceneFont(font()); do{ setTextFont(text,_font); @@ -337,13 +338,14 @@ void TextItem::setLineSpacing(int value) { int oldValue = m_lineSpacing; m_lineSpacing = value; - initTextSizes(); +// if (autoHeight()) +// initTextSizes(); update(); notify("lineSpacing",oldValue,value); } -void TextItem::initTextSizes() +void TextItem::initTextSizes() const { TextPtr text = textDocument(); m_textSize= text->size(); @@ -412,7 +414,7 @@ QString TextItem::formatFieldValue() } } -TextItem::TextPtr TextItem::textDocument() +TextItem::TextPtr TextItem::textDocument() const { TextPtr text(new QTextDocument); @@ -423,6 +425,8 @@ TextItem::TextPtr TextItem::textDocument() QTextOption to; to.setAlignment(m_alignment); + to.setTextDirection(m_textLayoutDirection); + //to.setTextDirection(QApplication::layoutDirection()); if (m_autoWidth!=MaxStringLength) if (m_adaptFontToSize && (!(m_autoHeight || m_autoWidth))) @@ -474,6 +478,22 @@ void TextItem::setTextIndent(const qreal &textIndent) } } +Qt::LayoutDirection TextItem::textLayoutDirection() const +{ + return m_textLayoutDirection; +} + +void TextItem::setTextLayoutDirection(const Qt::LayoutDirection &textLayoutDirection) +{ + if (m_textLayoutDirection != textLayoutDirection){ + int oldValue = int(m_textLayoutDirection); + m_textLayoutDirection = textLayoutDirection; + update(); + notify("textLayoutDirection",oldValue,int(textLayoutDirection)); + } +} + + QString TextItem::followTo() const { return m_followTo; @@ -624,6 +644,11 @@ void TextItem::geometryChangedEvent(QRectF , QRectF) bool TextItem::isNeedUpdateSize(RenderPass pass) const { Q_UNUSED(pass) + + if (autoHeight() && autoWidth()){ + initTextSizes(); + } + bool res = (m_textSize.height()>geometry().height()&&autoHeight()) || (m_textSize.width()>geometry().width()&&autoWidth()) || m_follower || @@ -795,9 +820,10 @@ BaseDesignIntf *TextItem::cloneEmpty(int height, QObject *owner, QGraphicsItem * void TextItem::objectLoadFinished() { ItemDesignIntf::objectLoadFinished(); - if (itemMode() == DesignMode || !isNeedExpandContent()){ - initTextSizes(); - } +// if (itemMode() == DesignMode || !isNeedExpandContent()){ +// if (autoHeight() && autoWidth()) +// initTextSizes(); +// } } void TextItem::setTextItemFont(QFont value) diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index fc5f062..068a59d 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -70,6 +70,7 @@ class TextItem : public LimeReport::ContentItemDesignIntf, IPageInit { Q_PROPERTY(QString followTo READ followTo WRITE setFollowTo) Q_PROPERTY(BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle) Q_PROPERTY(qreal textIndent READ textIndent WRITE setTextIndent) + Q_PROPERTY(Qt::LayoutDirection textLayoutDirection READ textLayoutDirection WRITE setTextLayoutDirection) public: enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength}; @@ -160,7 +161,9 @@ public: qreal textIndent() const; void setTextIndent(const qreal &textIndent); - + Qt::LayoutDirection textLayoutDirection() const; + void setTextLayoutDirection(const Qt::LayoutDirection &textLayoutDirection); + protected: void updateLayout(); bool isNeedExpandContent() const; @@ -170,24 +173,23 @@ protected: QString getTextPart(int height, int skipHeight); void restoreLinksEvent(); private: - void initTextSizes(); - void setTextFont(TextPtr text, const QFont &value); - void adaptFontSize(TextPtr text); + void initTextSizes() const; + void setTextFont(TextPtr text, const QFont &value) const; + void adaptFontSize(TextPtr text) const; QString formatDateTime(const QDateTime &value); QString formatNumber(const double value); QString formatFieldValue(); - TextPtr textDocument(); + TextPtr textDocument() const; private: QString m_strText; - //QTextLayout m_layout; - //QTextDocument* m_text; + //QTextDocument* m_text; Qt::Alignment m_alignment; bool m_autoHeight; AutoWidth m_autoWidth; - QSizeF m_textSize; - qreal m_firstLineSize; + QSizeF mutable m_textSize; + qreal mutable m_firstLineSize; AngleType m_angle; int m_foregroundOpacity; bool m_underlines; @@ -203,6 +205,7 @@ private: QString m_followTo; TextItem* m_follower; qreal m_textIndent; + Qt::LayoutDirection m_textLayoutDirection; }; } From f927f3a83c3410545635433fd231aa84e37f858f Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 23 Jan 2017 11:53:07 +0300 Subject: [PATCH 038/136] followTo has been fixed --- limereport/items/lrtextitem.cpp | 8 ++++---- limereport/items/lrtextitem.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 8328079..d8d77cd 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -233,7 +233,7 @@ void TextItem::setContent(const QString &value) // } if (!isLoading()){ - if (autoHeight() || autoWidth()) + if (autoHeight() || autoWidth() || hasFollower()) initTextSizes(); update(rect()); notify("content",oldValue,value); @@ -245,7 +245,7 @@ void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, i { if (isNeedExpandContent()) expandContent(dataManager, pass); - if (!isLoading() && (autoHeight() || autoWidth()) ) + if (!isLoading() && (autoHeight() || autoWidth() || hasFollower()) ) initTextSizes(); if (m_textSize.width()>width() && ((m_autoWidth==MaxWordLength)||(m_autoWidth==MaxStringLength))){ @@ -547,7 +547,7 @@ void TextItem::clearFollower() m_follower = 0; } -bool TextItem::hasFollower() +bool TextItem::hasFollower() const { return m_follower != 0; } @@ -645,7 +645,7 @@ bool TextItem::isNeedUpdateSize(RenderPass pass) const { Q_UNUSED(pass) - if (autoHeight() && autoWidth()){ + if (autoHeight() && autoWidth() || hasFollower()){ initTextSizes(); } diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index 068a59d..ac9b5b6 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -150,8 +150,8 @@ public: void setFollowTo(const QString &followTo); void setFollower(TextItem* follower); void clearFollower(); - bool hasFollower(); - TextItem* follower(){ return m_follower;} + bool hasFollower() const; + TextItem* follower() const { return m_follower;} bool initFollower(QString follower); // IPageInit interface From 887710d728db64e3093b1b3587b5e379336d81ba Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 23 Jan 2017 12:11:48 +0300 Subject: [PATCH 039/136] ImageItem design time label has been fixed --- limereport/items/lrimageitem.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/limereport/items/lrimageitem.cpp b/limereport/items/lrimageitem.cpp index 38e4441..ede6a1f 100644 --- a/limereport/items/lrimageitem.cpp +++ b/limereport/items/lrimageitem.cpp @@ -241,6 +241,7 @@ void ImageItem::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option if (img.isNull() && itemMode()==DesignMode){ QString text; ppainter->setFont(transformToSceneFont(QFont("Arial",10))); + ppainter->setPen(Qt::black); if (!datasource().isEmpty() && !field().isEmpty()) text = datasource()+"."+field(); else text = tr("Image"); From afc8ad77b26379cc46b5234b75f2733cfa97e9db Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 28 Jan 2017 02:20:15 +0300 Subject: [PATCH 040/136] Group functions have been refactored. From now they can use script expression in value parameter --- include/lrglobal.cpp | 16 +++ include/lrglobal.h | 14 ++- limereport/lrbasedesignintf.cpp | 144 ++--------------------- limereport/lrbasedesignintf.h | 10 +- limereport/lrdatasourcemanager.cpp | 33 ++++++ limereport/lrdatasourcemanager.h | 13 +++ limereport/lrglobal.cpp | 16 +++ limereport/lrglobal.h | 14 ++- limereport/lrgroupfunctions.cpp | 64 ++++++++--- limereport/lrgroupfunctions.h | 2 +- limereport/lrreportengine.cpp | 3 +- limereport/lrreportrender.cpp | 6 +- limereport/lrscriptenginemanager.cpp | 165 ++++++++++++++++++++++++++- limereport/lrscriptenginemanager.h | 5 + 14 files changed, 333 insertions(+), 172 deletions(-) diff --git a/include/lrglobal.cpp b/include/lrglobal.cpp index 47b31f0..5b2cdff 100644 --- a/include/lrglobal.cpp +++ b/include/lrglobal.cpp @@ -51,4 +51,20 @@ void ReportSettings::setSuppressAbsentFieldsAndVarsWarnings(bool suppressAbsentF m_suppressAbsentFieldsAndVarsWarnings = suppressAbsentFieldsAndVarsWarnings; } +QString escapeSimbols(const QString &value) +{ + QString result = value; + result.replace("\"","\\\""); + result.replace('\n',"\\n"); + return result; +} + +QString replaceHTMLSymbols(const QString &value) +{ + QString result = value; + result.replace("<","<"); + result.replace(">",">"); + return result; +} + } //namespace LimeReport diff --git a/include/lrglobal.h b/include/lrglobal.h index 3a01927..3b8aa7d 100644 --- a/include/lrglobal.h +++ b/include/lrglobal.h @@ -82,16 +82,21 @@ namespace Const{ //const int DATASOURCE_INDEX = 6; //const int VALUE_INDEX = 2; - const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:((?:(?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))((?:\\w+\\.?\\w+)|(?:\\w+))(?:(?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,)|(?:))\\s*\\\"(\\w+)\\\"\\s*\\)"; - const int DATASOURCE_INDEX = 4; - const int VALUE_INDEX = 2; - const int EXPRESSION_ARGUMENT_INDEX = 3; + //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 int DATASOURCE_INDEX = 3;//4; + const int VALUE_INDEX = 2; //2; + const int EXPRESSION_ARGUMENT_INDEX = 1;//3; const QString GROUP_FUNCTION_RX = "(%1\\s*"+GROUP_FUNCTION_PARAM_RX+")"; const QString GROUP_FUNCTION_NAME_RX = "%1\\s*\\((.*[^\\)])\\)"; const int SCENE_MARGIN = 50; } QString extractClassName(QString className); + QString escapeSimbols(const QString& value); + QString replaceHTMLSymbols(const QString &value); + + enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols}; enum RenderPass {FirstPass, SecondPass}; enum ArrangeType {AsNeeded, Force}; enum PreviewHint{ShowAllPreviewBars = 0, @@ -100,6 +105,7 @@ namespace Const{ HidePreviewStatusBar = 4, HideAllPreviewBar = 7, PreviewBarsUserSetting = 8}; + Q_DECLARE_FLAGS(PreviewHints, PreviewHint) Q_FLAGS(PreviewHints) diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 77967f4..f0f7e2b 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -34,7 +34,6 @@ #include "lrreportdesignwidget.h" #include "qgraphicsitem.h" #include "lrdesignelementsfactory.h" - #include "lrhorizontallayout.h" #include @@ -241,150 +240,29 @@ QFont BaseDesignIntf::transformToSceneFont(const QFont& value) const return f; } -QString BaseDesignIntf::escapeSimbols(const QString &value) -{ - QString result = value; - result.replace("\"","\\\""); - result.replace('\n',"\\n"); - return result; -} - -QString BaseDesignIntf::replaceHTMLSymbols(const QString &value) -{ - QString result = value; - result.replace("<","<"); - result.replace(">",">"); - return result; -} - QString BaseDesignIntf::expandDataFields(QString context, ExpandType expandType, DataSourceManager* dataManager) { - QRegExp rx(Const::FIELD_RX); - - if (context.contains(rx)){ - while ((rx.indexIn(context))!=-1){ - QString field=rx.cap(1); - - if (dataManager->containsField(field)) { - QString fieldValue; - m_varValue = dataManager->fieldData(field); - if (expandType == EscapeSymbols) { - if (dataManager->fieldData(field).isNull()) { - fieldValue="\"\""; - } else { - fieldValue = escapeSimbols(m_varValue.toString()); - switch (dataManager->fieldData(field).type()) { - case QVariant::Char: - case QVariant::String: - case QVariant::StringList: - case QVariant::Date: - case QVariant::DateTime: - fieldValue = "\""+fieldValue+"\""; - break; - default: - break; - } - } - } else { - if (expandType == ReplaceHTMLSymbols) - fieldValue = replaceHTMLSymbols(m_varValue.toString()); - else fieldValue = m_varValue.toString(); - } - - context.replace(rx.cap(0),fieldValue); - - } else { - QString error = QString("Field %1 not found in %2 !!! ").arg(field).arg(this->objectName()); - dataManager->putError(error); - if (!reportSettings() || !reportSettings()->suppressAbsentFieldsAndVarsWarnings()) - context.replace(rx.cap(0),error); - else - context.replace(rx.cap(0),""); - } - } - } - - return context; + ScriptEngineManager& sm = ScriptEngineManager::instance(); + if (sm.dataManager() != dataManager) sm.setDataManager(dataManager); + return sm.expandDataFields(context, expandType, m_varValue, this); } QString BaseDesignIntf::expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager* dataManager) { - QRegExp rx(Const::VARIABLE_RX); - if (context.contains(rx)){ - int pos = 0; - while ((pos = rx.indexIn(context,pos))!=-1){ - QString variable=rx.cap(1); - pos += rx.matchedLength(); - if (dataManager->containsVariable(variable) ){ - try { - if (pass==dataManager->variablePass(variable)){ - m_varValue = dataManager->variable(variable); - switch (expandType){ - case EscapeSymbols: - context.replace(rx.cap(0),escapeSimbols(m_varValue.toString())); - break; - case NoEscapeSymbols: - context.replace(rx.cap(0),m_varValue.toString()); - break; - case ReplaceHTMLSymbols: - context.replace(rx.cap(0),replaceHTMLSymbols(m_varValue.toString())); - break; - } - pos=0; - } - } catch (ReportError e){ - dataManager->putError(e.what()); - if (!reportSettings() || reportSettings()->suppressAbsentFieldsAndVarsWarnings()) - context.replace(rx.cap(0),e.what()); - else - context.replace(rx.cap(0),""); - } - } else { - QString error; - error = tr("Variable %1 not found").arg(variable); - dataManager->putError(error); - if (!reportSettings() || reportSettings()->suppressAbsentFieldsAndVarsWarnings()) - context.replace(rx.cap(0),error); - else - context.replace(rx.cap(0),""); - } - } - } - return context; + + ScriptEngineManager& sm = ScriptEngineManager::instance(); + if (sm.dataManager() != dataManager) sm.setDataManager(dataManager); + return sm.expandUserVariables(context, pass, expandType, m_varValue); + } QString BaseDesignIntf::expandScripts(QString context, DataSourceManager* dataManager) { - QRegExp rx(Const::SCRIPT_RX); - if (context.contains(rx)){ - ScriptEngineManager::instance().setDataManager(dataManager); - QScriptEngine* se = ScriptEngineManager::instance().scriptEngine(); + ScriptEngineManager& sm = ScriptEngineManager::instance(); + if (sm.dataManager() != dataManager) sm.setDataManager(dataManager); + return sm.expandScripts(context,m_varValue,this); - QScriptValue svThis = se->globalObject().property("THIS"); - if (svThis.isValid()){ - se->newQObject(svThis, this); - } else { - svThis = se->newQObject(this); - se->globalObject().setProperty("THIS",svThis); - } - - ScriptExtractor scriptExtractor(context); - if (scriptExtractor.parse()){ - for(int i=0; ievaluate(scriptBody); - if (!se->hasUncaughtException()) { - m_varValue = value.toVariant(); - context.replace(scriptExtractor.scriptAt(i),value.toString()); - } else { - context.replace(scriptExtractor.scriptAt(i),se->uncaughtException().toString()); - } - } - } - } - return context; } void BaseDesignIntf::setupPainter(QPainter *painter) const diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index d6b32f6..253da8d 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -131,7 +131,7 @@ public: }; enum ObjectState {ObjectLoading, ObjectLoaded, ObjectCreated}; enum ItemAlign {LeftItemAlign,RightItemAlign,CenterItemAlign,ParentWidthItemAlign,DesignedItemAlign}; - enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols}; +// enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols}; Q_DECLARE_FLAGS(BorderLines, BorderSide) Q_DECLARE_FLAGS(ItemMode,ItemModes) friend class SelectionMarker; @@ -327,11 +327,9 @@ protected: virtual bool drawDesignBorders() const {return true;} virtual QColor selectionMarkerColor(){ return Const::SELECTION_COLOR;} - QString escapeSimbols(const QString& value); - QString replaceHTMLSymbols(const QString& value); - virtual QString expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager *dataManager); - virtual QString expandDataFields(QString context, ExpandType expandType, DataSourceManager *dataManager); - virtual QString expandScripts(QString context, DataSourceManager *dataManager); + QString expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager *dataManager); + QString expandDataFields(QString context, ExpandType expandType, DataSourceManager *dataManager); + QString expandScripts(QString context, DataSourceManager *dataManager); QVariant m_varValue; diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index 42ec024..bab241d 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -238,6 +238,29 @@ void DataSourceManager::setDefaultDatabasePath(const QString &defaultDatabasePat { m_defaultDatabasePath = defaultDatabasePath; } + +QString DataSourceManager::putGroupFunctionsExpressions(QString expression) +{ + if (m_groupFunctionsExpressionsMap.contains(expression)){ + return QString::number(m_groupFunctionsExpressionsMap.value(expression)); + } else { + m_groupFunctionsExpressions.append(expression); + m_groupFunctionsExpressionsMap.insert(expression, m_groupFunctionsExpressions.size()-1); + return QString::number(m_groupFunctionsExpressions.size()-1); + } +} + +void DataSourceManager::clearGroupFuntionsExpressions() +{ + m_groupFunctionsExpressionsMap.clear(); + m_groupFunctionsExpressions.clear(); +} + +QString DataSourceManager::getExpression(QString index) +{ + return m_groupFunctionsExpressions.at(index.toInt()); +} + bool DataSourceManager::designTime() const { return m_designTime; @@ -702,6 +725,16 @@ bool DataSourceManager::initAndOpenDB(QSqlDatabase& db, ConnectionDesc& connecti return connected; } +ReportSettings *DataSourceManager::reportSettings() const +{ + return m_reportSettings; +} + +void DataSourceManager::setReportSettings(ReportSettings *reportSettings) +{ + m_reportSettings = reportSettings; +} + bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) { diff --git a/limereport/lrdatasourcemanager.h b/limereport/lrdatasourcemanager.h index a6043f0..7670b2e 100644 --- a/limereport/lrdatasourcemanager.h +++ b/limereport/lrdatasourcemanager.h @@ -192,6 +192,13 @@ public: QString defaultDatabasePath() const; void setDefaultDatabasePath(const QString &defaultDatabasePath); + QString putGroupFunctionsExpressions(QString expression); + void clearGroupFuntionsExpressions(); + QString getExpression(QString index); + + ReportSettings *reportSettings() const; + void setReportSettings(ReportSettings *reportSettings); + signals: void loadCollectionFinished(const QString& collectionName); void cleared(); @@ -240,7 +247,13 @@ private: bool m_designTime; bool m_needUpdate; QString m_defaultDatabasePath; + ReportSettings* m_reportSettings; + QHash m_groupFunctionsExpressionsMap; + QVector m_groupFunctionsExpressions; + + }; } #endif // LRDATASOURCEMANAGER_H + diff --git a/limereport/lrglobal.cpp b/limereport/lrglobal.cpp index 47b31f0..5b2cdff 100644 --- a/limereport/lrglobal.cpp +++ b/limereport/lrglobal.cpp @@ -51,4 +51,20 @@ void ReportSettings::setSuppressAbsentFieldsAndVarsWarnings(bool suppressAbsentF m_suppressAbsentFieldsAndVarsWarnings = suppressAbsentFieldsAndVarsWarnings; } +QString escapeSimbols(const QString &value) +{ + QString result = value; + result.replace("\"","\\\""); + result.replace('\n',"\\n"); + return result; +} + +QString replaceHTMLSymbols(const QString &value) +{ + QString result = value; + result.replace("<","<"); + result.replace(">",">"); + return result; +} + } //namespace LimeReport diff --git a/limereport/lrglobal.h b/limereport/lrglobal.h index 3a01927..3b8aa7d 100644 --- a/limereport/lrglobal.h +++ b/limereport/lrglobal.h @@ -82,16 +82,21 @@ namespace Const{ //const int DATASOURCE_INDEX = 6; //const int VALUE_INDEX = 2; - const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:((?:(?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))((?:\\w+\\.?\\w+)|(?:\\w+))(?:(?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,)|(?:))\\s*\\\"(\\w+)\\\"\\s*\\)"; - const int DATASOURCE_INDEX = 4; - const int VALUE_INDEX = 2; - const int EXPRESSION_ARGUMENT_INDEX = 3; + //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 int DATASOURCE_INDEX = 3;//4; + const int VALUE_INDEX = 2; //2; + const int EXPRESSION_ARGUMENT_INDEX = 1;//3; const QString GROUP_FUNCTION_RX = "(%1\\s*"+GROUP_FUNCTION_PARAM_RX+")"; const QString GROUP_FUNCTION_NAME_RX = "%1\\s*\\((.*[^\\)])\\)"; const int SCENE_MARGIN = 50; } QString extractClassName(QString className); + QString escapeSimbols(const QString& value); + QString replaceHTMLSymbols(const QString &value); + + enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols}; enum RenderPass {FirstPass, SecondPass}; enum ArrangeType {AsNeeded, Force}; enum PreviewHint{ShowAllPreviewBars = 0, @@ -100,6 +105,7 @@ namespace Const{ HidePreviewStatusBar = 4, HideAllPreviewBar = 7, PreviewBarsUserSetting = 8}; + Q_DECLARE_FLAGS(PreviewHints, PreviewHint) Q_FLAGS(PreviewHints) diff --git a/limereport/lrgroupfunctions.cpp b/limereport/lrgroupfunctions.cpp index d21b4f8..c265dfc 100644 --- a/limereport/lrgroupfunctions.cpp +++ b/limereport/lrgroupfunctions.cpp @@ -31,6 +31,7 @@ #include "lrdatasourcemanager.h" #include "lrbanddesignintf.h" #include "lritemdesignintf.h" +#include "lrscriptenginemanager.h" #include @@ -38,23 +39,45 @@ namespace LimeReport { void GroupFunction::slotBandRendered(BandDesignIntf *band) { + ScriptEngineManager& sm = ScriptEngineManager::instance(); + + QRegExp rxField(Const::FIELD_RX); + QRegExp rxVar(Const::VARIABLE_RX); + switch (m_dataType){ case Field: - if (m_dataManager->containsField(m_data)){ - m_values.push_back(m_dataManager->fieldData(m_data)); - } else { - setInvalid(tr("Field \"%1\" not found").arg(m_data)); + if (rxField.indexIn(m_data) != -1){ + QString field = rxField.cap(1); + if (m_dataManager->containsField(field)){ + m_values.push_back(m_dataManager->fieldData(field)); + } else { + setInvalid(tr("Field \"%1\" not found").arg(m_data)); + } } break; case Variable: - if (m_dataManager->containsVariable(m_data)){ - m_values.push_back(m_dataManager->variable(m_data)); - } else { - setInvalid(tr("Variable \"%1\" not found").arg(m_data)); + if (rxVar.indexIn(m_data) != -1){ + QString var = rxVar.cap(1); + if (m_dataManager->containsVariable(var)){ + m_values.push_back(m_dataManager->variable(var)); + } else { + setInvalid(tr("Variable \"%1\" not found").arg(m_data)); + } } break; + case Script: + { + QVariant value = sm.evaluateScript(m_data); + if (value.isValid()){ + m_values.push_back(value); + } else { + setInvalid(tr("Wrong script syntax \"%1\" ").arg(m_data)); + } + break; + } case ContentItem:{ - ContentItemDesignIntf* item = dynamic_cast(band->childByName(m_data)); + QString itemName = m_data; + ContentItemDesignIntf* item = dynamic_cast(band->childByName(itemName.remove('"'))); if (item) m_values.push_back(item->content()); else if (m_name.compare("COUNT",Qt::CaseInsensitive) == 0) { @@ -91,24 +114,27 @@ QVariant GroupFunction::multiplication(QVariant value1, QVariant value2) GroupFunction::GroupFunction(const QString &expression, const QString &dataBandName, DataSourceManager* dataManager) :m_dataBandName(dataBandName), m_dataManager(dataManager),m_isValid(true), m_errorMessage("") { + m_data = expression; QRegExp rxField(Const::FIELD_RX,Qt::CaseInsensitive); - if (rxField.indexIn(expression)>=0){ - m_dataType=Field; - m_data = rxField.cap(1); + QRegExp rxVariable(Const::VARIABLE_RX,Qt::CaseInsensitive); + QRegExp rxScript(Const::SCRIPT_RX,Qt::CaseInsensitive); + + if (rxScript.indexIn(expression) != -1){ + m_dataType = Script; return; } - QRegExp rxVariable(Const::VARIABLE_RX,Qt::CaseInsensitive); - if (rxVariable.indexIn(expression)>=0){ - m_dataType=Variable; - m_data = rxVariable.cap(1); + if (rxField.indexIn(expression) != -1){ + m_dataType=Field; + return; + } + + if (rxVariable.indexIn(expression) != -1){ + m_dataType = Variable; return; } m_dataType = ContentItem; - m_data = expression; - m_data = m_data.remove('"'); - } GroupFunction *GroupFunctionFactory::createGroupFunction(const QString &functionName, const QString &expression, const QString& dataBandName, DataSourceManager *dataManager) diff --git a/limereport/lrgroupfunctions.h b/limereport/lrgroupfunctions.h index cfe59c2..f85a0bd 100644 --- a/limereport/lrgroupfunctions.h +++ b/limereport/lrgroupfunctions.h @@ -42,7 +42,7 @@ class BandDesignIntf; class GroupFunction : public QObject{ Q_OBJECT public: - enum DataType{Variable,Field,Srcipt,ContentItem}; + enum DataType{Variable, Field, Script, ContentItem}; GroupFunction(const QString& expression, const QString& dataBandName, DataSourceManager *dataManager); bool isValid(){return m_isValid;} void setInvalid(QString message){m_isValid=false,m_errorMessage=message;} diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 62d75bb..edb7ac4 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -60,7 +60,8 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) : m_showProgressDialog(true), m_reportName(""), m_activePreview(0), m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")), m_reportRendering(false) { - m_datasources= new DataSourceManager(this); + m_datasources = new DataSourceManager(this); + m_datasources->setReportSettings(&m_reportSettings); m_scriptEngineContext = new ScriptEngineContext(this); m_datasources->setObjectName("datasources"); connect(m_datasources,SIGNAL(loadCollectionFinished(QString)),this,SLOT(slotDataSourceCollectionLoaded(QString))); diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 2b061d8..a66b95d 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -236,6 +236,7 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) try{ datasources()->setAllDatasourcesToFirst(); + datasources()->clearGroupFuntionsExpressions(); } catch(ReportError &exception){ //TODO possible should thow exeption QMessageBox::critical(0,tr("Error"),exception.what()); @@ -277,7 +278,7 @@ int ReportRender::pageCount() PageItemDesignIntf::Ptr ReportRender::pageAt(int index) { - if ((index>m_renderedPages.count()-1)||(index<0)) throw ReportError("page index out of range"); + if ((index>m_renderedPages.count()-1)||(index<0)) throw ReportError(tr("page index out of range")); else return m_renderedPages.at(index); } @@ -368,7 +369,8 @@ void ReportRender::replaceGroupsFunction(BandDesignIntf *band) if (rx.indexIn(content)>=0){ int pos = 0; while ( (pos = rx.indexIn(content,pos))!= -1 ){ - content.replace(rx.capturedTexts().at(0),QString("%1(%2,%3)").arg(functionName).arg('"'+rx.cap(Const::EXPRESSION_ARGUMENT_INDEX)+'"').arg('"'+band->objectName()+'"')); + QString expressionIndex = datasources()->putGroupFunctionsExpressions(rx.cap(Const::VALUE_INDEX)); + content.replace(rx.capturedTexts().at(0),QString("%1(%2,%3)").arg(functionName).arg('"'+expressionIndex+'"').arg('"'+band->objectName()+'"')); pos += rx.matchedLength(); } contentItem->setContent(content); diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index aeca592..f69283b 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -309,7 +309,7 @@ QScriptValue callGroupFunction(const QString& functionName, QScriptContext* pcon expression = " "; band = pcontext->argument(0).toString(); } else { - expression = pcontext->argument(0).toString(); + expression = dm->getExpression(pcontext->argument(0).toString()); band = pcontext->argument(1).toString(); } @@ -427,7 +427,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("FieldName")+"\",\""+tr("BandName")+"\")"); + addFunction(func, groupFunction,"GROUP FUNCTIONS", func+"(\""+tr("Value")+"\",\""+tr("BandName")+"\")"); } foreach(ScriptFunctionDesc func, m_functions){ if (func.type==ScriptFunctionDesc::Native) @@ -437,6 +437,167 @@ void ScriptEngineManager::setDataManager(DataSourceManager *dataManager){ } } +QString ScriptEngineManager::expandUserVariables(QString context, RenderPass pass, ExpandType expandType, QVariant &varValue) +{ + QRegExp rx(Const::VARIABLE_RX); + if (context.contains(rx)){ + int pos = 0; + while ((pos = rx.indexIn(context,pos))!=-1){ + QString variable=rx.cap(1); + pos += rx.matchedLength(); + if (dataManager()->containsVariable(variable) ){ + try { + if (pass==dataManager()->variablePass(variable)){ + varValue = dataManager()->variable(variable); + switch (expandType){ + case EscapeSymbols: + context.replace(rx.cap(0),escapeSimbols(varValue.toString())); + break; + case NoEscapeSymbols: + context.replace(rx.cap(0),varValue.toString()); + break; + case ReplaceHTMLSymbols: + context.replace(rx.cap(0),replaceHTMLSymbols(varValue.toString())); + break; + } + pos=0; + } + } catch (ReportError e){ + dataManager()->putError(e.what()); + if (!dataManager()->reportSettings() || dataManager()->reportSettings()->suppressAbsentFieldsAndVarsWarnings()) + context.replace(rx.cap(0),e.what()); + else + context.replace(rx.cap(0),""); + } + } else { + QString error; + error = tr("Variable %1 not found").arg(variable); + dataManager()->putError(error); + if (!dataManager()->reportSettings() || dataManager()->reportSettings()->suppressAbsentFieldsAndVarsWarnings()) + context.replace(rx.cap(0),error); + else + context.replace(rx.cap(0),""); + } + } + } + return context; +} + +QString ScriptEngineManager::expandDataFields(QString context, ExpandType expandType, QVariant &varValue, QObject *reportItem) +{ + QRegExp rx(Const::FIELD_RX); + + if (context.contains(rx)){ + while ((rx.indexIn(context))!=-1){ + QString field=rx.cap(1); + + if (dataManager()->containsField(field)) { + QString fieldValue; + varValue = dataManager()->fieldData(field); + if (expandType == EscapeSymbols) { + if (dataManager()->fieldData(field).isNull()) { + fieldValue="\"\""; + } else { + fieldValue = escapeSimbols(varValue.toString()); + switch (dataManager()->fieldData(field).type()) { + case QVariant::Char: + case QVariant::String: + case QVariant::StringList: + case QVariant::Date: + case QVariant::DateTime: + fieldValue = "\""+fieldValue+"\""; + break; + default: + break; + } + } + } else { + if (expandType == ReplaceHTMLSymbols) + fieldValue = replaceHTMLSymbols(varValue.toString()); + else fieldValue = varValue.toString(); + } + + context.replace(rx.cap(0),fieldValue); + + } else { + QString error = QString("Field %1 not found in %2 !!! ").arg(field).arg(reportItem->objectName()); + dataManager()->putError(error); + varValue = QVariant(); + if (!dataManager()->reportSettings() || !dataManager()->reportSettings()->suppressAbsentFieldsAndVarsWarnings()) + context.replace(rx.cap(0),error); + else + context.replace(rx.cap(0),""); + } + } + } + + return context; +} + +QString ScriptEngineManager::expandScripts(QString context, QVariant& varValue, QObject *reportItem) +{ + QRegExp rx(Const::SCRIPT_RX); + + if (context.contains(rx)){ + + if (ScriptEngineManager::instance().dataManager()!=dataManager()) + ScriptEngineManager::instance().setDataManager(dataManager()); + + QScriptEngine* se = ScriptEngineManager::instance().scriptEngine(); + + if (reportItem){ + QScriptValue svThis = se->globalObject().property("THIS"); + if (svThis.isValid()){ + se->newQObject(svThis, this); + } else { + svThis = se->newQObject(this); + se->globalObject().setProperty("THIS",svThis); + } + } + + ScriptExtractor scriptExtractor(context); + if (scriptExtractor.parse()){ + for(int i=0; ievaluate(scriptBody); + if (!se->hasUncaughtException()) { + varValue = value.toVariant(); + context.replace(scriptExtractor.scriptAt(i),value.toString()); + } else { + context.replace(scriptExtractor.scriptAt(i),se->uncaughtException().toString()); + } + } + } + } + return context; +} + +QVariant ScriptEngineManager::evaluateScript(const QString& script){ + + QRegExp rx(Const::SCRIPT_RX); + QVariant varValue; + + if (script.contains(rx)){ + + if (ScriptEngineManager::instance().dataManager()!=dataManager()) + ScriptEngineManager::instance().setDataManager(dataManager()); + + QScriptEngine* se = ScriptEngineManager::instance().scriptEngine(); + + ScriptExtractor scriptExtractor(script); + if (scriptExtractor.parse()){ + QString scriptBody = expandDataFields(scriptExtractor.bodyAt(0),EscapeSymbols, varValue, 0); + scriptBody = expandUserVariables(scriptBody, FirstPass, EscapeSymbols, varValue); + QScriptValue value = se->evaluate(scriptBody); + if (!se->hasUncaughtException()) { + return value.toVariant(); + } + } + } + return QVariant(); +} + void ScriptEngineManager::updateModel() { diff --git a/limereport/lrscriptenginemanager.h b/limereport/lrscriptenginemanager.h index 0c738d9..545580b 100644 --- a/limereport/lrscriptenginemanager.h +++ b/limereport/lrscriptenginemanager.h @@ -190,6 +190,11 @@ public: DataSourceManager* dataManager() const {return m_dataManager;} void setDataManager(DataSourceManager* dataManager); + QString expandUserVariables(QString context, RenderPass pass, ExpandType expandType, QVariant &varValue); + QString expandDataFields(QString context, ExpandType expandType, QVariant &varValue, QObject* reportItem); + QString expandScripts(QString context, QVariant &varValue, QObject* reportItem); + QVariant evaluateScript(const QString &script); + protected: void updateModel(); bool containsFunction(const QString &functionName); From f0ac7822964bbb574b883a63a07ebb32bb20fbf9 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 31 Jan 2017 18:31:28 +0400 Subject: [PATCH 041/136] From now Designer can load a report from the command-line option --- designer/main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer/main.cpp b/designer/main.cpp index 7d5084c..6ecf8ef 100644 --- a/designer/main.cpp +++ b/designer/main.cpp @@ -5,6 +5,9 @@ int main(int argc, char *argv[]) { QApplication a(argc, argv); LimeReport::ReportEngine report; + if (a.arguments().count()>1){ + report.loadFromFile(a.arguments().at(1)); + } report.designReport(); return a.exec(); } From f409f54e8f67168de9b6465721171ee5d0605922 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 1 Feb 2017 23:56:12 +0300 Subject: [PATCH 042/136] Arabic translation has been added --- limereport/limereport.pro | 2 +- translations/limereport_ar.ts | 2192 +++++++++++++++++++++++++++++++++ 2 files changed, 2193 insertions(+), 1 deletion(-) create mode 100644 translations/limereport_ar.ts diff --git a/limereport/limereport.pro b/limereport/limereport.pro index f287154..6397a71 100644 --- a/limereport/limereport.pro +++ b/limereport/limereport.pro @@ -67,7 +67,7 @@ contains(CONFIG,zint){ ####Automatically build required translation files (*.qm) contains(CONFIG,build_translations){ - LANGUAGES = ru es_ES + LANGUAGES = ru es_ES ar defineReplace(prependAll) { for(a,$$1):result += $$2$${a}$$3 diff --git a/translations/limereport_ar.ts b/translations/limereport_ar.ts new file mode 100644 index 0000000..aa037f9 --- /dev/null +++ b/translations/limereport_ar.ts @@ -0,0 +1,2192 @@ + + + + + AboutDialog + + About + حول البرنامج + + + Author + المؤلف + + + License + إتفاقية الترخيص + + + Close + إغلاق + + + Version 1.1.1 + الإصدار 1.1.1 + + + + ConnectionDialog + + Connection + إتصال بقاعدة بيانات + + + Connection Name + أسم الإتصال + + + Driver + المشغل + + + Server + الخادم + + + User + المستخدم + + + Password + كلمة المرور + + + Database + قاعدة البيانات + + + Auto connect + إتصال تلقائي + + + Check connection + فحص الإتصال + + + Cancel + إلغاء الأمر + + + Error + خطأ + + + Connection succsesfully established! + تم الإتصال بنجاح!! + + + Connection Name is empty + أسم الإتصال فارغ + + + Connection with name + إتصال بأسم + + + already exists + موجود مسبقاً + + + + DataBrowser + + Datasources + مصدر البيانات + + + Add database connection + إضافة إتصال قاعدة بيانات + + + Add new datasource + إضافة مصدر بيانات جديد + + + View data + عرض البيانات + + + Change datasource + تغيير مصدر البيانات + + + Delete datasource + حذف مصدر البيانات + + + Show error + عرض الأخطاء + + + Variables + المتغيرات + + + Add new variable + إضافة متغير + + + Edit variable + تعديل متغير + + + Delete variable + حذف متغير + + + + LRVariableDialog + + Variable + متغير + + + Name + الأسم + + + Value + القيمة + + + Type + النوع + + + Attention + Attention + + + + LimeReport::AVariablesHolder + + variable with name + متغير بأسم + + + already exists !! + موجود مسبقاً !! + + + does not exists !! + غير موجود !! + + + + LimeReport::AboutDialog + + About + حول البرنامج + + + Author + المؤلف + + + License + إتفاقية الترخيص + + + Close + إغلاق + + + Version 1.1.1 + الإصدار 1.1.1 + + + Lime Report + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/report/images/logo_100.png" height="100" style="float: left;" /><span style=" font-size:12pt; font-weight:600; color:#555555;">Report engine for </span><span style=" font-size:12pt; font-weight:600; color:#7faa18;">Qt</span><span style=" font-size:12pt; font-weight:600; color:#555555;"> framework</span></p> +<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">LimeReport - multi-platform C++ library written using Qt framework and intended for software developers that would like to add into their application capability to form report or print forms generated using templates.</span></p> +<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><br /></p> +<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><br /></p> +<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">Official web site : </span><a href="www.limereport.ru"><span style=" font-size:11pt; text-decoration: underline; color:#0000ff;">www.limereport.ru</span></a></p> +<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt; text-decoration: underline; color:#0000ff;"><br /></p> +<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600; color:#000000;">This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</span></p> +<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt; font-weight:600; color:#000000;"><br /></p> +<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; color:#000000;">Copyright 2015 Arin Alexander. All rights reserved.</span></p></body></html> + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Arin Alexander</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">arin_a@bk.ru</p></body></html> + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(c) 2015 Arin Alexander arin_a@bk.ru</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="SEC1"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">G</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">NU LESSER GENERAL PUBLIC LICENSE</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Version 2.1, February 1999</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Copyright (C) 1991, 1999 Free Software Foundation, Inc.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Everyone is permitted to copy and distribute verbatim copies</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">of this license document, but changing it is not allowed.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">[This is the first released version of the Lesser GPL. It also counts</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;"> as the successor of the GNU Library Public License, version 2, hence</span></p> +<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;"> the version number 2.1.]</span></p> +<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="SEC2"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">P</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">reamble</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">We call this license the &quot;Lesser&quot; General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a &quot;work based on the library&quot; and a &quot;work that uses the library&quot;. The former contains code derived from the library, whereas the latter must be combined with the library in order to run.</span></p> +<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="SEC3"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">T</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">ERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">0.</span><span style=" font-family:'sans-serif'; color:#000000;"> This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called &quot;this License&quot;). Each licensee is addressed as &quot;you&quot;.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">A &quot;library&quot; means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">The &quot;Library&quot;, below, refers to any such software library or work which has been distributed under these terms. A &quot;work based on the Library&quot; means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term &quot;modification&quot;.)</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">&quot;Source code&quot; for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">1.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">2.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:</span></p> +<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> The modified work must itself be a software library.</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">c)</span><span style=" font-size:16px;"> You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">d)</span><span style=" font-size:16px;"> If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.</span></li></ul> +<p style=" margin-top:15px; margin-bottom:15px; margin-left:38px; margin-right:19px; -qt-block-indent:1; text-indent:0px;"><span style=" font-family:'sans-serif'; color:#000000;">(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">3.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">This option is useful when you wish to copy part of the code of the Library into a program that is not a library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">4.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">5.</span><span style=" font-family:'sans-serif'; color:#000000;"> A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a &quot;work that uses the Library&quot;. Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">However, linking a &quot;work that uses the Library&quot; with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a &quot;work that uses the library&quot;. The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">When a &quot;work that uses the Library&quot; uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">6.</span><span style=" font-family:'sans-serif'; color:#000000;"> As an exception to the Sections above, you may also combine or link a &quot;work that uses the Library&quot; with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:</span></p> +<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable &quot;work that uses the Library&quot;, as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">c)</span><span style=" font-size:16px;"> Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">d)</span><span style=" font-size:16px;"> If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">e)</span><span style=" font-size:16px;"> Verify that the user has already received a copy of these materials or that you have already sent this user a copy.</span></li></ul> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">For an executable, the required form of the &quot;work that uses the Library&quot; must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">7.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:</span></p> +<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.</span></li></ul> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">8.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">9.</span><span style=" font-family:'sans-serif'; color:#000000;"> You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">10.</span><span style=" font-family:'sans-serif'; color:#000000;"> Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">11.</span><span style=" font-family:'sans-serif'; color:#000000;"> If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">12.</span><span style=" font-family:'sans-serif'; color:#000000;"> If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">13.</span><span style=" font-family:'sans-serif'; color:#000000;"> The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and &quot;any later version&quot;, you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">14.</span><span style=" font-family:'sans-serif'; color:#000000;"> If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">NO WARRANTY</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">15.</span><span style=" font-family:'sans-serif'; color:#000000;"> BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY &quot;AS IS&quot; WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">16.</span><span style=" font-family:'sans-serif'; color:#000000;"> IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</span></p> +<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#333333; background-color:#ffffff;">END OF TERMS AND CONDITIONS</span></p> +<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="SEC4"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">H</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">ow to Apply These Terms to Your New Libraries</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License).</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the &quot;copyright&quot; line and a pointer to where the full notice is found.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; font-style:italic; color:#000000;">one line to give the library's name and an idea of what it does.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">Copyright (C) </span><span style=" font-family:'monospace'; font-style:italic; color:#000000;">year</span><span style=" font-family:'monospace'; color:#000000;"> </span><span style=" font-family:'monospace'; font-style:italic; color:#000000;">name of author</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; font-style:italic; color:#000000; background-color:#ffffff;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">This library is free software; you can redistribute it and/or</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">modify it under the terms of the GNU Lesser General Public</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">License as published by the Free Software Foundation; either</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">version 2.1 of the License, or (at your option) any later version.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">This library is distributed in the hope that it will be useful,</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">but WITHOUT ANY WARRANTY; without even the implied warranty of</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">Lesser General Public License for more details.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">You should have received a copy of the GNU Lesser General Public</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">License along with this library; if not, write to the Free Software</span></p> +<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Also add information on how to contact you by electronic and paper mail.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">You should also get your employer (if you work as a programmer) or your school, if any, to sign a &quot;copyright disclaimer&quot; for the library, if necessary. Here is a sample; alter the names:</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Yoyodyne, Inc., hereby disclaims all copyright interest in</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">the library `Frob' (a library for tweaking knobs) written</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">by James Random Hacker.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; font-style:italic; color:#000000;">signature of Ty Coon</span><span style=" font-family:'monospace'; color:#000000;">, 1 April 1990</span></p> +<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">Ty Coon, President of Vice</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">That's all there is to it!</span></p></body></html> + + + + + LimeReport::AlignmentPropItem + + Left + محاذاة يسار + + + Right + محاذاة يمين + + + Center + محاذاة وسط + + + Justify + ملأ السطر + + + Top + محاذاة لأعلى + + + Botom + محاذاة لأسفل + + + horizontal + أفقي + + + vertical + عمودي + + + + LimeReport::BandDesignIntf + + connected to + إتصال ب + + + + LimeReport::ConnectionDialog + + Connection + إتصال بقاعدة بيانات + + + Connection Name + أسم الإتصال + + + Driver + المشغل + + + Server + الخادم + + + User + المستخدم + + + Password + كلمة المرور + + + Database + قاعدة البيانات + + + Auto connect + إتصال تلقائي + + + Check connection + فحص الإتصال + + + Cancel + إلغاء الأمر + + + Error + خطأ + + + Connection succsesfully established! + تم الإتصال بنجاح! + + + Connection Name is empty + أسم الإتصال فارغ + + + Connection with name + إتصال بأسم + + + already exists + موجود مسبقاً + + + ... + + + + Ok + موافق + + + + LimeReport::ContentItemDesignIntf + + Variable %1 not found + المتغير %1 غير موجود + + + + LimeReport::DataBand + + Data + بيانات + + + + LimeReport::DataBrowser + + Datasources + مصدر البيانات + + + Add database connection + إضافة إتصال قاعدة بيانات + + + Add new datasource + إضافة مصدر بيانات جديد + + + View data + عرض البيانات + + + Change datasource + تغيير مصدر البيانات + + + Delete datasource + حذف مصدر البيانات + + + Show error + عرض الأخطاء + + + Variables + المتغيرات + + + Add new variable + إضافة متغير جديد + + + Edit variable + تعديل متغير + + + Delete variable + حذف متغير + + + Attention + Attention + + + Do you really want to delete "%1" connection ? + Do you really want delete "%1" connection ? + هل ترغب في حذف الإتصال "%1" ? + + + User variables + متغيرات المستخدم + + + System variables + متغيرات النظام + + + Do you really want to delete "%1" datasource ? + Do you really want delete "%1" datasource ? + هل ترغب في حذف مصدر البيانات "%1" ? + + + Do you really want delete variable "%1" ? + هل ترغب في حذف المتغير "%1" ? + + + Error + خطأ + + + ... + + + + Do you really want to delete variable "%1" ? + هل ترغب في حذف المتغير "%1" ? + + + Grab variable + + + + Report variables + + + + External variables + + + + + LimeReport::DataFooterBand + + DataFooter + ذيل جدول البيانات + + + + LimeReport::DataHeaderBand + + DataHeader + رأس جدول البيانات + + + + LimeReport::DataSourceManager + + Connection "%1" is not open + الإتصال "%1" غير مفتوح + + + Datasource "%1" not found ! + الإتصال "%1" غير موجود ! + + + connection with name "%1" already exists ! + الإتصال بأسم "%1" موجود مسبقاً ! + + + datasource with name "%1" already exists ! + data source with name "%1" already exists !! + مصدر البيانات بأسم "%1" موجود مسبقاً ! + + + invalid connection + خطأ بالإتصال + + + Variable "%1" not found! + + + + Database "%1" not found + + + + + LimeReport::DataSourceModel + + Datasources + مصدر البيانات + + + Variables + المتغيرات + + + External variables + + + + + LimeReport::FontEditorWidget + + Font bold + خط ثخين + + + Font Italic + خط مائل + + + Font Underline + تحته خط + + + + LimeReport::FontPropItem + + bold + ثخين + + + italic + مائل + + + underline + تحته خط + + + size + حجم + + + family + الفئة + + + + LimeReport::GroupBandFooter + + GroupFooter + ذيل المجموعة + + + + LimeReport::GroupBandHeader + + GroupHeader + رأس المجموعة + + + Group field not found + + + + Datasource "%1" not found !!! + + + + + LimeReport::GroupFunction + + Field "%1" not found + الحقل "%1" غير موجود + + + Variable "%1" not found + المتغير "%1" غير موجود + + + Item "%1" not found + العنصر "%1" غير موجود + + + + LimeReport::ImageItem + + Image + صورة + + + + LimeReport::ItemsAlignmentEditorWidget + + Bring to top + إحضار للأمام + + + Send to back + إرسال للخلف + + + Align to left + محاذاة يسار + + + Align to right + محاذاة يمين + + + Align to vertical center + محاذاة وسط(عمودي) + + + Align to top + محاذاة لأعلى + + + Align to bottom + محاذاة لأسفل + + + Align to horizontal center + محاذاة وسط (أفقي) + + + Set same height + مساواة الارتفاع + + + Set same width + مساواة العرض + + + + LimeReport::ItemsBordersEditorWidget + + Top line + خط علوي + + + Bottom line + خط سفلي + + + Left line + خط أيسر + + + Right line + خط أيمن + + + No borders + بدون إطار + + + All borders + محاط بإطار + + + + LimeReport::MasterDetailProxyModel + + Field: "%1" not found in "%2" child datasource + الحقل: "%1" غير موجود في مصدر البيانات الفرعي "%2" + + + Field: "%1" not found in "%2" master datasource + الحقل: "%1" غير موجود في مصدر البيانات الرئيسي "%2" + + + + LimeReport::ModelToDataSource + + model is destroyed + + + + + LimeReport::ObjectBrowser + + Objects + الكائن + + + + LimeReport::PageDesignIntf + + Warning + تحذير + + + Multi band deletion not allowed + لا يمكن حذف فقرات متعددة + + + + LimeReport::PageFooter + + Page Footer + ذيل الصفحة + + + + LimeReport::PageHeader + + Page Header + رأس الصفحة + + + + LimeReport::PreviewReportWidget + + Form + نموذج + + + PDF file name + أسم ملف PDF + + + Report file name + أسم التقرير + + + + LimeReport::PreviewReportWindow + + View + عرض + + + Report + تقرير + + + toolBar + شريط الأدوات + + + Print + طباعة + + + Zoom In + تكبير + + + Zoom Out + تصغير + + + Prior Page + الصفحة السابقة + + + Next Page + الصفحة التالية + + + Close Preview + أغلاق + + + Edit Mode + وضع التعديل + + + Save to file + حفظ إلى ملف + + + Show errors + عرض الأخطاء + + + First Page + الصفحة الأولى + + + First page + الصفحة الأولى + + + Last Page + الصفحة الأخيرة + + + Print To PDF + تحويل إلى PDF + + + Page: + صفحة: + + + of %1 + من %1 + + + Report file name + أسم التقرير + + + PDF file name + أسم ملف PDF + + + Preview + معاينة + + + Ctrl+P + + + + Fit page width + تمديد ليتاسب عرض الصفحة + + + Fit page + تمديد ليناسب الصفحة بالكامل + + + One to one + + + + Show Toolbar + عرض شريط الأدوات + + + Show toolbar + عرض شريط الأدوات + + + + LimeReport::ProxyHolder + + Datasource has been invalidated + مصدر البيانات غير صحيح + + + + LimeReport::QObjectPropertyModel + + Property Name + الخاصية + + + Property value + القيمة + + + leftMargin + الهامش الأيسر + + + rightMargin + الهامش الأيمن + + + topMargin + الهامش العلوي + + + الهامش السفلي + Отступ нижний + + + objectName + أسم الكائن + + + borders + الإطار + + + geometry + الأبعاد + + + itemAlign + محاذاة + + + pageOrientation + أتجاة الصفحة + + + pageSize + حجم الصفحة + + + TopLine + خط علوي + + + BottomLine + خط سفلي + + + LeftLine + خط أيسر + + + RightLine + خط أيمن + + + datasource + مصدر البيانات + + + alignment + расположение + + + content + المحتوى + + + itemLocation + قفل + + + Warning + تحذير + + + reprintOnEachPage + + + + borderLineSize + + + + autoHeight + + + + backgroundColor + + + + columnCount + + + + columnsFillDirection + + + + keepBottomSpace + + + + keepFooterTogether + + + + keepSubdetailTogether + + + + printIfEmpty + + + + sliceLastRow + + + + splittable + + + + angle + + + + autoWidth + + + + backgroundMode + + + + backgroundOpacity + + + + font + + + + fontColor + + + + foregroundOpacity + + + + margin + + + + stretchToMaxHeight + + + + trimValue + + + + lineWidth + + + + opacity + + + + penStyle + + + + shape + + + + shapeBrush + + + + shapeBrushColor + + + + + LimeReport::RectMMPropItem + + width + العرض + + + height + الأرتفاع + + + + LimeReport::RectPropItem + + width + العرض + + + height + الأرتفاع + + + + LimeReport::ReportDesignWidget + + Report file name + أسم التقرير + + + + LimeReport::ReportDesignWindow + + New Report + تقرير جديد + + + Edit Mode + وضع التعديل + + + Undo + تراجع + + + Redo + أعادة التراجع + + + Copy + نسخ + + + Paste + لصق + + + Cut + قص + + + Settings + إعدادات + + + Use grid + عرض الشبكة + + + Text Item + نص + + + Save Report + حفظ التقرير + + + Save Report As + حفظ التقرير بأسم + + + Load Report + تحميل التقرير + + + Delete item + حذف + + + Zoom In + تكبير + + + Zoom Out + تصغير + + + Render Report + إنشاء التقرير + + + نمط تعديل النسق + Режим редактирования группировок + + + نسق أفقي + Горизонтальная группировка + + + حول البرنامج + О программе + + + Hide left panel + إخفاء المقطع الأيسر + + + Hide right panel + إخفاء المقطع الأيمن + + + Report Tools + أدوات التقرير + + + Main Tools + الأدوات الرئيسة + + + Font + خط + + + Text alignment + محاذاة النص + + + Items alignment + محاذاة + + + Borders + الإطار + + + Report bands + فقرات التقرير + + + Report Header + رأس التقرير + + + Report Footer + ذيل التقرير + + + Page Header + رأس الصفحة + + + Page Footer + ذيل الصفحة + + + Data + جدول البيانات + + + Data Header + رأس جدول البيانات + + + Data Footer + ذيل جدول البيانات + + + SubDetail + بيانات فرعية + + + SubDetailHeader + رأس البيانات الفرعية + + + SubDetailFooter + ذيل البيانات الفرعية + + + GroupHeader + رأس المجموعة + + + GroupFooter + ذيل المجموعة + + + File + ملف + + + Edit + تحرير + + + Info + معلومات + + + Object Inspector + فاحص الكائن + + + Report structure + بنية التقرير + + + Data Browser + إستعراض البيانات + + + Report has been modified ! Do you want save the report ? + تم تعديل التقرير ! هل تريد حفظ التعديلات ? + + + Report file name + أسم التقرير + + + Rendering report + جاري قراءة التقرير + + + Abort + إجهاض + + + page rendered + تم إنشاء الصفحة + + + Warning + تحذير + + + Use magnet + + + + Recent Files + + + + File "%1" not found! + + + + Tear-off Band + + + + + LimeReport::ReportEnginePrivate + + Error + Ошибка + + + Preview + + + + + LimeReport::ReportFooter + + Report Footer + Завершение отчета + + + + LimeReport::ReportHeader + + Report Header + رأس التقرير + + + + LimeReport::ReportRender + + Error + خطأ + + + Databand "%1" not found + فقرة جدول البيانات "%1" غير موجودة + + + Wrong using function %1 + خطأ في إستخدام الدالة %1 + + + + LimeReport::SQLEditDialog + + Datasource + مصدر البيانات + + + Connection + الإتصال + + + Datasource Name + أسم مصدر البيانات + + + Subdetail + البيانات الفرعية + + + Master datasource + مصدر البيانات الرئيسي + + + Subquery mode + وضع الاستعلام الفرعي + + + Filter mode + وضع التصفية + + + SQL + + + + Hide Preview + إخفاء المعاينة + + + Child datasource + مصدر البيانات الفرعي + + + Fields map + + + + Data preview + معاينة البيانات + + + Cancel + إلغاء الأمر + + + Error + خطأ + + + Datasource Name is empty ! + أسم مصدر البيانات فارغ ! + + + SQL is empty ! + SQL فارغة ! + + + Datasource with name: "%1" already exists ! + مصدر البيانات بأسم: "%1" موجود مسبقاً ! + + + Datasource with name %1 already exist + مصدر البيانات بأسم: "%1" موجود مسبقاً + + + Attention + + + + Connection is not specified + إتصال غير محدد + + + Refresh + تحديث + + + Preview + + + + ... + + + + Ok + + + + + LimeReport::ScriptEngineManager + + FieldName + Имя поля + + + BandName + أسم الفقرة + + + Value + القيمة + + + Format + الصيغة + + + Precision + الموقع + + + Locale + + + + CurrencySymbol + + + + Name + الأسم + + + + LimeReport::SettingDialog + + Designer setting + إعدادات + + + Default font + الخط الإفتراضي + + + Grid + شبكة + + + Vertical grid step + تباعد الشبكة العمودي + + + Horizontal grid step + تباعد الشبكة الأفقي + + + Designer Setting + + + + Report Setting + + + + Suppress absent fields and variables warning + + + + + LimeReport::SubDetailBand + + SubDetail + البيانات الفرعية + + + + LimeReport::SubDetailHeaderBand + + SubDetailHeader + رأس البيانات الفرعية + + + + LimeReport::TearOffBand + + Tear-off Band + + + + + LimeReport::TextAlignmentEditorWidget + + Text align left + محاذاة النص لليسار + + + Text align center + محاذاة النص للوسط + + + Text align right + محاذاة النص لليمين + + + Text align justify + ملأ السطر + + + Text align top + محاذاة النص لأعلى + + + Text align bottom + محاذاة السطر لأسفل + + + + LimeReport::TextItemEditor + + Text Item Editor + تحرير النص + + + Content + المحتوى + + + Functions + الدوال + + + Editor settings + إعدادات المحرر + + + Editor font + خطوط المحرر + + + Cancel + إلغاء الأمر + + + Data + + + + ... + + + + Ok + + + + Ctrl+Return + + + + Esc + + + + + LimeReport::VariablesHolder + + variable with name + متغير بأسم + + + already exists !! + موجود مسبقاً !! + + + does not exists !! + غير موجود !! + + + + PreviewReportWindow + + Preview + معاينة + + + View + عرض + + + Report + تقرير + + + toolBar + شريط الأدوات + + + Print + طباعة + + + Zoom In + تكبير + + + Zoom Out + تصغير + + + Prior Page + الصفحة السابقة + + + Next Page + الصفحة التالية + + + Close Preview + أغلاق + + + Edit Mode + وضع التعديل + + + Save to file + حفظ إلى ملف + + + Show errors + عرض الأخطاء + + + First Page + الصفحة الأولى + + + First page + الصفحة الأولى + + + Last Page + الصفحة الأخيرة + + + Print To PDF + تحويل إلى PDF + + + Page: + صفحة: + + + of %1 + من %1 + + + Report file name + أسم التقرير + + + PDF file name + أسم ملف PDF + + + + QObject + + Data + جدول البرنامج + + + DataHeader + رأس جدول البيانات + + + DataFooter + ذيل جدول البيانات + + + GroupHeader + رأس المجموعة + + + GroupFooter + ذيل المجموعة + + + Page Footer + ذيل الصفحة + + + Page Header + رأس الصفحة + + + Report Footer + ذيل التقرير + + + Report Header + رأس التقرير + + + SubDetail + البيانات الفرعية + + + SubDetailHeader + رأس البيانات الفرعية + + + SubDetailFooter + ذيل البيانات الفرعية + + + alignment + محاذاة + + + Barcode Item + باركود + + + HLayout + نسق أفقي + + + Image Item + صورة + + + Shape Item + رسم + + + itemLocation + الموقع + + + Text Item + نص + + + Invalid connection! %1 + خطأ بإتصال %1 + + + Master datasource "%1" not found! + مصدر البيانات الرئيسي "%1" غير موجود! + + + Child + بيانات فرعية + + + and child + و بيانات فرعية + + + datasouce "%1" not found! + مصدر البيانات الرئيسي "%1" غير موجود ! + + + Attention! + + + + Selected elements have different parent containers + العناصر المحددة مختلفة البنية + + + Object with name %1 already exists + أسم الكائن %1 уже موجود مسبقاً + + + Function %1 not found or have wrong arguments + الدالة %1 غير موجودة او الباريميترات خاطئة + + + datasource + مصدر البيانات + + + field + الحقل + + + enum + + + + flags + + + + geometry + الأبعاد + + + mm + + + + File %1 not opened + الحقل %1 غير مفتوح + + + TopLine + خط علوي + + + BottomLine + خط سفلي + + + LeftLine + خط أيسر + + + RightLine + خط أيمن + + + content + المحتوى + + + Master datasource "%1" not found!!! + + + + Master datasouce "%1" not found! + + + + bool + + + + QColor + + + + QFont + + + + QImage + + + + int + + + + qreal + + + + QRect + + + + QRectF + + + + QString + + + + Content string is empty + + + + Content is empty + + + + Tear-off Band + + + + + SQLEditDialog + + Datasource + مصدر البيانات + + + Connection + الإتصال + + + Datasource Name + أسم مصدر البيانات + + + Subdetail + البيانات الفرعية + + + Master datasource + مصدر البيانات الرئيسي + + + Subquery mode + وضع الاستعلام الفرعي + + + Filter mode + وضع التصفية + + + Preview + معاينة + + + Hide Preview + إخفاء المعاينة + + + Child datasource + مصدر البيانات الفرعي + + + Data preview + معاينة البيانات + + + Cancel + إلغاء الأمر + + + Error + خطأ + + + Datasource Name is empty ! + أسم مصدر البيانات فارغ ! + + + SQL is empty ! + SQL فارغة ! + + + Datasource with name: "%1" already exists ! + مصدر البيانات بأسم: "%1" موجود مسبقاً ! + + + Datasource with name %1 already exist + مصدر البيانات بأسم: "%1" موجود مسبقاً + + + Connection is not specified + إتصال غير محدد + + + Refresh + تحديث + + + + SettingDialog + + Designer setting + إعدادات + + + Default font + الخط الإفتراضي + + + Grid + شبكة + + + Vertical grid step + تباعد الشبكة العمودي + + + Horizontal grid step + تباعد الشبكة الأفقي + + + + TextItemEditor + + Text Item Editor + محرر النص + + + Content + المحتوى + + + Data + جدول البيانات + + + Functions + الدوال + + + Editor settings + إعدادات المحرر + + + Editor font + محرر الخطوط + + + Cancel + إلغاء الأمر + + + + WaitForm + + Wait + انتظر + + + Please wait ... + يرجى الإنتظار ... + + + From 21b3f0e912bd5ad5e5edd6127f1d93713cad8baf Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 3 Feb 2017 14:18:28 +0300 Subject: [PATCH 043/136] fix #58 PDF file extension --- limereport/lrpreviewreportwidget.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/limereport/lrpreviewreportwidget.cpp b/limereport/lrpreviewreportwidget.cpp index d614193..986e95d 100644 --- a/limereport/lrpreviewreportwidget.cpp +++ b/limereport/lrpreviewreportwidget.cpp @@ -174,8 +174,12 @@ void PreviewReportWidget::print() void PreviewReportWidget::printToPDF() { - QString fileName = QFileDialog::getSaveFileName(this,tr("PDF file name"),"","PDF(*.pdf)" ); + QString filter = "PDF (*.pdf)"; + QString fileName = QFileDialog::getSaveFileName(this,tr("PDF file name"),"","PDF (*.pdf)"); if (!fileName.isEmpty()){ + QFileInfo fi(fileName); + if (fi.suffix().isEmpty()) + fileName+=".pdf"; QPrinter printer; printer.setOutputFileName(fileName); printer.setOutputFormat(QPrinter::PdfFormat); From 7af7a16840872f44c3309c56391aac7dbc08c472 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 3 Feb 2017 14:20:30 +0300 Subject: [PATCH 044/136] fix #59 setResultEditable(bool value) has been added --- include/lrreportengine.h | 2 ++ limereport/items/lrtextitem.cpp | 2 +- limereport/lrpreviewreportwindow.cpp | 5 +++++ limereport/lrpreviewreportwindow.h | 1 + limereport/lrreportengine.cpp | 27 ++++++++++++++++++++++++++- limereport/lrreportengine.h | 2 ++ limereport/lrreportengine_p.h | 4 ++++ 7 files changed, 41 insertions(+), 2 deletions(-) diff --git a/include/lrreportengine.h b/include/lrreportengine.h index 8164036..0d5b309 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -98,6 +98,8 @@ public: PreviewReportWidget *createPreviewWidget(QWidget *parent = 0); void setPreviewWindowTitle(const QString& title); void setPreviewWindowIcon(const QIcon& icon); + void setResultEditable(bool value); + bool resultIsEditable(); bool isBusy(); signals: void renderStarted(); diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index d8d77cd..cddcfee 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -645,7 +645,7 @@ bool TextItem::isNeedUpdateSize(RenderPass pass) const { Q_UNUSED(pass) - if (autoHeight() && autoWidth() || hasFollower()){ + if ((autoHeight() && autoWidth()) || hasFollower()){ initTextSizes(); } diff --git a/limereport/lrpreviewreportwindow.cpp b/limereport/lrpreviewreportwindow.cpp index 2d05ad5..b000547 100644 --- a/limereport/lrpreviewreportwindow.cpp +++ b/limereport/lrpreviewreportwindow.cpp @@ -166,6 +166,11 @@ void PreviewReportWindow::setMenuVisible(bool value) ui->menubar->setVisible(value); } +void PreviewReportWindow::setHideResultEditButton(bool value) +{ + ui->actionEdit_Mode->setVisible(value); +} + QSettings*PreviewReportWindow::settings() { if (m_settings){ diff --git a/limereport/lrpreviewreportwindow.h b/limereport/lrpreviewreportwindow.h index 26cf181..bc942be 100644 --- a/limereport/lrpreviewreportwindow.h +++ b/limereport/lrpreviewreportwindow.h @@ -65,6 +65,7 @@ public: void setToolBarVisible(bool value); void setStatusBarVisible(bool value); void setMenuVisible(bool value); + void setHideResultEditButton(bool value); QSettings* settings(); protected: void writeSetting(); diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index edb7ac4..2ea54d9 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -58,7 +58,8 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) : QObject(parent), m_fileName(""), m_settings(0), m_ownedSettings(false), m_printer(new QPrinter(QPrinter::HighResolution)), m_printerSelected(false), m_showProgressDialog(true), m_reportName(""), m_activePreview(0), - m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")), m_reportRendering(false) + m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")), + m_reportRendering(false), m_resultIsEditable(true) { m_datasources = new DataSourceManager(this); m_datasources->setReportSettings(&m_reportSettings); @@ -383,6 +384,8 @@ void ReportEnginePrivate::previewReport(PreviewHints hints) w->setToolBarVisible(!hints.testFlag(HidePreviewToolBar)); } + w->setHideResultEditButton(resultIsEditable()); + m_activePreview = w; connect(w,SIGNAL(destroyed(QObject*)), this, SLOT(slotPreviewWindowDestroed(QObject*))); qDebug()<<"render time ="<setPreviewWindowIcon(icon); } +void ReportEngine::setResultEditable(bool value) +{ + Q_D(ReportEngine); + d->setResultEditable(value); +} + +bool ReportEngine::resultIsEditable() +{ + Q_D(ReportEngine); + return d->resultIsEditable(); +} + bool ReportEngine::isBusy() { Q_D(ReportEngine); diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index 8164036..0d5b309 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -98,6 +98,8 @@ public: PreviewReportWidget *createPreviewWidget(QWidget *parent = 0); void setPreviewWindowTitle(const QString& title); void setPreviewWindowIcon(const QIcon& icon); + void setResultEditable(bool value); + bool resultIsEditable(); bool isBusy(); signals: void renderStarted(); diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index 2a6e230..85aff24 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -122,6 +122,9 @@ public: bool suppressFieldAndVarError() const; void setSuppressFieldAndVarError(bool suppressFieldAndVarError); bool isBusy(); + bool resultIsEditable() const; + void setResultEditable(bool value); + signals: void pagesLoadFinished(); void datasourceCollectionLoadFinished(const QString& collectionName); @@ -171,6 +174,7 @@ private: QPointer m_designerWindow; ReportSettings m_reportSettings; bool m_reportRendering; + bool m_resultIsEditable; }; } From f7a3ff622bee832f4a05a6889541d67b4e5f1bc3 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 4 Feb 2017 22:15:44 +0300 Subject: [PATCH 045/136] beforeRender, afterRender signals have been added to ReportPage --- limereport/lrreportrender.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index a66b95d..11c3ae0 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -209,9 +209,10 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) { m_curentNameIndex = 0; m_patternPageItem = patternPage->pageItem(); + + if (m_patternPageItem->resetPageNumber() && m_pageCount>0) { resetPageNumber(PageReset); - } m_renderCanceled = false; BandDesignIntf* reportFooter = m_patternPageItem->bandByType(BandDesignIntf::ReportFooter); @@ -224,7 +225,7 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) #endif if (m_scriptEngineContext){ - + baseDesignIntfToScript(patternPage->pageItem()); foreach (BaseDesignIntf* item, patternPage->pageItem()->childBaseItems()){ baseDesignIntfToScript(item); } @@ -246,6 +247,8 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) clearPageMap(); startNewPage(); + + renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader), 0, StartNewPageAsNeeded); BandDesignIntf* lastRenderedBand = 0; @@ -300,6 +303,7 @@ void ReportRender::initRenderPage() m_renderPageItem = new PageItemDesignIntf(m_patternPageItem->pageSize(), m_patternPageItem->pageRect()); m_renderPageItem->initFromItem(m_patternPageItem); m_renderPageItem->setItemMode(PreviewMode); + m_renderPageItem->setPatternName(m_patternPageItem->objectName()); } } @@ -1018,11 +1022,15 @@ void ReportRender::startNewPage() initColumns(); initRenderPage(); + baseDesignIntfToScript(m_renderPageItem); + m_renderPageItem->setObjectName(QLatin1String("ReportPage")+QString::number(m_pageCount)); m_maxHeightByColumn[m_currentColumn]=m_renderPageItem->pageRect().height(); m_currentStartDataPos[m_currentColumn]=m_patternPageItem->topMargin()*Const::mmFACTOR; m_currentIndex=0; + emit m_patternPageItem->beforeRender(); + renderPageHeader(m_patternPageItem); m_pageFooterHeight = calcPageFooterHeight(m_patternPageItem); @@ -1031,6 +1039,7 @@ void ReportRender::startNewPage() m_dataAreaSize = m_maxHeightByColumn[m_currentColumn]; m_renderedDataBandCount = 0; + foreach (BandDesignIntf* band, m_reprintableBands) { renderBand(band, 0); } @@ -1208,6 +1217,7 @@ void ReportRender::savePage(bool isLast) } moveTearOffBand(); + emit m_patternPageItem->afterRender(); } From 034f254d5c31d794b72436a32de434bef315ac0f Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 10 Feb 2017 23:08:49 +0300 Subject: [PATCH 046/136] Connection will be restored if server is gone away or drop limereport connection --- limereport/lrdatasourcemanager.cpp | 14 +++++++++++--- limereport/lrdatasourcemanager.h | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index 42ec024..f97c84f 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -702,12 +702,17 @@ bool DataSourceManager::initAndOpenDB(QSqlDatabase& db, ConnectionDesc& connecti return connected; } +bool DataSourceManager::checkConnection(QSqlDatabase& db){ + QSqlQuery query("Select 1",db); + return query.first(); +} + bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) { bool connected = false; clearErrors(); - QString lastError =""; + QString lastError = ""; foreach(QString datasourceName, dataSourceNames()){ dataSourceHolder(datasourceName)->clearErrors(); @@ -715,7 +720,7 @@ bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) if (!QSqlDatabase::contains(connectionDesc->name())){ QSqlDatabase db = QSqlDatabase::addDatabase(connectionDesc->driver(),connectionDesc->name()); - connected=initAndOpenDB(db, *connectionDesc); + connected = initAndOpenDB(db, *connectionDesc); if (!connected){ setLastError(db.lastError().text()); return false; @@ -726,7 +731,10 @@ bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) db.close(); connected = initAndOpenDB(db, *connectionDesc); } else { - connected = db.isOpen(); +// connected = db.isOpen(); + connected = checkConnection(db); + if (!connected) + connected = initAndOpenDB(db, *connectionDesc); } } diff --git a/limereport/lrdatasourcemanager.h b/limereport/lrdatasourcemanager.h index fcf0f99..5b43cce 100644 --- a/limereport/lrdatasourcemanager.h +++ b/limereport/lrdatasourcemanager.h @@ -215,6 +215,7 @@ protected: void setLastError(const QString& value); void invalidateLinkedDatasources(QString datasourceName); + bool checkConnection(QSqlDatabase &db); private slots: void slotConnectionRenamed(const QString& oldName,const QString& newName); void slotQueryTextChanged(const QString& queryName, const QString& queryText); From 7406789cbb7484da7e63de55fdf6b4a3c3278b5d Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 11 Feb 2017 00:21:03 +0300 Subject: [PATCH 047/136] QJSEngine -> QQmlEngine --- include/lrglobal.h | 12 +- limereport/lrglobal.h | 12 +- limereport/lrreportrender.cpp | 33 ++- limereport/lrscriptenginemanager.cpp | 314 +++++++++++++++++---------- limereport/lrscriptenginemanager.h | 8 +- 5 files changed, 247 insertions(+), 132 deletions(-) diff --git a/include/lrglobal.h b/include/lrglobal.h index 82a0364..421f8d7 100644 --- a/include/lrglobal.h +++ b/include/lrglobal.h @@ -43,7 +43,8 @@ #endif #ifdef USE_QJSENGINE -#include +//#include +#include #else #include #endif @@ -138,8 +139,15 @@ namespace Const{ #endif #ifdef USE_QJSENGINE - typedef QJSEngine ScriptEngineType; + typedef QQmlEngine ScriptEngineType; typedef QJSValue ScriptValueType; + template + static inline QJSValue getCppOwnedJSValue(QJSEngine &e, T *p) + { + QJSValue res = e.newQObject(p); + QQmlEngine::setObjectOwnership(p, QQmlEngine::CppOwnership); + return res; + } #else typedef QScriptEngine ScriptEngineType; typedef QScriptValue ScriptValueType; diff --git a/limereport/lrglobal.h b/limereport/lrglobal.h index 82a0364..421f8d7 100644 --- a/limereport/lrglobal.h +++ b/limereport/lrglobal.h @@ -43,7 +43,8 @@ #endif #ifdef USE_QJSENGINE -#include +//#include +#include #else #include #endif @@ -138,8 +139,15 @@ namespace Const{ #endif #ifdef USE_QJSENGINE - typedef QJSEngine ScriptEngineType; + typedef QQmlEngine ScriptEngineType; typedef QJSValue ScriptValueType; + template + static inline QJSValue getCppOwnedJSValue(QJSEngine &e, T *p) + { + QJSValue res = e.newQObject(p); + QQmlEngine::setObjectOwnership(p, QQmlEngine::CppOwnership); + return res; + } #else typedef QScriptEngine ScriptEngineType; typedef QScriptValue ScriptValueType; diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 2d0701c..4092f82 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -167,17 +167,29 @@ void ReportRender::setScriptContext(ScriptEngineContext* scriptContext) bool ReportRender::runInitScript(){ if (m_scriptEngineContext){ - QScriptEngine* engine = ScriptEngineManager::instance().scriptEngine(); + ScriptEngineType* engine = ScriptEngineManager::instance().scriptEngine(); +#ifndef USE_QJSENGINE engine->pushContext(); - QScriptValue res = engine->evaluate(m_scriptEngineContext->initScript()); +#endif + ScriptValueType res = engine->evaluate(m_scriptEngineContext->initScript()); if (res.isBool()) return res.toBool(); +#ifdef USE_QJSENGINE + if (res.isError()){ + QMessageBox::critical(0,tr("Error"), + QString("Line %1: %2 ").arg(res.property("lineNumber").toString()) + .arg(res.toString()) + ); + return false; + } +#else if (engine->hasUncaughtException()) { QMessageBox::critical(0,tr("Error"), QString("Line %1: %2 ").arg(engine->uncaughtExceptionLineNumber()) .arg(engine->uncaughtException().toString()) ); return false; - } + } +#endif } return true; } @@ -269,8 +281,9 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) renderBand(tearOffBand, 0, StartNewPageAsNeeded); savePage(true); - +#ifndef USE_QJSENGINE ScriptEngineManager::instance().scriptEngine()->popContext(); +#endif } } @@ -1262,18 +1275,26 @@ void ReportRender::baseDesignIntfToScript(BaseDesignIntf *item) if (item->metaObject()->indexOfSignal("afterRender()")!=-1) item->disconnect(SIGNAL(afterRender())); - QScriptEngine* engine = ScriptEngineManager::instance().scriptEngine(); - QScriptValue sItem = engine->globalObject().property(item->patternName()); + ScriptEngineType* engine = ScriptEngineManager::instance().scriptEngine(); + +#ifdef USE_QJSENGINE + //sItem = engine->newQObject(item); + ScriptValueType sItem = getCppOwnedJSValue(*engine, item); + engine->globalObject().setProperty(item->patternName(), sItem); +#else + ScriptValueType sItem = engine->globalObject().property(item->patternName()); if (sItem.isValid()){ engine->newQObject(sItem, item); } else { sItem = engine->newQObject(item); engine->globalObject().setProperty(item->patternName(),sItem); } +#endif foreach(BaseDesignIntf* child, item->childBaseItems()){ baseDesignIntfToScript(child); } } + } } diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index ad0d84d..dab7272 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -196,141 +196,141 @@ void ScriptEngineModel::updateModel() endResetModel(); } -QScriptValue line(QScriptContext* pcontext, QScriptEngine* pengine){ - ScriptEngineManager* sm = qscriptvalue_cast(pcontext->callee().data()); - DataSourceManager* dm = sm->dataManager(); - QString band = pcontext->argument(0).toString(); - QScriptValue res; - QString varName = QLatin1String("line_")+band.toLower(); - if (dm->variable(varName).isValid()){ - res=pengine->newVariant(dm->variable(varName)); - } else res=pengine->newVariant(QString("Variable line for band %1 not found").arg(band)); - return res; -} +//QScriptValue line(QScriptContext* pcontext, QScriptEngine* pengine){ +// ScriptEngineManager* sm = qscriptvalue_cast(pcontext->callee().data()); +// DataSourceManager* dm = sm->dataManager(); +// QString band = pcontext->argument(0).toString(); +// QScriptValue res; +// QString varName = QLatin1String("line_")+band.toLower(); +// if (dm->variable(varName).isValid()){ +// res=pengine->newVariant(dm->variable(varName)); +// } else res=pengine->newVariant(QString("Variable line for band %1 not found").arg(band)); +// return res; +//} -QScriptValue setVariable(QScriptContext* pcontext, QScriptEngine* /*pengine*/){ +//QScriptValue setVariable(QScriptContext* pcontext, QScriptEngine* /*pengine*/){ - QString name = pcontext->argument(0).toString(); - QVariant value = pcontext->argument(1).toVariant(); +// QString name = pcontext->argument(0).toString(); +// QVariant value = pcontext->argument(1).toVariant(); - ScriptEngineManager* sm = qscriptvalue_cast(pcontext->callee().data()); - DataSourceManager* dm = sm->dataManager(); +// ScriptEngineManager* sm = qscriptvalue_cast(pcontext->callee().data()); +// DataSourceManager* dm = sm->dataManager(); - dm->changeVariable(name,value); - return QScriptValue(); -} +// dm->changeVariable(name,value); +// return QScriptValue(); +//} -QScriptValue getVariable(QScriptContext* pcontext, QScriptEngine* pengine){ +//QScriptValue getVariable(QScriptContext* pcontext, QScriptEngine* pengine){ - QString name = pcontext->argument(0).toString(); +// QString name = pcontext->argument(0).toString(); - ScriptEngineManager* sm = qscriptvalue_cast(pcontext->callee().data()); - DataSourceManager* dm = sm->dataManager(); - QScriptValue res = pengine->newVariant(dm->variable(name)); +// ScriptEngineManager* sm = qscriptvalue_cast(pcontext->callee().data()); +// DataSourceManager* dm = sm->dataManager(); +// QScriptValue res = pengine->newVariant(dm->variable(name)); - return res; -} +// return res; +//} -QScriptValue getField(QScriptContext* pcontext, QScriptEngine* pengine){ +//QScriptValue getField(QScriptContext* pcontext, QScriptEngine* pengine){ - QString name = pcontext->argument(0).toString(); +// QString name = pcontext->argument(0).toString(); - ScriptEngineManager* sm = qscriptvalue_cast(pcontext->callee().data()); - DataSourceManager* dm = sm->dataManager(); - QScriptValue res = pengine->newVariant(dm->fieldData(name)); +// ScriptEngineManager* sm = qscriptvalue_cast(pcontext->callee().data()); +// DataSourceManager* dm = sm->dataManager(); +// QScriptValue res = pengine->newVariant(dm->fieldData(name)); - return res; -} +// return res; +//} -QScriptValue numberFormat(QScriptContext* pcontext, QScriptEngine* pengine){ - QVariant value = pcontext->argument(0).toVariant(); - char format = (pcontext->argumentCount()>1)?pcontext->argument(1).toString()[0].toLatin1():'f'; - int precision = (pcontext->argumentCount()>2)?pcontext->argument(2).toInt32():2; - QString locale = (pcontext->argumentCount()>3)?pcontext->argument(3).toString():""; - QScriptValue res = (locale.isEmpty())?pengine->newVariant(QString::number(value.toDouble(),format,precision)): - pengine->newVariant(QLocale(locale).toString(value.toDouble(),format,precision)); - return res; -} -#if QT_VERSION>0x040800 -QScriptValue currencyFormat(QScriptContext* pcontext, QScriptEngine* pengine){ - QVariant value = pcontext->argument(0).toVariant(); - QString locale = (pcontext->argumentCount()>1)?pcontext->argument(1).toString():QLocale::system().name(); - return pengine->newVariant(QLocale(locale).toCurrencyString(value.toDouble())); -} +//QScriptValue numberFormat(QScriptContext* pcontext, QScriptEngine* pengine){ +// QVariant value = pcontext->argument(0).toVariant(); +// char format = (pcontext->argumentCount()>1)?pcontext->argument(1).toString()[0].toLatin1():'f'; +// int precision = (pcontext->argumentCount()>2)?pcontext->argument(2).toInt32():2; +// QString locale = (pcontext->argumentCount()>3)?pcontext->argument(3).toString():""; +// QScriptValue res = (locale.isEmpty())?pengine->newVariant(QString::number(value.toDouble(),format,precision)): +// pengine->newVariant(QLocale(locale).toString(value.toDouble(),format,precision)); +// return res; +//} +//#if QT_VERSION>0x040800 +//QScriptValue currencyFormat(QScriptContext* pcontext, QScriptEngine* pengine){ +// QVariant value = pcontext->argument(0).toVariant(); +// QString locale = (pcontext->argumentCount()>1)?pcontext->argument(1).toString():QLocale::system().name(); +// return pengine->newVariant(QLocale(locale).toCurrencyString(value.toDouble())); +//} -QScriptValue currencyUSBasedFormat(QScriptContext* pcontext, QScriptEngine* pengine){ - QVariant value = pcontext->argument(0).toVariant(); - QString CurrencySymbol = (pcontext->argumentCount()>1)?pcontext->argument(1).toString():QLocale::system().currencySymbol(); - // Format it using USA locale - QString vTempStr=QLocale(QLocale::English, QLocale::UnitedStates).toCurrencyString(value.toDouble()); - // Replace currency symbol if necesarry - if (CurrencySymbol!="") vTempStr.replace("$", CurrencySymbol); - return pengine->newVariant(vTempStr); -} -#endif -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"; - QScriptValue res = pengine->newVariant(QLocale().toString(value.toDate(),format)); - return res; -} +//QScriptValue currencyUSBasedFormat(QScriptContext* pcontext, QScriptEngine* pengine){ +// QVariant value = pcontext->argument(0).toVariant(); +// QString CurrencySymbol = (pcontext->argumentCount()>1)?pcontext->argument(1).toString():QLocale::system().currencySymbol(); +// // Format it using USA locale +// QString vTempStr=QLocale(QLocale::English, QLocale::UnitedStates).toCurrencyString(value.toDouble()); +// // Replace currency symbol if necesarry +// if (CurrencySymbol!="") vTempStr.replace("$", CurrencySymbol); +// return pengine->newVariant(vTempStr); +//} +//#endif +//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"; +// QScriptValue res = pengine->newVariant(QLocale().toString(value.toDate(),format)); +// return res; +//} -QScriptValue timeFormat(QScriptContext* pcontext, QScriptEngine* pengine){ - QVariant value = pcontext->argument(0).toVariant(); - QString format = (pcontext->argumentCount()>1)?pcontext->argument(1).toString().toLatin1():"hh:mm"; - QScriptValue res = pengine->newVariant(QLocale().toString(value.toTime(),format)); - return res; -} +//QScriptValue timeFormat(QScriptContext* pcontext, QScriptEngine* pengine){ +// QVariant value = pcontext->argument(0).toVariant(); +// QString format = (pcontext->argumentCount()>1)?pcontext->argument(1).toString().toLatin1():"hh:mm"; +// QScriptValue res = pengine->newVariant(QLocale().toString(value.toTime(),format)); +// return res; +//} -QScriptValue dateTimeFormat(QScriptContext* pcontext, QScriptEngine* pengine){ - QVariant value = pcontext->argument(0).toVariant(); - QString format = (pcontext->argumentCount()>1)?pcontext->argument(1).toString().toLatin1():"dd.MM.yyyy hh:mm"; - QScriptValue res = pengine->newVariant(QLocale().toString(value.toDateTime(),format)); - return res; -} +//QScriptValue dateTimeFormat(QScriptContext* pcontext, QScriptEngine* pengine){ +// QVariant value = pcontext->argument(0).toVariant(); +// QString format = (pcontext->argumentCount()>1)?pcontext->argument(1).toString().toLatin1():"dd.MM.yyyy hh:mm"; +// QScriptValue res = pengine->newVariant(QLocale().toString(value.toDateTime(),format)); +// return res; +//} -QScriptValue now(QScriptContext* /*pcontext*/, QScriptEngine* pengine){ - return pengine->newVariant(QDateTime::currentDateTime()); -} +//QScriptValue now(QScriptContext* /*pcontext*/, QScriptEngine* pengine){ +// return pengine->newVariant(QDateTime::currentDateTime()); +//} -QScriptValue date(QScriptContext* /*pcontext*/, QScriptEngine* pengine){ - return pengine->newVariant(QDate::currentDate()); -} +//QScriptValue date(QScriptContext* /*pcontext*/, QScriptEngine* pengine){ +// return pengine->newVariant(QDate::currentDate()); +//} -QScriptValue callGroupFunction(const QString& functionName, QScriptContext* pcontext, QScriptEngine* pengine){ +//QScriptValue callGroupFunction(const QString& functionName, QScriptContext* pcontext, QScriptEngine* pengine){ - ScriptEngineManager* sm = qscriptvalue_cast(pcontext->callee().data()); - DataSourceManager* dm = sm->dataManager(); +// ScriptEngineManager* sm = qscriptvalue_cast(pcontext->callee().data()); +// DataSourceManager* dm = sm->dataManager(); - QString expression; - QString band; +// QString expression; +// QString band; - if (functionName.compare("COUNT",Qt::CaseInsensitive) == 0 && pcontext->argumentCount()==1){ - expression = " "; - band = pcontext->argument(0).toString(); - } else { - expression = dm->getExpression(pcontext->argument(0).toString()); - band = pcontext->argument(1).toString(); - } +// if (functionName.compare("COUNT",Qt::CaseInsensitive) == 0 && pcontext->argumentCount()==1){ +// expression = " "; +// band = pcontext->argument(0).toString(); +// } else { +// expression = dm->getExpression(pcontext->argument(0).toString()); +// band = pcontext->argument(1).toString(); +// } - QScriptValue res; - GroupFunction* gf = dm->groupFunction(functionName,expression,band); - if (gf){ - if (gf->isValid()){ - res=pengine->newVariant(gf->calculate()); - }else{ - res=pengine->newVariant(gf->error()); - } - } - else { - res=pengine->newVariant(QString(QObject::tr("Function %1 not found or have wrong arguments").arg(functionName))); - } - return res; -} +// QScriptValue res; +// GroupFunction* gf = dm->groupFunction(functionName,expression,band); +// if (gf){ +// if (gf->isValid()){ +// res=pengine->newVariant(gf->calculate()); +// }else{ +// res=pengine->newVariant(gf->error()); +// } +// } +// else { +// res=pengine->newVariant(QString(QObject::tr("Function %1 not found or have wrong arguments").arg(functionName))); +// } +// return res; +//} -QScriptValue groupFunction(QScriptContext* pcontext, QScriptEngine* pengine){ - return callGroupFunction(pcontext->callee().property("functionName").toString(),pcontext,pengine); -} +//QScriptValue groupFunction(QScriptContext* pcontext, QScriptEngine* pengine){ +// return callGroupFunction(pcontext->callee().property("functionName").toString(),pcontext,pengine); +//} ScriptEngineManager::~ScriptEngineManager() { @@ -589,16 +589,24 @@ QString ScriptEngineManager::expandScripts(QString context, QVariant& varValue, if (ScriptEngineManager::instance().dataManager()!=dataManager()) ScriptEngineManager::instance().setDataManager(dataManager()); - QScriptEngine* se = ScriptEngineManager::instance().scriptEngine(); + ScriptEngineType* se = ScriptEngineManager::instance().scriptEngine(); if (reportItem){ - QScriptValue svThis = se->globalObject().property("THIS"); + + ScriptValueType svThis; + +#ifdef USE_QJSENGINE + svThis = getCppOwnedJSValue(*se, reportItem); + se->globalObject().setProperty("THIS",svThis); +#else + 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); } +#endif } ScriptExtractor scriptExtractor(context); @@ -606,16 +614,26 @@ QString ScriptEngineManager::expandScripts(QString context, QVariant& varValue, for(int i=0; ievaluate(scriptBody); + ScriptValueType value = se->evaluate(scriptBody); +#ifdef USE_QJSENGINE + if (!value.isError()){ + varValue = value.toVariant(); + context.replace(scriptExtractor.scriptAt(i),value.toString()); + } else { + context.replace(scriptExtractor.scriptAt(i),value.toString()); + } +#else if (!se->hasUncaughtException()) { varValue = value.toVariant(); context.replace(scriptExtractor.scriptAt(i),value.toString()); } else { context.replace(scriptExtractor.scriptAt(i),se->uncaughtException().toString()); } +#endif } } } + return context; } @@ -629,14 +647,18 @@ QVariant ScriptEngineManager::evaluateScript(const QString& script){ if (ScriptEngineManager::instance().dataManager()!=dataManager()) ScriptEngineManager::instance().setDataManager(dataManager()); - QScriptEngine* se = ScriptEngineManager::instance().scriptEngine(); + ScriptEngineType* se = ScriptEngineManager::instance().scriptEngine(); ScriptExtractor scriptExtractor(script); if (scriptExtractor.parse()){ QString scriptBody = expandDataFields(scriptExtractor.bodyAt(0),EscapeSymbols, varValue, 0); scriptBody = expandUserVariables(scriptBody, FirstPass, EscapeSymbols, varValue); - QScriptValue value = se->evaluate(scriptBody); + ScriptValueType value = se->evaluate(scriptBody); +#ifdef USE_QJSENGINE + if (!value.isError()){ +#else if (!se->hasUncaughtException()) { +#endif return value.toVariant(); } } @@ -820,6 +842,36 @@ bool ScriptEngineManager::createSetVariableFunction(){ return addFunction(fd); } +bool ScriptEngineManager::createGetVariableFunction() +{ + JSFunctionDesc fd; + fd.setManager(m_functionManager); + fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); + fd.setCategory("GENERAL"); + fd.setName("getVariable"); + fd.setDescription("getVariable(\""+tr("Name")+"\")"); + fd.setScriptWrapper(QString("function getVariable(name){" + "return %1.getVariable(name);}" + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ); + return addFunction(fd); +} + +bool ScriptEngineManager::createGetFieldFunction() +{ + JSFunctionDesc fd; + fd.setManager(m_functionManager); + fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); + fd.setCategory("GENERAL"); + fd.setName("getField"); + fd.setDescription("getField(\""+tr("Name")+"\")"); + fd.setScriptWrapper(QString("function getField(name){" + "return %1.getField(name);}" + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ); + return addFunction(fd); +} + ScriptEngineManager::ScriptEngineManager() :m_model(0), m_dataManager(0) { @@ -839,6 +891,8 @@ ScriptEngineManager::ScriptEngineManager() createCurrencyUSBasedFormatFunction(); #endif createSetVariableFunction(); + createGetFieldFunction(); + createGetVariableFunction(); // addFunction("line",line,"SYSTEM", "line(\""+tr("BandName")+"\")"); // addFunction("numberFormat",numberFormat,"NUMBER", "numberFormat(\""+tr("Value")+"\",\""+tr("Format")+"\",\""+ @@ -1235,10 +1289,17 @@ void JSFunctionDesc::setScriptWrapper(const QString &scriptWrapper) m_scriptWrapper = scriptWrapper; } -QVariant ScriptFunctionsManager::calcGroupFunction(const QString &name, const QString &fieldName, const QString &bandName) +QVariant ScriptFunctionsManager::calcGroupFunction(const QString &name, const QString &expressionID, const QString &bandName) { if (m_scriptEngineManager->dataManager()){ - GroupFunction* gf = m_scriptEngineManager->dataManager()->groupFunction(name,fieldName,bandName); + QString expression = ""; + if (name.compare("COUNT",Qt::CaseInsensitive) == 0){ + expression = " "; + } else { + expression = m_scriptEngineManager->dataManager()->getExpression(expressionID); + } + + GroupFunction* gf = m_scriptEngineManager->dataManager()->groupFunction(name,expression,bandName); if (gf){ if (gf->isValid()){ return gf->calculate(); @@ -1316,6 +1377,19 @@ void ScriptFunctionsManager::setVariable(const QString &name, QVariant value) DataSourceManager* dm = scriptEngineManager()->dataManager(); dm->changeVariable(name,value); } + +QVariant ScriptFunctionsManager::getVariable(const QString &name) +{ + DataSourceManager* dm = scriptEngineManager()->dataManager(); + return dm->variable(name); +} + +QVariant ScriptFunctionsManager::getField(const QString &field) +{ + DataSourceManager* dm = scriptEngineManager()->dataManager(); + return dm->fieldData(field); +} + #ifdef USE_QJSENGINE QFont ScriptFunctionsManager::font(const QString &family, int pointSize, bool bold, bool italic, bool underLine) { diff --git a/limereport/lrscriptenginemanager.h b/limereport/lrscriptenginemanager.h index b338bbb..726013b 100644 --- a/limereport/lrscriptenginemanager.h +++ b/limereport/lrscriptenginemanager.h @@ -216,7 +216,7 @@ class ScriptFunctionsManager : public QObject{ Q_OBJECT public: explicit ScriptFunctionsManager(QObject* parent = 0):QObject(parent){} - Q_INVOKABLE QVariant calcGroupFunction(const QString& name, const QString& fieldName, const QString& bandName); + Q_INVOKABLE QVariant calcGroupFunction(const QString& name, const QString& expressionID, const QString& bandName); Q_INVOKABLE QVariant line(const QString& bandName); Q_INVOKABLE QVariant numberFormat(QVariant value, const char &format, int precision, const QString &locale); Q_INVOKABLE QVariant dateFormat(QVariant value, const QString& format); @@ -226,7 +226,9 @@ public: Q_INVOKABLE QVariant now(); Q_INVOKABLE QVariant currencyFormat(QVariant value, const QString& locale); Q_INVOKABLE QVariant currencyUSBasedFormat(QVariant value, const QString& currencySymbol); - Q_INVOKABLE void setVariable(const QString& name, QVariant value); + Q_INVOKABLE void setVariable(const QString& name, QVariant value); + Q_INVOKABLE QVariant getVariable(const QString& name); + Q_INVOKABLE QVariant getField(const QString& field); Q_INVOKABLE QVariant color(const QString& color){ return QColor(color);} #ifdef USE_QJSENGINE Q_INVOKABLE QFont font(const QString& family, int pointSize = -1, bool bold = false, bool italic = false, bool underLine = false); @@ -283,6 +285,8 @@ private: bool createCurrencyFormatFunction(); bool createCurrencyUSBasedFormatFunction(); bool createSetVariableFunction(); + bool createGetVariableFunction(); + bool createGetFieldFunction(); private: ScriptEngineManager(); ScriptEngineType* m_scriptEngine; From 8659818a30bb5c3a54fc6d5601201ac1bba0646c Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 11 Feb 2017 00:24:59 +0300 Subject: [PATCH 048/136] Connection will be restored if server is gone away or drop limereport connection --- limereport/lrdatasourcemanager.cpp | 10 +++++++++- limereport/lrdatasourcemanager.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index bab241d..2fb0d40 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -735,6 +735,11 @@ void DataSourceManager::setReportSettings(ReportSettings *reportSettings) m_reportSettings = reportSettings; } +bool DataSourceManager::checkConnection(QSqlDatabase db){ + QSqlQuery query("Select 1",db); + return query.first(); +} + bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) { @@ -759,7 +764,10 @@ bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) db.close(); connected = initAndOpenDB(db, *connectionDesc); } else { - connected = db.isOpen(); + //connected = db.isOpen(); + connected = checkConnection(db); + if (!connected) + connected = initAndOpenDB(db, *connectionDesc); } } diff --git a/limereport/lrdatasourcemanager.h b/limereport/lrdatasourcemanager.h index 7670b2e..a0efaaf 100644 --- a/limereport/lrdatasourcemanager.h +++ b/limereport/lrdatasourcemanager.h @@ -221,7 +221,7 @@ protected: void setSystemVariable(const QString& name, const QVariant& value, RenderPass pass); void setLastError(const QString& value); void invalidateLinkedDatasources(QString datasourceName); - + bool checkConnection(QSqlDatabase db); private slots: void slotConnectionRenamed(const QString& oldName,const QString& newName); void slotQueryTextChanged(const QString& queryName, const QString& queryText); From 8fb3fb5abadfcde379892aa0befdc2f815498d3f Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 15 Feb 2017 00:10:02 +0300 Subject: [PATCH 049/136] LimeReport will not delete external connections --- limereport/lrdatadesignintf.cpp | 6 +++-- limereport/lrdatadesignintf.h | 3 +++ limereport/lrdatasourcemanager.cpp | 36 ++++++++++++++++++------------ limereport/lrdatasourcemanager.h | 2 +- 4 files changed, 30 insertions(+), 17 deletions(-) diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index f20f891..daea32e 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -350,12 +350,14 @@ 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_autoconnect(false), + m_internal(false) {} ConnectionDesc::ConnectionDesc(QObject *parent) :QObject(parent),m_connectionName(""),m_connectionHost(""),m_connectionDriver(""), - m_databaseName(""), m_user(""), m_password(""), m_autoconnect(false) + m_databaseName(""), m_user(""), m_password(""), m_autoconnect(false), + m_internal(false) {} ConnectionDesc::Ptr ConnectionDesc::create(QSqlDatabase db, QObject *parent) diff --git a/limereport/lrdatadesignintf.h b/limereport/lrdatadesignintf.h index abe26bb..7323f80 100644 --- a/limereport/lrdatadesignintf.h +++ b/limereport/lrdatadesignintf.h @@ -130,6 +130,8 @@ public: void setAutoconnect(bool value){m_autoconnect=value;} bool autoconnect(){return m_autoconnect;} bool isEqual(const QSqlDatabase& db); + bool isInternal(){ return m_internal; } + void setInternal(bool value) {m_internal = value;} signals: void nameChanged(const QString& oldName,const QString& newName); private: @@ -140,6 +142,7 @@ private: QString m_user; QString m_password; bool m_autoconnect; + bool m_internal; }; class IConnectionController{ diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index 2fb0d40..ea7e6e0 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -620,13 +620,15 @@ void DataSourceManager::removeDatasource(const QString &name) emit datasourcesChanged(); } -void DataSourceManager::removeConnection(const QString &name) +void DataSourceManager::removeConnection(const QString &connectionName) { for(int i=0;iname()==name){ - QSqlDatabase db = QSqlDatabase::database(name); - db.close(); - QSqlDatabase::removeDatabase(name); + if (m_connections.at(i)->name()==connectionName){ + if (m_connections.at(i)->isInternal()){ + QSqlDatabase db = QSqlDatabase::database(connectionName); + db.close(); + QSqlDatabase::removeDatabase(connectionName); + } delete m_connections.at(i); m_connections.removeAt(i); } @@ -654,10 +656,12 @@ void DataSourceManager::addConnectionDesc(ConnectionDesc * connection) bool DataSourceManager::checkConnectionDesc(ConnectionDesc *connection) { if (connectConnection(connection)){ - QSqlDatabase::removeDatabase(connection->name()); + if (connection->isInternal()) + QSqlDatabase::removeDatabase(connection->name()); return true; } - QSqlDatabase::removeDatabase(connection->name()); + if (connection->isInternal()) + QSqlDatabase::removeDatabase(connection->name()); return false; } @@ -721,6 +725,7 @@ bool DataSourceManager::initAndOpenDB(QSqlDatabase& db, ConnectionDesc& connecti } connected=db.open(); + connectionDesc.setInternal(true); if (!connected) setLastError(db.lastError().text()); return connected; } @@ -760,19 +765,19 @@ bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) } } else { QSqlDatabase db = QSqlDatabase::database(connectionDesc->name()); - if (!connectionDesc->isEqual(db)){ + if (!connectionDesc->isEqual(db) && connectionDesc->isInternal()){ db.close(); connected = initAndOpenDB(db, *connectionDesc); } else { - //connected = db.isOpen(); connected = checkConnection(db); - if (!connected) + if (!connected && connectionDesc->isInternal()) connected = initAndOpenDB(db, *connectionDesc); } } if (!connected) { - QSqlDatabase::removeDatabase(connectionDesc->name()); + if (connectionDesc->isInternal()) + QSqlDatabase::removeDatabase(connectionDesc->name()); return false; } else { foreach(QString datasourceName, dataSourceNames()){ @@ -884,11 +889,13 @@ void DataSourceManager::disconnectConnection(const QString& connectionName) } } } - { + + ConnectionDesc* connectionDesc = connectionByName(connectionName); + if (connectionDesc->isInternal()){ QSqlDatabase db = QSqlDatabase::database(connectionName); if (db.isOpen()) db.close(); + if (QSqlDatabase::contains(connectionName)) QSqlDatabase::removeDatabase(connectionName); } - if (QSqlDatabase::contains(connectionName)) QSqlDatabase::removeDatabase(connectionName); } @@ -1185,7 +1192,8 @@ void DataSourceManager::clear(ClearMethod method) QList::iterator cit = m_connections.begin(); while( cit != m_connections.end() ){ - QSqlDatabase::removeDatabase( (*cit)->name() ); + if ( (*cit)->isInternal() ) + QSqlDatabase::removeDatabase( (*cit)->name() ); delete (*cit); cit = m_connections.erase(cit); } diff --git a/limereport/lrdatasourcemanager.h b/limereport/lrdatasourcemanager.h index a0efaaf..c60bfa5 100644 --- a/limereport/lrdatasourcemanager.h +++ b/limereport/lrdatasourcemanager.h @@ -131,7 +131,7 @@ public: QString queryText(const QString& dataSourceName); QString connectionName(const QString& dataSourceName); void removeDatasource(const QString& name); - void removeConnection(const QString& name); + void removeConnection(const QString& connectionName); bool isQuery(const QString& dataSourceName); bool containsDatasource(const QString& dataSourceName); bool isSubQuery(const QString& dataSourceName); From fa985d7fb732536e357c9d8f05f264f42063b963 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 15 Feb 2017 02:52:11 +0300 Subject: [PATCH 050/136] defaultConnection support has been added to LimeReport designer --- limereport/databrowser/lrconnectiondialog.cpp | 35 +++++++++----- limereport/databrowser/lrconnectiondialog.h | 9 ++-- limereport/databrowser/lrconnectiondialog.ui | 7 +++ limereport/databrowser/lrdatabrowser.cpp | 46 +++++++++++++------ limereport/databrowser/lrdatabrowser.h | 4 +- limereport/databrowser/lrsqleditdialog.cpp | 20 +++++--- limereport/lrdatadesignintf.cpp | 12 ++++- limereport/lrdatadesignintf.h | 4 ++ limereport/lrdatasourcemanager.cpp | 13 +++--- 9 files changed, 108 insertions(+), 42 deletions(-) diff --git a/limereport/databrowser/lrconnectiondialog.cpp b/limereport/databrowser/lrconnectiondialog.cpp index 52ce1b8..60652cf 100644 --- a/limereport/databrowser/lrconnectiondialog.cpp +++ b/limereport/databrowser/lrconnectiondialog.cpp @@ -41,7 +41,7 @@ namespace LimeReport{ ConnectionDialog::ConnectionDialog(LimeReport::IConnectionController *conControl, LimeReport::ConnectionDesc* connectionDesc, QWidget *parent) : QDialog(parent), - ui(new Ui::ConnectionDialog),m_connection(connectionDesc),m_controller(conControl) + ui(new Ui::ConnectionDialog), m_connection(connectionDesc), m_controller(conControl), m_savedConnectionName("") { ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose,true); @@ -56,6 +56,7 @@ ConnectionDialog::~ConnectionDialog() void ConnectionDialog::init() { ui->cbbDrivers->addItems(QSqlDatabase::drivers()); + ui->cbbUseDefaultConnection->setEnabled(!m_controller->containsDefaultConnection()); } void ConnectionDialog::showEvent(QShowEvent *) @@ -101,27 +102,20 @@ void ConnectionDialog::checkFieldsFill() bool ConnectionDialog::checkConnection() { QScopedPointer con(uiToConnection()); -// LimeReport::ConnectionDesc con; -// con.setName(ui->leConnectionName->text()+"_check"); -// con.setHost(ui->leServerName->text()); -// con.setUserName(ui->leUserName->text()); -// con.setPassword(ui->lePassword->text()); -// con.setDatabaseName(ui->leDataBase->text()); -// con.setDriver(ui->cbbDrivers->currentText()); if (!m_controller->checkConnectionDesc(con.data())){ throw LimeReport::ReportError(m_controller->lastError()); } return true; } -LimeReport::ConnectionDesc *ConnectionDialog::uiToConnection(LimeReport::ConnectionDesc* conDesc) +ConnectionDesc *ConnectionDialog::uiToConnection(LimeReport::ConnectionDesc* conDesc) { LimeReport::ConnectionDesc* result; if (conDesc) result = conDesc; else result = new LimeReport::ConnectionDesc(); - result ->setName(ui->leConnectionName->text()); + result ->setName(ConnectionDesc::connectionNameForReport(ui->leConnectionName->text())); result ->setHost(ui->leServerName->text()); result ->setDriver(ui->cbbDrivers->currentText()); result ->setUserName(ui->leUserName->text()); @@ -135,7 +129,8 @@ void ConnectionDialog::connectionToUI() { init(); if (!m_connection) return; - ui->leConnectionName->setText(m_connection->name()); + ui->leConnectionName->setText(ConnectionDesc::connectionNameForUser(m_connection->name())); + ui->cbbUseDefaultConnection->setChecked(m_connection->name().compare(QSqlDatabase::defaultConnection) == 0); ui->leDataBase->setText(m_connection->databaseName()); ui->leServerName->setText(m_connection->host()); ui->leUserName->setText(m_connection->userName()); @@ -144,10 +139,26 @@ void ConnectionDialog::connectionToUI() ui->cbAutoConnect->setChecked(m_connection->autoconnect()); } - void ConnectionDialog::on_toolButton_clicked() { ui->leDataBase->setText(QFileDialog::getOpenFileName()); } +void ConnectionDialog::on_cbbUseDefaultConnection_toggled(bool checked) +{ + if (checked){ + m_savedConnectionName = ui->leConnectionName->text(); + ui->leConnectionName->setText(tr("defaultConnection")); + ui->leConnectionName->setEnabled(false); + } else { + ui->leConnectionName->setText(m_savedConnectionName); + ui->leConnectionName->setEnabled(true); + } +} + } // namespace LimeReport + + + + + diff --git a/limereport/databrowser/lrconnectiondialog.h b/limereport/databrowser/lrconnectiondialog.h index acc86a5..531666a 100644 --- a/limereport/databrowser/lrconnectiondialog.h +++ b/limereport/databrowser/lrconnectiondialog.h @@ -50,7 +50,7 @@ protected: void init(); void checkFieldsFill(); bool checkConnection(); - LimeReport::ConnectionDesc* uiToConnection(LimeReport::ConnectionDesc *conDesc = 0); + ConnectionDesc* uiToConnection(LimeReport::ConnectionDesc *conDesc = 0); void connectionToUI(); signals: void conectionRegistred(LimeReport::ConnectionDesc* connectionDesc); @@ -58,11 +58,14 @@ private slots: void slotAccept(); void slotCheckConnection(); void on_toolButton_clicked(); + void on_cbbUseDefaultConnection_toggled(bool checked); + private: Ui::ConnectionDialog *ui; - LimeReport::ConnectionDesc* m_connection; + ConnectionDesc* m_connection; bool m_changeMode; - LimeReport::IConnectionController* m_controller; + IConnectionController* m_controller; + QString m_savedConnectionName; }; } // namespace LimeReport diff --git a/limereport/databrowser/lrconnectiondialog.ui b/limereport/databrowser/lrconnectiondialog.ui index 49525ec..aa06393 100644 --- a/limereport/databrowser/lrconnectiondialog.ui +++ b/limereport/databrowser/lrconnectiondialog.ui @@ -36,6 +36,13 @@ + + + + Use default application connection + + + diff --git a/limereport/databrowser/lrdatabrowser.cpp b/limereport/databrowser/lrdatabrowser.cpp index 37f6eaf..ba89566 100644 --- a/limereport/databrowser/lrdatabrowser.cpp +++ b/limereport/databrowser/lrdatabrowser.cpp @@ -126,17 +126,17 @@ void DataBrowser::slotSQLEditingFinished(SQLEditResult result) void DataBrowser::slotDeleteConnection() { - if (!getConnectionName().isEmpty()){ + if (!getConnectionName(NameForUser).isEmpty()){ if ( QMessageBox::critical( this, tr("Attention"), - tr("Do you really want to delete \"%1\" connection ?").arg(getConnectionName()), + tr("Do you really want to delete \"%1\" connection ?").arg(getConnectionName(NameForUser)), QMessageBox::Ok|QMessageBox::No, QMessageBox::No - )==QMessageBox::Ok + ) == QMessageBox::Ok ){ - m_report->dataManager()->removeConnection(getConnectionName()); + m_report->dataManager()->removeConnection(getConnectionName(NameForReport)); updateDataTree(); } } @@ -153,7 +153,7 @@ void DataBrowser::slotAddDataSource() #endif sqlEdit->setSettings(settings()); sqlEdit->setDataSources(m_report->dataManager()); - sqlEdit->setDefaultConnection(getConnectionName()); + sqlEdit->setDefaultConnection(getConnectionName(NameForReport)); connect(sqlEdit,SIGNAL(signalSqlEditingFinished(SQLEditResult)),this,SLOT(slotSQLEditingFinished(SQLEditResult))); sqlEdit->exec(); } @@ -173,7 +173,10 @@ void DataBrowser::updateDataTree() foreach(QString dataSourceName, m_report->datasourcesNames()){ QTreeWidgetItem *item=new QTreeWidgetItem(QStringList(dataSourceName),DataBrowserTree::Table); - QTreeWidgetItem *parentItem = findByNameAndType(m_report->dataManager()->connectionName(dataSourceName),DataBrowserTree::Connection); + QTreeWidgetItem *parentItem = findByNameAndType( + ConnectionDesc::connectionNameForUser(m_report->dataManager()->connectionName(dataSourceName)), + DataBrowserTree::Connection + ); if (parentItem){ parentItem->addChild(item); if (!parentItem->isExpanded()) ui->dataTree->expandItem(parentItem); @@ -336,11 +339,18 @@ QTreeWidgetItem* findConnectionItem(QTreeWidgetItem* item){ } } -QString DataBrowser::getConnectionName() +QString DataBrowser::getConnectionName(NameType nameType) { if (ui->dataTree->currentItem()){ QTreeWidgetItem * ci = findConnectionItem(ui->dataTree->currentItem()); - if (ci) return ci->text(0); + if (ci) { + switch (nameType) { + case NameForUser: + return ConnectionDesc::connectionNameForUser(ci->text(0)); + case NameForReport: + return ConnectionDesc::connectionNameForReport(ci->text(0)); + } + } else return QString(); }; return QString(); @@ -417,7 +427,11 @@ void DataBrowser::initConnections() ui->dataTree->clear(); QListitems; foreach(QString connectionName,m_report->dataManager()->connectionNames()){ - QTreeWidgetItem *item=new QTreeWidgetItem(ui->dataTree,QStringList(connectionName), DataBrowserTree::Connection); + QTreeWidgetItem *item=new QTreeWidgetItem( + ui->dataTree, + QStringList(ConnectionDesc::connectionNameForUser(connectionName)), + DataBrowserTree::Connection + ); if (m_report->dataManager()->isConnectionConnected(connectionName)) item->setIcon(0,QIcon(":/databrowser/images/database_connected")); else @@ -482,10 +496,10 @@ void DataBrowser::slotDataWindowClosed() void DataBrowser::slotChangeConnection() { - if (!getConnectionName().isEmpty()){ + if (!getConnectionName(NameForUser).isEmpty()){ ConnectionDialog *connectionEdit = new ConnectionDialog( this, - m_report->dataManager()->connectionByName(getConnectionName()), + m_report->dataManager()->connectionByName(getConnectionName(NameForReport)), this ); connectionEdit->setAttribute(Qt::WA_DeleteOnClose,true); @@ -501,7 +515,7 @@ void DataBrowser::slotChangeConnection() void DataBrowser::slotChangeConnectionState() { - QString connectionName = getConnectionName(); + QString connectionName = getConnectionName(NameForReport); if (!connectionName.isEmpty()){ if (!m_report->dataManager()->isConnectionConnected(connectionName)){ setCursor(Qt::WaitCursor); @@ -626,6 +640,12 @@ bool DataBrowser::checkConnectionDesc(ConnectionDesc *connection) return result; } +bool DataBrowser::containsDefaultConnection() +{ + bool result = m_report->dataManager()->connectionByName(QSqlDatabase::defaultConnection); + return result; +} + QString DataBrowser::lastError() const { return m_lastError; @@ -778,4 +798,4 @@ void DataBrowser::on_variablesTree_itemDoubleClicked(QTreeWidgetItem *item, int } } -} // namespace LimeReport \ No newline at end of file +} // namespace LimeReport diff --git a/limereport/databrowser/lrdatabrowser.h b/limereport/databrowser/lrdatabrowser.h index b068742..7d0a91e 100644 --- a/limereport/databrowser/lrdatabrowser.h +++ b/limereport/databrowser/lrdatabrowser.h @@ -87,8 +87,9 @@ private slots: void on_variablesTree_itemDoubleClicked(QTreeWidgetItem *item, int); private: + enum NameType{NameForUser, NameForReport}; QString getDatasourceName(); - QString getConnectionName(); + QString getConnectionName(NameType nameType); QString getVariable(); bool isClosingWindows() const {return m_closingWindows;} QTreeWidgetItem * findByNameAndType(QString name, int itemType); @@ -108,6 +109,7 @@ private: void addConnectionDesc(ConnectionDesc *connection); void changeConnectionDesc(ConnectionDesc *connection); bool checkConnectionDesc(ConnectionDesc *connection); + bool containsDefaultConnection(); private: Ui::DataBrowser* ui; diff --git a/limereport/databrowser/lrsqleditdialog.cpp b/limereport/databrowser/lrsqleditdialog.cpp index ef292a8..31dd6f1 100644 --- a/limereport/databrowser/lrsqleditdialog.cpp +++ b/limereport/databrowser/lrsqleditdialog.cpp @@ -101,7 +101,7 @@ void SQLEditDialog::accept() else result.resultMode=SQLEditResult::SubProxy; } - result.connectionName=ui->cbbConnection->currentText(); + result.connectionName = ConnectionDesc::connectionNameForReport(ui->cbbConnection->currentText()); result.datasourceName=ui->leDatasourceName->text(); result.sql=ui->textEditSQL->toPlainText(); result.dialogMode=m_dialogMode; @@ -159,15 +159,19 @@ void SQLEditDialog::check() void SQLEditDialog::initConnections() { foreach(QString connectionName, QSqlDatabase::connectionNames()){ - ui->cbbConnection->addItem(QIcon(":/databrowser/images/plug-connect.png"),connectionName); + ui->cbbConnection->addItem(QIcon(":/databrowser/images/plug-connect.png"),ConnectionDesc::connectionNameForUser(connectionName)); } + foreach(QString connectionName, m_datasources->connectionNames()){ + connectionName = (connectionName.compare(QSqlDatabase::defaultConnection)==0) ? + tr("defaultConnection") : connectionName; if (ui->cbbConnection->findText(connectionName,Qt::MatchExactly )==-1) - ui->cbbConnection->addItem(QIcon(":/databrowser/images/plug-disconnect.png"),connectionName); + ui->cbbConnection->addItem(QIcon(":/databrowser/images/plug-disconnect.png"),ConnectionDesc::connectionNameForUser(connectionName)); } + ui->cbbConnection->setCurrentIndex(ui->cbbConnection->findText(m_defaultConnection)); if (!m_oldDatasourceName.isEmpty()){ - ui->cbbConnection->setCurrentIndex(ui->cbbConnection->findText(m_datasources->connectionName(m_oldDatasourceName))); + ui->cbbConnection->setCurrentIndex(ui->cbbConnection->findText(ConnectionDesc::connectionNameForUser(m_datasources->connectionName(m_oldDatasourceName)))); } } @@ -202,7 +206,7 @@ void SQLEditDialog::setDataSources(LimeReport::DataSourceManager *dataSources, Q void SQLEditDialog::setDefaultConnection(QString defaultConnection) { - m_defaultConnection=defaultConnection; + m_defaultConnection = ConnectionDesc::connectionNameForUser(defaultConnection); } void SQLEditDialog::slotDataSourceNameEditing() @@ -298,7 +302,11 @@ void SQLEditDialog::slotPreviewData() QMessageBox::critical(this,tr("Attention"),tr("Connection is not specified")); return; } - m_previewModel = m_datasources->previewSQL(ui->cbbConnection->currentText(),ui->textEditSQL->toPlainText(),ui->leMaster->text()); + m_previewModel = m_datasources->previewSQL( + ConnectionDesc::connectionNameForReport(ui->cbbConnection->currentText()), + ui->textEditSQL->toPlainText(), + ui->leMaster->text() + ); if (m_previewModel){ ui->tvPreview->setModel(m_previewModel.data()); ui->gbDataPreview->setVisible(true); diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index daea32e..ccff471 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -378,7 +378,17 @@ bool ConnectionDesc::isEqual(const QSqlDatabase &db) (db.hostName() == m_connectionHost) && (db.connectionName() == m_connectionName) && (db.userName() == m_user) && - (db.password() == m_password); + (db.password() == m_password); +} + +QString ConnectionDesc::connectionNameForUser(const QString &connectionName) +{ + return connectionName.compare(QSqlDatabase::defaultConnection) == 0 ? tr("defaultConnection") : connectionName; +} + +QString ConnectionDesc::connectionNameForReport(const QString &connectionName) +{ + return connectionName.compare(tr("defaultConnection")) == 0 ? QSqlDatabase::defaultConnection : connectionName; } QueryDesc::QueryDesc(QString queryName, QString queryText, QString connection) diff --git a/limereport/lrdatadesignintf.h b/limereport/lrdatadesignintf.h index 7323f80..d2c9685 100644 --- a/limereport/lrdatadesignintf.h +++ b/limereport/lrdatadesignintf.h @@ -132,6 +132,9 @@ public: bool isEqual(const QSqlDatabase& db); bool isInternal(){ return m_internal; } void setInternal(bool value) {m_internal = value;} +public: + static QString connectionNameForUser(const QString& connectionName); + static QString connectionNameForReport(const QString& connectionName); signals: void nameChanged(const QString& oldName,const QString& newName); private: @@ -150,6 +153,7 @@ public: virtual void addConnectionDesc(ConnectionDesc* connection) = 0; virtual void changeConnectionDesc(ConnectionDesc* connection) = 0; virtual bool checkConnectionDesc(ConnectionDesc* connection) = 0; + virtual bool containsDefaultConnection() = 0; virtual QString lastError() const = 0; }; diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index ea7e6e0..5607117 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -622,16 +622,17 @@ void DataSourceManager::removeDatasource(const QString &name) void DataSourceManager::removeConnection(const QString &connectionName) { - for(int i=0;iname()==connectionName){ - if (m_connections.at(i)->isInternal()){ + QList::iterator cit = m_connections.begin(); + while( cit != m_connections.end() ){ + if ( ((*cit)->name().compare(connectionName) == 0) && (*cit)->isInternal() ){ + { QSqlDatabase db = QSqlDatabase::database(connectionName); db.close(); - QSqlDatabase::removeDatabase(connectionName); } - delete m_connections.at(i); - m_connections.removeAt(i); + QSqlDatabase::removeDatabase(connectionName); } + delete (*cit); + cit = m_connections.erase(cit); } emit datasourcesChanged(); } From d9285813ac2fd342879ce5f67b4cb106c4aeba23 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 16 Feb 2017 04:11:39 +0300 Subject: [PATCH 051/136] Database connections have been refactored "defaultConnection" has been added to Designer keepDbCredentials property has been added to Connection setPassPharse(QString& passPharse) method has been added to ReportEngine IDbCredentialsProvider interface has been added registerDbCredentialsProvider(IDbCredentialsProvider *provider) has been added to IDataSourceManager --- include/lrdatasourcemanagerintf.h | 23 ++++--- include/lrreportengine.h | 1 + limereport/databrowser/lrconnectiondialog.cpp | 2 + limereport/databrowser/lrconnectiondialog.ui | 7 +++ limereport/lrdatadesignintf.cpp | 14 ++++- limereport/lrdatadesignintf.h | 10 ++- limereport/lrdatasourcemanager.cpp | 46 +++++++++++--- limereport/lrdatasourcemanager.h | 5 +- limereport/lrdatasourcemanagerintf.h | 23 ++++--- limereport/lrreportengine.cpp | 61 ++++++++++++++++++- limereport/lrreportengine.h | 1 + limereport/lrreportengine_p.h | 3 + limereport/lrsimplecrypt.cpp | 21 ++++++- limereport/lrsimplecrypt.h | 1 + limereport/serializators/lrserializatorintf.h | 10 ++- limereport/serializators/lrstorageintf.h | 26 ++++---- .../lrxmlbasetypesserializators.cpp | 4 +- .../lrxmlbasetypesserializators.h | 17 +++++- limereport/serializators/lrxmlreader.cpp | 9 +++ limereport/serializators/lrxmlreader.h | 24 +++++--- limereport/serializators/lrxmlwriter.cpp | 9 +++ limereport/serializators/lrxmlwriter.h | 4 ++ 22 files changed, 257 insertions(+), 64 deletions(-) diff --git a/include/lrdatasourcemanagerintf.h b/include/lrdatasourcemanagerintf.h index 85cf388..57bd0c1 100644 --- a/include/lrdatasourcemanagerintf.h +++ b/include/lrdatasourcemanagerintf.h @@ -37,18 +37,25 @@ class QString; class QAbstractItemModel; namespace LimeReport{ +class IDbCredentialsProvider{ +public: + virtual QString getUserName(const QString& connectionName) = 0; + virtual QString getPassword(const QString& connectionName) = 0; +}; + class IDataSourceManager{ public: - virtual void setReportVariable(const QString& name, const QVariant& value)=0; - virtual void setDefaultDatabasePath(const QString &defaultDatabasePath)=0; - virtual void deleteVariable(const QString& name)=0; - virtual bool containsVariable(const QString& variableName)=0; - virtual QVariant variable(const QString& variableName)=0; - virtual bool addModel(const QString& name, QAbstractItemModel *model, bool owned)=0; - virtual void removeModel(const QString& name)=0; - virtual bool containsDatasource(const QString& dataSourceName)=0; + virtual void setReportVariable(const QString& name, const QVariant& value) = 0; + virtual void setDefaultDatabasePath(const QString &defaultDatabasePath) = 0; + virtual void deleteVariable(const QString& name) = 0; + virtual bool containsVariable(const QString& variableName) = 0; + virtual QVariant variable(const QString& variableName) = 0; + virtual bool addModel(const QString& name, QAbstractItemModel *model, bool owned) = 0; + virtual void removeModel(const QString& name) = 0; + virtual bool containsDatasource(const QString& dataSourceName) = 0; virtual void clearUserVariables()=0; virtual ICallbackDatasource* createCallbackDatasouce(const QString& name) = 0; + virtual void registerDbCredentialsProvider(IDbCredentialsProvider* provider) = 0; //virtual void addCallbackDatasource(ICallbackDatasource* datasource, const QString& name) = 0; }; diff --git a/include/lrreportengine.h b/include/lrreportengine.h index 0d5b309..dbbb2a8 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -101,6 +101,7 @@ public: void setResultEditable(bool value); bool resultIsEditable(); bool isBusy(); + void setPassPharse(QString& passPharse); signals: void renderStarted(); void renderFinished(); diff --git a/limereport/databrowser/lrconnectiondialog.cpp b/limereport/databrowser/lrconnectiondialog.cpp index 60652cf..b90545e 100644 --- a/limereport/databrowser/lrconnectiondialog.cpp +++ b/limereport/databrowser/lrconnectiondialog.cpp @@ -122,6 +122,7 @@ ConnectionDesc *ConnectionDialog::uiToConnection(LimeReport::ConnectionDesc* con result ->setPassword(ui->lePassword->text()); result ->setDatabaseName(ui->leDataBase->text()); result ->setAutoconnect(ui->cbAutoConnect->isChecked()); + result->setKeepDBCredentials(!ui->cbbKeepCredentials->isChecked()); return result ; } @@ -137,6 +138,7 @@ void ConnectionDialog::connectionToUI() ui->lePassword->setText(m_connection->password()); ui->cbbDrivers->setCurrentIndex(ui->cbbDrivers->findText(m_connection->driver())); ui->cbAutoConnect->setChecked(m_connection->autoconnect()); + ui->cbbKeepCredentials->setChecked(!m_connection->keepDBCredentials()); } void ConnectionDialog::on_toolButton_clicked() diff --git a/limereport/databrowser/lrconnectiondialog.ui b/limereport/databrowser/lrconnectiondialog.ui index aa06393..60bf527 100644 --- a/limereport/databrowser/lrconnectiondialog.ui +++ b/limereport/databrowser/lrconnectiondialog.ui @@ -137,6 +137,13 @@ + + + + Dont keep credentals in lrxml + + + diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index ccff471..0d2d14b 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -351,13 +351,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_internal(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), - m_internal(false) + m_internal(false), m_keepDBCredentials(true) {} ConnectionDesc::Ptr ConnectionDesc::create(QSqlDatabase db, QObject *parent) @@ -391,6 +391,16 @@ QString ConnectionDesc::connectionNameForReport(const QString &connectionName) return connectionName.compare(tr("defaultConnection")) == 0 ? QSqlDatabase::defaultConnection : connectionName; } +bool ConnectionDesc::keepDBCredentials() const +{ + return m_keepDBCredentials; +} + +void ConnectionDesc::setKeepDBCredentials(bool keepDBCredentals) +{ + m_keepDBCredentials = keepDBCredentals; +} + QueryDesc::QueryDesc(QString queryName, QString queryText, QString connection) :m_queryName(queryName), m_queryText(queryText), m_connectionName(connection) {} diff --git a/limereport/lrdatadesignintf.h b/limereport/lrdatadesignintf.h index d2c9685..e2f8134 100644 --- a/limereport/lrdatadesignintf.h +++ b/limereport/lrdatadesignintf.h @@ -110,6 +110,7 @@ class ConnectionDesc : public QObject{ Q_PROPERTY(QString password READ password WRITE setPassword) Q_PROPERTY(QString host READ host WRITE setHost) Q_PROPERTY(bool autoconnect READ autoconnect WRITE setAutoconnect) + Q_PROPERTY(bool keepDBCredentials READ keepDBCredentials WRITE setKeepDBCredentials) public: typedef QSharedPointer Ptr; ConnectionDesc(QSqlDatabase db, QObject* parent=0); @@ -124,17 +125,19 @@ public: void setDatabaseName(const QString &value){m_databaseName=value;} QString databaseName(){return m_databaseName;} void setUserName(const QString &value){m_user=value;} - QString userName(){return m_user;} + QString userName(){ return m_user; } void setPassword(const QString &value){m_password=value;} - QString password(){return m_password;} + QString password(){ return m_password; } void setAutoconnect(bool value){m_autoconnect=value;} bool autoconnect(){return m_autoconnect;} bool isEqual(const QSqlDatabase& db); bool isInternal(){ return m_internal; } void setInternal(bool value) {m_internal = value;} + bool keepDBCredentials() const; + void setKeepDBCredentials(bool keepDBCredentials); public: static QString connectionNameForUser(const QString& connectionName); - static QString connectionNameForReport(const QString& connectionName); + static QString connectionNameForReport(const QString& connectionName); signals: void nameChanged(const QString& oldName,const QString& newName); private: @@ -146,6 +149,7 @@ private: QString m_password; bool m_autoconnect; bool m_internal; + bool m_keepDBCredentials; }; class IConnectionController{ diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index 5607117..74dd69e 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -217,7 +217,7 @@ void DataSourceModel::updateModel() } DataSourceManager::DataSourceManager(QObject *parent) : - QObject(parent), m_lastError(""), m_designTime(true), m_needUpdate(false) + QObject(parent), m_lastError(""), m_designTime(true), m_needUpdate(false), m_dbCredentialsProvider(0) { m_groupFunctionFactory.registerFunctionCreator(QLatin1String("COUNT"),new ConstructorGroupFunctionCreator); m_groupFunctionFactory.registerFunctionCreator(QLatin1String("SUM"),new ConstructorGroupFunctionCreator); @@ -324,6 +324,11 @@ ICallbackDatasource *DataSourceManager::createCallbackDatasouce(const QString& n return ds; } +void DataSourceManager::registerDbCredentialsProvider(IDbCredentialsProvider *provider) +{ + m_dbCredentialsProvider = provider; +} + void DataSourceManager::addCallbackDatasource(ICallbackDatasource *datasource, const QString& name) { IDataSource* datasourceIntf = dynamic_cast(datasource); @@ -567,6 +572,11 @@ int DataSourceManager::connectionIndexByName(const QString &connectionName) return -1; } +QList& DataSourceManager::conections() +{ + return m_connections; +} + bool DataSourceManager::dataSourceIsValid(const QString &name) { if (m_datasources.value(name.toLower())) return !m_datasources.value(name.toLower())->isInvalid(); @@ -704,10 +714,19 @@ void DataSourceManager::putProxyDesc(ProxyDesc *proxyDesc) bool DataSourceManager::initAndOpenDB(QSqlDatabase& db, ConnectionDesc& connectionDesc){ bool connected = false; + + db.setHostName(replaceVariables(connectionDesc.host())); db.setUserName(replaceVariables(connectionDesc.userName())); db.setPassword(replaceVariables(connectionDesc.password())); + if (!connectionDesc.keepDBCredentials() && m_dbCredentialsProvider){ + if (!m_dbCredentialsProvider->getUserName(connectionDesc.name()).isEmpty()) + db.setUserName(m_dbCredentialsProvider->getUserName(connectionDesc.name())); + if (!m_dbCredentialsProvider->getPassword(connectionDesc.name()).isEmpty()) + db.setPassword(m_dbCredentialsProvider->getPassword(connectionDesc.name())); + } + QString dbName = replaceVariables(connectionDesc.databaseName()); if (connectionDesc.driver().compare("QSQLITE")==0){ if (!defaultDatabasePath().isEmpty()){ @@ -726,7 +745,6 @@ bool DataSourceManager::initAndOpenDB(QSqlDatabase& db, ConnectionDesc& connecti } connected=db.open(); - connectionDesc.setInternal(true); if (!connected) setLastError(db.lastError().text()); return connected; } @@ -758,10 +776,17 @@ bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) } if (!QSqlDatabase::contains(connectionDesc->name())){ - QSqlDatabase db = QSqlDatabase::addDatabase(connectionDesc->driver(),connectionDesc->name()); - connected=initAndOpenDB(db, *connectionDesc); + QString dbError; + { + QSqlDatabase db = QSqlDatabase::addDatabase(connectionDesc->driver(),connectionDesc->name()); + connectionDesc->setInternal(true); + connected=initAndOpenDB(db, *connectionDesc); + dbError = db.lastError().text(); + } if (!connected){ - setLastError(db.lastError().text()); + if (!dbError.trimmed().isEmpty()) + setLastError(dbError); + QSqlDatabase::removeDatabase(connectionDesc->name()); return false; } } else { @@ -868,8 +893,9 @@ bool DataSourceManager::isConnection(const QString &connectionName) bool DataSourceManager::isConnectionConnected(const QString &connectionName) { - if (isConnection(connectionName)){ - return QSqlDatabase::database(connectionName).isOpen(); + if (isConnection(connectionName) && QSqlDatabase::contains(connectionName)){ + QSqlDatabase db = QSqlDatabase::database(connectionName); + return db.isValid() && QSqlDatabase::database(connectionName).isOpen(); } return false; } @@ -893,8 +919,10 @@ void DataSourceManager::disconnectConnection(const QString& connectionName) ConnectionDesc* connectionDesc = connectionByName(connectionName); if (connectionDesc->isInternal()){ - QSqlDatabase db = QSqlDatabase::database(connectionName); - if (db.isOpen()) db.close(); + { + QSqlDatabase db = QSqlDatabase::database(connectionName); + if (db.isOpen()) db.close(); + } if (QSqlDatabase::contains(connectionName)) QSqlDatabase::removeDatabase(connectionName); } diff --git a/limereport/lrdatasourcemanager.h b/limereport/lrdatasourcemanager.h index c60bfa5..77967c5 100644 --- a/limereport/lrdatasourcemanager.h +++ b/limereport/lrdatasourcemanager.h @@ -115,6 +115,7 @@ public: bool addModel(const QString& name, QAbstractItemModel *model, bool owned); void removeModel(const QString& name); ICallbackDatasource* createCallbackDatasouce(const QString &name); + void registerDbCredentialsProvider(IDbCredentialsProvider *provider); void addCallbackDatasource(ICallbackDatasource *datasource, const QString &name); void setReportVariable(const QString& name, const QVariant& value); void deleteVariable(const QString& name); @@ -150,6 +151,7 @@ public: int proxyIndexByName(const QString& dataSourceName); int connectionIndexByName(const QString& connectionName); + QList &conections(); bool dataSourceIsValid(const QString& name); IDataSource* dataSource(const QString& name); IDataSourceHolder* dataSourceHolder(const QString& name); @@ -250,8 +252,7 @@ private: ReportSettings* m_reportSettings; QHash m_groupFunctionsExpressionsMap; QVector m_groupFunctionsExpressions; - - + IDbCredentialsProvider* m_dbCredentialsProvider; }; } diff --git a/limereport/lrdatasourcemanagerintf.h b/limereport/lrdatasourcemanagerintf.h index 85cf388..57bd0c1 100644 --- a/limereport/lrdatasourcemanagerintf.h +++ b/limereport/lrdatasourcemanagerintf.h @@ -37,18 +37,25 @@ class QString; class QAbstractItemModel; namespace LimeReport{ +class IDbCredentialsProvider{ +public: + virtual QString getUserName(const QString& connectionName) = 0; + virtual QString getPassword(const QString& connectionName) = 0; +}; + class IDataSourceManager{ public: - virtual void setReportVariable(const QString& name, const QVariant& value)=0; - virtual void setDefaultDatabasePath(const QString &defaultDatabasePath)=0; - virtual void deleteVariable(const QString& name)=0; - virtual bool containsVariable(const QString& variableName)=0; - virtual QVariant variable(const QString& variableName)=0; - virtual bool addModel(const QString& name, QAbstractItemModel *model, bool owned)=0; - virtual void removeModel(const QString& name)=0; - virtual bool containsDatasource(const QString& dataSourceName)=0; + virtual void setReportVariable(const QString& name, const QVariant& value) = 0; + virtual void setDefaultDatabasePath(const QString &defaultDatabasePath) = 0; + virtual void deleteVariable(const QString& name) = 0; + virtual bool containsVariable(const QString& variableName) = 0; + virtual QVariant variable(const QString& variableName) = 0; + virtual bool addModel(const QString& name, QAbstractItemModel *model, bool owned) = 0; + virtual void removeModel(const QString& name) = 0; + virtual bool containsDatasource(const QString& dataSourceName) = 0; virtual void clearUserVariables()=0; virtual ICallbackDatasource* createCallbackDatasouce(const QString& name) = 0; + virtual void registerDbCredentialsProvider(IDbCredentialsProvider* provider) = 0; //virtual void addCallbackDatasource(ICallbackDatasource* datasource, const QString& name) = 0; }; diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 2ea54d9..fb7ee7c 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -59,7 +59,7 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) : m_printer(new QPrinter(QPrinter::HighResolution)), m_printerSelected(false), m_showProgressDialog(true), m_reportName(""), m_activePreview(0), m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")), - m_reportRendering(false), m_resultIsEditable(true) + m_reportRendering(false), m_resultIsEditable(true), m_passPhrase("HjccbzHjlbyfCkjy") { m_datasources = new DataSourceManager(this); m_datasources->setReportSettings(&m_reportSettings); @@ -513,14 +513,29 @@ bool ReportEnginePrivate::loadFromFile(const QString &fileName) { if (!QFile::exists(fileName)) return false; - clearReport(); + clearReport(); ItemsReaderIntf::Ptr reader = FileXMLReader::create(fileName); + reader->setPassPhrase(m_passPhrase); if (reader->first()){ if (reader->readItem(this)){ m_fileName=fileName; QFileInfo fi(fileName); m_reportName = fi.fileName(); + + QString dbSettingFileName = fi.absolutePath()+"/"+fi.baseName()+".db"; + if (QFile::exists(dbSettingFileName)){ + QSettings dbcredentals(dbSettingFileName, QSettings::IniFormat); + foreach (ConnectionDesc* connection, dataManager()->conections()) { + if (!connection->keepDBCredentials()){ + dbcredentals.beginGroup(connection->name()); + connection->setUserName(dbcredentals.value("user").toString()); + connection->setPassword(dbcredentals.value("password").toString()); + dbcredentals.endGroup(); + } + } + } + dataManager()->connectAutoConnections(); return true; }; @@ -533,6 +548,7 @@ bool ReportEnginePrivate::loadFromByteArray(QByteArray* data, const QString &nam clearReport(); ItemsReaderIntf::Ptr reader = ByteArrayXMLReader::create(data); + reader->setPassPhrase(m_passPhrase); if (reader->first()){ if (reader->readItem(this)){ m_fileName = ""; @@ -548,6 +564,7 @@ bool ReportEnginePrivate::loadFromString(const QString &report, const QString &n clearReport(); ItemsReaderIntf::Ptr reader = StringXMLreader::create(report); + reader->setPassPhrase(m_passPhrase); if (reader->first()){ if (reader->readItem(this)){ m_fileName = ""; @@ -566,10 +583,35 @@ bool ReportEnginePrivate::saveToFile(const QString &fileName) if (fi.suffix().isEmpty()) fn+=".lrxml"; + QString dbSettingFileName = fi.absolutePath()+"/"+fi.baseName()+".db"; + QSettings dbcredentals(dbSettingFileName, QSettings::IniFormat); + + foreach (ConnectionDesc* connection, dataManager()->conections()) { + if (!connection->keepDBCredentials()){ + dbcredentals.beginGroup(connection->name()); + dbcredentals.setValue("user",connection->userName()); + dbcredentals.setValue("password",connection->password()); + dbcredentals.endGroup(); + connection->setPassword(""); + connection->setUserName(""); + } + } + QScopedPointer< ItemsWriterIntf > writer(new XMLWriter()); + writer->setPassPhrase(m_passPhrase); writer->putItem(this); - m_fileName=fn; + m_fileName=fn; bool saved = writer->saveToFile(fn); + + foreach (ConnectionDesc* connection, dataManager()->conections()) { + if (!connection->keepDBCredentials()){ + dbcredentals.beginGroup(connection->name()); + connection->setUserName(dbcredentals.value("user").toString()); + connection->setPassword(dbcredentals.value("password").toString()); + dbcredentals.endGroup(); + } + } + if (saved){ foreach(PageDesignIntf* page, m_pages){ page->setToSaved(); @@ -581,6 +623,7 @@ bool ReportEnginePrivate::saveToFile(const QString &fileName) QByteArray ReportEnginePrivate::saveToByteArray() { QScopedPointer< ItemsWriterIntf > writer(new XMLWriter()); + writer->setPassPhrase(m_passPhrase); writer->putItem(this); QByteArray result = writer->saveToByteArray(); if (!result.isEmpty()){ @@ -593,6 +636,7 @@ QByteArray ReportEnginePrivate::saveToByteArray() QString ReportEnginePrivate::saveToString(){ QScopedPointer< ItemsWriterIntf > writer(new XMLWriter()); + writer->setPassPhrase(m_passPhrase); writer->putItem(this); QString result = writer->saveToString(); if (!result.isEmpty()){ @@ -629,6 +673,11 @@ QString ReportEnginePrivate::renderToString() }else return QString(); } +void ReportEnginePrivate::setPassPhrase(const QString &passPhrase) +{ + m_passPhrase = passPhrase; +} + bool ReportEnginePrivate::resultIsEditable() const { return m_resultIsEditable; @@ -807,6 +856,12 @@ bool ReportEngine::isBusy() return d->isBusy(); } +void ReportEngine::setPassPharse(QString &passPharse) +{ + Q_D(ReportEngine); + d->setPassPhrase(passPharse); +} + void ReportEngine::setShowProgressDialog(bool value) { Q_D(ReportEngine); diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index 0d5b309..dbbb2a8 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -101,6 +101,7 @@ public: void setResultEditable(bool value); bool resultIsEditable(); bool isBusy(); + void setPassPharse(QString& passPharse); signals: void renderStarted(); void renderFinished(); diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index 85aff24..4ec3508 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -125,6 +125,8 @@ public: bool resultIsEditable() const; void setResultEditable(bool value); + void setPassPhrase(const QString &passPhrase); + signals: void pagesLoadFinished(); void datasourceCollectionLoadFinished(const QString& collectionName); @@ -175,6 +177,7 @@ private: ReportSettings m_reportSettings; bool m_reportRendering; bool m_resultIsEditable; + QString m_passPhrase; }; } diff --git a/limereport/lrsimplecrypt.cpp b/limereport/lrsimplecrypt.cpp index 0b9aa06..d79273e 100644 --- a/limereport/lrsimplecrypt.cpp +++ b/limereport/lrsimplecrypt.cpp @@ -41,6 +41,8 @@ const int b = 16; /* number of bytes in key */ const int c = 4; /* number words in key = ceil(8*b/w)*/ const int t = 26; /* size of table S = 2*(r+1) words */ +const char* passPhrase = "HjccbzHjlbyfCkjy"; + WORD P = 0xb7e15163, Q = 0x9e3779b9; #define ROTL(x,y) (((x)<<(y&(w-1))) | ((x)>>(w-(y&(w-1))))) @@ -64,11 +66,15 @@ namespace LimeReport { class ChipperPrivate{ friend class Chipper; +public: + ChipperPrivate():m_prepared(false){} + bool isPrepared(){ return m_prepared;} private: void RC5_SETUP(const char *K); void RC5_ENCRYPT(WORD *pt, WORD *ct); void RC5_DECRYPT(WORD *ct, WORD *pt); WORD S[26]; + bool m_prepared; }; void ChipperPrivate::RC5_SETUP(const char *K) @@ -82,6 +88,7 @@ void ChipperPrivate::RC5_SETUP(const char *K) A = S[i] = ROTL(S[i]+(A+B),3); B = L[j] = ROTL(L[j]+(A+B),(A+B)); } + m_prepared = true; } void ChipperPrivate::RC5_ENCRYPT(WORD *pt, WORD *ct) @@ -111,7 +118,8 @@ QByteArray Chipper::cryptString(QString value) buff += value; WTB pt, ct, prior; - d->RC5_SETUP("HjccbzHjlbyfCkjy"); + if (!d->isPrepared()) + d->RC5_SETUP(passPhrase); prior.word[0]=0; prior.word[1]=0; @@ -144,7 +152,8 @@ QString Chipper::decryptByteArray(QByteArray value) QByteArray result; WTB pt, ct, prior; - d->RC5_SETUP("HjccbzHjlbyfCkjy"); + if (!d->isPrepared()) + d->RC5_SETUP(passPhrase); prior.word[0] = 0; prior.word[1] = 0; @@ -174,6 +183,14 @@ QString Chipper::decryptByteArray(QByteArray value) Chipper::Chipper(): d(new ChipperPrivate()){} +Chipper::Chipper(QString passphrase): d(new ChipperPrivate()) +{ + if (!passphrase.trimmed().isEmpty()){ + passphrase = passphrase.leftJustified(16,'#'); + d->RC5_SETUP(passphrase.toLatin1().data()); + } +} + Chipper::~Chipper() { delete d; diff --git a/limereport/lrsimplecrypt.h b/limereport/lrsimplecrypt.h index 68978b5..4088726 100644 --- a/limereport/lrsimplecrypt.h +++ b/limereport/lrsimplecrypt.h @@ -42,6 +42,7 @@ public: QByteArray cryptString(QString value); QString decryptByteArray(QByteArray value); Chipper(); + Chipper(QString passphrase); ~Chipper(); private: ChipperPrivate* d; diff --git a/limereport/serializators/lrserializatorintf.h b/limereport/serializators/lrserializatorintf.h index ce6a44b..b16263a 100644 --- a/limereport/serializators/lrserializatorintf.h +++ b/limereport/serializators/lrserializatorintf.h @@ -35,10 +35,16 @@ namespace LimeReport { class SerializatorIntf { public: - virtual QVariant loadValue()=0; - virtual void save(const QVariant& value,QString name)=0; + virtual QVariant loadValue() = 0; + virtual void save(const QVariant& value,QString name) = 0; virtual ~SerializatorIntf(){} }; +class CryptedSerializator : public virtual SerializatorIntf +{ +public: + virtual void setPassPhrase(const QString& passPhrase) = 0; +}; + } #endif // LRSERIALIZATORINTF_H diff --git a/limereport/serializators/lrstorageintf.h b/limereport/serializators/lrstorageintf.h index 85fb7ad..74b83ef 100644 --- a/limereport/serializators/lrstorageintf.h +++ b/limereport/serializators/lrstorageintf.h @@ -39,18 +39,19 @@ namespace LimeReport{ class ObjectLoadingStateIntf{ public: - virtual bool isLoading()=0; - virtual void objectLoadStarted()=0; - virtual void objectLoadFinished()=0; + virtual bool isLoading() = 0; + virtual void objectLoadStarted() = 0; + virtual void objectLoadFinished() = 0; }; class ItemsWriterIntf { public: - virtual void putItem(QObject* item)=0; + virtual void putItem(QObject* item) = 0; virtual bool saveToFile(QString fileName) = 0; virtual QString saveToString() = 0; virtual QByteArray saveToByteArray() = 0; + virtual void setPassPhrase(const QString& passPhrase) = 0; virtual ~ItemsWriterIntf(){} }; @@ -58,14 +59,15 @@ class ItemsReaderIntf { public: typedef QSharedPointer Ptr; - virtual bool first()=0; - virtual bool next()=0; - virtual bool prior()=0; - virtual QString itemType()=0; - virtual QString itemClassName()=0; - virtual bool readItem(QObject *item)=0; - virtual int firstLevelItemsCount()=0; - virtual QString lastError()=0; + virtual bool first() = 0; + virtual bool next() = 0; + virtual bool prior() = 0; + virtual QString itemType() = 0; + virtual QString itemClassName() = 0; + virtual bool readItem(QObject *item) = 0; + virtual int firstLevelItemsCount() = 0; + virtual QString lastError() = 0; + virtual void setPassPhrase(const QString& passPhrase) = 0; virtual ~ItemsReaderIntf(){} }; diff --git a/limereport/serializators/lrxmlbasetypesserializators.cpp b/limereport/serializators/lrxmlbasetypesserializators.cpp index ebc4260..c0c2ce7 100644 --- a/limereport/serializators/lrxmlbasetypesserializators.cpp +++ b/limereport/serializators/lrxmlbasetypesserializators.cpp @@ -109,7 +109,7 @@ void XmlQStringSerializator::save(const QVariant &value, QString name) QDomElement _node = doc()->createElement(name); _node.setAttribute("Type","QString"); if (name.compare("password")==0){ - Chipper chipper; + Chipper chipper(passPhrase()); QByteArray ba = chipper.cryptString(value.toString()); //ba.append(); _node.setAttribute("Value",QString(ba.toBase64())); @@ -123,7 +123,7 @@ QVariant XmlQStringSerializator::loadValue() { if (node()->tagName().compare("password")==0){ QByteArray ba; - Chipper chipper; + Chipper chipper(passPhrase()); ba.append(node()->attribute("Value").toLatin1()); return chipper.decryptByteArray(QByteArray::fromBase64(ba)); } else diff --git a/limereport/serializators/lrxmlbasetypesserializators.h b/limereport/serializators/lrxmlbasetypesserializators.h index 70bd40d..56f62c1 100644 --- a/limereport/serializators/lrxmlbasetypesserializators.h +++ b/limereport/serializators/lrxmlbasetypesserializators.h @@ -36,7 +36,7 @@ namespace LimeReport{ -class XmlBaseSerializator : public SerializatorIntf{ +class XmlBaseSerializator : public virtual SerializatorIntf{ public: XmlBaseSerializator(QDomDocument *doc, QDomElement *node):m_doc(doc),m_node(node){} protected: @@ -48,10 +48,21 @@ private: QDomElement *m_node; }; -class XmlQStringSerializator : public XmlBaseSerializator +class XmlCryptedSerializator : public XmlBaseSerializator, public virtual CryptedSerializator{ +public: + XmlCryptedSerializator(QDomDocument *doc, QDomElement *node) + :XmlBaseSerializator(doc, node){} + virtual void setPassPhrase(const QString& passPhrase) {m_passPhrase = passPhrase;} +protected: + QString passPhrase(){ return m_passPhrase;} +private: + QString m_passPhrase; +}; + +class XmlQStringSerializator : public XmlCryptedSerializator { public: - XmlQStringSerializator(QDomDocument *doc, QDomElement *node):XmlBaseSerializator(doc,node){} + XmlQStringSerializator(QDomDocument *doc, QDomElement *node):XmlCryptedSerializator(doc,node){} private: virtual void save(const QVariant &value,QString name); virtual QVariant loadValue(); diff --git a/limereport/serializators/lrxmlreader.cpp b/limereport/serializators/lrxmlreader.cpp index 545c4ca..bee2ff8 100644 --- a/limereport/serializators/lrxmlreader.cpp +++ b/limereport/serializators/lrxmlreader.cpp @@ -135,6 +135,11 @@ QString XMLReader::lastError() return m_error; } +void XMLReader::setPassPhrase(const QString &passPhrase) +{ + m_passPhrase = passPhrase; +} + bool XMLReader::extractFirstNode() { if (m_firstNode.isNull()){ @@ -166,6 +171,10 @@ QVariant XMLReader::getValue(QDomElement *node) if (creator) { QScopedPointerserializator(creator(m_doc.data(),node)); + CryptedSerializator* cs = dynamic_cast(serializator.data()); + if (cs){ + cs->setPassPhrase(m_passPhrase); + } return serializator->loadValue(); } return QVariant(); diff --git a/limereport/serializators/lrxmlreader.h b/limereport/serializators/lrxmlreader.h index f677c68..0bc17ee 100644 --- a/limereport/serializators/lrxmlreader.h +++ b/limereport/serializators/lrxmlreader.h @@ -44,14 +44,17 @@ public: XMLReader(); XMLReader(QSharedPointer doc); protected: +//ItemsReaderIntf interface + bool first(); + bool next(); + bool prior(); + QString itemType(); + QString itemClassName(); + bool readItem(QObject *item); + int firstLevelItemsCount(); + QString lastError(); + void setPassPhrase(const QString &passPhrase); - virtual bool first(); - virtual bool next(); - virtual bool prior(); - virtual QString itemType(); - virtual QString itemClassName(); - virtual bool readItem(QObject *item); - virtual int firstLevelItemsCount(); virtual bool prepareReader(QDomDocument *doc); void readItemFromNode(QObject *item, QDomElement *node); @@ -60,7 +63,7 @@ protected: void readCollection(QObject *item, QDomElement *node); QVariant getValue(QDomElement *node); - virtual QString lastError(); + protected: bool extractFirstNode(); QString m_error; @@ -68,6 +71,11 @@ private: QSharedPointer m_doc; QDomElement m_curNode; QDomElement m_firstNode; + QString m_passPhrase; + + + + }; class FileXMLReader : public XMLReader{ diff --git a/limereport/serializators/lrxmlwriter.cpp b/limereport/serializators/lrxmlwriter.cpp index 1a6e68a..3038373 100644 --- a/limereport/serializators/lrxmlwriter.cpp +++ b/limereport/serializators/lrxmlwriter.cpp @@ -113,6 +113,11 @@ QByteArray XMLWriter::saveToByteArray() return res; } +void XMLWriter::setPassPhrase(const QString &passPhrase) +{ + m_passPhrase = passPhrase; +} + QDomElement XMLWriter::putQObjectItem(QString name, QObject *item) { Q_UNUSED(name) @@ -158,6 +163,10 @@ void XMLWriter::saveProperty(QString name, QObject* item, QDomElement *node) if (creator) { QScopedPointer serializator(creator(m_doc.data(),node)); + CryptedSerializator* cs = dynamic_cast(serializator.data()); + if (cs){ + cs->setPassPhrase(m_passPhrase); + } serializator->save( item->property(name.toLatin1()), name diff --git a/limereport/serializators/lrxmlwriter.h b/limereport/serializators/lrxmlwriter.h index 399e2e2..0259a75 100644 --- a/limereport/serializators/lrxmlwriter.h +++ b/limereport/serializators/lrxmlwriter.h @@ -44,10 +44,13 @@ public: XMLWriter(QSharedPointer doc); ~XMLWriter() {} private: + // ItemsWriterIntf interface void putItem(QObject* item); bool saveToFile(QString fileName); QString saveToString(); QByteArray saveToByteArray(); + void setPassPhrase(const QString &passPhrase); + void init(); QDomElement putQObjectItem(QString name, QObject* item); void putChildQObjectItem(QString name, QObject* item, QDomElement* parentNode); @@ -66,6 +69,7 @@ private: QSharedPointer m_doc; QString m_fileName; QDomElement m_rootElement; + QString m_passPhrase; }; } From ce3a905c5500bdafc15f67d82fe4219b760bb49d Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 16 Feb 2017 04:11:39 +0300 Subject: [PATCH 052/136] Database connections have been refactored keepDbCredentials property has been added to Connection setPassPharse(QString& passPharse) method has been added to ReportEngine IDbCredentialsProvider interface has been added registerDbCredentialsProvider(IDbCredentialsProvider *provider) has been added to IDataSourceManager --- include/lrdatasourcemanagerintf.h | 23 ++++--- include/lrreportengine.h | 1 + limereport/databrowser/lrconnectiondialog.cpp | 2 + limereport/databrowser/lrconnectiondialog.ui | 7 +++ limereport/lrdatadesignintf.cpp | 14 ++++- limereport/lrdatadesignintf.h | 10 ++- limereport/lrdatasourcemanager.cpp | 46 +++++++++++--- limereport/lrdatasourcemanager.h | 5 +- limereport/lrdatasourcemanagerintf.h | 23 ++++--- limereport/lrreportengine.cpp | 61 ++++++++++++++++++- limereport/lrreportengine.h | 1 + limereport/lrreportengine_p.h | 3 + limereport/lrsimplecrypt.cpp | 21 ++++++- limereport/lrsimplecrypt.h | 1 + limereport/serializators/lrserializatorintf.h | 10 ++- limereport/serializators/lrstorageintf.h | 26 ++++---- .../lrxmlbasetypesserializators.cpp | 4 +- .../lrxmlbasetypesserializators.h | 17 +++++- limereport/serializators/lrxmlreader.cpp | 9 +++ limereport/serializators/lrxmlreader.h | 24 +++++--- limereport/serializators/lrxmlwriter.cpp | 9 +++ limereport/serializators/lrxmlwriter.h | 4 ++ 22 files changed, 257 insertions(+), 64 deletions(-) diff --git a/include/lrdatasourcemanagerintf.h b/include/lrdatasourcemanagerintf.h index 85cf388..57bd0c1 100644 --- a/include/lrdatasourcemanagerintf.h +++ b/include/lrdatasourcemanagerintf.h @@ -37,18 +37,25 @@ class QString; class QAbstractItemModel; namespace LimeReport{ +class IDbCredentialsProvider{ +public: + virtual QString getUserName(const QString& connectionName) = 0; + virtual QString getPassword(const QString& connectionName) = 0; +}; + class IDataSourceManager{ public: - virtual void setReportVariable(const QString& name, const QVariant& value)=0; - virtual void setDefaultDatabasePath(const QString &defaultDatabasePath)=0; - virtual void deleteVariable(const QString& name)=0; - virtual bool containsVariable(const QString& variableName)=0; - virtual QVariant variable(const QString& variableName)=0; - virtual bool addModel(const QString& name, QAbstractItemModel *model, bool owned)=0; - virtual void removeModel(const QString& name)=0; - virtual bool containsDatasource(const QString& dataSourceName)=0; + virtual void setReportVariable(const QString& name, const QVariant& value) = 0; + virtual void setDefaultDatabasePath(const QString &defaultDatabasePath) = 0; + virtual void deleteVariable(const QString& name) = 0; + virtual bool containsVariable(const QString& variableName) = 0; + virtual QVariant variable(const QString& variableName) = 0; + virtual bool addModel(const QString& name, QAbstractItemModel *model, bool owned) = 0; + virtual void removeModel(const QString& name) = 0; + virtual bool containsDatasource(const QString& dataSourceName) = 0; virtual void clearUserVariables()=0; virtual ICallbackDatasource* createCallbackDatasouce(const QString& name) = 0; + virtual void registerDbCredentialsProvider(IDbCredentialsProvider* provider) = 0; //virtual void addCallbackDatasource(ICallbackDatasource* datasource, const QString& name) = 0; }; diff --git a/include/lrreportengine.h b/include/lrreportengine.h index 0d5b309..dbbb2a8 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -101,6 +101,7 @@ public: void setResultEditable(bool value); bool resultIsEditable(); bool isBusy(); + void setPassPharse(QString& passPharse); signals: void renderStarted(); void renderFinished(); diff --git a/limereport/databrowser/lrconnectiondialog.cpp b/limereport/databrowser/lrconnectiondialog.cpp index 60652cf..b90545e 100644 --- a/limereport/databrowser/lrconnectiondialog.cpp +++ b/limereport/databrowser/lrconnectiondialog.cpp @@ -122,6 +122,7 @@ ConnectionDesc *ConnectionDialog::uiToConnection(LimeReport::ConnectionDesc* con result ->setPassword(ui->lePassword->text()); result ->setDatabaseName(ui->leDataBase->text()); result ->setAutoconnect(ui->cbAutoConnect->isChecked()); + result->setKeepDBCredentials(!ui->cbbKeepCredentials->isChecked()); return result ; } @@ -137,6 +138,7 @@ void ConnectionDialog::connectionToUI() ui->lePassword->setText(m_connection->password()); ui->cbbDrivers->setCurrentIndex(ui->cbbDrivers->findText(m_connection->driver())); ui->cbAutoConnect->setChecked(m_connection->autoconnect()); + ui->cbbKeepCredentials->setChecked(!m_connection->keepDBCredentials()); } void ConnectionDialog::on_toolButton_clicked() diff --git a/limereport/databrowser/lrconnectiondialog.ui b/limereport/databrowser/lrconnectiondialog.ui index aa06393..60bf527 100644 --- a/limereport/databrowser/lrconnectiondialog.ui +++ b/limereport/databrowser/lrconnectiondialog.ui @@ -137,6 +137,13 @@ + + + + Dont keep credentals in lrxml + + + diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index ccff471..0d2d14b 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -351,13 +351,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_internal(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), - m_internal(false) + m_internal(false), m_keepDBCredentials(true) {} ConnectionDesc::Ptr ConnectionDesc::create(QSqlDatabase db, QObject *parent) @@ -391,6 +391,16 @@ QString ConnectionDesc::connectionNameForReport(const QString &connectionName) return connectionName.compare(tr("defaultConnection")) == 0 ? QSqlDatabase::defaultConnection : connectionName; } +bool ConnectionDesc::keepDBCredentials() const +{ + return m_keepDBCredentials; +} + +void ConnectionDesc::setKeepDBCredentials(bool keepDBCredentals) +{ + m_keepDBCredentials = keepDBCredentals; +} + QueryDesc::QueryDesc(QString queryName, QString queryText, QString connection) :m_queryName(queryName), m_queryText(queryText), m_connectionName(connection) {} diff --git a/limereport/lrdatadesignintf.h b/limereport/lrdatadesignintf.h index d2c9685..e2f8134 100644 --- a/limereport/lrdatadesignintf.h +++ b/limereport/lrdatadesignintf.h @@ -110,6 +110,7 @@ class ConnectionDesc : public QObject{ Q_PROPERTY(QString password READ password WRITE setPassword) Q_PROPERTY(QString host READ host WRITE setHost) Q_PROPERTY(bool autoconnect READ autoconnect WRITE setAutoconnect) + Q_PROPERTY(bool keepDBCredentials READ keepDBCredentials WRITE setKeepDBCredentials) public: typedef QSharedPointer Ptr; ConnectionDesc(QSqlDatabase db, QObject* parent=0); @@ -124,17 +125,19 @@ public: void setDatabaseName(const QString &value){m_databaseName=value;} QString databaseName(){return m_databaseName;} void setUserName(const QString &value){m_user=value;} - QString userName(){return m_user;} + QString userName(){ return m_user; } void setPassword(const QString &value){m_password=value;} - QString password(){return m_password;} + QString password(){ return m_password; } void setAutoconnect(bool value){m_autoconnect=value;} bool autoconnect(){return m_autoconnect;} bool isEqual(const QSqlDatabase& db); bool isInternal(){ return m_internal; } void setInternal(bool value) {m_internal = value;} + bool keepDBCredentials() const; + void setKeepDBCredentials(bool keepDBCredentials); public: static QString connectionNameForUser(const QString& connectionName); - static QString connectionNameForReport(const QString& connectionName); + static QString connectionNameForReport(const QString& connectionName); signals: void nameChanged(const QString& oldName,const QString& newName); private: @@ -146,6 +149,7 @@ private: QString m_password; bool m_autoconnect; bool m_internal; + bool m_keepDBCredentials; }; class IConnectionController{ diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index 5607117..74dd69e 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -217,7 +217,7 @@ void DataSourceModel::updateModel() } DataSourceManager::DataSourceManager(QObject *parent) : - QObject(parent), m_lastError(""), m_designTime(true), m_needUpdate(false) + QObject(parent), m_lastError(""), m_designTime(true), m_needUpdate(false), m_dbCredentialsProvider(0) { m_groupFunctionFactory.registerFunctionCreator(QLatin1String("COUNT"),new ConstructorGroupFunctionCreator); m_groupFunctionFactory.registerFunctionCreator(QLatin1String("SUM"),new ConstructorGroupFunctionCreator); @@ -324,6 +324,11 @@ ICallbackDatasource *DataSourceManager::createCallbackDatasouce(const QString& n return ds; } +void DataSourceManager::registerDbCredentialsProvider(IDbCredentialsProvider *provider) +{ + m_dbCredentialsProvider = provider; +} + void DataSourceManager::addCallbackDatasource(ICallbackDatasource *datasource, const QString& name) { IDataSource* datasourceIntf = dynamic_cast(datasource); @@ -567,6 +572,11 @@ int DataSourceManager::connectionIndexByName(const QString &connectionName) return -1; } +QList& DataSourceManager::conections() +{ + return m_connections; +} + bool DataSourceManager::dataSourceIsValid(const QString &name) { if (m_datasources.value(name.toLower())) return !m_datasources.value(name.toLower())->isInvalid(); @@ -704,10 +714,19 @@ void DataSourceManager::putProxyDesc(ProxyDesc *proxyDesc) bool DataSourceManager::initAndOpenDB(QSqlDatabase& db, ConnectionDesc& connectionDesc){ bool connected = false; + + db.setHostName(replaceVariables(connectionDesc.host())); db.setUserName(replaceVariables(connectionDesc.userName())); db.setPassword(replaceVariables(connectionDesc.password())); + if (!connectionDesc.keepDBCredentials() && m_dbCredentialsProvider){ + if (!m_dbCredentialsProvider->getUserName(connectionDesc.name()).isEmpty()) + db.setUserName(m_dbCredentialsProvider->getUserName(connectionDesc.name())); + if (!m_dbCredentialsProvider->getPassword(connectionDesc.name()).isEmpty()) + db.setPassword(m_dbCredentialsProvider->getPassword(connectionDesc.name())); + } + QString dbName = replaceVariables(connectionDesc.databaseName()); if (connectionDesc.driver().compare("QSQLITE")==0){ if (!defaultDatabasePath().isEmpty()){ @@ -726,7 +745,6 @@ bool DataSourceManager::initAndOpenDB(QSqlDatabase& db, ConnectionDesc& connecti } connected=db.open(); - connectionDesc.setInternal(true); if (!connected) setLastError(db.lastError().text()); return connected; } @@ -758,10 +776,17 @@ bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) } if (!QSqlDatabase::contains(connectionDesc->name())){ - QSqlDatabase db = QSqlDatabase::addDatabase(connectionDesc->driver(),connectionDesc->name()); - connected=initAndOpenDB(db, *connectionDesc); + QString dbError; + { + QSqlDatabase db = QSqlDatabase::addDatabase(connectionDesc->driver(),connectionDesc->name()); + connectionDesc->setInternal(true); + connected=initAndOpenDB(db, *connectionDesc); + dbError = db.lastError().text(); + } if (!connected){ - setLastError(db.lastError().text()); + if (!dbError.trimmed().isEmpty()) + setLastError(dbError); + QSqlDatabase::removeDatabase(connectionDesc->name()); return false; } } else { @@ -868,8 +893,9 @@ bool DataSourceManager::isConnection(const QString &connectionName) bool DataSourceManager::isConnectionConnected(const QString &connectionName) { - if (isConnection(connectionName)){ - return QSqlDatabase::database(connectionName).isOpen(); + if (isConnection(connectionName) && QSqlDatabase::contains(connectionName)){ + QSqlDatabase db = QSqlDatabase::database(connectionName); + return db.isValid() && QSqlDatabase::database(connectionName).isOpen(); } return false; } @@ -893,8 +919,10 @@ void DataSourceManager::disconnectConnection(const QString& connectionName) ConnectionDesc* connectionDesc = connectionByName(connectionName); if (connectionDesc->isInternal()){ - QSqlDatabase db = QSqlDatabase::database(connectionName); - if (db.isOpen()) db.close(); + { + QSqlDatabase db = QSqlDatabase::database(connectionName); + if (db.isOpen()) db.close(); + } if (QSqlDatabase::contains(connectionName)) QSqlDatabase::removeDatabase(connectionName); } diff --git a/limereport/lrdatasourcemanager.h b/limereport/lrdatasourcemanager.h index c60bfa5..77967c5 100644 --- a/limereport/lrdatasourcemanager.h +++ b/limereport/lrdatasourcemanager.h @@ -115,6 +115,7 @@ public: bool addModel(const QString& name, QAbstractItemModel *model, bool owned); void removeModel(const QString& name); ICallbackDatasource* createCallbackDatasouce(const QString &name); + void registerDbCredentialsProvider(IDbCredentialsProvider *provider); void addCallbackDatasource(ICallbackDatasource *datasource, const QString &name); void setReportVariable(const QString& name, const QVariant& value); void deleteVariable(const QString& name); @@ -150,6 +151,7 @@ public: int proxyIndexByName(const QString& dataSourceName); int connectionIndexByName(const QString& connectionName); + QList &conections(); bool dataSourceIsValid(const QString& name); IDataSource* dataSource(const QString& name); IDataSourceHolder* dataSourceHolder(const QString& name); @@ -250,8 +252,7 @@ private: ReportSettings* m_reportSettings; QHash m_groupFunctionsExpressionsMap; QVector m_groupFunctionsExpressions; - - + IDbCredentialsProvider* m_dbCredentialsProvider; }; } diff --git a/limereport/lrdatasourcemanagerintf.h b/limereport/lrdatasourcemanagerintf.h index 85cf388..57bd0c1 100644 --- a/limereport/lrdatasourcemanagerintf.h +++ b/limereport/lrdatasourcemanagerintf.h @@ -37,18 +37,25 @@ class QString; class QAbstractItemModel; namespace LimeReport{ +class IDbCredentialsProvider{ +public: + virtual QString getUserName(const QString& connectionName) = 0; + virtual QString getPassword(const QString& connectionName) = 0; +}; + class IDataSourceManager{ public: - virtual void setReportVariable(const QString& name, const QVariant& value)=0; - virtual void setDefaultDatabasePath(const QString &defaultDatabasePath)=0; - virtual void deleteVariable(const QString& name)=0; - virtual bool containsVariable(const QString& variableName)=0; - virtual QVariant variable(const QString& variableName)=0; - virtual bool addModel(const QString& name, QAbstractItemModel *model, bool owned)=0; - virtual void removeModel(const QString& name)=0; - virtual bool containsDatasource(const QString& dataSourceName)=0; + virtual void setReportVariable(const QString& name, const QVariant& value) = 0; + virtual void setDefaultDatabasePath(const QString &defaultDatabasePath) = 0; + virtual void deleteVariable(const QString& name) = 0; + virtual bool containsVariable(const QString& variableName) = 0; + virtual QVariant variable(const QString& variableName) = 0; + virtual bool addModel(const QString& name, QAbstractItemModel *model, bool owned) = 0; + virtual void removeModel(const QString& name) = 0; + virtual bool containsDatasource(const QString& dataSourceName) = 0; virtual void clearUserVariables()=0; virtual ICallbackDatasource* createCallbackDatasouce(const QString& name) = 0; + virtual void registerDbCredentialsProvider(IDbCredentialsProvider* provider) = 0; //virtual void addCallbackDatasource(ICallbackDatasource* datasource, const QString& name) = 0; }; diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 2ea54d9..fb7ee7c 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -59,7 +59,7 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) : m_printer(new QPrinter(QPrinter::HighResolution)), m_printerSelected(false), m_showProgressDialog(true), m_reportName(""), m_activePreview(0), m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")), - m_reportRendering(false), m_resultIsEditable(true) + m_reportRendering(false), m_resultIsEditable(true), m_passPhrase("HjccbzHjlbyfCkjy") { m_datasources = new DataSourceManager(this); m_datasources->setReportSettings(&m_reportSettings); @@ -513,14 +513,29 @@ bool ReportEnginePrivate::loadFromFile(const QString &fileName) { if (!QFile::exists(fileName)) return false; - clearReport(); + clearReport(); ItemsReaderIntf::Ptr reader = FileXMLReader::create(fileName); + reader->setPassPhrase(m_passPhrase); if (reader->first()){ if (reader->readItem(this)){ m_fileName=fileName; QFileInfo fi(fileName); m_reportName = fi.fileName(); + + QString dbSettingFileName = fi.absolutePath()+"/"+fi.baseName()+".db"; + if (QFile::exists(dbSettingFileName)){ + QSettings dbcredentals(dbSettingFileName, QSettings::IniFormat); + foreach (ConnectionDesc* connection, dataManager()->conections()) { + if (!connection->keepDBCredentials()){ + dbcredentals.beginGroup(connection->name()); + connection->setUserName(dbcredentals.value("user").toString()); + connection->setPassword(dbcredentals.value("password").toString()); + dbcredentals.endGroup(); + } + } + } + dataManager()->connectAutoConnections(); return true; }; @@ -533,6 +548,7 @@ bool ReportEnginePrivate::loadFromByteArray(QByteArray* data, const QString &nam clearReport(); ItemsReaderIntf::Ptr reader = ByteArrayXMLReader::create(data); + reader->setPassPhrase(m_passPhrase); if (reader->first()){ if (reader->readItem(this)){ m_fileName = ""; @@ -548,6 +564,7 @@ bool ReportEnginePrivate::loadFromString(const QString &report, const QString &n clearReport(); ItemsReaderIntf::Ptr reader = StringXMLreader::create(report); + reader->setPassPhrase(m_passPhrase); if (reader->first()){ if (reader->readItem(this)){ m_fileName = ""; @@ -566,10 +583,35 @@ bool ReportEnginePrivate::saveToFile(const QString &fileName) if (fi.suffix().isEmpty()) fn+=".lrxml"; + QString dbSettingFileName = fi.absolutePath()+"/"+fi.baseName()+".db"; + QSettings dbcredentals(dbSettingFileName, QSettings::IniFormat); + + foreach (ConnectionDesc* connection, dataManager()->conections()) { + if (!connection->keepDBCredentials()){ + dbcredentals.beginGroup(connection->name()); + dbcredentals.setValue("user",connection->userName()); + dbcredentals.setValue("password",connection->password()); + dbcredentals.endGroup(); + connection->setPassword(""); + connection->setUserName(""); + } + } + QScopedPointer< ItemsWriterIntf > writer(new XMLWriter()); + writer->setPassPhrase(m_passPhrase); writer->putItem(this); - m_fileName=fn; + m_fileName=fn; bool saved = writer->saveToFile(fn); + + foreach (ConnectionDesc* connection, dataManager()->conections()) { + if (!connection->keepDBCredentials()){ + dbcredentals.beginGroup(connection->name()); + connection->setUserName(dbcredentals.value("user").toString()); + connection->setPassword(dbcredentals.value("password").toString()); + dbcredentals.endGroup(); + } + } + if (saved){ foreach(PageDesignIntf* page, m_pages){ page->setToSaved(); @@ -581,6 +623,7 @@ bool ReportEnginePrivate::saveToFile(const QString &fileName) QByteArray ReportEnginePrivate::saveToByteArray() { QScopedPointer< ItemsWriterIntf > writer(new XMLWriter()); + writer->setPassPhrase(m_passPhrase); writer->putItem(this); QByteArray result = writer->saveToByteArray(); if (!result.isEmpty()){ @@ -593,6 +636,7 @@ QByteArray ReportEnginePrivate::saveToByteArray() QString ReportEnginePrivate::saveToString(){ QScopedPointer< ItemsWriterIntf > writer(new XMLWriter()); + writer->setPassPhrase(m_passPhrase); writer->putItem(this); QString result = writer->saveToString(); if (!result.isEmpty()){ @@ -629,6 +673,11 @@ QString ReportEnginePrivate::renderToString() }else return QString(); } +void ReportEnginePrivate::setPassPhrase(const QString &passPhrase) +{ + m_passPhrase = passPhrase; +} + bool ReportEnginePrivate::resultIsEditable() const { return m_resultIsEditable; @@ -807,6 +856,12 @@ bool ReportEngine::isBusy() return d->isBusy(); } +void ReportEngine::setPassPharse(QString &passPharse) +{ + Q_D(ReportEngine); + d->setPassPhrase(passPharse); +} + void ReportEngine::setShowProgressDialog(bool value) { Q_D(ReportEngine); diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index 0d5b309..dbbb2a8 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -101,6 +101,7 @@ public: void setResultEditable(bool value); bool resultIsEditable(); bool isBusy(); + void setPassPharse(QString& passPharse); signals: void renderStarted(); void renderFinished(); diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index 85aff24..4ec3508 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -125,6 +125,8 @@ public: bool resultIsEditable() const; void setResultEditable(bool value); + void setPassPhrase(const QString &passPhrase); + signals: void pagesLoadFinished(); void datasourceCollectionLoadFinished(const QString& collectionName); @@ -175,6 +177,7 @@ private: ReportSettings m_reportSettings; bool m_reportRendering; bool m_resultIsEditable; + QString m_passPhrase; }; } diff --git a/limereport/lrsimplecrypt.cpp b/limereport/lrsimplecrypt.cpp index 0b9aa06..d79273e 100644 --- a/limereport/lrsimplecrypt.cpp +++ b/limereport/lrsimplecrypt.cpp @@ -41,6 +41,8 @@ const int b = 16; /* number of bytes in key */ const int c = 4; /* number words in key = ceil(8*b/w)*/ const int t = 26; /* size of table S = 2*(r+1) words */ +const char* passPhrase = "HjccbzHjlbyfCkjy"; + WORD P = 0xb7e15163, Q = 0x9e3779b9; #define ROTL(x,y) (((x)<<(y&(w-1))) | ((x)>>(w-(y&(w-1))))) @@ -64,11 +66,15 @@ namespace LimeReport { class ChipperPrivate{ friend class Chipper; +public: + ChipperPrivate():m_prepared(false){} + bool isPrepared(){ return m_prepared;} private: void RC5_SETUP(const char *K); void RC5_ENCRYPT(WORD *pt, WORD *ct); void RC5_DECRYPT(WORD *ct, WORD *pt); WORD S[26]; + bool m_prepared; }; void ChipperPrivate::RC5_SETUP(const char *K) @@ -82,6 +88,7 @@ void ChipperPrivate::RC5_SETUP(const char *K) A = S[i] = ROTL(S[i]+(A+B),3); B = L[j] = ROTL(L[j]+(A+B),(A+B)); } + m_prepared = true; } void ChipperPrivate::RC5_ENCRYPT(WORD *pt, WORD *ct) @@ -111,7 +118,8 @@ QByteArray Chipper::cryptString(QString value) buff += value; WTB pt, ct, prior; - d->RC5_SETUP("HjccbzHjlbyfCkjy"); + if (!d->isPrepared()) + d->RC5_SETUP(passPhrase); prior.word[0]=0; prior.word[1]=0; @@ -144,7 +152,8 @@ QString Chipper::decryptByteArray(QByteArray value) QByteArray result; WTB pt, ct, prior; - d->RC5_SETUP("HjccbzHjlbyfCkjy"); + if (!d->isPrepared()) + d->RC5_SETUP(passPhrase); prior.word[0] = 0; prior.word[1] = 0; @@ -174,6 +183,14 @@ QString Chipper::decryptByteArray(QByteArray value) Chipper::Chipper(): d(new ChipperPrivate()){} +Chipper::Chipper(QString passphrase): d(new ChipperPrivate()) +{ + if (!passphrase.trimmed().isEmpty()){ + passphrase = passphrase.leftJustified(16,'#'); + d->RC5_SETUP(passphrase.toLatin1().data()); + } +} + Chipper::~Chipper() { delete d; diff --git a/limereport/lrsimplecrypt.h b/limereport/lrsimplecrypt.h index 68978b5..4088726 100644 --- a/limereport/lrsimplecrypt.h +++ b/limereport/lrsimplecrypt.h @@ -42,6 +42,7 @@ public: QByteArray cryptString(QString value); QString decryptByteArray(QByteArray value); Chipper(); + Chipper(QString passphrase); ~Chipper(); private: ChipperPrivate* d; diff --git a/limereport/serializators/lrserializatorintf.h b/limereport/serializators/lrserializatorintf.h index ce6a44b..b16263a 100644 --- a/limereport/serializators/lrserializatorintf.h +++ b/limereport/serializators/lrserializatorintf.h @@ -35,10 +35,16 @@ namespace LimeReport { class SerializatorIntf { public: - virtual QVariant loadValue()=0; - virtual void save(const QVariant& value,QString name)=0; + virtual QVariant loadValue() = 0; + virtual void save(const QVariant& value,QString name) = 0; virtual ~SerializatorIntf(){} }; +class CryptedSerializator : public virtual SerializatorIntf +{ +public: + virtual void setPassPhrase(const QString& passPhrase) = 0; +}; + } #endif // LRSERIALIZATORINTF_H diff --git a/limereport/serializators/lrstorageintf.h b/limereport/serializators/lrstorageintf.h index 85fb7ad..74b83ef 100644 --- a/limereport/serializators/lrstorageintf.h +++ b/limereport/serializators/lrstorageintf.h @@ -39,18 +39,19 @@ namespace LimeReport{ class ObjectLoadingStateIntf{ public: - virtual bool isLoading()=0; - virtual void objectLoadStarted()=0; - virtual void objectLoadFinished()=0; + virtual bool isLoading() = 0; + virtual void objectLoadStarted() = 0; + virtual void objectLoadFinished() = 0; }; class ItemsWriterIntf { public: - virtual void putItem(QObject* item)=0; + virtual void putItem(QObject* item) = 0; virtual bool saveToFile(QString fileName) = 0; virtual QString saveToString() = 0; virtual QByteArray saveToByteArray() = 0; + virtual void setPassPhrase(const QString& passPhrase) = 0; virtual ~ItemsWriterIntf(){} }; @@ -58,14 +59,15 @@ class ItemsReaderIntf { public: typedef QSharedPointer Ptr; - virtual bool first()=0; - virtual bool next()=0; - virtual bool prior()=0; - virtual QString itemType()=0; - virtual QString itemClassName()=0; - virtual bool readItem(QObject *item)=0; - virtual int firstLevelItemsCount()=0; - virtual QString lastError()=0; + virtual bool first() = 0; + virtual bool next() = 0; + virtual bool prior() = 0; + virtual QString itemType() = 0; + virtual QString itemClassName() = 0; + virtual bool readItem(QObject *item) = 0; + virtual int firstLevelItemsCount() = 0; + virtual QString lastError() = 0; + virtual void setPassPhrase(const QString& passPhrase) = 0; virtual ~ItemsReaderIntf(){} }; diff --git a/limereport/serializators/lrxmlbasetypesserializators.cpp b/limereport/serializators/lrxmlbasetypesserializators.cpp index ebc4260..c0c2ce7 100644 --- a/limereport/serializators/lrxmlbasetypesserializators.cpp +++ b/limereport/serializators/lrxmlbasetypesserializators.cpp @@ -109,7 +109,7 @@ void XmlQStringSerializator::save(const QVariant &value, QString name) QDomElement _node = doc()->createElement(name); _node.setAttribute("Type","QString"); if (name.compare("password")==0){ - Chipper chipper; + Chipper chipper(passPhrase()); QByteArray ba = chipper.cryptString(value.toString()); //ba.append(); _node.setAttribute("Value",QString(ba.toBase64())); @@ -123,7 +123,7 @@ QVariant XmlQStringSerializator::loadValue() { if (node()->tagName().compare("password")==0){ QByteArray ba; - Chipper chipper; + Chipper chipper(passPhrase()); ba.append(node()->attribute("Value").toLatin1()); return chipper.decryptByteArray(QByteArray::fromBase64(ba)); } else diff --git a/limereport/serializators/lrxmlbasetypesserializators.h b/limereport/serializators/lrxmlbasetypesserializators.h index 70bd40d..56f62c1 100644 --- a/limereport/serializators/lrxmlbasetypesserializators.h +++ b/limereport/serializators/lrxmlbasetypesserializators.h @@ -36,7 +36,7 @@ namespace LimeReport{ -class XmlBaseSerializator : public SerializatorIntf{ +class XmlBaseSerializator : public virtual SerializatorIntf{ public: XmlBaseSerializator(QDomDocument *doc, QDomElement *node):m_doc(doc),m_node(node){} protected: @@ -48,10 +48,21 @@ private: QDomElement *m_node; }; -class XmlQStringSerializator : public XmlBaseSerializator +class XmlCryptedSerializator : public XmlBaseSerializator, public virtual CryptedSerializator{ +public: + XmlCryptedSerializator(QDomDocument *doc, QDomElement *node) + :XmlBaseSerializator(doc, node){} + virtual void setPassPhrase(const QString& passPhrase) {m_passPhrase = passPhrase;} +protected: + QString passPhrase(){ return m_passPhrase;} +private: + QString m_passPhrase; +}; + +class XmlQStringSerializator : public XmlCryptedSerializator { public: - XmlQStringSerializator(QDomDocument *doc, QDomElement *node):XmlBaseSerializator(doc,node){} + XmlQStringSerializator(QDomDocument *doc, QDomElement *node):XmlCryptedSerializator(doc,node){} private: virtual void save(const QVariant &value,QString name); virtual QVariant loadValue(); diff --git a/limereport/serializators/lrxmlreader.cpp b/limereport/serializators/lrxmlreader.cpp index 545c4ca..bee2ff8 100644 --- a/limereport/serializators/lrxmlreader.cpp +++ b/limereport/serializators/lrxmlreader.cpp @@ -135,6 +135,11 @@ QString XMLReader::lastError() return m_error; } +void XMLReader::setPassPhrase(const QString &passPhrase) +{ + m_passPhrase = passPhrase; +} + bool XMLReader::extractFirstNode() { if (m_firstNode.isNull()){ @@ -166,6 +171,10 @@ QVariant XMLReader::getValue(QDomElement *node) if (creator) { QScopedPointerserializator(creator(m_doc.data(),node)); + CryptedSerializator* cs = dynamic_cast(serializator.data()); + if (cs){ + cs->setPassPhrase(m_passPhrase); + } return serializator->loadValue(); } return QVariant(); diff --git a/limereport/serializators/lrxmlreader.h b/limereport/serializators/lrxmlreader.h index f677c68..0bc17ee 100644 --- a/limereport/serializators/lrxmlreader.h +++ b/limereport/serializators/lrxmlreader.h @@ -44,14 +44,17 @@ public: XMLReader(); XMLReader(QSharedPointer doc); protected: +//ItemsReaderIntf interface + bool first(); + bool next(); + bool prior(); + QString itemType(); + QString itemClassName(); + bool readItem(QObject *item); + int firstLevelItemsCount(); + QString lastError(); + void setPassPhrase(const QString &passPhrase); - virtual bool first(); - virtual bool next(); - virtual bool prior(); - virtual QString itemType(); - virtual QString itemClassName(); - virtual bool readItem(QObject *item); - virtual int firstLevelItemsCount(); virtual bool prepareReader(QDomDocument *doc); void readItemFromNode(QObject *item, QDomElement *node); @@ -60,7 +63,7 @@ protected: void readCollection(QObject *item, QDomElement *node); QVariant getValue(QDomElement *node); - virtual QString lastError(); + protected: bool extractFirstNode(); QString m_error; @@ -68,6 +71,11 @@ private: QSharedPointer m_doc; QDomElement m_curNode; QDomElement m_firstNode; + QString m_passPhrase; + + + + }; class FileXMLReader : public XMLReader{ diff --git a/limereport/serializators/lrxmlwriter.cpp b/limereport/serializators/lrxmlwriter.cpp index 1a6e68a..3038373 100644 --- a/limereport/serializators/lrxmlwriter.cpp +++ b/limereport/serializators/lrxmlwriter.cpp @@ -113,6 +113,11 @@ QByteArray XMLWriter::saveToByteArray() return res; } +void XMLWriter::setPassPhrase(const QString &passPhrase) +{ + m_passPhrase = passPhrase; +} + QDomElement XMLWriter::putQObjectItem(QString name, QObject *item) { Q_UNUSED(name) @@ -158,6 +163,10 @@ void XMLWriter::saveProperty(QString name, QObject* item, QDomElement *node) if (creator) { QScopedPointer serializator(creator(m_doc.data(),node)); + CryptedSerializator* cs = dynamic_cast(serializator.data()); + if (cs){ + cs->setPassPhrase(m_passPhrase); + } serializator->save( item->property(name.toLatin1()), name diff --git a/limereport/serializators/lrxmlwriter.h b/limereport/serializators/lrxmlwriter.h index 399e2e2..0259a75 100644 --- a/limereport/serializators/lrxmlwriter.h +++ b/limereport/serializators/lrxmlwriter.h @@ -44,10 +44,13 @@ public: XMLWriter(QSharedPointer doc); ~XMLWriter() {} private: + // ItemsWriterIntf interface void putItem(QObject* item); bool saveToFile(QString fileName); QString saveToString(); QByteArray saveToByteArray(); + void setPassPhrase(const QString &passPhrase); + void init(); QDomElement putQObjectItem(QString name, QObject* item); void putChildQObjectItem(QString name, QObject* item, QDomElement* parentNode); @@ -66,6 +69,7 @@ private: QSharedPointer m_doc; QString m_fileName; QDomElement m_rootElement; + QString m_passPhrase; }; } From bf81d3f98cfec759c0c9648d3dbf9255db31bf2f Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 18 Feb 2017 17:22:04 +0300 Subject: [PATCH 053/136] DataBrowser shows application connection --- limereport/databrowser/lrdatabrowser.cpp | 60 ++++++++++++++++++++---- 1 file changed, 51 insertions(+), 9 deletions(-) diff --git a/limereport/databrowser/lrdatabrowser.cpp b/limereport/databrowser/lrdatabrowser.cpp index ba89566..b6db492 100644 --- a/limereport/databrowser/lrdatabrowser.cpp +++ b/limereport/databrowser/lrdatabrowser.cpp @@ -426,18 +426,58 @@ void DataBrowser::initConnections() { ui->dataTree->clear(); QListitems; - foreach(QString connectionName,m_report->dataManager()->connectionNames()){ + + QStringList connections = QSqlDatabase::connectionNames(); + foreach(QString connectionName, m_report->dataManager()->connectionNames()){ + if (!connections.contains(connectionName,Qt::CaseInsensitive)){ + connections.append(connectionName); + } + } + qSort(connections); + foreach (QString connectionName, connections) { QTreeWidgetItem *item=new QTreeWidgetItem( ui->dataTree, QStringList(ConnectionDesc::connectionNameForUser(connectionName)), DataBrowserTree::Connection ); - if (m_report->dataManager()->isConnectionConnected(connectionName)) + if (!m_report->dataManager()->connectionNames().contains(ConnectionDesc::connectionNameForReport(connectionName), Qt::CaseInsensitive)) + { item->setIcon(0,QIcon(":/databrowser/images/database_connected")); - else - item->setIcon(0,QIcon(":/databrowser/images/database_disconnected")); + } else { + if (m_report->dataManager()->isConnectionConnected(connectionName)) + item->setIcon(0,QIcon(":/databrowser/images/database_connected")); + else + item->setIcon(0,QIcon(":/databrowser/images/database_disconnected")); + } items.append(item); } + + +// foreach (QString connectionName, connections) { +// QTreeWidgetItem *item=new QTreeWidgetItem( +// ui->dataTree, +// QStringList(ConnectionDesc::connectionNameForUser(connectionName)), +// DataBrowserTree::Connection +// ); +// item->setIcon(0,QIcon(":/databrowser/images/database_connected")); +// } + +// connections = m_report->dataManager()->connectionNames(); +// qSort(connections); +// foreach(QString connectionName,connectionName){ +// if (!QSqlDatabase::contains(connectionName)){ +// QTreeWidgetItem *item=new QTreeWidgetItem( +// ui->dataTree, +// QStringList(ConnectionDesc::connectionNameForUser(connectionName)), +// DataBrowserTree::Connection +// ); +// if (m_report->dataManager()->isConnectionConnected(connectionName)) +// item->setIcon(0,QIcon(":/databrowser/images/database_connected")); +// else +// item->setIcon(0,QIcon(":/databrowser/images/database_disconnected")); +// items.append(item); +// } +// } ui->dataTree->insertTopLevelItems(0,items); } @@ -642,7 +682,8 @@ bool DataBrowser::checkConnectionDesc(ConnectionDesc *connection) bool DataBrowser::containsDefaultConnection() { - bool result = m_report->dataManager()->connectionByName(QSqlDatabase::defaultConnection); + bool result = m_report->dataManager()->connectionByName(QSqlDatabase::defaultConnection) || + QSqlDatabase::contains(QSqlDatabase::defaultConnection); return result; } @@ -660,7 +701,7 @@ void DataBrowser::on_dataTree_currentItemChanged(QTreeWidgetItem *current, QTree { Q_UNUSED(previous) if (current&&(current->type() == DataBrowserTree::Connection)) { - ui->pbConnect->setEnabled(true); + bool internalConnection = m_report->dataManager()->connectionByName(ConnectionDesc::connectionNameForReport(current->text(0))); if (m_report->dataManager()->isConnectionConnected(current->text(0))){ ui->pbConnect->setIcon(QIcon(":/databrowser/images/plug-connect.png")); } else { @@ -668,9 +709,10 @@ void DataBrowser::on_dataTree_currentItemChanged(QTreeWidgetItem *current, QTree } ui->editDataSource->setEnabled(false); ui->deleteDataSource->setEnabled(false); - ui->viewDataSource->setEnabled(false); - ui->changeConnection->setEnabled(true); - ui->deleteConection->setEnabled(true); + ui->viewDataSource->setEnabled(false); + ui->pbConnect->setEnabled(internalConnection); + ui->changeConnection->setEnabled(internalConnection); + ui->deleteConection->setEnabled(internalConnection); ui->errorMessage->setDisabled(true); } else { ui->changeConnection->setEnabled(false); From 28c8ae66e1b64ac33acf96293c872207ae247379 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 21 Feb 2017 18:36:30 +0300 Subject: [PATCH 054/136] Esc close the preview window --- limereport/lrpreviewreportwindow.h | 1 - limereport/lrpreviewreportwindow.ui | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/limereport/lrpreviewreportwindow.h b/limereport/lrpreviewreportwindow.h index bc942be..92b2829 100644 --- a/limereport/lrpreviewreportwindow.h +++ b/limereport/lrpreviewreportwindow.h @@ -98,7 +98,6 @@ private slots: void slotScalePercentChanged(int percent); void on_actionShowMessages_toggled(bool value); void on_actionShow_Toolbar_triggered(); - private: ItemsReaderIntf* reader(); void initPercentCombobox(); diff --git a/limereport/lrpreviewreportwindow.ui b/limereport/lrpreviewreportwindow.ui index bca9861..50487cb 100644 --- a/limereport/lrpreviewreportwindow.ui +++ b/limereport/lrpreviewreportwindow.ui @@ -35,7 +35,7 @@ 0 0 800 - 20 + 19 @@ -158,6 +158,9 @@ Close Preview + + Esc + From 3975406487e55ae74f02e0e4b87920b997393fdf Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Tue, 21 Feb 2017 22:16:09 +0300 Subject: [PATCH 055/136] Check connection has been fixed --- limereport/lrdatasourcemanager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index 74dd69e..f0a9bf2 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -667,8 +667,10 @@ void DataSourceManager::addConnectionDesc(ConnectionDesc * connection) bool DataSourceManager::checkConnectionDesc(ConnectionDesc *connection) { if (connectConnection(connection)){ - if (connection->isInternal()) + if (connection->isInternal()){ QSqlDatabase::removeDatabase(connection->name()); + if (designTime()) emit datasourcesChanged(); + } return true; } if (connection->isInternal()) From 117023e9204a10a5e829882719774003e1d8615f Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Wed, 22 Feb 2017 00:20:37 +0300 Subject: [PATCH 056/136] Script browser update has been fixed --- limereport/lrreportdesignwindow.cpp | 1 + limereport/scriptbrowser/lrscriptbrowser.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index 5455529..358aa6b 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -539,6 +539,7 @@ void ReportDesignWindow::startNewReport() m_reportDesignWidget->createStartPage(); m_lblReportName->setText(""); updateRedoUndo(); + m_reportDesignWidget->slotPagesLoadFinished(); m_newPageHeader->setEnabled(true); m_newPageFooter->setEnabled(true); m_newReportHeader->setEnabled(true); diff --git a/limereport/scriptbrowser/lrscriptbrowser.cpp b/limereport/scriptbrowser/lrscriptbrowser.cpp index ea38798..5f90bf3 100644 --- a/limereport/scriptbrowser/lrscriptbrowser.cpp +++ b/limereport/scriptbrowser/lrscriptbrowser.cpp @@ -64,6 +64,7 @@ void ScriptBrowser::setReportEditor(ReportDesignWidget* report) void ScriptBrowser::updateFunctionTree() { + ui->twFunctions->clear(); ScriptEngineManager* sm = reportEditor()->scriptManager(); QMap categ; foreach(ScriptFunctionDesc fd, sm->functionsDescriber()){ From a2c93601d0fd6df43272ae3ab5cacac79a6c2d5f Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 24 Feb 2017 07:13:43 +0300 Subject: [PATCH 057/136] Items context menu has been added Fields drag & drop init band datasource if it empty --- limereport/items/lrtextitem.cpp | 46 +++++++++++++++++++++++ limereport/items/lrtextitem.h | 2 + limereport/lrbanddesignintf.cpp | 37 +++++++++++++++++++ limereport/lrbanddesignintf.h | 4 +- limereport/lrbasedesignintf.cpp | 51 ++++++++++++++++++++++++++ limereport/lrbasedesignintf.h | 15 ++++++-- limereport/lrpagedesignintf.cpp | 19 +++++++++- limereport/lrpageitemdesignintf.cpp | 9 +++++ limereport/lrpageitemdesignintf.h | 1 + limereport/serializators/lrxmlreader.h | 5 --- 10 files changed, 177 insertions(+), 12 deletions(-) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index cddcfee..664bd20 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -42,6 +42,7 @@ #include "lrsimpletagparser.h" #include "lrtextitemeditor.h" #include "lrreportengine_p.h" +#include namespace{ @@ -80,6 +81,51 @@ int TextItem::fakeMarginSize() const{ return marginSize()+5; } +void TextItem::preparePopUpMenu(QMenu &menu) +{ + QAction* editAction = menu.addAction(QIcon(":/report/images/edit_pecil2.png"),tr("Edit")); + menu.insertAction(menu.actions().at(0),editAction); + menu.insertSeparator(menu.actions().at(1)); + + menu.addSeparator(); + + QAction* action = menu.addAction(tr("Auto height")); + action->setCheckable(true); + action->setChecked(autoHeight()); + + action = menu.addAction(tr("Allow HTML")); + action->setCheckable(true); + action->setChecked(allowHTML()); + + action = menu.addAction(tr("Allow HTML in fields")); + action->setCheckable(true); + action->setChecked(allowHTMLInFields()); + + action = menu.addAction(tr("Strethc to max height")); + action->setCheckable(true); + action->setChecked(stretchToMaxHeight()); + +} + +void TextItem::processPopUpAction(QAction *action) +{ + if (action->text().compare(tr("Edit")) == 0){ + this->showEditorDialog(); + } + if (action->text().compare(tr("Auto height")) == 0){ + setProperty("autoHeight",action->isChecked()); + } + if (action->text().compare(tr("Allow HTML")) == 0){ + setProperty("allowHTML",action->isChecked()); + } + if (action->text().compare(tr("Allow HTML in fields")) == 0){ + setProperty("allowHTMLInFields",action->isChecked()); + } + if (action->text().compare(tr("Strethc to max height")) == 0){ + setProperty("stretchToMaxHeight",action->isChecked()); + } +} + void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, QWidget* widget) { Q_UNUSED(widget); Q_UNUSED(style); diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index ac9b5b6..6dc735b 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -172,6 +172,8 @@ protected: int fakeMarginSize() const; QString getTextPart(int height, int skipHeight); void restoreLinksEvent(); + void preparePopUpMenu(QMenu &menu); + void processPopUpAction(QAction *action); private: void initTextSizes() const; void setTextFont(TextPtr text, const QFont &value) const; diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index c6993ad..9a704f2 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -33,6 +33,7 @@ #include #include #include +#include namespace LimeReport { @@ -431,6 +432,34 @@ void BandDesignIntf::moveItemsDown(qreal startPos, qreal offset){ } } +void BandDesignIntf::preparePopUpMenu(QMenu &menu) +{ + foreach (QAction* action, menu.actions()) { + if (action->text().compare(tr("Bring to top")) == 0 || + action->text().compare(tr("Send to back")) == 0 ) + action->setEnabled(false); + } + + menu.addSeparator(); + QAction* autoHeightAction = menu.addAction(tr("Auto height")); + autoHeightAction->setCheckable(true); + autoHeightAction->setChecked(autoHeight()); + + QAction* autoSplittableAction = menu.addAction(tr("Splittable")); + autoSplittableAction->setCheckable(true); + autoSplittableAction->setChecked(isSplittable()); +} + +void BandDesignIntf::processPopUpAction(QAction *action) +{ + if (action->text().compare(tr("Auto height")) == 0){ + setProperty("autoHeight",action->isChecked()); + } + if (action->text().compare(tr("Splittable")) == 0){ + setProperty("splittable",action->isChecked()); + } +} + BaseDesignIntf* BandDesignIntf::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent) { int maxBottom = 0; @@ -804,6 +833,14 @@ void BandDesignIntf::setStartNewPage(bool startNewPage) m_startNewPage = startNewPage; } +void BandDesignIntf::setAutoHeight(bool value){ + if (m_autoHeight != value){ + m_autoHeight=value; + if (!isLoading()) + notify("autoHeight",!value,value); + } +} + bool BandDesignIntf::reprintOnEachPage() const { return m_reprintOnEachPage; diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index fea245a..0d92f5e 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -207,7 +207,7 @@ public: bool startNewPage() const; void setStartNewPage(bool startNewPage); - void setAutoHeight(bool value){m_autoHeight=value;} + void setAutoHeight(bool value); bool autoHeight(){return m_autoHeight;} bool startFromNewPage() const; @@ -244,6 +244,8 @@ protected: void setColumnsCount(int value); void setColumnsFillDirection(BandColumnsLayoutType value); void moveItemsDown(qreal startPos, qreal offset); + void preparePopUpMenu(QMenu &menu); + void processPopUpAction(QAction *action); private slots: void childBandDeleted(QObject* band); private: diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index f0f7e2b..2f5f4db 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -35,6 +35,8 @@ #include "qgraphicsitem.h" #include "lrdesignelementsfactory.h" #include "lrhorizontallayout.h" +#include "serializators/lrstorageintf.h" +#include "serializators/lrxmlreader.h" #include @@ -43,6 +45,8 @@ #include #include #include +#include +#include namespace LimeReport { @@ -1147,6 +1151,53 @@ void BaseDesignIntf::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) QGraphicsItem::mouseDoubleClickEvent(event); } +void BaseDesignIntf::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) +{ + PageDesignIntf* page = dynamic_cast(scene()); + if (!page->selectedItems().contains(this)){ + page->clearSelection(); + this->setSelected(true); + } + QMenu menu; + QAction* copyAction = menu.addAction(QIcon(":/report/images/copy.png"), tr("Copy")); + copyAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C)); + QAction* cutAction = menu.addAction(QIcon(":/report//images/cut"), tr("Cut")); + cutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X)); + QAction* pasteAction = menu.addAction(QIcon(":/report/images/paste.png"), tr("Paste")); + pasteAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V)); + pasteAction->setEnabled(false); + QClipboard *clipboard = QApplication::clipboard(); + ItemsReaderIntf::Ptr reader = StringXMLreader::create(clipboard->text()); + if (reader->first() && reader->itemType() == "Object"){ + pasteAction->setEnabled(true); + } + menu.addSeparator(); + QAction* brinToTopAction = menu.addAction(QIcon(":/report//images/bringToTop"), tr("Bring to top")); + QAction* sendToBackAction = menu.addAction(QIcon(":/report//images/sendToBack"), tr("Send to back")); + menu.addSeparator(); + QAction* noBordersAction = menu.addAction(QIcon(":/report//images/noLines"), tr("No borders")); + QAction* allBordersAction = menu.addAction(QIcon(":/report//images/allLines"), tr("All borders")); + preparePopUpMenu(menu); + QAction* a = menu.exec(event->screenPos()); + if (a){ + if (a == cutAction) + page->cut(); + if (a == copyAction) + page->copy(); + if (a == pasteAction) + page->paste(); + if (a == brinToTopAction) + page->bringToFront(); + if (a == sendToBackAction) + page->sendToBack(); + if (a == noBordersAction) + page->setBorders(BaseDesignIntf::NoLine); + if (a == allBordersAction) + page->setBorders(BaseDesignIntf::AllLines); + processPopUpAction(a); + } +} + int BaseDesignIntf::possibleMoveDirectionFlags() const { return m_possibleMoveDirectionFlags; diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index 253da8d..4f615ed 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -124,10 +124,13 @@ public: TopBotom=2, All=3 }; - enum BorderSide { TopLine = 1, - BottomLine = 2, - LeftLine = 4, - RightLine = 8 + enum BorderSide { + NoLine = 0, + TopLine = 1, + BottomLine = 2, + LeftLine = 4, + RightLine = 8, + AllLines = 15 }; enum ObjectState {ObjectLoading, ObjectLoaded, ObjectCreated}; enum ItemAlign {LeftItemAlign,RightItemAlign,CenterItemAlign,ParentWidthItemAlign,DesignedItemAlign}; @@ -293,6 +296,7 @@ protected: void mouseMoveEvent(QGraphicsSceneMouseEvent* event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); + void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); virtual void geometryChangedEvent(QRectF newRect, QRectF oldRect); virtual QPen borderPen(BorderSide side) const; @@ -333,6 +337,9 @@ protected: QVariant m_varValue; + virtual void preparePopUpMenu(QMenu& menu){Q_UNUSED(menu)} + virtual void processPopUpAction(QAction* action){Q_UNUSED(action)} + private: void updateSelectionMarker(); int resizeDirectionFlags(QPointF position); diff --git a/limereport/lrpagedesignintf.cpp b/limereport/lrpagedesignintf.cpp index e0a5ec2..2178d43 100644 --- a/limereport/lrpagedesignintf.cpp +++ b/limereport/lrpagedesignintf.cpp @@ -56,6 +56,7 @@ #include #include + namespace LimeReport { @@ -744,6 +745,15 @@ void PageDesignIntf::dropEvent(QGraphicsSceneDragDropEvent* event) QString data = event->mimeData()->text().remove(0,event->mimeData()->text().indexOf(":")+1); if (isVar) data = data.remove(QRegExp(" \\[.*\\]")); ti->setContent(data); + if (!isVar){ + BandDesignIntf* parentBand = dynamic_cast(ti->parentItem()); + if (parentBand && parentBand->datasourceName().isEmpty()){ + QRegExp dataSource("(?:\\$D\\{\\s*(.*)\\..*\\})"); + if (dataSource.indexIn(data) != -1){ + parentBand->setProperty("datasource",dataSource.cap(1)); + } + } + } } } @@ -1231,8 +1241,13 @@ BaseDesignIntf* PageDesignIntf::findDestObject(BaseDesignIntf* item){ void PageDesignIntf::paste() { QClipboard *clipboard = QApplication::clipboard(); - if (!selectedItems().isEmpty()) { - BaseDesignIntf* destItem = findDestObject(dynamic_cast(selectedItems().at(0))); + BaseDesignIntf* destItem = 0; + ItemsReaderIntf::Ptr reader = StringXMLreader::create(clipboard->text()); + if (reader->first() && reader->itemType() == "Object"){ + if (!selectedItems().isEmpty()) + destItem = findDestObject(dynamic_cast(selectedItems().at(0))); + else + destItem = this->pageItem(); if (destItem){ CommandIf::Ptr command = PasteCommand::create(this, clipboard->text(), destItem); saveCommand(command); diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index 41d89aa..d943a13 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -33,6 +33,7 @@ #include #include +#include namespace LimeReport { @@ -519,6 +520,14 @@ void PageItemDesignIntf::initPageSize(const QSizeF& size) setHeight(size.height()); m_sizeChainging=false; } + +void PageItemDesignIntf::preparePopUpMenu(QMenu &menu) +{ + foreach (QAction* action, menu.actions()) { + if (action->text().compare(tr("Paste")) != 0) + action->setVisible(false); + } +} void PageItemDesignIntf::initPageSize(const PageItemDesignIntf::PageSize &size) { m_sizeChainging = true; diff --git a/limereport/lrpageitemdesignintf.h b/limereport/lrpageitemdesignintf.h index 635655f..2c1fb84 100644 --- a/limereport/lrpageitemdesignintf.h +++ b/limereport/lrpageitemdesignintf.h @@ -127,6 +127,7 @@ protected: void initPageSize(const PageSize &size); void initPageSize(const QSizeF &size); QColor selectionMarkerColor(){return Qt::transparent;} + void preparePopUpMenu(QMenu &menu); private: void paintGrid(QPainter *ppainter); void initColumnsPos(QVector&posByColumns, qreal pos, int columnCount); diff --git a/limereport/serializators/lrxmlreader.h b/limereport/serializators/lrxmlreader.h index 0bc17ee..c0f3508 100644 --- a/limereport/serializators/lrxmlreader.h +++ b/limereport/serializators/lrxmlreader.h @@ -63,7 +63,6 @@ protected: void readCollection(QObject *item, QDomElement *node); QVariant getValue(QDomElement *node); - protected: bool extractFirstNode(); QString m_error; @@ -72,10 +71,6 @@ private: QDomElement m_curNode; QDomElement m_firstNode; QString m_passPhrase; - - - - }; class FileXMLReader : public XMLReader{ From 6c9b4087238bf7d2857020802fa74057f9d15371 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 28 Feb 2017 23:22:48 +0300 Subject: [PATCH 058/136] misprint has been fixed --- limereport/items/lrtextitem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 664bd20..e36d251 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -101,7 +101,7 @@ void TextItem::preparePopUpMenu(QMenu &menu) action->setCheckable(true); action->setChecked(allowHTMLInFields()); - action = menu.addAction(tr("Strethc to max height")); + action = menu.addAction(tr("Stretch to max height")); action->setCheckable(true); action->setChecked(stretchToMaxHeight()); @@ -121,7 +121,7 @@ void TextItem::processPopUpAction(QAction *action) if (action->text().compare(tr("Allow HTML in fields")) == 0){ setProperty("allowHTMLInFields",action->isChecked()); } - if (action->text().compare(tr("Strethc to max height")) == 0){ + if (action->text().compare(tr("Stretch to max height")) == 0){ setProperty("stretchToMaxHeight",action->isChecked()); } } From e9957bd8b550fa532443a2b9a8711d09b89fd200 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 28 Feb 2017 23:23:33 +0300 Subject: [PATCH 059/136] Russian translation has been updated --- translations/limereport_ru.ts | 1125 ++++++++++++--------------------- 1 file changed, 417 insertions(+), 708 deletions(-) diff --git a/translations/limereport_ru.ts b/translations/limereport_ru.ts index 29eb2f1..8282137 100644 --- a/translations/limereport_ru.ts +++ b/translations/limereport_ru.ts @@ -1,139 +1,6 @@ - - - AboutDialog - - About - О программе - - - Author - Автор - - - License - Лицензия - - - Close - Закрыть - - - Version 1.1.1 - Версия - - - - ConnectionDialog - - Connection - Соединение - - - Connection Name - Название - - - Driver - Драйвер - - - Server - Сервер - - - User - Пользователь - - - Password - Пароль - - - Database - База данных - - - Auto connect - Автоматическое соединение - - - Check connection - Проверить соединение - - - Cancel - Отмена - - - Error - Ошибка - - - Connection succsesfully established! - Соединение успешно установлено! - - - Connection Name is empty - Наименование соединения не указано - - - Connection with name - Соединение - - - already exists - уже существует - - - - DataBrowser - - Datasources - Источники данных - - - Add database connection - Добавить соединение с базой - - - Add new datasource - Добавить новый источник данных - - - View data - Просмотр данных в источнике - - - Change datasource - Изменить источник данных - - - Delete datasource - Удалить источник данных - - - Show error - Показать ошибки - - - Variables - Переменные - - - Add new variable - Добавить новую переменную - - - Edit variable - Редактировать переменную - - - Delete variable - Удалить переменную - - + LRVariableDialog @@ -157,46 +24,31 @@ Внимание - - LimeReport::AVariablesHolder - - variable with name - переменная - - - already exists !! - уже существует !! - - - does not exists !! - не существует !! - - LimeReport::AboutDialog About - О программе + О программе Author - Автор + Автор License - Лицензия + Лицензия Close - Закрыть + Закрыть Version 1.1.1 - Версия + Версия 1.1.1 Lime Report - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> @@ -212,7 +64,7 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600; color:#000000;">This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</span></p> <p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt; font-weight:600; color:#000000;"><br /></p> <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; color:#000000;">Copyright 2015 Arin Alexander. All rights reserved.</span></p></body></html> - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> @@ -221,9 +73,9 @@ p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Arin Alexander</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">arin_a@bk.ru</p></body></html> - + - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -338,7 +190,7 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; font-style:italic; color:#000000;">signature of Ty Coon</span><span style=" font-family:'monospace'; color:#000000;">, 1 April 1990</span></p> <p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">Ty Coon, President of Vice</span></p> <p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">That's all there is to it!</span></p></body></html> - + @@ -382,76 +234,127 @@ p, li { white-space: pre-wrap; } connected to соединён с + + Bring to top + На передний план + + + Send to back + На задний план + + + Auto height + Автоматическая высота + + + Splittable + Разбивать содержимое на части + + + + LimeReport::BaseDesignIntf + + Copy + Копировать + + + Cut + Вырезать + + + Paste + Вставить + + + Bring to top + На передний план + + + Send to back + На задний план + + + No borders + Удалить границы + + + All borders + Внешние границы + LimeReport::ConnectionDialog Connection - Соединение + Соединение + + + Use default application connection + Использовать соединение по умолчанию Connection Name - Название + Название Driver - Драйвер + Драйвер Server - Сервер + Сервер User - Пользователь + Пользователь Password - Пароль + Пароль Database - База данных + База данных Auto connect - Автоматическое соединение + Автоматическое соединение Check connection - Проверить соединение + Проверить соединение Cancel - Отмена + Отмена Error - Ошибка + Ошибка Connection succsesfully established! - Соединение успешно установлено! + Соединение успешно установлено! Connection Name is empty - Наименование соединения не указано + Наименование соединения не указано Connection with name - Соединение + Соединение already exists - уже существует + уже существует ... - + Ok - + Ок @@ -468,6 +371,17 @@ p, li { white-space: pre-wrap; } Данные + + LimeReport::ScriptBrowser + + Functions + Функции + + + Dialogs + Диалоги + + LimeReport::DataBrowser @@ -476,43 +390,43 @@ p, li { white-space: pre-wrap; } Add database connection - Добавить соединение с базой + Добавить соединение с базой Add new datasource - Добавить новый источник данных + Добавить новый источник данных View data - Просмотр данных в источнике + Просмотр данных в источнике Change datasource - Изменить источник данных + Изменить источник данных Delete datasource - Удалить источник данных + Удалить источник данных Show error - Показать ошибки + Показать ошибки Variables - Переменные + Переменные Add new variable - Добавить новую переменную + Добавить новую переменную Edit variable - Редактировать переменную + Редактировать переменную Delete variable - Удалить переменную + Удалить переменную Attention @@ -523,46 +437,42 @@ p, li { white-space: pre-wrap; } Do you really want delete "%1" connection ? Вы действительно хотите удалить "%1" соединение ? - - User variables - Пользовательские переменные - System variables Системные переменные + + User variables + Пользовательские переменные + Do you really want to delete "%1" datasource ? Do you really want delete "%1" datasource ? Вы действительно хотите удалить источник данных "%1" ? - - Do you really want delete variable "%1" ? - Вы действительно хотите удалить переменную "%1" ? - Error Ошибка ... - + Do you really want to delete variable "%1" ? - + Вы действительно хотите удалить переменную "%1" ? Grab variable - + Захватить переменную Report variables - + Переменные отчета External variables - + Внешние переменные @@ -604,7 +514,7 @@ p, li { white-space: pre-wrap; } Variable "%1" not found! - + Переменная "%1" не найдена! @@ -759,7 +669,7 @@ p, li { white-space: pre-wrap; } All borders - Внешние границы + Все границы @@ -787,17 +697,6 @@ p, li { white-space: pre-wrap; } Объекты - - LimeReport::PageDesignIntf - - Warning - Предупреждение - - - Multi band deletion not allowed - Удаление нескольких бандов запрещено - - LimeReport::PageFooter @@ -816,126 +715,110 @@ p, li { white-space: pre-wrap; } LimeReport::PreviewReportWidget Form - + Форма PDF file name - Имя PDF файла + Имя PDF файла Report file name - Файл отчета + Имя файла отчета LimeReport::PreviewReportWindow View - Просмотр + Просмотр Report - Отчет + Отчет toolBar - Панель инструментов + Панель инструментов Print - Печать + Печать Zoom In - Увеличить + Увеличить Zoom Out - Уменьшить + Уменьшить Prior Page - Предыдущая страница + Предыдущая страница Next Page - Следующая страница + Следующая страница Close Preview - Закрыть + Закрыть Edit Mode - Режим редактирования + Режим редактирования Save to file - Записать в файл + Сохранить в файл Show errors - Показать ошибки + Показать ошибки First Page - Первая страница + Первая страница First page - Первая страница + Первая страница Last Page - Последняя страница + Последняя страница Print To PDF - Печать в PDF + Печать в PDF Page: - Страница: + Страница: of %1 - из %1 - - - Report file name - Файл отчета - - - PDF file name - Имя PDF файла + из %1 Preview - + Предосмотр Ctrl+P - + Fit page width - + По ширине страницы Fit page - + Страница целиком One to one - - - - Font - Шрифт - - - Text align - + Один к одному @@ -955,21 +838,61 @@ p, li { white-space: pre-wrap; } Property value Значение + + fullPage + Страница целиком + + + gridStep + Шаг сетки + + + oldPrintMode + Старый режим печати + + + resourcePath + Путь к ресурсам + + + autoSize + Автоматический размер + + + center + Центрировать + + + field + Поле + + + image + Изображение + + + keepAspectRatio + Сохранять соотношение сторон + + + scale + Масштабировать + leftMargin - Отступ левый + Левый отступ rightMargin - Отступ правый + Правый отступ topMargin - Отступ верхний + Верхний отступ bottomMargin - Отступ нижний + Нижний отступ objectName @@ -979,13 +902,25 @@ p, li { white-space: pre-wrap; } borders Границы + + condition + Условие + + + keepGroupTogether + Сохранять группу вместе + + + groupFieldName + Столбец группы + geometry Геометрия itemAlign - Расположение объекта + Выравнивание объекта pageOrientation @@ -1013,19 +948,19 @@ p, li { white-space: pre-wrap; } datasource - источник данных + Источник данных alignment - расположение + Выравнивание content - содержимое + Содержимое itemLocation - Расположение объекта + Расположение объекта Warning @@ -1033,115 +968,187 @@ p, li { white-space: pre-wrap; } reprintOnEachPage - + Печатать на каждой странице borderLineSize - + Ширина линии границы + + + textIndent + Отступ текста + + + textLayoutDirection + Направление текста + + + lineSpacing + Межстрочный интервал + + + underlines + Подчеркивание + + + underlineLineSize + Толщина подчеркивания + + + format + Формат + + + valueType + Тип значения + + + adaptFontToSize + Шрифт по размеру + + + followTo + Следует за + + + backgroundBrushStyle + Стиль заполнения фона autoHeight - + Автоматическая высота backgroundColor - + Цвет фона - columnCount - + alternateBackgroundColor + Альтернативный цвет фона + + + columnsCount + Количество столбцов columnsFillDirection - + Направление заполнения столбцов keepBottomSpace - + Сохранять отступ снизу keepFooterTogether - + Привязать колонтитул к данным keepSubdetailTogether - + Привязать подчиненные данные printIfEmpty - + Печатать, если пустое sliceLastRow - + Разрезать последнюю запись splittable - + Разбивать содержимое на части angle - + Угол поворота autoWidth - + Автоматическая ширина backgroundMode - + Режим фона backgroundOpacity - + Заполненость фона font - + Шрифт fontColor - + Цвет шрифта foregroundOpacity - + Заполненость переднего плана margin - + Поля stretchToMaxHeight - + Растягивать до максимальной высоты trimValue - + Обрезать пробелы с краев lineWidth - + Ширина линии opacity - + Заполненость penStyle - + Стиль пера shape - + Фигура shapeBrush - + Кисть фигуры shapeBrushColor - + Цвет кисти + + + allowHTML + Разрешить HTML + + + allowHTMLInFields + Разрешить HTML в полях + + + printAlways + Печатать всегда + + + borderColor + Цвет границ + + + startNewPage + Начинать новую страницу + + + startFromNewPage + Начинать с новой страницы + + + resetPageNumber + Обнулять номер страницы @@ -1172,22 +1179,6 @@ p, li { white-space: pre-wrap; } Report file name Файл отчета - - Page - - - - Script - - - - Error - Ошибка - - - Wrong file format - - LimeReport::ReportDesignWindow @@ -1207,6 +1198,14 @@ p, li { white-space: pre-wrap; } Redo Повторить действие + + New Report Page + Новая страница отчета + + + Delete Report Page + Удалить страницу отчета + Copy Копировать @@ -1355,6 +1354,10 @@ p, li { white-space: pre-wrap; } GroupFooter Завершение группы + + Tear-off Band + Отрыв данных + File Файл @@ -1379,9 +1382,13 @@ p, li { white-space: pre-wrap; } Data Browser Инспектор данных + + Script Browser + Инспектор скриптов + Report has been modified ! Do you want save the report ? - Отчет был изменен ! Хотите его записать ? + Отчет был изменен ! Хотите его сохранить ? Report file name @@ -1393,39 +1400,27 @@ p, li { white-space: pre-wrap; } Abort - О генераторе + Прервать page rendered - создается страница + создается страница Warning - Предупреждение + Предупреждение Use magnet - + Использовать магнит Recent Files - + Последние файлы File "%1" not found! - - - - New Report Page - - - - Delete Report Page - - - - Script Browser - + Файл "%1" не найден! @@ -1436,7 +1431,7 @@ p, li { white-space: pre-wrap; } Preview - + Предосмотр @@ -1472,153 +1467,99 @@ p, li { white-space: pre-wrap; } LimeReport::SQLEditDialog Datasource - Источник данных + Источник данных Connection - Соединение + Соединение Datasource Name - Имя источника + Имя источника Subdetail - Подчиненный + Подчиненный Master datasource - Главный источник + Главный источник Subquery mode - Режим подзапроса + Режим подзапроса Filter mode - Режим фильтрации + Режим фильтрации SQL - SQL запрос + SQL запрос Hide Preview - Скрыть + Скрыть Child datasource - Подчиненный источник + Подчиненный источник Fields map - Поля для связи источников + Поля для связи источников Data preview - Данные + Данные Cancel - Отмена + Отмена Error - Ошибка + Ошибка Datasource Name is empty ! - Имя источника данных не заполнено ! + Имя источника данных не заполнено ! SQL is empty ! - SQL запрос пустой ! + SQL запрос пустой ! Datasource with name: "%1" already exists ! - Источник данных с именем: "%1" уже существует ! + Источник данных с именем: "%1" уже существует ! Datasource with name %1 already exist - Источник данных с именем: "%1" уже существует + Источник данных с именем: "%1" уже существует Attention - Внимание + Внимание Connection is not specified - Соединение не указано + Соединение не указано Refresh - Обновить + Обновить Preview - + Предосмотр ... - + Ok - - - - - LimeReport::ScriptBrowser - - Form - - - - Functions - Функции - - - ... - - - - Dialogs - - - - Type - Тип - - - Name - Имя переменной - - - NO CATEGORY - - - - Error - Ошибка - - - Dialog with name: %1 already exists - - - - ui file must cointain QDialog instead QWidget or QMainWindow - - - - wrong file format - - - - - LimeReport::ScriptEngineContext - - Dialog with name: %1 can`t be created - + Ок @@ -1645,34 +1586,34 @@ p, li { white-space: pre-wrap; } Locale - + Локализация CurrencySymbol - + Символ валюты LimeReport::SettingDialog Designer setting - Настройки дизайнера + Настройки дизайнера Default font - Шрифт по умолчанию + Шрифт по умолчанию Grid - Сетка + Сетка Vertical grid step - Вертикальный шаг + Вертикальный шаг сетки Horizontal grid step - Горизонтальный шаг + Горизонтальный шаг сетки @@ -1716,153 +1657,101 @@ p, li { white-space: pre-wrap; } Прижать к нижнему краю + + LimeReport::TextItem + + Edit + Правка + + + Auto height + Автоматическая высота + + + Allow HTML + Разрешить HTML + + + Allow HTML in fields + Разрешить HTML в полях + + + Stretch to max height + Растягивать до максимальной высоты + + + Error + Ошибка + + + TextItem " %1 " already has folower " %2 " + Текстовый элемент "%1" уже следует за "%2" + + + TextItem " %1 " not found ! + Текстовый элемент "%1" не найден! + + LimeReport::TextItemEditor Text Item Editor - Редактор текстового элемента + Редактор текстового элемента Content - Содержимое + Содержимое Functions - Функции + Функции Editor settings - Настройки + Настройки Editor font - Шрифт редактора + Шрифт редактора Cancel - Отмена + Отмена Data - + Данные ... - + Ok - + Ок Ctrl+Return - + Esc - + LimeReport::VariablesHolder variable with name - переменная + переменная already exists !! - уже существует !! + уже существует !! does not exists !! - не существует !! - - - - PreviewReportWindow - - Preview - Предварительный просмотр - - - View - Просмотр - - - Report - Отчет - - - toolBar - Панель инструментов - - - Print - Печать - - - Zoom In - Увеличить - - - Zoom Out - Уменьшить - - - Prior Page - Предыдущая страница - - - Next Page - Следующая страница - - - Close Preview - Закрыть - - - Edit Mode - Режим редактирования - - - Save to file - Записать в файл - - - Show errors - Показать ошибки - - - First Page - Первая страница - - - First page - Первая страница - - - Last Page - Последняя страница - - - Print To PDF - Печать в PDF - - - Page: - Страница: - - - of %1 - из %1 - - - Report file name - Файл отчета - - - PDF file name - Имя PDF файла + не существует !! @@ -1917,7 +1806,7 @@ p, li { white-space: pre-wrap; } alignment - расположение + Выравнивание объекта Barcode Item @@ -1947,10 +1836,6 @@ p, li { white-space: pre-wrap; } Invalid connection! %1 Неверное соединение %1 - - Master datasource "%1" not found! - Главный источник данных "%1" не найден! - Child Подчиненный @@ -2007,237 +1892,61 @@ p, li { white-space: pre-wrap; } File %1 not opened Файл %1 не открыт - - TopLine - Верхняя граница - - - BottomLine - Нижняя граница - - - LeftLine - Левая граница - - - RightLine - Правая граница - content содержимое Master datasource "%1" not found!!! - + Главный источник данных "%1" не найден! Master datasouce "%1" not found! - + Главный источник данных "%1" не найден! bool - + QColor - + QFont - + QImage - + int - + qreal - + QRect - + QRectF - + QString - + Content string is empty - + Строка содержимого пустая Content is empty - - - - Wrong file format - - - - - SQLEditDialog - - Datasource - Источник данных - - - Connection - Соединение - - - Datasource Name - Имя источника - - - Subdetail - Подчиненный - - - Master datasource - Главный источник - - - Subquery mode - Режим подзапроса - - - Filter mode - Режим фильтрации - - - SQL - SQL запрос - - - Preview - Предпросмотр - - - Hide Preview - Скрыть - - - Child datasource - Подчиненный источник - - - Fields map - Поля для связи источников - - - Data preview - Данные - - - Cancel - Отмена - - - Error - Ошибка - - - Datasource Name is empty ! - Имя источника данных не заполнено ! - - - SQL is empty ! - SQL запрос пустой ! - - - Datasource with name: "%1" already exists ! - Источник данных с именем: "%1" уже существует ! - - - Datasource with name %1 already exist - Источник данных с именем: "%1" уже существует - - - Attention - Внимание - - - Connection is not specified - Соединение не указано - - - Refresh - Обновить - - - - SettingDialog - - Designer setting - Настройки дизайнера - - - Default font - Шрифт по умолчанию - - - Grid - Сетка - - - Vertical grid step - Вертикальный шаг - - - Horizontal grid step - Горизонтальный шаг - - - - TextItemEditor - - Text Item Editor - Редактор текстового элемента - - - Content - Содержимое - - - Data - Источники данных - - - Functions - Функции - - - Editor settings - Настройки - - - Editor font - Шрифт редактора - - - Cancel - Отмена - - - - WaitForm - - Wait - Ожидайте - - - Please wait ... - Пожалуста подождите ... + Содержимое пустое From 1d8178de0ab8a9a64b725d9b1dcb0ee9e7369f96 Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Wed, 1 Mar 2017 01:27:07 +0300 Subject: [PATCH 060/136] New logo has been added --- limereport/images/logo_32x32_1.png | Bin 0 -> 591 bytes limereport/report.qrc | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 limereport/images/logo_32x32_1.png diff --git a/limereport/images/logo_32x32_1.png b/limereport/images/logo_32x32_1.png new file mode 100644 index 0000000000000000000000000000000000000000..98c7467d534c97fd0318d9aeb9368ba0190bcabd GIT binary patch literal 591 zcmV-V0kdg00002VoOIv0RM-N z%)bBt010qNS#tmY3ljhU3ljkVnw%H_000McNliru;Q|#GB`Lq-Ycv1=0pLkQK~zY` zt(Ch=TVWW+f9Ld6yc92i79BLjsk%9;i%207iq)Y|sHn0 zMk~FXMj~Q47iXODh?__NWegfHFdXzEGZ0WujAM5BK?aLBgA7**C23WrVj7Yq93!T6 zU8~$m9xr2%1G0RlkuF+j<$_Z(WSQVAi^Reh%vi* zDo&I9LFihmGS#W9yzH6KtOo;=UY4li04(ePANK%x&qO-sn5Xn}?kthC>*79eQru6t z(z)YbA}#w$IM4$%X~R;Ny=E3OlMwcst`i!7lrpIR`( z$ZwLwrjN~P%GoX9kVzm;if@k7L^#0hl>&LD$#KLC3VCXLeK03v=|inPfOm{xhe!IB zL6images/FitPage.png images/FitWidth.png images/OneToOne.png - images/logo_32x32.png + images/logo_32x32.png images/addPage1.png images/deletePage1.png images/toolbar.png @@ -174,5 +174,6 @@ images/delete2.png images/addBand2.png images/edit_control_4_24.png + images/logo_32x32_1.png From 29b9ae1036aa15f499e144670db7fd2d9be78cd6 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 1 Mar 2017 04:10:38 +0300 Subject: [PATCH 061/136] Version has been changed --- common.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.pri b/common.pri index 6154dbc..7fadeef 100644 --- a/common.pri +++ b/common.pri @@ -56,7 +56,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 1 +LIMEREPORT_VERSION_RELEASE = 2 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" From 915b335fb54959e139cc18dc94d5305a4fa71c58 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 2 Mar 2017 19:47:42 +0300 Subject: [PATCH 062/136] Qt 4.8 build fixed --- common.pri | 2 +- limereport/lrbasedesignintf.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common.pri b/common.pri index 121fc2f..3f8f6b5 100644 --- a/common.pri +++ b/common.pri @@ -56,7 +56,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 1 +LIMEREPORT_VERSION_RELEASE = 2 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index 4f615ed..7b4d78d 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -76,6 +76,7 @@ protected: }; class DataSourceManager; +class ReportRender; class BaseDesignIntf : public QObject, public QGraphicsItem, public ICollectionContainer, public ObjectLoadingStateIntf { @@ -94,7 +95,7 @@ class BaseDesignIntf : Q_PROPERTY(int borderLineSize READ borderLineSize WRITE setBorderLineSize) Q_PROPERTY(bool isVisible READ isVisible WRITE setItemVisible DESIGNABLE false) Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor) - + friend class ReportRender; public: enum BGMode { TransparentMode, OpaqueMode}; From 84bb15802cbca9b08895fd8c25f2aa9799ba3ac5 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 2 Mar 2017 20:22:49 +0300 Subject: [PATCH 063/136] msvc build fixed --- limereport/lrbasedesignintf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index 7b4d78d..c925579 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -34,6 +34,7 @@ #include #include #include +#include #include "lrcollection.h" #include "lrglobal.h" #include "serializators/lrstorageintf.h" From ef712cca5fa9a7df7a50564ea3924b7c8fd2a441 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 3 Mar 2017 00:30:54 +0300 Subject: [PATCH 064/136] Fixed the error occurred during loading a report if the report contains data sources with identical names to data sources added by application --- limereport/lrdatasourcemanager.cpp | 67 ++++++++++++++++++++---------- limereport/lrreportrender.cpp | 2 +- 2 files changed, 47 insertions(+), 22 deletions(-) diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index f0a9bf2..cfbafab 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -1081,33 +1081,58 @@ QObject* DataSourceManager::elementAt(const QString &collectionName, int index) void DataSourceManager::collectionLoadFinished(const QString &collectionName) { - if (collectionName.compare("connections",Qt::CaseInsensitive)==0){ + if (collectionName.compare("connections",Qt::CaseInsensitive) == 0){ } - if (collectionName.compare("queries",Qt::CaseInsensitive)==0){ - foreach(QueryDesc* query,m_queries){ - connect(query, SIGNAL(queryTextChanged(QString,QString)), - this, SLOT(slotQueryTextChanged(QString,QString))); - putHolder(query->queryName(),new QueryHolder(query->queryText(), query->connectionName(), this)); + if (collectionName.compare("queries",Qt::CaseInsensitive) == 0){ + + QMutableListIterator it(m_queries); + while (it.hasNext()){ + it.next(); + if (!m_datasources.contains(it.value()->queryName().toLower())){ + connect(it.value(), SIGNAL(queryTextChanged(QString,QString)), + this, SLOT(slotQueryTextChanged(QString,QString))); + putHolder(it.value()->queryName(),new QueryHolder(it.value()->queryText(), it.value()->connectionName(), this)); + } else { + delete it.value(); + it.remove(); + } + } + + } + + if (collectionName.compare("subqueries",Qt::CaseInsensitive) == 0){ + + QMutableListIterator it(m_subqueries); + while (it.hasNext()){ + it.next(); + if (!m_datasources.contains(it.value()->queryName().toLower())){ + connect(it.value(), SIGNAL(queryTextChanged(QString,QString)), + this, SLOT(slotQueryTextChanged(QString,QString))); + putHolder(it.value()->queryName(),new QueryHolder(it.value()->queryText(), it.value()->connectionName(), this)); + } else { + delete it.value(); + it.remove(); + } + } + + } + + if (collectionName.compare("subproxies",Qt::CaseInsensitive) == 0){ + QMutableListIterator it(m_proxies); + while (it.hasNext()){ + it.next(); + if (!m_datasources.contains(it.value()->name().toLower())){ + putHolder(it.value()->name(),new ProxyHolder(it.value(), this)); + } else { + delete it.value(); + it.remove(); + } } } - if (collectionName.compare("subqueries",Qt::CaseInsensitive)==0){ - foreach(SubQueryDesc* query,m_subqueries){ - connect(query, SIGNAL(queryTextChanged(QString,QString)), - this, SLOT(slotQueryTextChanged(QString,QString))); - putHolder(query->queryName(),new SubQueryHolder(query->queryText(), query->connectionName(), query->master(), this)); - } - } - - if(collectionName.compare("subproxies",Qt::CaseInsensitive)==0){ - foreach(ProxyDesc* proxy,m_proxies){ - putHolder(proxy->name(),new ProxyHolder(proxy, this)); - } - } - - if(collectionName.compare("variables",Qt::CaseInsensitive)==0){ + if (collectionName.compare("variables",Qt::CaseInsensitive) == 0){ foreach (VarDesc* item, m_tempVars) { if (!m_reportVariables.containsVariable(item->name())){ m_reportVariables.addVariable(item->name(),item->value(),VarDesc::Report,FirstPass); diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 11c3ae0..ef6836f 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -407,7 +407,7 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign bandClone->setBackgroundColor( - (datasources()->variable(QLatin1String("line_")+patternBand->objectName().toLower()).toInt()%2!=0 ? + (datasources()->variable(QLatin1String("line_")+patternBand->objectName().toLower()).toInt() %2 !=0 ? bandClone->backgroundColor(): bandClone->alternateBackgroundColor() ) From 9ab3cb580354c980f342ce323da9717fbd0039aa Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 3 Mar 2017 00:55:35 +0300 Subject: [PATCH 065/136] Fix subquery loading --- limereport/lrdatasourcemanager.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index cfbafab..dc2c32e 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -856,7 +856,7 @@ QList DataSourceManager::childDatasources(const QString &parentDatasour foreach(QString datasourceName, dataSourceNames()){ if (isSubQuery(datasourceName)){ SubQueryHolder* sh = dynamic_cast(dataSourceHolder(datasourceName)); - if (sh->masterDatasource().compare(parentDatasourceName,Qt::CaseInsensitive)==0){ + if (sh && sh->masterDatasource().compare(parentDatasourceName,Qt::CaseInsensitive)==0){ result.append(datasourceName); } } @@ -868,7 +868,8 @@ void DataSourceManager::invalidateChildren(const QString &parentDatasourceName) { foreach(QString datasourceName, childDatasources(parentDatasourceName)){ SubQueryHolder* sh = dynamic_cast(dataSourceHolder(datasourceName)); - sh->invalidate(designTime()?IDataSource::DESIGN_MODE:IDataSource::RENDER_MODE); + if (sh) + sh->invalidate(designTime()?IDataSource::DESIGN_MODE:IDataSource::RENDER_MODE); invalidateChildren(datasourceName); } } @@ -1110,7 +1111,12 @@ void DataSourceManager::collectionLoadFinished(const QString &collectionName) if (!m_datasources.contains(it.value()->queryName().toLower())){ connect(it.value(), SIGNAL(queryTextChanged(QString,QString)), this, SLOT(slotQueryTextChanged(QString,QString))); - putHolder(it.value()->queryName(),new QueryHolder(it.value()->queryText(), it.value()->connectionName(), this)); + putHolder(it.value()->queryName(),new SubQueryHolder( + it.value()->queryText(), + it.value()->connectionName(), + it.value()->master(), + this) + ); } else { delete it.value(); it.remove(); From 322ded365910712d1efa108686689d19f46834a4 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 3 Mar 2017 01:12:29 +0300 Subject: [PATCH 066/136] Null pointer access has been fixed --- limereport/lrscriptenginemanager.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index f69283b..f8d157d 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -520,8 +520,11 @@ QString ScriptEngineManager::expandDataFields(QString context, ExpandType expand context.replace(rx.cap(0),fieldValue); } else { - QString error = QString("Field %1 not found in %2 !!! ").arg(field).arg(reportItem->objectName()); - dataManager()->putError(error); + QString error; + if (reportItem){ + error = QString("Field %1 not found in %2 !!! ").arg(field).arg(reportItem->objectName()); + dataManager()->putError(error); + } varValue = QVariant(); if (!dataManager()->reportSettings() || !dataManager()->reportSettings()->suppressAbsentFieldsAndVarsWarnings()) context.replace(rx.cap(0),error); From d864b1bf3e0ff4b9e342f8997080dbc7ea07236a Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 3 Mar 2017 01:12:45 +0300 Subject: [PATCH 067/136] Version has been fixed --- common.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.pri b/common.pri index 3f8f6b5..6b59a37 100644 --- a/common.pri +++ b/common.pri @@ -56,7 +56,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 2 +LIMEREPORT_VERSION_RELEASE = 4 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" From aa040e80313e2f7f3b9cca407defb3f0aed1b3f9 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 3 Mar 2017 02:23:23 +0300 Subject: [PATCH 068/136] LRDemo_r2 will get first template file to show --- demo_r2/mainwindow.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/demo_r2/mainwindow.cpp b/demo_r2/mainwindow.cpp index 5ad3ac4..b7bde34 100644 --- a/demo_r2/mainwindow.cpp +++ b/demo_r2/mainwindow.cpp @@ -50,10 +50,21 @@ MainWindow::MainWindow(QWidget *parent) : resize(screenWidth*0.8, screenHeight*0.8); move(x, y); - if (QFile::exists(QApplication::applicationDirPath()+"/demo_reports/categories.lrxml")){ - m_report.loadFromFile(QApplication::applicationDirPath()+"/demo_reports/categories.lrxml"); - m_preview->refreshPages(); + + if (ui->treeWidget->topLevelItemCount()>0){ + int index = 0; + while (indextreeWidget->topLevelItemCount()){ + if (ui->treeWidget->topLevelItem(index)->childCount()>0) + ++index; + else { + m_report.loadFromFile(ui->treeWidget->topLevelItem(index)->data(0,Qt::UserRole).toString()); + ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(index)); + break; + } + } + } + m_preview->refreshPages(); } From 4c6c0dfd3be3cafc5cc7ab6c68414229ba9ac08e Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 3 Mar 2017 23:47:10 +0300 Subject: [PATCH 069/136] QString -> tr --- limereport/lrscriptenginemanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index b975c03..5b6faa8 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -568,7 +568,7 @@ QString ScriptEngineManager::expandDataFields(QString context, ExpandType expand } else { QString error; if (reportItem){ - error = QString("Field %1 not found in %2 !!! ").arg(field).arg(reportItem->objectName()); + error = tr("Field %1 not found in %2 !!! ").arg(field).arg(reportItem->objectName()); dataManager()->putError(error); } varValue = QVariant(); From 242dbe75d2e9a76d87eaa831ada56e81dfff1a31 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 4 Mar 2017 00:21:21 +0300 Subject: [PATCH 070/136] useAlternateBackgroundColor property has been added --- limereport/bands/lrdataband.cpp | 17 +++++++++++++++++ limereport/bands/lrdataband.h | 5 ++++- limereport/bands/lrsubdetailband.h | 1 + limereport/lrbanddesignintf.cpp | 27 ++++++++++++++++++++++++--- limereport/lrbanddesignintf.h | 5 ++++- limereport/lrreportrender.cpp | 15 ++++++++------- 6 files changed, 58 insertions(+), 12 deletions(-) diff --git a/limereport/bands/lrdataband.cpp b/limereport/bands/lrdataband.cpp index 342622a..4a67e58 100644 --- a/limereport/bands/lrdataband.cpp +++ b/limereport/bands/lrdataband.cpp @@ -79,6 +79,23 @@ bool DataBand::isUnique() const return false; } +void DataBand::preparePopUpMenu(QMenu &menu) +{ + DataBandDesignIntf::preparePopUpMenu(menu); + + QAction* autoSplittableAction = menu.addAction(tr("useAlternateBackgroundColor")); + autoSplittableAction->setCheckable(true); + autoSplittableAction->setChecked(useAlternateBackgroundColor()); +} + +void DataBand::processPopUpAction(QAction *action) +{ + DataBandDesignIntf::processPopUpAction(action); + if (action->text().compare(tr("useAlternateBackgroundColor")) == 0){ + setProperty("useAlternateBackgroundColor",action->isChecked()); + } +} + QColor DataBand::bandColor() const { return QColor(Qt::darkGreen); diff --git a/limereport/bands/lrdataband.h b/limereport/bands/lrdataband.h index fd180e8..f2ea27a 100644 --- a/limereport/bands/lrdataband.h +++ b/limereport/bands/lrdataband.h @@ -48,10 +48,13 @@ class DataBand : public DataBandDesignIntf Q_PROPERTY(bool startNewPage READ startNewPage WRITE setStartNewPage) Q_PROPERTY(bool startFromNewPage READ startFromNewPage WRITE setStartFromNewPage) Q_PROPERTY(QColor alternateBackgroundColor READ alternateBackgroundColor WRITE setAlternateBackgroundColor) + Q_PROPERTY(bool useAlternateBackgroundColor READ useAlternateBackgroundColor WRITE setUseAlternateBackgroundColor) public: DataBand(QObject* owner = 0, QGraphicsItem* parent=0); bool isUnique() const; bool isData() const {return true;} + void preparePopUpMenu(QMenu &menu); + void processPopUpAction(QAction *action); protected: QColor bandColor() const; private: @@ -82,7 +85,7 @@ class DataFooterBand : public BandDesignIntf Q_OBJECT Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount) Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection) - Q_PROPERTY(bool printAlways READ printAlways() WRITE setPrintAlways()) + Q_PROPERTY(bool printAlways READ printAlways WRITE setPrintAlways) public: DataFooterBand(QObject* owner=0, QGraphicsItem* parent=0); bool isUnique() const {return false;} diff --git a/limereport/bands/lrsubdetailband.h b/limereport/bands/lrsubdetailband.h index c9b4c76..ae094e4 100644 --- a/limereport/bands/lrsubdetailband.h +++ b/limereport/bands/lrsubdetailband.h @@ -43,6 +43,7 @@ class SubDetailBand : public DataBandDesignIntf Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection) Q_PROPERTY(bool keepFooterTogether READ keepFooterTogether WRITE setKeepFooterTogether) Q_PROPERTY(QColor alternateBackgroundColor READ alternateBackgroundColor WRITE setAlternateBackgroundColor) + Q_PROPERTY(bool useAlternateBackgroundColor READ useAlternateBackgroundColor WRITE setUseAlternateBackgroundColor) public: SubDetailBand(QObject* owner = 0, QGraphicsItem* parent=0); bool isUnique() const {return false;} diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index 9a704f2..ed9a534 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -147,7 +147,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_useAlternateBackgroundColor(false) { setPossibleResizeDirectionFlags(ResizeBottom); setPossibleMoveFlags(TopBotom); @@ -447,7 +448,7 @@ void BandDesignIntf::preparePopUpMenu(QMenu &menu) QAction* autoSplittableAction = menu.addAction(tr("Splittable")); autoSplittableAction->setCheckable(true); - autoSplittableAction->setChecked(isSplittable()); + autoSplittableAction->setChecked(isSplittable()); } void BandDesignIntf::processPopUpAction(QAction *action) @@ -780,6 +781,21 @@ void BandDesignIntf::childBandDeleted(QObject *band) m_childBands.removeAt(m_childBands.indexOf(reinterpret_cast(band))); } +bool BandDesignIntf::useAlternateBackgroundColor() const +{ + return m_useAlternateBackgroundColor; +} + +void BandDesignIntf::setUseAlternateBackgroundColor(bool useAlternateBackgroundColor) +{ + if (m_useAlternateBackgroundColor != useAlternateBackgroundColor){ + QColor oldValue = m_useAlternateBackgroundColor; + m_useAlternateBackgroundColor=useAlternateBackgroundColor; + if (!isLoading()) + notify("useAlternateBackgroundColor",oldValue,useAlternateBackgroundColor); + } +} + QColor BandDesignIntf::alternateBackgroundColor() const { if (metaObject()->indexOfProperty("alternateBackgroundColor")!=-1) @@ -790,7 +806,12 @@ QColor BandDesignIntf::alternateBackgroundColor() const void BandDesignIntf::setAlternateBackgroundColor(const QColor &alternateBackgroundColor) { - m_alternateBackgroundColor = alternateBackgroundColor; + if (m_alternateBackgroundColor != alternateBackgroundColor){ + QColor oldValue = m_alternateBackgroundColor; + m_alternateBackgroundColor=alternateBackgroundColor; + if (!isLoading()) + notify("alternateBackgroundColor",oldValue,alternateBackgroundColor); + } } bool BandDesignIntf::repeatOnEachRow() const diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index 0d92f5e..c53b9e3 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -219,6 +219,8 @@ public: void setRepeatOnEachRow(bool repeatOnEachRow); QColor alternateBackgroundColor() const; void setAlternateBackgroundColor(const QColor &alternateBackgroundColor); + bool useAlternateBackgroundColor() const; + void setUseAlternateBackgroundColor(bool useAlternateBackgroundColor); signals: void bandRendered(BandDesignIntf* band); @@ -276,7 +278,8 @@ private: bool m_printAlways; bool m_repeatOnEachRow; QMap m_slicedItems; - QColor m_alternateBackgroundColor; + QColor m_alternateBackgroundColor; + bool m_useAlternateBackgroundColor; }; class DataBandDesignIntf : public BandDesignIntf{ diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index aceca92..a497565 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -431,13 +431,14 @@ 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(): - bandClone->alternateBackgroundColor() - ) - ); + if (bandClone->useAlternateBackgroundColor()){ + bandClone->setBackgroundColor( + (datasources()->variable(QLatin1String("line_")+patternBand->objectName().toLower()).toInt() %2 == 0 ? + bandClone->backgroundColor() : + bandClone->alternateBackgroundColor() + ) + ); + } patternBand->emitBandRendered(bandClone); emit(patternBand->afterRender()); From b963428f4c88deb954e3d7222106afc04345eb28 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 4 Mar 2017 00:30:52 +0300 Subject: [PATCH 071/136] "Transparent" menu item has been added to TextItem context menu --- limereport/items/lrtextitem.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index e36d251..b2115bf 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -105,6 +105,10 @@ void TextItem::preparePopUpMenu(QMenu &menu) action->setCheckable(true); action->setChecked(stretchToMaxHeight()); + action = menu.addAction(tr("Transparent")); + action->setCheckable(true); + action->setChecked(backgroundMode() == TransparentMode); + } void TextItem::processPopUpAction(QAction *action) @@ -124,6 +128,13 @@ void TextItem::processPopUpAction(QAction *action) if (action->text().compare(tr("Stretch to max height")) == 0){ setProperty("stretchToMaxHeight",action->isChecked()); } + if (action->text().compare(tr("Transparent")) == 0){ + if (action->isChecked()){ + setProperty("backgroundMode",TransparentMode); + } else { + setProperty("backgroundMode",OpaqueMode); + } + } } void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, QWidget* widget) { From d25001583946f84a8bd8abde3c171b4a1d05173e Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sun, 5 Mar 2017 16:39:50 +0300 Subject: [PATCH 072/136] Default system printer will selected in "printer select dialog" by default --- limereport/lrpreviewreportwidget.cpp | 7 +++++++ limereport/lrreportengine.cpp | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/limereport/lrpreviewreportwidget.cpp b/limereport/lrpreviewreportwidget.cpp index 986e95d..dcddb74 100644 --- a/limereport/lrpreviewreportwidget.cpp +++ b/limereport/lrpreviewreportwidget.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include @@ -157,7 +158,13 @@ void PreviewReportWidget::lastPage() void PreviewReportWidget::print() { + + QPrinterInfo pi; QPrinter printer(QPrinter::HighResolution); + + if (!pi.defaultPrinter().isNull()) + printer.setPrinterName(pi.defaultPrinterName()); + QPrintDialog dialog(&printer,QApplication::activeWindow()); if (dialog.exec()==QDialog::Accepted){ if (!d_ptr->m_reportPages.isEmpty()) diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index d4b4fa2..6f9c6e0 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -29,6 +29,7 @@ ****************************************************************************/ #include #include +#include #include #include #include @@ -271,6 +272,9 @@ void ReportEnginePrivate::printReport(ReportPages pages, QPrinter &printer, cons bool ReportEnginePrivate::printReport(QPrinter* printer) { if (!printer&&!m_printerSelected){ + QPrinterInfo pi; + if (!pi.defaultPrinter().isNull()) + m_printer.data()->setPrinterName(pi.defaultPrinterName()); QPrintDialog dialog(m_printer.data(),QApplication::activeWindow()); m_printerSelected = dialog.exec()!=QDialog::Rejected; } @@ -294,8 +298,10 @@ bool ReportEnginePrivate::printReport(QPrinter* printer) bool ReportEnginePrivate::printPages(ReportPages pages, QPrinter *printer, PrintRange printRange) { - if (!printer&&!m_printerSelected){ + QPrinterInfo pi; + if (!pi.defaultPrinter().isNull()) + m_printer.data()->setPrinterName(pi.defaultPrinterName()); QPrintDialog dialog(m_printer.data(),QApplication::activeWindow()); m_printerSelected = dialog.exec()!=QDialog::Rejected; if (m_printerSelected){ From 11b94026be8f13b840a0cae4919cee495691cdc7 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 6 Mar 2017 14:34:19 +0300 Subject: [PATCH 073/136] Russian translation has been updated --- translations/limereport_ru.ts | 404 +++++++++++++++++----------------- 1 file changed, 204 insertions(+), 200 deletions(-) diff --git a/translations/limereport_ru.ts b/translations/limereport_ru.ts index 3a76892..ea926cf 100644 --- a/translations/limereport_ru.ts +++ b/translations/limereport_ru.ts @@ -55,6 +55,22 @@ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/report/images/logo_100.png" height="100" style="float: left;" /><span style=" font-size:12pt; font-weight:600; color:#555555;">Report engine for </span><span style=" font-size:12pt; font-weight:600; color:#7faa18;">Qt</span><span style=" font-size:12pt; font-weight:600; color:#555555;"> framework</span></p> +<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">LimeReport - multi-platform C++ library written using Qt framework and intended for software developers that would like to add into their application capability to form report or print forms generated using templates.</span></p> +<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><br /></p> +<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><br /></p> +<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">Official web site : </span><a href="www.limereport.ru"><span style=" font-size:11pt; text-decoration: underline; color:#0000ff;">www.limereport.ru</span></a></p> +<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt; text-decoration: underline; color:#0000ff;"><br /></p> +<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600; color:#000000;">This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</span></p> +<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt; font-weight:600; color:#000000;"><br /></p> +<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; color:#000000;">Copyright 2015 Arin Alexander. All rights reserved.</span></p></body></html> + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Arin Alexander</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">arin_a@bk.ru</p></body></html> @@ -64,133 +80,117 @@ p, li { white-space: pre-wrap; } <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/report/images/logo_100.png" height="100" style="float: left;" /><span style=" font-size:12pt; font-weight:600;">Report engine for </span><span style=" font-size:12pt; font-weight:600; color:#7faa18;">Qt</span><span style=" font-size:12pt; font-weight:600;"> framework</span></p> -<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">LimeReport - multi-platform C++ library written using Qt framework and intended for software developers that would like to add into their application capability to form report or print forms generated using templates.</span></p> -<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><br /></p> -<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><br /></p> -<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">Official web site : </span><a href="www.limereport.ru"><span style=" font-size:11pt; text-decoration: underline; color:#0000ff;">www.limereport.ru</span></a></p> -<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt; text-decoration: underline; color:#0000ff;"><br /></p> -<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600;">This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</span></p> -<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt; font-weight:600; color:#000000;"><br /></p> -<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Copyright 2015 Arin Alexander. All rights reserved.</span></p></body></html> - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(c) 2015 Arin Alexander arin_a@bk.ru</p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="SEC1"></a><span style=" font-family:'sans-serif'; font-weight:600;">G</span><span style=" font-family:'sans-serif'; font-weight:600;">NU LESSER GENERAL PUBLIC LICENSE</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Version 2.1, February 1999</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">Copyright (C) 1991, 1999 Free Software Foundation, Inc.</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">Everyone is permitted to copy and distribute verbatim copies</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">of this license document, but changing it is not allowed.</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace';"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">[This is the first released version of the Lesser GPL. It also counts</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';"> as the successor of the GNU Library Public License, version 2, hence</span></p> -<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';"> the version number 2.1.]</span></p> -<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="SEC2"></a><span style=" font-family:'sans-serif'; font-weight:600;">P</span><span style=" font-family:'sans-serif'; font-weight:600;">reamble</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">We call this license the &quot;Lesser&quot; General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a &quot;work based on the library&quot; and a &quot;work that uses the library&quot;. The former contains code derived from the library, whereas the latter must be combined with the library in order to run.</span></p> -<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="SEC3"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">T</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">ERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">0.</span><span style=" font-family:'sans-serif';"> This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called &quot;this License&quot;). Each licensee is addressed as &quot;you&quot;.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">A &quot;library&quot; means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">The &quot;Library&quot;, below, refers to any such software library or work which has been distributed under these terms. A &quot;work based on the Library&quot; means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term &quot;modification&quot;.)</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">&quot;Source code&quot; for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">1.</span><span style=" font-family:'sans-serif';"> You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">2.</span><span style=" font-family:'sans-serif';"> You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:</span></p> -<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif';" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> The modified work must itself be a software library.</span></li> -<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.</span></li> -<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">c)</span><span style=" font-size:16px;"> You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.</span></li> -<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">d)</span><span style=" font-size:16px;"> If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.</span></li></ul> -<p style=" margin-top:15px; margin-bottom:15px; margin-left:38px; margin-right:19px; -qt-block-indent:1; text-indent:0px;"><span style=" font-family:'sans-serif';">(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">3.</span><span style=" font-family:'sans-serif';"> You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">This option is useful when you wish to copy part of the code of the Library into a program that is not a library.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">4.</span><span style=" font-family:'sans-serif';"> You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">5.</span><span style=" font-family:'sans-serif';"> A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a &quot;work that uses the Library&quot;. Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">However, linking a &quot;work that uses the Library&quot; with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a &quot;work that uses the library&quot;. The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">When a &quot;work that uses the Library&quot; uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">6.</span><span style=" font-family:'sans-serif';"> As an exception to the Sections above, you may also combine or link a &quot;work that uses the Library&quot; with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:</span></p> -<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif';" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable &quot;work that uses the Library&quot;, as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)</span></li> -<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.</span></li> -<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">c)</span><span style=" font-size:16px;"> Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.</span></li> -<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">d)</span><span style=" font-size:16px;"> If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.</span></li> -<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">e)</span><span style=" font-size:16px;"> Verify that the user has already received a copy of these materials or that you have already sent this user a copy.</span></li></ul> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">For an executable, the required form of the &quot;work that uses the Library&quot; must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">7.</span><span style=" font-family:'sans-serif';"> You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:</span></p> -<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif';" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.</span></li> -<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.</span></li></ul> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">8.</span><span style=" font-family:'sans-serif';"> You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">9.</span><span style=" font-family:'sans-serif';"> You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">10.</span><span style=" font-family:'sans-serif';"> Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">11.</span><span style=" font-family:'sans-serif';"> If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">12.</span><span style=" font-family:'sans-serif';"> If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">13.</span><span style=" font-family:'sans-serif';"> The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and &quot;any later version&quot;, you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">14.</span><span style=" font-family:'sans-serif';"> If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">NO WARRANTY</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">15.</span><span style=" font-family:'sans-serif';"> BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY &quot;AS IS&quot; WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">16.</span><span style=" font-family:'sans-serif';"> IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</span></p> -<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">END OF TERMS AND CONDITIONS</span></p> -<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="SEC4"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">H</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">ow to Apply These Terms to Your New Libraries</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License).</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the &quot;copyright&quot; line and a pointer to where the full notice is found.</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace'; font-style:italic;">one line to give the library's name and an idea of what it does.</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">Copyright (C) </span><span style=" font-family:'monospace'; font-style:italic;">year</span><span style=" font-family:'monospace';"> </span><span style=" font-family:'monospace'; font-style:italic;">name of author</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; font-style:italic;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">This library is free software; you can redistribute it and/or</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">modify it under the terms of the GNU Lesser General Public</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">License as published by the Free Software Foundation; either</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">version 2.1 of the License, or (at your option) any later version.</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace';"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">This library is distributed in the hope that it will be useful,</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">but WITHOUT ANY WARRANTY; without even the implied warranty of</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">Lesser General Public License for more details.</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace';"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">You should have received a copy of the GNU Lesser General Public</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">License along with this library; if not, write to the Free Software</span></p> -<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Also add information on how to contact you by electronic and paper mail.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">You should also get your employer (if you work as a programmer) or your school, if any, to sign a &quot;copyright disclaimer&quot; for the library, if necessary. Here is a sample; alter the names:</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">Yoyodyne, Inc., hereby disclaims all copyright interest in</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">the library `Frob' (a library for tweaking knobs) written</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">by James Random Hacker.</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace';"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace'; font-style:italic;">signature of Ty Coon</span><span style=" font-family:'monospace';">, 1 April 1990</span></p> -<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">Ty Coon, President of Vice</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">That's all there is to it!</span></p></body></html> - +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="SEC1"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">G</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">NU LESSER GENERAL PUBLIC LICENSE</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Version 2.1, February 1999</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Copyright (C) 1991, 1999 Free Software Foundation, Inc.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Everyone is permitted to copy and distribute verbatim copies</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">of this license document, but changing it is not allowed.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">[This is the first released version of the Lesser GPL. It also counts</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;"> as the successor of the GNU Library Public License, version 2, hence</span></p> +<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;"> the version number 2.1.]</span></p> +<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="SEC2"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">P</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">reamble</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">We call this license the &quot;Lesser&quot; General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a &quot;work based on the library&quot; and a &quot;work that uses the library&quot;. The former contains code derived from the library, whereas the latter must be combined with the library in order to run.</span></p> +<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="SEC3"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">T</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">ERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">0.</span><span style=" font-family:'sans-serif'; color:#000000;"> This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called &quot;this License&quot;). Each licensee is addressed as &quot;you&quot;.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">A &quot;library&quot; means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">The &quot;Library&quot;, below, refers to any such software library or work which has been distributed under these terms. A &quot;work based on the Library&quot; means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term &quot;modification&quot;.)</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">&quot;Source code&quot; for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">1.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">2.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:</span></p> +<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> The modified work must itself be a software library.</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">c)</span><span style=" font-size:16px;"> You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">d)</span><span style=" font-size:16px;"> If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.</span></li></ul> +<p style=" margin-top:15px; margin-bottom:15px; margin-left:38px; margin-right:19px; -qt-block-indent:1; text-indent:0px;"><span style=" font-family:'sans-serif'; color:#000000;">(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">3.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">This option is useful when you wish to copy part of the code of the Library into a program that is not a library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">4.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">5.</span><span style=" font-family:'sans-serif'; color:#000000;"> A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a &quot;work that uses the Library&quot;. Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">However, linking a &quot;work that uses the Library&quot; with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a &quot;work that uses the library&quot;. The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">When a &quot;work that uses the Library&quot; uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">6.</span><span style=" font-family:'sans-serif'; color:#000000;"> As an exception to the Sections above, you may also combine or link a &quot;work that uses the Library&quot; with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:</span></p> +<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable &quot;work that uses the Library&quot;, as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">c)</span><span style=" font-size:16px;"> Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">d)</span><span style=" font-size:16px;"> If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">e)</span><span style=" font-size:16px;"> Verify that the user has already received a copy of these materials or that you have already sent this user a copy.</span></li></ul> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">For an executable, the required form of the &quot;work that uses the Library&quot; must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">7.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:</span></p> +<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.</span></li></ul> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">8.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">9.</span><span style=" font-family:'sans-serif'; color:#000000;"> You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">10.</span><span style=" font-family:'sans-serif'; color:#000000;"> Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">11.</span><span style=" font-family:'sans-serif'; color:#000000;"> If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">12.</span><span style=" font-family:'sans-serif'; color:#000000;"> If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">13.</span><span style=" font-family:'sans-serif'; color:#000000;"> The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and &quot;any later version&quot;, you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">14.</span><span style=" font-family:'sans-serif'; color:#000000;"> If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">NO WARRANTY</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">15.</span><span style=" font-family:'sans-serif'; color:#000000;"> BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY &quot;AS IS&quot; WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">16.</span><span style=" font-family:'sans-serif'; color:#000000;"> IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</span></p> +<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#333333; background-color:#ffffff;">END OF TERMS AND CONDITIONS</span></p> +<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="SEC4"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">H</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">ow to Apply These Terms to Your New Libraries</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License).</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the &quot;copyright&quot; line and a pointer to where the full notice is found.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; font-style:italic; color:#000000;">one line to give the library's name and an idea of what it does.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">Copyright (C) </span><span style=" font-family:'monospace'; font-style:italic; color:#000000;">year</span><span style=" font-family:'monospace'; color:#000000;"> </span><span style=" font-family:'monospace'; font-style:italic; color:#000000;">name of author</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; font-style:italic; color:#000000; background-color:#ffffff;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">This library is free software; you can redistribute it and/or</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">modify it under the terms of the GNU Lesser General Public</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">License as published by the Free Software Foundation; either</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">version 2.1 of the License, or (at your option) any later version.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">This library is distributed in the hope that it will be useful,</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">but WITHOUT ANY WARRANTY; without even the implied warranty of</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">Lesser General Public License for more details.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">You should have received a copy of the GNU Lesser General Public</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">License along with this library; if not, write to the Free Software</span></p> +<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Also add information on how to contact you by electronic and paper mail.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">You should also get your employer (if you work as a programmer) or your school, if any, to sign a &quot;copyright disclaimer&quot; for the library, if necessary. Here is a sample; alter the names:</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Yoyodyne, Inc., hereby disclaims all copyright interest in</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">the library `Frob' (a library for tweaking knobs) written</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">by James Random Hacker.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; font-style:italic; color:#000000;">signature of Ty Coon</span><span style=" font-family:'monospace'; color:#000000;">, 1 April 1990</span></p> +<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">Ty Coon, President of Vice</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">That's all there is to it!</span></p></body></html> + @@ -286,7 +286,7 @@ p, li { white-space: pre-wrap; } LimeReport::ConnectionDesc defaultConnection - + Соединение по умолчанию @@ -365,18 +365,18 @@ p, li { white-space: pre-wrap; } Dont keep credentals in lrxml - + Не хранить учетные данные в lrxml defaultConnection - + Соединение по умолчанию LimeReport::ContentItemDesignIntf Variable %1 not found - Переменная %1 не найдена + Переменная %1 не найдена @@ -447,7 +447,7 @@ p, li { white-space: pre-wrap; } User variables - Пользовательские переменные + Пользовательские переменные Do you really want to delete "%1" datasource ? @@ -522,7 +522,7 @@ p, li { white-space: pre-wrap; } Database "%1" not found - + База данных "%1;" не найдена @@ -537,7 +537,7 @@ p, li { white-space: pre-wrap; } External variables - Внешние переменные + Внешние переменные @@ -593,11 +593,11 @@ p, li { white-space: pre-wrap; } Group field not found - + Поле группы не найдено Datasource "%1" not found !!! - + Источник данных "%1;" не найден !!! @@ -616,7 +616,7 @@ p, li { white-space: pre-wrap; } Wrong script syntax "%1" - + Неверный синтаксис скрипта "%1" @@ -739,7 +739,7 @@ p, li { white-space: pre-wrap; } LimeReport::PageItemDesignIntf Paste - Вставить + Вставить @@ -853,23 +853,23 @@ p, li { white-space: pre-wrap; } Esc - + Esc Show Toolbar - + Показывать Панель Инструментов Show toolbar - + Показывать Панель Инструментов Font - Шрифт + Шрифт Text align - + Выравнивание текста @@ -891,43 +891,43 @@ p, li { white-space: pre-wrap; } fullPage - Страница целиком + Страница целиком gridStep - Шаг сетки + Шаг сетки oldPrintMode - Старый режим печати + Старый режим печати resourcePath - Путь к ресурсам + Путь к ресурсам autoSize - Автоматический размер + Автоматический размер center - Центрировать + Центрировать field - Поле + Поле image - Изображение + Изображение keepAspectRatio - Сохранять соотношение сторон + Сохранять соотношение сторон scale - Масштабировать + Масштабировать leftMargin @@ -955,15 +955,15 @@ p, li { white-space: pre-wrap; } condition - Условие + Условие keepGroupTogether - Сохранять группу вместе + Сохранять группу вместе groupFieldName - Столбец группы + Столбец группы geometry @@ -1027,43 +1027,43 @@ p, li { white-space: pre-wrap; } textIndent - Отступ текста + Отступ текста textLayoutDirection - Направление текста + Направление текста lineSpacing - Межстрочный интервал + Межстрочный интервал underlines - Подчеркивание + Подчеркивание underlineLineSize - Толщина подчеркивания + Толщина подчеркивания format - Формат + Формат valueType - Тип значения + Тип значения adaptFontToSize - Шрифт по размеру + Шрифт по размеру followTo - Следует за + Следует за backgroundBrushStyle - Стиль заполнения фона + Стиль заполнения фона autoHeight @@ -1075,11 +1075,11 @@ p, li { white-space: pre-wrap; } alternateBackgroundColor - Альтернативный цвет фона + Альтернативный цвет фона columnsCount - Количество столбцов + Количество столбцов columnsFillDirection @@ -1175,35 +1175,35 @@ p, li { white-space: pre-wrap; } allowHTML - Разрешить HTML + Разрешить HTML allowHTMLInFields - Разрешить HTML в полях + Разрешить HTML в полях printAlways - Печатать всегда + Печатать всегда borderColor - Цвет границ + Цвет границ startNewPage - Начинать новую страницу + Начинать новую страницу startFromNewPage - Начинать с новой страницы + Начинать с новой страницы resetPageNumber - Обнулять номер страницы + Обнулять номер страницы columnCount - + Количество столбцов @@ -1236,19 +1236,19 @@ p, li { white-space: pre-wrap; } Page - + Страница Script - + Скрипт Error - Ошибка + Ошибка Wrong file format - + Неверный формат файла @@ -1535,7 +1535,7 @@ p, li { white-space: pre-wrap; } page index out of range - + номер страницы выходит за пределы дипазона @@ -1638,7 +1638,7 @@ p, li { white-space: pre-wrap; } defaultConnection - + Соединение по умолчанию @@ -1653,53 +1653,53 @@ p, li { white-space: pre-wrap; } Form - Форма + Форма ... - + Type - Тип + Тип Name - Имя переменной + Имя переменной NO CATEGORY - + Error - Ошибка + Ошибка Dialog with name: %1 already exists - + Диалог с именем: %1 уже существует ui file must cointain QDialog instead QWidget or QMainWindow - + файл ui должен содержать QDialog вместо QWidget или QMainWindow wrong file format - + неверный формат файла LimeReport::ScriptEngineContext Dialog with name: %1 can`t be created - + Диалог с именем: %1 не может быть создан LimeReport::ScriptEngineManager FieldName - Имя поля + Имя поля BandName @@ -1727,11 +1727,15 @@ p, li { white-space: pre-wrap; } Variable %1 not found - Переменная %1 не найдена + Переменная %1 не найдена Name - Имя переменной + Имя переменной + + + Field %1 not found in %2 !!! + Поле %1 не найдено в %2 !!! @@ -1758,15 +1762,15 @@ p, li { white-space: pre-wrap; } Designer Setting - + Настройки Дизайнера Report Setting - + Настройки Отчета Suppress absent fields and variables warning - + Скрывать предупреждения об отсутсвующих полях и переменных @@ -1787,7 +1791,7 @@ p, li { white-space: pre-wrap; } LimeReport::TearOffBand Tear-off Band - Отрыв данных + Отрыв данных @@ -1896,7 +1900,7 @@ p, li { white-space: pre-wrap; } Esc - + Esc @@ -2110,11 +2114,11 @@ p, li { white-space: pre-wrap; } Tear-off Band - Отрыв данных + Отрыв данных Wrong file format - + Неверный формат файла From 55364608c3fc3cce96480cdaa5c3730c0411497b Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 6 Mar 2017 18:46:16 +0300 Subject: [PATCH 074/136] Nested groups has been fixed --- limereport/lrreportrender.cpp | 16 ++++++++++++++-- limereport/lrreportrender.h | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index ef6836f..ddf7134 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -699,14 +699,26 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da } } +void ReportRender::renderGroupFooterByHeader(BandDesignIntf* groupHeader){ + foreach (BandDesignIntf* header, groupHeader->childrenByType(BandDesignIntf::GroupHeader)){ + renderGroupFooterByHeader(header); + } + foreach (BandDesignIntf* footer, groupHeader->childrenByType(BandDesignIntf::GroupFooter)){ + renderBand(footer, 0, StartNewPageAsNeeded); + } +} + void ReportRender::renderGroupFooter(BandDesignIntf *parentBand) { foreach(BandDesignIntf* band,parentBand->childrenByType(BandDesignIntf::GroupHeader)){ IGroupBand* gb = dynamic_cast(band); if (gb && gb->isStarted()){ if (band->reprintOnEachPage()) m_reprintableBands.removeOne(band); - if (band->childBands().count()>0){ - renderBand(band->childBands().at(0), 0, StartNewPageAsNeeded); + foreach(BandDesignIntf* header, band->childrenByType(BandDesignIntf::GroupHeader)){ + renderGroupFooterByHeader(header); + } + foreach(BandDesignIntf* footer, band->childrenByType(BandDesignIntf::GroupFooter)){ + renderBand(footer, 0, StartNewPageAsNeeded); } closeDataGroup(band); } diff --git a/limereport/lrreportrender.h b/limereport/lrreportrender.h index 16e8176..8e62b0b 100644 --- a/limereport/lrreportrender.h +++ b/limereport/lrreportrender.h @@ -151,6 +151,7 @@ private: qreal columnHeigth(int columnIndex); qreal maxColumnHeight(); void renameChildItems(BaseDesignIntf *item); + void renderGroupFooterByHeader(BandDesignIntf *groupHeader); private: DataSourceManager* m_datasources; ScriptEngineContext* m_scriptEngineContext; @@ -183,7 +184,6 @@ private: QVector m_columnedBandItems; unsigned long long m_curentNameIndex; - }; } // namespace LimeReport #endif // LRREPORTRENDER_H From d86c6f226be42455a55c3f4288038d3d40a0e8a5 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 7 Mar 2017 19:09:13 +0300 Subject: [PATCH 075/136] Group functions have been fixed --- include/lrglobal.cpp | 9 +++++++++ include/lrglobal.h | 4 +++- limereport/lrglobal.cpp | 9 +++++++++ limereport/lrglobal.h | 4 +++- limereport/lrreportrender.cpp | 28 ++++++++++++++++++---------- 5 files changed, 42 insertions(+), 12 deletions(-) diff --git a/include/lrglobal.cpp b/include/lrglobal.cpp index 5b2cdff..b4eb854 100644 --- a/include/lrglobal.cpp +++ b/include/lrglobal.cpp @@ -67,4 +67,13 @@ QString replaceHTMLSymbols(const QString &value) return result; } +QVector normalizeCaptures(const QRegExp& reg){ + QVector result; + foreach (QString cap, reg.capturedTexts()) { + if (!cap.isEmpty()) + result.append(cap); + } + return result; +} + } //namespace LimeReport diff --git a/include/lrglobal.h b/include/lrglobal.h index 3b8aa7d..3f11f78 100644 --- a/include/lrglobal.h +++ b/include/lrglobal.h @@ -83,7 +83,8 @@ namespace Const{ //const int VALUE_INDEX = 2; //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 = "\\((?:(.+),(.+))|(?:\\\"(\\w+)\\\")\\)"; + const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:(?:(?:\\\")|(?:))(\\w+)(?:(?:\\\")|(?:)))|(?:(?:(?:\\\")|(?:))(\\s*\\$\\w\\s*\\{.+\\}\\s*)(?:(?:\\\")|(?:))\\s*,\\s*(?:(?:\\\")|(?:))(\\w+)(?:(?:\\\")|(?:))))\\)"; const int DATASOURCE_INDEX = 3;//4; const int VALUE_INDEX = 2; //2; const int EXPRESSION_ARGUMENT_INDEX = 1;//3; @@ -95,6 +96,7 @@ namespace Const{ QString extractClassName(QString className); QString escapeSimbols(const QString& value); QString replaceHTMLSymbols(const QString &value); + QVector normalizeCaptures(const QRegExp ®); enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols}; enum RenderPass {FirstPass, SecondPass}; diff --git a/limereport/lrglobal.cpp b/limereport/lrglobal.cpp index 5b2cdff..b4eb854 100644 --- a/limereport/lrglobal.cpp +++ b/limereport/lrglobal.cpp @@ -67,4 +67,13 @@ QString replaceHTMLSymbols(const QString &value) return result; } +QVector normalizeCaptures(const QRegExp& reg){ + QVector result; + foreach (QString cap, reg.capturedTexts()) { + if (!cap.isEmpty()) + result.append(cap); + } + return result; +} + } //namespace LimeReport diff --git a/limereport/lrglobal.h b/limereport/lrglobal.h index 3b8aa7d..3f11f78 100644 --- a/limereport/lrglobal.h +++ b/limereport/lrglobal.h @@ -83,7 +83,8 @@ namespace Const{ //const int VALUE_INDEX = 2; //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 = "\\((?:(.+),(.+))|(?:\\\"(\\w+)\\\")\\)"; + const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:(?:(?:\\\")|(?:))(\\w+)(?:(?:\\\")|(?:)))|(?:(?:(?:\\\")|(?:))(\\s*\\$\\w\\s*\\{.+\\}\\s*)(?:(?:\\\")|(?:))\\s*,\\s*(?:(?:\\\")|(?:))(\\w+)(?:(?:\\\")|(?:))))\\)"; const int DATASOURCE_INDEX = 3;//4; const int VALUE_INDEX = 2; //2; const int EXPRESSION_ARGUMENT_INDEX = 1;//3; @@ -95,6 +96,7 @@ namespace Const{ QString extractClassName(QString className); QString escapeSimbols(const QString& value); QString replaceHTMLSymbols(const QString &value); + QVector normalizeCaptures(const QRegExp ®); enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols}; enum RenderPass {FirstPass, SecondPass}; diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index ddf7134..c7c82fc 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -341,15 +341,19 @@ void ReportRender::extractGroupsFunction(BandDesignIntf *band) if (rx.indexIn(contentItem->content())>=0){ int pos = 0; while ( (pos = rx.indexIn(contentItem->content(),pos)) != -1){ - BandDesignIntf* dataBand = m_patternPageItem->bandByName(rx.cap(Const::DATASOURCE_INDEX)); - if (dataBand){ - GroupFunction* gf = datasources()->addGroupFunction(functionName,rx.cap(Const::VALUE_INDEX),band->objectName(),dataBand->objectName()); - if (gf){ - connect(dataBand,SIGNAL(bandRendered(BandDesignIntf*)),gf,SLOT(slotBandRendered(BandDesignIntf*))); + QVector 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))); } - } else { - GroupFunction* gf = datasources()->addGroupFunction(functionName,rx.cap(Const::VALUE_INDEX),band->objectName(),rx.cap(Const::DATASOURCE_INDEX)); - gf->setInvalid(tr("Databand \"%1\" not found").arg(rx.cap(Const::DATASOURCE_INDEX))); } pos += rx.matchedLength(); } @@ -362,6 +366,7 @@ void ReportRender::extractGroupsFunction(BandDesignIntf *band) } } + void ReportRender::replaceGroupsFunction(BandDesignIntf *band) { foreach(BaseDesignIntf* item,band->childBaseItems()){ @@ -373,8 +378,11 @@ void ReportRender::replaceGroupsFunction(BandDesignIntf *band) if (rx.indexIn(content)>=0){ int pos = 0; while ( (pos = rx.indexIn(content,pos))!= -1 ){ - QString expressionIndex = datasources()->putGroupFunctionsExpressions(rx.cap(Const::VALUE_INDEX)); - content.replace(rx.capturedTexts().at(0),QString("%1(%2,%3)").arg(functionName).arg('"'+expressionIndex+'"').arg('"'+band->objectName()+'"')); + QVector 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(); } contentItem->setContent(content); From 6529ced062c619d3549349fe3fedaf9e514738ea Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 8 Mar 2017 04:59:40 +0300 Subject: [PATCH 076/136] COUNT function has been fixed --- limereport/lrscriptenginemanager.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index 5b6faa8..613b4dc 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -1295,13 +1295,7 @@ void JSFunctionDesc::setScriptWrapper(const QString &scriptWrapper) QVariant ScriptFunctionsManager::calcGroupFunction(const QString &name, const QString &expressionID, const QString &bandName) { if (m_scriptEngineManager->dataManager()){ - QString expression = ""; - if (name.compare("COUNT",Qt::CaseInsensitive) == 0){ - expression = " "; - } else { - expression = m_scriptEngineManager->dataManager()->getExpression(expressionID); - } - + QString expression = m_scriptEngineManager->dataManager()->getExpression(expressionID); GroupFunction* gf = m_scriptEngineManager->dataManager()->groupFunction(name,expression,bandName); if (gf){ if (gf->isValid()){ From 97365e0f4dd03b700a55a1f0eeac23a9305d9d3c Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 9 Mar 2017 14:00:02 +0300 Subject: [PATCH 077/136] borderLineSize has been fixed --- limereport/lrbasedesignintf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 2f5f4db..944277e 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -777,7 +777,7 @@ void BaseDesignIntf::emitObjectNamePropertyChanged(const QString &oldName, const int BaseDesignIntf::borderLineSize() const { - return 0 /*m_borderLineSize*/; + return m_borderLineSize; } void BaseDesignIntf::setBorderLineSize(int value) From 0505801e3a09218955cdfd761e05f4530cface12 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sun, 19 Mar 2017 14:03:13 +0300 Subject: [PATCH 078/136] printBeforePageHeader property has been added to "ReportHeader" band --- limereport/bands/lrreportheader.cpp | 15 ++++++++++++++- limereport/bands/lrreportheader.h | 4 ++++ limereport/lrreportrender.cpp | 21 +++++++++++++++++---- limereport/lrreportrender.h | 4 +++- 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/limereport/bands/lrreportheader.cpp b/limereport/bands/lrreportheader.cpp index 5b853b7..e08f418 100644 --- a/limereport/bands/lrreportheader.cpp +++ b/limereport/bands/lrreportheader.cpp @@ -46,7 +46,7 @@ bool VARIABLE_IS_NOT_USED registred = LimeReport::DesignElementsFactory::instanc namespace LimeReport { ReportHeader::ReportHeader(QObject *owner, QGraphicsItem *parent) - : BandDesignIntf(LimeReport::BandDesignIntf::ReportHeader,xmlTag,owner,parent) { + : BandDesignIntf(LimeReport::BandDesignIntf::ReportHeader,xmlTag,owner,parent), m_printBeforePageHeader(false) { setBandTypeText(tr("Report Header")); setMarkerColor(bandColor()); } @@ -60,5 +60,18 @@ QColor ReportHeader::bandColor() const return QColor(152,69,167); } +bool ReportHeader::printBeforePageHeader() const +{ + return m_printBeforePageHeader; +} + +void ReportHeader::setPrintBeforePageHeader(bool printBeforePageHeader) +{ + if (m_printBeforePageHeader != printBeforePageHeader){ + m_printBeforePageHeader = printBeforePageHeader; + notify("printBeforePageHeader",!m_printBeforePageHeader,m_printBeforePageHeader); + } +} + } diff --git a/limereport/bands/lrreportheader.h b/limereport/bands/lrreportheader.h index bc70667..d532ff9 100644 --- a/limereport/bands/lrreportheader.h +++ b/limereport/bands/lrreportheader.h @@ -39,11 +39,15 @@ class ReportHeader : public LimeReport::BandDesignIntf { Q_OBJECT Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable ) + Q_PROPERTY(bool printBeforePageHeader READ printBeforePageHeader WRITE setPrintBeforePageHeader) public: ReportHeader(QObject* owner = 0, QGraphicsItem *parent=0); virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0); + bool printBeforePageHeader() const; + void setPrintBeforePageHeader(bool printBeforePageHeader); protected: QColor bandColor() const; + bool m_printBeforePageHeader; }; } #endif // LRREPORTHEADER_H diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 36f7961..2476930 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -257,11 +257,12 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) } clearPageMap(); - startNewPage(); + startNewPage(true); + renderReportHeader(m_patternPageItem, AfterPageHeader); - renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader), 0, StartNewPageAsNeeded); +// renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader), 0, StartNewPageAsNeeded); BandDesignIntf* lastRenderedBand = 0; for (int i=0;idataBandCount() && !m_renderCanceled;i++){ @@ -605,6 +606,17 @@ void ReportRender::renderPageHeader(PageItemDesignIntf *patternPage) } } +void ReportRender::renderReportHeader(PageItemDesignIntf *patternPage, PageRenderStage stage) +{ + BandDesignIntf* band = patternPage->bandByType(BandDesignIntf::ReportHeader); + if (band){ + if (band->property("printBeforePageHeader").toBool() && stage == BeforePageHeader ) + renderBand(band, 0, StartNewPageAsNeeded); + if (!band->property("printBeforePageHeader").toBool() && stage == AfterPageHeader ) + renderBand(band, 0, StartNewPageAsNeeded); + } +} + void ReportRender::renderPageFooter(PageItemDesignIntf *patternPage) { BandDesignIntf* band = patternPage->bandByType(BandDesignIntf::PageFooter); @@ -897,7 +909,7 @@ bool ReportRender::registerBand(BandDesignIntf *band, bool registerInChildren) } - if (band->height()<=m_maxHeightByColumn[m_currentColumn]){ + if (band->height() <= m_maxHeightByColumn[m_currentColumn]){ if (band->bandType()==BandDesignIntf::PageFooter){ for (int i=0;ibeforeRender(); + if (isFirst) renderReportHeader(m_patternPageItem, BeforePageHeader); renderPageHeader(m_patternPageItem); m_pageFooterHeight = calcPageFooterHeight(m_patternPageItem); diff --git a/limereport/lrreportrender.h b/limereport/lrreportrender.h index 8e62b0b..1759712 100644 --- a/limereport/lrreportrender.h +++ b/limereport/lrreportrender.h @@ -70,6 +70,7 @@ public: enum DataRenderMode {StartNewPageAsNeeded, NotStartNewPage, ForcedStartPage}; enum BandPrintMode {PrintAlwaysPrintable, PrintNotAlwaysPrintable }; enum ResetPageNuberType{BandReset, PageReset}; + enum PageRenderStage{BeforePageHeader, AfterPageHeader}; typedef QSharedPointer Ptr; ~ReportRender(); ReportRender(QObject *parent = 0); @@ -102,6 +103,7 @@ private: BandDesignIntf* renderBand(BandDesignIntf *patternBand, BandDesignIntf *bandData, DataRenderMode mode = NotStartNewPage, bool isLast = false); void renderDataBand(BandDesignIntf* dataBand); void renderPageHeader(PageItemDesignIntf* patternPage); + void renderReportHeader(PageItemDesignIntf* patternPage, PageRenderStage stage); void renderPageFooter(PageItemDesignIntf* patternPage); void moveTearOffBand(); void renderPageItems(PageItemDesignIntf* patternPage); @@ -138,7 +140,7 @@ private: BandDesignIntf* saveUppperPartReturnBottom(BandDesignIntf *band, int height, BandDesignIntf *patternBand); BandDesignIntf* renderData(BandDesignIntf* patternBand); void startNewColumn(); - void startNewPage(); + void startNewPage(bool isFirst = false); void resetPageNumber(ResetPageNuberType resetType); int findLastPageNumber(int currentPage); void savePage(bool isLast = false); From 4559925af437b8012f128ff21435e277b0b27719 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 21 Mar 2017 18:01:35 +0300 Subject: [PATCH 079/136] aggregate functions can be called in data header --- limereport/bands/lrsubdetailband.h | 1 + limereport/lrbanddesignintf.cpp | 24 ++++++++ limereport/lrbanddesignintf.h | 7 ++- limereport/lrbasedesignintf.cpp | 14 ++++- limereport/lrbasedesignintf.h | 3 + limereport/lrdatasourcemanager.cpp | 6 +- limereport/lrreportrender.cpp | 90 ++++++++++++++++++++++++------ limereport/lrreportrender.h | 7 +++ 8 files changed, 131 insertions(+), 21 deletions(-) diff --git a/limereport/bands/lrsubdetailband.h b/limereport/bands/lrsubdetailband.h index ae094e4..afbc6c5 100644 --- a/limereport/bands/lrsubdetailband.h +++ b/limereport/bands/lrsubdetailband.h @@ -64,6 +64,7 @@ class SubDetailHeaderBand : public BandDesignIntf public: SubDetailHeaderBand(QObject* owner = 0, QGraphicsItem* parent=0); bool isUnique() const; + bool isHeader() const {return true;} protected: QColor bandColor() const; private: diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index ed9a534..42342ad 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -461,6 +461,19 @@ void BandDesignIntf::processPopUpAction(QAction *action) } } +void BandDesignIntf::recalcItems(DataSourceManager* dataManager) +{ + foreach(BaseDesignIntf* bi, childBaseItems()){ + ContentItemDesignIntf* ci = dynamic_cast(bi); + if (bi){ + ContentItemDesignIntf* pci = dynamic_cast(bi->patternItem()); + ci->setContent(pci->content()); + } + } + + updateItemSize(dataManager,FirstPass,height()); +} + BaseDesignIntf* BandDesignIntf::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent) { int maxBottom = 0; @@ -966,6 +979,17 @@ void BandDesignIntf::updateItemSize(DataSourceManager* dataManager, RenderPass p BaseDesignIntf::updateItemSize(dataManager, pass, maxHeight); } +void BandDesignIntf::restoreItems() +{ + foreach(BaseDesignIntf* bi, childBaseItems()){ + ContentItemDesignIntf* ci = dynamic_cast(bi); + if (ci){ + ContentItemDesignIntf* pci = dynamic_cast(bi->patternItem()); + ci->setContent(pci->content()); + } + } +} + void BandDesignIntf::updateBandNameLabel() { if (m_bandNameLabel) m_bandNameLabel->updateLabel(); diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index c53b9e3..c440aab 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -128,6 +128,8 @@ public: virtual QIcon bandIcon() const; virtual bool isUnique() const; void updateItemSize(DataSourceManager *dataManager, RenderPass pass=FirstPass, int maxHeight=0); + void restoreItems(); + void recalcItems(DataSourceManager* dataManager); void updateBandNameLabel(); virtual QColor selectionColor() const; @@ -220,8 +222,8 @@ public: QColor alternateBackgroundColor() const; void setAlternateBackgroundColor(const QColor &alternateBackgroundColor); bool useAlternateBackgroundColor() const; - void setUseAlternateBackgroundColor(bool useAlternateBackgroundColor); - + void setUseAlternateBackgroundColor(bool useAlternateBackgroundColor); + void replaceGroupsFunction(BandDesignIntf *band); signals: void bandRendered(BandDesignIntf* band); protected: @@ -248,6 +250,7 @@ protected: void moveItemsDown(qreal startPos, qreal offset); void preparePopUpMenu(QMenu &menu); void processPopUpAction(QAction *action); + private slots: void childBandDeleted(QObject* band); private: diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 944277e..1e02ecf 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -79,7 +79,8 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q m_changingItemAlign(false), m_borderColor(Qt::black), m_reportSettings(0), - m_patternName("") + m_patternName(""), + m_patternItem(0) { setGeometry(QRectF(0, 0, m_width, m_height)); if (BaseDesignIntf *item = dynamic_cast(parent)) { @@ -712,6 +713,16 @@ void BaseDesignIntf::setPatternName(const QString &patternName) m_patternName = patternName; } +BaseDesignIntf* BaseDesignIntf::patternItem() const +{ + return m_patternItem; +} + +void BaseDesignIntf::setPatternItem(BaseDesignIntf *patternItem) +{ + m_patternItem = patternItem; +} + ReportSettings *BaseDesignIntf::reportSettings() const { return m_reportSettings; @@ -1330,6 +1341,7 @@ BaseDesignIntf *BaseDesignIntf::cloneItem(ItemMode mode, QObject *owner, QGraphi { BaseDesignIntf *clone = cloneItemWOChild(mode, owner, parent); clone->setPatternName(this->objectName()); + clone->setPatternItem(this); #ifdef HAVE_QT5 foreach(QObject * child, children()) { #else diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index c925579..812fefc 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -272,6 +272,8 @@ public: void setZValueProperty(qreal value); QString patternName() const; void setPatternName(const QString &patternName); + BaseDesignIntf* patternItem() const; + void setPatternItem(BaseDesignIntf* patternItem); Q_INVOKABLE QString setItemWidth(qreal width); Q_INVOKABLE QString setItemHeight(qreal height); @@ -397,6 +399,7 @@ private: QColor m_borderColor; ReportSettings* m_reportSettings; QString m_patternName; + BaseDesignIntf* m_patternItem; signals: void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry); void posChanged(QObject* object, QPointF newPos, QPointF oldPos); diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index dc2c32e..1198f8b 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -258,7 +258,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 diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 2476930..99d5cf3 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -259,11 +259,8 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) clearPageMap(); startNewPage(true); - renderReportHeader(m_patternPageItem, AfterPageHeader); -// renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader), 0, StartNewPageAsNeeded); - BandDesignIntf* lastRenderedBand = 0; for (int i=0;idataBandCount() && !m_renderCanceled;i++){ lastRenderedBand = m_patternPageItem->dataBandAt(i); @@ -318,6 +315,7 @@ void ReportRender::initRenderPage() m_renderPageItem->initFromItem(m_patternPageItem); m_renderPageItem->setItemMode(PreviewMode); m_renderPageItem->setPatternName(m_patternPageItem->objectName()); + m_renderPageItem->setPatternItem(m_patternPageItem); } } @@ -393,6 +391,21 @@ void ReportRender::extractGroupsFunction(BandDesignIntf *band) } } +bool ReportRender::containsGroupsFunction(BandDesignIntf *band){ + foreach(BaseDesignIntf* item,band->childBaseItems()){ + ContentItemDesignIntf* contentItem = dynamic_cast(item); + if (contentItem){ + QString content = contentItem->content(); + foreach(QString functionName, m_datasources->groupFunctionNames()){ + QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName)); + if (rx.indexIn(content)>=0){ + return true; + } + } + } + } + return false; +} void ReportRender::replaceGroupsFunction(BandDesignIntf *band) { @@ -517,20 +530,20 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) BandDesignIntf* header = dataBand->bandHeader(); BandDesignIntf* footer = dataBand->bandFooter(); - if (header && header->printAlways()) renderBand(header, 0); + if (header && header->printAlways()) renderDataHeader(header); if(bandDatasource && !bandDatasource->eof() && !m_renderCanceled){ QString varName = QLatin1String("line_")+dataBand->objectName().toLower(); datasources()->setReportVariable(varName,1); - if (header && !header->printAlways()) - renderBand(header, 0); - - if (dataBand->bandHeader() && dataBand->bandHeader()->reprintOnEachPage()) + if (header && header->reprintOnEachPage()) m_reprintableBands.append(dataBand->bandHeader()); - renderChildHeader(dataBand,PrintNotAlwaysPrintable); + if (header && !header->printAlways()) + renderDataHeader(header); + + //renderChildHeader(dataBand,PrintNotAlwaysPrintable); renderGroupHeader(dataBand, bandDatasource, true); bool firstTime = true; @@ -578,7 +591,8 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) firstTime = false; } - m_reprintableBands.removeOne(dataBand->bandHeader()); + m_reprintableBands.removeOne(header); + if (header) recalcIfNeeded(header); renderGroupFooter(dataBand); @@ -702,13 +716,48 @@ void ReportRender::renderChildBands(BandDesignIntf *parentBand) } } +BandDesignIntf* ReportRender::findRecalcableBand(BandDesignIntf* patternBand){ + + QList::iterator it = m_recalcBands.begin(); + for (;it !=m_recalcBands.end() ;++it){ + if ((*it)->patternItem() == patternBand){ + BandDesignIntf* result = (*it); + m_recalcBands.erase(it); + return result; + } + } + return 0; +} + +void ReportRender::recalcIfNeeded(BandDesignIntf* band){ + BandDesignIntf* recalcBand = findRecalcableBand(band); + if (recalcBand){ + QString bandName = recalcBand->objectName(); + recalcBand->restoreItems(); + recalcBand->setObjectName(recalcBand->patternItem()->objectName()); + replaceGroupsFunction(recalcBand); + recalcBand->updateItemSize(datasources()); + recalcBand->setObjectName(bandName); + datasources()->clearGroupFunctionValues(recalcBand->patternItem()->objectName()); + } +} + +void ReportRender::renderDataHeader(BandDesignIntf *header) +{ + recalcIfNeeded(header); + BandDesignIntf* renderedHeader = renderBand(header, 0); + if (containsGroupsFunction(header)) + m_recalcBands.append(renderedHeader); +} + void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* dataSource, bool firstTime) { foreach(BandDesignIntf* band,parentBand->childrenByType(BandDesignIntf::GroupHeader)){ IGroupBand* gb = dynamic_cast(band); - if (gb&&gb->isNeedToClose(m_datasources)){ + if (gb&&gb->isNeedToClose(datasources())){ if (band->childBands().count()>0){ dataSource->prior(); + foreach (BandDesignIntf* subBand, band->childrenByType(BandDesignIntf::GroupHeader)) { foreach(BandDesignIntf* footer, subBand->childrenByType(BandDesignIntf::GroupFooter)){ renderBand(footer, 0); @@ -723,10 +772,6 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da dataSource->next(); } closeDataGroup(band); -// if (gb->isNeedToStartNewPage()){ -// savePage(); -// startNewPage(); -// } } if (!gb->isStarted()){ @@ -734,12 +779,15 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da m_reprintableBands.append(band); gb->startGroup(m_datasources); openDataGroup(band); + BandDesignIntf* renderedHeader = 0; if (!firstTime && gb->startNewPage()){ if (gb->resetPageNumber()) resetPageNumber(BandReset); - renderBand(band, 0, ForcedStartPage); + renderedHeader = renderBand(band, 0, ForcedStartPage); } else { - renderBand(band, 0, StartNewPageAsNeeded); + renderedHeader = renderBand(band, 0, StartNewPageAsNeeded); } + if (containsGroupsFunction(band)) + m_recalcBands.append(renderedHeader); } renderGroupHeader(band, dataSource, firstTime); @@ -753,6 +801,7 @@ void ReportRender::renderGroupFooterByHeader(BandDesignIntf* groupHeader){ foreach (BandDesignIntf* footer, groupHeader->childrenByType(BandDesignIntf::GroupFooter)){ renderBand(footer, 0, StartNewPageAsNeeded); } + recalcIfNeeded(groupHeader); } void ReportRender::renderGroupFooter(BandDesignIntf *parentBand) @@ -780,6 +829,7 @@ void ReportRender::initGroups() if (band->isHeader()){ IGroupBand* gb = dynamic_cast(band); if (gb) gb->closeGroup(); + extractGroupsFunction(band); } } } @@ -852,6 +902,7 @@ void ReportRender::closeDataGroup(BandDesignIntf *band) groupBand->closeGroup(); if (band->reprintOnEachPage()) m_reprintableBands.removeOne(band); } + recalcIfNeeded(band); closeGroup(band); } @@ -1056,6 +1107,11 @@ BandDesignIntf *ReportRender::renderData(BandDesignIntf *patternBand) if (patternBand->isFooter()){ replaceGroupsFunction(bandClone); } + + if (patternBand->isHeader()){ + replaceGroupsFunction(bandClone); + } + bandClone->updateItemSize(m_datasources); baseDesignIntfToScript(bandClone); diff --git a/limereport/lrreportrender.h b/limereport/lrreportrender.h index 1759712..21048c9 100644 --- a/limereport/lrreportrender.h +++ b/limereport/lrreportrender.h @@ -90,6 +90,7 @@ private: void baseDesignIntfToScript(BaseDesignIntf* item); + void renderPage(PageDesignIntf *patternPage); void initDatasources(); void initDatasource(const QString &name); @@ -112,13 +113,18 @@ private: void renderChildHeader(BandDesignIntf* parent, BandPrintMode printMode); void renderChildFooter(BandDesignIntf* parent, BandPrintMode printMode); void renderChildBands(BandDesignIntf* parentBand); + void recalcIfNeeded(BandDesignIntf *band); + void renderDataHeader(BandDesignIntf* header); void renderGroupHeader(BandDesignIntf* parentBand, IDataSource* dataSource, bool firstTime); void renderGroupFooter(BandDesignIntf* parentBand); void initGroups(); + bool containsGroupsFunction(BandDesignIntf* band); void extractGroupsFunction(BandDesignIntf* band); void replaceGroupsFunction(BandDesignIntf* band); + BandDesignIntf *findRecalcableBand(BandDesignIntf *patternBand); + void popPageFooterGroupValues(BandDesignIntf* dataBand); void pushPageFooterGroupValues(BandDesignIntf* dataBand); @@ -162,6 +168,7 @@ private: QList m_renderedPages; QMultiMap< BandDesignIntf*, GroupBandsHolder* > m_childBands; QList m_reprintableBands; + QList m_recalcBands; // QList m_lastRenderedHeaders; //int m_maxHeightByColumn[0]; From 188ab54ee2b042dac413ae56277dd8fb4dccffbb Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 22 Mar 2017 14:42:09 +0300 Subject: [PATCH 080/136] ReportEnginePrivate has been changed to ReportEngine in PrewiewWindow and DesignerWindow --- include/lrpreviewreportwidget.h | 3 ++- include/lrreportengine.h | 4 ++++ limereport/lrpreviewreportwidget.cpp | 7 ++++--- limereport/lrpreviewreportwidget.h | 3 ++- limereport/lrpreviewreportwindow.cpp | 4 +++- limereport/lrpreviewreportwindow.h | 19 +++++++++++-------- limereport/lrreportdesignwidget.cpp | 6 +++--- limereport/lrreportdesignwidget.h | 2 +- limereport/lrreportdesignwindow.cpp | 4 ++-- limereport/lrreportdesignwindow.h | 4 ++-- limereport/lrreportengine.cpp | 9 ++++++--- limereport/lrreportengine.h | 4 ++++ 12 files changed, 44 insertions(+), 25 deletions(-) diff --git a/include/lrpreviewreportwidget.h b/include/lrpreviewreportwidget.h index 4e35ea6..e33f75f 100644 --- a/include/lrpreviewreportwidget.h +++ b/include/lrpreviewreportwidget.h @@ -12,6 +12,7 @@ class PreviewReportWidget; class PreviewReportWidgetPrivate; class ReportEnginePrivate; +class ReportEngine; class LIMEREPORT_EXPORT PreviewReportWidget : public QWidget { @@ -20,7 +21,7 @@ class LIMEREPORT_EXPORT PreviewReportWidget : public QWidget friend class PreviewReportWindow; friend class PreviewReportWidgetPrivate; public: - explicit PreviewReportWidget(ReportEnginePrivate *report, QWidget *parent = 0); + explicit PreviewReportWidget(ReportEngine *report, QWidget *parent = 0); ~PreviewReportWidget(); public slots: void refreshPages(); diff --git a/include/lrreportengine.h b/include/lrreportengine.h index 9bd87b5..cbeb76b 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -63,11 +63,15 @@ class DataSourceManager; class ReportEnginePrivate; class PageDesignIntf; class PageItemDesignIntf; +class ReportDesignWidget; +class PreviewReportWidget; typedef QList< QSharedPointer > ReportPages; class LIMEREPORT_EXPORT ReportEngine : public QObject{ Q_OBJECT + friend class ReportDesignWidget; + friend class PreviewReportWidget; public: static void setSettings(QSettings *value){m_settings=value;} public: diff --git a/limereport/lrpreviewreportwidget.cpp b/limereport/lrpreviewreportwidget.cpp index dcddb74..53f289a 100644 --- a/limereport/lrpreviewreportwidget.cpp +++ b/limereport/lrpreviewreportwidget.cpp @@ -60,14 +60,15 @@ PageItemDesignIntf::Ptr PreviewReportWidgetPrivate::currentPage() else return PageItemDesignIntf::Ptr(0); } -PreviewReportWidget::PreviewReportWidget(ReportEnginePrivate *report, QWidget *parent) : +PreviewReportWidget::PreviewReportWidget(ReportEngine *report, QWidget *parent) : QWidget(parent), ui(new Ui::PreviewReportWidget), d_ptr(new PreviewReportWidgetPrivate(this)) { ui->setupUi(this); - d_ptr->m_previewPage = report->createPreviewPage(); + d_ptr->m_report = report->d_ptr; + d_ptr->m_previewPage = d_ptr->m_report->createPreviewPage(); d_ptr->m_previewPage->setItemMode( LimeReport::PreviewMode ); - d_ptr->m_report = report; + ui->errorsView->setVisible(false); connect(ui->graphicsView->verticalScrollBar(),SIGNAL(valueChanged(int)), this, SLOT(slotSliderMoved(int))); diff --git a/limereport/lrpreviewreportwidget.h b/limereport/lrpreviewreportwidget.h index 4e35ea6..e33f75f 100644 --- a/limereport/lrpreviewreportwidget.h +++ b/limereport/lrpreviewreportwidget.h @@ -12,6 +12,7 @@ class PreviewReportWidget; class PreviewReportWidgetPrivate; class ReportEnginePrivate; +class ReportEngine; class LIMEREPORT_EXPORT PreviewReportWidget : public QWidget { @@ -20,7 +21,7 @@ class LIMEREPORT_EXPORT PreviewReportWidget : public QWidget friend class PreviewReportWindow; friend class PreviewReportWidgetPrivate; public: - explicit PreviewReportWidget(ReportEnginePrivate *report, QWidget *parent = 0); + explicit PreviewReportWidget(ReportEngine *report, QWidget *parent = 0); ~PreviewReportWidget(); public slots: void refreshPages(); diff --git a/limereport/lrpreviewreportwindow.cpp b/limereport/lrpreviewreportwindow.cpp index b000547..02ee7ad 100644 --- a/limereport/lrpreviewreportwindow.cpp +++ b/limereport/lrpreviewreportwindow.cpp @@ -34,6 +34,8 @@ #include "lrreportengine_p.h" #include "lrpreviewreportwidget.h" #include "lrpreviewreportwidget_p.h" +#include "items/editors/lrfonteditorwidget.h" +#include "items/editors/lrtextalignmenteditorwidget.h" #include #include @@ -43,7 +45,7 @@ namespace LimeReport{ -PreviewReportWindow::PreviewReportWindow(ReportEnginePrivate *report,QWidget *parent, QSettings *settings, Qt::WindowFlags flags) : +PreviewReportWindow::PreviewReportWindow(ReportEngine *report, QWidget *parent, QSettings *settings, Qt::WindowFlags flags) : QMainWindow(parent,flags), ui(new Ui::PreviewReportWindow), m_settings(settings), m_ownedSettings(false) { diff --git a/limereport/lrpreviewreportwindow.h b/limereport/lrpreviewreportwindow.h index 92b2829..e61bf76 100644 --- a/limereport/lrpreviewreportwindow.h +++ b/limereport/lrpreviewreportwindow.h @@ -34,15 +34,10 @@ #include #include #include +#include +#include -#include "lrpagedesignintf.h" -#include "lrreportrender.h" -#include "serializators/lrstorageintf.h" #include "serializators/lrxmlreader.h" -#include "lrpreviewreportwidget.h" - -#include "items/editors/lrfonteditorwidget.h" -#include "items/editors/lrtextalignmenteditorwidget.h" namespace LimeReport { @@ -50,11 +45,19 @@ namespace Ui { class PreviewReportWindow; } +class PreviewReportWidget; +class FontEditorWidget; +class TextAlignmentEditorWidget; +class ReportEngine; +class PageItemDesignIntf; +typedef QList< QSharedPointer > ReportPages; + + class PreviewReportWindow : public QMainWindow { Q_OBJECT public: - explicit PreviewReportWindow(ReportEnginePrivate *report, QWidget *parent = 0, QSettings* settings=0, Qt::WindowFlags flags=0); + explicit PreviewReportWindow(ReportEngine *report, QWidget *parent = 0, QSettings* settings=0, Qt::WindowFlags flags=0); ~PreviewReportWindow(); void setReportReader(ItemsReaderIntf::Ptr reader); void setPages(ReportPages pages); diff --git a/limereport/lrreportdesignwidget.cpp b/limereport/lrreportdesignwidget.cpp index 6a6ff0c..30c5137 100644 --- a/limereport/lrreportdesignwidget.cpp +++ b/limereport/lrreportdesignwidget.cpp @@ -48,7 +48,7 @@ namespace LimeReport { // ReportDesignIntf -ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow *mainWindow, QWidget *parent) : +ReportDesignWidget::ReportDesignWidget(ReportEngine *report, QMainWindow *mainWindow, QWidget *parent) : QWidget(parent), m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false) { m_tabWidget = new QTabWidget(this); @@ -63,7 +63,7 @@ ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow m_report->appendPage("page1"); } else { - m_report=report; + m_report=report->d_ptr; if (!m_report->pageCount()) m_report->appendPage("page1"); } @@ -74,7 +74,7 @@ ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentTabChanged(int))); //m_instance=this; - m_scriptEditor->setPlainText(report->scriptContext()->initScript()); + m_scriptEditor->setPlainText(m_report->scriptContext()->initScript()); m_zoomer = new GraphicsViewZoomer(activeView()); #ifdef Q_OS_WIN m_defaultFont = QFont("Arial",10); diff --git a/limereport/lrreportdesignwidget.h b/limereport/lrreportdesignwidget.h index 28a1998..46bfbda 100644 --- a/limereport/lrreportdesignwidget.h +++ b/limereport/lrreportdesignwidget.h @@ -150,7 +150,7 @@ protected: void createTabs(); private: bool eventFilter(QObject *target, QEvent *event); - ReportDesignWidget(ReportEnginePrivate* report,QMainWindow *mainWindow,QWidget *parent = 0); + ReportDesignWidget(ReportEngine* report,QMainWindow *mainWindow,QWidget *parent = 0); private: ReportEnginePrivate* m_report; QGraphicsView *m_view; diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index 358aa6b..82dba6a 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -62,7 +62,7 @@ namespace LimeReport{ ReportDesignWindow* ReportDesignWindow::m_instance=0; -ReportDesignWindow::ReportDesignWindow(ReportEnginePrivate *report, QWidget *parent, QSettings* settings) : +ReportDesignWindow::ReportDesignWindow(ReportEngine *report, QWidget *parent, QSettings* settings) : QMainWindow(parent), m_textAttibutesIsChanging(false), m_settings(settings), m_ownedSettings(false), m_progressDialog(0), m_showProgressDialog(true) { initReportEditor(report); @@ -437,7 +437,7 @@ void ReportDesignWindow::createMainMenu() m_recentFilesMenu->setDisabled(m_recentFiles.isEmpty()); } -void ReportDesignWindow::initReportEditor(ReportEnginePrivate* report) +void ReportDesignWindow::initReportEditor(ReportEngine* report) { m_reportDesignWidget=new ReportDesignWidget(report,this,this); setCentralWidget(m_reportDesignWidget); diff --git a/limereport/lrreportdesignwindow.h b/limereport/lrreportdesignwindow.h index 147f47f..94d5670 100644 --- a/limereport/lrreportdesignwindow.h +++ b/limereport/lrreportdesignwindow.h @@ -59,7 +59,7 @@ class ReportDesignWindow : public QMainWindow { Q_OBJECT public: - explicit ReportDesignWindow(ReportEnginePrivate* report, QWidget *parent = 0, QSettings* settings=0); + explicit ReportDesignWindow(ReportEngine *report, QWidget *parent = 0, QSettings* settings=0); ~ReportDesignWindow(); static ReportDesignWindow* instance(){return m_instance;} @@ -134,7 +134,7 @@ private: void createItemsActions(); void createObjectInspector(); void createObjectsBrowser(); - void initReportEditor(ReportEnginePrivate* report); + void initReportEditor(ReportEngine *report); void createDataWindow(); void createScriptWindow(); void updateRedoUndo(); diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 6f9c6e0..3bb60d1 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -371,7 +371,8 @@ void ReportEnginePrivate::previewReport(PreviewHints hints) ReportPages pages = renderToPages(); dataManager()->setDesignTime(true); if (pages.count()>0){ - PreviewReportWindow* w = new PreviewReportWindow(this,0,settings()); + Q_Q(ReportEngine); + PreviewReportWindow* w = new PreviewReportWindow(q,0,settings()); w->setWindowFlags(Qt::Dialog|Qt::WindowMaximizeButtonHint|Qt::WindowCloseButtonHint| Qt::WindowMinMaxButtonsHint); w->setAttribute(Qt::WA_DeleteOnClose,true); w->setWindowModality(Qt::ApplicationModal); @@ -405,7 +406,8 @@ void ReportEnginePrivate::previewReport(PreviewHints hints) PreviewReportWidget* ReportEnginePrivate::createPreviewWidget(QWidget* parent){ - PreviewReportWidget* widget = new PreviewReportWidget(this, parent); + Q_Q(ReportEngine); + PreviewReportWidget* widget = new PreviewReportWidget(q, parent); try{ dataManager()->setDesignTime(false); ReportPages pages = renderToPages(); @@ -478,7 +480,8 @@ PageDesignIntf* ReportEngine::createPreviewScene(QObject* parent){ void ReportEnginePrivate::designReport() { if (!m_designerWindow) { - m_designerWindow = new LimeReport::ReportDesignWindow(this,QApplication::activeWindow(),settings()); + Q_Q(ReportEngine); + m_designerWindow = new LimeReport::ReportDesignWindow(q,QApplication::activeWindow(),settings()); m_designerWindow->setAttribute(Qt::WA_DeleteOnClose,true); m_designerWindow->setWindowIcon(QIcon(":report/images/logo32")); m_designerWindow->setShowProgressDialog(m_showProgressDialog); diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index 9bd87b5..cbeb76b 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -63,11 +63,15 @@ class DataSourceManager; class ReportEnginePrivate; class PageDesignIntf; class PageItemDesignIntf; +class ReportDesignWidget; +class PreviewReportWidget; typedef QList< QSharedPointer > ReportPages; class LIMEREPORT_EXPORT ReportEngine : public QObject{ Q_OBJECT + friend class ReportDesignWidget; + friend class PreviewReportWidget; public: static void setSettings(QSettings *value){m_settings=value;} public: From 61a3c20bb2985d706356b0f4100b1c1c9c2e226c Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 1 Apr 2017 14:48:56 +0300 Subject: [PATCH 081/136] Readme.md has been changed --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index febeb6d..00a80dd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -LimeReport v1.3.11 [![Build Status](https://api.travis-ci.org/fralx/LimeReport.svg?branch=master)](https://travis-ci.org/fralx/LimeReport) +LimeReport v1.4.7 [![Build Status](https://api.travis-ci.org/fralx/LimeReport.svg?branch=master)](https://travis-ci.org/fralx/LimeReport) +----------- +Official LimeReport web site [http://limereport.ru](http://limereport.ru) ----------- ##Features @@ -38,6 +40,17 @@ For more samples see a demo ## Change log +###1.4.7 +1. Multipage +2. Dialogs +3. Render events +4. Initscript +5. Memory usage has been reduced +6. Datasource manager has been refactored +7. Report items context menus have been added +8. Editable report +And many others minor fixes and improvements + ###1.3.11 1. LimeReport project structure has been changed 2. Preview widget has been added From 6dca8b27cb63eb591ec8de6c41db48f75575a03d Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Wed, 5 Apr 2017 00:58:04 +0300 Subject: [PATCH 082/136] Fix #61 AutoHeight overlapping --- limereport/items/lrtextitem.cpp | 2 +- limereport/limereport.pri | 6 +- limereport/lrbanddesignintf.cpp | 113 +--------------------- limereport/lrbanddesignintf.h | 42 +------- limereport/lrbasedesignintf.cpp | 4 +- limereport/lritemscontainerdesignitf.cpp | 117 +++++++++++++++++++++++ limereport/lritemscontainerdesignitf.h | 56 +++++++++++ limereport/lrpageitemdesignintf.cpp | 12 ++- limereport/lrpageitemdesignintf.h | 4 +- limereport/lrreportrender.cpp | 7 +- 10 files changed, 200 insertions(+), 163 deletions(-) create mode 100644 limereport/lritemscontainerdesignitf.cpp create mode 100644 limereport/lritemscontainerdesignitf.h diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index e36d251..1224bc9 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -691,7 +691,7 @@ bool TextItem::isNeedUpdateSize(RenderPass pass) const { Q_UNUSED(pass) - if ((autoHeight() && autoWidth()) || hasFollower()){ + if ((autoHeight() || autoWidth()) || hasFollower()){ initTextSizes(); } diff --git a/limereport/limereport.pri b/limereport/limereport.pri index 7f621e9..605f96a 100644 --- a/limereport/limereport.pri +++ b/limereport/limereport.pri @@ -89,7 +89,8 @@ SOURCES += \ $$REPORT_PATH/lrsimplecrypt.cpp \ $$REPORT_PATH/lraboutdialog.cpp \ $$REPORT_PATH/lrsettingdialog.cpp \ - $$REPORT_PATH/scriptbrowser/lrscriptbrowser.cpp + $$REPORT_PATH/scriptbrowser/lrscriptbrowser.cpp \ + $$REPORT_PATH/lritemscontainerdesignitf.cpp contains(CONFIG, zint){ SOURCES += $$REPORT_PATH/items/lrbarcodeitem.cpp @@ -188,7 +189,8 @@ HEADERS += \ $$REPORT_PATH/lrcallbackdatasourceintf.h \ $$REPORT_PATH/lrsettingdialog.h \ $$REPORT_PATH/lrpreviewreportwidget_p.h \ - $$REPORT_PATH/scriptbrowser/lrscriptbrowser.h + $$REPORT_PATH/scriptbrowser/lrscriptbrowser.h \ + $$REPORT_PATH/lritemscontainerdesignitf.h contains(CONFIG,zint){ HEADERS += $$REPORT_PATH/items/lrbarcodeitem.h diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index 9a704f2..f4a1cf9 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -99,33 +99,8 @@ void BandMarker::mousePressEvent(QGraphicsSceneMouseEvent *event) } } -bool Segment::intersect(Segment value) -{ - return ((value.m_end>=m_begin)&&(value.m_end<=m_end)) || - ((value.m_begin>=m_begin)&&(value.m_end>=m_end)) || - ((value.m_begin>=m_begin)&&(value.m_end<=m_end)) || - ((value.m_beginm_end)) ; -} - -qreal Segment::intersectValue(Segment value) -{ - if ((value.m_end>=m_begin)&&(value.m_end<=m_end)){ - return value.m_end-m_begin; - } - if ((value.m_begin>=m_begin)&&(value.m_end>=m_end)){ - return m_end-value.m_begin; - } - if ((value.m_begin>=m_begin)&&(value.m_end<=m_end)){ - return value.m_end-value.m_begin; - } - if ((value.m_beginm_end)){ - return m_end-m_begin; - } - return 0; -} - BandDesignIntf::BandDesignIntf(BandsType bandType, const QString &xmlTypeName, QObject* owner, QGraphicsItem *parent) : - BaseDesignIntf(xmlTypeName, owner,parent), + ItemsContainerDesignInft(xmlTypeName, owner,parent), m_bandType(bandType), m_bandIndex(static_cast(bandType)), m_dataSourceName(""), @@ -581,97 +556,11 @@ void BandDesignIntf::setSplittable(bool value){ } } -bool itemSortContainerLessThen(const PItemSortContainer c1, const PItemSortContainer c2) -{ - VSegment vS1(c1->m_rect),vS2(c2->m_rect); - HSegment hS1(c1->m_rect),hS2(c2->m_rect); - if (vS1.intersectValue(vS2)>hS1.intersectValue(hS2)) - return c1->m_rect.x()m_rect.x(); - else return c1->m_rect.y()m_rect.y(); -} - bool bandIndexLessThen(const BandDesignIntf* b1, const BandDesignIntf* b2) { return b1->bandIndex()bandIndex(); } -void BandDesignIntf::snapshotItemsLayout() -{ - m_bandItems.clear(); - foreach(BaseDesignIntf *childItem,childBaseItems()){ - m_bandItems.append(PItemSortContainer(new ItemSortContainer(childItem))); - } - qSort(m_bandItems.begin(),m_bandItems.end(),itemSortContainerLessThen); -} - -void BandDesignIntf::arrangeSubItems(RenderPass pass, DataSourceManager *dataManager, ArrangeType type) -{ - bool needArrage=(type==Force); - - foreach (PItemSortContainer item, m_bandItems) { - if (item->m_item->isNeedUpdateSize(pass)){ - item->m_item->updateItemSize(dataManager, pass); - needArrage=true; - } - } - - if (needArrage){ - //qSort(m_bandItems.begin(),m_bandItems.end(),itemSortContainerLessThen); - for (int i=0;im_item->collidesWithItem(m_bandItems[j]->m_item))){ - HSegment hS1(m_bandItems[j]->m_rect),hS2(m_bandItems[i]->m_rect); - VSegment vS1(m_bandItems[j]->m_rect),vS2(m_bandItems[i]->m_rect); - if (m_bandItems[i]->m_rect.bottom()m_item->geometry().bottom()){ - if (hS1.intersectValue(hS2)>vS1.intersectValue(vS2)) - m_bandItems[j]->m_item->setY(m_bandItems[i]->m_item->y()+m_bandItems[i]->m_item->height() - +m_bandItems[j]->m_rect.top()-m_bandItems[i]->m_rect.bottom()); - - } - if (m_bandItems[i]->m_rect.right()m_item->geometry().right()){ - if (vS1.intersectValue(vS2)>hS1.intersectValue(hS2)) - m_bandItems[j]->m_item->setX(m_bandItems[i]->m_item->geometry().right()+ - (m_bandItems[j]->m_rect.x()-m_bandItems[i]->m_rect.right())); - } - } - } - } - - if(needArrage||pass==FirstPass){ - int maxBottom = findMaxBottom(); - foreach(BaseDesignIntf* item,childBaseItems()){ - ItemDesignIntf* childItem=dynamic_cast(item); - if (childItem){ - if (childItem->stretchToMaxHeight()) - childItem->setHeight(maxBottom-childItem->geometry().top()); - } - } - } - -} - -qreal BandDesignIntf::findMaxBottom() -{ - qreal maxBottom=0; - foreach(QGraphicsItem* item,childItems()){ - BaseDesignIntf* subItem = dynamic_cast(item); - if(subItem) - if ( subItem->isVisible() && (subItem->geometry().bottom()>maxBottom) ) - maxBottom=subItem->geometry().bottom(); - } - return maxBottom; -} - -qreal BandDesignIntf::findMaxHeight(){ - qreal maxHeight=0; - foreach(QGraphicsItem* item,childItems()){ - BaseDesignIntf* subItem = dynamic_cast(item); - if(subItem) - if (subItem->geometry().height()>maxHeight) maxHeight=subItem->geometry().height(); - } - return maxHeight; -} - void BandDesignIntf::trimToMaxHeight(int maxHeight) { foreach(BaseDesignIntf* item,childBaseItems()){ diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index 0d92f5e..e588385 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -31,6 +31,7 @@ #define LRBANDDESIGNINTF_H #include "lrbasedesignintf.h" #include "lrdatasourcemanager.h" +#include "lritemscontainerdesignitf.h" #include namespace LimeReport { @@ -81,10 +82,7 @@ private: BandDesignIntf* m_band; }; -struct ItemSortContainer; -typedef QSharedPointer< ItemSortContainer > PItemSortContainer; - -class BandDesignIntf : public BaseDesignIntf +class BandDesignIntf : public ItemsContainerDesignInft { Q_OBJECT Q_PROPERTY(bool autoHeight READ autoHeight WRITE setAutoHeight ) @@ -223,10 +221,6 @@ public: signals: void bandRendered(BandDesignIntf* band); protected: - void snapshotItemsLayout(); - void arrangeSubItems(RenderPass pass, DataSourceManager *dataManager, ArrangeType type = AsNeeded); - qreal findMaxBottom(); - qreal findMaxHeight(); void trimToMaxHeight(int maxHeight); void setBandTypeText(const QString& value); QString bandTypeText(){return m_bandTypeText;} @@ -286,37 +280,7 @@ public: DataBandDesignIntf(BandsType bandType, QString xmlTypeName, QObject* owner = 0, QGraphicsItem* parent=0); }; -class Segment{ -public: - Segment(qreal segmentStart,qreal segmentEnd):m_begin(segmentStart),m_end(segmentEnd){} - bool intersect(Segment value); - qreal intersectValue(Segment value); -private: - qreal m_begin; - qreal m_end; -}; - -class VSegment : public Segment{ -public: - VSegment(QRectF rect):Segment(rect.top(),rect.bottom()){} -}; - -struct HSegment :public Segment{ -public: - HSegment(QRectF rect):Segment(rect.left(),rect.right()){} -}; - -struct ItemSortContainer { - QRectF m_rect; - BaseDesignIntf * m_item; - ItemSortContainer(BaseDesignIntf *item){ - m_item=item; - m_rect=item->geometry(); - } -}; - -bool itemSortContainerLessThen(const PItemSortContainer c1, const PItemSortContainer c2); bool bandIndexLessThen(const BandDesignIntf* b1, const BandDesignIntf* b2); -} +} // namespace LimeReport #endif // LRBANDDESIGNINTF_H diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 944277e..a80fd33 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -39,7 +39,6 @@ #include "serializators/lrxmlreader.h" #include - #include #include #include @@ -1525,8 +1524,7 @@ BaseDesignIntf *Marker::object() const return m_object; } - -} +} //namespace LimeReport diff --git a/limereport/lritemscontainerdesignitf.cpp b/limereport/lritemscontainerdesignitf.cpp new file mode 100644 index 0000000..dcad6ee --- /dev/null +++ b/limereport/lritemscontainerdesignitf.cpp @@ -0,0 +1,117 @@ +#include "lritemscontainerdesignitf.h" +#include "lritemdesignintf.h" + +namespace LimeReport { + +bool Segment::intersect(Segment value) +{ + return ((value.m_end>=m_begin)&&(value.m_end<=m_end)) || + ((value.m_begin>=m_begin)&&(value.m_end>=m_end)) || + ((value.m_begin>=m_begin)&&(value.m_end<=m_end)) || + ((value.m_beginm_end)) ; +} + +qreal Segment::intersectValue(Segment value) +{ + if ((value.m_end>=m_begin)&&(value.m_end<=m_end)){ + return value.m_end-m_begin; + } + if ((value.m_begin>=m_begin)&&(value.m_end>=m_end)){ + return m_end-value.m_begin; + } + if ((value.m_begin>=m_begin)&&(value.m_end<=m_end)){ + return value.m_end-value.m_begin; + } + if ((value.m_beginm_end)){ + return m_end-m_begin; + } + return 0; +} + +bool itemSortContainerLessThen(const PItemSortContainer c1, const PItemSortContainer c2) +{ + VSegment vS1(c1->m_rect),vS2(c2->m_rect); + HSegment hS1(c1->m_rect),hS2(c2->m_rect); + if (vS1.intersectValue(vS2)>hS1.intersectValue(hS2)) + return c1->m_rect.x()m_rect.x(); + else return c1->m_rect.y()m_rect.y(); +} + +void ItemsContainerDesignInft::snapshotItemsLayout() +{ + m_containerItems.clear(); + foreach(BaseDesignIntf *childItem,childBaseItems()){ + m_containerItems.append(PItemSortContainer(new ItemSortContainer(childItem))); + } + qSort(m_containerItems.begin(),m_containerItems.end(),itemSortContainerLessThen); +} + +void ItemsContainerDesignInft::arrangeSubItems(RenderPass pass, DataSourceManager *dataManager, ArrangeType type) +{ + bool needArrage=(type==Force); + + foreach (PItemSortContainer item, m_containerItems) { + if (item->m_item->isNeedUpdateSize(pass)){ + item->m_item->updateItemSize(dataManager, pass); + needArrage=true; + } + } + + if (needArrage){ + for (int i=0;im_item->collidesWithItem(m_containerItems[j]->m_item))){ + HSegment hS1(m_containerItems[j]->m_rect),hS2(m_containerItems[i]->m_rect); + VSegment vS1(m_containerItems[j]->m_rect),vS2(m_containerItems[i]->m_rect); + if (m_containerItems[i]->m_rect.bottom()m_item->geometry().bottom()){ + if (hS1.intersectValue(hS2)>vS1.intersectValue(vS2)) + m_containerItems[j]->m_item->setY(m_containerItems[i]->m_item->y()+m_containerItems[i]->m_item->height() + +m_containerItems[j]->m_rect.top()-m_containerItems[i]->m_rect.bottom()); + + } + if (m_containerItems[i]->m_rect.right()m_item->geometry().right()){ + if (vS1.intersectValue(vS2)>hS1.intersectValue(hS2)) + m_containerItems[j]->m_item->setX(m_containerItems[i]->m_item->geometry().right()+ + (m_containerItems[j]->m_rect.x()-m_containerItems[i]->m_rect.right())); + } + } + } + } + } + + if (needArrage||pass==FirstPass){ + int maxBottom = findMaxBottom(); + foreach(BaseDesignIntf* item,childBaseItems()){ + ItemDesignIntf* childItem=dynamic_cast(item); + if (childItem){ + if (childItem->stretchToMaxHeight()) + childItem->setHeight(maxBottom-childItem->geometry().top()); + } + } + } +} + +qreal ItemsContainerDesignInft::findMaxBottom() +{ + qreal maxBottom=0; + foreach(QGraphicsItem* item,childItems()){ + BaseDesignIntf* subItem = dynamic_cast(item); + if(subItem) + if ( subItem->isVisible() && (subItem->geometry().bottom()>maxBottom) ) + maxBottom=subItem->geometry().bottom(); + } + return maxBottom; +} + +qreal ItemsContainerDesignInft::findMaxHeight() +{ + qreal maxHeight=0; + foreach(QGraphicsItem* item,childItems()){ + BaseDesignIntf* subItem = dynamic_cast(item); + if(subItem) + if (subItem->geometry().height()>maxHeight) maxHeight=subItem->geometry().height(); + } + return maxHeight; +} + +} // namespace LimeReport diff --git a/limereport/lritemscontainerdesignitf.h b/limereport/lritemscontainerdesignitf.h new file mode 100644 index 0000000..86b2509 --- /dev/null +++ b/limereport/lritemscontainerdesignitf.h @@ -0,0 +1,56 @@ +#ifndef ITEMSCONTAINERDESIGNITF_H +#define ITEMSCONTAINERDESIGNITF_H + +#include "lrbasedesignintf.h" + +namespace LimeReport{ + +class Segment{ +public: + Segment(qreal segmentStart,qreal segmentEnd):m_begin(segmentStart),m_end(segmentEnd){} + bool intersect(Segment value); + qreal intersectValue(Segment value); +private: + qreal m_begin; + qreal m_end; +}; + +class VSegment : public Segment{ +public: + VSegment(QRectF rect):Segment(rect.top(),rect.bottom()){} +}; + +struct HSegment :public Segment{ +public: + HSegment(QRectF rect):Segment(rect.left(),rect.right()){} +}; + +struct ItemSortContainer { + QRectF m_rect; + BaseDesignIntf * m_item; + ItemSortContainer(BaseDesignIntf *item){ + m_item=item; + m_rect=item->geometry(); + } +}; + +typedef QSharedPointer< ItemSortContainer > PItemSortContainer; +bool itemSortContainerLessThen(const PItemSortContainer c1, const PItemSortContainer c2); + +class ItemsContainerDesignInft : public BaseDesignIntf{ +public: + ItemsContainerDesignInft(const QString& xmlTypeName, QObject* owner = 0, QGraphicsItem* parent=0): + BaseDesignIntf(xmlTypeName, owner, parent){} +protected: + void snapshotItemsLayout(); + void arrangeSubItems(RenderPass pass, DataSourceManager *dataManager, ArrangeType type = AsNeeded); + qreal findMaxBottom(); + qreal findMaxHeight(); +private: + QVector m_containerItems; + +}; + +} // namespace LimeReport + +#endif // ITEMSCONTAINERDESIGNITF_H diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index d943a13..150df06 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -46,24 +46,26 @@ bool bandSortBandLessThenByIndex(const BandDesignIntf *c1, const BandDesignIntf } PageItemDesignIntf::PageItemDesignIntf(QObject *owner, QGraphicsItem *parent) : - BaseDesignIntf("PageItem",owner,parent), + ItemsContainerDesignInft("PageItem",owner,parent), m_topMargin(0), m_bottomMargin(0), m_leftMargin(0), m_rightMargin(0), m_pageOrientaion(Portrait), m_pageSize(A4), m_sizeChainging(false), m_fullPage(false), m_oldPrintMode(false), m_resetPageNumber(false) { setFixedPos(true); setPossibleResizeDirectionFlags(Fixed); + setFlag(QGraphicsItem::ItemClipsChildrenToShape); initPageSize(m_pageSize); } PageItemDesignIntf::PageItemDesignIntf(const PageSize pageSize, const QRectF &rect, QObject *owner, QGraphicsItem *parent) : - BaseDesignIntf("PageItem",owner,parent), + ItemsContainerDesignInft("PageItem",owner,parent), m_topMargin(0), m_bottomMargin(0), m_leftMargin(0), m_rightMargin(0), m_pageOrientaion(Portrait), m_pageSize(pageSize), m_sizeChainging(false), m_fullPage(false), m_oldPrintMode(false), m_resetPageNumber(false) { setFixedPos(true); setPossibleResizeDirectionFlags(Fixed); + setFlag(QGraphicsItem::ItemClipsChildrenToShape); initPageSize(rect.size()); } @@ -316,6 +318,12 @@ void PageItemDesignIntf::setResetPageNumber(bool resetPageNumber) } } +void PageItemDesignIntf::updateSubItemsSize(RenderPass pass, DataSourceManager *dataManager) +{ + snapshotItemsLayout(); + arrangeSubItems(pass, dataManager); +} + bool PageItemDesignIntf::oldPrintMode() const { return m_oldPrintMode; diff --git a/limereport/lrpageitemdesignintf.h b/limereport/lrpageitemdesignintf.h index 2c1fb84..ef9b06d 100644 --- a/limereport/lrpageitemdesignintf.h +++ b/limereport/lrpageitemdesignintf.h @@ -31,13 +31,14 @@ #define LRPAGEITEM_H #include "lrbasedesignintf.h" #include "lrbanddesignintf.h" +#include "lritemscontainerdesignitf.h" #include #include namespace LimeReport{ class ReportRender; -class PageItemDesignIntf : public LimeReport::BaseDesignIntf +class PageItemDesignIntf : public LimeReport::ItemsContainerDesignInft { Q_OBJECT Q_ENUMS(Orientation) @@ -115,6 +116,7 @@ public: bool canContainChildren(){ return true;} bool resetPageNumber() const; void setResetPageNumber(bool resetPageNumber); + void updateSubItemsSize(RenderPass pass, DataSourceManager *dataManager); protected slots: void bandDeleted(QObject* band); diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index c7c82fc..8d2ccb6 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -608,9 +608,10 @@ void ReportRender::renderPageItems(PageItemDesignIntf* patternPage) } } m_renderPageItem->restoreLinks(); - foreach(BaseDesignIntf* item, pageItems){ - item->updateItemSize(m_datasources); - } + m_renderPageItem->updateSubItemsSize(FirstPass,m_datasources); +// foreach(BaseDesignIntf* item, pageItems){ +// item->updateItemSize(m_datasources); +// } } qreal ReportRender::calcPageFooterHeight(PageItemDesignIntf *patternPage) From 1ccfd147f170ff0f47935ff3df7b0bc5b09d2e80 Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Wed, 5 Apr 2017 01:08:03 +0300 Subject: [PATCH 083/136] version has been changed --- common.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.pri b/common.pri index 6b59a37..0bb04eb 100644 --- a/common.pri +++ b/common.pri @@ -56,7 +56,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 4 +LIMEREPORT_VERSION_RELEASE = 8 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" From 491f7b49d704cf175a94df873ad2d81bd27c3e61 Mon Sep 17 00:00:00 2001 From: Andy Maloney Date: Fri, 7 Apr 2017 23:02:58 -0400 Subject: [PATCH 084/136] Fix "hidden overloaded virtual function" warning I'm presuming that TearOffBand::isUnique() is supposed to override the base class's isUnique(), but it was missing a const... --- limereport/bands/lrtearoffband.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/limereport/bands/lrtearoffband.h b/limereport/bands/lrtearoffband.h index d1ee19b..e373a90 100644 --- a/limereport/bands/lrtearoffband.h +++ b/limereport/bands/lrtearoffband.h @@ -12,7 +12,7 @@ public: virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0); protected: QColor bandColor() const; - bool isUnique(){ return true;} + virtual bool isUnique() const {return true;} }; } // namespace LimeReport From 3ae754e3dddecc28b37461f6d0abe873f34f7477 Mon Sep 17 00:00:00 2001 From: Andy Maloney Date: Sat, 8 Apr 2017 09:31:02 -0400 Subject: [PATCH 085/136] Fix a memory leak in PageDesignIntf::copy() --- limereport/lrpagedesignintf.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/limereport/lrpagedesignintf.cpp b/limereport/lrpagedesignintf.cpp index 2178d43..49d513c 100644 --- a/limereport/lrpagedesignintf.cpp +++ b/limereport/lrpagedesignintf.cpp @@ -1226,6 +1226,8 @@ void PageDesignIntf::copy() if (shouldWrite) { clipboard->setText(writer->saveToString()); } + + delete writer; } } From 7ebc42c5142ba7313ea4966660b3eee3637e801d Mon Sep 17 00:00:00 2001 From: Andy Maloney Date: Sat, 8 Apr 2017 09:35:09 -0400 Subject: [PATCH 086/136] Fixes a few instances where nullptrs might be dereferenced --- limereport/lrpagedesignintf.cpp | 2 +- limereport/lrreportdesignwidget.cpp | 2 +- limereport/lrreportrender.cpp | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/limereport/lrpagedesignintf.cpp b/limereport/lrpagedesignintf.cpp index 2178d43..679f583 100644 --- a/limereport/lrpagedesignintf.cpp +++ b/limereport/lrpagedesignintf.cpp @@ -2169,7 +2169,7 @@ void PropertyItemAlignChangedCommand::undoIt() if (reportItem && (reportItem->property(m_propertyName.toLatin1()) != m_oldValue)) { reportItem->setProperty(m_propertyName.toLatin1(), m_oldValue); } - if (m_oldValue == BaseDesignIntf::DesignedItemAlign){ + if (reportItem && (m_oldValue == BaseDesignIntf::DesignedItemAlign)){ reportItem->setPos(m_savedPos); } } diff --git a/limereport/lrreportdesignwidget.cpp b/limereport/lrreportdesignwidget.cpp index 6a6ff0c..4852b97 100644 --- a/limereport/lrreportdesignwidget.cpp +++ b/limereport/lrreportdesignwidget.cpp @@ -74,7 +74,7 @@ ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentTabChanged(int))); //m_instance=this; - m_scriptEditor->setPlainText(report->scriptContext()->initScript()); + m_scriptEditor->setPlainText(m_report->scriptContext()->initScript()); m_zoomer = new GraphicsViewZoomer(activeView()); #ifdef Q_OS_WIN m_defaultFont = QFont("Arial",10); diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 8d2ccb6..f1a40bd 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -481,9 +481,12 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign void ReportRender::renderDataBand(BandDesignIntf *dataBand) { + if (dataBand == NULL ) + return; + IDataSource* bandDatasource = 0; m_lastRenderedFooter = 0; - if (dataBand && !dataBand->datasourceName().isEmpty()) + if (!dataBand->datasourceName().isEmpty()) bandDatasource = datasources()->dataSource(dataBand->datasourceName()); BandDesignIntf* header = dataBand->bandHeader(); @@ -691,7 +694,7 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da // } } - if (!gb->isStarted()){ + if (gb && !gb->isStarted()){ if (band->reprintOnEachPage()) m_reprintableBands.append(band); gb->startGroup(m_datasources); From 942da982ca249b6b9e93f638fc88bda87b22f833 Mon Sep 17 00:00:00 2001 From: Andy Maloney Date: Sat, 8 Apr 2017 09:42:08 -0400 Subject: [PATCH 087/136] Ensure we aren't returning data that has been deleted by setting the pointer to NULL. --- limereport/lrreportrender.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 8d2ccb6..1b31b4f 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -442,6 +442,7 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign BandDesignIntf* upperPart = dynamic_cast(bandClone->cloneUpperPart(m_maxHeightByColumn[m_currentColumn])); registerBand(upperPart); delete bandClone; + bandClone = NULL; } } else { @@ -459,6 +460,7 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign BandDesignIntf* upperPart = dynamic_cast(bandClone->cloneUpperPart(m_maxHeightByColumn[m_currentColumn])); registerBand(upperPart); delete bandClone; + bandClone = NULL; }; } else { bandClone->setHeight(m_maxHeightByColumn[m_currentColumn]); From 64331fbaeb274f377330ef10dbae559558f3a016 Mon Sep 17 00:00:00 2001 From: Andy Maloney Date: Sat, 8 Apr 2017 12:53:05 -0400 Subject: [PATCH 088/136] Corrects spelling of method name --- include/lrdatasourcemanagerintf.h | 2 +- limereport/lrdatasourcemanager.cpp | 2 +- limereport/lrdatasourcemanager.h | 2 +- limereport/lrdatasourcemanagerintf.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/lrdatasourcemanagerintf.h b/include/lrdatasourcemanagerintf.h index 57bd0c1..e3a6ce7 100644 --- a/include/lrdatasourcemanagerintf.h +++ b/include/lrdatasourcemanagerintf.h @@ -54,7 +54,7 @@ public: virtual void removeModel(const QString& name) = 0; virtual bool containsDatasource(const QString& dataSourceName) = 0; virtual void clearUserVariables()=0; - virtual ICallbackDatasource* createCallbackDatasouce(const QString& name) = 0; + virtual ICallbackDatasource* createCallbackDatasource(const QString& name) = 0; virtual void registerDbCredentialsProvider(IDbCredentialsProvider* provider) = 0; //virtual void addCallbackDatasource(ICallbackDatasource* datasource, const QString& name) = 0; }; diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index dc2c32e..d35f670 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -314,7 +314,7 @@ void DataSourceManager::removeModel(const QString &name) removeDatasource(name.toLower()); } -ICallbackDatasource *DataSourceManager::createCallbackDatasouce(const QString& name) +ICallbackDatasource *DataSourceManager::createCallbackDatasource(const QString& name) { ICallbackDatasource* ds = new CallbackDatasource(); IDataSourceHolder* holder = new CallbackDatasourceHolder(dynamic_cast(ds),true); diff --git a/limereport/lrdatasourcemanager.h b/limereport/lrdatasourcemanager.h index 77967c5..b6bdad1 100644 --- a/limereport/lrdatasourcemanager.h +++ b/limereport/lrdatasourcemanager.h @@ -114,7 +114,7 @@ public: void addProxy(const QString& name, QString master, QString detail, QList fields); bool addModel(const QString& name, QAbstractItemModel *model, bool owned); void removeModel(const QString& name); - ICallbackDatasource* createCallbackDatasouce(const QString &name); + ICallbackDatasource* createCallbackDatasource(const QString &name); void registerDbCredentialsProvider(IDbCredentialsProvider *provider); void addCallbackDatasource(ICallbackDatasource *datasource, const QString &name); void setReportVariable(const QString& name, const QVariant& value); diff --git a/limereport/lrdatasourcemanagerintf.h b/limereport/lrdatasourcemanagerintf.h index 57bd0c1..e3a6ce7 100644 --- a/limereport/lrdatasourcemanagerintf.h +++ b/limereport/lrdatasourcemanagerintf.h @@ -54,7 +54,7 @@ public: virtual void removeModel(const QString& name) = 0; virtual bool containsDatasource(const QString& dataSourceName) = 0; virtual void clearUserVariables()=0; - virtual ICallbackDatasource* createCallbackDatasouce(const QString& name) = 0; + virtual ICallbackDatasource* createCallbackDatasource(const QString& name) = 0; virtual void registerDbCredentialsProvider(IDbCredentialsProvider* provider) = 0; //virtual void addCallbackDatasource(ICallbackDatasource* datasource, const QString& name) = 0; }; From 6789b01e7913f56f315f69f6bf6c5204c96f2a9f Mon Sep 17 00:00:00 2001 From: Andy Maloney Date: Sat, 8 Apr 2017 18:41:42 -0400 Subject: [PATCH 089/136] Fixes some shadowed vars & avoids string copies using const refs --- limereport/items/lrhorizontallayout.cpp | 8 ++++---- limereport/items/lrsimpletagparser.cpp | 2 +- limereport/items/lrtextitemeditor.cpp | 4 ++-- limereport/lrdatadesignintf.cpp | 3 +-- limereport/lrpagedesignintf.cpp | 8 ++++---- limereport/lrreportrender.cpp | 10 +++++----- limereport/serializators/lrxmlreader.cpp | 5 ++--- 7 files changed, 19 insertions(+), 21 deletions(-) diff --git a/limereport/items/lrhorizontallayout.cpp b/limereport/items/lrhorizontallayout.cpp index 3269844..9ca4b0a 100644 --- a/limereport/items/lrhorizontallayout.cpp +++ b/limereport/items/lrhorizontallayout.cpp @@ -390,8 +390,8 @@ void HorizontalLayout::slotOnChildDestroy(QObject* child) BaseDesignIntf* HorizontalLayout::findNext(BaseDesignIntf* item){ if (m_children.count() &storage, QString text, int &curPos tagName.remove('>'); while (buff.contains(rx)){ - int pos=rx.indexIn(buff); + pos=rx.indexIn(buff); buff=buff.right(buff.length()-pos); curPos+=pos; if (extractWord(rx.cap(0),1).compare(extractWord(tagName,1),Qt::CaseInsensitive)==0){ diff --git a/limereport/items/lrtextitemeditor.cpp b/limereport/items/lrtextitemeditor.cpp index e2b6778..09a0e3a 100644 --- a/limereport/items/lrtextitemeditor.cpp +++ b/limereport/items/lrtextitemeditor.cpp @@ -124,8 +124,8 @@ void TextItemEditor::initUI() ui->twData->setModel(dm->datasourcesModel()); ui->twScriptEngine->setModel(se.model()); - foreach(QString dsName,dm->dataSourceNames()){ - foreach(QString field, dm->fieldNames(dsName)){ + foreach(const QString &dsName,dm->dataSourceNames()){ + foreach(const QString &field, dm->fieldNames(dsName)){ dataWords<headerData(columnIndex,Qt::Horizontal, Qt::UserRole).isValid()? m_model->headerData(columnIndex,Qt::Horizontal, Qt::UserRole).toString(): m_model->headerData(columnIndex,Qt::Horizontal).toString(); @@ -704,7 +704,6 @@ int CallbackDatasource::columnCount(){ int currIndex = 0; do { QVariant columnName; - CallbackInfo info; info.dataType = CallbackInfo::ColumnHeaderData; info.index = currIndex; emit getCallbackData(info,columnName); diff --git a/limereport/lrpagedesignintf.cpp b/limereport/lrpagedesignintf.cpp index 2178d43..201403e 100644 --- a/limereport/lrpagedesignintf.cpp +++ b/limereport/lrpagedesignintf.cpp @@ -1304,7 +1304,7 @@ void PageDesignIntf::deleteSelected() } void PageDesignIntf::cut() -{ +{ CommandIf::Ptr command = CutCommand::create(this); saveCommand(command); } @@ -1727,8 +1727,8 @@ CommandIf::Ptr DeleteLayoutCommand::create(PageDesignIntf *page, LayoutDesignInt DeleteLayoutCommand* command = new DeleteLayoutCommand(); command->setPage(page); command->setItem(item); - foreach (BaseDesignIntf* item, item->childBaseItems()){ - command->m_childItems.append(item->objectName()); + foreach (BaseDesignIntf* childItem, item->childBaseItems()){ + command->m_childItems.append(childItem->objectName()); } return CommandIf::Ptr(command); } @@ -1845,7 +1845,7 @@ CommandIf::Ptr CutCommand::create(PageDesignIntf *page) foreach(QGraphicsItem * item, page->selectedItems()) { if (!dynamic_cast(item)){ BaseDesignIntf *reportItem = dynamic_cast(item); - + if (reportItem) { command->m_itemNames.push_back(reportItem->objectName()); writer->putItem(reportItem); diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 8d2ccb6..ba678c9 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -254,7 +254,7 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) BandDesignIntf* lastRenderedBand = 0; for (int i=0;idataBandCount() && !m_renderCanceled;i++){ lastRenderedBand = m_patternPageItem->dataBandAt(i); - initDatasource(lastRenderedBand->datasourceName()); + initDatasource(lastRenderedBand->datasourceName()); renderDataBand(lastRenderedBand); if (idataBandCount()-1) closeFooterGroup(lastRenderedBand); } @@ -263,7 +263,7 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) renderBand(reportFooter, 0, StartNewPageAsNeeded); if (lastRenderedBand && lastRenderedBand->keepFooterTogether()) closeFooterGroup(lastRenderedBand); - + BandDesignIntf* tearOffBand = m_patternPageItem->bandByType(BandDesignIntf::TearOffBand); if (tearOffBand) renderBand(tearOffBand, 0, StartNewPageAsNeeded); @@ -335,7 +335,7 @@ void ReportRender::extractGroupsFunction(BandDesignIntf *band) foreach(BaseDesignIntf* item,band->childBaseItems()){ ContentItemDesignIntf* contentItem = dynamic_cast(item); if (contentItem&&(contentItem->content().contains(QRegExp("\\$S\\s*\\{.*\\}")))){ - foreach(QString functionName, m_datasources->groupFunctionNames()){ + 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){ @@ -373,7 +373,7 @@ void ReportRender::replaceGroupsFunction(BandDesignIntf *band) ContentItemDesignIntf* contentItem = dynamic_cast(item); if (contentItem){ QString content = contentItem->content(); - foreach(QString functionName, m_datasources->groupFunctionNames()){ + foreach(const QString &functionName, m_datasources->groupFunctionNames()){ QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName)); if (rx.indexIn(content)>=0){ int pos = 0; @@ -1229,7 +1229,7 @@ void ReportRender::savePage(bool isLast) m_renderedPages.append(PageItemDesignIntf::Ptr(m_renderPageItem)); m_pageCount++; emit pageRendered(m_pageCount); - + if (isLast){ BandDesignIntf* ph = m_renderPageItem->bandByType(BandDesignIntf::PageHeader); if (ph && !ph->property("printOnLastPage").toBool()){ diff --git a/limereport/serializators/lrxmlreader.cpp b/limereport/serializators/lrxmlreader.cpp index bee2ff8..2e791cd 100644 --- a/limereport/serializators/lrxmlreader.cpp +++ b/limereport/serializators/lrxmlreader.cpp @@ -106,7 +106,6 @@ bool XMLReader::readItem(QObject *item) void XMLReader::readItemFromNode(QObject* item,QDomElement *node) { - ObjectLoadingStateIntf* lf = dynamic_cast(item); if(lf) lf->objectLoadStarted(); for (int i=0;ichildNodes().count();i++){ @@ -123,8 +122,8 @@ void XMLReader::readItemFromNode(QObject* item,QDomElement *node) BaseDesignIntf* baseObj = dynamic_cast(item); if(baseObj) { - foreach(QGraphicsItem* item,baseObj->childItems()){ - BaseDesignIntf* baseItem = dynamic_cast(item); + foreach(QGraphicsItem* childItem,baseObj->childItems()){ + BaseDesignIntf* baseItem = dynamic_cast(childItem); if (baseItem) baseItem->parentObjectLoadFinished(); } } From aa5b4c6a66e3072e78d73b52c4571e13b1a2264a Mon Sep 17 00:00:00 2001 From: Andy Maloney Date: Sat, 8 Apr 2017 21:38:23 -0400 Subject: [PATCH 090/136] Add missing initializers --- limereport/items/lralignpropitem.h | 2 +- limereport/lrbasedesignintf.h | 4 ++-- limereport/lrdatasourcemanager.h | 2 +- limereport/lrpreviewreportwidget_p.h | 1 + limereport/objectinspector/lrpropertydelegate.cpp | 2 +- limereport/objectinspector/propertyItems/lrenumpropitem.h | 2 +- limereport/objectinspector/propertyItems/lrfontpropitem.h | 2 +- limereport/objectsbrowser/lrobjectbrowser.cpp | 2 +- 8 files changed, 9 insertions(+), 8 deletions(-) diff --git a/limereport/items/lralignpropitem.h b/limereport/items/lralignpropitem.h index 36a0bd7..61e4b7f 100644 --- a/limereport/items/lralignpropitem.h +++ b/limereport/items/lralignpropitem.h @@ -43,7 +43,7 @@ class AlignmentPropItem : public ObjectPropItem { Q_OBJECT public: - AlignmentPropItem():ObjectPropItem(){} + AlignmentPropItem():ObjectPropItem(),m_horizEditor(NULL),m_vertEditor(NULL){} AlignmentPropItem(QObject *object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value, ObjectPropItem* parent, bool readonly=true); QString displayValue() const; void setPropertyValue(QVariant value); diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index c925579..e722598 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -51,7 +51,7 @@ class BaseDesignIntf; class Marker : public QGraphicsItem{ public: - Marker(QGraphicsItem* parent=0):QGraphicsItem(parent){} + Marker(QGraphicsItem* parent=0):QGraphicsItem(parent),m_object(NULL){} QRectF boundingRect() const; void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *); void setRect(QRectF rect){prepareGeometryChange();m_rect=rect;} @@ -266,7 +266,7 @@ public: QColor borderColor() const; void setBorderColor(const QColor &borderColor); void setItemVisible(const bool& value); - virtual bool canContainChildren(){ return false;} + virtual bool canContainChildren(){ return false;} ReportSettings* reportSettings() const; void setReportSettings(ReportSettings *reportSettings); void setZValueProperty(qreal value); diff --git a/limereport/lrdatasourcemanager.h b/limereport/lrdatasourcemanager.h index 77967c5..b682ab9 100644 --- a/limereport/lrdatasourcemanager.h +++ b/limereport/lrdatasourcemanager.h @@ -71,7 +71,7 @@ class DataSourceModel : public QAbstractItemModel{ Q_OBJECT friend class DataSourceManager; public: - DataSourceModel():m_rootNode(new DataNode()){} + DataSourceModel():m_dataManager(NULL),m_rootNode(new DataNode()){} DataSourceModel(DataSourceManager* dataManager); ~DataSourceModel(); QModelIndex index(int row, int column, const QModelIndex &parent) const; diff --git a/limereport/lrpreviewreportwidget_p.h b/limereport/lrpreviewreportwidget_p.h index 695b605..9557a5d 100644 --- a/limereport/lrpreviewreportwidget_p.h +++ b/limereport/lrpreviewreportwidget_p.h @@ -13,6 +13,7 @@ class PreviewReportWidgetPrivate { public: PreviewReportWidgetPrivate(PreviewReportWidget* previewReportWidget): + m_previewPage(NULL), m_report(NULL), m_zoomer(NULL), m_currentPage(1), m_changingPage(false), m_priorScrolValue(0), m_scalePercent(50), q_ptr(previewReportWidget) {} bool pageIsVisible(); diff --git a/limereport/objectinspector/lrpropertydelegate.cpp b/limereport/objectinspector/lrpropertydelegate.cpp index 4856efc..3abfb32 100644 --- a/limereport/objectinspector/lrpropertydelegate.cpp +++ b/limereport/objectinspector/lrpropertydelegate.cpp @@ -36,7 +36,7 @@ #include "lrglobal.h" LimeReport::PropertyDelegate::PropertyDelegate(QObject *parent) - :QItemDelegate(parent), m_editingItem(0), m_isEditing(false) + :QItemDelegate(parent), m_objectInspector(NULL), m_editingItem(0), m_isEditing(false) {} void LimeReport::PropertyDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const diff --git a/limereport/objectinspector/propertyItems/lrenumpropitem.h b/limereport/objectinspector/propertyItems/lrenumpropitem.h index 7cd23c1..268cc3d 100644 --- a/limereport/objectinspector/propertyItems/lrenumpropitem.h +++ b/limereport/objectinspector/propertyItems/lrenumpropitem.h @@ -37,7 +37,7 @@ class EnumPropItem : public ObjectPropItem { Q_OBJECT public: - EnumPropItem():ObjectPropItem(){} + EnumPropItem():ObjectPropItem(), m_settingValue(false){} 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){} EnumPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly, QVector acceptableValues) diff --git a/limereport/objectinspector/propertyItems/lrfontpropitem.h b/limereport/objectinspector/propertyItems/lrfontpropitem.h index fe0219a..a5a3cfd 100644 --- a/limereport/objectinspector/propertyItems/lrfontpropitem.h +++ b/limereport/objectinspector/propertyItems/lrfontpropitem.h @@ -87,7 +87,7 @@ class FontPropItem : public ObjectPropItem { Q_OBJECT public: - FontPropItem():ObjectPropItem(){} + FontPropItem():ObjectPropItem(), m_pointSize(NULL), m_bold(NULL), m_italic(NULL), m_underline(NULL), m_family(NULL) {} FontPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly); QWidget* createProperyEditor(QWidget *parent) const; QString displayValue() const; diff --git a/limereport/objectsbrowser/lrobjectbrowser.cpp b/limereport/objectsbrowser/lrobjectbrowser.cpp index 07192f7..5eff56d 100644 --- a/limereport/objectsbrowser/lrobjectbrowser.cpp +++ b/limereport/objectsbrowser/lrobjectbrowser.cpp @@ -35,7 +35,7 @@ namespace LimeReport{ ObjectBrowser::ObjectBrowser(QWidget *parent) - :QWidget(parent), m_changingItemSelection(false) + :QWidget(parent), m_report(NULL), m_mainWindow(NULL), m_changingItemSelection(false) { QVBoxLayout *layout = new QVBoxLayout(this); setLayout(layout); From 42e0e3b70b3f6ce80e07947d8622f35e772dc0f7 Mon Sep 17 00:00:00 2001 From: Andy Maloney Date: Sat, 8 Apr 2017 21:44:52 -0400 Subject: [PATCH 091/136] Fix missed uses in the demo --- demo_r1/mainwindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/demo_r1/mainwindow.cpp b/demo_r1/mainwindow.cpp index d695a4e..6deb868 100644 --- a/demo_r1/mainwindow.cpp +++ b/demo_r1/mainwindow.cpp @@ -71,19 +71,19 @@ MainWindow::MainWindow(QWidget *parent) : }; } - LimeReport::ICallbackDatasource * callbackDatasource = report->dataManager()->createCallbackDatasouce("master"); + LimeReport::ICallbackDatasource * callbackDatasource = report->dataManager()->createCallbackDatasource("master"); connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)), this, SLOT(slotGetCallbackData(LimeReport::CallbackInfo,QVariant&))); connect(callbackDatasource, SIGNAL(changePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)), this, SLOT(slotChangePos(const LimeReport::CallbackInfo::ChangePosType&,bool&))); - callbackDatasource = report->dataManager()->createCallbackDatasouce("detail"); + callbackDatasource = report->dataManager()->createCallbackDatasource("detail"); connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)), this, SLOT(slotGetCallbackChildData(LimeReport::CallbackInfo,QVariant&))); connect(callbackDatasource, SIGNAL(changePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)), this, SLOT(slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosType&,bool&))); - callbackDatasource = report->dataManager()->createCallbackDatasouce("oneSlotDS"); + callbackDatasource = report->dataManager()->createCallbackDatasource("oneSlotDS"); connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)), this, SLOT(slotOneSlotDS(LimeReport::CallbackInfo,QVariant&))); From 8ee7fc01e5d7f2ed00661d7b06ec953941b295df Mon Sep 17 00:00:00 2001 From: Andy Maloney Date: Sun, 9 Apr 2017 11:40:56 -0400 Subject: [PATCH 092/136] Fix crash when cutting an item using the context menu page->cut() is deleting the object, which means that "this" is no longer valid, and then we're trying to call `processPopUpAction()` on it. --- limereport/lrbasedesignintf.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index a80fd33..bdba630 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -1180,7 +1180,10 @@ void BaseDesignIntf::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) QAction* a = menu.exec(event->screenPos()); if (a){ if (a == cutAction) + { page->cut(); + return; + } if (a == copyAction) page->copy(); if (a == pasteAction) From cd2e748a9bbe110ac4ceda2a9c924d2791d42d46 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 7 Apr 2017 21:01:51 +0300 Subject: [PATCH 093/136] QtDesigner integration has been added QtDesigner intergration has been added --- common.pri | 2 + .../3rdparty/designer/pluginmanager_p.h | 109 ++++++++++ .../designer/qdesigner_integration_p.h | 126 +++++++++++ .../3rdparty/designer/shared_global_p.h | 72 +++++++ .../designerintegrationv2/README.txt | 10 + .../designerintegration.pri | 11 + .../designerintegrationv2/formresizer.cpp | 198 ++++++++++++++++++ .../designerintegrationv2/formresizer.h | 99 +++++++++ .../designerintegrationv2/sizehandlerect.cpp | 188 +++++++++++++++++ .../designerintegrationv2/sizehandlerect.h | 82 ++++++++ .../designerintegrationv2/widgethost.cpp | 111 ++++++++++ .../designerintegrationv2/widgethost.h | 80 +++++++ .../widgethostconstants.h | 41 ++++ .../3rdparty/qtcreator/namespace_global.h | 48 +++++ limereport/dialogdesigner/dialogdesigner.pri | 17 ++ .../dialogdesigner/lrdialogdesigner.cpp | 171 +++++++++++++++ limereport/dialogdesigner/lrdialogdesigner.h | 48 +++++ limereport/limereport.pri | 34 +-- limereport/lrreportdesignwidget.cpp | 59 +++++- limereport/lrreportdesignwidget.h | 22 +- limereport/lrreportdesignwindow.cpp | 138 +++++++++++- limereport/lrreportdesignwindow.h | 17 +- limereport/lrreportrender.cpp | 2 +- limereport/lrscriptenginemanager.h | 12 +- limereport/scriptbrowser/lrscriptbrowser.cpp | 2 +- 25 files changed, 1662 insertions(+), 37 deletions(-) create mode 100644 limereport/dialogdesigner/3rdparty/designer/pluginmanager_p.h create mode 100644 limereport/dialogdesigner/3rdparty/designer/qdesigner_integration_p.h create mode 100644 limereport/dialogdesigner/3rdparty/designer/shared_global_p.h create mode 100644 limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/README.txt create mode 100644 limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/designerintegration.pri create mode 100644 limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/formresizer.cpp create mode 100644 limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/formresizer.h create mode 100644 limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/sizehandlerect.cpp create mode 100644 limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/sizehandlerect.h create mode 100644 limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/widgethost.cpp create mode 100644 limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/widgethost.h create mode 100644 limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/widgethostconstants.h create mode 100644 limereport/dialogdesigner/3rdparty/qtcreator/namespace_global.h create mode 100644 limereport/dialogdesigner/dialogdesigner.pri create mode 100644 limereport/dialogdesigner/lrdialogdesigner.cpp create mode 100644 limereport/dialogdesigner/lrdialogdesigner.h diff --git a/common.pri b/common.pri index 7d148ef..f9e80f3 100644 --- a/common.pri +++ b/common.pri @@ -1,6 +1,8 @@ CONFIG += build_translations CONFIG += zint CONFIG += qjsengine +CONFIG += dialogdesigner + greaterThan(QT_MAJOR_VERSION, 4) { QT += uitools } diff --git a/limereport/dialogdesigner/3rdparty/designer/pluginmanager_p.h b/limereport/dialogdesigner/3rdparty/designer/pluginmanager_p.h new file mode 100644 index 0000000..1706182 --- /dev/null +++ b/limereport/dialogdesigner/3rdparty/designer/pluginmanager_p.h @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information +** to ensure GNU General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. In addition, as a special +** exception, Nokia gives you certain additional rights. These rights +** are described in the Nokia Qt GPL Exception version 1.3, included in +** the file GPL_EXCEPTION.txt in this package. +** +** Qt for Windows(R) Licensees +** As a special exception, Nokia, as the sole copyright holder for Qt +** Designer, grants users of the Qt/Eclipse Integration plug-in the +** right for the Qt/Eclipse Integration to link to functionality +** provided by Qt Designer and its related libraries. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of Qt Designer. This header +// file may change from version to version without notice, or even be removed. +// +// We mean it. +// + +#ifndef PLUGINMANAGER_H +#define PLUGINMANAGER_H + +#include "shared_global_p.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +class QDesignerFormEditorInterface; +class QDesignerCustomWidgetInterface; +class QDesignerPluginManagerPrivate; + +class QDESIGNER_SHARED_EXPORT QDesignerPluginManager: public QObject +{ + Q_OBJECT +public: + explicit QDesignerPluginManager(QDesignerFormEditorInterface *core); + virtual ~QDesignerPluginManager(); + + QDesignerFormEditorInterface *core() const; + + QObject *instance(const QString &plugin) const; + + QStringList registeredPlugins() const; + + QStringList findPlugins(const QString &path); + + QStringList pluginPaths() const; + void setPluginPaths(const QStringList &plugin_paths); + + QStringList disabledPlugins() const; + void setDisabledPlugins(const QStringList &disabled_plugins); + + QStringList failedPlugins() const; + QString failureReason(const QString &pluginName) const; + + QList instances() const; + QList registeredCustomWidgets() const; + + bool registerNewPlugins(); + +public slots: + bool syncSettings(); + void ensureInitialized(); + +private: + void updateRegisteredPlugins(); + void registerPath(const QString &path); + void registerPlugin(const QString &plugin); + +private: + static QStringList defaultPluginPaths(); + + QDesignerPluginManagerPrivate *m_d; +}; + +QT_END_NAMESPACE + +#endif // PLUGINMANAGER_H diff --git a/limereport/dialogdesigner/3rdparty/designer/qdesigner_integration_p.h b/limereport/dialogdesigner/3rdparty/designer/qdesigner_integration_p.h new file mode 100644 index 0000000..f59c001 --- /dev/null +++ b/limereport/dialogdesigner/3rdparty/designer/qdesigner_integration_p.h @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information +** to ensure GNU General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. In addition, as a special +** exception, Nokia gives you certain additional rights. These rights +** are described in the Nokia Qt GPL Exception version 1.3, included in +** the file GPL_EXCEPTION.txt in this package. +** +** Qt for Windows(R) Licensees +** As a special exception, Nokia, as the sole copyright holder for Qt +** Designer, grants users of the Qt/Eclipse Integration plug-in the +** right for the Qt/Eclipse Integration to link to functionality +** provided by Qt Designer and its related libraries. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of Qt Designer. This header +// file may change from version to version without notice, or even be removed. +// +// We mean it. +// + +#ifndef QDESIGNER_INTEGRATION_H +#define QDESIGNER_INTEGRATION_H + +#include "shared_global_p.h" +#include + +#include + +QT_BEGIN_NAMESPACE + +class QDesignerFormEditorInterface; +class QDesignerFormWindowInterface; +class QDesignerResourceBrowserInterface; + +class QVariant; +class QWidget; + +namespace qdesigner_internal { + +struct Selection; +class QDesignerIntegrationPrivate; + +class QDESIGNER_SHARED_EXPORT QDesignerIntegration: public QDesignerIntegrationInterface +{ + Q_OBJECT +public: + explicit QDesignerIntegration(QDesignerFormEditorInterface *core, QObject *parent = 0); + virtual ~QDesignerIntegration(); + + static void requestHelp(const QDesignerFormEditorInterface *core, const QString &manual, const QString &document); + + virtual QWidget *containerWindow(QWidget *widget) const; + + // Load plugins into widget database and factory. + static void initializePlugins(QDesignerFormEditorInterface *formEditor); + void emitObjectNameChanged(QDesignerFormWindowInterface *formWindow, QObject *object, const QString &newName, const QString &oldName); + + // Create a resource browser specific to integration. Language integration takes precedence + virtual QDesignerResourceBrowserInterface *createResourceBrowser(QWidget *parent = 0); + +signals: + void propertyChanged(QDesignerFormWindowInterface *formWindow, const QString &name, const QVariant &value); + void objectNameChanged(QDesignerFormWindowInterface *formWindow, QObject *object, const QString &newName, const QString &oldName); + void helpRequested(const QString &manual, const QString &document); + +public slots: + virtual void updateProperty(const QString &name, const QVariant &value, bool enableSubPropertyHandling); + // Additional signals of designer property editor + virtual void updatePropertyComment(const QString &name, const QString &value); + virtual void resetProperty(const QString &name); + virtual void addDynamicProperty(const QString &name, const QVariant &value); + virtual void removeDynamicProperty(const QString &name); + + + virtual void updateActiveFormWindow(QDesignerFormWindowInterface *formWindow); + virtual void setupFormWindow(QDesignerFormWindowInterface *formWindow); + virtual void updateSelection(); + virtual void updateGeometry(); + virtual void activateWidget(QWidget *widget); + + void updateCustomWidgetPlugins(); + +private slots: + void updatePropertyPrivate(const QString &name, const QVariant &value); + +private: + void initialize(); + void getSelection(Selection &s); + QObject *propertyEditorObject(); + + QDesignerIntegrationPrivate *m_d; +}; + +} // namespace qdesigner_internal + +QT_END_NAMESPACE + +#endif // QDESIGNER_INTEGRATION_H diff --git a/limereport/dialogdesigner/3rdparty/designer/shared_global_p.h b/limereport/dialogdesigner/3rdparty/designer/shared_global_p.h new file mode 100644 index 0000000..3b9ff24 --- /dev/null +++ b/limereport/dialogdesigner/3rdparty/designer/shared_global_p.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information +** to ensure GNU General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. In addition, as a special +** exception, Nokia gives you certain additional rights. These rights +** are described in the Nokia Qt GPL Exception version 1.3, included in +** the file GPL_EXCEPTION.txt in this package. +** +** Qt for Windows(R) Licensees +** As a special exception, Nokia, as the sole copyright holder for Qt +** Designer, grants users of the Qt/Eclipse Integration plug-in the +** right for the Qt/Eclipse Integration to link to functionality +** provided by Qt Designer and its related libraries. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of Qt Designer. This header +// file may change from version to version without notice, or even be removed. +// +// We mean it. +// + +#ifndef SHARED_GLOBAL_H +#define SHARED_GLOBAL_H + +#include + +#ifdef QT_DESIGNER_STATIC +#define QDESIGNER_SHARED_EXTERN +#define QDESIGNER_SHARED_IMPORT +#else +#define QDESIGNER_SHARED_EXTERN Q_DECL_EXPORT +#define QDESIGNER_SHARED_IMPORT Q_DECL_IMPORT +#endif + +#ifndef QT_NO_SHARED_EXPORT +# ifdef QDESIGNER_SHARED_LIBRARY +# define QDESIGNER_SHARED_EXPORT QDESIGNER_SHARED_EXTERN +# else +# define QDESIGNER_SHARED_EXPORT QDESIGNER_SHARED_IMPORT +# endif +#else +# define QDESIGNER_SHARED_EXPORT +#endif + +#endif // SHARED_GLOBAL_H diff --git a/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/README.txt b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/README.txt new file mode 100644 index 0000000..f5351ea --- /dev/null +++ b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/README.txt @@ -0,0 +1,10 @@ +This is a new Designer integration, started on 28.02.2008. + +The reason for it is the introduction of layout caching +in Qt 4.4, which unearthed a lot of mainwindow-size related +bugs in Designer and all integrations. + +The goal of it is to have a closed layout chain from +integration top level to form window. + +Friedemann diff --git a/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/designerintegration.pri b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/designerintegration.pri new file mode 100644 index 0000000..f3a02f6 --- /dev/null +++ b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/designerintegration.pri @@ -0,0 +1,11 @@ +INCLUDEPATH *= $$PWD $$PWD/.. + +SOURCES += $$PWD/widgethost.cpp \ + $$PWD/sizehandlerect.cpp \ + $$PWD/formresizer.cpp + +HEADERS += $$PWD/widgethost.h \ + $$PWD/sizehandlerect.h \ + $$PWD/formresizer.h \ + $$PWD/widgethostconstants.h \ + $$PWD/../namespace_global.h diff --git a/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/formresizer.cpp b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/formresizer.cpp new file mode 100644 index 0000000..e0d88ed --- /dev/null +++ b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/formresizer.cpp @@ -0,0 +1,198 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** +**************************************************************************/ + +#include "formresizer.h" +#include "sizehandlerect.h" +#include "widgethostconstants.h" + +#include + +#include + +#include +#include +#include +#include +#include + +enum { debugFormResizer = 0 }; + +using namespace SharedTools::Internal; + +FormResizer::FormResizer(QWidget *parent) : + QWidget(parent), + m_frame(new QFrame), + m_formWindow(0) +{ + // Make the resize grip of a mainwindow form find us as resizable window. + setWindowFlags(windowFlags() | Qt::SubWindow); + setBackgroundRole(QPalette::Base); + + QVBoxLayout *handleLayout = new QVBoxLayout(this); + handleLayout->setMargin(SELECTION_MARGIN); + handleLayout->addWidget(m_frame); + + m_frame->setFrameStyle(QFrame::Panel | QFrame::Raised); + QVBoxLayout *layout = new QVBoxLayout(m_frame); + layout->setMargin(0); + // handles + m_handles.reserve(SizeHandleRect::Left); + for (int i = SizeHandleRect::LeftTop; i <= SizeHandleRect::Left; ++i) { + SizeHandleRect *shr = new SizeHandleRect(this, static_cast(i), this); + connect(shr, SIGNAL(mouseButtonReleased(QRect,QRect)), this, SIGNAL(formWindowSizeChanged(QRect,QRect))); + m_handles.push_back(shr); + } + setState(SelectionHandleActive); + updateGeometry(); +} + +void FormResizer::updateGeometry() +{ + const QRect &geom = m_frame->geometry(); + + if (debugFormResizer) + qDebug() << "FormResizer::updateGeometry() " << size() << " frame " << geom; + + const int w = SELECTION_HANDLE_SIZE; + const int h = SELECTION_HANDLE_SIZE; + + const Handles::iterator hend = m_handles.end(); + for (Handles::iterator it = m_handles.begin(); it != hend; ++it) { + SizeHandleRect *hndl = *it;; + switch (hndl->dir()) { + case SizeHandleRect::LeftTop: + hndl->move(geom.x() - w / 2, geom.y() - h / 2); + break; + case SizeHandleRect::Top: + hndl->move(geom.x() + geom.width() / 2 - w / 2, geom.y() - h / 2); + break; + case SizeHandleRect::RightTop: + hndl->move(geom.x() + geom.width() - w / 2, geom.y() - h / 2); + break; + case SizeHandleRect::Right: + hndl->move(geom.x() + geom.width() - w / 2, geom.y() + geom.height() / 2 - h / 2); + break; + case SizeHandleRect::RightBottom: + hndl->move(geom.x() + geom.width() - w / 2, geom.y() + geom.height() - h / 2); + break; + case SizeHandleRect::Bottom: + hndl->move(geom.x() + geom.width() / 2 - w / 2, geom.y() + geom.height() - h / 2); + break; + case SizeHandleRect::LeftBottom: + hndl->move(geom.x() - w / 2, geom.y() + geom.height() - h / 2); + break; + case SizeHandleRect::Left: + hndl->move(geom.x() - w / 2, geom.y() + geom.height() / 2 - h / 2); + break; + default: + break; + } + } +} + +void FormResizer::update() +{ + const Handles::iterator hend = m_handles.end(); + for (Handles::iterator it = m_handles.begin(); it != hend; ++it) { + (*it)->update(); + } +} + +void FormResizer::setState(SelectionHandleState st) +{ + if (debugFormResizer) + qDebug() << "FormResizer::setState " << st; + + const Handles::iterator hend = m_handles.end(); + for (Handles::iterator it = m_handles.begin(); it != hend; ++it) + (*it)->setState(st); +} + +void FormResizer::setFormWindow(QDesignerFormWindowInterface *fw) +{ + if (debugFormResizer) + qDebug() << "FormResizer::setFormWindow " << fw; + QVBoxLayout *layout = qobject_cast(m_frame->layout()); + Q_ASSERT(layout); + if (layout->count()) + delete layout->takeAt(0); + m_formWindow = fw; + + if (m_formWindow) + layout->addWidget(m_formWindow); + mainContainerChanged(); + connect(fw, SIGNAL(mainContainerChanged(QWidget*)), this, SLOT(mainContainerChanged())); +} + +void FormResizer::resizeEvent(QResizeEvent *event) +{ + if (debugFormResizer) + qDebug() << ">FormResizer::resizeEvent" << event->size(); + updateGeometry(); + QWidget::resizeEvent(event); + if (debugFormResizer) + qDebug() << "lineWidth(); + const QMargins frameMargins = m_frame->contentsMargins(); + const int margin = 2* SELECTION_MARGIN; + QSize size = QSize( margin, margin ); + size += QSize( qMax( frameMargins.left(), lineWidth ), qMax( frameMargins.top(), lineWidth ) ); + size += QSize( qMax( frameMargins.right(), lineWidth ), qMax( frameMargins.bottom(), lineWidth ) ); + return size; +} + +QWidget *FormResizer::mainContainer() +{ + if (m_formWindow) + return m_formWindow->mainContainer(); + return 0; +} + +void FormResizer::mainContainerChanged() +{ + const QSize maxWidgetSize = QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); + if (const QWidget *mc = mainContainer()) { + // Set Maximum size which is not handled via a hint (as opposed to minimum size) + const QSize maxWidgetSize = QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); + const QSize formMaxSize = mc->maximumSize(); + QSize newMaxSize = maxWidgetSize; + if (formMaxSize != maxWidgetSize) + newMaxSize = formMaxSize + decorationSize(); + if (debugFormResizer) + qDebug() << "FormResizer::mainContainerChanged" << mc << " Size " << mc->size()<< newMaxSize; + setMaximumSize(newMaxSize); + resize(decorationSize() + mc->size()); + } else { + setMaximumSize(maxWidgetSize); + } +} diff --git a/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/formresizer.h b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/formresizer.h new file mode 100644 index 0000000..c7bd689 --- /dev/null +++ b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/formresizer.h @@ -0,0 +1,99 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** +**************************************************************************/ +#ifndef FORMRESIZER_H +#define FORMRESIZER_H + +#include "namespace_global.h" + +#include "widgethostconstants.h" + +#include +#include + +QT_FORWARD_DECLARE_CLASS(QDesignerFormWindowInterface) +QT_FORWARD_DECLARE_CLASS(QFrame) + +namespace SharedTools { +namespace Internal { + +class SizeHandleRect; + +/* A window to embed a form window interface as follows: + * + * Widget + * | + * +---+----+ + * | | + * | | + * Handles QVBoxLayout [margin: SELECTION_MARGIN] + * | + * Frame [margin: lineWidth] + * | + * QVBoxLayout + * | + * QDesignerFormWindowInterface + * + * Can be embedded into a QScrollArea. */ + +class FormResizer : public QWidget +{ + Q_OBJECT +public: + + FormResizer(QWidget *parent = 0); + + void updateGeometry(); + void setState(SelectionHandleState st); + void update(); + + void setFormWindow(QDesignerFormWindowInterface *fw); + +signals: + void formWindowSizeChanged(const QRect &oldGeo, const QRect &newGeo); + +protected: + virtual void resizeEvent(QResizeEvent *event); + +private slots: + void mainContainerChanged(); + +private: + QSize decorationSize() const; + QWidget *mainContainer(); + + QFrame *m_frame; + typedef QVector Handles; + Handles m_handles; + QDesignerFormWindowInterface * m_formWindow; +}; + +} +} // namespace SharedTools + +#endif // FORMRESIZER_H diff --git a/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/sizehandlerect.cpp b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/sizehandlerect.cpp new file mode 100644 index 0000000..4247769 --- /dev/null +++ b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/sizehandlerect.cpp @@ -0,0 +1,188 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** +**************************************************************************/ +#include "sizehandlerect.h" +#include "widgethostconstants.h" + +#include + +#include +#include +#include +#include + +enum { debugSizeHandle = 0 }; + +using namespace SharedTools::Internal; + +SizeHandleRect::SizeHandleRect(QWidget *parent, Direction d, QWidget *resizable) : + QWidget(parent), + m_dir(d), + m_resizable(resizable), + m_state(SelectionHandleOff) +{ + setBackgroundRole(QPalette::Text); + setAutoFillBackground(true); + + setFixedSize(SELECTION_HANDLE_SIZE, SELECTION_HANDLE_SIZE); + setMouseTracking(false); + updateCursor(); +} + +void SizeHandleRect::updateCursor() +{ + switch (m_dir) { + case Right: + case RightTop: + setCursor(Qt::SizeHorCursor); + return; + case RightBottom: + setCursor(Qt::SizeFDiagCursor); + return; + case LeftBottom: + case Bottom: + setCursor(Qt::SizeVerCursor); + return; + default: + break; + } + + setCursor(Qt::ArrowCursor); +} + +void SizeHandleRect::paintEvent(QPaintEvent *) +{ + switch (m_state) { + case SelectionHandleOff: + break; + case SelectionHandleInactive: { + QPainter p(this); + p.setPen(Qt::red); + p.drawRect(0, 0, width() - 1, height() - 1); + } + break; + case SelectionHandleActive: { + QPainter p(this); + p.setPen(Qt::blue); + p.drawRect(0, 0, width() - 1, height() - 1); + } + break; + } +} + +void SizeHandleRect::mousePressEvent(QMouseEvent *e) +{ + e->accept(); + + if (e->button() != Qt::LeftButton) + return; + + m_startSize = m_curSize = m_resizable->size(); + m_startPos = m_curPos = m_resizable->mapFromGlobal(e->globalPos()); + if (debugSizeHandle) + qDebug() << "SizeHandleRect::mousePressEvent" << m_startSize << m_startPos << m_curPos; + +} + +void SizeHandleRect::mouseMoveEvent(QMouseEvent *e) +{ + if (!(e->buttons() & Qt::LeftButton)) + return; + + // Try resize with delta against start position. + // We don't take little deltas in consecutive move events as this + // causes the handle and the mouse cursor to become out of sync + // once a min/maxSize limit is hit. When the cursor reenters the valid + // areas, it will now snap to it. + m_curPos = m_resizable->mapFromGlobal(e->globalPos()); + QSize delta = QSize(m_curPos.x() - m_startPos.x(), m_curPos.y() - m_startPos.y()); + switch (m_dir) { + case Right: + case RightTop: // Only width + delta.setHeight(0); + break; + case RightBottom: // All dimensions + break; + case LeftBottom: + case Bottom: // Only height + delta.setWidth(0); + break; + default: + delta = QSize(0, 0); + break; + } + if (delta != QSize(0, 0)) + tryResize(delta); +} + +void SizeHandleRect::mouseReleaseEvent(QMouseEvent *e) +{ + if (e->button() != Qt::LeftButton) + return; + + e->accept(); + if (m_startSize != m_curSize) { + const QRect startRect = QRect(0, 0, m_startPos.x(), m_startPos.y()); + const QRect newRect = QRect(0, 0, m_curPos.x(), m_curPos.y()); + if (debugSizeHandle) + qDebug() << "SizeHandleRect::mouseReleaseEvent" << startRect << newRect; + emit mouseButtonReleased(startRect, newRect); + } +} + +void SizeHandleRect::tryResize(const QSize &delta) +{ + // Try resize with delta against start position + QSize newSize = m_startSize + delta; + newSize = newSize.expandedTo(m_resizable->minimumSizeHint()); + newSize = newSize.expandedTo(m_resizable->minimumSize()); + newSize = newSize.boundedTo(m_resizable->maximumSize()); + if (newSize == m_resizable->size()) + return; + if (debugSizeHandle) + qDebug() << "SizeHandleRect::tryResize by (" << m_startSize << '+' << delta << ')' << newSize; + m_resizable->resize(newSize); + m_curSize = m_resizable->size(); +} + +void SizeHandleRect::setState(SelectionHandleState st) +{ + if (st == m_state) + return; + switch (st) { + case SelectionHandleOff: + hide(); + break; + case SelectionHandleInactive: + case SelectionHandleActive: + show(); + raise(); + break; + } + m_state = st; +} diff --git a/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/sizehandlerect.h b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/sizehandlerect.h new file mode 100644 index 0000000..c916b00 --- /dev/null +++ b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/sizehandlerect.h @@ -0,0 +1,82 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** +**************************************************************************/ +#ifndef SIZEHANDLERECT_H +#define SIZEHANDLERECT_H + +#include "namespace_global.h" + +#include "widgethostconstants.h" + +#include +#include + +namespace SharedTools { +namespace Internal { + +class SizeHandleRect : public QWidget +{ + Q_OBJECT +public: + enum Direction { LeftTop, Top, RightTop, Right, RightBottom, Bottom, LeftBottom, Left }; + + SizeHandleRect(QWidget *parent, Direction d, QWidget *resizable); + + Direction dir() const { return m_dir; } + void updateCursor(); + void setState(SelectionHandleState st); + +signals: + + void mouseButtonReleased(const QRect &, const QRect &); + +protected: + void paintEvent(QPaintEvent *e); + void mousePressEvent(QMouseEvent *e); + void mouseMoveEvent(QMouseEvent *e); + void mouseReleaseEvent(QMouseEvent *e); + +private: + void tryResize(const QSize &delta); + +private: + const Direction m_dir; + QPoint m_startPos; + QPoint m_curPos; + QSize m_startSize; + QSize m_curSize; + QWidget *m_resizable; + SelectionHandleState m_state; +}; + +} +} // namespace SharedTools + + +#endif // SIZEHANDLERECT_H + diff --git a/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/widgethost.cpp b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/widgethost.cpp new file mode 100644 index 0000000..b78eb4b --- /dev/null +++ b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/widgethost.cpp @@ -0,0 +1,111 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** +**************************************************************************/ + +#include "widgethost.h" +#include "formresizer.h" +#include "widgethostconstants.h" + +#include +#include + +#include +#include +#include +#include +#include + +using namespace SharedTools; + +// ---------- WidgetHost +WidgetHost::WidgetHost(QWidget *parent, QDesignerFormWindowInterface *formWindow) : + QScrollArea(parent), + m_formWindow(0), + m_formResizer(new Internal::FormResizer) +{ + setWidget(m_formResizer); + // Re-set flag (gets cleared by QScrollArea): Make the resize grip of a mainwindow form find the resizer as resizable window. + m_formResizer->setWindowFlags(m_formResizer->windowFlags() | Qt::SubWindow); + setFormWindow(formWindow); +} + +WidgetHost::~WidgetHost() +{ + if (m_formWindow) + delete m_formWindow; +} + +void WidgetHost::setFormWindow(QDesignerFormWindowInterface *fw) +{ + m_formWindow = fw; + if (!fw) + return; + + m_formResizer->setFormWindow(fw); + + setBackgroundRole(QPalette::Base); + m_formWindow->setAutoFillBackground(true); + m_formWindow->setBackgroundRole(QPalette::Background); + + connect(m_formResizer, SIGNAL(formWindowSizeChanged(QRect, QRect)), + this, SLOT(fwSizeWasChanged(QRect, QRect))); + connect(m_formWindow, SIGNAL(destroyed(QObject*)), this, SLOT(formWindowDeleted(QObject*))); +} + +QSize WidgetHost::formWindowSize() const +{ + if (!m_formWindow || !m_formWindow->mainContainer()) + return QSize(); + return m_formWindow->mainContainer()->size(); +} + +void WidgetHost::fwSizeWasChanged(const QRect &, const QRect &) +{ + // newGeo is the mouse coordinates, thus moving the Right will actually emit wrong height + emit formWindowSizeChanged(formWindowSize().width(), formWindowSize().height()); +} + +void WidgetHost::formWindowDeleted(QObject *object) +{ + if (object == m_formWindow) m_formWindow = 0; +} + +void WidgetHost::updateFormWindowSelectionHandles(bool active) +{ + Internal::SelectionHandleState state = Internal::SelectionHandleOff; + const QDesignerFormWindowCursorInterface *cursor = m_formWindow->cursor(); + if (cursor->isWidgetSelected(m_formWindow->mainContainer())) + state = active ? Internal::SelectionHandleActive : Internal::SelectionHandleInactive; + + m_formResizer->setState(state); +} + +QWidget *WidgetHost::integrationContainer() const +{ + return m_formResizer; +} diff --git a/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/widgethost.h b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/widgethost.h new file mode 100644 index 0000000..82b9fef --- /dev/null +++ b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/widgethost.h @@ -0,0 +1,80 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** +**************************************************************************/ + +#ifndef WIDGETHOST_H +#define WIDGETHOST_H + +#include "namespace_global.h" + +#include + +QT_FORWARD_DECLARE_CLASS(QDesignerFormWindowInterface) + +namespace SharedTools { + +namespace Internal { + class FormResizer; +} + +/* A scroll area that embeds a Designer form window */ + +class WidgetHost : public QScrollArea +{ + Q_OBJECT +public: + WidgetHost(QWidget *parent = 0, QDesignerFormWindowInterface *formWindow = 0); + virtual ~WidgetHost(); + // Show handles if active and main container is selected. + void updateFormWindowSelectionHandles(bool active); + + inline QDesignerFormWindowInterface *formWindow() const { return m_formWindow; } + + QWidget *integrationContainer() const; + +protected: + void setFormWindow(QDesignerFormWindowInterface *fw); + +signals: + void formWindowSizeChanged(int, int); + +private slots: + void fwSizeWasChanged(const QRect &, const QRect &); + void formWindowDeleted(QObject* object); + +private: + QSize formWindowSize() const; + + QDesignerFormWindowInterface *m_formWindow; + Internal::FormResizer *m_formResizer; + QSize m_oldFakeWidgetSize; +}; + +} // namespace SharedTools + +#endif // WIDGETHOST_H diff --git a/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/widgethostconstants.h b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/widgethostconstants.h new file mode 100644 index 0000000..b1f7fff --- /dev/null +++ b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/widgethostconstants.h @@ -0,0 +1,41 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** +**************************************************************************/ + +#ifndef WIDGETHOST_CONSTANTS_H +#define WIDGETHOST_CONSTANTS_H + +namespace SharedTools { + namespace Internal { + enum { SELECTION_HANDLE_SIZE = 6, SELECTION_MARGIN = 10 }; + enum SelectionHandleState { SelectionHandleOff, SelectionHandleInactive, SelectionHandleActive }; + } +} + +#endif // WIDGETHOST_CONSTANTS_H + diff --git a/limereport/dialogdesigner/3rdparty/qtcreator/namespace_global.h b/limereport/dialogdesigner/3rdparty/qtcreator/namespace_global.h new file mode 100644 index 0000000..7b6ba3f --- /dev/null +++ b/limereport/dialogdesigner/3rdparty/qtcreator/namespace_global.h @@ -0,0 +1,48 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** +**************************************************************************/ + +#ifndef NAMESPACE_GLOBAL_H +#define NAMESPACE_GLOBAL_H + +#include + +#if QT_VERSION < 0x040400 +# define QT_ADD_NAMESPACE(name) ::name +# define QT_USE_NAMESPACE +# define QT_BEGIN_NAMESPACE +# define QT_END_NAMESPACE +# define QT_BEGIN_INCLUDE_NAMESPACE +# define QT_END_INCLUDE_NAMESPACE +# define QT_BEGIN_MOC_NAMESPACE +# define QT_END_MOC_NAMESPACE +# define QT_FORWARD_DECLARE_CLASS(name) class name; +# define QT_MANGLE_NAMESPACE(name) name +#endif + +#endif // NAMESPACE_GLOBAL_H diff --git a/limereport/dialogdesigner/dialogdesigner.pri b/limereport/dialogdesigner/dialogdesigner.pri new file mode 100644 index 0000000..37a1ea1 --- /dev/null +++ b/limereport/dialogdesigner/dialogdesigner.pri @@ -0,0 +1,17 @@ +include(../../common.pri) +include($$PWD/3rdparty/qtcreator/designerintegrationv2/designerintegration.pri) +INCLUDEPATH *= $$PWD/3rdparty/designer +greaterThan(QT_MAJOR_VERSION, 4) { + contains(QT,uitools){ + DEFINES += HAVE_QTDESIGNER_INTEGRATION + } +} +lessThan(QT_MAJOR_VERSION, 5){ + contains(CONFIG,uitools){ + DEFINES += HAVE_QTDESIGNER_INTEGRATION + } +} +QT += designer designercomponents-private + +SOURCES += $$PWD/lrdialogdesigner.cpp +HEADERS += $$PWD/lrdialogdesigner.h diff --git a/limereport/dialogdesigner/lrdialogdesigner.cpp b/limereport/dialogdesigner/lrdialogdesigner.cpp new file mode 100644 index 0000000..cc5d258 --- /dev/null +++ b/limereport/dialogdesigner/lrdialogdesigner.cpp @@ -0,0 +1,171 @@ +#include "lrdialogdesigner.h" + +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include "pluginmanager_p.h" +//#include + +#include "widgethost.h" + +namespace LimeReport{ + +DialogDesigner::DialogDesigner(QObject *parent) : QObject(parent) +{ + QDesignerComponents::initializeResources(); + m_formEditor = QDesignerComponents::createFormEditor(this); + QDesignerComponents::initializePlugins(m_formEditor); + QDesignerComponents::createTaskMenu(m_formEditor, this); + + foreach ( QObject* o, QPluginLoader::staticInstances() << m_formEditor->pluginManager()->instances() ) + { + if ( QDesignerFormEditorPluginInterface* fep = qobject_cast( o ) ) + { + // initialize plugin if needed + if ( !fep->isInitialized() ) + fep->initialize( m_formEditor ); + + // set action chackable +// fep->action()->setCheckable( true ); + +// // add action mode to group +// aModes->addAction( fep->action() ); + } + } + + + m_widgetBox = QDesignerComponents::createWidgetBox(m_formEditor, 0); + m_widgetBox->setWindowTitle(tr("Widget Box")); + m_widgetBox->setObjectName(QLatin1String("WidgetBox")); + m_formEditor->setWidgetBox(m_widgetBox); + m_formEditor->setTopLevel(m_widgetBox); + m_designerToolWindows.append(m_widgetBox); + connect(m_widgetBox, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) ); + + m_objectInspector = QDesignerComponents::createObjectInspector(m_formEditor, 0); + m_objectInspector->setWindowTitle(tr("Object Inspector")); + m_objectInspector->setObjectName(QLatin1String("ObjectInspector")); + m_formEditor->setObjectInspector(m_objectInspector); + m_designerToolWindows.append(m_objectInspector); + connect(m_objectInspector, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) ); + + m_propertyEditor = QDesignerComponents::createPropertyEditor(m_formEditor, 0); + m_propertyEditor->setWindowTitle(tr("Property Editor")); + m_propertyEditor->setObjectName(QLatin1String("PropertyEditor")); + m_formEditor->setPropertyEditor(m_propertyEditor); + m_designerToolWindows.append(m_propertyEditor); + connect(m_propertyEditor, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) ); + + m_signalSlotEditor = QDesignerComponents::createSignalSlotEditor(m_formEditor, 0); + m_signalSlotEditor->setWindowTitle(tr("Signals && Slots Editor")); + m_signalSlotEditor->setObjectName(QLatin1String("SignalsAndSlotsEditor")); + + m_designerToolWindows.append(m_signalSlotEditor); + connect(m_signalSlotEditor, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) ); + + m_resourcesEditor = QDesignerComponents::createResourceEditor(m_formEditor, 0); + m_resourcesEditor->setWindowTitle(tr("Resource Editor")); + m_resourcesEditor->setObjectName(QLatin1String("ResourceEditor")); + m_designerToolWindows.append(m_resourcesEditor); + connect(m_resourcesEditor, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) ); + + m_actionEditor = QDesignerComponents::createActionEditor(m_formEditor, 0); + m_actionEditor->setWindowTitle(tr("Action Editor")); + m_actionEditor->setObjectName("ActionEditor"); + m_formEditor->setActionEditor(m_actionEditor); + m_designerToolWindows.append(m_actionEditor); + connect(m_formEditor, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) ); + + m_designerIntegration = new QDesignerIntegration(m_formEditor,this); + m_formEditor->setIntegration(m_designerIntegration); + +} + +DialogDesigner::~DialogDesigner() +{ + for (int i = 0; iformWindowManager()->createFormWindow(0, Qt::Window); + wnd->setContents(content); + m_formEditor->formWindowManager()->setActiveFormWindow(wnd); + m_formEditor->objectInspector()->setFormWindow(wnd); + wnd->editWidgets(); + + SharedTools::WidgetHost *placeholder = new SharedTools::WidgetHost(0,wnd); + placeholder->setFrameStyle( QFrame::NoFrame | QFrame::Plain ); + placeholder->setFocusProxy( wnd ); + + return placeholder; + +} + +void DialogDesigner::setActiveEditor(QWidget *widget) +{ + SharedTools::WidgetHost* wh = dynamic_cast(widget); + if (wh){ + m_formEditor->formWindowManager()->setActiveFormWindow(wh->formWindow()); + } + +} + +QWidget* DialogDesigner::widgetBox() const +{ + return m_widgetBox; +} + +QWidget* DialogDesigner::actionEditor() const +{ + return m_actionEditor; +} + +QWidget* DialogDesigner::propertyEditor() const +{ + return m_propertyEditor; +} + +QWidget* DialogDesigner::objectInspector() const +{ + return m_objectInspector; +} + +QWidget *DialogDesigner::signalSlotEditor() const +{ + return m_signalSlotEditor; +} + +QWidget *DialogDesigner::resourcesEditor() const +{ + return m_resourcesEditor; +} + +void DialogDesigner::objectDestroyed(QObject *object) +{ + for ( int i = 0; i +#include + +class QDesignerFormEditorInterface; +class QDesignerFormWindowInterface; +class QDesignerIntegrationInterface; +class QDesignerWidgetBoxInterface; +class QDesignerActionEditorInterface; +class QDesignerPropertyEditorInterface; +class QDesignerObjectInspectorInterface; +class QDesignerFormWindowManagerInterface; + +namespace LimeReport{ + +class DialogDesigner : public QObject +{ + Q_OBJECT +public: + explicit DialogDesigner(QObject *parent = 0); + ~DialogDesigner(); + QWidget* createFormEditor(const QString& content); + void setActiveEditor(QWidget* widget); + QWidget* widgetBox() const; + QWidget* actionEditor() const; + QWidget* propertyEditor() const; + QWidget* objectInspector() const; + QWidget* signalSlotEditor() const; + QWidget* resourcesEditor() const; +private slots: + void objectDestroyed(QObject* object); +private: + QDesignerFormEditorInterface* m_formEditor; + QDesignerIntegrationInterface* m_designerIntegration; + QDesignerWidgetBoxInterface* m_widgetBox; + QDesignerActionEditorInterface* m_actionEditor; + QDesignerPropertyEditorInterface* m_propertyEditor; + QDesignerObjectInspectorInterface* m_objectInspector; + QWidget* m_signalSlotEditor; + QWidget* m_resourcesEditor; + QVector m_designerToolWindows; +}; + +} // namespace LimeReport + +#endif // DIALOGDESIGNER_H diff --git a/limereport/limereport.pri b/limereport/limereport.pri index 7f621e9..41b3e3f 100644 --- a/limereport/limereport.pri +++ b/limereport/limereport.pri @@ -1,5 +1,9 @@ include(../common.pri) +contains(CONFIG,dialogdesigner){ + include($$REPORT_PATH/dialogdesigner/dialogdesigner.pri) +} + DEFINES += INSPECT_BASEDESIGN INCLUDEPATH += \ @@ -19,6 +23,15 @@ SOURCES += \ $$REPORT_PATH/bands/lrgroupbands.cpp \ $$REPORT_PATH/bands/lrsubdetailband.cpp \ $$REPORT_PATH/bands/lrtearoffband.cpp \ + $$REPORT_PATH/databrowser/lrdatabrowser.cpp \ + $$REPORT_PATH/databrowser/lrsqleditdialog.cpp \ + $$REPORT_PATH/databrowser/lrconnectiondialog.cpp \ + $$REPORT_PATH/databrowser/lrvariabledialog.cpp \ + $$REPORT_PATH/databrowser/lrdatabrowsertree.cpp \ + $$REPORT_PATH/serializators/lrxmlqrectserializator.cpp \ + $$REPORT_PATH/serializators/lrxmlbasetypesserializators.cpp \ + $$REPORT_PATH/serializators/lrxmlreader.cpp \ + $$REPORT_PATH/serializators/lrxmlwriter.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrstringpropitem.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrrectproptem.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrintpropitem.cpp \ @@ -44,16 +57,8 @@ SOURCES += \ $$REPORT_PATH/objectinspector/lrobjectitemmodel.cpp \ $$REPORT_PATH/objectinspector/lrobjectpropitem.cpp \ $$REPORT_PATH/objectinspector/lrpropertydelegate.cpp \ - $$REPORT_PATH/objectsbrowser/lrobjectbrowser.cpp \ - $$REPORT_PATH/databrowser/lrdatabrowser.cpp \ - $$REPORT_PATH/databrowser/lrsqleditdialog.cpp \ - $$REPORT_PATH/databrowser/lrconnectiondialog.cpp \ - $$REPORT_PATH/databrowser/lrvariabledialog.cpp \ - $$REPORT_PATH/databrowser/lrdatabrowsertree.cpp \ - $$REPORT_PATH/serializators/lrxmlqrectserializator.cpp \ - $$REPORT_PATH/serializators/lrxmlbasetypesserializators.cpp \ - $$REPORT_PATH/serializators/lrxmlreader.cpp \ - $$REPORT_PATH/serializators/lrxmlwriter.cpp \ + $$REPORT_PATH/objectsbrowser/lrobjectbrowser.cpp \ + $$REPORT_PATH/scriptbrowser/lrscriptbrowser.cpp \ $$REPORT_PATH/items/lrsubitemparentpropitem.cpp \ $$REPORT_PATH/items/lralignpropitem.cpp \ $$REPORT_PATH/items/lrhorizontallayout.cpp \ @@ -88,8 +93,8 @@ SOURCES += \ $$REPORT_PATH/lrgroupfunctions.cpp \ $$REPORT_PATH/lrsimplecrypt.cpp \ $$REPORT_PATH/lraboutdialog.cpp \ - $$REPORT_PATH/lrsettingdialog.cpp \ - $$REPORT_PATH/scriptbrowser/lrscriptbrowser.cpp + $$REPORT_PATH/lrsettingdialog.cpp + contains(CONFIG, zint){ SOURCES += $$REPORT_PATH/items/lrbarcodeitem.cpp @@ -145,6 +150,7 @@ HEADERS += \ $$REPORT_PATH/objectinspector/lrobjectpropitem.h \ $$REPORT_PATH/objectinspector/lrpropertydelegate.h \ $$REPORT_PATH/objectsbrowser/lrobjectbrowser.h \ + $$REPORT_PATH/scriptbrowser/lrscriptbrowser.h \ $$REPORT_PATH/items/editors/lritemeditorwidget.h \ $$REPORT_PATH/items/editors/lrfonteditorwidget.h \ $$REPORT_PATH/items/editors/lrtextalignmenteditorwidget.h \ @@ -187,8 +193,8 @@ HEADERS += \ $$REPORT_PATH/lraboutdialog.h \ $$REPORT_PATH/lrcallbackdatasourceintf.h \ $$REPORT_PATH/lrsettingdialog.h \ - $$REPORT_PATH/lrpreviewreportwidget_p.h \ - $$REPORT_PATH/scriptbrowser/lrscriptbrowser.h + $$REPORT_PATH/lrpreviewreportwidget_p.h + contains(CONFIG,zint){ HEADERS += $$REPORT_PATH/items/lrbarcodeitem.h diff --git a/limereport/lrreportdesignwidget.cpp b/limereport/lrreportdesignwidget.cpp index 6a6ff0c..6acb22a 100644 --- a/limereport/lrreportdesignwidget.cpp +++ b/limereport/lrreportdesignwidget.cpp @@ -33,6 +33,7 @@ #include "lrreportengine_p.h" #include "lrbasedesignintf.h" #include "lrsettingdialog.h" +#include "dialogdesigner/lrdialogdesigner.h" #include #include @@ -46,10 +47,8 @@ namespace LimeReport { -// ReportDesignIntf - ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow *mainWindow, QWidget *parent) : - QWidget(parent), m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false) + QWidget(parent), m_dialogDesigner(new DialogDesigner(this)), m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false) { m_tabWidget = new QTabWidget(this); m_tabWidget->setTabPosition(QTabWidget::South); @@ -73,7 +72,6 @@ ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow connect(m_report,SIGNAL(cleared()),this,SIGNAL(cleared())); connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentTabChanged(int))); - //m_instance=this; m_scriptEditor->setPlainText(report->scriptContext()->initScript()); m_zoomer = new GraphicsViewZoomer(activeView()); #ifdef Q_OS_WIN @@ -81,6 +79,39 @@ ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow #endif } +DialogDesigner *ReportDesignWidget::dialogDesigner() const +{ + return m_dialogDesigner; +} + +QWidget *ReportDesignWidget::toolWindow(ReportDesignWidget::ToolWindowType windowType) +{ + switch (windowType) { + case WidgetBox: + return dialogDesigner()->widgetBox(); + case PropertyEditor: + return dialogDesigner()->propertyEditor(); + case ObjectInspector: + return dialogDesigner()->objectInspector(); + case ActionEditor: + return dialogDesigner()->actionEditor(); + case ResourceEditor: + return dialogDesigner()->resourcesEditor(); + case SignalSlotEditor: + return dialogDesigner()->signalSlotEditor(); + default: + return 0; + } +} + +ReportDesignWidget::EditorTabType ReportDesignWidget::activeTabType() +{ + QString tabType = m_tabWidget->tabWhatsThis(m_tabWidget->currentIndex()); + if ( tabType.compare("dialog") == 0) return Dialog; + if ( tabType.compare("script") == 0) return Script; + return Page; +} + bool ReportDesignWidget::useMagnet() const { return m_useMagnet; @@ -139,6 +170,7 @@ void ReportDesignWidget::loadState(QSettings* settings) void ReportDesignWidget::createTabs(){ + int pageIndex = -1; for (int i = 0; ipageCount();++i){ QGraphicsView* view = new QGraphicsView(qobject_cast(this)); view->setBackgroundBrush(QBrush(Qt::gray)); @@ -152,11 +184,22 @@ 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)); + pageIndex = m_tabWidget->addTab(view,QIcon(),m_report->pageAt(i)->pageItem()->objectName()); + m_tabWidget->setTabWhatsThis(pageIndex, "page"); } +#ifdef HAVE_QTDESIGNER_INTEGRATION + QWidget* dialogEditor; + foreach(DialogDescriber::Ptr dialogDesc, m_report->scriptContext()->dialogDescribers()){ + dialogEditor = m_dialogDesigner->createFormEditor(dialogDesc->description()); + pageIndex = m_tabWidget->addTab(dialogEditor,QIcon(),dialogDesc->name()); + m_tabWidget->setTabWhatsThis(pageIndex,"dialog"); + } +#endif m_scriptEditor = new QTextEdit(this); - m_tabWidget->addTab(m_scriptEditor,QIcon(),tr("Script")); + pageIndex = m_tabWidget->addTab(m_scriptEditor,QIcon(),tr("Script")); + m_tabWidget->setTabWhatsThis(pageIndex,"script"); m_tabWidget->setCurrentIndex(0); + } ReportDesignWidget::~ReportDesignWidget() @@ -189,7 +232,6 @@ void ReportDesignWidget::connectPage(PageDesignIntf *page) connect(page, SIGNAL(pageUpdateFinished(LimeReport::PageDesignIntf*)), this, SIGNAL(activePageUpdated(LimeReport::PageDesignIntf*))); - //activeView()->centerOn(0,0); emit activePageChanged(); } @@ -605,6 +647,9 @@ void ReportDesignWidget::slotCurrentTabChanged(int index) } m_zoomer->setView(view); } + if (activeTabType() == Dialog){ + m_dialogDesigner->setActiveEditor(m_tabWidget->widget(index)); + } emit activePageChanged(); } diff --git a/limereport/lrreportdesignwidget.h b/limereport/lrreportdesignwidget.h index 28a1998..d624617 100644 --- a/limereport/lrreportdesignwidget.h +++ b/limereport/lrreportdesignwidget.h @@ -48,6 +48,7 @@ namespace LimeReport { class ReportEnginePrivate; class DataBrowser; class ReportDesignWindow; +class DialogDesigner; class ReportDesignWidget : public QWidget { @@ -55,8 +56,20 @@ class ReportDesignWidget : public QWidget Q_PROPERTY(QObject* datasourcesManager READ dataManager()) friend class ReportDesignWindow; public: + enum ToolWindowType{ + WidgetBox = 1, + ObjectInspector = 2, + ActionEditor = 3, + SignalSlotEditor = 4, + PropertyEditor = 5, + ResourceEditor = 6 + }; + enum EditorTabType{ + Page, + Dialog, + Script + }; ~ReportDesignWidget(); -// static ReportDesignWidget* instance(){return m_instance;} void createStartPage(); void clear(); DataSourceManager* dataManager(); @@ -76,7 +89,6 @@ public: QList selectedItems(); QStringList datasourcesNames(); void scale( qreal sx, qreal sy); -// void setDatabrowser(DataBrowser* databrowser); ReportEnginePrivate* report(){return m_report;} QString reportFileName(); bool isNeedToSave(); @@ -88,7 +100,9 @@ public: bool useGrid(){ return m_useGrid;} bool useMagnet() const; void setUseMagnet(bool useMagnet); - + DialogDesigner *dialogDesigner() const; + QWidget* toolWindow(ToolWindowType windowType); + EditorTabType activeTabType(); public slots: void saveToFile(const QString&); bool save(); @@ -155,6 +169,7 @@ private: ReportEnginePrivate* m_report; QGraphicsView *m_view; QTextEdit* m_scriptEditor; + DialogDesigner* m_dialogDesigner; QMainWindow *m_mainWindow; QTabWidget* m_tabWidget; GraphicsViewZoomer* m_zoomer; @@ -163,7 +178,6 @@ private: int m_horizontalGridStep; bool m_useGrid; bool m_useMagnet; -// static ReportDesignWidget* m_instance; }; } diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index 358aa6b..8bdb62d 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -73,6 +73,14 @@ ReportDesignWindow::ReportDesignWindow(ReportEnginePrivate *report, QWidget *par createDataWindow(); createScriptWindow(); createObjectsBrowser(); +#ifdef HAVE_QTDESIGNER_INTEGRATION + createDialogWidgetBox(); + createDialogPropertyEditor(); + createDialogObjectInspector(); + createDialogActionEditor(); + createDialogResourceEditor(); + createDialogSignalSlotEditor(); +#endif m_instance=this; m_statusBar=new QStatusBar(this); m_lblReportName = new QLabel(report->reportFileName(),this); @@ -82,6 +90,8 @@ ReportDesignWindow::ReportDesignWindow(ReportEnginePrivate *report, QWidget *par restoreSetting(); m_hideLeftPanel->setChecked(isDockAreaVisible(Qt::LeftDockWidgetArea)); m_hideRightPanel->setChecked(isDockAreaVisible(Qt::RightDockWidgetArea)); + m_editorTabType = ReportDesignWidget::Page; + showDefaultEditors(); } ReportDesignWindow::~ReportDesignWindow() @@ -475,7 +485,6 @@ void ReportDesignWindow::createObjectInspector() m_objectInspector->setModel(m_propertyModel); m_objectInspector->setAlternatingRowColors(true); m_objectInspector->setRootIsDecorated(!m_propertyModel->subclassesAsLevel()); - QDockWidget *objectDoc = new QDockWidget(this); QWidget* w = new QWidget(objectDoc); QVBoxLayout* l = new QVBoxLayout(w); @@ -485,6 +494,7 @@ void ReportDesignWindow::createObjectInspector() objectDoc->setWindowTitle(tr("Object Inspector")); objectDoc->setWidget(w); objectDoc->setObjectName("objectInspector"); + m_pageEditors.append(objectDoc); addDockWidget(Qt::LeftDockWidgetArea,objectDoc); } @@ -497,9 +507,73 @@ void ReportDesignWindow::createObjectsBrowser() doc->setObjectName("structureDoc"); addDockWidget(Qt::RightDockWidgetArea,doc); m_objectsBrowser->setMainWindow(this); + m_pageEditors.append(doc); m_objectsBrowser->setReportEditor(m_reportDesignWidget); } +#ifdef HAVE_QTDESIGNER_INTEGRATION + +void ReportDesignWindow::createDialogWidgetBox() +{ + QDockWidget *doc = new QDockWidget(this); + doc->setWindowTitle(tr("Widget Box")); + doc->setWidget(m_reportDesignWidget->toolWindow(ReportDesignWidget::WidgetBox)); + doc->setObjectName("WidgetBox"); + addDockWidget(Qt::LeftDockWidgetArea,doc); + m_dialogEditors.append(doc); +} + +void ReportDesignWindow::createDialogPropertyEditor() +{ + QDockWidget *doc = new QDockWidget(this); + doc->setWindowTitle(tr("Property Editor")); + doc->setWidget(m_reportDesignWidget->toolWindow(ReportDesignWidget::PropertyEditor)); + doc->setObjectName("PropertyEditor"); + addDockWidget(Qt::RightDockWidgetArea,doc); + m_dialogEditors.append(doc); +} + +void ReportDesignWindow::createDialogObjectInspector() +{ + QDockWidget *doc = new QDockWidget(this); + doc->setWindowTitle(tr("Object Inspector")); + doc->setWidget(m_reportDesignWidget->toolWindow(ReportDesignWidget::ObjectInspector)); + doc->setObjectName("ObjectInspector"); + addDockWidget(Qt::RightDockWidgetArea,doc); + m_dialogEditors.append(doc); +} + +void ReportDesignWindow::createDialogActionEditor() +{ + QDockWidget *doc = new QDockWidget(this); + doc->setWindowTitle(tr("Action Editor")); + doc->setWidget(m_reportDesignWidget->toolWindow(ReportDesignWidget::ActionEditor)); + doc->setObjectName("ActionEditor"); + addDockWidget(Qt::BottomDockWidgetArea,doc); + m_dialogEditors.append(doc); +} + +void ReportDesignWindow::createDialogResourceEditor() +{ + QDockWidget *doc = new QDockWidget(this); + doc->setWindowTitle(tr("Resource Editor")); + doc->setWidget(m_reportDesignWidget->toolWindow(ReportDesignWidget::ResourceEditor)); + doc->setObjectName("ResourceEditor"); + addDockWidget(Qt::BottomDockWidgetArea,doc); + m_dialogEditors.append(doc); +} + +void ReportDesignWindow::createDialogSignalSlotEditor() +{ + QDockWidget *doc = new QDockWidget(this); + doc->setWindowTitle(tr("SignalSlot Editor")); + doc->setWidget(m_reportDesignWidget->toolWindow(ReportDesignWidget::SignalSlotEditor)); + doc->setObjectName("SignalSlotEditor"); + addDockWidget(Qt::BottomDockWidgetArea,doc); + m_dialogEditors.append(doc); +} + +#endif void ReportDesignWindow::createDataWindow() { QDockWidget *dataDoc = new QDockWidget(this); @@ -510,6 +584,7 @@ void ReportDesignWindow::createDataWindow() addDockWidget(Qt::LeftDockWidgetArea,dataDoc); m_dataBrowser->setSettings(settings()); m_dataBrowser->setMainWindow(this); + m_pageEditors.append(dataDoc); m_dataBrowser->setReportEditor(m_reportDesignWidget); } @@ -522,6 +597,7 @@ void ReportDesignWindow::createScriptWindow() dataDoc->setObjectName("scriptDoc"); addDockWidget(Qt::LeftDockWidgetArea,dataDoc); m_scriptBrowser->setReportEditor(m_reportDesignWidget); + m_pageEditors.append(dataDoc); #ifdef HAVE_UI_LOADER m_scriptBrowser->updateDialogsTree(); #endif @@ -544,6 +620,8 @@ void ReportDesignWindow::startNewReport() m_newPageFooter->setEnabled(true); m_newReportHeader->setEnabled(true); m_newReportFooter->setEnabled(true); + m_editorTabType = ReportDesignWidget::Page; + showDefaultEditors(); } void ReportDesignWindow::writePosition() @@ -557,7 +635,16 @@ void ReportDesignWindow::writePosition() void ReportDesignWindow::writeState() { settings()->beginGroup("DesignerWindow"); - settings()->setValue("State",saveState()); + switch (m_editorTabType) { + case ReportDesignWidget::Page: + settings()->setValue("PageEditorsState", saveState()); + settings()->setValue("DialogEditorsState", m_dialogEditorsState); + break; + default: + settings()->setValue("DialogEditorsState", saveState()); + settings()->setValue("PageEditorsState", m_pageEditorsState); + break; + } settings()->setValue("InspectorFirsColumnWidth",m_objectInspector->columnWidth(0)); settings()->endGroup(); settings()->beginGroup("RecentFiles"); @@ -650,9 +737,15 @@ void ReportDesignWindow::restoreSetting() resize(screenWidth*0.8, screenHeight*0.8); move(x, y); } - v = settings()->value("State"); + v = settings()->value("PageEditorsState"); if (v.isValid()){ + m_pageEditorsState = v.toByteArray(); restoreState(v.toByteArray()); + m_editorTabType = ReportDesignWidget::Page; + } + v = settings()->value("DialogEditorsState"); + if (v.isValid()){ + m_dialogEditorsState = v.toByteArray(); } v = settings()->value("InspectorFirsColumnWidth"); if (v.isValid()){ @@ -954,6 +1047,8 @@ void ReportDesignWindow::slotLoadReport() unsetCursor(); setWindowTitle(m_reportDesignWidget->report()->reportName() + " - Lime Report Designer"); addRecentFile(fileName); + m_editorTabType = ReportDesignWidget::Page; + showDefaultEditors(); } } @@ -1120,11 +1215,48 @@ void ReportDesignWindow::updateAvaibleBands(){ } } + +void ReportDesignWindow::showDefaultEditors(){ + foreach (QDockWidget* w, m_pageEditors) { + w->setVisible(m_editorTabType != ReportDesignWidget::Dialog); + } + foreach (QDockWidget* w, m_dialogEditors) { + w->setVisible(m_editorTabType == ReportDesignWidget::Dialog); + } +} + void ReportDesignWindow::slotActivePageChanged() { m_propertyModel->setObject(0); updateRedoUndo(); updateAvaibleBands(); + + switch (m_editorTabType) { + case ReportDesignWidget::Dialog: + m_dialogEditorsState = saveState(); + break; + default: + m_pageEditorsState = saveState(); + break; + } + + m_editorTabType = m_reportDesignWidget->activeTabType(); + + switch (m_editorTabType) { + case ReportDesignWidget::Dialog: + if (!m_dialogEditorsState.isEmpty()) + restoreState(m_dialogEditorsState); + else + showDefaultEditors(); + break; + default: + if (!m_pageEditors.isEmpty()) + restoreState(m_pageEditorsState); + else + showDefaultEditors(); + break; + } + } void ReportDesignWindow::renderStarted() diff --git a/limereport/lrreportdesignwindow.h b/limereport/lrreportdesignwindow.h index 147f47f..ec37638 100644 --- a/limereport/lrreportdesignwindow.h +++ b/limereport/lrreportdesignwindow.h @@ -126,6 +126,7 @@ protected: void hideDockWidgets(Qt::DockWidgetArea area, bool value); bool isDockAreaVisible(Qt::DockWidgetArea area); private: + void initReportEditor(ReportEnginePrivate* report); void createActions(); void createBandsButton(); void createMainMenu(); @@ -134,9 +135,16 @@ private: void createItemsActions(); void createObjectInspector(); void createObjectsBrowser(); - void initReportEditor(ReportEnginePrivate* report); void createDataWindow(); void createScriptWindow(); +#ifdef HAVE_QTDESIGNER_INTEGRATION + void createDialogWidgetBox(); + void createDialogPropertyEditor(); + void createDialogObjectInspector(); + void createDialogActionEditor(); + void createDialogResourceEditor(); + void createDialogSignalSlotEditor(); +#endif void updateRedoUndo(); void updateAvaibleBands(); void startNewReport(); @@ -146,6 +154,7 @@ private: void removeNotExistedRecentFiles(); void removeNotExistedRecentFilesFromMenu(const QString& fileName); void addRecentFile(const QString& fileName); + void showDefaultEditors(); private: static ReportDesignWindow* m_instance; QStatusBar* m_statusBar; @@ -235,6 +244,12 @@ private: QProgressDialog* m_progressDialog; bool m_showProgressDialog; QMap m_recentFiles; + QVector m_pageEditors; + QVector m_dialogEditors; + ReportDesignWidget::EditorTabType m_editorTabType; + QByteArray m_pageEditorsState; + QByteArray m_dialogEditorsState; + }; class ObjectNameValidator : public ValidatorIntf{ diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 2476930..4c23026 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -341,7 +341,7 @@ void registerChildObjects(ScriptEngineType* se, ScriptValueType* sv){ void ReportRender::initDialogs(){ if (m_scriptEngineContext){ ScriptEngineType* se = ScriptEngineManager::instance().scriptEngine(); - foreach(DialogDescriber::Ptr dialog, m_scriptEngineContext->dialogsDescriber()){ + foreach(DialogDescriber::Ptr dialog, m_scriptEngineContext->dialogDescribers()){ ScriptValueType sv = se->newQObject(m_scriptEngineContext->getDialog(dialog->name())); #ifdef USE_QJSENGINE registerChildObjects(se,&sv); diff --git a/limereport/lrscriptenginemanager.h b/limereport/lrscriptenginemanager.h index 726013b..36ecda2 100644 --- a/limereport/lrscriptenginemanager.h +++ b/limereport/lrscriptenginemanager.h @@ -144,21 +144,21 @@ public: #endif explicit ScriptEngineContext(QObject* parent=0):QObject(parent){} #ifdef HAVE_UI_LOADER - void addDialog(const QString& name, const QByteArray &description); + void addDialog(const QString& name, const QByteArray &description); bool previewDialog(const QString& dialogName); bool containsDialog(const QString& dialogName); - const QVector& dialogsDescriber(){return m_dialogs;} + const QVector& dialogDescribers(){return m_dialogs;} void deleteDialog(const QString& dialogName); QDialog *getDialog(const QString &dialogName); #endif - void clear(); + void clear(); QString initScript() const; - void setInitScript(const QString& initScript); + void setInitScript(const QString& initScript); protected: QObject* createElement(const QString& collectionName,const QString& elementType); - int elementsCount(const QString& collectionName); + int elementsCount(const QString& collectionName); QObject* elementAt(const QString& collectionName,int index); - void collectionLoadFinished(const QString &collectionName); + void collectionLoadFinished(const QString &collectionName); #ifdef HAVE_UI_LOADER QDialog *createDialog(DialogDescriber *cont); QDialog *findDialog(const QString &dialogName); diff --git a/limereport/scriptbrowser/lrscriptbrowser.cpp b/limereport/scriptbrowser/lrscriptbrowser.cpp index 8e6dcc3..1bd052d 100644 --- a/limereport/scriptbrowser/lrscriptbrowser.cpp +++ b/limereport/scriptbrowser/lrscriptbrowser.cpp @@ -117,7 +117,7 @@ void ScriptBrowser::updateDialogsTree() { ui->twDialogs->clear(); ScriptEngineContext* sc = reportEditor()->scriptContext(); - foreach(DialogDescriber::Ptr dc, sc->dialogsDescriber()){ + foreach(DialogDescriber::Ptr dc, sc->dialogDescribers()){ QTreeWidgetItem* dialogItem = new QTreeWidgetItem(ui->twDialogs,QStringList(dc->name())); dialogItem->setIcon(0,QIcon(":/scriptbrowser/images/dialog")); fillDialog(dialogItem,dc->description()); From 0692435b26861b4eb9dcffa8c6703a76bfa64abd Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 11 Apr 2017 11:23:34 +0300 Subject: [PATCH 094/136] Dialog designers tool bar integration has been added --- limereport/dialogdesigner/dialogdesigner.pri | 3 + limereport/dialogdesigner/dialogdesigner.qrc | 9 ++ .../dialogdesigner/images/buddytool.png | Bin 0 -> 997 bytes limereport/dialogdesigner/images/editform.png | Bin 0 -> 349 bytes .../dialogdesigner/images/signalslottool.png | Bin 0 -> 1128 bytes .../dialogdesigner/images/tabordertool.png | Bin 0 -> 1205 bytes .../dialogdesigner/images/widgettool.png | Bin 0 -> 1039 bytes .../dialogdesigner/lrdialogdesigner.cpp | 99 +++++++++++++++--- limereport/dialogdesigner/lrdialogdesigner.h | 14 ++- limereport/lrreportdesignwidget.cpp | 48 ++++++++- limereport/lrreportdesignwidget.h | 12 ++- limereport/lrreportdesignwindow.cpp | 27 ++++- limereport/lrreportdesignwindow.h | 7 ++ limereport/lrscriptenginemanager.cpp | 11 ++ limereport/lrscriptenginemanager.h | 3 +- 15 files changed, 209 insertions(+), 24 deletions(-) create mode 100644 limereport/dialogdesigner/dialogdesigner.qrc create mode 100644 limereport/dialogdesigner/images/buddytool.png create mode 100644 limereport/dialogdesigner/images/editform.png create mode 100644 limereport/dialogdesigner/images/signalslottool.png create mode 100644 limereport/dialogdesigner/images/tabordertool.png create mode 100644 limereport/dialogdesigner/images/widgettool.png diff --git a/limereport/dialogdesigner/dialogdesigner.pri b/limereport/dialogdesigner/dialogdesigner.pri index 37a1ea1..df76e68 100644 --- a/limereport/dialogdesigner/dialogdesigner.pri +++ b/limereport/dialogdesigner/dialogdesigner.pri @@ -15,3 +15,6 @@ QT += designer designercomponents-private SOURCES += $$PWD/lrdialogdesigner.cpp HEADERS += $$PWD/lrdialogdesigner.h + +RESOURCES += \ + $$PWD/dialogdesigner.qrc diff --git a/limereport/dialogdesigner/dialogdesigner.qrc b/limereport/dialogdesigner/dialogdesigner.qrc new file mode 100644 index 0000000..67c62fb --- /dev/null +++ b/limereport/dialogdesigner/dialogdesigner.qrc @@ -0,0 +1,9 @@ + + + images/buddytool.png + images/editform.png + images/signalslottool.png + images/tabordertool.png + images/widgettool.png + + diff --git a/limereport/dialogdesigner/images/buddytool.png b/limereport/dialogdesigner/images/buddytool.png new file mode 100644 index 0000000000000000000000000000000000000000..4cd968bbf5fb473cecf134e7c1dc0793e869445d GIT binary patch literal 997 zcmVM&= zaCqIkO%%LMHg(=I2^41ZLv&gA?K~%)&gM4jz?bvB&pGG&dCq&D!z&VrM8Qnb|5Pvl zku6b^8jVKu_V!|Ma1c734t;%n{C!|xfNNxA1pWQ}d~A6R^`xq*Dsqw91q=-hp{1n- zjg5^^sZ?ldYePdr16ONnD>^zl_;XWJ6Q4&hnoCMZNN@}o9v+6OUImRt!_CxcHSfuY zVx;cwZXPEPy*D>Evt;U#n3(7opx5iUnYK%d_V#wZn07%i%9x(Jy1IB=t=8~3#Ylo6 zI0vAt$gHfa3<`w;6%`fe>FMF7v>O`l?Cj({#mStKNlr>~44^}#tt*vEgocJfB9UOH z$8PusMME5!jv&&hOs0$_Wg8$5CEh4!K;8)YMd78QZpdA@__JsLlf# zl)(GPD|#j4keoZukdl((9H6eQj+f$ci5@wf3B1i`eHQQ{19)-{i%T*WpM~juBqUK+ zAr6Uf449ahfL5!u)ICWO#n!ZxvTPaPT_K>1!Q!(R{46;SNPS_Bae*n#6Yib|vDMwL z*)CvaW(HKMq~!|~5-kTB6+l_6wdB6Q1s6~=$1+H|7q)v#zKEmq3he+sfGSC^H}LEY z1_Of6$=D8_0_AZly6y+WZ^G(kj@txNmNyvSlPw4b%+Ah2H>3ld1(}oh4m2ge%Y;9= z;SUJb<`xKpnq)pUAr=6ckByCCa&i)*qoW8tp983F;#*}r7W4K1Nv^Qh%!v$=?fVym z1Lo%DU^I>`$;e@Miz^Wpn+wy6IDEZi-`oO8c7-X|&kDi;^YimO^O=tyK?goPJ&mcU zDcn=MVvrmxSpI4X$-;etN!TmDD3bN<8#4Y{7QEK$zbC} z0jSOmLqXhr4iP!?!=XB-QZyCrgE?!9ZSyNEUVH$xx5FWX?ONHvdKYA^XfiD_Jq&*2)<;3$TJbVi36-_g=il`qIOwd2kX!xaZ$hv=M+6gnf=5 z%-sAu5Vb{-5Keg6z6ToxtcEP8Gx3I*Up#5&CjSdyHKgEj;JW7j1y~JP&z$rdsg5DL TV66v=00000NkvXXu0mjfW+uQs literal 0 HcmV?d00001 diff --git a/limereport/dialogdesigner/images/editform.png b/limereport/dialogdesigner/images/editform.png new file mode 100644 index 0000000000000000000000000000000000000000..452fcd8878b7c7999b5317aae0cb90c28df36a36 GIT binary patch literal 349 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM3?#3wJbMaAH3s;Exc>kD-yxy_$O8fhL*Fs( z!rTArAO26TYTokr|C4Y3r{DNL<@)~%ENYmvXLW(Yb#V6h5A=elF{r5}E)%Jgjs8 literal 0 HcmV?d00001 diff --git a/limereport/dialogdesigner/images/signalslottool.png b/limereport/dialogdesigner/images/signalslottool.png new file mode 100644 index 0000000000000000000000000000000000000000..e80fd1caa625d6fa6342bec58bc5619386b21b7c GIT binary patch literal 1128 zcmV-u1eg1XP)cij(J$Niew-Fe^V>79p}CBfF#Kb$!;@Xr6oIsZ9~ zbnN2g!X37hN<@?QD9@FMS-QHNbHDQdnYPE<4jlUQhdo-#v^F=Rb->(gnJ9`0f&hSY zI!&om!We_K7NwN$0KL7vbar-j0S^XflUsfE!c|7cMrmDlmAxQXj6O$|&=&2aAGZH}F|O#iK$G&W``#@;ZFV;UM7`~->d z0w|7RwAPCQuACb?`{J`Z*uQUw=S@$~as1>(B4!9eyt#;=#G!OVCX>Qi>*1Mf#=l<_ zaHF58@;t0sv62tp%hS@FUKKtqnVMZ{4BMcQ1miXq_pXi`WE|&%HU}MbU000q% zk~D$j_~4zFXm5RtTZ08Y`QikroFmidIQ-oo^!zo#XkikioHwri2p$UX4?E|Wn~e!1 zn@qBwmF>$J9GT(Z;op*JPIIMi80X;cTjL;p_Y1X{3|`a%^&l;EeAJca~;^EqDjO1raQ`Fbz*syU^0x&r6 zW>I7jarE`{a<4EASUjNmPn6W+5)nkmr&0my)~%(jwTX194jm}Uy$D$k`YrjzDWtf%a>_RX!^pwsMfIt4q2=Kgt9{qXmBY{%f3bP(3D5 uf*=5X8s)Qs!JF5X4Cvmyy`_t#srw(dSG7JJtV|{V0000}MF0#M1Cu_l5A*Z$SYBQhmX?;VxUe9(MHMfom^nUMU0s!!IeEUgC^f|E z^@4hL8Qf}VL2qv_1_uXWx7#HqJv}{exm>ud*1osYV zu~;xLFaU?cA+ULPcv!?4Q$WYslxFN9+N{03J-UHeIkSmVbES!HW^QzJR3_x!>2wOL zp$TKwxYZDCZEevFtX8WOQh;KdUJFu$rdpVJ?)3mV&!dfL(ACuyK1&KxM8g~f^pQ+V zOvs)llarGeA0Nla$cWV1Y_{kI9UUFg%p$(Q*w~l|vysAFb&dv+=g)e5gx%fU(G7mN zX2aW`Hz7W&K}|G)6W{%bxC0ktf5YlT?UmcueY8<>g=Z}yMpGUo&9n)RDXPJlpRG9d zm01Kh;qh-<;c}0m?8i3j{^Sa3e(S*XRtK8f-BLqS-g$jIgmKI_;MKeMheMiKOp~dp zDO@%W$Xjslne?F3F(Nf>J#P4XUdij}X~4frR0CeQhGwTUb237M{lzz7s4i<}w@N*)zU;u<+#C|qb8-4s5Q%9fG2;i2x9gFo z({So$P@qZJV0Ly^rsP+WE5DMADaL1Q33nN= znZl)&^>`^GZ=Li!5u=FSuak@1#vlr>1@X0YO>)P-I41^geG?GE2E3a3n@@wJjC|B| zuAyl-HnsLOlr;yD{cBKG*1xdtV=*}ReLx5s@D8u6tjMc#O)?hXXng<$SA)n85gAA3 zG^UIHNDmFTlCVK>NePTbBQi2FWPRw-?MTh4z;nr&G1-@0iR`K_l(ht9W&M_C_K3lW zO94R}g#IU&_9tha9Ne?Ncz9dFfxkD!?Zu|J)OEJqK`5Vd#)jN;T}VGtfz3PKz*9+w z0y|#G!s*`wf*8n;!C=^+xJU7TVyj}OB1w^~NKw3|NDaX_WoOEVD5|mHonsYpRg;YQ zwbV$?EXCQ@fN-b5M#X)KhZRpMo>e@r*riBNB!+mAxm|ld!UuVk>c^Ht&WCz8s*}L` zrV6~L2pdG0+^e`>@t|U};xWY*#p8-6LNMN{Zp=@-ZR!fwg?iY#L5WsVI7Ib-$w&7< Tg6EMl00000NkvXXu0mjf6WBk& literal 0 HcmV?d00001 diff --git a/limereport/dialogdesigner/images/widgettool.png b/limereport/dialogdesigner/images/widgettool.png new file mode 100644 index 0000000000000000000000000000000000000000..a52224e068c4ac63c6e1ed7c41025d1108e6caaa GIT binary patch literal 1039 zcmV+q1n~QbP)z8wB<%qK}Q^REM+ z&I^UY*xK3}!Z3vEx~SD^sMqTVf9Ltvs&)jhAdBpkOz$F5?sA@59=$lEdbV3qlS4v zp-7Q);0MT$-^9ek1kMaS!k6U;u^6Yq02NUc1LIu=PjT?f~B}@ZgzlFAmWt@qaBAKITLZ_X+fPJ_A8~#t7P?#&K&>iu3S8W|JF52MVZ~N&)rhwPKG=tq{Egu`L51UR9A^|4gOY00I?wLDFZex_Lj4k@8kH9eWsN+9+UoVG+w4kSKB?LXT51x z(Qbo{tMq*i&)!bAiGfZyv!Gk|d8cEF*tGaj6 #include #include +#include +#include #include "pluginmanager_p.h" //#include @@ -30,64 +32,70 @@ DialogDesigner::DialogDesigner(QObject *parent) : QObject(parent) QDesignerComponents::initializePlugins(m_formEditor); QDesignerComponents::createTaskMenu(m_formEditor, this); + m_editWidgetsAction = new QAction(tr("Edit Widgets")); + m_editWidgetsAction->setIcon(QIcon(":/images/images/widgettool.png")); + m_editWidgetsAction->setEnabled(false); + connect(m_editWidgetsAction, SIGNAL(triggered()), this, SLOT(slotEditWidgets())); + connect(m_formEditor->formWindowManager(), SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)), + this, SLOT(slotActiveFormWindowChanged(QDesignerFormWindowInterface*)) ); + + m_modes = new QActionGroup(this); + m_modes->setExclusive(true); + m_modes->addAction(m_editWidgetsAction); + foreach ( QObject* o, QPluginLoader::staticInstances() << m_formEditor->pluginManager()->instances() ) { if ( QDesignerFormEditorPluginInterface* fep = qobject_cast( o ) ) { - // initialize plugin if needed if ( !fep->isInitialized() ) fep->initialize( m_formEditor ); - - // set action chackable -// fep->action()->setCheckable( true ); - -// // add action mode to group -// aModes->addAction( fep->action() ); + fep->action()->setCheckable( true ); + fep->action()->setIcon(QIcon(iconPathByName(fep->action()->objectName()))); + m_modes->addAction(fep->action()); } } - m_widgetBox = QDesignerComponents::createWidgetBox(m_formEditor, 0); m_widgetBox->setWindowTitle(tr("Widget Box")); m_widgetBox->setObjectName(QLatin1String("WidgetBox")); m_formEditor->setWidgetBox(m_widgetBox); m_formEditor->setTopLevel(m_widgetBox); m_designerToolWindows.append(m_widgetBox); - connect(m_widgetBox, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) ); + connect(m_widgetBox, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) ); m_objectInspector = QDesignerComponents::createObjectInspector(m_formEditor, 0); m_objectInspector->setWindowTitle(tr("Object Inspector")); m_objectInspector->setObjectName(QLatin1String("ObjectInspector")); m_formEditor->setObjectInspector(m_objectInspector); m_designerToolWindows.append(m_objectInspector); - connect(m_objectInspector, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) ); + connect(m_objectInspector, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) ); m_propertyEditor = QDesignerComponents::createPropertyEditor(m_formEditor, 0); m_propertyEditor->setWindowTitle(tr("Property Editor")); m_propertyEditor->setObjectName(QLatin1String("PropertyEditor")); m_formEditor->setPropertyEditor(m_propertyEditor); m_designerToolWindows.append(m_propertyEditor); - connect(m_propertyEditor, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) ); + connect(m_propertyEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) ); m_signalSlotEditor = QDesignerComponents::createSignalSlotEditor(m_formEditor, 0); m_signalSlotEditor->setWindowTitle(tr("Signals && Slots Editor")); m_signalSlotEditor->setObjectName(QLatin1String("SignalsAndSlotsEditor")); m_designerToolWindows.append(m_signalSlotEditor); - connect(m_signalSlotEditor, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) ); + connect(m_signalSlotEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) ); m_resourcesEditor = QDesignerComponents::createResourceEditor(m_formEditor, 0); m_resourcesEditor->setWindowTitle(tr("Resource Editor")); m_resourcesEditor->setObjectName(QLatin1String("ResourceEditor")); m_designerToolWindows.append(m_resourcesEditor); - connect(m_resourcesEditor, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) ); + connect(m_resourcesEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) ); m_actionEditor = QDesignerComponents::createActionEditor(m_formEditor, 0); m_actionEditor->setWindowTitle(tr("Action Editor")); m_actionEditor->setObjectName("ActionEditor"); m_formEditor->setActionEditor(m_actionEditor); m_designerToolWindows.append(m_actionEditor); - connect(m_formEditor, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)) ); + connect(m_formEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) ); m_designerIntegration = new QDesignerIntegration(m_formEditor,this); m_formEditor->setIntegration(m_designerIntegration); @@ -105,6 +113,28 @@ DialogDesigner::~DialogDesigner() delete m_formEditor; } +void DialogDesigner::initToolBar(QToolBar *tb) +{ + tb->setIconSize(QSize(16,16)); + tb->addAction(m_formEditor->formWindowManager()->actionCopy()); + tb->addAction(m_formEditor->formWindowManager()->actionPaste()); + tb->addAction(m_formEditor->formWindowManager()->actionCut()); + tb->addAction(m_formEditor->formWindowManager()->actionUndo()); + tb->addAction(m_formEditor->formWindowManager()->actionRedo()); + + tb->addActions(m_modes->actions()); + + tb->addAction(m_formEditor->formWindowManager()->actionHorizontalLayout()); + tb->addAction(m_formEditor->formWindowManager()->actionVerticalLayout()); + tb->addAction(m_formEditor->formWindowManager()->actionSplitHorizontal()); + tb->addAction(m_formEditor->formWindowManager()->actionSplitVertical()); + tb->addAction(m_formEditor->formWindowManager()->actionGridLayout()); + m_formEditor->formWindowManager()->actionFormLayout()->setIcon(QIcon(":/images/images/editform.png")); + tb->addAction(m_formEditor->formWindowManager()->actionFormLayout()); + tb->addAction(m_formEditor->formWindowManager()->actionBreakLayout()); + tb->addAction(m_formEditor->formWindowManager()->actionAdjustSize()); +} + QWidget *DialogDesigner::createFormEditor(const QString &content) { QDesignerFormWindowInterface* wnd = m_formEditor->formWindowManager()->createFormWindow(0, Qt::Window); @@ -113,12 +143,22 @@ QWidget *DialogDesigner::createFormEditor(const QString &content) m_formEditor->objectInspector()->setFormWindow(wnd); wnd->editWidgets(); + connect(wnd, SIGNAL(changed()), this, SIGNAL(dialogChanged())); + SharedTools::WidgetHost *placeholder = new SharedTools::WidgetHost(0,wnd); placeholder->setFrameStyle( QFrame::NoFrame | QFrame::Plain ); placeholder->setFocusProxy( wnd ); - return placeholder; + return placeholder; +} +QByteArray DialogDesigner::getDialogDescription(QWidget *form) +{ + SharedTools::WidgetHost* wh = dynamic_cast(form); + if (wh){ + return wh->formWindow()->contents().toUtf8(); + } + return QByteArray(); } void DialogDesigner::setActiveEditor(QWidget *widget) @@ -127,7 +167,6 @@ void DialogDesigner::setActiveEditor(QWidget *widget) if (wh){ m_formEditor->formWindowManager()->setActiveFormWindow(wh->formWindow()); } - } QWidget* DialogDesigner::widgetBox() const @@ -160,7 +199,7 @@ QWidget *DialogDesigner::resourcesEditor() const return m_resourcesEditor; } -void DialogDesigner::objectDestroyed(QObject *object) +void DialogDesigner::slotObjectDestroyed(QObject *object) { for ( int i = 0; iformWindowManager()->formWindowCount(); ++i){ + m_formEditor->formWindowManager()->formWindow(i)->editWidgets(); + } +} + +void DialogDesigner::slotActiveFormWindowChanged(QDesignerFormWindowInterface *formWindow) +{ + if (formWindow){ + m_editWidgetsAction->setEnabled(true); + m_activeWindowName = formWindow->objectName(); + } +} + +QString DialogDesigner::iconPathByName(const QString &name) +{ + if (name.compare("__qt_edit_signals_slots_action") == 0) + return ":/images/images/signalslottool.png"; + if (name.compare("__qt_edit_buddies_action") == 0) + return ":/images/images/buddytool.png"; + if (name.compare("_qt_edit_tab_order_action") == 0) + return ":/images/images/tabordertool.png"; + return ""; +} + } diff --git a/limereport/dialogdesigner/lrdialogdesigner.h b/limereport/dialogdesigner/lrdialogdesigner.h index 2620b71..bebc4dd 100644 --- a/limereport/dialogdesigner/lrdialogdesigner.h +++ b/limereport/dialogdesigner/lrdialogdesigner.h @@ -3,6 +3,7 @@ #include #include +#include class QDesignerFormEditorInterface; class QDesignerFormWindowInterface; @@ -21,7 +22,9 @@ class DialogDesigner : public QObject public: explicit DialogDesigner(QObject *parent = 0); ~DialogDesigner(); + void initToolBar(QToolBar* tb); QWidget* createFormEditor(const QString& content); + QByteArray getDialogDescription(QWidget* form); void setActiveEditor(QWidget* widget); QWidget* widgetBox() const; QWidget* actionEditor() const; @@ -29,8 +32,14 @@ public: QWidget* objectInspector() const; QWidget* signalSlotEditor() const; QWidget* resourcesEditor() const; +signals: + void dialogChanged(); private slots: - void objectDestroyed(QObject* object); + void slotObjectDestroyed(QObject* object); + void slotEditWidgets(); + void slotActiveFormWindowChanged(QDesignerFormWindowInterface *formWindow); +private: + QString iconPathByName(const QString& name); private: QDesignerFormEditorInterface* m_formEditor; QDesignerIntegrationInterface* m_designerIntegration; @@ -41,6 +50,9 @@ private: QWidget* m_signalSlotEditor; QWidget* m_resourcesEditor; QVector m_designerToolWindows; + QAction* m_editWidgetsAction; + QActionGroup* m_modes; + QString m_activeWindowName; }; } // namespace LimeReport diff --git a/limereport/lrreportdesignwidget.cpp b/limereport/lrreportdesignwidget.cpp index 6acb22a..97621ab 100644 --- a/limereport/lrreportdesignwidget.cpp +++ b/limereport/lrreportdesignwidget.cpp @@ -48,7 +48,11 @@ namespace LimeReport { ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow *mainWindow, QWidget *parent) : - QWidget(parent), m_dialogDesigner(new DialogDesigner(this)), m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false) + QWidget(parent), +#ifdef HAVE_QTDESIGNER_INTEGRATION + m_dialogDesigner(new DialogDesigner(this)), +#endif + m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false) { m_tabWidget = new QTabWidget(this); m_tabWidget->setTabPosition(QTabWidget::South); @@ -74,9 +78,14 @@ ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow m_scriptEditor->setPlainText(report->scriptContext()->initScript()); m_zoomer = new GraphicsViewZoomer(activeView()); + #ifdef Q_OS_WIN m_defaultFont = QFont("Arial",10); #endif + +#ifdef HAVE_QTDESIGNER_INTEGRATION + connect(m_dialogDesigner, SIGNAL(dialogChanged()), this, SLOT(slotDialogChanged())); +#endif } DialogDesigner *ReportDesignWidget::dialogDesigner() const @@ -112,6 +121,20 @@ ReportDesignWidget::EditorTabType ReportDesignWidget::activeTabType() return Page; } +void ReportDesignWidget::initDialogDesignerToolBar(QToolBar *toolBar) +{ + m_dialogDesigner->initToolBar(toolBar); +} + +void ReportDesignWidget::updateDialogs() +{ + for ( int i = 0; icount(); ++i ){ + if (m_tabWidget->tabWhatsThis(i).compare("dialog") == 0){ + m_report->scriptContext()->changeDialog(m_tabWidget->tabText(i), m_dialogDesigner->getDialogDescription(m_tabWidget->widget(i))); + } + } +} + bool ReportDesignWidget::useMagnet() const { return m_useMagnet; @@ -299,7 +322,12 @@ void ReportDesignWidget::slotItemSelected(BaseDesignIntf *item){ } void ReportDesignWidget::saveToFile(const QString &fileName){ + m_report->scriptContext()->setInitScript(m_scriptEditor->toPlainText()); +#ifdef HAVE_QTDESIGNER_INTEGRATION + updateDialogs(); +#endif + if (m_report->saveToFile(fileName)) { m_report->emitSaveFinished(); } @@ -308,6 +336,10 @@ void ReportDesignWidget::saveToFile(const QString &fileName){ bool ReportDesignWidget::save() { m_report->scriptContext()->setInitScript(m_scriptEditor->toPlainText()); +#ifdef HAVE_QTDESIGNER_INTEGRATION + updateDialogs(); +#endif + if (!m_report->reportFileName().isEmpty()){ if (m_report->saveToFile()){ m_report->emitSaveFinished(); @@ -499,12 +531,18 @@ void ReportDesignWidget::setBorders(const BaseDesignIntf::BorderLines& borders) void ReportDesignWidget::previewReport() { report()->scriptContext()->setInitScript(m_scriptEditor->toPlainText()); +#ifdef HAVE_QTDESIGNER_INTEGRATION + updateDialogs(); +#endif report()->previewReport(); } void ReportDesignWidget::printReport() { report()->scriptContext()->setInitScript(m_scriptEditor->toPlainText()); +#ifdef HAVE_QTDESIGNER_INTEGRATION + updateDialogs(); +#endif setCursor(Qt::WaitCursor); report()->printReport(); setCursor(Qt::ArrowCursor); @@ -653,6 +691,14 @@ void ReportDesignWidget::slotCurrentTabChanged(int index) emit activePageChanged(); } +#ifdef HAVE_QTDESIGNER_INTEGRATION + +void ReportDesignWidget::slotDialogChanged() +{ +} + +#endif + bool ReportDesignWidget::eventFilter(QObject *target, QEvent *event) { if (event->type() == QEvent::Wheel){ diff --git a/limereport/lrreportdesignwidget.h b/limereport/lrreportdesignwidget.h index d624617..ee6a157 100644 --- a/limereport/lrreportdesignwidget.h +++ b/limereport/lrreportdesignwidget.h @@ -54,7 +54,6 @@ class ReportDesignWidget : public QWidget { Q_OBJECT Q_PROPERTY(QObject* datasourcesManager READ dataManager()) - friend class ReportDesignWindow; public: enum ToolWindowType{ WidgetBox = 1, @@ -69,6 +68,7 @@ public: Dialog, Script }; + ReportDesignWidget(ReportEnginePrivate* report,QMainWindow *mainWindow,QWidget *parent = 0); ~ReportDesignWidget(); void createStartPage(); void clear(); @@ -103,6 +103,10 @@ public: DialogDesigner *dialogDesigner() const; QWidget* toolWindow(ToolWindowType windowType); EditorTabType activeTabType(); +#ifdef HAVE_QTDESIGNER_INTEGRATION + void initDialogDesignerToolBar(QToolBar* toolBar); + void updateDialogs(); +#endif public slots: void saveToFile(const QString&); bool save(); @@ -135,13 +139,16 @@ public slots: void printReport(); void addPage(); void deleteCurrentPage(); + void slotPagesLoadFinished(); private slots: void slotItemSelected(LimeReport::BaseDesignIntf *item); void slotSelectionChanged(); - void slotPagesLoadFinished(); void slotDatasourceCollectionLoaded(const QString&); void slotSceneRectChanged(QRectF); void slotCurrentTabChanged(int index); +#ifdef HAVE_QTDESIGNER_INTEGRATION + void slotDialogChanged(); +#endif signals: void insertModeStarted(); void itemInserted(LimeReport::PageDesignIntf*,QPointF,const QString&); @@ -164,7 +171,6 @@ protected: void createTabs(); private: bool eventFilter(QObject *target, QEvent *event); - ReportDesignWidget(ReportEnginePrivate* report,QMainWindow *mainWindow,QWidget *parent = 0); private: ReportEnginePrivate* m_report; QGraphicsView *m_view; diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index 8bdb62d..febddfd 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -80,6 +80,7 @@ ReportDesignWindow::ReportDesignWindow(ReportEnginePrivate *report, QWidget *par createDialogActionEditor(); createDialogResourceEditor(); createDialogSignalSlotEditor(); + createDialogDesignerToolBar(); #endif m_instance=this; m_statusBar=new QStatusBar(this); @@ -87,11 +88,12 @@ ReportDesignWindow::ReportDesignWindow(ReportEnginePrivate *report, QWidget *par m_statusBar->insertWidget(0,m_lblReportName); setStatusBar(m_statusBar); setWindowTitle("Lime Report Designer"); + showDefaultEditors(); + showDefaultToolBars(); restoreSetting(); m_hideLeftPanel->setChecked(isDockAreaVisible(Qt::LeftDockWidgetArea)); m_hideRightPanel->setChecked(isDockAreaVisible(Qt::RightDockWidgetArea)); m_editorTabType = ReportDesignWidget::Page; - showDefaultEditors(); } ReportDesignWindow::~ReportDesignWindow() @@ -323,6 +325,9 @@ void ReportDesignWindow::createToolBars() addToolBar(m_itemsBordersEditorBar); createReportToolBar(); + + m_pageTools << m_mainToolBar << m_reportToolBar << m_fontEditorBar << m_textAlignmentEditorBar << m_itemsBordersEditorBar; + } void ReportDesignWindow::createItemsActions() @@ -573,6 +578,14 @@ void ReportDesignWindow::createDialogSignalSlotEditor() m_dialogEditors.append(doc); } +void ReportDesignWindow::createDialogDesignerToolBar() +{ + m_dialogDesignerToolBar = addToolBar(tr("Dialog Designer Tools")); + m_dialogDesignerToolBar->setObjectName("DialogDesignerTools"); + m_reportDesignWidget->initDialogDesignerToolBar(m_dialogDesignerToolBar); + m_dialogTools << m_dialogDesignerToolBar; +} + #endif void ReportDesignWindow::createDataWindow() { @@ -622,6 +635,7 @@ void ReportDesignWindow::startNewReport() m_newReportFooter->setEnabled(true); m_editorTabType = ReportDesignWidget::Page; showDefaultEditors(); + showDefaultToolBars(); } void ReportDesignWindow::writePosition() @@ -1048,6 +1062,7 @@ void ReportDesignWindow::slotLoadReport() setWindowTitle(m_reportDesignWidget->report()->reportName() + " - Lime Report Designer"); addRecentFile(fileName); m_editorTabType = ReportDesignWidget::Page; + showDefaultToolBars(); showDefaultEditors(); } } @@ -1215,6 +1230,14 @@ void ReportDesignWindow::updateAvaibleBands(){ } } +void ReportDesignWindow::showDefaultToolBars(){ + foreach (QToolBar* tb, m_pageTools){ + tb->setVisible(m_editorTabType != ReportDesignWidget::Dialog); + } + foreach (QToolBar* tb, m_dialogTools){ + tb->setVisible(m_editorTabType == ReportDesignWidget::Dialog); + } +} void ReportDesignWindow::showDefaultEditors(){ foreach (QDockWidget* w, m_pageEditors) { @@ -1248,12 +1271,14 @@ void ReportDesignWindow::slotActivePageChanged() restoreState(m_dialogEditorsState); else showDefaultEditors(); + showDefaultToolBars(); break; default: if (!m_pageEditors.isEmpty()) restoreState(m_pageEditorsState); else showDefaultEditors(); + showDefaultToolBars(); break; } diff --git a/limereport/lrreportdesignwindow.h b/limereport/lrreportdesignwindow.h index ec37638..0abe16c 100644 --- a/limereport/lrreportdesignwindow.h +++ b/limereport/lrreportdesignwindow.h @@ -144,6 +144,7 @@ private: void createDialogActionEditor(); void createDialogResourceEditor(); void createDialogSignalSlotEditor(); + void createDialogDesignerToolBar(); #endif void updateRedoUndo(); void updateAvaibleBands(); @@ -154,6 +155,7 @@ private: void removeNotExistedRecentFiles(); void removeNotExistedRecentFilesFromMenu(const QString& fileName); void addRecentFile(const QString& fileName); + void showDefaultToolBars(); void showDefaultEditors(); private: static ReportDesignWindow* m_instance; @@ -162,6 +164,9 @@ private: QToolBar* m_fontToolBar; QToolBar* m_reportToolBar; QToolBar* m_alignToolBar; +#ifdef HAVE_QTDESIGNER_INTEGRATION + QToolBar* m_dialogDesignerToolBar; +#endif QToolButton* m_newBandButton; QMenuBar* m_mainMenu; QMenu* m_fileMenu; @@ -249,6 +254,8 @@ private: ReportDesignWidget::EditorTabType m_editorTabType; QByteArray m_pageEditorsState; QByteArray m_dialogEditorsState; + QVector m_pageTools; + QVector m_dialogTools; }; diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index 613b4dc..b57ea88 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -1067,6 +1067,17 @@ void ScriptEngineContext::addDialog(const QString& name, const QByteArray& descr m_dialogs.push_back(DialogDescriber::create(name,description)); } +bool ScriptEngineContext::changeDialog(const QString& name, const QByteArray& description) +{ + foreach( DialogDescriber::Ptr describer, m_dialogs){ + if (describer->name().compare(name) == 0){ + describer->setDescription(description); + return true; + } + } + return false; +} + bool ScriptEngineContext::previewDialog(const QString& dialogName) { QDialog* dialog = getDialog(dialogName); diff --git a/limereport/lrscriptenginemanager.h b/limereport/lrscriptenginemanager.h index 36ecda2..af97b63 100644 --- a/limereport/lrscriptenginemanager.h +++ b/limereport/lrscriptenginemanager.h @@ -144,7 +144,8 @@ public: #endif explicit ScriptEngineContext(QObject* parent=0):QObject(parent){} #ifdef HAVE_UI_LOADER - void addDialog(const QString& name, const QByteArray &description); + void addDialog(const QString& name, const QByteArray& description); + bool changeDialog(const QString& name, const QByteArray &description); bool previewDialog(const QString& dialogName); bool containsDialog(const QString& dialogName); const QVector& dialogDescribers(){return m_dialogs;} From 7b04b6efcac7d8140c0755cb60207d2ccf3da205 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 14 Apr 2017 02:43:34 +0300 Subject: [PATCH 095/136] Dialog Designer intergration has been finished --- limereport/dialogdesigner/dialogdesigner.qrc | 3 + .../dialogdesigner/lrdialogdesigner.cpp | 161 +++++++++++++++--- limereport/dialogdesigner/lrdialogdesigner.h | 43 ++++- limereport/dialogdesigner/templates/Dialog.ui | 18 ++ limereport/images/addDialog.png | Bin 0 -> 332 bytes limereport/images/deleteDialog.png | Bin 0 -> 245 bytes limereport/lrreportdesignwidget.cpp | 161 ++++++++++++++---- limereport/lrreportdesignwidget.h | 24 ++- limereport/lrreportdesignwindow.cpp | 40 ++++- limereport/lrreportdesignwindow.h | 8 + limereport/lrscriptenginemanager.cpp | 49 ++++++ limereport/lrscriptenginemanager.h | 6 + limereport/report.qrc | 2 + limereport/scriptbrowser/lrscriptbrowser.cpp | 8 +- limereport/scriptbrowser/lrscriptbrowser.h | 1 + 15 files changed, 448 insertions(+), 76 deletions(-) create mode 100644 limereport/dialogdesigner/templates/Dialog.ui create mode 100644 limereport/images/addDialog.png create mode 100644 limereport/images/deleteDialog.png diff --git a/limereport/dialogdesigner/dialogdesigner.qrc b/limereport/dialogdesigner/dialogdesigner.qrc index 67c62fb..3911131 100644 --- a/limereport/dialogdesigner/dialogdesigner.qrc +++ b/limereport/dialogdesigner/dialogdesigner.qrc @@ -6,4 +6,7 @@ images/tabordertool.png images/widgettool.png + + templates/Dialog.ui + diff --git a/limereport/dialogdesigner/lrdialogdesigner.cpp b/limereport/dialogdesigner/lrdialogdesigner.cpp index 643cf50..e71fb78 100644 --- a/limereport/dialogdesigner/lrdialogdesigner.cpp +++ b/limereport/dialogdesigner/lrdialogdesigner.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include "pluginmanager_p.h" //#include @@ -25,14 +26,14 @@ namespace LimeReport{ -DialogDesigner::DialogDesigner(QObject *parent) : QObject(parent) +DialogDesignerManager::DialogDesignerManager(QObject *parent) : QObject(parent) { QDesignerComponents::initializeResources(); m_formEditor = QDesignerComponents::createFormEditor(this); QDesignerComponents::initializePlugins(m_formEditor); QDesignerComponents::createTaskMenu(m_formEditor, this); - m_editWidgetsAction = new QAction(tr("Edit Widgets")); + m_editWidgetsAction = new QAction(tr("Edit Widgets"), this); m_editWidgetsAction->setIcon(QIcon(":/images/images/widgettool.png")); m_editWidgetsAction->setEnabled(false); connect(m_editWidgetsAction, SIGNAL(triggered()), this, SLOT(slotEditWidgets())); @@ -102,7 +103,7 @@ DialogDesigner::DialogDesigner(QObject *parent) : QObject(parent) } -DialogDesigner::~DialogDesigner() +DialogDesignerManager::~DialogDesignerManager() { for (int i = 0; isetIconSize(QSize(16,16)); + m_formEditor->formWindowManager()->actionCopy()->setIcon(QIcon(":/report/images/copy")); tb->addAction(m_formEditor->formWindowManager()->actionCopy()); + m_formEditor->formWindowManager()->actionPaste()->setIcon(QIcon(":/report/images/paste")); tb->addAction(m_formEditor->formWindowManager()->actionPaste()); + m_formEditor->formWindowManager()->actionCut()->setIcon(QIcon(":/report/images/cut")); tb->addAction(m_formEditor->formWindowManager()->actionCut()); + m_formEditor->formWindowManager()->actionUndo()->setIcon(QIcon(":/report/images/undo")); tb->addAction(m_formEditor->formWindowManager()->actionUndo()); + m_formEditor->formWindowManager()->actionRedo()->setIcon(QIcon(":/report/images/redo")); tb->addAction(m_formEditor->formWindowManager()->actionRedo()); tb->addActions(m_modes->actions()); @@ -135,7 +141,7 @@ void DialogDesigner::initToolBar(QToolBar *tb) tb->addAction(m_formEditor->formWindowManager()->actionAdjustSize()); } -QWidget *DialogDesigner::createFormEditor(const QString &content) +QWidget *DialogDesignerManager::createFormEditor(const QString &content) { QDesignerFormWindowInterface* wnd = m_formEditor->formWindowManager()->createFormWindow(0, Qt::Window); wnd->setContents(content); @@ -143,25 +149,32 @@ QWidget *DialogDesigner::createFormEditor(const QString &content) m_formEditor->objectInspector()->setFormWindow(wnd); wnd->editWidgets(); - connect(wnd, SIGNAL(changed()), this, SIGNAL(dialogChanged())); + DialogDesigner* dialogDesigner = new DialogDesigner(wnd, m_formEditor); - SharedTools::WidgetHost *placeholder = new SharedTools::WidgetHost(0,wnd); - placeholder->setFrameStyle( QFrame::NoFrame | QFrame::Plain ); - placeholder->setFocusProxy( wnd ); + connect(dialogDesigner, SIGNAL(dialogChanged()), this, SLOT(slotDialogChanged())); + connect(dialogDesigner, SIGNAL(dialogNameChanged(QString,QString)), this, SIGNAL(dialogNameChanged(QString,QString))); + connect(dialogDesigner, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*))); + + m_dialogDesigners.append(dialogDesigner); + + return dialogDesigner; - return placeholder; } -QByteArray DialogDesigner::getDialogDescription(QWidget *form) +QByteArray DialogDesignerManager::getDialogDescription(QWidget *form) { - SharedTools::WidgetHost* wh = dynamic_cast(form); - if (wh){ - return wh->formWindow()->contents().toUtf8(); + QByteArray result; + DialogDesigner* dialogDesigner = dynamic_cast(form); + Q_ASSERT(dialogDesigner != NULL); + //SharedTools::WidgetHost* wh = dynamic_cast(form); + if (dialogDesigner){ + result = dialogDesigner->dialogContent(); + //wh->formWindow()->setDirty(false); } - return QByteArray(); + return result; } -void DialogDesigner::setActiveEditor(QWidget *widget) +void DialogDesignerManager::setActiveEditor(QWidget *widget) { SharedTools::WidgetHost* wh = dynamic_cast(widget); if (wh){ @@ -169,52 +182,70 @@ void DialogDesigner::setActiveEditor(QWidget *widget) } } -QWidget* DialogDesigner::widgetBox() const +void DialogDesignerManager::setDirty(bool value) +{ + foreach(DialogDesigner* dialogDesigner, m_dialogDesigners){ + dialogDesigner->setChanged(value); + } +} + +QWidget* DialogDesignerManager::widgetBox() const { return m_widgetBox; } -QWidget* DialogDesigner::actionEditor() const +QWidget* DialogDesignerManager::actionEditor() const { return m_actionEditor; } -QWidget* DialogDesigner::propertyEditor() const +QWidget* DialogDesignerManager::propertyEditor() const { return m_propertyEditor; } -QWidget* DialogDesigner::objectInspector() const +QWidget* DialogDesignerManager::objectInspector() const { return m_objectInspector; } -QWidget *DialogDesigner::signalSlotEditor() const +QWidget *DialogDesignerManager::signalSlotEditor() const { return m_signalSlotEditor; } -QWidget *DialogDesigner::resourcesEditor() const +QWidget *DialogDesignerManager::resourcesEditor() const { return m_resourcesEditor; } -void DialogDesigner::slotObjectDestroyed(QObject *object) +void DialogDesignerManager::slotObjectDestroyed(QObject* object) { + + QList::Iterator it = m_dialogDesigners.begin(); + while(it!=m_dialogDesigners.end()){ + if (*it == object){ + it = m_dialogDesigners.erase(it); + return; + } else { + ++it; + } + } + for ( int i = 0; iformWindowManager()->formWindowCount(); ++i){ m_formEditor->formWindowManager()->formWindow(i)->editWidgets(); } } -void DialogDesigner::slotActiveFormWindowChanged(QDesignerFormWindowInterface *formWindow) +void DialogDesignerManager::slotActiveFormWindowChanged(QDesignerFormWindowInterface *formWindow) { if (formWindow){ m_editWidgetsAction->setEnabled(true); @@ -222,7 +253,15 @@ void DialogDesigner::slotActiveFormWindowChanged(QDesignerFormWindowInterface *f } } -QString DialogDesigner::iconPathByName(const QString &name) +void DialogDesignerManager::slotDialogChanged() +{ + DialogDesigner* dialogDesigner = dynamic_cast(sender()); + if (dialogDesigner){ + emit dialogChanged(dialogDesigner->dialogName()); + } +} + +QString DialogDesignerManager::iconPathByName(const QString &name) { if (name.compare("__qt_edit_signals_slots_action") == 0) return ":/images/images/signalslottool.png"; @@ -233,4 +272,74 @@ QString DialogDesigner::iconPathByName(const QString &name) return ""; } +DialogDesigner::DialogDesigner(QDesignerFormWindowInterface* wnd, QDesignerFormEditorInterface* formEditor, QWidget *parent, Qt::WindowFlags flags) + :QWidget(parent, flags), m_formEditor(formEditor) +{ + m_dialogName = wnd->mainContainer()->objectName(); + connect(wnd, SIGNAL(changed()), this, SIGNAL(dialogChanged())); + connect(wnd->mainContainer(), SIGNAL(objectNameChanged(QString)), this, SLOT(slotMainContainerNameChanged(QString))); + + m_designerHolder = new SharedTools::WidgetHost(this,wnd); + m_designerHolder->setFrameStyle( QFrame::NoFrame | QFrame::Plain ); + m_designerHolder->setFocusProxy( wnd ); + + QVBoxLayout* l = new QVBoxLayout(this); + l->addWidget(m_designerHolder); + setLayout(l); + +} + +DialogDesigner::~DialogDesigner(){} + +QString DialogDesigner::dialogName() const +{ + return m_dialogName; +} + +void DialogDesigner::setDialogName(const QString &dialogName) +{ + m_dialogName = dialogName; +} + +bool DialogDesigner::isChanged() +{ + return m_designerHolder->formWindow()->isDirty(); +} + +void DialogDesigner::setChanged(bool value) +{ + m_designerHolder->formWindow()->setDirty(false); +} + +QByteArray DialogDesigner::dialogContent() +{ + if (m_designerHolder && m_designerHolder->formWindow()) + return m_designerHolder->formWindow()->contents().toUtf8(); + return QByteArray(); +} + +void DialogDesigner::undo() +{ + Q_ASSERT(m_formEditor != NULL); + if (m_formEditor){ + m_formEditor->formWindowManager()->actionUndo()->trigger(); + } +} + +void DialogDesigner::redo() +{ + Q_ASSERT(m_formEditor != NULL); + if (m_formEditor){ + m_formEditor->formWindowManager()->actionRedo()->trigger(); + } +} + +void DialogDesigner::slotMainContainerNameChanged(QString newName) +{ + if (m_dialogName.compare(newName) != 0){ + emit dialogNameChanged(m_dialogName, newName); + m_dialogName = newName; + } +} + } diff --git a/limereport/dialogdesigner/lrdialogdesigner.h b/limereport/dialogdesigner/lrdialogdesigner.h index bebc4dd..8a0bfbe 100644 --- a/limereport/dialogdesigner/lrdialogdesigner.h +++ b/limereport/dialogdesigner/lrdialogdesigner.h @@ -14,18 +14,48 @@ class QDesignerPropertyEditorInterface; class QDesignerObjectInspectorInterface; class QDesignerFormWindowManagerInterface; +namespace SharedTools{ + class WidgetHost; +} + namespace LimeReport{ -class DialogDesigner : public QObject +class DialogDesigner : public QWidget{ + Q_OBJECT +public: + DialogDesigner(QDesignerFormWindowInterface *wnd, QDesignerFormEditorInterface* formEditor, QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags()); + ~DialogDesigner(); + QString dialogName() const; + void setDialogName(const QString &dialogName); + bool isChanged(); + void setChanged(bool value); + QByteArray dialogContent(); +public slots: + void undo(); + void redo(); +signals: + void dialogChanged(); + void dialogNameChanged(QString oldName, QString newName); + +private slots: + void slotMainContainerNameChanged(QString newName); +private: + QString m_dialogName; + SharedTools::WidgetHost* m_designerHolder; + QDesignerFormEditorInterface* m_formEditor; +}; + +class DialogDesignerManager : public QObject { Q_OBJECT public: - explicit DialogDesigner(QObject *parent = 0); - ~DialogDesigner(); + explicit DialogDesignerManager(QObject *parent = 0); + ~DialogDesignerManager(); void initToolBar(QToolBar* tb); QWidget* createFormEditor(const QString& content); QByteArray getDialogDescription(QWidget* form); - void setActiveEditor(QWidget* widget); + void setActiveEditor(QWidget* widget); + void setDirty(bool value); QWidget* widgetBox() const; QWidget* actionEditor() const; QWidget* propertyEditor() const; @@ -33,11 +63,13 @@ public: QWidget* signalSlotEditor() const; QWidget* resourcesEditor() const; signals: - void dialogChanged(); + void dialogChanged(QString dialogName); + void dialogNameChanged(QString oldName, QString newName); private slots: void slotObjectDestroyed(QObject* object); void slotEditWidgets(); void slotActiveFormWindowChanged(QDesignerFormWindowInterface *formWindow); + void slotDialogChanged(); private: QString iconPathByName(const QString& name); private: @@ -53,6 +85,7 @@ private: QAction* m_editWidgetsAction; QActionGroup* m_modes; QString m_activeWindowName; + QList m_dialogDesigners; }; } // namespace LimeReport diff --git a/limereport/dialogdesigner/templates/Dialog.ui b/limereport/dialogdesigner/templates/Dialog.ui new file mode 100644 index 0000000..6eb9e5f --- /dev/null +++ b/limereport/dialogdesigner/templates/Dialog.ui @@ -0,0 +1,18 @@ + + $ClassName$ + + + + 0 + 0 + 400 + 300 + + + + $ClassName$ + + + + + diff --git a/limereport/images/addDialog.png b/limereport/images/addDialog.png new file mode 100644 index 0000000000000000000000000000000000000000..6023700b8d477a8a22e12ced91acbe37d7b7c821 GIT binary patch literal 332 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE(~4_RSXVCc7-eQ3-~9PMKdqdXAw7lL{z#FW zgy`I6?(_OFj6L<7A@^L(+wzzhzRr>Hv6|_;`sKgH7f$o6yVkn8^rG5Ht`3{rug4Zu z<$32h)Zgjj>f}~E$+#xHJ*iQ`daGY_=VGaA_l1{~zMpt{S0KaI3s3aEpSamKC%f?^ zci6-O$E>B!otW18{Br5+&e;k%doMp%Obb*kyu7cqW|7pDi9s)f8t?x3^R+(U=k~w3 aHVhIP!I}+!P0s*5$>8bg=d#Wzp$PzZS%Jj> literal 0 HcmV?d00001 diff --git a/limereport/images/deleteDialog.png b/limereport/images/deleteDialog.png new file mode 100644 index 0000000000000000000000000000000000000000..53914900832bdccb2912a5c7fdb17c0db523f10b GIT binary patch literal 245 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE(~4_RSXVCc7-p*!14`y0f=d z9BA`TymgiR1~1T@1cUl-JnMDUmoDL`YV6I?Hvj^e>C=)De)&5({0PnZuP%B(=zf6* f`-{xkAq))p?}JZWvQW4KbPa>2tDnm{r-UW|gbz>v literal 0 HcmV?d00001 diff --git a/limereport/lrreportdesignwidget.cpp b/limereport/lrreportdesignwidget.cpp index 97621ab..ec1332c 100644 --- a/limereport/lrreportdesignwidget.cpp +++ b/limereport/lrreportdesignwidget.cpp @@ -50,9 +50,9 @@ namespace LimeReport { ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow *mainWindow, QWidget *parent) : QWidget(parent), #ifdef HAVE_QTDESIGNER_INTEGRATION - m_dialogDesigner(new DialogDesigner(this)), + m_dialogDesignerManager(new DialogDesignerManager(this)), #endif - m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false) + m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false), m_dialogChanged(false) { m_tabWidget = new QTabWidget(this); m_tabWidget->setTabPosition(QTabWidget::South); @@ -75,6 +75,7 @@ ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow connect(m_report,SIGNAL(pagesLoadFinished()),this,SLOT(slotPagesLoadFinished())); connect(m_report,SIGNAL(cleared()),this,SIGNAL(cleared())); connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentTabChanged(int))); + connect(m_report->scriptContext(), SIGNAL(dialogDeleted(QString)), this, SLOT(slotDialogDeleted(QString))); m_scriptEditor->setPlainText(report->scriptContext()->initScript()); m_zoomer = new GraphicsViewZoomer(activeView()); @@ -84,35 +85,49 @@ ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow #endif #ifdef HAVE_QTDESIGNER_INTEGRATION - connect(m_dialogDesigner, SIGNAL(dialogChanged()), this, SLOT(slotDialogChanged())); + connect(m_dialogDesignerManager, SIGNAL(dialogChanged(QString)), + this, SLOT(slotDialogChanged(QString))); + connect(m_dialogDesignerManager, SIGNAL(dialogNameChanged(QString,QString)), + this, SLOT(slotDialogNameChanged(QString,QString))); #endif } -DialogDesigner *ReportDesignWidget::dialogDesigner() const +#ifdef HAVE_QTDESIGNER_INTEGRATION +DialogDesignerManager *ReportDesignWidget::dialogDesignerManager() const { - return m_dialogDesigner; + return m_dialogDesignerManager; } +QString ReportDesignWidget::activeDialogName() +{ + if (activeDialogPage()) + return activeDialogPage()->dialogName(); + return ""; +} + + QWidget *ReportDesignWidget::toolWindow(ReportDesignWidget::ToolWindowType windowType) { switch (windowType) { case WidgetBox: - return dialogDesigner()->widgetBox(); + return dialogDesignerManager()->widgetBox(); case PropertyEditor: - return dialogDesigner()->propertyEditor(); + return dialogDesignerManager()->propertyEditor(); case ObjectInspector: - return dialogDesigner()->objectInspector(); + return dialogDesignerManager()->objectInspector(); case ActionEditor: - return dialogDesigner()->actionEditor(); + return dialogDesignerManager()->actionEditor(); case ResourceEditor: - return dialogDesigner()->resourcesEditor(); + return dialogDesignerManager()->resourcesEditor(); case SignalSlotEditor: - return dialogDesigner()->signalSlotEditor(); + return dialogDesignerManager()->signalSlotEditor(); default: return 0; } } +#endif + ReportDesignWidget::EditorTabType ReportDesignWidget::activeTabType() { QString tabType = m_tabWidget->tabWhatsThis(m_tabWidget->currentIndex()); @@ -121,20 +136,24 @@ ReportDesignWidget::EditorTabType ReportDesignWidget::activeTabType() return Page; } +#ifdef HAVE_QTDESIGNER_INTEGRATION + void ReportDesignWidget::initDialogDesignerToolBar(QToolBar *toolBar) { - m_dialogDesigner->initToolBar(toolBar); + m_dialogDesignerManager->initToolBar(toolBar); } void ReportDesignWidget::updateDialogs() { for ( int i = 0; icount(); ++i ){ if (m_tabWidget->tabWhatsThis(i).compare("dialog") == 0){ - m_report->scriptContext()->changeDialog(m_tabWidget->tabText(i), m_dialogDesigner->getDialogDescription(m_tabWidget->widget(i))); + m_report->scriptContext()->changeDialog(m_tabWidget->tabText(i), m_dialogDesignerManager->getDialogDescription(m_tabWidget->widget(i))); } } } +#endif + bool ReportDesignWidget::useMagnet() const { return m_useMagnet; @@ -210,21 +229,38 @@ void ReportDesignWidget::createTabs(){ pageIndex = m_tabWidget->addTab(view,QIcon(),m_report->pageAt(i)->pageItem()->objectName()); m_tabWidget->setTabWhatsThis(pageIndex, "page"); } -#ifdef HAVE_QTDESIGNER_INTEGRATION - QWidget* dialogEditor; - foreach(DialogDescriber::Ptr dialogDesc, m_report->scriptContext()->dialogDescribers()){ - dialogEditor = m_dialogDesigner->createFormEditor(dialogDesc->description()); - pageIndex = m_tabWidget->addTab(dialogEditor,QIcon(),dialogDesc->name()); - m_tabWidget->setTabWhatsThis(pageIndex,"dialog"); - } -#endif + m_scriptEditor = new QTextEdit(this); pageIndex = m_tabWidget->addTab(m_scriptEditor,QIcon(),tr("Script")); m_tabWidget->setTabWhatsThis(pageIndex,"script"); m_tabWidget->setCurrentIndex(0); +#ifdef HAVE_QTDESIGNER_INTEGRATION + QWidget* dialogDesigner; + foreach(DialogDescriber::Ptr dialogDesc, m_report->scriptContext()->dialogDescribers()){ + dialogDesigner = m_dialogDesignerManager->createFormEditor(dialogDesc->description()); + pageIndex = m_tabWidget->addTab(dialogDesigner,QIcon(),dialogDesc->name()); + m_tabWidget->setTabWhatsThis(pageIndex,"dialog"); + + } +#endif + } +#ifdef HAVE_QTDESIGNER_INTEGRATION +void ReportDesignWidget::createNewDialogTab(const QString& dialogName, const QByteArray& description) +{ + QWidget* dialogDesigner = m_dialogDesignerManager->createFormEditor(description); + int pageIndex = m_tabWidget->addTab(dialogDesigner,QIcon(),dialogName); + m_tabWidget->setTabWhatsThis(pageIndex,"dialog"); +} + +DialogDesigner*ReportDesignWidget::activeDialogPage() +{ + return dynamic_cast(m_tabWidget->currentWidget()); +} +#endif + ReportDesignWidget::~ReportDesignWidget() { delete m_zoomer; @@ -301,6 +337,8 @@ PageDesignIntf * ReportDesignWidget::activePage() return 0; } + + QList ReportDesignWidget::selectedItems(){ return activePage()->selectedItems(); } @@ -321,16 +359,26 @@ void ReportDesignWidget::slotItemSelected(BaseDesignIntf *item){ emit itemSelected(item); } -void ReportDesignWidget::saveToFile(const QString &fileName){ +bool ReportDesignWidget::saveToFile(const QString &fileName){ + bool result = false; m_report->scriptContext()->setInitScript(m_scriptEditor->toPlainText()); #ifdef HAVE_QTDESIGNER_INTEGRATION updateDialogs(); #endif if (m_report->saveToFile(fileName)) { - m_report->emitSaveFinished(); + m_report->emitSaveFinished(); + result = true; } + +#ifdef HAVE_QTDESIGNER_INTEGRATION + if (result){ + m_dialogChanged = false; + m_dialogDesignerManager->setDirty(false); + } +#endif + return result; } bool ReportDesignWidget::save() @@ -340,24 +388,32 @@ bool ReportDesignWidget::save() updateDialogs(); #endif + bool result = false; + if (!m_report->reportFileName().isEmpty()){ if (m_report->saveToFile()){ m_report->emitSaveFinished(); - return true; + result = true; } } else { m_report->emitSaveReport(); if (m_report->isSaved()) { m_report->emitSaveFinished(); - return true; + result = true; } - if (m_report->saveToFile(QFileDialog::getSaveFileName(this,tr("Report file name"),"","Report files (*.lrxml);; All files (*)"))){ + else if (m_report->saveToFile(QFileDialog::getSaveFileName(this,tr("Report file name"),"","Report files (*.lrxml);; All files (*)"))){ m_report->emitSaveFinished(); - return true; + result = true; }; } - return false; +#ifdef HAVE_QTDESIGNER_INTEGRATION + if (result){ + m_dialogChanged = false; + m_dialogDesignerManager->setDirty(false); + } +#endif + return result; } bool ReportDesignWidget::loadFromFile(const QString &fileName) @@ -367,6 +423,7 @@ bool ReportDesignWidget::loadFromFile(const QString &fileName) //connectPage(m_report->pageAt(0)); m_scriptEditor->setPlainText(m_report->scriptContext()->initScript()); emit loaded(); + m_dialogChanged = false; return true; } else { QMessageBox::critical(this,tr("Error"),tr("Wrong file format")); @@ -390,7 +447,7 @@ QString ReportDesignWidget::reportFileName() bool ReportDesignWidget::isNeedToSave() { if(m_report) - return m_report->isNeedToSave(); + return (m_report->isNeedToSave() || m_dialogChanged); return false; } @@ -409,12 +466,20 @@ void ReportDesignWidget::undo() { if (activePage()) activePage()->undo(); +#ifdef HAVE_QTDESIGNER_INTEGRATION + if (activeDialogPage()) + activeDialogPage()->undo(); +#endif } void ReportDesignWidget::redo() { if (activePage()) activePage()->redo(); +#ifdef HAVE_QTDESIGNER_INTEGRATION + if (activeDialogPage()) + activeDialogPage()->redo(); +#endif } void ReportDesignWidget::copy() @@ -667,6 +732,16 @@ void ReportDesignWidget::slotPagesLoadFinished() emit loaded(); } +void ReportDesignWidget::slotDialogDeleted(QString dialogName) +{ + for (int i = 0; icount(); ++i ){ + if (m_tabWidget->tabText(i).compare(dialogName) == 0){ + delete m_tabWidget->widget(i); + break; + } + } +} + void ReportDesignWidget::slotDatasourceCollectionLoaded(const QString & /*collectionName*/) { } @@ -685,16 +760,40 @@ void ReportDesignWidget::slotCurrentTabChanged(int index) } m_zoomer->setView(view); } +#ifdef HAVE_QTDESIGNER_INTEGRATION if (activeTabType() == Dialog){ - m_dialogDesigner->setActiveEditor(m_tabWidget->widget(index)); + m_dialogDesignerManager->setActiveEditor(m_tabWidget->widget(index)); } + updateDialogs(); +#endif emit activePageChanged(); } #ifdef HAVE_QTDESIGNER_INTEGRATION -void ReportDesignWidget::slotDialogChanged() +void ReportDesignWidget::addNewDialog() { + QFile templateUi(":/templates/templates/Dialog.ui"); + templateUi.open(QIODevice::ReadOnly|QIODevice::Text); + QString templateStr = templateUi.readAll(); + QString dialogName = m_report->scriptContext()->getNewDialogName(); + templateStr.replace("$ClassName$", dialogName); + m_report->scriptContext()->addDialog(dialogName,templateStr.toUtf8()); + createNewDialogTab(dialogName, templateStr.toUtf8()); +} + +void ReportDesignWidget::slotDialogChanged(QString ) +{ + m_dialogChanged = true; +} + +void ReportDesignWidget::slotDialogNameChanged(QString oldName, QString newName) +{ + for (int i = 0; i < m_tabWidget->count(); ++i){ + if (m_tabWidget->tabText(i).compare(oldName) == 0) + m_tabWidget->setTabText(i, newName); + } + m_report->scriptContext()->changeDialogName(oldName, newName); } #endif diff --git a/limereport/lrreportdesignwidget.h b/limereport/lrreportdesignwidget.h index ee6a157..455b685 100644 --- a/limereport/lrreportdesignwidget.h +++ b/limereport/lrreportdesignwidget.h @@ -48,6 +48,7 @@ namespace LimeReport { class ReportEnginePrivate; class DataBrowser; class ReportDesignWindow; +class DialogDesignerManager; class DialogDesigner; class ReportDesignWidget : public QWidget @@ -100,15 +101,17 @@ public: bool useGrid(){ return m_useGrid;} bool useMagnet() const; void setUseMagnet(bool useMagnet); - DialogDesigner *dialogDesigner() const; - QWidget* toolWindow(ToolWindowType windowType); EditorTabType activeTabType(); #ifdef HAVE_QTDESIGNER_INTEGRATION void initDialogDesignerToolBar(QToolBar* toolBar); void updateDialogs(); + DialogDesignerManager *dialogDesignerManager() const; + QString activeDialogName(); + DialogDesigner* activeDialogPage(); + QWidget* toolWindow(ToolWindowType windowType); #endif public slots: - void saveToFile(const QString&); + bool saveToFile(const QString&); bool save(); bool loadFromFile(const QString&); void deleteSelectedItems(); @@ -140,6 +143,10 @@ public slots: void addPage(); void deleteCurrentPage(); void slotPagesLoadFinished(); + void slotDialogDeleted(QString dialogName); +#ifdef HAVE_QTDESIGNER_INTEGRATION + void addNewDialog(); +#endif private slots: void slotItemSelected(LimeReport::BaseDesignIntf *item); void slotSelectionChanged(); @@ -147,7 +154,8 @@ private slots: void slotSceneRectChanged(QRectF); void slotCurrentTabChanged(int index); #ifdef HAVE_QTDESIGNER_INTEGRATION - void slotDialogChanged(); + void slotDialogChanged(QString); + void slotDialogNameChanged(QString oldName, QString newName); #endif signals: void insertModeStarted(); @@ -169,13 +177,18 @@ signals: void pageDeleted(); protected: void createTabs(); +#ifdef HAVE_QTDESIGNER_INTEGRATION + void createNewDialogTab(const QString& dialogName,const QByteArray& description); +#endif private: bool eventFilter(QObject *target, QEvent *event); private: ReportEnginePrivate* m_report; QGraphicsView *m_view; QTextEdit* m_scriptEditor; - DialogDesigner* m_dialogDesigner; +#ifdef HAVE_QTDESIGNER_INTEGRATION + DialogDesignerManager* m_dialogDesignerManager; +#endif QMainWindow *m_mainWindow; QTabWidget* m_tabWidget; GraphicsViewZoomer* m_zoomer; @@ -184,6 +197,7 @@ private: int m_horizontalGridStep; bool m_useGrid; bool m_useMagnet; + bool m_dialogChanged; }; } diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index febddfd..b2df5a1 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -211,11 +211,6 @@ void ReportDesignWindow::createActions() m_testAction->setIcon(QIcon(":/report/images/pin")); connect(m_testAction,SIGNAL(triggered()),this,SLOT(slotTest())); -// m_printReportAction = new QAction(tr("Print Report"),this); -// m_printReportAction->setIcon(QIcon(":/report/images/print")); -// m_printReportAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_P)); -// connect(m_printReportAction,SIGNAL(triggered()),this,SLOT(slotPrintReport())); - m_editLayoutMode = new QAction(tr("Edit layouts mode"),this); m_editLayoutMode->setIcon(QIcon(":/report/images/editlayout")); m_editLayoutMode->setCheckable(true); @@ -231,15 +226,22 @@ void ReportDesignWindow::createActions() m_hideLeftPanel = new QAction(tr("Hide left panel"),this); m_hideLeftPanel->setCheckable(true); -// m_hideLeftPanel->setChecked(true); m_hideLeftPanel->setIcon(QIcon(":/report/images/hideLeftPanel")); connect(m_hideLeftPanel,SIGNAL(toggled(bool)), this, SLOT(slotHideLeftPanel(bool))); m_hideRightPanel = new QAction(tr("Hide right panel"),this); m_hideRightPanel->setCheckable(true); -// m_hideRightPanel->setChecked(true); m_hideRightPanel->setIcon(QIcon(":/report/images/hideRightPanel")); connect(m_hideRightPanel,SIGNAL(toggled(bool)), this, SLOT(slotHideRightPanel(bool))); +#ifdef HAVE_QTDESIGNER_INTEGRATION + m_deleteDialogAction = new QAction(tr("Delete dialog"), this); + m_deleteDialogAction->setIcon(QIcon(":/report//images/deleteDialog")); + connect(m_deleteDialogAction, SIGNAL(triggered()), this, SLOT(slotDeleteDialog())); + + m_addNewDialogAction = new QAction(tr("Add new dialog"), this); + m_addNewDialogAction->setIcon(QIcon(":/report//images/addDialog")); + connect(m_addNewDialogAction, SIGNAL(triggered()), this, SLOT(slotAddNewDialog())); +#endif } void ReportDesignWindow::createReportToolBar() @@ -252,7 +254,6 @@ void ReportDesignWindow::createReportToolBar() m_reportToolBar->setObjectName("reportTools"); createItemsActions(); m_reportToolBar->addSeparator(); - //m_reportToolBar->addAction(m_editLayoutMode); m_reportToolBar->addAction(m_addHLayout); m_reportToolBar->addSeparator(); m_reportToolBar->addAction(m_deleteItemAction); @@ -286,6 +287,9 @@ void ReportDesignWindow::createToolBars() m_mainToolBar->addAction(m_newPageAction); m_mainToolBar->addAction(m_deletePageAction); +#ifdef HAVE_QTDESIGNER_INTEGRATION + m_mainToolBar->addAction(m_addNewDialogAction); +#endif m_mainToolBar->addSeparator(); m_mainToolBar->addAction(m_copyAction); @@ -582,6 +586,11 @@ void ReportDesignWindow::createDialogDesignerToolBar() { m_dialogDesignerToolBar = addToolBar(tr("Dialog Designer Tools")); m_dialogDesignerToolBar->setObjectName("DialogDesignerTools"); + m_dialogDesignerToolBar->addAction(m_saveReportAction); + m_dialogDesignerToolBar->addAction(m_previewReportAction); + m_dialogDesignerToolBar->addSeparator(); + m_dialogDesignerToolBar->addAction(m_deleteDialogAction); + m_dialogDesignerToolBar->addSeparator(); m_reportDesignWidget->initDialogDesignerToolBar(m_dialogDesignerToolBar); m_dialogTools << m_dialogDesignerToolBar; } @@ -1257,6 +1266,7 @@ void ReportDesignWindow::slotActivePageChanged() switch (m_editorTabType) { case ReportDesignWidget::Dialog: m_dialogEditorsState = saveState(); + m_scriptBrowser->updateDialogsTree(); break; default: m_pageEditorsState = saveState(); @@ -1388,6 +1398,20 @@ void ReportDesignWindow::slotPageDeleted() m_deletePageAction->setEnabled(m_reportDesignWidget->report()->pageCount()>1); } +#ifdef HAVE_QTDESIGNER_INTEGRATION +void ReportDesignWindow::slotDeleteDialog() +{ + if ( m_editorTabType == ReportDesignWidget::Dialog ){ + m_reportDesignWidget->report()->scriptContext()->deleteDialog(m_reportDesignWidget->activeDialogName()); + } +} + +void ReportDesignWindow::slotAddNewDialog() +{ + m_reportDesignWidget->addNewDialog(); +} +#endif + void ReportDesignWindow::closeEvent(QCloseEvent * event) { if (checkNeedToSave()){ diff --git a/limereport/lrreportdesignwindow.h b/limereport/lrreportdesignwindow.h index 0abe16c..c3e2578 100644 --- a/limereport/lrreportdesignwindow.h +++ b/limereport/lrreportdesignwindow.h @@ -119,6 +119,10 @@ private slots: void slotLoadRecentFile(const QString fileName); void slotPageAdded(PageDesignIntf* ); void slotPageDeleted(); +#ifdef HAVE_QTDESIGNER_INTEGRATION + void slotDeleteDialog(); + void slotAddNewDialog(); +#endif protected: void closeEvent(QCloseEvent *event); void resizeEvent(QResizeEvent *); @@ -217,6 +221,10 @@ private: QAction* m_addHLayout; QAction* m_hideLeftPanel; QAction* m_hideRightPanel; +#ifdef HAVE_QTDESIGNER_INTEGRATION + QAction* m_deleteDialogAction; + QAction* m_addNewDialogAction; +#endif QMenu* m_recentFilesMenu; QSignalMapper* m_bandsAddSignalsMap; diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index b57ea88..785640a 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -1065,6 +1065,7 @@ void DialogDescriber::setDescription(const QByteArray &description) void ScriptEngineContext::addDialog(const QString& name, const QByteArray& description) { m_dialogs.push_back(DialogDescriber::create(name,description)); + emit dialogAdded(name); } bool ScriptEngineContext::changeDialog(const QString& name, const QByteArray& description) @@ -1072,6 +1073,37 @@ bool ScriptEngineContext::changeDialog(const QString& name, const QByteArray& de foreach( DialogDescriber::Ptr describer, m_dialogs){ if (describer->name().compare(name) == 0){ describer->setDescription(description); + { + QList::Iterator it = m_createdDialogs.begin(); + while(it!=m_createdDialogs.end()){ + if ((*it)->objectName()==name){ + it = m_createdDialogs.erase(it); + } else { + ++it; + } + } + } + return true; + } + } + return false; +} + +bool ScriptEngineContext::changeDialogName(const QString& oldName, const QString& newName) +{ + foreach( DialogDescriber::Ptr describer, m_dialogs){ + if (describer->name().compare(oldName) == 0){ + describer->setName(newName); + { + QList::Iterator it = m_createdDialogs.begin(); + while(it!=m_createdDialogs.end()){ + if ((*it)->objectName()==oldName){ + it = m_createdDialogs.erase(it); + } else { + ++it; + } + } + } return true; } } @@ -1106,6 +1138,7 @@ void ScriptEngineContext::deleteDialog(const QString& dialogName) while(it!=m_dialogs.end()){ if ((*it)->name()==dialogName){ it = m_dialogs.erase(it); + emit dialogDeleted(dialogName); } else { ++it; } @@ -1188,6 +1221,10 @@ QDialog* ScriptEngineContext::createDialog(DialogDescriber* cont) buffer.open(QIODevice::ReadOnly); QDialog* dialog = dynamic_cast(loader.load(&buffer)); m_createdDialogs.push_back(QSharedPointer(dialog)); + if (cont->name().compare(dialog->objectName())){ + cont->setName(dialog->objectName()); + emit dialogNameChanged(dialog->objectName()); + } return dialog; } @@ -1225,6 +1262,18 @@ QDialog* ScriptEngineContext::getDialog(const QString& dialogName) } return 0; } + +QString ScriptEngineContext::getNewDialogName() +{ + QString result = "Dialog"; + int index = m_dialogs.size() - 1; + while (containsDialog(result)){ + index++; + result = QString("Dialog%1").arg(index); + } + return result; +} + #endif QString ScriptEngineContext::initScript() const { diff --git a/limereport/lrscriptenginemanager.h b/limereport/lrscriptenginemanager.h index af97b63..235599a 100644 --- a/limereport/lrscriptenginemanager.h +++ b/limereport/lrscriptenginemanager.h @@ -146,15 +146,21 @@ public: #ifdef HAVE_UI_LOADER void addDialog(const QString& name, const QByteArray& description); bool changeDialog(const QString& name, const QByteArray &description); + bool changeDialogName(const QString& oldName, const QString& newName); bool previewDialog(const QString& dialogName); bool containsDialog(const QString& dialogName); const QVector& dialogDescribers(){return m_dialogs;} void deleteDialog(const QString& dialogName); QDialog *getDialog(const QString &dialogName); + QString getNewDialogName(); #endif void clear(); QString initScript() const; void setInitScript(const QString& initScript); +signals: + void dialogNameChanged(QString dialogName); + void dialogDeleted(QString dialogName); + void dialogAdded(QString dialogName); protected: QObject* createElement(const QString& collectionName,const QString& elementType); int elementsCount(const QString& collectionName); diff --git a/limereport/report.qrc b/limereport/report.qrc index 6548420..1e7c5d6 100644 --- a/limereport/report.qrc +++ b/limereport/report.qrc @@ -175,5 +175,7 @@ images/addBand2.png images/edit_control_4_24.png images/logo_32x32_1.png + images/addDialog.png + images/deleteDialog.png diff --git a/limereport/scriptbrowser/lrscriptbrowser.cpp b/limereport/scriptbrowser/lrscriptbrowser.cpp index 1bd052d..1ef6b73 100644 --- a/limereport/scriptbrowser/lrscriptbrowser.cpp +++ b/limereport/scriptbrowser/lrscriptbrowser.cpp @@ -59,6 +59,7 @@ void ScriptBrowser::setReportEditor(ReportDesignWidget* report) m_report=report; connect(m_report,SIGNAL(cleared()),this,SLOT(slotClear())); connect(m_report,SIGNAL(loaded()),this,SLOT(slotUpdate())); + connect(m_report->scriptContext(), SIGNAL(dialogAdded(QString)), this, SLOT(slotDialogAdded(QString))); updateFunctionTree(); } @@ -138,6 +139,11 @@ void ScriptBrowser::slotUpdate() updateFunctionTree(); } +void ScriptBrowser::slotDialogAdded(QString) +{ + updateDialogsTree(); +} + #ifdef HAVE_UI_LOADER void ScriptBrowser::on_tbAddDialog_clicked() { @@ -157,7 +163,7 @@ void ScriptBrowser::on_tbAddDialog_clicked() if (!m_report->scriptContext()->containsDialog(dialog->objectName())){ file.seek(0); m_report->scriptContext()->addDialog(dialog->objectName(),file.readAll()); - updateDialogsTree(); + //updateDialogsTree(); } else { QMessageBox::critical(this,tr("Error"),tr("Dialog with name: %1 already exists").arg(dialog->objectName())); } diff --git a/limereport/scriptbrowser/lrscriptbrowser.h b/limereport/scriptbrowser/lrscriptbrowser.h index 3214617..dd7d9ae 100644 --- a/limereport/scriptbrowser/lrscriptbrowser.h +++ b/limereport/scriptbrowser/lrscriptbrowser.h @@ -62,6 +62,7 @@ protected: private slots: void slotClear(); void slotUpdate(); + void slotDialogAdded(QString); #ifdef HAVE_UI_LOADER void on_tbAddDialog_clicked(); void on_tbRunDialog_clicked(); From 02a8ef8b5c760228aa4ead8e45a11ded3b067f3a Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 18 Apr 2017 20:00:59 +0300 Subject: [PATCH 096/136] Crash on destroy has been fixed --- .../dialogdesigner/lrdialogdesigner.cpp | 2 +- limereport/lrreportdesignwidget.cpp | 1 + limereport/lrreportdesignwindow.cpp | 63 +++++++++++-------- limereport/lrreportdesignwindow.h | 1 + 4 files changed, 40 insertions(+), 27 deletions(-) diff --git a/limereport/dialogdesigner/lrdialogdesigner.cpp b/limereport/dialogdesigner/lrdialogdesigner.cpp index e71fb78..6a33752 100644 --- a/limereport/dialogdesigner/lrdialogdesigner.cpp +++ b/limereport/dialogdesigner/lrdialogdesigner.cpp @@ -96,7 +96,7 @@ DialogDesignerManager::DialogDesignerManager(QObject *parent) : QObject(parent) m_actionEditor->setObjectName("ActionEditor"); m_formEditor->setActionEditor(m_actionEditor); m_designerToolWindows.append(m_actionEditor); - connect(m_formEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) ); + connect(m_actionEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) ); m_designerIntegration = new QDesignerIntegration(m_formEditor,this); m_formEditor->setIntegration(m_designerIntegration); diff --git a/limereport/lrreportdesignwidget.cpp b/limereport/lrreportdesignwidget.cpp index ec1332c..7c7c2bc 100644 --- a/limereport/lrreportdesignwidget.cpp +++ b/limereport/lrreportdesignwidget.cpp @@ -253,6 +253,7 @@ void ReportDesignWidget::createNewDialogTab(const QString& dialogName, const QBy QWidget* dialogDesigner = m_dialogDesignerManager->createFormEditor(description); int pageIndex = m_tabWidget->addTab(dialogDesigner,QIcon(),dialogName); m_tabWidget->setTabWhatsThis(pageIndex,"dialog"); + m_tabWidget->setCurrentIndex(pageIndex); } DialogDesigner*ReportDesignWidget::activeDialogPage() diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index b2df5a1..b44eff7 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -78,8 +78,8 @@ ReportDesignWindow::ReportDesignWindow(ReportEnginePrivate *report, QWidget *par createDialogPropertyEditor(); createDialogObjectInspector(); createDialogActionEditor(); - createDialogResourceEditor(); createDialogSignalSlotEditor(); + createDialogResourceEditor(); createDialogDesignerToolBar(); #endif m_instance=this; @@ -330,7 +330,9 @@ void ReportDesignWindow::createToolBars() createReportToolBar(); - m_pageTools << m_mainToolBar << m_reportToolBar << m_fontEditorBar << m_textAlignmentEditorBar << m_itemsBordersEditorBar; + m_pageTools << m_mainToolBar << m_reportToolBar << m_fontEditorBar + << m_textAlignmentEditorBar << m_itemsAlignmentEditorBar + << m_itemsBordersEditorBar; } @@ -544,42 +546,45 @@ void ReportDesignWindow::createDialogPropertyEditor() void ReportDesignWindow::createDialogObjectInspector() { - QDockWidget *doc = new QDockWidget(this); - doc->setWindowTitle(tr("Object Inspector")); - doc->setWidget(m_reportDesignWidget->toolWindow(ReportDesignWidget::ObjectInspector)); - doc->setObjectName("ObjectInspector"); - addDockWidget(Qt::RightDockWidgetArea,doc); - m_dialogEditors.append(doc); + QDockWidget *dock = new QDockWidget(this); + dock->setWindowTitle(tr("Object Inspector")); + dock->setWidget(m_reportDesignWidget->toolWindow(ReportDesignWidget::ObjectInspector)); + dock->setObjectName("ObjectInspector"); + addDockWidget(Qt::RightDockWidgetArea,dock); + m_dialogEditors.append(dock); } void ReportDesignWindow::createDialogActionEditor() { - QDockWidget *doc = new QDockWidget(this); - doc->setWindowTitle(tr("Action Editor")); - doc->setWidget(m_reportDesignWidget->toolWindow(ReportDesignWidget::ActionEditor)); - doc->setObjectName("ActionEditor"); - addDockWidget(Qt::BottomDockWidgetArea,doc); - m_dialogEditors.append(doc); + QDockWidget *dock = new QDockWidget(this); + dock->setWindowTitle(tr("Action Editor")); + dock->setWidget(m_reportDesignWidget->toolWindow(ReportDesignWidget::ActionEditor)); + dock->setObjectName("ActionEditor"); + addDockWidget(Qt::BottomDockWidgetArea,dock); + m_dialogEditors.append(dock); + m_docksToTabify.append(dock); } void ReportDesignWindow::createDialogResourceEditor() { - QDockWidget *doc = new QDockWidget(this); - doc->setWindowTitle(tr("Resource Editor")); - doc->setWidget(m_reportDesignWidget->toolWindow(ReportDesignWidget::ResourceEditor)); - doc->setObjectName("ResourceEditor"); - addDockWidget(Qt::BottomDockWidgetArea,doc); - m_dialogEditors.append(doc); + QDockWidget *dock = new QDockWidget(this); + dock->setWindowTitle(tr("Resource Editor")); + dock->setWidget(m_reportDesignWidget->toolWindow(ReportDesignWidget::ResourceEditor)); + dock->setObjectName("ResourceEditor"); + addDockWidget(Qt::BottomDockWidgetArea,dock); + m_dialogEditors.append(dock); + m_docksToTabify.append(dock); } void ReportDesignWindow::createDialogSignalSlotEditor() { - QDockWidget *doc = new QDockWidget(this); - doc->setWindowTitle(tr("SignalSlot Editor")); - doc->setWidget(m_reportDesignWidget->toolWindow(ReportDesignWidget::SignalSlotEditor)); - doc->setObjectName("SignalSlotEditor"); - addDockWidget(Qt::BottomDockWidgetArea,doc); - m_dialogEditors.append(doc); + QDockWidget *dock = new QDockWidget(this); + dock->setWindowTitle(tr("SignalSlot Editor")); + dock->setWidget(m_reportDesignWidget->toolWindow(ReportDesignWidget::SignalSlotEditor)); + dock->setObjectName("SignalSlotEditor"); + addDockWidget(Qt::BottomDockWidgetArea,dock); + m_dialogEditors.append(dock); + m_docksToTabify.append(dock); } void ReportDesignWindow::createDialogDesignerToolBar() @@ -1252,9 +1257,15 @@ void ReportDesignWindow::showDefaultEditors(){ foreach (QDockWidget* w, m_pageEditors) { w->setVisible(m_editorTabType != ReportDesignWidget::Dialog); } +#ifdef HAVE_QTDESIGNER_INTEGRATION foreach (QDockWidget* w, m_dialogEditors) { w->setVisible(m_editorTabType == ReportDesignWidget::Dialog); } + for ( int i = 0; i < m_docksToTabify.size() - 1; ++i){ + tabifyDockWidget(m_docksToTabify.at(i),m_docksToTabify.at(i+1)); + } + m_docksToTabify.at(0)->raise(); +#endif } void ReportDesignWindow::slotActivePageChanged() diff --git a/limereport/lrreportdesignwindow.h b/limereport/lrreportdesignwindow.h index c3e2578..658c984 100644 --- a/limereport/lrreportdesignwindow.h +++ b/limereport/lrreportdesignwindow.h @@ -259,6 +259,7 @@ private: QMap m_recentFiles; QVector m_pageEditors; QVector m_dialogEditors; + QVector m_docksToTabify; ReportDesignWidget::EditorTabType m_editorTabType; QByteArray m_pageEditorsState; QByteArray m_dialogEditorsState; From 3bdec95a8c87bd6a7053f60ad6a72b4dce3dd82f Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 18 Apr 2017 21:47:35 +0300 Subject: [PATCH 097/136] Icons have been changed --- limereport/images/copy3.png | Bin 0 -> 778 bytes limereport/images/paste2.png | Bin 0 -> 749 bytes limereport/images/save.png | Bin 868 -> 536 bytes limereport/images/toBack.png | Bin 591 -> 334 bytes limereport/images/toBottom.png | Bin 518 -> 295 bytes limereport/images/toCenter.png | Bin 505 -> 302 bytes limereport/images/toFront.png | Bin 634 -> 359 bytes limereport/images/toLeft1.png | Bin 503 -> 297 bytes limereport/images/toRight.png | Bin 504 -> 299 bytes limereport/images/toSameHeight.png | Bin 459 -> 239 bytes limereport/images/toSameWidth.png | Bin 453 -> 235 bytes limereport/images/toTop.png | Bin 516 -> 292 bytes limereport/images/toVCernter.png | Bin 518 -> 297 bytes limereport/images/zoom_in1.png | Bin 845 -> 467 bytes limereport/images/zoom_out1.png | Bin 849 -> 466 bytes limereport/report.qrc | 6 ++++-- 16 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 limereport/images/copy3.png create mode 100644 limereport/images/paste2.png diff --git a/limereport/images/copy3.png b/limereport/images/copy3.png new file mode 100644 index 0000000000000000000000000000000000000000..928dcf115df53f384e4c35ee17bd4f9dff61f145 GIT binary patch literal 778 zcmV+l1NHogP)i$__4I7)RUV~Impfj3HaCSiy` zSAjN4b|+tlK30GwRqPkJm- zd@Vm=B>(^a?eXbjnl@sXHTe4W{{H;?{QBPJ*x=~f`1$tp`SPyOtCPZ#p~#=i-OBm< z_uAvp^Y-x5=FnoXTwuIaV6|6pwP}j6hw=66R)00^^XkXm!eg>rcg|{b$!KD?Sy!b{ zkFSjE^yJ#)(%$FST7o(0@8iGOxM8nbWxQZ+!(?H$SyZV{VVhjn;?3jj+wAn_D1@&-rwog)a1vEynp0*t-jQ$ ztI3&js%TP}OgV%!HFh$Eq;|&Gx76gu&)>qg(V?--nzPNFu*{p7yM>UmeT=Spg{XA3 z%cjoZzslRZvd^2X%ayImmafc~ugsUL$&R2b7^U|?WiWMT#Z7FGr*;4lXR3r;RD*V2jyB4EdB z&j%JT7la773ki#eA`AG7OGpNQ1*D+@kx|hxU;$ZkIFJJiC?EtB!2-$%0Tr--8bUxF zETD-H&;kqSAOv*50{RF61F(RRF%+1Xt^^CffhELqNC3zM0Ou+xf3QClbpQYW07*qo IM6N<$f}JjCdH?_b literal 0 HcmV?d00001 diff --git a/limereport/images/paste2.png b/limereport/images/paste2.png new file mode 100644 index 0000000000000000000000000000000000000000..11399d9e72e17ecf3ab7ddfd13cd1c059f70a7d1 GIT binary patch literal 749 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GXl47#|1tgt+=uYGWe%L=_wDhUate&0dQYatMU=Gw(J|h+=64785-e49~V-Q|%2GkN-XA)L# z5>jUzT5lXuX9PsSwT3_xRBHf2HTprdAOzGNTn7{ZvJHZ34MOS-oKjV*Puf)-w*^X7 z9kVMxY+JhDreu$G`9YhKy*9-=tqZnU{{R2Kc(--o4y%GKmbn`&{{R2?>-Uem&6YXq zEwWad-+FV?XQ7APEUWk>Q9CYe{r2li-bRa@wHBGH%+i;c9l3ijYfn!Yh_fFq@bSZ0%dFBeUv?Zn~3rzOj+>x>^He+v6?xCcZO`)C>U9UVi`{eEI z*PoweEHg`6WSTtRBx$zs=!u3`pPo2- zZ-4!kaVka3!^&3QV>z{kD@7T?4r|#}rePV9bti;&f zu;`YMEhm>=e0&HPS*P#sK5}dG@!MNZ-`jcS!S2I1H|@Hx>g>b4!07Hz`S%n^F_r}R z1v5B2yO9RsBze2LFm$lWdH^|`1s;*b3=G`DAk4@xYmNj^kiEpy*OmPti;$qK?oRGS zwLqa}PZ!4!iOas{PYX2}@U%WGQw%M*5-6ar@qjhN;pH~zT5-9q>!weAjQ^~DGCN0! zMOD+#>(oY{J1@@s-f}6}%XjNF<`>gu{bYQ4UQ+DXHQjK&Yg_8-?;dLrOz7^e*ly2| z#8Aqja;%hTj%1L-u?ft2JmCj=AL>;_9}IZ3@%ZP|)vuoYW#7%FrYmc5Dgx*n22WQ% Jmvv4FO#o1iOb`G7 literal 0 HcmV?d00001 diff --git a/limereport/images/save.png b/limereport/images/save.png index e6fe0b29ab08185a4ce50d74e389ac9a045a8078..2b31666d2e6aedb9c9ce84d613ba2900800dec1c 100644 GIT binary patch delta 146 zcmaFDHiKn?GCyN{fKP~P^+~(rS!O`Au`rBLu2A7cI0FL%V@Z%-FoVOh8)+a;lDE4H zLkFv@$K>aXav={{gaow=ytwiv0OgE4T^vIsE+;3XIJ2$c;pxd?5?%CbDcQ0<=y?y)k-BVz+uixL`Ai%-J_mP>irLFa}n~R(4@gv8Mwl}c| z2?;f0oSev;6D=)wR{nHQ3ux%o-MnDKiWMt%EHN<_);MtBNE^!x z31Fy2Y}b7JOZjvu(4VR$t`Q|Ei6yC4iOEH&K$^kGz|c(B&_LJFEX2sj%D~*p$VA(~ m*vi15?q$_R6dk$wDVb@NxHa%^Im8Rpz~JfX=d#Wzp$PyXu&4+C diff --git a/limereport/images/toBack.png b/limereport/images/toBack.png index 883ae1944f0af2822390ed87dda98a80a4c6f0ef..1fc9fe18ba9cec3679f1ebf0723920306f07dd65 100644 GIT binary patch delta 146 zcmX@la*k<&3ipHnpAgs5{WjGn?Iz}R$!)yvmcqcmz*rLG7tG-B>_!@hljQC0!qCAg z>oM7YQ7-Z!i;$o>zj9*&D~Qgf&g;-d9PoRM^zV=jVPj z;F~P=Z~hcJDOo;Vvs;}Y KUMwFx^mZVxG7o`Fz1|tJQGhIUiT|=`FBO@yVb1Neg pZ3AN~1B1GkRU1(>mdKI%cPYCIBYfm(>6O diff --git a/limereport/images/toBottom.png b/limereport/images/toBottom.png index 73c104df84f076788ab923b074a5f385cc38e861..3f9fe616b73e0785d11d73b37c94737f4754f852 100644 GIT binary patch delta 130 zcmZo;SUkfCW9u1u7*vUjLaBYoMte@D9&Y3;5$%Y fz_Vf@BM&RX{jZ#=F&WHRKs^keu6{1-oD!Mk04(LhAK4%hK3dfhF?ITh8GMBr3MTP zuM!v-tY$DUh!@P+6=(yLs1EQ6aRt(TmD(p>uAiu1BzI-bne#va#*!evUYjlCPTZko7XuKocxi!hJu=Z~5|gBa30T^vIsF87}Ec*5;4|d1}wjbelYS8EsoMgg$Leg2|6w`u7GL9Wm3o@-+ z>LeJKWx7RN<4v$HW6@MSP#Nn|n9|Na9AIl)k5nV~E7%n p87_R;IFr+SDhH!l&bLR~#2BvnGS9y~eHF-522WQ%mvv4FO#pfQEsFpE delta 344 zcmZ3-^pkmliZ4sLqpu?a!^VE@KZ&di3=9g%9znhg3{`3j3=J&|48MRv4KElNN(~qo zUL`OvSj}Ky5HFasE6@fgQ61nD;tHhg6IJ{wwI6=IGSMhs?xptC3ZNKcNswPKgTu2M zX&_FLx4VnR-VIwfP24Y6|A3oCm`C>WM@^tv43VBLjv*44lM@;k+}KPSln$^k7ci!Y zg_)J{`Kd7K<;j)t#kDZVbDQsPP?*H9OOj=6YLe6C!zwB|N?K}qikhtA6Q)g^IypSR zg+oL0bl1uit5zC6G-z(v%CN+kMf~LJyn{eXR7+eVN>UO_QmvAUQsaO$gOP!unXaLM zuAy0ok&%^wxs{QLwt=ygfkEBNs*NZ*a`RI%(<*Um;NNnH7pQ^3)78&qol`;+0MZp_ AHvj+t diff --git a/limereport/images/toFront.png b/limereport/images/toFront.png index 8d04661a1d71b5cfea0797c69e5f467f62845027..f6666ba4754138e1b2c8310e44a01729cff412f6 100644 GIT binary patch delta 135 zcmeyx@|mdKI;Vst06M57-2eap delta 437 zcmaFP^owPJiVI7+qpu?a!^VE@KZ&di3=9g%9znhg3{`3j3=J&|48MRv4KElNN(~qo zUL`OvSj}Ky5HFasE6@fgu`$3W#1%+S)Ld6@-_8*TWXhHV`2{ol!UG;3Dqaj!$e85q z?jl#jrJxPua29w(7Bet#3xhBt!>leJhGoZY62~0=*1@5ysSd(a_My$QHjy(^6hvT{nXU4u-~UX2QnY+Q!m8%XO@+ zt=ZMZt<7T^+NZbo&!0YBTu(tkLqkDDM~6jRKu}azTwGkRk=vu8u}|+#ny03xXQrfW zE%S=miRX+=OpM$LH+Qa_Y1!4#y0lfaivi@ilL9W&Ytk+NS*j(j5hZCUi6yC4$wjF^ ziowXh&`j6RK-bVL#K_3Xz}(8nMBBjF%D|xRWz|NQ4zPyY{FKbJO57Uww;bXHYGCkm L^>bP0l+XkKS&4|h diff --git a/limereport/images/toLeft1.png b/limereport/images/toLeft1.png index 18900601dbdd6256f2cdff28811d15b05f360562..88cc447cf31f2f3f3f706d7aaa8bf8dca05bc722 100644 GIT binary patch delta 135 zcmey)ypm~x3SUKlPl)To&sXddRs1ToCl=<*?c;ZBWME)mED7=pW^j0RBMrn!@^*J& z=wOxgnD|f5=OK%b5R(R5?K4xLl$NK9V~E7%5i9$Q^DK{|Bmi|Wc)I$ztaD0e0sw(tDy0Ab delta 342 zcmZ3<^qqNviZ4sLqpu?a!^VE@KZ&di3=9g%9znhg3{`3j3=J&|48MRv4KElNN(~qo zUL`OvSj}Ky5HFasE6@fgQ61nD;tHhg6IJ{wwI6=IGSMhs?xptC3ZNKcNswPKgTu2M zX&_FLx4VnR-VIwfP24Y6|A3oCm`C>WM@^tv4B?(Gjv*44lM@nB9GD|mW+X7^9XNC7 z)Uk61J5>%GJ$v}v!ES*E$q%223%Ce5m^ZUzE6!?Qayq26DCv>Vq@V)EOvy;gN>&%;;J*%SxEf_(L=|!?H6hiYKRU+61&hwZt`|BqgyV)hf9tHL)ZnmBGls&`j6R zK-bVL#K_3Xz}(8nMBBjF%D|xRWz|L$9l7}_nQ4`{HSlja#0%8G;OXk;vd$@?2>>LJ BZ%F_E diff --git a/limereport/images/toRight.png b/limereport/images/toRight.png index e4946f435e93f52dac919883ea80454b0f60e8c9..14b348f5b6609be9b8e9399c05e6fe1590df96de 100644 GIT binary patch delta 137 zcmeytyqal(3SUKlPl#*B`5^m56~9XDiG}%c^Xz{;U|?WiED7=pW^j0RBMrn!@^*J& z=wOxgnD|f5?;(qj5R=lg75v&jDIHH2#}J9j$q5dOJv=-StTPfA^b|N5mvAhY?RX+e nP0d8tK>1;tkm3QCSz8%q&SBM*VfKjv>SOS9^>bP0l+XkKvy3T& delta 343 zcmZ3@^n-bViZ4sLqpu?a!^VE@KZ&di3=9g%9znhg3{`3j3=J&|48MRv4KElNN(~qo zUL`OvSj}Ky5HFasE6@fgQ61nD;tHhg6IJ{wwL8uSO*G1vE2=&b3KU~33GxeOaCmkj z4a7^T>Yws0lQSA;QzeF+}2Wa)JY64-ZcS>x={jy#r?s zojP{zV5h)?q{OGs9=eJ>cr5rnKLeIG2rCv?&#|D_V7B$x+FE_=@U_r zhfH3lv{og3%6e76sCH=$E5n*{7Ts{AoiRW=R7+eVN>UO_QmvAUQWIlKQW=a449#>6 z4Rj67LX3>849u;JOtcM*tqct6URG^H(UF^&n0}NOI69~X5kN^t{3lp3g)B@;EM+4~I2LRDf0g2WD R!3zKY002ovPDHLkV1mXuA@KkJ delta 349 zcmaFQc$#^FiZ4sLqpu?a!^VE@KZ&di3=9g%9znhg3{`3j3=J&|48MRv4KElNN(~qo zUL`OvSj}Ky5HFasE6@fg;St~y;tHhg6IJ{wweNmBJJHBSE-tD2HBgMPB*-tA!Qt7B zG!Q4r+ucQ+``V2Di9K@l54c%`d1OC-)C8Kv5a;RQ7$R{w_q;b>g8~oB1+6gGkOTbR z?N`mTc)2LiY{K+QVv;dSCJSz47Ffm*5PE3OnuZ;&PF|cFcn&}!E=o*@Z7#Ud^m|Gc{Xd4(?85q>PtlEgABh@N5KP5A*61N8aEr)o48W=oX L{an^LB{Ts5i^gXUX8ODtJRZEw0v+$hS*(7`I}G4ZsV<3ko9 zA!ZZq^lobg1_pUg7sn8Z%gG5T4valK5iBz%Ft{{G@^y$gm?sxRaWiZzVDznJICc)G Ol)=;0&t;ucLK6U}%^|q} delta 346 zcmaFOc$9g9N&ri`qpu?a!^VE@KZ&di3=9g%9znhg3{`3j3=J&|48MRv4KElNN(~qo zUL`OvSj}Ky5HFasE6@fg;St~y;tHhg6IJ{wwX09swVm^wXlf}pMvC-_I>m4#PBYxdk_T-M2~`G4jTpz|42OI#yLQW8s2t&)pU6JtwK8H@}J z&2$Y7bPdfyjEt-d%&m+}v<-}{3=HaCR&7Mlk(-~AnO2Eg1OJvoyg&^Mp00i_>zopr E0Qp#PV*mgE diff --git a/limereport/images/toTop.png b/limereport/images/toTop.png index 7b91b8eef064047b131a9cbdd1911fa8d707398c..58c25e4d6f2d5adba6b3ea712e688b453e51385a 100644 GIT binary patch delta 133 zcmZo+S;90yMX(~kC&cyP=ganqDt?vPO=mnNmgLB-d-Eonfq{XsB*-tA!Qt7BG!Q4r z+uensgH_gJ;y*d}hb%%uEF$$DwkAL+RZkbk5Q)pl2@dQ%84Zlw2~3O@tU?KCX=zQt iCE^a{>}}qiYz&jPF>>Buu5tuwVDNPHb6Mw<&;$T?Whk)# delta 358 zcmZ3&)WR}BC4eQ}(btiIVPik{pF~y$1_p&>k04(LhAK4%hK3dfhF?ITh8GMBr3MTP zuM!v-tY$DUh!@P+6=(yLs1EQ6aRt)$i7I}T+D&IX9)7+&(KJV{X8ZKRKw-v`AirP+ zhi5m^K%69RcNdMl8@6tmxL>aR0XK^4s3S=_o@<{1O+Q!UAKjVMV; zEJ?LWE=mPb3`PcqX1az3x`t*UMn+Z!=2k`~+6Kl}1_pI6t2Tmlz%=CMr(~v8;?}^w S&vtbH diff --git a/limereport/images/toVCernter.png b/limereport/images/toVCernter.png index 3e0689bcef591e42209b8c82098ddd4aa3ca0699..79f2fe054a75acafed01d40cc0a19dee83a3df58 100644 GIT binary patch delta 135 zcmZo;S;;g(g|8yOC&ab;La1M*cGDS;iG}%czh3{p$-uzCSQ6wH%;50sMjD8dGHkQd*uajv*44lM@t}44N3a7=(p|l{Z=VFgOV+Dkw0d l9n>s3bKn_Y$@EEF4Bbo&U;FRpbO3cRc)I$ztaD0e0stK#EEoU) delta 357 zcmZ3<)W$MF#g`@B(btiIVPik{pF~y$1_p&>k04(LhAK4%hK3dfhF?ITh8GMBr3MTP zuM!v-tY$DUh!@P+6=(yLs1EQ6aRt(TmD){bJi0H0PBhAwyLjV@El`ZHB*-tA!Qt7B zG!Q4r+ucQD?}n|LChnK3f56Qm%p?2xqbATShBQwX#}J9jQ_s2cH8}7vJ8b%LuR8kI z|9XyTMGSrqx|dE=b`7*^nZVAW_~PA?EUN?7_u~VNO z4UL!*+Ut6GTg|1f%n4H_CC(B*uq%(}ccIPyiuzyX>dH4*;=k_`-UYNVTeZYBq9i4; zB-JXpC>2OC7#SFv=^7g78k&U|8Ce;aTN#;X8yH&|7}UM2+6dHv(2$#-l9^VCTLb@= RL%cu@44$rjF6*2UngE5ic}D;M diff --git a/limereport/images/zoom_in1.png b/limereport/images/zoom_in1.png index 4e6fc7a9a55818197bcfc2f37563bc7b1fe4de63..f1d1b62ec47c175ad4824232c7df1ced2ea12103 100644 GIT binary patch delta 427 zcmV;c0aX6Y2GawO85#xv001BJ|6u?C00v@9M??Th0D1sG#JX33lj{KuRoTr}jz{@@F`+t7_=XrTgVooHFV{1Tm zyuv^S&;i}htPfEq&4KrUe{<$X#?Y)Pz>*g%2ZAJ{DGqm!SXo}>?emqv&j4U=b9>|Q z;ri)bnlbh}Kx}J=Lb^EBx?C$^-Cl`p$mi0tqO%h|IE&hOAzefc1nv5n25KaMS2*;n z-=&2CR3$#uS>%;m6IF?GaZ>{byC>)Xn5~9gT*)=3a-jnqw}B2|f41wMS8(XM+u#JC z*Y8rUmFz>&S-e88-?a@S#}obntSdvFTO(gN5JZh6P?b1ltAW|BJK>C>SyjmiM^Zxo zzFx3R7X67nHw+VS9=HR($KN~<5-@<@4Yw~xu%TJvdZ%8aOw2h0UKoBS_+J>{57+R7 Vr8R_-5&!@I07*qo1w^hwV1l}aynFxv literal 845 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJOS+@4BLl<6e(pbstU$g(vPY0F z14ES>14Ba#1H&(%P{RubhEf9thF1v;3|2E37{m+a>`T@Ck7RDoCDXhK9DD zU-0DJy~l5FpSyQp?*7Kq*%ojGcV1ll_4~)CZ|`1xeDd)1%^T0o9=@?DZH^UC!PavN z{{H>*^~a|xPfnb=vwPXmzSLP3zyJLH{`1T6TibVCS_b5nEcN~Q=f{qVOETx$WzTc? z^5etCGqX}=TbzGz`1$+$+b%4exwjT*RNexYo6pbRe0FZ<#igr`Pt2HW3lz+nXSe0t zJfO*kZfx9fVe!2EjX*=HPl8a&Y)c?JWtKVIoe;*G&(H6^xcvUh>*wzuTz`7{{QZNU zzP&woW5b(I&!4=#d*{WaGk5nLzPWk#<(2ndUA^}7^zmEU_FY|b;o;$vcXl4QwjLNb zDSI{?22!3SL4Lsul~4XYzWVLZ^#?ajzqnTZ{q&pfzrVk^aJS~-r@#L`UHS3u@4vTS zKK}UmODRS*L#FG01ahK@^*J&=wOxg z0CG4BJR*x37`TN&n2}-D90{Nxdx@v7EBga(7GWOQ&mT2`vBz-0)5S4F;&O5V1GAf2 zntz&@8=FMJ*A|8_i}}5CnV7^-l{Cd1Y_o_rZxw)Otv;PIomiNKD4!ThGN=_SFSEq zZmzGTD>gCwY@0XF?UQ3&*q6G*sWf^bn4dLwR3Gx$kxo8$JggD-O6%zMbq7< zFJHcR@!}=tC+^AG%pnIZU*>(MJ3&muuGu=^2y-VtLqxu^fQ8l)V5($LEpd$~Nl7e8 zwMs5Z1yT$~28L$3h6cKZW+6sKRtDx)Mkd+@##ROfbuX(nqG-s?PsvQH#I1pU%OPH% O1_n=8KbLh*2~7ZG>y``v diff --git a/limereport/images/zoom_out1.png b/limereport/images/zoom_out1.png index cce6ea29053eb2f9da890f09efdbdd43f9cb0dd5..04db40649174825046d7b455a6bac81d1779746a 100644 GIT binary patch delta 451 zcmV;!0X+WE2GRqN8Gi-<001BJ|6u?C00v@9M??Th0D1sG#JX3300009a7bBm000XU z000XU0RWnu7ytkO2XskIMF-&o5)vyCgg2mU0004BNklGAgYVXOnE?RS9W_AZ5N$yd6nmoe{e zM7Zj<6LS0#34cce$pD3HiAXpq!kjxd5>Vo4Cc%{-6PR~i8%0h5aCDyVk?Z+3ik#x= zPDk8#3v_@j!)kG?o>0%X13NIRme_W@7Bm3EZcen|%4>lFy?&RfUJfKz^)kJFSA;d+ zAbICNiKkKI6o%Epu$v=tOdj%Lg#c(&OlhV`jLAcm*F1jr_Vu5LH058Y0mL)I(On@T tF(uSu@;gW*G_8Q}EGqkc14Ba#1H&(%P{RubhEf9thF1v;3|2E37{m+a>|BWU zo6pYu{rl(Zk55;goH%u7_oSUAX>+Xq|NsB}=a=KRw(q>Sq+p@j&p$tQTwIc~zzJv+ z(2z}M=VZ*WIecUD^Y{0+U0AsAP&?45?D-Bio}K}kw)5iB)yF4g&vyh0X3cZha&G>K z+dB{4*a#G#x4$uCt}W1=nRD$@W?NLBv;!iDGvMT#&(9ydxpnu&<@aA+KY#z=_KS<_qEgn48?f7ArVBEud} z7sn8Z%gG5qkdpK*AuTbbfiaAqBcb)vO`98*7CU!TRxDJik^95c6K3sVk7#X6EAYsOsBl>_ z%`Ad-a(iE1NQqC*oOyOfc$oQ}l^_3TaS;wS=I1Z&u-4I8yCyg1txd#3CAn{WeGb#D zEUO*nJUYbmsk^;>^5n_w?04LG)+q?4FizkI;pW-F`12h@K$o)cTF<0Vpg&YgTq8?+%fw`5DiMD~Um4QLs%c_ki8glbfGSez?YvA8< Rh!?1V!PC{xWt~$(697hElh^images/hlayuot_3_24.png images/addBand1.png images/delete1.png - images/copy2.png + images/copy2.png images/new_leaf1.png - images/paste1.png + images/paste1.png images/zoom_in1.png images/zoom_out1.png images/folder3.png @@ -177,5 +177,7 @@ images/logo_32x32_1.png images/addDialog.png images/deleteDialog.png + images/copy3.png + images/paste2.png From 170057639447a001e32dd059808b3acc9a1be853 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 19 Apr 2017 02:04:14 +0400 Subject: [PATCH 098/136] Qt4 build fixed --- .../designer/qdesigner_integration_p.h | 2 +- limereport/dialogdesigner/dialogdesigner.pri | 10 +++- .../dialogdesigner/lrdialogdesigner.cpp | 47 ++++++++++++------- limereport/dialogdesigner/lrdialogdesigner.h | 8 ++-- limereport/lrpreviewreportwidget.cpp | 8 +++- limereport/lrreportengine.cpp | 10 ++++ 6 files changed, 60 insertions(+), 25 deletions(-) diff --git a/limereport/dialogdesigner/3rdparty/designer/qdesigner_integration_p.h b/limereport/dialogdesigner/3rdparty/designer/qdesigner_integration_p.h index f59c001..6c76d10 100644 --- a/limereport/dialogdesigner/3rdparty/designer/qdesigner_integration_p.h +++ b/limereport/dialogdesigner/3rdparty/designer/qdesigner_integration_p.h @@ -94,7 +94,7 @@ signals: public slots: virtual void updateProperty(const QString &name, const QVariant &value, bool enableSubPropertyHandling); // Additional signals of designer property editor - virtual void updatePropertyComment(const QString &name, const QString &value); +// virtual void updatePropertyComment(const QString &name, const QString &value); virtual void resetProperty(const QString &name); virtual void addDynamicProperty(const QString &name, const QVariant &value); virtual void removeDynamicProperty(const QString &name); diff --git a/limereport/dialogdesigner/dialogdesigner.pri b/limereport/dialogdesigner/dialogdesigner.pri index df76e68..9bd17dd 100644 --- a/limereport/dialogdesigner/dialogdesigner.pri +++ b/limereport/dialogdesigner/dialogdesigner.pri @@ -11,7 +11,15 @@ lessThan(QT_MAJOR_VERSION, 5){ DEFINES += HAVE_QTDESIGNER_INTEGRATION } } -QT += designer designercomponents-private + +greaterThan(QT_MAJOR_VERSION, 4) { + QT *= designer designercomponents-private + +} else { + CONFIG *= designer + qtAddLibrary( QtDesignerComponents ) +} +#QT += designer designercomponents-private SOURCES += $$PWD/lrdialogdesigner.cpp HEADERS += $$PWD/lrdialogdesigner.h diff --git a/limereport/dialogdesigner/lrdialogdesigner.cpp b/limereport/dialogdesigner/lrdialogdesigner.cpp index 6a33752..82a08d0 100644 --- a/limereport/dialogdesigner/lrdialogdesigner.cpp +++ b/limereport/dialogdesigner/lrdialogdesigner.cpp @@ -3,9 +3,6 @@ #include #include -#include -#include - #include #include #include @@ -19,10 +16,17 @@ #include #include #include -#include "pluginmanager_p.h" -//#include +#if HAVE_QT5 +#include +#endif +#if HAVE_QT4 +#include "qdesigner_integration_p.h" +#include +#endif +#include "pluginmanager_p.h" #include "widgethost.h" +#include namespace LimeReport{ @@ -98,7 +102,12 @@ DialogDesignerManager::DialogDesignerManager(QObject *parent) : QObject(parent) m_designerToolWindows.append(m_actionEditor); connect(m_actionEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) ); +#ifdef HAVE_QT4 + m_designerIntegration = new qdesigner_internal::QDesignerIntegration(m_formEditor,this); +#endif +#ifdef HAVE_QT5 m_designerIntegration = new QDesignerIntegration(m_formEditor,this); +#endif m_formEditor->setIntegration(m_designerIntegration); } @@ -151,7 +160,7 @@ QWidget *DialogDesignerManager::createFormEditor(const QString &content) DialogDesigner* dialogDesigner = new DialogDesigner(wnd, m_formEditor); - connect(dialogDesigner, SIGNAL(dialogChanged()), this, SLOT(slotDialogChanged())); + connect(dialogDesigner, SIGNAL(dialogChanged(QString)), this, SIGNAL(dialogChanged(QString))); connect(dialogDesigner, SIGNAL(dialogNameChanged(QString,QString)), this, SIGNAL(dialogNameChanged(QString,QString))); connect(dialogDesigner, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*))); @@ -253,14 +262,6 @@ void DialogDesignerManager::slotActiveFormWindowChanged(QDesignerFormWindowInter } } -void DialogDesignerManager::slotDialogChanged() -{ - DialogDesigner* dialogDesigner = dynamic_cast(sender()); - if (dialogDesigner){ - emit dialogChanged(dialogDesigner->dialogName()); - } -} - QString DialogDesignerManager::iconPathByName(const QString &name) { if (name.compare("__qt_edit_signals_slots_action") == 0) @@ -276,8 +277,7 @@ DialogDesigner::DialogDesigner(QDesignerFormWindowInterface* wnd, QDesignerFormE :QWidget(parent, flags), m_formEditor(formEditor) { m_dialogName = wnd->mainContainer()->objectName(); - connect(wnd, SIGNAL(changed()), this, SIGNAL(dialogChanged())); - connect(wnd->mainContainer(), SIGNAL(objectNameChanged(QString)), this, SLOT(slotMainContainerNameChanged(QString))); + connect(wnd, SIGNAL(changed()), this, SLOT(slotDialogChanged())); m_designerHolder = new SharedTools::WidgetHost(this,wnd); m_designerHolder->setFrameStyle( QFrame::NoFrame | QFrame::Plain ); @@ -308,7 +308,7 @@ bool DialogDesigner::isChanged() void DialogDesigner::setChanged(bool value) { - m_designerHolder->formWindow()->setDirty(false); + m_designerHolder->formWindow()->setDirty(value); } QByteArray DialogDesigner::dialogContent() @@ -342,4 +342,17 @@ void DialogDesigner::slotMainContainerNameChanged(QString newName) } } +void DialogDesigner::slotDialogChanged() +{ + Q_ASSERT(m_designerHolder != NULL); + if (m_designerHolder && m_designerHolder->formWindow()){ + if ( m_designerHolder->formWindow()->mainContainer()->objectName().compare(m_dialogName) !=0 ){ + emit dialogNameChanged(m_dialogName, m_designerHolder->formWindow()->mainContainer()->objectName()); + m_dialogName = m_designerHolder->formWindow()->mainContainer()->objectName(); + } + emit dialogChanged(m_dialogName); + m_designerHolder->formWindow()->setDirty(false); + } +} + } diff --git a/limereport/dialogdesigner/lrdialogdesigner.h b/limereport/dialogdesigner/lrdialogdesigner.h index 8a0bfbe..a5c33bc 100644 --- a/limereport/dialogdesigner/lrdialogdesigner.h +++ b/limereport/dialogdesigner/lrdialogdesigner.h @@ -4,6 +4,7 @@ #include #include #include +#include class QDesignerFormEditorInterface; class QDesignerFormWindowInterface; @@ -23,7 +24,7 @@ namespace LimeReport{ class DialogDesigner : public QWidget{ Q_OBJECT public: - DialogDesigner(QDesignerFormWindowInterface *wnd, QDesignerFormEditorInterface* formEditor, QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags()); + DialogDesigner(QDesignerFormWindowInterface *wnd, QDesignerFormEditorInterface* formEditor, QWidget *parent = NULL, Qt::WindowFlags flags = Qt::WindowFlags()); ~DialogDesigner(); QString dialogName() const; void setDialogName(const QString &dialogName); @@ -34,11 +35,11 @@ public slots: void undo(); void redo(); signals: - void dialogChanged(); + void dialogChanged(QString dialogName); void dialogNameChanged(QString oldName, QString newName); - private slots: void slotMainContainerNameChanged(QString newName); + void slotDialogChanged(); private: QString m_dialogName; SharedTools::WidgetHost* m_designerHolder; @@ -69,7 +70,6 @@ private slots: void slotObjectDestroyed(QObject* object); void slotEditWidgets(); void slotActiveFormWindowChanged(QDesignerFormWindowInterface *formWindow); - void slotDialogChanged(); private: QString iconPathByName(const QString& name); private: diff --git a/limereport/lrpreviewreportwidget.cpp b/limereport/lrpreviewreportwidget.cpp index dcddb74..fdf2e3b 100644 --- a/limereport/lrpreviewreportwidget.cpp +++ b/limereport/lrpreviewreportwidget.cpp @@ -163,8 +163,12 @@ void PreviewReportWidget::print() QPrinter printer(QPrinter::HighResolution); if (!pi.defaultPrinter().isNull()) - printer.setPrinterName(pi.defaultPrinterName()); - +#ifdef HAVE_QT4 + printer.setPrinterName(pi.defaultPrinter().printerName()); +#endif +#ifdef HAVE_QT5 + printer.setPrinterName(pi.defaultPrinterName()); +#endif QPrintDialog dialog(&printer,QApplication::activeWindow()); if (dialog.exec()==QDialog::Accepted){ if (!d_ptr->m_reportPages.isEmpty()) diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 6f9c6e0..10ea8bb 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -274,7 +274,12 @@ bool ReportEnginePrivate::printReport(QPrinter* printer) if (!printer&&!m_printerSelected){ QPrinterInfo pi; if (!pi.defaultPrinter().isNull()) +#ifdef HAVE_QT4 + m_printer.data()->setPrinterName(pi.defaultPrinter().printerName()); +#endif +#ifdef HAVE_QT5 m_printer.data()->setPrinterName(pi.defaultPrinterName()); +#endif QPrintDialog dialog(m_printer.data(),QApplication::activeWindow()); m_printerSelected = dialog.exec()!=QDialog::Rejected; } @@ -301,7 +306,12 @@ bool ReportEnginePrivate::printPages(ReportPages pages, QPrinter *printer, Print if (!printer&&!m_printerSelected){ QPrinterInfo pi; if (!pi.defaultPrinter().isNull()) +#ifdef HAVE_QT4 + m_printer.data()->setPrinterName(pi.defaultPrinter().printerName()); +#endif +#ifdef HAVE_QT5 m_printer.data()->setPrinterName(pi.defaultPrinterName()); +#endif QPrintDialog dialog(m_printer.data(),QApplication::activeWindow()); m_printerSelected = dialog.exec()!=QDialog::Rejected; if (m_printerSelected){ From 64c4a7fc3d69bad258bb254a3609adee3eda43ff Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 19 Apr 2017 02:44:57 +0400 Subject: [PATCH 099/136] Icons have been changed --- limereport/dialogdesigner/dialogdesigner.pri | 1 - limereport/images/zoom_in1.png | Bin 467 -> 564 bytes limereport/images/zoom_out1.png | Bin 466 -> 484 bytes 3 files changed, 1 deletion(-) diff --git a/limereport/dialogdesigner/dialogdesigner.pri b/limereport/dialogdesigner/dialogdesigner.pri index 9bd17dd..960b7c3 100644 --- a/limereport/dialogdesigner/dialogdesigner.pri +++ b/limereport/dialogdesigner/dialogdesigner.pri @@ -19,7 +19,6 @@ greaterThan(QT_MAJOR_VERSION, 4) { CONFIG *= designer qtAddLibrary( QtDesignerComponents ) } -#QT += designer designercomponents-private SOURCES += $$PWD/lrdialogdesigner.cpp HEADERS += $$PWD/lrdialogdesigner.h diff --git a/limereport/images/zoom_in1.png b/limereport/images/zoom_in1.png index f1d1b62ec47c175ad4824232c7df1ced2ea12103..e26b6ecee167f61de5ea87e4d6468de1db9541c8 100644 GIT binary patch delta 503 zcmVy{D6rGa-K#DhUuk@ErgE0l`T`K~y-)rIRs88(|d3 ze`gdzLnK+Qm_UtL61;;#Aw;x-HIz=CajQ_lfG$GmeC<$|aEOC+35bQ*cF0&cx+bLH zpadjCE(C;Lwm_Gbq&7k+*CDx}$3>{V>EnIx|Nq|mzyAk!3}M)XqDm3qEszER{d9jB z_@HaX;f(}}Dy;*1KCeHJoKA5+7y{s=UcziO01kD{$P9g1QKcW*PcN-s-L~Zn{rID$ zsFJ0q(l&s{Nf4VC_rzd$W;?Tw&+DgVR@mHqh5*RX1hEGX5rCRmS%}Sx??zmjSXX9W z;Pd*23b!=3W*^g|ZUs}JH~`D9lX@wVoL(fmk*8)>cyo{;^=O&rsV(TuZ`YRHG$@zOj_h?I2EweS zwveNVUU!!r-hbHvXzH3#7M%O{j0yS4q@VV=ho|x?OLJ=jK~L)?3dI~|tMOwKc%o}Y zRd9l%kH-P{cHHLgAInXmCa|JwMs?uCA>d5kx>v1S)ivYj+FwvqDeV~(K0Coz{eDx7 t0I$UOy<36pHGcix_`T5T&HGtdbGa-KxEE3ChHmd*t0bof)K~y-)m69<_0$~`( ze`iMFa89|_61asoxCO$6f{W4MlGqmrAz;pCaOk?*-~^!8?^3Rn>_gF6yh5+vwGAZ46aE6M zD?^@JBVRcXM2#d+l{jXrf!VG*;f$eKRmllQQbPc~Ua(CT{fRy|3=?o3xC6e&-#ic! zFo53;w=YMqp;_X3r(UB>%sB&I7=9=CUl`yI*YJd;HH4B900000NkvXXu0jG}g2EZL A`2YX_ diff --git a/limereport/images/zoom_out1.png b/limereport/images/zoom_out1.png index 04db40649174825046d7b455a6bac81d1779746a..ad1ab694d3ff3040dccc77f408200fc9412532c1 100644 GIT binary patch delta 458 zcmV;*0X6>81LOmcB!3xnMObuGZ)S9NVRB^vL1b@YWgtmyVP|DhWnpA_ami&o0004o zNklNeu=IEhn(p z%lFS1PF~x~@b$-MkU@n&Ll$6l22gVY5dYtFWYK?g@a6lb|9`EEbN>V7-vhA%x?U!r zpa77rk95vr@U@P`Fr1r%mmxo-l|f8U8mtb(03Z$kF|cVyHpI^=2E4h zIf)Ec?w!UkU}M`A21O|itcJ57b3g%z3w-_l8K(gUKz_S&|1?92cR5Z2PF&juqA;S8 z2^cjX10KxT(tinxF07jGKfl4S?;I#OfGtA-%pgMDR_x%1FK;5w-8#x4$ScAiBdQ2- zHqgLz2j?;@*x$w=VaUet>G>}MH7n7FH;=r&fGr^z0IBt`Kt-{Im61Woh7ZiXcjObp z-{1ceVTpIsj`YpjsO4fxL^6tUUfbZ}BF#P|=un-`?0H5@%>lAs?0000007*qoM6N<$fcSmN#TmBH5lV1Hw0{ps=c`C+UBr|oxuSD0dRDl@R95JHj13$>P|=8cMEiYEyHSY zte#NMw*xyctd`hzycRS7!){Kr;L2-(0=<5hs$LExSM@TzepiGw-ynJCK#8YObvSFLbLyJ$Hrx0000 Date: Wed, 19 Apr 2017 21:48:37 -0400 Subject: [PATCH 100/136] Fix spelling: slotPreviewWindowDestroed -> slotPreviewWindowDestroyed --- limereport/lrreportengine.cpp | 4 ++-- limereport/lrreportengine_p.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index fb7ee7c..d41c194 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -155,7 +155,7 @@ void ReportEnginePrivate::slotDataSourceCollectionLoaded(const QString &collecti emit datasourceCollectionLoadFinished(collectionName); } -void ReportEnginePrivate::slotPreviewWindowDestroed(QObject* window) +void ReportEnginePrivate::slotPreviewWindowDestroyed(QObject* window) { if (m_activePreview == window){ m_activePreview = 0; @@ -387,7 +387,7 @@ void ReportEnginePrivate::previewReport(PreviewHints hints) w->setHideResultEditButton(resultIsEditable()); m_activePreview = w; - connect(w,SIGNAL(destroyed(QObject*)), this, SLOT(slotPreviewWindowDestroed(QObject*))); + connect(w,SIGNAL(destroyed(QObject*)), this, SLOT(slotPreviewWindowDestroyed(QObject*))); qDebug()<<"render time ="<exec(); } diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index 4ec3508..ca080f2 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -144,7 +144,7 @@ protected: protected slots: void slotDataSourceCollectionLoaded(const QString& collectionName); private slots: - void slotPreviewWindowDestroed(QObject *window); + void slotPreviewWindowDestroyed(QObject *window); private: //ICollectionContainer virtual QObject* createElement(const QString&,const QString&); From 94db98d5966045dc0eb084fc361ff09810fa7b66 Mon Sep 17 00:00:00 2001 From: Andy Maloney Date: Wed, 19 Apr 2017 22:43:48 -0400 Subject: [PATCH 101/136] Optionally monitor changes to files loaded with ReportEngine::loadFromFile() When using the designer as a stand alone application and the renderer/preview in the user application, the preview window would have to be closed and opened again every time a change was made to the report. This change adds an optional QFileSystemWatcher to monitor changes to the report file and automatically refreshes the preview in the application when it is saved. It may be turned on using the new parameter to ReportEngine::loadFromFile(). If the preview window is open in the application and the file name changes or the file is removed, inform the user and close the preview window. --- include/lrreportengine.h | 2 +- limereport/lrpreviewreportwindow.cpp | 5 ++ limereport/lrpreviewreportwindow.h | 1 + limereport/lrreportdesignwidget.cpp | 2 +- limereport/lrreportengine.cpp | 107 ++++++++++++++++++--------- limereport/lrreportengine.h | 2 +- limereport/lrreportengine_p.h | 7 +- 7 files changed, 89 insertions(+), 37 deletions(-) diff --git a/include/lrreportengine.h b/include/lrreportengine.h index dbbb2a8..99728e1 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -82,7 +82,7 @@ public: void setShowProgressDialog(bool value); IDataSourceManager* dataManager(); IScriptEngineManager* scriptManager(); - bool loadFromFile(const QString& fileName); + bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange = false); bool loadFromByteArray(QByteArray *data); bool loadFromString(const QString& data); QString reportFileName(); diff --git a/limereport/lrpreviewreportwindow.cpp b/limereport/lrpreviewreportwindow.cpp index b000547..47c4ec0 100644 --- a/limereport/lrpreviewreportwindow.cpp +++ b/limereport/lrpreviewreportwindow.cpp @@ -136,6 +136,11 @@ void PreviewReportWindow::initPreview(int pagesCount) m_pagesNavigator->setValue(1); } +void PreviewReportWindow::reloadPreview() +{ + m_previewReportWidget->refreshPages(); +} + void PreviewReportWindow::setSettings(QSettings* value) { if (m_ownedSettings) diff --git a/limereport/lrpreviewreportwindow.h b/limereport/lrpreviewreportwindow.h index 92b2829..78e4c07 100644 --- a/limereport/lrpreviewreportwindow.h +++ b/limereport/lrpreviewreportwindow.h @@ -60,6 +60,7 @@ public: void setPages(ReportPages pages); void exec(); void initPreview(int pagesCount); + void reloadPreview(); void setSettings(QSettings* value); void setErrorMessages(const QStringList& value); void setToolBarVisible(bool value); diff --git a/limereport/lrreportdesignwidget.cpp b/limereport/lrreportdesignwidget.cpp index 4852b97..9e22238 100644 --- a/limereport/lrreportdesignwidget.cpp +++ b/limereport/lrreportdesignwidget.cpp @@ -288,7 +288,7 @@ bool ReportDesignWidget::save() bool ReportDesignWidget::loadFromFile(const QString &fileName) { - if (m_report->loadFromFile(fileName)){ + if (m_report->loadFromFile(fileName,false)){ createTabs(); //connectPage(m_report->pageAt(0)); m_scriptEditor->setPlainText(m_report->scriptContext()->initScript()); diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index d41c194..dbd1882 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include "time.h" @@ -59,13 +60,15 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) : m_printer(new QPrinter(QPrinter::HighResolution)), m_printerSelected(false), m_showProgressDialog(true), m_reportName(""), m_activePreview(0), m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")), - m_reportRendering(false), m_resultIsEditable(true), m_passPhrase("HjccbzHjlbyfCkjy") + m_reportRendering(false), m_resultIsEditable(true), m_passPhrase("HjccbzHjlbyfCkjy"), + m_fileWatcher( new QFileSystemWatcher( this ) ) { m_datasources = new DataSourceManager(this); m_datasources->setReportSettings(&m_reportSettings); m_scriptEngineContext = new ScriptEngineContext(this); m_datasources->setObjectName("datasources"); connect(m_datasources,SIGNAL(loadCollectionFinished(QString)),this,SLOT(slotDataSourceCollectionLoaded(QString))); + connect(m_fileWatcher,SIGNAL(fileChanged(const QString &)),this,SLOT(slotLoadFromFile(const QString &))); } ReportEnginePrivate::~ReportEnginePrivate() @@ -457,6 +460,63 @@ void ReportEnginePrivate::setCurrentReportsDir(const QString &dirName) m_reportsDir = dirName; } +bool ReportEnginePrivate::slotLoadFromFile(const QString &fileName) +{ + PreviewReportWindow *currentPreview = qobject_cast(m_activePreview); + + if (!QFile::exists(fileName)) + { + if ( hasActivePreview() ) + { + QMessageBox::information( NULL, + tr( "Report File Change" ), + tr( "The report file \"%1\" has changed names or been deleted.\n\nThis preview is no longer valid." ).arg( fileName ) + ); + + clearReport(); + + currentPreview->close(); + } + + return false; + } + + clearReport(); + + ItemsReaderIntf::Ptr reader = FileXMLReader::create(fileName); + reader->setPassPhrase(m_passPhrase); + if (reader->first()){ + if (reader->readItem(this)){ + m_fileName=fileName; + QFileInfo fi(fileName); + m_reportName = fi.fileName(); + + QString dbSettingFileName = fi.absolutePath()+"/"+fi.baseName()+".db"; + if (QFile::exists(dbSettingFileName)){ + QSettings dbcredentals(dbSettingFileName, QSettings::IniFormat); + foreach (ConnectionDesc* connection, dataManager()->conections()) { + if (!connection->keepDBCredentials()){ + dbcredentals.beginGroup(connection->name()); + connection->setUserName(dbcredentals.value("user").toString()); + connection->setPassword(dbcredentals.value("password").toString()); + dbcredentals.endGroup(); + } + } + } + + dataManager()->connectAutoConnections(); + + if ( hasActivePreview() ) + { + currentPreview->reloadPreview(); + } + return true; + }; + } + m_lastError = reader->lastError(); + return false; +} + void ReportEnginePrivate::cancelRender() { if (m_reportRender) @@ -509,39 +569,20 @@ QSettings*ReportEnginePrivate::settings() } } -bool ReportEnginePrivate::loadFromFile(const QString &fileName) +bool ReportEnginePrivate::loadFromFile(const QString &fileName, bool autoLoadPreviewOnChange) { - if (!QFile::exists(fileName)) return false; + // only watch one file at a time + if ( !m_fileWatcher->files().isEmpty() ) + { + m_fileWatcher->removePaths( m_fileWatcher->files() ); + } - clearReport(); + if ( autoLoadPreviewOnChange ) + { + m_fileWatcher->addPath( fileName ); + } - ItemsReaderIntf::Ptr reader = FileXMLReader::create(fileName); - reader->setPassPhrase(m_passPhrase); - if (reader->first()){ - if (reader->readItem(this)){ - m_fileName=fileName; - QFileInfo fi(fileName); - m_reportName = fi.fileName(); - - QString dbSettingFileName = fi.absolutePath()+"/"+fi.baseName()+".db"; - if (QFile::exists(dbSettingFileName)){ - QSettings dbcredentals(dbSettingFileName, QSettings::IniFormat); - foreach (ConnectionDesc* connection, dataManager()->conections()) { - if (!connection->keepDBCredentials()){ - dbcredentals.beginGroup(connection->name()); - connection->setUserName(dbcredentals.value("user").toString()); - connection->setPassword(dbcredentals.value("password").toString()); - dbcredentals.endGroup(); - } - } - } - - dataManager()->connectAutoConnections(); - return true; - }; - } - m_lastError = reader->lastError(); - return false; + return slotLoadFromFile( fileName ); } bool ReportEnginePrivate::loadFromByteArray(QByteArray* data, const QString &name){ @@ -880,10 +921,10 @@ IScriptEngineManager* ReportEngine::scriptManager() return d->scriptManagerIntf(); } -bool ReportEngine::loadFromFile(const QString &fileName) +bool ReportEngine::loadFromFile(const QString &fileName, bool autoLoadPreviewOnChange) { Q_D(ReportEngine); - return d->loadFromFile(fileName); + return d->loadFromFile(fileName, autoLoadPreviewOnChange); } bool ReportEngine::loadFromByteArray(QByteArray* data){ diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index dbbb2a8..99728e1 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -82,7 +82,7 @@ public: void setShowProgressDialog(bool value); IDataSourceManager* dataManager(); IScriptEngineManager* scriptManager(); - bool loadFromFile(const QString& fileName); + bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange = false); bool loadFromByteArray(QByteArray *data); bool loadFromString(const QString& data); QString reportFileName(); diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index ca080f2..f900217 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -42,6 +42,8 @@ #include "serializators/lrstorageintf.h" #include "lrscriptenginemanager.h" +class QFileSystemWatcher; + namespace LimeReport{ class PageDesignIntf; @@ -91,7 +93,7 @@ public: void setSettings(QSettings* value); void setShowProgressDialog(bool value){m_showProgressDialog = value;} QSettings* settings(); - bool loadFromFile(const QString& fileName); + bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange); bool loadFromByteArray(QByteArray *data, const QString& name = ""); bool loadFromString(const QString& report, const QString& name = ""); QString reportFileName(){return m_fileName;} @@ -138,6 +140,7 @@ signals: void onSave(); void saveFinished(); public slots: + bool slotLoadFromFile(const QString& fileName); void cancelRender(); protected: PageDesignIntf* createPage(const QString& pageName=""); @@ -178,6 +181,8 @@ private: bool m_reportRendering; bool m_resultIsEditable; QString m_passPhrase; + + QFileSystemWatcher *m_fileWatcher; }; } From b3529ffd0c7537e04a05b83288349ab2c898cf85 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 20 Apr 2017 21:09:52 +0300 Subject: [PATCH 102/136] TextItem render has been fixed --- limereport/items/lrtextitem.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 1224bc9..608f0ed 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -491,18 +491,20 @@ TextItem::TextPtr TextItem::textDocument() const setTextFont(text,_font); } - text->documentLayout(); + //text->documentLayout(); + if (m_lineSpacing != 1 || m_textIndent !=0 ){ - for ( QTextBlock block = text->begin(); block.isValid(); block = block.next()) - { - QTextCursor tc = QTextCursor(block); - QTextBlockFormat fmt = block.blockFormat(); - fmt.setTextIndent(m_textIndent); - - if(fmt.lineHeight() != m_lineSpacing) { - fmt.setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight); + for ( QTextBlock block = text->begin(); block.isValid(); block = block.next()) + { + QTextCursor tc = QTextCursor(block); + QTextBlockFormat fmt = block.blockFormat(); + fmt.setTextIndent(m_textIndent); + if (fmt.lineHeight() != m_lineSpacing) { + fmt.setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight); + } tc.setBlockFormat( fmt ); } + } return text; From d89fcc53a8e230cb0acaffd0fbde83aeb79caf1b Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 20 Apr 2017 23:34:32 +0300 Subject: [PATCH 103/136] Prevent multi run initscript Prevent multi run initscript Prevent multi run initscript & Build without HAVE_UI_LOADER has been fixed --- limereport/items/lrtextitem.cpp | 2 +- limereport/lrreportdesignwidget.cpp | 3 +- limereport/lrreportdesignwindow.cpp | 2 + limereport/lrreportengine.cpp | 28 ++- limereport/lrreportengine_p.h | 1 - limereport/lrreportrender.cpp | 179 +++---------- limereport/lrreportrender.h | 22 +- limereport/lrscriptenginemanager.cpp | 249 +++++++------------ limereport/lrscriptenginemanager.h | 6 + limereport/scriptbrowser/lrscriptbrowser.cpp | 5 +- limereport/scriptbrowser/lrscriptbrowser.h | 2 +- 11 files changed, 166 insertions(+), 333 deletions(-) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 4f4d258..d674bf2 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -503,7 +503,7 @@ TextItem::TextPtr TextItem::textDocument() const } //text->documentLayout(); - if (m_lineSpacing != 1 || m_textIndent !=0 ){ + if (m_lineSpacing != 1 || m_textIndent != 0 ){ for ( QTextBlock block = text->begin(); block.isValid(); block = block.next()) { diff --git a/limereport/lrreportdesignwidget.cpp b/limereport/lrreportdesignwidget.cpp index 6648354..b082273 100644 --- a/limereport/lrreportdesignwidget.cpp +++ b/limereport/lrreportdesignwidget.cpp @@ -77,8 +77,9 @@ ReportDesignWidget::ReportDesignWidget(ReportEngine *report, QMainWindow *mainWi connect(m_report,SIGNAL(pagesLoadFinished()),this,SLOT(slotPagesLoadFinished())); connect(m_report,SIGNAL(cleared()),this,SIGNAL(cleared())); connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentTabChanged(int))); +#ifdef HAVE_UI_LOADER connect(m_report->scriptContext(), SIGNAL(dialogDeleted(QString)), this, SLOT(slotDialogDeleted(QString))); - +#endif //m_instance=this; m_scriptEditor->setPlainText(m_report->scriptContext()->initScript()); m_zoomer = new GraphicsViewZoomer(activeView()); diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index 2f15315..cee9775 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -1277,7 +1277,9 @@ void ReportDesignWindow::slotActivePageChanged() switch (m_editorTabType) { case ReportDesignWidget::Dialog: m_dialogEditorsState = saveState(); +#ifdef HAVE_UI_LOADER m_scriptBrowser->updateDialogsTree(); +#endif break; default: m_pageEditorsState = saveState(); diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 8dcd2fc..0729fca 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -795,22 +795,34 @@ ReportPages ReportEnginePrivate::renderToPages() connect(m_reportRender.data(),SIGNAL(pageRendered(int)), this, SIGNAL(renderPageFinished(int))); + if (m_pages.count()){ +#ifdef HAVE_UI_LOADER + m_scriptEngineContext->initDialogs(); +#endif ReportPages result; m_reportRendering = true; - emit renderStarted(); + m_reportRender->setDatasources(dataManager()); m_reportRender->setScriptContext(scriptContext()); - foreach(PageDesignIntf* page , m_pages){ - m_pages.at(0)->setReportSettings(&m_reportSettings); - result.append(m_reportRender->renderPageToPages(page)); + foreach (PageDesignIntf* page, m_pages) { + scriptContext()->baseDesignIntfToScript(page->pageItem()); } - m_reportRender->secondRenderPass(result); - emit renderFinished(); - m_reportRender.clear(); - m_reportRendering = false; + if (m_scriptEngineContext->runInitScript()){ + emit renderStarted(); + + foreach(PageDesignIntf* page , m_pages){ + page->setReportSettings(&m_reportSettings); + result.append(m_reportRender->renderPageToPages(page)); + } + + m_reportRender->secondRenderPass(result); + emit renderFinished(); + m_reportRender.clear(); + m_reportRendering = false; + } return result; } else { return ReportPages(); diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index f900217..8a989d6 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -181,7 +181,6 @@ private: bool m_reportRendering; bool m_resultIsEditable; QString m_passPhrase; - QFileSystemWatcher *m_fileWatcher; }; diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 039a3ba..008b17e 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -165,35 +165,6 @@ void ReportRender::setScriptContext(ScriptEngineContext* scriptContext) m_scriptEngineContext=scriptContext; } -bool ReportRender::runInitScript(){ - if (m_scriptEngineContext){ - ScriptEngineType* engine = ScriptEngineManager::instance().scriptEngine(); -#ifndef USE_QJSENGINE - engine->pushContext(); -#endif - ScriptValueType res = engine->evaluate(m_scriptEngineContext->initScript()); - if (res.isBool()) return res.toBool(); -#ifdef USE_QJSENGINE - if (res.isError()){ - QMessageBox::critical(0,tr("Error"), - QString("Line %1: %2 ").arg(res.property("lineNumber").toString()) - .arg(res.toString()) - ); - return false; - } -#else - if (engine->hasUncaughtException()) { - QMessageBox::critical(0,tr("Error"), - QString("Line %1: %2 ").arg(engine->uncaughtExceptionLineNumber()) - .arg(engine->uncaughtException().toString()) - ); - return false; - } -#endif - } - return true; -} - void ReportRender::initDatasources(){ try{ datasources()->setAllDatasourcesToFirst(); @@ -222,67 +193,55 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) m_curentNameIndex = 0; m_patternPageItem = patternPage->pageItem(); - if (m_patternPageItem->resetPageNumber() && m_pageCount>0) { resetPageNumber(PageReset); } + m_renderCanceled = false; BandDesignIntf* reportFooter = m_patternPageItem->bandByType(BandDesignIntf::ReportFooter); m_reportFooterHeight = 0; if (reportFooter) m_reportFooterHeight = reportFooter->height(); + initGroups(); -#ifdef HAVE_UI_LOADER - initDialogs(); -#endif + clearPageMap(); - if (m_scriptEngineContext){ - baseDesignIntfToScript(patternPage->pageItem()); - foreach (BaseDesignIntf* item, patternPage->pageItem()->childBaseItems()){ - baseDesignIntfToScript(item); - } + try{ + datasources()->setAllDatasourcesToFirst(); + datasources()->clearGroupFuntionsExpressions(); + } catch(ReportError &exception){ + //TODO possible should thow exeption + QMessageBox::critical(0,tr("Error"),exception.what()); + return; } - if (runInitScript()){ + clearPageMap(); + startNewPage(true); - clearPageMap(); + renderReportHeader(m_patternPageItem, AfterPageHeader); - try{ - datasources()->setAllDatasourcesToFirst(); - datasources()->clearGroupFuntionsExpressions(); - } catch(ReportError &exception){ - //TODO possible should thow exeption - QMessageBox::critical(0,tr("Error"),exception.what()); - return; - } + BandDesignIntf* lastRenderedBand = 0; + for (int i=0;idataBandCount() && !m_renderCanceled;i++){ + lastRenderedBand = m_patternPageItem->dataBandAt(i); + initDatasource(lastRenderedBand->datasourceName()); + renderDataBand(lastRenderedBand); + if (idataBandCount()-1) closeFooterGroup(lastRenderedBand); + } - clearPageMap(); - startNewPage(true); + if (reportFooter) + renderBand(reportFooter, 0, StartNewPageAsNeeded); + if (lastRenderedBand && lastRenderedBand->keepFooterTogether()) + closeFooterGroup(lastRenderedBand); - renderReportHeader(m_patternPageItem, AfterPageHeader); + BandDesignIntf* tearOffBand = m_patternPageItem->bandByType(BandDesignIntf::TearOffBand); + if (tearOffBand) + renderBand(tearOffBand, 0, StartNewPageAsNeeded); - BandDesignIntf* lastRenderedBand = 0; - for (int i=0;idataBandCount() && !m_renderCanceled;i++){ - lastRenderedBand = m_patternPageItem->dataBandAt(i); - initDatasource(lastRenderedBand->datasourceName()); - renderDataBand(lastRenderedBand); - if (idataBandCount()-1) closeFooterGroup(lastRenderedBand); - } - - if (reportFooter) - renderBand(reportFooter, 0, StartNewPageAsNeeded); - if (lastRenderedBand && lastRenderedBand->keepFooterTogether()) - closeFooterGroup(lastRenderedBand); - - BandDesignIntf* tearOffBand = m_patternPageItem->bandByType(BandDesignIntf::TearOffBand); - if (tearOffBand) - renderBand(tearOffBand, 0, StartNewPageAsNeeded); - - savePage(true); + savePage(true); #ifndef USE_QJSENGINE - ScriptEngineManager::instance().scriptEngine()->popContext(); + ScriptEngineManager::instance().scriptEngine()->popContext(); #endif - } + } int ReportRender::pageCount() @@ -325,31 +284,6 @@ void ReportRender::initVariables() m_datasources->setReportVariable("#PAGE_COUNT",0); } -#ifdef HAVE_UI_LOADER - -#ifdef USE_QJSENGINE -void registerChildObjects(ScriptEngineType* se, ScriptValueType* sv){ - foreach(QObject* obj, sv->toQObject()->children()){ - ScriptValueType child = se->newQObject(obj); - sv->setProperty(obj->objectName(),child); - registerChildObjects(se, &child); - } -} -#endif -void ReportRender::initDialogs(){ - if (m_scriptEngineContext){ - ScriptEngineType* se = ScriptEngineManager::instance().scriptEngine(); - foreach(DialogDescriber::Ptr dialog, m_scriptEngineContext->dialogDescribers()){ - ScriptValueType sv = se->newQObject(m_scriptEngineContext->getDialog(dialog->name())); -#ifdef USE_QJSENGINE - registerChildObjects(se,&sv); -#endif - se->globalObject().setProperty(dialog->name(),sv); - } - } -} -#endif - void ReportRender::clearPageMap() { m_renderedPages.clear(); @@ -548,7 +482,6 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) if (header && !header->printAlways()) renderDataHeader(header); - //renderChildHeader(dataBand,PrintNotAlwaysPrintable); renderGroupHeader(dataBand, bandDatasource, true); bool firstTime = true; @@ -662,14 +595,10 @@ void ReportRender::renderPageItems(PageItemDesignIntf* patternPage) m_renderPageItem, m_renderPageItem); pageItems.append(cloneItem); - //cloneItem->updateItemSize(m_datasources); } } m_renderPageItem->restoreLinks(); m_renderPageItem->updateSubItemsSize(FirstPass,m_datasources); -// foreach(BaseDesignIntf* item, pageItems){ -// item->updateItemSize(m_datasources); -// } } qreal ReportRender::calcPageFooterHeight(PageItemDesignIntf *patternPage) @@ -1068,9 +997,6 @@ void ReportRender::secondRenderPass(ReportPages renderedPages) foreach(BaseDesignIntf* item, page->childBaseItems()){ item->updateItemSize(m_datasources, SecondPass); } -// foreach(BandDesignIntf* band, page->childBands()){ -// band->updateItemSize(m_datasources, SecondPass); -// } } } @@ -1080,7 +1006,6 @@ BandDesignIntf *ReportRender::saveUppperPartReturnBottom(BandDesignIntf *band, i BandDesignIntf* upperBandPart = dynamic_cast(band->cloneUpperPart(sliceHeight)); BandDesignIntf* bottomBandPart = dynamic_cast(band->cloneBottomPart(sliceHeight)); if (!bottomBandPart->isEmpty()){ - //bottomBandPart->updateItemSize(FirstPass,height); if (patternBand->keepFooterTogether()) closeFooterGroup(patternBand); } @@ -1097,8 +1022,7 @@ BandDesignIntf *ReportRender::saveUppperPartReturnBottom(BandDesignIntf *band, i savePage(); startNewPage(); } -// if (!bottomBandPart->isEmpty() && patternBand->keepFooterTogether()) -// openFooterGroup(patternBand); + delete band; return bottomBandPart; } @@ -1107,7 +1031,7 @@ BandDesignIntf *ReportRender::renderData(BandDesignIntf *patternBand) { BandDesignIntf* bandClone = dynamic_cast(patternBand->cloneItem(PreviewMode)); - baseDesignIntfToScript(bandClone); + m_scriptEngineContext->baseDesignIntfToScript(bandClone); emit(patternBand->beforeRender()); if (patternBand->isFooter()){ @@ -1120,7 +1044,7 @@ BandDesignIntf *ReportRender::renderData(BandDesignIntf *patternBand) bandClone->updateItemSize(m_datasources); - baseDesignIntfToScript(bandClone); + m_scriptEngineContext->baseDesignIntfToScript(bandClone); emit(patternBand->afterData()); return bandClone; @@ -1143,7 +1067,7 @@ void ReportRender::startNewPage(bool isFirst) initColumns(); initRenderPage(); - baseDesignIntfToScript(m_renderPageItem); + m_scriptEngineContext->baseDesignIntfToScript(m_renderPageItem); m_renderPageItem->setObjectName(QLatin1String("ReportPage")+QString::number(m_pageCount)); m_maxHeightByColumn[m_currentColumn]=m_renderPageItem->pageRect().height(); @@ -1360,37 +1284,4 @@ void ReportRender::cancelRender(){ m_renderCanceled = true; } -void ReportRender::baseDesignIntfToScript(BaseDesignIntf *item) -{ - if ( item ) { - - if (item->metaObject()->indexOfSignal("beforeRender()")!=-1) - item->disconnect(SIGNAL(beforeRender())); - if (item->metaObject()->indexOfSignal("afterData()")!=-1) - item->disconnect(SIGNAL(afterData())); - if (item->metaObject()->indexOfSignal("afterRender()")!=-1) - item->disconnect(SIGNAL(afterRender())); - - ScriptEngineType* engine = ScriptEngineManager::instance().scriptEngine(); - -#ifdef USE_QJSENGINE - //sItem = engine->newQObject(item); - ScriptValueType sItem = getCppOwnedJSValue(*engine, item); - engine->globalObject().setProperty(item->patternName(), sItem); -#else - ScriptValueType sItem = engine->globalObject().property(item->patternName()); - if (sItem.isValid()){ - engine->newQObject(sItem, item); - } else { - sItem = engine->newQObject(item); - engine->globalObject().setProperty(item->patternName(),sItem); - } -#endif - foreach(BaseDesignIntf* child, item->childBaseItems()){ - baseDesignIntfToScript(child); - } - } - -} - -} +} // namespace LimeReport diff --git a/limereport/lrreportrender.h b/limereport/lrreportrender.h index 21048c9..cb3bca1 100644 --- a/limereport/lrreportrender.h +++ b/limereport/lrreportrender.h @@ -87,29 +87,20 @@ signals: public slots: void cancelRender(); private: - - void baseDesignIntfToScript(BaseDesignIntf* item); - - - void renderPage(PageDesignIntf *patternPage); void initDatasources(); void initDatasource(const QString &name); void initRenderPage(); -#ifdef HAVE_UI_LOADER - void initDialogs(); -#endif void initVariables(); - bool runInitScript(); + void initGroups(); void clearPageMap(); + + void renderPage(PageDesignIntf *patternPage); BandDesignIntf* renderBand(BandDesignIntf *patternBand, BandDesignIntf *bandData, DataRenderMode mode = NotStartNewPage, bool isLast = false); void renderDataBand(BandDesignIntf* dataBand); void renderPageHeader(PageItemDesignIntf* patternPage); void renderReportHeader(PageItemDesignIntf* patternPage, PageRenderStage stage); void renderPageFooter(PageItemDesignIntf* patternPage); - void moveTearOffBand(); void renderPageItems(PageItemDesignIntf* patternPage); - qreal calcPageFooterHeight(PageItemDesignIntf* patternPage); - qreal calcSlicePercent(qreal height); void renderChildHeader(BandDesignIntf* parent, BandPrintMode printMode); void renderChildFooter(BandDesignIntf* parent, BandPrintMode printMode); void renderChildBands(BandDesignIntf* parentBand); @@ -117,8 +108,10 @@ private: void renderDataHeader(BandDesignIntf* header); void renderGroupHeader(BandDesignIntf* parentBand, IDataSource* dataSource, bool firstTime); void renderGroupFooter(BandDesignIntf* parentBand); + void moveTearOffBand(); + qreal calcPageFooterHeight(PageItemDesignIntf* patternPage); + qreal calcSlicePercent(qreal height); - void initGroups(); bool containsGroupsFunction(BandDesignIntf* band); void extractGroupsFunction(BandDesignIntf* band); void replaceGroupsFunction(BandDesignIntf* band); @@ -169,10 +162,7 @@ private: QMultiMap< BandDesignIntf*, GroupBandsHolder* > m_childBands; QList m_reprintableBands; QList m_recalcBands; -// QList m_lastRenderedHeaders; - //int m_maxHeightByColumn[0]; - //int m_currentStartDataPos; int m_currentIndex; int m_pageCount; diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index 785640a..6a781cd 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -32,12 +32,14 @@ #include #include #include +#include #ifdef HAVE_UI_LOADER #include #include #include #endif #include "lrdatasourcemanager.h" +#include "lrbasedesignintf.h" Q_DECLARE_METATYPE(QColor) Q_DECLARE_METATYPE(QFont) @@ -192,146 +194,9 @@ void ScriptEngineModel::updateModel() } categ->addChild(funcDesc.name,funcDesc.description,ScriptEngineNode::Function,QIcon(":/report/images/function")); } - //reset(); endResetModel(); } -//QScriptValue line(QScriptContext* pcontext, QScriptEngine* pengine){ -// ScriptEngineManager* sm = qscriptvalue_cast(pcontext->callee().data()); -// DataSourceManager* dm = sm->dataManager(); -// QString band = pcontext->argument(0).toString(); -// QScriptValue res; -// QString varName = QLatin1String("line_")+band.toLower(); -// if (dm->variable(varName).isValid()){ -// res=pengine->newVariant(dm->variable(varName)); -// } else res=pengine->newVariant(QString("Variable line for band %1 not found").arg(band)); -// return res; -//} - -//QScriptValue setVariable(QScriptContext* pcontext, QScriptEngine* /*pengine*/){ - -// QString name = pcontext->argument(0).toString(); -// QVariant value = pcontext->argument(1).toVariant(); - -// ScriptEngineManager* sm = qscriptvalue_cast(pcontext->callee().data()); -// DataSourceManager* dm = sm->dataManager(); - -// dm->changeVariable(name,value); -// return QScriptValue(); -//} - -//QScriptValue getVariable(QScriptContext* pcontext, QScriptEngine* pengine){ - -// QString name = pcontext->argument(0).toString(); - -// ScriptEngineManager* sm = qscriptvalue_cast(pcontext->callee().data()); -// DataSourceManager* dm = sm->dataManager(); -// QScriptValue res = pengine->newVariant(dm->variable(name)); - -// return res; -//} - -//QScriptValue getField(QScriptContext* pcontext, QScriptEngine* pengine){ - -// QString name = pcontext->argument(0).toString(); - -// ScriptEngineManager* sm = qscriptvalue_cast(pcontext->callee().data()); -// DataSourceManager* dm = sm->dataManager(); -// QScriptValue res = pengine->newVariant(dm->fieldData(name)); - -// return res; -//} - -//QScriptValue numberFormat(QScriptContext* pcontext, QScriptEngine* pengine){ -// QVariant value = pcontext->argument(0).toVariant(); -// char format = (pcontext->argumentCount()>1)?pcontext->argument(1).toString()[0].toLatin1():'f'; -// int precision = (pcontext->argumentCount()>2)?pcontext->argument(2).toInt32():2; -// QString locale = (pcontext->argumentCount()>3)?pcontext->argument(3).toString():""; -// QScriptValue res = (locale.isEmpty())?pengine->newVariant(QString::number(value.toDouble(),format,precision)): -// pengine->newVariant(QLocale(locale).toString(value.toDouble(),format,precision)); -// return res; -//} -//#if QT_VERSION>0x040800 -//QScriptValue currencyFormat(QScriptContext* pcontext, QScriptEngine* pengine){ -// QVariant value = pcontext->argument(0).toVariant(); -// QString locale = (pcontext->argumentCount()>1)?pcontext->argument(1).toString():QLocale::system().name(); -// return pengine->newVariant(QLocale(locale).toCurrencyString(value.toDouble())); -//} - -//QScriptValue currencyUSBasedFormat(QScriptContext* pcontext, QScriptEngine* pengine){ -// QVariant value = pcontext->argument(0).toVariant(); -// QString CurrencySymbol = (pcontext->argumentCount()>1)?pcontext->argument(1).toString():QLocale::system().currencySymbol(); -// // Format it using USA locale -// QString vTempStr=QLocale(QLocale::English, QLocale::UnitedStates).toCurrencyString(value.toDouble()); -// // Replace currency symbol if necesarry -// if (CurrencySymbol!="") vTempStr.replace("$", CurrencySymbol); -// return pengine->newVariant(vTempStr); -//} -//#endif -//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"; -// QScriptValue res = pengine->newVariant(QLocale().toString(value.toDate(),format)); -// return res; -//} - -//QScriptValue timeFormat(QScriptContext* pcontext, QScriptEngine* pengine){ -// QVariant value = pcontext->argument(0).toVariant(); -// QString format = (pcontext->argumentCount()>1)?pcontext->argument(1).toString().toLatin1():"hh:mm"; -// QScriptValue res = pengine->newVariant(QLocale().toString(value.toTime(),format)); -// return res; -//} - -//QScriptValue dateTimeFormat(QScriptContext* pcontext, QScriptEngine* pengine){ -// QVariant value = pcontext->argument(0).toVariant(); -// QString format = (pcontext->argumentCount()>1)?pcontext->argument(1).toString().toLatin1():"dd.MM.yyyy hh:mm"; -// QScriptValue res = pengine->newVariant(QLocale().toString(value.toDateTime(),format)); -// return res; -//} - -//QScriptValue now(QScriptContext* /*pcontext*/, QScriptEngine* pengine){ -// return pengine->newVariant(QDateTime::currentDateTime()); -//} - -//QScriptValue date(QScriptContext* /*pcontext*/, QScriptEngine* pengine){ -// return pengine->newVariant(QDate::currentDate()); -//} - -//QScriptValue callGroupFunction(const QString& functionName, QScriptContext* pcontext, QScriptEngine* pengine){ - -// ScriptEngineManager* sm = qscriptvalue_cast(pcontext->callee().data()); -// DataSourceManager* dm = sm->dataManager(); - -// QString expression; -// QString band; - -// if (functionName.compare("COUNT",Qt::CaseInsensitive) == 0 && pcontext->argumentCount()==1){ -// expression = " "; -// band = pcontext->argument(0).toString(); -// } else { -// expression = dm->getExpression(pcontext->argument(0).toString()); -// band = pcontext->argument(1).toString(); -// } - -// QScriptValue res; -// GroupFunction* gf = dm->groupFunction(functionName,expression,band); -// if (gf){ -// if (gf->isValid()){ -// res=pengine->newVariant(gf->calculate()); -// }else{ -// res=pengine->newVariant(gf->error()); -// } -// } -// else { -// res=pengine->newVariant(QString(QObject::tr("Function %1 not found or have wrong arguments").arg(functionName))); -// } -// return res; -//} - -//QScriptValue groupFunction(QScriptContext* pcontext, QScriptEngine* pengine){ -// return callGroupFunction(pcontext->callee().property("functionName").toString(),pcontext,pengine); -//} - ScriptEngineManager::~ScriptEngineManager() { delete m_model; @@ -896,20 +761,6 @@ ScriptEngineManager::ScriptEngineManager() createSetVariableFunction(); createGetFieldFunction(); createGetVariableFunction(); - -// addFunction("line",line,"SYSTEM", "line(\""+tr("BandName")+"\")"); -// addFunction("numberFormat",numberFormat,"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("currencyFormat",currencyFormat,"NUMBER","currencyFormat(\""+tr("Value")+"\",\""+tr("Locale")+"\")"); -// addFunction("currencyUSBasedFormat",currencyUSBasedFormat,"NUMBER","currencyUSBasedFormat(\""+tr("Value")+",\""+tr("CurrencySymbol")+"\")"); -// addFunction("setVariable", setVariable, "GENERAL", "setVariable(\""+tr("Name")+"\",\""+tr("Value")+"\")"); #ifndef USE_QJSENGINE QScriptValue colorCtor = m_scriptEngine->newFunction(constructColor); m_scriptEngine->globalObject().setProperty("QColor", colorCtor); @@ -919,15 +770,6 @@ ScriptEngineManager::ScriptEngineManager() QScriptValue fontConstructor = m_scriptEngine->newFunction(QFontPrototype::constructorQFont, fontProto); m_scriptEngine->globalObject().setProperty("QFont", fontConstructor); #endif -// foreach(QString func, dataManager()->groupFunctionNames()){ -// addFunction(func, groupFunction,"GROUP FUNCTIONS", func+"(\""+tr("FieldName")+"\",\""+tr("BandName")+"\")"); -// } - -// foreach(ScriptFunctionDesc func, m_functions){ -// if (func.type==ScriptFunctionDesc::Native) -// m_scriptEngine->globalObject().setProperty(func.name,func.scriptValue); -// } - m_model = new ScriptEngineModel(this); } @@ -1275,6 +1117,93 @@ QString ScriptEngineContext::getNewDialogName() } #endif + +void ScriptEngineContext::baseDesignIntfToScript(BaseDesignIntf* item) +{ + if ( item ) { + + if (item->metaObject()->indexOfSignal("beforeRender()")!=-1) + item->disconnect(SIGNAL(beforeRender())); + if (item->metaObject()->indexOfSignal("afterData()")!=-1) + item->disconnect(SIGNAL(afterData())); + if (item->metaObject()->indexOfSignal("afterRender()")!=-1) + item->disconnect(SIGNAL(afterRender())); + + ScriptEngineType* engine = ScriptEngineManager::instance().scriptEngine(); + +#ifdef USE_QJSENGINE + //sItem = engine->newQObject(item); + ScriptValueType sItem = getCppOwnedJSValue(*engine, item); + engine->globalObject().setProperty(item->patternName(), sItem); +#else + ScriptValueType sItem = engine->globalObject().property(item->patternName()); + if (sItem.isValid()){ + engine->newQObject(sItem, item); + } else { + sItem = engine->newQObject(item); + engine->globalObject().setProperty(item->patternName(),sItem); + } +#endif + foreach(BaseDesignIntf* child, item->childBaseItems()){ + baseDesignIntfToScript(child); + } + } +} + +#ifdef HAVE_UI_LOADER + +#ifdef USE_QJSENGINE +void registerChildObjects(ScriptEngineType* se, ScriptValueType* sv){ + foreach(QObject* obj, sv->toQObject()->children()){ + ScriptValueType child = se->newQObject(obj); + sv->setProperty(obj->objectName(),child); + registerChildObjects(se, &child); + } +} +#endif + +void ScriptEngineContext::initDialogs(){ + ScriptEngineType* se = ScriptEngineManager::instance().scriptEngine(); + foreach(DialogDescriber::Ptr dialog, dialogDescribers()){ + ScriptValueType sv = se->newQObject(getDialog(dialog->name())); +#ifdef USE_QJSENGINE + registerChildObjects(se,&sv); +#endif + se->globalObject().setProperty(dialog->name(),sv); + } +} + +#endif + + +bool ScriptEngineContext::runInitScript(){ + + ScriptEngineType* engine = ScriptEngineManager::instance().scriptEngine(); +#ifndef USE_QJSENGINE + engine->pushContext(); +#endif + ScriptValueType res = engine->evaluate(initScript()); + if (res.isBool()) return res.toBool(); +#ifdef USE_QJSENGINE + if (res.isError()){ + QMessageBox::critical(0,tr("Error"), + QString("Line %1: %2 ").arg(res.property("lineNumber").toString()) + .arg(res.toString()) + ); + return false; + } +#else + if (engine->hasUncaughtException()) { + QMessageBox::critical(0,tr("Error"), + QString("Line %1: %2 ").arg(engine->uncaughtExceptionLineNumber()) + .arg(engine->uncaughtException().toString()) + ); + return false; + } +#endif + return true; +} + QString ScriptEngineContext::initScript() const { return m_initScript; diff --git a/limereport/lrscriptenginemanager.h b/limereport/lrscriptenginemanager.h index 235599a..2e5786f 100644 --- a/limereport/lrscriptenginemanager.h +++ b/limereport/lrscriptenginemanager.h @@ -54,6 +54,7 @@ namespace LimeReport{ class DataSourceManager; +class BaseDesignIntf; struct ScriptFunctionDesc{ enum FuncType {Native,Script}; @@ -153,14 +154,19 @@ public: void deleteDialog(const QString& dialogName); QDialog *getDialog(const QString &dialogName); QString getNewDialogName(); + void initDialogs(); #endif + void baseDesignIntfToScript(BaseDesignIntf *item); void clear(); QString initScript() const; void setInitScript(const QString& initScript); + bool runInitScript(); +#ifdef HAVE_UI_LOADER signals: void dialogNameChanged(QString dialogName); void dialogDeleted(QString dialogName); void dialogAdded(QString dialogName); +#endif protected: QObject* createElement(const QString& collectionName,const QString& elementType); int elementsCount(const QString& collectionName); diff --git a/limereport/scriptbrowser/lrscriptbrowser.cpp b/limereport/scriptbrowser/lrscriptbrowser.cpp index 1ef6b73..98d0568 100644 --- a/limereport/scriptbrowser/lrscriptbrowser.cpp +++ b/limereport/scriptbrowser/lrscriptbrowser.cpp @@ -59,7 +59,9 @@ void ScriptBrowser::setReportEditor(ReportDesignWidget* report) m_report=report; connect(m_report,SIGNAL(cleared()),this,SLOT(slotClear())); connect(m_report,SIGNAL(loaded()),this,SLOT(slotUpdate())); +#ifdef HAVE_UI_LOADER connect(m_report->scriptContext(), SIGNAL(dialogAdded(QString)), this, SLOT(slotDialogAdded(QString))); +#endif updateFunctionTree(); } @@ -139,12 +141,13 @@ void ScriptBrowser::slotUpdate() updateFunctionTree(); } +#ifdef HAVE_UI_LOADER + void ScriptBrowser::slotDialogAdded(QString) { updateDialogsTree(); } -#ifdef HAVE_UI_LOADER void ScriptBrowser::on_tbAddDialog_clicked() { QFileDialog fileDialog(this); diff --git a/limereport/scriptbrowser/lrscriptbrowser.h b/limereport/scriptbrowser/lrscriptbrowser.h index dd7d9ae..54bf077 100644 --- a/limereport/scriptbrowser/lrscriptbrowser.h +++ b/limereport/scriptbrowser/lrscriptbrowser.h @@ -62,8 +62,8 @@ protected: private slots: void slotClear(); void slotUpdate(); - void slotDialogAdded(QString); #ifdef HAVE_UI_LOADER + void slotDialogAdded(QString); void on_tbAddDialog_clicked(); void on_tbRunDialog_clicked(); void on_tbDeleteDialog_clicked(); From e3df7c88d16632f43b031965f66445c41bfa91db Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 21 Apr 2017 23:03:56 +0300 Subject: [PATCH 104/136] Print range from QPrinter fix --- include/lrreportengine.h | 2 +- limereport/lrpreviewreportwidget.cpp | 5 ++--- limereport/lrreportengine.cpp | 29 +++++++++++----------------- limereport/lrreportengine.h | 2 +- limereport/lrreportengine_p.h | 4 ++-- 5 files changed, 17 insertions(+), 25 deletions(-) diff --git a/include/lrreportengine.h b/include/lrreportengine.h index 99728e1..564dabd 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -73,7 +73,7 @@ public: explicit ReportEngine(QObject *parent = 0); ~ReportEngine(); bool printReport(QPrinter *printer=0); - bool printPages(ReportPages pages, QPrinter *printer, PrintRange printRange = PrintRange()); + bool printPages(ReportPages pages, QPrinter *printer); void printToFile(const QString& fileName); PageDesignIntf *createPreviewScene(QObject *parent = 0); bool printToPDF(const QString& fileName); diff --git a/limereport/lrpreviewreportwidget.cpp b/limereport/lrpreviewreportwidget.cpp index 986e95d..4e36335 100644 --- a/limereport/lrpreviewreportwidget.cpp +++ b/limereport/lrpreviewreportwidget.cpp @@ -163,8 +163,7 @@ void PreviewReportWidget::print() if (!d_ptr->m_reportPages.isEmpty()) ReportEnginePrivate::printReport( d_ptr->m_reportPages, - printer, - PrintRange(dialog.printRange(),dialog.fromPage(),dialog.toPage()) + printer ); foreach(PageItemDesignIntf::Ptr pageItem, d_ptr->m_reportPages){ d_ptr->m_previewPage->reactivatePageItem(pageItem); @@ -184,7 +183,7 @@ void PreviewReportWidget::printToPDF() printer.setOutputFileName(fileName); printer.setOutputFormat(QPrinter::PdfFormat); if (!d_ptr->m_reportPages.isEmpty()){ - ReportEnginePrivate::printReport(d_ptr->m_reportPages,printer,PrintRange()); + ReportEnginePrivate::printReport(d_ptr->m_reportPages,printer); } foreach(PageItemDesignIntf::Ptr pageItem, d_ptr->m_reportPages){ d_ptr->m_previewPage->reactivatePageItem(pageItem); diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index dbd1882..4d3aa3d 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -208,7 +208,7 @@ void ReportEnginePrivate::printReport(ItemsReaderIntf::Ptr reader, QPrinter& pri } } -void ReportEnginePrivate::printReport(ReportPages pages, QPrinter &printer, const PrintRange& printRange) +void ReportEnginePrivate::printReport(ReportPages pages, QPrinter &printer) { LimeReport::PageDesignIntf renderPage; renderPage.setItemMode(PrintMode); @@ -216,13 +216,13 @@ void ReportEnginePrivate::printReport(ReportPages pages, QPrinter &printer, cons bool isFirst = true; int currenPage = 1; - foreach(PageItemDesignIntf::Ptr page,pages){ + foreach(PageItemDesignIntf::Ptr page, pages){ if ( - (printRange.rangeType()==QPrintDialog::AllPages) || - ( (printRange.rangeType()==QPrintDialog::PageRange) && - (currenPage>=printRange.fromPage()) && - (currenPage<=printRange.toPage()) + (printer.printRange() == QPrinter::AllPages) || + ( (printer.printRange()==QPrinter::PageRange) && + (currenPage>=printer.fromPage()) && + (currenPage<=printer.toPage()) ) ) { @@ -286,7 +286,7 @@ bool ReportEnginePrivate::printReport(QPrinter* printer) ReportPages pages = renderToPages(); dataManager()->setDesignTime(true); if (pages.count()>0){ - printReport(pages,*printer,PrintRange()); + printReport(pages,*printer); } } catch(ReportError &exception){ saveError(exception.what()); @@ -295,18 +295,12 @@ bool ReportEnginePrivate::printReport(QPrinter* printer) } else return false; } -bool ReportEnginePrivate::printPages(ReportPages pages, QPrinter *printer, PrintRange printRange) +bool ReportEnginePrivate::printPages(ReportPages pages, QPrinter *printer) { if (!printer&&!m_printerSelected){ QPrintDialog dialog(m_printer.data(),QApplication::activeWindow()); m_printerSelected = dialog.exec()!=QDialog::Rejected; - if (m_printerSelected){ - printRange.setRangeType(dialog.printRange()); - printRange.setFromPage(dialog.fromPage()); - printRange.setToPage(dialog.toPage()); - } - } if (!printer&&!m_printerSelected) return false; @@ -316,8 +310,7 @@ bool ReportEnginePrivate::printPages(ReportPages pages, QPrinter *printer, Print if (pages.count()>0){ printReport( pages, - *printer, - printRange + *printer ); } } catch(ReportError &exception){ @@ -828,9 +821,9 @@ bool ReportEngine::printReport(QPrinter *printer) return d->printReport(printer); } -bool ReportEngine::printPages(ReportPages pages, QPrinter *printer, PrintRange printRange){ +bool ReportEngine::printPages(ReportPages pages, QPrinter *printer){ Q_D(ReportEngine); - return d->printPages(pages,printer, printRange); + return d->printPages(pages,printer); } void ReportEngine::printToFile(const QString &fileName) diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index 99728e1..564dabd 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -73,7 +73,7 @@ public: explicit ReportEngine(QObject *parent = 0); ~ReportEngine(); bool printReport(QPrinter *printer=0); - bool printPages(ReportPages pages, QPrinter *printer, PrintRange printRange = PrintRange()); + bool printPages(ReportPages pages, QPrinter *printer); void printToFile(const QString& fileName); PageDesignIntf *createPreviewScene(QObject *parent = 0); bool printToPDF(const QString& fileName); diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index f900217..ade298e 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -63,7 +63,7 @@ class ReportEnginePrivate : public QObject, public ICollectionContainer friend class PreviewReportWidget; public: static void printReport(ItemsReaderIntf::Ptr reader, QPrinter &printer); - static void printReport(ReportPages pages, QPrinter &printer, const PrintRange &printRange); + static void printReport(ReportPages pages, QPrinter &printer); public: explicit ReportEnginePrivate(QObject *parent = 0); virtual ~ReportEnginePrivate(); @@ -85,7 +85,7 @@ public: void clearReport(); bool printReport(QPrinter *printer=0); - bool printPages(ReportPages pages, QPrinter *printer, PrintRange printRange = PrintRange()); + bool printPages(ReportPages pages, QPrinter *printer); void printToFile(const QString& fileName); bool printToPDF(const QString& fileName); void previewReport(PreviewHints hints = PreviewBarsUserSetting); From 2312c21d840cf55692a9b4e9ef47b568625876ea Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 15 May 2017 20:30:54 +0300 Subject: [PATCH 105/136] followTo has been fixed --- limereport/items/lrtextitem.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 608f0ed..64e9248 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -491,7 +491,9 @@ TextItem::TextPtr TextItem::textDocument() const setTextFont(text,_font); } - //text->documentLayout(); + if (follower()) + text->documentLayout(); + if (m_lineSpacing != 1 || m_textIndent !=0 ){ for ( QTextBlock block = text->begin(); block.isValid(); block = block.next()) From fb494db9479afd3029eecb01deea429376339d3b Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 2 Jun 2017 22:11:53 +0300 Subject: [PATCH 106/136] Extended area has been added to page in design mode --- limereport/lrpagedesignintf.cpp | 2 +- limereport/lrpageitemdesignintf.cpp | 76 +++++++++++++++++++++++------ limereport/lrpageitemdesignintf.h | 12 ++++- 3 files changed, 74 insertions(+), 16 deletions(-) diff --git a/limereport/lrpagedesignintf.cpp b/limereport/lrpagedesignintf.cpp index 0928856..cbd2161 100644 --- a/limereport/lrpagedesignintf.cpp +++ b/limereport/lrpagedesignintf.cpp @@ -130,7 +130,7 @@ void PageDesignIntf::updatePageRect() } this->setSceneRect(-Const::SCENE_MARGIN, -Const::SCENE_MARGIN, pageItem()->geometry().width() + Const::SCENE_MARGIN*2, - pageItem()->geometry().height() + Const::SCENE_MARGIN*2); + pageItem()->boundingRect().height() + Const::SCENE_MARGIN*2); emit sceneRectChanged(sceneRect()); } diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index 150df06..7c23d12 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -49,7 +49,8 @@ PageItemDesignIntf::PageItemDesignIntf(QObject *owner, QGraphicsItem *parent) : ItemsContainerDesignInft("PageItem",owner,parent), m_topMargin(0), m_bottomMargin(0), m_leftMargin(0), m_rightMargin(0), m_pageOrientaion(Portrait), m_pageSize(A4), m_sizeChainging(false), - m_fullPage(false), m_oldPrintMode(false), m_resetPageNumber(false) + m_fullPage(false), m_oldPrintMode(false), m_resetPageNumber(false), + m_isExtendedInDesignMode(false), m_extendedHeight(1000) { setFixedPos(true); setPossibleResizeDirectionFlags(Fixed); @@ -61,7 +62,8 @@ PageItemDesignIntf::PageItemDesignIntf(const PageSize pageSize, const QRectF &re ItemsContainerDesignInft("PageItem",owner,parent), m_topMargin(0), m_bottomMargin(0), m_leftMargin(0), m_rightMargin(0), m_pageOrientaion(Portrait), m_pageSize(pageSize), m_sizeChainging(false), - m_fullPage(false), m_oldPrintMode(false), m_resetPageNumber(false) + m_fullPage(false), m_oldPrintMode(false), m_resetPageNumber(false), + m_isExtendedInDesignMode(false), m_extendedHeight(1000) { setFixedPos(true); setPossibleResizeDirectionFlags(Fixed); @@ -79,14 +81,24 @@ void PageItemDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsIte { if (itemMode() & DesignMode){ + QRectF rect = pageRect(); + if (isExtendedInDesignMode()) rect.adjust(0,0,0,m_extendedHeight); ppainter->save(); ppainter->setOpacity(0.8); ppainter->fillRect(boundingRect(),pageBorderColor()); ppainter->setOpacity(1); - ppainter->fillRect(pageRect(),Qt::white); - paintGrid(ppainter); + ppainter->fillRect(rect,Qt::white); + paintGrid(ppainter,rect); ppainter->setPen(gridColor()); ppainter->drawRect(boundingRect()); + if (m_isExtendedInDesignMode){ + QPen pen; + pen.setColor(Qt::red); + pen.setStyle(Qt::DashLine); + pen.setWidth(2); + ppainter->setPen(pen); + ppainter->drawLine(pageRect().bottomLeft(),pageRect().bottomRight()); + } ppainter->restore(); } @@ -140,6 +152,16 @@ QColor PageItemDesignIntf::gridColor() const return QColor(170,200,150); } +QRectF PageItemDesignIntf::boundingRect() const +{ + if (!isExtendedInDesignMode()) + return BaseDesignIntf::boundingRect(); + else { + QRectF result = BaseDesignIntf::boundingRect(); + return result.adjusted(0,0,0,m_extendedHeight); + } +} + void PageItemDesignIntf::clear() { foreach(QGraphicsItem* item, childItems()){ @@ -303,6 +325,32 @@ void PageItemDesignIntf::initColumnsPos(QVector &posByColumns, qreal pos, } } +int PageItemDesignIntf::extendedHeight() const +{ + return m_extendedHeight; +} + +void PageItemDesignIntf::setExtendedHeight(int extendedHeight) +{ + m_extendedHeight = extendedHeight; + PageDesignIntf* page = dynamic_cast(scene()); + if (page) page->updatePageRect(); + update(); +} + +bool PageItemDesignIntf::isExtendedInDesignMode() const +{ + return m_isExtendedInDesignMode; +} + +void PageItemDesignIntf::setExtendedInDesignMode(bool pageIsExtended) +{ + m_isExtendedInDesignMode = pageIsExtended; + PageDesignIntf* page = dynamic_cast(scene()); + if (page) page->updatePageRect(); + update(); +} + bool PageItemDesignIntf::resetPageNumber() const { return m_resetPageNumber; @@ -630,27 +678,27 @@ void PageItemDesignIntf::updateMarginRect() update(); } -void PageItemDesignIntf::paintGrid(QPainter *ppainter) +void PageItemDesignIntf::paintGrid(QPainter *ppainter, QRectF rect) { ppainter->save(); ppainter->setPen(QPen(gridColor())); ppainter->setOpacity(0.5); - for (int i=0;i<=(pageRect().height()-50)/100;i++){ - ppainter->drawLine(pageRect().x(),(i*100)+pageRect().y()+50,pageRect().right(),i*100+pageRect().y()+50); + for (int i=0;i<=(rect.height()-50)/100;i++){ + ppainter->drawLine(rect.x(),(i*100)+rect.y()+50,rect.right(),i*100+rect.y()+50); }; - for (int i=0;i<=((pageRect().width()-50)/100);i++){ - ppainter->drawLine(i*100+pageRect().x()+50,pageRect().y(),i*100+pageRect().x()+50,pageRect().bottom()); + for (int i=0;i<=((rect.width()-50)/100);i++){ + ppainter->drawLine(i*100+rect.x()+50,rect.y(),i*100+rect.x()+50,rect.bottom()); }; ppainter->setPen(QPen(gridColor())); ppainter->setOpacity(1); - for (int i=0;i<=(pageRect().width()/100);i++){ - ppainter->drawLine(i*100+pageRect().x(),pageRect().y(),i*100+pageRect().x(),pageRect().bottom()); + for (int i=0;i<=(rect.width()/100);i++){ + ppainter->drawLine(i*100+rect.x(),rect.y(),i*100+rect.x(),rect.bottom()); }; - for (int i=0;i<=pageRect().height()/100;i++){ - ppainter->drawLine(pageRect().x(),i*100+pageRect().y(),pageRect().right(),i*100+pageRect().y()); + for (int i=0;i<=rect.height()/100;i++){ + ppainter->drawLine(rect.x(),i*100+rect.y(),rect.right(),i*100+rect.y()); }; - ppainter->drawRect(pageRect()); + ppainter->drawRect(rect); ppainter->restore(); } diff --git a/limereport/lrpageitemdesignintf.h b/limereport/lrpageitemdesignintf.h index ef9b06d..f488b07 100644 --- a/limereport/lrpageitemdesignintf.h +++ b/limereport/lrpageitemdesignintf.h @@ -53,6 +53,8 @@ class PageItemDesignIntf : public LimeReport::ItemsContainerDesignInft Q_PROPERTY(bool fullPage READ fullPage WRITE setFullPage) Q_PROPERTY(bool oldPrintMode READ oldPrintMode WRITE setOldPrintMode) Q_PROPERTY(bool resetPageNumber READ resetPageNumber WRITE setResetPageNumber) + Q_PROPERTY(bool isExtendedInDesignMode READ isExtendedInDesignMode WRITE setExtendedInDesignMode) + Q_PROPERTY(int extendedHeight READ extendedHeight WRITE setExtendedHeight) friend class ReportRender; public: enum Orientation { Portrait, Landscape }; @@ -74,6 +76,7 @@ public: virtual QColor selectionColor() const; virtual QColor pageBorderColor() const; virtual QColor gridColor() const; + virtual QRectF boundingRect() const; void clear(); const BandsList& childBands() const {return m_bands;} BandDesignIntf * bandByType(BandDesignIntf::BandsType bandType) const; @@ -118,6 +121,11 @@ public: void setResetPageNumber(bool resetPageNumber); void updateSubItemsSize(RenderPass pass, DataSourceManager *dataManager); + bool isExtendedInDesignMode() const; + void setExtendedInDesignMode(bool isExtendedInDesignMode); + int extendedHeight() const; + void setExtendedHeight(int extendedHeight); + protected slots: void bandDeleted(QObject* band); void bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry); @@ -131,7 +139,7 @@ protected: QColor selectionMarkerColor(){return Qt::transparent;} void preparePopUpMenu(QMenu &menu); private: - void paintGrid(QPainter *ppainter); + void paintGrid(QPainter *ppainter, QRectF rect); void initColumnsPos(QVector&posByColumns, qreal pos, int columnCount); private: int m_topMargin; @@ -146,6 +154,8 @@ private: bool m_fullPage; bool m_oldPrintMode; bool m_resetPageNumber; + bool m_isExtendedInDesignMode; + int m_extendedHeight; }; typedef QList ReportPages; From 0786ee1f32f86560a5191f13dac4000659cbde25 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 7 Jun 2017 23:47:43 +0300 Subject: [PATCH 107/136] Group function pattern has been fixed --- include/lrglobal.h | 3 ++- limereport/lrdatasourcemanager.cpp | 6 +++++- limereport/lrglobal.h | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/lrglobal.h b/include/lrglobal.h index 3f11f78..3c9af32 100644 --- a/include/lrglobal.h +++ b/include/lrglobal.h @@ -84,7 +84,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; diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index d35f670..0942b32 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -258,7 +258,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 diff --git a/limereport/lrglobal.h b/limereport/lrglobal.h index 3f11f78..3c9af32 100644 --- a/limereport/lrglobal.h +++ b/limereport/lrglobal.h @@ -84,7 +84,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; From 801b3b492239293004d0092dbc2596d2481677cf Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 12 Jun 2017 13:11:00 +0300 Subject: [PATCH 108/136] Static build has been fixed --- common.pri | 9 +- limereport/limereport.pri | 4 +- limereport/limereport.pro | 10 +- limereport/lrfactoryinitializer.cpp | 426 ++++++++++++++++++++++++++++ limereport/lrfactoryinitializer.h | 5 + limereport/lrreportengine.cpp | 9 +- 6 files changed, 457 insertions(+), 6 deletions(-) create mode 100644 limereport/lrfactoryinitializer.cpp create mode 100644 limereport/lrfactoryinitializer.h diff --git a/common.pri b/common.pri index 0bb04eb..5af0a16 100644 --- a/common.pri +++ b/common.pri @@ -1,6 +1,11 @@ CONFIG += build_translations 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 +13,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 @@ -82,3 +85,5 @@ lessThan(QT_MAJOR_VERSION, 5){ DEFINES += HAVE_UI_LOADER } } + + diff --git a/limereport/limereport.pri b/limereport/limereport.pri index 605f96a..4e714cf 100644 --- a/limereport/limereport.pri +++ b/limereport/limereport.pri @@ -67,6 +67,7 @@ SOURCES += \ $$REPORT_PATH/items/lrtextitemeditor.cpp \ $$REPORT_PATH/items/lrshapeitem.cpp \ $$REPORT_PATH/items/lrtextitem.cpp \ + $$REPORT_PATH/lrfactoryinitializer.cpp \ $$REPORT_PATH/lrbanddesignintf.cpp \ $$REPORT_PATH/lrpageitemdesignintf.cpp \ $$REPORT_PATH/lrpagedesignintf.cpp \ @@ -159,6 +160,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 \ @@ -209,8 +211,6 @@ FORMS += \ $$REPORT_PATH/lrsettingdialog.ui \ $$REPORT_PATH/scriptbrowser/lrscriptbrowser.ui \ - - RESOURCES += \ $$REPORT_PATH/objectinspector/lobjectinspector.qrc \ $$REPORT_PATH/databrowser/lrdatabrowser.qrc \ diff --git a/limereport/limereport.pro b/limereport/limereport.pro index 6397a71..356cde3 100644 --- a/limereport/limereport.pro +++ b/limereport/limereport.pro @@ -3,6 +3,7 @@ TEMPLATE = lib CONFIG += lib CONFIG += dll +#CONFIG += staticlib CONFIG += create_prl CONFIG += link_prl @@ -12,7 +13,14 @@ macx{ CONFIG += plugin } -DEFINES += LIMEREPORT_EXPORTS +!staticlib:{ + DEFINES += LIMEREPORT_EXPORTS +} + +staticlib:{ + DEFINES += HAVE_STATIC_BUILD + message(STATIC_BUILD) +} EXTRA_FILES += \ $$PWD/lrglobal.cpp \ diff --git a/limereport/lrfactoryinitializer.cpp b/limereport/lrfactoryinitializer.cpp new file mode 100644 index 0000000..d607be5 --- /dev/null +++ b/limereport/lrfactoryinitializer.cpp @@ -0,0 +1,426 @@ +#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" +#include "items/lrbarcodeitem.h" +#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" + +inline 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); +} + +BaseDesignIntf * createBarcodeItem(QObject* owner, LimeReport::BaseDesignIntf* parent){ + return new BarcodeItem(owner,parent); +} + +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 diff --git a/limereport/lrfactoryinitializer.h b/limereport/lrfactoryinitializer.h new file mode 100644 index 0000000..add7eab --- /dev/null +++ b/limereport/lrfactoryinitializer.h @@ -0,0 +1,5 @@ +namespace LimeReport{ + void initReportItems(); + void initObjectInspectorProperties(); + void initSerializators(); +} // namespace LimeReport diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 4d3aa3d..641e3eb 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -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,6 +65,11 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) : m_reportRendering(false), m_resultIsEditable(true), m_passPhrase("HjccbzHjlbyfCkjy"), m_fileWatcher( new QFileSystemWatcher( this ) ) { +#ifdef HAVE_STATIC_BUILD + initReportItems(); + initObjectInspectorProperties(); + initSerializators(); +#endif m_datasources = new DataSourceManager(this); m_datasources->setReportSettings(&m_reportSettings); m_scriptEngineContext = new ScriptEngineContext(this); From 41d09a15ea9a34e42bf93eba40ecc4f424382203 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 12 Jun 2017 13:36:30 +0300 Subject: [PATCH 109/136] Nested groups has been fixed for callback datasources (Thanks to Louis Coetzer) --- limereport/lrdatadesignintf.cpp | 13 ++++++++----- limereport/lrdatadesignintf.h | 3 +++ limereport/lrreportrender.cpp | 9 +++++++-- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index 37b3d4c..c3e9344 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -673,12 +673,15 @@ 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 (!eof()) //Don't read past the end + { + CallbackInfo info; + info.dataType = CallbackInfo::ColumnData; + info.columnName = columnName; + info.index = m_currentRow; + emit getCallbackData(info,result); + } return result; } diff --git a/limereport/lrdatadesignintf.h b/limereport/lrdatadesignintf.h index e2f8134..8737bb2 100644 --- a/limereport/lrdatadesignintf.h +++ b/limereport/lrdatadesignintf.h @@ -53,6 +53,7 @@ public: virtual bool next() = 0; virtual bool hasNext() = 0; virtual bool prior() = 0; + virtual void undoPrior() = 0; virtual void first() = 0; virtual void last() = 0; virtual bool bof() = 0; @@ -354,6 +355,7 @@ public: bool next(); bool hasNext(); bool prior(); + void undoPrior() {m_curRow++;} void first(); void last(); bool eof(); @@ -384,6 +386,7 @@ public: 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;} + void undoPrior() {m_currentRow++;} void first(); void last(){} bool bof(){return m_currentRow == -1;} diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 9e6ea4c..bb88770 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -675,7 +675,7 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da IGroupBand* gb = dynamic_cast(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 +687,12 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da renderBand(footer, 0, StartNewPageAsNeeded); } - dataSource->next(); + if (didGoBack) + { + //New Method to undo prior... Alternatively pass in bool isUndoPrior into next() + dataSource->undoPrior(); + //dataSource->next(); //Also emit changePos, which it should not at this point + } } closeDataGroup(band); // if (gb->isNeedToStartNewPage()){ From 6ed6beb39528885ce3f2ba44f97752385bd49fc8 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 13 Jun 2017 13:03:38 +0300 Subject: [PATCH 110/136] build without zint has been fixed --- limereport/limereport.pri | 11 +++++++++-- limereport/lrfactoryinitializer.cpp | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/limereport/limereport.pri b/limereport/limereport.pri index 4e714cf..25568a7 100644 --- a/limereport/limereport.pri +++ b/limereport/limereport.pri @@ -67,7 +67,6 @@ SOURCES += \ $$REPORT_PATH/items/lrtextitemeditor.cpp \ $$REPORT_PATH/items/lrshapeitem.cpp \ $$REPORT_PATH/items/lrtextitem.cpp \ - $$REPORT_PATH/lrfactoryinitializer.cpp \ $$REPORT_PATH/lrbanddesignintf.cpp \ $$REPORT_PATH/lrpageitemdesignintf.cpp \ $$REPORT_PATH/lrpagedesignintf.cpp \ @@ -92,6 +91,10 @@ SOURCES += \ $$REPORT_PATH/lrsettingdialog.cpp \ $$REPORT_PATH/scriptbrowser/lrscriptbrowser.cpp \ $$REPORT_PATH/lritemscontainerdesignitf.cpp + +contains(CONFIG, staticbuild){ + SOURCES += $$REPORT_PATH/lrfactoryinitializer.cpp +} contains(CONFIG, zint){ SOURCES += $$REPORT_PATH/items/lrbarcodeitem.cpp @@ -193,7 +196,11 @@ HEADERS += \ $$REPORT_PATH/lrpreviewreportwidget_p.h \ $$REPORT_PATH/scriptbrowser/lrscriptbrowser.h \ $$REPORT_PATH/lritemscontainerdesignitf.h - + +contains(CONFIG, staticbuild){ + HEADERS += $$REPORT_PATH/lrfactoryinitializer.h +} + contains(CONFIG,zint){ HEADERS += $$REPORT_PATH/items/lrbarcodeitem.h } diff --git a/limereport/lrfactoryinitializer.cpp b/limereport/lrfactoryinitializer.cpp index d607be5..cf83c8c 100644 --- a/limereport/lrfactoryinitializer.cpp +++ b/limereport/lrfactoryinitializer.cpp @@ -9,7 +9,9 @@ #include "items/lrtextitem.h" +#ifdef HAVE_ZINT #include "items/lrbarcodeitem.h" +#endif #include "items/lrhorizontallayout.h" #include "items/lrimageitem.h" #include "items/lrshapeitem.h" From b17aadb2bb86904b8d3b4b4c157d4ac5952e3293 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 13 Jun 2017 17:48:22 +0300 Subject: [PATCH 111/136] Using group functions in the horizontal layout items has been fixed --- limereport/lrreportrender.cpp | 111 ++++++++++++++++++++-------------- limereport/lrreportrender.h | 11 ++-- 2 files changed, 72 insertions(+), 50 deletions(-) diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index bb88770..77ebdbd 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -330,68 +330,87 @@ void ReportRender::clearPageMap() m_renderedPages.clear(); } -void ReportRender::extractGroupsFunction(BandDesignIntf *band) -{ - foreach(BaseDesignIntf* item,band->childBaseItems()){ - ContentItemDesignIntf* contentItem = dynamic_cast(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 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 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(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 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 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(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(); @@ -748,7 +767,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(band); if (gb) gb->closeGroup(); diff --git a/limereport/lrreportrender.h b/limereport/lrreportrender.h index 8e62b0b..40a27b7 100644 --- a/limereport/lrreportrender.h +++ b/limereport/lrreportrender.h @@ -40,6 +40,7 @@ namespace LimeReport{ class PageDesignIntf; class BandDesignIntf; +class ContentItemDesignIntf; class GroupBandsHolder: public QList{ 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); @@ -184,6 +186,7 @@ private: QVector m_columnedBandItems; unsigned long long m_curentNameIndex; + }; } // namespace LimeReport #endif // LRREPORTRENDER_H From 6a42e0c46c35a71cde63c8317973567b34716e40 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 14 Jun 2017 12:07:02 +0300 Subject: [PATCH 112/136] Static build has been fixed --- common.pri | 2 +- limereport/limereport.pri | 4 ++-- limereport/limereport.pro | 7 +++---- limereport/lrfactoryinitializer.h | 1 + limereport/lrreportengine.cpp | 1 + 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/common.pri b/common.pri index 5af0a16..baea82d 100644 --- a/common.pri +++ b/common.pri @@ -59,7 +59,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 8 +LIMEREPORT_VERSION_RELEASE = 17 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/limereport.pri b/limereport/limereport.pri index 25568a7..d20810d 100644 --- a/limereport/limereport.pri +++ b/limereport/limereport.pri @@ -92,7 +92,7 @@ SOURCES += \ $$REPORT_PATH/scriptbrowser/lrscriptbrowser.cpp \ $$REPORT_PATH/lritemscontainerdesignitf.cpp -contains(CONFIG, staticbuild){ +contains(CONFIG, staticlib){ SOURCES += $$REPORT_PATH/lrfactoryinitializer.cpp } @@ -197,7 +197,7 @@ HEADERS += \ $$REPORT_PATH/scriptbrowser/lrscriptbrowser.h \ $$REPORT_PATH/lritemscontainerdesignitf.h -contains(CONFIG, staticbuild){ +contains(CONFIG, staticlib){ HEADERS += $$REPORT_PATH/lrfactoryinitializer.h } diff --git a/limereport/limereport.pro b/limereport/limereport.pro index 356cde3..5af5676 100644 --- a/limereport/limereport.pro +++ b/limereport/limereport.pro @@ -13,13 +13,12 @@ macx{ CONFIG += plugin } -!staticlib:{ - DEFINES += LIMEREPORT_EXPORTS -} +DEFINES += LIMEREPORT_EXPORTS -staticlib:{ +contains(CONFIG, staticlib){ DEFINES += HAVE_STATIC_BUILD message(STATIC_BUILD) + DEFINES -= LIMEREPORT_EXPORTS } EXTRA_FILES += \ diff --git a/limereport/lrfactoryinitializer.h b/limereport/lrfactoryinitializer.h index add7eab..679d657 100644 --- a/limereport/lrfactoryinitializer.h +++ b/limereport/lrfactoryinitializer.h @@ -1,3 +1,4 @@ +void initResources(); namespace LimeReport{ void initReportItems(); void initObjectInspectorProperties(); diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 641e3eb..d99bff6 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -66,6 +66,7 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) : m_fileWatcher( new QFileSystemWatcher( this ) ) { #ifdef HAVE_STATIC_BUILD + initResources(); initReportItems(); initObjectInspectorProperties(); initSerializators(); From ad99677d9c0d4fb38003a9bf92468580d0fb9bb9 Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Fri, 16 Jun 2017 03:03:40 +0300 Subject: [PATCH 113/136] "THIS" pointer to report item has been fixed --- limereport/lrscriptenginemanager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index f8d157d..983637f 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -551,9 +551,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); } } From 2c0e343c55ee76f393990cbeb7c8e98915aaecf8 Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Fri, 16 Jun 2017 03:06:09 +0300 Subject: [PATCH 114/136] Static build has been fixed. CONFIG no_zint & static_build flags have been added --- 3rdparty/zint-2.4.4/backend_qt4/Zint.pro | 13 ++++++++++--- 3rdparty/zint-2.4.4/backend_qt4/qzint_global.h | 4 ++++ common.pri | 5 ++++- demo_r1/demo_r1.pro | 12 ++++++++---- demo_r2/demo_r2.pro | 13 ++++++++----- designer/designer.pro | 13 ++++++++----- limereport.pro | 6 ++++++ limereport/limereport.pro | 12 +++++++++--- limereport/lrfactoryinitializer.cpp | 4 +++- 9 files changed, 60 insertions(+), 22 deletions(-) diff --git a/3rdparty/zint-2.4.4/backend_qt4/Zint.pro b/3rdparty/zint-2.4.4/backend_qt4/Zint.pro index b579cde..b8c6bd5 100644 --- a/3rdparty/zint-2.4.4/backend_qt4/Zint.pro +++ b/3rdparty/zint-2.4.4/backend_qt4/Zint.pro @@ -1,7 +1,15 @@ DEFINES += NO_PNG - TEMPLATE = lib -CONFIG += dll + +contains(CONFIG, static_build){ + CONFIG += staticlib + DEFINES += HAVE_STATIC_BUILD +} + +!contains(CONFIG, staticlib){ + CONFIG += dll + DEFINES += QZINT_LIBRARY +} include(../../../common.pri) @@ -18,7 +26,6 @@ unix{ INCLUDEPATH += $$PWD/../backend DEFINES += _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS ZINT_VERSION=\\\"$$VERSION\\\" -DEFINES += QZINT_LIBRARY TARGET = QtZint !contains(DEFINES, NO_PNG) { diff --git a/3rdparty/zint-2.4.4/backend_qt4/qzint_global.h b/3rdparty/zint-2.4.4/backend_qt4/qzint_global.h index 025b16e..ea46fe2 100644 --- a/3rdparty/zint-2.4.4/backend_qt4/qzint_global.h +++ b/3rdparty/zint-2.4.4/backend_qt4/qzint_global.h @@ -3,10 +3,14 @@ #include +#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 diff --git a/common.pri b/common.pri index baea82d..d19ba65 100644 --- a/common.pri +++ b/common.pri @@ -1,5 +1,8 @@ CONFIG += build_translations -CONFIG += zint + +!contains(CONFIG, no_zint){ + CONFIG += zint +} ZINT_PATH = $$PWD/3rdparty/zint-2.4.4 contains(CONFIG,zint){ diff --git a/demo_r1/demo_r1.pro b/demo_r1/demo_r1.pro index 26f70cd..b620055 100644 --- a/demo_r1/demo_r1.pro +++ b/demo_r1/demo_r1.pro @@ -27,8 +27,10 @@ macx{ unix:{ LIBS += -L$${DEST_LIBS} -llimereport - contains(CONFIG,zint){ - LIBS += -L$${DEST_LIBS} -lQtZint + !contains(CONFIG, static_build){ + contains(CONFIG,zint){ + LIBS += -L$${DEST_LIBS} -lQtZint + } } DESTDIR = $$DEST_DIR # QMAKE_POST_LINK += mkdir -p $$quote($$REPORTS_DIR) | @@ -53,8 +55,10 @@ 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} -lQtZint + !contains(CONFIG, static_build){ + contains(CONFIG,zint){ + LIBS += -L$${DEST_LIBS} -lQtZint + } } LIBS += -L$${DEST_LIBS} -llimereport } diff --git a/demo_r2/demo_r2.pro b/demo_r2/demo_r2.pro index cec1043..f327957 100644 --- a/demo_r2/demo_r2.pro +++ b/demo_r2/demo_r2.pro @@ -27,8 +27,10 @@ macx{ unix:{ LIBS += -L$${DEST_LIBS} -llimereport - contains(CONFIG,zint){ - LIBS += -L$${DEST_LIBS} -lQtZint + !contains(CONFIG, static_build){ + contains(CONFIG,zint){ + LIBS += -L$${DEST_LIBS} -lQtZint + } } DESTDIR = $$DEST_DIR QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR) $$quote($$REPORTS_DIR) $$escape_expand(\n\t) @@ -50,9 +52,10 @@ win32 { DESTDIR = $$DEST_DIR RC_FILE += mainicon.rc - - contains(CONFIG,zint){ - LIBS += -L$${DEST_LIBS} -lQtZint + !contains(CONFIG, static_build){ + contains(CONFIG,zint){ + LIBS += -L$${DEST_LIBS} -lQtZint + } } LIBS += -L$${DEST_LIBS} -llimereport diff --git a/designer/designer.pro b/designer/designer.pro index e483859..fef1c0f 100644 --- a/designer/designer.pro +++ b/designer/designer.pro @@ -18,8 +18,10 @@ macx{ unix:{ LIBS += -L$${DEST_LIBS} -llimereport - contains(CONFIG,zint){ - LIBS += -L$${DEST_LIBS} -lQtZint + !contains(CONFIG, static_build){ + contains(CONFIG,zint){ + LIBS += -L$${DEST_LIBS} -lQtZint + } } DESTDIR = $$DEST_DIR linux{ @@ -40,9 +42,10 @@ win32 { DESTDIR = $$DEST_DIR RC_FILE += mainicon.rc - - contains(CONFIG,zint){ - LIBS += -L$${DEST_LIBS} -lQtZint + !contains(CONFIG, static_build){ + contains(CONFIG,zint){ + LIBS += -L$${DEST_LIBS} -lQtZint + } } LIBS += -L$${DEST_LIBS} -llimereport } diff --git a/limereport.pro b/limereport.pro index c03043d..84179ac 100644 --- a/limereport.pro +++ b/limereport.pro @@ -1,9 +1,15 @@ TEMPLATE = subdirs + +!contains(CONFIG, no_zint){ + CONFIG += zint +} + include(common.pri) contains(CONFIG, zint){ SUBDIRS += 3rdparty } +export($$CONFIG) SUBDIRS += \ limereport diff --git a/limereport/limereport.pro b/limereport/limereport.pro index 5af5676..5f85023 100644 --- a/limereport/limereport.pro +++ b/limereport/limereport.pro @@ -1,9 +1,15 @@ TARGET = limereport TEMPLATE = lib -CONFIG += lib -CONFIG += dll -#CONFIG += staticlib +contains(CONFIG, static_build){ + CONFIG += staticlib +} + +!contains(CONFIG, staticlib){ + CONFIG += lib + CONFIG += dll +} + CONFIG += create_prl CONFIG += link_prl diff --git a/limereport/lrfactoryinitializer.cpp b/limereport/lrfactoryinitializer.cpp index cf83c8c..5aef43a 100644 --- a/limereport/lrfactoryinitializer.cpp +++ b/limereport/lrfactoryinitializer.cpp @@ -39,7 +39,7 @@ #include "serializators/lrxmlqrectserializator.h" #include "serializators/lrxmlserializatorsfactory.h" -inline void initResources(){ +void initResources(){ Q_INIT_RESOURCE(report); Q_INIT_RESOURCE(lobjectinspector); Q_INIT_RESOURCE(lrdatabrowser); @@ -95,9 +95,11 @@ BaseDesignIntf * createTextItem(QObject* owner, LimeReport::BaseDesignIntf* par 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) { From 4e191423588629f647a38ff20fd000c54dfc0bf7 Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Fri, 16 Jun 2017 03:07:07 +0300 Subject: [PATCH 115/136] Version has been changed to 1.4.18 --- common.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.pri b/common.pri index d19ba65..1ea1411 100644 --- a/common.pri +++ b/common.pri @@ -62,7 +62,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 17 +LIMEREPORT_VERSION_RELEASE = 18 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" From 1c2de351660f5fa75f3164d1e4d7109b47babc2c Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Fri, 16 Jun 2017 03:17:17 +0300 Subject: [PATCH 116/136] CONFIG qtscriptengine & no_formdesigner have been added --- common.pri | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/common.pri b/common.pri index 11c63f8..6481360 100644 --- a/common.pri +++ b/common.pri @@ -4,8 +4,12 @@ CONFIG += build_translations CONFIG += zint } -CONFIG += qjsengine -CONFIG += dialogdesigner +!contains(CONFIG, qtscriptengine){ + CONFIG += qjsengine +} +!contains(CONFIG, no_formdesigner){ + CONFIG += dialogdesigner +} ZINT_PATH = $$PWD/3rdparty/zint-2.4.4 contains(CONFIG,zint){ From 0d64591085535053505a6965bd83153fb3070713 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 20 Jun 2017 05:59:39 +0300 Subject: [PATCH 117/136] Callback datasource has been fixed --- limereport/bands/lrgroupbands.cpp | 1 + limereport/lrdatadesignintf.cpp | 59 ++++++++++++++++++++++++------- limereport/lrdatadesignintf.h | 10 +++--- limereport/lrreportrender.cpp | 12 +++---- 4 files changed, 59 insertions(+), 23 deletions(-) diff --git a/limereport/bands/lrgroupbands.cpp b/limereport/bands/lrgroupbands.cpp index 74b55eb..575760f 100644 --- a/limereport/bands/lrgroupbands.cpp +++ b/limereport/bands/lrgroupbands.cpp @@ -151,6 +151,7 @@ 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 { diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index c3e9344..806d12c 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -638,11 +638,22 @@ QVariant MasterDetailProxyModel::masterData(QString fieldName) const bool CallbackDatasource::next(){ if (!m_eof){ + + if (m_currentRow>-1){ + if (!m_getDataFromCache && checkNextRecord(m_currentRow)){ + for (int i = 0; i < m_columnCount; ++i ){ + m_valuesCache[columnNameByIndex(i)] = data(columnNameByIndex(i)); + } + } + + } 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 0 && m_currentRow < m_rowCount){ m_eof = false; } else { m_eof = true; @@ -655,6 +666,22 @@ bool CallbackDatasource::next(){ } else return false; } +bool CallbackDatasource::prior(){ + if (m_currentRow !=-1) { + if (!m_getDataFromCache && !m_valuesCache.isEmpty()){ + m_getDataFromCache = true; + if (eof()) m_currentRow--; + m_currentRow--; + m_eof = false; + return true; + } else { + return false; + } + } else { + return false; + } +} + void CallbackDatasource::first(){ m_currentRow = 0; m_eof=checkIfEmpty(); @@ -674,13 +701,17 @@ void CallbackDatasource::first(){ QVariant CallbackDatasource::data(const QString& columnName) { QVariant result; - if (!eof()) //Don't read past the end + if (!eof() && !bof()) { - CallbackInfo info; - info.dataType = CallbackInfo::ColumnData; - info.columnName = columnName; - info.index = m_currentRow; - emit getCallbackData(info,result); + 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; } @@ -744,8 +775,9 @@ int CallbackDatasource::columnIndexByName(QString name) } bool CallbackDatasource::checkNextRecord(int recordNum){ - if (m_rowCount>0 && m_currentRow 0) { + return (m_currentRow < (m_rowCount-1)); } else { QVariant result = false; CallbackInfo info; @@ -765,7 +797,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(); diff --git a/limereport/lrdatadesignintf.h b/limereport/lrdatadesignintf.h index 8737bb2..e51a3af 100644 --- a/limereport/lrdatadesignintf.h +++ b/limereport/lrdatadesignintf.h @@ -53,7 +53,6 @@ public: virtual bool next() = 0; virtual bool hasNext() = 0; virtual bool prior() = 0; - virtual void undoPrior() = 0; virtual void first() = 0; virtual void last() = 0; virtual bool bof() = 0; @@ -355,7 +354,6 @@ public: bool next(); bool hasNext(); bool prior(); - void undoPrior() {m_curRow++;} void first(); void last(); bool eof(); @@ -382,11 +380,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;} - void undoPrior() {m_currentRow++;} + bool prior(); void first(); void last(){} bool bof(){return m_currentRow == -1;} @@ -407,6 +405,8 @@ private: bool m_eof; int m_columnCount; int m_rowCount; + QHash m_valuesCache; + bool m_getDataFromCache; }; class CallbackDatasourceHolder :public QObject, public IDataSourceHolder{ diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 77ebdbd..eb20072 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -576,7 +576,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); @@ -706,11 +709,8 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da renderBand(footer, 0, StartNewPageAsNeeded); } - if (didGoBack) - { - //New Method to undo prior... Alternatively pass in bool isUndoPrior into next() - dataSource->undoPrior(); - //dataSource->next(); //Also emit changePos, which it should not at this point + if (didGoBack){ + dataSource->next(); } } closeDataGroup(band); From b0538393d138d0854fbd6e2eb82f33c498dcb4ca Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 21 Jun 2017 23:53:26 +0300 Subject: [PATCH 118/136] Callback datasource columnIndexByName() has been fixed --- limereport/lrdatadesignintf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index 806d12c..382df11 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -762,7 +762,7 @@ QString CallbackDatasource::columnNameByIndex(int columnIndex) int CallbackDatasource::columnIndexByName(QString name) { for (int i=0;i Date: Fri, 23 Jun 2017 09:57:02 +0300 Subject: [PATCH 119/136] Page items have been fixed --- limereport/lrreportrender.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index eb20072..ad6829b 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -247,8 +247,6 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) clearPageMap(); startNewPage(); - - renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader), 0, StartNewPageAsNeeded); BandDesignIntf* lastRenderedBand = 0; @@ -1096,7 +1094,7 @@ void ReportRender::startNewPage() checkLostHeadersOnPrevPage(); pasteGroups(); - renderPageItems(m_patternPageItem); + } void ReportRender::resetPageNumber(ResetPageNuberType resetType) @@ -1229,6 +1227,7 @@ void ReportRender::moveTearOffBand(){ void ReportRender::savePage(bool isLast) { + renderPageItems(m_patternPageItem); checkFooterGroup(m_lastDataBand); cutGroups(); rearrangeColumnsItems(); From b87009e1de186e22e9ae3855773f7dc9786252e1 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 23 Jun 2017 16:03:50 +0300 Subject: [PATCH 120/136] Callback datasource has been fixed --- common.pri | 2 +- limereport/lrdatadesignintf.cpp | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/common.pri b/common.pri index 1ea1411..d8c974a 100644 --- a/common.pri +++ b/common.pri @@ -62,7 +62,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 18 +LIMEREPORT_VERSION_RELEASE = 22 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index 382df11..0f090d3 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -638,14 +638,18 @@ QVariant MasterDetailProxyModel::masterData(QString fieldName) const bool CallbackDatasource::next(){ if (!m_eof){ - + bool nextRowExists = checkNextRecord(m_currentRow); if (m_currentRow>-1){ - if (!m_getDataFromCache && checkNextRecord(m_currentRow)){ + 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 = true; @@ -670,7 +674,6 @@ bool CallbackDatasource::prior(){ if (m_currentRow !=-1) { if (!m_getDataFromCache && !m_valuesCache.isEmpty()){ m_getDataFromCache = true; - if (eof()) m_currentRow--; m_currentRow--; m_eof = false; return true; @@ -701,7 +704,7 @@ void CallbackDatasource::first(){ QVariant CallbackDatasource::data(const QString& columnName) { QVariant result; - if (!eof() && !bof()) + if (!bof()) { if (!m_getDataFromCache){ CallbackInfo info; From af3d5840d620fbd8696415c6bbce51b20d67d39b Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 27 Jun 2017 23:12:22 +0300 Subject: [PATCH 121/136] Russian translation has been updated --- translations/limereport_ru.ts | 197 +++++++++++++++++++++++++--------- 1 file changed, 145 insertions(+), 52 deletions(-) diff --git a/translations/limereport_ru.ts b/translations/limereport_ru.ts index 3a76892..9ed69a5 100644 --- a/translations/limereport_ru.ts +++ b/translations/limereport_ru.ts @@ -232,7 +232,7 @@ p, li { white-space: pre-wrap; } LimeReport::BandDesignIntf connected to - соединён с + соединён с Bring to top @@ -286,7 +286,7 @@ p, li { white-space: pre-wrap; } LimeReport::ConnectionDesc defaultConnection - + Соединение по умолчанию @@ -309,7 +309,7 @@ p, li { white-space: pre-wrap; } Server - Сервер + Сервер User @@ -349,11 +349,11 @@ p, li { white-space: pre-wrap; } Connection with name - Соединение + Соединение already exists - уже существует + уже существует ... @@ -365,11 +365,11 @@ p, li { white-space: pre-wrap; } Dont keep credentals in lrxml - + Не хранить логин с паролем в lrxml defaultConnection - + Соединение по умолчанию @@ -385,6 +385,10 @@ p, li { white-space: pre-wrap; } Data Данные + + useAlternateBackgroundColor + Использовать алтернативный цвет фона + LimeReport::DataBrowser @@ -522,7 +526,7 @@ p, li { white-space: pre-wrap; } Database "%1" not found - + База данных "%1" не найдена @@ -537,7 +541,38 @@ p, li { white-space: pre-wrap; } External variables - Внешние переменные + Внешние переменные + + + + LimeReport::DialogDesignerManager + + Edit Widgets + Редактировать виджеты + + + Widget Box + Панель виджетов + + + Object Inspector + Инспектор объектов + + + Property Editor + Редактор свойств + + + Signals && Slots Editor + Редактор сигналов и слотов + + + Resource Editor + Редактор ресурсов + + + Action Editor + Редактор дейчтвий @@ -593,11 +628,11 @@ p, li { white-space: pre-wrap; } Group field not found - + Поле для группировки не найдено Datasource "%1" not found !!! - + Источник данных "%1" не найден ! @@ -616,7 +651,7 @@ p, li { white-space: pre-wrap; } Wrong script syntax "%1" - + Неправильный синиаксис скипта "%1" @@ -739,7 +774,7 @@ p, li { white-space: pre-wrap; } LimeReport::PageItemDesignIntf Paste - Вставить + Вставить @@ -853,23 +888,23 @@ p, li { white-space: pre-wrap; } Esc - + Esc Show Toolbar - + Показать панель иструментов Show toolbar - + Показать панель иструментов Font - Шрифт + Шрифт Text align - + Выравнивание текста @@ -1203,7 +1238,7 @@ p, li { white-space: pre-wrap; } columnCount - + Количество колонок @@ -1236,19 +1271,19 @@ p, li { white-space: pre-wrap; } Page - + Страница Script - + Скрипт Error - Ошибка + Ошибка Wrong file format - + Неправильный формат файла @@ -1263,7 +1298,7 @@ p, li { white-space: pre-wrap; } Undo - Отменить действие + Отменить действие Redo @@ -1307,7 +1342,7 @@ p, li { white-space: pre-wrap; } Save Report As - Сохранить отчет как + Сохранить отчет как Load Report @@ -1375,7 +1410,7 @@ p, li { white-space: pre-wrap; } Report bands - Банды + Разделы Report Header @@ -1427,7 +1462,7 @@ p, li { white-space: pre-wrap; } Tear-off Band - Отрыв данных + Полоса для отрывания File @@ -1493,6 +1528,38 @@ p, li { white-space: pre-wrap; } File "%1" not found! Файл "%1" не найден! + + Delete dialog + Удалить диалог + + + Add new dialog + Добавить диалог + + + Widget Box + Панель виджетов + + + Property Editor + Редактор свойств + + + Action Editor + Редактор действий + + + Resource Editor + Редактор ресурсов + + + SignalSlot Editor + Редактор сигналов и слотов + + + Dialog Designer Tools + Инструменты создания диалогов + LimeReport::ReportEnginePrivate @@ -1504,6 +1571,16 @@ p, li { white-space: pre-wrap; } Preview Предосмотр + + Report File Change + Монитор изменений файлов + + + The report file "%1" has changed names or been deleted. + +This preview is no longer valid. + Файл отчета "%1" изменил имя или был удален. + LimeReport::ReportFooter @@ -1535,7 +1612,7 @@ p, li { white-space: pre-wrap; } page index out of range - + индекс страницы вышел за границы диапазона @@ -1638,7 +1715,7 @@ p, li { white-space: pre-wrap; } defaultConnection - + Соединение по умолчанию @@ -1653,46 +1730,50 @@ p, li { white-space: pre-wrap; } Form - Форма + Форма ... - + ... Type - Тип + Тип Name - Имя переменной + Имя переменной NO CATEGORY - + БЕЗ КАТЕГОРИИ Error - Ошибка + Ошибка Dialog with name: %1 already exists - + Диалог с именем %1 уже существует ui file must cointain QDialog instead QWidget or QMainWindow - + ui файл должен содержать QDialog вместо QWidget или QMainWindow wrong file format - + неправильный формат файла LimeReport::ScriptEngineContext Dialog with name: %1 can`t be created - + Диалог с именем: %1 не может быть создан + + + Error + Ошибка @@ -1727,11 +1808,15 @@ p, li { white-space: pre-wrap; } Variable %1 not found - Переменная %1 не найдена + Переменная %1 не найдена Name - Имя переменной + Имя переменной + + + Function manger with name "%1" already exists ! + Менеджер функций с именем "%1" уже существует! @@ -1758,15 +1843,15 @@ p, li { white-space: pre-wrap; } Designer Setting - + Настройки дизайнера Report Setting - + Настройки отчета Suppress absent fields and variables warning - + Не выводить сообщения об отсутствия полей или переменных @@ -1787,7 +1872,7 @@ p, li { white-space: pre-wrap; } LimeReport::TearOffBand Tear-off Band - Отрыв данных + Полоса для отрывания @@ -1845,12 +1930,16 @@ p, li { white-space: pre-wrap; } TextItem " %1 " already has folower " %2 " - Текстовый элемент "%1" уже следует за "%2" + Текстовый элемент "%1" уже следует за "%2" TextItem " %1 " not found ! Текстовый элемент "%1" не найден! + + Transparent + Прозрачный + LimeReport::TextItemEditor @@ -1903,15 +1992,15 @@ p, li { white-space: pre-wrap; } LimeReport::VariablesHolder variable with name - переменная + переменная already exists !! - уже существует !! + уже существует !! does not exists !! - не существует !! + не существует !! @@ -2002,7 +2091,7 @@ p, li { white-space: pre-wrap; } and child - и подчиненный + и подчиненный datasouce "%1" not found! @@ -2110,11 +2199,15 @@ p, li { white-space: pre-wrap; } Tear-off Band - Отрыв данных + Полоса для отрывания Wrong file format - + Не правильный формат файла + + + Datasource manager not found + Менеджер источников данных не найден From 4755bd78111310f73cecc24799e2d8a79b2b2831 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 28 Jun 2017 11:16:50 +0300 Subject: [PATCH 122/136] Russian translation has been fixed --- translations/limereport_ru.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/translations/limereport_ru.ts b/translations/limereport_ru.ts index 9ed69a5..f30fe2e 100644 --- a/translations/limereport_ru.ts +++ b/translations/limereport_ru.ts @@ -57,7 +57,12 @@ p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Arin Alexander</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">arin_a@bk.ru</p></body></html> - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Александр Арин</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">arin_a@bk.ru</p></body></html> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> @@ -387,7 +392,7 @@ p, li { white-space: pre-wrap; } useAlternateBackgroundColor - Использовать алтернативный цвет фона + Использовать альтернативный цвет фона @@ -572,7 +577,7 @@ p, li { white-space: pre-wrap; } Action Editor - Редактор дейчтвий + Редактор действий @@ -651,7 +656,7 @@ p, li { white-space: pre-wrap; } Wrong script syntax "%1" - Неправильный синиаксис скипта "%1" + Неправильный синтаксис скрипта "%1" @@ -868,7 +873,7 @@ p, li { white-space: pre-wrap; } Preview - Предосмотр + Предпросмотр Ctrl+P @@ -892,7 +897,7 @@ p, li { white-space: pre-wrap; } Show Toolbar - Показать панель иструментов + Показать панель инструментов Show toolbar @@ -2203,7 +2208,7 @@ This preview is no longer valid. Wrong file format - Не правильный формат файла + Неправильный формат файла Datasource manager not found From 1354c4a253984308e4515fe333e604b6413eb964 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 28 Jun 2017 16:58:01 +0300 Subject: [PATCH 123/136] Russian translation has been fixed --- limereport/bands/lrgroupbands.cpp | 2 +- limereport/databrowser/lrconnectiondialog.cpp | 2 +- limereport/databrowser/lrdatabrowser.cpp | 6 +- limereport/databrowser/lrsqleditdialog.cpp | 6 +- limereport/items/lrtextitem.cpp | 2 +- limereport/lrdatadesignintf.cpp | 2 +- limereport/lrdatasourcemanager.cpp | 14 +- limereport/lrreportdesignwindow.cpp | 4 +- limereport/lrvariablesholder.cpp | 8 +- translations/limereport_ru.ts | 171 +++++++++--------- 10 files changed, 109 insertions(+), 108 deletions(-) diff --git a/limereport/bands/lrgroupbands.cpp b/limereport/bands/lrgroupbands.cpp index 575760f..6865ce5 100644 --- a/limereport/bands/lrgroupbands.cpp +++ b/limereport/bands/lrgroupbands.cpp @@ -155,7 +155,7 @@ bool GroupBandHeader::isNeedToClose(DataSourceManager* dataManager) 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)); } } diff --git a/limereport/databrowser/lrconnectiondialog.cpp b/limereport/databrowser/lrconnectiondialog.cpp index b90545e..9795628 100644 --- a/limereport/databrowser/lrconnectiondialog.cpp +++ b/limereport/databrowser/lrconnectiondialog.cpp @@ -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! ")); } } diff --git a/limereport/databrowser/lrdatabrowser.cpp b/limereport/databrowser/lrdatabrowser.cpp index b6db492..0b4ac5a 100644 --- a/limereport/databrowser/lrdatabrowser.cpp +++ b/limereport/databrowser/lrdatabrowser.cpp @@ -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 @@ -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); diff --git a/limereport/databrowser/lrsqleditdialog.cpp b/limereport/databrowser/lrsqleditdialog.cpp index 31dd6f1..05e3267 100644 --- a/limereport/databrowser/lrsqleditdialog.cpp +++ b/limereport/databrowser/lrsqleditdialog.cpp @@ -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())); } } } diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 64e9248..543b34e 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -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,""); diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index 0f090d3..2bc5e3a 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -421,7 +421,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())); diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index 0942b32..2358ecf 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -584,7 +584,7 @@ QList& 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) @@ -664,7 +664,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())); } } @@ -689,7 +689,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) @@ -698,7 +698,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) @@ -707,14 +707,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){ @@ -946,7 +946,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; } } diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index 358aa6b..68e44fd 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -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) { @@ -1267,7 +1267,7 @@ bool ObjectNameValidator::validate(const QString &propName, const QVariant &prop BaseDesignIntf* bd = dynamic_cast(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())); } diff --git a/limereport/lrvariablesholder.cpp b/limereport/lrvariablesholder.cpp index ed98f83..dd46b4e 100644 --- a/limereport/lrvariablesholder.cpp +++ b/limereport/lrvariablesholder.cpp @@ -62,7 +62,7 @@ void VariablesHolder::addVariable(const QString& name, const QVariant& value, Va if (type==VarDesc::Report) m_userVariables.append(varValue); } else { - throw ReportError(tr("variable with name ")+name+tr(" already exists !!")); + throw ReportError(tr("variable with name ")+name+tr(" already exists!")); } } @@ -77,7 +77,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) @@ -94,7 +94,7 @@ void VariablesHolder::changeVariable(const QString &name, const QVariant &value) if(m_varNames.contains(name)) { m_varNames.value(name)->setValue(value); } 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 +142,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 diff --git a/translations/limereport_ru.ts b/translations/limereport_ru.ts index f30fe2e..52c623d 100644 --- a/translations/limereport_ru.ts +++ b/translations/limereport_ru.ts @@ -78,7 +78,7 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600;">This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</span></p> <p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt; font-weight:600; color:#000000;"><br /></p> <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Copyright 2015 Arin Alexander. All rights reserved.</span></p></body></html> - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> @@ -356,13 +356,9 @@ p, li { white-space: pre-wrap; } Connection with name Соединение - - already exists - уже существует - ... - + ... Ok @@ -376,6 +372,10 @@ p, li { white-space: pre-wrap; } defaultConnection Соединение по умолчанию + + already exists! + уже существует! + LimeReport::ContentItemDesignIntf @@ -392,7 +392,7 @@ p, li { white-space: pre-wrap; } useAlternateBackgroundColor - Использовать альтернативный цвет фона + Использовать альтернативный цвет фона @@ -445,11 +445,6 @@ p, li { white-space: pre-wrap; } Attention Внимание - - Do you really want to delete "%1" connection ? - Do you really want delete "%1" connection ? - Вы действительно хотите удалить "%1" соединение ? - System variables Системные переменные @@ -458,11 +453,6 @@ p, li { white-space: pre-wrap; } User variables Пользовательские переменные - - Do you really want to delete "%1" datasource ? - Do you really want delete "%1" datasource ? - Вы действительно хотите удалить источник данных "%1" ? - Error Ошибка @@ -471,10 +461,6 @@ p, li { white-space: pre-wrap; } ... - - Do you really want to delete variable "%1" ? - Вы действительно хотите удалить переменную "%1" ? - Grab variable Захватить переменную @@ -487,6 +473,18 @@ p, li { white-space: pre-wrap; } External variables Внешние переменные + + Do you really want to delete "%1" connection? + Вы действительно хотите удалить "%1" соединение? + + + Do you really want to delete "%1" datasource? + Вы действительно хотите удалить источник данных "%1"? + + + Do you really want to delete variable "%1"? + Вы действительно хотите удалить переменную "%1"? + LimeReport::DataFooterBand @@ -508,19 +506,6 @@ p, li { white-space: pre-wrap; } Connection "%1" is not open Соединение "%1" не открыто - - Datasource "%1" not found ! - Источник данных "%1" не найден ! - - - connection with name "%1" already exists ! - соединение "%1" уже существует ! - - - datasource with name "%1" already exists ! - data source with name "%1" already exists !! - источник данных "%1" уже существует ! - invalid connection нет соединения @@ -533,6 +518,18 @@ p, li { white-space: pre-wrap; } Database "%1" not found База данных "%1" не найдена + + Datasource "%1" not found! + Источник данных "%1" не найден! + + + connection with name "%1" already exists! + соединение "%1" уже существует! + + + datasource with name "%1" already exists! + источник данных "%1" уже существует! + LimeReport::DataSourceModel @@ -553,31 +550,31 @@ p, li { white-space: pre-wrap; } LimeReport::DialogDesignerManager Edit Widgets - Редактировать виджеты + Редактировать виджеты Widget Box - Панель виджетов + Панель виджетов Object Inspector - Инспектор объектов + Инспектор объектов Property Editor - Редактор свойств + Редактор свойств Signals && Slots Editor - Редактор сигналов и слотов + Редактор сигналов и слотов Resource Editor - Редактор ресурсов + Редактор ресурсов Action Editor - Редактор действий + Редактор действий @@ -636,8 +633,8 @@ p, li { white-space: pre-wrap; } Поле для группировки не найдено - Datasource "%1" not found !!! - Источник данных "%1" не найден ! + Datasource "%1" not found! + Источник данных "%1" не найден! @@ -1163,7 +1160,7 @@ p, li { white-space: pre-wrap; } backgroundOpacity - Заполненость фона + Непрозрачность фона font @@ -1175,7 +1172,7 @@ p, li { white-space: pre-wrap; } foregroundOpacity - Заполненость переднего плана + Непрозрачность переднего плана margin @@ -1195,7 +1192,7 @@ p, li { white-space: pre-wrap; } opacity - Заполненость + Непрозрачность penStyle @@ -1497,10 +1494,6 @@ p, li { white-space: pre-wrap; } Script Browser Инспектор скриптов - - Report has been modified ! Do you want save the report ? - Отчет был изменен ! Хотите его сохранить ? - Report file name Файл отчета @@ -1535,35 +1528,39 @@ p, li { white-space: pre-wrap; } Delete dialog - Удалить диалог + Удалить диалог Add new dialog - Добавить диалог + Добавить диалог Widget Box - Панель виджетов + Панель виджетов Property Editor - Редактор свойств + Редактор свойств Action Editor - Редактор действий + Редактор действий Resource Editor - Редактор ресурсов + Редактор ресурсов SignalSlot Editor - Редактор сигналов и слотов + Редактор сигналов и слотов Dialog Designer Tools - Инструменты создания диалогов + Инструменты создания диалогов + + + Report has been modified! Do you want save the report? + Отчет был изменен! Хотите его сохранить? @@ -1678,18 +1675,6 @@ This preview is no longer valid. Error Ошибка - - Datasource Name is empty ! - Имя источника данных не заполнено ! - - - SQL is empty ! - SQL запрос пустой ! - - - Datasource with name: "%1" already exists ! - Источник данных с именем: "%1" уже существует ! - Datasource with name %1 already exist Источник данных с именем: "%1" уже существует @@ -1722,6 +1707,18 @@ This preview is no longer valid. defaultConnection Соединение по умолчанию + + Datasource Name is empty! + Имя источника данных не заполнено! + + + SQL is empty! + SQL запрос пустой! + + + Datasource with name: "%1" already exists! + Источник данных с именем: "%1" уже существует! + LimeReport::ScriptBrowser @@ -1778,7 +1775,7 @@ This preview is no longer valid. Error - Ошибка + Ошибка @@ -1819,10 +1816,6 @@ This preview is no longer valid. Name Имя переменной - - Function manger with name "%1" already exists ! - Менеджер функций с именем "%1" уже существует! - LimeReport::SettingDialog @@ -1938,12 +1931,12 @@ This preview is no longer valid. Текстовый элемент "%1" уже следует за "%2" - TextItem " %1 " not found ! + TextItem " %1 " not found! Текстовый элемент "%1" не найден! Transparent - Прозрачный + Прозрачный @@ -2000,12 +1993,12 @@ This preview is no longer valid. переменная - already exists !! - уже существует !! + already exists! + уже существует! - does not exists !! - не существует !! + does not exists! + не существует! @@ -2100,7 +2093,7 @@ This preview is no longer valid. datasouce "%1" not found! - источник данных "%1" не найден ! + источник данных "%1" не найден! Attention! @@ -2112,7 +2105,7 @@ This preview is no longer valid. Object with name %1 already exists - Объект с именем %1 уже существует + Объект с именем %1 уже существует Function %1 not found or have wrong arguments @@ -2152,7 +2145,7 @@ This preview is no longer valid. Master datasource "%1" not found!!! - Главный источник данных "%1" не найден! + Главный источник данных "%1" не найден! Master datasouce "%1" not found! @@ -2212,7 +2205,15 @@ This preview is no longer valid. Datasource manager not found - Менеджер источников данных не найден + Менеджер источников данных не найден + + + Master datasource "%1" not found! + Главный источник данных "%1" не найден! + + + Object with name %1 already exists! + Объект с именем %1 уже существует! From 96c823487274a7757006c8c335a5d3ea5f296718 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 28 Jun 2017 17:15:05 +0300 Subject: [PATCH 124/136] Russian translation has been fixed --- limereport/lrscriptenginemanager.cpp | 4 +- translations/limereport_ru.ts | 391 +++++++++++++++------------ 2 files changed, 213 insertions(+), 182 deletions(-) diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index 6a781cd..ecf2222 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -256,7 +256,7 @@ bool ScriptEngineManager::addFunction(const JSFunctionDesc &functionDescriber) return false; } } else { - m_lastError = tr("Function manger with name \"%1\" already exists !"); + m_lastError = tr("Function manger with name \"%1\" already exists!"); return false; } @@ -433,7 +433,7 @@ QString ScriptEngineManager::expandDataFields(QString context, ExpandType expand } else { QString error; if (reportItem){ - error = tr("Field %1 not found in %2 !!! ").arg(field).arg(reportItem->objectName()); + error = tr("Field %1 not found in %2!").arg(field).arg(reportItem->objectName()); dataManager()->putError(error); } varValue = QVariant(); diff --git a/translations/limereport_ru.ts b/translations/limereport_ru.ts index 6ba7051..7f6a738 100644 --- a/translations/limereport_ru.ts +++ b/translations/limereport_ru.ts @@ -1,6 +1,13 @@ + + $ClassName$ + + $ClassName$ + + + LRVariableDialog @@ -55,22 +62,6 @@ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/report/images/logo_100.png" height="100" style="float: left;" /><span style=" font-size:12pt; font-weight:600; color:#555555;">Report engine for </span><span style=" font-size:12pt; font-weight:600; color:#7faa18;">Qt</span><span style=" font-size:12pt; font-weight:600; color:#555555;"> framework</span></p> -<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">LimeReport - multi-platform C++ library written using Qt framework and intended for software developers that would like to add into their application capability to form report or print forms generated using templates.</span></p> -<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><br /></p> -<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><br /></p> -<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">Official web site : </span><a href="www.limereport.ru"><span style=" font-size:11pt; text-decoration: underline; color:#0000ff;">www.limereport.ru</span></a></p> -<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt; text-decoration: underline; color:#0000ff;"><br /></p> -<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600; color:#000000;">This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</span></p> -<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt; font-weight:600; color:#000000;"><br /></p> -<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; color:#000000;">Copyright 2015 Arin Alexander. All rights reserved.</span></p></body></html> - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Arin Alexander</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">arin_a@bk.ru</p></body></html> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> @@ -85,117 +76,133 @@ p, li { white-space: pre-wrap; } <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/report/images/logo_100.png" height="100" style="float: left;" /><span style=" font-size:12pt; font-weight:600;">Report engine for </span><span style=" font-size:12pt; font-weight:600; color:#7faa18;">Qt</span><span style=" font-size:12pt; font-weight:600;"> framework</span></p> +<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">LimeReport - multi-platform C++ library written using Qt framework and intended for software developers that would like to add into their application capability to form report or print forms generated using templates.</span></p> +<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><br /></p> +<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><br /></p> +<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">Official web site : </span><a href="www.limereport.ru"><span style=" font-size:11pt; text-decoration: underline; color:#0000ff;">www.limereport.ru</span></a></p> +<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt; text-decoration: underline; color:#0000ff;"><br /></p> +<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600;">This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</span></p> +<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt; font-weight:600; color:#000000;"><br /></p> +<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Copyright 2015 Arin Alexander. All rights reserved.</span></p></body></html> + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(c) 2015 Arin Alexander arin_a@bk.ru</p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="SEC1"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">G</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">NU LESSER GENERAL PUBLIC LICENSE</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Version 2.1, February 1999</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Copyright (C) 1991, 1999 Free Software Foundation, Inc.</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Everyone is permitted to copy and distribute verbatim copies</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">of this license document, but changing it is not allowed.</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">[This is the first released version of the Lesser GPL. It also counts</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;"> as the successor of the GNU Library Public License, version 2, hence</span></p> -<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;"> the version number 2.1.]</span></p> -<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="SEC2"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">P</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">reamble</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">We call this license the &quot;Lesser&quot; General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a &quot;work based on the library&quot; and a &quot;work that uses the library&quot;. The former contains code derived from the library, whereas the latter must be combined with the library in order to run.</span></p> -<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="SEC3"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">T</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">ERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">0.</span><span style=" font-family:'sans-serif'; color:#000000;"> This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called &quot;this License&quot;). Each licensee is addressed as &quot;you&quot;.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">A &quot;library&quot; means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">The &quot;Library&quot;, below, refers to any such software library or work which has been distributed under these terms. A &quot;work based on the Library&quot; means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term &quot;modification&quot;.)</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">&quot;Source code&quot; for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">1.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">2.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:</span></p> -<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> The modified work must itself be a software library.</span></li> -<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.</span></li> -<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">c)</span><span style=" font-size:16px;"> You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.</span></li> -<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">d)</span><span style=" font-size:16px;"> If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.</span></li></ul> -<p style=" margin-top:15px; margin-bottom:15px; margin-left:38px; margin-right:19px; -qt-block-indent:1; text-indent:0px;"><span style=" font-family:'sans-serif'; color:#000000;">(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">3.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">This option is useful when you wish to copy part of the code of the Library into a program that is not a library.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">4.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">5.</span><span style=" font-family:'sans-serif'; color:#000000;"> A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a &quot;work that uses the Library&quot;. Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">However, linking a &quot;work that uses the Library&quot; with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a &quot;work that uses the library&quot;. The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">When a &quot;work that uses the Library&quot; uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">6.</span><span style=" font-family:'sans-serif'; color:#000000;"> As an exception to the Sections above, you may also combine or link a &quot;work that uses the Library&quot; with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:</span></p> -<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable &quot;work that uses the Library&quot;, as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)</span></li> -<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.</span></li> -<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">c)</span><span style=" font-size:16px;"> Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.</span></li> -<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">d)</span><span style=" font-size:16px;"> If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.</span></li> -<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">e)</span><span style=" font-size:16px;"> Verify that the user has already received a copy of these materials or that you have already sent this user a copy.</span></li></ul> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">For an executable, the required form of the &quot;work that uses the Library&quot; must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">7.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:</span></p> -<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.</span></li> -<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.</span></li></ul> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">8.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">9.</span><span style=" font-family:'sans-serif'; color:#000000;"> You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">10.</span><span style=" font-family:'sans-serif'; color:#000000;"> Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">11.</span><span style=" font-family:'sans-serif'; color:#000000;"> If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">12.</span><span style=" font-family:'sans-serif'; color:#000000;"> If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">13.</span><span style=" font-family:'sans-serif'; color:#000000;"> The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and &quot;any later version&quot;, you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">14.</span><span style=" font-family:'sans-serif'; color:#000000;"> If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">NO WARRANTY</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">15.</span><span style=" font-family:'sans-serif'; color:#000000;"> BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY &quot;AS IS&quot; WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">16.</span><span style=" font-family:'sans-serif'; color:#000000;"> IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</span></p> -<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#333333; background-color:#ffffff;">END OF TERMS AND CONDITIONS</span></p> -<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="SEC4"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">H</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">ow to Apply These Terms to Your New Libraries</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License).</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the &quot;copyright&quot; line and a pointer to where the full notice is found.</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; font-style:italic; color:#000000;">one line to give the library's name and an idea of what it does.</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">Copyright (C) </span><span style=" font-family:'monospace'; font-style:italic; color:#000000;">year</span><span style=" font-family:'monospace'; color:#000000;"> </span><span style=" font-family:'monospace'; font-style:italic; color:#000000;">name of author</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; font-style:italic; color:#000000; background-color:#ffffff;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">This library is free software; you can redistribute it and/or</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">modify it under the terms of the GNU Lesser General Public</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">License as published by the Free Software Foundation; either</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">version 2.1 of the License, or (at your option) any later version.</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">This library is distributed in the hope that it will be useful,</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">but WITHOUT ANY WARRANTY; without even the implied warranty of</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">Lesser General Public License for more details.</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">You should have received a copy of the GNU Lesser General Public</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">License along with this library; if not, write to the Free Software</span></p> -<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Also add information on how to contact you by electronic and paper mail.</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">You should also get your employer (if you work as a programmer) or your school, if any, to sign a &quot;copyright disclaimer&quot; for the library, if necessary. Here is a sample; alter the names:</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Yoyodyne, Inc., hereby disclaims all copyright interest in</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">the library `Frob' (a library for tweaking knobs) written</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">by James Random Hacker.</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; font-style:italic; color:#000000;">signature of Ty Coon</span><span style=" font-family:'monospace'; color:#000000;">, 1 April 1990</span></p> -<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">Ty Coon, President of Vice</span></p> -<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">That's all there is to it!</span></p></body></html> - +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="SEC1"></a><span style=" font-family:'sans-serif'; font-weight:600;">G</span><span style=" font-family:'sans-serif'; font-weight:600;">NU LESSER GENERAL PUBLIC LICENSE</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Version 2.1, February 1999</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">Copyright (C) 1991, 1999 Free Software Foundation, Inc.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">Everyone is permitted to copy and distribute verbatim copies</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">of this license document, but changing it is not allowed.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace';"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">[This is the first released version of the Lesser GPL. It also counts</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';"> as the successor of the GNU Library Public License, version 2, hence</span></p> +<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';"> the version number 2.1.]</span></p> +<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="SEC2"></a><span style=" font-family:'sans-serif'; font-weight:600;">P</span><span style=" font-family:'sans-serif'; font-weight:600;">reamble</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">We call this license the &quot;Lesser&quot; General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a &quot;work based on the library&quot; and a &quot;work that uses the library&quot;. The former contains code derived from the library, whereas the latter must be combined with the library in order to run.</span></p> +<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="SEC3"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">T</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">ERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">0.</span><span style=" font-family:'sans-serif';"> This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called &quot;this License&quot;). Each licensee is addressed as &quot;you&quot;.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">A &quot;library&quot; means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">The &quot;Library&quot;, below, refers to any such software library or work which has been distributed under these terms. A &quot;work based on the Library&quot; means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term &quot;modification&quot;.)</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">&quot;Source code&quot; for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">1.</span><span style=" font-family:'sans-serif';"> You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">2.</span><span style=" font-family:'sans-serif';"> You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:</span></p> +<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif';" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> The modified work must itself be a software library.</span></li> +<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.</span></li> +<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">c)</span><span style=" font-size:16px;"> You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.</span></li> +<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">d)</span><span style=" font-size:16px;"> If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.</span></li></ul> +<p style=" margin-top:15px; margin-bottom:15px; margin-left:38px; margin-right:19px; -qt-block-indent:1; text-indent:0px;"><span style=" font-family:'sans-serif';">(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">3.</span><span style=" font-family:'sans-serif';"> You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">This option is useful when you wish to copy part of the code of the Library into a program that is not a library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">4.</span><span style=" font-family:'sans-serif';"> You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">5.</span><span style=" font-family:'sans-serif';"> A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a &quot;work that uses the Library&quot;. Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">However, linking a &quot;work that uses the Library&quot; with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a &quot;work that uses the library&quot;. The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">When a &quot;work that uses the Library&quot; uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">6.</span><span style=" font-family:'sans-serif';"> As an exception to the Sections above, you may also combine or link a &quot;work that uses the Library&quot; with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:</span></p> +<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif';" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable &quot;work that uses the Library&quot;, as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)</span></li> +<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.</span></li> +<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">c)</span><span style=" font-size:16px;"> Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.</span></li> +<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">d)</span><span style=" font-size:16px;"> If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.</span></li> +<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">e)</span><span style=" font-size:16px;"> Verify that the user has already received a copy of these materials or that you have already sent this user a copy.</span></li></ul> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">For an executable, the required form of the &quot;work that uses the Library&quot; must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">7.</span><span style=" font-family:'sans-serif';"> You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:</span></p> +<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif';" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.</span></li> +<li style=" font-family:'sans-serif';" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.</span></li></ul> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">8.</span><span style=" font-family:'sans-serif';"> You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">9.</span><span style=" font-family:'sans-serif';"> You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">10.</span><span style=" font-family:'sans-serif';"> Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">11.</span><span style=" font-family:'sans-serif';"> If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">12.</span><span style=" font-family:'sans-serif';"> If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">13.</span><span style=" font-family:'sans-serif';"> The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and &quot;any later version&quot;, you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">14.</span><span style=" font-family:'sans-serif';"> If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">NO WARRANTY</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">15.</span><span style=" font-family:'sans-serif';"> BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY &quot;AS IS&quot; WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600;">16.</span><span style=" font-family:'sans-serif';"> IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</span></p> +<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">END OF TERMS AND CONDITIONS</span></p> +<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="SEC4"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">H</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">ow to Apply These Terms to Your New Libraries</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License).</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the &quot;copyright&quot; line and a pointer to where the full notice is found.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace'; font-style:italic;">one line to give the library's name and an idea of what it does.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">Copyright (C) </span><span style=" font-family:'monospace'; font-style:italic;">year</span><span style=" font-family:'monospace';"> </span><span style=" font-family:'monospace'; font-style:italic;">name of author</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; font-style:italic;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">This library is free software; you can redistribute it and/or</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">modify it under the terms of the GNU Lesser General Public</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">License as published by the Free Software Foundation; either</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">version 2.1 of the License, or (at your option) any later version.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace';"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">This library is distributed in the hope that it will be useful,</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">but WITHOUT ANY WARRANTY; without even the implied warranty of</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">Lesser General Public License for more details.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace';"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">You should have received a copy of the GNU Lesser General Public</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">License along with this library; if not, write to the Free Software</span></p> +<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">Also add information on how to contact you by electronic and paper mail.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">You should also get your employer (if you work as a programmer) or your school, if any, to sign a &quot;copyright disclaimer&quot; for the library, if necessary. Here is a sample; alter the names:</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">Yoyodyne, Inc., hereby disclaims all copyright interest in</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">the library `Frob' (a library for tweaking knobs) written</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">by James Random Hacker.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace';"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace'; font-style:italic;">signature of Ty Coon</span><span style=" font-family:'monospace';">, 1 April 1990</span></p> +<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">Ty Coon, President of Vice</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'sans-serif';">That's all there is to it!</span></p></body></html> + @@ -381,7 +388,7 @@ p, li { white-space: pre-wrap; } LimeReport::ContentItemDesignIntf Variable %1 not found - Переменная %1 не найдена + Переменная %1 не найдена @@ -392,7 +399,7 @@ p, li { white-space: pre-wrap; } useAlternateBackgroundColor - Использовать альтернативный цвет фона + Использовать альтернативный цвет фона @@ -451,7 +458,7 @@ p, li { white-space: pre-wrap; } User variables - Пользовательские переменные + Пользовательские переменные Error @@ -524,11 +531,19 @@ p, li { white-space: pre-wrap; } connection with name "%1" already exists! - соединение "%1" уже существует! + соединение "%1" уже существует! datasource with name "%1" already exists! - источник данных "%1" уже существует! + источник данных "%1" уже существует! + + + Connection with name "%1" already exists! + Соединение "%1" уже существует! + + + Datasource with name "%1" already exists! + Источник данных "%1" уже существует! @@ -550,31 +565,31 @@ p, li { white-space: pre-wrap; } LimeReport::DialogDesignerManager Edit Widgets - Редактировать виджеты + Редактировать виджеты Widget Box - Панель виджетов + Панель виджетов Object Inspector - Инспектор объектов + Инспектор объектов Property Editor - Редактор свойств + Редактор свойств Signals && Slots Editor - Редактор сигналов и слотов + Редактор сигналов и слотов Resource Editor - Редактор ресурсов + Редактор ресурсов Action Editor - Редактор действий + Редактор действий @@ -928,43 +943,43 @@ p, li { white-space: pre-wrap; } fullPage - Страница целиком + Страница целиком gridStep - Шаг сетки + Шаг сетки oldPrintMode - Старый режим печати + Старый режим печати resourcePath - Путь к ресурсам + Путь к ресурсам autoSize - Автоматический размер + Автоматический размер center - Центрировать + Центрировать field - Поле + Поле image - Изображение + Изображение keepAspectRatio - Сохранять соотношение сторон + Сохранять соотношение сторон scale - Масштабировать + Масштабировать leftMargin @@ -992,15 +1007,15 @@ p, li { white-space: pre-wrap; } condition - Условие + Условие keepGroupTogether - Сохранять группу вместе + Сохранять группу вместе groupFieldName - Столбец группы + Столбец группы geometry @@ -1064,43 +1079,43 @@ p, li { white-space: pre-wrap; } textIndent - Отступ текста + Отступ текста textLayoutDirection - Направление текста + Направление текста lineSpacing - Межстрочный интервал + Межстрочный интервал underlines - Подчеркивание + Подчеркивание underlineLineSize - Толщина подчеркивания + Толщина подчеркивания format - Формат + Формат valueType - Тип значения + Тип значения adaptFontToSize - Шрифт по размеру + Шрифт по размеру followTo - Следует за + Следует за backgroundBrushStyle - Стиль заполнения фона + Стиль заполнения фона autoHeight @@ -1112,11 +1127,11 @@ p, li { white-space: pre-wrap; } alternateBackgroundColor - Альтернативный цвет фона + Альтернативный цвет фона columnsCount - Количество столбцов + Количество столбцов columnsFillDirection @@ -1212,31 +1227,31 @@ p, li { white-space: pre-wrap; } allowHTML - Разрешить HTML + Разрешить HTML allowHTMLInFields - Разрешить HTML в полях + Разрешить HTML в полях printAlways - Печатать всегда + Печатать всегда borderColor - Цвет границ + Цвет границ startNewPage - Начинать новую страницу + Начинать новую страницу startFromNewPage - Начинать с новой страницы + Начинать с новой страницы resetPageNumber - Обнулять номер страницы + Обнулять номер страницы columnCount @@ -1528,35 +1543,35 @@ p, li { white-space: pre-wrap; } Delete dialog - Удалить диалог + Удалить диалог Add new dialog - Добавить диалог + Добавить диалог Widget Box - Панель виджетов + Панель виджетов Property Editor - Редактор свойств + Редактор свойств Action Editor - Редактор действий + Редактор действий Resource Editor - Редактор ресурсов + Редактор ресурсов SignalSlot Editor - Редактор сигналов и слотов + Редактор сигналов и слотов Dialog Designer Tools - Инструменты создания диалогов + Инструменты создания диалогов Report has been modified! Do you want save the report? @@ -1775,7 +1790,7 @@ This preview is no longer valid. Error - Ошибка + Ошибка @@ -1816,6 +1831,22 @@ This preview is no longer valid. Name Имя переменной + + Function manger with name "%1" already exists ! + Менеджер функций с именем "%1" уже существует! + + + Field %1 not found in %2 !!! + Поле %1 не найдено в %2 !!! + + + Function manger with name "%1" already exists! + Менеджер функций с именем "%1" уже существует! + + + Field %1 not found in %2! + Поле %1 не найдено в %2! + LimeReport::SettingDialog @@ -1936,7 +1967,7 @@ This preview is no longer valid. Transparent - Прозрачный + Прозрачный @@ -2205,7 +2236,7 @@ This preview is no longer valid. Datasource manager not found - Менеджер источников данных не найден + Менеджер источников данных не найден Master datasource "%1" not found! From f671c3a3471b2d28615525ab53d76e71d65c5269 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 28 Jun 2017 18:40:55 +0300 Subject: [PATCH 125/136] Object properties translation has been updated --- limereport/lrpagedesignintf.cpp | 4 +- limereport/lrpagedesignintf.h | 2 +- .../objectinspector/lrobjectitemmodel.cpp | 42 ++++++ translations/limereport_ru.ts | 120 +++++++++++++----- 4 files changed, 135 insertions(+), 33 deletions(-) diff --git a/limereport/lrpagedesignintf.cpp b/limereport/lrpagedesignintf.cpp index 0928856..2a3a068 100644 --- a/limereport/lrpagedesignintf.cpp +++ b/limereport/lrpagedesignintf.cpp @@ -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(); diff --git a/limereport/lrpagedesignintf.h b/limereport/lrpagedesignintf.h index 5ddfdc0..d2ff996 100644 --- a/limereport/lrpagedesignintf.h +++ b/limereport/lrpagedesignintf.h @@ -252,7 +252,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); diff --git a/limereport/objectinspector/lrobjectitemmodel.cpp b/limereport/objectinspector/lrobjectitemmodel.cpp index c79480a..260b584 100644 --- a/limereport/objectinspector/lrobjectitemmodel.cpp +++ b/limereport/objectinspector/lrobjectitemmodel.cpp @@ -83,6 +83,48 @@ 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"); + } void QObjectPropertyModel::clearObjectsList() diff --git a/translations/limereport_ru.ts b/translations/limereport_ru.ts index 52c623d..ccc5d63 100644 --- a/translations/limereport_ru.ts +++ b/translations/limereport_ru.ts @@ -524,11 +524,19 @@ p, li { white-space: pre-wrap; } connection with name "%1" already exists! - соединение "%1" уже существует! + соединение "%1" уже существует! datasource with name "%1" already exists! - источник данных "%1" уже существует! + источник данных "%1" уже существует! + + + Connection with name "%1" already exists! + Соединение "%1" уже существует! + + + Datasource with name "%1" already exists! + Источник данных с именем: "%1" уже существует! @@ -928,43 +936,43 @@ p, li { white-space: pre-wrap; } fullPage - Страница целиком + Страница целиком gridStep - Шаг сетки + Шаг сетки oldPrintMode - Старый режим печати + Старый режим печати resourcePath - Путь к ресурсам + Путь к ресурсам autoSize - Автоматический размер + Автоматический размер center - Центрировать + Центрировать field - Поле + Поле image - Изображение + Изображение keepAspectRatio - Сохранять соотношение сторон + Сохранять соотношение сторон scale - Масштабировать + Масштабировать leftMargin @@ -1064,43 +1072,43 @@ p, li { white-space: pre-wrap; } textIndent - Отступ текста + Отступ текста textLayoutDirection - Направление текста + Направление текста lineSpacing - Межстрочный интервал + Межстрочный интервал underlines - Подчеркивание + Подчеркивание underlineLineSize - Толщина подчеркивания + Толщина подчеркивания format - Формат + Формат valueType - Тип значения + Тип значения adaptFontToSize - Шрифт по размеру + Шрифт по размеру followTo - Следует за + Следует за backgroundBrushStyle - Стиль заполнения фона + Стиль заполнения фона autoHeight @@ -1112,11 +1120,11 @@ p, li { white-space: pre-wrap; } alternateBackgroundColor - Альтернативный цвет фона + Альтернативный цвет фона columnsCount - Количество столбцов + Количество столбцов columnsFillDirection @@ -1212,11 +1220,11 @@ p, li { white-space: pre-wrap; } allowHTML - Разрешить HTML + Разрешить HTML allowHTMLInFields - Разрешить HTML в полях + Разрешить HTML в полях printAlways @@ -1224,24 +1232,76 @@ p, li { white-space: pre-wrap; } borderColor - Цвет границ + Цвет границ startNewPage - Начинать новую страницу + Начинать новую страницу startFromNewPage - Начинать с новой страницы + Начинать с новой страницы resetPageNumber - Обнулять номер страницы + Обнулять номер страницы columnCount Количество колонок + + alternateBackgroundMode + Альтернативный цвет фона + + + textIdent + Параграф + + + securityLevel + Уровень безопасности + + + testValue + Тестовое значение + + + whitespace + Отступ + + + cornerRadius + Радиус закругления + + + shapeColor + Цвет фигуры + + + layoutType + Тип группировки + + + barcodeType + Тип штрихкода + + + barcodeWidth + + + + foregroundColor + Цвет переднего плана + + + inputMode + + + + pdf417CodeWords + + LimeReport::RectMMPropItem From bf38d57406fe4ed5c76ed3bc84eedc4012680fe0 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 29 Jun 2017 00:55:16 +0300 Subject: [PATCH 126/136] Band location has been fixed --- limereport/bands/lrsubdetailband.h | 1 + limereport/lrbanddesignintf.cpp | 22 +++++++++++-- limereport/lrbanddesignintf.h | 5 +-- limereport/lrpageitemdesignintf.cpp | 24 +++++++++----- .../objectinspector/lrobjectitemmodel.cpp | 11 ++++++- translations/limereport_ru.ts | 32 ++++++++++++++++--- 6 files changed, 77 insertions(+), 18 deletions(-) diff --git a/limereport/bands/lrsubdetailband.h b/limereport/bands/lrsubdetailband.h index c9b4c76..7c16d51 100644 --- a/limereport/bands/lrsubdetailband.h +++ b/limereport/bands/lrsubdetailband.h @@ -63,6 +63,7 @@ class SubDetailHeaderBand : public BandDesignIntf public: SubDetailHeaderBand(QObject* owner = 0, QGraphicsItem* parent=0); bool isUnique() const; + bool isHeader() const {return true;} protected: QColor bandColor() const; private: diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index f4a1cf9..05412cb 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -171,7 +171,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(); + if (parentBand()) bandText+=tr(" connected to ")+parentBand()->objectName(); QFont font("Arial", 7 * Const::fontFACTOR, -1, true); QFontMetrics fontMetrics(font); @@ -229,9 +229,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); @@ -293,6 +299,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 ignoredBands) const{ int curIndex = bandIndex(); foreach(BandDesignIntf* childBand, childBands()){ diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index e588385..eab3d90 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -131,7 +131,7 @@ 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(); @@ -151,8 +151,10 @@ public: bool isConnectedToBand(BandDesignIntf::BandsType bandType) const; int minChildIndex(BandsType bandType); + int maxChildIndex(BandDesignIntf::BandsType bandType) const; int maxChildIndex(QSet ignoredBands = QSet()) const; + BandDesignIntf* parentBand() const {return m_parentBand;} QList childBands() const{return m_childBands;} @@ -217,7 +219,6 @@ public: void setRepeatOnEachRow(bool repeatOnEachRow); QColor alternateBackgroundColor() const; void setAlternateBackgroundColor(const QColor &alternateBackgroundColor); - signals: void bandRendered(BandDesignIntf* band); protected: diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index 150df06..2e8de0b 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -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(); diff --git a/limereport/objectinspector/lrobjectitemmodel.cpp b/limereport/objectinspector/lrobjectitemmodel.cpp index 260b584..080a7a2 100644 --- a/limereport/objectinspector/lrobjectitemmodel.cpp +++ b/limereport/objectinspector/lrobjectitemmodel.cpp @@ -124,7 +124,16 @@ void QObjectPropertyModel::translatePropertyName() 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() diff --git a/translations/limereport_ru.ts b/translations/limereport_ru.ts index ccc5d63..96d6602 100644 --- a/translations/limereport_ru.ts +++ b/translations/limereport_ru.ts @@ -1000,15 +1000,15 @@ p, li { white-space: pre-wrap; } condition - Условие + Условие keepGroupTogether - Сохранять группу вместе + Сохранять группу вместе groupFieldName - Столбец группы + Столбец группы geometry @@ -1228,7 +1228,7 @@ p, li { white-space: pre-wrap; } printAlways - Печатать всегда + Печатать всегда borderColor @@ -1302,6 +1302,30 @@ p, li { white-space: pre-wrap; } pdf417CodeWords + + useAlternateBackgroundColor + Использовать альтернативный цвет фона + + + printBeforePageHeader + Печатать перед заголовком страницы + + + maxScalePercent + Максимальный процент уменьшения + + + printOnFirstPage + Печатать на первой странице + + + printOnLastPage + Печатать на последней странице + + + repeatOnEachRow + Печатать на каждой странице + LimeReport::RectMMPropItem From e3d01f1451c77692ae58a5c808ac85e723cee769 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 29 Jun 2017 02:32:42 +0300 Subject: [PATCH 127/136] Band names translation has been added --- limereport/lrbanddesignintf.cpp | 34 +++++++++++++-- limereport/lrbanddesignintf.h | 2 + limereport/lrreportdesignwindow.cpp | 2 + translations/limereport_ru.ts | 68 +++++++++++++++++++++++++++++ 4 files changed, 102 insertions(+), 4 deletions(-) diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index 05412cb..61bb5cf 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -159,6 +159,16 @@ 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{ + return tr(extractClassName(item->metaObject()->className()).toLatin1())+QString::number(extractItemIndex(item)); +} + void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { @@ -170,8 +180,7 @@ void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *op if (itemMode() & DesignMode){ painter->save(); - QString bandText = objectName(); - if (parentBand()) bandText+=tr(" connected to ")+parentBand()->objectName(); + QString bandText = bandTitle(); QFont font("Arial", 7 * Const::fontFACTOR, -1, true); QFontMetrics fontMetrics(font); @@ -202,6 +211,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 +235,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; } diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index eab3d90..e306742 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -121,6 +121,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; @@ -241,6 +242,7 @@ 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); private: diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index 68e44fd..b2c882b 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -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; } diff --git a/translations/limereport_ru.ts b/translations/limereport_ru.ts index 96d6602..d2bd7e0 100644 --- a/translations/limereport_ru.ts +++ b/translations/limereport_ru.ts @@ -255,6 +255,74 @@ p, li { white-space: pre-wrap; } Splittable Разбивать содержимое на части + + DataBand + Данные + + + ReportHeader + Заголовок отчета + + + ReportFooter + Завершение отчета + + + PageHeader + Верхний колонтитул + + + PageFooter + Нижний колонтитул + + + Subdetail + Подчиненный + + + DataHeaderBand + Заголовок данных + + + DataFooterBand + Завершение данных + + + SubdetailBand + Подчиненные данные + + + SubdetailHeaderBand + Заголовок подчиненных данных + + + SubdetailFooterBand + Завершение подчиненных данных + + + GroupBandHeader + Заголовок группы + + + GroupBandFooter + Завершение группы + + + TearOffBand + Полоса для отрывания + + + SubDetailBand + Подчиненные данные + + + SubDetailHeaderBand + Заголовок подчиненных данных + + + SubDetailFooterBand + Завершение подчиненных данных + LimeReport::BaseDesignIntf From 774f334e40694893342cc5d85e6dc50e36d7fb73 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 29 Jun 2017 02:46:48 +0300 Subject: [PATCH 128/136] Fix #79: qDebug "render time" message --- limereport/lrreportengine.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index d99bff6..b89ee3c 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -392,7 +392,6 @@ void ReportEnginePrivate::previewReport(PreviewHints hints) m_activePreview = w; connect(w,SIGNAL(destroyed(QObject*)), this, SLOT(slotPreviewWindowDestroyed(QObject*))); - qDebug()<<"render time ="<exec(); } } catch (ReportError &exception){ From 815a67e17d718da6aac3a2ae9a2f0acf1464c298 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 29 Jun 2017 03:04:30 +0300 Subject: [PATCH 129/136] Function categories have been translated --- limereport/lrscriptenginemanager.cpp | 26 +++++++++++++------------- translations/limereport_ru.ts | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index ecf2222..11b4cbc 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -332,7 +332,7 @@ void ScriptEngineManager::setDataManager(DataSourceManager *dataManager){ foreach(QString func, m_dataManager->groupFunctionNames()){ JSFunctionDesc describer( func, - "GROUP FUNCTIONS", + tr("GROUP FUNCTIONS"), func+"(\""+tr("FieldName")+"\",\""+tr("BandName")+"\")", LimeReport::Const::FUNCTION_MANAGER_NAME, m_functionManager, @@ -545,7 +545,7 @@ bool ScriptEngineManager::createLineFunction() fd.setManager(m_functionManager); fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); - fd.setCategory("SYSTEM"); + fd.setCategory(tr("SYSTEM")); fd.setName("line"); fd.setDescription("line(\""+tr("BandName")+"\")"); fd.setScriptWrapper(QString("function line(bandName){ return %1.line(bandName);}").arg(LimeReport::Const::FUNCTION_MANAGER_NAME)); @@ -560,7 +560,7 @@ bool ScriptEngineManager::createNumberFomatFunction() fd.setManager(m_functionManager); fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); - fd.setCategory("NUMBER"); + fd.setCategory(tr("NUMBER")); fd.setName("numberFormat"); fd.setDescription("numberFormat(\""+tr("Value")+"\",\""+tr("Format")+"\",\""+ tr("Precision")+"\",\""+ @@ -582,7 +582,7 @@ bool ScriptEngineManager::createDateFormatFunction(){ fd.setManager(m_functionManager); fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); - fd.setCategory("DATE&TIME"); + fd.setCategory(tr("DATE&TIME")); fd.setName("dateFormat"); fd.setDescription("dateFormat(\""+tr("Value")+"\",\""+tr("Format")+"\")"); fd.setScriptWrapper(QString("function dateFormat(value, format){" @@ -599,7 +599,7 @@ bool ScriptEngineManager::createTimeFormatFunction(){ fd.setManager(m_functionManager); fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); - fd.setCategory("DATE&TIME"); + fd.setCategory(tr("DATE&TIME")); fd.setName("timeFormat"); fd.setDescription("timeFormat(\""+tr("Value")+"\",\""+tr("Format")+"\")"); fd.setScriptWrapper(QString("function timeFormat(value, format){" @@ -616,7 +616,7 @@ bool ScriptEngineManager::createDateTimeFormatFunction(){ fd.setManager(m_functionManager); fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); - fd.setCategory("DATE&TIME"); + fd.setCategory(tr("DATE&TIME")); fd.setName("dateTimeFormat"); fd.setDescription("dateTimeFormat(\""+tr("Value")+"\",\""+tr("Format")+"\")"); fd.setScriptWrapper(QString("function dateTimeFormat(value, format){" @@ -633,7 +633,7 @@ bool ScriptEngineManager::createDateFunction(){ fd.setManager(m_functionManager); fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); - fd.setCategory("DATE&TIME"); + fd.setCategory(tr("DATE&TIME")); fd.setName("date"); fd.setDescription("date()"); fd.setScriptWrapper(QString("function date(){" @@ -650,7 +650,7 @@ bool ScriptEngineManager::createNowFunction(){ fd.setManager(m_functionManager); fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); - fd.setCategory("DATE&TIME"); + fd.setCategory(tr("DATE&TIME")); fd.setName("now"); fd.setDescription("now()"); fd.setScriptWrapper(QString("function now(){" @@ -666,7 +666,7 @@ bool ScriptEngineManager::createCurrencyFormatFunction(){ fd.setManager(m_functionManager); fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); - fd.setCategory("NUMBER"); + fd.setCategory(tr("NUMBER")); fd.setName("currencyFormat"); fd.setDescription("currencyFormat(\""+tr("Value")+"\",\""+tr("Locale")+"\")"); fd.setScriptWrapper(QString("function currencyFormat(value, locale){" @@ -683,7 +683,7 @@ bool ScriptEngineManager::createCurrencyUSBasedFormatFunction(){ fd.setManager(m_functionManager); fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); - fd.setCategory("NUMBER"); + fd.setCategory(tr("NUMBER")); fd.setName("currencyUSBasedFormat"); fd.setDescription("currencyUSBasedFormat(\""+tr("Value")+",\""+tr("CurrencySymbol")+"\")"); fd.setScriptWrapper(QString("function currencyUSBasedFormat(value, currencySymbol){" @@ -700,7 +700,7 @@ bool ScriptEngineManager::createSetVariableFunction(){ fd.setManager(m_functionManager); fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); - fd.setCategory("GENERAL"); + fd.setCategory(tr("GENERAL")); fd.setName("setVariable"); fd.setDescription("setVariable(\""+tr("Name")+"\",\""+tr("Value")+"\")"); fd.setScriptWrapper(QString("function setVariable(name, value){" @@ -715,7 +715,7 @@ bool ScriptEngineManager::createGetVariableFunction() JSFunctionDesc fd; fd.setManager(m_functionManager); fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); - fd.setCategory("GENERAL"); + fd.setCategory(tr("GENERAL")); fd.setName("getVariable"); fd.setDescription("getVariable(\""+tr("Name")+"\")"); fd.setScriptWrapper(QString("function getVariable(name){" @@ -730,7 +730,7 @@ bool ScriptEngineManager::createGetFieldFunction() JSFunctionDesc fd; fd.setManager(m_functionManager); fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); - fd.setCategory("GENERAL"); + fd.setCategory(tr("GENERAL")); fd.setName("getField"); fd.setDescription("getField(\""+tr("Name")+"\")"); fd.setScriptWrapper(QString("function getField(name){" diff --git a/translations/limereport_ru.ts b/translations/limereport_ru.ts index 987aad9..1e6188e 100644 --- a/translations/limereport_ru.ts +++ b/translations/limereport_ru.ts @@ -1991,6 +1991,26 @@ This preview is no longer valid. Field %1 not found in %2! Поле %1 не найдено в %2! + + GROUP FUNCTIONS + АГРЕГАТНЫЕ ФУНКЦИИ + + + SYSTEM + СИСТЕМНЫЕ + + + NUMBER + ЧИСЛОВЫЕ + + + DATE&TIME + ДАТА И ВРЕМЯ + + + GENERAL + ОБЩИЕ + LimeReport::SettingDialog From 36d72a57567c26aa1bfd6fdb0014cb664bc1f284 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 29 Jun 2017 03:16:30 +0300 Subject: [PATCH 130/136] Script function names have been translated --- limereport/lrscriptenginemanager.cpp | 26 +++++++++++++------------- translations/limereport_ru.ts | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index 983637f..866c4c5 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -427,7 +427,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) @@ -612,22 +612,22 @@ 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("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); diff --git a/translations/limereport_ru.ts b/translations/limereport_ru.ts index d2bd7e0..8b9caa0 100644 --- a/translations/limereport_ru.ts +++ b/translations/limereport_ru.ts @@ -1968,6 +1968,26 @@ This preview is no longer valid. Name Имя переменной + + GROUP FUNCTIONS + АГРЕГАТНЫЕ ФУНКЦИИ + + + SYSTEM + СИСТЕМНЫЕ + + + NUMBER + ЧИСЛОВЫЕ + + + DATE&TIME + ДАТА И ВРЕМЯ + + + GENERAL + ОБЩИЕ + LimeReport::SettingDialog From 9c95206dfe0ffc57d84841b167f1e4b0e12b8a88 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 30 Jun 2017 13:21:16 +0300 Subject: [PATCH 131/136] Band names translation has been fixed --- limereport/lrbanddesignintf.cpp | 26 ++++++++++++++++++++------ limereport/lrbanddesignintf.h | 5 +++-- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index 61bb5cf..47f398c 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -145,6 +145,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() @@ -166,7 +168,12 @@ int extractItemIndex(const BaseDesignIntf* item){ } QString BandDesignIntf::translateBandName(const BaseDesignIntf* item) const{ - return tr(extractClassName(item->metaObject()->className()).toLatin1())+QString::number(extractItemIndex(item)); + 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) @@ -612,7 +619,7 @@ void BandDesignIntf::trimToMaxHeight(int maxHeight) void BandDesignIntf::setBandTypeText(const QString &value){ m_bandTypeText=value; - m_bandNameLabel->updateLabel(); + m_bandNameLabel->updateLabel(bandTitle()); } QSet BandDesignIntf::groupBands() @@ -670,7 +677,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()); } @@ -724,6 +731,13 @@ void BandDesignIntf::setAlternateBackgroundColor(const QColor &alternateBackgrou m_alternateBackgroundColor = alternateBackgroundColor; } +void BandDesignIntf::slotPropertyObjectNameChanged(const QString &, const QString& newName) +{ + update(); + if (m_bandNameLabel) + m_bandNameLabel->updateLabel(newName); +} + bool BandDesignIntf::repeatOnEachRow() const { return m_repeatOnEachRow; @@ -878,7 +892,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 @@ -921,7 +935,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); @@ -929,7 +943,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(); } diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index e306742..1e60a13 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -74,7 +74,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; @@ -221,7 +221,7 @@ public: QColor alternateBackgroundColor() const; void setAlternateBackgroundColor(const QColor &alternateBackgroundColor); signals: - void bandRendered(BandDesignIntf* band); + void bandRendered(BandDesignIntf* band); protected: void trimToMaxHeight(int maxHeight); void setBandTypeText(const QString& value); @@ -245,6 +245,7 @@ protected: 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; From c3ff1ff46259051ab4a5075c1f82a10d50940599 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 30 Jun 2017 13:22:41 +0300 Subject: [PATCH 132/136] Subdetail header render has been fixed --- limereport/lrreportrender.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index ad6829b..710da8f 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -430,7 +430,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(): @@ -505,6 +504,7 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) IDataSource* bandDatasource = 0; m_lastRenderedFooter = 0; + if (!dataBand->datasourceName().isEmpty()) bandDatasource = datasources()->dataSource(dataBand->datasourceName()); @@ -524,7 +524,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; @@ -658,7 +658,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 ((band != m_lastRenderedHeader) && (printAlways == (printMode == PrintAlwaysPrintable)) ) + renderBand(band, 0, StartNewPageAsNeeded); } } @@ -682,9 +683,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); } } From fa2ef0f643e10d60de51cf0f02402c2c2b424d69 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 30 Jun 2017 13:52:17 +0300 Subject: [PATCH 133/136] Build has been fixed --- limereport/lrreportrender.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 710da8f..3992408 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -658,7 +658,7 @@ void ReportRender::renderChildHeader(BandDesignIntf *parent, BandPrintMode print if (band->metaObject()->indexOfProperty("printAlways")>0){ printAlways=band->property("printAlways").toBool(); } - if ((band != m_lastRenderedHeader) && (printAlways == (printMode == PrintAlwaysPrintable)) ) + if (printAlways == (printMode == PrintAlwaysPrintable)) renderBand(band, 0, StartNewPageAsNeeded); } } From ec3724247584e0bd79a3dc5eed91b4c7018f4c95 Mon Sep 17 00:00:00 2001 From: Spiek Date: Tue, 11 Jul 2017 10:58:42 +0200 Subject: [PATCH 134/136] Build Environment for Windows has been fixed - language files are now compile-able if path to build environment contains white spaces - demo reports are now copied correctly if REPORTS_DIR or EXTRA_DIR contains white spaces --- demo_r1/demo_r1.pro | 2 +- demo_r2/demo_r2.pro | 2 +- limereport/limereport.pro | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/demo_r1/demo_r1.pro b/demo_r1/demo_r1.pro index b620055..7f15359 100644 --- a/demo_r1/demo_r1.pro +++ b/demo_r1/demo_r1.pro @@ -54,7 +54,7 @@ win32 { DESTDIR = $$DEST_DIR RC_FILE += mainicon.rc - QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR\\*) $$quote($$REPORTS_DIR\\demo_reports) $$escape_expand(\\n\\t) + QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$shell_quote($$EXTRA_DIR\\*) $$shell_quote($$REPORTS_DIR\\demo_reports) $$escape_expand(\\n\\t) !contains(CONFIG, static_build){ contains(CONFIG,zint){ LIBS += -L$${DEST_LIBS} -lQtZint diff --git a/demo_r2/demo_r2.pro b/demo_r2/demo_r2.pro index f327957..ae33d88 100644 --- a/demo_r2/demo_r2.pro +++ b/demo_r2/demo_r2.pro @@ -59,6 +59,6 @@ win32 { } LIBS += -L$${DEST_LIBS} -llimereport - QMAKE_POST_LINK += $$QMAKE_COPY_DIR \"$$EXTRA_DIR\" \"$$REPORTS_DIR\\demo_reports\" $$escape_expand(\\n\\t) + QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$shell_quote($$EXTRA_DIR\\*) $$shell_quote($$REPORTS_DIR\\demo_reports) $$escape_expand(\\n\\t) } diff --git a/limereport/limereport.pro b/limereport/limereport.pro index 5f85023..5832173 100644 --- a/limereport/limereport.pro +++ b/limereport/limereport.pro @@ -87,16 +87,16 @@ contains(CONFIG,build_translations){ return($$result) } - TRANSLATIONS = $$prependAll(LANGUAGES, $$TRANSLATIONS_PATH/limereport_,.ts) + TRANSLATIONS = $$prependAll(LANGUAGES, \"$$TRANSLATIONS_PATH/limereport_,.ts\") qtPrepareTool(LUPDATE, lupdate) - ts.commands = $$LUPDATE $$PWD -ts $$TRANSLATIONS + ts.commands = $$LUPDATE $$shell_quote($$PWD) -ts $$TRANSLATIONS TRANSLATIONS_FILES = qtPrepareTool(LRELEASE, lrelease) for(tsfile, TRANSLATIONS) { qmfile = $$tsfile - qmfile ~= s,.ts$,.qm, + qmfile ~= s,".ts\"$",".qm\"", qm.commands += $$LRELEASE -removeidentical $$tsfile -qm $$qmfile $$escape_expand(\\n\\t) tmp_command = $$LRELEASE -removeidentical $$tsfile -qm $$qmfile $$escape_expand(\\n\\t) TRANSLATIONS_FILES += $$qmfile From 4e1a680e09f30802c566a53afde01163ffba716f Mon Sep 17 00:00:00 2001 From: Spiek Date: Tue, 11 Jul 2017 10:59:40 +0200 Subject: [PATCH 135/136] Syntax Error in mainicon.rc files has been fixed --- demo_r1/mainicon.rc | 2 +- demo_r2/mainicon.rc | 2 +- designer/mainicon.rc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/demo_r1/mainicon.rc b/demo_r1/mainicon.rc index 83c0128..ef4125c 100644 --- a/demo_r1/mainicon.rc +++ b/demo_r1/mainicon.rc @@ -1 +1 @@ -DI_ICON1 ICON "main.ico" +IDI_ICON1 ICON "main.ico" diff --git a/demo_r2/mainicon.rc b/demo_r2/mainicon.rc index 83c0128..ef4125c 100644 --- a/demo_r2/mainicon.rc +++ b/demo_r2/mainicon.rc @@ -1 +1 @@ -DI_ICON1 ICON "main.ico" +IDI_ICON1 ICON "main.ico" diff --git a/designer/mainicon.rc b/designer/mainicon.rc index 83c0128..ef4125c 100644 --- a/designer/mainicon.rc +++ b/designer/mainicon.rc @@ -1 +1 @@ -DI_ICON1 ICON "main.ico" +IDI_ICON1 ICON "main.ico" From c6d5e23ddf00c8af77307ea9246ec0d794e98cfc Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 11 Jul 2017 12:44:52 +0300 Subject: [PATCH 136/136] Subdetail headers render for column mode has been fixed --- limereport/bands/lrsubdetailband.h | 3 +++ limereport/lrbanddesignintf.h | 1 + limereport/lrreportrender.cpp | 6 ++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/limereport/bands/lrsubdetailband.h b/limereport/bands/lrsubdetailband.h index 7c16d51..72967b3 100644 --- a/limereport/bands/lrsubdetailband.h +++ b/limereport/bands/lrsubdetailband.h @@ -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: @@ -64,6 +65,7 @@ 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: @@ -80,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: diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index 1e60a13..5b71de3 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -168,6 +168,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); diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 3992408..fe211a7 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -880,7 +880,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;icolumnsCount();++i){ @@ -908,7 +909,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();