From fecf863f7c407386f36b41fd5c3cf3bb0136d4aa Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 10 Jun 2016 19:05:18 +0400 Subject: [PATCH] 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 ... - Пожалуста подождите ... + Пожалуста подождите ...