From fecf863f7c407386f36b41fd5c3cf3bb0136d4aa Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 10 Jun 2016 19:05:18 +0400 Subject: [PATCH 01/51] Version 1.4 initial commit --- include/lrreportengine.h | 6 + limereport/databrowser/lrdatabrowser.cpp | 12 +- limereport/images/addPage.png | Bin 0 -> 679 bytes limereport/images/addPage1.png | Bin 0 -> 453 bytes limereport/images/deletePage.png | Bin 0 -> 649 bytes limereport/images/deletePage1.png | Bin 0 -> 393 bytes limereport/images/green_logo_32x32.png | Bin 0 -> 15508 bytes limereport/images/logo_16x16.png | Bin 0 -> 15260 bytes .../items/editors/lrfonteditorwidget.cpp | 38 +- limereport/items/editors/lrfonteditorwidget.h | 3 + limereport/items/lrshapeitem.cpp | 31 +- limereport/items/lrtextitem.cpp | 163 +++++++-- limereport/items/lrtextitem.h | 24 +- limereport/limereport.pri | 12 +- limereport/lrbanddesignintf.cpp | 7 + limereport/lrdatasourcemanager.h | 2 +- limereport/lrgraphicsviewzoom.cpp | 12 +- limereport/lrgraphicsviewzoom.h | 1 + limereport/lrpagedesignintf.h | 1 + limereport/lrpageitemdesignintf.h | 3 + limereport/lrpreviewreportwindow.cpp | 43 ++- limereport/lrpreviewreportwindow.h | 11 +- limereport/lrpreviewreportwindow.ui | 2 + limereport/lrreportdesignwidget.cpp | 254 ++++++++++--- limereport/lrreportdesignwidget.h | 17 +- limereport/lrreportdesignwindow.cpp | 124 +++++-- limereport/lrreportdesignwindow.h | 10 + limereport/lrreportengine.cpp | 76 +++- limereport/lrreportengine.h | 6 + limereport/lrreportengine_p.h | 21 +- limereport/lrreportrender.cpp | 45 +++ limereport/lrreportrender.h | 8 +- limereport/lrscriptenginemanager.cpp | 201 +++++++++++ limereport/lrscriptenginemanager.h | 70 +++- .../objectinspector/editors/lrcoloreditor.cpp | 1 + .../objectinspector/editors/lrimageeditor.cpp | 14 +- .../objectinspector/editors/lrimageeditor.h | 2 + limereport/objectinspector/lrobjectpropitem.h | 2 +- limereport/objectsbrowser/lrobjectbrowser.cpp | 7 +- limereport/report.qrc | 2 + limereport/scriptbrowser/images/Dialog.png | Bin 0 -> 348 bytes .../scriptbrowser/images/Dialog_add.png | Bin 0 -> 429 bytes .../scriptbrowser/images/Dialog_delete.png | Bin 0 -> 633 bytes .../scriptbrowser/images/Dialog_run.png | Bin 0 -> 576 bytes limereport/scriptbrowser/images/function3.png | Bin 0 -> 505 bytes .../scriptbrowser/images/function_add.png | Bin 0 -> 504 bytes .../scriptbrowser/images/function_delete.png | Bin 0 -> 731 bytes .../scriptbrowser/images/function_edit.png | Bin 0 -> 666 bytes .../scriptbrowser/images/green_cube.png | Bin 0 -> 790 bytes .../scriptbrowser/images/green_cube1.png | Bin 0 -> 609 bytes limereport/scriptbrowser/lrscriptbrowser.cpp | 195 ++++++++++ limereport/scriptbrowser/lrscriptbrowser.h | 77 ++++ limereport/scriptbrowser/lrscriptbrowser.qrc | 14 + limereport/scriptbrowser/lrscriptbrowser.ui | 287 +++++++++++++++ limereport/serializators/lrxmlreader.cpp | 4 + limereport/serializators/lrxmlwriter.cpp | 11 +- limereport/serializators/lrxmlwriter.h | 2 +- translations/limereport_es_ES.qm | Bin 63618 -> 63645 bytes translations/limereport_es_ES.ts | 141 +++++++- translations/limereport_ru.qm | Bin 28632 -> 28957 bytes translations/limereport_ru.ts | 333 ++++++++++++------ 61 files changed, 2019 insertions(+), 276 deletions(-) create mode 100644 limereport/images/addPage.png create mode 100644 limereport/images/addPage1.png create mode 100644 limereport/images/deletePage.png create mode 100644 limereport/images/deletePage1.png create mode 100644 limereport/images/green_logo_32x32.png create mode 100644 limereport/images/logo_16x16.png create mode 100644 limereport/scriptbrowser/images/Dialog.png create mode 100644 limereport/scriptbrowser/images/Dialog_add.png create mode 100644 limereport/scriptbrowser/images/Dialog_delete.png create mode 100644 limereport/scriptbrowser/images/Dialog_run.png create mode 100644 limereport/scriptbrowser/images/function3.png create mode 100644 limereport/scriptbrowser/images/function_add.png create mode 100644 limereport/scriptbrowser/images/function_delete.png create mode 100644 limereport/scriptbrowser/images/function_edit.png create mode 100644 limereport/scriptbrowser/images/green_cube.png create mode 100644 limereport/scriptbrowser/images/green_cube1.png create mode 100644 limereport/scriptbrowser/lrscriptbrowser.cpp create mode 100644 limereport/scriptbrowser/lrscriptbrowser.h create mode 100644 limereport/scriptbrowser/lrscriptbrowser.qrc create mode 100644 limereport/scriptbrowser/lrscriptbrowser.ui diff --git a/include/lrreportengine.h b/include/lrreportengine.h index afbbcdc..94b78d2 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -60,6 +60,10 @@ private: class DataSourceManager; class ReportEnginePrivate; +class PageDesignIntf; +class PageItemDesignIntf; + +typedef QList< QSharedPointer > ReportPages; class LIMEREPORT_EXPORT ReportEngine : public QObject{ Q_OBJECT @@ -69,7 +73,9 @@ public: explicit ReportEngine(QObject *parent = 0); ~ReportEngine(); bool printReport(QPrinter *printer=0); + bool printPages(ReportPages pages, QPrinter *printer, PrintRange printRange = PrintRange()); void printToFile(const QString& fileName); + PageDesignIntf *createPreviewScene(QObject *parent = 0); bool printToPDF(const QString& fileName); void previewReport(); void designReport(); diff --git a/limereport/databrowser/lrdatabrowser.cpp b/limereport/databrowser/lrdatabrowser.cpp index 4629d0e..37f6eaf 100644 --- a/limereport/databrowser/lrdatabrowser.cpp +++ b/limereport/databrowser/lrdatabrowser.cpp @@ -778,14 +778,4 @@ void DataBrowser::on_variablesTree_itemDoubleClicked(QTreeWidgetItem *item, int } } -} // namespace LimeReport - - - - - - - - - - +} // namespace LimeReport \ No newline at end of file diff --git a/limereport/images/addPage.png b/limereport/images/addPage.png new file mode 100644 index 0000000000000000000000000000000000000000..030733079771ba6da2da54dc9e1a79ffcacbc4fc GIT binary patch literal 679 zcmV;Y0$BZtP)1v7bMxOA z?GM&OV=IALn}Tyus*7$dI=I?FaBx!)TU}gQ6hv{g;N&8Lr05{j)j@PAX|XjRDH2+& zZEj;~@45Hf&sQK~CkV6R@!%`Dz-JuvD` zb~=|%_VoEXMg#ti(SSeM)924l=hF46*)ESw4n5Rbi#CArT(s5=vep{qsYU@JJDn>4 zm&T_u59&UVxz@jI8lpeZo$>=%r;30ezI0?yc2obz*OJ^DpUO-CALeEjubKc>rbx8Y zq->Y5wk-sL^S!pf(r7kKjO4h=v&mmt>Ji~BoBDf1m6H1VYbp6B6tnhmvqbZt(a7^YO-#4wEJ z7IL%S22x$&!n0emXsSb0%0r_WzHplK*+G&6{S-HfILamxi4qEh+t(;PNyryO*8!eJ z2m{AaNK;ZOZz5fZqa?19&EeJ?$F&KV0b&ci_)H(RW3#nYLI@K_E2L}VD4W041Sp%w zHy-gO_l}R&XM%w!`PDoJLNSB_N6CKxTnT6{4xUFWYuNcwb<|htDpU|ZL4;T8Ae0tebkaq)t|~3!=0^xgK~fMLii<-hu_3t*Ot=(`|0hCKs z`#f&yDq^R$m0~>AU(_c7K)c~srK(-#f-QBL?tz|_8LamK0EMoZvrwwqJ>|KXau8Ao z5G8U%2q=hjfrt95r5M3pZDSO{K3aME`1)SnjqFp*0D;%G<-+^3=X4hJ1_Qf~`2{^S zjiUg7(JjIc{R}m8L>er zS%=Mic}D`_PP8O&6d`XxPXI#@kpvKtBu$H_XB7;$h00000NkvXXu0mjfsOz}w literal 0 HcmV?d00001 diff --git a/limereport/images/deletePage.png b/limereport/images/deletePage.png new file mode 100644 index 0000000000000000000000000000000000000000..f8b7cfec344bbc147d3c63a18b91d245a12649bf GIT binary patch literal 649 zcmV;40(Sk0P)4!RRFv5-1fAr~vIlTx(us7SmtXzHor@?CoO!jQblKLzZo3UrfGE&whMLt=plu zr;EKk$?k5IT6K@^?LMyilA((ul$;$xp->aNdGmaU(h9AiP^h4_Mr%!=VM}e2FXZu* zBoc`d4xc`5;07*NlcOjcx;QB6}a`BaWGQmjVGETvvKNe^8 z`#Qy92_XcYR=B>zQxeaYxV}8WKuOx$46gKyvbp_(bFo1-wl*miO9V>cDR$ygZ`f&o+cU#&Q>pa7~F^firC|7rJoN7z{Rs$uEk{uRwADT$GgGjieC4Y;- j^SLKE{zK(0nFja;StB(u2WEe000000NkvXXu0mjf=mZ|Z literal 0 HcmV?d00001 diff --git a/limereport/images/deletePage1.png b/limereport/images/deletePage1.png new file mode 100644 index 0000000000000000000000000000000000000000..45f33ce6fc6303690f3006fbae283046e629193f GIT binary patch literal 393 zcmV;40e1e0P)Y5Qd+V!(Sjl zueio5giT>5SXx+ah^^qy5H@Hh5p683Ewofl1RHBXJ0XH_SEUHHLK<^=V-b_v5ANKvb$F0ih z+Yk3lF&Qh^==G?5Ef%#5!1Ibnk|tBB763p*D(9D^gM9fB;K}o-EiG5%3(0pc n?f4jQc(xbM^Q}MLKLdatU^12wSuWLV00000NkvXXu0mjfEUuwX literal 0 HcmV?d00001 diff --git a/limereport/images/green_logo_32x32.png b/limereport/images/green_logo_32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..b1752f71b75604a400455952c3d95e3d2c50f012 GIT binary patch literal 15508 zcmeI3e{d7W6~`}5+YnQifJti-nhFt@7&zVOw{?}p7|FyAk>eW2*lkKU-L32!OFE%D zTaw8*kPI$v!p}fzOa=&~O*5g40~v-S{O}kvQ`#^PprxUdG;K1Z83vd!EwnVyJ^l7t z-tn~Q^q#3`Kw5afbLW-h_YN|c;@LQ+7CwvWlDxICz;n%(4 z>Sl$aCKhY&yQscbN+`;4S!!rfo4k*6f*dsPqU-~PSTGD{QkYd>t5n??0gF0o8-&g_!6EABxeA>z4h9GUmDk0Bfsn$*D)foC z9Q>^fGkRTOirQA8uhbIin!I&7w;TaFtHDMKtj(^oI}Apv-EOhZ)tOkMm0`_{nWar; z&cbpQlP>kry9(hiXGHXK^_~T(bkM5Mx2kHGW0+_(YKWQ*a-@YZIvfs$H8Ca=4QJ3w zJf!k5I;6}@21&>907ZyMVO5etIxQ~mliSq_yv_0*Ol#1qK8_5QJ0(`Wf^3gQ~Z}qC=&u-3$NSZR{wS$;6hMT4&-4dmc+#x4i zE9Z^?UX>#avK(+FtE?`KQ0I0hs!I3BVksobQKihupf1_{&PD?sUIi|#9%=D@yL% zoH(Mu`Q=EES6xz&Zvjj=)Z%2agE=!ZRmHjGfEslUdCU!ECenVHxli+G?^G>2iymrOiI82>j(XquG=!2)LF!VMe8@mK0d6@ti7# zwVXKF7J+3WN7F(;N}Nz(KB54v|0?w92Fx63nG;L%N%S$t3)}6#< zQ*P4e?HnJ1Wc(cWv2#RQK?v7g$xw+|V+T=WzZ&Hupt1#4$ap$G8Fi!^8s5oh{{;c* zf3Oh>-|^pV!}z-DKiGz`PN@IiHe{<|COTJS&I66DMfL;6!k56Gs$U!*d{*jxZR(s|3pzXx zG_NmO^Ys@hZ=V>Jom+>mn-9f@mt3_UakRhpk@D=Ni?_b`9N7!}0!u%ePI5 z6nwA1{+E@rKUuc?&b+67=-=Ml`%vsBQ$hWfj;D)np7Y#SVt?b8r*2PLvhy3>rd7v! z9}I5)^DXy+%XeNGyzAhej)~p7_P7^rIIfh;J}sNK?K;$V ze=B1eXt^*Lyv|ec_j`W(;flty!t6cWH=f$9esyitr4M`dztpsXKJen}v2~MT-B)hz zzi;uBFAPIl%C-)aUS>{rS-v}c;l-hEzEb=4kC>kh!~@>X=W%Olz|3mi_|8vQOX-7Z(^@gna~2$bi>+~MZ40y!wX-vKyOZwjYY*t0~ z+t#|mY&aDJF{NQ34O$19+N6PQ$t&Ax0~TLKfB_Of7p<8@JgEs8zbzYAfak_AW3y(b z=-qx>osrPm9&WY<)ikiW>~30O-5#sQYv)`ZkJGcl%Cnq{VI7QvrFnt$G;;dvU)ptb&_E@tSYwkQ{* z5GMpQDXpY*MNL|bxMD=@)%`Y`k*Ij&?<Rx)Lod&V)#YQt{eBMycRtC^@%mDdbkj2k%t~rh%xd={8l3 z2Xa-`TtH|I2D4RVU9wh5%4(ms)W@JMrS&dF10hid0izyi)^1erZi}pS*$7{sK(VayetrK_?U9TCa-Lz35`ij7n2fb37iV zO9ZqBur;)kce1qC#d9<(i_RK{%sHiqHw!TwHoH#>9a5!Uqg!C;+{PlS5)5CutccSs zOF*olqY@XTIS#mJIK;thUJvi_0#8(w3yDm@CM9|(t-yUxjGN{d_aeh&K$0V%#>3N* zh>N8ooYPB-BIlvSs1rn4mse&zVj)GDFq2X>C>pHRep400TF&llt)OS(XhDc8*&Qk+ zrZr&npWjw!z~Yux+_4OwY#$4vWbADL$!HG%DNGnGT~^UE@1{&%&Z!~D#W%TE&e0bG zNnCs7LS<)F4x*`1y-!Sox-M8DQ|bI%)QN6rcpqc@7sQqSU?DVd{l8m=sdd#qScXbF z)c>~(r7D(UVzLX!0j5yEg@LK9Ty8xlc2=QVCwHRH_;V6q7sHAYv)#k_m`P)$%(?mP zMmNTLv-3SX3lD}fzVohT8FlTzyP9RxwdA=vsptVdpA8u{c^Utpx$V6bKJ0;j+vRe& zd<;5_dNeB;5N{7Da39u;{e*MpeNdsSV@D-NlaP1JEtTo9EZc**QTWgYpEsG}1Lvgn zEbe00^Q3e~*E1>-izGpS;7x)H&j(QnE(8ePB)IT=5S8FUfZ$Dn3(p5p2`&T(-Xys2 zd=Qo3LV(~+f(y?FQ3);t2;L;P@O%)J;6i}lO@a&02T=(w1PIK%{l zIlp8LIL@^nS~6`1fBeEMH#qUaifQNXyvg%U$Db#E=4!qjAHVX~27m9R{iFLw1LsDc z{B+S4t91Lxy4Bma&e<|Yzc{vvdv?vb+0rZ1_uP20exAE$>(Ko3OQTxw%!ReSrX{>X|O?mE5Z^11J-t{fb-e6{$up^$%O`|g*z_wK&=@~zaD8ysVA zoVM-i*)~Ie?NMs1ftmZ}eItWM6O9&^4^+)Qa>Gx9XJ_s`z3%0m-(+?@z3_zP#gT2B z`2{G{NScurrentFont()); - resFont.setPointSize(value.toInt()); - reportEditor()->setFont(resFont); - } + if (m_ignoreSlots) return; + + QFont resFont(fontNameEditor()->currentFont()); + resFont.setPointSize(value.toInt()); + + if (reportEditor()) reportEditor()->setFont(resFont); + if (page()) page()->setFont(resFont); } void FontEditorWidget::slotFontAttribsChanged(bool) { - if (reportEditor()&& !m_ignoreSlots){ - QFont resFont(m_fontNameEditor->currentFont()); - resFont.setBold(m_fontBold->isChecked()); - resFont.setItalic(m_fontItalic->isChecked()); - resFont.setUnderline(m_fontUnderline->isChecked()); - reportEditor()->setFont(resFont); - } + if (m_ignoreSlots) return; + + QFont resFont(m_fontNameEditor->currentFont()); + resFont.setBold(m_fontBold->isChecked()); + resFont.setItalic(m_fontItalic->isChecked()); + resFont.setUnderline(m_fontUnderline->isChecked()); + if (reportEditor()) reportEditor()->setFont(resFont); + if (page()) page()->setFont(resFont); + } void FontEditorWidget::slotPropertyChanged(const QString &objectName, const QString &property, const QVariant& oldValue, const QVariant& newValue) diff --git a/limereport/items/editors/lrfonteditorwidget.h b/limereport/items/editors/lrfonteditorwidget.h index eb7864e..23f9ab7 100644 --- a/limereport/items/editors/lrfonteditorwidget.h +++ b/limereport/items/editors/lrfonteditorwidget.h @@ -45,8 +45,11 @@ class FontEditorWidget :public ItemEditorWidget{ public: explicit FontEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0); explicit FontEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0); + explicit FontEditorWidget(PageDesignIntf* page, const QString &title, QWidget *parent = 0); + explicit FontEditorWidget(PageDesignIntf* page, QWidget *parent = 0); protected: void setItemEvent(BaseDesignIntf *item); + QFontComboBox* fontNameEditor(){return m_fontNameEditor;} private slots: void slotFontChanged(const QFont& font); void slotFontSizeChanged(const QString& value); diff --git a/limereport/items/lrshapeitem.cpp b/limereport/items/lrshapeitem.cpp index 1639fc2..16c72f9 100644 --- a/limereport/items/lrshapeitem.cpp +++ b/limereport/items/lrshapeitem.cpp @@ -60,8 +60,24 @@ ShapeItem::ShapeItem(QObject *owner, QGraphicsItem *parent) { } +Qt::PenStyle ShapeItem::penStyle() const +{ + return m_penStyle; +} + +void ShapeItem::setPenStyle(const Qt::PenStyle &value) +{ + if ((value!=m_penStyle)){ + Qt::PenStyle oldValue = m_penStyle; + m_penStyle=value; + update(); + notify("penStyle",(int)oldValue,(int)value); + } +} + void ShapeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + painter->save(); QPen pen(m_shapeColor); @@ -150,21 +166,6 @@ void ShapeItem::setLineWidth(qreal value) } } -Qt::PenStyle ShapeItem::penStyle() const -{ - return m_penStyle; -} - -void ShapeItem::setPenStyle(const Qt::PenStyle &value) -{ - if (m_penStyle!=value){ - Qt::PenStyle oldValue = m_penStyle; - m_penStyle = value; - update(); - notify("penStyle",(int)oldValue,(int)value); - } -} - BaseDesignIntf *ShapeItem::createSameTypeItem(QObject *owner, QGraphicsItem *parent) { return new ShapeItem(owner,parent); diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index d9197f7..9fd38aa 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -150,20 +150,45 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q break; } -// for(QTextBlock it=m_text->begin();it!=m_text->end();it=it.next()){ -// for (int i=0;ilineCount();i++){ -// painter->setOpacity(qreal(foregroundOpacity())/100); -// it.layout()->lineAt(i).draw(painter,QPointF(0,0)); -// } -// } + int lineHeight = painter->fontMetrics().height(); + qreal curpos = 0; + + if (m_underlines){ + QPen pen = painter->pen(); + pen.setWidth(m_underlineLineSize); + painter->setPen(pen); + } painter->setOpacity(qreal(foregroundOpacity())/100); - - //m_text->setDefaultTextOption(); QAbstractTextDocumentLayout::PaintContext ctx; ctx.palette.setColor(QPalette::Text, fontColor()); + for(QTextBlock it=m_text->begin();it!=m_text->end();it=it.next()){ + it.blockFormat().setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight); + for (int i=0;ilineCount();i++){ + QTextLine line = it.layout()->lineAt(i); + if (m_underlines){ + painter->drawLine(QPointF(0,line.rect().bottomLeft().y()),QPoint(rect().width(),line.rect().bottomRight().y())); + lineHeight = line.height()+m_lineSpacing; + curpos = line.rect().bottom(); + } + } + } m_text->documentLayout()->draw(painter,ctx); + if (m_underlines){ + if (lineHeight<0) lineHeight = painter->fontMetrics().height(); + for (curpos+=lineHeight; curposdrawLine(QPointF(0,curpos),QPoint(rect().width(),curpos)); + } + } + + //painter->setOpacity(qreal(foregroundOpacity())/100); + + //m_text->setDefaultTextOption(); + //QAbstractTextDocumentLayout::PaintContext ctx; + //ctx.palette.setColor(QPalette::Text, fontColor()); + //m_text->documentLayout()->draw(painter,ctx); + // m_layout.draw(ppainter,QPointF(marginSize(),0),); // ppainter->setFont(transformToSceneFont(font())); // QTextOption o; @@ -186,6 +211,10 @@ void TextItem::Init() // m_text->setDefaultFont(transformToSceneFont(font())); m_textSize=QSizeF(); m_foregroundOpacity = 100; + m_underlines = false; + m_adaptFontToSize = false; + m_underlineLineSize = 1; + m_lineSpacing = 1; } void TextItem::setContent(const QString &value) @@ -204,9 +233,9 @@ void TextItem::setContent(const QString &value) } if (!isLoading()){ - update(rect()); - notify("content",oldValue,value); - //updateLayout(); + initText(); + update(rect()); + notify("content",oldValue,value); } } } @@ -223,7 +252,7 @@ void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, i } if ((m_textSize.height()>height()) && (m_autoHeight) ){ - setHeight(m_textSize.height()+5); + setHeight(m_textSize.height()+borderLineSize()*2); } BaseDesignIntf::updateItemSize(dataManager, pass, maxHeight); } @@ -262,23 +291,91 @@ QString TextItem::replaceReturns(QString text) return result; } +void TextItem::setTextFont(const QFont& value){ + m_text->setDefaultFont(value); + if ((m_angle==Angle0)||(m_angle==Angle180)){ + m_text->setTextWidth(rect().width()-fakeMarginSize()*2); + } else { + m_text->setTextWidth(rect().height()-fakeMarginSize()*2); + } +} + +void TextItem::adaptFontSize(){ + QFont _font = transformToSceneFont(font()); + do{ + setTextFont(_font); + if (_font.pixelSize()>2) + _font.setPixelSize(_font.pixelSize()-1); + else break; + } while(m_text->size().height()>this->height() || m_text->size().width()>(this->width())-fakeMarginSize()*2); +} +int TextItem::underlineLineSize() const +{ + return m_underlineLineSize; +} + +void TextItem::setUnderlineLineSize(int value) +{ + int oldValue = m_underlineLineSize; + m_underlineLineSize = value; + update(); + notify("underlineLineSize",oldValue,value); +} + +int TextItem::lineSpacing() const +{ + return m_lineSpacing; +} + +void TextItem::setLineSpacing(int value) +{ + int oldValue = m_lineSpacing; + m_lineSpacing = value; + initText(); + update(); + notify("lineSpacing",oldValue,value); +} + + void TextItem::initText() { QTextOption to; to.setAlignment(m_alignment); if (m_autoWidth!=MaxStringLength) - to.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); + if (m_adaptFontToSize && (!(m_autoHeight || m_autoWidth))) + to.setWrapMode(QTextOption::WordWrap); + else + to.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); else to.setWrapMode(QTextOption::NoWrap); m_text->setDocumentMargin(0); m_text->setDefaultTextOption(to); - m_text->setDefaultFont(transformToSceneFont(font())); + + QFont _font = transformToSceneFont(font()); + if (m_adaptFontToSize && (!(m_autoHeight || m_autoWidth))){ + adaptFontSize(); + } else { + setTextFont(transformToSceneFont(font())); + } + if ((m_angle==Angle0)||(m_angle==Angle180)){ m_text->setTextWidth(rect().width()-fakeMarginSize()*2); } else { m_text->setTextWidth(rect().height()-fakeMarginSize()*2); } + + for ( QTextBlock block = m_text->begin(); block.isValid(); block = block.next()) + { + QTextCursor tc = QTextCursor(block); + QTextBlockFormat fmt = block.blockFormat(); + + if(fmt.lineHeight() != m_lineSpacing) { + fmt.setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight); + tc.setBlockFormat( fmt ); + } + } + m_textSize=m_text->size(); } @@ -320,9 +417,11 @@ bool TextItem::trimValue() const return m_trimValue; } -void TextItem::setTrimValue(bool trimValue) +void TextItem::setTrimValue(bool value) { - m_trimValue = trimValue; + bool oldValue = m_trimValue; + m_trimValue = value; + notify("trimValue",oldValue,value); } @@ -333,8 +432,9 @@ void TextItem::geometryChangedEvent(QRectF , QRectF) // } else { // m_text->setTextWidth(rect().height()-fakeMarginSize()*2); // } -// m_textSize=m_text->size(); if (itemMode() == DesignMode) initText(); + else if (adaptFontToSize()) initText(); + } bool TextItem::isNeedUpdateSize(RenderPass pass) const @@ -395,6 +495,17 @@ void TextItem::setAutoWidth(TextItem::AutoWidth value) } } +void TextItem::setAdaptFontToSize(bool value) +{ + if (m_adaptFontToSize!=value){ + bool oldValue = m_adaptFontToSize; + m_adaptFontToSize=value; + initText(); + invalidateRect(rect()); + notify("updateFontToSize",oldValue,value); + } +} + bool TextItem::canBeSplitted(int height) const { return height>(m_text->begin().layout()->lineAt(0).height()); @@ -409,8 +520,10 @@ BaseDesignIntf *TextItem::cloneUpperPart(int height, QObject *owner, QGraphicsIt for (QTextBlock it=m_text->begin();it!=m_text->end();it=it.next()){ for (int i=0;ilineCount();i++){ - linesHeight+=it.layout()->lineAt(i).height(); - if (linesHeight>(height-(fakeMarginSize()*2+borderLineSize()*2))) {linesHeight-=it.layout()->lineAt(i).height(); goto loop_exit;} + linesHeight+=it.layout()->lineAt(i).height()+lineSpacing(); + if (linesHeight>(height-(fakeMarginSize()*2+borderLineSize()*2))) { + linesHeight-=it.layout()->lineAt(i).height(); goto loop_exit; + } tmpText+=it.text().mid(it.layout()->lineAt(i).textStart(),it.layout()->lineAt(i).textLength())+'\n'; } } @@ -433,7 +546,7 @@ BaseDesignIntf *TextItem::cloneBottomPart(int height, QObject *owner, QGraphicsI for (curBlock=m_text->begin();curBlock!=m_text->end();curBlock=curBlock.next()){ for (curLine=0;curLinelineCount();curLine++){ - linesHeight+=curBlock.layout()->lineAt(curLine).height(); + linesHeight+=curBlock.layout()->lineAt(curLine).height()+lineSpacing(); if (linesHeight>(height-(fakeMarginSize()*2+borderLineSize()*2))) {goto loop_exit;} } } @@ -565,6 +678,16 @@ void TextItem::setForegroundOpacity(int value) } } +void TextItem::setUnderlines(bool value) +{ + if (m_underlines != value){ + bool oldValue = m_underlines; + m_underlines = value; + update(); + notify("underlines",oldValue,value); + } +} + } //namespace LimeReport diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index d95cb3c..d2243e7 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -56,7 +56,11 @@ class TextItem : public LimeReport::ContentItemDesignIntf { Q_PROPERTY(QColor fontColor READ fontColor WRITE setFontColorProperty) Q_PROPERTY(AngleType angle READ angle WRITE setAngle) Q_PROPERTY(int foregroundOpacity READ foregroundOpacity WRITE setForegroundOpacity) + Q_PROPERTY(bool underlines READ underlines WRITE setUnderlines) + Q_PROPERTY(bool adaptFontToSize READ adaptFontToSize WRITE setAdaptFontToSize) Q_PROPERTY(bool trimValue READ trimValue WRITE setTrimValue) + Q_PROPERTY(int lineSpacing READ lineSpacing WRITE setLineSpacing) + Q_PROPERTY(int underlineLineSize READ underlineLineSize WRITE setUnderlineLineSize) Q_PROPERTY(bool allowHTML READ allowHTML WRITE setAllowHTML) Q_PROPERTY(bool allowHTMLInFields READ allowHTMLInFields WRITE setAllowHTMLInFields) public: @@ -72,9 +76,6 @@ public: QString content() const; void setContent(const QString& value); - //void setMarginSize(int value); - - void setAlignment(Qt::Alignment value); Qt::Alignment alignment(){return m_alignment;} @@ -89,6 +90,9 @@ public: void setAutoWidth(AutoWidth value); AutoWidth autoWidth() const {return m_autoWidth;} + void setAdaptFontToSize(bool value); + bool adaptFontToSize() const {return m_adaptFontToSize;} + bool canBeSplitted(int height) const; bool isSplittable() const { return true;} bool isEmpty() const{return m_text->isEmpty();} @@ -108,10 +112,18 @@ public: void setAngle(const AngleType& value); int foregroundOpacity(){return m_foregroundOpacity;} void setForegroundOpacity(int value); + bool underlines(){return m_underlines;} + void setUnderlines(bool value); bool trimValue() const; void setTrimValue(bool trimValue); + int lineSpacing() const; + void setLineSpacing(int value); + + int underlineLineSize() const; + void setUnderlineLineSize(int value); + bool allowHTML() const; void setAllowHTML(bool allowHTML); @@ -126,6 +138,8 @@ protected: int fakeMarginSize(); private: void initText(); + void setTextFont(const QFont &value); + void adaptFontSize(); private: QString m_strText; @@ -137,7 +151,11 @@ private: QSizeF m_textSize; AngleType m_angle; int m_foregroundOpacity; + bool m_underlines; + bool m_adaptFontToSize; bool m_trimValue; + int m_lineSpacing; + int m_underlineLineSize; bool m_allowHTML; bool m_allowHTMLInFields; }; diff --git a/limereport/limereport.pri b/limereport/limereport.pri index 8b82707..db8b5ec 100644 --- a/limereport/limereport.pri +++ b/limereport/limereport.pri @@ -87,7 +87,8 @@ SOURCES += \ $$REPORT_PATH/lrgroupfunctions.cpp \ $$REPORT_PATH/lrsimplecrypt.cpp \ $$REPORT_PATH/lraboutdialog.cpp \ - $$REPORT_PATH/lrsettingdialog.cpp + $$REPORT_PATH/lrsettingdialog.cpp \ + $$REPORT_PATH/scriptbrowser/lrscriptbrowser.cpp contains(CONFIG, zint){ SOURCES += $$REPORT_PATH/items/lrbarcodeitem.cpp @@ -183,7 +184,8 @@ HEADERS += \ $$REPORT_PATH/lraboutdialog.h \ $$REPORT_PATH/lrcallbackdatasourceintf.h \ $$REPORT_PATH/lrsettingdialog.h \ - $$PWD/lrpreviewreportwidget_p.h + $$REPORT_PATH/lrpreviewreportwidget_p.h \ + $$REPORT_PATH/scriptbrowser/lrscriptbrowser.h \ contains(CONFIG,zint){ HEADERS += $$REPORT_PATH/items/lrbarcodeitem.h @@ -199,11 +201,13 @@ FORMS += \ $$REPORT_PATH/lrpreviewreportwidget.ui \ $$REPORT_PATH/items/lrtextitemeditor.ui \ $$REPORT_PATH/lraboutdialog.ui \ - $$REPORT_PATH/lrsettingdialog.ui + $$REPORT_PATH/lrsettingdialog.ui \ + $$REPORT_PATH/scriptbrowser/lrscriptbrowser.ui \ RESOURCES += \ $$REPORT_PATH/objectinspector/lobjectinspector.qrc \ $$REPORT_PATH/databrowser/lrdatabrowser.qrc \ $$REPORT_PATH/report.qrc \ - $$REPORT_PATH/items/items.qrc + $$REPORT_PATH/items/items.qrc \ + $$REPORT_PATH/scriptbrowser/lrscriptbrowser.qrc diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index fe6c139..879b4bc 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -681,6 +681,13 @@ void BandDesignIntf::initMode(ItemMode mode) BaseDesignIntf::initMode(mode); if ((mode==PreviewMode)||(mode==PrintMode)){ m_bandMarker->setVisible(false); + } else { + if (!m_bandMarker->scene() && this->scene()){ + this->scene()->addItem(m_bandMarker); + m_bandMarker->setParentItem(this->parentItem()); + m_bandMarker->setHeight(this->height()); + } + m_bandMarker->setVisible(true); } } diff --git a/limereport/lrdatasourcemanager.h b/limereport/lrdatasourcemanager.h index 494ec20..08d11cb 100644 --- a/limereport/lrdatasourcemanager.h +++ b/limereport/lrdatasourcemanager.h @@ -74,8 +74,8 @@ class DataSourceModel : public QAbstractItemModel{ public: DataSourceModel():m_rootNode(new DataNode()){} DataSourceModel(DataSourceManager* dataManager); - QModelIndex index(int row, int column, const QModelIndex &parent) const; ~DataSourceModel(); + QModelIndex index(int row, int column, const QModelIndex &parent) const; QModelIndex parent(const QModelIndex &child) const; int rowCount(const QModelIndex &parent) const; int columnCount(const QModelIndex &parent) const; diff --git a/limereport/lrgraphicsviewzoom.cpp b/limereport/lrgraphicsviewzoom.cpp index 8676f22..89ae87e 100644 --- a/limereport/lrgraphicsviewzoom.cpp +++ b/limereport/lrgraphicsviewzoom.cpp @@ -29,7 +29,17 @@ void GraphicsViewZoomer::setModifiers(Qt::KeyboardModifiers modifiers) { } void GraphicsViewZoomer::setZoomFactorBase(double value) { - m_zoomFactorBase = value; + m_zoomFactorBase = value; +} + +void GraphicsViewZoomer::setView(QGraphicsView *view) +{ + if (m_view!=view){ + m_view->viewport()->removeEventFilter(this); + m_view = view; + m_view->viewport()->installEventFilter(this); + m_view->setMouseTracking(true); + } } bool GraphicsViewZoomer::eventFilter(QObject *object, QEvent *event) { diff --git a/limereport/lrgraphicsviewzoom.h b/limereport/lrgraphicsviewzoom.h index d9f1720..e1f6d49 100644 --- a/limereport/lrgraphicsviewzoom.h +++ b/limereport/lrgraphicsviewzoom.h @@ -13,6 +13,7 @@ public: void gentleZoom(double factor); void setModifiers(Qt::KeyboardModifiers modifiers); void setZoomFactorBase(double value); + void setView(QGraphicsView* view); private: QGraphicsView* m_view; Qt::KeyboardModifiers m_modifiers; diff --git a/limereport/lrpagedesignintf.h b/limereport/lrpagedesignintf.h index 5dd36d4..b182a36 100644 --- a/limereport/lrpagedesignintf.h +++ b/limereport/lrpagedesignintf.h @@ -123,6 +123,7 @@ namespace LimeReport { PageItemDesignIntf *pageItem(); void setPageItem(PageItemDesignIntf::Ptr pageItem); void setPageItems(QList pages); + QList pageItems(){return m_reportPages;} bool isItemInsertMode(); ReportEnginePrivate* reportEditor(); diff --git a/limereport/lrpageitemdesignintf.h b/limereport/lrpageitemdesignintf.h index 8632837..0f27de7 100644 --- a/limereport/lrpageitemdesignintf.h +++ b/limereport/lrpageitemdesignintf.h @@ -139,5 +139,8 @@ private: bool m_fullPage; bool m_oldPrintMode; }; + +typedef QList ReportPages; + } #endif // LRPAGEITEM_H diff --git a/limereport/lrpreviewreportwindow.cpp b/limereport/lrpreviewreportwindow.cpp index 441b77a..f4adbde 100644 --- a/limereport/lrpreviewreportwindow.cpp +++ b/limereport/lrpreviewreportwindow.cpp @@ -61,12 +61,25 @@ PreviewReportWindow::PreviewReportWindow(ReportEnginePrivate *report,QWidget *pa setCentralWidget(m_previewReportWidget); layout()->setContentsMargins(1,1,1,1); connect(m_previewReportWidget,SIGNAL(pageChanged(int)), this,SLOT(slotPageChanged(int)) ); + connect(m_previewReportWidget->d_ptr->m_previewPage,SIGNAL(selectionChanged()),this,SLOT(slotSelectionChanged())); + connect(m_pagesNavigator,SIGNAL(valueChanged(int)),this,SLOT(slotPageNavigatorChanged(int))); + m_fontEditor = new FontEditorWidget(m_previewReportWidget->d_ptr->m_previewPage,tr("Font"),this); + m_fontEditor->setObjectName("fontTools"); + m_fontEditor->setIconSize(ui->toolBar->iconSize()); + m_textAlignmentEditor = new TextAlignmentEditorWidget(m_previewReportWidget->d_ptr->m_previewPage,tr("Text align"),this); + m_textAlignmentEditor->setObjectName("textAlignmentTools"); + m_textAlignmentEditor->setIconSize(ui->toolBar->iconSize()); + addToolBar(Qt::TopToolBarArea,m_fontEditor); + addToolBar(Qt::TopToolBarArea,m_textAlignmentEditor); m_scalePercent = new QComboBox(this); m_scalePercent->setEditable(true); ui->toolBar->insertWidget(ui->actionZoomOut, m_scalePercent); initPercentCombobox(); + +// connect(ui->graphicsView->verticalScrollBar(),SIGNAL(valueChanged(int)), this, SLOT(slotSliderMoved(int))); + connect(ui->actionShowMessages, SIGNAL(triggered()), this, SLOT(slotShowErrors())); connect(m_previewReportWidget, SIGNAL(scalePercentChanged(int)), this, SLOT(slotScalePercentChanged(int))); connect(m_scalePercent, SIGNAL(currentIndexChanged(QString)), this, SLOT(scaleComboboxChanged(QString))); restoreSetting(); @@ -209,6 +222,12 @@ void PreviewReportWindow::moveEvent(QMoveEvent* e) #endif } +void PreviewReportWindow::showEvent(QShowEvent *) +{ + m_fontEditor->setVisible(ui->actionEdit_Mode->isChecked()); + m_textAlignmentEditor->setVisible(ui->actionEdit_Mode->isChecked()); +} + void PreviewReportWindow::slotPrint() { m_previewReportWidget->print(); @@ -244,6 +263,28 @@ void PreviewReportWindow::slotShowErrors() m_previewReportWidget->setErrorsMesagesVisible(ui->actionShowMessages->isChecked()); } +void PreviewReportWindow::on_actionEdit_Mode_triggered(bool checked) +{ + m_previewReportWidget->d_ptr->m_previewPage->setItemMode((checked)?ItemModes(DesignMode):PreviewMode); + m_textAlignmentEditor->setVisible(checked); + m_fontEditor->setVisible(checked); + //m_reportPages.at(m_currentPage)->setItemMode((checked)?DesignMode:PreviewMode); +} + +void PreviewReportWindow::slotSelectionChanged() +{ + QGraphicsScene* page=dynamic_cast(sender()); + if (page){ + if (page->selectedItems().count()==1){ + BaseDesignIntf* item = dynamic_cast(page->selectedItems().at(0)); + if (item) { + m_fontEditor->setItem(item); + m_textAlignmentEditor->setItem(item); + } + } + } +} + ItemsReaderIntf *PreviewReportWindow::reader() { return m_reader.data(); @@ -312,4 +353,4 @@ void PreviewReportWindow::on_actionShowMessages_toggled(bool value) m_previewReportWidget->setErrorsMesagesVisible(value); } -}// namespace LimeReport \ No newline at end of file +}// namespace LimeReport diff --git a/limereport/lrpreviewreportwindow.h b/limereport/lrpreviewreportwindow.h index 995810c..dbc6995 100644 --- a/limereport/lrpreviewreportwindow.h +++ b/limereport/lrpreviewreportwindow.h @@ -41,6 +41,9 @@ #include "serializators/lrxmlreader.h" #include "lrpreviewreportwidget.h" +#include "items/editors/lrfonteditorwidget.h" +#include "items/editors/lrtextalignmenteditorwidget.h" + namespace LimeReport { namespace Ui { @@ -66,6 +69,7 @@ protected: void closeEvent(QCloseEvent *); void resizeEvent(QResizeEvent *e); void moveEvent(QMoveEvent *e); + void showEvent(QShowEvent *); public slots: void slotPrint(); void slotPriorPage(); @@ -75,6 +79,8 @@ public slots: void slotPageNavigatorChanged(int value); void slotShowErrors(); void on_actionSaveToFile_triggered(); + void slotSelectionChanged(); + void on_actionEdit_Mode_triggered(bool checked); void slotFirstPage(); void slotLastPage(); void slotPrintToPDF(); @@ -90,8 +96,6 @@ private slots: private: ItemsReaderIntf* reader(); void initPercentCombobox(); - //bool pageIsVisible(PageItemDesignIntf::Ptr page); - //QRectF calcPageShift(PageItemDesignIntf::Ptr page); private: Ui::PreviewReportWindow *ui; QSpinBox* m_pagesNavigator; @@ -100,6 +104,9 @@ private: bool m_changingPage; QSettings* m_settings; bool m_ownedSettings; + FontEditorWidget* m_fontEditor; + TextAlignmentEditorWidget* m_textAlignmentEditor; + int m_priorScrolValue; PreviewReportWidget* m_previewReportWidget; QComboBox* m_scalePercent; }; diff --git a/limereport/lrpreviewreportwindow.ui b/limereport/lrpreviewreportwindow.ui index 7618999..816ea1f 100644 --- a/limereport/lrpreviewreportwindow.ui +++ b/limereport/lrpreviewreportwindow.ui @@ -73,6 +73,8 @@ false + + diff --git a/limereport/lrreportdesignwidget.cpp b/limereport/lrreportdesignwidget.cpp index bdaab42..a7afece 100644 --- a/limereport/lrreportdesignwidget.cpp +++ b/limereport/lrreportdesignwidget.cpp @@ -41,6 +41,8 @@ #include #include #include +#include +#include namespace LimeReport { @@ -49,11 +51,10 @@ namespace LimeReport { ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow *mainWindow, QWidget *parent) : QWidget(parent), m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false) { - QVBoxLayout *mainLayout = new QVBoxLayout(this); - mainLayout->setContentsMargins(1,1,1,1); - m_view = new QGraphicsView(qobject_cast(this)); - m_view->setBackgroundBrush(QBrush(Qt::gray)); - mainLayout->addWidget(m_view); + m_tabWidget = new QTabWidget(this); + m_tabWidget->setTabPosition(QTabWidget::South); + QVBoxLayout* mainLayout = new QVBoxLayout(this); + mainLayout->addWidget(m_tabWidget); setLayout(mainLayout); if (!report) { @@ -66,16 +67,15 @@ ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow if (!m_report->pageCount()) m_report->appendPage("page1"); } - setActivePage(m_report->pageAt(0)); - foreach(QGraphicsItem* item, activePage()->selectedItems()){ - item->setSelected(false); - } + createTabs(); + connect(m_report,SIGNAL(pagesLoadFinished()),this,SLOT(slotPagesLoadFinished())); connect(m_report,SIGNAL(cleared()),this,SIGNAL(cleared())); - m_view->scale(0.5,0.5); + connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentTabChanged(int))); + //m_instance=this; - //m_view->viewport()->installEventFilter(this); - m_zoomer = new GraphicsViewZoomer(m_view); + m_scriptEditor->setPlainText(report->scriptContext()->initScript()); + m_zoomer = new GraphicsViewZoomer(activeView()); #ifdef Q_OS_WIN m_defaultFont = QFont("Arial",10); #endif @@ -133,20 +133,43 @@ void ReportDesignWidget::loadState(QSettings* settings) if (v.isValid()){ m_useGrid = v.toBool(); } - settings->endGroup(); - applySettings(); } + +void ReportDesignWidget::createTabs(){ + for (int i = 0; ipageCount();++i){ + QGraphicsView* view = new QGraphicsView(qobject_cast(this)); + view->setBackgroundBrush(QBrush(Qt::gray)); + view->setFrameShape(QFrame::NoFrame); + view->setScene(m_report->pageAt(i)); + + foreach(QGraphicsItem* item, m_report->pageAt(i)->selectedItems()){ + item->setSelected(false); + } + + view->centerOn(0,0); + view->scale(0.5,0.5); + connectPage(m_report->pageAt(i)); + m_tabWidget->addTab(view,QIcon(),tr("Page")+QString::number(i+1)); + } + m_scriptEditor = new QTextEdit(this); + m_tabWidget->addTab(m_scriptEditor,QIcon(),tr("Script")); + m_tabWidget->setCurrentIndex(0); +} + ReportDesignWidget::~ReportDesignWidget() { delete m_zoomer; } -void ReportDesignWidget::setActivePage(PageDesignIntf *page) +QGraphicsView* ReportDesignWidget::activeView(){ + return dynamic_cast(m_tabWidget->currentWidget()); +} + +void ReportDesignWidget::connectPage(PageDesignIntf *page) { - m_view->setScene(page); connect(page,SIGNAL(itemInserted(LimeReport::PageDesignIntf*,QPointF,QString)),this,SIGNAL(itemInserted(LimeReport::PageDesignIntf*,QPointF,QString))); connect(page,SIGNAL(itemInsertCanceled(QString)),this,SIGNAL(itemInsertCanceled(QString))); connect(page,SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)),this,SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant))); @@ -166,48 +189,55 @@ void ReportDesignWidget::setActivePage(PageDesignIntf *page) connect(page, SIGNAL(pageUpdateFinished(LimeReport::PageDesignIntf*)), this, SIGNAL(activePageUpdated(LimeReport::PageDesignIntf*))); - m_view->centerOn(0, 0); + //activeView()->centerOn(0,0); emit activePageChanged(); } void ReportDesignWidget::createStartPage() { - PageDesignIntf* reportPage = m_report->appendPage("page1"); - setActivePage(reportPage); + m_report->appendPage("page1"); + createTabs(); } void ReportDesignWidget::removeDatasource(const QString &datasourceName) { - m_report->dataManager()->removeDatasource(datasourceName); + if (m_report->dataManager()) + m_report->dataManager()->removeDatasource(datasourceName); } void ReportDesignWidget::addBand(const QString &bandType) { - activePage()->addBand(bandType); + if (activePage()) + activePage()->addBand(bandType); } void ReportDesignWidget::addBand(BandDesignIntf::BandsType bandType) { - activePage()->addBand(bandType); + if (activePage()) + activePage()->addBand(bandType); } void ReportDesignWidget::startInsertMode(const QString &itemType) { - activePage()->startInsertMode(itemType); + if (activePage()) + activePage()->startInsertMode(itemType); } void ReportDesignWidget::startEditMode() { - activePage()->startEditMode(); + if (activePage()) + activePage()->startEditMode(); } PageDesignIntf * ReportDesignWidget::activePage() { - return qobject_cast(m_view->scene()); + if (activeView()) + return qobject_cast(activeView()->scene()); + return 0; } QList ReportDesignWidget::selectedItems(){ - return m_view->scene()->selectedItems(); + return activePage()->selectedItems(); } void ReportDesignWidget::deleteItem(QGraphicsItem *item){ @@ -227,11 +257,13 @@ void ReportDesignWidget::slotItemSelected(BaseDesignIntf *item){ } void ReportDesignWidget::saveToFile(const QString &fileName){ + m_report->scriptContext()->setInitScript(m_scriptEditor->toPlainText()); m_report->saveToFile(fileName); } bool ReportDesignWidget::save() { + m_report->scriptContext()->setInitScript(m_scriptEditor->toPlainText()); if (!m_report->reportFileName().isEmpty()){ if (m_report->saveToFile()){ m_report->emitSaveFinished(); @@ -254,24 +286,36 @@ bool ReportDesignWidget::save() bool ReportDesignWidget::loadFromFile(const QString &fileName) { - if (!m_report->loadFromFile(fileName)) return false; - setActivePage(m_report->pageAt(0)); - return true; + if (m_report->loadFromFile(fileName)){ + createTabs(); + //connectPage(m_report->pageAt(0)); + m_scriptEditor->setPlainText(m_report->scriptContext()->initScript()); + emit loaded(); + return true; + } else { + QMessageBox::critical(this,tr("Error"),tr("Wrong file format")); + return false; + } } void ReportDesignWidget::scale(qreal sx, qreal sy) { - m_view->scale(sx,sy); + //m_view->scale(sx,sy); + if (activeView()) activeView()->scale(sx,sy); } QString ReportDesignWidget::reportFileName() { - return m_report->reportFileName(); + if (m_report) + return m_report->reportFileName(); + return QString(); } bool ReportDesignWidget::isNeedToSave() { - return m_report->isNeedToSave(); + if(m_report) + return m_report->isNeedToSave(); + return false; } bool ReportDesignWidget::emitLoadReport() @@ -281,82 +325,98 @@ bool ReportDesignWidget::emitLoadReport() void ReportDesignWidget::updateSize() { - activePage()->slotUpdateItemSize(); + if (activePage()) + activePage()->slotUpdateItemSize(); } void ReportDesignWidget::undo() { - activePage()->undo(); + if (activePage()) + activePage()->undo(); } void ReportDesignWidget::redo() { - activePage()->redo(); + if (activePage()) + activePage()->redo(); } void ReportDesignWidget::copy() { - activePage()->copy(); + if (activePage()) + activePage()->copy(); } void ReportDesignWidget::paste() { - activePage()->paste(); + if (activePage()) + activePage()->paste(); } void ReportDesignWidget::cut() { - activePage()->cut(); + if (activePage()) + activePage()->cut(); } void ReportDesignWidget::brinToFront() { - activePage()->bringToFront(); + if (activePage()) + activePage()->bringToFront(); } void ReportDesignWidget::sendToBack() { - activePage()->sendToBack(); + if (activePage()) + activePage()->sendToBack(); } void ReportDesignWidget::alignToLeft() { - activePage()->alignToLeft(); + if (activePage()) + activePage()->alignToLeft(); } void ReportDesignWidget::alignToRight() { - activePage()->alignToRigth(); + if (activePage()) + activePage()->alignToRigth(); } void ReportDesignWidget::alignToVCenter() { - activePage()->alignToVCenter(); + if (activePage()) + activePage()->alignToVCenter(); } void ReportDesignWidget::alignToTop() { - activePage()->alignToTop(); + if (activePage()) + activePage()->alignToTop(); } void ReportDesignWidget::alignToBottom() { - activePage()->alignToBottom(); + if (activePage()) + activePage()->alignToBottom(); } void ReportDesignWidget::alignToHCenter() { - activePage()->alignToHCenter(); + if (activePage()) + activePage()->alignToHCenter(); } void ReportDesignWidget::sameHeight() { - activePage()->sameHeight(); + if (activePage()) + activePage()->sameHeight(); } void ReportDesignWidget::sameWidth() { - activePage()->sameWidth(); + if (activePage()) + activePage()->sameWidth(); } void ReportDesignWidget::editLayoutMode(bool value) @@ -370,22 +430,74 @@ void ReportDesignWidget::editLayoutMode(bool value) void ReportDesignWidget::addHLayout() { - activePage()->addHLayout(); + if (activePage()) + activePage()->addHLayout(); } void ReportDesignWidget::setFont(const QFont& font) { - activePage()->setFont(font); + if (activePage()) + activePage()->setFont(font); } void ReportDesignWidget::setTextAlign(const bool& horizontalAlign, const Qt::AlignmentFlag& alignment) { - activePage()->changeSelectedGrpoupTextAlignPropperty(horizontalAlign, alignment); + if (activePage()) + activePage()->changeSelectedGrpoupTextAlignPropperty(horizontalAlign, alignment); } void ReportDesignWidget::setBorders(const BaseDesignIntf::BorderLines& borders) { - activePage()->setBorders(borders); + if (activePage()) + activePage()->setBorders(borders); +} + +void ReportDesignWidget::previewReport() +{ + report()->scriptContext()->setInitScript(m_scriptEditor->toPlainText()); + report()->previewReport(); +} + +void ReportDesignWidget::printReport() +{ + report()->scriptContext()->setInitScript(m_scriptEditor->toPlainText()); + setCursor(Qt::WaitCursor); + report()->printReport(); + setCursor(Qt::ArrowCursor); +} + +void ReportDesignWidget::addPage() +{ + QGraphicsView* view = new QGraphicsView(qobject_cast(this)); + view->setBackgroundBrush(QBrush(Qt::gray)); + view->setFrameShape(QFrame::NoFrame); + PageDesignIntf* page = m_report->appendPage("page"+QString::number(m_report->pageCount()+1)); + view->setScene(page); + int index = m_report->pageCount()-1; + m_tabWidget->insertTab(index,view,QIcon(),tr("Page")+QString::number(m_report->pageCount())); + m_tabWidget->setCurrentIndex(index); + connectPage(page); + view->scale(0.5,0.5); + view->centerOn(0,0); + emit pageAdded(page); +} + +void ReportDesignWidget::deleteCurrentPage() +{ + if (m_report->pageCount()>1){ + QGraphicsView* view = dynamic_cast(m_tabWidget->currentWidget()); + if (view){ + PageDesignIntf* page = dynamic_cast(view->scene()); + if (page){ + if (m_report->deletePage(page)){ + int index = m_tabWidget->currentIndex(); + m_tabWidget->removeTab(m_tabWidget->currentIndex()); + if (index>0) m_tabWidget->setCurrentIndex(index-1); + emit pageDeleted(); + } + } + } + } } void ReportDesignWidget::editSetting() @@ -421,12 +533,16 @@ void ReportDesignWidget::setUseGrid(bool value) bool ReportDesignWidget::isCanUndo() { - return activePage()->isCanUndo(); + if (activePage()) + return activePage()->isCanUndo(); + return false; } bool ReportDesignWidget::isCanRedo() { - return activePage()->isCanRedo(); + if (activePage()) + return activePage()->isCanRedo(); + return false; } void ReportDesignWidget::slotSelectionChanged() @@ -449,10 +565,20 @@ DataSourceManager* ReportDesignWidget::dataManager() return m_report->dataManager(); } +ScriptEngineManager* ReportDesignWidget::scriptManager() +{ + return m_report->scriptManager(); +} + +ScriptEngineContext*ReportDesignWidget::scriptContext() +{ + return m_report->scriptContext(); +} + void ReportDesignWidget::slotPagesLoadFinished() { applySettings(); - setActivePage(m_report->pageAt(0)); + //setActivePage(m_report->pageAt(0)); emit loaded(); } @@ -462,7 +588,19 @@ void ReportDesignWidget::slotDatasourceCollectionLoaded(const QString & /*collec void ReportDesignWidget::slotSceneRectChanged(QRectF) { - m_view->centerOn(0,0); + if (activeView()) activeView()->centerOn(0,0); +} + +void ReportDesignWidget::slotCurrentTabChanged(int index) +{ + QGraphicsView* view = dynamic_cast(m_tabWidget->widget(index)); + if (view) { + if (view->scene()){ + foreach (QGraphicsItem* item, view->scene()->selectedItems()) item->setSelected(false); + } + m_zoomer->setView(view); + } + emit activePageChanged(); } bool ReportDesignWidget::eventFilter(QObject *target, QEvent *event) @@ -480,6 +618,10 @@ bool ReportDesignWidget::eventFilter(QObject *target, QEvent *event) void ReportDesignWidget::clear() { m_report->clearReport(); + m_tabWidget->clear(); + m_report->setReportFileName(""); + m_report->scriptContext()->setInitScript(""); + m_scriptEditor->setPlainText(""); } } diff --git a/limereport/lrreportdesignwidget.h b/limereport/lrreportdesignwidget.h index 8b807d4..28a1998 100644 --- a/limereport/lrreportdesignwidget.h +++ b/limereport/lrreportdesignwidget.h @@ -33,6 +33,7 @@ #include #include #include +#include #include "lrpagedesignintf.h" #include "lrdatadesignintf.h" @@ -59,6 +60,8 @@ public: void createStartPage(); void clear(); DataSourceManager* dataManager(); + ScriptEngineManager* scriptManager(); + ScriptEngineContext* scriptContext(); void removeDatasource(const QString& datasourceName); void addBand(const QString& bandType); void addBand(BandDesignIntf::BandsType bandType); @@ -69,6 +72,7 @@ public: bool isCanRedo(); void deleteItem(QGraphicsItem *item); PageDesignIntf* activePage(); + QGraphicsView* activeView(); QList selectedItems(); QStringList datasourcesNames(); void scale( qreal sx, qreal sy); @@ -90,7 +94,7 @@ public slots: bool save(); bool loadFromFile(const QString&); void deleteSelectedItems(); - void setActivePage(PageDesignIntf* page); + void connectPage(PageDesignIntf* page); void undo(); void redo(); void copy(); @@ -113,12 +117,17 @@ public slots: void setBorders(const BaseDesignIntf::BorderLines& borders); void editSetting(); void setUseGrid(bool value); + void previewReport(); + void printReport(); + void addPage(); + void deleteCurrentPage(); private slots: void slotItemSelected(LimeReport::BaseDesignIntf *item); void slotSelectionChanged(); void slotPagesLoadFinished(); void slotDatasourceCollectionLoaded(const QString&); void slotSceneRectChanged(QRectF); + void slotCurrentTabChanged(int index); signals: void insertModeStarted(); void itemInserted(LimeReport::PageDesignIntf*,QPointF,const QString&); @@ -135,13 +144,19 @@ signals: void bandDeleted(LimeReport::PageDesignIntf*, LimeReport::BandDesignIntf*); void itemAdded(LimeReport::PageDesignIntf*, LimeReport::BaseDesignIntf*); void itemDeleted(LimeReport::PageDesignIntf*, LimeReport::BaseDesignIntf*); + void pageAdded(PageDesignIntf* page); + void pageDeleted(); +protected: + void createTabs(); private: bool eventFilter(QObject *target, QEvent *event); ReportDesignWidget(ReportEnginePrivate* report,QMainWindow *mainWindow,QWidget *parent = 0); private: ReportEnginePrivate* m_report; QGraphicsView *m_view; + QTextEdit* m_scriptEditor; QMainWindow *m_mainWindow; + QTabWidget* m_tabWidget; GraphicsViewZoomer* m_zoomer; QFont m_defaultFont; int m_verticalGridStep; diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index b0ebae7..b7a6d0b 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -47,6 +47,7 @@ #include "lrbasedesignobjectmodel.h" #include "lrreportdesignwidget.h" #include "lrdatabrowser.h" +#include "scriptbrowser/lrscriptbrowser.h" #include "lrbasedesignintf.h" #include "lrpagedesignintf.h" @@ -70,6 +71,7 @@ ReportDesignWindow::ReportDesignWindow(ReportEnginePrivate *report, QWidget *par createToolBars(); createObjectInspector(); createDataWindow(); + createScriptWindow(); createObjectsBrowser(); m_instance=this; m_statusBar=new QStatusBar(this); @@ -96,6 +98,15 @@ void ReportDesignWindow::createActions() m_newReportAction->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_N)); connect(m_newReportAction,SIGNAL(triggered()),this,SLOT(slotNewReport())); + m_newPageAction = new QAction(tr("New Report Page"),this); + m_newPageAction->setIcon(QIcon(":/report/images/addPage")); + connect(m_newPageAction,SIGNAL(triggered()),this,SLOT(slotNewPage())); + + m_deletePageAction = new QAction(tr("Delete Report Page"),this); + m_deletePageAction->setIcon(QIcon(":/report/images/deletePage")); + connect(m_deletePageAction,SIGNAL(triggered()),this,SLOT(slotDeletePage())); + m_deletePageAction->setEnabled(false); + m_editModeAction = new QAction(tr("Edit Mode"),this); m_editModeAction->setIcon(QIcon(":/report/images/editMode")); m_editModeAction->setCheckable(true); @@ -261,6 +272,10 @@ void ReportDesignWindow::createToolBars() m_mainToolBar->addAction(m_settingsAction); m_mainToolBar->addSeparator(); + m_mainToolBar->addAction(m_newPageAction); + m_mainToolBar->addAction(m_deletePageAction); + m_mainToolBar->addSeparator(); + m_mainToolBar->addAction(m_copyAction); m_mainToolBar->addAction(m_pasteAction); m_mainToolBar->addAction(m_cutAction); @@ -421,18 +436,18 @@ void ReportDesignWindow::initReportEditor(ReportEnginePrivate* report) { m_reportDesignWidget=new ReportDesignWidget(report,this,this); setCentralWidget(m_reportDesignWidget); - connect(m_reportDesignWidget, SIGNAL(itemSelected(LimeReport::BaseDesignIntf*)), - this, SLOT(slotItemSelected(LimeReport::BaseDesignIntf*))); - connect(m_reportDesignWidget, SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)), - this, SLOT(slotItemPropertyChanged(QString,QString,QVariant,QVariant))); - connect(m_reportDesignWidget, SIGNAL(insertModeStarted()), this, SLOT(slotInsertModeStarted())); - - connect(m_reportDesignWidget, SIGNAL(multiItemSelected()), this, SLOT(slotMultiItemSelected())); - connect(m_reportDesignWidget, SIGNAL(itemInserted(LimeReport::PageDesignIntf*,QPointF,QString)), - this, SLOT(slotItemInserted(LimeReport::PageDesignIntf*,QPointF,QString))); - connect(m_reportDesignWidget, SIGNAL(itemInsertCanceled(QString)), this, SLOT(slotItemInsertCanceled(QString))); - connect(m_reportDesignWidget->report(),SIGNAL(datasourceCollectionLoadFinished(QString)), this, SLOT(slotUpdateDataBrowser(QString))); - connect(m_reportDesignWidget, SIGNAL(commandHistoryChanged()),this,SLOT(slotCommandHistoryChanged())); + connect(m_reportDesignWidget,SIGNAL(itemSelected(LimeReport::BaseDesignIntf*)), + this,SLOT(slotItemSelected(LimeReport::BaseDesignIntf*))); + connect(m_reportDesignWidget,SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)), + this,SLOT(slotItemPropertyChanged(QString,QString,QVariant,QVariant))); + connect(m_reportDesignWidget,SIGNAL(insertModeStarted()),this,SLOT(slotInsertModeStarted())); + connect(m_reportDesignWidget,SIGNAL(multiItemSelected()),this,SLOT(slotMultiItemSelected())); + connect(m_reportDesignWidget,SIGNAL(itemInserted(LimeReport::PageDesignIntf*,QPointF,QString)), + this,SLOT(slotItemInserted(LimeReport::PageDesignIntf*,QPointF,QString))); + connect(m_reportDesignWidget,SIGNAL(itemInsertCanceled(QString)),this,SLOT(slotItemInsertCanceled(QString))); + connect(m_reportDesignWidget->report(),SIGNAL(datasourceCollectionLoadFinished(QString)),this,SLOT(slotUpdateDataBrowser(QString))); + connect(m_reportDesignWidget,SIGNAL(commandHistoryChanged()),this,SLOT(slotCommandHistoryChanged())); + connect(m_reportDesignWidget,SIGNAL(activePageChanged()),this,SLOT(slotActivePageChanged())); connect(m_reportDesignWidget, SIGNAL(bandAdded(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)), this, SLOT(slotBandAdded(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*))); connect(m_reportDesignWidget, SIGNAL(bandDeleted(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)), @@ -440,6 +455,8 @@ void ReportDesignWindow::initReportEditor(ReportEnginePrivate* report) connect(m_reportDesignWidget->report(), SIGNAL(renderStarted()), this, SLOT(renderStarted())); connect(m_reportDesignWidget->report(), SIGNAL(renderPageFinished(int)), this, SLOT(renderPageFinished(int))); connect(m_reportDesignWidget->report(), SIGNAL(renderFinished()), this, SLOT(renderFinished())); + connect(m_reportDesignWidget, SIGNAL(pageAdded(PageDesignIntf*)), this, SLOT(slotPageAdded(PageDesignIntf*))); + connect(m_reportDesignWidget, SIGNAL(pageDeleted()), this, SLOT(slotPageDeleted())); } void ReportDesignWindow::createObjectInspector() @@ -491,6 +508,20 @@ void ReportDesignWindow::createDataWindow() m_dataBrowser->setReportEditor(m_reportDesignWidget); } +void ReportDesignWindow::createScriptWindow() +{ + QDockWidget *dataDoc = new QDockWidget(this); + dataDoc->setWindowTitle(tr("Script Browser")); + m_scriptBrowser=new ScriptBrowser(dataDoc); + dataDoc->setWidget(m_scriptBrowser); + dataDoc->setObjectName("scriptDoc"); + addDockWidget(Qt::LeftDockWidgetArea,dataDoc); + m_scriptBrowser->setReportEditor(m_reportDesignWidget); +#ifdef HAVE_UI_LOADER + m_scriptBrowser->updateDialogsTree(); +#endif +} + void ReportDesignWindow::updateRedoUndo() { m_undoAction->setEnabled(m_reportDesignWidget->isCanUndo()); @@ -701,7 +732,24 @@ QSettings*ReportDesignWindow::settings() void ReportDesignWindow::slotNewReport() { - if (checkNeedToSave()) startNewReport(); + if (checkNeedToSave()) { + m_lblReportName->setText(""); + startNewReport(); + m_deletePageAction->setEnabled(false); + } +} + +void ReportDesignWindow::slotNewPage(){ + if (m_reportDesignWidget){ + m_reportDesignWidget->addPage(); + } +} + +void ReportDesignWindow::slotDeletePage() +{ + if (m_reportDesignWidget && m_reportDesignWidget->report()->pageCount()>1){ + m_reportDesignWidget->deleteCurrentPage(); + } } void ReportDesignWindow::slotNewTextItem() @@ -872,12 +920,32 @@ void ReportDesignWindow::slotLoadReport() QApplication::processEvents(); setCursor(Qt::WaitCursor); m_reportDesignWidget->clear(); - m_reportDesignWidget->loadFromFile(fileName); - m_lblReportName->setText(fileName); - m_propertyModel->setObject(0); - updateRedoUndo(); + if (m_reportDesignWidget->loadFromFile(fileName)){ + 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(); + QDateTime minDate = QDateTime::currentDateTime(); + while (it != m_recentFiles.constEnd()) { + if (minDate>it.value()) minDate = it.value(); + ++it; + } + m_recentFiles.remove(m_recentFiles.key(minDate)); + } + m_recentFiles.insert(fileName,QDateTime::currentDateTime()); + } else { + m_recentFiles[fileName] = QDateTime::currentDateTime(); + } + createRecentFilesMenu(); + m_deletePageAction->setEnabled(m_reportDesignWidget->report()->pageCount()>1); + } else { + slotNewReport(); + } unsetCursor(); - setWindowTitle(m_reportDesignWidget->report()->reportName() + " - Lime Report Designer"); + setWindowTitle(m_reportDesignWidget->report()->reportName() + " - Lime Report Designer"); addRecentFile(fileName); } } @@ -951,13 +1019,13 @@ void ReportDesignWindow::slotTest() void ReportDesignWindow::slotPrintReport() { setCursor(Qt::WaitCursor); - m_reportDesignWidget->report()->printReport(); + m_reportDesignWidget->printReport(); setCursor(Qt::ArrowCursor); } void ReportDesignWindow::slotPreviewReport() { - m_reportDesignWidget->report()->previewReport(); + m_reportDesignWidget->previewReport(); } void ReportDesignWindow::slotItemActionCliked() @@ -1010,6 +1078,12 @@ void ReportDesignWindow::slotBandDeleted(PageDesignIntf *, BandDesignIntf *band) } } +void ReportDesignWindow::slotActivePageChanged() +{ + m_propertyModel->setObject(0); + updateRedoUndo(); +} + void ReportDesignWindow::renderStarted() { if (m_showProgressDialog){ @@ -1104,6 +1178,16 @@ void ReportDesignWindow::slotLoadRecentFile(const QString fileName) } } +void ReportDesignWindow::slotPageAdded(PageDesignIntf *page) +{ + m_deletePageAction->setEnabled(m_reportDesignWidget->report()->pageCount()>1); +} + +void ReportDesignWindow::slotPageDeleted() +{ + m_deletePageAction->setEnabled(m_reportDesignWidget->report()->pageCount()>1); +} + void ReportDesignWindow::closeEvent(QCloseEvent * event) { if (checkNeedToSave()){ diff --git a/limereport/lrreportdesignwindow.h b/limereport/lrreportdesignwindow.h index d70f4a9..474d212 100644 --- a/limereport/lrreportdesignwindow.h +++ b/limereport/lrreportdesignwindow.h @@ -50,6 +50,7 @@ class ObjectInspectorWidget; class QObjectPropertyModel; class ReportDesignWidget; class DataBrowser; +class ScriptBrowser; class BaseDesignIntf; class PageDesignIntf; class ObjectBrowser; @@ -72,6 +73,8 @@ public: private slots: void slotNewReport(); + void slotNewPage(); + void slotDeletePage(); void slotNewTextItem(); void slotNewBand(const QString& bandType); void slotNewBand(int bandType); @@ -103,6 +106,7 @@ private slots: void slotItemActionCliked(); void slotBandAdded(LimeReport::PageDesignIntf*, LimeReport::BandDesignIntf*band); void slotBandDeleted(LimeReport::PageDesignIntf*, LimeReport::BandDesignIntf*band); + void slotActivePageChanged(); void renderStarted(); void renderPageFinished(int renderedPageCount); void renderFinished(); @@ -113,6 +117,8 @@ private slots: void slotUseGrid(bool value); void slotUseMagnet(bool value); void slotLoadRecentFile(const QString fileName); + void slotPageAdded(PageDesignIntf* page); + void slotPageDeleted(); protected: void closeEvent(QCloseEvent *event); void resizeEvent(QResizeEvent *); @@ -130,6 +136,7 @@ private: void createObjectsBrowser(); void initReportEditor(ReportEnginePrivate* report); void createDataWindow(); + void createScriptWindow(); void updateRedoUndo(); void startNewReport(); void writePosition(); @@ -174,6 +181,8 @@ private: QAction* m_settingsAction; QAction* m_useGridAction; QAction* m_useMagnetAction; + QAction* m_newPageAction; + QAction* m_deletePageAction; QAction* m_newPageHeader; QAction* m_newPageFooter; @@ -202,6 +211,7 @@ private: ReportDesignWidget* m_reportDesignWidget; DataBrowser * m_dataBrowser; + ScriptBrowser* m_scriptBrowser; ObjectBrowser* m_objectsBrowser; diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 7a63217..aaf8dfa 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -61,6 +61,7 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) : m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")) { m_datasources= new DataSourceManager(this); + m_scriptEngineContext = new ScriptEngineContext(this); m_datasources->setObjectName("datasources"); connect(m_datasources,SIGNAL(loadCollectionFinished(QString)),this,SLOT(slotDataSourceCollectionLoaded(QString))); } @@ -103,6 +104,17 @@ PageDesignIntf *ReportEnginePrivate::appendPage(const QString &pageName) return page; } +bool ReportEnginePrivate::deletePage(PageDesignIntf *page){ + QList::iterator it = m_pages.begin(); + while (it != m_pages.end()){ + if (*it == page) { + it = m_pages.erase(it); + return true; + } else ++it; + } + return false; +} + PageDesignIntf *ReportEnginePrivate::createPreviewPage() { return createPage(); @@ -152,6 +164,7 @@ void ReportEnginePrivate::clearReport() m_pages.clear(); m_datasources->clear(DataSourceManager::Owned); m_fileName=""; + m_scriptEngineContext->clear(); emit cleared(); } @@ -261,9 +274,44 @@ bool ReportEnginePrivate::printReport(QPrinter* printer) printer =(printer)?printer:m_printer.data(); if (printer&&printer->isValid()){ try{ - dataManager()->setDesignTime(false); - printReport(renderToPages(),*printer,PrintRange()); + dataManager()->setDesignTime(false); + ReportPages pages = renderToPages(); dataManager()->setDesignTime(true); + if (pages.count()>0){ + printReport(pages,*printer,PrintRange()); + } + } catch(ReportError &exception){ + saveError(exception.what()); + } + return true; + } else return false; +} + +bool ReportEnginePrivate::printPages(ReportPages pages, QPrinter *printer, PrintRange printRange) +{ + + if (!printer&&!m_printerSelected){ + QPrintDialog dialog(m_printer.data(),QApplication::activeWindow()); + m_printerSelected = dialog.exec()!=QDialog::Rejected; + if (m_printerSelected){ + printRange.setRangeType(dialog.printRange()); + printRange.setFromPage(dialog.fromPage()); + printRange.setToPage(dialog.toPage()); + } + + } + if (!printer&&!m_printerSelected) return false; + + printer =(printer)?printer:m_printer.data(); + if (printer&&printer->isValid()){ + try{ + if (pages.count()>0){ + printReport( + pages, + *printer, + printRange + ); + } } catch(ReportError &exception){ saveError(exception.what()); } @@ -401,6 +449,11 @@ void ReportEnginePrivate::cancelRender() m_reportRender->cancelRender(); } +PageDesignIntf* ReportEngine::createPreviewScene(QObject* parent){ + Q_D(ReportEngine); + return d->createPreviewScene(parent); +} + void ReportEnginePrivate::designReport() { if (!m_designerWindow) { @@ -456,7 +509,8 @@ bool ReportEnginePrivate::loadFromFile(const QString &fileName) dataManager()->connectAutoConnections(); return true; }; - } + } + m_lastError = reader->lastError(); return false; } @@ -555,6 +609,7 @@ QString ReportEnginePrivate::renderToString() dataManager()->setDesignTime(false); if (m_pages.count()){ render.setDatasources(dataManager()); + render.setScriptContext(scriptContext()); return render.renderPageToString(m_pages.at(0)); }else return QString(); } @@ -588,12 +643,18 @@ ReportPages ReportEnginePrivate::renderToPages() connect(m_reportRender.data(),SIGNAL(pageRendered(int)), this, SIGNAL(renderPageFinished(int))); if (m_pages.count()){ + ReportPages result; emit renderStarted(); m_reportRender->setDatasources(dataManager()); - ReportPages result = m_reportRender->renderPageToPages(m_pages.at(0)); + m_reportRender->setScriptContext(scriptContext()); + + foreach(PageDesignIntf* page , m_pages){ + result.append(m_reportRender->renderPageToPages(page)); + } emit renderFinished(); + m_reportRender.clear(); return result; - }else { + } else { return ReportPages(); } } @@ -628,6 +689,11 @@ bool ReportEngine::printReport(QPrinter *printer) return d->printReport(printer); } +bool ReportEngine::printPages(ReportPages pages, QPrinter *printer, PrintRange printRange){ + Q_D(ReportEngine); + return d->printPages(pages,printer, printRange); +} + void ReportEngine::printToFile(const QString &fileName) { Q_D(ReportEngine); diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index afbbcdc..94b78d2 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -60,6 +60,10 @@ private: class DataSourceManager; class ReportEnginePrivate; +class PageDesignIntf; +class PageItemDesignIntf; + +typedef QList< QSharedPointer > ReportPages; class LIMEREPORT_EXPORT ReportEngine : public QObject{ Q_OBJECT @@ -69,7 +73,9 @@ public: explicit ReportEngine(QObject *parent = 0); ~ReportEngine(); bool printReport(QPrinter *printer=0); + bool printPages(ReportPages pages, QPrinter *printer, PrintRange printRange = PrintRange()); void printToFile(const QString& fileName); + PageDesignIntf *createPreviewScene(QObject *parent = 0); bool printToPDF(const QString& fileName); void previewReport(); void designReport(); diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index da9ce08..d015d50 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -55,7 +55,8 @@ class ReportEnginePrivate : public QObject, public ICollectionContainer Q_OBJECT Q_DECLARE_PUBLIC(ReportEngine) Q_PROPERTY(ACollectionProperty pages READ fakeCollectionReader()) - Q_PROPERTY(QObject* datasourcesManager READ dataManager()) + Q_PROPERTY(QObject* datasourcesManager READ dataManager) + Q_PROPERTY(QObject* scriptContext READ scriptContext) friend class PreviewReportWidget; public: static void printReport(ItemsReaderIntf::Ptr reader, QPrinter &printer); @@ -63,12 +64,16 @@ public: public: explicit ReportEnginePrivate(QObject *parent = 0); virtual ~ReportEnginePrivate(); - PageDesignIntf* appendPage(const QString &pageName = ""); - PageDesignIntf* createPreviewPage(); - PageDesignIntf* pageAt(int index){return (index<=(m_pages.count()-1)) ? m_pages.at(index):0;} - int pageCount() {return m_pages.count();} - DataSourceManager* dataManager(){return m_datasources;} - IDataSourceManager* dataManagerIntf(){return m_datasources;} + + PageDesignIntf* appendPage(const QString& pageName=""); + bool deletePage(PageDesignIntf *page); + PageDesignIntf* createPreviewPage(); + PageDesignIntf* pageAt(int index){return (index<=(m_pages.count()-1)) ? m_pages.at(index):0;} + int pageCount() {return m_pages.count();} + DataSourceManager* dataManager(){return m_datasources;} + ScriptEngineContext* scriptContext(){return m_scriptEngineContext;} + ScriptEngineManager* scriptManager(){return &ScriptEngineManager::instance();} + IDataSourceManager* dataManagerIntf(){return m_datasources;} IScriptEngineManager* scriptManagerIntf(){ ScriptEngineManager::instance().setDataManager(dataManager()); @@ -77,6 +82,7 @@ public: void clearReport(); bool printReport(QPrinter *printer=0); + bool printPages(ReportPages pages, QPrinter *printer, PrintRange printRange = PrintRange()); void printToFile(const QString& fileName); bool printToPDF(const QString& fileName); void previewReport(); @@ -144,6 +150,7 @@ private: private: QList m_pages; DataSourceManager* m_datasources; + ScriptEngineContext* m_scriptEngineContext; ReportRender::Ptr m_reportRender; QString m_fileName; QString m_lastError; diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 8446336..12f6e42 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -158,6 +158,19 @@ void ReportRender::setDatasources(DataSourceManager *value) m_datasources=value; } +void ReportRender::setScriptContext(ScriptEngineContext* scriptContext) +{ + m_scriptEngineContext=scriptContext; +} + +bool ReportRender::runInitScript(){ + if (m_scriptEngineContext){ + QScriptValue res = ScriptEngineManager::instance().scriptEngine()->evaluate(m_scriptEngineContext->initScript()); + if (res.isBool()) return res.toBool(); + } + return true; +} + void ReportRender::initDatasources(){ try{ datasources()->setAllDatasourcesToFirst(); @@ -181,6 +194,20 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) initVariables(); initGroupFunctions(); +#ifdef HAVE_UI_LOADER + initDialogs(); +#endif + if (runInitScript()){ + + clearPageMap(); + + try{ + datasources()->setAllDatasourcesToFirst(); + } catch(ReportError &exception){ + //TODO posible should thow exeption + QMessageBox::critical(0,tr("Error"),exception.what()); + return; + } clearPageMap(); resetPageNumber(); @@ -204,6 +231,7 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) savePage(); if (!m_renderCanceled) secondRenderPass(); + } } int ReportRender::pageCount() @@ -244,6 +272,18 @@ void ReportRender::initVariables() m_datasources->setReportVariable("#PAGE_COUNT",0); } +#ifdef HAVE_UI_LOADER +void ReportRender::initDialogs(){ + if (m_scriptEngineContext){ + QScriptEngine* se = ScriptEngineManager::instance().scriptEngine(); + foreach(DialogDescriber::Ptr dialog, m_scriptEngineContext->dialogsDescriber()){ + QScriptValue sv = se->newQObject(m_scriptEngineContext->getDialog(dialog->name())); + se->globalObject().setProperty(dialog->name(),sv); + } + } +} +#endif + void ReportRender::clearPageMap() { m_renderedPages.clear(); @@ -523,6 +563,10 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da dataSource->next(); } closeDataGroup(band); +// if (gb->isNeedToStartNewPage()){ +// savePage(); +// startNewPage(); +// } } if (!gb->isStarted()){ if (band->reprintOnEachPage()) @@ -851,6 +895,7 @@ void ReportRender::startNewPage() m_currentIndex=0; renderPageHeader(m_patternPageItem); + //renderPageFooter(m_patternPageItem); m_pageFooterHeight = calcPageFooterHeight(m_patternPageItem); m_maxHeightByColumn[m_currentColumn] -= m_pageFooterHeight; m_currentIndex=10; diff --git a/limereport/lrreportrender.h b/limereport/lrreportrender.h index a5c7562..ee583a4 100644 --- a/limereport/lrreportrender.h +++ b/limereport/lrreportrender.h @@ -33,6 +33,7 @@ #include "lrcollection.h" #include "lrdatasourcemanager.h" #include "lrpageitemdesignintf.h" +#include "lrscriptenginemanager.h" #include "serializators/lrstorageintf.h" namespace LimeReport{ @@ -55,7 +56,6 @@ private: bool m_footerGroup; }; -typedef QList ReportPages; struct PagesRange{ int firstPage; @@ -73,6 +73,7 @@ public: ~ReportRender(); ReportRender(QObject *parent = 0); void setDatasources(DataSourceManager* value); + void setScriptContext(ScriptEngineContext* scriptContext); DataSourceManager* datasources(){return m_datasources;} int pageCount(); PageItemDesignIntf::Ptr pageAt(int index); @@ -86,7 +87,11 @@ private: void renderPage(PageDesignIntf *patternPage); void initDatasources(); void initRenderPage(); +#ifdef HAVE_UI_LOADER + void initDialogs(); +#endif void initVariables(); + bool runInitScript(); void clearPageMap(); void renderBand(BandDesignIntf *patternBand, DataRenderMode mode = NotStartNewPage, bool isLast = false); void renderDataBand(BandDesignIntf* dataBand); @@ -141,6 +146,7 @@ private: void renameChildItems(BaseDesignIntf *item); private: DataSourceManager* m_datasources; + ScriptEngineContext* m_scriptEngineContext; PageItemDesignIntf* m_renderPageItem; PageItemDesignIntf* m_patternPageItem; QList m_renderedPages; diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index 1e3f264..b748e48 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -32,6 +32,11 @@ #include #include #include +#ifdef HAVE_UI_LOADER +#include +#include +#include +#endif #include "lrdatasourcemanager.h" Q_DECLARE_METATYPE(QColor) @@ -375,6 +380,11 @@ void ScriptEngineManager::setDataManager(DataSourceManager *dataManager){ } } +void ScriptEngineManager::updateModel() +{ + +} + ScriptEngineManager::ScriptEngineManager() :m_model(0), m_dataManager(0) { @@ -523,5 +533,196 @@ QString ScriptExtractor::substring(const QString &value, int start, int end) return value.mid(start,end-start); } +QString DialogDescriber::name() const +{ + return m_name; +} + +void DialogDescriber::setName(const QString& name) +{ + m_name = name; +} + +QByteArray DialogDescriber::description() const +{ + return m_description; +} + +void DialogDescriber::setDescription(const QByteArray &description) +{ + m_description = description; +} + +#ifdef HAVE_UI_LOADER +void ScriptEngineContext::addDialog(const QString& name, const QByteArray& description) +{ + m_dialogs.push_back(DialogDescriber::create(name,description)); +} + +bool ScriptEngineContext::previewDialog(const QString& dialogName) +{ + QDialog* dialog = getDialog(dialogName); + if (dialog) { + dialog->exec(); + return true; + } else { + m_lastError = tr("Dialog with name: %1 can`t be created").arg(dialogName); + return false; + } +} + +bool ScriptEngineContext::containsDialog(const QString& dialogName) +{ + foreach(DialogDescriber::Ptr dialog, m_dialogs){ + if (dialog->name()==dialogName) + return true; + } + return false; +} + +void ScriptEngineContext::deleteDialog(const QString& dialogName) +{ + { + QVector::Iterator it = m_dialogs.begin(); + while(it!=m_dialogs.end()){ + if ((*it)->name()==dialogName){ + it = m_dialogs.erase(it); + } else { + ++it; + } + } + } + { + QList::Iterator it = m_createdDialogs.begin(); + while(it!=m_createdDialogs.end()){ + if ((*it)->objectName()==dialogName){ + it = m_createdDialogs.erase(it); + } else { + ++it; + } + } + } +} + +#endif + +void ScriptEngineContext::clear() +{ +#ifdef HAVE_UI_LOADER + m_dialogs.clear(); + m_createdDialogs.clear(); +#endif + m_initScript.clear(); + m_lastError=""; +} + +QObject* ScriptEngineContext::createElement(const QString& collectionName, const QString& elementType) +{ + Q_UNUSED(elementType) +#ifdef HAVE_UI_LOADER + if (collectionName.compare("dialogs",Qt::CaseInsensitive)==0){ + m_dialogs.push_back(DialogDescriber::create()); + return m_dialogs.at(m_dialogs.count()-1).data(); + } +#else + Q_UNUSED(collectionName) +#endif + return 0; +} + +int ScriptEngineContext::elementsCount(const QString& collectionName) +{ +#ifdef HAVE_UI_LOADER + if (collectionName.compare("dialogs",Qt::CaseInsensitive)==0){ + return m_dialogs.count(); + }; +#else + Q_UNUSED(collectionName) +#endif + return 0; +} + +QObject* ScriptEngineContext::elementAt(const QString& collectionName, int index) +{ +#ifdef HAVE_UI_LOADER + if (collectionName.compare("dialogs",Qt::CaseInsensitive)==0){ + return m_dialogs.at(index).data(); + }; +#else + Q_UNUSED(collectionName) + Q_UNUSED(index) +#endif + return 0; +} + +void ScriptEngineContext::collectionLoadFinished(const QString& collectionName) +{ + Q_UNUSED(collectionName); +} + +#ifdef HAVE_UI_LOADER +QDialog* ScriptEngineContext::createDialog(DialogDescriber* cont) +{ + QUiLoader loader; + QByteArray desc = cont->description(); + QBuffer buffer(&desc); + buffer.open(QIODevice::ReadOnly); + QDialog* dialog = dynamic_cast(loader.load(&buffer)); + m_createdDialogs.push_back(QSharedPointer(dialog)); + return dialog; +} + +QDialog* ScriptEngineContext::findDialog(const QString& dialogName) +{ + foreach(DialogPtr dialog, m_createdDialogs){ + if (dialog->objectName()==dialogName) + return dialog.data(); + } + return 0; +} + +DialogDescriber* ScriptEngineContext::findDialogContainer(const QString& dialogName) +{ + foreach (DialogDescriber::Ptr dialogCont , m_dialogs) { + if (dialogCont->name().compare(dialogName,Qt::CaseInsensitive)==0){ + return dialogCont.data(); + } + } + return 0; +} + +QDialog* ScriptEngineContext::getDialog(const QString& dialogName) +{ + QDialog* dialog = findDialog(dialogName); + if (dialog){ + return dialog; + } else { + DialogDescriber* cont = findDialogContainer(dialogName); + if (cont){ + dialog = createDialog(cont); + if (dialog) + return dialog; + } + } + return 0; +} +#endif +QString ScriptEngineContext::initScript() const +{ + return m_initScript; +} + +void ScriptEngineContext::setInitScript(const QString& initScript) +{ + m_initScript = initScript; +} + +DialogDescriber::Ptr DialogDescriber::create(const QString& name, const QByteArray& desc) { + Ptr res(new DialogDescriber()); + res->setName(name); + res->setDescription(desc); + return res; +} + } //namespace LimeReport diff --git a/limereport/lrscriptenginemanager.h b/limereport/lrscriptenginemanager.h index 155b4c3..32ef2c5 100644 --- a/limereport/lrscriptenginemanager.h +++ b/limereport/lrscriptenginemanager.h @@ -39,8 +39,13 @@ #include #include +#ifdef HAVE_UI_LOADER +#include +#endif + #include "base/lrsingleton.h" #include "lrscriptenginemanagerintf.h" +#include "lrcollection.h" namespace LimeReport{ @@ -57,7 +62,7 @@ struct ScriptFunctionDesc{ class ScriptEngineNode { public: - enum NodeType{Root,Category,Function}; + enum NodeType{Root,Category,Function,Dialog,DialogElement}; ScriptEngineNode(const QString& name="", const QString& description ="", NodeType type=Root, ScriptEngineNode* parent=0, const QIcon& icon=QIcon()) :m_name(name), m_description(description), m_icon(icon), m_type(type), m_parent(parent){} virtual ~ScriptEngineNode(); @@ -95,6 +100,7 @@ public: int columnCount(const QModelIndex &parent) const; QVariant data(const QModelIndex &index, int role) const; void setScriptEngineManager(ScriptEngineManager* scriptManager); + inline ScriptEngineManager* scriptEngineManager(){return m_scriptManager;} private slots: void slotScriptEngineChanged(); private: @@ -105,6 +111,64 @@ private: ScriptEngineNode* m_rootNode; }; +class DialogDescriber : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString name READ name WRITE setName) + Q_PROPERTY(QByteArray description READ description WRITE setDescription) +public: + typedef QSharedPointer Ptr; + static Ptr create(const QString& name, const QByteArray &desc); + static Ptr create(){return Ptr(new DialogDescriber);} + QString name() const; + void setName(const QString& name); + QByteArray description() const; + void setDescription(const QByteArray& description); +private : + QString m_name; + QByteArray m_description; +}; + +class ScriptEngineContext : public QObject, public ICollectionContainer +{ + Q_OBJECT + Q_PROPERTY(ACollectionProperty dialogs READ fakeCollectionReader) + Q_PROPERTY(QString initScript READ initScript WRITE setInitScript) +public: +#ifdef HAVE_UI_LOADER + typedef QSharedPointer DialogPtr; +#endif + explicit ScriptEngineContext(QObject* parent=0):QObject(parent){} +#ifdef HAVE_UI_LOADER + void addDialog(const QString& name, const QByteArray &description); + bool previewDialog(const QString& dialogName); + bool containsDialog(const QString& dialogName); + const QVector& dialogsDescriber(){return m_dialogs;} + void deleteDialog(const QString& dialogName); + QDialog *getDialog(const QString &dialogName); +#endif + void clear(); + QString initScript() const; + void setInitScript(const QString& initScript); +protected: + QObject* createElement(const QString& collectionName,const QString& elementType); + int elementsCount(const QString& collectionName); + QObject* elementAt(const QString& collectionName,int index); + void collectionLoadFinished(const QString &collectionName); +#ifdef HAVE_UI_LOADER + QDialog *createDialog(DialogDescriber *cont); + QDialog *findDialog(const QString &dialogName); + DialogDescriber* findDialogContainer(const QString& dialogName); +#endif +private: +#ifdef HAVE_UI_LOADER + QVector m_dialogs; + QList m_createdDialogs; +#endif + QString m_lastError; + QString m_initScript; +}; + class ScriptEngineManager : public QObject, public Singleton, public IScriptEngineManager { Q_OBJECT @@ -122,8 +186,11 @@ public: QStringList functionsNames(); const QList& functionsDescriber(){return m_functions;} ScriptEngineModel* model(){return m_model;} + void setContext(ScriptEngineContext* context){m_context=context;} DataSourceManager* dataManager() const {return m_dataManager;} void setDataManager(DataSourceManager* dataManager); +protected: + void updateModel(); private: Q_DISABLE_COPY(ScriptEngineManager) private: @@ -132,6 +199,7 @@ private: QString m_lastError; QList m_functions; ScriptEngineModel* m_model; + ScriptEngineContext* m_context; DataSourceManager* m_dataManager; }; diff --git a/limereport/objectinspector/editors/lrcoloreditor.cpp b/limereport/objectinspector/editors/lrcoloreditor.cpp index 0d743e5..e845d76 100644 --- a/limereport/objectinspector/editors/lrcoloreditor.cpp +++ b/limereport/objectinspector/editors/lrcoloreditor.cpp @@ -53,6 +53,7 @@ ColorEditor::ColorEditor(QWidget *parent) : setFocusProxy(m_button); setAutoFillBackground(true); setLayout(layout); + setAutoFillBackground(true); connect(m_button,SIGNAL(clicked()),this,SLOT(slotClicked())); } diff --git a/limereport/objectinspector/editors/lrimageeditor.cpp b/limereport/objectinspector/editors/lrimageeditor.cpp index c48d887..aae4f99 100644 --- a/limereport/objectinspector/editors/lrimageeditor.cpp +++ b/limereport/objectinspector/editors/lrimageeditor.cpp @@ -37,13 +37,17 @@ ImageEditor::ImageEditor(QWidget* parent) :QWidget(parent) { m_button.setIcon(QIcon(":items/ImageItem")); + m_clearButton.setIcon(QIcon(":items/clear.png")); QHBoxLayout* layout = new QHBoxLayout(this); layout->addWidget(&m_button); - layout->setSpacing(0); + layout->addWidget(&m_clearButton); + layout->setSpacing(1); layout->setContentsMargins(1,0,1,1); setLayout(layout); setFocusProxy(&m_button); + setAutoFillBackground(true); connect(&m_button,SIGNAL(clicked()),this,SLOT(slotButtonClicked())); + connect(&m_clearButton,SIGNAL(clicked()),this,SLOT(slotClearButtonClicked())); } QImage ImageEditor::image() @@ -57,4 +61,10 @@ void ImageEditor::slotButtonClicked() emit editingFinished(); } -} // namespace LimeReport +void ImageEditor::slotClearButtonClicked() +{ + m_image = QImage(); + emit editingFinished(); +} + +} //namespace LimeReport diff --git a/limereport/objectinspector/editors/lrimageeditor.h b/limereport/objectinspector/editors/lrimageeditor.h index ada3c87..4b116b7 100644 --- a/limereport/objectinspector/editors/lrimageeditor.h +++ b/limereport/objectinspector/editors/lrimageeditor.h @@ -46,8 +46,10 @@ signals: void editingFinished(); private slots: void slotButtonClicked(); + void slotClearButtonClicked(); private: QPushButton m_button; + QPushButton m_clearButton; QImage m_image; }; diff --git a/limereport/objectinspector/lrobjectpropitem.h b/limereport/objectinspector/lrobjectpropitem.h index 6e2d796..6c3045b 100644 --- a/limereport/objectinspector/lrobjectpropitem.h +++ b/limereport/objectinspector/lrobjectpropitem.h @@ -88,7 +88,7 @@ namespace LimeReport{ void setColorIndex(int propertyValue); void setModel(QAbstractItemModel* model){m_model=model;} QAbstractItemModel* model(){return m_model;} - void setModelIndex(QModelIndex index){m_index=index;} + void setModelIndex(const QModelIndex& index){m_index=index;} QModelIndex modelIndex(){return m_index;} bool isClass(){return m_isClass;} #ifdef INSPECT_BASEDESIGN diff --git a/limereport/objectsbrowser/lrobjectbrowser.cpp b/limereport/objectsbrowser/lrobjectbrowser.cpp index c9c7f6e..07192f7 100644 --- a/limereport/objectsbrowser/lrobjectbrowser.cpp +++ b/limereport/objectsbrowser/lrobjectbrowser.cpp @@ -106,6 +106,7 @@ void ObjectBrowser::buildTree(BaseDesignIntf* ignoredItem){ m_treeView->clear(); m_itemsMap.clear(); + if (!m_report->activePage()) return; ObjectBrowserNode *topLevelItem=new ObjectBrowserNode(m_treeView); topLevelItem->setText(0,m_report->activePage()->objectName()); @@ -204,7 +205,7 @@ void ObjectBrowser::slotItemDeleted(PageDesignIntf *, BaseDesignIntf *item) void ObjectBrowser::slotObjectTreeItemSelectionChanged() { - if (!m_changingItemSelection){ + if (!m_changingItemSelection && m_report->activePage()){ m_changingItemSelection = true; m_report->activePage()->clearSelection(); foreach(QTreeWidgetItem* item, m_treeView->selectedItems()){ @@ -214,6 +215,10 @@ void ObjectBrowser::slotObjectTreeItemSelectionChanged() if (si) { m_report->activePage()->animateItem(si); si->setSelected(true); + QPointF p = si->mapToScene(si->pos()); + if (si->parentItem()) + p = si->parentItem()->mapToScene(si->pos()); + m_report->activeView()->centerOn(p); } } } diff --git a/limereport/report.qrc b/limereport/report.qrc index ad0f243..a2c526c 100644 --- a/limereport/report.qrc +++ b/limereport/report.qrc @@ -165,5 +165,7 @@ images/FitWidth.png images/OneToOne.png images/logo_32x32.png + images/addPage1.png + images/deletePage1.png diff --git a/limereport/scriptbrowser/images/Dialog.png b/limereport/scriptbrowser/images/Dialog.png new file mode 100644 index 0000000000000000000000000000000000000000..f6cc4e389d1535ca45d1b43c3b906d03d001b97e GIT binary patch literal 348 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmP)i;#$!eh8a2D^TdAr;B5V#p%71?&h`_2(;KM{bJbN z(LL2_lF=ofpkt*B=Q%?da}O|ER~}GH-w`}TK6S~|vnS;0cQe(kWP0%P&w}|eb+uLc z?=Brb{WyBtKWRpW+}m06o^M?i5*&7U-K=GT4x9>{#=m>Ql7v@u9P^9XD|FzDfpJ@+ zh0KS0>HEIRG3@5?U@47#F2WJ~PCe+TDYwM&j}EWqME{j|F-Q5X<(7cZtBMD5BLBLG z#P7RxDEDR3j@JoGW4Uj!zKH7Rl3>`R&#`MCyF!bD{C7{qmbZ;Yz9sSn^;Wr;?|tiF o+K_tlTs}+e_1gFLV)cvp=XYIFNmRMU1oSk6r>mdKI;Vst0Cc~H7XSbN literal 0 HcmV?d00001 diff --git a/limereport/scriptbrowser/images/Dialog_add.png b/limereport/scriptbrowser/images/Dialog_add.png new file mode 100644 index 0000000000000000000000000000000000000000..144134fc2e41cb27a7ec9444521f27a04fdbcede GIT binary patch literal 429 zcmV;e0aE^nP)KtYK_iwH%au?s{&k^;I^ zNZ4}R@Cmjhb}7zpTZG3*tGgTB&CH$l=;UTw@CRHRjtBr+0C0ZrjN!aaU6-F zNL83tSgNp6wryvonuvgzb7=uU$wVk2Dv+Ghm>J9r*L7*vIO++V=iNxQuVH*WV|kJvR^SA<2@i1Y)1?(Ua_)_S4T3`^{co XZ=BF9a$9X(00000NkvXXu0mjfWk9WV literal 0 HcmV?d00001 diff --git a/limereport/scriptbrowser/images/Dialog_delete.png b/limereport/scriptbrowser/images/Dialog_delete.png new file mode 100644 index 0000000000000000000000000000000000000000..9e069d625fcf0c6449a9cd2538e1e2a7b83c1dd8 GIT binary patch literal 633 zcmV-<0*3vGP)ckjT{ zLxW5v<4UmMIM@Cp49Yy*5n7JHIFvz90Hq2}m)zZT9 z>}+;#fB%-DwML7$C?a4OTw7Y=^Xe+5W#KIpFgG@+X>R7j<|ZawxUF^h^fLnQS5^S% z42Su)vjgQa`|In}l*{P)dXxzIpv8thBYszBC(%%dcir8DeLlWVPg81aq!*tY#m=nq-taJ?h6ape64l;LBA-Wz5N&FLREmmi^KoHeR{gH)<1pYvA`k2Q zezg*hr#%o9Py)#-eSOw$KCeHmt=;?MhnawZ7qzvor@*Xgli+#j^}ZR0`v5-y?*uw6 T@>@Gv00000NkvXXu0mjfgr^(W literal 0 HcmV?d00001 diff --git a/limereport/scriptbrowser/images/Dialog_run.png b/limereport/scriptbrowser/images/Dialog_run.png new file mode 100644 index 0000000000000000000000000000000000000000..345bab9d777246573f2b5b5f9000a737a73100b8 GIT binary patch literal 576 zcmV-G0>AxSqe=DL6DA81t)Rv2Ts!6 zBGx?*f~goQDT1K5NFs$~C^{y6_ujsH9Gavr&2vx>e7TqJJ?Gr-J?C6?>(yo9AMDxn zngZ|uo-V#8x&Do*|5ZR3hN87TLexhzgy;myBK~i{r&IMYVX+I{)#aMYb|qg7nq)&oD`|l2T#c5aw)YwV0ZT;)#?{k*ERs?bYmW^ zU&GpiC#BNN4X>{t4N7Uk@Dr9^|EJHA2rdDyl`8&B^ZN})zC-Ru7uB!; O0000 zlRiZdL^ulzIVHt)a-|ux*#R4M69`U>z5%$@{RQTfjt^Yw_CtLQxavpHEDSgc1DgS+U7Ed8S`CN#dtkRra0`47I0v@D zXD-ctC>>9A)nw;Nt0wRiSnpkaB1W#o$X?-_wv<+Xdf0nU*EfC`d`)RJa_1v4GA~BF v7+Jb+^U6yViIFxi4b*L78xMBlW9|G8LWh5tVRTEQ00000NkvXXu0mjfil)j> literal 0 HcmV?d00001 diff --git a/limereport/scriptbrowser/images/function_add.png b/limereport/scriptbrowser/images/function_add.png new file mode 100644 index 0000000000000000000000000000000000000000..259a781371ef42dcba7f2c51319dcc2703c2a37b GIT binary patch literal 504 zcmVMvg$zF2L{tRb6jVfXFxAobr z*`i(4#zcSOZqY7QXCUOEj*k_8rPu8p#wTpxz#fI4;xVL^gA}JKas#XQQM8Mzl-G%RaG7(=@gr06ba zVgz0-Eg|$qND^j$$qG$LA(RFhvkyn$WSHgFHurV&8AD2YZVrcY-sha>obw72ptzJ` zpc^;|Sb$E|sorB3NIU#)pb@wX+yz?M10tb%Ca?^ws!lbJ|3qR3X8|+tJ~6@Su-5F^ zf#OmEy5?;JL*CGF;0=%#=nI&4kcNS)fxduS0#Kc*75JdXPlvprTwn&615*A{_yN%S zM}p!~jKCp1I0v|a%{zU8K}Ub(cO&5`tHWvrZBioY?H$<2Ikpf^Nt{6mkPP@$ry2mx zG)(-MtY~TJztV9y#f4H7>|6Po(`vctMwX7&)z{yWD|iTPMxEe@Zl`pcTD@vE?JF!4 z!td7_Zd^$JHJthFz|hw9%I4;S_vt~nxU*rNJ0>woz=E%Ht~9FY*~UL2^a%95+4JY zWO<~@ZZFWhUM*HqBHnsD;}agwt7vJd&=wc96Lx!^$!HuB|2olrXt$M@_oP}ZVsd=^ ziwwna5OMHU+3oooYiru4>1oHVA7udAhfJo?K`yN~-_> literal 0 HcmV?d00001 diff --git a/limereport/scriptbrowser/images/function_edit.png b/limereport/scriptbrowser/images/function_edit.png new file mode 100644 index 0000000000000000000000000000000000000000..f68aa2045877af818fa7d1afb47a256947c29acd GIT binary patch literal 666 zcmV;L0%iS)P)0w+mC zK~y-)jgw7CRACf`pK%l$ba0%xQ%Zg*>Vzm{NuUKK7`CwJXAwn4KO!}`NTvigp_`!E zbVHHuBCMbwY7v2phR8)hXc-xWHKbHt35NNyP;4@%`C4?1%P8u*IULS8@A-FNgV048 z&=trJi_-8WBAWywKHW&^hYq#+YPwHEaE|C#U{Yr6J! zN1m@x-Q08;&6DO%C3s>RZp<3kdK_~lldtM_H?)5`oa4$>yVkWiPMp7xkhd~x(rpAu z;DM#bflHtcN`pz~-u%((=4eexZZZ1;ZH}Yu7uD!pZv_mG17rwY%m`gPvaP8_3u?18 z_%mqC4X?g~I{mUVIXKm$N?UzVr>87nzyEDQ7fR@&Zo#q+Wb|X8YWoV3L-DR;(V1*X z<=Pxl9%x$V;_QOp{S;rlf9iLAcuVrJ>``Uy-Vt0yYgT&Vc#n9`jeU5g?!CUA$ZX~# z8~yGjpJ@S(rw`>j3m#5QN5eBCb8mQ;m|e{6FUmW(lJ193$N&HU07*qoM6N<$g153B ADF6Tf literal 0 HcmV?d00001 diff --git a/limereport/scriptbrowser/images/green_cube.png b/limereport/scriptbrowser/images/green_cube.png new file mode 100644 index 0000000000000000000000000000000000000000..2f0b2bdb09aa3be3cfba5ea31e3c32f5f3ef146f GIT binary patch literal 790 zcmV+x1L^#UP)`9W8$Zh$0;n zktk?s5JeQxASx75At*os6ht_J63m@__Sw6$J40dLUBa&zX{4u5zxmz>z^(ls1f);Oo@#8|OA&xHIz;H!1%KK-gJ79|Yj@pFes9xSZMA zYfjT%Bp@h<^@PmYQN={X@L_SgYRVhH^;d`QT~94*&3~@BymEV8+gHNw~C+_aA)8^n_X}3@9%b80(P8Uxx3l*cqUzjAM zngQTr#s0th-1%uD^ReeB4i(e{O@yY7o~Hm!=*}+*{Z=RmdKJN4i!7DnB;~vN@yaM z2r^sF9W^)x#O0k3Ya-zokhj`2(Nj16crMft5qS`xCa5a+N5v@8K0cI`ItQl20BIBP z^OZyqP}3zq3>Am0)CfwE_6f0JQBN@p+GB|E_{mOGP!%jyaw|wydv}_mVsz6@d{|(b zoVe+XDQC?|1J_crj$lDDuk1 zSX`aHLJU;RAqUmo z4~Ks8$@7oAeC^`ai}3-#{kiu2`wwq-&%fQW{Pme1pRHs4*=WA|@w*p4-2MOTfA7ow UnQy@A0{{R307*qoM6N<$f?_vpDF6Tf literal 0 HcmV?d00001 diff --git a/limereport/scriptbrowser/images/green_cube1.png b/limereport/scriptbrowser/images/green_cube1.png new file mode 100644 index 0000000000000000000000000000000000000000..3b9fc5cbf7b55e2d0ed54b25024685d8ce56f051 GIT binary patch literal 609 zcmV-n0-pVeP)0r-k8l700q#je zK~y-)&C8!z!faTa92uPa1DyB=)WpHW zzrvsqGhUJA6mZ|58rArNrZ-}Wq@Ja6!?Bgc!^8_#RG?bniUbS9~^ z?rI4Z2lik~Jg=-TS9@jmN35Iun^Q~OQ^37vb1T=b&(62>3yOh50*7|$Xl!$0AsVz1j0*7HQ8NjR zYLl(_J0{fR{gQOQBscDC;4lsc0^U2qN=V$OQkDgx1m{4M{YwWTXswT(MyQ9wG^0_{ zvIp$poj-B9BS0xZ8HLdyMnwn;1Zu%B=c4oU%RP)3gl$C2SpbBwq8>FcVyFc}3{}Rk zuEb+8MFl1LPh;Ds0UfAbvsF(fN7`ISuF?ow-s7bn4l^Ch(#v=03^ox2>uq)lm{}OR zGc|E(K@-e%v!A!L3gW7%liLBgOG(Q<-rKK@u=P@ew`aaGz>|;5)$zEUgr+*31g+)V vrHi@C-t>#^qr&E!``OOU{kg}U|0cfy2oSmV^U1c!00000NkvXXu0mjfgEA7L literal 0 HcmV?d00001 diff --git a/limereport/scriptbrowser/lrscriptbrowser.cpp b/limereport/scriptbrowser/lrscriptbrowser.cpp new file mode 100644 index 0000000..ea38798 --- /dev/null +++ b/limereport/scriptbrowser/lrscriptbrowser.cpp @@ -0,0 +1,195 @@ +/*************************************************************************** + * This file is part of the Lime Report project * + * Copyright (C) 2015 by Alexander Arin * + * arin_a@bk.ru * + * * + ** GNU General Public License Usage ** + * * + * This library is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + ** GNU Lesser General Public License ** + * * + * This library is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library. * + * If not, see . * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + ****************************************************************************/ +#include "lrscriptbrowser.h" +#include "ui_lrscriptbrowser.h" + +#ifdef HAVE_UI_LOADER +#include +#include +#endif +#include + +namespace LimeReport{ + +ScriptBrowser::ScriptBrowser(QWidget *parent) : + QWidget(parent), + ui(new Ui::ScriptBrowser) +{ + ui->setupUi(this); +#ifndef HAVE_UI_LOADER + ui->tpDialogs->setVisible(false); + ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tpDialogs)); +#endif +} + +ScriptBrowser::~ScriptBrowser() +{ + delete ui; +} + +void ScriptBrowser::setReportEditor(ReportDesignWidget* report) +{ + m_report=report; + connect(m_report,SIGNAL(cleared()),this,SLOT(slotClear())); + connect(m_report,SIGNAL(loaded()),this,SLOT(slotUpdate())); + updateFunctionTree(); +} + +void ScriptBrowser::updateFunctionTree() +{ + ScriptEngineManager* sm = reportEditor()->scriptManager(); + QMap categ; + foreach(ScriptFunctionDesc fd, sm->functionsDescriber()){ + QString functionCategory = (fd.category!="") ? fd.category : tr("NO CATEGORY"); + if (categ.contains(functionCategory)){ + QTreeWidgetItem* item = new QTreeWidgetItem(categ.value(fd.category),QStringList(fd.name)); + item->setIcon(0,QIcon(":/report/images/function")); + } else { + QTreeWidgetItem* categItem = new QTreeWidgetItem(ui->twFunctions,QStringList(functionCategory)); + categItem->setIcon(0,QIcon(":/report/images/folder")); + categ.insert(functionCategory,categItem); + QTreeWidgetItem* item = new QTreeWidgetItem(categItem,QStringList(fd.name)); + item->setIcon(0,QIcon(":/report/images/function")); + } + } +} + +#ifdef HAVE_UI_LOADER +void ScriptBrowser::fillProperties(QTreeWidgetItem* objectItem, QObject* item){ + for(int i=0; imetaObject()->propertyCount(); ++i){ + QStringList row; + row<metaObject()->property(i).typeName()<metaObject()->property(i).name(); + /*QTreeWidgetItem* propItem = */new QTreeWidgetItem(objectItem,row); + } +} + +void ScriptBrowser::fillDialog(QTreeWidgetItem* dialogItem,const QString& description){ + + QUiLoader loader; + QByteArray baDesc = description.toUtf8(); + QBuffer buff(&baDesc); + buff.open(QIODevice::ReadOnly); + QDialog* dialog = dynamic_cast(loader.load(&buff)); + if (dialog){ + foreach (QObject* child, dialog->children()) { + if (!child->objectName().isEmpty()){ + QStringList row; + row<metaObject()->className()<objectName(); + QTreeWidgetItem* item = new QTreeWidgetItem(dialogItem,row); + item->setIcon(0,QIcon(":/scriptbrowser/images/item")); + fillProperties(item,child); + } + } + delete dialog; + } + +} + +void ScriptBrowser::updateDialogsTree() +{ + ui->twDialogs->clear(); + ScriptEngineContext* sc = reportEditor()->scriptContext(); + foreach(DialogDescriber::Ptr dc, sc->dialogsDescriber()){ + QTreeWidgetItem* dialogItem = new QTreeWidgetItem(ui->twDialogs,QStringList(dc->name())); + dialogItem->setIcon(0,QIcon(":/scriptbrowser/images/dialog")); + fillDialog(dialogItem,dc->description()); + } +} +#endif +void ScriptBrowser::slotClear() +{ + ui->twDialogs->clear(); + ui->twFunctions->clear(); +} + +void ScriptBrowser::slotUpdate() +{ +#ifdef HAVE_UI_LOADER + updateDialogsTree(); +#endif + updateFunctionTree(); +} + +#ifdef HAVE_UI_LOADER +void ScriptBrowser::on_tbAddDialog_clicked() +{ + QFileDialog fileDialog(this); + if (fileDialog.exec()==QDialog::Accepted){ + QStringList fileNames = fileDialog.selectedFiles(); + QUiLoader loader; + + if (!fileNames.isEmpty()){ + foreach (QString fileName, fileNames) { + QFile file(fileName); + file.open(QIODevice::ReadOnly); + if (file.isOpen()){ + QWidget* widget = loader.load(&file); + QDialog* dialog = dynamic_cast(widget); + if (dialog){ + if (!m_report->scriptContext()->containsDialog(dialog->objectName())){ + file.seek(0); + m_report->scriptContext()->addDialog(dialog->objectName(),file.readAll()); + updateDialogsTree(); + } else { + QMessageBox::critical(this,tr("Error"),tr("Dialog with name: %1 already exists").arg(dialog->objectName())); + } + } else { + if (widget) + QMessageBox::critical(this,tr("Error"),tr("ui file must cointain QDialog instead QWidget or QMainWindow")); + else + QMessageBox::critical(this,tr("Error"),tr("wrong file format")); + } + if (widget) delete widget; + } + } + } + } +} + +void ScriptBrowser::on_tbRunDialog_clicked() +{ + if (ui->twDialogs->currentItem()&& ui->twDialogs->currentItem()->parent()==0){ + m_report->scriptContext()->previewDialog(ui->twDialogs->currentItem()->text(0)); + } +} + +void ScriptBrowser::on_tbDeleteDialog_clicked() +{ + if (ui->twDialogs->currentItem()&& ui->twDialogs->currentItem()->parent()==0){ + m_report->scriptContext()->deleteDialog(ui->twDialogs->currentItem()->text(0)); + updateDialogsTree(); + } +} + +#endif + +} //namespace LimeReport + + diff --git a/limereport/scriptbrowser/lrscriptbrowser.h b/limereport/scriptbrowser/lrscriptbrowser.h new file mode 100644 index 0000000..3214617 --- /dev/null +++ b/limereport/scriptbrowser/lrscriptbrowser.h @@ -0,0 +1,77 @@ +/*************************************************************************** + * This file is part of the Lime Report project * + * Copyright (C) 2015 by Alexander Arin * + * arin_a@bk.ru * + * * + ** GNU General Public License Usage ** + * * + * This library is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + ** GNU Lesser General Public License ** + * * + * This library is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library. * + * If not, see . * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + ****************************************************************************/ +#ifndef LRSCRIPTBROWSER_H +#define LRSCRIPTBROWSER_H + +#include +#include +#include +#include "lrreportdesignwidget.h" + +namespace LimeReport{ + +namespace Ui { +class ScriptBrowser; +} + +class ScriptBrowser : public QWidget +{ + Q_OBJECT + +public: + explicit ScriptBrowser(QWidget *parent = 0); + ~ScriptBrowser(); + void setReportEditor(LimeReport::ReportDesignWidget* report); + inline ReportDesignWidget* reportEditor(){return m_report;} + void updateFunctionTree(); +#ifdef HAVE_UI_LOADER + void updateDialogsTree(); +#endif +protected: +#ifdef HAVE_UI_LOADER + void fillDialog(QTreeWidgetItem *dialogItem, const QString &description); + void fillProperties(QTreeWidgetItem *objectItem, QObject *item); +#endif +private slots: + void slotClear(); + void slotUpdate(); +#ifdef HAVE_UI_LOADER + void on_tbAddDialog_clicked(); + void on_tbRunDialog_clicked(); + void on_tbDeleteDialog_clicked(); +#endif + +private: + Ui::ScriptBrowser *ui; + ReportDesignWidget* m_report; +}; + +} // namespace LimeReport +#endif // LRSCRIPTBROWSER_H diff --git a/limereport/scriptbrowser/lrscriptbrowser.qrc b/limereport/scriptbrowser/lrscriptbrowser.qrc new file mode 100644 index 0000000..5ec7b02 --- /dev/null +++ b/limereport/scriptbrowser/lrscriptbrowser.qrc @@ -0,0 +1,14 @@ + + + images/Dialog.png + images/Dialog_add.png + images/Dialog_delete.png + images/Dialog_run.png + images/function3.png + images/function_add.png + images/function_delete.png + images/function_edit.png + images/green_cube.png + images/green_cube1.png + + diff --git a/limereport/scriptbrowser/lrscriptbrowser.ui b/limereport/scriptbrowser/lrscriptbrowser.ui new file mode 100644 index 0000000..d0a5384 --- /dev/null +++ b/limereport/scriptbrowser/lrscriptbrowser.ui @@ -0,0 +1,287 @@ + + + LimeReport::ScriptBrowser + + + + 0 + 0 + 400 + 300 + + + + Form + + + + 1 + + + 1 + + + 1 + + + 1 + + + 2 + + + + + QTabWidget::South + + + 0 + + + + Functions + + + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + 2 + + + + + ... + + + + :/scriptbrowser/images/function_add:/scriptbrowser/images/function_add + + + + 16 + 16 + + + + true + + + + + + + ... + + + + :/scriptbrowser/images/function_edit:/scriptbrowser/images/function_edit + + + + 16 + 16 + + + + true + + + + + + + ... + + + + :/scriptbrowser/images/function_delete:/scriptbrowser/images/function_delete + + + + 16 + 16 + + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + false + + + + 1 + + + + + + + + + Dialogs + + + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + 2 + + + + + ... + + + + :/scriptbrowser/images/dialog_add:/scriptbrowser/images/dialog_add + + + + 16 + 16 + + + + true + + + + + + + ... + + + + :/scriptbrowser/images/dialog_run:/scriptbrowser/images/dialog_run + + + + 16 + 16 + + + + true + + + + + + + ... + + + + :/scriptbrowser/images/dialog_delete:/scriptbrowser/images/dialog_delete + + + + 16 + 16 + + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 2 + + + 131 + + + 100 + + + + Type + + + + + Name + + + + + + + + + + + + + + + diff --git a/limereport/serializators/lrxmlreader.cpp b/limereport/serializators/lrxmlreader.cpp index 4f2f282..545c4ca 100644 --- a/limereport/serializators/lrxmlreader.cpp +++ b/limereport/serializators/lrxmlreader.cpp @@ -204,6 +204,10 @@ bool FileXMLReader::prepareReader(QDomDocument *doc) QFile source(m_fileName); if (source.open(QFile::ReadOnly)) { doc->setContent(&source); + if (doc->documentElement().nodeName()!="Report") { + m_error = QString(QObject::tr("Wrong file format")); + return false; + } } else {m_error=QString(QObject::tr("File %1 not opened")).arg(m_fileName); return false;} } return true; diff --git a/limereport/serializators/lrxmlwriter.cpp b/limereport/serializators/lrxmlwriter.cpp index de1b9fb..dc70216 100644 --- a/limereport/serializators/lrxmlwriter.cpp +++ b/limereport/serializators/lrxmlwriter.cpp @@ -37,12 +37,19 @@ namespace LimeReport{ XMLWriter::XMLWriter() : m_doc(new QDomDocument) { - m_rootElement=m_doc->createElement("Report"); - m_doc->appendChild(m_rootElement); + init(); } XMLWriter::XMLWriter(QSharedPointer doc) : m_doc(doc){ + init(); +} + +void XMLWriter::init() +{ m_rootElement=m_doc->createElement("Report"); + QDomNode xmlNode = m_doc->createProcessingInstruction("xml", + "version=\"1.0\" encoding=\"UTF8\""); + m_doc->insertBefore(xmlNode,m_doc->firstChild()); m_doc->appendChild(m_rootElement); } diff --git a/limereport/serializators/lrxmlwriter.h b/limereport/serializators/lrxmlwriter.h index dc0deaa..399e2e2 100644 --- a/limereport/serializators/lrxmlwriter.h +++ b/limereport/serializators/lrxmlwriter.h @@ -48,7 +48,7 @@ private: bool saveToFile(QString fileName); QString saveToString(); QByteArray saveToByteArray(); - + void init(); QDomElement putQObjectItem(QString name, QObject* item); void putChildQObjectItem(QString name, QObject* item, QDomElement* parentNode); void putCollectionItem(QObject* item, QDomElement* parentNode=0); diff --git a/translations/limereport_es_ES.qm b/translations/limereport_es_ES.qm index b0946c37ad7e78d0ebcc78b71f94d0f4b670d520..3fd67a67c416d80a8a1c250ac74fd13acc902bc6 100644 GIT binary patch delta 713 zcmaKpT}YE*6vzL2KXQ(Jcrl7q&?54pkBej$?V_ZxTrKDWE1a${2F@sDo3x8)U=&%a z1uuQX!a}>4m54P$3raHVCJNuB)7kRf-f6Xp4m>x3(AAIUoag+{|D4mT@HZ9y zvN>c0L>DkM3am2%6FlQ|6mT5|#+O3qXa%MZF=n1Is>6)4B@kDS0AC^yD@p-uV$2Rh z?Dx>y�Op4h{gR+t?m`0mx3qP{t3((HbD}1UuGWp~NdVuho*FRvi4TlJF?1Pd_H1 zHb&Kf^94=7*9yF|y(NP+n%x~#mkeo!x?1Re8Mn(V1B#97y_*BRS-2nZIO%Ko&DM5c z<{}@=D?qMJs46~=5I(mHo*?OuKNP}U)L4!PR~=7j6PFmX<&0`rxKTwDBz_6^UDP=D zT!`uEJykFC*54w54?>@gHkhwnl>8O-V2w8 zNMMn+Q>H{pr=3f0CFj=*y;_c(CJF~%7g79xu9&BIx}Pz#P*=WfB~5l#*EzNvnDpu5 zNfHDY(?yJ#KYEKor%8?J%TAsGM)LZoN`{m-`h1Uuj5HhSx>vbr()WfteGwA;Xq@~> zx0%>rdKo=KEABDLD`GT}>;-14C9kqZa&r&5ON4=$?)^DCCk41=i!Dy?G0$F4V}mbX zx9>aR^EL*y_!>_5JwB<8v;HrAVQxq=@*53H{#B43@n*@(+vi1V=S9p?<@dFJ0k>lS A(EtDd delta 700 zcmZ9KZAep57{~wj?%v$y+$;(TvX&!>`Vf*9j4(qo7Zw#HvX!*qrB%0TR&Pq&IO3VZ#&a4E#?kzAr2)?QmKpFVQ z0?`S6^eHg;4BNdUK*%XEH3!4d1HiWcc5J)`ctX>tZncnr7pVQ6rbhGF-!woC?n%rT zaWTgQ#O-)f@|pylW=e9Kfaxd9?oMhDz0bVty+HR4u{-O6R5!6hcQe3LIs4P^r$Osw zTeR&!vR~$&O#;jY&RBFD_&UZ3Zkmtqd#<^c1cU~;>xPGvz<|W`D~Xvl?uL<^jO(~= z6A55iIG>946IZyQBR6UPhZ|N>a#54S%p%^sU=JDi!28aV@I(Xu*%cxojvOW(rz9uk z9nGb5zf9g040$M`VtF=R0i<*atDGeVxr))Te5yApi)2(!ge9hKDYsRwCTBg$uD~kb zd#lnPp@x9O#3qU9bE;)YdXktzRo>7Dyem|B(Oac=#3(En&;j#6!j-fQ0JooN-Hp95cTXw(U9G&US4fIChQeX*c~VJ`mN&C?5_Vy zv8<)w-%~Yaht+Jc3C=3JtzK~SEtHK+X-V=L)W8e}th8ESgFqifi+Z9KF7Zoj39sJg Zr1L!~3o8cL6=M5Lhp5RGh?jok{{;+=`A+}< diff --git a/translations/limereport_es_ES.ts b/translations/limereport_es_ES.ts index 8c8efbc..8784b9b 100644 --- a/translations/limereport_es_ES.ts +++ b/translations/limereport_es_ES.ts @@ -1,6 +1,6 @@ - + LRVariableDialog @@ -28,15 +28,15 @@ LimeReport::AVariablesHolder variable with name - variable con el nombre + variable con el nombre already exists !! - ya existe !! + ya existe !! does not exists !! - no existe !! + no existe !! @@ -86,7 +86,7 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">arin_a@bk.ru</p></body></html> - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -395,7 +395,7 @@ p, li { white-space: pre-wrap; } User variables - Variables de usuario + Variables de usuario System variables @@ -413,6 +413,18 @@ p, li { white-space: pre-wrap; } Error + + Grab variable + + + + Report variables + + + + External variables + + LimeReport::DataFooterBand @@ -758,6 +770,14 @@ p, li { white-space: pre-wrap; } One to one + + Font + + + + Text align + + LimeReport::ProxyHolder @@ -993,6 +1013,22 @@ p, li { white-space: pre-wrap; } Report file name + + Page + + + + Script + + + + Error + + + + Wrong file format + + LimeReport::ReportDesignWindow @@ -1220,6 +1256,18 @@ p, li { white-space: pre-wrap; } File "%1" not found! + + New Report Page + + + + Delete Report Page + + + + Script Browser + + LimeReport::ReportEnginePrivate @@ -1227,6 +1275,10 @@ p, li { white-space: pre-wrap; } Error + + Preview + + LimeReport::ReportFooter @@ -1356,6 +1408,60 @@ p, li { white-space: pre-wrap; } + + LimeReport::ScriptBrowser + + Form + + + + Functions + + + + ... + + + + Dialogs + + + + Type + Tipo + + + Name + Nombre + + + NO CATEGORY + + + + Error + + + + Dialog with name: %1 already exists + + + + ui file must cointain QDialog instead QWidget or QMainWindow + + + + wrong file format + + + + + LimeReport::ScriptEngineContext + + Dialog with name: %1 can`t be created + + + LimeReport::ScriptEngineManager @@ -1382,6 +1488,10 @@ p, li { white-space: pre-wrap; } Locale + + CurrencySymbol + + LimeReport::SettingDialog @@ -1494,6 +1604,21 @@ p, li { white-space: pre-wrap; } + + LimeReport::VariablesHolder + + variable with name + variable con el nombre + + + already exists !! + ya existe !! + + + does not exists !! + no existe !! + + QObject @@ -1688,5 +1813,9 @@ p, li { white-space: pre-wrap; } Content is empty + + Wrong file format + + diff --git a/translations/limereport_ru.qm b/translations/limereport_ru.qm index c1d404615aabf5e5d563ca414d5cb6a899c05809..62addf125a33a1261db15e66f10a3d9260e5f7d1 100644 GIT binary patch delta 2668 zcmZ{mX;c(f7RUe9Rn=5?S9PO;f+&k%41%I;0xJ6+lx9&;v1Mxz<3f;t=#h@QqDLJY zG$dpcV+?VOIuc`CFfK4a4B|w=XlB%-=r}HM88ROCx%l#7&YAH;pI_B`_3nP}>z}W3 zpIzrH$c0p`A1!!|1cC-M)eWBjs0SvH%y15a^ z{|q*DBE6qS+?FaJU@?&#;zlqAoPj0b{TYC&3<(eE;EbzC46LRP_9Lk#ha$0+(RLZ5 ze>r2kg)yOD6M6owFEU<|$NWiTE?>jA%GjQ(R$Y4ah4{%@!}=>#|f8#JWQ zvkaSCqUk*sI}3ME+H7&Ql2SRP2Iu|H0ip|Tr`#fg$~Zj92KrfUa@x{+z}V%S-5#P) z&Kc{gDgVKox#y1*(nXAMx42KscLI)juJyPtWhj9AVc%Nv$b;)RO@_FYan}Ne0z)Qp zcdEAmhBVc{4q6{ES~WQ8b6}>cD)epykS(hcYTC%KxvB{!a?H}FpUU_L3bm7q>ceGA zDFP!^o9E2~M%`yDn5p{nv2Y-Hnd-=n-vFgu^-xdWPhYKi+T2X3dcfPB4FFQzd5<}V zfFu*|H8a<#Tq#nvj(oi3AuJeN!)Mi)fW8;` z?0)n?#u+|$)>gn6!_Vyi-F@AO|KMNekYP#B1baP&dg6M)ybzRvVqyJ0a)2ultaqv{q-dS+al$b` z9m<&alyRC~sGW9-iu1Bi`$7dcm>5H*GS2)(*naIXFs4eVd)Uh!VdsDYfO`vLXf0#* z9pQ_6z2_SkLk=@$c?i2REfjKdx3Ig-N+E1yoE{WK;HTdG3Pw|OC)$fas%)lTS0|Iat)+t)ilsF-YAS9!!%eMSZt-Q1~tW zoiEg{y;o8w%Wb%xU#Z`7ZM4h&Mc-A~v^!T(s9)P$t~Ud|b0k%~Keh2=Nk3%+y{n{z z=z~Do8fjz2O;T`A+PHz_PPi&<&k6v1eqqeFOqF)@E+p-gzFbe#@Y3!Z6e7(f>5auH zUDDn_%9+n7sd0TP73&@8$*)mBpE5@K>(bM`WQe=7Mv12?pOB()?KRLPL=(1aBrtli zCcKDh#J5E=YtMPQGaQMuKk}BQP@`;r!1Gc=`@b7^#bt|`4wp2UsT9BL-P zjyE-JKiblachjut}XvB8tf})B5=_{Rils!$lE4qB?G2msd%RllP;5|aOw6g~=ozrb^yF#fd z)a`en^P|7kUGg&1{u-HctEK)QJ3y9_uLFbo%W^C!Oui>8(rL2zk=&0bf#I!;@lA|5 z6|%$33Yw6sWyePs$n1TxyLYd`tFouuOgZn8z5CI*h~bP0u8cWta^M1zA3RAmZLFi3 zn<3}6TM|f65IqnJJmoDt)P8+V$e+BTfh2Uu+l-ymo@Me;ZUI&AJo)6VZ^*+^xn<%9 zba`aRmrhZR?T5+Fzu{<5`6{036+qVeN@(IT8b|?3#H(m>pg@VgOzYvCQcyvLy1Ysknf5(DnmUto7Q+|FbIV0{?fl!QOmY`ybqL_YwdA delta 2511 zcmZ9OX;c(f8iwEQs%omctGf|I46Z2XD98}m6gNAwtICwu5RZw#z)Fahe1Y(L5U(Z!gL*=I&;pFFh9q7DhRlQH@cS7M*FcI5 z0WcKOU-ttM2O*uZbNvmZ8m?n*L#nR^j9gzl3-~R9Zk-R%aR+p@Re*gVTuLP1lMKYH zD*{57k#t;}s50~_;{G%Z5H=vLndeff5g%I2_y2?=VdHebP=SwZw@qbSfy($MmDWU9 z!y183O_)%ygAQh6;u=QOXAvf~G9vK~QocD%hksC+d<3=yL5ybw?5jM0-pMKlzC+GC zI$*EB%-(m&+YWsFb~g}W{2vQY;4+UXZAHQ9PC&Qsuu4yZea~R+*(k1Cusyq!0P0r2`)M8bkhLVDKtU`@N*JNfXTM!EJ-ay1SSqo}#h0 z{GFL})TUh8;~k!hyET3q%~>dHrCU@S=!O5jL64gt+4EU4KFw-thmYx$G;a!MH(7%N@z?y08Gdbt_3sF;l;u| zx1Qv4;lp$~mMDoHW~O}1deJ@~EQM1n+|K~C#iH|3F%7K~H^d!hN2RGu5LHgGh?}QW zI~d_xaq~MZ)!U?UP=?CX6XMoe&w&A3#FFMVeh{~N{s8z+QaNmwN?U`t<1x>BMX4NA zqcY7!EK6a^GtP=-^-gAVxcHB$)QaY%SgBM~^m$^Hi=*wr1AHJOTvVoa5KkD)6p2w~ zLYa8gxdce|5r5mw)b_Hg45?E&Vvsc8CB+mxM~dl9L!PIk%#=vqWi;c{cQ9SAxmYh#1i$E~t?;wr9_IL^{ z;jz4W6)#SFByY8a0H5|%X&)??wyj6+mv}`2pC`%UTaL84K zbyVpK`PI`AOu4MmGf#fKkB<24*PCLg?!***_cjN+pVtrD8NmMCp^unDjRbelXYIYh zZ-EcV_kkh$Y?)$gcS}FBm22;Z`uu{K?EheW{u2fgJ6M0DmiKnb*VkWg1suj}VKL_ccEr(+trgeF4j4L;8_uj?hZOj5hwk!(a~?Pkv#r?`_YTTS;CVctd5z z8bjF~Z$KYrsC~f9GUkso-B&rP%21yyG1Dc6^B26?|D*aD#SctTLX^=fOJ;;NZNJ&<_-tcE=3thgVtAyN&b-zKUdrZ-WPeLjqLxpi|R&ty3#Ri0c&_w`Q+Kp z{Mubodiv8~K!DOmsb$TtDgN#}I6OpUyr0VSy-H{v4TRg2)YT>Yx5H7i@JjTEJ<9Md@RsNOG?(>o6_!dm5Q;umbIhsyP8*0@83^7fF1 z18SV9k8TNPd!lJ*{9+EG2vg+yC`OQLioL=8NX7Ko0y^sbttqQKm6NX2^!cy6r-Pd* zSKq*M+e|C1p3LNOm9gKOww_qc(pH#`IIJR5|I&1H(lyptGF7*I??)7wUe7VdyogUaoJ+GQbRGF zRc0s_M_v$+{=%~L*lGTdaai^Zyu!d;Ek0-0Ed@+}w%qMm$%$8Hxt~0jp59cMF)o`w zgAO_0d-#`U>Lrb)hx4Ghv(wf^be^;uomqBIbLWKYnf9^vIkR);hKENw3+)sBf2+wJ z@9gGga*dpjo|~OMJ;$CGJ3A-Co?D)27~`r5b(XkybneM9IuCicwi_jeP=bt - + AboutDialog About - О программе + О программе Author - Автор + Автор License - Лицензия + Лицензия Close - Закрыть + Закрыть Version 1.1.1 - Версия + Версия ConnectionDialog Connection - Соединение + Соединение Connection Name - Название + Название Driver - Драйвер + Драйвер Server - Сервер + Сервер User - Пользователь + Пользователь Password - Пароль + Пароль Database - База данных + База данных Auto connect - Автоматическое соединение + Автоматическое соединение Check connection - Проверить соединение + Проверить соединение Cancel - Отмена + Отмена Error - Ошибка + Ошибка Connection succsesfully established! - Соединение успешно установлено! + Соединение успешно установлено! Connection Name is empty - Наименование соединения не указано + Наименование соединения не указано Connection with name - Соединение + Соединение already exists - уже существует + уже существует DataBrowser Datasources - Источники данных + Источники данных Add database connection - Добавить соединение с базой + Добавить соединение с базой Add new datasource - Добавить новый источник данных + Добавить новый источник данных View data - Просмотр данных в источнике + Просмотр данных в источнике Change datasource - Изменить источник данных + Изменить источник данных Delete datasource - Удалить источник данных + Удалить источник данных Show error - Показать ошибки + Показать ошибки Variables - Переменные + Переменные Add new variable - Добавить новую переменную + Добавить новую переменную Edit variable - Редактировать переменную + Редактировать переменную Delete variable - Удалить переменную + Удалить переменную @@ -161,15 +161,15 @@ LimeReport::AVariablesHolder variable with name - переменная + переменная already exists !! - уже существует !! + уже существует !! does not exists !! - не существует !! + не существует !! @@ -223,7 +223,7 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">arin_a@bk.ru</p></body></html> - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -525,7 +525,7 @@ p, li { white-space: pre-wrap; } User variables - Пользовательские переменные + Пользовательские переменные System variables @@ -538,7 +538,7 @@ p, li { white-space: pre-wrap; } Do you really want delete variable "%1" ? - Вы действительно хотите удалить переменную "%1" ? + Вы действительно хотите удалить переменную "%1" ? Error @@ -552,6 +552,18 @@ p, li { white-space: pre-wrap; } Do you really want to delete variable "%1" ? + + Grab variable + + + + Report variables + + + + External variables + + LimeReport::DataFooterBand @@ -779,11 +791,11 @@ p, li { white-space: pre-wrap; } LimeReport::PageDesignIntf Warning - Предупреждение + Предупреждение Multi band deletion not allowed - Удаление нескольких бандов запрещено + Удаление нескольких бандов запрещено @@ -917,6 +929,14 @@ p, li { white-space: pre-wrap; } One to one + + Font + Шрифт + + + Text align + + LimeReport::ProxyHolder @@ -1152,6 +1172,22 @@ p, li { white-space: pre-wrap; } Report file name Файл отчета + + Page + + + + Script + + + + Error + Ошибка + + + Wrong file format + + LimeReport::ReportDesignWindow @@ -1379,6 +1415,18 @@ p, li { white-space: pre-wrap; } File "%1" not found! + + New Report Page + + + + Delete Report Page + + + + Script Browser + + LimeReport::ReportEnginePrivate @@ -1386,6 +1434,10 @@ p, li { white-space: pre-wrap; } Error Ошибка + + Preview + + LimeReport::ReportFooter @@ -1515,6 +1567,60 @@ p, li { white-space: pre-wrap; } + + LimeReport::ScriptBrowser + + Form + + + + Functions + Функции + + + ... + + + + Dialogs + + + + Type + Тип + + + Name + Имя переменной + + + NO CATEGORY + + + + Error + Ошибка + + + Dialog with name: %1 already exists + + + + ui file must cointain QDialog instead QWidget or QMainWindow + + + + wrong file format + + + + + LimeReport::ScriptEngineContext + + Dialog with name: %1 can`t be created + + + LimeReport::ScriptEngineManager @@ -1541,6 +1647,10 @@ p, li { white-space: pre-wrap; } Locale + + CurrencySymbol + + LimeReport::SettingDialog @@ -1653,91 +1763,106 @@ p, li { white-space: pre-wrap; } + + LimeReport::VariablesHolder + + variable with name + переменная + + + already exists !! + уже существует !! + + + does not exists !! + не существует !! + + PreviewReportWindow Preview - Предварительный просмотр + Предварительный просмотр View - Просмотр + Просмотр Report - Отчет + Отчет toolBar - Панель инструментов + Панель инструментов Print - Печать + Печать Zoom In - Увеличить + Увеличить Zoom Out - Уменьшить + Уменьшить Prior Page - Предыдущая страница + Предыдущая страница Next Page - Следующая страница + Следующая страница Close Preview - Закрыть + Закрыть Edit Mode - Режим редактирования + Режим редактирования Save to file - Записать в файл + Записать в файл Show errors - Показать ошибки + Показать ошибки First Page - Первая страница + Первая страница First page - Первая страница + Первая страница Last Page - Последняя страница + Последняя страница Print To PDF - Печать в PDF + Печать в PDF Page: - Страница: + Страница: of %1 - из %1 + из %1 Report file name - Файл отчета + Файл отчета PDF file name - Имя PDF файла + Имя PDF файла @@ -1824,7 +1949,7 @@ p, li { white-space: pre-wrap; } Master datasource "%1" not found! - Главный источник данных "%1" не найден! + Главный источник данных "%1" не найден! Child @@ -1884,19 +2009,19 @@ p, li { white-space: pre-wrap; } TopLine - Верхняя граница + Верхняя граница BottomLine - Нижняя граница + Нижняя граница LeftLine - Левая граница + Левая граница RightLine - Правая граница + Правая граница content @@ -1954,161 +2079,165 @@ p, li { white-space: pre-wrap; } Content is empty + + Wrong file format + + SQLEditDialog Datasource - Источник данных + Источник данных Connection - Соединение + Соединение Datasource Name - Имя источника + Имя источника Subdetail - Подчиненный + Подчиненный Master datasource - Главный источник + Главный источник Subquery mode - Режим подзапроса + Режим подзапроса Filter mode - Режим фильтрации + Режим фильтрации SQL - SQL запрос + SQL запрос Preview - Предпросмотр + Предпросмотр Hide Preview - Скрыть + Скрыть Child datasource - Подчиненный источник + Подчиненный источник Fields map - Поля для связи источников + Поля для связи источников Data preview - Данные + Данные Cancel - Отмена + Отмена Error - Ошибка + Ошибка Datasource Name is empty ! - Имя источника данных не заполнено ! + Имя источника данных не заполнено ! SQL is empty ! - SQL запрос пустой ! + SQL запрос пустой ! Datasource with name: "%1" already exists ! - Источник данных с именем: "%1" уже существует ! + Источник данных с именем: "%1" уже существует ! Datasource with name %1 already exist - Источник данных с именем: "%1" уже существует + Источник данных с именем: "%1" уже существует Attention - Внимание + Внимание Connection is not specified - Соединение не указано + Соединение не указано Refresh - Обновить + Обновить SettingDialog Designer setting - Настройки дизайнера + Настройки дизайнера Default font - Шрифт по умолчанию + Шрифт по умолчанию Grid - Сетка + Сетка Vertical grid step - Вертикальный шаг + Вертикальный шаг Horizontal grid step - Горизонтальный шаг + Горизонтальный шаг TextItemEditor Text Item Editor - Редактор текстового элемента + Редактор текстового элемента Content - Содержимое + Содержимое Data - Источники данных + Источники данных Functions - Функции + Функции Editor settings - Настройки + Настройки Editor font - Шрифт редактора + Шрифт редактора Cancel - Отмена + Отмена WaitForm Wait - Ожидайте + Ожидайте Please wait ... - Пожалуста подождите ... + Пожалуста подождите ... From 381ef73b84ca6b14867f1bca9d5fb92a1c39e090 Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Fri, 12 Aug 2016 22:01:07 +0300 Subject: [PATCH 02/51] Text item changing font in preview window has been fixed --- limereport/items/editors/lrfonteditorwidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/limereport/items/editors/lrfonteditorwidget.cpp b/limereport/items/editors/lrfonteditorwidget.cpp index 812c5a9..a2d7dbc 100644 --- a/limereport/items/editors/lrfonteditorwidget.cpp +++ b/limereport/items/editors/lrfonteditorwidget.cpp @@ -122,6 +122,7 @@ void FontEditorWidget::updateValues(const QFont& font) void FontEditorWidget::slotFontChanged(const QFont &font) { if (reportEditor() && !m_ignoreSlots) reportEditor()->setFont(font); + if (page()) page()->setFont(font); } void FontEditorWidget::slotFontSizeChanged(const QString &value) From d8b10e7dfa29949d1ebf9baae7e6473acb4825f0 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 31 Aug 2016 00:12:31 +0400 Subject: [PATCH 03/51] Thanks to GraninDB! Fix: Set valid grid setting after new page adding --- limereport/lrreportdesignwidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/limereport/lrreportdesignwidget.cpp b/limereport/lrreportdesignwidget.cpp index 3b3133a..6a6ff0c 100644 --- a/limereport/lrreportdesignwidget.cpp +++ b/limereport/lrreportdesignwidget.cpp @@ -481,6 +481,7 @@ void ReportDesignWidget::addPage() connectPage(page); view->scale(0.5,0.5); view->centerOn(0,0); + applyUseGrid(); emit pageAdded(page); } From a3deac318129a1fe14046b5799be7c5b3cc9fd28 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 5 Sep 2016 20:52:15 +0400 Subject: [PATCH 04/51] ui dialog demo added --- common.pri | 8 +++ demo_r1/demo_reports/demoDialog.ui | 82 +++++++++++++++++++++++ demo_r1/demo_reports/dialogDemo.lrxml | 93 +++++++++++++++++++++++++++ 3 files changed, 183 insertions(+) create mode 100644 demo_r1/demo_reports/demoDialog.ui create mode 100644 demo_r1/demo_reports/dialogDemo.lrxml diff --git a/common.pri b/common.pri index c15fe14..8eee2c5 100644 --- a/common.pri +++ b/common.pri @@ -1,5 +1,13 @@ CONFIG += build_translations CONFIG += zint + +#greaterThan(QT_MAJOR_VERSION, 4) { +# QT += uitools +#} +#lessThan(QT_MAJOR_VERSION, 5){ +# CONFIG += uitools +#} + ZINT_PATH = $$PWD/3rdparty/zint-2.4.4 CONFIG(release, debug|release){ diff --git a/demo_r1/demo_reports/demoDialog.ui b/demo_r1/demo_reports/demoDialog.ui new file mode 100644 index 0000000..8f387f9 --- /dev/null +++ b/demo_r1/demo_reports/demoDialog.ui @@ -0,0 +1,82 @@ + + + Dialog + + + + 0 + 0 + 400 + 300 + + + + Dialog + + + + + + + + + + Message + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + buttonBox + accepted() + Dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/demo_r1/demo_reports/dialogDemo.lrxml b/demo_r1/demo_reports/dialogDemo.lrxml new file mode 100644 index 0000000..eb5780a --- /dev/null +++ b/demo_r1/demo_reports/dialogDemo.lrxml @@ -0,0 +1,93 @@ + + + + + + + page1 + + + + + + + + ReportPage1 + + + + TextItem1 + + + + + ReportPage1 + + + + + + + $S{Dialog.lineEdit.text} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + datasources + + + + + + + + + + + + Dialog + + + + Dialog.exec()==1 + + + + From c3cc76ca8bc612ca8409b0728b173e00c908c4f5 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 16 Sep 2016 02:59:56 +0400 Subject: [PATCH 05/51] Pagination has been fixed --- limereport/lrpageitemdesignintf.cpp | 23 ++++++-- limereport/lrpageitemdesignintf.h | 5 ++ limereport/lrreportdesignwindow.cpp | 31 ++++++++++- limereport/lrreportdesignwindow.h | 3 +- limereport/lrreportengine.cpp | 4 +- limereport/lrreportrender.cpp | 81 ++++++++++++++++------------- limereport/lrreportrender.h | 6 ++- 7 files changed, 108 insertions(+), 45 deletions(-) diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index e009d5e..5ea814c 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -48,10 +48,10 @@ PageItemDesignIntf::PageItemDesignIntf(QObject *owner, QGraphicsItem *parent) : BaseDesignIntf("PageItem",owner,parent), m_topMargin(0), m_bottomMargin(0), m_leftMargin(0), m_rightMargin(0), m_pageOrientaion(Portrait), m_pageSize(A4), m_sizeChainging(false), - m_fullPage(false), m_oldPrintMode(false) + m_fullPage(false), m_oldPrintMode(false), m_resetPageNumber(false) { setFixedPos(true); - setPosibleResizeDirectionFlags(Fixed); + setPossibleResizeDirectionFlags(Fixed); initPageSize(m_pageSize); } @@ -59,10 +59,10 @@ PageItemDesignIntf::PageItemDesignIntf(const PageSize pageSize, const QRectF &re BaseDesignIntf("PageItem",owner,parent), m_topMargin(0), m_bottomMargin(0), m_leftMargin(0), m_rightMargin(0), m_pageOrientaion(Portrait), m_pageSize(pageSize), m_sizeChainging(false), - m_fullPage(false), m_oldPrintMode(false) + m_fullPage(false), m_oldPrintMode(false), m_resetPageNumber(false) { setFixedPos(true); - setPosibleResizeDirectionFlags(Fixed); + setPossibleResizeDirectionFlags(Fixed); initPageSize(rect.size()); } @@ -300,6 +300,21 @@ void PageItemDesignIntf::initColumnsPos(QVector &posByColumns, qreal pos, } } +bool PageItemDesignIntf::resetPageNumber() const +{ + return m_resetPageNumber; +} + +void PageItemDesignIntf::setResetPageNumber(bool resetPageNumber) +{ + if (m_resetPageNumber!=resetPageNumber){ + m_resetPageNumber = resetPageNumber; + if (!isLoading()){ + notify("resetPageNumber",!m_resetPageNumber,m_resetPageNumber); + } + } +} + bool PageItemDesignIntf::oldPrintMode() const { return m_oldPrintMode; diff --git a/limereport/lrpageitemdesignintf.h b/limereport/lrpageitemdesignintf.h index ba01820..635655f 100644 --- a/limereport/lrpageitemdesignintf.h +++ b/limereport/lrpageitemdesignintf.h @@ -51,6 +51,7 @@ class PageItemDesignIntf : public LimeReport::BaseDesignIntf Q_PROPERTY(int gridStep READ gridStep WRITE setGridStep) Q_PROPERTY(bool fullPage READ fullPage WRITE setFullPage) Q_PROPERTY(bool oldPrintMode READ oldPrintMode WRITE setOldPrintMode) + Q_PROPERTY(bool resetPageNumber READ resetPageNumber WRITE setResetPageNumber) friend class ReportRender; public: enum Orientation { Portrait, Landscape }; @@ -112,6 +113,9 @@ public: bool oldPrintMode() const; void setOldPrintMode(bool oldPrintMode); bool canContainChildren(){ return true;} + bool resetPageNumber() const; + void setResetPageNumber(bool resetPageNumber); + protected slots: void bandDeleted(QObject* band); void bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry); @@ -138,6 +142,7 @@ private: QList m_bands; bool m_fullPage; bool m_oldPrintMode; + bool m_resetPageNumber; }; typedef QList ReportPages; diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index b7a6d0b..dbe6f8d 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -1078,10 +1078,39 @@ void ReportDesignWindow::slotBandDeleted(PageDesignIntf *, BandDesignIntf *band) } } + +void ReportDesignWindow::updateAvaibleBands(){ + + if (!m_reportDesignWidget || !m_reportDesignWidget->activePage()) return; + m_newPageHeader->setEnabled(true); + m_newPageFooter->setEnabled(true); + m_newReportHeader->setEnabled(true); + m_newReportFooter->setEnabled(true); + + foreach(BandDesignIntf* band, m_reportDesignWidget->activePage()->pageItem()->bands()){ + switch (band->bandType()) { + case BandDesignIntf::PageHeader: + m_newPageHeader->setEnabled(false); + break; + case BandDesignIntf::PageFooter: + m_newPageFooter->setEnabled(false); + break; + case BandDesignIntf::ReportHeader: + m_newReportHeader->setEnabled(false); + break; + case BandDesignIntf::ReportFooter: + m_newReportFooter->setEnabled(false); + default: + break; + } + } +} + void ReportDesignWindow::slotActivePageChanged() { m_propertyModel->setObject(0); updateRedoUndo(); + updateAvaibleBands(); } void ReportDesignWindow::renderStarted() @@ -1178,7 +1207,7 @@ void ReportDesignWindow::slotLoadRecentFile(const QString fileName) } } -void ReportDesignWindow::slotPageAdded(PageDesignIntf *page) +void ReportDesignWindow::slotPageAdded(PageDesignIntf *) { m_deletePageAction->setEnabled(m_reportDesignWidget->report()->pageCount()>1); } diff --git a/limereport/lrreportdesignwindow.h b/limereport/lrreportdesignwindow.h index 474d212..5819a1c 100644 --- a/limereport/lrreportdesignwindow.h +++ b/limereport/lrreportdesignwindow.h @@ -117,7 +117,7 @@ private slots: void slotUseGrid(bool value); void slotUseMagnet(bool value); void slotLoadRecentFile(const QString fileName); - void slotPageAdded(PageDesignIntf* page); + void slotPageAdded(PageDesignIntf* ); void slotPageDeleted(); protected: void closeEvent(QCloseEvent *event); @@ -138,6 +138,7 @@ private: void createDataWindow(); void createScriptWindow(); void updateRedoUndo(); + void updateAvaibleBands(); void startNewReport(); void writePosition(); void writeState(); diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 315b4a9..7ff4095 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -671,7 +671,9 @@ ReportPages ReportEnginePrivate::renderToPages() foreach(PageDesignIntf* page , m_pages){ m_pages.at(0)->setReportSettings(&m_reportSettings); result.append(m_reportRender->renderPageToPages(page)); - } + } + + m_reportRender->secondRenderPass(result); emit renderFinished(); m_reportRender.clear(); return result; diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 9813b15..d902427 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -156,6 +156,8 @@ ReportRender::ReportRender(QObject *parent) void ReportRender::setDatasources(DataSourceManager *value) { m_datasources=value; + initVariables(); + resetPageNumber(BandReset); } void ReportRender::setScriptContext(ScriptEngineContext* scriptContext) @@ -175,7 +177,7 @@ void ReportRender::initDatasources(){ try{ datasources()->setAllDatasourcesToFirst(); } catch(ReportError &exception){ - //TODO posible should thow exeption + //TODO possible should thow exeption QMessageBox::critical(0,tr("Error"),exception.what()); return; } @@ -185,14 +187,16 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) { m_curentNameIndex = 0; m_patternPageItem = patternPage->pageItem(); - m_pageCount = 1; + if (m_patternPageItem->resetPageNumber() && m_pageCount>0) { + resetPageNumber(PageReset); + + } + //m_pageCount = 1; m_renderCanceled = false; BandDesignIntf* reportFooter = m_patternPageItem->bandByType(BandDesignIntf::ReportFooter); m_reportFooterHeight = 0; if (reportFooter) m_reportFooterHeight = reportFooter->height(); - - initVariables(); initGroupFunctions(); #ifdef HAVE_UI_LOADER initDialogs(); @@ -204,33 +208,32 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) try{ datasources()->setAllDatasourcesToFirst(); } catch(ReportError &exception){ - //TODO posible should thow exeption + //TODO possible should thow exeption QMessageBox::critical(0,tr("Error"),exception.what()); return; } - clearPageMap(); - resetPageNumber(); - startNewPage(); + clearPageMap(); - renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader),StartNewPageAsNeeded); + startNewPage(); - BandDesignIntf* lastRenderedBand = 0; - for (int i=0;idataBandCount() && !m_renderCanceled;i++){ - lastRenderedBand = m_patternPageItem->dataBandAt(i); - initDatasources(); - renderDataBand(lastRenderedBand); - if (idataBandCount()-1) closeFooterGroup(lastRenderedBand); - } + renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader),StartNewPageAsNeeded); - if (reportFooter) - renderBand(reportFooter,StartNewPageAsNeeded); - if (lastRenderedBand && lastRenderedBand->keepFooterTogether()) - closeFooterGroup(lastRenderedBand); + BandDesignIntf* lastRenderedBand = 0; + for (int i=0;idataBandCount() && !m_renderCanceled;i++){ + lastRenderedBand = m_patternPageItem->dataBandAt(i); + initDatasources(); + renderDataBand(lastRenderedBand); + if (idataBandCount()-1) closeFooterGroup(lastRenderedBand); + } + + if (reportFooter) + renderBand(reportFooter,StartNewPageAsNeeded); + if (lastRenderedBand && lastRenderedBand->keepFooterTogether()) + closeFooterGroup(lastRenderedBand); + + savePage(); - savePage(); - if (!m_renderCanceled) - secondRenderPass(); } } @@ -599,7 +602,7 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da gb->startGroup(m_datasources); openDataGroup(band); if (!firstTime && gb->startNewPage()){ - if (gb->resetPageNumber()) resetPageNumber(); + if (gb->resetPageNumber()) resetPageNumber(BandReset); renderBand(band,ForcedStartPage); } else { renderBand(band,StartNewPageAsNeeded); @@ -849,14 +852,17 @@ BandDesignIntf* ReportRender::sliceBand(BandDesignIntf *band, BandDesignIntf* pa } -void ReportRender::secondRenderPass() +void ReportRender::secondRenderPass(ReportPages renderedPages) { - for(int i=0; isetReportVariable("#PAGE_COUNT",findLastPageNumber(i)); - foreach(BandDesignIntf* band, page->childBands()){ - band->updateItemSize(m_datasources, SecondPass); + foreach(BaseDesignIntf* item, page->childBaseItems()){ + item->updateItemSize(m_datasources, SecondPass); } +// foreach(BandDesignIntf* band, page->childBands()){ +// band->updateItemSize(m_datasources, SecondPass); +// } } } @@ -938,24 +944,26 @@ void ReportRender::startNewPage() renderPageItems(m_patternPageItem); } -void ReportRender::resetPageNumber() +void ReportRender::resetPageNumber(ResetPageNuberType resetType) { PagesRange range; if (!m_ranges.isEmpty()){ - m_ranges.last().lastPage = m_pageCount; - range.firstPage = m_pageCount+1; + m_ranges.last().lastPage = (resetType == BandReset)? m_pageCount : m_pageCount-1; + range.firstPage = m_pageCount+((resetType == BandReset)? 1 : 0); } else { range.firstPage = m_pageCount; } - range.lastPage = 0; + range.lastPage = (resetType == BandReset)? 0 : m_pageCount; m_ranges.append(range); + if (resetType == PageReset) + m_datasources->setReportVariable("#PAGE",1); } int ReportRender::findLastPageNumber(int currentPage) { foreach (PagesRange range, m_ranges) { - if ( range.firstPage<= (currentPage+1) && range.lastPage>= (currentPage+1) ) - return range.lastPage-(range.firstPage-1); + if ( range.firstPage<= (currentPage) && range.lastPage>= (currentPage) ) + return (range.lastPage-(range.firstPage))+1; } return 0; } @@ -1068,8 +1076,9 @@ void ReportRender::savePage() BandDesignIntf* pageFooter = m_renderPageItem->bandByType(BandDesignIntf::PageFooter); if (pageFooter) pageFooter->setBandIndex(++m_currentIndex); m_renderedPages.append(PageItemDesignIntf::Ptr(m_renderPageItem)); - emit pageRendered(m_pageCount); m_pageCount++; + emit pageRendered(m_pageCount); + } QString ReportRender::toString() diff --git a/limereport/lrreportrender.h b/limereport/lrreportrender.h index ee583a4..4f39fb5 100644 --- a/limereport/lrreportrender.h +++ b/limereport/lrreportrender.h @@ -69,6 +69,7 @@ class ReportRender: public QObject public: enum DataRenderMode {StartNewPageAsNeeded, NotStartNewPage, ForcedStartPage}; enum BandPrintMode {PrintAlwaysPrintable, PrintNotAlwaysPrintable }; + enum ResetPageNuberType{BandReset, PageReset}; typedef QSharedPointer Ptr; ~ReportRender(); ReportRender(QObject *parent = 0); @@ -79,6 +80,7 @@ public: PageItemDesignIntf::Ptr pageAt(int index); QString renderPageToString(PageDesignIntf *patternPage); ReportPages renderPageToPages(PageDesignIntf *patternPage); + void secondRenderPass(ReportPages renderedPages); signals: void pageRendered(int renderedPageCount); public slots: @@ -127,12 +129,12 @@ private: BandDesignIntf* findEnclosingGroup(); bool registerBand(BandDesignIntf* band, bool registerInChildren=true); BandDesignIntf *sliceBand(BandDesignIntf* band, BandDesignIntf *patternBand, bool isLast); - void secondRenderPass(); + BandDesignIntf* saveUppperPartReturnBottom(BandDesignIntf *band, int height, BandDesignIntf *patternBand); BandDesignIntf* renderData(BandDesignIntf* patternBand); void startNewColumn(); void startNewPage(); - void resetPageNumber(); + void resetPageNumber(ResetPageNuberType resetType); int findLastPageNumber(int currentPage); void savePage(); QString toString(); From 6982edc8ececb03a1e0b9c71476cf612e3638aa4 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 4 Oct 2016 04:55:02 +0400 Subject: [PATCH 06/51] Disable creation of Tear-off band if it exists --- limereport/lrreportdesignwindow.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index 73206d0..cdbac29 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -1095,6 +1095,7 @@ void ReportDesignWindow::updateAvaibleBands(){ m_newPageFooter->setEnabled(true); m_newReportHeader->setEnabled(true); m_newReportFooter->setEnabled(true); + m_newTearOffBand->setEnabled(true); foreach(BandDesignIntf* band, m_reportDesignWidget->activePage()->pageItem()->bands()){ switch (band->bandType()) { @@ -1109,6 +1110,8 @@ void ReportDesignWindow::updateAvaibleBands(){ break; case BandDesignIntf::ReportFooter: m_newReportFooter->setEnabled(false); + case BandDesignIntf::TearOffBand: + m_newTearOffBand->setEnabled(false); default: break; } From c786be0ca48d4de665d914a37c06a9c71a67233a Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Wed, 2 Nov 2016 00:21:45 +0300 Subject: [PATCH 07/51] pri file has been refactored pri file refactored --- limereport/limereport.pri | 99 ++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 49 deletions(-) diff --git a/limereport/limereport.pri b/limereport/limereport.pri index ae11f9e..37f2234 100644 --- a/limereport/limereport.pri +++ b/limereport/limereport.pri @@ -11,7 +11,6 @@ INCLUDEPATH += \ $$REPORT_PATH/databrowser SOURCES += \ - $$REPORT_PATH/items/lrtextitem.cpp \ $$REPORT_PATH/bands/lrpageheader.cpp \ $$REPORT_PATH/bands/lrpagefooter.cpp \ $$REPORT_PATH/bands/lrreportheader.cpp \ @@ -20,31 +19,31 @@ SOURCES += \ $$REPORT_PATH/bands/lrgroupbands.cpp \ $$REPORT_PATH/bands/lrsubdetailband.cpp \ $$REPORT_PATH/bands/lrtearoffband.cpp \ - $$REPORT_PATH/objectinspector/lrobjectinspectorwidget.cpp \ - $$REPORT_PATH/objectinspector/lrobjectitemmodel.cpp \ - $$REPORT_PATH/objectinspector/lrobjectpropitem.cpp \ - $$REPORT_PATH/objectinspector/lrpropertydelegate.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrstringpropitem.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrrectproptem.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrintpropitem.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrenumpropitem.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrboolpropitem.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrflagspropitem.cpp \ - $$REPORT_PATH/objectinspector/editors/lrtextitempropertyeditor.cpp \ - $$REPORT_PATH/objectinspector/editors/lrcomboboxeditor.cpp \ - $$REPORT_PATH/objectinspector/editors/lrcheckboxeditor.cpp \ - $$REPORT_PATH/objectinspector/editors/lrbuttonlineeditor.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrfontpropitem.cpp \ - $$REPORT_PATH/objectinspector/editors/lrfonteditor.cpp \ - $$REPORT_PATH/objectinspector/editors/lrimageeditor.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrimagepropitem.cpp \ - $$REPORT_PATH/objectinspector/lrbasedesignobjectmodel.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrqrealpropitem.cpp \ - $$REPORT_PATH/objectinspector/editors/lrcoloreditor.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrcolorpropitem.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrdatasourcepropitem.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrgroupfieldpropitem.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrcontentpropitem.cpp \ + $$REPORT_PATH/objectinspector/editors/lrtextitempropertyeditor.cpp \ + $$REPORT_PATH/objectinspector/editors/lrcomboboxeditor.cpp \ + $$REPORT_PATH/objectinspector/editors/lrcheckboxeditor.cpp \ + $$REPORT_PATH/objectinspector/editors/lrbuttonlineeditor.cpp \ + $$REPORT_PATH/objectinspector/editors/lrfonteditor.cpp \ + $$REPORT_PATH/objectinspector/editors/lrimageeditor.cpp \ + $$REPORT_PATH/objectinspector/editors/lrcoloreditor.cpp \ + $$REPORT_PATH/objectinspector/lrbasedesignobjectmodel.cpp \ + $$REPORT_PATH/objectinspector/lrobjectinspectorwidget.cpp \ + $$REPORT_PATH/objectinspector/lrobjectitemmodel.cpp \ + $$REPORT_PATH/objectinspector/lrobjectpropitem.cpp \ + $$REPORT_PATH/objectinspector/lrpropertydelegate.cpp \ $$REPORT_PATH/objectsbrowser/lrobjectbrowser.cpp \ $$REPORT_PATH/databrowser/lrdatabrowser.cpp \ $$REPORT_PATH/databrowser/lrsqleditdialog.cpp \ @@ -67,6 +66,7 @@ SOURCES += \ $$REPORT_PATH/items/lrimageitem.cpp \ $$REPORT_PATH/items/lrtextitemeditor.cpp \ $$REPORT_PATH/items/lrshapeitem.cpp \ + $$REPORT_PATH/items/lrtextitem.cpp \ $$REPORT_PATH/lrbanddesignintf.cpp \ $$REPORT_PATH/lrpageitemdesignintf.cpp \ $$REPORT_PATH/lrpagedesignintf.cpp \ @@ -97,30 +97,21 @@ contains(CONFIG, zint){ HEADERS += \ $$REPORT_PATH/base/lrsingleton.h \ + $$REPORT_PATH/base/lrsimpleabstractfactory.h \ + $$REPORT_PATH/base/lrattribsabstractfactory.h \ $$REPORT_PATH/bands/lrpageheader.h \ $$REPORT_PATH/bands/lrpagefooter.h \ $$REPORT_PATH/bands/lrreportheader.h \ $$REPORT_PATH/bands/lrreportfooter.h \ $$REPORT_PATH/bands/lrdataband.h \ $$REPORT_PATH/bands/lrtearoffband.h \ - $$REPORT_PATH/objectinspector/lrobjectinspectorwidget.h \ - $$REPORT_PATH/objectinspector/lrobjectitemmodel.h \ - $$REPORT_PATH/objectinspector/lrobjectpropitem.h \ - $$REPORT_PATH/objectinspector/lrpropertydelegate.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrstringpropitem.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrrectproptem.h \ + $$REPORT_PATH/bands/lrsubdetailband.h \ + $$REPORT_PATH/bands/lrgroupbands.h \ $$REPORT_PATH/databrowser/lrdatabrowser.h \ $$REPORT_PATH/databrowser/lrsqleditdialog.h \ $$REPORT_PATH/databrowser/lrconnectiondialog.h \ $$REPORT_PATH/databrowser/lrvariabledialog.h \ $$REPORT_PATH/databrowser/lrdatabrowsertree.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrdatasourcepropitem.h \ - $$REPORT_PATH/lrbanddesignintf.h \ - $$REPORT_PATH/lrpageitemdesignintf.h \ - $$REPORT_PATH/lrbandsmanager.h \ - $$REPORT_PATH/lrglobal.h \ - $$REPORT_PATH/base/lrsimpleabstractfactory.h \ - $$REPORT_PATH/base/lrattribsabstractfactory.h \ $$REPORT_PATH/serializators/lrserializatorintf.h \ $$REPORT_PATH/serializators/lrstorageintf.h \ $$REPORT_PATH/serializators/lrxmlqrectserializator.h \ @@ -128,29 +119,49 @@ HEADERS += \ $$REPORT_PATH/serializators/lrxmlbasetypesserializators.h \ $$REPORT_PATH/serializators/lrxmlreader.h \ $$REPORT_PATH/serializators/lrxmlwriter.h \ - $$REPORT_PATH/lrbasedesignintf.h \ - $$REPORT_PATH/lritemdesignintf.h \ - $$REPORT_PATH/lrdesignelementsfactory.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrstringpropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrrectproptem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrdatasourcepropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrfontpropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrimagepropitem.h \ $$REPORT_PATH/objectinspector/propertyItems/lrintpropitem.h \ $$REPORT_PATH/objectinspector/propertyItems/lrenumpropitem.h \ $$REPORT_PATH/objectinspector/propertyItems/lrboolpropitem.h \ $$REPORT_PATH/objectinspector/propertyItems/lrflagspropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrgroupfieldpropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrcontentpropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrqrealpropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrcolorpropitem.h \ $$REPORT_PATH/objectinspector/editors/lrtextitempropertyeditor.h \ $$REPORT_PATH/objectinspector/editors/lrcomboboxeditor.h \ $$REPORT_PATH/objectinspector/editors/lrcheckboxeditor.h \ $$REPORT_PATH/objectinspector/editors/lrbuttonlineeditor.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrgroupfieldpropitem.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrcontentpropitem.h \ + $$REPORT_PATH/objectinspector/editors/lrimageeditor.h \ + $$REPORT_PATH/objectinspector/editors/lrcoloreditor.h \ + $$REPORT_PATH/objectinspector/editors/lrfonteditor.h \ + $$REPORT_PATH/objectinspector/lrbasedesignobjectmodel.h \ + $$REPORT_PATH/objectinspector/lrobjectinspectorwidget.h \ + $$REPORT_PATH/objectinspector/lrobjectitemmodel.h \ + $$REPORT_PATH/objectinspector/lrobjectpropitem.h \ + $$REPORT_PATH/objectinspector/lrpropertydelegate.h \ $$REPORT_PATH/objectsbrowser/lrobjectbrowser.h \ - $$REPORT_PATH/items/lrtextitem.h \ - $$REPORT_PATH/items/lrsubitemparentpropitem.h \ - $$REPORT_PATH/items/lralignpropitem.h \ - $$REPORT_PATH/items/lrhorizontallayout.h \ $$REPORT_PATH/items/editors/lritemeditorwidget.h \ $$REPORT_PATH/items/editors/lrfonteditorwidget.h \ $$REPORT_PATH/items/editors/lrtextalignmenteditorwidget.h \ $$REPORT_PATH/items/editors/lritemsaligneditorwidget.h \ $$REPORT_PATH/items/editors/lritemsborderseditorwidget.h \ + $$REPORT_PATH/items/lrtextitem.h \ + $$REPORT_PATH/items/lrsubitemparentpropitem.h \ + $$REPORT_PATH/items/lralignpropitem.h \ + $$REPORT_PATH/items/lrhorizontallayout.h \ + $$REPORT_PATH/items/lrtextitemeditor.h \ + $$REPORT_PATH/items/lrshapeitem.h \ + $$REPORT_PATH/items/lrimageitem.h \ + $$REPORT_PATH/items/lrsimpletagparser.h \ + $$REPORT_PATH/lrbanddesignintf.h \ + $$REPORT_PATH/lrpageitemdesignintf.h \ + $$REPORT_PATH/lrbandsmanager.h \ + $$REPORT_PATH/lrglobal.h \ $$REPORT_PATH/lrdatadesignintf.h \ $$REPORT_PATH/lrcollection.h \ $$REPORT_PATH/lrpagedesignintf.h \ @@ -158,26 +169,15 @@ HEADERS += \ $$REPORT_PATH/lrreportengine_p.h \ $$REPORT_PATH/lrdatasourcemanager.h \ $$REPORT_PATH/lrreportdesignwindow.h \ - $$REPORT_PATH/items/lrsimpletagparser.h \ - $$REPORT_PATH/bands/lrsubdetailband.h \ $$REPORT_PATH/lrreportrender.h \ $$REPORT_PATH/lrpreviewreportwindow.h \ $$REPORT_PATH/lrpreviewreportwidget.h \ $$REPORT_PATH/lrpreviewreportwidget_p.h \ $$REPORT_PATH/lrgraphicsviewzoom.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrfontpropitem.h \ - $$REPORT_PATH/objectinspector/editors/lrfonteditor.h \ - $$REPORT_PATH/items/lrimageitem.h \ - $$REPORT_PATH/objectinspector/editors/lrimageeditor.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrimagepropitem.h \ - $$REPORT_PATH/items/lrtextitemeditor.h \ - $$REPORT_PATH/objectinspector/lrbasedesignobjectmodel.h \ + $$REPORT_PATH/lrbasedesignintf.h \ + $$REPORT_PATH/lritemdesignintf.h \ + $$REPORT_PATH/lrdesignelementsfactory.h \ $$REPORT_PATH/lrscriptenginemanager.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrqrealpropitem.h \ - $$REPORT_PATH/items/lrshapeitem.h \ - $$REPORT_PATH/objectinspector/editors/lrcoloreditor.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrcolorpropitem.h \ - $$REPORT_PATH/bands/lrgroupbands.h \ $$REPORT_PATH/lrvariablesholder.h \ $$REPORT_PATH/lrgroupfunctions.h \ $$REPORT_PATH/lrreportengine.h \ @@ -204,6 +204,7 @@ FORMS += \ $$REPORT_PATH/lraboutdialog.ui \ $$REPORT_PATH/lrsettingdialog.ui + RESOURCES += \ $$REPORT_PATH/objectinspector/lobjectinspector.qrc \ $$REPORT_PATH/databrowser/lrdatabrowser.qrc \ From 04745def1e3d5fd1b87595288931ee16f26a6021 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 4 Nov 2016 01:24:03 +0300 Subject: [PATCH 08/51] TextItem splitting has been fixed --- limereport/items/lrtextitem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 7d61562..421675d 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -655,11 +655,11 @@ BaseDesignIntf *TextItem::cloneBottomPart(int height, QObject *owner, QGraphicsI loop_exit:; int textPos=0; - for (;curBlock!=m_text->end();curBlock=curBlock.next(),curLine=0){ + for (;curBlock!=m_text->end() || curLinelineCount();curLine++){ if (tmpText=="") textPos= curBlock.layout()->lineAt(curLine).textStart(); tmpText+=curBlock.text().mid(curBlock.layout()->lineAt(curLine).textStart(), - curBlock.layout()->lineAt(curLine).textLength()) + "\n"; + curBlock.layout()->lineAt(curLine).textLength()); } } tmpText.chop(1); From 5b95b9b3d69ad3b62c0c6e80503ef590be284951 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 4 Nov 2016 01:11:45 +0300 Subject: [PATCH 09/51] followTo has been added followTo has been added --- limereport/items/lrtextitem.cpp | 176 ++++++++++++++++++++++++-------- limereport/items/lrtextitem.h | 25 ++++- limereport/lrbanddesignintf.cpp | 1 + limereport/lrbasedesignintf.cpp | 29 +++++- limereport/lrbasedesignintf.h | 6 ++ limereport/lrpageinitintf.h | 9 ++ limereport/lrreportrender.cpp | 12 ++- 7 files changed, 202 insertions(+), 56 deletions(-) create mode 100644 limereport/lrpageinitintf.h diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 7d61562..041a737 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include "lrpagedesignintf.h" @@ -57,7 +58,7 @@ namespace LimeReport{ TextItem::TextItem(QObject *owner, QGraphicsItem *parent) : ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0), m_trimValue(true), m_allowHTML(false), - m_allowHTMLInFields(false) + m_allowHTMLInFields(false), m_followTo(""), m_follower(0) { m_text = new QTextDocument(); @@ -265,8 +266,13 @@ void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, i setWidth(m_textSize.width() + fakeMarginSize()*2); } - if ((m_textSize.height()>height()) && (m_autoHeight) ){ - setHeight(m_textSize.height()+borderLineSize()*2); + if (m_textSize.height()>height()) { + if (m_autoHeight) + setHeight(m_textSize.height()+borderLineSize()*2); + else if (hasFollower() && !content().isEmpty()){ + follower()->setContent(getTextPart(0,height())); + setContent(getTextPart(height(),0)); + } } BaseDesignIntf::updateItemSize(dataManager, pass, maxHeight); } @@ -353,6 +359,7 @@ void TextItem::setLineSpacing(int value) void TextItem::initText() { + if (!m_text) return; QTextOption to; to.setAlignment(m_alignment); @@ -454,6 +461,66 @@ QString TextItem::formatFieldValue() } } +QString TextItem::followTo() const +{ + return m_followTo; +} + +void TextItem::setFollowTo(const QString &followTo) +{ + if (m_followTo != followTo){ + QString oldValue = m_followTo; + m_followTo = followTo; + if (!isLoading()){ + TextItem* fi = scene()->findChild(followTo); + if (fi && initFollower(followTo)){ + notify("followTo",oldValue,followTo); + } else { + m_followTo = ""; + QMessageBox::critical( + 0, + tr("Error"), + tr("TextItem \" %1 \" already has folower \" %2 \" ") + .arg(fi->objectName()) + .arg(fi->follower()->objectName()) + ); + notify("followTo",followTo,""); + } + } + } +} + +void TextItem::setFollower(TextItem *follower) +{ + if (!m_follower){ + m_follower = follower; + } +} + +bool TextItem::hasFollower() +{ + return m_follower != 0; +} + +bool TextItem::initFollower(QString follower) +{ + TextItem* fi = scene()->findChild(follower); + if (fi){ + if (!fi->hasFollower()){ + fi->setFollower(this); + return true; + } + } + return false; +} + +void TextItem::pageObjectHasBeenLoaded() +{ + if (!m_followTo.isEmpty()){ + initFollower(m_followTo); + } +} + TextItem::ValueType TextItem::valueType() const { return m_valueType; @@ -537,6 +604,7 @@ bool TextItem::isNeedUpdateSize(RenderPass pass) const Q_UNUSED(pass) bool res = (m_textSize.height()>geometry().height()&&autoHeight()) || (m_textSize.width()>geometry().width()&&autoWidth()) || + m_follower || isNeedExpandContent(); return res; } @@ -557,6 +625,7 @@ void TextItem::setAlignment(Qt::Alignment value) void TextItem::expandContent(DataSourceManager* dataManager, RenderPass pass) { + QString context=content(); ExpandType expandType = (allowHTML() && !allowHTMLInFields())?ReplaceHTMLSymbols:NoEscapeSymbols; switch(pass){ @@ -575,6 +644,7 @@ void TextItem::expandContent(DataSourceManager* dataManager, RenderPass pass) } else { setContent(context); } + } void TextItem::setAutoHeight(bool value) @@ -611,63 +681,79 @@ bool TextItem::canBeSplitted(int height) const return height>(m_text->begin().layout()->lineAt(0).height()); } -BaseDesignIntf *TextItem::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent) -{ +QString TextItem::getTextPart(int height, int skipHeight){ int linesHeight=0; - QString tmpText=""; - TextItem* upperPart = dynamic_cast(cloneItem(itemMode(),owner,parent)); + int curLine=0; + int textPos=0; - for (QTextBlock it=m_text->begin();it!=m_text->end();it=it.next()){ - for (int i=0;ilineCount();i++){ - linesHeight+=it.layout()->lineAt(i).height()+lineSpacing(); - if (linesHeight>(height-(fakeMarginSize()*2+borderLineSize()*2))) { - linesHeight-=it.layout()->lineAt(i).height(); - goto loop_exit; + QTextBlock curBlock = m_text->begin(); + QString resultText=""; + + if (skipHeight>0){ + for (;curBlock!=m_text->end();curBlock=curBlock.next()){ + for (curLine=0;curLinelineCount();curLine++){ + linesHeight+=curBlock.layout()->lineAt(curLine).height()+lineSpacing(); + if (linesHeight>(skipHeight-(/*fakeMarginSize()*2+*/borderLineSize()*2))) {goto loop_exit;} + } + } + loop_exit:; + } + + linesHeight = 0; + qDebug()<end()); + for (;curBlock!=m_text->end() || curLinelineCount();curLine++){ + if (resultText=="") textPos= curBlock.layout()->lineAt(curLine).textStart(); + linesHeight+=curBlock.layout()->lineAt(curLine).height()+lineSpacing(); + if ( (height>0) && (linesHeight>(height-(/*fakeMarginSize()*2+*/borderLineSize()*2))) ) { + linesHeight-=curBlock.layout()->lineAt(curLine).height(); + goto loop_exit1; } - tmpText+=it.text().mid(it.layout()->lineAt(i).textStart(),it.layout()->lineAt(i).textLength())+'\n'; + resultText+=curBlock.text().mid(curBlock.layout()->lineAt(curLine).textStart(), + curBlock.layout()->lineAt(curLine).textLength()); } } - loop_exit: - tmpText.chop(1); + loop_exit1:; + + resultText.chop(1); - upperPart->setHeight(linesHeight+fakeMarginSize()*2+borderLineSize()*2); QScopedPointer context(new HtmlContext(m_strText)); - upperPart->setContent(context->extendTextByTags(tmpText,0)); + return context->extendTextByTags(resultText,textPos); +} + +void TextItem::restoreLinksEvent() +{ + if (!followTo().isEmpty()){ + BaseDesignIntf* pi = dynamic_cast(parentItem()); + if (pi){ + foreach (BaseDesignIntf* bi, pi->childBaseItems()) { + if (bi->patternName().compare(followTo())==0){ + TextItem* ti = dynamic_cast(bi); + if (ti){ + ti->setFollower(this); + } + } + } + } + } +} + +BaseDesignIntf *TextItem::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent) +{ + TextItem* upperPart = dynamic_cast(cloneItem(itemMode(),owner,parent)); + upperPart->setContent(getTextPart(height,0)); upperPart->initText(); + upperPart->setHeight(upperPart->textSize().height()+borderLineSize()*2); return upperPart; } BaseDesignIntf *TextItem::cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent) { TextItem* bottomPart = dynamic_cast(cloneItem(itemMode(),owner,parent)); - int linesHeight=0; - int curLine=0; - QTextBlock curBlock; - - QString tmpText=""; - - for (curBlock=m_text->begin();curBlock!=m_text->end();curBlock=curBlock.next()){ - for (curLine=0;curLinelineCount();curLine++){ - linesHeight+=curBlock.layout()->lineAt(curLine).height()+lineSpacing(); - if (linesHeight>(height-(fakeMarginSize()*2+borderLineSize()*2))) {goto loop_exit;} - } - } - loop_exit:; - - int textPos=0; - for (;curBlock!=m_text->end();curBlock=curBlock.next(),curLine=0){ - for (;curLinelineCount();curLine++){ - if (tmpText=="") textPos= curBlock.layout()->lineAt(curLine).textStart(); - tmpText+=curBlock.text().mid(curBlock.layout()->lineAt(curLine).textStart(), - curBlock.layout()->lineAt(curLine).textLength()) + "\n"; - } - } - tmpText.chop(1); - - QScopedPointer context(new HtmlContext(m_strText)); - bottomPart->setContent(context->extendTextByTags(tmpText,textPos)); + bottomPart->setContent(getTextPart(0,height)); bottomPart->initText(); - bottomPart->setHeight(bottomPart->m_textSize.height()+borderLineSize()*2); + bottomPart->setHeight(bottomPart->textSize().height()+borderLineSize()*2); return bottomPart; } diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index 07c3412..bda15d8 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -32,15 +32,16 @@ #include #include #include -#include "lritemdesignintf.h" -#include - #include +#include "lritemdesignintf.h" +#include "lritemdesignintf.h" +#include "lrpageinitintf.h" + namespace LimeReport { class Tag; -class TextItem : public LimeReport::ContentItemDesignIntf { +class TextItem : public LimeReport::ContentItemDesignIntf, IPageInit { Q_OBJECT Q_ENUMS(AutoWidth) Q_ENUMS(AngleType) @@ -66,6 +67,7 @@ class TextItem : public LimeReport::ContentItemDesignIntf { Q_PROPERTY(bool allowHTMLInFields READ allowHTMLInFields WRITE setAllowHTMLInFields) Q_PROPERTY(QString format READ format WRITE setFormat) Q_PROPERTY(ValueType valueType READ valueType WRITE setValueType) + Q_PROPERTY(QString followTo READ followTo WRITE setFollowTo) public: enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength}; @@ -140,12 +142,25 @@ public: ValueType valueType() const; void setValueType(const ValueType valueType); + QSizeF textSize(){ return m_textSize;} + QString followTo() const; + void setFollowTo(const QString &followTo); + void setFollower(TextItem* follower); + bool hasFollower(); + TextItem* follower(){ return m_follower;} + bool initFollower(QString follower); + + // IPageInit interface + void pageObjectHasBeenLoaded(); + protected: void updateLayout(); bool isNeedExpandContent() const; QString replaceBR(QString text); QString replaceReturns(QString text); int fakeMarginSize(); + QString getTextPart(int height, int skipHeight); + void restoreLinksEvent(); private: void initText(); void setTextFont(const QFont &value); @@ -174,6 +189,8 @@ private: QString m_format; ValueType m_valueType; + QString m_followTo; + TextItem* m_follower; }; } diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index a55f74c..c7b3dcc 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -889,6 +889,7 @@ void BandDesignIntf::updateItemSize(DataSourceManager* dataManager, RenderPass p if (borderLines()!=0){ spaceBorder += borderLineSize(); } + restoreLinks(); snapshotItemsLayout(); arrangeSubItems(pass, dataManager); if (autoHeight()){ diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 8b632d5..a901997 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -76,7 +76,8 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q m_itemAlign(DesignedItemAlign), m_changingItemAlign(false), m_borderColor(Qt::black), - m_reportSettings(0) + m_reportSettings(0), + m_patternName("") { setGeometry(QRectF(0, 0, m_width, m_height)); if (BaseDesignIntf *item = dynamic_cast(parent)) { @@ -672,6 +673,16 @@ void BaseDesignIntf::turnOnSelectionMarker(bool value) } } +QString BaseDesignIntf::patternName() const +{ + return m_patternName; +} + +void BaseDesignIntf::setPatternName(const QString &patternName) +{ + m_patternName = patternName; +} + ReportSettings *BaseDesignIntf::reportSettings() const { return m_reportSettings; @@ -737,7 +748,7 @@ void BaseDesignIntf::emitObjectNamePropertyChanged(const QString &oldName, const int BaseDesignIntf::borderLineSize() const { - return m_borderLineSize; + return 0 /*m_borderLineSize*/; } void BaseDesignIntf::setBorderLineSize(int value) @@ -987,6 +998,19 @@ void BaseDesignIntf::parentChangedEvent(BaseDesignIntf *) } +void BaseDesignIntf::restoreLinks() +{ +#ifdef HAVE_QT5 + foreach(QObject * child, children()) { +#else + foreach(QObject * child, QObject::children()) { +#endif + BaseDesignIntf *childItem = dynamic_cast(child); + if (childItem) {childItem->restoreLinks();} + } + restoreLinksEvent(); +} + QPainterPath BaseDesignIntf::shape() const { QPainterPath path; @@ -1229,6 +1253,7 @@ void BaseDesignIntf::collectionLoadFinished(const QString &collectionName) BaseDesignIntf *BaseDesignIntf::cloneItem(ItemMode mode, QObject *owner, QGraphicsItem *parent) { BaseDesignIntf *clone = cloneItemWOChild(mode, owner, parent); + clone->setPatternName(this->objectName()); #ifdef HAVE_QT5 foreach(QObject * child, children()) { #else diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index f31bf73..dae9cf4 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -249,6 +249,8 @@ public: ReportSettings* reportSettings() const; void setReportSettings(ReportSettings *reportSettings); void setZValueProperty(qreal value); + QString patternName() const; + void setPatternName(const QString &patternName); Q_INVOKABLE QString setItemWidth(qreal width); Q_INVOKABLE QString setItemHeight(qreal height); @@ -258,6 +260,7 @@ public: Q_INVOKABLE qreal getItemPosY(); Q_INVOKABLE QString setItemPosX(qreal xValue); Q_INVOKABLE QString setItemPosY(qreal yValue); + protected: //ICollectionContainer @@ -283,6 +286,8 @@ protected: virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value); virtual void childAddedEvent(BaseDesignIntf* child); virtual void parentChangedEvent(BaseDesignIntf*); + void restoreLinks(); + virtual void restoreLinksEvent(){} void drawTopLine(QPainter *painter, QRectF rect) const; void drawBootomLine(QPainter *painter, QRectF rect) const; @@ -359,6 +364,7 @@ private: bool m_changingItemAlign; QColor m_borderColor; ReportSettings* m_reportSettings; + QString m_patternName; signals: void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry); void posChanged(QObject* object, QPointF newPos, QPointF oldPos); diff --git a/limereport/lrpageinitintf.h b/limereport/lrpageinitintf.h new file mode 100644 index 0000000..346138b --- /dev/null +++ b/limereport/lrpageinitintf.h @@ -0,0 +1,9 @@ +#ifndef LRPAGEINITINTF_H +#define LRPAGEINITINTF_H + +class IPageInit{ +public: + virtual void pageObjectHasBeenLoaded() = 0; +}; + +#endif // LRPAGEINITINTF_H diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 42dacef..3d39635 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -204,7 +204,6 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) resetPageNumber(PageReset); } - //m_pageCount = 1; m_renderCanceled = false; BandDesignIntf* reportFooter = m_patternPageItem->bandByType(BandDesignIntf::ReportFooter); m_reportFooterHeight = 0; @@ -225,9 +224,7 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) QMessageBox::critical(0,tr("Error"),exception.what()); return; } - clearPageMap(); - startNewPage(); renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader),StartNewPageAsNeeded); @@ -543,15 +540,21 @@ void ReportRender::renderPageFooter(PageItemDesignIntf *patternPage) void ReportRender::renderPageItems(PageItemDesignIntf* patternPage) { + QList pageItems; foreach (BaseDesignIntf* item, patternPage->childBaseItems()) { ItemDesignIntf* id = dynamic_cast(item); if (id&&id->itemLocation()==ItemDesignIntf::Page){ BaseDesignIntf* cloneItem = item->cloneItem(m_renderPageItem->itemMode(), m_renderPageItem, m_renderPageItem); - cloneItem->updateItemSize(m_datasources); + pageItems.append(cloneItem); + //cloneItem->updateItemSize(m_datasources); } } + m_renderPageItem->restoreLinks(); + foreach(BaseDesignIntf* item, pageItems){ + item->updateItemSize(m_datasources); + } } qreal ReportRender::calcPageFooterHeight(PageItemDesignIntf *patternPage) @@ -978,7 +981,6 @@ void ReportRender::startNewPage() renderBand(band); } checkLostHeadersOnPrevPage(); - pasteGroups(); renderPageItems(m_patternPageItem); } From 33959d38820bb73724b6247c5b14fa8d40750cc8 Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Wed, 16 Nov 2016 01:31:06 +0300 Subject: [PATCH 10/51] Icons have been changed --- limereport/images/addBand1.png | Bin 450 -> 205 bytes limereport/images/addBand2.png | Bin 0 -> 229 bytes limereport/images/delete2.png | Bin 0 -> 460 bytes limereport/images/edit_control_4_24.png | Bin 0 -> 290 bytes limereport/images/hlayuot_4_24.png | Bin 0 -> 210 bytes limereport/items/images/barcode4.png | Bin 0 -> 171 bytes limereport/items/images/barcode5.png | Bin 0 -> 221 bytes limereport/items/images/imageItem4.png | Bin 0 -> 259 bytes limereport/items/images/insert-text_6.png | Bin 409 -> 226 bytes limereport/items/images/shapes7.png | Bin 0 -> 648 bytes limereport/items/items.qrc | 14 +++++++++----- limereport/report.qrc | 12 ++++++++---- 12 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 limereport/images/addBand2.png create mode 100644 limereport/images/delete2.png create mode 100644 limereport/images/edit_control_4_24.png create mode 100644 limereport/images/hlayuot_4_24.png create mode 100644 limereport/items/images/barcode4.png create mode 100644 limereport/items/images/barcode5.png create mode 100644 limereport/items/images/imageItem4.png create mode 100644 limereport/items/images/shapes7.png diff --git a/limereport/images/addBand1.png b/limereport/images/addBand1.png index d83b77efb9ed0a6dc50ab59eaff2a053a6440b8b..d559323d0a60a5d0758e9a4f3487c0ac9ad041f8 100644 GIT binary patch delta 119 zcmX@ae3o&73aes(Pl)Tp5=FUypUFEI7#J8!g8YIR9G=}s196hP-CYzopr04gaX5&!@I delta 365 zcmX@hc!+s|N&ri`qpu?a!^VE@KZ&di3=9g%9znhg3{`3j3=J&|48MRv4KElNN(~qo zUL`OvSj}Ky5HFasE6@fgVG!UG;;LJ+N@1|qNbw8{HfEIBcz8V0CMPrOl2c@s zV0q;T6kMkGvoX;%h?VD=(H%RM_T`0E?wto25@#70xic^iWSDQ3Nk7|v$1*Rc=`e+QG z)c^ng1AZp&04ioI3GxeOaCmkj4a7H=O_6OYjVm$m8n`EtkLbjeRjv*44lM@v9B#f06ni=_A9VFFMRasS4RTWy#9n3Wg zkmFLQ5|9yDyzxb%!?nW>9{ihnHZsac8BbtjnDmOr<8Ov4nJa0`PlBg3pYAU*6Qp1!W^54ico#Kp63_U!RbWQq!>L-TnXk_V#~s z=S(eNTGrRd8aXd`MykCu|7Hd`c1wkgtP&CuA{RsrHX2zO7#MIQ{ZPnTw6b}D(eb)0 zmp8w6+slYQoo{!*fxkiUq@=g*@5r4qc~2O=`F?%Bc$$m6zKdA0WB8F%XLAl5JpaZ) zSKi>^q#wUu+c)d1mIL9#K<^m-(AmH9!Jq&2{~vE@U|r6-|G)8*DF37cAkesxb^O4A z0}Y4%AN$a%cwO{h`r|Z}v+O4PivqdbbR`_c9-KM3MyBV3%$ZXMJ0>kI{OGx6yMBbZm3CJ0StErPgg&ebxsLQ0JUPj ABme*a literal 0 HcmV?d00001 diff --git a/limereport/images/edit_control_4_24.png b/limereport/images/edit_control_4_24.png new file mode 100644 index 0000000000000000000000000000000000000000..1964712e14ae1cce622edb14638d38f94aa0eee4 GIT binary patch literal 290 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjY)RhkE(~!D6B$geFx@c(if|Tq zL>4nJa0`PlBg3pYAU*6Qp1!W^54icogarSek#7SEt@m_s4DmRgoFKu<%qua`vQXIf zfAHZ8u0NMQe70$Uch~E}z?2`Sz3&J7@Hvw8#O{U1v{s)ZQgQL|{?k-_w)8zYn9jKJ zpvxxK4LcOBDQ#-*i0IbnV|H5E-8yB%y7lXidp%~>*-^AeXcA*@Z?DSpgr)@x7e1_a zc0OF6xdS@h(>g$o_S*T?ayr8p!fD>ECuI>Dz^bI^H`>JzDRPHR-B e96Ne}m0_OtRJ%^OQ&m8xGkCiCxvX4nJaD4z_MyE9<_s4MR=LEu4!2T6pHtBaSZV|o}3`T%EF**q@K6v zWqk>2_a}ejB;n)g+co~1+=&q@@hr5}v-tgVX@0@CLwkZXUOiHuDR|}Z0U&UBtsu2E z;Yw2=x0|lS)&?nt#dZ$*=QmFMf8>=Us|zE8@Js29syCni0b0f2>FVdQ&MBb@0LlVI Ah5!Hn literal 0 HcmV?d00001 diff --git a/limereport/items/images/barcode4.png b/limereport/items/images/barcode4.png new file mode 100644 index 0000000000000000000000000000000000000000..635b9776295b6e20e651fe2cfa8e9a0f5ef2672a GIT binary patch literal 171 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjY)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYYs>cdx@v7EBga(enBI~q7Al3fkGCZE{-7{$CDEzSev?s9 z-rL5g7G+&^r74ixO;=)T!<|EYv(k8c1RiQPb?Pp2Klp%=p`=M;TUG9hc|bE5JYD@< J);T3K0RTn6GE4vf literal 0 HcmV?d00001 diff --git a/limereport/items/images/barcode5.png b/limereport/items/images/barcode5.png new file mode 100644 index 0000000000000000000000000000000000000000..5c195c28867b6b448441fd5a87f66f1a06af7c72 GIT binary patch literal 221 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjY)RhkE(~!D6B$geFx@c(if|Tq zL>4nJa0`PlBg3pYAU*6Qp1!W^54icoBup(8gzo}{vOHZJLp+WrCoC{bNJ&UY=$M`H zYra^U{we#jCzu}VoUwKdJ^WaGrlA1{T(s(FTgbX$!(q3_lbx5fR|@n-8Dt%Nu(^RT zEaotS(d>|hJia*j2ij~Mno0$~8loB&@Vf;I@@!b(erEzRL*%c$*OGsq`U13-!PC{x JWt~$(6973cM&tkh literal 0 HcmV?d00001 diff --git a/limereport/items/images/imageItem4.png b/limereport/items/images/imageItem4.png new file mode 100644 index 0000000000000000000000000000000000000000..589cc691ba697da4a478ed56a744f467df390cbb GIT binary patch literal 259 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjY)RhkE(~!D6B$geFx@c(if|Tq zL>4nJaD4z_MyE9<_s4#Uy#^?N&_z3Qh2IaSZV|o}3`@szLBr$Lx$> z^JlT?pRzxD;s6jd>Fh9gFA~brKR<;n-T0zaM?q9T*@4D|ZyK0$bsWrQ1bMTmb?lPi zOGur}98usIkoDof@UP->aylbL#~E87pL;sZ4b> z(big#Y7xf0B2mMSdqu8=TjZBdm(1G&8~7OBEZ1AOXQ}%_pxYQcUHx3vIVCg!0AZnA A8~^|S literal 0 HcmV?d00001 diff --git a/limereport/items/images/insert-text_6.png b/limereport/items/images/insert-text_6.png index 0d68f8e8768dbfc049d43b4bc2dda169b8b38f76..ac5982ddd05c60bba10c7d988bda4034e8200c7a 100644 GIT binary patch delta 182 zcmbQq{D^Uagfs^m0|Uc@a@!w3iY>|8-Gw2JVIqU+6{b6e6L%=o^NUGy+9uh|1j^=n zx;Tb-98XS=c-0_ytYdb@ulcjs^iSEJJ#hdCnsjy;ycY@O>7Sp%mTr8}sv{$hk=yR% zCT2bt$xBZQ8f>^Pm>$+SqGp!hc*JGh_0CY^FTodAuqq#55=#NS%G|oWRD45bDP46hOx7_4S6Fo+k-*%fF5l+X(B32_C|`5UeCmzn2I zQc0U>9J@#_Yn5riMk|ou2CIUN)&)RvllA}q|3k|a7=fyJN`m}?84iiDv2ckWp1tJ7 zLZ2tSxY-fvqHzXCa&1s;*b3=FJ>Ak4V^tp>>P>?NMQuIvxESwt1p(qf-I z1Pa-Ex;TbNTux3nznC}Q!>*kacgk-w)GWI1B0ilpUXO@geCy9eR$RY diff --git a/limereport/items/images/shapes7.png b/limereport/items/images/shapes7.png new file mode 100644 index 0000000000000000000000000000000000000000..a9920f5451c95bc16b54f4ae68df5b601d391253 GIT binary patch literal 648 zcmV;30(bq1P)K*e7pTG$&^`gY0q_JsU!Xm{%_Bsi{ zHr^^7X)|7D_xomNzZnz#XH)R={$RbvuJW%SpSHg%lXJ$~V|UE&ja2Y*>1CGmyebX; z>!e3h;D_usL4dhB%XBb!Re*0G`k4|4@V!a!nGr;R!%{Lp_RWB-jzf+)oc`-D3_S4( zTzg2ZbBo$_%bVw)roEx1eevk?8r)|-$*wek(;v{EQ`1w}lhrI0%DVUL+5LYm&5yX>a_G8oOUn!#7)UW^lB%eK#|gSuHszKy9^m70Q>qfVN`^EY5FsK?_Yw6nJ2BKEY-z z0VJ7O)TF_KRAC*`q&~I~;N43*G5F|m#mQp}&1^az!NN0L3OuxuTW4mpn)n15QdR%g zs}Vzq=q->~4T>nO=A@$*X*IZYtf?X3uTl0qwz$yhSS)M3-`<{s2PzWa__}>$_9J+x z2Q`t@kV;-}i2Y-N5O917zYN{sKH5bR5`goG+x+-$RCrO~f&Kj2`1a~exzletZwK6) za4%|le03ZEnH`rp7Zz&A5N*3Yk~)L0u>TPTK9xSK+YuF7M2kj8MMH#Ikn_m>;si2Z iuoWmRXlQYEC%^y}fe*{3!pVLB0000images/insert-text_5.png images/shape5.png images/imageItem1.png - images/imageItem2.png + images/imageItem2.png images/settings.png images/settings2.png - images/hlayuot_3_24.png + images/hlayuot_3_24.png images/addBand1.png images/DataBand.png images/PageHeader.png @@ -34,8 +34,12 @@ images/GroupHeader16.png images/ReportPage16.png images/insert-text_6.png - images/barcode3.png - images/shape6.png - images/imageItem3.png + images/barcode3.png + images/shape6.png + images/imageItem3.png + images/barcode4.png + images/imageItem4.png + images/shapes7.png + images/barcode5.png diff --git a/limereport/report.qrc b/limereport/report.qrc index 6dfc6fe..0f74519 100644 --- a/limereport/report.qrc +++ b/limereport/report.qrc @@ -121,11 +121,11 @@ images/text_bold1.png images/text_italic1.png images/text_underline1.png - images/edit_control_3_24.png + images/edit_control_3_24.png images/edit_layout_4_24.png - images/hlayuot_3_24.png - images/addBand1.png - images/delete1.png + images/hlayuot_3_24.png + images/addBand1.png + images/delete1.png images/copy2.png images/new_leaf1.png images/paste1.png @@ -170,5 +170,9 @@ images/toolbar.png images/not_checked.png images/checked.png + images/hlayuot_4_24.png + images/delete2.png + images/addBand2.png + images/edit_control_4_24.png From e9b32ec7d737ebb3b371d69a76bdd887931b8f3a Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 17 Nov 2016 00:50:36 +0300 Subject: [PATCH 11/51] Version has been changed --- common.pri | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common.pri b/common.pri index 8eee2c5..2847ef6 100644 --- a/common.pri +++ b/common.pri @@ -55,8 +55,8 @@ OBJECTS_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/obj RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 -LIMEREPORT_VERSION_MINOR = 3 -LIMEREPORT_VERSION_RELEASE = 11 +LIMEREPORT_VERSION_MINOR = 4 +LIMEREPORT_VERSION_RELEASE = 1 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" From 61653c9bb36bb17aae7560827e37da6ed2daba90 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 18 Nov 2016 01:12:23 +0300 Subject: [PATCH 12/51] Calculated condition has been added to group band header --- limereport/bands/lrgroupbands.cpp | 49 ++++++++-- limereport/bands/lrgroupbands.h | 6 ++ limereport/lrbasedesignintf.cpp | 149 ++++++++++++++++++++++++++++- limereport/lrbasedesignintf.h | 10 ++ limereport/lritemdesignintf.cpp | 151 ------------------------------ limereport/lritemdesignintf.h | 13 +-- 6 files changed, 203 insertions(+), 175 deletions(-) diff --git a/limereport/bands/lrgroupbands.cpp b/limereport/bands/lrgroupbands.cpp index 965982b..74b55eb 100644 --- a/limereport/bands/lrgroupbands.cpp +++ b/limereport/bands/lrgroupbands.cpp @@ -31,7 +31,6 @@ #include "lrglobal.h" #include "lrdatasourcemanager.h" - const QString xmlTagHeader = QLatin1String("GroupHeader"); const QString xmlTagFooter = QLatin1String("GroupFooter"); @@ -98,6 +97,8 @@ void GroupBandHeader::startGroup(DataSourceManager* dataManager) if (ds && ds->columnIndexByName(m_groupFiledName)!=-1) m_groupFieldValue=ds->data(m_groupFiledName); } + + if (!m_condition.isEmpty()) m_conditionValue = calcCondition(dataManager); } QColor GroupBandHeader::bandColor() const @@ -114,20 +115,47 @@ QString GroupBandHeader::findDataSourceName(BandDesignIntf* parentBand){ } +QString GroupBandHeader::condition() const +{ + return m_condition; +} + +void GroupBandHeader::setCondition(const QString &condition) +{ + m_condition = condition; +} + +QString GroupBandHeader::calcCondition(DataSourceManager* dataManager){ + QString result = m_condition; + if (!m_condition.isEmpty()){ + result=expandUserVariables(result, FirstPass, NoEscapeSymbols, dataManager); + result=expandScripts(result, dataManager); + result=expandDataFields(result, NoEscapeSymbols, dataManager); + } + return result; +} + bool GroupBandHeader::isNeedToClose(DataSourceManager* dataManager) { if (!m_groupStarted) return false; - if (m_groupFiledName.isNull() || m_groupFiledName.isEmpty()) + if ((m_groupFiledName.isNull() || m_groupFiledName.isEmpty()) && condition().isEmpty()){ dataManager->putError(tr("Group field not found")); - QString datasourceName = findDataSourceName(parentBand()); - if (dataManager->containsDatasource(datasourceName)){ - IDataSource* ds = dataManager->dataSource(datasourceName); - if (ds){ - if (ds->data(m_groupFiledName).isNull() && m_groupFieldValue.isNull()) return false; - return ds->data(m_groupFiledName)!=m_groupFieldValue; - } + return false; + } + + if (!m_condition.isEmpty()){ + return m_conditionValue != calcCondition(dataManager); } else { - dataManager->putError(tr("Datasource \"%1\" not found !!!").arg(datasourceName)); + QString datasourceName = findDataSourceName(parentBand()); + if (dataManager->containsDatasource(datasourceName)){ + IDataSource* ds = dataManager->dataSource(datasourceName); + if (ds){ + if (ds->data(m_groupFiledName).isNull() && m_groupFieldValue.isNull()) return false; + return ds->data(m_groupFiledName)!=m_groupFieldValue; + } + } else { + dataManager->putError(tr("Datasource \"%1\" not found !!!").arg(datasourceName)); + } } return false; @@ -141,6 +169,7 @@ bool GroupBandHeader::isStarted() void GroupBandHeader::closeGroup() { m_groupFieldValue=QVariant(); + m_conditionValue=""; m_groupStarted=false; } diff --git a/limereport/bands/lrgroupbands.h b/limereport/bands/lrgroupbands.h index 9fa3eaa..42285d8 100644 --- a/limereport/bands/lrgroupbands.h +++ b/limereport/bands/lrgroupbands.h @@ -43,6 +43,7 @@ class GroupBandHeader : public BandDesignIntf, public IGroupBand{ Q_PROPERTY(bool startNewPage READ startNewPage WRITE setStartNewPage) Q_PROPERTY(bool resetPageNumber READ resetPageNumber WRITE setResetPageNumber) Q_PROPERTY(bool reprintOnEachPage READ reprintOnEachPage WRITE setReprintOnEachPage) + Q_PROPERTY(QString condition READ condition WRITE setCondition) public: GroupBandHeader(QObject* owner = 0, QGraphicsItem* parent=0); virtual bool isUnique() const; @@ -57,6 +58,8 @@ public: void setResetPageNumber(bool resetPageNumber); bool isHeader() const{return true;} bool isGroupHeader() const {return true;} + QString condition() const; + void setCondition(const QString &condition); private: virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0); void startGroup(DataSourceManager* dataManager); @@ -65,12 +68,15 @@ private: void closeGroup(); int index(); QString findDataSourceName(BandDesignIntf *parentBand); + QString calcCondition(DataSourceManager *dataManager); private: QVariant m_groupFieldValue; QString m_groupFiledName; bool m_groupStarted; //bool m_startNewPage; bool m_resetPageNumber; + QString m_condition; + QString m_conditionValue; }; class GroupBandFooter : public BandDesignIntf{ diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 8b632d5..2f00d93 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -85,9 +85,6 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q m_font = QFont("Arial",10); } initFlags(); - - - //connect(this,SIGNAL(objectNameChanged(QString)),this,SLOT(slotObjectNameChanged(QString))); } QRectF BaseDesignIntf::boundingRect() const @@ -242,6 +239,152 @@ QFont BaseDesignIntf::transformToSceneFont(const QFont& value) const return f; } +QString BaseDesignIntf::escapeSimbols(const QString &value) +{ + QString result = value; + result.replace("\"","\\\""); + result.replace('\n',"\\n"); + return result; +} + +QString BaseDesignIntf::replaceHTMLSymbols(const QString &value) +{ + QString result = value; + result.replace("<","<"); + result.replace(">",">"); + return result; +} + +QString BaseDesignIntf::expandDataFields(QString context, ExpandType expandType, DataSourceManager* dataManager) +{ + QRegExp rx(Const::FIELD_RX); + + if (context.contains(rx)){ + while ((rx.indexIn(context))!=-1){ + QString field=rx.cap(1); + + if (dataManager->containsField(field)) { + QString fieldValue; + m_varValue = dataManager->fieldData(field); + if (expandType == EscapeSymbols) { + if (dataManager->fieldData(field).isNull()) { + fieldValue="\"\""; + } else { + fieldValue = escapeSimbols(m_varValue.toString()); + switch (dataManager->fieldData(field).type()) { + case QVariant::Char: + case QVariant::String: + case QVariant::StringList: + case QVariant::Date: + case QVariant::DateTime: + fieldValue = "\""+fieldValue+"\""; + break; + default: + break; + } + } + } else { + if (expandType == ReplaceHTMLSymbols) + fieldValue = replaceHTMLSymbols(m_varValue.toString()); + else fieldValue = m_varValue.toString(); + } + + context.replace(rx.cap(0),fieldValue); + + } else { + QString error = QString("Field %1 not found in %2 !!! ").arg(field).arg(this->objectName()); + dataManager->putError(error); + if (!reportSettings() || !reportSettings()->suppressAbsentFieldsAndVarsWarnings()) + context.replace(rx.cap(0),error); + else + context.replace(rx.cap(0),""); + } + } + } + + return context; +} + +QString BaseDesignIntf::expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager* dataManager) +{ + QRegExp rx(Const::VARIABLE_RX); + if (context.contains(rx)){ + int pos = 0; + while ((pos = rx.indexIn(context,pos))!=-1){ + QString variable=rx.cap(1); + pos += rx.matchedLength(); + if (dataManager->containsVariable(variable) ){ + try { + if (pass==dataManager->variablePass(variable)){ + m_varValue = dataManager->variable(variable); + switch (expandType){ + case EscapeSymbols: + context.replace(rx.cap(0),escapeSimbols(m_varValue.toString())); + break; + case NoEscapeSymbols: + context.replace(rx.cap(0),m_varValue.toString()); + break; + case ReplaceHTMLSymbols: + context.replace(rx.cap(0),replaceHTMLSymbols(m_varValue.toString())); + break; + } + pos=0; + } + } catch (ReportError e){ + dataManager->putError(e.what()); + if (!reportSettings() || reportSettings()->suppressAbsentFieldsAndVarsWarnings()) + context.replace(rx.cap(0),e.what()); + else + context.replace(rx.cap(0),""); + } + } else { + QString error; + error = tr("Variable %1 not found").arg(variable); + dataManager->putError(error); + if (!reportSettings() || reportSettings()->suppressAbsentFieldsAndVarsWarnings()) + context.replace(rx.cap(0),error); + else + context.replace(rx.cap(0),""); + } + } + } + return context; +} + +QString BaseDesignIntf::expandScripts(QString context, DataSourceManager* dataManager) +{ + QRegExp rx(Const::SCRIPT_RX); + + if (context.contains(rx)){ + ScriptEngineManager::instance().setDataManager(dataManager); + QScriptEngine* se = ScriptEngineManager::instance().scriptEngine(); + + QScriptValue svThis = se->globalObject().property("THIS"); + if (svThis.isValid()){ + se->newQObject(svThis, this); + } else { + svThis = se->newQObject(this); + se->globalObject().setProperty("THIS",svThis); + } + + ScriptExtractor scriptExtractor(context); + if (scriptExtractor.parse()){ + for(int i=0; ievaluate(scriptBody); + if (!se->hasUncaughtException()) { + m_varValue = value.toVariant(); + context.replace(scriptExtractor.scriptAt(i),value.toString()); + } else { + context.replace(scriptExtractor.scriptAt(i),se->uncaughtException().toString()); + } + } + } + } + return context; +} + void BaseDesignIntf::setupPainter(QPainter *painter) const { if (!painter) { diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index f31bf73..cae3d77 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -116,6 +116,7 @@ public: }; enum ObjectState {ObjectLoading, ObjectLoaded, ObjectCreated}; enum ItemAlign {LeftItemAlign,RightItemAlign,CenterItemAlign,ParentWidthItemAlign,DesignedItemAlign}; + enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols}; Q_DECLARE_FLAGS(BorderLines, BorderSide) Q_DECLARE_FLAGS(ItemMode,ItemModes) friend class SelectionMarker; @@ -305,6 +306,15 @@ protected: virtual bool drawDesignBorders() const {return true;} virtual QColor selectionMarkerColor(){ return Const::SELECTION_COLOR;} + + QString escapeSimbols(const QString& value); + QString replaceHTMLSymbols(const QString& value); + virtual QString expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager *dataManager); + virtual QString expandDataFields(QString context, ExpandType expandType, DataSourceManager *dataManager); + virtual QString expandScripts(QString context, DataSourceManager *dataManager); + + QVariant m_varValue; + private: void updateSelectionMarker(); int resizeDirectionFlags(QPointF position); diff --git a/limereport/lritemdesignintf.cpp b/limereport/lritemdesignintf.cpp index db18eb2..5987086 100644 --- a/limereport/lritemdesignintf.cpp +++ b/limereport/lritemdesignintf.cpp @@ -113,157 +113,6 @@ void ItemDesignIntf::initFlags() } } -QString ContentItemDesignIntf::expandDataFields(QString context, ExpandType expandType, DataSourceManager* dataManager) -{ - QRegExp rx(Const::FIELD_RX); - - if (context.contains(rx)){ - while ((rx.indexIn(context))!=-1){ - QString field=rx.cap(1); - - if (dataManager->containsField(field)) { - QString fieldValue; - m_varValue = dataManager->fieldData(field); - if (expandType == EscapeSymbols) { - if (dataManager->fieldData(field).isNull()) { - fieldValue="\"\""; - } else { - fieldValue = escapeSimbols(m_varValue.toString()); - switch (dataManager->fieldData(field).type()) { - case QVariant::Char: - case QVariant::String: - case QVariant::StringList: - case QVariant::Date: - case QVariant::DateTime: - fieldValue = "\""+fieldValue+"\""; - break; - default: - break; - } - } - } else { - if (expandType == ReplaceHTMLSymbols) - fieldValue = replaceHTMLSymbols(m_varValue.toString()); - else fieldValue = m_varValue.toString(); - } - - context.replace(rx.cap(0),fieldValue); - - } else { - QString error = QString("Field %1 not found in %2 !!! ").arg(field).arg(this->objectName()); - dataManager->putError(error); - if (!reportSettings() || !reportSettings()->suppressAbsentFieldsAndVarsWarnings()) - context.replace(rx.cap(0),error); - else - context.replace(rx.cap(0),""); - } - } - } - - return context; -} - -QString ContentItemDesignIntf::expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager* dataManager) -{ - QRegExp rx(Const::VARIABLE_RX); - if (context.contains(rx)){ - int pos = 0; - while ((pos = rx.indexIn(context,pos))!=-1){ - QString variable=rx.cap(1); - pos += rx.matchedLength(); - if (dataManager->containsVariable(variable) ){ - try { - if (pass==dataManager->variablePass(variable)){ - m_varValue = dataManager->variable(variable); - switch (expandType){ - case EscapeSymbols: - context.replace(rx.cap(0),escapeSimbols(m_varValue.toString())); - break; - case NoEscapeSymbols: - context.replace(rx.cap(0),m_varValue.toString()); - break; - case ReplaceHTMLSymbols: - context.replace(rx.cap(0),replaceHTMLSymbols(m_varValue.toString())); - break; - } - pos=0; - } - } catch (ReportError e){ - dataManager->putError(e.what()); - if (!reportSettings() || reportSettings()->suppressAbsentFieldsAndVarsWarnings()) - context.replace(rx.cap(0),e.what()); - else - context.replace(rx.cap(0),""); - } - } else { - QString error; - error = tr("Variable %1 not found").arg(variable); - dataManager->putError(error); - if (!reportSettings() || reportSettings()->suppressAbsentFieldsAndVarsWarnings()) - context.replace(rx.cap(0),error); - else - context.replace(rx.cap(0),""); - } - } - } - return context; -} - -QString ContentItemDesignIntf::expandScripts(QString context, DataSourceManager* dataManager) -{ - QRegExp rx(Const::SCRIPT_RX); - - if (context.contains(rx)){ - ScriptEngineManager::instance().setDataManager(dataManager); - QScriptEngine* se = ScriptEngineManager::instance().scriptEngine(); - - QScriptValue svThis = se->globalObject().property("THIS"); - if (svThis.isValid()){ - se->newQObject(svThis, this); - } else { - svThis = se->newQObject(this); - se->globalObject().setProperty("THIS",svThis); - } - - ScriptExtractor scriptExtractor(context); - if (scriptExtractor.parse()){ - for(int i=0; ievaluate(scriptBody); - if (!se->hasUncaughtException()) { - m_varValue = value.toVariant(); - context.replace(scriptExtractor.scriptAt(i),value.toString()); - } else { - context.replace(scriptExtractor.scriptAt(i),se->uncaughtException().toString()); - } - } - } - } - return context; -} - -QString ContentItemDesignIntf::content() const -{ - return ""; -} - -QString ContentItemDesignIntf::escapeSimbols(const QString &value) -{ - QString result = value; - result.replace("\"","\\\""); - result.replace('\n',"\\n"); - return result; -} - -QString ContentItemDesignIntf::replaceHTMLSymbols(const QString &value) -{ - QString result = value; - result.replace("<","<"); - result.replace(">",">"); - return result; -} - Spacer::Spacer(QObject *owner, QGraphicsItem *parent) :ItemDesignIntf("Spacer",owner,parent){} diff --git a/limereport/lritemdesignintf.h b/limereport/lritemdesignintf.h index e6f6170..a9c8d7a 100644 --- a/limereport/lritemdesignintf.h +++ b/limereport/lritemdesignintf.h @@ -73,17 +73,8 @@ class ContentItemDesignIntf : public ItemDesignIntf public: ContentItemDesignIntf(const QString& xmlTypeName, QObject* owner = 0,QGraphicsItem* parent = 0) :ItemDesignIntf(xmlTypeName,owner,parent){} - virtual QString content() const; - virtual void setContent(const QString& value)=0; - enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols}; -protected: - QString escapeSimbols(const QString& value); - QString replaceHTMLSymbols(const QString& value); - virtual QString expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager *dataManager); - virtual QString expandDataFields(QString context, ExpandType expandType, DataSourceManager *dataManager); - virtual QString expandScripts(QString context, DataSourceManager *dataManager); - - QVariant m_varValue; + virtual QString content() const = 0; + virtual void setContent(const QString& value) = 0; }; class LayoutDesignIntf : public ItemDesignIntf{ From b4dea2fcfdfb335b30e12eb0be086aa02e4d7764 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 18 Nov 2016 01:14:01 +0300 Subject: [PATCH 13/51] New demo reports have been added --- demo_r1/demo_reports/simple_group.lrxml | 624 ++++++++++++++++++++++++ demo_r1/demo_reports/simple_list.lrxml | 511 +++++++++++++++++++ 2 files changed, 1135 insertions(+) create mode 100644 demo_r1/demo_reports/simple_group.lrxml create mode 100644 demo_r1/demo_reports/simple_list.lrxml diff --git a/demo_r1/demo_reports/simple_group.lrxml b/demo_r1/demo_reports/simple_group.lrxml new file mode 100644 index 0000000..3cb4b68 --- /dev/null +++ b/demo_r1/demo_reports/simple_group.lrxml @@ -0,0 +1,624 @@ + + + + + + + page1 + + + + + + + + ReportPage1 + + + + DataBand1 + + + + TextItem1 + + + + + DataBand1 + + + + + + + $D{customers.CompanyName} + + + + + + + + + + + + + + + + + + + + + + + TextItem5 + + + + + DataBand1 + + + + + + + $D{customers.Address} + + + + + + + + + + + + + + + + + + + + + + + TextItem6 + + + + + DataBand1 + + + + + + + $D{customers.Phone} + + + + + + + + + + + + + + + + + + + + + + + TextItem7 + + + + + DataBand1 + + + + + + + $D{customers.Fax} + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + + + + customers + + + + + + + + + + + + DataHeaderBand1 + + + + TextItem2 + + + + + DataHeaderBand1 + + + + + + + Company + + + + + + + + + + + + + + + + + + + + + + + TextItem4 + + + + + DataHeaderBand1 + + + + + + + Address + + + + + + + + + + + + + + + + + + + + + + + TextItem8 + + + + + DataHeaderBand1 + + + + + + + Phone + + + + + + + + + + + + + + + + + + + + + + + TextItem9 + + + + + DataHeaderBand1 + + + + + + + Fax + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + DataBand1 + + + + + + + + + + ReportHeader2 + + + + TextItem3 + + + + + ReportHeader2 + + + + + + + Customers + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + + + + + + + PageFooter9 + + + + TextItem10 + + + + + PageFooter9 + + + + + + + Page $V{#PAGE} of $V{#PAGE_COUNT} + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + + + + + + + + GroupBandHeader1 + + + + TextItem11 + + + + + GroupBandHeader1 + + + + + + + $S{$D{customers.CompanyName}.substring(0,1).toUpperCase();} + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + DataBand1 + + + + + + + + + $S{$D{customers.CompanyName}.substring(0,1).toUpperCase();} + + + GroupBandFooter11 + + + + TextItem12 + + + + + GroupBandFooter11 + + + + + + + Count: $S{COUNT($D{customers.CompanyName},"DataBand1")} + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + GroupBandHeader1 + + + + + + + + + + + + + + + + + + + + + + + + + datasources + + + + northwind.db + QSQLITE + D:/Work/C_Projects/LimeReportGitHub/build/5.6.1/win32/release/demo_r1/demo_reports/northwind.db + + + + + + + + + + customers + Select * from customers + northwind.db + + + + + + + + + + + + + + diff --git a/demo_r1/demo_reports/simple_list.lrxml b/demo_r1/demo_reports/simple_list.lrxml new file mode 100644 index 0000000..1ed49dd --- /dev/null +++ b/demo_r1/demo_reports/simple_list.lrxml @@ -0,0 +1,511 @@ + + + + + + + page1 + + + + + + + + ReportPage1 + + + + DataBand1 + + + + TextItem1 + + + + + DataBand1 + + + + + + + $D{customers.CompanyName} + + + + + + + + + + + + + + + + + + + + + + + TextItem5 + + + + + DataBand1 + + + + + + + $D{customers.Address} + + + + + + + + + + + + + + + + + + + + + + + TextItem6 + + + + + DataBand1 + + + + + + + $D{customers.Phone} + + + + + + + + + + + + + + + + + + + + + + + TextItem7 + + + + + DataBand1 + + + + + + + $D{customers.Fax} + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + + + + customers + + + + + + + + + + + + DataHeaderBand1 + + + + TextItem2 + + + + + DataHeaderBand1 + + + + + + + Company + + + + + + + + + + + + + + + + + + + + + + + TextItem4 + + + + + DataHeaderBand1 + + + + + + + Address + + + + + + + + + + + + + + + + + + + + + + + TextItem8 + + + + + DataHeaderBand1 + + + + + + + Phone + + + + + + + + + + + + + + + + + + + + + + + TextItem9 + + + + + DataHeaderBand1 + + + + + + + Fax + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + DataBand1 + + + + + + + + + + ReportHeader2 + + + + TextItem3 + + + + + ReportHeader2 + + + + + + + Customers + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + + + + + + + PageFooter9 + + + + TextItem10 + + + + + PageFooter9 + + + + + + + Page $V{#PAGE} of $V{#PAGE_COUNT} + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + datasources + + + + northwind.db + QSQLITE + D:/Work/C_Projects/LimeReportGitHub/build/5.6.1/win32/release/demo_r1/demo_reports/northwind.db + + + + + + + + + + customers + Select * from customers + northwind.db + + + + + + + + + + + + + + From dc5ee3d98bf3949990dd7fecea956e2403772f26 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 25 Nov 2016 23:54:23 +0300 Subject: [PATCH 14/51] Debug messages have been removed --- limereport/items/lrtextitem.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 041a737..d3d658b 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -700,8 +700,7 @@ QString TextItem::getTextPart(int height, int skipHeight){ } linesHeight = 0; - qDebug()<end()); + for (;curBlock!=m_text->end() || curLinelineCount();curLine++){ if (resultText=="") textPos= curBlock.layout()->lineAt(curLine).textStart(); From 229e8f529d7488c4a499dcf4877a620036af0fac Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 5 Dec 2016 22:58:52 +0300 Subject: [PATCH 15/51] resourcePath property has been added to ImageItem --- limereport/items/lrimageitem.cpp | 30 ++++++++++++++++++++---------- limereport/items/lrimageitem.h | 8 +++++--- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/limereport/items/lrimageitem.cpp b/limereport/items/lrimageitem.cpp index a8e255e..38e4441 100644 --- a/limereport/items/lrimageitem.cpp +++ b/limereport/items/lrimageitem.cpp @@ -56,16 +56,21 @@ BaseDesignIntf *ImageItem::createSameTypeItem(QObject *owner, QGraphicsItem *par void ImageItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight) { - if (!m_datasource.isEmpty() && !m_field.isEmpty() && m_picture.isNull()){ - IDataSource* ds = dataManager->dataSource(m_datasource); - if (ds) { - QVariant data = ds->data(m_field); - if (data.isValid()){ - if (data.type()==QVariant::Image){ - m_picture = data.value(); - } else - m_picture.loadFromData(data.toByteArray()); - } + + if (m_picture.isNull()){ + if (!m_datasource.isEmpty() && !m_field.isEmpty()){ + IDataSource* ds = dataManager->dataSource(m_datasource); + if (ds) { + QVariant data = ds->data(m_field); + if (data.isValid()){ + if (data.type()==QVariant::Image){ + m_picture = data.value(); + } else + m_picture.loadFromData(data.toByteArray()); + } + } + } else if (!m_resourcePath.isEmpty()){ + m_picture = QImage(m_resourcePath); } } if (m_autoSize){ @@ -80,6 +85,11 @@ bool ImageItem::isNeedUpdateSize(RenderPass) const return m_picture.isNull() || m_autoSize; } +QString ImageItem::resourcePath() const +{ + return m_resourcePath; +} + qreal ImageItem::minHeight() const{ if (!m_picture.isNull() && autoSize()) { diff --git a/limereport/items/lrimageitem.h b/limereport/items/lrimageitem.h index 4e3fa23..631f292 100644 --- a/limereport/items/lrimageitem.h +++ b/limereport/items/lrimageitem.h @@ -44,12 +44,14 @@ class ImageItem : public LimeReport::ItemDesignIntf Q_PROPERTY(bool scale READ scale WRITE setScale) Q_PROPERTY(bool keepAspectRatio READ keepAspectRatio WRITE setKeepAspectRatio) Q_PROPERTY(bool center READ center WRITE setCenter) + Q_PROPERTY(QString resourcePath READ resourcePath WRITE setResourcePath) public: ImageItem(QObject *owner, QGraphicsItem *parent); virtual void paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget); void setImage(QImage value); QImage image(){return m_picture;} - void setContent(const QString &value){m_content=value;} + void setResourcePath(const QString &value){m_resourcePath=value;} + QString resourcePath() const; QString datasource() const; void setDatasource(const QString &datasource); QString field() const; @@ -72,8 +74,8 @@ protected: bool isNeedUpdateSize(RenderPass) const; bool drawDesignBorders() const {return m_picture.isNull();} private: - QImage m_picture; - QString m_content; + QImage m_picture; + QString m_resourcePath; QString m_datasource; QString m_field; bool m_autoSize; From 54562d80cda143e58c243842d1099fc5a6762642 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 5 Dec 2016 23:00:32 +0300 Subject: [PATCH 16/51] checkIfEmpty has been refactored --- limereport/lrdatadesignintf.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index 3b24e66..f20f891 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -736,11 +736,15 @@ bool CallbackDatasource::checkIfEmpty(){ if (m_rowCount == 0) { return true; } else { - QVariant result = true; + QVariant isEmpty = true; + QVariant recordCount = 0; CallbackInfo info; + info.dataType = CallbackInfo::RowCount; + emit getCallbackData(info, recordCount); + if (recordCount.toInt()>0) return false; info.dataType = CallbackInfo::IsEmpty; - emit getCallbackData(info,result); - return result.toBool(); + emit getCallbackData(info,isEmpty); + return isEmpty.toBool(); } } From bca10198039e7549ae8b78076f3f4422a7705b6e Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 6 Dec 2016 00:16:50 +0300 Subject: [PATCH 17/51] Path to database has been fixed --- demo_r1/demo_reports/simple_group.lrxml | 118 +++++++++++++----------- demo_r1/demo_reports/simple_list.lrxml | 96 ++++++++++--------- 2 files changed, 118 insertions(+), 96 deletions(-) diff --git a/demo_r1/demo_reports/simple_group.lrxml b/demo_r1/demo_reports/simple_group.lrxml index 3cb4b68..e41daf7 100644 --- a/demo_r1/demo_reports/simple_group.lrxml +++ b/demo_r1/demo_reports/simple_group.lrxml @@ -5,28 +5,28 @@ page1 - + - + ReportPage1 - + DataBand1 - + TextItem1 - + DataBand1 - + @@ -37,7 +37,7 @@ - + @@ -53,15 +53,16 @@ + TextItem5 - + DataBand1 - + @@ -72,7 +73,7 @@ - + @@ -88,15 +89,16 @@ + TextItem6 - + DataBand1 - + @@ -107,7 +109,7 @@ - + @@ -123,15 +125,16 @@ + TextItem7 - + DataBand1 - + @@ -142,7 +145,7 @@ - + @@ -158,12 +161,13 @@ + ReportPage1 - + @@ -185,16 +189,16 @@ DataHeaderBand1 - + TextItem2 - + DataHeaderBand1 - + @@ -205,7 +209,7 @@ - + @@ -221,15 +225,16 @@ + TextItem4 - + DataHeaderBand1 - + @@ -240,7 +245,7 @@ - + @@ -256,15 +261,16 @@ + TextItem8 - + DataHeaderBand1 - + @@ -275,7 +281,7 @@ - + @@ -291,15 +297,16 @@ + TextItem9 - + DataHeaderBand1 - + @@ -310,7 +317,7 @@ - + @@ -326,12 +333,13 @@ + ReportPage1 - + @@ -348,16 +356,16 @@ ReportHeader2 - + TextItem3 - + ReportHeader2 - + @@ -368,7 +376,7 @@ - + @@ -384,12 +392,13 @@ + ReportPage1 - + @@ -402,16 +411,16 @@ PageFooter9 - + TextItem10 - + PageFooter9 - + @@ -422,7 +431,7 @@ - + @@ -438,12 +447,13 @@ + ReportPage1 - + @@ -457,16 +467,16 @@ GroupBandHeader1 - + TextItem11 - + GroupBandHeader1 - + @@ -477,7 +487,7 @@ - + @@ -493,12 +503,13 @@ + ReportPage1 - + @@ -517,16 +528,16 @@ GroupBandFooter11 - + TextItem12 - + GroupBandFooter11 - + @@ -537,7 +548,7 @@ - + @@ -553,12 +564,13 @@ + ReportPage1 - + @@ -572,7 +584,7 @@ - + @@ -595,7 +607,7 @@ northwind.db QSQLITE - D:/Work/C_Projects/LimeReportGitHub/build/5.6.1/win32/release/demo_r1/demo_reports/northwind.db + ./demo_reports/northwind.db diff --git a/demo_r1/demo_reports/simple_list.lrxml b/demo_r1/demo_reports/simple_list.lrxml index 1ed49dd..8cdc401 100644 --- a/demo_r1/demo_reports/simple_list.lrxml +++ b/demo_r1/demo_reports/simple_list.lrxml @@ -5,28 +5,28 @@ page1 - + - + ReportPage1 - + DataBand1 - + TextItem1 - + DataBand1 - + @@ -37,7 +37,7 @@ - + @@ -53,15 +53,16 @@ + TextItem5 - + DataBand1 - + @@ -72,7 +73,7 @@ - + @@ -88,15 +89,16 @@ + TextItem6 - + DataBand1 - + @@ -107,7 +109,7 @@ - + @@ -123,15 +125,16 @@ + TextItem7 - + DataBand1 - + @@ -142,7 +145,7 @@ - + @@ -158,12 +161,13 @@ + ReportPage1 - + @@ -185,16 +189,16 @@ DataHeaderBand1 - + TextItem2 - + DataHeaderBand1 - + @@ -205,7 +209,7 @@ - + @@ -221,15 +225,16 @@ + TextItem4 - + DataHeaderBand1 - + @@ -240,7 +245,7 @@ - + @@ -256,15 +261,16 @@ + TextItem8 - + DataHeaderBand1 - + @@ -275,7 +281,7 @@ - + @@ -291,15 +297,16 @@ + TextItem9 - + DataHeaderBand1 - + @@ -310,7 +317,7 @@ - + @@ -326,12 +333,13 @@ + ReportPage1 - + @@ -348,16 +356,16 @@ ReportHeader2 - + TextItem3 - + ReportHeader2 - + @@ -368,7 +376,7 @@ - + @@ -384,12 +392,13 @@ + ReportPage1 - + @@ -402,16 +411,16 @@ PageFooter9 - + TextItem10 - + PageFooter9 - + @@ -422,7 +431,7 @@ - + @@ -438,12 +447,13 @@ + ReportPage1 - + @@ -459,7 +469,7 @@ - + @@ -482,7 +492,7 @@ northwind.db QSQLITE - D:/Work/C_Projects/LimeReportGitHub/build/5.6.1/win32/release/demo_r1/demo_reports/northwind.db + ./demo_reports/northwind.db From 6d31f205667bba6cbaa6ca6cb0599aec321018af Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 6 Dec 2016 00:17:39 +0300 Subject: [PATCH 18/51] OneSlotDS has been added to demo_r1 --- demo_r1/mainwindow.cpp | 35 +++++++++++++++++++++++++++++++++-- demo_r1/mainwindow.h | 1 + 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/demo_r1/mainwindow.cpp b/demo_r1/mainwindow.cpp index b5afab8..bc96811 100644 --- a/demo_r1/mainwindow.cpp +++ b/demo_r1/mainwindow.cpp @@ -76,14 +76,16 @@ MainWindow::MainWindow(QWidget *parent) : this, SLOT(slotGetCallbackData(LimeReport::CallbackInfo,QVariant&))); connect(callbackDatasource, SIGNAL(changePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)), this, SLOT(slotChangePos(const LimeReport::CallbackInfo::ChangePosType&,bool&))); - //report->dataManager()->addCallbackDatasource(callbackDatasource,"master"); callbackDatasource = report->dataManager()->createCallbackDatasouce("detail"); connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)), this, SLOT(slotGetCallbackChildData(LimeReport::CallbackInfo,QVariant&))); connect(callbackDatasource, SIGNAL(changePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)), this, SLOT(slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosType&,bool&))); - //report->dataManager()->addCallbackDatasource(callbackDatasource,"detail"); + + callbackDatasource = report->dataManager()->createCallbackDatasouce("oneSlotDS"); + connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)), + this, SLOT(slotOneSlotDS(LimeReport::CallbackInfo,QVariant&))); QStringList simpleData; simpleData << "value1" << "value2" << "value3"; @@ -208,3 +210,32 @@ void MainWindow::slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosTyp if (type == LimeReport::CallbackInfo::First) result = ds->first(); else result = ds->next(); } + +void MainWindow::slotOneSlotDS(LimeReport::CallbackInfo info, QVariant &data) +{ + QStringList columns; + columns << "Name" << "Value" << "Image"; + switch (info.dataType) { + case LimeReport::CallbackInfo::RowCount: + data = 4; + break; + case LimeReport::CallbackInfo::ColumnCount: + data = columns.size(); + break; +// case LimeReport::CallbackInfo::IsEmpty: +// data = false; +// break; + case LimeReport::CallbackInfo::ColumnHeaderData: { + data = columns.at(info.index); + break; + } + case LimeReport::CallbackInfo::ColumnData: + if (info.columnName == "Image") + data = QImage(":/report//images/logo32"); + else { + data = info.columnName+" "+QString::number(info.index); + } + break; + default: break; + } +} diff --git a/demo_r1/mainwindow.h b/demo_r1/mainwindow.h index e5bbd32..e8d7ff1 100644 --- a/demo_r1/mainwindow.h +++ b/demo_r1/mainwindow.h @@ -57,6 +57,7 @@ private slots: void slotChangePos(const LimeReport::CallbackInfo::ChangePosType& type, bool& result); void slotGetCallbackChildData(LimeReport::CallbackInfo info, QVariant& data); void slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosType& type, bool& result); + void slotOneSlotDS(LimeReport::CallbackInfo info, QVariant& data); private: void prepareData(QSqlQuery* ds, LimeReport::CallbackInfo info, QVariant &data); private: From 114e69054104d1d692701bf335a849978e46d879 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 6 Dec 2016 01:08:30 +0300 Subject: [PATCH 19/51] travis build: ppa:beineri/opt-qt561-trusty --> ppa:beineri/opt-qt562-trusty --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b89e1f8..dadebf9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ env: - QT_BASE=56 before_install: - - if [ "$QT_BASE" = "56" ]; then sudo add-apt-repository ppa:beineri/opt-qt561-trusty -y; fi + - if [ "$QT_BASE" = "56" ]; then sudo add-apt-repository ppa:beineri/opt-qt562-trusty -y; fi - sudo apt-get update -qq install: From 32bf7765ec0256d2c2893b4080c61165d813eb99 Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Wed, 7 Dec 2016 23:04:15 +0300 Subject: [PATCH 20/51] Render empty data band has been fixed --- limereport/items/lrtextitem.h | 2 +- limereport/lrreportrender.cpp | 99 +++++++++++++++++++++-------------- limereport/lrreportrender.h | 2 +- 3 files changed, 62 insertions(+), 41 deletions(-) diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index bda15d8..27b78f7 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -101,7 +101,7 @@ public: bool canBeSplitted(int height) const; bool isSplittable() const { return true;} - bool isEmpty() const{return m_text->isEmpty();} + bool isEmpty() const{return m_strText.trimmed().isEmpty() /*m_text->isEmpty()*/;} BaseDesignIntf* cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent); BaseDesignIntf* cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent); BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0); diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 3d39635..64c02d3 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -227,7 +227,7 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) clearPageMap(); startNewPage(); - renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader),StartNewPageAsNeeded); + renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader), 0, StartNewPageAsNeeded); BandDesignIntf* lastRenderedBand = 0; for (int i=0;idataBandCount() && !m_renderCanceled;i++){ @@ -238,13 +238,13 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) } if (reportFooter) - renderBand(reportFooter,StartNewPageAsNeeded); + renderBand(reportFooter, 0, StartNewPageAsNeeded); if (lastRenderedBand && lastRenderedBand->keepFooterTogether()) closeFooterGroup(lastRenderedBand); BandDesignIntf* tearOffBand = m_patternPageItem->bandByType(BandDesignIntf::TearOffBand); if (tearOffBand) - renderBand(tearOffBand,StartNewPageAsNeeded); + renderBand(tearOffBand, 0, StartNewPageAsNeeded); savePage(true); @@ -359,7 +359,7 @@ void ReportRender::replaceGroupsFunction(BandDesignIntf *band) } } -void ReportRender::renderBand(BandDesignIntf *patternBand, ReportRender::DataRenderMode mode, bool isLast) +BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesignIntf* bandData, ReportRender::DataRenderMode mode, bool isLast) { QApplication::processEvents(); if (patternBand){ @@ -372,7 +372,14 @@ void ReportRender::renderBand(BandDesignIntf *patternBand, ReportRender::DataRen if (patternBand->isFooter()) m_lastRenderedFooter = patternBand; - BandDesignIntf* bandClone=renderData(patternBand); + BandDesignIntf* bandClone = 0; + + if (bandData){ + bandClone = bandData; + } else { + bandClone=renderData(patternBand); + } + bandClone->setBackgroundColor( (datasources()->variable(QLatin1String("line_")+patternBand->objectName().toLower()).toInt()%2!=0 ? patternBand->backgroundColor(): @@ -424,10 +431,16 @@ void ReportRender::renderBand(BandDesignIntf *patternBand, ReportRender::DataRen } } } - } else {delete bandClone;} + } else { + delete bandClone; + return 0; + } + if (patternBand->isFooter()) datasources()->clearGroupFunctionValues(patternBand->objectName()); + return bandClone; } + return 0; } void ReportRender::renderDataBand(BandDesignIntf *dataBand) @@ -440,7 +453,7 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) BandDesignIntf* header = dataBand->bandHeader(); BandDesignIntf* footer = dataBand->bandFooter(); - if (header && header->printAlways()) renderBand(header); + if (header && header->printAlways()) renderBand(header, 0); if(bandDatasource && !bandDatasource->eof() && !m_renderCanceled){ @@ -448,7 +461,7 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) datasources()->setReportVariable(varName,1); if (header && !header->printAlways()) - renderBand(header); + renderBand(header, 0); if (dataBand->bandHeader() && dataBand->bandHeader()->reprintOnEachPage()) m_reprintableBands.append(dataBand->bandHeader()); @@ -458,28 +471,35 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) bool firstTime = true; + while(!bandDatasource->eof() && !m_renderCanceled){ - if ((firstTime && dataBand->startFromNewPage()) || - (!firstTime && dataBand->startNewPage())) { - savePage(); - startNewPage(); + BandDesignIntf* rawData = renderData(dataBand); + + if (!rawData->isEmpty() || dataBand->printIfEmpty()){ + + if ((firstTime && dataBand->startFromNewPage()) || + (!firstTime && dataBand->startNewPage())) { + savePage(); + startNewPage(); + } + + if (dataBand->tryToKeepTogether()) openDataGroup(dataBand); + + if (dataBand->keepFooterTogether() && !bandDatasource->hasNext()) + openFooterGroup(dataBand); + + datasources()->updateChildrenData(dataBand->datasourceName()); + m_lastDataBand = dataBand; + + if (header && !firstTime && header->repeatOnEachRow()) + renderBand(header, 0, StartNewPageAsNeeded); + + if (renderBand(dataBand, rawData, StartNewPageAsNeeded, !bandDatasource->hasNext()) ) + renderChildBands(dataBand); + } - if (dataBand->tryToKeepTogether()) openDataGroup(dataBand); - - if (dataBand->keepFooterTogether() && !bandDatasource->hasNext()) - openFooterGroup(dataBand); - - datasources()->updateChildrenData(dataBand->datasourceName()); - m_lastDataBand = dataBand; - - if (header && !firstTime && header->repeatOnEachRow()) - renderBand(header,StartNewPageAsNeeded); - - renderBand(dataBand,StartNewPageAsNeeded,!bandDatasource->hasNext()); - renderChildBands(dataBand); - bandDatasource->next(); datasources()->setReportVariable(varName,datasources()->variable(varName).toInt()+1); @@ -499,16 +519,16 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) renderGroupFooter(dataBand); if (footer && !footer->printAlways()) - renderBand(footer,StartNewPageAsNeeded); + renderBand(footer, 0, StartNewPageAsNeeded); datasources()->deleteVariable(varName); } else if (bandDatasource==0) { - renderBand(dataBand,StartNewPageAsNeeded); + renderBand(dataBand, 0, StartNewPageAsNeeded); } if (footer && footer->printAlways()) - renderBand(footer,StartNewPageAsNeeded); + renderBand(footer, 0, StartNewPageAsNeeded); } void ReportRender::renderPageHeader(PageItemDesignIntf *patternPage) @@ -518,7 +538,7 @@ void ReportRender::renderPageHeader(PageItemDesignIntf *patternPage) if (m_datasources->variable("#PAGE").toInt()!=1 || band->property("printOnFirstPage").toBool() ) - renderBand(band); + renderBand(band, 0); } } @@ -576,7 +596,7 @@ void ReportRender::renderChildHeader(BandDesignIntf *parent, BandPrintMode print if (band->metaObject()->indexOfProperty("printAlways")>0){ printAlways=band->property("printAlways").toBool(); } - if (printAlways == (printMode==PrintAlwaysPrintable) ) renderBand(band,StartNewPageAsNeeded); + if (printAlways == (printMode==PrintAlwaysPrintable) ) renderBand(band, 0, StartNewPageAsNeeded); } } @@ -589,7 +609,7 @@ void ReportRender::renderChildFooter(BandDesignIntf *parent, BandPrintMode print } if ( (band != m_lastRenderedFooter) && (printAlways == (printMode == PrintAlwaysPrintable)) ) - renderBand(band,StartNewPageAsNeeded); + renderBand(band, 0, StartNewPageAsNeeded); } } @@ -614,13 +634,13 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da dataSource->prior(); foreach (BandDesignIntf* subBand, band->childrenByType(BandDesignIntf::GroupHeader)) { foreach(BandDesignIntf* footer, subBand->childrenByType(BandDesignIntf::GroupFooter)){ - renderBand(footer); + renderBand(footer, 0); closeDataGroup(subBand); } } foreach (BandDesignIntf* footer, band->childrenByType(BandDesignIntf::GroupFooter)) { - renderBand(footer,StartNewPageAsNeeded); + renderBand(footer, 0, StartNewPageAsNeeded); } dataSource->next(); @@ -639,9 +659,9 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da openDataGroup(band); if (!firstTime && gb->startNewPage()){ if (gb->resetPageNumber()) resetPageNumber(BandReset); - renderBand(band,ForcedStartPage); + renderBand(band, 0, ForcedStartPage); } else { - renderBand(band,StartNewPageAsNeeded); + renderBand(band, 0, StartNewPageAsNeeded); } } @@ -656,7 +676,7 @@ void ReportRender::renderGroupFooter(BandDesignIntf *parentBand) if (gb && gb->isStarted()){ if (band->reprintOnEachPage()) m_reprintableBands.removeOne(band); if (band->childBands().count()>0){ - renderBand(band->childBands().at(0),StartNewPageAsNeeded); + renderBand(band->childBands().at(0), 0, StartNewPageAsNeeded); } closeDataGroup(band); } @@ -970,7 +990,7 @@ void ReportRender::startNewPage() m_currentIndex=0; renderPageHeader(m_patternPageItem); - //renderPageFooter(m_patternPageItem); + m_pageFooterHeight = calcPageFooterHeight(m_patternPageItem); m_maxHeightByColumn[m_currentColumn] -= m_pageFooterHeight; m_currentIndex=10; @@ -978,8 +998,9 @@ void ReportRender::startNewPage() m_renderedDataBandCount = 0; foreach (BandDesignIntf* band, m_reprintableBands) { - renderBand(band); + renderBand(band, 0); } + checkLostHeadersOnPrevPage(); pasteGroups(); renderPageItems(m_patternPageItem); diff --git a/limereport/lrreportrender.h b/limereport/lrreportrender.h index ab128d8..89807ca 100644 --- a/limereport/lrreportrender.h +++ b/limereport/lrreportrender.h @@ -96,7 +96,7 @@ private: void initVariables(); bool runInitScript(); void clearPageMap(); - void renderBand(BandDesignIntf *patternBand, DataRenderMode mode = NotStartNewPage, bool isLast = false); + BandDesignIntf* renderBand(BandDesignIntf *patternBand, BandDesignIntf *bandData, DataRenderMode mode = NotStartNewPage, bool isLast = false); void renderDataBand(BandDesignIntf* dataBand); void renderPageHeader(PageItemDesignIntf* patternPage); void renderPageFooter(PageItemDesignIntf* patternPage); From 46c830212fb4bbc4affbe36e024e1a8de061ac1d Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 12 Dec 2016 23:41:38 +0300 Subject: [PATCH 21/51] Render child bands has been fixed --- limereport/lrreportrender.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 64c02d3..196d3ad 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -495,8 +495,8 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) if (header && !firstTime && header->repeatOnEachRow()) renderBand(header, 0, StartNewPageAsNeeded); - if (renderBand(dataBand, rawData, StartNewPageAsNeeded, !bandDatasource->hasNext()) ) - renderChildBands(dataBand); + renderBand(dataBand, rawData, StartNewPageAsNeeded, !bandDatasource->hasNext()); + renderChildBands(dataBand); } From eeea8c264391431f9a8cd21839278b2b3cc3f190 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 13 Dec 2016 00:07:50 +0300 Subject: [PATCH 22/51] QTextDocument is created as needed --- limereport/items/lrtextitem.cpp | 264 +++++++++++++++----------------- limereport/items/lrtextitem.h | 15 +- 2 files changed, 135 insertions(+), 144 deletions(-) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index d3d658b..5b76d0e 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -60,8 +60,6 @@ TextItem::TextItem(QObject *owner, QGraphicsItem *parent) : ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0), m_trimValue(true), m_allowHTML(false), m_allowHTMLInFields(false), m_followTo(""), m_follower(0) { - m_text = new QTextDocument(); - PageItemDesignIntf* pageItem = dynamic_cast(parent); BaseDesignIntf* parentItem = dynamic_cast(parent); while (!pageItem && parentItem){ @@ -76,12 +74,9 @@ TextItem::TextItem(QObject *owner, QGraphicsItem *parent) Init(); } -TextItem::~TextItem() -{ - delete m_text; -} +TextItem::~TextItem(){} -int TextItem::fakeMarginSize(){ +int TextItem::fakeMarginSize() const{ return marginSize()+5; } @@ -89,6 +84,9 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q Q_UNUSED(widget); Q_UNUSED(style); + + TextPtr text = textDocument(); + painter->save(); setupPainter(painter); @@ -103,38 +101,38 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q painter->setClipRect(rect()); } - qreal hOffset = 0, vOffset=0; + qreal hOffset = 0, vOffset = 0; switch (m_angle){ case Angle0: hOffset = fakeMarginSize(); - if ((tmpSize.height()>0) && (m_alignment & Qt::AlignVCenter)){ - vOffset = tmpSize.height()/2; + if ((tmpSize.height() > 0) && (m_alignment & Qt::AlignVCenter)){ + vOffset = tmpSize.height() / 2; } - if ((tmpSize.height()>0) && (m_alignment & Qt::AlignBottom)) // allow html + if ((tmpSize.height() > 0) && (m_alignment & Qt::AlignBottom)) // allow html vOffset = tmpSize.height(); painter->translate(hOffset,vOffset); break; case Angle90: - hOffset = width()-fakeMarginSize(); + hOffset = width() - fakeMarginSize(); vOffset = fakeMarginSize(); if (m_alignment & Qt::AlignVCenter){ - hOffset = (width()-m_text->size().height())/2+m_text->size().height(); + hOffset = (width() - text->size().height()) / 2 + text->size().height(); } if (m_alignment & Qt::AlignBottom){ - hOffset = (m_text->size().height()); + hOffset = (text->size().height()); } painter->translate(hOffset,vOffset); painter->rotate(90); break; case Angle180: - hOffset = width()-fakeMarginSize(); - vOffset = height()-fakeMarginSize(); + hOffset = width() - fakeMarginSize(); + vOffset = height() - fakeMarginSize(); if ((tmpSize.width()>0) && (m_alignment & Qt::AlignVCenter)){ - vOffset = tmpSize.height()/2+m_text->size().height(); + vOffset = tmpSize.height() / 2+ text->size().height(); } if ((tmpSize.height()>0) && (m_alignment & Qt::AlignBottom)){ - vOffset = (m_text->size().height()); + vOffset = (text->size().height()); } painter->translate(hOffset,vOffset); painter->rotate(180); @@ -143,11 +141,11 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q hOffset = fakeMarginSize(); vOffset = height()-fakeMarginSize(); if (m_alignment & Qt::AlignVCenter){ - hOffset = (width()-m_text->size().height())/2; + hOffset = (width() - text->size().height())/2; } if (m_alignment & Qt::AlignBottom){ - hOffset = (width()-m_text->size().height()); + hOffset = (width() - text->size().height()); } painter->translate(hOffset,vOffset); painter->rotate(270); @@ -155,12 +153,12 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q case Angle45: painter->translate(width()/2,0); painter->rotate(45); - m_text->setTextWidth(sqrt(2*(pow(width()/2,2)))); + text->setTextWidth(sqrt(2*(pow(width()/2,2)))); break; case Angle315: painter->translate(0,height()/2); painter->rotate(315); - m_text->setTextWidth(sqrt(2*(pow(height()/2,2)))); + text->setTextWidth(sqrt(2*(pow(height()/2,2)))); break; } @@ -176,7 +174,8 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q painter->setOpacity(qreal(foregroundOpacity())/100); QAbstractTextDocumentLayout::PaintContext ctx; ctx.palette.setColor(QPalette::Text, fontColor()); - for(QTextBlock it=m_text->begin();it!=m_text->end();it=it.next()){ + + for(QTextBlock it = text->begin(); it != text->end(); it=it.next()){ it.blockFormat().setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight); for (int i=0;ilineCount();i++){ QTextLine line = it.layout()->lineAt(i); @@ -187,7 +186,8 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q } } } - m_text->documentLayout()->draw(painter,ctx); + + text->documentLayout()->draw(painter,ctx); if (m_underlines){ if (lineHeight<0) lineHeight = painter->fontMetrics().height(); @@ -196,19 +196,6 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q } } - //painter->setOpacity(qreal(foregroundOpacity())/100); - - //m_text->setDefaultTextOption(); - //QAbstractTextDocumentLayout::PaintContext ctx; - //ctx.palette.setColor(QPalette::Text, fontColor()); - //m_text->documentLayout()->draw(painter,ctx); - -// m_layout.draw(ppainter,QPointF(marginSize(),0),); -// ppainter->setFont(transformToSceneFont(font())); -// QTextOption o; -// o.setAlignment(alignment()); -// ppainter->drawText(rect(), content(), o); - painter->restore(); BaseDesignIntf::paint(painter, style, widget); } @@ -219,11 +206,11 @@ QString TextItem::content() const{ void TextItem::Init() { - m_autoWidth=NoneAutoWidth; - m_alignment= Qt::AlignLeft|Qt::AlignTop; - m_autoHeight=false; -// m_text->setDefaultFont(transformToSceneFont(font())); - m_textSize=QSizeF(); + m_autoWidth = NoneAutoWidth; + m_alignment = Qt::AlignLeft|Qt::AlignTop; + m_autoHeight = false; + m_textSize = QSizeF(); + m_firstLineSize = 0; m_foregroundOpacity = 100; m_underlines = false; m_adaptFontToSize = false; @@ -237,18 +224,13 @@ void TextItem::setContent(const QString &value) if (m_strText.compare(value)!=0){ QString oldValue = m_strText; m_strText=value; - if (allowHTML()) - m_text->setHtml(replaceReturns(value.trimmed())); - else - m_text->setPlainText(value); - //m_text->setTextWidth(width()); - //m_textSize=m_text->size(); + if (itemMode() == DesignMode){ - initText(); + initTextSizes(); } if (!isLoading()){ - initText(); + initTextSizes(); update(rect()); notify("content",oldValue,value); } @@ -260,7 +242,7 @@ void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, i if (isNeedExpandContent()) expandContent(dataManager, pass); if (!isLoading()) - initText(); + initTextSizes(); if (m_textSize.width()>width() && ((m_autoWidth==MaxWordLength)||(m_autoWidth==MaxStringLength))){ setWidth(m_textSize.width() + fakeMarginSize()*2); @@ -311,24 +293,25 @@ QString TextItem::replaceReturns(QString text) return result; } -void TextItem::setTextFont(const QFont& value){ - m_text->setDefaultFont(value); +void TextItem::setTextFont(TextPtr text, const QFont& value) { + text->setDefaultFont(value); if ((m_angle==Angle0)||(m_angle==Angle180)){ - m_text->setTextWidth(rect().width()-fakeMarginSize()*2); + text->setTextWidth(rect().width()-fakeMarginSize()*2); } else { - m_text->setTextWidth(rect().height()-fakeMarginSize()*2); + text->setTextWidth(rect().height()-fakeMarginSize()*2); } } -void TextItem::adaptFontSize(){ +void TextItem::adaptFontSize(TextPtr text) { QFont _font = transformToSceneFont(font()); do{ - setTextFont(_font); + setTextFont(text,_font); if (_font.pixelSize()>2) _font.setPixelSize(_font.pixelSize()-1); else break; - } while(m_text->size().height()>this->height() || m_text->size().width()>(this->width())-fakeMarginSize()*2); + } while(text->size().height()>this->height() || text->size().width()>(this->width()) - fakeMarginSize() * 2); } + int TextItem::underlineLineSize() const { return m_underlineLineSize; @@ -351,53 +334,18 @@ void TextItem::setLineSpacing(int value) { int oldValue = m_lineSpacing; m_lineSpacing = value; - initText(); + initTextSizes(); update(); notify("lineSpacing",oldValue,value); } -void TextItem::initText() +void TextItem::initTextSizes() { - if (!m_text) return; - QTextOption to; - to.setAlignment(m_alignment); - - if (m_autoWidth!=MaxStringLength) - if (m_adaptFontToSize && (!(m_autoHeight || m_autoWidth))) - to.setWrapMode(QTextOption::WordWrap); - else - to.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); - else to.setWrapMode(QTextOption::NoWrap); - - m_text->setDocumentMargin(0); - m_text->setDefaultTextOption(to); - - QFont _font = transformToSceneFont(font()); - if (m_adaptFontToSize && (!(m_autoHeight || m_autoWidth))){ - adaptFontSize(); - } else { - setTextFont(transformToSceneFont(font())); - } - - if ((m_angle==Angle0)||(m_angle==Angle180)){ - m_text->setTextWidth(rect().width()-fakeMarginSize()*2); - } else { - m_text->setTextWidth(rect().height()-fakeMarginSize()*2); - } - - for ( QTextBlock block = m_text->begin(); block.isValid(); block = block.next()) - { - QTextCursor tc = QTextCursor(block); - QTextBlockFormat fmt = block.blockFormat(); - - if(fmt.lineHeight() != m_lineSpacing) { - fmt.setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight); - tc.setBlockFormat( fmt ); - } - } - - m_textSize=m_text->size(); + TextPtr text = textDocument(); + m_textSize= text->size(); + if (text->begin().isValid() && text->begin().layout()->lineAt(0).isValid()) + m_firstLineSize = text->begin().layout()->lineAt(0).height(); } QString TextItem::formatDateTime(const QDateTime &value) @@ -461,6 +409,52 @@ QString TextItem::formatFieldValue() } } +TextItem::TextPtr TextItem::textDocument() +{ + TextPtr text(new QTextDocument); + + if (allowHTML()) + text->setHtml(m_strText); + else + text->setPlainText(m_strText); + + QTextOption to; + to.setAlignment(m_alignment); + + if (m_autoWidth!=MaxStringLength) + if (m_adaptFontToSize && (!(m_autoHeight || m_autoWidth))) + to.setWrapMode(QTextOption::WordWrap); + else + to.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); + else to.setWrapMode(QTextOption::NoWrap); + + text->setDocumentMargin(0); + text->setDefaultTextOption(to); + + QFont _font = transformToSceneFont(font()); + if (m_adaptFontToSize && (!(m_autoHeight || m_autoWidth))){ + adaptFontSize(text); + } else { + setTextFont(text,_font); + } + + text->documentLayout(); + + for ( QTextBlock block = text->begin(); block.isValid(); block = block.next()) + { + QTextCursor tc = QTextCursor(block); + QTextBlockFormat fmt = block.blockFormat(); + + if(fmt.lineHeight() != m_lineSpacing) { + fmt.setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight); + tc.setBlockFormat( fmt ); + } + } + + return text; + +} + QString TextItem::followTo() const { return m_followTo; @@ -564,13 +558,14 @@ void TextItem::setAllowHTML(bool allowHTML) { if (m_allowHTML!=allowHTML){ m_allowHTML = allowHTML; - if (m_text){ - if (allowHTML) - m_text->setHtml(m_strText); - else - m_text->setPlainText(m_strText); - update(); - } +// if (m_text){ +// if (allowHTML) +// m_text->setHtml(m_strText); +// else +// m_text->setPlainText(m_strText); +// update(); +// } + update(); notify("allowHTML",!m_allowHTML,allowHTML); } } @@ -588,16 +583,7 @@ void TextItem::setTrimValue(bool value) void TextItem::geometryChangedEvent(QRectF , QRectF) -{ -// if ((m_angle==Angle0)||(m_angle==Angle180)){ -// m_text->setTextWidth(rect().width()-fakeMarginSize()*2); -// } else { -// m_text->setTextWidth(rect().height()-fakeMarginSize()*2); -// } - if (itemMode() == DesignMode) initText(); - else if (adaptFontToSize()) initText(); - -} +{} bool TextItem::isNeedUpdateSize(RenderPass pass) const { @@ -616,7 +602,6 @@ void TextItem::setAlignment(Qt::Alignment value) m_alignment=value; //m_layout.setTextOption(QTextOption(m_alignment)); if (!isLoading()){ - initText(); update(rect()); notify("alignment",QVariant(oldValue),QVariant(value)); } @@ -625,7 +610,6 @@ void TextItem::setAlignment(Qt::Alignment value) void TextItem::expandContent(DataSourceManager* dataManager, RenderPass pass) { - QString context=content(); ExpandType expandType = (allowHTML() && !allowHTMLInFields())?ReplaceHTMLSymbols:NoEscapeSymbols; switch(pass){ @@ -670,7 +654,7 @@ void TextItem::setAdaptFontToSize(bool value) if (m_adaptFontToSize!=value){ bool oldValue = m_adaptFontToSize; m_adaptFontToSize=value; - initText(); +// initText(); invalidateRect(rect()); notify("updateFontToSize",oldValue,value); } @@ -678,22 +662,25 @@ void TextItem::setAdaptFontToSize(bool value) bool TextItem::canBeSplitted(int height) const { - return height>(m_text->begin().layout()->lineAt(0).height()); + QFontMetrics fm(font()); + return height > m_firstLineSize; } QString TextItem::getTextPart(int height, int skipHeight){ - int linesHeight=0; - int curLine=0; - int textPos=0; + int linesHeight = 0; + int curLine = 0; + int textPos = 0; - QTextBlock curBlock = m_text->begin(); - QString resultText=""; + TextPtr text = textDocument(); - if (skipHeight>0){ - for (;curBlock!=m_text->end();curBlock=curBlock.next()){ - for (curLine=0;curLinelineCount();curLine++){ - linesHeight+=curBlock.layout()->lineAt(curLine).height()+lineSpacing(); - if (linesHeight>(skipHeight-(/*fakeMarginSize()*2+*/borderLineSize()*2))) {goto loop_exit;} + QTextBlock curBlock = text->begin(); + QString resultText = ""; + + if (skipHeight > 0){ + for (;curBlock != text->end(); curBlock=curBlock.next()){ + for (curLine = 0; curLine < curBlock.layout()->lineCount(); curLine++){ + linesHeight += curBlock.layout()->lineAt(curLine).height() + lineSpacing(); + if (linesHeight > (skipHeight-(/*fakeMarginSize()*2+*/borderLineSize() * 2))) {goto loop_exit;} } } loop_exit:; @@ -701,10 +688,10 @@ QString TextItem::getTextPart(int height, int skipHeight){ linesHeight = 0; - for (;curBlock!=m_text->end() || curLinelineCount();curLine++){ - if (resultText=="") textPos= curBlock.layout()->lineAt(curLine).textStart(); - linesHeight+=curBlock.layout()->lineAt(curLine).height()+lineSpacing(); + for (;curBlock != text->end() || curLinelineCount(); curLine++){ + if (resultText == "") textPos= curBlock.layout()->lineAt(curLine).textStart(); + linesHeight += curBlock.layout()->lineAt(curLine).height() + lineSpacing(); if ( (height>0) && (linesHeight>(height-(/*fakeMarginSize()*2+*/borderLineSize()*2))) ) { linesHeight-=curBlock.layout()->lineAt(curLine).height(); goto loop_exit1; @@ -742,7 +729,7 @@ BaseDesignIntf *TextItem::cloneUpperPart(int height, QObject *owner, QGraphicsIt { TextItem* upperPart = dynamic_cast(cloneItem(itemMode(),owner,parent)); upperPart->setContent(getTextPart(height,0)); - upperPart->initText(); + upperPart->initTextSizes(); upperPart->setHeight(upperPart->textSize().height()+borderLineSize()*2); return upperPart; } @@ -751,7 +738,7 @@ BaseDesignIntf *TextItem::cloneBottomPart(int height, QObject *owner, QGraphicsI { TextItem* bottomPart = dynamic_cast(cloneItem(itemMode(),owner,parent)); bottomPart->setContent(getTextPart(0,height)); - bottomPart->initText(); + bottomPart->initTextSizes(); bottomPart->setHeight(bottomPart->textSize().height()+borderLineSize()*2); return bottomPart; } @@ -773,7 +760,7 @@ void TextItem::objectLoadFinished() { ItemDesignIntf::objectLoadFinished(); if (itemMode() == DesignMode || !isNeedExpandContent()){ - initText(); + initTextSizes(); } } @@ -782,7 +769,7 @@ void TextItem::setTextItemFont(QFont value) if (font()!=value){ QFont oldValue = font(); setFont(value); - m_text->setDefaultFont(transformToSceneFont(value)); + update(); notify("font",oldValue,value); } } @@ -844,7 +831,6 @@ void TextItem::setAngle(const AngleType& value) AngleType oldValue = m_angle; m_angle = value; if (!isLoading()){ - initText(); update(); notify("angle",oldValue,value); } diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index 27b78f7..adab6b3 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -153,30 +153,35 @@ public: // IPageInit interface void pageObjectHasBeenLoaded(); + typedef QSharedPointer TextPtr; + protected: void updateLayout(); bool isNeedExpandContent() const; QString replaceBR(QString text); QString replaceReturns(QString text); - int fakeMarginSize(); + int fakeMarginSize() const; QString getTextPart(int height, int skipHeight); void restoreLinksEvent(); private: - void initText(); - void setTextFont(const QFont &value); - void adaptFontSize(); + void initTextSizes(); + void setTextFont(TextPtr text, const QFont &value); + void adaptFontSize(TextPtr text); QString formatDateTime(const QDateTime &value); QString formatNumber(const double value); QString formatFieldValue(); + + TextPtr textDocument(); private: QString m_strText; //QTextLayout m_layout; - QTextDocument* m_text; + //QTextDocument* m_text; Qt::Alignment m_alignment; bool m_autoHeight; AutoWidth m_autoWidth; QSizeF m_textSize; + qreal m_firstLineSize; AngleType m_angle; int m_foregroundOpacity; bool m_underlines; From edd2c43545ad9071878b76ec8313246740ee8b00 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 20 Dec 2016 01:33:58 +0300 Subject: [PATCH 23/51] beforeRender, afterData, afterRender signals have been added getVariable, getField functions have been added --- limereport/lrbanddesignintf.cpp | 1 + limereport/lrbasedesignintf.cpp | 2 +- limereport/lrbasedesignintf.h | 4 ++ limereport/lrreportrender.cpp | 73 +++++++++++++++++++++++----- limereport/lrreportrender.h | 3 ++ limereport/lrscriptenginemanager.cpp | 24 +++++++++ 6 files changed, 93 insertions(+), 14 deletions(-) diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index c7b3dcc..2fe29b8 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -357,6 +357,7 @@ bool BandDesignIntf::canBeSplitted(int height) const bool BandDesignIntf::isEmpty() const { + if (!isVisible()) return true; foreach(QGraphicsItem* qgItem,childItems()){ BaseDesignIntf* item = dynamic_cast(qgItem); if ((item)&&(!item->isEmpty())) return false; diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 3a3056b..7025a0f 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -818,7 +818,7 @@ void BaseDesignIntf::turnOnSelectionMarker(bool value) QString BaseDesignIntf::patternName() const { - return m_patternName; + return (m_patternName.isEmpty()) ? objectName() : m_patternName; } void BaseDesignIntf::setPatternName(const QString &patternName) diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index 71e2736..d9bdf3f 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -387,6 +387,10 @@ signals: void propertyesChanged(QVector propertyNames); void itemAlignChanged(BaseDesignIntf* item, const ItemAlign& oldValue, const ItemAlign& newValue); void itemVisibleHasChanged(BaseDesignIntf* item); + + void beforeRender(); + void afterData(); + void afterRender(); }; } //namespace LimeReport diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 196d3ad..1f656eb 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -167,6 +167,7 @@ void ReportRender::setScriptContext(ScriptEngineContext* scriptContext) bool ReportRender::runInitScript(){ if (m_scriptEngineContext){ + ScriptEngineManager::instance().scriptEngine()->pushContext(); QScriptValue res = ScriptEngineManager::instance().scriptEngine()->evaluate(m_scriptEngineContext->initScript()); if (res.isBool()) return res.toBool(); } @@ -213,6 +214,14 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) #ifdef HAVE_UI_LOADER initDialogs(); #endif + + if (m_scriptEngineContext){ + + foreach (BaseDesignIntf* item, patternPage->pageItem()->childBaseItems()){ + baseDesignIntfToScript(item); + } + } + if (runInitScript()){ clearPageMap(); @@ -224,6 +233,7 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) QMessageBox::critical(0,tr("Error"),exception.what()); return; } + clearPageMap(); startNewPage(); @@ -242,12 +252,13 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) if (lastRenderedBand && lastRenderedBand->keepFooterTogether()) closeFooterGroup(lastRenderedBand); - BandDesignIntf* tearOffBand = m_patternPageItem->bandByType(BandDesignIntf::TearOffBand); - if (tearOffBand) - renderBand(tearOffBand, 0, StartNewPageAsNeeded); + BandDesignIntf* tearOffBand = m_patternPageItem->bandByType(BandDesignIntf::TearOffBand); + if (tearOffBand) + renderBand(tearOffBand, 0, StartNewPageAsNeeded); savePage(true); + ScriptEngineManager::instance().scriptEngine()->popContext(); } } @@ -364,14 +375,6 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign QApplication::processEvents(); if (patternBand){ - if (mode == ForcedStartPage){ - savePage(); - startNewPage(); - } - - if (patternBand->isFooter()) - m_lastRenderedFooter = patternBand; - BandDesignIntf* bandClone = 0; if (bandData){ @@ -380,13 +383,24 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign bandClone=renderData(patternBand); } + if (mode == ForcedStartPage){ + savePage(); + startNewPage(); + } + + if (patternBand->isFooter()) + m_lastRenderedFooter = patternBand; + + bandClone->setBackgroundColor( (datasources()->variable(QLatin1String("line_")+patternBand->objectName().toLower()).toInt()%2!=0 ? - patternBand->backgroundColor(): - patternBand->alternateBackgroundColor() + bandClone->backgroundColor(): + bandClone->alternateBackgroundColor() ) ); + patternBand->emitBandRendered(bandClone); + emit(patternBand->afterRender()); if ( isLast && bandClone->keepFooterTogether() && bandClone->sliceLastRow() ){ if (m_maxHeightByColumn[m_currentColumn] < (bandClone->height()+m_reportFooterHeight)) @@ -960,10 +974,18 @@ BandDesignIntf *ReportRender::saveUppperPartReturnBottom(BandDesignIntf *band, i BandDesignIntf *ReportRender::renderData(BandDesignIntf *patternBand) { BandDesignIntf* bandClone = dynamic_cast(patternBand->cloneItem(PreviewMode)); + + baseDesignIntfToScript(bandClone); + emit(patternBand->beforeRender()); + if (patternBand->isFooter()){ replaceGroupsFunction(bandClone); } bandClone->updateItemSize(m_datasources); + + baseDesignIntfToScript(bandClone); + emit(patternBand->afterData()); + return bandClone; } @@ -1194,4 +1216,29 @@ void ReportRender::cancelRender(){ m_renderCanceled = true; } +void ReportRender::baseDesignIntfToScript(BaseDesignIntf *item) +{ + if ( item ) { + + if (item->metaObject()->indexOfSignal("beforeRender()")!=-1) + item->disconnect(SIGNAL(beforeRender())); + if (item->metaObject()->indexOfSignal("afterData()")!=-1) + item->disconnect(SIGNAL(afterData())); + if (item->metaObject()->indexOfSignal("afterRender()")!=-1) + item->disconnect(SIGNAL(afterRender())); + + QScriptEngine* engine = ScriptEngineManager::instance().scriptEngine(); + QScriptValue sItem = engine->globalObject().property(item->patternName()); + if (sItem.isValid()){ + engine->newQObject(sItem, item); + } else { + sItem = engine->newQObject(item); + engine->globalObject().setProperty(item->patternName(),sItem); + } + foreach(BaseDesignIntf* child, item->childBaseItems()){ + baseDesignIntfToScript(child); + } + } +} + } diff --git a/limereport/lrreportrender.h b/limereport/lrreportrender.h index 89807ca..16e8176 100644 --- a/limereport/lrreportrender.h +++ b/limereport/lrreportrender.h @@ -86,6 +86,9 @@ signals: public slots: void cancelRender(); private: + + void baseDesignIntfToScript(BaseDesignIntf* item); + void renderPage(PageDesignIntf *patternPage); void initDatasources(); void initDatasource(const QString &name); diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index 976aa22..d24de0e 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -220,6 +220,28 @@ QScriptValue setVariable(QScriptContext* pcontext, QScriptEngine* /*pengine*/){ return QScriptValue(); } +QScriptValue getVariable(QScriptContext* pcontext, QScriptEngine* pengine){ + + QString name = pcontext->argument(0).toString(); + + ScriptEngineManager* sm = qscriptvalue_cast(pcontext->callee().data()); + DataSourceManager* dm = sm->dataManager(); + QScriptValue res = pengine->newVariant(dm->variable(name)); + + return res; +} + +QScriptValue getField(QScriptContext* pcontext, QScriptEngine* pengine){ + + QString name = pcontext->argument(0).toString(); + + ScriptEngineManager* sm = qscriptvalue_cast(pcontext->callee().data()); + DataSourceManager* dm = sm->dataManager(); + QScriptValue res = pengine->newVariant(dm->fieldData(name)); + + return res; +} + QScriptValue numberFormat(QScriptContext* pcontext, QScriptEngine* pengine){ QVariant value = pcontext->argument(0).toVariant(); char format = (pcontext->argumentCount()>1)?pcontext->argument(1).toString()[0].toLatin1():'f'; @@ -431,6 +453,8 @@ ScriptEngineManager::ScriptEngineManager() addFunction("currencyUSBasedFormat",currencyUSBasedFormat,"NUMBER","currencyUSBasedFormat(\""+tr("Value")+",\""+tr("CurrencySymbol")+"\")"); #endif addFunction("setVariable", setVariable, "GENERAL", "setVariable(\""+tr("Name")+"\",\""+tr("Value")+"\")"); + addFunction("getVariable", getVariable, "GENERAL", "getVariable(\""+tr("Name")+"\")"); + addFunction("getField", getField, "GENERAL", "getField(\""+tr("Name")+"\")"); QScriptValue colorCtor = m_scriptEngine->newFunction(constructColor); m_scriptEngine->globalObject().setProperty("QColor", colorCtor); From dd214ca247a9b17049cdde7b762c118244e90437 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 21 Dec 2016 18:21:20 +0300 Subject: [PATCH 24/51] init script error message has been added --- limereport/lrreportrender.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 1f656eb..e768e10 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -167,9 +167,17 @@ void ReportRender::setScriptContext(ScriptEngineContext* scriptContext) bool ReportRender::runInitScript(){ if (m_scriptEngineContext){ - ScriptEngineManager::instance().scriptEngine()->pushContext(); - QScriptValue res = ScriptEngineManager::instance().scriptEngine()->evaluate(m_scriptEngineContext->initScript()); + QScriptEngine* engine = ScriptEngineManager::instance().scriptEngine(); + engine->pushContext(); + QScriptValue res = engine->evaluate(m_scriptEngineContext->initScript()); if (res.isBool()) return res.toBool(); + if (engine->hasUncaughtException()) { + QMessageBox::critical(0,tr("Error"), + QString("Line %1: %2 ").arg(engine->uncaughtExceptionLineNumber()) + .arg(engine->uncaughtException().toString()) + ); + return false; + } } return true; } From 7da0cfd7e2768f3e4ed7d0e1c87abb9c65169383 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 21 Dec 2016 22:09:10 +0300 Subject: [PATCH 25/51] backgroundBrushStyle property has been added --- limereport/items/lrshapeitem.cpp | 2 +- limereport/items/lrtextitem.h | 1 + limereport/lrbanddesignintf.cpp | 36 ++++++++++++++------------ limereport/lrbanddesignintf.h | 3 ++- limereport/lrbasedesignintf.cpp | 44 +++++++++++++++++--------------- limereport/lrbasedesignintf.h | 43 +++++++++++++++++++++---------- 6 files changed, 77 insertions(+), 52 deletions(-) diff --git a/limereport/items/lrshapeitem.cpp b/limereport/items/lrshapeitem.cpp index f52b1c8..a1b37d9 100644 --- a/limereport/items/lrshapeitem.cpp +++ b/limereport/items/lrshapeitem.cpp @@ -85,7 +85,7 @@ void ShapeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, pen.setStyle(m_penStyle); painter->setPen(pen); QBrush brush(m_shapeBrushColor,m_shapeBrushType); - + brush.setTransform(painter->worldTransform().inverted()); painter->setBrush(brush); painter->setBackground(QBrush(Qt::NoBrush)); painter->setOpacity(qreal(m_opacity)/100); diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index adab6b3..535bcd4 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -68,6 +68,7 @@ class TextItem : public LimeReport::ContentItemDesignIntf, IPageInit { Q_PROPERTY(QString format READ format WRITE setFormat) Q_PROPERTY(ValueType valueType READ valueType WRITE setValueType) Q_PROPERTY(QString followTo READ followTo WRITE setFollowTo) + Q_PROPERTY(BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle) public: enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength}; diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index 2fe29b8..c6993ad 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -183,16 +183,20 @@ BandDesignIntf::~BandDesignIntf() delete m_bandNameLabel; } -void BandDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget) +void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { - if (backgroundColor()!=Qt::white) { - ppainter->fillRect(rect(),backgroundColor()); + + if ( !(backgroundColor() == Qt::white && backgroundBrushStyle() == SolidPattern) ) { + QBrush brush(backgroundColor(), static_cast(backgroundBrushStyle())); + brush.setTransform(painter->worldTransform().inverted()); + painter->fillRect(rect(), brush); } - if (itemMode()&DesignMode){ - ppainter->save(); + + if (itemMode() & DesignMode){ + painter->save(); QString bandText = objectName(); if (parentBand()) bandText+=QLatin1String(" connected to ")+parentBand()->objectName(); - QFont font("Arial",7*Const::fontFACTOR,-1,true); + QFont font("Arial", 7 * Const::fontFACTOR, -1, true); QFontMetrics fontMetrics(font); QVector bandNameRects; @@ -204,22 +208,22 @@ void BandDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *o //if (isSelected()) ppainter->setPen(QColor(167,244,167)); // else ppainter->setPen(QColor(220,220,220)); - ppainter->setFont(font); + painter->setFont(font); for (int i=0;isetRenderHint(QPainter::Antialiasing); - ppainter->setBrush(bandColor()); - ppainter->setOpacity(Const::BAND_NAME_AREA_OPACITY); - ppainter->drawRoundedRect(labelRect,8,8); - ppainter->setOpacity(Const::BAND_NAME_TEXT_OPACITY); - ppainter->setPen(Qt::black); - ppainter->drawText(bandNameRects[i],Qt::AlignHCenter,bandText); + painter->setRenderHint(QPainter::Antialiasing); + painter->setBrush(bandColor()); + painter->setOpacity(Const::BAND_NAME_AREA_OPACITY); + painter->drawRoundedRect(labelRect,8,8); + painter->setOpacity(Const::BAND_NAME_TEXT_OPACITY); + painter->setPen(Qt::black); + painter->drawText(bandNameRects[i],Qt::AlignHCenter,bandText); } } - ppainter->restore(); + painter->restore(); } - BaseDesignIntf::paint(ppainter,option,widget); + BaseDesignIntf::paint(painter,option,widget); } BandDesignIntf::BandsType BandDesignIntf::bandType() const diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index 1f21919..fea245a 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -92,6 +92,7 @@ class BandDesignIntf : public BaseDesignIntf Q_PROPERTY(bool keepBottomSpace READ keepBottomSpaceOption WRITE setKeepBottomSpaceOption ) Q_PROPERTY(QString parentBand READ parentBandName WRITE setParentBandName DESIGNABLE false ) Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor) + Q_PROPERTY(BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle) Q_PROPERTY(bool printIfEmpty READ printIfEmpty WRITE setPrintIfEmpty) Q_ENUMS(BandColumnsLayoutType) friend class BandMarker; @@ -121,7 +122,7 @@ public: BandDesignIntf(BandsType bandType, const QString& xmlTypeName, QObject* owner = 0, QGraphicsItem* parent=0); ~BandDesignIntf(); - void paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget); + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); virtual BandsType bandType() const; virtual QString bandTitle() const; virtual QIcon bandIcon() const; diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 7025a0f..77967f4 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -64,14 +64,13 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q m_BGMode(OpaqueMode), m_opacity(100), m_borderLinesFlags(0), - m_hintFrame(0), m_storageTypeName(storageTypeName), m_itemMode(DesignMode), m_objectState(ObjectCreated), m_selectionMarker(0), m_joinMarker(0), - m_backgroundBrush(Solid), - m_backgroundBrushcolor(Qt::white), + m_backgroundBrushStyle(SolidPattern), + m_backgroundColor(Qt::white), m_margin(4), m_itemAlign(DesignedItemAlign), m_changingItemAlign(false), @@ -122,21 +121,23 @@ QString BaseDesignIntf::parentReportItemName() const else return ""; } -void BaseDesignIntf::setBackgroundBrushMode(BaseDesignIntf::BrushMode value) +void BaseDesignIntf::setBackgroundBrushStyle(BrushStyle value) { - if ( value != m_backgroundBrush ){ - m_backgroundBrush=value; + if ( value != m_backgroundBrushStyle ){ + BrushStyle oldValue = m_backgroundBrushStyle; + m_backgroundBrushStyle=value; if (!isLoading()) update(); + notify("backgroundBrushStyle", static_cast(oldValue), static_cast(value)); } } void BaseDesignIntf::setBackgroundColor(QColor value) { - if (value != m_backgroundBrushcolor){ - QColor oldValue = m_backgroundBrushcolor; - m_backgroundBrushcolor=value; + if (value != m_backgroundColor){ + QColor oldValue = m_backgroundColor; + m_backgroundColor=value; if (!isLoading()) update(); - notify("backgroundColor",oldValue,m_backgroundBrushcolor); + notify("backgroundColor", oldValue, value); } } @@ -496,7 +497,6 @@ void BaseDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *o Q_UNUSED(option); Q_UNUSED(widget); setupPainter(ppainter); - drawBorder(ppainter, rect()); if (isSelected()) {drawSelection(ppainter, rect());} drawResizeZone(ppainter); @@ -512,24 +512,28 @@ QColor calcColor(QColor color){ return Qt::white; else return Qt::black; -}; +} -void BaseDesignIntf::prepareRect(QPainter *ppainter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/) +void BaseDesignIntf::prepareRect(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/) { - ppainter->save(); + painter->save(); + + QBrush brush(m_backgroundColor,static_cast(m_backgroundBrushStyle)); + brush.setTransform(painter->worldTransform().inverted()); + if (isSelected() && (opacity() == 100) && (m_BGMode!=TransparentMode)) { - ppainter->fillRect(rect(), QBrush(QColor(m_backgroundBrushcolor))); + painter->fillRect(rect(), brush); } else { if (m_BGMode == OpaqueMode) { - ppainter->setOpacity(qreal(m_opacity) / 100); - ppainter->fillRect(rect(), QBrush(m_backgroundBrushcolor)); + painter->setOpacity(qreal(m_opacity) / 100); + painter->fillRect(rect(), brush); } else if (itemMode() & DesignMode){ - ppainter->setOpacity(0.1); - ppainter->fillRect(rect(), QBrush(QPixmap(":/report/empty"))); + painter->setOpacity(0.1); + painter->fillRect(rect(), QBrush(QPixmap(":/report/images/empty"))); } } - ppainter->restore(); + painter->restore(); } void BaseDesignIntf::hoverMoveEvent(QGraphicsSceneHoverEvent *event) diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index d9bdf3f..d6b32f6 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -83,7 +83,7 @@ class BaseDesignIntf : Q_INTERFACES(QGraphicsItem) Q_ENUMS(BGMode) Q_ENUMS(Qt::BrushStyle) - Q_ENUMS(BrushMode) + Q_ENUMS(BrushStyle) Q_ENUMS(ItemAlign) Q_FLAGS(BorderLines) Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometryProperty NOTIFY geometryChanged) @@ -96,8 +96,23 @@ class BaseDesignIntf : Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor) public: - enum BGMode { TransparentMode,OpaqueMode}; - enum BrushMode{Solid,None}; + enum BGMode { TransparentMode, OpaqueMode}; + + enum BrushStyle{ NoBrush, + SolidPattern, + Dense1Pattern, + Dense2Pattern, + Dense3Pattern, + Dense4Pattern, + Dense5Pattern, + Dense6Pattern, + Dense7Pattern, + HorPattern, + VerPattern, + CrossPattern, + BDiagPattern, + FDiagPattern }; + enum ResizeFlags { Fixed = 0, ResizeLeft = 1, ResizeRight = 2, @@ -124,13 +139,13 @@ public: BaseDesignIntf(const QString& storageTypeName, QObject* owner = 0, QGraphicsItem* parent = 0); virtual ~BaseDesignIntf(); - void setParentReportItem(const QString& value); + void setParentReportItem(const QString& value); QString parentReportItemName() const; - BrushMode backgroundBrushMode() const {return m_backgroundBrush;} - void setBackgroundBrushMode(BrushMode value); - QColor backgroundColor() const {return m_backgroundBrushcolor;} - void setBackgroundColor(QColor value); + BrushStyle backgroundBrushStyle() const {return m_backgroundBrushStyle;} + void setBackgroundBrushStyle(BrushStyle value); + QColor backgroundColor() const {return m_backgroundColor;} + void setBackgroundColor(QColor value); QPen pen() const; void setPen(QPen& pen); @@ -155,7 +170,7 @@ public: virtual QSizeF sizeMM() const; void paint(QPainter* ppainter, const QStyleOptionGraphicsItem* option, QWidget* widget); - void prepareRect(QPainter* ppainter, const QStyleOptionGraphicsItem*, QWidget*); + void prepareRect(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*); virtual QPainterPath shape() const; void setFixedPos(bool fixedPos); @@ -329,13 +344,13 @@ private: void turnOnSelectionMarker(bool value); private: QPointF m_startPos; - //QPointF m_startScenePos; int m_resizeHandleSize; int m_selectionPenSize; int m_possibleResizeDirectionFlags; int m_possibleMoveDirectionFlags; int m_resizeDirectionFlags; - qreal m_width, m_height; + qreal m_width; + qreal m_height; QPen m_pen; QFont m_font; QColor m_fontColor; @@ -357,7 +372,6 @@ private: QRectF m_rightRect; QVector m_resizeAreas; - QFrame* m_hintFrame; QString m_storageTypeName; ItemMode m_itemMode; @@ -365,8 +379,9 @@ private: SelectionMarker* m_selectionMarker; Marker* m_joinMarker; - BrushMode m_backgroundBrush; - QColor m_backgroundBrushcolor; + BrushStyle m_backgroundBrushStyle; + QColor m_backgroundColor; + RenderPass m_currentPass; int m_margin; QString m_itemTypeName; From 3807ac0c576732a43801c07ebf25fdd1fe1e0e8a Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 22 Dec 2016 02:08:27 +0300 Subject: [PATCH 26/51] limereport.pri for static building and aliases have been added --- demo_r1/mainwindow.cpp | 6 ++-- limereport.pri | 5 +++ limereport/LRCallbackDS | 1 + limereport/LRDataManager | 1 + limereport/LRScriptManager | 1 + limereport/LimeReport | 1 + qzint.pri | 64 ++++++++++++++++++++++++++++++++++++++ 7 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 limereport.pri create mode 100644 limereport/LRCallbackDS create mode 100644 limereport/LRDataManager create mode 100644 limereport/LRScriptManager create mode 100644 limereport/LimeReport create mode 100644 qzint.pri diff --git a/demo_r1/mainwindow.cpp b/demo_r1/mainwindow.cpp index bc96811..d695a4e 100644 --- a/demo_r1/mainwindow.cpp +++ b/demo_r1/mainwindow.cpp @@ -33,8 +33,8 @@ #include #include #include -#include "lrreportengine.h" -#include "lrcallbackdatasourceintf.h" +#include +#include #include #include @@ -104,6 +104,8 @@ MainWindow::MainWindow(QWidget *parent) : MainWindow::~MainWindow() { delete ui; + delete m_customers; + delete m_orders; } void MainWindow::on_pushButton_clicked() diff --git a/limereport.pri b/limereport.pri new file mode 100644 index 0000000..a7f272f --- /dev/null +++ b/limereport.pri @@ -0,0 +1,5 @@ +CONFIG += zint +include(./limereport/limereport.pri) +contains(CONFIG, zint){ + include(./qzint.pri) +} diff --git a/limereport/LRCallbackDS b/limereport/LRCallbackDS new file mode 100644 index 0000000..fd5f8c4 --- /dev/null +++ b/limereport/LRCallbackDS @@ -0,0 +1 @@ +#include "lrcallbackdatasourceintf.h" \ No newline at end of file diff --git a/limereport/LRDataManager b/limereport/LRDataManager new file mode 100644 index 0000000..720a2ed --- /dev/null +++ b/limereport/LRDataManager @@ -0,0 +1 @@ +#include "lrdatasourcemanagerintf.h" \ No newline at end of file diff --git a/limereport/LRScriptManager b/limereport/LRScriptManager new file mode 100644 index 0000000..05ab2f8 --- /dev/null +++ b/limereport/LRScriptManager @@ -0,0 +1 @@ +#include "lrscriptenginemanagerintf.h" \ No newline at end of file diff --git a/limereport/LimeReport b/limereport/LimeReport new file mode 100644 index 0000000..037cf8c --- /dev/null +++ b/limereport/LimeReport @@ -0,0 +1 @@ +#include "lrreportengine.h" diff --git a/qzint.pri b/qzint.pri new file mode 100644 index 0000000..51a6a50 --- /dev/null +++ b/qzint.pri @@ -0,0 +1,64 @@ +DEFINES += _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS ZINT_VERSION=\\\"$$ZINT_VERSION\\\" NO_PNG + +!contains(DEFINES, NO_PNG) { + LIBS += -lpng +} + +INCLUDEPATH += \ + $$ZINT_PATH/backend \ + $$ZINT_PATH/backend_qt4 + +HEADERS += $$ZINT_PATH/backend/aztec.h \ + $$ZINT_PATH/backend/code1.h \ + $$ZINT_PATH/backend/code49.h \ + $$ZINT_PATH/backend/common.h \ + $$ZINT_PATH/backend/composite.h \ + $$ZINT_PATH/backend/dmatrix.h \ + $$ZINT_PATH/backend/font.h \ + $$ZINT_PATH/backend/gb2312.h \ + $$ZINT_PATH/backend/gridmtx.h \ + $$ZINT_PATH/backend/gs1.h \ + $$ZINT_PATH/backend/large.h \ + $$ZINT_PATH/backend/maxicode.h \ + $$ZINT_PATH/backend/maxipng.h \ + $$ZINT_PATH/backend/ms_stdint.h \ + $$ZINT_PATH/backend/pdf417.h \ + $$ZINT_PATH/backend/qr.h \ + $$ZINT_PATH/backend/reedsol.h \ + $$ZINT_PATH/backend/rss.h \ + $$ZINT_PATH/backend/sjis.h \ + $$ZINT_PATH/backend/zint.h \ + $$ZINT_PATH/backend_qt4/qzint.h + +SOURCES += $$ZINT_PATH/backend/2of5.c \ + $$ZINT_PATH/backend/auspost.c \ + $$ZINT_PATH/backend/aztec.c \ + $$ZINT_PATH/backend/code.c \ + $$ZINT_PATH/backend/code1.c \ + $$ZINT_PATH/backend/code128.c \ + $$ZINT_PATH/backend/code16k.c \ + $$ZINT_PATH/backend/code49.c \ + $$ZINT_PATH/backend/common.c \ + $$ZINT_PATH/backend/composite.c \ + $$ZINT_PATH/backend/dmatrix.c \ + $$ZINT_PATH/backend/gridmtx.c \ + $$ZINT_PATH/backend/gs1.c \ + $$ZINT_PATH/backend/imail.c \ + $$ZINT_PATH/backend/large.c \ + $$ZINT_PATH/backend/library.c \ + $$ZINT_PATH/backend/maxicode.c \ + $$ZINT_PATH/backend/medical.c \ + $$ZINT_PATH/backend/pdf417.c \ + $$ZINT_PATH/backend/plessey.c \ + $$ZINT_PATH/backend/postal.c \ + $$ZINT_PATH/backend/ps.c \ + $$ZINT_PATH/backend/qr.c \ + $$ZINT_PATH/backend/reedsol.c \ + $$ZINT_PATH/backend/render.c \ + $$ZINT_PATH/backend/rss.c \ + $$ZINT_PATH/backend/svg.c \ + $$ZINT_PATH/backend/telepen.c \ + $$ZINT_PATH/backend/upcean.c \ + $$ZINT_PATH/backend/dllversion.c \ + $$ZINT_PATH/backend/png.c \ + $$ZINT_PATH/backend_qt4/qzint.cpp From 658a6e7e09f16814e09852d8ff4783657fdc6eaa Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 24 Dec 2016 11:49:56 +0300 Subject: [PATCH 27/51] followTo has been fixed --- limereport/items/lrtextitem.cpp | 38 +++++++++++++++++++++++++-------- limereport/items/lrtextitem.h | 1 + 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 5b76d0e..2152143 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -223,7 +223,10 @@ void TextItem::setContent(const QString &value) { if (m_strText.compare(value)!=0){ QString oldValue = m_strText; - m_strText=value; + if (m_trimValue) + m_strText=value.trimmed(); + else + m_strText=value; if (itemMode() == DesignMode){ initTextSizes(); @@ -466,17 +469,29 @@ void TextItem::setFollowTo(const QString &followTo) QString oldValue = m_followTo; m_followTo = followTo; if (!isLoading()){ - TextItem* fi = scene()->findChild(followTo); - if (fi && initFollower(followTo)){ - notify("followTo",oldValue,followTo); - } else { - m_followTo = ""; + TextItem* fi = scene()->findChild(oldValue); + if (fi) fi->clearFollower(); + fi = scene()->findChild(followTo); + if (fi && fi != this){ + if (initFollower(followTo)){ + notify("followTo",oldValue,followTo); + } else { + m_followTo = ""; + QMessageBox::critical( + 0, + tr("Error"), + tr("TextItem \" %1 \" already has folower \" %2 \" ") + .arg(fi->objectName()) + .arg(fi->follower()->objectName()) + ); + notify("followTo",followTo,""); + } + } else if (m_followTo != ""){ QMessageBox::critical( 0, tr("Error"), - tr("TextItem \" %1 \" already has folower \" %2 \" ") - .arg(fi->objectName()) - .arg(fi->follower()->objectName()) + tr("TextItem \" %1 \" not found !") + .arg(m_followTo) ); notify("followTo",followTo,""); } @@ -491,6 +506,11 @@ void TextItem::setFollower(TextItem *follower) } } +void TextItem::clearFollower() +{ + m_follower = 0; +} + bool TextItem::hasFollower() { return m_follower != 0; diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index 535bcd4..065724e 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -147,6 +147,7 @@ public: QString followTo() const; void setFollowTo(const QString &followTo); void setFollower(TextItem* follower); + void clearFollower(); bool hasFollower(); TextItem* follower(){ return m_follower;} bool initFollower(QString follower); From 081b4224684756b26d9fad24390b2be169221cc6 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 24 Dec 2016 14:01:35 +0300 Subject: [PATCH 28/51] COUNT function can be called with only one databand argument --- include/lrglobal.h | 11 +++++++++-- limereport/lrglobal.h | 11 +++++++++-- limereport/lrgroupfunctions.cpp | 5 ++++- limereport/lrreportrender.cpp | 2 +- limereport/lrscriptenginemanager.cpp | 13 +++++++++++-- 5 files changed, 34 insertions(+), 8 deletions(-) diff --git a/include/lrglobal.h b/include/lrglobal.h index e64cd43..3a01927 100644 --- a/include/lrglobal.h +++ b/include/lrglobal.h @@ -77,9 +77,16 @@ namespace Const{ const QString FIELD_RX = "\\$D\\s*\\{\\s*([^{}]*)\\s*\\}"; const QString VARIABLE_RX = "\\$V\\s*\\{\\s*([^{}]*)\\s*\\}"; const QString SCRIPT_RX = "\\$S\\s*\\{(.*)\\}"; - const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(((?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))(\\w+\\.?\\w+)((?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,\\s*\\\"(\\w+)\\\"\\s*\\)"; - const int DATASOURCE_INDEX = 6; + + //const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(((?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))(\\w+\\.?\\w+)((?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,\\s*\\\"(\\w+)\\\"\\s*\\)"; + //const int DATASOURCE_INDEX = 6; + //const int VALUE_INDEX = 2; + + const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:((?:(?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))((?:\\w+\\.?\\w+)|(?:\\w+))(?:(?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,)|(?:))\\s*\\\"(\\w+)\\\"\\s*\\)"; + const int DATASOURCE_INDEX = 4; const int VALUE_INDEX = 2; + const int EXPRESSION_ARGUMENT_INDEX = 3; + const QString GROUP_FUNCTION_RX = "(%1\\s*"+GROUP_FUNCTION_PARAM_RX+")"; const QString GROUP_FUNCTION_NAME_RX = "%1\\s*\\((.*[^\\)])\\)"; const int SCENE_MARGIN = 50; diff --git a/limereport/lrglobal.h b/limereport/lrglobal.h index e64cd43..3a01927 100644 --- a/limereport/lrglobal.h +++ b/limereport/lrglobal.h @@ -77,9 +77,16 @@ namespace Const{ const QString FIELD_RX = "\\$D\\s*\\{\\s*([^{}]*)\\s*\\}"; const QString VARIABLE_RX = "\\$V\\s*\\{\\s*([^{}]*)\\s*\\}"; const QString SCRIPT_RX = "\\$S\\s*\\{(.*)\\}"; - const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(((?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))(\\w+\\.?\\w+)((?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,\\s*\\\"(\\w+)\\\"\\s*\\)"; - const int DATASOURCE_INDEX = 6; + + //const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(((?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))(\\w+\\.?\\w+)((?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,\\s*\\\"(\\w+)\\\"\\s*\\)"; + //const int DATASOURCE_INDEX = 6; + //const int VALUE_INDEX = 2; + + const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:((?:(?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))((?:\\w+\\.?\\w+)|(?:\\w+))(?:(?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,)|(?:))\\s*\\\"(\\w+)\\\"\\s*\\)"; + const int DATASOURCE_INDEX = 4; const int VALUE_INDEX = 2; + const int EXPRESSION_ARGUMENT_INDEX = 3; + const QString GROUP_FUNCTION_RX = "(%1\\s*"+GROUP_FUNCTION_PARAM_RX+")"; const QString GROUP_FUNCTION_NAME_RX = "%1\\s*\\((.*[^\\)])\\)"; const int SCENE_MARGIN = 50; diff --git a/limereport/lrgroupfunctions.cpp b/limereport/lrgroupfunctions.cpp index 821b969..d21b4f8 100644 --- a/limereport/lrgroupfunctions.cpp +++ b/limereport/lrgroupfunctions.cpp @@ -57,7 +57,10 @@ void GroupFunction::slotBandRendered(BandDesignIntf *band) ContentItemDesignIntf* item = dynamic_cast(band->childByName(m_data)); if (item) m_values.push_back(item->content()); - else setInvalid(tr("Item \"%1\" not found").arg(m_data)); + else if (m_name.compare("COUNT",Qt::CaseInsensitive) == 0) { + m_values.push_back(1); + } else setInvalid(tr("Item \"%1\" not found").arg(m_data)); + break; } default: diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index e768e10..4158f49 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -368,7 +368,7 @@ void ReportRender::replaceGroupsFunction(BandDesignIntf *band) if (rx.indexIn(content)>=0){ int pos = 0; while ( (pos = rx.indexIn(content,pos))!= -1 ){ - content.replace(rx.capturedTexts().at(0),QString("%1(%2,%3)").arg(functionName).arg('"'+rx.cap(4)+'"').arg('"'+band->objectName()+'"')); + content.replace(rx.capturedTexts().at(0),QString("%1(%2,%3)").arg(functionName).arg('"'+rx.cap(Const::EXPRESSION_ARGUMENT_INDEX)+'"').arg('"'+band->objectName()+'"')); pos += rx.matchedLength(); } contentItem->setContent(content); diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index d24de0e..aeca592 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -302,8 +302,17 @@ QScriptValue callGroupFunction(const QString& functionName, QScriptContext* pcon ScriptEngineManager* sm = qscriptvalue_cast(pcontext->callee().data()); DataSourceManager* dm = sm->dataManager(); - QString expression = pcontext->argument(0).toString(); - QString band = pcontext->argument(1).toString(); + QString expression; + QString band; + + if (functionName.compare("COUNT",Qt::CaseInsensitive) == 0 && pcontext->argumentCount()==1){ + expression = " "; + band = pcontext->argument(0).toString(); + } else { + expression = pcontext->argument(0).toString(); + band = pcontext->argument(1).toString(); + } + QScriptValue res; GroupFunction* gf = dm->groupFunction(functionName,expression,band); if (gf){ From 2af7c5c7ddd109d3b9afbe3774f1001bb4e6f9ab Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 5 Jan 2017 14:46:06 +0300 Subject: [PATCH 29/51] Fix: #57 Callback DataSource initialized before signals/slots are connected --- limereport/lrreportengine.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index a7eaa36..62d75bb 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -664,9 +664,12 @@ ReportPages ReportEnginePrivate::renderToPages() { if (m_reportRendering) return ReportPages(); m_reportRender = ReportRender::Ptr(new ReportRender); + dataManager()->clearErrors(); dataManager()->connectAllDatabases(); dataManager()->setDesignTime(false); + dataManager()->updateDatasourceModel(); + connect(m_reportRender.data(),SIGNAL(pageRendered(int)), this, SIGNAL(renderPageFinished(int))); if (m_pages.count()){ From 6e895e9423f533884d28683dc857ce900517c384 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 9 Jan 2017 18:29:56 +0300 Subject: [PATCH 30/51] "Datasource not found" suppressed for empty data source at subdetail band --- limereport/lrreportrender.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 4158f49..2b061d8 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -638,7 +638,9 @@ void ReportRender::renderChildFooter(BandDesignIntf *parent, BandPrintMode print void ReportRender::renderChildBands(BandDesignIntf *parentBand) { foreach(BandDesignIntf* band,parentBand->childrenByType(BandDesignIntf::SubDetailBand)){ - IDataSource* ds = m_datasources->dataSource(band->datasourceName()); + IDataSource* ds = 0; + if (!band->datasourceName().isEmpty()) + ds = m_datasources->dataSource(band->datasourceName()); if (ds) ds->first(); renderChildHeader(band,PrintAlwaysPrintable); renderDataBand(band); From e327c64fedc3b5b2daf46c7ef3f9b2c1df88872d Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 20 Jan 2017 23:07:54 +0300 Subject: [PATCH 31/51] textIndent property has been added to TextItem --- limereport/items/lrtextitem.cpp | 18 +++++++++++++++++- limereport/items/lrtextitem.h | 5 +++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 2152143..32f868a 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -58,7 +58,7 @@ namespace LimeReport{ TextItem::TextItem(QObject *owner, QGraphicsItem *parent) : ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0), m_trimValue(true), m_allowHTML(false), - m_allowHTMLInFields(false), m_followTo(""), m_follower(0) + m_allowHTMLInFields(false), m_followTo(""), m_follower(0), m_textIndent(0) { PageItemDesignIntf* pageItem = dynamic_cast(parent); BaseDesignIntf* parentItem = dynamic_cast(parent); @@ -447,6 +447,7 @@ TextItem::TextPtr TextItem::textDocument() { QTextCursor tc = QTextCursor(block); QTextBlockFormat fmt = block.blockFormat(); + fmt.setTextIndent(m_textIndent); if(fmt.lineHeight() != m_lineSpacing) { fmt.setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight); @@ -458,6 +459,21 @@ TextItem::TextPtr TextItem::textDocument() } +qreal TextItem::textIndent() const +{ + return m_textIndent; +} + +void TextItem::setTextIndent(const qreal &textIndent) +{ + if (m_textIndent != textIndent){ + qreal oldValue = m_textIndent; + m_textIndent = textIndent; + update(); + notify("textIndent", oldValue, textIndent); + } +} + QString TextItem::followTo() const { return m_followTo; diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index 065724e..fc5f062 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -69,6 +69,7 @@ class TextItem : public LimeReport::ContentItemDesignIntf, IPageInit { Q_PROPERTY(ValueType valueType READ valueType WRITE setValueType) Q_PROPERTY(QString followTo READ followTo WRITE setFollowTo) Q_PROPERTY(BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle) + Q_PROPERTY(qreal textIndent READ textIndent WRITE setTextIndent) public: enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength}; @@ -157,6 +158,9 @@ public: typedef QSharedPointer TextPtr; + qreal textIndent() const; + void setTextIndent(const qreal &textIndent); + protected: void updateLayout(); bool isNeedExpandContent() const; @@ -198,6 +202,7 @@ private: ValueType m_valueType; QString m_followTo; TextItem* m_follower; + qreal m_textIndent; }; } From 0261a11b30428c63c8da9470a40175e0dd2fcfac Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 20 Jan 2017 23:26:18 +0300 Subject: [PATCH 32/51] textLayoutDirection property has been added to TextItem --- limereport/items/lrtextitem.cpp | 56 ++++++++++++++++++++++++--------- limereport/items/lrtextitem.h | 21 +++++++------ 2 files changed, 53 insertions(+), 24 deletions(-) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 32f868a..8328079 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -58,7 +58,7 @@ namespace LimeReport{ TextItem::TextItem(QObject *owner, QGraphicsItem *parent) : ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0), m_trimValue(true), m_allowHTML(false), - m_allowHTMLInFields(false), m_followTo(""), m_follower(0), m_textIndent(0) + m_allowHTMLInFields(false), m_followTo(""), m_follower(0), m_textIndent(0), m_textLayoutDirection(Qt::LayoutDirectionAuto) { PageItemDesignIntf* pageItem = dynamic_cast(parent); BaseDesignIntf* parentItem = dynamic_cast(parent); @@ -92,7 +92,7 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q setupPainter(painter); prepareRect(painter,style,widget); - QSizeF tmpSize = rect().size()-m_textSize; + QSizeF tmpSize = rect().size()-text->size(); if (!painter->clipRegion().isEmpty()){ QRegion clipReg=painter->clipRegion().xored(painter->clipRegion().subtracted(rect().toRect())); @@ -228,12 +228,13 @@ void TextItem::setContent(const QString &value) else m_strText=value; - if (itemMode() == DesignMode){ - initTextSizes(); - } +// if (itemMode() == DesignMode && (autoHeight())){ +// initTextSizes(); +// } if (!isLoading()){ - initTextSizes(); + if (autoHeight() || autoWidth()) + initTextSizes(); update(rect()); notify("content",oldValue,value); } @@ -244,7 +245,7 @@ void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, i { if (isNeedExpandContent()) expandContent(dataManager, pass); - if (!isLoading()) + if (!isLoading() && (autoHeight() || autoWidth()) ) initTextSizes(); if (m_textSize.width()>width() && ((m_autoWidth==MaxWordLength)||(m_autoWidth==MaxStringLength))){ @@ -296,7 +297,7 @@ QString TextItem::replaceReturns(QString text) return result; } -void TextItem::setTextFont(TextPtr text, const QFont& value) { +void TextItem::setTextFont(TextPtr text, const QFont& value) const { text->setDefaultFont(value); if ((m_angle==Angle0)||(m_angle==Angle180)){ text->setTextWidth(rect().width()-fakeMarginSize()*2); @@ -305,7 +306,7 @@ void TextItem::setTextFont(TextPtr text, const QFont& value) { } } -void TextItem::adaptFontSize(TextPtr text) { +void TextItem::adaptFontSize(TextPtr text) const{ QFont _font = transformToSceneFont(font()); do{ setTextFont(text,_font); @@ -337,13 +338,14 @@ void TextItem::setLineSpacing(int value) { int oldValue = m_lineSpacing; m_lineSpacing = value; - initTextSizes(); +// if (autoHeight()) +// initTextSizes(); update(); notify("lineSpacing",oldValue,value); } -void TextItem::initTextSizes() +void TextItem::initTextSizes() const { TextPtr text = textDocument(); m_textSize= text->size(); @@ -412,7 +414,7 @@ QString TextItem::formatFieldValue() } } -TextItem::TextPtr TextItem::textDocument() +TextItem::TextPtr TextItem::textDocument() const { TextPtr text(new QTextDocument); @@ -423,6 +425,8 @@ TextItem::TextPtr TextItem::textDocument() QTextOption to; to.setAlignment(m_alignment); + to.setTextDirection(m_textLayoutDirection); + //to.setTextDirection(QApplication::layoutDirection()); if (m_autoWidth!=MaxStringLength) if (m_adaptFontToSize && (!(m_autoHeight || m_autoWidth))) @@ -474,6 +478,22 @@ void TextItem::setTextIndent(const qreal &textIndent) } } +Qt::LayoutDirection TextItem::textLayoutDirection() const +{ + return m_textLayoutDirection; +} + +void TextItem::setTextLayoutDirection(const Qt::LayoutDirection &textLayoutDirection) +{ + if (m_textLayoutDirection != textLayoutDirection){ + int oldValue = int(m_textLayoutDirection); + m_textLayoutDirection = textLayoutDirection; + update(); + notify("textLayoutDirection",oldValue,int(textLayoutDirection)); + } +} + + QString TextItem::followTo() const { return m_followTo; @@ -624,6 +644,11 @@ void TextItem::geometryChangedEvent(QRectF , QRectF) bool TextItem::isNeedUpdateSize(RenderPass pass) const { Q_UNUSED(pass) + + if (autoHeight() && autoWidth()){ + initTextSizes(); + } + bool res = (m_textSize.height()>geometry().height()&&autoHeight()) || (m_textSize.width()>geometry().width()&&autoWidth()) || m_follower || @@ -795,9 +820,10 @@ BaseDesignIntf *TextItem::cloneEmpty(int height, QObject *owner, QGraphicsItem * void TextItem::objectLoadFinished() { ItemDesignIntf::objectLoadFinished(); - if (itemMode() == DesignMode || !isNeedExpandContent()){ - initTextSizes(); - } +// if (itemMode() == DesignMode || !isNeedExpandContent()){ +// if (autoHeight() && autoWidth()) +// initTextSizes(); +// } } void TextItem::setTextItemFont(QFont value) diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index fc5f062..068a59d 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -70,6 +70,7 @@ class TextItem : public LimeReport::ContentItemDesignIntf, IPageInit { Q_PROPERTY(QString followTo READ followTo WRITE setFollowTo) Q_PROPERTY(BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle) Q_PROPERTY(qreal textIndent READ textIndent WRITE setTextIndent) + Q_PROPERTY(Qt::LayoutDirection textLayoutDirection READ textLayoutDirection WRITE setTextLayoutDirection) public: enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength}; @@ -160,7 +161,9 @@ public: qreal textIndent() const; void setTextIndent(const qreal &textIndent); - + Qt::LayoutDirection textLayoutDirection() const; + void setTextLayoutDirection(const Qt::LayoutDirection &textLayoutDirection); + protected: void updateLayout(); bool isNeedExpandContent() const; @@ -170,24 +173,23 @@ protected: QString getTextPart(int height, int skipHeight); void restoreLinksEvent(); private: - void initTextSizes(); - void setTextFont(TextPtr text, const QFont &value); - void adaptFontSize(TextPtr text); + void initTextSizes() const; + void setTextFont(TextPtr text, const QFont &value) const; + void adaptFontSize(TextPtr text) const; QString formatDateTime(const QDateTime &value); QString formatNumber(const double value); QString formatFieldValue(); - TextPtr textDocument(); + TextPtr textDocument() const; private: QString m_strText; - //QTextLayout m_layout; - //QTextDocument* m_text; + //QTextDocument* m_text; Qt::Alignment m_alignment; bool m_autoHeight; AutoWidth m_autoWidth; - QSizeF m_textSize; - qreal m_firstLineSize; + QSizeF mutable m_textSize; + qreal mutable m_firstLineSize; AngleType m_angle; int m_foregroundOpacity; bool m_underlines; @@ -203,6 +205,7 @@ private: QString m_followTo; TextItem* m_follower; qreal m_textIndent; + Qt::LayoutDirection m_textLayoutDirection; }; } From f927f3a83c3410545635433fd231aa84e37f858f Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 23 Jan 2017 11:53:07 +0300 Subject: [PATCH 33/51] followTo has been fixed --- limereport/items/lrtextitem.cpp | 8 ++++---- limereport/items/lrtextitem.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 8328079..d8d77cd 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -233,7 +233,7 @@ void TextItem::setContent(const QString &value) // } if (!isLoading()){ - if (autoHeight() || autoWidth()) + if (autoHeight() || autoWidth() || hasFollower()) initTextSizes(); update(rect()); notify("content",oldValue,value); @@ -245,7 +245,7 @@ void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, i { if (isNeedExpandContent()) expandContent(dataManager, pass); - if (!isLoading() && (autoHeight() || autoWidth()) ) + if (!isLoading() && (autoHeight() || autoWidth() || hasFollower()) ) initTextSizes(); if (m_textSize.width()>width() && ((m_autoWidth==MaxWordLength)||(m_autoWidth==MaxStringLength))){ @@ -547,7 +547,7 @@ void TextItem::clearFollower() m_follower = 0; } -bool TextItem::hasFollower() +bool TextItem::hasFollower() const { return m_follower != 0; } @@ -645,7 +645,7 @@ bool TextItem::isNeedUpdateSize(RenderPass pass) const { Q_UNUSED(pass) - if (autoHeight() && autoWidth()){ + if (autoHeight() && autoWidth() || hasFollower()){ initTextSizes(); } diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index 068a59d..ac9b5b6 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -150,8 +150,8 @@ public: void setFollowTo(const QString &followTo); void setFollower(TextItem* follower); void clearFollower(); - bool hasFollower(); - TextItem* follower(){ return m_follower;} + bool hasFollower() const; + TextItem* follower() const { return m_follower;} bool initFollower(QString follower); // IPageInit interface From 887710d728db64e3093b1b3587b5e379336d81ba Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 23 Jan 2017 12:11:48 +0300 Subject: [PATCH 34/51] ImageItem design time label has been fixed --- limereport/items/lrimageitem.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/limereport/items/lrimageitem.cpp b/limereport/items/lrimageitem.cpp index 38e4441..ede6a1f 100644 --- a/limereport/items/lrimageitem.cpp +++ b/limereport/items/lrimageitem.cpp @@ -241,6 +241,7 @@ void ImageItem::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option if (img.isNull() && itemMode()==DesignMode){ QString text; ppainter->setFont(transformToSceneFont(QFont("Arial",10))); + ppainter->setPen(Qt::black); if (!datasource().isEmpty() && !field().isEmpty()) text = datasource()+"."+field(); else text = tr("Image"); From afc8ad77b26379cc46b5234b75f2733cfa97e9db Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 28 Jan 2017 02:20:15 +0300 Subject: [PATCH 35/51] Group functions have been refactored. From now they can use script expression in value parameter --- include/lrglobal.cpp | 16 +++ include/lrglobal.h | 14 ++- limereport/lrbasedesignintf.cpp | 144 ++--------------------- limereport/lrbasedesignintf.h | 10 +- limereport/lrdatasourcemanager.cpp | 33 ++++++ limereport/lrdatasourcemanager.h | 13 +++ limereport/lrglobal.cpp | 16 +++ limereport/lrglobal.h | 14 ++- limereport/lrgroupfunctions.cpp | 64 ++++++++--- limereport/lrgroupfunctions.h | 2 +- limereport/lrreportengine.cpp | 3 +- limereport/lrreportrender.cpp | 6 +- limereport/lrscriptenginemanager.cpp | 165 ++++++++++++++++++++++++++- limereport/lrscriptenginemanager.h | 5 + 14 files changed, 333 insertions(+), 172 deletions(-) diff --git a/include/lrglobal.cpp b/include/lrglobal.cpp index 47b31f0..5b2cdff 100644 --- a/include/lrglobal.cpp +++ b/include/lrglobal.cpp @@ -51,4 +51,20 @@ void ReportSettings::setSuppressAbsentFieldsAndVarsWarnings(bool suppressAbsentF m_suppressAbsentFieldsAndVarsWarnings = suppressAbsentFieldsAndVarsWarnings; } +QString escapeSimbols(const QString &value) +{ + QString result = value; + result.replace("\"","\\\""); + result.replace('\n',"\\n"); + return result; +} + +QString replaceHTMLSymbols(const QString &value) +{ + QString result = value; + result.replace("<","<"); + result.replace(">",">"); + return result; +} + } //namespace LimeReport diff --git a/include/lrglobal.h b/include/lrglobal.h index 3a01927..3b8aa7d 100644 --- a/include/lrglobal.h +++ b/include/lrglobal.h @@ -82,16 +82,21 @@ namespace Const{ //const int DATASOURCE_INDEX = 6; //const int VALUE_INDEX = 2; - const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:((?:(?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))((?:\\w+\\.?\\w+)|(?:\\w+))(?:(?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,)|(?:))\\s*\\\"(\\w+)\\\"\\s*\\)"; - const int DATASOURCE_INDEX = 4; - const int VALUE_INDEX = 2; - const int EXPRESSION_ARGUMENT_INDEX = 3; + //const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:((?:(?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"?\\$S\\s*\\{\\s*)|(?:\\\"))((?:\\w+\\.?\\w+)|(?:\\w+))(?:(?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,)|(?:))\\s*\\\"(\\w+)\\\"\\s*\\)"; + const QString GROUP_FUNCTION_PARAM_RX = "\\((?:(.+),|(?:))(?:\\\"(\\w+)\\\")\\)"; + const int DATASOURCE_INDEX = 3;//4; + const int VALUE_INDEX = 2; //2; + const int EXPRESSION_ARGUMENT_INDEX = 1;//3; const QString GROUP_FUNCTION_RX = "(%1\\s*"+GROUP_FUNCTION_PARAM_RX+")"; const QString GROUP_FUNCTION_NAME_RX = "%1\\s*\\((.*[^\\)])\\)"; const int SCENE_MARGIN = 50; } QString extractClassName(QString className); + QString escapeSimbols(const QString& value); + QString replaceHTMLSymbols(const QString &value); + + enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols}; enum RenderPass {FirstPass, SecondPass}; enum ArrangeType {AsNeeded, Force}; enum PreviewHint{ShowAllPreviewBars = 0, @@ -100,6 +105,7 @@ namespace Const{ HidePreviewStatusBar = 4, HideAllPreviewBar = 7, PreviewBarsUserSetting = 8}; + Q_DECLARE_FLAGS(PreviewHints, PreviewHint) Q_FLAGS(PreviewHints) diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 77967f4..f0f7e2b 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -34,7 +34,6 @@ #include "lrreportdesignwidget.h" #include "qgraphicsitem.h" #include "lrdesignelementsfactory.h" - #include "lrhorizontallayout.h" #include @@ -241,150 +240,29 @@ QFont BaseDesignIntf::transformToSceneFont(const QFont& value) const return f; } -QString BaseDesignIntf::escapeSimbols(const QString &value) -{ - QString result = value; - result.replace("\"","\\\""); - result.replace('\n',"\\n"); - return result; -} - -QString BaseDesignIntf::replaceHTMLSymbols(const QString &value) -{ - QString result = value; - result.replace("<","<"); - result.replace(">",">"); - return result; -} - QString BaseDesignIntf::expandDataFields(QString context, ExpandType expandType, DataSourceManager* dataManager) { - QRegExp rx(Const::FIELD_RX); - - if (context.contains(rx)){ - while ((rx.indexIn(context))!=-1){ - QString field=rx.cap(1); - - if (dataManager->containsField(field)) { - QString fieldValue; - m_varValue = dataManager->fieldData(field); - if (expandType == EscapeSymbols) { - if (dataManager->fieldData(field).isNull()) { - fieldValue="\"\""; - } else { - fieldValue = escapeSimbols(m_varValue.toString()); - switch (dataManager->fieldData(field).type()) { - case QVariant::Char: - case QVariant::String: - case QVariant::StringList: - case QVariant::Date: - case QVariant::DateTime: - fieldValue = "\""+fieldValue+"\""; - break; - default: - break; - } - } - } else { - if (expandType == ReplaceHTMLSymbols) - fieldValue = replaceHTMLSymbols(m_varValue.toString()); - else fieldValue = m_varValue.toString(); - } - - context.replace(rx.cap(0),fieldValue); - - } else { - QString error = QString("Field %1 not found in %2 !!! ").arg(field).arg(this->objectName()); - dataManager->putError(error); - if (!reportSettings() || !reportSettings()->suppressAbsentFieldsAndVarsWarnings()) - context.replace(rx.cap(0),error); - else - context.replace(rx.cap(0),""); - } - } - } - - return context; + ScriptEngineManager& sm = ScriptEngineManager::instance(); + if (sm.dataManager() != dataManager) sm.setDataManager(dataManager); + return sm.expandDataFields(context, expandType, m_varValue, this); } QString BaseDesignIntf::expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager* dataManager) { - QRegExp rx(Const::VARIABLE_RX); - if (context.contains(rx)){ - int pos = 0; - while ((pos = rx.indexIn(context,pos))!=-1){ - QString variable=rx.cap(1); - pos += rx.matchedLength(); - if (dataManager->containsVariable(variable) ){ - try { - if (pass==dataManager->variablePass(variable)){ - m_varValue = dataManager->variable(variable); - switch (expandType){ - case EscapeSymbols: - context.replace(rx.cap(0),escapeSimbols(m_varValue.toString())); - break; - case NoEscapeSymbols: - context.replace(rx.cap(0),m_varValue.toString()); - break; - case ReplaceHTMLSymbols: - context.replace(rx.cap(0),replaceHTMLSymbols(m_varValue.toString())); - break; - } - pos=0; - } - } catch (ReportError e){ - dataManager->putError(e.what()); - if (!reportSettings() || reportSettings()->suppressAbsentFieldsAndVarsWarnings()) - context.replace(rx.cap(0),e.what()); - else - context.replace(rx.cap(0),""); - } - } else { - QString error; - error = tr("Variable %1 not found").arg(variable); - dataManager->putError(error); - if (!reportSettings() || reportSettings()->suppressAbsentFieldsAndVarsWarnings()) - context.replace(rx.cap(0),error); - else - context.replace(rx.cap(0),""); - } - } - } - return context; + + ScriptEngineManager& sm = ScriptEngineManager::instance(); + if (sm.dataManager() != dataManager) sm.setDataManager(dataManager); + return sm.expandUserVariables(context, pass, expandType, m_varValue); + } QString BaseDesignIntf::expandScripts(QString context, DataSourceManager* dataManager) { - QRegExp rx(Const::SCRIPT_RX); - if (context.contains(rx)){ - ScriptEngineManager::instance().setDataManager(dataManager); - QScriptEngine* se = ScriptEngineManager::instance().scriptEngine(); + ScriptEngineManager& sm = ScriptEngineManager::instance(); + if (sm.dataManager() != dataManager) sm.setDataManager(dataManager); + return sm.expandScripts(context,m_varValue,this); - QScriptValue svThis = se->globalObject().property("THIS"); - if (svThis.isValid()){ - se->newQObject(svThis, this); - } else { - svThis = se->newQObject(this); - se->globalObject().setProperty("THIS",svThis); - } - - ScriptExtractor scriptExtractor(context); - if (scriptExtractor.parse()){ - for(int i=0; ievaluate(scriptBody); - if (!se->hasUncaughtException()) { - m_varValue = value.toVariant(); - context.replace(scriptExtractor.scriptAt(i),value.toString()); - } else { - context.replace(scriptExtractor.scriptAt(i),se->uncaughtException().toString()); - } - } - } - } - return context; } void BaseDesignIntf::setupPainter(QPainter *painter) const diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index d6b32f6..253da8d 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -131,7 +131,7 @@ public: }; enum ObjectState {ObjectLoading, ObjectLoaded, ObjectCreated}; enum ItemAlign {LeftItemAlign,RightItemAlign,CenterItemAlign,ParentWidthItemAlign,DesignedItemAlign}; - enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols}; +// enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols}; Q_DECLARE_FLAGS(BorderLines, BorderSide) Q_DECLARE_FLAGS(ItemMode,ItemModes) friend class SelectionMarker; @@ -327,11 +327,9 @@ protected: virtual bool drawDesignBorders() const {return true;} virtual QColor selectionMarkerColor(){ return Const::SELECTION_COLOR;} - QString escapeSimbols(const QString& value); - QString replaceHTMLSymbols(const QString& value); - virtual QString expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager *dataManager); - virtual QString expandDataFields(QString context, ExpandType expandType, DataSourceManager *dataManager); - virtual QString expandScripts(QString context, DataSourceManager *dataManager); + QString expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager *dataManager); + QString expandDataFields(QString context, ExpandType expandType, DataSourceManager *dataManager); + QString expandScripts(QString context, DataSourceManager *dataManager); QVariant m_varValue; diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index 42ec024..bab241d 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -238,6 +238,29 @@ void DataSourceManager::setDefaultDatabasePath(const QString &defaultDatabasePat { m_defaultDatabasePath = defaultDatabasePath; } + +QString DataSourceManager::putGroupFunctionsExpressions(QString expression) +{ + if (m_groupFunctionsExpressionsMap.contains(expression)){ + return QString::number(m_groupFunctionsExpressionsMap.value(expression)); + } else { + m_groupFunctionsExpressions.append(expression); + m_groupFunctionsExpressionsMap.insert(expression, m_groupFunctionsExpressions.size()-1); + return QString::number(m_groupFunctionsExpressions.size()-1); + } +} + +void DataSourceManager::clearGroupFuntionsExpressions() +{ + m_groupFunctionsExpressionsMap.clear(); + m_groupFunctionsExpressions.clear(); +} + +QString DataSourceManager::getExpression(QString index) +{ + return m_groupFunctionsExpressions.at(index.toInt()); +} + bool DataSourceManager::designTime() const { return m_designTime; @@ -702,6 +725,16 @@ bool DataSourceManager::initAndOpenDB(QSqlDatabase& db, ConnectionDesc& connecti return connected; } +ReportSettings *DataSourceManager::reportSettings() const +{ + return m_reportSettings; +} + +void DataSourceManager::setReportSettings(ReportSettings *reportSettings) +{ + m_reportSettings = reportSettings; +} + bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) { diff --git a/limereport/lrdatasourcemanager.h b/limereport/lrdatasourcemanager.h index a6043f0..7670b2e 100644 --- a/limereport/lrdatasourcemanager.h +++ b/limereport/lrdatasourcemanager.h @@ -192,6 +192,13 @@ public: QString defaultDatabasePath() const; void setDefaultDatabasePath(const QString &defaultDatabasePath); + QString putGroupFunctionsExpressions(QString expression); + void clearGroupFuntionsExpressions(); + QString getExpression(QString index); + + ReportSettings *reportSettings() const; + void setReportSettings(ReportSettings *reportSettings); + signals: void loadCollectionFinished(const QString& collectionName); void cleared(); @@ -240,7 +247,13 @@ private: bool m_designTime; bool m_needUpdate; QString m_defaultDatabasePath; + ReportSettings* m_reportSettings; + QHash m_groupFunctionsExpressionsMap; + QVector m_groupFunctionsExpressions; + + }; } #endif // LRDATASOURCEMANAGER_H + diff --git a/limereport/lrglobal.cpp b/limereport/lrglobal.cpp index 47b31f0..5b2cdff 100644 --- a/limereport/lrglobal.cpp +++ b/limereport/lrglobal.cpp @@ -51,4 +51,20 @@ void ReportSettings::setSuppressAbsentFieldsAndVarsWarnings(bool suppressAbsentF m_suppressAbsentFieldsAndVarsWarnings = suppressAbsentFieldsAndVarsWarnings; } +QString escapeSimbols(const QString &value) +{ + QString result = value; + result.replace("\"","\\\""); + result.replace('\n',"\\n"); + return result; +} + +QString replaceHTMLSymbols(const QString &value) +{ + QString result = value; + result.replace("<","<"); + result.replace(">",">"); + return result; +} + } //namespace LimeReport diff --git a/limereport/lrglobal.h b/limereport/lrglobal.h index 3a01927..3b8aa7d 100644 --- a/limereport/lrglobal.h +++ b/limereport/lrglobal.h @@ -82,16 +82,21 @@ namespace Const{ //const int DATASOURCE_INDEX = 6; //const int VALUE_INDEX = 2; - const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:((?:(?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))((?:\\w+\\.?\\w+)|(?:\\w+))(?:(?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,)|(?:))\\s*\\\"(\\w+)\\\"\\s*\\)"; - const int DATASOURCE_INDEX = 4; - const int VALUE_INDEX = 2; - const int EXPRESSION_ARGUMENT_INDEX = 3; + //const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:((?:(?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"?\\$S\\s*\\{\\s*)|(?:\\\"))((?:\\w+\\.?\\w+)|(?:\\w+))(?:(?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,)|(?:))\\s*\\\"(\\w+)\\\"\\s*\\)"; + const QString GROUP_FUNCTION_PARAM_RX = "\\((?:(.+),|(?:))(?:\\\"(\\w+)\\\")\\)"; + const int DATASOURCE_INDEX = 3;//4; + const int VALUE_INDEX = 2; //2; + const int EXPRESSION_ARGUMENT_INDEX = 1;//3; const QString GROUP_FUNCTION_RX = "(%1\\s*"+GROUP_FUNCTION_PARAM_RX+")"; const QString GROUP_FUNCTION_NAME_RX = "%1\\s*\\((.*[^\\)])\\)"; const int SCENE_MARGIN = 50; } QString extractClassName(QString className); + QString escapeSimbols(const QString& value); + QString replaceHTMLSymbols(const QString &value); + + enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols}; enum RenderPass {FirstPass, SecondPass}; enum ArrangeType {AsNeeded, Force}; enum PreviewHint{ShowAllPreviewBars = 0, @@ -100,6 +105,7 @@ namespace Const{ HidePreviewStatusBar = 4, HideAllPreviewBar = 7, PreviewBarsUserSetting = 8}; + Q_DECLARE_FLAGS(PreviewHints, PreviewHint) Q_FLAGS(PreviewHints) diff --git a/limereport/lrgroupfunctions.cpp b/limereport/lrgroupfunctions.cpp index d21b4f8..c265dfc 100644 --- a/limereport/lrgroupfunctions.cpp +++ b/limereport/lrgroupfunctions.cpp @@ -31,6 +31,7 @@ #include "lrdatasourcemanager.h" #include "lrbanddesignintf.h" #include "lritemdesignintf.h" +#include "lrscriptenginemanager.h" #include @@ -38,23 +39,45 @@ namespace LimeReport { void GroupFunction::slotBandRendered(BandDesignIntf *band) { + ScriptEngineManager& sm = ScriptEngineManager::instance(); + + QRegExp rxField(Const::FIELD_RX); + QRegExp rxVar(Const::VARIABLE_RX); + switch (m_dataType){ case Field: - if (m_dataManager->containsField(m_data)){ - m_values.push_back(m_dataManager->fieldData(m_data)); - } else { - setInvalid(tr("Field \"%1\" not found").arg(m_data)); + if (rxField.indexIn(m_data) != -1){ + QString field = rxField.cap(1); + if (m_dataManager->containsField(field)){ + m_values.push_back(m_dataManager->fieldData(field)); + } else { + setInvalid(tr("Field \"%1\" not found").arg(m_data)); + } } break; case Variable: - if (m_dataManager->containsVariable(m_data)){ - m_values.push_back(m_dataManager->variable(m_data)); - } else { - setInvalid(tr("Variable \"%1\" not found").arg(m_data)); + if (rxVar.indexIn(m_data) != -1){ + QString var = rxVar.cap(1); + if (m_dataManager->containsVariable(var)){ + m_values.push_back(m_dataManager->variable(var)); + } else { + setInvalid(tr("Variable \"%1\" not found").arg(m_data)); + } } break; + case Script: + { + QVariant value = sm.evaluateScript(m_data); + if (value.isValid()){ + m_values.push_back(value); + } else { + setInvalid(tr("Wrong script syntax \"%1\" ").arg(m_data)); + } + break; + } case ContentItem:{ - ContentItemDesignIntf* item = dynamic_cast(band->childByName(m_data)); + QString itemName = m_data; + ContentItemDesignIntf* item = dynamic_cast(band->childByName(itemName.remove('"'))); if (item) m_values.push_back(item->content()); else if (m_name.compare("COUNT",Qt::CaseInsensitive) == 0) { @@ -91,24 +114,27 @@ QVariant GroupFunction::multiplication(QVariant value1, QVariant value2) GroupFunction::GroupFunction(const QString &expression, const QString &dataBandName, DataSourceManager* dataManager) :m_dataBandName(dataBandName), m_dataManager(dataManager),m_isValid(true), m_errorMessage("") { + m_data = expression; QRegExp rxField(Const::FIELD_RX,Qt::CaseInsensitive); - if (rxField.indexIn(expression)>=0){ - m_dataType=Field; - m_data = rxField.cap(1); + QRegExp rxVariable(Const::VARIABLE_RX,Qt::CaseInsensitive); + QRegExp rxScript(Const::SCRIPT_RX,Qt::CaseInsensitive); + + if (rxScript.indexIn(expression) != -1){ + m_dataType = Script; return; } - QRegExp rxVariable(Const::VARIABLE_RX,Qt::CaseInsensitive); - if (rxVariable.indexIn(expression)>=0){ - m_dataType=Variable; - m_data = rxVariable.cap(1); + if (rxField.indexIn(expression) != -1){ + m_dataType=Field; + return; + } + + if (rxVariable.indexIn(expression) != -1){ + m_dataType = Variable; return; } m_dataType = ContentItem; - m_data = expression; - m_data = m_data.remove('"'); - } GroupFunction *GroupFunctionFactory::createGroupFunction(const QString &functionName, const QString &expression, const QString& dataBandName, DataSourceManager *dataManager) diff --git a/limereport/lrgroupfunctions.h b/limereport/lrgroupfunctions.h index cfe59c2..f85a0bd 100644 --- a/limereport/lrgroupfunctions.h +++ b/limereport/lrgroupfunctions.h @@ -42,7 +42,7 @@ class BandDesignIntf; class GroupFunction : public QObject{ Q_OBJECT public: - enum DataType{Variable,Field,Srcipt,ContentItem}; + enum DataType{Variable, Field, Script, ContentItem}; GroupFunction(const QString& expression, const QString& dataBandName, DataSourceManager *dataManager); bool isValid(){return m_isValid;} void setInvalid(QString message){m_isValid=false,m_errorMessage=message;} diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 62d75bb..edb7ac4 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -60,7 +60,8 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) : m_showProgressDialog(true), m_reportName(""), m_activePreview(0), m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")), m_reportRendering(false) { - m_datasources= new DataSourceManager(this); + m_datasources = new DataSourceManager(this); + m_datasources->setReportSettings(&m_reportSettings); m_scriptEngineContext = new ScriptEngineContext(this); m_datasources->setObjectName("datasources"); connect(m_datasources,SIGNAL(loadCollectionFinished(QString)),this,SLOT(slotDataSourceCollectionLoaded(QString))); diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 2b061d8..a66b95d 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -236,6 +236,7 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) try{ datasources()->setAllDatasourcesToFirst(); + datasources()->clearGroupFuntionsExpressions(); } catch(ReportError &exception){ //TODO possible should thow exeption QMessageBox::critical(0,tr("Error"),exception.what()); @@ -277,7 +278,7 @@ int ReportRender::pageCount() PageItemDesignIntf::Ptr ReportRender::pageAt(int index) { - if ((index>m_renderedPages.count()-1)||(index<0)) throw ReportError("page index out of range"); + if ((index>m_renderedPages.count()-1)||(index<0)) throw ReportError(tr("page index out of range")); else return m_renderedPages.at(index); } @@ -368,7 +369,8 @@ void ReportRender::replaceGroupsFunction(BandDesignIntf *band) if (rx.indexIn(content)>=0){ int pos = 0; while ( (pos = rx.indexIn(content,pos))!= -1 ){ - content.replace(rx.capturedTexts().at(0),QString("%1(%2,%3)").arg(functionName).arg('"'+rx.cap(Const::EXPRESSION_ARGUMENT_INDEX)+'"').arg('"'+band->objectName()+'"')); + QString expressionIndex = datasources()->putGroupFunctionsExpressions(rx.cap(Const::VALUE_INDEX)); + content.replace(rx.capturedTexts().at(0),QString("%1(%2,%3)").arg(functionName).arg('"'+expressionIndex+'"').arg('"'+band->objectName()+'"')); pos += rx.matchedLength(); } contentItem->setContent(content); diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index aeca592..f69283b 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -309,7 +309,7 @@ QScriptValue callGroupFunction(const QString& functionName, QScriptContext* pcon expression = " "; band = pcontext->argument(0).toString(); } else { - expression = pcontext->argument(0).toString(); + expression = dm->getExpression(pcontext->argument(0).toString()); band = pcontext->argument(1).toString(); } @@ -427,7 +427,7 @@ void ScriptEngineManager::setDataManager(DataSourceManager *dataManager){ if (m_dataManager){ foreach(QString func, m_dataManager->groupFunctionNames()){ if (isFunctionExists(func)) deleteFunction(func); - addFunction(func, groupFunction,"GROUP FUNCTIONS", func+"(\""+tr("FieldName")+"\",\""+tr("BandName")+"\")"); + addFunction(func, groupFunction,"GROUP FUNCTIONS", func+"(\""+tr("Value")+"\",\""+tr("BandName")+"\")"); } foreach(ScriptFunctionDesc func, m_functions){ if (func.type==ScriptFunctionDesc::Native) @@ -437,6 +437,167 @@ void ScriptEngineManager::setDataManager(DataSourceManager *dataManager){ } } +QString ScriptEngineManager::expandUserVariables(QString context, RenderPass pass, ExpandType expandType, QVariant &varValue) +{ + QRegExp rx(Const::VARIABLE_RX); + if (context.contains(rx)){ + int pos = 0; + while ((pos = rx.indexIn(context,pos))!=-1){ + QString variable=rx.cap(1); + pos += rx.matchedLength(); + if (dataManager()->containsVariable(variable) ){ + try { + if (pass==dataManager()->variablePass(variable)){ + varValue = dataManager()->variable(variable); + switch (expandType){ + case EscapeSymbols: + context.replace(rx.cap(0),escapeSimbols(varValue.toString())); + break; + case NoEscapeSymbols: + context.replace(rx.cap(0),varValue.toString()); + break; + case ReplaceHTMLSymbols: + context.replace(rx.cap(0),replaceHTMLSymbols(varValue.toString())); + break; + } + pos=0; + } + } catch (ReportError e){ + dataManager()->putError(e.what()); + if (!dataManager()->reportSettings() || dataManager()->reportSettings()->suppressAbsentFieldsAndVarsWarnings()) + context.replace(rx.cap(0),e.what()); + else + context.replace(rx.cap(0),""); + } + } else { + QString error; + error = tr("Variable %1 not found").arg(variable); + dataManager()->putError(error); + if (!dataManager()->reportSettings() || dataManager()->reportSettings()->suppressAbsentFieldsAndVarsWarnings()) + context.replace(rx.cap(0),error); + else + context.replace(rx.cap(0),""); + } + } + } + return context; +} + +QString ScriptEngineManager::expandDataFields(QString context, ExpandType expandType, QVariant &varValue, QObject *reportItem) +{ + QRegExp rx(Const::FIELD_RX); + + if (context.contains(rx)){ + while ((rx.indexIn(context))!=-1){ + QString field=rx.cap(1); + + if (dataManager()->containsField(field)) { + QString fieldValue; + varValue = dataManager()->fieldData(field); + if (expandType == EscapeSymbols) { + if (dataManager()->fieldData(field).isNull()) { + fieldValue="\"\""; + } else { + fieldValue = escapeSimbols(varValue.toString()); + switch (dataManager()->fieldData(field).type()) { + case QVariant::Char: + case QVariant::String: + case QVariant::StringList: + case QVariant::Date: + case QVariant::DateTime: + fieldValue = "\""+fieldValue+"\""; + break; + default: + break; + } + } + } else { + if (expandType == ReplaceHTMLSymbols) + fieldValue = replaceHTMLSymbols(varValue.toString()); + else fieldValue = varValue.toString(); + } + + context.replace(rx.cap(0),fieldValue); + + } else { + QString error = QString("Field %1 not found in %2 !!! ").arg(field).arg(reportItem->objectName()); + dataManager()->putError(error); + varValue = QVariant(); + if (!dataManager()->reportSettings() || !dataManager()->reportSettings()->suppressAbsentFieldsAndVarsWarnings()) + context.replace(rx.cap(0),error); + else + context.replace(rx.cap(0),""); + } + } + } + + return context; +} + +QString ScriptEngineManager::expandScripts(QString context, QVariant& varValue, QObject *reportItem) +{ + QRegExp rx(Const::SCRIPT_RX); + + if (context.contains(rx)){ + + if (ScriptEngineManager::instance().dataManager()!=dataManager()) + ScriptEngineManager::instance().setDataManager(dataManager()); + + QScriptEngine* se = ScriptEngineManager::instance().scriptEngine(); + + if (reportItem){ + QScriptValue svThis = se->globalObject().property("THIS"); + if (svThis.isValid()){ + se->newQObject(svThis, this); + } else { + svThis = se->newQObject(this); + se->globalObject().setProperty("THIS",svThis); + } + } + + ScriptExtractor scriptExtractor(context); + if (scriptExtractor.parse()){ + for(int i=0; ievaluate(scriptBody); + if (!se->hasUncaughtException()) { + varValue = value.toVariant(); + context.replace(scriptExtractor.scriptAt(i),value.toString()); + } else { + context.replace(scriptExtractor.scriptAt(i),se->uncaughtException().toString()); + } + } + } + } + return context; +} + +QVariant ScriptEngineManager::evaluateScript(const QString& script){ + + QRegExp rx(Const::SCRIPT_RX); + QVariant varValue; + + if (script.contains(rx)){ + + if (ScriptEngineManager::instance().dataManager()!=dataManager()) + ScriptEngineManager::instance().setDataManager(dataManager()); + + QScriptEngine* se = ScriptEngineManager::instance().scriptEngine(); + + ScriptExtractor scriptExtractor(script); + if (scriptExtractor.parse()){ + QString scriptBody = expandDataFields(scriptExtractor.bodyAt(0),EscapeSymbols, varValue, 0); + scriptBody = expandUserVariables(scriptBody, FirstPass, EscapeSymbols, varValue); + QScriptValue value = se->evaluate(scriptBody); + if (!se->hasUncaughtException()) { + return value.toVariant(); + } + } + } + return QVariant(); +} + void ScriptEngineManager::updateModel() { diff --git a/limereport/lrscriptenginemanager.h b/limereport/lrscriptenginemanager.h index 0c738d9..545580b 100644 --- a/limereport/lrscriptenginemanager.h +++ b/limereport/lrscriptenginemanager.h @@ -190,6 +190,11 @@ public: DataSourceManager* dataManager() const {return m_dataManager;} void setDataManager(DataSourceManager* dataManager); + QString expandUserVariables(QString context, RenderPass pass, ExpandType expandType, QVariant &varValue); + QString expandDataFields(QString context, ExpandType expandType, QVariant &varValue, QObject* reportItem); + QString expandScripts(QString context, QVariant &varValue, QObject* reportItem); + QVariant evaluateScript(const QString &script); + protected: void updateModel(); bool containsFunction(const QString &functionName); From f0ac7822964bbb574b883a63a07ebb32bb20fbf9 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 31 Jan 2017 18:31:28 +0400 Subject: [PATCH 36/51] From now Designer can load a report from the command-line option --- designer/main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer/main.cpp b/designer/main.cpp index 7d5084c..6ecf8ef 100644 --- a/designer/main.cpp +++ b/designer/main.cpp @@ -5,6 +5,9 @@ int main(int argc, char *argv[]) { QApplication a(argc, argv); LimeReport::ReportEngine report; + if (a.arguments().count()>1){ + report.loadFromFile(a.arguments().at(1)); + } report.designReport(); return a.exec(); } From f409f54e8f67168de9b6465721171ee5d0605922 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 1 Feb 2017 23:56:12 +0300 Subject: [PATCH 37/51] Arabic translation has been added --- limereport/limereport.pro | 2 +- translations/limereport_ar.ts | 2192 +++++++++++++++++++++++++++++++++ 2 files changed, 2193 insertions(+), 1 deletion(-) create mode 100644 translations/limereport_ar.ts diff --git a/limereport/limereport.pro b/limereport/limereport.pro index f287154..6397a71 100644 --- a/limereport/limereport.pro +++ b/limereport/limereport.pro @@ -67,7 +67,7 @@ contains(CONFIG,zint){ ####Automatically build required translation files (*.qm) contains(CONFIG,build_translations){ - LANGUAGES = ru es_ES + LANGUAGES = ru es_ES ar defineReplace(prependAll) { for(a,$$1):result += $$2$${a}$$3 diff --git a/translations/limereport_ar.ts b/translations/limereport_ar.ts new file mode 100644 index 0000000..aa037f9 --- /dev/null +++ b/translations/limereport_ar.ts @@ -0,0 +1,2192 @@ + + + + + AboutDialog + + About + حول البرنامج + + + Author + المؤلف + + + License + إتفاقية الترخيص + + + Close + إغلاق + + + Version 1.1.1 + الإصدار 1.1.1 + + + + ConnectionDialog + + Connection + إتصال بقاعدة بيانات + + + Connection Name + أسم الإتصال + + + Driver + المشغل + + + Server + الخادم + + + User + المستخدم + + + Password + كلمة المرور + + + Database + قاعدة البيانات + + + Auto connect + إتصال تلقائي + + + Check connection + فحص الإتصال + + + Cancel + إلغاء الأمر + + + Error + خطأ + + + Connection succsesfully established! + تم الإتصال بنجاح!! + + + Connection Name is empty + أسم الإتصال فارغ + + + Connection with name + إتصال بأسم + + + already exists + موجود مسبقاً + + + + DataBrowser + + Datasources + مصدر البيانات + + + Add database connection + إضافة إتصال قاعدة بيانات + + + Add new datasource + إضافة مصدر بيانات جديد + + + View data + عرض البيانات + + + Change datasource + تغيير مصدر البيانات + + + Delete datasource + حذف مصدر البيانات + + + Show error + عرض الأخطاء + + + Variables + المتغيرات + + + Add new variable + إضافة متغير + + + Edit variable + تعديل متغير + + + Delete variable + حذف متغير + + + + LRVariableDialog + + Variable + متغير + + + Name + الأسم + + + Value + القيمة + + + Type + النوع + + + Attention + Attention + + + + LimeReport::AVariablesHolder + + variable with name + متغير بأسم + + + already exists !! + موجود مسبقاً !! + + + does not exists !! + غير موجود !! + + + + LimeReport::AboutDialog + + About + حول البرنامج + + + Author + المؤلف + + + License + إتفاقية الترخيص + + + Close + إغلاق + + + Version 1.1.1 + الإصدار 1.1.1 + + + Lime Report + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/report/images/logo_100.png" height="100" style="float: left;" /><span style=" font-size:12pt; font-weight:600; color:#555555;">Report engine for </span><span style=" font-size:12pt; font-weight:600; color:#7faa18;">Qt</span><span style=" font-size:12pt; font-weight:600; color:#555555;"> framework</span></p> +<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">LimeReport - multi-platform C++ library written using Qt framework and intended for software developers that would like to add into their application capability to form report or print forms generated using templates.</span></p> +<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><br /></p> +<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><br /></p> +<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">Official web site : </span><a href="www.limereport.ru"><span style=" font-size:11pt; text-decoration: underline; color:#0000ff;">www.limereport.ru</span></a></p> +<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt; text-decoration: underline; color:#0000ff;"><br /></p> +<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600; color:#000000;">This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</span></p> +<p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt; font-weight:600; color:#000000;"><br /></p> +<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; color:#000000;">Copyright 2015 Arin Alexander. All rights reserved.</span></p></body></html> + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Arin Alexander</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">arin_a@bk.ru</p></body></html> + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(c) 2015 Arin Alexander arin_a@bk.ru</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="SEC1"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">G</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">NU LESSER GENERAL PUBLIC LICENSE</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Version 2.1, February 1999</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Copyright (C) 1991, 1999 Free Software Foundation, Inc.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Everyone is permitted to copy and distribute verbatim copies</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">of this license document, but changing it is not allowed.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">[This is the first released version of the Lesser GPL. It also counts</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;"> as the successor of the GNU Library Public License, version 2, hence</span></p> +<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;"> the version number 2.1.]</span></p> +<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="SEC2"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">P</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">reamble</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">We call this license the &quot;Lesser&quot; General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a &quot;work based on the library&quot; and a &quot;work that uses the library&quot;. The former contains code derived from the library, whereas the latter must be combined with the library in order to run.</span></p> +<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="SEC3"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">T</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">ERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">0.</span><span style=" font-family:'sans-serif'; color:#000000;"> This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called &quot;this License&quot;). Each licensee is addressed as &quot;you&quot;.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">A &quot;library&quot; means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">The &quot;Library&quot;, below, refers to any such software library or work which has been distributed under these terms. A &quot;work based on the Library&quot; means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term &quot;modification&quot;.)</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">&quot;Source code&quot; for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">1.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">2.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:</span></p> +<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> The modified work must itself be a software library.</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">c)</span><span style=" font-size:16px;"> You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">d)</span><span style=" font-size:16px;"> If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.</span></li></ul> +<p style=" margin-top:15px; margin-bottom:15px; margin-left:38px; margin-right:19px; -qt-block-indent:1; text-indent:0px;"><span style=" font-family:'sans-serif'; color:#000000;">(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">3.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">This option is useful when you wish to copy part of the code of the Library into a program that is not a library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">4.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">5.</span><span style=" font-family:'sans-serif'; color:#000000;"> A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a &quot;work that uses the Library&quot;. Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">However, linking a &quot;work that uses the Library&quot; with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a &quot;work that uses the library&quot;. The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">When a &quot;work that uses the Library&quot; uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">6.</span><span style=" font-family:'sans-serif'; color:#000000;"> As an exception to the Sections above, you may also combine or link a &quot;work that uses the Library&quot; with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:</span></p> +<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable &quot;work that uses the Library&quot;, as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">c)</span><span style=" font-size:16px;"> Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">d)</span><span style=" font-size:16px;"> If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">e)</span><span style=" font-size:16px;"> Verify that the user has already received a copy of these materials or that you have already sent this user a copy.</span></li></ul> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">For an executable, the required form of the &quot;work that uses the Library&quot; must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">7.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:</span></p> +<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">a)</span><span style=" font-size:16px;"> Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.</span></li> +<li style=" font-family:'sans-serif'; color:#000000;" style=" margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px; font-weight:600;">b)</span><span style=" font-size:16px;"> Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.</span></li></ul> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">8.</span><span style=" font-family:'sans-serif'; color:#000000;"> You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">9.</span><span style=" font-family:'sans-serif'; color:#000000;"> You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">10.</span><span style=" font-family:'sans-serif'; color:#000000;"> Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">11.</span><span style=" font-family:'sans-serif'; color:#000000;"> If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">12.</span><span style=" font-family:'sans-serif'; color:#000000;"> If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">13.</span><span style=" font-family:'sans-serif'; color:#000000;"> The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and &quot;any later version&quot;, you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">14.</span><span style=" font-family:'sans-serif'; color:#000000;"> If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">NO WARRANTY</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">15.</span><span style=" font-family:'sans-serif'; color:#000000;"> BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY &quot;AS IS&quot; WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#000000;">16.</span><span style=" font-family:'sans-serif'; color:#000000;"> IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</span></p> +<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; font-weight:600; color:#333333; background-color:#ffffff;">END OF TERMS AND CONDITIONS</span></p> +<p style=" margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="SEC4"></a><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">H</span><span style=" font-family:'sans-serif'; font-weight:600; color:#333333;">ow to Apply These Terms to Your New Libraries</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License).</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the &quot;copyright&quot; line and a pointer to where the full notice is found.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; font-style:italic; color:#000000;">one line to give the library's name and an idea of what it does.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">Copyright (C) </span><span style=" font-family:'monospace'; font-style:italic; color:#000000;">year</span><span style=" font-family:'monospace'; color:#000000;"> </span><span style=" font-family:'monospace'; font-style:italic; color:#000000;">name of author</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; font-style:italic; color:#000000; background-color:#ffffff;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">This library is free software; you can redistribute it and/or</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">modify it under the terms of the GNU Lesser General Public</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">License as published by the Free Software Foundation; either</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">version 2.1 of the License, or (at your option) any later version.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">This library is distributed in the hope that it will be useful,</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">but WITHOUT ANY WARRANTY; without even the implied warranty of</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">Lesser General Public License for more details.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">You should have received a copy of the GNU Lesser General Public</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">License along with this library; if not, write to the Free Software</span></p> +<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">Also add information on how to contact you by electronic and paper mail.</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">You should also get your employer (if you work as a programmer) or your school, if any, to sign a &quot;copyright disclaimer&quot; for the library, if necessary. Here is a sample; alter the names:</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">Yoyodyne, Inc., hereby disclaims all copyright interest in</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">the library `Frob' (a library for tweaking knobs) written</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000; background-color:#ffffff;">by James Random Hacker.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; font-style:italic; color:#000000;">signature of Ty Coon</span><span style=" font-family:'monospace'; color:#000000;">, 1 April 1990</span></p> +<p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">Ty Coon, President of Vice</span></p> +<p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">That's all there is to it!</span></p></body></html> + + + + + LimeReport::AlignmentPropItem + + Left + محاذاة يسار + + + Right + محاذاة يمين + + + Center + محاذاة وسط + + + Justify + ملأ السطر + + + Top + محاذاة لأعلى + + + Botom + محاذاة لأسفل + + + horizontal + أفقي + + + vertical + عمودي + + + + LimeReport::BandDesignIntf + + connected to + إتصال ب + + + + LimeReport::ConnectionDialog + + Connection + إتصال بقاعدة بيانات + + + Connection Name + أسم الإتصال + + + Driver + المشغل + + + Server + الخادم + + + User + المستخدم + + + Password + كلمة المرور + + + Database + قاعدة البيانات + + + Auto connect + إتصال تلقائي + + + Check connection + فحص الإتصال + + + Cancel + إلغاء الأمر + + + Error + خطأ + + + Connection succsesfully established! + تم الإتصال بنجاح! + + + Connection Name is empty + أسم الإتصال فارغ + + + Connection with name + إتصال بأسم + + + already exists + موجود مسبقاً + + + ... + + + + Ok + موافق + + + + LimeReport::ContentItemDesignIntf + + Variable %1 not found + المتغير %1 غير موجود + + + + LimeReport::DataBand + + Data + بيانات + + + + LimeReport::DataBrowser + + Datasources + مصدر البيانات + + + Add database connection + إضافة إتصال قاعدة بيانات + + + Add new datasource + إضافة مصدر بيانات جديد + + + View data + عرض البيانات + + + Change datasource + تغيير مصدر البيانات + + + Delete datasource + حذف مصدر البيانات + + + Show error + عرض الأخطاء + + + Variables + المتغيرات + + + Add new variable + إضافة متغير جديد + + + Edit variable + تعديل متغير + + + Delete variable + حذف متغير + + + Attention + Attention + + + Do you really want to delete "%1" connection ? + Do you really want delete "%1" connection ? + هل ترغب في حذف الإتصال "%1" ? + + + User variables + متغيرات المستخدم + + + System variables + متغيرات النظام + + + Do you really want to delete "%1" datasource ? + Do you really want delete "%1" datasource ? + هل ترغب في حذف مصدر البيانات "%1" ? + + + Do you really want delete variable "%1" ? + هل ترغب في حذف المتغير "%1" ? + + + Error + خطأ + + + ... + + + + Do you really want to delete variable "%1" ? + هل ترغب في حذف المتغير "%1" ? + + + Grab variable + + + + Report variables + + + + External variables + + + + + LimeReport::DataFooterBand + + DataFooter + ذيل جدول البيانات + + + + LimeReport::DataHeaderBand + + DataHeader + رأس جدول البيانات + + + + LimeReport::DataSourceManager + + Connection "%1" is not open + الإتصال "%1" غير مفتوح + + + Datasource "%1" not found ! + الإتصال "%1" غير موجود ! + + + connection with name "%1" already exists ! + الإتصال بأسم "%1" موجود مسبقاً ! + + + datasource with name "%1" already exists ! + data source with name "%1" already exists !! + مصدر البيانات بأسم "%1" موجود مسبقاً ! + + + invalid connection + خطأ بالإتصال + + + Variable "%1" not found! + + + + Database "%1" not found + + + + + LimeReport::DataSourceModel + + Datasources + مصدر البيانات + + + Variables + المتغيرات + + + External variables + + + + + LimeReport::FontEditorWidget + + Font bold + خط ثخين + + + Font Italic + خط مائل + + + Font Underline + تحته خط + + + + LimeReport::FontPropItem + + bold + ثخين + + + italic + مائل + + + underline + تحته خط + + + size + حجم + + + family + الفئة + + + + LimeReport::GroupBandFooter + + GroupFooter + ذيل المجموعة + + + + LimeReport::GroupBandHeader + + GroupHeader + رأس المجموعة + + + Group field not found + + + + Datasource "%1" not found !!! + + + + + LimeReport::GroupFunction + + Field "%1" not found + الحقل "%1" غير موجود + + + Variable "%1" not found + المتغير "%1" غير موجود + + + Item "%1" not found + العنصر "%1" غير موجود + + + + LimeReport::ImageItem + + Image + صورة + + + + LimeReport::ItemsAlignmentEditorWidget + + Bring to top + إحضار للأمام + + + Send to back + إرسال للخلف + + + Align to left + محاذاة يسار + + + Align to right + محاذاة يمين + + + Align to vertical center + محاذاة وسط(عمودي) + + + Align to top + محاذاة لأعلى + + + Align to bottom + محاذاة لأسفل + + + Align to horizontal center + محاذاة وسط (أفقي) + + + Set same height + مساواة الارتفاع + + + Set same width + مساواة العرض + + + + LimeReport::ItemsBordersEditorWidget + + Top line + خط علوي + + + Bottom line + خط سفلي + + + Left line + خط أيسر + + + Right line + خط أيمن + + + No borders + بدون إطار + + + All borders + محاط بإطار + + + + LimeReport::MasterDetailProxyModel + + Field: "%1" not found in "%2" child datasource + الحقل: "%1" غير موجود في مصدر البيانات الفرعي "%2" + + + Field: "%1" not found in "%2" master datasource + الحقل: "%1" غير موجود في مصدر البيانات الرئيسي "%2" + + + + LimeReport::ModelToDataSource + + model is destroyed + + + + + LimeReport::ObjectBrowser + + Objects + الكائن + + + + LimeReport::PageDesignIntf + + Warning + تحذير + + + Multi band deletion not allowed + لا يمكن حذف فقرات متعددة + + + + LimeReport::PageFooter + + Page Footer + ذيل الصفحة + + + + LimeReport::PageHeader + + Page Header + رأس الصفحة + + + + LimeReport::PreviewReportWidget + + Form + نموذج + + + PDF file name + أسم ملف PDF + + + Report file name + أسم التقرير + + + + LimeReport::PreviewReportWindow + + View + عرض + + + Report + تقرير + + + toolBar + شريط الأدوات + + + Print + طباعة + + + Zoom In + تكبير + + + Zoom Out + تصغير + + + Prior Page + الصفحة السابقة + + + Next Page + الصفحة التالية + + + Close Preview + أغلاق + + + Edit Mode + وضع التعديل + + + Save to file + حفظ إلى ملف + + + Show errors + عرض الأخطاء + + + First Page + الصفحة الأولى + + + First page + الصفحة الأولى + + + Last Page + الصفحة الأخيرة + + + Print To PDF + تحويل إلى PDF + + + Page: + صفحة: + + + of %1 + من %1 + + + Report file name + أسم التقرير + + + PDF file name + أسم ملف PDF + + + Preview + معاينة + + + Ctrl+P + + + + Fit page width + تمديد ليتاسب عرض الصفحة + + + Fit page + تمديد ليناسب الصفحة بالكامل + + + One to one + + + + Show Toolbar + عرض شريط الأدوات + + + Show toolbar + عرض شريط الأدوات + + + + LimeReport::ProxyHolder + + Datasource has been invalidated + مصدر البيانات غير صحيح + + + + LimeReport::QObjectPropertyModel + + Property Name + الخاصية + + + Property value + القيمة + + + leftMargin + الهامش الأيسر + + + rightMargin + الهامش الأيمن + + + topMargin + الهامش العلوي + + + الهامش السفلي + Отступ нижний + + + objectName + أسم الكائن + + + borders + الإطار + + + geometry + الأبعاد + + + itemAlign + محاذاة + + + pageOrientation + أتجاة الصفحة + + + pageSize + حجم الصفحة + + + TopLine + خط علوي + + + BottomLine + خط سفلي + + + LeftLine + خط أيسر + + + RightLine + خط أيمن + + + datasource + مصدر البيانات + + + alignment + расположение + + + content + المحتوى + + + itemLocation + قفل + + + Warning + تحذير + + + reprintOnEachPage + + + + borderLineSize + + + + autoHeight + + + + backgroundColor + + + + columnCount + + + + columnsFillDirection + + + + keepBottomSpace + + + + keepFooterTogether + + + + keepSubdetailTogether + + + + printIfEmpty + + + + sliceLastRow + + + + splittable + + + + angle + + + + autoWidth + + + + backgroundMode + + + + backgroundOpacity + + + + font + + + + fontColor + + + + foregroundOpacity + + + + margin + + + + stretchToMaxHeight + + + + trimValue + + + + lineWidth + + + + opacity + + + + penStyle + + + + shape + + + + shapeBrush + + + + shapeBrushColor + + + + + LimeReport::RectMMPropItem + + width + العرض + + + height + الأرتفاع + + + + LimeReport::RectPropItem + + width + العرض + + + height + الأرتفاع + + + + LimeReport::ReportDesignWidget + + Report file name + أسم التقرير + + + + LimeReport::ReportDesignWindow + + New Report + تقرير جديد + + + Edit Mode + وضع التعديل + + + Undo + تراجع + + + Redo + أعادة التراجع + + + Copy + نسخ + + + Paste + لصق + + + Cut + قص + + + Settings + إعدادات + + + Use grid + عرض الشبكة + + + Text Item + نص + + + Save Report + حفظ التقرير + + + Save Report As + حفظ التقرير بأسم + + + Load Report + تحميل التقرير + + + Delete item + حذف + + + Zoom In + تكبير + + + Zoom Out + تصغير + + + Render Report + إنشاء التقرير + + + نمط تعديل النسق + Режим редактирования группировок + + + نسق أفقي + Горизонтальная группировка + + + حول البرنامج + О программе + + + Hide left panel + إخفاء المقطع الأيسر + + + Hide right panel + إخفاء المقطع الأيمن + + + Report Tools + أدوات التقرير + + + Main Tools + الأدوات الرئيسة + + + Font + خط + + + Text alignment + محاذاة النص + + + Items alignment + محاذاة + + + Borders + الإطار + + + Report bands + فقرات التقرير + + + Report Header + رأس التقرير + + + Report Footer + ذيل التقرير + + + Page Header + رأس الصفحة + + + Page Footer + ذيل الصفحة + + + Data + جدول البيانات + + + Data Header + رأس جدول البيانات + + + Data Footer + ذيل جدول البيانات + + + SubDetail + بيانات فرعية + + + SubDetailHeader + رأس البيانات الفرعية + + + SubDetailFooter + ذيل البيانات الفرعية + + + GroupHeader + رأس المجموعة + + + GroupFooter + ذيل المجموعة + + + File + ملف + + + Edit + تحرير + + + Info + معلومات + + + Object Inspector + فاحص الكائن + + + Report structure + بنية التقرير + + + Data Browser + إستعراض البيانات + + + Report has been modified ! Do you want save the report ? + تم تعديل التقرير ! هل تريد حفظ التعديلات ? + + + Report file name + أسم التقرير + + + Rendering report + جاري قراءة التقرير + + + Abort + إجهاض + + + page rendered + تم إنشاء الصفحة + + + Warning + تحذير + + + Use magnet + + + + Recent Files + + + + File "%1" not found! + + + + Tear-off Band + + + + + LimeReport::ReportEnginePrivate + + Error + Ошибка + + + Preview + + + + + LimeReport::ReportFooter + + Report Footer + Завершение отчета + + + + LimeReport::ReportHeader + + Report Header + رأس التقرير + + + + LimeReport::ReportRender + + Error + خطأ + + + Databand "%1" not found + فقرة جدول البيانات "%1" غير موجودة + + + Wrong using function %1 + خطأ في إستخدام الدالة %1 + + + + LimeReport::SQLEditDialog + + Datasource + مصدر البيانات + + + Connection + الإتصال + + + Datasource Name + أسم مصدر البيانات + + + Subdetail + البيانات الفرعية + + + Master datasource + مصدر البيانات الرئيسي + + + Subquery mode + وضع الاستعلام الفرعي + + + Filter mode + وضع التصفية + + + SQL + + + + Hide Preview + إخفاء المعاينة + + + Child datasource + مصدر البيانات الفرعي + + + Fields map + + + + Data preview + معاينة البيانات + + + Cancel + إلغاء الأمر + + + Error + خطأ + + + Datasource Name is empty ! + أسم مصدر البيانات فارغ ! + + + SQL is empty ! + SQL فارغة ! + + + Datasource with name: "%1" already exists ! + مصدر البيانات بأسم: "%1" موجود مسبقاً ! + + + Datasource with name %1 already exist + مصدر البيانات بأسم: "%1" موجود مسبقاً + + + Attention + + + + Connection is not specified + إتصال غير محدد + + + Refresh + تحديث + + + Preview + + + + ... + + + + Ok + + + + + LimeReport::ScriptEngineManager + + FieldName + Имя поля + + + BandName + أسم الفقرة + + + Value + القيمة + + + Format + الصيغة + + + Precision + الموقع + + + Locale + + + + CurrencySymbol + + + + Name + الأسم + + + + LimeReport::SettingDialog + + Designer setting + إعدادات + + + Default font + الخط الإفتراضي + + + Grid + شبكة + + + Vertical grid step + تباعد الشبكة العمودي + + + Horizontal grid step + تباعد الشبكة الأفقي + + + Designer Setting + + + + Report Setting + + + + Suppress absent fields and variables warning + + + + + LimeReport::SubDetailBand + + SubDetail + البيانات الفرعية + + + + LimeReport::SubDetailHeaderBand + + SubDetailHeader + رأس البيانات الفرعية + + + + LimeReport::TearOffBand + + Tear-off Band + + + + + LimeReport::TextAlignmentEditorWidget + + Text align left + محاذاة النص لليسار + + + Text align center + محاذاة النص للوسط + + + Text align right + محاذاة النص لليمين + + + Text align justify + ملأ السطر + + + Text align top + محاذاة النص لأعلى + + + Text align bottom + محاذاة السطر لأسفل + + + + LimeReport::TextItemEditor + + Text Item Editor + تحرير النص + + + Content + المحتوى + + + Functions + الدوال + + + Editor settings + إعدادات المحرر + + + Editor font + خطوط المحرر + + + Cancel + إلغاء الأمر + + + Data + + + + ... + + + + Ok + + + + Ctrl+Return + + + + Esc + + + + + LimeReport::VariablesHolder + + variable with name + متغير بأسم + + + already exists !! + موجود مسبقاً !! + + + does not exists !! + غير موجود !! + + + + PreviewReportWindow + + Preview + معاينة + + + View + عرض + + + Report + تقرير + + + toolBar + شريط الأدوات + + + Print + طباعة + + + Zoom In + تكبير + + + Zoom Out + تصغير + + + Prior Page + الصفحة السابقة + + + Next Page + الصفحة التالية + + + Close Preview + أغلاق + + + Edit Mode + وضع التعديل + + + Save to file + حفظ إلى ملف + + + Show errors + عرض الأخطاء + + + First Page + الصفحة الأولى + + + First page + الصفحة الأولى + + + Last Page + الصفحة الأخيرة + + + Print To PDF + تحويل إلى PDF + + + Page: + صفحة: + + + of %1 + من %1 + + + Report file name + أسم التقرير + + + PDF file name + أسم ملف PDF + + + + QObject + + Data + جدول البرنامج + + + DataHeader + رأس جدول البيانات + + + DataFooter + ذيل جدول البيانات + + + GroupHeader + رأس المجموعة + + + GroupFooter + ذيل المجموعة + + + Page Footer + ذيل الصفحة + + + Page Header + رأس الصفحة + + + Report Footer + ذيل التقرير + + + Report Header + رأس التقرير + + + SubDetail + البيانات الفرعية + + + SubDetailHeader + رأس البيانات الفرعية + + + SubDetailFooter + ذيل البيانات الفرعية + + + alignment + محاذاة + + + Barcode Item + باركود + + + HLayout + نسق أفقي + + + Image Item + صورة + + + Shape Item + رسم + + + itemLocation + الموقع + + + Text Item + نص + + + Invalid connection! %1 + خطأ بإتصال %1 + + + Master datasource "%1" not found! + مصدر البيانات الرئيسي "%1" غير موجود! + + + Child + بيانات فرعية + + + and child + و بيانات فرعية + + + datasouce "%1" not found! + مصدر البيانات الرئيسي "%1" غير موجود ! + + + Attention! + + + + Selected elements have different parent containers + العناصر المحددة مختلفة البنية + + + Object with name %1 already exists + أسم الكائن %1 уже موجود مسبقاً + + + Function %1 not found or have wrong arguments + الدالة %1 غير موجودة او الباريميترات خاطئة + + + datasource + مصدر البيانات + + + field + الحقل + + + enum + + + + flags + + + + geometry + الأبعاد + + + mm + + + + File %1 not opened + الحقل %1 غير مفتوح + + + TopLine + خط علوي + + + BottomLine + خط سفلي + + + LeftLine + خط أيسر + + + RightLine + خط أيمن + + + content + المحتوى + + + Master datasource "%1" not found!!! + + + + Master datasouce "%1" not found! + + + + bool + + + + QColor + + + + QFont + + + + QImage + + + + int + + + + qreal + + + + QRect + + + + QRectF + + + + QString + + + + Content string is empty + + + + Content is empty + + + + Tear-off Band + + + + + SQLEditDialog + + Datasource + مصدر البيانات + + + Connection + الإتصال + + + Datasource Name + أسم مصدر البيانات + + + Subdetail + البيانات الفرعية + + + Master datasource + مصدر البيانات الرئيسي + + + Subquery mode + وضع الاستعلام الفرعي + + + Filter mode + وضع التصفية + + + Preview + معاينة + + + Hide Preview + إخفاء المعاينة + + + Child datasource + مصدر البيانات الفرعي + + + Data preview + معاينة البيانات + + + Cancel + إلغاء الأمر + + + Error + خطأ + + + Datasource Name is empty ! + أسم مصدر البيانات فارغ ! + + + SQL is empty ! + SQL فارغة ! + + + Datasource with name: "%1" already exists ! + مصدر البيانات بأسم: "%1" موجود مسبقاً ! + + + Datasource with name %1 already exist + مصدر البيانات بأسم: "%1" موجود مسبقاً + + + Connection is not specified + إتصال غير محدد + + + Refresh + تحديث + + + + SettingDialog + + Designer setting + إعدادات + + + Default font + الخط الإفتراضي + + + Grid + شبكة + + + Vertical grid step + تباعد الشبكة العمودي + + + Horizontal grid step + تباعد الشبكة الأفقي + + + + TextItemEditor + + Text Item Editor + محرر النص + + + Content + المحتوى + + + Data + جدول البيانات + + + Functions + الدوال + + + Editor settings + إعدادات المحرر + + + Editor font + محرر الخطوط + + + Cancel + إلغاء الأمر + + + + WaitForm + + Wait + انتظر + + + Please wait ... + يرجى الإنتظار ... + + + From 21b3f0e912bd5ad5e5edd6127f1d93713cad8baf Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 3 Feb 2017 14:18:28 +0300 Subject: [PATCH 38/51] fix #58 PDF file extension --- limereport/lrpreviewreportwidget.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/limereport/lrpreviewreportwidget.cpp b/limereport/lrpreviewreportwidget.cpp index d614193..986e95d 100644 --- a/limereport/lrpreviewreportwidget.cpp +++ b/limereport/lrpreviewreportwidget.cpp @@ -174,8 +174,12 @@ void PreviewReportWidget::print() void PreviewReportWidget::printToPDF() { - QString fileName = QFileDialog::getSaveFileName(this,tr("PDF file name"),"","PDF(*.pdf)" ); + QString filter = "PDF (*.pdf)"; + QString fileName = QFileDialog::getSaveFileName(this,tr("PDF file name"),"","PDF (*.pdf)"); if (!fileName.isEmpty()){ + QFileInfo fi(fileName); + if (fi.suffix().isEmpty()) + fileName+=".pdf"; QPrinter printer; printer.setOutputFileName(fileName); printer.setOutputFormat(QPrinter::PdfFormat); From 7af7a16840872f44c3309c56391aac7dbc08c472 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 3 Feb 2017 14:20:30 +0300 Subject: [PATCH 39/51] fix #59 setResultEditable(bool value) has been added --- include/lrreportengine.h | 2 ++ limereport/items/lrtextitem.cpp | 2 +- limereport/lrpreviewreportwindow.cpp | 5 +++++ limereport/lrpreviewreportwindow.h | 1 + limereport/lrreportengine.cpp | 27 ++++++++++++++++++++++++++- limereport/lrreportengine.h | 2 ++ limereport/lrreportengine_p.h | 4 ++++ 7 files changed, 41 insertions(+), 2 deletions(-) diff --git a/include/lrreportengine.h b/include/lrreportengine.h index 8164036..0d5b309 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -98,6 +98,8 @@ public: PreviewReportWidget *createPreviewWidget(QWidget *parent = 0); void setPreviewWindowTitle(const QString& title); void setPreviewWindowIcon(const QIcon& icon); + void setResultEditable(bool value); + bool resultIsEditable(); bool isBusy(); signals: void renderStarted(); diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index d8d77cd..cddcfee 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -645,7 +645,7 @@ bool TextItem::isNeedUpdateSize(RenderPass pass) const { Q_UNUSED(pass) - if (autoHeight() && autoWidth() || hasFollower()){ + if ((autoHeight() && autoWidth()) || hasFollower()){ initTextSizes(); } diff --git a/limereport/lrpreviewreportwindow.cpp b/limereport/lrpreviewreportwindow.cpp index 2d05ad5..b000547 100644 --- a/limereport/lrpreviewreportwindow.cpp +++ b/limereport/lrpreviewreportwindow.cpp @@ -166,6 +166,11 @@ void PreviewReportWindow::setMenuVisible(bool value) ui->menubar->setVisible(value); } +void PreviewReportWindow::setHideResultEditButton(bool value) +{ + ui->actionEdit_Mode->setVisible(value); +} + QSettings*PreviewReportWindow::settings() { if (m_settings){ diff --git a/limereport/lrpreviewreportwindow.h b/limereport/lrpreviewreportwindow.h index 26cf181..bc942be 100644 --- a/limereport/lrpreviewreportwindow.h +++ b/limereport/lrpreviewreportwindow.h @@ -65,6 +65,7 @@ public: void setToolBarVisible(bool value); void setStatusBarVisible(bool value); void setMenuVisible(bool value); + void setHideResultEditButton(bool value); QSettings* settings(); protected: void writeSetting(); diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index edb7ac4..2ea54d9 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -58,7 +58,8 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) : QObject(parent), m_fileName(""), m_settings(0), m_ownedSettings(false), m_printer(new QPrinter(QPrinter::HighResolution)), m_printerSelected(false), m_showProgressDialog(true), m_reportName(""), m_activePreview(0), - m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")), m_reportRendering(false) + m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")), + m_reportRendering(false), m_resultIsEditable(true) { m_datasources = new DataSourceManager(this); m_datasources->setReportSettings(&m_reportSettings); @@ -383,6 +384,8 @@ void ReportEnginePrivate::previewReport(PreviewHints hints) w->setToolBarVisible(!hints.testFlag(HidePreviewToolBar)); } + w->setHideResultEditButton(resultIsEditable()); + m_activePreview = w; connect(w,SIGNAL(destroyed(QObject*)), this, SLOT(slotPreviewWindowDestroed(QObject*))); qDebug()<<"render time ="<setPreviewWindowIcon(icon); } +void ReportEngine::setResultEditable(bool value) +{ + Q_D(ReportEngine); + d->setResultEditable(value); +} + +bool ReportEngine::resultIsEditable() +{ + Q_D(ReportEngine); + return d->resultIsEditable(); +} + bool ReportEngine::isBusy() { Q_D(ReportEngine); diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index 8164036..0d5b309 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -98,6 +98,8 @@ public: PreviewReportWidget *createPreviewWidget(QWidget *parent = 0); void setPreviewWindowTitle(const QString& title); void setPreviewWindowIcon(const QIcon& icon); + void setResultEditable(bool value); + bool resultIsEditable(); bool isBusy(); signals: void renderStarted(); diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index 2a6e230..85aff24 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -122,6 +122,9 @@ public: bool suppressFieldAndVarError() const; void setSuppressFieldAndVarError(bool suppressFieldAndVarError); bool isBusy(); + bool resultIsEditable() const; + void setResultEditable(bool value); + signals: void pagesLoadFinished(); void datasourceCollectionLoadFinished(const QString& collectionName); @@ -171,6 +174,7 @@ private: QPointer m_designerWindow; ReportSettings m_reportSettings; bool m_reportRendering; + bool m_resultIsEditable; }; } From f7a3ff622bee832f4a05a6889541d67b4e5f1bc3 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 4 Feb 2017 22:15:44 +0300 Subject: [PATCH 40/51] beforeRender, afterRender signals have been added to ReportPage --- limereport/lrreportrender.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index a66b95d..11c3ae0 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -209,9 +209,10 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) { m_curentNameIndex = 0; m_patternPageItem = patternPage->pageItem(); + + if (m_patternPageItem->resetPageNumber() && m_pageCount>0) { resetPageNumber(PageReset); - } m_renderCanceled = false; BandDesignIntf* reportFooter = m_patternPageItem->bandByType(BandDesignIntf::ReportFooter); @@ -224,7 +225,7 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) #endif if (m_scriptEngineContext){ - + baseDesignIntfToScript(patternPage->pageItem()); foreach (BaseDesignIntf* item, patternPage->pageItem()->childBaseItems()){ baseDesignIntfToScript(item); } @@ -246,6 +247,8 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) clearPageMap(); startNewPage(); + + renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader), 0, StartNewPageAsNeeded); BandDesignIntf* lastRenderedBand = 0; @@ -300,6 +303,7 @@ void ReportRender::initRenderPage() m_renderPageItem = new PageItemDesignIntf(m_patternPageItem->pageSize(), m_patternPageItem->pageRect()); m_renderPageItem->initFromItem(m_patternPageItem); m_renderPageItem->setItemMode(PreviewMode); + m_renderPageItem->setPatternName(m_patternPageItem->objectName()); } } @@ -1018,11 +1022,15 @@ void ReportRender::startNewPage() initColumns(); initRenderPage(); + baseDesignIntfToScript(m_renderPageItem); + m_renderPageItem->setObjectName(QLatin1String("ReportPage")+QString::number(m_pageCount)); m_maxHeightByColumn[m_currentColumn]=m_renderPageItem->pageRect().height(); m_currentStartDataPos[m_currentColumn]=m_patternPageItem->topMargin()*Const::mmFACTOR; m_currentIndex=0; + emit m_patternPageItem->beforeRender(); + renderPageHeader(m_patternPageItem); m_pageFooterHeight = calcPageFooterHeight(m_patternPageItem); @@ -1031,6 +1039,7 @@ void ReportRender::startNewPage() m_dataAreaSize = m_maxHeightByColumn[m_currentColumn]; m_renderedDataBandCount = 0; + foreach (BandDesignIntf* band, m_reprintableBands) { renderBand(band, 0); } @@ -1208,6 +1217,7 @@ void ReportRender::savePage(bool isLast) } moveTearOffBand(); + emit m_patternPageItem->afterRender(); } From 8659818a30bb5c3a54fc6d5601201ac1bba0646c Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 11 Feb 2017 00:24:59 +0300 Subject: [PATCH 41/51] Connection will be restored if server is gone away or drop limereport connection --- limereport/lrdatasourcemanager.cpp | 10 +++++++++- limereport/lrdatasourcemanager.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index bab241d..2fb0d40 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -735,6 +735,11 @@ void DataSourceManager::setReportSettings(ReportSettings *reportSettings) m_reportSettings = reportSettings; } +bool DataSourceManager::checkConnection(QSqlDatabase db){ + QSqlQuery query("Select 1",db); + return query.first(); +} + bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) { @@ -759,7 +764,10 @@ bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) db.close(); connected = initAndOpenDB(db, *connectionDesc); } else { - connected = db.isOpen(); + //connected = db.isOpen(); + connected = checkConnection(db); + if (!connected) + connected = initAndOpenDB(db, *connectionDesc); } } diff --git a/limereport/lrdatasourcemanager.h b/limereport/lrdatasourcemanager.h index 7670b2e..a0efaaf 100644 --- a/limereport/lrdatasourcemanager.h +++ b/limereport/lrdatasourcemanager.h @@ -221,7 +221,7 @@ protected: void setSystemVariable(const QString& name, const QVariant& value, RenderPass pass); void setLastError(const QString& value); void invalidateLinkedDatasources(QString datasourceName); - + bool checkConnection(QSqlDatabase db); private slots: void slotConnectionRenamed(const QString& oldName,const QString& newName); void slotQueryTextChanged(const QString& queryName, const QString& queryText); From 8fb3fb5abadfcde379892aa0befdc2f815498d3f Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 15 Feb 2017 00:10:02 +0300 Subject: [PATCH 42/51] LimeReport will not delete external connections --- limereport/lrdatadesignintf.cpp | 6 +++-- limereport/lrdatadesignintf.h | 3 +++ limereport/lrdatasourcemanager.cpp | 36 ++++++++++++++++++------------ limereport/lrdatasourcemanager.h | 2 +- 4 files changed, 30 insertions(+), 17 deletions(-) diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index f20f891..daea32e 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -350,12 +350,14 @@ void ModelToDataSource::slotModelDestroed() ConnectionDesc::ConnectionDesc(QSqlDatabase db, QObject *parent) : QObject(parent), m_connectionName(db.connectionName()), m_connectionHost(db.hostName()), m_connectionDriver(db.driverName()), - m_databaseName(db.databaseName()), m_user(db.userName()), m_password(db.password()), m_autoconnect(false) + m_databaseName(db.databaseName()), m_user(db.userName()), m_password(db.password()), m_autoconnect(false), + m_internal(false) {} ConnectionDesc::ConnectionDesc(QObject *parent) :QObject(parent),m_connectionName(""),m_connectionHost(""),m_connectionDriver(""), - m_databaseName(""), m_user(""), m_password(""), m_autoconnect(false) + m_databaseName(""), m_user(""), m_password(""), m_autoconnect(false), + m_internal(false) {} ConnectionDesc::Ptr ConnectionDesc::create(QSqlDatabase db, QObject *parent) diff --git a/limereport/lrdatadesignintf.h b/limereport/lrdatadesignintf.h index abe26bb..7323f80 100644 --- a/limereport/lrdatadesignintf.h +++ b/limereport/lrdatadesignintf.h @@ -130,6 +130,8 @@ public: void setAutoconnect(bool value){m_autoconnect=value;} bool autoconnect(){return m_autoconnect;} bool isEqual(const QSqlDatabase& db); + bool isInternal(){ return m_internal; } + void setInternal(bool value) {m_internal = value;} signals: void nameChanged(const QString& oldName,const QString& newName); private: @@ -140,6 +142,7 @@ private: QString m_user; QString m_password; bool m_autoconnect; + bool m_internal; }; class IConnectionController{ diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index 2fb0d40..ea7e6e0 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -620,13 +620,15 @@ void DataSourceManager::removeDatasource(const QString &name) emit datasourcesChanged(); } -void DataSourceManager::removeConnection(const QString &name) +void DataSourceManager::removeConnection(const QString &connectionName) { for(int i=0;iname()==name){ - QSqlDatabase db = QSqlDatabase::database(name); - db.close(); - QSqlDatabase::removeDatabase(name); + if (m_connections.at(i)->name()==connectionName){ + if (m_connections.at(i)->isInternal()){ + QSqlDatabase db = QSqlDatabase::database(connectionName); + db.close(); + QSqlDatabase::removeDatabase(connectionName); + } delete m_connections.at(i); m_connections.removeAt(i); } @@ -654,10 +656,12 @@ void DataSourceManager::addConnectionDesc(ConnectionDesc * connection) bool DataSourceManager::checkConnectionDesc(ConnectionDesc *connection) { if (connectConnection(connection)){ - QSqlDatabase::removeDatabase(connection->name()); + if (connection->isInternal()) + QSqlDatabase::removeDatabase(connection->name()); return true; } - QSqlDatabase::removeDatabase(connection->name()); + if (connection->isInternal()) + QSqlDatabase::removeDatabase(connection->name()); return false; } @@ -721,6 +725,7 @@ bool DataSourceManager::initAndOpenDB(QSqlDatabase& db, ConnectionDesc& connecti } connected=db.open(); + connectionDesc.setInternal(true); if (!connected) setLastError(db.lastError().text()); return connected; } @@ -760,19 +765,19 @@ bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) } } else { QSqlDatabase db = QSqlDatabase::database(connectionDesc->name()); - if (!connectionDesc->isEqual(db)){ + if (!connectionDesc->isEqual(db) && connectionDesc->isInternal()){ db.close(); connected = initAndOpenDB(db, *connectionDesc); } else { - //connected = db.isOpen(); connected = checkConnection(db); - if (!connected) + if (!connected && connectionDesc->isInternal()) connected = initAndOpenDB(db, *connectionDesc); } } if (!connected) { - QSqlDatabase::removeDatabase(connectionDesc->name()); + if (connectionDesc->isInternal()) + QSqlDatabase::removeDatabase(connectionDesc->name()); return false; } else { foreach(QString datasourceName, dataSourceNames()){ @@ -884,11 +889,13 @@ void DataSourceManager::disconnectConnection(const QString& connectionName) } } } - { + + ConnectionDesc* connectionDesc = connectionByName(connectionName); + if (connectionDesc->isInternal()){ QSqlDatabase db = QSqlDatabase::database(connectionName); if (db.isOpen()) db.close(); + if (QSqlDatabase::contains(connectionName)) QSqlDatabase::removeDatabase(connectionName); } - if (QSqlDatabase::contains(connectionName)) QSqlDatabase::removeDatabase(connectionName); } @@ -1185,7 +1192,8 @@ void DataSourceManager::clear(ClearMethod method) QList::iterator cit = m_connections.begin(); while( cit != m_connections.end() ){ - QSqlDatabase::removeDatabase( (*cit)->name() ); + if ( (*cit)->isInternal() ) + QSqlDatabase::removeDatabase( (*cit)->name() ); delete (*cit); cit = m_connections.erase(cit); } diff --git a/limereport/lrdatasourcemanager.h b/limereport/lrdatasourcemanager.h index a0efaaf..c60bfa5 100644 --- a/limereport/lrdatasourcemanager.h +++ b/limereport/lrdatasourcemanager.h @@ -131,7 +131,7 @@ public: QString queryText(const QString& dataSourceName); QString connectionName(const QString& dataSourceName); void removeDatasource(const QString& name); - void removeConnection(const QString& name); + void removeConnection(const QString& connectionName); bool isQuery(const QString& dataSourceName); bool containsDatasource(const QString& dataSourceName); bool isSubQuery(const QString& dataSourceName); From fa985d7fb732536e357c9d8f05f264f42063b963 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 15 Feb 2017 02:52:11 +0300 Subject: [PATCH 43/51] defaultConnection support has been added to LimeReport designer --- limereport/databrowser/lrconnectiondialog.cpp | 35 +++++++++----- limereport/databrowser/lrconnectiondialog.h | 9 ++-- limereport/databrowser/lrconnectiondialog.ui | 7 +++ limereport/databrowser/lrdatabrowser.cpp | 46 +++++++++++++------ limereport/databrowser/lrdatabrowser.h | 4 +- limereport/databrowser/lrsqleditdialog.cpp | 20 +++++--- limereport/lrdatadesignintf.cpp | 12 ++++- limereport/lrdatadesignintf.h | 4 ++ limereport/lrdatasourcemanager.cpp | 13 +++--- 9 files changed, 108 insertions(+), 42 deletions(-) diff --git a/limereport/databrowser/lrconnectiondialog.cpp b/limereport/databrowser/lrconnectiondialog.cpp index 52ce1b8..60652cf 100644 --- a/limereport/databrowser/lrconnectiondialog.cpp +++ b/limereport/databrowser/lrconnectiondialog.cpp @@ -41,7 +41,7 @@ namespace LimeReport{ ConnectionDialog::ConnectionDialog(LimeReport::IConnectionController *conControl, LimeReport::ConnectionDesc* connectionDesc, QWidget *parent) : QDialog(parent), - ui(new Ui::ConnectionDialog),m_connection(connectionDesc),m_controller(conControl) + ui(new Ui::ConnectionDialog), m_connection(connectionDesc), m_controller(conControl), m_savedConnectionName("") { ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose,true); @@ -56,6 +56,7 @@ ConnectionDialog::~ConnectionDialog() void ConnectionDialog::init() { ui->cbbDrivers->addItems(QSqlDatabase::drivers()); + ui->cbbUseDefaultConnection->setEnabled(!m_controller->containsDefaultConnection()); } void ConnectionDialog::showEvent(QShowEvent *) @@ -101,27 +102,20 @@ void ConnectionDialog::checkFieldsFill() bool ConnectionDialog::checkConnection() { QScopedPointer con(uiToConnection()); -// LimeReport::ConnectionDesc con; -// con.setName(ui->leConnectionName->text()+"_check"); -// con.setHost(ui->leServerName->text()); -// con.setUserName(ui->leUserName->text()); -// con.setPassword(ui->lePassword->text()); -// con.setDatabaseName(ui->leDataBase->text()); -// con.setDriver(ui->cbbDrivers->currentText()); if (!m_controller->checkConnectionDesc(con.data())){ throw LimeReport::ReportError(m_controller->lastError()); } return true; } -LimeReport::ConnectionDesc *ConnectionDialog::uiToConnection(LimeReport::ConnectionDesc* conDesc) +ConnectionDesc *ConnectionDialog::uiToConnection(LimeReport::ConnectionDesc* conDesc) { LimeReport::ConnectionDesc* result; if (conDesc) result = conDesc; else result = new LimeReport::ConnectionDesc(); - result ->setName(ui->leConnectionName->text()); + result ->setName(ConnectionDesc::connectionNameForReport(ui->leConnectionName->text())); result ->setHost(ui->leServerName->text()); result ->setDriver(ui->cbbDrivers->currentText()); result ->setUserName(ui->leUserName->text()); @@ -135,7 +129,8 @@ void ConnectionDialog::connectionToUI() { init(); if (!m_connection) return; - ui->leConnectionName->setText(m_connection->name()); + ui->leConnectionName->setText(ConnectionDesc::connectionNameForUser(m_connection->name())); + ui->cbbUseDefaultConnection->setChecked(m_connection->name().compare(QSqlDatabase::defaultConnection) == 0); ui->leDataBase->setText(m_connection->databaseName()); ui->leServerName->setText(m_connection->host()); ui->leUserName->setText(m_connection->userName()); @@ -144,10 +139,26 @@ void ConnectionDialog::connectionToUI() ui->cbAutoConnect->setChecked(m_connection->autoconnect()); } - void ConnectionDialog::on_toolButton_clicked() { ui->leDataBase->setText(QFileDialog::getOpenFileName()); } +void ConnectionDialog::on_cbbUseDefaultConnection_toggled(bool checked) +{ + if (checked){ + m_savedConnectionName = ui->leConnectionName->text(); + ui->leConnectionName->setText(tr("defaultConnection")); + ui->leConnectionName->setEnabled(false); + } else { + ui->leConnectionName->setText(m_savedConnectionName); + ui->leConnectionName->setEnabled(true); + } +} + } // namespace LimeReport + + + + + diff --git a/limereport/databrowser/lrconnectiondialog.h b/limereport/databrowser/lrconnectiondialog.h index acc86a5..531666a 100644 --- a/limereport/databrowser/lrconnectiondialog.h +++ b/limereport/databrowser/lrconnectiondialog.h @@ -50,7 +50,7 @@ protected: void init(); void checkFieldsFill(); bool checkConnection(); - LimeReport::ConnectionDesc* uiToConnection(LimeReport::ConnectionDesc *conDesc = 0); + ConnectionDesc* uiToConnection(LimeReport::ConnectionDesc *conDesc = 0); void connectionToUI(); signals: void conectionRegistred(LimeReport::ConnectionDesc* connectionDesc); @@ -58,11 +58,14 @@ private slots: void slotAccept(); void slotCheckConnection(); void on_toolButton_clicked(); + void on_cbbUseDefaultConnection_toggled(bool checked); + private: Ui::ConnectionDialog *ui; - LimeReport::ConnectionDesc* m_connection; + ConnectionDesc* m_connection; bool m_changeMode; - LimeReport::IConnectionController* m_controller; + IConnectionController* m_controller; + QString m_savedConnectionName; }; } // namespace LimeReport diff --git a/limereport/databrowser/lrconnectiondialog.ui b/limereport/databrowser/lrconnectiondialog.ui index 49525ec..aa06393 100644 --- a/limereport/databrowser/lrconnectiondialog.ui +++ b/limereport/databrowser/lrconnectiondialog.ui @@ -36,6 +36,13 @@ + + + + Use default application connection + + + diff --git a/limereport/databrowser/lrdatabrowser.cpp b/limereport/databrowser/lrdatabrowser.cpp index 37f6eaf..ba89566 100644 --- a/limereport/databrowser/lrdatabrowser.cpp +++ b/limereport/databrowser/lrdatabrowser.cpp @@ -126,17 +126,17 @@ void DataBrowser::slotSQLEditingFinished(SQLEditResult result) void DataBrowser::slotDeleteConnection() { - if (!getConnectionName().isEmpty()){ + if (!getConnectionName(NameForUser).isEmpty()){ if ( QMessageBox::critical( this, tr("Attention"), - tr("Do you really want to delete \"%1\" connection ?").arg(getConnectionName()), + tr("Do you really want to delete \"%1\" connection ?").arg(getConnectionName(NameForUser)), QMessageBox::Ok|QMessageBox::No, QMessageBox::No - )==QMessageBox::Ok + ) == QMessageBox::Ok ){ - m_report->dataManager()->removeConnection(getConnectionName()); + m_report->dataManager()->removeConnection(getConnectionName(NameForReport)); updateDataTree(); } } @@ -153,7 +153,7 @@ void DataBrowser::slotAddDataSource() #endif sqlEdit->setSettings(settings()); sqlEdit->setDataSources(m_report->dataManager()); - sqlEdit->setDefaultConnection(getConnectionName()); + sqlEdit->setDefaultConnection(getConnectionName(NameForReport)); connect(sqlEdit,SIGNAL(signalSqlEditingFinished(SQLEditResult)),this,SLOT(slotSQLEditingFinished(SQLEditResult))); sqlEdit->exec(); } @@ -173,7 +173,10 @@ void DataBrowser::updateDataTree() foreach(QString dataSourceName, m_report->datasourcesNames()){ QTreeWidgetItem *item=new QTreeWidgetItem(QStringList(dataSourceName),DataBrowserTree::Table); - QTreeWidgetItem *parentItem = findByNameAndType(m_report->dataManager()->connectionName(dataSourceName),DataBrowserTree::Connection); + QTreeWidgetItem *parentItem = findByNameAndType( + ConnectionDesc::connectionNameForUser(m_report->dataManager()->connectionName(dataSourceName)), + DataBrowserTree::Connection + ); if (parentItem){ parentItem->addChild(item); if (!parentItem->isExpanded()) ui->dataTree->expandItem(parentItem); @@ -336,11 +339,18 @@ QTreeWidgetItem* findConnectionItem(QTreeWidgetItem* item){ } } -QString DataBrowser::getConnectionName() +QString DataBrowser::getConnectionName(NameType nameType) { if (ui->dataTree->currentItem()){ QTreeWidgetItem * ci = findConnectionItem(ui->dataTree->currentItem()); - if (ci) return ci->text(0); + if (ci) { + switch (nameType) { + case NameForUser: + return ConnectionDesc::connectionNameForUser(ci->text(0)); + case NameForReport: + return ConnectionDesc::connectionNameForReport(ci->text(0)); + } + } else return QString(); }; return QString(); @@ -417,7 +427,11 @@ void DataBrowser::initConnections() ui->dataTree->clear(); QListitems; foreach(QString connectionName,m_report->dataManager()->connectionNames()){ - QTreeWidgetItem *item=new QTreeWidgetItem(ui->dataTree,QStringList(connectionName), DataBrowserTree::Connection); + QTreeWidgetItem *item=new QTreeWidgetItem( + ui->dataTree, + QStringList(ConnectionDesc::connectionNameForUser(connectionName)), + DataBrowserTree::Connection + ); if (m_report->dataManager()->isConnectionConnected(connectionName)) item->setIcon(0,QIcon(":/databrowser/images/database_connected")); else @@ -482,10 +496,10 @@ void DataBrowser::slotDataWindowClosed() void DataBrowser::slotChangeConnection() { - if (!getConnectionName().isEmpty()){ + if (!getConnectionName(NameForUser).isEmpty()){ ConnectionDialog *connectionEdit = new ConnectionDialog( this, - m_report->dataManager()->connectionByName(getConnectionName()), + m_report->dataManager()->connectionByName(getConnectionName(NameForReport)), this ); connectionEdit->setAttribute(Qt::WA_DeleteOnClose,true); @@ -501,7 +515,7 @@ void DataBrowser::slotChangeConnection() void DataBrowser::slotChangeConnectionState() { - QString connectionName = getConnectionName(); + QString connectionName = getConnectionName(NameForReport); if (!connectionName.isEmpty()){ if (!m_report->dataManager()->isConnectionConnected(connectionName)){ setCursor(Qt::WaitCursor); @@ -626,6 +640,12 @@ bool DataBrowser::checkConnectionDesc(ConnectionDesc *connection) return result; } +bool DataBrowser::containsDefaultConnection() +{ + bool result = m_report->dataManager()->connectionByName(QSqlDatabase::defaultConnection); + return result; +} + QString DataBrowser::lastError() const { return m_lastError; @@ -778,4 +798,4 @@ void DataBrowser::on_variablesTree_itemDoubleClicked(QTreeWidgetItem *item, int } } -} // namespace LimeReport \ No newline at end of file +} // namespace LimeReport diff --git a/limereport/databrowser/lrdatabrowser.h b/limereport/databrowser/lrdatabrowser.h index b068742..7d0a91e 100644 --- a/limereport/databrowser/lrdatabrowser.h +++ b/limereport/databrowser/lrdatabrowser.h @@ -87,8 +87,9 @@ private slots: void on_variablesTree_itemDoubleClicked(QTreeWidgetItem *item, int); private: + enum NameType{NameForUser, NameForReport}; QString getDatasourceName(); - QString getConnectionName(); + QString getConnectionName(NameType nameType); QString getVariable(); bool isClosingWindows() const {return m_closingWindows;} QTreeWidgetItem * findByNameAndType(QString name, int itemType); @@ -108,6 +109,7 @@ private: void addConnectionDesc(ConnectionDesc *connection); void changeConnectionDesc(ConnectionDesc *connection); bool checkConnectionDesc(ConnectionDesc *connection); + bool containsDefaultConnection(); private: Ui::DataBrowser* ui; diff --git a/limereport/databrowser/lrsqleditdialog.cpp b/limereport/databrowser/lrsqleditdialog.cpp index ef292a8..31dd6f1 100644 --- a/limereport/databrowser/lrsqleditdialog.cpp +++ b/limereport/databrowser/lrsqleditdialog.cpp @@ -101,7 +101,7 @@ void SQLEditDialog::accept() else result.resultMode=SQLEditResult::SubProxy; } - result.connectionName=ui->cbbConnection->currentText(); + result.connectionName = ConnectionDesc::connectionNameForReport(ui->cbbConnection->currentText()); result.datasourceName=ui->leDatasourceName->text(); result.sql=ui->textEditSQL->toPlainText(); result.dialogMode=m_dialogMode; @@ -159,15 +159,19 @@ void SQLEditDialog::check() void SQLEditDialog::initConnections() { foreach(QString connectionName, QSqlDatabase::connectionNames()){ - ui->cbbConnection->addItem(QIcon(":/databrowser/images/plug-connect.png"),connectionName); + ui->cbbConnection->addItem(QIcon(":/databrowser/images/plug-connect.png"),ConnectionDesc::connectionNameForUser(connectionName)); } + foreach(QString connectionName, m_datasources->connectionNames()){ + connectionName = (connectionName.compare(QSqlDatabase::defaultConnection)==0) ? + tr("defaultConnection") : connectionName; if (ui->cbbConnection->findText(connectionName,Qt::MatchExactly )==-1) - ui->cbbConnection->addItem(QIcon(":/databrowser/images/plug-disconnect.png"),connectionName); + ui->cbbConnection->addItem(QIcon(":/databrowser/images/plug-disconnect.png"),ConnectionDesc::connectionNameForUser(connectionName)); } + ui->cbbConnection->setCurrentIndex(ui->cbbConnection->findText(m_defaultConnection)); if (!m_oldDatasourceName.isEmpty()){ - ui->cbbConnection->setCurrentIndex(ui->cbbConnection->findText(m_datasources->connectionName(m_oldDatasourceName))); + ui->cbbConnection->setCurrentIndex(ui->cbbConnection->findText(ConnectionDesc::connectionNameForUser(m_datasources->connectionName(m_oldDatasourceName)))); } } @@ -202,7 +206,7 @@ void SQLEditDialog::setDataSources(LimeReport::DataSourceManager *dataSources, Q void SQLEditDialog::setDefaultConnection(QString defaultConnection) { - m_defaultConnection=defaultConnection; + m_defaultConnection = ConnectionDesc::connectionNameForUser(defaultConnection); } void SQLEditDialog::slotDataSourceNameEditing() @@ -298,7 +302,11 @@ void SQLEditDialog::slotPreviewData() QMessageBox::critical(this,tr("Attention"),tr("Connection is not specified")); return; } - m_previewModel = m_datasources->previewSQL(ui->cbbConnection->currentText(),ui->textEditSQL->toPlainText(),ui->leMaster->text()); + m_previewModel = m_datasources->previewSQL( + ConnectionDesc::connectionNameForReport(ui->cbbConnection->currentText()), + ui->textEditSQL->toPlainText(), + ui->leMaster->text() + ); if (m_previewModel){ ui->tvPreview->setModel(m_previewModel.data()); ui->gbDataPreview->setVisible(true); diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index daea32e..ccff471 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -378,7 +378,17 @@ bool ConnectionDesc::isEqual(const QSqlDatabase &db) (db.hostName() == m_connectionHost) && (db.connectionName() == m_connectionName) && (db.userName() == m_user) && - (db.password() == m_password); + (db.password() == m_password); +} + +QString ConnectionDesc::connectionNameForUser(const QString &connectionName) +{ + return connectionName.compare(QSqlDatabase::defaultConnection) == 0 ? tr("defaultConnection") : connectionName; +} + +QString ConnectionDesc::connectionNameForReport(const QString &connectionName) +{ + return connectionName.compare(tr("defaultConnection")) == 0 ? QSqlDatabase::defaultConnection : connectionName; } QueryDesc::QueryDesc(QString queryName, QString queryText, QString connection) diff --git a/limereport/lrdatadesignintf.h b/limereport/lrdatadesignintf.h index 7323f80..d2c9685 100644 --- a/limereport/lrdatadesignintf.h +++ b/limereport/lrdatadesignintf.h @@ -132,6 +132,9 @@ public: bool isEqual(const QSqlDatabase& db); bool isInternal(){ return m_internal; } void setInternal(bool value) {m_internal = value;} +public: + static QString connectionNameForUser(const QString& connectionName); + static QString connectionNameForReport(const QString& connectionName); signals: void nameChanged(const QString& oldName,const QString& newName); private: @@ -150,6 +153,7 @@ public: virtual void addConnectionDesc(ConnectionDesc* connection) = 0; virtual void changeConnectionDesc(ConnectionDesc* connection) = 0; virtual bool checkConnectionDesc(ConnectionDesc* connection) = 0; + virtual bool containsDefaultConnection() = 0; virtual QString lastError() const = 0; }; diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index ea7e6e0..5607117 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -622,16 +622,17 @@ void DataSourceManager::removeDatasource(const QString &name) void DataSourceManager::removeConnection(const QString &connectionName) { - for(int i=0;iname()==connectionName){ - if (m_connections.at(i)->isInternal()){ + QList::iterator cit = m_connections.begin(); + while( cit != m_connections.end() ){ + if ( ((*cit)->name().compare(connectionName) == 0) && (*cit)->isInternal() ){ + { QSqlDatabase db = QSqlDatabase::database(connectionName); db.close(); - QSqlDatabase::removeDatabase(connectionName); } - delete m_connections.at(i); - m_connections.removeAt(i); + QSqlDatabase::removeDatabase(connectionName); } + delete (*cit); + cit = m_connections.erase(cit); } emit datasourcesChanged(); } From ce3a905c5500bdafc15f67d82fe4219b760bb49d Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 16 Feb 2017 04:11:39 +0300 Subject: [PATCH 44/51] Database connections have been refactored keepDbCredentials property has been added to Connection setPassPharse(QString& passPharse) method has been added to ReportEngine IDbCredentialsProvider interface has been added registerDbCredentialsProvider(IDbCredentialsProvider *provider) has been added to IDataSourceManager --- include/lrdatasourcemanagerintf.h | 23 ++++--- include/lrreportengine.h | 1 + limereport/databrowser/lrconnectiondialog.cpp | 2 + limereport/databrowser/lrconnectiondialog.ui | 7 +++ limereport/lrdatadesignintf.cpp | 14 ++++- limereport/lrdatadesignintf.h | 10 ++- limereport/lrdatasourcemanager.cpp | 46 +++++++++++--- limereport/lrdatasourcemanager.h | 5 +- limereport/lrdatasourcemanagerintf.h | 23 ++++--- limereport/lrreportengine.cpp | 61 ++++++++++++++++++- limereport/lrreportengine.h | 1 + limereport/lrreportengine_p.h | 3 + limereport/lrsimplecrypt.cpp | 21 ++++++- limereport/lrsimplecrypt.h | 1 + limereport/serializators/lrserializatorintf.h | 10 ++- limereport/serializators/lrstorageintf.h | 26 ++++---- .../lrxmlbasetypesserializators.cpp | 4 +- .../lrxmlbasetypesserializators.h | 17 +++++- limereport/serializators/lrxmlreader.cpp | 9 +++ limereport/serializators/lrxmlreader.h | 24 +++++--- limereport/serializators/lrxmlwriter.cpp | 9 +++ limereport/serializators/lrxmlwriter.h | 4 ++ 22 files changed, 257 insertions(+), 64 deletions(-) diff --git a/include/lrdatasourcemanagerintf.h b/include/lrdatasourcemanagerintf.h index 85cf388..57bd0c1 100644 --- a/include/lrdatasourcemanagerintf.h +++ b/include/lrdatasourcemanagerintf.h @@ -37,18 +37,25 @@ class QString; class QAbstractItemModel; namespace LimeReport{ +class IDbCredentialsProvider{ +public: + virtual QString getUserName(const QString& connectionName) = 0; + virtual QString getPassword(const QString& connectionName) = 0; +}; + class IDataSourceManager{ public: - virtual void setReportVariable(const QString& name, const QVariant& value)=0; - virtual void setDefaultDatabasePath(const QString &defaultDatabasePath)=0; - virtual void deleteVariable(const QString& name)=0; - virtual bool containsVariable(const QString& variableName)=0; - virtual QVariant variable(const QString& variableName)=0; - virtual bool addModel(const QString& name, QAbstractItemModel *model, bool owned)=0; - virtual void removeModel(const QString& name)=0; - virtual bool containsDatasource(const QString& dataSourceName)=0; + virtual void setReportVariable(const QString& name, const QVariant& value) = 0; + virtual void setDefaultDatabasePath(const QString &defaultDatabasePath) = 0; + virtual void deleteVariable(const QString& name) = 0; + virtual bool containsVariable(const QString& variableName) = 0; + virtual QVariant variable(const QString& variableName) = 0; + virtual bool addModel(const QString& name, QAbstractItemModel *model, bool owned) = 0; + virtual void removeModel(const QString& name) = 0; + virtual bool containsDatasource(const QString& dataSourceName) = 0; virtual void clearUserVariables()=0; virtual ICallbackDatasource* createCallbackDatasouce(const QString& name) = 0; + virtual void registerDbCredentialsProvider(IDbCredentialsProvider* provider) = 0; //virtual void addCallbackDatasource(ICallbackDatasource* datasource, const QString& name) = 0; }; diff --git a/include/lrreportengine.h b/include/lrreportengine.h index 0d5b309..dbbb2a8 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -101,6 +101,7 @@ public: void setResultEditable(bool value); bool resultIsEditable(); bool isBusy(); + void setPassPharse(QString& passPharse); signals: void renderStarted(); void renderFinished(); diff --git a/limereport/databrowser/lrconnectiondialog.cpp b/limereport/databrowser/lrconnectiondialog.cpp index 60652cf..b90545e 100644 --- a/limereport/databrowser/lrconnectiondialog.cpp +++ b/limereport/databrowser/lrconnectiondialog.cpp @@ -122,6 +122,7 @@ ConnectionDesc *ConnectionDialog::uiToConnection(LimeReport::ConnectionDesc* con result ->setPassword(ui->lePassword->text()); result ->setDatabaseName(ui->leDataBase->text()); result ->setAutoconnect(ui->cbAutoConnect->isChecked()); + result->setKeepDBCredentials(!ui->cbbKeepCredentials->isChecked()); return result ; } @@ -137,6 +138,7 @@ void ConnectionDialog::connectionToUI() ui->lePassword->setText(m_connection->password()); ui->cbbDrivers->setCurrentIndex(ui->cbbDrivers->findText(m_connection->driver())); ui->cbAutoConnect->setChecked(m_connection->autoconnect()); + ui->cbbKeepCredentials->setChecked(!m_connection->keepDBCredentials()); } void ConnectionDialog::on_toolButton_clicked() diff --git a/limereport/databrowser/lrconnectiondialog.ui b/limereport/databrowser/lrconnectiondialog.ui index aa06393..60bf527 100644 --- a/limereport/databrowser/lrconnectiondialog.ui +++ b/limereport/databrowser/lrconnectiondialog.ui @@ -137,6 +137,13 @@ + + + + Dont keep credentals in lrxml + + + diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index ccff471..0d2d14b 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -351,13 +351,13 @@ void ModelToDataSource::slotModelDestroed() ConnectionDesc::ConnectionDesc(QSqlDatabase db, QObject *parent) : QObject(parent), m_connectionName(db.connectionName()), m_connectionHost(db.hostName()), m_connectionDriver(db.driverName()), m_databaseName(db.databaseName()), m_user(db.userName()), m_password(db.password()), m_autoconnect(false), - m_internal(false) + m_internal(false), m_keepDBCredentials(true) {} ConnectionDesc::ConnectionDesc(QObject *parent) :QObject(parent),m_connectionName(""),m_connectionHost(""),m_connectionDriver(""), m_databaseName(""), m_user(""), m_password(""), m_autoconnect(false), - m_internal(false) + m_internal(false), m_keepDBCredentials(true) {} ConnectionDesc::Ptr ConnectionDesc::create(QSqlDatabase db, QObject *parent) @@ -391,6 +391,16 @@ QString ConnectionDesc::connectionNameForReport(const QString &connectionName) return connectionName.compare(tr("defaultConnection")) == 0 ? QSqlDatabase::defaultConnection : connectionName; } +bool ConnectionDesc::keepDBCredentials() const +{ + return m_keepDBCredentials; +} + +void ConnectionDesc::setKeepDBCredentials(bool keepDBCredentals) +{ + m_keepDBCredentials = keepDBCredentals; +} + QueryDesc::QueryDesc(QString queryName, QString queryText, QString connection) :m_queryName(queryName), m_queryText(queryText), m_connectionName(connection) {} diff --git a/limereport/lrdatadesignintf.h b/limereport/lrdatadesignintf.h index d2c9685..e2f8134 100644 --- a/limereport/lrdatadesignintf.h +++ b/limereport/lrdatadesignintf.h @@ -110,6 +110,7 @@ class ConnectionDesc : public QObject{ Q_PROPERTY(QString password READ password WRITE setPassword) Q_PROPERTY(QString host READ host WRITE setHost) Q_PROPERTY(bool autoconnect READ autoconnect WRITE setAutoconnect) + Q_PROPERTY(bool keepDBCredentials READ keepDBCredentials WRITE setKeepDBCredentials) public: typedef QSharedPointer Ptr; ConnectionDesc(QSqlDatabase db, QObject* parent=0); @@ -124,17 +125,19 @@ public: void setDatabaseName(const QString &value){m_databaseName=value;} QString databaseName(){return m_databaseName;} void setUserName(const QString &value){m_user=value;} - QString userName(){return m_user;} + QString userName(){ return m_user; } void setPassword(const QString &value){m_password=value;} - QString password(){return m_password;} + QString password(){ return m_password; } void setAutoconnect(bool value){m_autoconnect=value;} bool autoconnect(){return m_autoconnect;} bool isEqual(const QSqlDatabase& db); bool isInternal(){ return m_internal; } void setInternal(bool value) {m_internal = value;} + bool keepDBCredentials() const; + void setKeepDBCredentials(bool keepDBCredentials); public: static QString connectionNameForUser(const QString& connectionName); - static QString connectionNameForReport(const QString& connectionName); + static QString connectionNameForReport(const QString& connectionName); signals: void nameChanged(const QString& oldName,const QString& newName); private: @@ -146,6 +149,7 @@ private: QString m_password; bool m_autoconnect; bool m_internal; + bool m_keepDBCredentials; }; class IConnectionController{ diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index 5607117..74dd69e 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -217,7 +217,7 @@ void DataSourceModel::updateModel() } DataSourceManager::DataSourceManager(QObject *parent) : - QObject(parent), m_lastError(""), m_designTime(true), m_needUpdate(false) + QObject(parent), m_lastError(""), m_designTime(true), m_needUpdate(false), m_dbCredentialsProvider(0) { m_groupFunctionFactory.registerFunctionCreator(QLatin1String("COUNT"),new ConstructorGroupFunctionCreator); m_groupFunctionFactory.registerFunctionCreator(QLatin1String("SUM"),new ConstructorGroupFunctionCreator); @@ -324,6 +324,11 @@ ICallbackDatasource *DataSourceManager::createCallbackDatasouce(const QString& n return ds; } +void DataSourceManager::registerDbCredentialsProvider(IDbCredentialsProvider *provider) +{ + m_dbCredentialsProvider = provider; +} + void DataSourceManager::addCallbackDatasource(ICallbackDatasource *datasource, const QString& name) { IDataSource* datasourceIntf = dynamic_cast(datasource); @@ -567,6 +572,11 @@ int DataSourceManager::connectionIndexByName(const QString &connectionName) return -1; } +QList& DataSourceManager::conections() +{ + return m_connections; +} + bool DataSourceManager::dataSourceIsValid(const QString &name) { if (m_datasources.value(name.toLower())) return !m_datasources.value(name.toLower())->isInvalid(); @@ -704,10 +714,19 @@ void DataSourceManager::putProxyDesc(ProxyDesc *proxyDesc) bool DataSourceManager::initAndOpenDB(QSqlDatabase& db, ConnectionDesc& connectionDesc){ bool connected = false; + + db.setHostName(replaceVariables(connectionDesc.host())); db.setUserName(replaceVariables(connectionDesc.userName())); db.setPassword(replaceVariables(connectionDesc.password())); + if (!connectionDesc.keepDBCredentials() && m_dbCredentialsProvider){ + if (!m_dbCredentialsProvider->getUserName(connectionDesc.name()).isEmpty()) + db.setUserName(m_dbCredentialsProvider->getUserName(connectionDesc.name())); + if (!m_dbCredentialsProvider->getPassword(connectionDesc.name()).isEmpty()) + db.setPassword(m_dbCredentialsProvider->getPassword(connectionDesc.name())); + } + QString dbName = replaceVariables(connectionDesc.databaseName()); if (connectionDesc.driver().compare("QSQLITE")==0){ if (!defaultDatabasePath().isEmpty()){ @@ -726,7 +745,6 @@ bool DataSourceManager::initAndOpenDB(QSqlDatabase& db, ConnectionDesc& connecti } connected=db.open(); - connectionDesc.setInternal(true); if (!connected) setLastError(db.lastError().text()); return connected; } @@ -758,10 +776,17 @@ bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc) } if (!QSqlDatabase::contains(connectionDesc->name())){ - QSqlDatabase db = QSqlDatabase::addDatabase(connectionDesc->driver(),connectionDesc->name()); - connected=initAndOpenDB(db, *connectionDesc); + QString dbError; + { + QSqlDatabase db = QSqlDatabase::addDatabase(connectionDesc->driver(),connectionDesc->name()); + connectionDesc->setInternal(true); + connected=initAndOpenDB(db, *connectionDesc); + dbError = db.lastError().text(); + } if (!connected){ - setLastError(db.lastError().text()); + if (!dbError.trimmed().isEmpty()) + setLastError(dbError); + QSqlDatabase::removeDatabase(connectionDesc->name()); return false; } } else { @@ -868,8 +893,9 @@ bool DataSourceManager::isConnection(const QString &connectionName) bool DataSourceManager::isConnectionConnected(const QString &connectionName) { - if (isConnection(connectionName)){ - return QSqlDatabase::database(connectionName).isOpen(); + if (isConnection(connectionName) && QSqlDatabase::contains(connectionName)){ + QSqlDatabase db = QSqlDatabase::database(connectionName); + return db.isValid() && QSqlDatabase::database(connectionName).isOpen(); } return false; } @@ -893,8 +919,10 @@ void DataSourceManager::disconnectConnection(const QString& connectionName) ConnectionDesc* connectionDesc = connectionByName(connectionName); if (connectionDesc->isInternal()){ - QSqlDatabase db = QSqlDatabase::database(connectionName); - if (db.isOpen()) db.close(); + { + QSqlDatabase db = QSqlDatabase::database(connectionName); + if (db.isOpen()) db.close(); + } if (QSqlDatabase::contains(connectionName)) QSqlDatabase::removeDatabase(connectionName); } diff --git a/limereport/lrdatasourcemanager.h b/limereport/lrdatasourcemanager.h index c60bfa5..77967c5 100644 --- a/limereport/lrdatasourcemanager.h +++ b/limereport/lrdatasourcemanager.h @@ -115,6 +115,7 @@ public: bool addModel(const QString& name, QAbstractItemModel *model, bool owned); void removeModel(const QString& name); ICallbackDatasource* createCallbackDatasouce(const QString &name); + void registerDbCredentialsProvider(IDbCredentialsProvider *provider); void addCallbackDatasource(ICallbackDatasource *datasource, const QString &name); void setReportVariable(const QString& name, const QVariant& value); void deleteVariable(const QString& name); @@ -150,6 +151,7 @@ public: int proxyIndexByName(const QString& dataSourceName); int connectionIndexByName(const QString& connectionName); + QList &conections(); bool dataSourceIsValid(const QString& name); IDataSource* dataSource(const QString& name); IDataSourceHolder* dataSourceHolder(const QString& name); @@ -250,8 +252,7 @@ private: ReportSettings* m_reportSettings; QHash m_groupFunctionsExpressionsMap; QVector m_groupFunctionsExpressions; - - + IDbCredentialsProvider* m_dbCredentialsProvider; }; } diff --git a/limereport/lrdatasourcemanagerintf.h b/limereport/lrdatasourcemanagerintf.h index 85cf388..57bd0c1 100644 --- a/limereport/lrdatasourcemanagerintf.h +++ b/limereport/lrdatasourcemanagerintf.h @@ -37,18 +37,25 @@ class QString; class QAbstractItemModel; namespace LimeReport{ +class IDbCredentialsProvider{ +public: + virtual QString getUserName(const QString& connectionName) = 0; + virtual QString getPassword(const QString& connectionName) = 0; +}; + class IDataSourceManager{ public: - virtual void setReportVariable(const QString& name, const QVariant& value)=0; - virtual void setDefaultDatabasePath(const QString &defaultDatabasePath)=0; - virtual void deleteVariable(const QString& name)=0; - virtual bool containsVariable(const QString& variableName)=0; - virtual QVariant variable(const QString& variableName)=0; - virtual bool addModel(const QString& name, QAbstractItemModel *model, bool owned)=0; - virtual void removeModel(const QString& name)=0; - virtual bool containsDatasource(const QString& dataSourceName)=0; + virtual void setReportVariable(const QString& name, const QVariant& value) = 0; + virtual void setDefaultDatabasePath(const QString &defaultDatabasePath) = 0; + virtual void deleteVariable(const QString& name) = 0; + virtual bool containsVariable(const QString& variableName) = 0; + virtual QVariant variable(const QString& variableName) = 0; + virtual bool addModel(const QString& name, QAbstractItemModel *model, bool owned) = 0; + virtual void removeModel(const QString& name) = 0; + virtual bool containsDatasource(const QString& dataSourceName) = 0; virtual void clearUserVariables()=0; virtual ICallbackDatasource* createCallbackDatasouce(const QString& name) = 0; + virtual void registerDbCredentialsProvider(IDbCredentialsProvider* provider) = 0; //virtual void addCallbackDatasource(ICallbackDatasource* datasource, const QString& name) = 0; }; diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 2ea54d9..fb7ee7c 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -59,7 +59,7 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) : m_printer(new QPrinter(QPrinter::HighResolution)), m_printerSelected(false), m_showProgressDialog(true), m_reportName(""), m_activePreview(0), m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")), - m_reportRendering(false), m_resultIsEditable(true) + m_reportRendering(false), m_resultIsEditable(true), m_passPhrase("HjccbzHjlbyfCkjy") { m_datasources = new DataSourceManager(this); m_datasources->setReportSettings(&m_reportSettings); @@ -513,14 +513,29 @@ bool ReportEnginePrivate::loadFromFile(const QString &fileName) { if (!QFile::exists(fileName)) return false; - clearReport(); + clearReport(); ItemsReaderIntf::Ptr reader = FileXMLReader::create(fileName); + reader->setPassPhrase(m_passPhrase); if (reader->first()){ if (reader->readItem(this)){ m_fileName=fileName; QFileInfo fi(fileName); m_reportName = fi.fileName(); + + QString dbSettingFileName = fi.absolutePath()+"/"+fi.baseName()+".db"; + if (QFile::exists(dbSettingFileName)){ + QSettings dbcredentals(dbSettingFileName, QSettings::IniFormat); + foreach (ConnectionDesc* connection, dataManager()->conections()) { + if (!connection->keepDBCredentials()){ + dbcredentals.beginGroup(connection->name()); + connection->setUserName(dbcredentals.value("user").toString()); + connection->setPassword(dbcredentals.value("password").toString()); + dbcredentals.endGroup(); + } + } + } + dataManager()->connectAutoConnections(); return true; }; @@ -533,6 +548,7 @@ bool ReportEnginePrivate::loadFromByteArray(QByteArray* data, const QString &nam clearReport(); ItemsReaderIntf::Ptr reader = ByteArrayXMLReader::create(data); + reader->setPassPhrase(m_passPhrase); if (reader->first()){ if (reader->readItem(this)){ m_fileName = ""; @@ -548,6 +564,7 @@ bool ReportEnginePrivate::loadFromString(const QString &report, const QString &n clearReport(); ItemsReaderIntf::Ptr reader = StringXMLreader::create(report); + reader->setPassPhrase(m_passPhrase); if (reader->first()){ if (reader->readItem(this)){ m_fileName = ""; @@ -566,10 +583,35 @@ bool ReportEnginePrivate::saveToFile(const QString &fileName) if (fi.suffix().isEmpty()) fn+=".lrxml"; + QString dbSettingFileName = fi.absolutePath()+"/"+fi.baseName()+".db"; + QSettings dbcredentals(dbSettingFileName, QSettings::IniFormat); + + foreach (ConnectionDesc* connection, dataManager()->conections()) { + if (!connection->keepDBCredentials()){ + dbcredentals.beginGroup(connection->name()); + dbcredentals.setValue("user",connection->userName()); + dbcredentals.setValue("password",connection->password()); + dbcredentals.endGroup(); + connection->setPassword(""); + connection->setUserName(""); + } + } + QScopedPointer< ItemsWriterIntf > writer(new XMLWriter()); + writer->setPassPhrase(m_passPhrase); writer->putItem(this); - m_fileName=fn; + m_fileName=fn; bool saved = writer->saveToFile(fn); + + foreach (ConnectionDesc* connection, dataManager()->conections()) { + if (!connection->keepDBCredentials()){ + dbcredentals.beginGroup(connection->name()); + connection->setUserName(dbcredentals.value("user").toString()); + connection->setPassword(dbcredentals.value("password").toString()); + dbcredentals.endGroup(); + } + } + if (saved){ foreach(PageDesignIntf* page, m_pages){ page->setToSaved(); @@ -581,6 +623,7 @@ bool ReportEnginePrivate::saveToFile(const QString &fileName) QByteArray ReportEnginePrivate::saveToByteArray() { QScopedPointer< ItemsWriterIntf > writer(new XMLWriter()); + writer->setPassPhrase(m_passPhrase); writer->putItem(this); QByteArray result = writer->saveToByteArray(); if (!result.isEmpty()){ @@ -593,6 +636,7 @@ QByteArray ReportEnginePrivate::saveToByteArray() QString ReportEnginePrivate::saveToString(){ QScopedPointer< ItemsWriterIntf > writer(new XMLWriter()); + writer->setPassPhrase(m_passPhrase); writer->putItem(this); QString result = writer->saveToString(); if (!result.isEmpty()){ @@ -629,6 +673,11 @@ QString ReportEnginePrivate::renderToString() }else return QString(); } +void ReportEnginePrivate::setPassPhrase(const QString &passPhrase) +{ + m_passPhrase = passPhrase; +} + bool ReportEnginePrivate::resultIsEditable() const { return m_resultIsEditable; @@ -807,6 +856,12 @@ bool ReportEngine::isBusy() return d->isBusy(); } +void ReportEngine::setPassPharse(QString &passPharse) +{ + Q_D(ReportEngine); + d->setPassPhrase(passPharse); +} + void ReportEngine::setShowProgressDialog(bool value) { Q_D(ReportEngine); diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index 0d5b309..dbbb2a8 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -101,6 +101,7 @@ public: void setResultEditable(bool value); bool resultIsEditable(); bool isBusy(); + void setPassPharse(QString& passPharse); signals: void renderStarted(); void renderFinished(); diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index 85aff24..4ec3508 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -125,6 +125,8 @@ public: bool resultIsEditable() const; void setResultEditable(bool value); + void setPassPhrase(const QString &passPhrase); + signals: void pagesLoadFinished(); void datasourceCollectionLoadFinished(const QString& collectionName); @@ -175,6 +177,7 @@ private: ReportSettings m_reportSettings; bool m_reportRendering; bool m_resultIsEditable; + QString m_passPhrase; }; } diff --git a/limereport/lrsimplecrypt.cpp b/limereport/lrsimplecrypt.cpp index 0b9aa06..d79273e 100644 --- a/limereport/lrsimplecrypt.cpp +++ b/limereport/lrsimplecrypt.cpp @@ -41,6 +41,8 @@ const int b = 16; /* number of bytes in key */ const int c = 4; /* number words in key = ceil(8*b/w)*/ const int t = 26; /* size of table S = 2*(r+1) words */ +const char* passPhrase = "HjccbzHjlbyfCkjy"; + WORD P = 0xb7e15163, Q = 0x9e3779b9; #define ROTL(x,y) (((x)<<(y&(w-1))) | ((x)>>(w-(y&(w-1))))) @@ -64,11 +66,15 @@ namespace LimeReport { class ChipperPrivate{ friend class Chipper; +public: + ChipperPrivate():m_prepared(false){} + bool isPrepared(){ return m_prepared;} private: void RC5_SETUP(const char *K); void RC5_ENCRYPT(WORD *pt, WORD *ct); void RC5_DECRYPT(WORD *ct, WORD *pt); WORD S[26]; + bool m_prepared; }; void ChipperPrivate::RC5_SETUP(const char *K) @@ -82,6 +88,7 @@ void ChipperPrivate::RC5_SETUP(const char *K) A = S[i] = ROTL(S[i]+(A+B),3); B = L[j] = ROTL(L[j]+(A+B),(A+B)); } + m_prepared = true; } void ChipperPrivate::RC5_ENCRYPT(WORD *pt, WORD *ct) @@ -111,7 +118,8 @@ QByteArray Chipper::cryptString(QString value) buff += value; WTB pt, ct, prior; - d->RC5_SETUP("HjccbzHjlbyfCkjy"); + if (!d->isPrepared()) + d->RC5_SETUP(passPhrase); prior.word[0]=0; prior.word[1]=0; @@ -144,7 +152,8 @@ QString Chipper::decryptByteArray(QByteArray value) QByteArray result; WTB pt, ct, prior; - d->RC5_SETUP("HjccbzHjlbyfCkjy"); + if (!d->isPrepared()) + d->RC5_SETUP(passPhrase); prior.word[0] = 0; prior.word[1] = 0; @@ -174,6 +183,14 @@ QString Chipper::decryptByteArray(QByteArray value) Chipper::Chipper(): d(new ChipperPrivate()){} +Chipper::Chipper(QString passphrase): d(new ChipperPrivate()) +{ + if (!passphrase.trimmed().isEmpty()){ + passphrase = passphrase.leftJustified(16,'#'); + d->RC5_SETUP(passphrase.toLatin1().data()); + } +} + Chipper::~Chipper() { delete d; diff --git a/limereport/lrsimplecrypt.h b/limereport/lrsimplecrypt.h index 68978b5..4088726 100644 --- a/limereport/lrsimplecrypt.h +++ b/limereport/lrsimplecrypt.h @@ -42,6 +42,7 @@ public: QByteArray cryptString(QString value); QString decryptByteArray(QByteArray value); Chipper(); + Chipper(QString passphrase); ~Chipper(); private: ChipperPrivate* d; diff --git a/limereport/serializators/lrserializatorintf.h b/limereport/serializators/lrserializatorintf.h index ce6a44b..b16263a 100644 --- a/limereport/serializators/lrserializatorintf.h +++ b/limereport/serializators/lrserializatorintf.h @@ -35,10 +35,16 @@ namespace LimeReport { class SerializatorIntf { public: - virtual QVariant loadValue()=0; - virtual void save(const QVariant& value,QString name)=0; + virtual QVariant loadValue() = 0; + virtual void save(const QVariant& value,QString name) = 0; virtual ~SerializatorIntf(){} }; +class CryptedSerializator : public virtual SerializatorIntf +{ +public: + virtual void setPassPhrase(const QString& passPhrase) = 0; +}; + } #endif // LRSERIALIZATORINTF_H diff --git a/limereport/serializators/lrstorageintf.h b/limereport/serializators/lrstorageintf.h index 85fb7ad..74b83ef 100644 --- a/limereport/serializators/lrstorageintf.h +++ b/limereport/serializators/lrstorageintf.h @@ -39,18 +39,19 @@ namespace LimeReport{ class ObjectLoadingStateIntf{ public: - virtual bool isLoading()=0; - virtual void objectLoadStarted()=0; - virtual void objectLoadFinished()=0; + virtual bool isLoading() = 0; + virtual void objectLoadStarted() = 0; + virtual void objectLoadFinished() = 0; }; class ItemsWriterIntf { public: - virtual void putItem(QObject* item)=0; + virtual void putItem(QObject* item) = 0; virtual bool saveToFile(QString fileName) = 0; virtual QString saveToString() = 0; virtual QByteArray saveToByteArray() = 0; + virtual void setPassPhrase(const QString& passPhrase) = 0; virtual ~ItemsWriterIntf(){} }; @@ -58,14 +59,15 @@ class ItemsReaderIntf { public: typedef QSharedPointer Ptr; - virtual bool first()=0; - virtual bool next()=0; - virtual bool prior()=0; - virtual QString itemType()=0; - virtual QString itemClassName()=0; - virtual bool readItem(QObject *item)=0; - virtual int firstLevelItemsCount()=0; - virtual QString lastError()=0; + virtual bool first() = 0; + virtual bool next() = 0; + virtual bool prior() = 0; + virtual QString itemType() = 0; + virtual QString itemClassName() = 0; + virtual bool readItem(QObject *item) = 0; + virtual int firstLevelItemsCount() = 0; + virtual QString lastError() = 0; + virtual void setPassPhrase(const QString& passPhrase) = 0; virtual ~ItemsReaderIntf(){} }; diff --git a/limereport/serializators/lrxmlbasetypesserializators.cpp b/limereport/serializators/lrxmlbasetypesserializators.cpp index ebc4260..c0c2ce7 100644 --- a/limereport/serializators/lrxmlbasetypesserializators.cpp +++ b/limereport/serializators/lrxmlbasetypesserializators.cpp @@ -109,7 +109,7 @@ void XmlQStringSerializator::save(const QVariant &value, QString name) QDomElement _node = doc()->createElement(name); _node.setAttribute("Type","QString"); if (name.compare("password")==0){ - Chipper chipper; + Chipper chipper(passPhrase()); QByteArray ba = chipper.cryptString(value.toString()); //ba.append(); _node.setAttribute("Value",QString(ba.toBase64())); @@ -123,7 +123,7 @@ QVariant XmlQStringSerializator::loadValue() { if (node()->tagName().compare("password")==0){ QByteArray ba; - Chipper chipper; + Chipper chipper(passPhrase()); ba.append(node()->attribute("Value").toLatin1()); return chipper.decryptByteArray(QByteArray::fromBase64(ba)); } else diff --git a/limereport/serializators/lrxmlbasetypesserializators.h b/limereport/serializators/lrxmlbasetypesserializators.h index 70bd40d..56f62c1 100644 --- a/limereport/serializators/lrxmlbasetypesserializators.h +++ b/limereport/serializators/lrxmlbasetypesserializators.h @@ -36,7 +36,7 @@ namespace LimeReport{ -class XmlBaseSerializator : public SerializatorIntf{ +class XmlBaseSerializator : public virtual SerializatorIntf{ public: XmlBaseSerializator(QDomDocument *doc, QDomElement *node):m_doc(doc),m_node(node){} protected: @@ -48,10 +48,21 @@ private: QDomElement *m_node; }; -class XmlQStringSerializator : public XmlBaseSerializator +class XmlCryptedSerializator : public XmlBaseSerializator, public virtual CryptedSerializator{ +public: + XmlCryptedSerializator(QDomDocument *doc, QDomElement *node) + :XmlBaseSerializator(doc, node){} + virtual void setPassPhrase(const QString& passPhrase) {m_passPhrase = passPhrase;} +protected: + QString passPhrase(){ return m_passPhrase;} +private: + QString m_passPhrase; +}; + +class XmlQStringSerializator : public XmlCryptedSerializator { public: - XmlQStringSerializator(QDomDocument *doc, QDomElement *node):XmlBaseSerializator(doc,node){} + XmlQStringSerializator(QDomDocument *doc, QDomElement *node):XmlCryptedSerializator(doc,node){} private: virtual void save(const QVariant &value,QString name); virtual QVariant loadValue(); diff --git a/limereport/serializators/lrxmlreader.cpp b/limereport/serializators/lrxmlreader.cpp index 545c4ca..bee2ff8 100644 --- a/limereport/serializators/lrxmlreader.cpp +++ b/limereport/serializators/lrxmlreader.cpp @@ -135,6 +135,11 @@ QString XMLReader::lastError() return m_error; } +void XMLReader::setPassPhrase(const QString &passPhrase) +{ + m_passPhrase = passPhrase; +} + bool XMLReader::extractFirstNode() { if (m_firstNode.isNull()){ @@ -166,6 +171,10 @@ QVariant XMLReader::getValue(QDomElement *node) if (creator) { QScopedPointerserializator(creator(m_doc.data(),node)); + CryptedSerializator* cs = dynamic_cast(serializator.data()); + if (cs){ + cs->setPassPhrase(m_passPhrase); + } return serializator->loadValue(); } return QVariant(); diff --git a/limereport/serializators/lrxmlreader.h b/limereport/serializators/lrxmlreader.h index f677c68..0bc17ee 100644 --- a/limereport/serializators/lrxmlreader.h +++ b/limereport/serializators/lrxmlreader.h @@ -44,14 +44,17 @@ public: XMLReader(); XMLReader(QSharedPointer doc); protected: +//ItemsReaderIntf interface + bool first(); + bool next(); + bool prior(); + QString itemType(); + QString itemClassName(); + bool readItem(QObject *item); + int firstLevelItemsCount(); + QString lastError(); + void setPassPhrase(const QString &passPhrase); - virtual bool first(); - virtual bool next(); - virtual bool prior(); - virtual QString itemType(); - virtual QString itemClassName(); - virtual bool readItem(QObject *item); - virtual int firstLevelItemsCount(); virtual bool prepareReader(QDomDocument *doc); void readItemFromNode(QObject *item, QDomElement *node); @@ -60,7 +63,7 @@ protected: void readCollection(QObject *item, QDomElement *node); QVariant getValue(QDomElement *node); - virtual QString lastError(); + protected: bool extractFirstNode(); QString m_error; @@ -68,6 +71,11 @@ private: QSharedPointer m_doc; QDomElement m_curNode; QDomElement m_firstNode; + QString m_passPhrase; + + + + }; class FileXMLReader : public XMLReader{ diff --git a/limereport/serializators/lrxmlwriter.cpp b/limereport/serializators/lrxmlwriter.cpp index 1a6e68a..3038373 100644 --- a/limereport/serializators/lrxmlwriter.cpp +++ b/limereport/serializators/lrxmlwriter.cpp @@ -113,6 +113,11 @@ QByteArray XMLWriter::saveToByteArray() return res; } +void XMLWriter::setPassPhrase(const QString &passPhrase) +{ + m_passPhrase = passPhrase; +} + QDomElement XMLWriter::putQObjectItem(QString name, QObject *item) { Q_UNUSED(name) @@ -158,6 +163,10 @@ void XMLWriter::saveProperty(QString name, QObject* item, QDomElement *node) if (creator) { QScopedPointer serializator(creator(m_doc.data(),node)); + CryptedSerializator* cs = dynamic_cast(serializator.data()); + if (cs){ + cs->setPassPhrase(m_passPhrase); + } serializator->save( item->property(name.toLatin1()), name diff --git a/limereport/serializators/lrxmlwriter.h b/limereport/serializators/lrxmlwriter.h index 399e2e2..0259a75 100644 --- a/limereport/serializators/lrxmlwriter.h +++ b/limereport/serializators/lrxmlwriter.h @@ -44,10 +44,13 @@ public: XMLWriter(QSharedPointer doc); ~XMLWriter() {} private: + // ItemsWriterIntf interface void putItem(QObject* item); bool saveToFile(QString fileName); QString saveToString(); QByteArray saveToByteArray(); + void setPassPhrase(const QString &passPhrase); + void init(); QDomElement putQObjectItem(QString name, QObject* item); void putChildQObjectItem(QString name, QObject* item, QDomElement* parentNode); @@ -66,6 +69,7 @@ private: QSharedPointer m_doc; QString m_fileName; QDomElement m_rootElement; + QString m_passPhrase; }; } From bf81d3f98cfec759c0c9648d3dbf9255db31bf2f Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 18 Feb 2017 17:22:04 +0300 Subject: [PATCH 45/51] DataBrowser shows application connection --- limereport/databrowser/lrdatabrowser.cpp | 60 ++++++++++++++++++++---- 1 file changed, 51 insertions(+), 9 deletions(-) diff --git a/limereport/databrowser/lrdatabrowser.cpp b/limereport/databrowser/lrdatabrowser.cpp index ba89566..b6db492 100644 --- a/limereport/databrowser/lrdatabrowser.cpp +++ b/limereport/databrowser/lrdatabrowser.cpp @@ -426,18 +426,58 @@ void DataBrowser::initConnections() { ui->dataTree->clear(); QListitems; - foreach(QString connectionName,m_report->dataManager()->connectionNames()){ + + QStringList connections = QSqlDatabase::connectionNames(); + foreach(QString connectionName, m_report->dataManager()->connectionNames()){ + if (!connections.contains(connectionName,Qt::CaseInsensitive)){ + connections.append(connectionName); + } + } + qSort(connections); + foreach (QString connectionName, connections) { QTreeWidgetItem *item=new QTreeWidgetItem( ui->dataTree, QStringList(ConnectionDesc::connectionNameForUser(connectionName)), DataBrowserTree::Connection ); - if (m_report->dataManager()->isConnectionConnected(connectionName)) + if (!m_report->dataManager()->connectionNames().contains(ConnectionDesc::connectionNameForReport(connectionName), Qt::CaseInsensitive)) + { item->setIcon(0,QIcon(":/databrowser/images/database_connected")); - else - item->setIcon(0,QIcon(":/databrowser/images/database_disconnected")); + } else { + if (m_report->dataManager()->isConnectionConnected(connectionName)) + item->setIcon(0,QIcon(":/databrowser/images/database_connected")); + else + item->setIcon(0,QIcon(":/databrowser/images/database_disconnected")); + } items.append(item); } + + +// foreach (QString connectionName, connections) { +// QTreeWidgetItem *item=new QTreeWidgetItem( +// ui->dataTree, +// QStringList(ConnectionDesc::connectionNameForUser(connectionName)), +// DataBrowserTree::Connection +// ); +// item->setIcon(0,QIcon(":/databrowser/images/database_connected")); +// } + +// connections = m_report->dataManager()->connectionNames(); +// qSort(connections); +// foreach(QString connectionName,connectionName){ +// if (!QSqlDatabase::contains(connectionName)){ +// QTreeWidgetItem *item=new QTreeWidgetItem( +// ui->dataTree, +// QStringList(ConnectionDesc::connectionNameForUser(connectionName)), +// DataBrowserTree::Connection +// ); +// if (m_report->dataManager()->isConnectionConnected(connectionName)) +// item->setIcon(0,QIcon(":/databrowser/images/database_connected")); +// else +// item->setIcon(0,QIcon(":/databrowser/images/database_disconnected")); +// items.append(item); +// } +// } ui->dataTree->insertTopLevelItems(0,items); } @@ -642,7 +682,8 @@ bool DataBrowser::checkConnectionDesc(ConnectionDesc *connection) bool DataBrowser::containsDefaultConnection() { - bool result = m_report->dataManager()->connectionByName(QSqlDatabase::defaultConnection); + bool result = m_report->dataManager()->connectionByName(QSqlDatabase::defaultConnection) || + QSqlDatabase::contains(QSqlDatabase::defaultConnection); return result; } @@ -660,7 +701,7 @@ void DataBrowser::on_dataTree_currentItemChanged(QTreeWidgetItem *current, QTree { Q_UNUSED(previous) if (current&&(current->type() == DataBrowserTree::Connection)) { - ui->pbConnect->setEnabled(true); + bool internalConnection = m_report->dataManager()->connectionByName(ConnectionDesc::connectionNameForReport(current->text(0))); if (m_report->dataManager()->isConnectionConnected(current->text(0))){ ui->pbConnect->setIcon(QIcon(":/databrowser/images/plug-connect.png")); } else { @@ -668,9 +709,10 @@ void DataBrowser::on_dataTree_currentItemChanged(QTreeWidgetItem *current, QTree } ui->editDataSource->setEnabled(false); ui->deleteDataSource->setEnabled(false); - ui->viewDataSource->setEnabled(false); - ui->changeConnection->setEnabled(true); - ui->deleteConection->setEnabled(true); + ui->viewDataSource->setEnabled(false); + ui->pbConnect->setEnabled(internalConnection); + ui->changeConnection->setEnabled(internalConnection); + ui->deleteConection->setEnabled(internalConnection); ui->errorMessage->setDisabled(true); } else { ui->changeConnection->setEnabled(false); From 28c8ae66e1b64ac33acf96293c872207ae247379 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 21 Feb 2017 18:36:30 +0300 Subject: [PATCH 46/51] Esc close the preview window --- limereport/lrpreviewreportwindow.h | 1 - limereport/lrpreviewreportwindow.ui | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/limereport/lrpreviewreportwindow.h b/limereport/lrpreviewreportwindow.h index bc942be..92b2829 100644 --- a/limereport/lrpreviewreportwindow.h +++ b/limereport/lrpreviewreportwindow.h @@ -98,7 +98,6 @@ private slots: void slotScalePercentChanged(int percent); void on_actionShowMessages_toggled(bool value); void on_actionShow_Toolbar_triggered(); - private: ItemsReaderIntf* reader(); void initPercentCombobox(); diff --git a/limereport/lrpreviewreportwindow.ui b/limereport/lrpreviewreportwindow.ui index bca9861..50487cb 100644 --- a/limereport/lrpreviewreportwindow.ui +++ b/limereport/lrpreviewreportwindow.ui @@ -35,7 +35,7 @@ 0 0 800 - 20 + 19 @@ -158,6 +158,9 @@ Close Preview + + Esc + From 3975406487e55ae74f02e0e4b87920b997393fdf Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Tue, 21 Feb 2017 22:16:09 +0300 Subject: [PATCH 47/51] Check connection has been fixed --- limereport/lrdatasourcemanager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index 74dd69e..f0a9bf2 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -667,8 +667,10 @@ void DataSourceManager::addConnectionDesc(ConnectionDesc * connection) bool DataSourceManager::checkConnectionDesc(ConnectionDesc *connection) { if (connectConnection(connection)){ - if (connection->isInternal()) + if (connection->isInternal()){ QSqlDatabase::removeDatabase(connection->name()); + if (designTime()) emit datasourcesChanged(); + } return true; } if (connection->isInternal()) From 117023e9204a10a5e829882719774003e1d8615f Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Wed, 22 Feb 2017 00:20:37 +0300 Subject: [PATCH 48/51] Script browser update has been fixed --- limereport/lrreportdesignwindow.cpp | 1 + limereport/scriptbrowser/lrscriptbrowser.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index 5455529..358aa6b 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -539,6 +539,7 @@ void ReportDesignWindow::startNewReport() m_reportDesignWidget->createStartPage(); m_lblReportName->setText(""); updateRedoUndo(); + m_reportDesignWidget->slotPagesLoadFinished(); m_newPageHeader->setEnabled(true); m_newPageFooter->setEnabled(true); m_newReportHeader->setEnabled(true); diff --git a/limereport/scriptbrowser/lrscriptbrowser.cpp b/limereport/scriptbrowser/lrscriptbrowser.cpp index ea38798..5f90bf3 100644 --- a/limereport/scriptbrowser/lrscriptbrowser.cpp +++ b/limereport/scriptbrowser/lrscriptbrowser.cpp @@ -64,6 +64,7 @@ void ScriptBrowser::setReportEditor(ReportDesignWidget* report) void ScriptBrowser::updateFunctionTree() { + ui->twFunctions->clear(); ScriptEngineManager* sm = reportEditor()->scriptManager(); QMap categ; foreach(ScriptFunctionDesc fd, sm->functionsDescriber()){ From a2c93601d0fd6df43272ae3ab5cacac79a6c2d5f Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 24 Feb 2017 07:13:43 +0300 Subject: [PATCH 49/51] Items context menu has been added Fields drag & drop init band datasource if it empty --- limereport/items/lrtextitem.cpp | 46 +++++++++++++++++++++++ limereport/items/lrtextitem.h | 2 + limereport/lrbanddesignintf.cpp | 37 +++++++++++++++++++ limereport/lrbanddesignintf.h | 4 +- limereport/lrbasedesignintf.cpp | 51 ++++++++++++++++++++++++++ limereport/lrbasedesignintf.h | 15 ++++++-- limereport/lrpagedesignintf.cpp | 19 +++++++++- limereport/lrpageitemdesignintf.cpp | 9 +++++ limereport/lrpageitemdesignintf.h | 1 + limereport/serializators/lrxmlreader.h | 5 --- 10 files changed, 177 insertions(+), 12 deletions(-) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index cddcfee..664bd20 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -42,6 +42,7 @@ #include "lrsimpletagparser.h" #include "lrtextitemeditor.h" #include "lrreportengine_p.h" +#include namespace{ @@ -80,6 +81,51 @@ int TextItem::fakeMarginSize() const{ return marginSize()+5; } +void TextItem::preparePopUpMenu(QMenu &menu) +{ + QAction* editAction = menu.addAction(QIcon(":/report/images/edit_pecil2.png"),tr("Edit")); + menu.insertAction(menu.actions().at(0),editAction); + menu.insertSeparator(menu.actions().at(1)); + + menu.addSeparator(); + + QAction* action = menu.addAction(tr("Auto height")); + action->setCheckable(true); + action->setChecked(autoHeight()); + + action = menu.addAction(tr("Allow HTML")); + action->setCheckable(true); + action->setChecked(allowHTML()); + + action = menu.addAction(tr("Allow HTML in fields")); + action->setCheckable(true); + action->setChecked(allowHTMLInFields()); + + action = menu.addAction(tr("Strethc to max height")); + action->setCheckable(true); + action->setChecked(stretchToMaxHeight()); + +} + +void TextItem::processPopUpAction(QAction *action) +{ + if (action->text().compare(tr("Edit")) == 0){ + this->showEditorDialog(); + } + if (action->text().compare(tr("Auto height")) == 0){ + setProperty("autoHeight",action->isChecked()); + } + if (action->text().compare(tr("Allow HTML")) == 0){ + setProperty("allowHTML",action->isChecked()); + } + if (action->text().compare(tr("Allow HTML in fields")) == 0){ + setProperty("allowHTMLInFields",action->isChecked()); + } + if (action->text().compare(tr("Strethc to max height")) == 0){ + setProperty("stretchToMaxHeight",action->isChecked()); + } +} + void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, QWidget* widget) { Q_UNUSED(widget); Q_UNUSED(style); diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index ac9b5b6..6dc735b 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -172,6 +172,8 @@ protected: int fakeMarginSize() const; QString getTextPart(int height, int skipHeight); void restoreLinksEvent(); + void preparePopUpMenu(QMenu &menu); + void processPopUpAction(QAction *action); private: void initTextSizes() const; void setTextFont(TextPtr text, const QFont &value) const; diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index c6993ad..9a704f2 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -33,6 +33,7 @@ #include #include #include +#include namespace LimeReport { @@ -431,6 +432,34 @@ void BandDesignIntf::moveItemsDown(qreal startPos, qreal offset){ } } +void BandDesignIntf::preparePopUpMenu(QMenu &menu) +{ + foreach (QAction* action, menu.actions()) { + if (action->text().compare(tr("Bring to top")) == 0 || + action->text().compare(tr("Send to back")) == 0 ) + action->setEnabled(false); + } + + menu.addSeparator(); + QAction* autoHeightAction = menu.addAction(tr("Auto height")); + autoHeightAction->setCheckable(true); + autoHeightAction->setChecked(autoHeight()); + + QAction* autoSplittableAction = menu.addAction(tr("Splittable")); + autoSplittableAction->setCheckable(true); + autoSplittableAction->setChecked(isSplittable()); +} + +void BandDesignIntf::processPopUpAction(QAction *action) +{ + if (action->text().compare(tr("Auto height")) == 0){ + setProperty("autoHeight",action->isChecked()); + } + if (action->text().compare(tr("Splittable")) == 0){ + setProperty("splittable",action->isChecked()); + } +} + BaseDesignIntf* BandDesignIntf::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent) { int maxBottom = 0; @@ -804,6 +833,14 @@ void BandDesignIntf::setStartNewPage(bool startNewPage) m_startNewPage = startNewPage; } +void BandDesignIntf::setAutoHeight(bool value){ + if (m_autoHeight != value){ + m_autoHeight=value; + if (!isLoading()) + notify("autoHeight",!value,value); + } +} + bool BandDesignIntf::reprintOnEachPage() const { return m_reprintOnEachPage; diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index fea245a..0d92f5e 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -207,7 +207,7 @@ public: bool startNewPage() const; void setStartNewPage(bool startNewPage); - void setAutoHeight(bool value){m_autoHeight=value;} + void setAutoHeight(bool value); bool autoHeight(){return m_autoHeight;} bool startFromNewPage() const; @@ -244,6 +244,8 @@ protected: void setColumnsCount(int value); void setColumnsFillDirection(BandColumnsLayoutType value); void moveItemsDown(qreal startPos, qreal offset); + void preparePopUpMenu(QMenu &menu); + void processPopUpAction(QAction *action); private slots: void childBandDeleted(QObject* band); private: diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index f0f7e2b..2f5f4db 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -35,6 +35,8 @@ #include "qgraphicsitem.h" #include "lrdesignelementsfactory.h" #include "lrhorizontallayout.h" +#include "serializators/lrstorageintf.h" +#include "serializators/lrxmlreader.h" #include @@ -43,6 +45,8 @@ #include #include #include +#include +#include namespace LimeReport { @@ -1147,6 +1151,53 @@ void BaseDesignIntf::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) QGraphicsItem::mouseDoubleClickEvent(event); } +void BaseDesignIntf::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) +{ + PageDesignIntf* page = dynamic_cast(scene()); + if (!page->selectedItems().contains(this)){ + page->clearSelection(); + this->setSelected(true); + } + QMenu menu; + QAction* copyAction = menu.addAction(QIcon(":/report/images/copy.png"), tr("Copy")); + copyAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C)); + QAction* cutAction = menu.addAction(QIcon(":/report//images/cut"), tr("Cut")); + cutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X)); + QAction* pasteAction = menu.addAction(QIcon(":/report/images/paste.png"), tr("Paste")); + pasteAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V)); + pasteAction->setEnabled(false); + QClipboard *clipboard = QApplication::clipboard(); + ItemsReaderIntf::Ptr reader = StringXMLreader::create(clipboard->text()); + if (reader->first() && reader->itemType() == "Object"){ + pasteAction->setEnabled(true); + } + menu.addSeparator(); + QAction* brinToTopAction = menu.addAction(QIcon(":/report//images/bringToTop"), tr("Bring to top")); + QAction* sendToBackAction = menu.addAction(QIcon(":/report//images/sendToBack"), tr("Send to back")); + menu.addSeparator(); + QAction* noBordersAction = menu.addAction(QIcon(":/report//images/noLines"), tr("No borders")); + QAction* allBordersAction = menu.addAction(QIcon(":/report//images/allLines"), tr("All borders")); + preparePopUpMenu(menu); + QAction* a = menu.exec(event->screenPos()); + if (a){ + if (a == cutAction) + page->cut(); + if (a == copyAction) + page->copy(); + if (a == pasteAction) + page->paste(); + if (a == brinToTopAction) + page->bringToFront(); + if (a == sendToBackAction) + page->sendToBack(); + if (a == noBordersAction) + page->setBorders(BaseDesignIntf::NoLine); + if (a == allBordersAction) + page->setBorders(BaseDesignIntf::AllLines); + processPopUpAction(a); + } +} + int BaseDesignIntf::possibleMoveDirectionFlags() const { return m_possibleMoveDirectionFlags; diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index 253da8d..4f615ed 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -124,10 +124,13 @@ public: TopBotom=2, All=3 }; - enum BorderSide { TopLine = 1, - BottomLine = 2, - LeftLine = 4, - RightLine = 8 + enum BorderSide { + NoLine = 0, + TopLine = 1, + BottomLine = 2, + LeftLine = 4, + RightLine = 8, + AllLines = 15 }; enum ObjectState {ObjectLoading, ObjectLoaded, ObjectCreated}; enum ItemAlign {LeftItemAlign,RightItemAlign,CenterItemAlign,ParentWidthItemAlign,DesignedItemAlign}; @@ -293,6 +296,7 @@ protected: void mouseMoveEvent(QGraphicsSceneMouseEvent* event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); + void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); virtual void geometryChangedEvent(QRectF newRect, QRectF oldRect); virtual QPen borderPen(BorderSide side) const; @@ -333,6 +337,9 @@ protected: QVariant m_varValue; + virtual void preparePopUpMenu(QMenu& menu){Q_UNUSED(menu)} + virtual void processPopUpAction(QAction* action){Q_UNUSED(action)} + private: void updateSelectionMarker(); int resizeDirectionFlags(QPointF position); diff --git a/limereport/lrpagedesignintf.cpp b/limereport/lrpagedesignintf.cpp index e0a5ec2..2178d43 100644 --- a/limereport/lrpagedesignintf.cpp +++ b/limereport/lrpagedesignintf.cpp @@ -56,6 +56,7 @@ #include #include + namespace LimeReport { @@ -744,6 +745,15 @@ void PageDesignIntf::dropEvent(QGraphicsSceneDragDropEvent* event) QString data = event->mimeData()->text().remove(0,event->mimeData()->text().indexOf(":")+1); if (isVar) data = data.remove(QRegExp(" \\[.*\\]")); ti->setContent(data); + if (!isVar){ + BandDesignIntf* parentBand = dynamic_cast(ti->parentItem()); + if (parentBand && parentBand->datasourceName().isEmpty()){ + QRegExp dataSource("(?:\\$D\\{\\s*(.*)\\..*\\})"); + if (dataSource.indexIn(data) != -1){ + parentBand->setProperty("datasource",dataSource.cap(1)); + } + } + } } } @@ -1231,8 +1241,13 @@ BaseDesignIntf* PageDesignIntf::findDestObject(BaseDesignIntf* item){ void PageDesignIntf::paste() { QClipboard *clipboard = QApplication::clipboard(); - if (!selectedItems().isEmpty()) { - BaseDesignIntf* destItem = findDestObject(dynamic_cast(selectedItems().at(0))); + BaseDesignIntf* destItem = 0; + ItemsReaderIntf::Ptr reader = StringXMLreader::create(clipboard->text()); + if (reader->first() && reader->itemType() == "Object"){ + if (!selectedItems().isEmpty()) + destItem = findDestObject(dynamic_cast(selectedItems().at(0))); + else + destItem = this->pageItem(); if (destItem){ CommandIf::Ptr command = PasteCommand::create(this, clipboard->text(), destItem); saveCommand(command); diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index 41d89aa..d943a13 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -33,6 +33,7 @@ #include #include +#include namespace LimeReport { @@ -519,6 +520,14 @@ void PageItemDesignIntf::initPageSize(const QSizeF& size) setHeight(size.height()); m_sizeChainging=false; } + +void PageItemDesignIntf::preparePopUpMenu(QMenu &menu) +{ + foreach (QAction* action, menu.actions()) { + if (action->text().compare(tr("Paste")) != 0) + action->setVisible(false); + } +} void PageItemDesignIntf::initPageSize(const PageItemDesignIntf::PageSize &size) { m_sizeChainging = true; diff --git a/limereport/lrpageitemdesignintf.h b/limereport/lrpageitemdesignintf.h index 635655f..2c1fb84 100644 --- a/limereport/lrpageitemdesignintf.h +++ b/limereport/lrpageitemdesignintf.h @@ -127,6 +127,7 @@ protected: void initPageSize(const PageSize &size); void initPageSize(const QSizeF &size); QColor selectionMarkerColor(){return Qt::transparent;} + void preparePopUpMenu(QMenu &menu); private: void paintGrid(QPainter *ppainter); void initColumnsPos(QVector&posByColumns, qreal pos, int columnCount); diff --git a/limereport/serializators/lrxmlreader.h b/limereport/serializators/lrxmlreader.h index 0bc17ee..c0f3508 100644 --- a/limereport/serializators/lrxmlreader.h +++ b/limereport/serializators/lrxmlreader.h @@ -63,7 +63,6 @@ protected: void readCollection(QObject *item, QDomElement *node); QVariant getValue(QDomElement *node); - protected: bool extractFirstNode(); QString m_error; @@ -72,10 +71,6 @@ private: QDomElement m_curNode; QDomElement m_firstNode; QString m_passPhrase; - - - - }; class FileXMLReader : public XMLReader{ From 6c9b4087238bf7d2857020802fa74057f9d15371 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 28 Feb 2017 23:22:48 +0300 Subject: [PATCH 50/51] misprint has been fixed --- limereport/items/lrtextitem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 664bd20..e36d251 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -101,7 +101,7 @@ void TextItem::preparePopUpMenu(QMenu &menu) action->setCheckable(true); action->setChecked(allowHTMLInFields()); - action = menu.addAction(tr("Strethc to max height")); + action = menu.addAction(tr("Stretch to max height")); action->setCheckable(true); action->setChecked(stretchToMaxHeight()); @@ -121,7 +121,7 @@ void TextItem::processPopUpAction(QAction *action) if (action->text().compare(tr("Allow HTML in fields")) == 0){ setProperty("allowHTMLInFields",action->isChecked()); } - if (action->text().compare(tr("Strethc to max height")) == 0){ + if (action->text().compare(tr("Stretch to max height")) == 0){ setProperty("stretchToMaxHeight",action->isChecked()); } } From e9957bd8b550fa532443a2b9a8711d09b89fd200 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 28 Feb 2017 23:23:33 +0300 Subject: [PATCH 51/51] Russian translation has been updated --- translations/limereport_ru.ts | 1125 ++++++++++++--------------------- 1 file changed, 417 insertions(+), 708 deletions(-) diff --git a/translations/limereport_ru.ts b/translations/limereport_ru.ts index 29eb2f1..8282137 100644 --- a/translations/limereport_ru.ts +++ b/translations/limereport_ru.ts @@ -1,139 +1,6 @@ - - - AboutDialog - - About - О программе - - - Author - Автор - - - License - Лицензия - - - Close - Закрыть - - - Version 1.1.1 - Версия - - - - ConnectionDialog - - Connection - Соединение - - - Connection Name - Название - - - Driver - Драйвер - - - Server - Сервер - - - User - Пользователь - - - Password - Пароль - - - Database - База данных - - - Auto connect - Автоматическое соединение - - - Check connection - Проверить соединение - - - Cancel - Отмена - - - Error - Ошибка - - - Connection succsesfully established! - Соединение успешно установлено! - - - Connection Name is empty - Наименование соединения не указано - - - Connection with name - Соединение - - - already exists - уже существует - - - - DataBrowser - - Datasources - Источники данных - - - Add database connection - Добавить соединение с базой - - - Add new datasource - Добавить новый источник данных - - - View data - Просмотр данных в источнике - - - Change datasource - Изменить источник данных - - - Delete datasource - Удалить источник данных - - - Show error - Показать ошибки - - - Variables - Переменные - - - Add new variable - Добавить новую переменную - - - Edit variable - Редактировать переменную - - - Delete variable - Удалить переменную - - + LRVariableDialog @@ -157,46 +24,31 @@ Внимание - - LimeReport::AVariablesHolder - - variable with name - переменная - - - already exists !! - уже существует !! - - - does not exists !! - не существует !! - - LimeReport::AboutDialog About - О программе + О программе Author - Автор + Автор License - Лицензия + Лицензия Close - Закрыть + Закрыть Version 1.1.1 - Версия + Версия 1.1.1 Lime Report - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> @@ -212,7 +64,7 @@ p, li { white-space: pre-wrap; } <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600; color:#000000;">This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</span></p> <p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt; font-weight:600; color:#000000;"><br /></p> <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; color:#000000;">Copyright 2015 Arin Alexander. All rights reserved.</span></p></body></html> - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> @@ -221,9 +73,9 @@ p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Arin Alexander</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">arin_a@bk.ru</p></body></html> - + - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } @@ -338,7 +190,7 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; font-style:italic; color:#000000;">signature of Ty Coon</span><span style=" font-family:'monospace'; color:#000000;">, 1 April 1990</span></p> <p style=" margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'monospace'; color:#000000;">Ty Coon, President of Vice</span></p> <p style=" margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'sans-serif'; color:#000000; background-color:#ffffff;">That's all there is to it!</span></p></body></html> - + @@ -382,76 +234,127 @@ p, li { white-space: pre-wrap; } connected to соединён с + + Bring to top + На передний план + + + Send to back + На задний план + + + Auto height + Автоматическая высота + + + Splittable + Разбивать содержимое на части + + + + LimeReport::BaseDesignIntf + + Copy + Копировать + + + Cut + Вырезать + + + Paste + Вставить + + + Bring to top + На передний план + + + Send to back + На задний план + + + No borders + Удалить границы + + + All borders + Внешние границы + LimeReport::ConnectionDialog Connection - Соединение + Соединение + + + Use default application connection + Использовать соединение по умолчанию Connection Name - Название + Название Driver - Драйвер + Драйвер Server - Сервер + Сервер User - Пользователь + Пользователь Password - Пароль + Пароль Database - База данных + База данных Auto connect - Автоматическое соединение + Автоматическое соединение Check connection - Проверить соединение + Проверить соединение Cancel - Отмена + Отмена Error - Ошибка + Ошибка Connection succsesfully established! - Соединение успешно установлено! + Соединение успешно установлено! Connection Name is empty - Наименование соединения не указано + Наименование соединения не указано Connection with name - Соединение + Соединение already exists - уже существует + уже существует ... - + Ok - + Ок @@ -468,6 +371,17 @@ p, li { white-space: pre-wrap; } Данные + + LimeReport::ScriptBrowser + + Functions + Функции + + + Dialogs + Диалоги + + LimeReport::DataBrowser @@ -476,43 +390,43 @@ p, li { white-space: pre-wrap; } Add database connection - Добавить соединение с базой + Добавить соединение с базой Add new datasource - Добавить новый источник данных + Добавить новый источник данных View data - Просмотр данных в источнике + Просмотр данных в источнике Change datasource - Изменить источник данных + Изменить источник данных Delete datasource - Удалить источник данных + Удалить источник данных Show error - Показать ошибки + Показать ошибки Variables - Переменные + Переменные Add new variable - Добавить новую переменную + Добавить новую переменную Edit variable - Редактировать переменную + Редактировать переменную Delete variable - Удалить переменную + Удалить переменную Attention @@ -523,46 +437,42 @@ p, li { white-space: pre-wrap; } Do you really want delete "%1" connection ? Вы действительно хотите удалить "%1" соединение ? - - User variables - Пользовательские переменные - System variables Системные переменные + + User variables + Пользовательские переменные + Do you really want to delete "%1" datasource ? Do you really want delete "%1" datasource ? Вы действительно хотите удалить источник данных "%1" ? - - Do you really want delete variable "%1" ? - Вы действительно хотите удалить переменную "%1" ? - Error Ошибка ... - + Do you really want to delete variable "%1" ? - + Вы действительно хотите удалить переменную "%1" ? Grab variable - + Захватить переменную Report variables - + Переменные отчета External variables - + Внешние переменные @@ -604,7 +514,7 @@ p, li { white-space: pre-wrap; } Variable "%1" not found! - + Переменная "%1" не найдена! @@ -759,7 +669,7 @@ p, li { white-space: pre-wrap; } All borders - Внешние границы + Все границы @@ -787,17 +697,6 @@ p, li { white-space: pre-wrap; } Объекты - - LimeReport::PageDesignIntf - - Warning - Предупреждение - - - Multi band deletion not allowed - Удаление нескольких бандов запрещено - - LimeReport::PageFooter @@ -816,126 +715,110 @@ p, li { white-space: pre-wrap; } LimeReport::PreviewReportWidget Form - + Форма PDF file name - Имя PDF файла + Имя PDF файла Report file name - Файл отчета + Имя файла отчета LimeReport::PreviewReportWindow View - Просмотр + Просмотр Report - Отчет + Отчет toolBar - Панель инструментов + Панель инструментов Print - Печать + Печать Zoom In - Увеличить + Увеличить Zoom Out - Уменьшить + Уменьшить Prior Page - Предыдущая страница + Предыдущая страница Next Page - Следующая страница + Следующая страница Close Preview - Закрыть + Закрыть Edit Mode - Режим редактирования + Режим редактирования Save to file - Записать в файл + Сохранить в файл Show errors - Показать ошибки + Показать ошибки First Page - Первая страница + Первая страница First page - Первая страница + Первая страница Last Page - Последняя страница + Последняя страница Print To PDF - Печать в PDF + Печать в PDF Page: - Страница: + Страница: of %1 - из %1 - - - Report file name - Файл отчета - - - PDF file name - Имя PDF файла + из %1 Preview - + Предосмотр Ctrl+P - + Fit page width - + По ширине страницы Fit page - + Страница целиком One to one - - - - Font - Шрифт - - - Text align - + Один к одному @@ -955,21 +838,61 @@ p, li { white-space: pre-wrap; } Property value Значение + + fullPage + Страница целиком + + + gridStep + Шаг сетки + + + oldPrintMode + Старый режим печати + + + resourcePath + Путь к ресурсам + + + autoSize + Автоматический размер + + + center + Центрировать + + + field + Поле + + + image + Изображение + + + keepAspectRatio + Сохранять соотношение сторон + + + scale + Масштабировать + leftMargin - Отступ левый + Левый отступ rightMargin - Отступ правый + Правый отступ topMargin - Отступ верхний + Верхний отступ bottomMargin - Отступ нижний + Нижний отступ objectName @@ -979,13 +902,25 @@ p, li { white-space: pre-wrap; } borders Границы + + condition + Условие + + + keepGroupTogether + Сохранять группу вместе + + + groupFieldName + Столбец группы + geometry Геометрия itemAlign - Расположение объекта + Выравнивание объекта pageOrientation @@ -1013,19 +948,19 @@ p, li { white-space: pre-wrap; } datasource - источник данных + Источник данных alignment - расположение + Выравнивание content - содержимое + Содержимое itemLocation - Расположение объекта + Расположение объекта Warning @@ -1033,115 +968,187 @@ p, li { white-space: pre-wrap; } reprintOnEachPage - + Печатать на каждой странице borderLineSize - + Ширина линии границы + + + textIndent + Отступ текста + + + textLayoutDirection + Направление текста + + + lineSpacing + Межстрочный интервал + + + underlines + Подчеркивание + + + underlineLineSize + Толщина подчеркивания + + + format + Формат + + + valueType + Тип значения + + + adaptFontToSize + Шрифт по размеру + + + followTo + Следует за + + + backgroundBrushStyle + Стиль заполнения фона autoHeight - + Автоматическая высота backgroundColor - + Цвет фона - columnCount - + alternateBackgroundColor + Альтернативный цвет фона + + + columnsCount + Количество столбцов columnsFillDirection - + Направление заполнения столбцов keepBottomSpace - + Сохранять отступ снизу keepFooterTogether - + Привязать колонтитул к данным keepSubdetailTogether - + Привязать подчиненные данные printIfEmpty - + Печатать, если пустое sliceLastRow - + Разрезать последнюю запись splittable - + Разбивать содержимое на части angle - + Угол поворота autoWidth - + Автоматическая ширина backgroundMode - + Режим фона backgroundOpacity - + Заполненость фона font - + Шрифт fontColor - + Цвет шрифта foregroundOpacity - + Заполненость переднего плана margin - + Поля stretchToMaxHeight - + Растягивать до максимальной высоты trimValue - + Обрезать пробелы с краев lineWidth - + Ширина линии opacity - + Заполненость penStyle - + Стиль пера shape - + Фигура shapeBrush - + Кисть фигуры shapeBrushColor - + Цвет кисти + + + allowHTML + Разрешить HTML + + + allowHTMLInFields + Разрешить HTML в полях + + + printAlways + Печатать всегда + + + borderColor + Цвет границ + + + startNewPage + Начинать новую страницу + + + startFromNewPage + Начинать с новой страницы + + + resetPageNumber + Обнулять номер страницы @@ -1172,22 +1179,6 @@ p, li { white-space: pre-wrap; } Report file name Файл отчета - - Page - - - - Script - - - - Error - Ошибка - - - Wrong file format - - LimeReport::ReportDesignWindow @@ -1207,6 +1198,14 @@ p, li { white-space: pre-wrap; } Redo Повторить действие + + New Report Page + Новая страница отчета + + + Delete Report Page + Удалить страницу отчета + Copy Копировать @@ -1355,6 +1354,10 @@ p, li { white-space: pre-wrap; } GroupFooter Завершение группы + + Tear-off Band + Отрыв данных + File Файл @@ -1379,9 +1382,13 @@ p, li { white-space: pre-wrap; } Data Browser Инспектор данных + + Script Browser + Инспектор скриптов + Report has been modified ! Do you want save the report ? - Отчет был изменен ! Хотите его записать ? + Отчет был изменен ! Хотите его сохранить ? Report file name @@ -1393,39 +1400,27 @@ p, li { white-space: pre-wrap; } Abort - О генераторе + Прервать page rendered - создается страница + создается страница Warning - Предупреждение + Предупреждение Use magnet - + Использовать магнит Recent Files - + Последние файлы File "%1" not found! - - - - New Report Page - - - - Delete Report Page - - - - Script Browser - + Файл "%1" не найден! @@ -1436,7 +1431,7 @@ p, li { white-space: pre-wrap; } Preview - + Предосмотр @@ -1472,153 +1467,99 @@ p, li { white-space: pre-wrap; } LimeReport::SQLEditDialog Datasource - Источник данных + Источник данных Connection - Соединение + Соединение Datasource Name - Имя источника + Имя источника Subdetail - Подчиненный + Подчиненный Master datasource - Главный источник + Главный источник Subquery mode - Режим подзапроса + Режим подзапроса Filter mode - Режим фильтрации + Режим фильтрации SQL - SQL запрос + SQL запрос Hide Preview - Скрыть + Скрыть Child datasource - Подчиненный источник + Подчиненный источник Fields map - Поля для связи источников + Поля для связи источников Data preview - Данные + Данные Cancel - Отмена + Отмена Error - Ошибка + Ошибка Datasource Name is empty ! - Имя источника данных не заполнено ! + Имя источника данных не заполнено ! SQL is empty ! - SQL запрос пустой ! + SQL запрос пустой ! Datasource with name: "%1" already exists ! - Источник данных с именем: "%1" уже существует ! + Источник данных с именем: "%1" уже существует ! Datasource with name %1 already exist - Источник данных с именем: "%1" уже существует + Источник данных с именем: "%1" уже существует Attention - Внимание + Внимание Connection is not specified - Соединение не указано + Соединение не указано Refresh - Обновить + Обновить Preview - + Предосмотр ... - + Ok - - - - - LimeReport::ScriptBrowser - - Form - - - - Functions - Функции - - - ... - - - - Dialogs - - - - Type - Тип - - - Name - Имя переменной - - - NO CATEGORY - - - - Error - Ошибка - - - Dialog with name: %1 already exists - - - - ui file must cointain QDialog instead QWidget or QMainWindow - - - - wrong file format - - - - - LimeReport::ScriptEngineContext - - Dialog with name: %1 can`t be created - + Ок @@ -1645,34 +1586,34 @@ p, li { white-space: pre-wrap; } Locale - + Локализация CurrencySymbol - + Символ валюты LimeReport::SettingDialog Designer setting - Настройки дизайнера + Настройки дизайнера Default font - Шрифт по умолчанию + Шрифт по умолчанию Grid - Сетка + Сетка Vertical grid step - Вертикальный шаг + Вертикальный шаг сетки Horizontal grid step - Горизонтальный шаг + Горизонтальный шаг сетки @@ -1716,153 +1657,101 @@ p, li { white-space: pre-wrap; } Прижать к нижнему краю + + LimeReport::TextItem + + Edit + Правка + + + Auto height + Автоматическая высота + + + Allow HTML + Разрешить HTML + + + Allow HTML in fields + Разрешить HTML в полях + + + Stretch to max height + Растягивать до максимальной высоты + + + Error + Ошибка + + + TextItem " %1 " already has folower " %2 " + Текстовый элемент "%1" уже следует за "%2" + + + TextItem " %1 " not found ! + Текстовый элемент "%1" не найден! + + LimeReport::TextItemEditor Text Item Editor - Редактор текстового элемента + Редактор текстового элемента Content - Содержимое + Содержимое Functions - Функции + Функции Editor settings - Настройки + Настройки Editor font - Шрифт редактора + Шрифт редактора Cancel - Отмена + Отмена Data - + Данные ... - + Ok - + Ок Ctrl+Return - + Esc - + LimeReport::VariablesHolder variable with name - переменная + переменная already exists !! - уже существует !! + уже существует !! does not exists !! - не существует !! - - - - PreviewReportWindow - - Preview - Предварительный просмотр - - - View - Просмотр - - - Report - Отчет - - - toolBar - Панель инструментов - - - Print - Печать - - - Zoom In - Увеличить - - - Zoom Out - Уменьшить - - - Prior Page - Предыдущая страница - - - Next Page - Следующая страница - - - Close Preview - Закрыть - - - Edit Mode - Режим редактирования - - - Save to file - Записать в файл - - - Show errors - Показать ошибки - - - First Page - Первая страница - - - First page - Первая страница - - - Last Page - Последняя страница - - - Print To PDF - Печать в PDF - - - Page: - Страница: - - - of %1 - из %1 - - - Report file name - Файл отчета - - - PDF file name - Имя PDF файла + не существует !! @@ -1917,7 +1806,7 @@ p, li { white-space: pre-wrap; } alignment - расположение + Выравнивание объекта Barcode Item @@ -1947,10 +1836,6 @@ p, li { white-space: pre-wrap; } Invalid connection! %1 Неверное соединение %1 - - Master datasource "%1" not found! - Главный источник данных "%1" не найден! - Child Подчиненный @@ -2007,237 +1892,61 @@ p, li { white-space: pre-wrap; } File %1 not opened Файл %1 не открыт - - TopLine - Верхняя граница - - - BottomLine - Нижняя граница - - - LeftLine - Левая граница - - - RightLine - Правая граница - content содержимое Master datasource "%1" not found!!! - + Главный источник данных "%1" не найден! Master datasouce "%1" not found! - + Главный источник данных "%1" не найден! bool - + QColor - + QFont - + QImage - + int - + qreal - + QRect - + QRectF - + QString - + Content string is empty - + Строка содержимого пустая Content is empty - - - - Wrong file format - - - - - SQLEditDialog - - Datasource - Источник данных - - - Connection - Соединение - - - Datasource Name - Имя источника - - - Subdetail - Подчиненный - - - Master datasource - Главный источник - - - Subquery mode - Режим подзапроса - - - Filter mode - Режим фильтрации - - - SQL - SQL запрос - - - Preview - Предпросмотр - - - Hide Preview - Скрыть - - - Child datasource - Подчиненный источник - - - Fields map - Поля для связи источников - - - Data preview - Данные - - - Cancel - Отмена - - - Error - Ошибка - - - Datasource Name is empty ! - Имя источника данных не заполнено ! - - - SQL is empty ! - SQL запрос пустой ! - - - Datasource with name: "%1" already exists ! - Источник данных с именем: "%1" уже существует ! - - - Datasource with name %1 already exist - Источник данных с именем: "%1" уже существует - - - Attention - Внимание - - - Connection is not specified - Соединение не указано - - - Refresh - Обновить - - - - SettingDialog - - Designer setting - Настройки дизайнера - - - Default font - Шрифт по умолчанию - - - Grid - Сетка - - - Vertical grid step - Вертикальный шаг - - - Horizontal grid step - Горизонтальный шаг - - - - TextItemEditor - - Text Item Editor - Редактор текстового элемента - - - Content - Содержимое - - - Data - Источники данных - - - Functions - Функции - - - Editor settings - Настройки - - - Editor font - Шрифт редактора - - - Cancel - Отмена - - - - WaitForm - - Wait - Ожидайте - - - Please wait ... - Пожалуста подождите ... + Содержимое пустое