From 21b9a9416828e9c1614a678e1182996b1309ecf6 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 4 Jun 2018 00:17:56 +0300 Subject: [PATCH 01/58] replaceCRwithBR property has been added --- common.pri | 2 +- limereport/items/lrtextitem.cpp | 30 ++++++++++++++++--- limereport/items/lrtextitem.h | 9 ++++-- .../objectinspector/lrobjectitemmodel.cpp | 1 + translations/limereport_ru.ts | 22 +++++++++----- 5 files changed, 50 insertions(+), 14 deletions(-) diff --git a/common.pri b/common.pri index 6a8f275..3020408 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 = 78 +LIMEREPORT_VERSION_RELEASE = 80 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 15e5809..a4384b0 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -59,7 +59,8 @@ 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_textLayoutDirection(Qt::LayoutDirectionAuto) + m_allowHTMLInFields(false), m_replaceCarriageReturns(false), m_followTo(""), m_follower(0), m_textIndent(0), + m_textLayoutDirection(Qt::LayoutDirectionAuto) { PageItemDesignIntf* pageItem = dynamic_cast(parent); BaseDesignIntf* parentItem = dynamic_cast(parent); @@ -289,8 +290,10 @@ void TextItem::setContent(const QString &value) void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight) { + if (isNeedExpandContent()) expandContent(dataManager, pass); + if (!isLoading() && (autoHeight() || autoWidth() || hasFollower()) ) initTextSizes(); @@ -331,12 +334,12 @@ bool TextItem::isNeedExpandContent() const return content().contains(rx); } -QString TextItem::replaceBR(QString text) +QString TextItem::replaceBR(QString text) const { return text.replace("
","\n"); } -QString TextItem::replaceReturns(QString text) +QString TextItem::replaceReturns(QString text) const { QString result = text.replace("\r\n","
"); result = result.replace("\n","
"); @@ -465,7 +468,11 @@ TextItem::TextPtr TextItem::textDocument() const TextPtr text(new QTextDocument); if (allowHTML()) - text->setHtml(m_strText); + if (isReplaceCarriageReturns()){ + text->setHtml(replaceReturns(m_strText)); + } else { + text->setHtml(m_strText); + } else text->setPlainText(m_strText); @@ -513,6 +520,21 @@ TextItem::TextPtr TextItem::textDocument() const } +bool TextItem::isReplaceCarriageReturns() const +{ + return m_replaceCarriageReturns; +} + +void TextItem::setReplaceCarriageReturns(bool replaceCarriageReturns) +{ + if (replaceCarriageReturns != m_replaceCarriageReturns){ + m_replaceCarriageReturns = replaceCarriageReturns; + update(); + notify("replaceCRwithBR",!replaceCarriageReturns, replaceCarriageReturns); + } + +} + qreal TextItem::textIndent() const { return m_textIndent; diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index 5bc82fb..d8fa8cc 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -72,6 +72,7 @@ class TextItem : public LimeReport::ContentItemDesignIntf, IPageInit { Q_PROPERTY(qreal textIndent READ textIndent WRITE setTextIndent) Q_PROPERTY(Qt::LayoutDirection textLayoutDirection READ textLayoutDirection WRITE setTextLayoutDirection) Q_PROPERTY(bool watermark READ isWatermark WRITE setWatermark) + Q_PROPERTY(bool replaceCRwithBR READ isReplaceCarriageReturns WRITE setReplaceCarriageReturns) public: enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength}; @@ -167,11 +168,14 @@ public: void setWatermark(bool watermark); + bool isReplaceCarriageReturns() const; + void setReplaceCarriageReturns(bool isReplaceCarriageReturns); + protected: void updateLayout(); bool isNeedExpandContent() const; - QString replaceBR(QString text); - QString replaceReturns(QString text); + QString replaceBR(QString text) const; + QString replaceReturns(QString text) const; int fakeMarginSize() const; QString getTextPart(int height, int skipHeight); void restoreLinksEvent(); @@ -204,6 +208,7 @@ private: int m_underlineLineSize; bool m_allowHTML; bool m_allowHTMLInFields; + bool m_replaceCarriageReturns; QString m_format; ValueType m_valueType; diff --git a/limereport/objectinspector/lrobjectitemmodel.cpp b/limereport/objectinspector/lrobjectitemmodel.cpp index 71b3adb..42b52fa 100644 --- a/limereport/objectinspector/lrobjectitemmodel.cpp +++ b/limereport/objectinspector/lrobjectitemmodel.cpp @@ -135,6 +135,7 @@ void QObjectPropertyModel::translatePropertyName() tr("groupFieldName"); tr("keepGroupTogether"); tr("watermark"); + tr("replaceCRwithBR"); } void QObjectPropertyModel::clearObjectsList() diff --git a/translations/limereport_ru.ts b/translations/limereport_ru.ts index 7fbb600..df9e655 100644 --- a/translations/limereport_ru.ts +++ b/translations/limereport_ru.ts @@ -325,15 +325,15 @@ p, li { white-space: pre-wrap; } Keep bottom space - + Сохранять нижний отступ Start from new page - + Начинать с новой страницы Start new page - + Начинать новую станицу @@ -458,7 +458,7 @@ p, li { white-space: pre-wrap; } Port - + Порт @@ -1635,6 +1635,14 @@ p, li { white-space: pre-wrap; } repeatOnEachRow Печатать на каждой странице + + watermark + Водяной знак + + + replaceCRwithBR + Заменять CR на BR + LimeReport::RectMMPropItem @@ -1957,11 +1965,11 @@ p, li { white-space: pre-wrap; } Hide left panel | Alt+L - + Скрыть левую панель | Alt+L Hide right panel | Alt+R - + Скрыть правую панель | Alt+R @@ -2239,7 +2247,7 @@ This preview is no longer valid. Seconds - + Секунды From 846363708a81dd3b1f7602fa9966ff88875afc71 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 7 Jun 2018 20:43:05 +0300 Subject: [PATCH 02/58] Multicolumn bands rendering has been fixed --- limereport/lrbanddesignintf.cpp | 4 +- limereport/lrreportrender.cpp | 138 +++++++++++++++++++------------- limereport/lrreportrender.h | 5 +- 3 files changed, 87 insertions(+), 60 deletions(-) diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index 4e3b5fc..edc0c45 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -880,8 +880,10 @@ void BandDesignIntf::setPrintIfEmpty(bool printIfEmpty) BandDesignIntf *BandDesignIntf::bandHeader() { foreach (BandDesignIntf* band, childBands()) { - if (band->isHeader() && !band->isGroupHeader()) + if (band->isHeader() && !band->isGroupHeader()){ + if (band->columnsCount() > 1) band->setColumnsFillDirection(this->columnsFillDirection()); return band; + } } return 0; } diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index ed72282..55f3de2 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -48,6 +48,7 @@ void ReportRender::initColumns(){ m_currentStartDataPos.clear(); m_maxHeightByColumn.append(0); m_currentStartDataPos.append(0); + m_currentColumn = 0; } bool ReportRender::isNeedToRearrangeColumnsItems() @@ -142,7 +143,7 @@ qreal ReportRender::maxColumnHeight() void ReportRender::renameChildItems(BaseDesignIntf *item){ foreach(BaseDesignIntf* child, item->childBaseItems()){ if (!child->childBaseItems().isEmpty()) renameChildItems(child); - child->setObjectName(child->metaObject()->className()+QString::number(++m_curentNameIndex)); + child->setObjectName(child->metaObject()->className()+QString::number(++m_currentNameIndex)); } } @@ -207,7 +208,7 @@ void ReportRender::initDatasource(const QString& name){ void ReportRender::renderPage(PageDesignIntf* patternPage) { - m_curentNameIndex = 0; + m_currentNameIndex = 0; m_patternPageItem = patternPage->pageItem(); @@ -250,11 +251,11 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader), 0, StartNewPageAsNeeded); BandDesignIntf* lastRenderedBand = 0; - for (int i=0;idataBandCount() && !m_renderCanceled;i++){ + for (int i=0; i < m_patternPageItem->dataBandCount() && !m_renderCanceled; i++){ lastRenderedBand = m_patternPageItem->dataBandAt(i); initDatasource(lastRenderedBand->datasourceName()); renderDataBand(lastRenderedBand); - if (idataBandCount()-1) closeFooterGroup(lastRenderedBand); + if ( i < m_patternPageItem->dataBandCount()-1) closeFooterGroup(lastRenderedBand); } if (reportFooter) @@ -515,7 +516,7 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) BandDesignIntf* header = dataBand->bandHeader(); BandDesignIntf* footer = dataBand->bandFooter(); - if (header && header->printAlways()) renderBand(header, 0); + if (header && header->printAlways()) renderBand(header, 0, StartNewPageAsNeeded); if(bandDatasource && !bandDatasource->eof() && !m_renderCanceled){ @@ -523,12 +524,11 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) datasources()->setReportVariable(varName,1); if (header && !header->printAlways()) - renderBand(header, 0); + renderBand(header, 0, StartNewPageAsNeeded); if (dataBand->bandHeader() && dataBand->bandHeader()->reprintOnEachPage()) m_reprintableBands.append(dataBand->bandHeader()); - //renderChildHeader(dataBand,PrintNotAlwaysPrintable); renderGroupHeader(dataBand, bandDatasource, true); bool firstTime = true; @@ -634,7 +634,6 @@ void ReportRender::renderPageItems(PageItemDesignIntf* patternPage) m_renderPageItem, m_renderPageItem); pageItems.append(cloneItem); - //cloneItem->updateItemSize(m_datasources); } } m_renderPageItem->restoreLinks(); @@ -691,9 +690,7 @@ void ReportRender::renderChildBands(BandDesignIntf *parentBand) if (!band->datasourceName().isEmpty()) ds = m_datasources->dataSource(band->datasourceName()); if (ds) ds->first(); - //renderChildHeader(band,PrintAlwaysPrintable); renderDataBand(band); - //renderChildFooter(band,PrintAlwaysPrintable); closeFooterGroup(band); } } @@ -707,7 +704,7 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da bool didGoBack = dataSource->prior(); foreach (BandDesignIntf* subBand, band->childrenByType(BandDesignIntf::GroupHeader)) { foreach(BandDesignIntf* footer, subBand->childrenByType(BandDesignIntf::GroupFooter)){ - renderBand(footer, 0); + renderBand(footer, 0, StartNewPageAsNeeded); } closeDataGroup(subBand); } @@ -721,10 +718,6 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da } } closeDataGroup(band); -// if (gb->isNeedToStartNewPage()){ -// savePage(); -// startNewPage(); -// } } if (gb && !gb->isStarted()){ @@ -887,10 +880,31 @@ qreal minVectorValue(QVector vector){ return curValue; } +void ReportRender::placeBandOnPage(BandDesignIntf* band, int columnIndex){ + + qreal bandPos = m_currentStartDataPos[columnIndex]; + + m_currentStartDataPos[columnIndex] += band->height(); + m_maxHeightByColumn[columnIndex] -= band->height(); + band->setPos(m_renderPageItem->pageRect().x()+band->width()*columnIndex, bandPos); + band->setBandIndex(++m_currentIndex); + band->setColumnIndex(columnIndex); + + m_renderPageItem->registerBand(band); + m_currentColumn = columnIndex; +} + +bool isMultiColumnHeader(BandDesignIntf* band){ + return ( (band->columnsCount() > 1 ) && + (band->isHeader() && + ((band->bandNestingLevel() == 0) || (band->columnsFillDirection() == BandDesignIntf::Horizontal)))); +} + bool ReportRender::registerBand(BandDesignIntf *band, bool registerInChildren) { - if (band->columnsCount()==1 && m_maxHeightByColumn.size()>1){ - if (band->bandType()!=BandDesignIntf::PageFooter){ + + if (band->columnsCount() == 1 && m_maxHeightByColumn.size() > 1 ){ + if (band->bandType() != BandDesignIntf::PageFooter){ rearrangeColumnsItems(); m_currentColumn = 0; qreal minValue = minVectorValue(m_maxHeightByColumn); @@ -902,63 +916,62 @@ bool ReportRender::registerBand(BandDesignIntf *band, bool registerInChildren) } } - if ( (band->columnsCount()>1) && - (!band->isHeader() || (band->bandNestingLevel()>0 && band->columnsFillDirection() != BandDesignIntf::Horizontal ))){ + if (band->columnsCount() != m_maxHeightByColumn.size()){ + for(int i=1;icolumnsCount();++i){ + m_maxHeightByColumn.append(m_maxHeightByColumn[0]); + m_currentStartDataPos.append(m_currentStartDataPos[0]); + } + m_currentColumn = 0; + } - if (m_maxHeightByColumn.size()!=band->columnsCount()){ - for(int i=1;icolumnsCount();++i){ - m_maxHeightByColumn.append(m_maxHeightByColumn[0]); - m_currentStartDataPos.append(m_currentStartDataPos[0]); - } - m_currentColumn = 0; + + if ( (band->columnsCount() > 1) && + (!band->isHeader() || (band->bandNestingLevel() > 0 && band->columnsFillDirection() != BandDesignIntf::Horizontal ))){ + + if (band->columnsFillDirection() == BandDesignIntf::Horizontal){ + if (m_currentColumncolumnsCount()-1) + m_currentColumn = m_currentColumn+1; + else + m_currentColumn = 0; } else { - if (band->columnsFillDirection()==BandDesignIntf::Horizontal){ - if (m_currentColumncolumnsCount()-1) - m_currentColumn = m_currentColumn+1; - else - m_currentColumn = 0; + if ( (m_maxHeightByColumn[0] == m_maxHeightByColumn[m_currentColumn]) && (m_maxHeightByColumn[0] >= band->height()) ){ + m_currentColumn = 0; } } } - if (band->height()<=m_maxHeightByColumn[m_currentColumn]){ + if ( (isMultiColumnHeader(band) && band->height() <= m_maxHeightByColumn[0]) || + (band->height() <= m_maxHeightByColumn[m_currentColumn])){ - if (band->bandType()==BandDesignIntf::PageFooter){ - for (int i=0;ibandType() == BandDesignIntf::PageFooter) ){ + for (int i=0; i < m_maxHeightByColumn.size(); ++i) m_maxHeightByColumn[i]+=band->height(); - } else { - m_maxHeightByColumn[m_currentColumn]-=band->height(); } - if ( (band->columnsCount()>1) && - (band->isHeader() && (band->bandNestingLevel()==0 || band->columnsFillDirection()==BandDesignIntf::Horizontal))){ + if ( isMultiColumnHeader(band)){ - qreal bandPos = m_currentStartDataPos[m_currentColumn]; - m_currentStartDataPos[m_currentColumn]+=band->height(); - for (int i=0;icolumnsCount();++i){ - if (i!=0) band = dynamic_cast(band->cloneItem(PreviewMode)); - band->setPos(m_renderPageItem->pageRect().x()+band->width()*i,bandPos); - band->setBandIndex(++m_currentIndex); - band->setColumnIndex(i); - m_renderPageItem->registerBand(band); + if (!band->parent()){ + for (int i = 0; i < band->columnsCount(); ++i){ + m_currentColumn = i; + if (i != 0) band = dynamic_cast(band->cloneItem(PreviewMode)); + placeBandOnPage(band, i); + } + } else { + placeBandOnPage(band, band->columnIndex()); } + } else { - if (band->bandType()!=BandDesignIntf::PageFooter){ - band->setPos(m_renderPageItem->pageRect().x()+band->width()*m_currentColumn, - m_currentStartDataPos[m_currentColumn]); - m_currentStartDataPos[m_currentColumn]+=band->height(); - band->setBandIndex(++m_currentIndex); - band->setColumnIndex(m_currentColumn); + if (band->bandType() != BandDesignIntf::PageFooter){ + placeBandOnPage(band, m_currentColumn); } - if (band->columnsCount()>1){ + if (band->columnsCount() > 1){ m_columnedBandItems.append(band); } - m_renderPageItem->registerBand(band); } foreach(QList* list,m_childBands.values()){ @@ -974,7 +987,7 @@ bool ReportRender::registerBand(BandDesignIntf *band, bool registerInChildren) } if (band->isData()) m_renderedDataBandCount++; - band->setObjectName(band->objectName()+QString::number(++m_curentNameIndex)); + band->setObjectName(band->objectName()+QString::number(++m_currentNameIndex)); renameChildItems(band); return true; } else return false; @@ -1090,9 +1103,7 @@ void ReportRender::startNewColumn(){ void ReportRender::startNewPage() { m_renderPageItem = 0; - m_currentColumn = 0; m_newPageStarted = true; - initColumns(); initRenderPage(); @@ -1192,8 +1203,14 @@ void ReportRender::pasteGroups() m_popupedValues.clear(); } +bool bandLessThen(BandDesignIntf* b1, BandDesignIntf* b2){ + return b1->bandIndex() < b2->bandIndex(); +} + void ReportRender::checkLostHeadersOnPrevPage() { + QVector lostHeaders; + if (m_renderedPages.isEmpty()) return; PageItemDesignIntf::Ptr page = m_renderedPages.last(); if (page->bands().isEmpty()) return; @@ -1212,12 +1229,19 @@ void ReportRender::checkLostHeadersOnPrevPage() if (it.value()->isHeader()){ if (it.value()->reprintOnEachPage()){ delete it.value(); - } else { registerBand(it.value());} + } else { lostHeaders.append(it.value());} it.remove(); it.previous(); } else break; } + if (lostHeaders.size() > 0){ + qSort(lostHeaders.begin(), lostHeaders.end(), bandLessThen); + foreach(BandDesignIntf* header, lostHeaders){ + registerBand(header); + } + } + } BandDesignIntf* ReportRender::findEnclosingGroup() diff --git a/limereport/lrreportrender.h b/limereport/lrreportrender.h index 3e9f26f..a207723 100644 --- a/limereport/lrreportrender.h +++ b/limereport/lrreportrender.h @@ -154,6 +154,8 @@ private: qreal maxColumnHeight(); void renameChildItems(BaseDesignIntf *item); void renderGroupFooterByHeader(BandDesignIntf *groupHeader); + void placeBandOnPage(BandDesignIntf *band, int columnIndex); + private: DataSourceManager* m_datasources; ScriptEngineContext* m_scriptEngineContext; @@ -184,10 +186,9 @@ private: int m_currentColumn; QList m_ranges; QVector m_columnedBandItems; - unsigned long long m_curentNameIndex; + unsigned long long m_currentNameIndex; bool m_newPageStarted; - }; } // namespace LimeReport #endif // LRREPORTRENDER_H From b43dfdd1aacc4d663c50b4c6e1fae6dcb868ae04 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 20 Jun 2018 16:23:52 +0300 Subject: [PATCH 03/58] keepFooterTogether with reprintOnEachPage fixed --- limereport/bands/lrdataband.cpp | 82 +++++++++++++++++++++++++++++++++ limereport/bands/lrdataband.h | 8 ++++ limereport/lrreportrender.cpp | 13 ++++-- 3 files changed, 100 insertions(+), 3 deletions(-) diff --git a/limereport/bands/lrdataband.cpp b/limereport/bands/lrdataband.cpp index 342622a..fbb0ae8 100644 --- a/limereport/bands/lrdataband.cpp +++ b/limereport/bands/lrdataband.cpp @@ -84,6 +84,40 @@ QColor DataBand::bandColor() const return QColor(Qt::darkGreen); } +void DataBand::preparePopUpMenu(QMenu &menu) +{ + BandDesignIntf::preparePopUpMenu(menu); + QAction* currAction = menu.addAction(tr("Keep footer together")); + currAction->setCheckable(true); + currAction->setChecked(keepFooterTogether()); + + currAction = menu.addAction(tr("Keep subdetail together")); + currAction->setCheckable(true); + currAction->setChecked(tryToKeepTogether()); + + currAction = menu.addAction(tr("Slice last row")); + currAction->setCheckable(true); + currAction->setChecked(sliceLastRow()); + +} + +void DataBand::processPopUpAction(QAction *action) +{ + BandDesignIntf::processPopUpAction(action); + if (action->text().compare(tr("Keep footer together")) == 0){ + setProperty("keepFooterTogether",action->isChecked()); + } + + if (action->text().compare(tr("Keep subdetail together")) == 0){ + setProperty("keepSubdetailTogether",action->isChecked()); + } + + if (action->text().compare(tr("Slice last row")) == 0){ + setProperty("sliceLastRow",action->isChecked()); + } + +} + BaseDesignIntf *DataBand::createSameTypeItem(QObject *owner, QGraphicsItem *parent) { return new DataBand(owner,parent); @@ -96,6 +130,38 @@ DataHeaderBand::DataHeaderBand(QObject *owner, QGraphicsItem *parent) setMarkerColor(bandColor()); } +void DataHeaderBand::preparePopUpMenu(QMenu &menu) +{ + BandDesignIntf::preparePopUpMenu(menu); + QAction* currAction = menu.addAction(tr("Reprint on each page")); + currAction->setCheckable(true); + currAction->setChecked(reprintOnEachPage()); + + currAction = menu.addAction(tr("Repeat on each row")); + currAction->setCheckable(true); + currAction->setChecked(repeatOnEachRow()); + + currAction = menu.addAction(tr("Print always")); + currAction->setCheckable(true); + currAction->setChecked(printAlways()); +} + +void DataHeaderBand::processPopUpAction(QAction *action) +{ + BandDesignIntf::processPopUpAction(action); + if (action->text().compare(tr("Reprint on each page")) == 0){ + setProperty("repeatOnEachPage",action->isChecked()); + } + + if (action->text().compare(tr("Repeat on each row")) == 0){ + setProperty("repeatOnEachRow",action->isChecked()); + } + + if (action->text().compare(tr("Print always")) == 0){ + setProperty("printAlways",action->isChecked()); + } +} + DataFooterBand::DataFooterBand(QObject *owner, QGraphicsItem *parent) :BandDesignIntf(BandDesignIntf::DataFooter,xmlTagFooter,owner,parent) { @@ -103,5 +169,21 @@ DataFooterBand::DataFooterBand(QObject *owner, QGraphicsItem *parent) setMarkerColor(bandColor()); } +void DataFooterBand::preparePopUpMenu(QMenu &menu) +{ + BandDesignIntf::preparePopUpMenu(menu); + QAction* currAction = menu.addAction(tr("Print always")); + currAction->setCheckable(true); + currAction->setChecked(printAlways()); +} + +void DataFooterBand::processPopUpAction(QAction *action) +{ + BandDesignIntf::processPopUpAction(action); + if (action->text().compare(tr("Print always")) == 0){ + setProperty("printAlways",action->isChecked()); + } +} + } diff --git a/limereport/bands/lrdataband.h b/limereport/bands/lrdataband.h index fd180e8..4045d3a 100644 --- a/limereport/bands/lrdataband.h +++ b/limereport/bands/lrdataband.h @@ -54,6 +54,8 @@ public: bool isData() const {return true;} protected: QColor bandColor() const; + void preparePopUpMenu(QMenu &menu); + void processPopUpAction(QAction *action); private: BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0); }; @@ -71,6 +73,9 @@ public: bool isUnique() const {return false;} bool isHeader() const {return true;} QColor bandColor() const {return QColor(Qt::darkGreen);} +protected: + void preparePopUpMenu(QMenu &menu); + void processPopUpAction(QAction *action); private: BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0){ return new DataHeaderBand(owner,parent); @@ -88,6 +93,9 @@ public: bool isUnique() const {return false;} bool isFooter() const {return true;} QColor bandColor() const{return QColor(Qt::darkGreen);} +protected: + void preparePopUpMenu(QMenu &menu); + void processPopUpAction(QAction *action); private: BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0){ return new DataFooterBand(owner,parent); diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 55f3de2..1999c77 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -577,15 +577,19 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) firstTime = false; } - m_reprintableBands.removeOne(dataBand->bandHeader()); + if (!dataBand->keepFooterTogether()) + m_reprintableBands.removeOne(dataBand->bandHeader()); if (bandDatasource->prior()){ renderGroupFooter(dataBand); bandDatasource->next(); } - if (footer && !footer->printAlways()) + if (footer && !footer->printAlways()){ renderBand(footer, 0, StartNewPageAsNeeded); + if (dataBand->keepFooterTogether()) + m_reprintableBands.removeOne(dataBand); + } datasources()->deleteVariable(varName); @@ -593,8 +597,11 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) renderBand(dataBand, 0, StartNewPageAsNeeded); } - if (footer && footer->printAlways()) + if (footer && footer->printAlways()){ renderBand(footer, 0, StartNewPageAsNeeded); + if (dataBand->keepFooterTogether()) + m_reprintableBands.removeOne(dataBand); + } } void ReportRender::renderPageHeader(PageItemDesignIntf *patternPage) From 072b6233980a3467c7aae8cb8c3aee75e89a4c4c Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 20 Jun 2018 18:47:59 +0300 Subject: [PATCH 04/58] Band popup menu fixed --- common.pri | 2 +- limereport/bands/lrdataband.cpp | 20 ++++++++++++- limereport/lrbanddesignintf.cpp | 53 +++++++++++++++++++++++---------- 3 files changed, 57 insertions(+), 18 deletions(-) diff --git a/common.pri b/common.pri index 3020408..0e2ae3e 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 = 80 +LIMEREPORT_VERSION_RELEASE = 83 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/bands/lrdataband.cpp b/limereport/bands/lrdataband.cpp index fbb0ae8..29cea5e 100644 --- a/limereport/bands/lrdataband.cpp +++ b/limereport/bands/lrdataband.cpp @@ -99,6 +99,16 @@ void DataBand::preparePopUpMenu(QMenu &menu) currAction->setCheckable(true); currAction->setChecked(sliceLastRow()); + currAction = menu.addAction(tr("Start from new page")); + currAction->setCheckable(true); + currAction->setChecked(startFromNewPage()); + + currAction = menu.addAction(tr("Start new page")); + currAction->setCheckable(true); + currAction->setChecked(startNewPage()); + + + } void DataBand::processPopUpAction(QAction *action) @@ -116,6 +126,14 @@ void DataBand::processPopUpAction(QAction *action) setProperty("sliceLastRow",action->isChecked()); } + if (action->text().compare(tr("Start new page")) == 0){ + setProperty("startNewPage",action->isChecked()); + } + + if (action->text().compare(tr("Start from new page")) == 0){ + setProperty("startFromNewPage",action->isChecked()); + } + } BaseDesignIntf *DataBand::createSameTypeItem(QObject *owner, QGraphicsItem *parent) @@ -150,7 +168,7 @@ void DataHeaderBand::processPopUpAction(QAction *action) { BandDesignIntf::processPopUpAction(action); if (action->text().compare(tr("Reprint on each page")) == 0){ - setProperty("repeatOnEachPage",action->isChecked()); + setProperty("reprintOnEachPage",action->isChecked()); } if (action->text().compare(tr("Repeat on each row")) == 0){ diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index edc0c45..56c2642 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -428,7 +428,11 @@ bool BandDesignIntf::isNeedRender() const void BandDesignIntf::setTryToKeepTogether(bool value) { - m_tryToKeepTogether=value; + if (m_tryToKeepTogether != value){ + m_tryToKeepTogether = value; + if (!isLoading()) + notify("keepSubdetailTogether", !value, value); + } } bool BandDesignIntf::tryToKeepTogether() @@ -497,6 +501,7 @@ void BandDesignIntf::preparePopUpMenu(QMenu &menu) currAction->setChecked(autoHeight()); currAction = menu.addAction(tr("Splittable")); + currAction->setEnabled(metaObject()->indexOfProperty("splittable") != -1); currAction->setCheckable(true); currAction->setChecked(isSplittable()); @@ -504,13 +509,10 @@ void BandDesignIntf::preparePopUpMenu(QMenu &menu) currAction->setCheckable(true); currAction->setChecked(keepBottomSpaceOption()); - currAction = menu.addAction(tr("Start from new page")); + currAction = menu.addAction(tr("Print if empty")); currAction->setCheckable(true); - currAction->setChecked(startFromNewPage()); + currAction->setChecked(printIfEmpty()); - currAction = menu.addAction(tr("Start new page")); - currAction->setCheckable(true); - currAction->setChecked(startNewPage()); } void BandDesignIntf::processPopUpAction(QAction *action) @@ -524,12 +526,10 @@ void BandDesignIntf::processPopUpAction(QAction *action) if (action->text().compare(tr("Keep bottom space")) == 0){ setProperty("keepBottomSpace",action->isChecked()); } - if (action->text().compare(tr("Start new page")) == 0){ - setProperty("startNewPage",action->isChecked()); - } - if (action->text().compare(tr("Start from new page")) == 0){ - setProperty("startFromNewPage",action->isChecked()); + if (action->text().compare(tr("Print if empty")) == 0){ + setProperty("printIfEmpty",action->isChecked()); } + } BaseDesignIntf* BandDesignIntf::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent) @@ -798,7 +798,11 @@ bool BandDesignIntf::repeatOnEachRow() const void BandDesignIntf::setRepeatOnEachRow(bool repeatOnEachRow) { - m_repeatOnEachRow = repeatOnEachRow; + if (m_repeatOnEachRow != repeatOnEachRow){ + m_repeatOnEachRow = repeatOnEachRow; + if (!isLoading()) + notify("repeatOnEachRow", !m_repeatOnEachRow, m_repeatOnEachRow); + } } bool BandDesignIntf::printAlways() const @@ -808,7 +812,11 @@ bool BandDesignIntf::printAlways() const void BandDesignIntf::setPrintAlways(bool printAlways) { - m_printAlways = printAlways; + if (m_printAlways != printAlways){ + m_printAlways = printAlways; + if (!isLoading()) + notify("printAlways", !m_printAlways, m_printAlways); + } } bool BandDesignIntf::startFromNewPage() const @@ -854,7 +862,11 @@ bool BandDesignIntf::reprintOnEachPage() const void BandDesignIntf::setReprintOnEachPage(bool reprintOnEachPage) { - m_reprintOnEachPage = reprintOnEachPage; + if (m_reprintOnEachPage != reprintOnEachPage){ + m_reprintOnEachPage = reprintOnEachPage; + if (!isLoading()) + notify("reprintOnEachPage", !m_reprintOnEachPage, m_reprintOnEachPage); + } } int BandDesignIntf::columnIndex() const @@ -874,7 +886,12 @@ bool BandDesignIntf::printIfEmpty() const void BandDesignIntf::setPrintIfEmpty(bool printIfEmpty) { - m_printIfEmpty = printIfEmpty; + if (m_printIfEmpty != printIfEmpty){ + m_printIfEmpty = printIfEmpty; + if (!isLoading()) + notify("printIfEmpty", !m_printIfEmpty, m_printIfEmpty); + } + } BandDesignIntf *BandDesignIntf::bandHeader() @@ -903,7 +920,11 @@ bool BandDesignIntf::sliceLastRow() const void BandDesignIntf::setSliceLastRow(bool sliceLastRow) { - m_sliceLastRow = sliceLastRow; + if (m_sliceLastRow != sliceLastRow){ + m_sliceLastRow = sliceLastRow; + if (!isLoading()) + notify("sliceLastRow", !sliceLastRow, sliceLastRow); + } } int BandDesignIntf::maxScalePercent() const From db8cb6c695f13fc9e3ce234c39ea76b237380a69 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 20 Jun 2018 22:25:11 +0300 Subject: [PATCH 05/58] Russian translation updated --- translations/limereport_ru.ts | 192 +++++++--------------------------- 1 file changed, 39 insertions(+), 153 deletions(-) diff --git a/translations/limereport_ru.ts b/translations/limereport_ru.ts index df9e655..1e09923 100644 --- a/translations/limereport_ru.ts +++ b/translations/limereport_ru.ts @@ -275,10 +275,6 @@ p, li { white-space: pre-wrap; } PageFooter Нижний колонтитул - - Subdetail - Подчиненный - DataHeaderBand Заголовок данных @@ -287,18 +283,6 @@ p, li { white-space: pre-wrap; } DataFooterBand Завершение данных - - SubdetailBand - Подчиненные данные - - - SubdetailHeaderBand - Заголовок подчиненных данных - - - SubdetailFooterBand - Завершение подчиненных данных - GroupBandHeader Заголовок группы @@ -328,12 +312,8 @@ p, li { white-space: pre-wrap; } Сохранять нижний отступ - Start from new page - Начинать с новой страницы - - - Start new page - Начинать новую станицу + Print if empty + Печатать если пустой @@ -461,13 +441,6 @@ p, li { white-space: pre-wrap; } Порт - - LimeReport::ContentItemDesignIntf - - Variable %1 not found - Переменная %1 не найдена - - LimeReport::DataBand @@ -475,8 +448,24 @@ p, li { white-space: pre-wrap; } Данные - useAlternateBackgroundColor - Использовать альтернативный цвет фона + Keep footer together + Привязать колонтитул к данными + + + Keep subdetail together + Привязать подчиненные данные + + + Slice last row + Разрезать последнюю запись + + + Start from new page + Начинать с новой страницы + + + Start new page + Начинать новую станицу @@ -533,10 +522,6 @@ p, li { white-space: pre-wrap; } System variables Системные переменные - - User variables - Пользовательские переменные - Error Ошибка @@ -576,6 +561,10 @@ p, li { white-space: pre-wrap; } DataFooter Подвал данных + + Print always + Печатать всегда + LimeReport::DataHeaderBand @@ -583,6 +572,18 @@ p, li { white-space: pre-wrap; } DataHeader Заголовок данных + + Reprint on each page + Печать на каждой странице + + + Repeat on each row + Повторять на каждой строке + + + Print always + Печатать всегда + LimeReport::DataSourceManager @@ -606,14 +607,6 @@ p, li { white-space: pre-wrap; } Datasource "%1" not found! Источник данных "%1" не найден! - - connection with name "%1" already exists! - соединение "%1" уже существует! - - - datasource with name "%1" already exists! - источник данных "%1" уже существует! - Connection with name "%1" already exists! Соединение "%1" уже существует! @@ -638,37 +631,6 @@ p, li { white-space: pre-wrap; } Внешние переменные - - LimeReport::DialogDesignerManager - - Edit Widgets - Редактировать виджеты - - - Widget Box - Панель виджетов - - - Object Inspector - Инспектор объектов - - - Property Editor - Редактор свойств - - - Signals && Slots Editor - Редактор сигналов и слотов - - - Resource Editor - Редактор ресурсов - - - Action Editor - Редактор действий - - LimeReport::EnumPropItem @@ -685,15 +647,15 @@ p, li { white-space: pre-wrap; } NoneAutoWidth - Нет + Нет MaxWordLength - По ширине слова + По ширине слова MaxStringLength - По ширине строки + По ширине строки TransparentMode @@ -1559,14 +1521,6 @@ p, li { white-space: pre-wrap; } columnCount Количество колонок - - alternateBackgroundMode - Альтернативный цвет фона - - - textIdent - Параграф - securityLevel Уровень безопасности @@ -1672,10 +1626,6 @@ p, li { white-space: pre-wrap; } Report file name Файл отчета - - Page - Страница - Script Скрипт @@ -1779,14 +1729,6 @@ p, li { white-space: pre-wrap; } About О программе - - Hide left panel - Спрятать левую панель - - - Hide right panel - Спрятать правую панель - Report Tools Элементы отчета @@ -1927,38 +1869,6 @@ 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 - Инструменты создания диалогов - Report has been modified! Do you want save the report? Отчет был изменен! Хотите его сохранить? @@ -2182,17 +2092,9 @@ This preview is no longer valid. Dialog with name: %1 can`t be created Диалог с именем: %1 не может быть создан - - Error - Ошибка - LimeReport::ScriptEngineManager - - FieldName - Имя поля - BandName Имя банда @@ -2367,10 +2269,6 @@ This preview is no longer valid. TextItem " %1 " not found! Текстовый элемент "%1" не найден! - - Transparent - Прозрачный - LimeReport::TextItemEditor @@ -2536,10 +2434,6 @@ This preview is no longer valid. Selected elements have different parent containers Выделенные элементы имеют различные родительские контейнеры - - Object with name %1 already exists - Объект с именем %1 уже существует - Function %1 not found or have wrong arguments Функция %1 не найдена или вызвана с неверными аргументами @@ -2576,10 +2470,6 @@ This preview is no longer valid. content содержимое - - Master datasource "%1" not found!!! - Главный источник данных "%1" не найден! - Master datasouce "%1" not found! Главный источник данных "%1" не найден! @@ -2636,10 +2526,6 @@ This preview is no longer valid. Wrong file format Неправильный формат файла - - Datasource manager not found - Менеджер источников данных не найден - Master datasource "%1" not found! Главный источник данных "%1" не найден! From 6ff055efb0eef5d4cc80a90d8c6f76c45b5c4262 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 10 Jul 2018 21:59:12 +0300 Subject: [PATCH 06/58] Font editor fixed --- common.pri | 2 +- .../objectinspector/propertyItems/lrfontpropitem.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/common.pri b/common.pri index 0e2ae3e..2dd4cb2 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 = 83 +LIMEREPORT_VERSION_RELEASE = 85 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/objectinspector/propertyItems/lrfontpropitem.cpp b/limereport/objectinspector/propertyItems/lrfontpropitem.cpp index 1c8b506..3e14fea 100644 --- a/limereport/objectinspector/propertyItems/lrfontpropitem.cpp +++ b/limereport/objectinspector/propertyItems/lrfontpropitem.cpp @@ -82,7 +82,14 @@ void FontPropItem::setPropertyEditorData(QWidget* propertyEditor, const QModelIn void FontPropItem::setModelData(QWidget* propertyEditor, QAbstractItemModel* model, const QModelIndex &index) { - model->setData(index,qobject_cast(propertyEditor)->fontValue()); + + QFont tmpFont = qobject_cast(propertyEditor)->fontValue(); + QFont font(tmpFont.family()); + font.setBold(tmpFont.bold()); + font.setPointSize(tmpFont.pointSize()); + font.setItalic(tmpFont.italic()); + font.setUnderline(tmpFont.underline()); + model->setData(index,font); setValueToObject(propertyName(),propertyValue()); } From b4d6ed76c8a4b78e7f22694f9a7b8fe24149536b Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 11 Jul 2018 02:42:43 +0300 Subject: [PATCH 07/58] Preview scale type has been added --- common.pri | 2 +- include/lrglobal.h | 1 + include/lrpreviewreportwidget.h | 10 ++++++ include/lrreportengine.h | 3 ++ limereport/lrglobal.h | 1 + limereport/lrpreviewreportwidget.cpp | 50 +++++++++++++++++++++++++++- limereport/lrpreviewreportwidget.h | 10 ++++++ limereport/lrpreviewreportwindow.cpp | 27 +++++++++++++++ limereport/lrpreviewreportwindow.h | 6 ++++ limereport/lrreportengine.cpp | 44 ++++++++++++++++++++++-- limereport/lrreportengine.h | 3 ++ limereport/lrreportengine_p.h | 6 ++++ 12 files changed, 159 insertions(+), 4 deletions(-) diff --git a/common.pri b/common.pri index 2dd4cb2..2c33314 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 = 85 +LIMEREPORT_VERSION_RELEASE = 86 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/include/lrglobal.h b/include/lrglobal.h index f2c866f..563e807 100644 --- a/include/lrglobal.h +++ b/include/lrglobal.h @@ -103,6 +103,7 @@ namespace Const{ enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols}; enum RenderPass {FirstPass, SecondPass}; enum ArrangeType {AsNeeded, Force}; + enum ScaleType {FitWidth, FitPage, OneToOne, Percents}; enum PreviewHint{ShowAllPreviewBars = 0, HidePreviewToolBar = 1, HidePreviewMenuBar = 2, diff --git a/include/lrpreviewreportwidget.h b/include/lrpreviewreportwidget.h index 4e35ea6..d66ac70 100644 --- a/include/lrpreviewreportwidget.h +++ b/include/lrpreviewreportwidget.h @@ -2,6 +2,7 @@ #define LRPREVIEWREPORTWIDGET_H #include +#include #include "lrglobal.h" namespace LimeReport { @@ -22,6 +23,9 @@ class LIMEREPORT_EXPORT PreviewReportWidget : public QWidget public: explicit PreviewReportWidget(ReportEnginePrivate *report, QWidget *parent = 0); ~PreviewReportWidget(); + ScaleType scaleType() const; + int scalePercent() const; + void setScaleType(const ScaleType &scaleType, int percent = 0); public slots: void refreshPages(); void zoomIn(); @@ -39,6 +43,8 @@ public slots: void setScalePercent(int percent); void fitWidth(); void fitPage(); +protected: + void resizeEvent(QResizeEvent *); signals: void pageChanged(int page); void scalePercentChanged(int percent); @@ -47,6 +53,7 @@ private slots: void slotSliderMoved(int value); void reportEngineDestroyed(QObject* object); void slotZoomed(double); + void resizeDone(); private: void initPreview(); void setErrorsMesagesVisible(bool visible); @@ -55,6 +62,9 @@ private: private: Ui::PreviewReportWidget *ui; PreviewReportWidgetPrivate* d_ptr; + ScaleType m_scaleType; + int m_scalePercent; + QTimer m_resizeTimer; }; } // namespace LimeReport diff --git a/include/lrreportengine.h b/include/lrreportengine.h index 746712e..f935b80 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -104,6 +104,9 @@ public: void setPassPharse(QString& passPharse); Qt::LayoutDirection previewLayoutDirection(); void setPreviewLayoutDirection(const Qt::LayoutDirection& previewLayoutDirection); + ScaleType previewScaleType(); + int previewScalePercent(); + void setPreviewScaleType(const ScaleType &previewScaleType, int percent = 0); signals: void renderStarted(); void renderFinished(); diff --git a/limereport/lrglobal.h b/limereport/lrglobal.h index f2c866f..563e807 100644 --- a/limereport/lrglobal.h +++ b/limereport/lrglobal.h @@ -103,6 +103,7 @@ namespace Const{ enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols}; enum RenderPass {FirstPass, SecondPass}; enum ArrangeType {AsNeeded, Force}; + enum ScaleType {FitWidth, FitPage, OneToOne, Percents}; enum PreviewHint{ShowAllPreviewBars = 0, HidePreviewToolBar = 1, HidePreviewMenuBar = 2, diff --git a/limereport/lrpreviewreportwidget.cpp b/limereport/lrpreviewreportwidget.cpp index 4e36335..66dc5de 100644 --- a/limereport/lrpreviewreportwidget.cpp +++ b/limereport/lrpreviewreportwidget.cpp @@ -61,18 +61,21 @@ PageItemDesignIntf::Ptr PreviewReportWidgetPrivate::currentPage() PreviewReportWidget::PreviewReportWidget(ReportEnginePrivate *report, QWidget *parent) : QWidget(parent), - ui(new Ui::PreviewReportWidget), d_ptr(new PreviewReportWidgetPrivate(this)) + ui(new Ui::PreviewReportWidget), d_ptr(new PreviewReportWidgetPrivate(this)), + m_scaleType(FitWidth), m_scalePercent(0) { ui->setupUi(this); d_ptr->m_previewPage = report->createPreviewPage(); d_ptr->m_previewPage->setItemMode( LimeReport::PreviewMode ); d_ptr->m_report = report; + m_resizeTimer.setSingleShot(true); ui->errorsView->setVisible(false); connect(ui->graphicsView->verticalScrollBar(),SIGNAL(valueChanged(int)), this, SLOT(slotSliderMoved(int))); connect(d_ptr->m_report, SIGNAL(destroyed(QObject*)), this, SLOT(reportEngineDestroyed(QObject*))); d_ptr->m_zoomer = new GraphicsViewZoomer(ui->graphicsView); connect(d_ptr->m_zoomer, SIGNAL(zoomed(double)), this, SLOT(slotZoomed(double))); + connect(&m_resizeTimer, SIGNAL(timeout()), this, SLOT(resizeDone())); } PreviewReportWidget::~PreviewReportWidget() @@ -221,6 +224,11 @@ void PreviewReportWidget::setScalePercent(int percent) qreal scaleSize = percent/100.0; ui->graphicsView->scale(scaleSize, scaleSize); emit scalePercentChanged(percent); + if (percent == 100){ + m_scaleType = OneToOne; + } else { + m_scaleType = Percents; + } } void PreviewReportWidget::fitWidth() @@ -228,6 +236,7 @@ void PreviewReportWidget::fitWidth() if (d_ptr->currentPage()){ qreal scalePercent = ui->graphicsView->viewport()->width() / ui->graphicsView->scene()->width(); setScalePercent(scalePercent*100); + m_scaleType = FitWidth; } } @@ -237,9 +246,15 @@ void PreviewReportWidget::fitPage() qreal vScale = ui->graphicsView->viewport()->width() / ui->graphicsView->scene()->width(); qreal hScale = ui->graphicsView->viewport()->height() / d_ptr->currentPage()->height(); setScalePercent(qMin(vScale,hScale)*100); + m_scaleType = FitPage; } } +void PreviewReportWidget::resizeEvent(QResizeEvent *) +{ + m_resizeTimer.start(100); +} + void PreviewReportWidget::setErrorMessages(const QStringList &value) { foreach (QString line, value) { @@ -252,6 +267,22 @@ void PreviewReportWidget::emitPageSet() emit pagesSet(d_ptr->m_reportPages.count()); } +ScaleType PreviewReportWidget::scaleType() const +{ + return m_scaleType; +} + +int PreviewReportWidget::scalePercent() const +{ + return m_scalePercent; +} + +void PreviewReportWidget::setScaleType(const ScaleType &scaleType, int percent) +{ + m_scaleType = scaleType; + m_scalePercent = percent; +} + void PreviewReportWidget::refreshPages() { if (d_ptr->m_report){ @@ -305,6 +336,23 @@ void PreviewReportWidget::slotZoomed(double ) emit scalePercentChanged(d_ptr->m_scalePercent); } +void PreviewReportWidget::resizeDone() +{ + switch (m_scaleType) { + case FitPage: + fitPage(); + break; + case FitWidth: + fitWidth(); + break; + case OneToOne: + setScalePercent(100); + break; + case Percents: + setScalePercent(m_scalePercent); + break; + } +} } diff --git a/limereport/lrpreviewreportwidget.h b/limereport/lrpreviewreportwidget.h index 4e35ea6..d66ac70 100644 --- a/limereport/lrpreviewreportwidget.h +++ b/limereport/lrpreviewreportwidget.h @@ -2,6 +2,7 @@ #define LRPREVIEWREPORTWIDGET_H #include +#include #include "lrglobal.h" namespace LimeReport { @@ -22,6 +23,9 @@ class LIMEREPORT_EXPORT PreviewReportWidget : public QWidget public: explicit PreviewReportWidget(ReportEnginePrivate *report, QWidget *parent = 0); ~PreviewReportWidget(); + ScaleType scaleType() const; + int scalePercent() const; + void setScaleType(const ScaleType &scaleType, int percent = 0); public slots: void refreshPages(); void zoomIn(); @@ -39,6 +43,8 @@ public slots: void setScalePercent(int percent); void fitWidth(); void fitPage(); +protected: + void resizeEvent(QResizeEvent *); signals: void pageChanged(int page); void scalePercentChanged(int percent); @@ -47,6 +53,7 @@ private slots: void slotSliderMoved(int value); void reportEngineDestroyed(QObject* object); void slotZoomed(double); + void resizeDone(); private: void initPreview(); void setErrorsMesagesVisible(bool visible); @@ -55,6 +62,9 @@ private: private: Ui::PreviewReportWidget *ui; PreviewReportWidgetPrivate* d_ptr; + ScaleType m_scaleType; + int m_scalePercent; + QTimer m_resizeTimer; }; } // namespace LimeReport diff --git a/limereport/lrpreviewreportwindow.cpp b/limereport/lrpreviewreportwindow.cpp index 47c4ec0..19520af 100644 --- a/limereport/lrpreviewreportwindow.cpp +++ b/limereport/lrpreviewreportwindow.cpp @@ -253,7 +253,22 @@ void PreviewReportWindow::showEvent(QShowEvent *) { m_fontEditor->setVisible(ui->actionEdit_Mode->isChecked()); m_textAlignmentEditor->setVisible(ui->actionEdit_Mode->isChecked()); + switch (m_previewScaleType) { + case FitWidth: + m_previewReportWidget->fitWidth(); + break; + case FitPage: + m_previewReportWidget->fitPage(); + break; + case OneToOne: + m_previewReportWidget->setScalePercent(100); + break; + case Percents: + m_previewReportWidget->setScalePercent(m_previewScalePercent); + + } } + void PreviewReportWindow::selectStateIcon() { if (ui->toolBar->isHidden()){ @@ -333,6 +348,18 @@ void PreviewReportWindow::initPercentCombobox() m_scalePercent->setCurrentIndex(4); } +ScaleType PreviewReportWindow::previewScaleType() const +{ + return m_previewScaleType; +} + +void PreviewReportWindow::setPreviewScaleType(const ScaleType &previewScaleType, int percent) +{ + m_previewScaleType = previewScaleType; + m_previewScalePercent = percent; + m_previewReportWidget->setScaleType(previewScaleType, percent); +} + void PreviewReportWindow::on_actionSaveToFile_triggered() { m_previewReportWidget->saveToFile(); diff --git a/limereport/lrpreviewreportwindow.h b/limereport/lrpreviewreportwindow.h index 78e4c07..63761c3 100644 --- a/limereport/lrpreviewreportwindow.h +++ b/limereport/lrpreviewreportwindow.h @@ -68,6 +68,9 @@ public: void setMenuVisible(bool value); void setHideResultEditButton(bool value); QSettings* settings(); + ScaleType previewScaleType() const; + void setPreviewScaleType(const ScaleType &previewScaleType, int percent = 0); + protected: void writeSetting(); void restoreSetting(); @@ -115,6 +118,9 @@ private: int m_priorScrolValue; PreviewReportWidget* m_previewReportWidget; QComboBox* m_scalePercent; + ScaleType m_previewScaleType; + int m_previewScalePercent; + }; } //namespace LimeReport #endif // LRPREVIEWREPORTWINDOW_H diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index adb9e73..3191b86 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -63,7 +63,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_resultIsEditable(true), m_passPhrase("HjccbzHjlbyfCkjy"), - m_fileWatcher( new QFileSystemWatcher( this ) ) + m_fileWatcher( new QFileSystemWatcher( this ) ), + m_previewScaleType(FitWidth), m_previewScalePercent(0) { #ifdef HAVE_STATIC_BUILD initResources(); @@ -381,6 +382,7 @@ void ReportEnginePrivate::previewReport(PreviewHints hints) w->setSettings(settings()); w->setPages(pages); w->setLayoutDirection(m_previewLayoutDirection); + if (!dataManager()->errorsList().isEmpty()){ w->setErrorMessages(dataManager()->errorsList()); } @@ -394,6 +396,9 @@ void ReportEnginePrivate::previewReport(PreviewHints hints) w->setHideResultEditButton(resultIsEditable()); m_activePreview = w; + + w->setPreviewScaleType(m_previewScaleType, m_previewScalePercent); + connect(w,SIGNAL(destroyed(QObject*)), this, SLOT(slotPreviewWindowDestroyed(QObject*))); w->exec(); } @@ -714,7 +719,23 @@ QString ReportEnginePrivate::renderToString() render.setDatasources(dataManager()); render.setScriptContext(scriptContext()); return render.renderPageToString(m_pages.at(0)); - }else return QString(); + } else return QString(); +} + +ScaleType ReportEnginePrivate::previewScaleType() +{ + return m_previewScaleType; +} + +int ReportEnginePrivate::previewScalePercent() +{ + return m_previewScalePercent; +} + +void ReportEnginePrivate::setPreviewScaleType(const ScaleType &scaleType, int percent) +{ + m_previewScaleType = scaleType; + m_previewScalePercent = percent; } Qt::LayoutDirection ReportEnginePrivate::previewLayoutDirection() @@ -945,6 +966,25 @@ void ReportEngine::setPreviewLayoutDirection(const Qt::LayoutDirection& layoutDi return d->setPreviewLayoutDirection(layoutDirection); } +ScaleType ReportEngine::previewScaleType() +{ + Q_D(ReportEngine); + return d->previewScaleType(); +} + +int ReportEngine::previewScalePercent() +{ + Q_D(ReportEngine); + return d->previewScalePercent(); +} + +void ReportEngine::setPreviewScaleType(const ScaleType &previewScaleType, int percent) +{ + Q_D(ReportEngine); + d->setPreviewScaleType(previewScaleType, percent); +} + + void ReportEngine::setShowProgressDialog(bool value) { Q_D(ReportEngine); diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index 746712e..f935b80 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -104,6 +104,9 @@ public: void setPassPharse(QString& passPharse); Qt::LayoutDirection previewLayoutDirection(); void setPreviewLayoutDirection(const Qt::LayoutDirection& previewLayoutDirection); + ScaleType previewScaleType(); + int previewScalePercent(); + void setPreviewScaleType(const ScaleType &previewScaleType, int percent = 0); signals: void renderStarted(); void renderFinished(); diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index 7d47e90..7784479 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -132,6 +132,10 @@ public: void clearSelection(); Qt::LayoutDirection previewLayoutDirection(); void setPreviewLayoutDirection(const Qt::LayoutDirection& previewLayoutDirection); + ScaleType previewScaleType(); + int previewScalePercent(); + void setPreviewScaleType(const ScaleType &previewScaleType, int percent = 0); + signals: void pagesLoadFinished(); void datasourceCollectionLoadFinished(const QString& collectionName); @@ -186,6 +190,8 @@ private: QString m_passPhrase; QFileSystemWatcher *m_fileWatcher; Qt::LayoutDirection m_previewLayoutDirection; + ScaleType m_previewScaleType; + int m_previewScalePercent; }; } From 24bc4f9b9d447328fdf362b892bef44436761b0c Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 11 Jul 2018 12:35:41 +0300 Subject: [PATCH 08/58] Resize preview widget in percent mode has been fixed --- limereport/lrpreviewreportwidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/limereport/lrpreviewreportwidget.cpp b/limereport/lrpreviewreportwidget.cpp index 66dc5de..2776aeb 100644 --- a/limereport/lrpreviewreportwidget.cpp +++ b/limereport/lrpreviewreportwidget.cpp @@ -228,6 +228,7 @@ void PreviewReportWidget::setScalePercent(int percent) m_scaleType = OneToOne; } else { m_scaleType = Percents; + m_scalePercent = percent; } } From f10647e9871d4b8e1910d80c7b2747625e097a57 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 11 Jul 2018 12:38:45 +0300 Subject: [PATCH 09/58] Style name removed from font serializer --- .../serializators/lrxmlbasetypesserializators.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/limereport/serializators/lrxmlbasetypesserializators.cpp b/limereport/serializators/lrxmlbasetypesserializators.cpp index c0c2ce7..559bee9 100644 --- a/limereport/serializators/lrxmlbasetypesserializators.cpp +++ b/limereport/serializators/lrxmlbasetypesserializators.cpp @@ -179,9 +179,9 @@ void XmlFontSerializator::save(const QVariant &value, QString name) _node.setAttribute("Type","QFont"); _node.setAttribute("family",font.family()); _node.setAttribute("pointSize",font.pointSize()); -#if QT_VERSION>0x040800 - _node.setAttribute("stylename",font.styleName()); -#endif +//#if QT_VERSION>0x040800 +// _node.setAttribute("stylename",font.styleName()); +//#endif _node.setAttribute("weight",font.weight()); //saveBool(_node,"bold",font.bold()); saveBool(_node,"italic",font.italic()); @@ -194,9 +194,9 @@ QVariant XmlFontSerializator::loadValue() QFont font; font.setFamily(node()->attribute("family")); font.setPointSize(node()->attribute("pointSize").toInt()); -#if QT_VERSION>0x040800 - font.setStyleName(node()->attribute("stylename")); -#endif +//#if QT_VERSION>0x040800 +// font.setStyleName(node()->attribute("stylename")); +//#endif font.setWeight(node()->attribute("weight").toInt()); if (!node()->attribute("bold").isEmpty()) font.setBold(node()->attribute("bold").toInt()); From f0a44483044dad90c21a2f021a13335346a216ab Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 11 Jul 2018 12:39:04 +0300 Subject: [PATCH 10/58] version changed --- common.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.pri b/common.pri index 2c33314..35091ea 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 = 86 +LIMEREPORT_VERSION_RELEASE = 87 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" From 29379c1e1bb3ddd432d528df2c3a5a36706741cb Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 12 Jul 2018 21:09:18 +0300 Subject: [PATCH 11/58] Proxy model has been fixed --- limereport/databrowser/lrsqleditdialog.cpp | 13 +++++++++++-- limereport/databrowser/lrsqleditdialog.h | 1 + limereport/lrdatadesignintf.cpp | 17 ++++++++++------- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/limereport/databrowser/lrsqleditdialog.cpp b/limereport/databrowser/lrsqleditdialog.cpp index 05e3267..90ad426 100644 --- a/limereport/databrowser/lrsqleditdialog.cpp +++ b/limereport/databrowser/lrsqleditdialog.cpp @@ -113,8 +113,8 @@ void SQLEditDialog::accept() if (ui->fieldsMap->rowCount()>0){ for(int i=0;ifieldsMap->rowCount();++i){ LimeReport::FieldsCorrelation fieldsCorrelation; - fieldsCorrelation.master=ui->fieldsMap->item(i,0)->data(Qt::DisplayRole).toString(); - fieldsCorrelation.detail=ui->fieldsMap->item(i,1)->data(Qt::DisplayRole).toString(); + fieldsCorrelation.master = ui->fieldsMap->item(i,0) ? ui->fieldsMap->item(i,0)->data(Qt::DisplayRole).toString() : ""; + fieldsCorrelation.detail = ui->fieldsMap->item(i,1) ? ui->fieldsMap->item(i,1)->data(Qt::DisplayRole).toString() : ""; result.fieldMap.append(fieldsCorrelation); } } @@ -351,4 +351,13 @@ void SQLEditDialog::hidePreview() ui->pbHidePreview->setVisible(false); } +void SQLEditDialog::on_pbDelField_clicked() +{ + ui->fieldsMap->removeRow(ui->fieldsMap->currentRow()); +} + } // namespace LimeReport + + + + diff --git a/limereport/databrowser/lrsqleditdialog.h b/limereport/databrowser/lrsqleditdialog.h index 269f3f4..7773acd 100644 --- a/limereport/databrowser/lrsqleditdialog.h +++ b/limereport/databrowser/lrsqleditdialog.h @@ -73,6 +73,7 @@ private slots: void on_rbProxy_clicked(bool checked); void on_rbSubQuery_clicked(bool checked); void on_pbAddField_clicked(); + void on_pbDelField_clicked(); void initQueryMode(); void initSubQueryMode(); void initProxyMode(); diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index 18e0d49..6c155ce 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -628,14 +628,17 @@ QVariant MasterDetailProxyModel::sourceData(QString fieldName, int row) const QVariant MasterDetailProxyModel::masterData(QString fieldName) const { IDataSource* master = dataManager()->dataSource(m_masterName); - int columnIndex = master->columnIndexByName(fieldName); - if (columnIndex!=-1){ - return master->data(fieldName); - } else { - throw ReportError( - tr("Field: \"%1\" not found in \"%2\" master datasource").arg(fieldName).arg(m_masterName) - ); + if (master){ + int columnIndex = master->columnIndexByName(fieldName); + if (columnIndex!=-1){ + return master->data(fieldName); + } else { + throw ReportError( + tr("Field: \"%1\" not found in \"%2\" master datasource").arg(fieldName).arg(m_masterName) + ); + } } + return QVariant(); } bool CallbackDatasource::next(){ From dfa596ef947aa020557e82adf26e63ac5f4f5637 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 12 Jul 2018 21:10:19 +0300 Subject: [PATCH 12/58] Version changed --- common.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.pri b/common.pri index 35091ea..8f5d3b6 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 = 87 +LIMEREPORT_VERSION_RELEASE = 88 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" From af12120260b65a4716544bab10c7e9f17f9199b5 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 13 Jul 2018 02:25:10 +0300 Subject: [PATCH 13/58] Band relocation has been fixed --- common.pri | 2 +- limereport/lrbanddesignintf.cpp | 13 +++++++++++++ limereport/lrbanddesignintf.h | 1 + limereport/lrbasedesignintf.cpp | 4 +++- limereport/lrpageitemdesignintf.cpp | 29 ++++++++++++++++++++++++++--- 5 files changed, 44 insertions(+), 5 deletions(-) diff --git a/common.pri b/common.pri index 8f5d3b6..dd2e624 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 = 88 +LIMEREPORT_VERSION_RELEASE = 89 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index 56c2642..00416b8 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -389,6 +389,19 @@ int BandDesignIntf::minChildIndex(BandDesignIntf::BandsType bandType){ return curIndex; } +int BandDesignIntf::minChildIndex(QSet ignoredBands) +{ + int curIndex = bandIndex(); + foreach(BandDesignIntf* childBand, childBands()){ + if (!ignoredBands.contains(childBand->bandType()) && childBand->bandIndex() < bandIndex()){ + curIndex = std::min(curIndex, childBand->maxChildIndex(ignoredBands)); + } + } + return curIndex; +} + + + QList BandDesignIntf::childrenByType(BandDesignIntf::BandsType type) { QList resList; diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index 7bf8401..50dd643 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -167,6 +167,7 @@ public: bool isConnectedToBand(BandDesignIntf::BandsType bandType) const; int minChildIndex(BandsType bandType); + int minChildIndex(QSet ignoredBands = QSet()); int maxChildIndex(BandDesignIntf::BandsType bandType) const; int maxChildIndex(QSet ignoredBands = QSet()) const; diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 61c7283..052ed7c 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -964,7 +964,9 @@ void BaseDesignIntf::setGeometryProperty(QRectF rect) setWidth(rect.width()); if (rect.height() != geometry().height()) setHeight(rect.height()); - if (!isLoading()) notify("geometry",oldValue,rect); + if (!isLoading()) { + notify("geometry",oldValue,rect); + } } } diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index 2e8de0b..9e5c4ce 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -595,9 +595,32 @@ void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry } } if (curIndex != band->bandIndex()){ - int swapIndex = bandToSwap->maxChildIndex(); - bandToSwap->changeBandIndex(band->bandIndex(),true); - band->changeBandIndex(swapIndex,true); + + int startIndex = std::min(band->minChildIndex(), bandToSwap->minChildIndex()); + +// int endIndex = std::max(band->maxChildIndex(), bandToSwap->maxChildIndex()); +// QList bandToMove; +// foreach(BandDesignIntf* curBand, m_bands){ +// if (curBand->bandIndex() > endIndex) +// bandToMove.append(curBand); +// } + + BandDesignIntf* firstMoveBand = (bandToSwap->bandIndex() > band->bandIndex()) ? bandToSwap: band; + + firstMoveBand->changeBandIndex(startIndex, true); + if (firstMoveBand == band){ + bandToSwap->changeBandIndex(firstMoveBand->maxChildIndex()+1,true); + } else { + band->changeBandIndex(firstMoveBand->maxChildIndex()+1, true); + } + +// int maxNewIndex = std::max(band->maxChildIndex(), bandToSwap->maxChildIndex()); +// if (maxNewIndex > endIndex){ +// foreach(BandDesignIntf* curBand, bandToMove){ +// curBand->setBandIndex(curBand->bandIndex()+(maxNewIndex - endIndex)); +// } +// } + } relocateBands(); From 6641215cc0940163348bc7acc0587940443bc712 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 13 Jul 2018 17:40:49 +0300 Subject: [PATCH 14/58] Bands relocation redo, undo fixed --- common.pri | 2 +- limereport/lrpagedesignintf.cpp | 45 +++++++++++++++++++---- limereport/lrpagedesignintf.h | 10 ++++++ limereport/lrpageitemdesignintf.cpp | 55 ++++++++++++++++------------- limereport/lrpageitemdesignintf.h | 3 +- 5 files changed, 82 insertions(+), 33 deletions(-) diff --git a/common.pri b/common.pri index dd2e624..5163922 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 = 89 +LIMEREPORT_VERSION_RELEASE = 90 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/lrpagedesignintf.cpp b/limereport/lrpagedesignintf.cpp index 67d8408..e0f1747 100644 --- a/limereport/lrpagedesignintf.cpp +++ b/limereport/lrpagedesignintf.cpp @@ -870,10 +870,17 @@ void PageDesignIntf::saveSelectedItemsGeometry() void PageDesignIntf::checkSizeOrPosChanges() { - CommandIf::Ptr posCommand; if ((selectedItems().count() > 0) && (m_positionStamp.count() > 0)) { - if (m_positionStamp[0].pos != selectedItems().at(0)->pos()) { + bool bandFound = false; + foreach(QGraphicsItem* item, selectedItems()){ + BandDesignIntf* band = dynamic_cast(item); + if (band){ + bandFound = true; + break; + } + } + if (!bandFound && (m_positionStamp[0].pos != selectedItems().at(0)->pos())) { posCommand = createChangePosCommand(); } m_positionStamp.clear(); @@ -909,16 +916,14 @@ CommandIf::Ptr PageDesignIntf::createChangePosCommand() QVector newPoses; foreach(ReportItemPos itemPos, m_positionStamp) { BaseDesignIntf *reportItem = reportItemByName(itemPos.objectName); - if (reportItem) { ReportItemPos newPos; newPos.objectName = reportItem->objectName(); newPos.pos = reportItem->pos(); newPoses.append(newPos); } - } + } return PosChangedCommand::create(this, m_positionStamp, newPoses); - } CommandIf::Ptr PageDesignIntf::createChangeSizeCommand() @@ -2240,7 +2245,35 @@ qreal ItemProjections::square(QRectF rect) qreal ItemProjections::square(BaseDesignIntf *item) { - return square(QRectF(item->pos().x(),item->pos().y(),item->width(),item->height())); + return square(QRectF(item->pos().x(),item->pos().y(),item->width(),item->height())); +} + +CommandIf::Ptr BandSwapCommand::create(PageDesignIntf *page, const QString &bandName, const QString &bandToSwapName) +{ + BandSwapCommand *command = new BandSwapCommand(); + command->setPage(page); + command->bandName = bandName; + command->bandToSwapName = bandToSwapName; + return CommandIf::Ptr(command); +} + +bool BandSwapCommand::doIt() +{ + BandDesignIntf* band = dynamic_cast(page()->reportItemByName(bandName)); + BandDesignIntf* bandToSwap = dynamic_cast(page()->reportItemByName(bandToSwapName)); + if (band && bandToSwap){ + page()->pageItem()->swapBands(band, bandToSwap); + return true; + } + return false; +} + +void BandSwapCommand::undoIt() +{ + BandDesignIntf* band = dynamic_cast(page()->reportItemByName(bandName)); + BandDesignIntf* bandToSwap = dynamic_cast(page()->reportItemByName(bandToSwapName)); + if (band && bandToSwap) + page()->pageItem()->swapBands(bandToSwap, band); } } diff --git a/limereport/lrpagedesignintf.h b/limereport/lrpagedesignintf.h index 684df0b..e3c1763 100644 --- a/limereport/lrpagedesignintf.h +++ b/limereport/lrpagedesignintf.h @@ -435,6 +435,16 @@ namespace LimeReport { QVector m_newPos; }; + class BandSwapCommand : public AbstractPageCommand{ + public: + static CommandIf::Ptr create(PageDesignIntf* page, const QString& bandName, const QString& bandToSwapName); + bool doIt(); + void undoIt(); + private: + QString bandName; + QString bandToSwapName; + }; + class SizeChangedCommand : public AbstractPageCommand{ public: static CommandIf::Ptr create(PageDesignIntf* page, QVector& oldSize, QVector& newSize); diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index 9e5c4ce..f13218d 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -568,6 +568,34 @@ void PageItemDesignIntf::bandDeleted(QObject *band) relocateBands(); } +void PageItemDesignIntf::swapBands(BandDesignIntf* band, BandDesignIntf* bandToSwap){ + int startIndex = std::min(band->minChildIndex(), bandToSwap->minChildIndex()); + +// int endIndex = std::max(band->maxChildIndex(), bandToSwap->maxChildIndex()); +// QList bandToMove; +// foreach(BandDesignIntf* curBand, m_bands){ +// if (curBand->bandIndex() > endIndex) +// bandToMove.append(curBand); +// } + + BandDesignIntf* firstMoveBand = (bandToSwap->bandIndex() > band->bandIndex()) ? bandToSwap: band; + + firstMoveBand->changeBandIndex(startIndex, true); + if (firstMoveBand == band){ + bandToSwap->changeBandIndex(firstMoveBand->maxChildIndex()+1,true); + } else { + band->changeBandIndex(firstMoveBand->maxChildIndex()+1, true); + } + relocateBands(); + +// int maxNewIndex = std::max(band->maxChildIndex(), bandToSwap->maxChildIndex()); +// if (maxNewIndex > endIndex){ +// foreach(BandDesignIntf* curBand, bandToMove){ +// curBand->setBandIndex(curBand->bandIndex()+(maxNewIndex - endIndex)); +// } +// } +} + void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry) { BandDesignIntf* band = dynamic_cast(object); @@ -596,33 +624,10 @@ void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry } if (curIndex != band->bandIndex()){ - int startIndex = std::min(band->minChildIndex(), bandToSwap->minChildIndex()); - -// int endIndex = std::max(band->maxChildIndex(), bandToSwap->maxChildIndex()); -// QList bandToMove; -// foreach(BandDesignIntf* curBand, m_bands){ -// if (curBand->bandIndex() > endIndex) -// bandToMove.append(curBand); -// } - - BandDesignIntf* firstMoveBand = (bandToSwap->bandIndex() > band->bandIndex()) ? bandToSwap: band; - - firstMoveBand->changeBandIndex(startIndex, true); - if (firstMoveBand == band){ - bandToSwap->changeBandIndex(firstMoveBand->maxChildIndex()+1,true); - } else { - band->changeBandIndex(firstMoveBand->maxChildIndex()+1, true); - } - -// int maxNewIndex = std::max(band->maxChildIndex(), bandToSwap->maxChildIndex()); -// if (maxNewIndex > endIndex){ -// foreach(BandDesignIntf* curBand, bandToMove){ -// curBand->setBandIndex(curBand->bandIndex()+(maxNewIndex - endIndex)); -// } -// } + //swapBands(band, bandToSwap); + page()->saveCommand(BandSwapCommand::create(page(), band->objectName(), bandToSwap->objectName()), true); } - relocateBands(); } diff --git a/limereport/lrpageitemdesignintf.h b/limereport/lrpageitemdesignintf.h index ef9b06d..aa66b0a 100644 --- a/limereport/lrpageitemdesignintf.h +++ b/limereport/lrpageitemdesignintf.h @@ -116,7 +116,8 @@ public: bool canContainChildren(){ return true;} bool resetPageNumber() const; void setResetPageNumber(bool resetPageNumber); - void updateSubItemsSize(RenderPass pass, DataSourceManager *dataManager); + void updateSubItemsSize(RenderPass pass, DataSourceManager *dataManager); + void swapBands(BandDesignIntf *band, BandDesignIntf *bandToSwap); protected slots: void bandDeleted(QObject* band); From 08bfc160b83e28db6c4a8b619c07588bb1e238bd Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 16 Jul 2018 15:21:37 +0300 Subject: [PATCH 15/58] Band relocation fixed --- limereport/lrpageitemdesignintf.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index f13218d..a060aff 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -569,7 +569,8 @@ void PageItemDesignIntf::bandDeleted(QObject *band) } void PageItemDesignIntf::swapBands(BandDesignIntf* band, BandDesignIntf* bandToSwap){ - int startIndex = std::min(band->minChildIndex(), bandToSwap->minChildIndex()); + int firstStartIndex = std::min(band->minChildIndex(), bandToSwap->minChildIndex()); + int secondStartIndex = std::max(band->minChildIndex(), bandToSwap->minChildIndex()); // int endIndex = std::max(band->maxChildIndex(), bandToSwap->maxChildIndex()); // QList bandToMove; @@ -580,11 +581,11 @@ void PageItemDesignIntf::swapBands(BandDesignIntf* band, BandDesignIntf* bandToS BandDesignIntf* firstMoveBand = (bandToSwap->bandIndex() > band->bandIndex()) ? bandToSwap: band; - firstMoveBand->changeBandIndex(startIndex, true); + firstMoveBand->changeBandIndex(firstStartIndex, true); if (firstMoveBand == band){ - bandToSwap->changeBandIndex(firstMoveBand->maxChildIndex()+1,true); + bandToSwap->changeBandIndex(secondStartIndex,true); } else { - band->changeBandIndex(firstMoveBand->maxChildIndex()+1, true); + band->changeBandIndex(secondStartIndex, true); } relocateBands(); From ba46f39dcfcad8da9c4c059995b63cc5aa14c8e6 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 16 Jul 2018 16:09:30 +0300 Subject: [PATCH 16/58] CallbackDatasource has been fixed --- limereport/lrdatadesignintf.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index 6c155ce..b98c4aa 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -692,6 +692,7 @@ bool CallbackDatasource::prior(){ void CallbackDatasource::first(){ m_currentRow = 0; + m_getDataFromCache = false; m_eof=checkIfEmpty(); bool result=false; From c10a699d04d52e72dfb8aac270cf260863bedd77 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 16 Jul 2018 16:12:54 +0300 Subject: [PATCH 17/58] Columns placement 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 1999c77..ad98b90 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -928,7 +928,7 @@ bool ReportRender::registerBand(BandDesignIntf *band, bool registerInChildren) m_maxHeightByColumn.append(m_maxHeightByColumn[0]); m_currentStartDataPos.append(m_currentStartDataPos[0]); } - m_currentColumn = 0; + m_currentColumn = -1; } @@ -936,7 +936,7 @@ bool ReportRender::registerBand(BandDesignIntf *band, bool registerInChildren) (!band->isHeader() || (band->bandNestingLevel() > 0 && band->columnsFillDirection() != BandDesignIntf::Horizontal ))){ if (band->columnsFillDirection() == BandDesignIntf::Horizontal){ - if (m_currentColumncolumnsCount()-1) + if (m_currentColumn < band->columnsCount()-1) m_currentColumn = m_currentColumn+1; else m_currentColumn = 0; From 8c19656c4e2b7d6f9f76d21370b3f4344019d539 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 16 Jul 2018 16:13:36 +0300 Subject: [PATCH 18/58] Version has been changed --- common.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.pri b/common.pri index 5163922..ab673b2 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 = 90 +LIMEREPORT_VERSION_RELEASE = 91 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" From f3ba4fcd80ea96205f919a5e2104eaa951fc794e Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 18 Jul 2018 19:48:05 +0300 Subject: [PATCH 19/58] Columns rendering has been fixed --- common.pri | 2 +- limereport/lrreportrender.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/common.pri b/common.pri index ab673b2..69b5256 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 = 91 +LIMEREPORT_VERSION_RELEASE = 92 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index ad98b90..5415356 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -948,6 +948,8 @@ bool ReportRender::registerBand(BandDesignIntf *band, bool registerInChildren) } + if (m_currentColumn == -1) m_currentColumn = 0; + if ( (isMultiColumnHeader(band) && band->height() <= m_maxHeightByColumn[0]) || (band->height() <= m_maxHeightByColumn[m_currentColumn])){ From 90ae2ac188fa70b40c7b34b48c08af1564c1ffa4 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 18 Jul 2018 21:39:25 +0300 Subject: [PATCH 20/58] Columns rendering has been fixed --- common.pri | 2 +- limereport/lrreportrender.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/common.pri b/common.pri index 69b5256..5b0e9d1 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 = 92 +LIMEREPORT_VERSION_RELEASE = 93 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 5415356..28e9882 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -931,7 +931,6 @@ bool ReportRender::registerBand(BandDesignIntf *band, bool registerInChildren) m_currentColumn = -1; } - if ( (band->columnsCount() > 1) && (!band->isHeader() || (band->bandNestingLevel() > 0 && band->columnsFillDirection() != BandDesignIntf::Horizontal ))){ @@ -941,14 +940,17 @@ bool ReportRender::registerBand(BandDesignIntf *band, bool registerInChildren) else m_currentColumn = 0; } else { - if ( (m_maxHeightByColumn[0] == m_maxHeightByColumn[m_currentColumn]) && (m_maxHeightByColumn[0] >= band->height()) ){ + m_currentColumn = m_currentColumn == -1 ? 0: m_currentColumn; + if ((m_currentColumn !=0) && + (m_maxHeightByColumn[0] == m_maxHeightByColumn[m_currentColumn]) && + (m_maxHeightByColumn[0] >= band->height()) + ){ m_currentColumn = 0; } } - } - if (m_currentColumn == -1) m_currentColumn = 0; + m_currentColumn = m_currentColumn == -1 ? 0: m_currentColumn; if ( (isMultiColumnHeader(band) && band->height() <= m_maxHeightByColumn[0]) || (band->height() <= m_maxHeightByColumn[m_currentColumn])){ From 0e9b8055e9af52e2bc10352277dfa046001ab2a3 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 20 Jul 2018 11:48:01 +0300 Subject: [PATCH 21/58] Bands relocation has been fixed --- common.pri | 2 +- limereport/lrpageitemdesignintf.cpp | 39 ++++++++++++++++------------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/common.pri b/common.pri index 5b0e9d1..4c68ba1 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 = 93 +LIMEREPORT_VERSION_RELEASE = 94 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index a060aff..6ae6fc7 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -569,32 +569,37 @@ void PageItemDesignIntf::bandDeleted(QObject *band) } void PageItemDesignIntf::swapBands(BandDesignIntf* band, BandDesignIntf* bandToSwap){ - int firstStartIndex = std::min(band->minChildIndex(), bandToSwap->minChildIndex()); - int secondStartIndex = std::max(band->minChildIndex(), bandToSwap->minChildIndex()); -// int endIndex = std::max(band->maxChildIndex(), bandToSwap->maxChildIndex()); -// QList bandToMove; -// foreach(BandDesignIntf* curBand, m_bands){ -// if (curBand->bandIndex() > endIndex) -// bandToMove.append(curBand); -// } + int firstIndex = std::min(band->minChildIndex(), bandToSwap->minChildIndex()); + int secondIndex = std::max(band->minChildIndex(), bandToSwap->minChildIndex()); + int moveIndex = std::min(band->maxChildIndex(), bandToSwap->maxChildIndex()); + + QList bandToMove; + foreach(BandDesignIntf* curBand, m_bands){ + if ( curBand->bandIndex() > moveIndex && curBand->bandIndex() < secondIndex && + curBand->bandType() == BandDesignIntf::Data && + curBand != band && curBand != bandToSwap + ) + bandToMove.append(curBand); + } BandDesignIntf* firstMoveBand = (bandToSwap->bandIndex() > band->bandIndex()) ? bandToSwap: band; - firstMoveBand->changeBandIndex(firstStartIndex, true); + firstMoveBand->changeBandIndex(firstIndex, true); + moveIndex = firstMoveBand->maxChildIndex() + 1; + qSort(bandToMove.begin(), bandToMove.end(), bandIndexLessThen); + foreach(BandDesignIntf* curBand, bandToMove){ + curBand->changeBandIndex(moveIndex,true); + moveIndex = curBand->maxChildIndex() + 1; + } + if (firstMoveBand == band){ - bandToSwap->changeBandIndex(secondStartIndex,true); + bandToSwap->changeBandIndex(moveIndex,true); } else { - band->changeBandIndex(secondStartIndex, true); + band->changeBandIndex(moveIndex, true); } relocateBands(); -// int maxNewIndex = std::max(band->maxChildIndex(), bandToSwap->maxChildIndex()); -// if (maxNewIndex > endIndex){ -// foreach(BandDesignIntf* curBand, bandToMove){ -// curBand->setBandIndex(curBand->bandIndex()+(maxNewIndex - endIndex)); -// } -// } } void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry) From 84c2428dc10cc1699fe2ca94ec09ec9c2f704132 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 20 Jul 2018 14:04:53 +0300 Subject: [PATCH 22/58] Vertical columns headers fixed --- common.pri | 2 +- limereport/lrreportrender.cpp | 16 +++++++++++----- limereport/lrreportrender.h | 1 + 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/common.pri b/common.pri index 4c68ba1..59b0769 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 = 94 +LIMEREPORT_VERSION_RELEASE = 95 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 28e9882..7084498 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -89,11 +89,11 @@ void ReportRender::rearrangeColumnsItems() { if (isNeedToRearrangeColumnsItems()){ qreal startHeight = columnHeigth(0); - int avg = m_columnedBandItems.size()/m_columnedBandItems[0]->columnsCount(); - for (int i=1;icolumnsCount();++i){ - if (columnItemsCount(i)columnsCount(); + for (int i = 1; i < m_columnedBandItems[0]->columnsCount(); ++i){ + if (columnItemsCount(i) < avg){ int getCount = avg * (m_columnedBandItems[0]->columnsCount()-i) - columnItemsCount(i); - for (int j=0;jsetPos(band->pos().x()+band->width(),m_columnedBandItems[0]->pos().y()); band->setColumnIndex(i); @@ -149,7 +149,7 @@ void ReportRender::renameChildItems(BaseDesignIntf *item){ ReportRender::ReportRender(QObject *parent) :QObject(parent), m_renderPageItem(0), m_pageCount(0), - m_lastDataBand(0), m_lastRenderedFooter(0), m_currentColumn(0), m_newPageStarted(false) + m_lastRenderedHeader(0), m_lastDataBand(0), m_lastRenderedFooter(0), m_currentColumn(0), m_newPageStarted(false) { initColumns(); } @@ -417,6 +417,9 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign QApplication::processEvents(); if (patternBand){ + if (patternBand->isHeader()) + m_lastRenderedHeader = patternBand; + BandDesignIntf* bandClone = 0; if (bandData){ @@ -473,6 +476,9 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign bandClone->columnsFillDirection()==BandDesignIntf::VerticalUniform)) { startNewColumn(); + if (patternBand->bandHeader() && patternBand->bandHeader()->columnsCount()>1){ + renderBand(patternBand->bandHeader(), 0, mode); + } } else { savePage(); startNewPage(); diff --git a/limereport/lrreportrender.h b/limereport/lrreportrender.h index a207723..7f3bcef 100644 --- a/limereport/lrreportrender.h +++ b/limereport/lrreportrender.h @@ -178,6 +178,7 @@ private: qreal m_dataAreaSize; qreal m_reportFooterHeight; int m_renderedDataBandCount; + BandDesignIntf* m_lastRenderedHeader; BandDesignIntf* m_lastDataBand; BandDesignIntf* m_lastRenderedFooter; bool m_renderCanceled; From d1dec366093b3505b9dfb543889c774fd29c0897 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 24 Jul 2018 23:11:21 +0300 Subject: [PATCH 23/58] Band relocation algorithm has been changed --- common.pri | 2 +- limereport/lrpagedesignintf.cpp | 27 +++++++++++- limereport/lrpagedesignintf.h | 11 +++++ limereport/lrpageitemdesignintf.cpp | 64 +++++++++++++++++++++++++---- limereport/lrpageitemdesignintf.h | 3 +- 5 files changed, 95 insertions(+), 12 deletions(-) diff --git a/common.pri b/common.pri index 59b0769..739441b 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 = 95 +LIMEREPORT_VERSION_RELEASE = 96 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/lrpagedesignintf.cpp b/limereport/lrpagedesignintf.cpp index e0f1747..8fc4cc7 100644 --- a/limereport/lrpagedesignintf.cpp +++ b/limereport/lrpagedesignintf.cpp @@ -2261,7 +2261,7 @@ bool BandSwapCommand::doIt() { BandDesignIntf* band = dynamic_cast(page()->reportItemByName(bandName)); BandDesignIntf* bandToSwap = dynamic_cast(page()->reportItemByName(bandToSwapName)); - if (band && bandToSwap){ + if (page() && band && bandToSwap){ page()->pageItem()->swapBands(band, bandToSwap); return true; } @@ -2272,9 +2272,32 @@ void BandSwapCommand::undoIt() { BandDesignIntf* band = dynamic_cast(page()->reportItemByName(bandName)); BandDesignIntf* bandToSwap = dynamic_cast(page()->reportItemByName(bandToSwapName)); - if (band && bandToSwap) + if (page() && band && bandToSwap) page()->pageItem()->swapBands(bandToSwap, band); } +CommandIf::Ptr BandMoveFromToCommand::create(PageDesignIntf* page, int from, int to) +{ + BandMoveFromToCommand* command = new BandMoveFromToCommand(); + command->setPage(page); + command->from = from; + command->to = to; + return CommandIf::Ptr(command); +} + +bool BandMoveFromToCommand::doIt() +{ + if (page() && from != to) { + page()->pageItem()->moveBandFromTo(from, to); + return true; + } + return false; +} + +void BandMoveFromToCommand::undoIt() +{ + if (page()) page()->pageItem()->moveBandFromTo(to, from); +} + } diff --git a/limereport/lrpagedesignintf.h b/limereport/lrpagedesignintf.h index e3c1763..9c48d8a 100644 --- a/limereport/lrpagedesignintf.h +++ b/limereport/lrpagedesignintf.h @@ -445,6 +445,17 @@ namespace LimeReport { QString bandToSwapName; }; + class BandMoveFromToCommand : public AbstractPageCommand{ + public: + static CommandIf::Ptr create(PageDesignIntf* page, int from, int to); + bool doIt(); + void undoIt(); + private: + int from; + int to; + }; + + class SizeChangedCommand : public AbstractPageCommand{ public: static CommandIf::Ptr create(PageDesignIntf* page, QVector& oldSize, QVector& newSize); diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index 6ae6fc7..961127a 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -577,7 +577,7 @@ void PageItemDesignIntf::swapBands(BandDesignIntf* band, BandDesignIntf* bandToS QList bandToMove; foreach(BandDesignIntf* curBand, m_bands){ if ( curBand->bandIndex() > moveIndex && curBand->bandIndex() < secondIndex && - curBand->bandType() == BandDesignIntf::Data && + curBand->bandType() == band->bandType() && curBand != band && curBand != bandToSwap ) bandToMove.append(curBand); @@ -587,7 +587,9 @@ void PageItemDesignIntf::swapBands(BandDesignIntf* band, BandDesignIntf* bandToS firstMoveBand->changeBandIndex(firstIndex, true); moveIndex = firstMoveBand->maxChildIndex() + 1; + moveIndex = firstIndex; qSort(bandToMove.begin(), bandToMove.end(), bandIndexLessThen); + foreach(BandDesignIntf* curBand, bandToMove){ curBand->changeBandIndex(moveIndex,true); moveIndex = curBand->maxChildIndex() + 1; @@ -602,16 +604,63 @@ void PageItemDesignIntf::swapBands(BandDesignIntf* band, BandDesignIntf* bandToS } +void PageItemDesignIntf::moveBandFromTo(int from, int to) +{ + BandDesignIntf* firstBand = 0; + BandDesignIntf* secondBand = 0; + + int firstIndex = std::min(from,to); + int secondIndex = std::max(from,to); + QList bandsToMove; + int moveIndex = 0; + + foreach(BandDesignIntf* band, bands()){ + if (band->bandIndex() == from){ + firstBand = band; + } + if (band->bandIndex() == to){ + secondBand = band; + bandsToMove.append(band); + } + } + + foreach(BandDesignIntf* curBand, m_bands){ + if ( curBand->bandIndex() > firstIndex && curBand->bandIndex() < secondIndex && + curBand->bandType() == firstBand->bandType() && + curBand != firstBand + ) + bandsToMove.append(curBand); + } + qSort(bandsToMove.begin(), bandsToMove.end(), bandIndexLessThen); + + + if (from > to){ + firstBand->changeBandIndex(secondBand->minChildIndex(), true); + moveIndex = firstBand->maxChildIndex()+1; + } else { + moveIndex = firstBand->minChildIndex(); + firstBand->changeBandIndex(secondBand->minChildIndex(), true); + } + + foreach(BandDesignIntf* curBand, bandsToMove){ + curBand->changeBandIndex(moveIndex,true); + moveIndex = curBand->maxChildIndex() + 1; + } + + relocateBands(); + +} + void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry) { BandDesignIntf* band = dynamic_cast(object); int curIndex = band->bandIndex(); BandDesignIntf* bandToSwap = 0; foreach(BandDesignIntf* curBand, bands()){ - if (newGeometry.y()>oldGeometry.y()) { + if (newGeometry.y() > oldGeometry.y()) { if (curBand->bandType() == band->bandType() - && curIndexbandIndex() - && (curBand->pos().y()+(curBand->height()/2))bandIndex() + && (curBand->pos().y() + (curBand->height()/2)) < newGeometry.y() && curBand->parentBand() == band->parentBand()) { curIndex = curBand->bandIndex(); @@ -620,7 +669,7 @@ void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry } else { if (curBand->bandType() == band->bandType() && curIndex>curBand->bandIndex() - && (curBand->pos().y()+(curBand->height()/2))>newGeometry.y() + && (curBand->pos().y() + (curBand->height()/2)) > newGeometry.y() && curBand->parentBand() == band->parentBand()) { curIndex = curBand->bandIndex(); @@ -629,10 +678,9 @@ void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry } } if (curIndex != band->bandIndex()){ - //swapBands(band, bandToSwap); - page()->saveCommand(BandSwapCommand::create(page(), band->objectName(), bandToSwap->objectName()), true); - + //page()->saveCommand(BandSwapCommand::create(page(), band->objectName(), bandToSwap->objectName()), true); + page()->saveCommand(BandMoveFromToCommand::create(page(), band->bandIndex(), bandToSwap->bandIndex()), true); } relocateBands(); } diff --git a/limereport/lrpageitemdesignintf.h b/limereport/lrpageitemdesignintf.h index aa66b0a..2287cf8 100644 --- a/limereport/lrpageitemdesignintf.h +++ b/limereport/lrpageitemdesignintf.h @@ -117,7 +117,8 @@ public: bool resetPageNumber() const; void setResetPageNumber(bool resetPageNumber); void updateSubItemsSize(RenderPass pass, DataSourceManager *dataManager); - void swapBands(BandDesignIntf *band, BandDesignIntf *bandToSwap); + void swapBands(BandDesignIntf *band, BandDesignIntf *bandToSwap); + void moveBandFromTo(int from, int to); protected slots: void bandDeleted(QObject* band); From 384368dd38be166d268c751f556399df74993e73 Mon Sep 17 00:00:00 2001 From: frostasm Date: Sat, 4 Aug 2018 18:23:56 +0300 Subject: [PATCH 24/58] Move build location from project source top dir to qmake top build dir --- .qmake.cache.in | 2 ++ .qmake.conf | 2 ++ common.pri | 7 ++++++- initvars.pro | 3 +++ limereport.pro | 21 ++++++++++++++------- 5 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 .qmake.cache.in create mode 100644 .qmake.conf create mode 100644 initvars.pro diff --git a/.qmake.cache.in b/.qmake.cache.in new file mode 100644 index 0000000..008a232 --- /dev/null +++ b/.qmake.cache.in @@ -0,0 +1,2 @@ +TOP_SRC_DIR=$$PWD +TOP_BUILD_DIR=$$OUT_PWD diff --git a/.qmake.conf b/.qmake.conf new file mode 100644 index 0000000..5b5aab0 --- /dev/null +++ b/.qmake.conf @@ -0,0 +1,2 @@ +TOP_SRC_DIR=$$PWD +TOP_BUILD_DIR=$$shadowed($$PWD) \ No newline at end of file diff --git a/common.pri b/common.pri index 739441b..1a6792e 100644 --- a/common.pri +++ b/common.pri @@ -24,7 +24,12 @@ CONFIG(release, debug|release){ BUILD_TYPE = debug } -BUILD_DIR = $$PWD/build/$${QT_VERSION} +isEmpty(TOP_BUILD_DIR) { +BUILD_DIR = $${OUT_PWD}/build/$${QT_VERSION} +}else{ +BUILD_DIR = $${TOP_BUILD_DIR}/build/$${QT_VERSION} +} + DEST_INCLUDE_DIR = $$PWD/include unix{ ARCH_DIR = $${OUT_PWD}/unix diff --git a/initvars.pro b/initvars.pro new file mode 100644 index 0000000..b3dc9a9 --- /dev/null +++ b/initvars.pro @@ -0,0 +1,3 @@ +TEMPLATE=subdirs +SUBDIRS= # don't build anything, we're just generating the .qmake.cache file +QMAKE_SUBSTITUTES += .qmake.cache.in diff --git a/limereport.pro b/limereport.pro index 84179ac..2fc1bb0 100644 --- a/limereport.pro +++ b/limereport.pro @@ -10,12 +10,19 @@ contains(CONFIG, zint){ } export($$CONFIG) + +CONFIG += ordered SUBDIRS += \ - limereport - -CONFIG += ordered - -SUBDIRS += demo_r1 demo_r2 designer - - + initvars.pro \ + limereport \ + demo_r1 \ + demo_r2 \ + designer +# QMake top level srcdir and builddir +# https://wiki.qt.io/QMake-top-level-srcdir-and-builddir +#Qt4 .qmake.cache.in +#Qt5 .qmake.conf +OTHER_FILES += \ + .qmake.conf \ + .qmake.cache.in From 169c8bbf9c45c2b41bf89d6c3b3c5ab9d4e73bf5 Mon Sep 17 00:00:00 2001 From: frostasm Date: Sat, 4 Aug 2018 19:03:48 +0300 Subject: [PATCH 25/58] Install binary and header files to Qt installation dir --- limereport/limereport.prf | 22 ++++++++++++++++++++++ limereport/limereport.pro | 15 ++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 limereport/limereport.prf diff --git a/limereport/limereport.prf b/limereport/limereport.prf new file mode 100644 index 0000000..98acf6c --- /dev/null +++ b/limereport/limereport.prf @@ -0,0 +1,22 @@ +QT += xml sql script + +greaterThan(QT_MAJOR_VERSION, 4) { +QT += widgets printsupport +} + +INCLUDEPATH += $$[QT_INSTALL_HEADERS]/LimeReport + +CONFIG(debug, debug|release) { +LIB_NAME = limereportd +} else { +LIB_NAME = limereport +} + +greaterThan(QT_MAJOR_VERSION, 4) { + LIBS += -l$${LIB_NAME} +} else { + qtAddLibrary($${LIB_NAME}) +} + +DEFINES += LIMEREPORT +DEFINES -= NO_LIMEREPORT diff --git a/limereport/limereport.pro b/limereport/limereport.pro index b05ac00..dff9004 100644 --- a/limereport/limereport.pro +++ b/limereport/limereport.pro @@ -37,7 +37,6 @@ contains(CONFIG, staticlib){ } EXTRA_FILES += \ - $$PWD/lrglobal.cpp \ $$PWD/lrglobal.h \ $$PWD/lrdatasourcemanagerintf.h \ $$PWD/lrreportengine.h \ @@ -92,6 +91,20 @@ contains(CONFIG,zint){ } + +#### Install mkspecs, headers and libs to QT_INSTALL_DIR + +headerFiles.path = $$[QT_INSTALL_HEADERS]/LimeReport/ +headerFiles.files = $${DEST_INCLUDE_DIR}/* +INSTALLS += headerFiles + +mkspecs.path = $$[QT_INSTALL_DATA]/mkspecs/features +mkspecs.files = limereport.prf +INSTALLS += mkspecs + +target.path = $$[QT_INSTALL_LIBS] +INSTALLS += target + ####### ####Automatically build required translation files (*.qm) From 715c241a37eb60a33aead8ddd10f1416b2be70e6 Mon Sep 17 00:00:00 2001 From: frostasm Date: Sat, 4 Aug 2018 19:22:43 +0300 Subject: [PATCH 26/58] Add no_build_translations config parameter --- common.pri | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common.pri b/common.pri index 1a6792e..cc2fc8e 100644 --- a/common.pri +++ b/common.pri @@ -1,4 +1,7 @@ -CONFIG += build_translations + +!contains(CONFIG, no_build_translations){ + CONFIG += build_translations +} !contains(CONFIG, no_zint){ CONFIG += zint From 7ae5347e64085aba3fd08d4307584e254822c7c7 Mon Sep 17 00:00:00 2001 From: frostasm Date: Sun, 5 Aug 2018 17:15:11 +0300 Subject: [PATCH 27/58] fix build with Travis CI --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dadebf9..39dedbc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ install: script: - - qmake -r + - qmake -r limereport.pro - make - make check From bb339a3a9061ca388963a26cb63fb60d002260da Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 7 Aug 2018 23:30:40 +0300 Subject: [PATCH 28/58] Band relocation has been changed --- common.pri | 2 +- limereport/lrbanddesignintf.cpp | 18 ++++++++++++++---- limereport/lrbanddesignintf.h | 6 ++++-- limereport/lrpageitemdesignintf.cpp | 12 ++++++++++-- limereport/lrpreviewreportwindow.cpp | 10 +++++++++- limereport/lrpreviewreportwindow.h | 1 + limereport/lrreportengine.cpp | 2 +- limereport/lrreportrender.cpp | 2 ++ 8 files changed, 42 insertions(+), 11 deletions(-) diff --git a/common.pri b/common.pri index cc2fc8e..8a9b289 100644 --- a/common.pri +++ b/common.pri @@ -70,7 +70,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 96 +LIMEREPORT_VERSION_RELEASE = 97 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index 00416b8..e767f26 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -128,7 +128,7 @@ BandDesignIntf::BandDesignIntf(BandsType bandType, const QString &xmlTypeName, Q m_startFromNewPage(false), m_printAlways(false), m_repeatOnEachRow(false), - m_bottomSpace() + m_bottomSpace(0) { setPossibleResizeDirectionFlags(ResizeBottom); setPossibleMoveFlags(TopBotom); @@ -549,7 +549,6 @@ BaseDesignIntf* BandDesignIntf::cloneUpperPart(int height, QObject *owner, QGrap { int maxBottom = 0; BandDesignIntf* upperPart = dynamic_cast(createSameTypeItem(owner,parent)); - upperPart->m_bottomSpace = this->bottomSpace(); BaseDesignIntf* upperItem = 0; upperPart->initFromItem(this); @@ -596,7 +595,6 @@ bool itemLessThen(QGraphicsItem* i1, QGraphicsItem* i2){ BaseDesignIntf *BandDesignIntf::cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent) { BandDesignIntf* bottomPart = dynamic_cast(createSameTypeItem(owner,parent)); - bottomPart->m_bottomSpace = this->bottomSpace(); bottomPart->initFromItem(this); QList bandItems; @@ -794,7 +792,7 @@ void BandDesignIntf::setAlternateBackgroundColor(const QColor &alternateBackgrou qreal BandDesignIntf::bottomSpace() const { - return m_bottomSpace.isValid() ? m_bottomSpace.value() : height()-findMaxBottom(); + return height()-findMaxBottom(); } void BandDesignIntf::slotPropertyObjectNameChanged(const QString &, const QString& newName) @@ -804,6 +802,16 @@ void BandDesignIntf::slotPropertyObjectNameChanged(const QString &, const QStrin m_bandNameLabel->updateLabel(newName); } +int BandDesignIntf::bootomSpace() const +{ + return m_bottomSpace; +} + +void BandDesignIntf::setBootomSpace(int bootomSpace) +{ + m_bottomSpace = bootomSpace; +} + bool BandDesignIntf::repeatOnEachRow() const { return m_repeatOnEachRow; @@ -974,6 +982,8 @@ void BandDesignIntf::updateItemSize(DataSourceManager* dataManager, RenderPass p if (borderLines()!=0){ spaceBorder += borderLineSize(); } + + spaceBorder += m_bottomSpace; restoreLinks(); snapshotItemsLayout(); arrangeSubItems(pass, dataManager); diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index 50dd643..b8f47c5 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -240,8 +240,10 @@ public: qreal bottomSpace() const; void setBackgroundModeProperty(BGMode value); void setBackgroundOpacity(int value); + int bootomSpace() const; + void setBootomSpace(int bootomSpace); signals: - void bandRendered(BandDesignIntf* band); + void bandRendered(BandDesignIntf* band); protected: void trimToMaxHeight(int maxHeight); void setBandTypeText(const QString& value); @@ -295,7 +297,7 @@ private: bool m_repeatOnEachRow; QMap m_slicedItems; QColor m_alternateBackgroundColor; - InitializedValue m_bottomSpace; + int m_bottomSpace; }; class DataBandDesignIntf : public BandDesignIntf{ diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index 961127a..9a7d350 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -396,8 +396,16 @@ void PageItemDesignIntf::relocateBands() m_bands[i+1]->columnsCount()); } if (m_bands[i+1]->columnIndex()==0){ - m_bands[i+1]->setPos(pageRect().x(),posByColumn[0]); - posByColumn[0] += m_bands[i+1]->height()+bandSpace; + if ( ((m_bands[i]->borderLines() & BandDesignIntf::BottomLine) && + (m_bands[i+1]->borderLines() & BandDesignIntf::TopLine)) || + (!(m_bands[i]->borderLines() & BandDesignIntf::BottomLine) && + !(m_bands[i+1]->borderLines() & BandDesignIntf::TopLine)) ){ + m_bands[i+1]->setPos(pageRect().x(),posByColumn[0]); + posByColumn[0] += m_bands[i+1]->height()+bandSpace; + } else { + m_bands[i+1]->setPos(pageRect().x(),posByColumn[0]+2); + posByColumn[0] += m_bands[i+1]->height()+bandSpace+2; + } } else { m_bands[i+1]->setPos(m_bands[i+1]->pos().x(),posByColumn[m_bands[i+1]->columnIndex()]); posByColumn[m_bands[i+1]->columnIndex()] += m_bands[i+1]->height()+bandSpace; diff --git a/limereport/lrpreviewreportwindow.cpp b/limereport/lrpreviewreportwindow.cpp index 19520af..d58678e 100644 --- a/limereport/lrpreviewreportwindow.cpp +++ b/limereport/lrpreviewreportwindow.cpp @@ -45,7 +45,7 @@ namespace LimeReport{ PreviewReportWindow::PreviewReportWindow(ReportEnginePrivate *report,QWidget *parent, QSettings *settings, Qt::WindowFlags flags) : QMainWindow(parent,flags), - ui(new Ui::PreviewReportWindow), m_settings(settings), m_ownedSettings(false) + ui(new Ui::PreviewReportWindow), m_settings(settings), m_ownedSettings(false), m_scalePercentChanging(false) { ui->setupUi(this); setWindowTitle("Lime Report Preview"); @@ -402,12 +402,20 @@ void PreviewReportWindow::on_actionOne_to_one_triggered() void PreviewReportWindow::scaleComboboxChanged(QString text) { + if (m_scalePercentChanging) return; + m_scalePercentChanging = true; m_previewReportWidget->setScalePercent(text.remove(text.count()-1,1).toInt()); + m_scalePercentChanging = false; } void PreviewReportWindow::slotScalePercentChanged(int percent) { + if (m_scalePercentChanging) return; + m_scalePercentChanging = true; + if (m_scalePercent->findText(QString("%1%").arg(percent)) == -1) + m_scalePercent->setCurrentIndex(-1); m_scalePercent->setEditText(QString("%1%").arg(percent)); + m_scalePercentChanging = false; } void PreviewReportWindow::on_actionShowMessages_toggled(bool value) diff --git a/limereport/lrpreviewreportwindow.h b/limereport/lrpreviewreportwindow.h index 63761c3..bc6da16 100644 --- a/limereport/lrpreviewreportwindow.h +++ b/limereport/lrpreviewreportwindow.h @@ -120,6 +120,7 @@ private: QComboBox* m_scalePercent; ScaleType m_previewScaleType; int m_previewScalePercent; + bool m_scalePercentChanging; }; } //namespace LimeReport diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 3191b86..adcfa73 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -63,7 +63,7 @@ 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_resultIsEditable(true), m_passPhrase("HjccbzHjlbyfCkjy"), - m_fileWatcher( new QFileSystemWatcher( this ) ), + m_fileWatcher( new QFileSystemWatcher( this ) ), m_previewLayoutDirection(Qt::LayoutDirectionAuto), m_previewScaleType(FitWidth), m_previewScalePercent(0) { #ifdef HAVE_STATIC_BUILD diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 7084498..f8e20e8 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -428,6 +428,8 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign bandClone=renderData(patternBand); } + if (isLast) bandClone->setBootomSpace(1); + if (mode == ForcedStartPage){ savePage(); startNewPage(); From d9a28e91104111937e4d91fe48690775edb019e8 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 9 Aug 2018 22:08:36 +0300 Subject: [PATCH 29/58] page footer placement changed --- common.pri | 2 +- limereport/bands/lrpagefooter.cpp | 1 + limereport/lrreportrender.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common.pri b/common.pri index 8a9b289..779adad 100644 --- a/common.pri +++ b/common.pri @@ -70,7 +70,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 97 +LIMEREPORT_VERSION_RELEASE = 98 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/bands/lrpagefooter.cpp b/limereport/bands/lrpagefooter.cpp index c5be0fb..2b1c3b1 100644 --- a/limereport/bands/lrpagefooter.cpp +++ b/limereport/bands/lrpagefooter.cpp @@ -53,6 +53,7 @@ PageFooter::PageFooter(QObject *owner, QGraphicsItem *parent) { setBandTypeText( tr("Page Footer") ); setMarkerColor(bandColor()); + setAutoHeight(false); } BaseDesignIntf *PageFooter::createSameTypeItem(QObject *owner, QGraphicsItem *parent) diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index f8e20e8..84ce884 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -1137,7 +1137,7 @@ void ReportRender::startNewPage() renderPageHeader(m_patternPageItem); - m_pageFooterHeight = calcPageFooterHeight(m_patternPageItem); + m_pageFooterHeight = calcPageFooterHeight(m_patternPageItem)+2; m_maxHeightByColumn[m_currentColumn] -= m_pageFooterHeight; m_currentIndex=10; m_dataAreaSize = m_maxHeightByColumn[m_currentColumn]; From 66b1d80f38c2ee82c5ebacf9b8d5bf48ebbf1e08 Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Fri, 10 Aug 2018 02:26:06 +0300 Subject: [PATCH 30/58] CONFIG param "config_build_dir" has been added --- common.pri | 15 ++++++++++----- demo_r1/demo_r1.pro | 5 +++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/common.pri b/common.pri index 779adad..86adc01 100644 --- a/common.pri +++ b/common.pri @@ -1,3 +1,6 @@ +!contains(CONFIG, config_build_dir){ + TOP_BUILD_DIR = $${PWD} +} !contains(CONFIG, no_build_translations){ CONFIG += build_translations @@ -27,11 +30,13 @@ CONFIG(release, debug|release){ BUILD_TYPE = debug } -isEmpty(TOP_BUILD_DIR) { -BUILD_DIR = $${OUT_PWD}/build/$${QT_VERSION} -}else{ +#isEmpty(TOP_BUILD_DIR) { +# BUILD_DIR = $${OUT_PWD}/build/$${QT_VERSION} +#}else{ +# BUILD_DIR = $${TOP_BUILD_DIR}/build/$${QT_VERSION} +#} + BUILD_DIR = $${TOP_BUILD_DIR}/build/$${QT_VERSION} -} DEST_INCLUDE_DIR = $$PWD/include unix{ @@ -70,7 +75,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 98 +LIMEREPORT_VERSION_RELEASE = 99 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/demo_r1/demo_r1.pro b/demo_r1/demo_r1.pro index 71c0821..128cc34 100644 --- a/demo_r1/demo_r1.pro +++ b/demo_r1/demo_r1.pro @@ -46,7 +46,7 @@ unix:{ } DESTDIR = $$DEST_DIR # QMAKE_POST_LINK += mkdir -p $$quote($$REPORTS_DIR) | - QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR) $$quote($$REPORTS_DIR) $$escape_expand(\n\t) + QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR) $$quote($$REPORTS_DIR) $$escape_expand(\n\t) linux{ #Link share lib to ../lib rpath @@ -67,7 +67,8 @@ 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 \"$$EXTRA_DIR\" \"$$REPORTS_DIR\\demo_reports\" $$escape_expand(\\n\\t) + #QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR\\*) $$quote($$REPORTS_DIR\\demo_reports) $$escape_expand(\\n\\t) !contains(CONFIG, static_build){ contains(CONFIG,zint){ From 3a302733772bcb1e7f6ce830db19754efbb3ca45 Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Tue, 21 Aug 2018 19:37:20 +0300 Subject: [PATCH 31/58] Copy & Cut abilities have been removed from band --- common.pri | 2 +- limereport/lrbanddesignintf.cpp | 11 ++++++++--- limereport/lrpagedesignintf.cpp | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/common.pri b/common.pri index 86adc01..ef17042 100644 --- a/common.pri +++ b/common.pri @@ -75,7 +75,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 99 +LIMEREPORT_VERSION_RELEASE = 100 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index e767f26..1508b8e 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -502,10 +502,15 @@ void BandDesignIntf::moveItemsDown(qreal startPos, qreal offset){ void BandDesignIntf::preparePopUpMenu(QMenu &menu) { + + QList disabledActions; + disabledActions << tr("Bring to top") << + tr("Send to back") << + tr("Cut") << + tr("Copy"); + 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); + action->setEnabled(!disabledActions.contains(action->text())); } menu.addSeparator(); diff --git a/limereport/lrpagedesignintf.cpp b/limereport/lrpagedesignintf.cpp index 8fc4cc7..9f7705b 100644 --- a/limereport/lrpagedesignintf.cpp +++ b/limereport/lrpagedesignintf.cpp @@ -1859,7 +1859,7 @@ CommandIf::Ptr CutCommand::create(PageDesignIntf *page) ItemsWriterIntf *writer = new XMLWriter(); foreach(QGraphicsItem * item, page->selectedItems()) { if (!dynamic_cast(item)){ - BaseDesignIntf *reportItem = dynamic_cast(item); + ItemDesignIntf *reportItem = dynamic_cast(item); if (reportItem) { command->m_itemNames.push_back(reportItem->objectName()); From e1982545e302496eb311964c56eebd6c06466c0c Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Wed, 22 Aug 2018 21:06:52 +0300 Subject: [PATCH 32/58] New icons added --- limereport/items/images/DataFooterBand.png | Bin 0 -> 176 bytes limereport/items/images/DataHeaderBand.png | Bin 0 -> 176 bytes limereport/items/items.qrc | 2 ++ 3 files changed, 2 insertions(+) create mode 100644 limereport/items/images/DataFooterBand.png create mode 100644 limereport/items/images/DataHeaderBand.png diff --git a/limereport/items/images/DataFooterBand.png b/limereport/items/images/DataFooterBand.png new file mode 100644 index 0000000000000000000000000000000000000000..d68293c04f2993be313f01caf1e7f40151b50fcd GIT binary patch literal 176 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9JOMr-uK)l42Qooq1B3CZ58Htp z#*!evUYh7ML)4Yh7ML)4u!C59VjI0>Eal|aXmSKf$`Xd0Cu)x|NjSegs%2baA0d-VA!!#?BbbJX-%L)22WQ% Jmvv4FO#losFNgpD literal 0 HcmV?d00001 diff --git a/limereport/items/items.qrc b/limereport/items/items.qrc index 8b0a351..99c7d25 100644 --- a/limereport/items/items.qrc +++ b/limereport/items/items.qrc @@ -41,5 +41,7 @@ images/imageItem4.png images/shapes7.png images/barcode5.png + images/DataHeaderBand.png + images/DataFooterBand.png From 1be5920a64f564ce5d82dcdb890cac01a4277aef Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Mon, 27 Aug 2018 17:44:33 +0300 Subject: [PATCH 33/58] Showing the report name in the title fixed --- common.pri | 2 +- limereport/lrreportdesignwindow.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/common.pri b/common.pri index ef17042..b048dde 100644 --- a/common.pri +++ b/common.pri @@ -75,7 +75,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 100 +LIMEREPORT_VERSION_RELEASE = 102 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index cffe165..2020c0b 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -78,7 +78,10 @@ ReportDesignWindow::ReportDesignWindow(ReportEnginePrivate *report, QWidget *par m_lblReportName = new QLabel(report->reportFileName(),this); m_statusBar->insertWidget(0,m_lblReportName); setStatusBar(m_statusBar); - setWindowTitle("Lime Report Designer"); + QString windowTitle = "Lime Report Designer"; + if (!report->reportName().isEmpty()) + windowTitle = report->reportName() + " - " + windowTitle; + setWindowTitle(windowTitle); restoreSetting(); m_hideLeftPanel->setChecked(isDockAreaVisible(Qt::LeftDockWidgetArea)); m_hideRightPanel->setChecked(isDockAreaVisible(Qt::RightDockWidgetArea)); @@ -742,6 +745,7 @@ void ReportDesignWindow::slotNewReport() m_lblReportName->setText(""); startNewReport(); m_deletePageAction->setEnabled(false); + setWindowTitle("Lime Report Designer"); } } @@ -931,7 +935,6 @@ void ReportDesignWindow::slotLoadReport() m_lblReportName->setText(fileName); m_propertyModel->setObject(0); updateRedoUndo(); - setWindowTitle(m_reportDesignWidget->report()->reportName() + " - Lime Report Designer"); if (!m_recentFiles.contains(fileName)){ if (m_recentFiles.count()==10){ QMap::const_iterator it = m_recentFiles.constBegin(); From 0d24f01826949d07351c6447161a02b45ea27401 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sun, 9 Sep 2018 21:54:33 +0300 Subject: [PATCH 34/58] Tearoff band has been fixed --- common.pri | 2 +- limereport/bands/lrtearoffband.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common.pri b/common.pri index b048dde..e79765e 100644 --- a/common.pri +++ b/common.pri @@ -75,7 +75,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 102 +LIMEREPORT_VERSION_RELEASE = 103 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/bands/lrtearoffband.h b/limereport/bands/lrtearoffband.h index 1366aa6..5c8c17c 100644 --- a/limereport/bands/lrtearoffband.h +++ b/limereport/bands/lrtearoffband.h @@ -12,7 +12,8 @@ public: virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0); protected: QColor bandColor() const; - virtual bool isUnique() const {return true;} + bool isUnique() const {return true;} + bool isFooter() const{ return true;} }; } // namespace LimeReport From baa078494dedebfa99906d5dcfbd88151bbe88d3 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 22 Sep 2018 12:34:48 +0300 Subject: [PATCH 35/58] .qmake.cache has been removed --- .qmake.cache.in | 2 -- .qmake.conf | 2 -- common.pri | 14 +++++++------- initvars.pro | 3 --- limereport.pro | 8 -------- 5 files changed, 7 insertions(+), 22 deletions(-) delete mode 100644 .qmake.cache.in delete mode 100644 .qmake.conf delete mode 100644 initvars.pro diff --git a/.qmake.cache.in b/.qmake.cache.in deleted file mode 100644 index 008a232..0000000 --- a/.qmake.cache.in +++ /dev/null @@ -1,2 +0,0 @@ -TOP_SRC_DIR=$$PWD -TOP_BUILD_DIR=$$OUT_PWD diff --git a/.qmake.conf b/.qmake.conf deleted file mode 100644 index 5b5aab0..0000000 --- a/.qmake.conf +++ /dev/null @@ -1,2 +0,0 @@ -TOP_SRC_DIR=$$PWD -TOP_BUILD_DIR=$$shadowed($$PWD) \ No newline at end of file diff --git a/common.pri b/common.pri index e79765e..714f6bf 100644 --- a/common.pri +++ b/common.pri @@ -1,7 +1,13 @@ -!contains(CONFIG, config_build_dir){ +isEmpty(TOP_BUILD_DIR) { TOP_BUILD_DIR = $${PWD} } +message(TOP_BUILD_DIR: $$TOP_BUILD_DIR) + +#!contains(CONFIG, config_build_dir){ +# TOP_BUILD_DIR = $${PWD} +#} + !contains(CONFIG, no_build_translations){ CONFIG += build_translations } @@ -30,12 +36,6 @@ CONFIG(release, debug|release){ BUILD_TYPE = debug } -#isEmpty(TOP_BUILD_DIR) { -# BUILD_DIR = $${OUT_PWD}/build/$${QT_VERSION} -#}else{ -# BUILD_DIR = $${TOP_BUILD_DIR}/build/$${QT_VERSION} -#} - BUILD_DIR = $${TOP_BUILD_DIR}/build/$${QT_VERSION} DEST_INCLUDE_DIR = $$PWD/include diff --git a/initvars.pro b/initvars.pro deleted file mode 100644 index b3dc9a9..0000000 --- a/initvars.pro +++ /dev/null @@ -1,3 +0,0 @@ -TEMPLATE=subdirs -SUBDIRS= # don't build anything, we're just generating the .qmake.cache file -QMAKE_SUBSTITUTES += .qmake.cache.in diff --git a/limereport.pro b/limereport.pro index 2fc1bb0..f954fae 100644 --- a/limereport.pro +++ b/limereport.pro @@ -13,16 +13,8 @@ export($$CONFIG) CONFIG += ordered SUBDIRS += \ - initvars.pro \ limereport \ demo_r1 \ demo_r2 \ designer -# QMake top level srcdir and builddir -# https://wiki.qt.io/QMake-top-level-srcdir-and-builddir -#Qt4 .qmake.cache.in -#Qt5 .qmake.conf -OTHER_FILES += \ - .qmake.conf \ - .qmake.cache.in From 9bf90cf7462d020e70a8967677e55218142a7950 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 30 Oct 2018 00:16:07 +0300 Subject: [PATCH 36/58] Cross compilations fixed --- common.pri | 2 +- demo_r1/demo_r1.pro | 68 ++++++++++++++++----------------------- demo_r2/demo_r2.pro | 64 +++++++++++++++--------------------- limereport/limereport.pro | 24 +++++++++----- 4 files changed, 70 insertions(+), 88 deletions(-) diff --git a/common.pri b/common.pri index 714f6bf..91b3a9c 100644 --- a/common.pri +++ b/common.pri @@ -75,7 +75,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 103 +LIMEREPORT_VERSION_RELEASE = 105 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/demo_r1/demo_r1.pro b/demo_r1/demo_r1.pro index 128cc34..8c09816 100644 --- a/demo_r1/demo_r1.pro +++ b/demo_r1/demo_r1.pro @@ -26,24 +26,7 @@ macx{ } unix:{ - LIBS += -L$${DEST_LIBS} - CONFIG(debug, debug|release) { - LIBS += -llimereportd - } else { - LIBS += -llimereport - } - !contains(CONFIG, static_build){ - contains(CONFIG,zint){ - LIBS += -L$${DEST_LIBS} - - CONFIG(debug, debug|release) { - LIBS += -lQtZintd - } else { - LIBS += -lQtZint - } - } - } DESTDIR = $$DEST_DIR # QMAKE_POST_LINK += mkdir -p $$quote($$REPORTS_DIR) | QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR) $$quote($$REPORTS_DIR) $$escape_expand(\n\t) @@ -60,33 +43,36 @@ unix:{ } win32 { - EXTRA_DIR ~= s,/,\\,g - DEST_DIR ~= s,/,\\,g - REPORTS_DIR ~= s,/,\\,g - DESTDIR = $$DEST_DIR - RC_FILE += mainicon.rc + contains(QMAKE_HOST.os, Linux){ + QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR) $$quote($$REPORTS_DIR) $$escape_expand(\n\t) + } else { + EXTRA_DIR ~= s,/,\\,g + DEST_DIR ~= s,/,\\,g + REPORTS_DIR ~= s,/,\\,g - QMAKE_POST_LINK += $$QMAKE_COPY_DIR \"$$EXTRA_DIR\" \"$$REPORTS_DIR\\demo_reports\" $$escape_expand(\\n\\t) - #QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR\\*) $$quote($$REPORTS_DIR\\demo_reports) $$escape_expand(\\n\\t) - !contains(CONFIG, static_build){ - - contains(CONFIG,zint){ - LIBS += -L$${DEST_LIBS} - CONFIG(debug, debug|release) { - LIBS += -lQtZintd - } else { - LIBS += -lQtZint - } - } + RC_FILE += mainicon.rc + + QMAKE_POST_LINK += $$QMAKE_COPY_DIR \"$$EXTRA_DIR\" \"$$REPORTS_DIR\\demo_reports\" $$escape_expand(\\n\\t) + #QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR\\*) $$quote($$REPORTS_DIR\\demo_reports) $$escape_expand(\\n\\t) } - - LIBS += -L$${DEST_LIBS} - CONFIG(debug, debug|release) { - LIBS += -llimereportd - } else { - LIBS += -llimereport - } +} + +LIBS += -L$${DEST_LIBS} +CONFIG(debug, debug|release) { + LIBS += -llimereportd +} else { + LIBS += -llimereport } +!contains(CONFIG, static_build){ + contains(CONFIG,zint){ + LIBS += -L$${DEST_LIBS} + CONFIG(debug, debug|release) { + LIBS += -lQtZintd + } else { + LIBS += -lQtZint + } + } +} diff --git a/demo_r2/demo_r2.pro b/demo_r2/demo_r2.pro index 8ff5356..707649b 100644 --- a/demo_r2/demo_r2.pro +++ b/demo_r2/demo_r2.pro @@ -26,22 +26,6 @@ macx{ } unix:{ - LIBS += -L$${DEST_LIBS} - CONFIG(debug, debug|release) { - LIBS += -llimereportd - } else { - LIBS += -llimereport - } - !contains(CONFIG, static_build){ - contains(CONFIG,zint){ - LIBS += -L$${DEST_LIBS} - CONFIG(debug, debug|release) { - LIBS += -lQtZintd - } else { - LIBS += -lQtZint - } - } - } DESTDIR = $$DEST_DIR QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR) $$quote($$REPORTS_DIR) $$escape_expand(\n\t) linux{ @@ -56,30 +40,34 @@ unix:{ } win32 { - EXTRA_DIR ~= s,/,\\,g - DEST_DIR ~= s,/,\\,g - REPORTS_DIR ~= s,/,\\,g - DESTDIR = $$DEST_DIR - RC_FILE += mainicon.rc - !contains(CONFIG, static_build){ - contains(CONFIG,zint){ - LIBS += -L$${DEST_LIBS} - CONFIG(debug, debug|release) { - LIBS += -lQtZintd - } else { - LIBS += -lQtZint - } - } - } - LIBS += -L$${DEST_LIBS} - - CONFIG(debug, debug|release) { - LIBS += -llimereportd + contains(QMAKE_HOST.os, Linux){ + QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR) $$quote($$REPORTS_DIR) $$escape_expand(\n\t) } else { - LIBS += -llimereport + EXTRA_DIR ~= s,/,\\,g + DEST_DIR ~= s,/,\\,g + REPORTS_DIR ~= s,/,\\,g + + RC_FILE += mainicon.rc + + QMAKE_POST_LINK += $$QMAKE_COPY_DIR \"$$EXTRA_DIR\" \"$$REPORTS_DIR\\demo_reports\" $$escape_expand(\\n\\t) } - - QMAKE_POST_LINK += $$QMAKE_COPY_DIR \"$$EXTRA_DIR\" \"$$REPORTS_DIR\\demo_reports\" $$escape_expand(\\n\\t) } +LIBS += -L$${DEST_LIBS} +CONFIG(debug, debug|release) { + LIBS += -llimereportd +} else { + LIBS += -llimereport +} + +!contains(CONFIG, static_build){ + contains(CONFIG,zint){ + LIBS += -L$${DEST_LIBS} + CONFIG(debug, debug|release) { + LIBS += -lQtZintd + } else { + LIBS += -lQtZint + } + } +} diff --git a/limereport/limereport.pro b/limereport/limereport.pro index dff9004..3aa045c 100644 --- a/limereport/limereport.pro +++ b/limereport/limereport.pro @@ -64,17 +64,25 @@ unix:{ } win32 { - EXTRA_FILES ~= s,/,\\,g - BUILD_DIR ~= s,/,\\,g DESTDIR = $${DEST_LIBS} - DEST_DIR = $$DESTDIR/include - DEST_DIR ~= s,/,\\,g - DEST_INCLUDE_DIR ~= s,/,\\,g + contains(QMAKE_HOST.os, Linux){ + QMAKE_POST_LINK += mkdir -p $$quote($${DEST_INCLUDE_DIR}) $$escape_expand(\\n\\t) # qmake need make mkdir -p on subdirs more than root/ + for(FILE,EXTRA_FILES){ + QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($${DEST_INCLUDE_DIR}) $$escape_expand(\\n\\t) # inside of libs make /include/files + } + QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($${DEST_INCLUDE_DIR}) $$quote($${DESTDIR}) + } else { + EXTRA_FILES ~= s,/,\\,g + BUILD_DIR ~= s,/,\\,g + DEST_DIR = $$DESTDIR/include + DEST_DIR ~= s,/,\\,g + DEST_INCLUDE_DIR ~= s,/,\\,g - for(FILE,EXTRA_FILES){ - QMAKE_POST_LINK += $$QMAKE_COPY \"$$FILE\" \"$${DEST_INCLUDE_DIR}\" $$escape_expand(\\n\\t) + for(FILE,EXTRA_FILES){ + QMAKE_POST_LINK += $$QMAKE_COPY \"$$FILE\" \"$${DEST_INCLUDE_DIR}\" $$escape_expand(\\n\\t) + } + QMAKE_POST_LINK += $$QMAKE_COPY_DIR \"$${DEST_INCLUDE_DIR}\" \"$${DEST_DIR}\" } - QMAKE_POST_LINK += $$QMAKE_COPY_DIR \"$${DEST_INCLUDE_DIR}\" \"$${DEST_DIR}\" } contains(CONFIG,zint){ From 83f5dff811b9ad082d8c1ec7ccb63c23df96c507 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 10 Nov 2018 23:48:03 +0300 Subject: [PATCH 37/58] Build fixed; TOT_BUILD_DIR -> BINARY_RESULT_DIR --- common.pri | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common.pri b/common.pri index 91b3a9c..44a178c 100644 --- a/common.pri +++ b/common.pri @@ -1,5 +1,7 @@ -isEmpty(TOP_BUILD_DIR) { - TOP_BUILD_DIR = $${PWD} +#BINARY_RESULT_DIR = $${TOP_BUILD_DIR} + +isEmpty(BINARY_RESULT_DIR) { + BINARY_RESULT_DIR = $${PWD} } message(TOP_BUILD_DIR: $$TOP_BUILD_DIR) @@ -36,7 +38,7 @@ CONFIG(release, debug|release){ BUILD_TYPE = debug } -BUILD_DIR = $${TOP_BUILD_DIR}/build/$${QT_VERSION} +BUILD_DIR = $${BINARY_RESULT_DIR}/build/$${QT_VERSION} DEST_INCLUDE_DIR = $$PWD/include unix{ From 43d5ead87510d3d2baf5487fc706b6256978b15a Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 20 Nov 2018 01:46:55 +0300 Subject: [PATCH 38/58] ru translation has been fixed --- translations/limereport_ru.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translations/limereport_ru.ts b/translations/limereport_ru.ts index 1e09923..ef748e7 100644 --- a/translations/limereport_ru.ts +++ b/translations/limereport_ru.ts @@ -1890,7 +1890,7 @@ p, li { white-space: pre-wrap; } Preview - Предосмотр + Предпросмотр Report File Change @@ -2012,7 +2012,7 @@ This preview is no longer valid. Preview - Предосмотр + Предпросмотр ... From 1d275e629d5b69cfd1f2b6c68e0ffd8d91b2f6cb Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 20 Nov 2018 01:48:13 +0300 Subject: [PATCH 39/58] Version changed --- common.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.pri b/common.pri index 44a178c..57050a2 100644 --- a/common.pri +++ b/common.pri @@ -77,7 +77,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 105 +LIMEREPORT_VERSION_RELEASE = 107 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" From a6d922aac4820a093b6db9c6539661a009b7e2fa Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 26 Nov 2018 21:41:30 +0300 Subject: [PATCH 40/58] Group functions have been fixed --- common.pri | 2 +- include/lrglobal.h | 2 +- limereport/lrglobal.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common.pri b/common.pri index 57050a2..6202072 100644 --- a/common.pri +++ b/common.pri @@ -77,7 +77,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 107 +LIMEREPORT_VERSION_RELEASE = 108 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/include/lrglobal.h b/include/lrglobal.h index 563e807..348056b 100644 --- a/include/lrglobal.h +++ b/include/lrglobal.h @@ -86,7 +86,7 @@ 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*((?:(?:\\\")|(?:))(?:(?:\\$(?:(?:D\\{\\s*\\w*.\\w*\\s*\\})|(?:V\\{\\s*\\w*\\s*\\})|(?:S\\{.+\\})))|(?:\\w*))(?:(?:\\\")|(?:)))(?:(?:\\s*,\\s*(?:\\\"(\\w*)\\\"))|(?:))\\)"; + const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*((?:(?:\\\")|(?:))(?:(?:\\$(?:(?:D\\{\\s*\\w*.\\w*\\s*\\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/lrglobal.h b/limereport/lrglobal.h index 563e807..348056b 100644 --- a/limereport/lrglobal.h +++ b/limereport/lrglobal.h @@ -86,7 +86,7 @@ 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*((?:(?:\\\")|(?:))(?:(?:\\$(?:(?:D\\{\\s*\\w*.\\w*\\s*\\})|(?:V\\{\\s*\\w*\\s*\\})|(?:S\\{.+\\})))|(?:\\w*))(?:(?:\\\")|(?:)))(?:(?:\\s*,\\s*(?:\\\"(\\w*)\\\"))|(?:))\\)"; + const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*((?:(?:\\\")|(?:))(?:(?:\\$(?:(?:D\\{\\s*\\w*.\\w*\\s*\\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 54dde3727b48045c8a26a97f832e30b684791900 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 29 Nov 2018 22:43:40 +0300 Subject: [PATCH 41/58] Group functions have been fixed --- common.pri | 2 +- include/lrglobal.h | 2 +- limereport/lrglobal.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common.pri b/common.pri index 6202072..1490959 100644 --- a/common.pri +++ b/common.pri @@ -77,7 +77,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 108 +LIMEREPORT_VERSION_RELEASE = 109 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/include/lrglobal.h b/include/lrglobal.h index 348056b..0ed00fe 100644 --- a/include/lrglobal.h +++ b/include/lrglobal.h @@ -86,7 +86,7 @@ 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*((?:(?:\\\")|(?:))(?:(?:\\$(?:(?:D\\{\\s*\\w*.\\w*\\s*\\w*\\s*\\})|(?:V\\{\\s*\\w*\\s*\\})|(?:S\\{.+\\})))|(?:\\w*))(?:(?:\\\")|(?:)))(?:(?:\\s*,\\s*(?:\\\"(\\w*)\\\"))|(?:))\\)"; + const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*((?:(?:\\\")|(?:))(?:(?:\\$(?:(?:D\\{\\s*\\w*.(?:(?:.\\w+\\s*)+)\\})|(?:V\\{\\s*\\w*\\s*\\})|(?: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/lrglobal.h b/limereport/lrglobal.h index 348056b..0ed00fe 100644 --- a/limereport/lrglobal.h +++ b/limereport/lrglobal.h @@ -86,7 +86,7 @@ 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*((?:(?:\\\")|(?:))(?:(?:\\$(?:(?:D\\{\\s*\\w*.\\w*\\s*\\w*\\s*\\})|(?:V\\{\\s*\\w*\\s*\\})|(?:S\\{.+\\})))|(?:\\w*))(?:(?:\\\")|(?:)))(?:(?:\\s*,\\s*(?:\\\"(\\w*)\\\"))|(?:))\\)"; + const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*((?:(?:\\\")|(?:))(?:(?:\\$(?:(?:D\\{\\s*\\w*.(?:(?:.\\w+\\s*)+)\\})|(?:V\\{\\s*\\w*\\s*\\})|(?: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 2d728cf2bb726eeba763c5147103cdee78a727e5 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 30 Nov 2018 23:50:27 +0300 Subject: [PATCH 42/58] Group functions fixed --- common.pri | 2 +- include/lrglobal.h | 10 +--------- limereport/lrglobal.h | 10 +--------- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/common.pri b/common.pri index 1490959..2b6ce4c 100644 --- a/common.pri +++ b/common.pri @@ -77,7 +77,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 109 +LIMEREPORT_VERSION_RELEASE = 110 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/include/lrglobal.h b/include/lrglobal.h index 0ed00fe..ea8b279 100644 --- a/include/lrglobal.h +++ b/include/lrglobal.h @@ -78,15 +78,7 @@ namespace Const{ const QString VARIABLE_RX = "\\$V\\s*\\{\\s*([^{}]*)\\s*\\}"; const QString NAMED_VARIABLE_RX = "\\$V\\s*\\{\\s*(%1)\\s*\\}"; const QString SCRIPT_RX = "\\$S\\s*\\{(.*)\\}"; - - //const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(((?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))(\\w+\\.?\\w+)((?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,\\s*\\\"(\\w+)\\\"\\s*\\)"; - //const int DATASOURCE_INDEX = 6; - //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 = "\\(\\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*)\\\"))|(?:))(?:(?:\\s*,\\s*(?:(\\w*)))|(?:))\\)"; + const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*((?:(?:\\\")|(?:))(?:(?:\\$(?:(?:D\\{\\s*\\w*..*\\})|(?:V\\{\\s*\\w*\\s*\\})|(?: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/lrglobal.h b/limereport/lrglobal.h index 0ed00fe..ea8b279 100644 --- a/limereport/lrglobal.h +++ b/limereport/lrglobal.h @@ -78,15 +78,7 @@ namespace Const{ const QString VARIABLE_RX = "\\$V\\s*\\{\\s*([^{}]*)\\s*\\}"; const QString NAMED_VARIABLE_RX = "\\$V\\s*\\{\\s*(%1)\\s*\\}"; const QString SCRIPT_RX = "\\$S\\s*\\{(.*)\\}"; - - //const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(((?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))(\\w+\\.?\\w+)((?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,\\s*\\\"(\\w+)\\\"\\s*\\)"; - //const int DATASOURCE_INDEX = 6; - //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 = "\\(\\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*)\\\"))|(?:))(?:(?:\\s*,\\s*(?:(\\w*)))|(?:))\\)"; + const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*((?:(?:\\\")|(?:))(?:(?:\\$(?:(?:D\\{\\s*\\w*..*\\})|(?:V\\{\\s*\\w*\\s*\\})|(?: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 37cbc134d134191d5fff7c92da71abe96f997bbb Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 21 Dec 2018 19:04:57 +0300 Subject: [PATCH 43/58] Nested groups footers have been fixed --- limereport/lrreportrender.cpp | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 84ce884..a04a6a4 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -717,22 +717,11 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da if (gb&&gb->isNeedToClose(m_datasources)){ if (band->childBands().count()>0){ bool didGoBack = dataSource->prior(); - foreach (BandDesignIntf* subBand, band->childrenByType(BandDesignIntf::GroupHeader)) { - foreach(BandDesignIntf* footer, subBand->childrenByType(BandDesignIntf::GroupFooter)){ - renderBand(footer, 0, StartNewPageAsNeeded); - } - closeDataGroup(subBand); - } - - foreach (BandDesignIntf* footer, band->childrenByType(BandDesignIntf::GroupFooter)) { - renderBand(footer, 0, StartNewPageAsNeeded); - } - + renderGroupFooterByHeader(band); if (didGoBack){ dataSource->next(); } } - closeDataGroup(band); } if (gb && !gb->isStarted()){ @@ -759,12 +748,14 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da } void ReportRender::renderGroupFooterByHeader(BandDesignIntf* groupHeader){ + if (groupHeader->reprintOnEachPage()) m_reprintableBands.removeOne(groupHeader); foreach (BandDesignIntf* header, groupHeader->childrenByType(BandDesignIntf::GroupHeader)){ renderGroupFooterByHeader(header); } foreach (BandDesignIntf* footer, groupHeader->childrenByType(BandDesignIntf::GroupFooter)){ renderBand(footer, 0, StartNewPageAsNeeded); } + closeDataGroup(groupHeader); } void ReportRender::renderGroupFooter(BandDesignIntf *parentBand) @@ -772,14 +763,7 @@ 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); - foreach(BandDesignIntf* header, band->childrenByType(BandDesignIntf::GroupHeader)){ - renderGroupFooterByHeader(header); - } - foreach(BandDesignIntf* footer, band->childrenByType(BandDesignIntf::GroupFooter)){ - renderBand(footer, 0, StartNewPageAsNeeded); - } - closeDataGroup(band); + renderGroupFooterByHeader(band); } } } From 533eb7efa0b1974c14a173a6dbd024c20f658378 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 21 Dec 2018 19:05:31 +0300 Subject: [PATCH 44/58] Bands relocation has been fixed --- limereport/lrbanddesignintf.cpp | 2 +- limereport/lrpageitemdesignintf.cpp | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index 1508b8e..fbef4f0 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -372,7 +372,7 @@ int BandDesignIntf::maxChildIndex(BandDesignIntf::BandsType bandType) const{ int BandDesignIntf::maxChildIndex(QSet ignoredBands) const{ int curIndex = bandIndex(); foreach(BandDesignIntf* childBand, childBands()){ - if (!ignoredBands.contains(childBand->bandType()) && childBand->bandIndex()>bandIndex()){ + if (!ignoredBands.contains(childBand->bandType())){ curIndex = std::max(curIndex,childBand->maxChildIndex(ignoredBands)); } } diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index 9a7d350..364d42e 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -201,17 +201,22 @@ 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()) { - if (bandType != BandDesignIntf::Data){ + if (bandType != BandDesignIntf::Data){ + 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(bandType)+1; - } else { - bandIndex=band->maxChildIndex()+1; } - } - } else { increaseBandIndex = true; break;} + } else { increaseBandIndex = true; break;} + } + } else { + int maxChildIndex = 0; + foreach(BandDesignIntf* band, m_bands){ + if (band->bandType() == BandDesignIntf::Data) + maxChildIndex = std::max(maxChildIndex, band->maxChildIndex()); + } + bandIndex = std::max(bandIndex, maxChildIndex+1); } if (bandIndex==-1) { From 668acaba2899bf1b60ba3e21e3db819378dddfbc Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 21 Dec 2018 19:06:29 +0300 Subject: [PATCH 45/58] Version changed --- common.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.pri b/common.pri index 2b6ce4c..15d5257 100644 --- a/common.pri +++ b/common.pri @@ -77,7 +77,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 110 +LIMEREPORT_VERSION_RELEASE = 111 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" From 317a00839619687170080f3b545ca4f151030139 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 21 Dec 2018 19:43:16 +0300 Subject: [PATCH 46/58] Groups rendering has been fixed --- common.pri | 2 +- limereport/lrreportrender.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common.pri b/common.pri index 15d5257..9f65129 100644 --- a/common.pri +++ b/common.pri @@ -77,7 +77,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 111 +LIMEREPORT_VERSION_RELEASE = 112 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index a04a6a4..e0bc4e1 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -722,6 +722,7 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da dataSource->next(); } } + closeDataGroup(band); } if (gb && !gb->isStarted()){ From 24de88c6b9cabc6110201caecd137c46512e4350 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 31 Dec 2018 03:02:27 +0300 Subject: [PATCH 47/58] HideText property has been added to BarcodeItem --- common.pri | 2 +- limereport/items/lrbarcodeitem.cpp | 17 +++++++++++++++++ limereport/items/lrbarcodeitem.h | 5 +++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/common.pri b/common.pri index 9f65129..c1fbd66 100644 --- a/common.pri +++ b/common.pri @@ -77,7 +77,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 112 +LIMEREPORT_VERSION_RELEASE = 113 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/items/lrbarcodeitem.cpp b/limereport/items/lrbarcodeitem.cpp index 7af23bf..fac67d7 100644 --- a/limereport/items/lrbarcodeitem.cpp +++ b/limereport/items/lrbarcodeitem.cpp @@ -73,6 +73,7 @@ void BarcodeItem::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *opti bc.setWidth(m_barcodeWidth); bc.setSecurityLevel(m_securityLevel); bc.setPdf417CodeWords(m_pdf417CodeWords); + bc.setHideText(m_hideText); if (isSelected()) ppainter->setOpacity(Const::SELECTION_OPACITY); @@ -249,6 +250,22 @@ void BarcodeItem::setInputMode(const InputMode &inputMode) } } +bool BarcodeItem::hideText() const +{ + return m_hideText; +} + +void BarcodeItem::setHideText(bool hideText) +{ + if (m_hideText != hideText){ + m_hideText = hideText; + if (!isLoading()){ + update(); + notify("hideText",!m_hideText,m_hideText); + } + } +} + void BarcodeItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight) { switch(pass){ diff --git a/limereport/items/lrbarcodeitem.h b/limereport/items/lrbarcodeitem.h index 3f56c59..cfd6265 100644 --- a/limereport/items/lrbarcodeitem.h +++ b/limereport/items/lrbarcodeitem.h @@ -50,6 +50,7 @@ class BarcodeItem : public LimeReport::ContentItemDesignIntf { Q_PROPERTY(int securityLevel READ securityLevel WRITE setSecurityLevel) Q_PROPERTY(int pdf417CodeWords READ pdf417CodeWords WRITE setPdf417CodeWords) Q_PROPERTY(InputMode inputMode READ inputMode WRITE setInputMode) + Q_PROPERTY(bool hideText READ hideText WRITE setHideText) public: // enum BarcodeType {QRCODE=58,CODE128=20,DATAMATRIX=71,MAXICODE=57,MICROPDF417=84}; // enum BarcodeType {CODE_11=1,C25MATRIX=2,QRCODE=58,CODE128=20,DATAMATRIX=71,MAXICODE=57,MICROPDF417=84, @@ -167,6 +168,9 @@ public: InputMode inputMode() const; void setInputMode(const InputMode &inputMode); + bool hideText() const; + void setHideText(bool hideText); + private: Zint::QZint m_bc; QString m_content; @@ -180,6 +184,7 @@ private: int m_securityLevel; int m_pdf417CodeWords; InputMode m_inputMode; + bool m_hideText; }; } From 4f0bde628bcacaab6841d4ff33afc5327b49371a Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 8 Jan 2019 19:52:58 +0300 Subject: [PATCH 48/58] Default editor dialog execution is unified --- limereport/lrbasedesignintf.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 052ed7c..732933c 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -1135,13 +1135,6 @@ void BaseDesignIntf::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void BaseDesignIntf::showEditorDialog(){ QWidget *editor = defaultEditor(); if (editor) { - -#ifdef Q_OS_WIN - editor->setAttribute(Qt::WA_DeleteOnClose); - editor->setWindowFlags(Qt::Dialog); - editor->setWindowModality(Qt::ApplicationModal); - editor->show(); -#else QDialog* dialog = new QDialog(QApplication::activeWindow()); dialog->setAttribute(Qt::WA_DeleteOnClose); #ifdef Q_OS_MAC @@ -1155,7 +1148,6 @@ void BaseDesignIntf::showEditorDialog(){ dialog->layout()->addWidget(editor); connect(editor,SIGNAL(destroyed()),dialog,SLOT(close())); dialog->exec(); -#endif } } From 561f64b1b65abf7b0ac0a4b352545645c5d66308 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 16 Jan 2019 20:26:17 +0300 Subject: [PATCH 49/58] Some unused code was deleted --- common.pri | 2 +- limereport/lrpagedesignintf.cpp | 62 +++--- limereport/lrpagedesignintf.h | 368 +++++++++++++++----------------- 3 files changed, 204 insertions(+), 228 deletions(-) diff --git a/common.pri b/common.pri index c1fbd66..b2d17a5 100644 --- a/common.pri +++ b/common.pri @@ -77,7 +77,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 113 +LIMEREPORT_VERSION_RELEASE = 114 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/lrpagedesignintf.cpp b/limereport/lrpagedesignintf.cpp index 9f7705b..f8c983c 100644 --- a/limereport/lrpagedesignintf.cpp +++ b/limereport/lrpagedesignintf.cpp @@ -67,8 +67,6 @@ bool bandSortBandLessThen(const BandDesignIntf *c1, const BandDesignIntf *c2) PageDesignIntf::PageDesignIntf(QObject *parent): QGraphicsScene(parent), - m_pageSize(A4), - m_orientation(Portrait), m_pageItem(0), m_insertMode(false), m_itemInsertRect(0), @@ -84,8 +82,6 @@ PageDesignIntf::PageDesignIntf(QObject *parent): m_executingGroupCommand(false), m_settings(0), m_selectionRect(0), - //m_verticalGridStep(1*Const::mmFACTOR), - //m_horizontalGridStep(1*Const::mmFACTOR) m_verticalGridStep(2), m_horizontalGridStep(2), m_updating(false), @@ -134,22 +130,22 @@ void PageDesignIntf::updatePageRect() emit sceneRectChanged(sceneRect()); } -PageDesignIntf::Orientation PageDesignIntf::getOrientation() -{ - return m_orientation; -} +//PageDesignIntf::Orientation PageDesignIntf::getOrientation() +//{ +// return m_orientation; +//} -void PageDesignIntf::setPageSize(PageDesignIntf::PageSize sizeType, QSizeF sizeValue) -{ - m_pageSize = sizeType; - m_pageSizeValue = sizeValue; - updatePageRect(); -} +//void PageDesignIntf::setPageSize(PageDesignIntf::PageSize sizeType, QSizeF sizeValue) +//{ +// m_pageSize = sizeType; +// m_pageSizeValue = sizeValue; +// updatePageRect(); +//} -PageDesignIntf::PageSize PageDesignIntf::pageSize() const -{ - return m_pageSize; -} +//PageDesignIntf::PageSize PageDesignIntf::pageSize() const +//{ +// return m_pageSize; +//} void PageDesignIntf::keyPressEvent(QKeyEvent *event) { @@ -672,22 +668,22 @@ bool PageDesignIntf::isExistsObjectName(const QString &objectName, QList pages); + QList pageItems(){return m_reportPages;} - void startInsertMode(const QString& ItemType); - void startEditMode(); + bool isItemInsertMode(); + ReportEnginePrivate* reportEditor(); + void setReportEditor(ReportEnginePrivate* value){m_reportEditor=value;} - PageItemDesignIntf *pageItem(); - void setPageItem(PageItemDesignIntf::Ptr pageItem); - void setPageItems(QList pages); - QList pageItems(){return m_reportPages;} + QStringList possibleParentItems(); + void registerItem(BaseDesignIntf* item); + void registerBand(BandDesignIntf* band); + void removeAllItems(); - bool isItemInsertMode(); - ReportEnginePrivate* reportEditor(); - void setReportEditor(ReportEnginePrivate* value){m_reportEditor=value;} + void setItemMode(BaseDesignIntf::ItemMode state); + BaseDesignIntf::ItemMode itemMode(){return m_itemMode;} + BaseDesignIntf* reportItemByName(const QString& name); + QList reportItemsByName(const QString &name); + BaseDesignIntf* addReportItem(const QString& itemType, QPointF pos, QSizeF size); + BaseDesignIntf* addReportItem(const QString& itemType, QObject *owner=0, BaseDesignIntf *parent=0); + BaseDesignIntf* createReportItem(const QString& itemType, QObject *owner=0, BaseDesignIntf *parent=0); + void removeReportItem(BaseDesignIntf* item, bool createComand = true); + CommandIf::Ptr removeReportItemCommand(BaseDesignIntf *item); + bool saveCommand(CommandIf::Ptr command, bool runCommand = true); - QStringList possibleParentItems(); - void registerItem(BaseDesignIntf* item); - void registerBand(BandDesignIntf* band); - void removeAllItems(); + bool isCanRedo(); + bool isCanUndo(); + bool isHasChanges(); - void setItemMode(BaseDesignIntf::ItemMode state); - BaseDesignIntf::ItemMode itemMode(){return m_itemMode;} - BaseDesignIntf* reportItemByName(const QString& name); - QList reportItemsByName(const QString &name); - BaseDesignIntf* addReportItem(const QString& itemType, QPointF pos, QSizeF size); - BaseDesignIntf* addReportItem(const QString& itemType, QObject *owner=0, BaseDesignIntf *parent=0); - BaseDesignIntf* createReportItem(const QString& itemType, QObject *owner=0, BaseDesignIntf *parent=0); - void removeReportItem(BaseDesignIntf* item, bool createComand = true); - CommandIf::Ptr removeReportItemCommand(BaseDesignIntf *item); - bool saveCommand(CommandIf::Ptr command, bool runCommand = true); + void reactivatePageItem(PageItemDesignIntf::Ptr pageItem); - bool isCanRedo(); - bool isCanUndo(); - bool isHasChanges(); + void setSettings(QSettings* settings){ m_settings = settings;} + QSettings* settings(){ return m_settings;} - void reactivatePageItem(PageItemDesignIntf::Ptr pageItem); + QString genObjectName(const QObject& object); - void setSettings(QSettings* settings){ m_settings = settings;} - QSettings* settings(){ return m_settings;} + void animateItem(BaseDesignIntf* item); + void setSelectionRect(QRectF selectionRect); + void emitRegisterdItem(BaseDesignIntf *item); + void emitItemRemoved(BaseDesignIntf* item); - QString genObjectName(const QObject& object); + DataSourceManager* datasourceManager(); + bool isSaved(){ return !m_hasHanges;} + void changeSelectedGrpoupTextAlignPropperty(const bool& horizontalAlign, Qt::AlignmentFlag flag); - void animateItem(BaseDesignIntf* item); - void setSelectionRect(QRectF selectionRect); - void emitRegisterdItem(BaseDesignIntf *item); - void emitItemRemoved(BaseDesignIntf* item); + int verticalGridStep() const; + void setVerticalGridStep(int verticalGridStep); - DataSourceManager* datasourceManager(); - bool isSaved(){ return !m_hasHanges;} - void changeSelectedGrpoupTextAlignPropperty(const bool& horizontalAlign, Qt::AlignmentFlag flag); + int horizontalGridStep() const; + void setHorizontalGridStep(int horizontalGridStep); - int verticalGridStep() const; - void setVerticalGridStep(int verticalGridStep); + void beginUpdate(){m_updating = true;} + bool isUpdating(){return m_updating;} + void endUpdate(); - int horizontalGridStep() const; - void setHorizontalGridStep(int horizontalGridStep); - - void beginUpdate(){m_updating = true;} - bool isUpdating(){return m_updating;} - void endUpdate(); - - void itemMoved(BaseDesignIntf* item); - bool magneticMovement() const; - void setMagneticMovement(bool magneticMovement); - - ReportSettings *getReportSettings() const; - void setReportSettings(ReportSettings *reportSettings); - - void setPropertyToSelectedItems(const char *name, const QVariant &value); + void itemMoved(BaseDesignIntf* item); + bool magneticMovement() const; + void setMagneticMovement(bool magneticMovement); + ReportSettings *getReportSettings() const; + void setReportSettings(ReportSettings *reportSettings); + void setPropertyToSelectedItems(const char *name, const QVariant &value); protected: + virtual void keyPressEvent(QKeyEvent *event); + virtual void keyReleaseEvent(QKeyEvent *event); + virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - virtual void keyPressEvent(QKeyEvent *event); - virtual void keyReleaseEvent(QKeyEvent *event); - virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); - virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event); + virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *); + virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event); + virtual void dropEvent(QGraphicsSceneDragDropEvent *event); - virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event); - virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *); - virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event); - virtual void dropEvent(QGraphicsSceneDragDropEvent *event); + LimeReport::BandDesignIntf::BandsType findPriorType(LimeReport::BandDesignIntf::BandsType bandType); + BaseDesignIntf *findDestObject(BaseDesignIntf *item); - LimeReport::BandDesignIntf::BandsType findPriorType(LimeReport::BandDesignIntf::BandsType bandType); - BaseDesignIntf *findDestObject(BaseDesignIntf *item); + bool isExistsObjectName (const QString& objectName, QList &itemsList) const; - bool isExistsObjectName (const QString& objectName, QList &itemsList) const; - QRectF getRectByPageSize(PageSize pageSize); + bool isLoading(); + void objectLoadStarted(); + void objectLoadFinished(); - bool isLoading(); - void objectLoadStarted(); - void objectLoadFinished(); - - HorizontalLayout* internalAddHLayout(); - QPointF placePosOnGrid(QPointF point); - QSizeF placeSizeOnGrid(QSizeF size); + HorizontalLayout* internalAddHLayout(); + QPointF placePosOnGrid(QPointF point); + QSizeF placeSizeOnGrid(QSizeF size); signals: - void geometryChanged(QRectF newGeometry); - void insertModeStarted(); - void itemInserted(LimeReport::PageDesignIntf* report, QPointF pos, const QString& ItemType); - void itemInsertCanceled(const QString& ItemType); - void itemSelected(LimeReport::BaseDesignIntf *item); - void multiItemsSelected(QList* objectsList); - void miltiItemsSelectionFinished(); - void commandHistoryChanged(); - void itemPropertyChanged(const QString& objectName, const QString& propertyName, const QVariant& oldValue, const QVariant& newValue); - void itemAdded(LimeReport::PageDesignIntf* page, LimeReport::BaseDesignIntf* item); - void itemRemoved(LimeReport::PageDesignIntf* page, LimeReport::BaseDesignIntf* item); - void bandAdded(LimeReport::PageDesignIntf* page, LimeReport::BandDesignIntf* band); - void bandRemoved(LimeReport::PageDesignIntf* page, LimeReport::BandDesignIntf* band); - void pageUpdateFinished(LimeReport::PageDesignIntf* page); - public slots: - BaseDesignIntf* addBand(const QString& bandType); - BaseDesignIntf* addBand(BandDesignIntf::BandsType bandType); - void removeBand(LimeReport::BandDesignIntf* band); - void bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry); - void bandPosChanged(QObject* object, QPointF newPos, QPointF oldPos); - void slotUpdateItemSize(); - void undo(); - void redo(); - void copy(); - void paste(); - void deleteSelected(); - void cut(); - void setToSaved(); - void bringToFront(); - void sendToBack(); - void alignToLeft(); - void alignToRigth(); - void alignToVCenter(); - void alignToTop(); - void alignToBottom(); - void alignToHCenter(); - void sameWidth(); - void sameHeight(); - void addHLayout(); - void setFont(const QFont &font); - void setTextAlign(const Qt::Alignment& alignment); - void setBorders(const BaseDesignIntf::BorderLines& border); - private slots: - 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); - void slotPageItemLoaded(QObject *); - void slotSelectionChanged(); - void slotAnimationStoped(QObject *animation); - private: - template - BaseDesignIntf* internalAddBand(T bandType); - void finalizeInsertMode(); - void saveSelectedItemsPos(); - void saveSelectedItemsGeometry(); - void checkSizeOrPosChanges(); - CommandIf::Ptr createChangePosCommand(); - CommandIf::Ptr createChangeSizeCommand(); - void saveChangeProppertyCommand(const QString& objectName, const QString& propertyName, const QVariant& oldPropertyValue, const QVariant& newPropertyValue); - void changeSelectedGroupProperty(const QString& name,const QVariant& value); - - private: - enum JoinType{Width, Height}; - PageSize m_pageSize; - QSizeF m_pageSizeValue; - Orientation m_orientation; - QRectF m_geometry; - LimeReport::PageItemDesignIntf::Ptr m_pageItem; - QList m_reportPages; - ReportEnginePrivate* m_reportEditor; - bool m_insertMode; - QGraphicsItem * m_itemInsertRect; - QString m_insertItemType; - BaseDesignIntf::ItemMode m_itemMode; - QGraphicsRectItem* m_cutterBorder; - QGraphicsRectItem* m_pageRect; - QVector m_commandsList; - QVector m_positionStamp; - QVector m_geometryStamp; - BaseDesignIntf* m_firstSelectedItem; - int m_currentCommand; - bool m_changeSizeMode; - bool m_changePosMode; - bool m_changePosOrSizeMode; - bool m_executingCommand; - bool m_hasHanges; - bool m_isLoading; - bool m_executingGroupCommand; - QSettings* m_settings; - QList m_animationList; - QPointF m_startSelectionPoint; - QGraphicsRectItem* m_selectionRect; - int m_verticalGridStep; - int m_horizontalGridStep; - bool m_updating; - int m_currentObjectIndex; - bool m_multiSelectStarted; - QList m_projections; - BaseDesignIntf* m_movedItem; - BaseDesignIntf* m_movedItemContainer; - BaseDesignIntf* m_joinItem; - JoinType m_joinType; - bool m_magneticMovement; - ReportSettings* m_reportSettings; + void geometryChanged(QRectF newGeometry); + void insertModeStarted(); + void itemInserted(LimeReport::PageDesignIntf* report, QPointF pos, const QString& ItemType); + void itemInsertCanceled(const QString& ItemType); + void itemSelected(LimeReport::BaseDesignIntf *item); + void multiItemsSelected(QList* objectsList); + void miltiItemsSelectionFinished(); + void commandHistoryChanged(); + void itemPropertyChanged(const QString& objectName, const QString& propertyName, const QVariant& oldValue, const QVariant& newValue); + void itemAdded(LimeReport::PageDesignIntf* page, LimeReport::BaseDesignIntf* item); + void itemRemoved(LimeReport::PageDesignIntf* page, LimeReport::BaseDesignIntf* item); + void bandAdded(LimeReport::PageDesignIntf* page, LimeReport::BandDesignIntf* band); + void bandRemoved(LimeReport::PageDesignIntf* page, LimeReport::BandDesignIntf* band); + void pageUpdateFinished(LimeReport::PageDesignIntf* page); + public slots: + BaseDesignIntf* addBand(const QString& bandType); + BaseDesignIntf* addBand(BandDesignIntf::BandsType bandType); + void removeBand(LimeReport::BandDesignIntf* band); + void bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry); + void bandPosChanged(QObject* object, QPointF newPos, QPointF oldPos); + void slotUpdateItemSize(); + void undo(); + void redo(); + void copy(); + void paste(); + void deleteSelected(); + void cut(); + void setToSaved(); + void bringToFront(); + void sendToBack(); + void alignToLeft(); + void alignToRigth(); + void alignToVCenter(); + void alignToTop(); + void alignToBottom(); + void alignToHCenter(); + void sameWidth(); + void sameHeight(); + void addHLayout(); + void setFont(const QFont &font); + void setTextAlign(const Qt::Alignment& alignment); + void setBorders(const BaseDesignIntf::BorderLines& border); + private slots: + 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); + void slotPageItemLoaded(QObject *); + void slotSelectionChanged(); + void slotAnimationStoped(QObject *animation); + private: + template + BaseDesignIntf* internalAddBand(T bandType); + void finalizeInsertMode(); + void saveSelectedItemsPos(); + void saveSelectedItemsGeometry(); + void checkSizeOrPosChanges(); + CommandIf::Ptr createChangePosCommand(); + CommandIf::Ptr createChangeSizeCommand(); + void saveChangeProppertyCommand(const QString& objectName, const QString& propertyName, const QVariant& oldPropertyValue, const QVariant& newPropertyValue); + void changeSelectedGroupProperty(const QString& name,const QVariant& value); + private: + enum JoinType{Width, Height}; + LimeReport::PageItemDesignIntf::Ptr m_pageItem; + QList m_reportPages; + ReportEnginePrivate* m_reportEditor; + bool m_insertMode; + QGraphicsItem * m_itemInsertRect; + QString m_insertItemType; + BaseDesignIntf::ItemMode m_itemMode; + QGraphicsRectItem* m_cutterBorder; + QGraphicsRectItem* m_pageRect; + QVector m_commandsList; + QVector m_positionStamp; + QVector m_geometryStamp; + BaseDesignIntf* m_firstSelectedItem; + int m_currentCommand; + bool m_changeSizeMode; + bool m_changePosMode; + bool m_changePosOrSizeMode; + bool m_executingCommand; + bool m_hasHanges; + bool m_isLoading; + bool m_executingGroupCommand; + QSettings* m_settings; + QList m_animationList; + QPointF m_startSelectionPoint; + QGraphicsRectItem* m_selectionRect; + int m_verticalGridStep; + int m_horizontalGridStep; + bool m_updating; + int m_currentObjectIndex; + bool m_multiSelectStarted; + QList m_projections; + BaseDesignIntf* m_movedItem; + BaseDesignIntf* m_movedItemContainer; + BaseDesignIntf* m_joinItem; + JoinType m_joinType; + bool m_magneticMovement; + ReportSettings* m_reportSettings; }; class AbstractPageCommand : public CommandIf{ From f154909c69813d08622a56b7fd8435f5bf35af8a Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 17 Jan 2019 00:55:26 +0300 Subject: [PATCH 50/58] Redundant geometry change event has been removed --- common.pri | 2 +- limereport/lrbasedesignintf.cpp | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/common.pri b/common.pri index b2d17a5..222482d 100644 --- a/common.pri +++ b/common.pri @@ -77,7 +77,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 114 +LIMEREPORT_VERSION_RELEASE = 116 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 732933c..3a3a22b 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -1124,12 +1124,6 @@ void BaseDesignIntf::setItemPos(const QPointF &newPos) void BaseDesignIntf::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { QGraphicsItem::mouseReleaseEvent(event); - QRectF newGeometry = geometry(); - if (newGeometry != m_oldGeometry) { - geometryChangedEvent(newGeometry, m_oldGeometry); - updateSelectionMarker(); - emit(geometryChanged(this, newGeometry, m_oldGeometry)); - } } void BaseDesignIntf::showEditorDialog(){ From 5d019fbd87e6c40faf41c0151b7e333cd2d00e0d Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 18 Jan 2019 20:18:45 +0300 Subject: [PATCH 51/58] Null pointer access has been fixed --- common.pri | 2 +- limereport/items/lrtextitem.cpp | 24 +++++++++++++----------- limereport/lrbasedesignintf.cpp | 28 +++++++++++++++------------- limereport/lrpageitemdesignintf.cpp | 7 +++---- 4 files changed, 32 insertions(+), 29 deletions(-) diff --git a/common.pri b/common.pri index 222482d..ab95c10 100644 --- a/common.pri +++ b/common.pri @@ -77,7 +77,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 116 +LIMEREPORT_VERSION_RELEASE = 117 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index a4384b0..eae907f 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -113,17 +113,19 @@ void TextItem::processPopUpAction(QAction *action) if (action->text().compare(tr("Edit")) == 0){ this->showEditorDialog(); } - if (action->text().compare(tr("Auto height")) == 0){ - page()->setPropertyToSelectedItems("autoHeight",action->isChecked()); - } - if (action->text().compare(tr("Allow HTML")) == 0){ - page()->setPropertyToSelectedItems("allowHTML",action->isChecked()); - } - if (action->text().compare(tr("Allow HTML in fields")) == 0){ - page()->setPropertyToSelectedItems("allowHTMLInFields",action->isChecked()); - } - if (action->text().compare(tr("Stretch to max height")) == 0){ - page()->setPropertyToSelectedItems("stretchToMaxHeight",action->isChecked()); + if (page()){ + if (action->text().compare(tr("Auto height")) == 0){ + page()->setPropertyToSelectedItems("autoHeight",action->isChecked()); + } + if (action->text().compare(tr("Allow HTML")) == 0){ + page()->setPropertyToSelectedItems("allowHTML",action->isChecked()); + } + if (action->text().compare(tr("Allow HTML in fields")) == 0){ + page()->setPropertyToSelectedItems("allowHTMLInFields",action->isChecked()); + } + if (action->text().compare(tr("Stretch to max height")) == 0){ + page()->setPropertyToSelectedItems("stretchToMaxHeight",action->isChecked()); + } } } diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 3a3a22b..39de032 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -544,10 +544,12 @@ void BaseDesignIntf::mouseMoveEvent(QGraphicsSceneMouseEvent *event) setItemPos(QPointF(div(m_startPos.x(), hStep).quot * hStep, div(m_startPos.y(), vStep).quot * vStep) - delta); - if (!isBand() && scene()->selectedItems().count()>1) - moveSelectedItems(tmpPos - pos()); - if (scene()->selectedItems().count()==1 && (page()->magneticMovement())) - page()->itemMoved(this); + if (page()){ + if (!isBand() && page()->selectedItems().count()>1) + moveSelectedItems(tmpPos - pos()); + if (page()->selectedItems().count()==1 && (page()->magneticMovement())) + page()->itemMoved(this); + } } } @@ -806,29 +808,29 @@ void BaseDesignIntf::setBorderLineSize(int value) void BaseDesignIntf::moveRight() { - if (!m_fixedPos) setItemPos(pos().x() + page()->horizontalGridStep(), pos().y()); + if (!m_fixedPos && page()) setItemPos(pos().x() + page()->horizontalGridStep(), pos().y()); } void BaseDesignIntf::moveLeft() { - if (!m_fixedPos) setItemPos(pos().x() - page()->horizontalGridStep(), pos().y()); + if (!m_fixedPos && page()) setItemPos(pos().x() - page()->horizontalGridStep(), pos().y()); } void BaseDesignIntf::moveDown() { - if (!m_fixedPos) setItemPos(pos().x(), pos().y() + page()->verticalGridStep()); + if (!m_fixedPos && page()) setItemPos(pos().x(), pos().y() + page()->verticalGridStep()); } void BaseDesignIntf::moveUp() { - if (!m_fixedPos) setItemPos(pos().x(), pos().y() - page()->verticalGridStep()); + if (!m_fixedPos && page()) setItemPos(pos().x(), pos().y() - page()->verticalGridStep()); } void BaseDesignIntf::sizeRight() { if ((m_possibleResizeDirectionFlags & ResizeLeft) || (m_possibleResizeDirectionFlags & ResizeRight)) { - setWidth(width() + page()->horizontalGridStep()); + if (page()) setWidth(width() + page()->horizontalGridStep()); } } @@ -836,7 +838,7 @@ void BaseDesignIntf::sizeLeft() { if ((m_possibleResizeDirectionFlags & ResizeLeft) || (m_possibleResizeDirectionFlags & ResizeRight)) { - setWidth(width() - page()->horizontalGridStep()); + if(page()) setWidth(width() - page()->horizontalGridStep()); } } @@ -844,7 +846,7 @@ void BaseDesignIntf::sizeUp() { if ((m_possibleResizeDirectionFlags & ResizeTop) || (m_possibleResizeDirectionFlags & ResizeBottom)) { - setHeight(height() - page()->verticalGridStep()); + if (page()) setHeight(height() - page()->verticalGridStep()); } } @@ -852,7 +854,7 @@ void BaseDesignIntf::sizeDown() { if ((m_possibleResizeDirectionFlags & ResizeTop) || (m_possibleResizeDirectionFlags & ResizeBottom)) { - setHeight(height() + page()->verticalGridStep()); + if (page()) setHeight(height() + page()->verticalGridStep()); } } @@ -1325,7 +1327,7 @@ void BaseDesignIntf::collectionLoadFinished(const QString &collectionName) foreach(QObject * obj, QObject::children()) { #endif BaseDesignIntf *item = dynamic_cast(obj); - if (item) { + if (item && page()) { page()->registerItem(item); } } diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index 364d42e..af65436 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -690,10 +690,9 @@ void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry } } } - if (curIndex != band->bandIndex()){ - //swapBands(band, bandToSwap); - //page()->saveCommand(BandSwapCommand::create(page(), band->objectName(), bandToSwap->objectName()), true); - page()->saveCommand(BandMoveFromToCommand::create(page(), band->bandIndex(), bandToSwap->bandIndex()), true); + if (curIndex != band->bandIndex() && itemMode() == DesignMode){ + if (page()) + page()->saveCommand(BandMoveFromToCommand::create(page(), band->bandIndex(), bandToSwap->bandIndex()), true); } relocateBands(); } From 603d80e1a5b16727b2179852a65d6119d1ab6096 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 18 Jan 2019 23:44:58 +0300 Subject: [PATCH 52/58] Geometry change event has been reverted --- limereport/lrbasedesignintf.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 39de032..610bd5f 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -1126,6 +1126,12 @@ void BaseDesignIntf::setItemPos(const QPointF &newPos) void BaseDesignIntf::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { QGraphicsItem::mouseReleaseEvent(event); + QRectF newGeometry = geometry(); + if (newGeometry != m_oldGeometry) { + geometryChangedEvent(newGeometry, m_oldGeometry); + updateSelectionMarker(); + emit(geometryChanged(this, newGeometry, m_oldGeometry)); + } } void BaseDesignIntf::showEditorDialog(){ From 1135cbd4243dd269a121fedee11ec0a7fd51f234 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 18 Jan 2019 23:45:16 +0300 Subject: [PATCH 53/58] Designtime behavior has been removed from render process --- common.pri | 2 +- limereport/lrpageitemdesignintf.cpp | 52 +++++++++++++++-------------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/common.pri b/common.pri index ab95c10..38ad957 100644 --- a/common.pri +++ b/common.pri @@ -77,7 +77,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 117 +LIMEREPORT_VERSION_RELEASE = 118 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index af65436..c3a20e7 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -666,33 +666,35 @@ void PageItemDesignIntf::moveBandFromTo(int from, int to) void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry) { - BandDesignIntf* band = dynamic_cast(object); - int curIndex = band->bandIndex(); - BandDesignIntf* bandToSwap = 0; - foreach(BandDesignIntf* curBand, bands()){ - if (newGeometry.y() > oldGeometry.y()) { - if (curBand->bandType() == band->bandType() - && curIndex < curBand->bandIndex() - && (curBand->pos().y() + (curBand->height()/2)) < newGeometry.y() - && curBand->parentBand() == band->parentBand()) - { - curIndex = curBand->bandIndex(); - bandToSwap = curBand; - } - } else { - if (curBand->bandType() == band->bandType() - && curIndex>curBand->bandIndex() - && (curBand->pos().y() + (curBand->height()/2)) > newGeometry.y() - && curBand->parentBand() == band->parentBand()) - { - curIndex = curBand->bandIndex(); - bandToSwap = curBand; + if (itemMode() == DesignMode){ + BandDesignIntf* band = dynamic_cast(object); + int curIndex = band->bandIndex(); + BandDesignIntf* bandToSwap = 0; + foreach(BandDesignIntf* curBand, bands()){ + if (newGeometry.y() > oldGeometry.y()) { + if (curBand->bandType() == band->bandType() + && curIndex < curBand->bandIndex() + && (curBand->pos().y() + (curBand->height()/2)) < newGeometry.y() + && curBand->parentBand() == band->parentBand()) + { + curIndex = curBand->bandIndex(); + bandToSwap = curBand; + } + } else { + if (curBand->bandType() == band->bandType() + && curIndex>curBand->bandIndex() + && (curBand->pos().y() + (curBand->height()/2)) > newGeometry.y() + && curBand->parentBand() == band->parentBand()) + { + curIndex = curBand->bandIndex(); + bandToSwap = curBand; + } } } - } - if (curIndex != band->bandIndex() && itemMode() == DesignMode){ - if (page()) - page()->saveCommand(BandMoveFromToCommand::create(page(), band->bandIndex(), bandToSwap->bandIndex()), true); + if (curIndex != band->bandIndex() && itemMode() == DesignMode){ + if (page()) + page()->saveCommand(BandMoveFromToCommand::create(page(), band->bandIndex(), bandToSwap->bandIndex()), true); + } } relocateBands(); } From d4fb85dafd0d014479fbb00b71c63a15d2d5c9f2 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 19 Jan 2019 00:04:01 +0300 Subject: [PATCH 54/58] TextItem editor size restoring has been fixed --- common.pri | 2 +- limereport/objectinspector/propertyItems/lrcontentpropitem.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common.pri b/common.pri index 38ad957..337b2c1 100644 --- a/common.pri +++ b/common.pri @@ -77,7 +77,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 118 +LIMEREPORT_VERSION_RELEASE = 119 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/objectinspector/propertyItems/lrcontentpropitem.cpp b/limereport/objectinspector/propertyItems/lrcontentpropitem.cpp index 1b49128..53c9806 100644 --- a/limereport/objectinspector/propertyItems/lrcontentpropitem.cpp +++ b/limereport/objectinspector/propertyItems/lrcontentpropitem.cpp @@ -30,6 +30,7 @@ void ContentEditor::editButtonClicked() dialog->setWindowTitle(propertyName()); QWidget* editor = dynamic_cast(m_object)->defaultEditor(); dialog->layout()->addWidget(editor); + dialog->resize(editor->size()); connect(editor,SIGNAL(destroyed()),dialog,SLOT(close())); connect(editor,SIGNAL(destroyed()),this,SIGNAL(editingFinished())); dialog->exec(); From 76ae6dfb2409810e6dfd705d2b994c77e8a73e78 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 21 Jan 2019 14:17:34 +0300 Subject: [PATCH 55/58] Layout has been fixed --- common.pri | 2 +- limereport/lrbasedesignintf.cpp | 7 ++++--- limereport/lrbasedesignintf.h | 2 +- limereport/lrpageitemdesignintf.cpp | 10 +++++----- limereport/lrpageitemdesignintf.h | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/common.pri b/common.pri index 337b2c1..9534741 100644 --- a/common.pri +++ b/common.pri @@ -77,7 +77,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 119 +LIMEREPORT_VERSION_RELEASE = 120 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 610bd5f..898c9a7 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -1026,6 +1026,7 @@ QVariant BaseDesignIntf::itemChange(QGraphicsItem::GraphicsItemChange change, co if (change == QGraphicsItem::ItemPositionHasChanged) { updateSelectionMarker(); } + if (change == QGraphicsItem::ItemSelectedChange) { turnOnSelectionMarker(value.toBool()); emit itemSelectedHasBeenChanged(this, value.toBool()); @@ -1120,18 +1121,18 @@ void BaseDesignIntf::setItemPos(const QPointF &newPos) QPointF oldPos = pos(); QPointF finalPos = modifyPosForAlignedItem(newPos); QGraphicsItem::setPos(finalPos); - emit posChanged(this, finalPos, oldPos); + emit posChanging(this, finalPos, oldPos); } void BaseDesignIntf::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { - QGraphicsItem::mouseReleaseEvent(event); QRectF newGeometry = geometry(); if (newGeometry != m_oldGeometry) { geometryChangedEvent(newGeometry, m_oldGeometry); updateSelectionMarker(); - emit(geometryChanged(this, newGeometry, m_oldGeometry)); + emit(posChanged(this, newGeometry.topLeft(), m_oldGeometry.topLeft())); } + QGraphicsItem::mouseReleaseEvent(event); } void BaseDesignIntf::showEditorDialog(){ diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index 904b64e..313c0f4 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -401,6 +401,7 @@ private: bool m_watermark; signals: void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry); + void posChanging(QObject* object, QPointF newPos, QPointF oldPos); void posChanged(QObject* object, QPointF newPos, QPointF oldPos); void itemSelected(LimeReport::BaseDesignIntf *item); void itemSelectedHasBeenChanged(BaseDesignIntf *item, bool value); @@ -412,7 +413,6 @@ 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(); diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index c3a20e7..b4ba954 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -303,7 +303,7 @@ void PageItemDesignIntf::registerBand(BandDesignIntf *band) band->setParentItem(this); band->setWidth(pageRect().width()/band->columnsCount()); connect(band, SIGNAL(destroyed(QObject*)),this,SLOT(bandDeleted(QObject*))); - connect(band, SIGNAL(geometryChanged(QObject*,QRectF,QRectF)),this,SLOT(bandGeometryChanged(QObject*,QRectF,QRectF))); + connect(band, SIGNAL(posChanged(QObject*,QPointF,QPointF)),this,SLOT(bandPositionChanged(QObject*,QPointF,QPointF))); } } @@ -664,17 +664,17 @@ void PageItemDesignIntf::moveBandFromTo(int from, int to) } -void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry) +void PageItemDesignIntf::bandPositionChanged(QObject* object, QPointF newPos, QPointF oldPos) { if (itemMode() == DesignMode){ BandDesignIntf* band = dynamic_cast(object); int curIndex = band->bandIndex(); BandDesignIntf* bandToSwap = 0; foreach(BandDesignIntf* curBand, bands()){ - if (newGeometry.y() > oldGeometry.y()) { + if (newPos.y() > oldPos.y()) { if (curBand->bandType() == band->bandType() && curIndex < curBand->bandIndex() - && (curBand->pos().y() + (curBand->height()/2)) < newGeometry.y() + && (curBand->pos().y() + (curBand->height()/2)) < newPos.y() && curBand->parentBand() == band->parentBand()) { curIndex = curBand->bandIndex(); @@ -683,7 +683,7 @@ void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry } else { if (curBand->bandType() == band->bandType() && curIndex>curBand->bandIndex() - && (curBand->pos().y() + (curBand->height()/2)) > newGeometry.y() + && (curBand->pos().y() + (curBand->height()/2)) > newPos.y() && curBand->parentBand() == band->parentBand()) { curIndex = curBand->bandIndex(); diff --git a/limereport/lrpageitemdesignintf.h b/limereport/lrpageitemdesignintf.h index 2287cf8..315ce08 100644 --- a/limereport/lrpageitemdesignintf.h +++ b/limereport/lrpageitemdesignintf.h @@ -122,7 +122,7 @@ public: protected slots: void bandDeleted(QObject* band); - void bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry); + void bandPositionChanged(QObject* object, QPointF newPos, QPointF oldPos); protected: void collectionLoadFinished(const QString& collectionName); QRectF& pageRect(){return m_pageRect;} From 070508db0bbd73a786e6afe84e2f4fe3978356ea Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Fri, 25 Jan 2019 01:10:37 +0300 Subject: [PATCH 56/58] PageSize enum's values are accorded with QPrinter::PageSize's values. --- common.pri | 2 +- limereport/lrpageitemdesignintf.h | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/common.pri b/common.pri index 9534741..fb015f5 100644 --- a/common.pri +++ b/common.pri @@ -77,7 +77,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 120 +LIMEREPORT_VERSION_RELEASE = 121 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/lrpageitemdesignintf.h b/limereport/lrpageitemdesignintf.h index 315ce08..d7fd6b0 100644 --- a/limereport/lrpageitemdesignintf.h +++ b/limereport/lrpageitemdesignintf.h @@ -34,6 +34,7 @@ #include "lritemscontainerdesignitf.h" #include #include +#include namespace LimeReport{ @@ -55,12 +56,19 @@ class PageItemDesignIntf : public LimeReport::ItemsContainerDesignInft Q_PROPERTY(bool resetPageNumber READ resetPageNumber WRITE setResetPageNumber) friend class ReportRender; public: - enum Orientation { Portrait, Landscape }; - enum PageSize {A4, B5, Letter, Legal, Executive, - A0, A1, A2, A3, A5, A6, A7, A8, A9, B0, B1, - B10, B2, B3, B4, B6, B7, B8, B9, C5E, Comm10E, - DLE, Folio, Ledger, Tabloid, Custom, NPageSize = Custom - }; + enum Orientation { Portrait = QPrinter::Portrait, Landscape = QPrinter::Landscape }; + enum PageSize { + A4 = QPrinter::A4, B5 = QPrinter::B5, Letter = QPrinter::Letter, + Legal = QPrinter::Legal, Executive = QPrinter::Executive, + A0 = QPrinter::A0, A1 = QPrinter::A1, A2 = QPrinter::A2, A3 = QPrinter::A3, + A5 = QPrinter::A5, A6 = QPrinter::A6, A7 = QPrinter::A7, A8 = QPrinter::A8, + A9 = QPrinter::A9, B0 = QPrinter::B0, B1 = QPrinter::B1, B10 = QPrinter::B10, + B2 = QPrinter::B2, B3 = QPrinter::B3, B4 = QPrinter::B4, B6 = QPrinter::B6, + B7 = QPrinter::B7, B8 = QPrinter::B8, B9 = QPrinter::B9, C5E = QPrinter::C5E, + Comm10E = QPrinter::Comm10E, DLE = QPrinter::DLE, Folio = QPrinter::Folio, + Ledger = QPrinter::Ledger, Tabloid = QPrinter::Tabloid, Custom = QPrinter::Custom, + NPageSize = Custom + }; typedef QList BandsList; typedef QList::const_iterator BandsIterator; typedef QSharedPointer Ptr; From df9253929fa29ad6650fe1434f30c1e9a643a82e Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 31 Jan 2019 21:01:55 +0300 Subject: [PATCH 57/58] Datasources changes tracking has been added --- common.pri | 2 +- limereport/lrdatasourcemanager.cpp | 26 +++++++++++++++++++------- limereport/lrdatasourcemanager.h | 3 +++ limereport/lrpagedesignintf.cpp | 12 ++++++------ limereport/lrpagedesignintf.h | 4 ++-- limereport/lrreportdesignwindow.cpp | 1 + limereport/lrreportengine.cpp | 8 +++++++- 7 files changed, 39 insertions(+), 17 deletions(-) diff --git a/common.pri b/common.pri index fb015f5..ed59d80 100644 --- a/common.pri +++ b/common.pri @@ -77,7 +77,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 121 +LIMEREPORT_VERSION_RELEASE = 122 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index c7950f2..20ff3fb 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -217,7 +217,8 @@ void DataSourceModel::updateModel() } DataSourceManager::DataSourceManager(QObject *parent) : - QObject(parent), m_lastError(""), m_designTime(true), m_needUpdate(false), m_dbCredentialsProvider(0) + QObject(parent), m_lastError(""), m_designTime(true), m_needUpdate(false), + m_dbCredentialsProvider(0), m_hasChanges(false) { m_groupFunctionFactory.registerFunctionCreator(QLatin1String("COUNT"),new ConstructorGroupFunctionCreator); m_groupFunctionFactory.registerFunctionCreator(QLatin1String("SUM"),new ConstructorGroupFunctionCreator); @@ -230,11 +231,11 @@ DataSourceManager::DataSourceManager(QObject *parent) : setSystemVariable(QLatin1String("#IS_FIRST_PAGEFOOTER"),false,FirstPass); connect(&m_reportVariables, SIGNAL(variableHasBeenAdded(QString)), - this, SLOT(slotVariableHasBeenAdded(QString)) ); + this, SLOT(slotVariableHasBeenAdded(QString))); connect(&m_reportVariables, SIGNAL(variableHasBeenChanged(QString)), this, SLOT(slotVariableHasBeenChanged(QString))); connect(&m_userVariables, SIGNAL(variableHasBeenAdded(QString)), - this, SLOT(slotVariableHasBeenAdded(QString)) ); + this, SLOT(slotVariableHasBeenAdded(QString))); connect(&m_userVariables, SIGNAL(variableHasBeenChanged(QString)), this, SLOT(slotVariableHasBeenChanged(QString))); @@ -499,6 +500,7 @@ void DataSourceManager::addQuery(const QString &name, const QString &sqlText, co QueryDesc *queryDecs = new QueryDesc(name,sqlText,connectionName); putQueryDesc(queryDecs); putHolder(name,new QueryHolder(sqlText, connectionName, this)); + m_hasChanges = true; emit datasourcesChanged(); } @@ -507,6 +509,7 @@ void DataSourceManager::addSubQuery(const QString &name, const QString &sqlText, SubQueryDesc *subQueryDesc = new SubQueryDesc(name.toLower(),sqlText,connectionName,masterDatasource); putSubQueryDesc(subQueryDesc); putHolder(name,new SubQueryHolder(sqlText, connectionName, masterDatasource, this)); + m_hasChanges = true; emit datasourcesChanged(); } @@ -521,6 +524,7 @@ void DataSourceManager::addProxy(const QString &name, QString master, QString de } putProxyDesc(proxyDesc); putHolder(name,new ProxyHolder(proxyDesc, this)); + m_hasChanges = true; emit datasourcesChanged(); } @@ -643,6 +647,7 @@ void DataSourceManager::removeDatasource(const QString &name) delete m_proxies.at(proxyIndex); m_proxies.removeAt(proxyIndex); } + m_hasChanges = true; emit datasourcesChanged(); } @@ -663,6 +668,7 @@ void DataSourceManager::removeConnection(const QString &connectionName) cit++; } } + m_hasChanges = true; emit datasourcesChanged(); } @@ -671,6 +677,7 @@ void DataSourceManager::addConnectionDesc(ConnectionDesc * connection) if (!isConnection(connection->name())) { connect(connection,SIGNAL(nameChanged(QString,QString)),this,SLOT(slotConnectionRenamed(QString,QString))); m_connections.append(connection); + m_hasChanges = true; if (connection->autoconnect()){ try{ connectConnection(connection); @@ -1025,6 +1032,7 @@ QStringList DataSourceManager::fieldNames(const QString &datasourceName) void DataSourceManager::addConnection(const QString &connectionName) { addConnectionDesc(new ConnectionDesc(QSqlDatabase::database(connectionName))); + m_hasChanges = true; emit datasourcesChanged(); } @@ -1189,8 +1197,10 @@ void DataSourceManager::deleteVariable(const QString& name) m_userVariables.deleteVariable(name); if (m_reportVariables.containsVariable(name)&&m_reportVariables.variableType(name)==VarDesc::Report){ m_reportVariables.deleteVariable(name); - if (designTime()) - emit datasourcesChanged(); + if (designTime()){ + m_hasChanges = true; + emit datasourcesChanged(); + } } } @@ -1266,14 +1276,16 @@ void DataSourceManager::invalidateQueriesContainsVariable(const QString& variabl void DataSourceManager::slotVariableHasBeenAdded(const QString& variableName) { - //qDebug()<< "variable has been added"<< variableName; invalidateQueriesContainsVariable(variableName); + if (variableType(variableName) == VarDesc::Report) + m_hasChanges = true; } void DataSourceManager::slotVariableHasBeenChanged(const QString& variableName) { - //qDebug()<< "variable has been changed"<< variableName; invalidateQueriesContainsVariable(variableName); + if (variableType(variableName) == VarDesc::Report) + m_hasChanges = true; } void DataSourceManager::clear(ClearMethod method) diff --git a/limereport/lrdatasourcemanager.h b/limereport/lrdatasourcemanager.h index fabb694..32e1168 100644 --- a/limereport/lrdatasourcemanager.h +++ b/limereport/lrdatasourcemanager.h @@ -201,6 +201,8 @@ public: ReportSettings *reportSettings() const; void setReportSettings(ReportSettings *reportSettings); + bool isHasChanges(){ return m_hasChanges; } + void dropChanges(){ m_hasChanges = false; } signals: void loadCollectionFinished(const QString& collectionName); void cleared(); @@ -256,6 +258,7 @@ private: QHash m_groupFunctionsExpressionsMap; QVector m_groupFunctionsExpressions; IDbCredentialsProvider* m_dbCredentialsProvider; + bool m_hasChanges; }; } diff --git a/limereport/lrpagedesignintf.cpp b/limereport/lrpagedesignintf.cpp index f8c983c..a241adc 100644 --- a/limereport/lrpagedesignintf.cpp +++ b/limereport/lrpagedesignintf.cpp @@ -77,7 +77,7 @@ PageDesignIntf::PageDesignIntf(QObject *parent): m_changePosMode(false), m_changePosOrSizeMode(false), m_executingCommand(false), - m_hasHanges(false), + m_hasChanges(false), m_isLoading(false), m_executingGroupCommand(false), m_settings(0), @@ -608,7 +608,7 @@ bool PageDesignIntf::saveCommand(CommandIf::Ptr command, bool runCommand) m_commandsList.push_back(command); m_currentCommand = m_commandsList.count() - 1; - m_hasHanges = true; + m_hasChanges = true; emit commandHistoryChanged(); return true; } @@ -625,7 +625,7 @@ bool PageDesignIntf::isCanUndo() bool PageDesignIntf::isHasChanges() { - return (m_commandsList.count() > 0) && m_hasHanges; + return (m_commandsList.count() > 0) && m_hasChanges; } bool PageDesignIntf::isItemInsertMode() @@ -1201,7 +1201,7 @@ void PageDesignIntf::undo() m_executingCommand = true; m_commandsList.at(m_currentCommand)->undoIt(); m_currentCommand--; - m_hasHanges = true; + m_hasChanges = true; m_executingCommand = false; } } @@ -1212,7 +1212,7 @@ void PageDesignIntf::redo() m_executingCommand = true; m_currentCommand++; m_commandsList.at(m_currentCommand)->doIt(); - m_hasHanges = true; + m_hasChanges = true; m_executingCommand = false; } } @@ -1322,7 +1322,7 @@ void PageDesignIntf::cut() void PageDesignIntf::setToSaved() { - m_hasHanges = false; + m_hasChanges = false; } void PageDesignIntf::bringToFront() diff --git a/limereport/lrpagedesignintf.h b/limereport/lrpagedesignintf.h index dcd2861..7688838 100644 --- a/limereport/lrpagedesignintf.h +++ b/limereport/lrpagedesignintf.h @@ -151,7 +151,7 @@ namespace LimeReport { void emitItemRemoved(BaseDesignIntf* item); DataSourceManager* datasourceManager(); - bool isSaved(){ return !m_hasHanges;} + bool isSaved(){ return !m_hasChanges;} void changeSelectedGrpoupTextAlignPropperty(const bool& horizontalAlign, Qt::AlignmentFlag flag); int verticalGridStep() const; @@ -277,7 +277,7 @@ namespace LimeReport { bool m_changePosMode; bool m_changePosOrSizeMode; bool m_executingCommand; - bool m_hasHanges; + bool m_hasChanges; bool m_isLoading; bool m_executingGroupCommand; QSettings* m_settings; diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index 2020c0b..7b4ee68 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -547,6 +547,7 @@ void ReportDesignWindow::startNewReport() m_newPageFooter->setEnabled(true); m_newReportHeader->setEnabled(true); m_newReportFooter->setEnabled(true); + m_reportDesignWidget->report()->dataManager()->dropChanges(); } void ReportDesignWindow::writePosition() diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index adcfa73..7a9c52f 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -513,7 +513,7 @@ bool ReportEnginePrivate::slotLoadFromFile(const QString &fileName) } dataManager()->connectAutoConnections(); - + dataManager()->dropChanges(); if ( hasActivePreview() ) { currentPreview->reloadPreview(); @@ -666,6 +666,7 @@ bool ReportEnginePrivate::saveToFile(const QString &fileName) page->setToSaved(); } } + m_datasources->dropChanges(); return saved; } @@ -680,6 +681,7 @@ QByteArray ReportEnginePrivate::saveToByteArray() page->setToSaved(); } } + m_datasources->dropChanges(); return result; } @@ -693,6 +695,7 @@ QString ReportEnginePrivate::saveToString(){ page->setToSaved(); } } + m_datasources->dropChanges(); return result; } @@ -701,6 +704,9 @@ bool ReportEnginePrivate::isNeedToSave() foreach(PageDesignIntf* page, m_pages){ if (page->isHasChanges()) return true; } + if (dataManager()->isHasChanges()){ + return true; + } return false; } From 64a49abdb29a778bbdc07f5acab710974e87ef4b Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 31 Jan 2019 22:03:33 +0300 Subject: [PATCH 58/58] Band size changing via keyboard has been fixed --- common.pri | 2 +- limereport/lrpageitemdesignintf.cpp | 11 ++++++++++- limereport/lrpageitemdesignintf.h | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/common.pri b/common.pri index ed59d80..f10eaf8 100644 --- a/common.pri +++ b/common.pri @@ -77,7 +77,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 122 +LIMEREPORT_VERSION_RELEASE = 123 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index b4ba954..21e9c81 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -303,7 +303,11 @@ void PageItemDesignIntf::registerBand(BandDesignIntf *band) band->setParentItem(this); band->setWidth(pageRect().width()/band->columnsCount()); connect(band, SIGNAL(destroyed(QObject*)),this,SLOT(bandDeleted(QObject*))); - connect(band, SIGNAL(posChanged(QObject*,QPointF,QPointF)),this,SLOT(bandPositionChanged(QObject*,QPointF,QPointF))); + connect(band, SIGNAL(posChanged(QObject*, QPointF, QPointF)), + this, SLOT(bandPositionChanged(QObject*, QPointF, QPointF))); + connect(band, SIGNAL(geometryChanged(QObject*, QRectF, QRectF)), + this, SLOT(bandGeometryChanged(QObject*, QRectF, QRectF))); + } } @@ -699,6 +703,11 @@ void PageItemDesignIntf::bandPositionChanged(QObject* object, QPointF newPos, QP relocateBands(); } +void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry) +{ + bandPositionChanged(object, newGeometry.topLeft(), oldGeometry.topLeft()); +} + void PageItemDesignIntf::collectionLoadFinished(const QString &collectionName) { if (collectionName.compare("children",Qt::CaseInsensitive)==0){ diff --git a/limereport/lrpageitemdesignintf.h b/limereport/lrpageitemdesignintf.h index d7fd6b0..e24556a 100644 --- a/limereport/lrpageitemdesignintf.h +++ b/limereport/lrpageitemdesignintf.h @@ -131,6 +131,7 @@ public: protected slots: void bandDeleted(QObject* band); void bandPositionChanged(QObject* object, QPointF newPos, QPointF oldPos); + void bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry); protected: void collectionLoadFinished(const QString& collectionName); QRectF& pageRect(){return m_pageRect;}