0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 00:33:02 +03:00

Version 1.4 initial commit

This commit is contained in:
Arin Alexander 2016-06-10 19:05:18 +04:00
parent 6a507e5b61
commit fecf863f7c
61 changed files with 2019 additions and 276 deletions

View File

@ -60,6 +60,10 @@ private:
class DataSourceManager; class DataSourceManager;
class ReportEnginePrivate; class ReportEnginePrivate;
class PageDesignIntf;
class PageItemDesignIntf;
typedef QList< QSharedPointer<PageItemDesignIntf> > ReportPages;
class LIMEREPORT_EXPORT ReportEngine : public QObject{ class LIMEREPORT_EXPORT ReportEngine : public QObject{
Q_OBJECT Q_OBJECT
@ -69,7 +73,9 @@ public:
explicit ReportEngine(QObject *parent = 0); explicit ReportEngine(QObject *parent = 0);
~ReportEngine(); ~ReportEngine();
bool printReport(QPrinter *printer=0); bool printReport(QPrinter *printer=0);
bool printPages(ReportPages pages, QPrinter *printer, PrintRange printRange = PrintRange());
void printToFile(const QString& fileName); void printToFile(const QString& fileName);
PageDesignIntf *createPreviewScene(QObject *parent = 0);
bool printToPDF(const QString& fileName); bool printToPDF(const QString& fileName);
void previewReport(); void previewReport();
void designReport(); void designReport();

View File

@ -779,13 +779,3 @@ void DataBrowser::on_variablesTree_itemDoubleClicked(QTreeWidgetItem *item, int
} }
} // namespace LimeReport } // namespace LimeReport

Binary file not shown.

After

Width:  |  Height:  |  Size: 679 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -41,6 +41,16 @@ FontEditorWidget::FontEditorWidget(ReportDesignWidget *reportEditor, QWidget *pa
initEditor(); initEditor();
} }
FontEditorWidget::FontEditorWidget(PageDesignIntf *page, const QString &title, QWidget *parent)
:ItemEditorWidget(page,title,parent), m_ignoreSlots(false) {
initEditor();
}
FontEditorWidget::FontEditorWidget(LimeReport::PageDesignIntf *page, QWidget *parent)
:ItemEditorWidget(page,parent), m_ignoreSlots(false){
initEditor();
}
void FontEditorWidget::setItemEvent(BaseDesignIntf* item) void FontEditorWidget::setItemEvent(BaseDesignIntf* item)
{ {
@ -116,22 +126,26 @@ void FontEditorWidget::slotFontChanged(const QFont &font)
void FontEditorWidget::slotFontSizeChanged(const QString &value) void FontEditorWidget::slotFontSizeChanged(const QString &value)
{ {
if (reportEditor() && !m_ignoreSlots){ if (m_ignoreSlots) return;
QFont resFont(m_fontNameEditor->currentFont());
QFont resFont(fontNameEditor()->currentFont());
resFont.setPointSize(value.toInt()); resFont.setPointSize(value.toInt());
reportEditor()->setFont(resFont);
} if (reportEditor()) reportEditor()->setFont(resFont);
if (page()) page()->setFont(resFont);
} }
void FontEditorWidget::slotFontAttribsChanged(bool) void FontEditorWidget::slotFontAttribsChanged(bool)
{ {
if (reportEditor()&& !m_ignoreSlots){ if (m_ignoreSlots) return;
QFont resFont(m_fontNameEditor->currentFont()); QFont resFont(m_fontNameEditor->currentFont());
resFont.setBold(m_fontBold->isChecked()); resFont.setBold(m_fontBold->isChecked());
resFont.setItalic(m_fontItalic->isChecked()); resFont.setItalic(m_fontItalic->isChecked());
resFont.setUnderline(m_fontUnderline->isChecked()); resFont.setUnderline(m_fontUnderline->isChecked());
reportEditor()->setFont(resFont); 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) void FontEditorWidget::slotPropertyChanged(const QString &objectName, const QString &property, const QVariant& oldValue, const QVariant& newValue)

View File

@ -45,8 +45,11 @@ class FontEditorWidget :public ItemEditorWidget{
public: public:
explicit FontEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0); explicit FontEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0);
explicit FontEditorWidget(ReportDesignWidget* reportEditor, 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: protected:
void setItemEvent(BaseDesignIntf *item); void setItemEvent(BaseDesignIntf *item);
QFontComboBox* fontNameEditor(){return m_fontNameEditor;}
private slots: private slots:
void slotFontChanged(const QFont& font); void slotFontChanged(const QFont& font);
void slotFontSizeChanged(const QString& value); void slotFontSizeChanged(const QString& value);

View File

@ -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) void ShapeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{ {
painter->save(); painter->save();
QPen pen(m_shapeColor); 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) BaseDesignIntf *ShapeItem::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
{ {
return new ShapeItem(owner,parent); return new ShapeItem(owner,parent);

View File

@ -150,20 +150,45 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q
break; break;
} }
// for(QTextBlock it=m_text->begin();it!=m_text->end();it=it.next()){ int lineHeight = painter->fontMetrics().height();
// for (int i=0;i<it.layout()->lineCount();i++){ qreal curpos = 0;
// painter->setOpacity(qreal(foregroundOpacity())/100);
// it.layout()->lineAt(i).draw(painter,QPointF(0,0)); if (m_underlines){
// } QPen pen = painter->pen();
// } pen.setWidth(m_underlineLineSize);
painter->setPen(pen);
}
painter->setOpacity(qreal(foregroundOpacity())/100); painter->setOpacity(qreal(foregroundOpacity())/100);
//m_text->setDefaultTextOption();
QAbstractTextDocumentLayout::PaintContext ctx; QAbstractTextDocumentLayout::PaintContext ctx;
ctx.palette.setColor(QPalette::Text, fontColor()); 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;i<it.layout()->lineCount();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); m_text->documentLayout()->draw(painter,ctx);
if (m_underlines){
if (lineHeight<0) lineHeight = painter->fontMetrics().height();
for (curpos+=lineHeight; curpos<rect().height();curpos+=lineHeight){
painter->drawLine(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),); // m_layout.draw(ppainter,QPointF(marginSize(),0),);
// ppainter->setFont(transformToSceneFont(font())); // ppainter->setFont(transformToSceneFont(font()));
// QTextOption o; // QTextOption o;
@ -186,6 +211,10 @@ void TextItem::Init()
// m_text->setDefaultFont(transformToSceneFont(font())); // m_text->setDefaultFont(transformToSceneFont(font()));
m_textSize=QSizeF(); m_textSize=QSizeF();
m_foregroundOpacity = 100; m_foregroundOpacity = 100;
m_underlines = false;
m_adaptFontToSize = false;
m_underlineLineSize = 1;
m_lineSpacing = 1;
} }
void TextItem::setContent(const QString &value) void TextItem::setContent(const QString &value)
@ -204,9 +233,9 @@ void TextItem::setContent(const QString &value)
} }
if (!isLoading()){ if (!isLoading()){
initText();
update(rect()); update(rect());
notify("content",oldValue,value); notify("content",oldValue,value);
//updateLayout();
} }
} }
} }
@ -223,7 +252,7 @@ void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, i
} }
if ((m_textSize.height()>height()) && (m_autoHeight) ){ if ((m_textSize.height()>height()) && (m_autoHeight) ){
setHeight(m_textSize.height()+5); setHeight(m_textSize.height()+borderLineSize()*2);
} }
BaseDesignIntf::updateItemSize(dataManager, pass, maxHeight); BaseDesignIntf::updateItemSize(dataManager, pass, maxHeight);
} }
@ -262,23 +291,91 @@ QString TextItem::replaceReturns(QString text)
return result; 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() void TextItem::initText()
{ {
QTextOption to; QTextOption to;
to.setAlignment(m_alignment); to.setAlignment(m_alignment);
if (m_autoWidth!=MaxStringLength) if (m_autoWidth!=MaxStringLength)
if (m_adaptFontToSize && (!(m_autoHeight || m_autoWidth)))
to.setWrapMode(QTextOption::WordWrap);
else
to.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); to.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
else to.setWrapMode(QTextOption::NoWrap); else to.setWrapMode(QTextOption::NoWrap);
m_text->setDocumentMargin(0); m_text->setDocumentMargin(0);
m_text->setDefaultTextOption(to); 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)){ if ((m_angle==Angle0)||(m_angle==Angle180)){
m_text->setTextWidth(rect().width()-fakeMarginSize()*2); m_text->setTextWidth(rect().width()-fakeMarginSize()*2);
} else { } else {
m_text->setTextWidth(rect().height()-fakeMarginSize()*2); 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(); m_textSize=m_text->size();
} }
@ -320,9 +417,11 @@ bool TextItem::trimValue() const
return m_trimValue; 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 { // } else {
// m_text->setTextWidth(rect().height()-fakeMarginSize()*2); // m_text->setTextWidth(rect().height()-fakeMarginSize()*2);
// } // }
// m_textSize=m_text->size();
if (itemMode() == DesignMode) initText(); if (itemMode() == DesignMode) initText();
else if (adaptFontToSize()) initText();
} }
bool TextItem::isNeedUpdateSize(RenderPass pass) const 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 bool TextItem::canBeSplitted(int height) const
{ {
return height>(m_text->begin().layout()->lineAt(0).height()); 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 (QTextBlock it=m_text->begin();it!=m_text->end();it=it.next()){
for (int i=0;i<it.layout()->lineCount();i++){ for (int i=0;i<it.layout()->lineCount();i++){
linesHeight+=it.layout()->lineAt(i).height(); linesHeight+=it.layout()->lineAt(i).height()+lineSpacing();
if (linesHeight>(height-(fakeMarginSize()*2+borderLineSize()*2))) {linesHeight-=it.layout()->lineAt(i).height(); goto loop_exit;} 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'; 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 (curBlock=m_text->begin();curBlock!=m_text->end();curBlock=curBlock.next()){
for (curLine=0;curLine<curBlock.layout()->lineCount();curLine++){ for (curLine=0;curLine<curBlock.layout()->lineCount();curLine++){
linesHeight+=curBlock.layout()->lineAt(curLine).height(); linesHeight+=curBlock.layout()->lineAt(curLine).height()+lineSpacing();
if (linesHeight>(height-(fakeMarginSize()*2+borderLineSize()*2))) {goto loop_exit;} 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 } //namespace LimeReport

View File

@ -56,7 +56,11 @@ class TextItem : public LimeReport::ContentItemDesignIntf {
Q_PROPERTY(QColor fontColor READ fontColor WRITE setFontColorProperty) Q_PROPERTY(QColor fontColor READ fontColor WRITE setFontColorProperty)
Q_PROPERTY(AngleType angle READ angle WRITE setAngle) Q_PROPERTY(AngleType angle READ angle WRITE setAngle)
Q_PROPERTY(int foregroundOpacity READ foregroundOpacity WRITE setForegroundOpacity) 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(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 allowHTML READ allowHTML WRITE setAllowHTML)
Q_PROPERTY(bool allowHTMLInFields READ allowHTMLInFields WRITE setAllowHTMLInFields) Q_PROPERTY(bool allowHTMLInFields READ allowHTMLInFields WRITE setAllowHTMLInFields)
public: public:
@ -72,9 +76,6 @@ public:
QString content() const; QString content() const;
void setContent(const QString& value); void setContent(const QString& value);
//void setMarginSize(int value);
void setAlignment(Qt::Alignment value); void setAlignment(Qt::Alignment value);
Qt::Alignment alignment(){return m_alignment;} Qt::Alignment alignment(){return m_alignment;}
@ -89,6 +90,9 @@ public:
void setAutoWidth(AutoWidth value); void setAutoWidth(AutoWidth value);
AutoWidth autoWidth() const {return m_autoWidth;} AutoWidth autoWidth() const {return m_autoWidth;}
void setAdaptFontToSize(bool value);
bool adaptFontToSize() const {return m_adaptFontToSize;}
bool canBeSplitted(int height) const; bool canBeSplitted(int height) const;
bool isSplittable() const { return true;} bool isSplittable() const { return true;}
bool isEmpty() const{return m_text->isEmpty();} bool isEmpty() const{return m_text->isEmpty();}
@ -108,10 +112,18 @@ public:
void setAngle(const AngleType& value); void setAngle(const AngleType& value);
int foregroundOpacity(){return m_foregroundOpacity;} int foregroundOpacity(){return m_foregroundOpacity;}
void setForegroundOpacity(int value); void setForegroundOpacity(int value);
bool underlines(){return m_underlines;}
void setUnderlines(bool value);
bool trimValue() const; bool trimValue() const;
void setTrimValue(bool trimValue); void setTrimValue(bool trimValue);
int lineSpacing() const;
void setLineSpacing(int value);
int underlineLineSize() const;
void setUnderlineLineSize(int value);
bool allowHTML() const; bool allowHTML() const;
void setAllowHTML(bool allowHTML); void setAllowHTML(bool allowHTML);
@ -126,6 +138,8 @@ protected:
int fakeMarginSize(); int fakeMarginSize();
private: private:
void initText(); void initText();
void setTextFont(const QFont &value);
void adaptFontSize();
private: private:
QString m_strText; QString m_strText;
@ -137,7 +151,11 @@ private:
QSizeF m_textSize; QSizeF m_textSize;
AngleType m_angle; AngleType m_angle;
int m_foregroundOpacity; int m_foregroundOpacity;
bool m_underlines;
bool m_adaptFontToSize;
bool m_trimValue; bool m_trimValue;
int m_lineSpacing;
int m_underlineLineSize;
bool m_allowHTML; bool m_allowHTML;
bool m_allowHTMLInFields; bool m_allowHTMLInFields;
}; };

View File

@ -87,7 +87,8 @@ SOURCES += \
$$REPORT_PATH/lrgroupfunctions.cpp \ $$REPORT_PATH/lrgroupfunctions.cpp \
$$REPORT_PATH/lrsimplecrypt.cpp \ $$REPORT_PATH/lrsimplecrypt.cpp \
$$REPORT_PATH/lraboutdialog.cpp \ $$REPORT_PATH/lraboutdialog.cpp \
$$REPORT_PATH/lrsettingdialog.cpp $$REPORT_PATH/lrsettingdialog.cpp \
$$REPORT_PATH/scriptbrowser/lrscriptbrowser.cpp
contains(CONFIG, zint){ contains(CONFIG, zint){
SOURCES += $$REPORT_PATH/items/lrbarcodeitem.cpp SOURCES += $$REPORT_PATH/items/lrbarcodeitem.cpp
@ -183,7 +184,8 @@ HEADERS += \
$$REPORT_PATH/lraboutdialog.h \ $$REPORT_PATH/lraboutdialog.h \
$$REPORT_PATH/lrcallbackdatasourceintf.h \ $$REPORT_PATH/lrcallbackdatasourceintf.h \
$$REPORT_PATH/lrsettingdialog.h \ $$REPORT_PATH/lrsettingdialog.h \
$$PWD/lrpreviewreportwidget_p.h $$REPORT_PATH/lrpreviewreportwidget_p.h \
$$REPORT_PATH/scriptbrowser/lrscriptbrowser.h \
contains(CONFIG,zint){ contains(CONFIG,zint){
HEADERS += $$REPORT_PATH/items/lrbarcodeitem.h HEADERS += $$REPORT_PATH/items/lrbarcodeitem.h
@ -199,11 +201,13 @@ FORMS += \
$$REPORT_PATH/lrpreviewreportwidget.ui \ $$REPORT_PATH/lrpreviewreportwidget.ui \
$$REPORT_PATH/items/lrtextitemeditor.ui \ $$REPORT_PATH/items/lrtextitemeditor.ui \
$$REPORT_PATH/lraboutdialog.ui \ $$REPORT_PATH/lraboutdialog.ui \
$$REPORT_PATH/lrsettingdialog.ui $$REPORT_PATH/lrsettingdialog.ui \
$$REPORT_PATH/scriptbrowser/lrscriptbrowser.ui \
RESOURCES += \ RESOURCES += \
$$REPORT_PATH/objectinspector/lobjectinspector.qrc \ $$REPORT_PATH/objectinspector/lobjectinspector.qrc \
$$REPORT_PATH/databrowser/lrdatabrowser.qrc \ $$REPORT_PATH/databrowser/lrdatabrowser.qrc \
$$REPORT_PATH/report.qrc \ $$REPORT_PATH/report.qrc \
$$REPORT_PATH/items/items.qrc $$REPORT_PATH/items/items.qrc \
$$REPORT_PATH/scriptbrowser/lrscriptbrowser.qrc

View File

@ -681,6 +681,13 @@ void BandDesignIntf::initMode(ItemMode mode)
BaseDesignIntf::initMode(mode); BaseDesignIntf::initMode(mode);
if ((mode==PreviewMode)||(mode==PrintMode)){ if ((mode==PreviewMode)||(mode==PrintMode)){
m_bandMarker->setVisible(false); 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);
} }
} }

View File

@ -74,8 +74,8 @@ class DataSourceModel : public QAbstractItemModel{
public: public:
DataSourceModel():m_rootNode(new DataNode()){} DataSourceModel():m_rootNode(new DataNode()){}
DataSourceModel(DataSourceManager* dataManager); DataSourceModel(DataSourceManager* dataManager);
QModelIndex index(int row, int column, const QModelIndex &parent) const;
~DataSourceModel(); ~DataSourceModel();
QModelIndex index(int row, int column, const QModelIndex &parent) const;
QModelIndex parent(const QModelIndex &child) const; QModelIndex parent(const QModelIndex &child) const;
int rowCount(const QModelIndex &parent) const; int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const; int columnCount(const QModelIndex &parent) const;

View File

@ -32,6 +32,16 @@ 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) { bool GraphicsViewZoomer::eventFilter(QObject *object, QEvent *event) {
if (event->type() == QEvent::MouseMove) { if (event->type() == QEvent::MouseMove) {
QMouseEvent* mouse_event = static_cast<QMouseEvent*>(event); QMouseEvent* mouse_event = static_cast<QMouseEvent*>(event);

View File

@ -13,6 +13,7 @@ public:
void gentleZoom(double factor); void gentleZoom(double factor);
void setModifiers(Qt::KeyboardModifiers modifiers); void setModifiers(Qt::KeyboardModifiers modifiers);
void setZoomFactorBase(double value); void setZoomFactorBase(double value);
void setView(QGraphicsView* view);
private: private:
QGraphicsView* m_view; QGraphicsView* m_view;
Qt::KeyboardModifiers m_modifiers; Qt::KeyboardModifiers m_modifiers;

View File

@ -123,6 +123,7 @@ namespace LimeReport {
PageItemDesignIntf *pageItem(); PageItemDesignIntf *pageItem();
void setPageItem(PageItemDesignIntf::Ptr pageItem); void setPageItem(PageItemDesignIntf::Ptr pageItem);
void setPageItems(QList<PageItemDesignIntf::Ptr> pages); void setPageItems(QList<PageItemDesignIntf::Ptr> pages);
QList<PageItemDesignIntf::Ptr> pageItems(){return m_reportPages;}
bool isItemInsertMode(); bool isItemInsertMode();
ReportEnginePrivate* reportEditor(); ReportEnginePrivate* reportEditor();

View File

@ -139,5 +139,8 @@ private:
bool m_fullPage; bool m_fullPage;
bool m_oldPrintMode; bool m_oldPrintMode;
}; };
typedef QList<PageItemDesignIntf::Ptr> ReportPages;
} }
#endif // LRPAGEITEM_H #endif // LRPAGEITEM_H

View File

@ -61,12 +61,25 @@ PreviewReportWindow::PreviewReportWindow(ReportEnginePrivate *report,QWidget *pa
setCentralWidget(m_previewReportWidget); setCentralWidget(m_previewReportWidget);
layout()->setContentsMargins(1,1,1,1); layout()->setContentsMargins(1,1,1,1);
connect(m_previewReportWidget,SIGNAL(pageChanged(int)), this,SLOT(slotPageChanged(int)) ); 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 = new QComboBox(this);
m_scalePercent->setEditable(true); m_scalePercent->setEditable(true);
ui->toolBar->insertWidget(ui->actionZoomOut, m_scalePercent); ui->toolBar->insertWidget(ui->actionZoomOut, m_scalePercent);
initPercentCombobox(); 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_previewReportWidget, SIGNAL(scalePercentChanged(int)), this, SLOT(slotScalePercentChanged(int)));
connect(m_scalePercent, SIGNAL(currentIndexChanged(QString)), this, SLOT(scaleComboboxChanged(QString))); connect(m_scalePercent, SIGNAL(currentIndexChanged(QString)), this, SLOT(scaleComboboxChanged(QString)));
restoreSetting(); restoreSetting();
@ -209,6 +222,12 @@ void PreviewReportWindow::moveEvent(QMoveEvent* e)
#endif #endif
} }
void PreviewReportWindow::showEvent(QShowEvent *)
{
m_fontEditor->setVisible(ui->actionEdit_Mode->isChecked());
m_textAlignmentEditor->setVisible(ui->actionEdit_Mode->isChecked());
}
void PreviewReportWindow::slotPrint() void PreviewReportWindow::slotPrint()
{ {
m_previewReportWidget->print(); m_previewReportWidget->print();
@ -244,6 +263,28 @@ void PreviewReportWindow::slotShowErrors()
m_previewReportWidget->setErrorsMesagesVisible(ui->actionShowMessages->isChecked()); 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<QGraphicsScene*>(sender());
if (page){
if (page->selectedItems().count()==1){
BaseDesignIntf* item = dynamic_cast<BaseDesignIntf*>(page->selectedItems().at(0));
if (item) {
m_fontEditor->setItem(item);
m_textAlignmentEditor->setItem(item);
}
}
}
}
ItemsReaderIntf *PreviewReportWindow::reader() ItemsReaderIntf *PreviewReportWindow::reader()
{ {
return m_reader.data(); return m_reader.data();

View File

@ -41,6 +41,9 @@
#include "serializators/lrxmlreader.h" #include "serializators/lrxmlreader.h"
#include "lrpreviewreportwidget.h" #include "lrpreviewreportwidget.h"
#include "items/editors/lrfonteditorwidget.h"
#include "items/editors/lrtextalignmenteditorwidget.h"
namespace LimeReport { namespace LimeReport {
namespace Ui { namespace Ui {
@ -66,6 +69,7 @@ protected:
void closeEvent(QCloseEvent *); void closeEvent(QCloseEvent *);
void resizeEvent(QResizeEvent *e); void resizeEvent(QResizeEvent *e);
void moveEvent(QMoveEvent *e); void moveEvent(QMoveEvent *e);
void showEvent(QShowEvent *);
public slots: public slots:
void slotPrint(); void slotPrint();
void slotPriorPage(); void slotPriorPage();
@ -75,6 +79,8 @@ public slots:
void slotPageNavigatorChanged(int value); void slotPageNavigatorChanged(int value);
void slotShowErrors(); void slotShowErrors();
void on_actionSaveToFile_triggered(); void on_actionSaveToFile_triggered();
void slotSelectionChanged();
void on_actionEdit_Mode_triggered(bool checked);
void slotFirstPage(); void slotFirstPage();
void slotLastPage(); void slotLastPage();
void slotPrintToPDF(); void slotPrintToPDF();
@ -90,8 +96,6 @@ private slots:
private: private:
ItemsReaderIntf* reader(); ItemsReaderIntf* reader();
void initPercentCombobox(); void initPercentCombobox();
//bool pageIsVisible(PageItemDesignIntf::Ptr page);
//QRectF calcPageShift(PageItemDesignIntf::Ptr page);
private: private:
Ui::PreviewReportWindow *ui; Ui::PreviewReportWindow *ui;
QSpinBox* m_pagesNavigator; QSpinBox* m_pagesNavigator;
@ -100,6 +104,9 @@ private:
bool m_changingPage; bool m_changingPage;
QSettings* m_settings; QSettings* m_settings;
bool m_ownedSettings; bool m_ownedSettings;
FontEditorWidget* m_fontEditor;
TextAlignmentEditorWidget* m_textAlignmentEditor;
int m_priorScrolValue;
PreviewReportWidget* m_previewReportWidget; PreviewReportWidget* m_previewReportWidget;
QComboBox* m_scalePercent; QComboBox* m_scalePercent;
}; };

View File

@ -73,6 +73,8 @@
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
<addaction name="actionPrint"/> <addaction name="actionPrint"/>
<addaction name="actionEdit_Mode"/>
<addaction name="actionSaveToFile"/>
<addaction name="actionPrint_To_PDF"/> <addaction name="actionPrint_To_PDF"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionZoomIn"/> <addaction name="actionZoomIn"/>

View File

@ -41,6 +41,8 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QFileDialog> #include <QFileDialog>
#include <QApplication> #include <QApplication>
#include <QTabWidget>
#include <QMessageBox>
namespace LimeReport { namespace LimeReport {
@ -49,11 +51,10 @@ namespace LimeReport {
ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow *mainWindow, QWidget *parent) : ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow *mainWindow, QWidget *parent) :
QWidget(parent), m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false) QWidget(parent), m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false)
{ {
m_tabWidget = new QTabWidget(this);
m_tabWidget->setTabPosition(QTabWidget::South);
QVBoxLayout* mainLayout = new QVBoxLayout(this); QVBoxLayout* mainLayout = new QVBoxLayout(this);
mainLayout->setContentsMargins(1,1,1,1); mainLayout->addWidget(m_tabWidget);
m_view = new QGraphicsView(qobject_cast<QWidget*>(this));
m_view->setBackgroundBrush(QBrush(Qt::gray));
mainLayout->addWidget(m_view);
setLayout(mainLayout); setLayout(mainLayout);
if (!report) { if (!report) {
@ -66,16 +67,15 @@ ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow
if (!m_report->pageCount()) m_report->appendPage("page1"); if (!m_report->pageCount()) m_report->appendPage("page1");
} }
setActivePage(m_report->pageAt(0)); createTabs();
foreach(QGraphicsItem* item, activePage()->selectedItems()){
item->setSelected(false);
}
connect(m_report,SIGNAL(pagesLoadFinished()),this,SLOT(slotPagesLoadFinished())); connect(m_report,SIGNAL(pagesLoadFinished()),this,SLOT(slotPagesLoadFinished()));
connect(m_report,SIGNAL(cleared()),this,SIGNAL(cleared())); 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_instance=this;
//m_view->viewport()->installEventFilter(this); m_scriptEditor->setPlainText(report->scriptContext()->initScript());
m_zoomer = new GraphicsViewZoomer(m_view); m_zoomer = new GraphicsViewZoomer(activeView());
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
m_defaultFont = QFont("Arial",10); m_defaultFont = QFont("Arial",10);
#endif #endif
@ -133,20 +133,43 @@ void ReportDesignWidget::loadState(QSettings* settings)
if (v.isValid()){ if (v.isValid()){
m_useGrid = v.toBool(); m_useGrid = v.toBool();
} }
settings->endGroup(); settings->endGroup();
applySettings(); applySettings();
} }
void ReportDesignWidget::createTabs(){
for (int i = 0; i<m_report->pageCount();++i){
QGraphicsView* view = new QGraphicsView(qobject_cast<QWidget*>(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() ReportDesignWidget::~ReportDesignWidget()
{ {
delete m_zoomer; delete m_zoomer;
} }
void ReportDesignWidget::setActivePage(PageDesignIntf *page) QGraphicsView* ReportDesignWidget::activeView(){
return dynamic_cast<QGraphicsView*>(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(itemInserted(LimeReport::PageDesignIntf*,QPointF,QString)),this,SIGNAL(itemInserted(LimeReport::PageDesignIntf*,QPointF,QString)));
connect(page,SIGNAL(itemInsertCanceled(QString)),this,SIGNAL(itemInsertCanceled(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))); 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*)), connect(page, SIGNAL(pageUpdateFinished(LimeReport::PageDesignIntf*)),
this, SIGNAL(activePageUpdated(LimeReport::PageDesignIntf*))); this, SIGNAL(activePageUpdated(LimeReport::PageDesignIntf*)));
m_view->centerOn(0, 0); //activeView()->centerOn(0,0);
emit activePageChanged(); emit activePageChanged();
} }
void ReportDesignWidget::createStartPage() void ReportDesignWidget::createStartPage()
{ {
PageDesignIntf* reportPage = m_report->appendPage("page1"); m_report->appendPage("page1");
setActivePage(reportPage); createTabs();
} }
void ReportDesignWidget::removeDatasource(const QString &datasourceName) void ReportDesignWidget::removeDatasource(const QString &datasourceName)
{ {
if (m_report->dataManager())
m_report->dataManager()->removeDatasource(datasourceName); m_report->dataManager()->removeDatasource(datasourceName);
} }
void ReportDesignWidget::addBand(const QString &bandType) void ReportDesignWidget::addBand(const QString &bandType)
{ {
if (activePage())
activePage()->addBand(bandType); activePage()->addBand(bandType);
} }
void ReportDesignWidget::addBand(BandDesignIntf::BandsType bandType) void ReportDesignWidget::addBand(BandDesignIntf::BandsType bandType)
{ {
if (activePage())
activePage()->addBand(bandType); activePage()->addBand(bandType);
} }
void ReportDesignWidget::startInsertMode(const QString &itemType) void ReportDesignWidget::startInsertMode(const QString &itemType)
{ {
if (activePage())
activePage()->startInsertMode(itemType); activePage()->startInsertMode(itemType);
} }
void ReportDesignWidget::startEditMode() void ReportDesignWidget::startEditMode()
{ {
if (activePage())
activePage()->startEditMode(); activePage()->startEditMode();
} }
PageDesignIntf * ReportDesignWidget::activePage() PageDesignIntf * ReportDesignWidget::activePage()
{ {
return qobject_cast<PageDesignIntf*>(m_view->scene()); if (activeView())
return qobject_cast<PageDesignIntf*>(activeView()->scene());
return 0;
} }
QList<QGraphicsItem *> ReportDesignWidget::selectedItems(){ QList<QGraphicsItem *> ReportDesignWidget::selectedItems(){
return m_view->scene()->selectedItems(); return activePage()->selectedItems();
} }
void ReportDesignWidget::deleteItem(QGraphicsItem *item){ void ReportDesignWidget::deleteItem(QGraphicsItem *item){
@ -227,11 +257,13 @@ void ReportDesignWidget::slotItemSelected(BaseDesignIntf *item){
} }
void ReportDesignWidget::saveToFile(const QString &fileName){ void ReportDesignWidget::saveToFile(const QString &fileName){
m_report->scriptContext()->setInitScript(m_scriptEditor->toPlainText());
m_report->saveToFile(fileName); m_report->saveToFile(fileName);
} }
bool ReportDesignWidget::save() bool ReportDesignWidget::save()
{ {
m_report->scriptContext()->setInitScript(m_scriptEditor->toPlainText());
if (!m_report->reportFileName().isEmpty()){ if (!m_report->reportFileName().isEmpty()){
if (m_report->saveToFile()){ if (m_report->saveToFile()){
m_report->emitSaveFinished(); m_report->emitSaveFinished();
@ -254,24 +286,36 @@ bool ReportDesignWidget::save()
bool ReportDesignWidget::loadFromFile(const QString &fileName) bool ReportDesignWidget::loadFromFile(const QString &fileName)
{ {
if (!m_report->loadFromFile(fileName)) return false; if (m_report->loadFromFile(fileName)){
setActivePage(m_report->pageAt(0)); createTabs();
//connectPage(m_report->pageAt(0));
m_scriptEditor->setPlainText(m_report->scriptContext()->initScript());
emit loaded();
return true; return true;
} else {
QMessageBox::critical(this,tr("Error"),tr("Wrong file format"));
return false;
}
} }
void ReportDesignWidget::scale(qreal sx, qreal sy) 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() QString ReportDesignWidget::reportFileName()
{ {
if (m_report)
return m_report->reportFileName(); return m_report->reportFileName();
return QString();
} }
bool ReportDesignWidget::isNeedToSave() bool ReportDesignWidget::isNeedToSave()
{ {
if(m_report)
return m_report->isNeedToSave(); return m_report->isNeedToSave();
return false;
} }
bool ReportDesignWidget::emitLoadReport() bool ReportDesignWidget::emitLoadReport()
@ -281,81 +325,97 @@ bool ReportDesignWidget::emitLoadReport()
void ReportDesignWidget::updateSize() void ReportDesignWidget::updateSize()
{ {
if (activePage())
activePage()->slotUpdateItemSize(); activePage()->slotUpdateItemSize();
} }
void ReportDesignWidget::undo() void ReportDesignWidget::undo()
{ {
if (activePage())
activePage()->undo(); activePage()->undo();
} }
void ReportDesignWidget::redo() void ReportDesignWidget::redo()
{ {
if (activePage())
activePage()->redo(); activePage()->redo();
} }
void ReportDesignWidget::copy() void ReportDesignWidget::copy()
{ {
if (activePage())
activePage()->copy(); activePage()->copy();
} }
void ReportDesignWidget::paste() void ReportDesignWidget::paste()
{ {
if (activePage())
activePage()->paste(); activePage()->paste();
} }
void ReportDesignWidget::cut() void ReportDesignWidget::cut()
{ {
if (activePage())
activePage()->cut(); activePage()->cut();
} }
void ReportDesignWidget::brinToFront() void ReportDesignWidget::brinToFront()
{ {
if (activePage())
activePage()->bringToFront(); activePage()->bringToFront();
} }
void ReportDesignWidget::sendToBack() void ReportDesignWidget::sendToBack()
{ {
if (activePage())
activePage()->sendToBack(); activePage()->sendToBack();
} }
void ReportDesignWidget::alignToLeft() void ReportDesignWidget::alignToLeft()
{ {
if (activePage())
activePage()->alignToLeft(); activePage()->alignToLeft();
} }
void ReportDesignWidget::alignToRight() void ReportDesignWidget::alignToRight()
{ {
if (activePage())
activePage()->alignToRigth(); activePage()->alignToRigth();
} }
void ReportDesignWidget::alignToVCenter() void ReportDesignWidget::alignToVCenter()
{ {
if (activePage())
activePage()->alignToVCenter(); activePage()->alignToVCenter();
} }
void ReportDesignWidget::alignToTop() void ReportDesignWidget::alignToTop()
{ {
if (activePage())
activePage()->alignToTop(); activePage()->alignToTop();
} }
void ReportDesignWidget::alignToBottom() void ReportDesignWidget::alignToBottom()
{ {
if (activePage())
activePage()->alignToBottom(); activePage()->alignToBottom();
} }
void ReportDesignWidget::alignToHCenter() void ReportDesignWidget::alignToHCenter()
{ {
if (activePage())
activePage()->alignToHCenter(); activePage()->alignToHCenter();
} }
void ReportDesignWidget::sameHeight() void ReportDesignWidget::sameHeight()
{ {
if (activePage())
activePage()->sameHeight(); activePage()->sameHeight();
} }
void ReportDesignWidget::sameWidth() void ReportDesignWidget::sameWidth()
{ {
if (activePage())
activePage()->sameWidth(); activePage()->sameWidth();
} }
@ -370,24 +430,76 @@ void ReportDesignWidget::editLayoutMode(bool value)
void ReportDesignWidget::addHLayout() void ReportDesignWidget::addHLayout()
{ {
if (activePage())
activePage()->addHLayout(); activePage()->addHLayout();
} }
void ReportDesignWidget::setFont(const QFont& font) void ReportDesignWidget::setFont(const QFont& font)
{ {
if (activePage())
activePage()->setFont(font); activePage()->setFont(font);
} }
void ReportDesignWidget::setTextAlign(const bool& horizontalAlign, const Qt::AlignmentFlag& alignment) void ReportDesignWidget::setTextAlign(const bool& horizontalAlign, const Qt::AlignmentFlag& alignment)
{ {
if (activePage())
activePage()->changeSelectedGrpoupTextAlignPropperty(horizontalAlign, alignment); activePage()->changeSelectedGrpoupTextAlignPropperty(horizontalAlign, alignment);
} }
void ReportDesignWidget::setBorders(const BaseDesignIntf::BorderLines& borders) void ReportDesignWidget::setBorders(const BaseDesignIntf::BorderLines& borders)
{ {
if (activePage())
activePage()->setBorders(borders); 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<QWidget*>(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<QGraphicsView*>(m_tabWidget->currentWidget());
if (view){
PageDesignIntf* page = dynamic_cast<PageDesignIntf*>(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() void ReportDesignWidget::editSetting()
{ {
SettingDialog setting(this); SettingDialog setting(this);
@ -421,12 +533,16 @@ void ReportDesignWidget::setUseGrid(bool value)
bool ReportDesignWidget::isCanUndo() bool ReportDesignWidget::isCanUndo()
{ {
if (activePage())
return activePage()->isCanUndo(); return activePage()->isCanUndo();
return false;
} }
bool ReportDesignWidget::isCanRedo() bool ReportDesignWidget::isCanRedo()
{ {
if (activePage())
return activePage()->isCanRedo(); return activePage()->isCanRedo();
return false;
} }
void ReportDesignWidget::slotSelectionChanged() void ReportDesignWidget::slotSelectionChanged()
@ -449,10 +565,20 @@ DataSourceManager* ReportDesignWidget::dataManager()
return m_report->dataManager(); return m_report->dataManager();
} }
ScriptEngineManager* ReportDesignWidget::scriptManager()
{
return m_report->scriptManager();
}
ScriptEngineContext*ReportDesignWidget::scriptContext()
{
return m_report->scriptContext();
}
void ReportDesignWidget::slotPagesLoadFinished() void ReportDesignWidget::slotPagesLoadFinished()
{ {
applySettings(); applySettings();
setActivePage(m_report->pageAt(0)); //setActivePage(m_report->pageAt(0));
emit loaded(); emit loaded();
} }
@ -462,7 +588,19 @@ void ReportDesignWidget::slotDatasourceCollectionLoaded(const QString & /*collec
void ReportDesignWidget::slotSceneRectChanged(QRectF) void ReportDesignWidget::slotSceneRectChanged(QRectF)
{ {
m_view->centerOn(0,0); if (activeView()) activeView()->centerOn(0,0);
}
void ReportDesignWidget::slotCurrentTabChanged(int index)
{
QGraphicsView* view = dynamic_cast<QGraphicsView*>(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) bool ReportDesignWidget::eventFilter(QObject *target, QEvent *event)
@ -480,6 +618,10 @@ bool ReportDesignWidget::eventFilter(QObject *target, QEvent *event)
void ReportDesignWidget::clear() void ReportDesignWidget::clear()
{ {
m_report->clearReport(); m_report->clearReport();
m_tabWidget->clear();
m_report->setReportFileName("");
m_report->scriptContext()->setInitScript("");
m_scriptEditor->setPlainText("");
} }
} }

View File

@ -33,6 +33,7 @@
#include <QObject> #include <QObject>
#include <QGraphicsView> #include <QGraphicsView>
#include <QMainWindow> #include <QMainWindow>
#include <QTextEdit>
#include "lrpagedesignintf.h" #include "lrpagedesignintf.h"
#include "lrdatadesignintf.h" #include "lrdatadesignintf.h"
@ -59,6 +60,8 @@ public:
void createStartPage(); void createStartPage();
void clear(); void clear();
DataSourceManager* dataManager(); DataSourceManager* dataManager();
ScriptEngineManager* scriptManager();
ScriptEngineContext* scriptContext();
void removeDatasource(const QString& datasourceName); void removeDatasource(const QString& datasourceName);
void addBand(const QString& bandType); void addBand(const QString& bandType);
void addBand(BandDesignIntf::BandsType bandType); void addBand(BandDesignIntf::BandsType bandType);
@ -69,6 +72,7 @@ public:
bool isCanRedo(); bool isCanRedo();
void deleteItem(QGraphicsItem *item); void deleteItem(QGraphicsItem *item);
PageDesignIntf* activePage(); PageDesignIntf* activePage();
QGraphicsView* activeView();
QList<QGraphicsItem *> selectedItems(); QList<QGraphicsItem *> selectedItems();
QStringList datasourcesNames(); QStringList datasourcesNames();
void scale( qreal sx, qreal sy); void scale( qreal sx, qreal sy);
@ -90,7 +94,7 @@ public slots:
bool save(); bool save();
bool loadFromFile(const QString&); bool loadFromFile(const QString&);
void deleteSelectedItems(); void deleteSelectedItems();
void setActivePage(PageDesignIntf* page); void connectPage(PageDesignIntf* page);
void undo(); void undo();
void redo(); void redo();
void copy(); void copy();
@ -113,12 +117,17 @@ public slots:
void setBorders(const BaseDesignIntf::BorderLines& borders); void setBorders(const BaseDesignIntf::BorderLines& borders);
void editSetting(); void editSetting();
void setUseGrid(bool value); void setUseGrid(bool value);
void previewReport();
void printReport();
void addPage();
void deleteCurrentPage();
private slots: private slots:
void slotItemSelected(LimeReport::BaseDesignIntf *item); void slotItemSelected(LimeReport::BaseDesignIntf *item);
void slotSelectionChanged(); void slotSelectionChanged();
void slotPagesLoadFinished(); void slotPagesLoadFinished();
void slotDatasourceCollectionLoaded(const QString&); void slotDatasourceCollectionLoaded(const QString&);
void slotSceneRectChanged(QRectF); void slotSceneRectChanged(QRectF);
void slotCurrentTabChanged(int index);
signals: signals:
void insertModeStarted(); void insertModeStarted();
void itemInserted(LimeReport::PageDesignIntf*,QPointF,const QString&); void itemInserted(LimeReport::PageDesignIntf*,QPointF,const QString&);
@ -135,13 +144,19 @@ signals:
void bandDeleted(LimeReport::PageDesignIntf*, LimeReport::BandDesignIntf*); void bandDeleted(LimeReport::PageDesignIntf*, LimeReport::BandDesignIntf*);
void itemAdded(LimeReport::PageDesignIntf*, LimeReport::BaseDesignIntf*); void itemAdded(LimeReport::PageDesignIntf*, LimeReport::BaseDesignIntf*);
void itemDeleted(LimeReport::PageDesignIntf*, LimeReport::BaseDesignIntf*); void itemDeleted(LimeReport::PageDesignIntf*, LimeReport::BaseDesignIntf*);
void pageAdded(PageDesignIntf* page);
void pageDeleted();
protected:
void createTabs();
private: private:
bool eventFilter(QObject *target, QEvent *event); bool eventFilter(QObject *target, QEvent *event);
ReportDesignWidget(ReportEnginePrivate* report,QMainWindow *mainWindow,QWidget *parent = 0); ReportDesignWidget(ReportEnginePrivate* report,QMainWindow *mainWindow,QWidget *parent = 0);
private: private:
ReportEnginePrivate* m_report; ReportEnginePrivate* m_report;
QGraphicsView *m_view; QGraphicsView *m_view;
QTextEdit* m_scriptEditor;
QMainWindow *m_mainWindow; QMainWindow *m_mainWindow;
QTabWidget* m_tabWidget;
GraphicsViewZoomer* m_zoomer; GraphicsViewZoomer* m_zoomer;
QFont m_defaultFont; QFont m_defaultFont;
int m_verticalGridStep; int m_verticalGridStep;

View File

@ -47,6 +47,7 @@
#include "lrbasedesignobjectmodel.h" #include "lrbasedesignobjectmodel.h"
#include "lrreportdesignwidget.h" #include "lrreportdesignwidget.h"
#include "lrdatabrowser.h" #include "lrdatabrowser.h"
#include "scriptbrowser/lrscriptbrowser.h"
#include "lrbasedesignintf.h" #include "lrbasedesignintf.h"
#include "lrpagedesignintf.h" #include "lrpagedesignintf.h"
@ -70,6 +71,7 @@ ReportDesignWindow::ReportDesignWindow(ReportEnginePrivate *report, QWidget *par
createToolBars(); createToolBars();
createObjectInspector(); createObjectInspector();
createDataWindow(); createDataWindow();
createScriptWindow();
createObjectsBrowser(); createObjectsBrowser();
m_instance=this; m_instance=this;
m_statusBar=new QStatusBar(this); m_statusBar=new QStatusBar(this);
@ -96,6 +98,15 @@ void ReportDesignWindow::createActions()
m_newReportAction->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_N)); m_newReportAction->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_N));
connect(m_newReportAction,SIGNAL(triggered()),this,SLOT(slotNewReport())); 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 = new QAction(tr("Edit Mode"),this);
m_editModeAction->setIcon(QIcon(":/report/images/editMode")); m_editModeAction->setIcon(QIcon(":/report/images/editMode"));
m_editModeAction->setCheckable(true); m_editModeAction->setCheckable(true);
@ -261,6 +272,10 @@ void ReportDesignWindow::createToolBars()
m_mainToolBar->addAction(m_settingsAction); m_mainToolBar->addAction(m_settingsAction);
m_mainToolBar->addSeparator(); 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_copyAction);
m_mainToolBar->addAction(m_pasteAction); m_mainToolBar->addAction(m_pasteAction);
m_mainToolBar->addAction(m_cutAction); m_mainToolBar->addAction(m_cutAction);
@ -426,13 +441,13 @@ void ReportDesignWindow::initReportEditor(ReportEnginePrivate* report)
connect(m_reportDesignWidget,SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)), connect(m_reportDesignWidget,SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)),
this,SLOT(slotItemPropertyChanged(QString,QString,QVariant,QVariant))); this,SLOT(slotItemPropertyChanged(QString,QString,QVariant,QVariant)));
connect(m_reportDesignWidget,SIGNAL(insertModeStarted()),this,SLOT(slotInsertModeStarted())); connect(m_reportDesignWidget,SIGNAL(insertModeStarted()),this,SLOT(slotInsertModeStarted()));
connect(m_reportDesignWidget,SIGNAL(multiItemSelected()),this,SLOT(slotMultiItemSelected())); connect(m_reportDesignWidget,SIGNAL(multiItemSelected()),this,SLOT(slotMultiItemSelected()));
connect(m_reportDesignWidget,SIGNAL(itemInserted(LimeReport::PageDesignIntf*,QPointF,QString)), connect(m_reportDesignWidget,SIGNAL(itemInserted(LimeReport::PageDesignIntf*,QPointF,QString)),
this,SLOT(slotItemInserted(LimeReport::PageDesignIntf*,QPointF,QString))); this,SLOT(slotItemInserted(LimeReport::PageDesignIntf*,QPointF,QString)));
connect(m_reportDesignWidget,SIGNAL(itemInsertCanceled(QString)),this,SLOT(slotItemInsertCanceled(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->report(),SIGNAL(datasourceCollectionLoadFinished(QString)),this,SLOT(slotUpdateDataBrowser(QString)));
connect(m_reportDesignWidget,SIGNAL(commandHistoryChanged()),this,SLOT(slotCommandHistoryChanged())); 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*)), connect(m_reportDesignWidget, SIGNAL(bandAdded(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)),
this, SLOT(slotBandAdded(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*))); this, SLOT(slotBandAdded(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)));
connect(m_reportDesignWidget, SIGNAL(bandDeleted(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(renderStarted()), this, SLOT(renderStarted()));
connect(m_reportDesignWidget->report(), SIGNAL(renderPageFinished(int)), this, SLOT(renderPageFinished(int))); connect(m_reportDesignWidget->report(), SIGNAL(renderPageFinished(int)), this, SLOT(renderPageFinished(int)));
connect(m_reportDesignWidget->report(), SIGNAL(renderFinished()), this, SLOT(renderFinished())); 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() void ReportDesignWindow::createObjectInspector()
@ -491,6 +508,20 @@ void ReportDesignWindow::createDataWindow()
m_dataBrowser->setReportEditor(m_reportDesignWidget); 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() void ReportDesignWindow::updateRedoUndo()
{ {
m_undoAction->setEnabled(m_reportDesignWidget->isCanUndo()); m_undoAction->setEnabled(m_reportDesignWidget->isCanUndo());
@ -701,7 +732,24 @@ QSettings*ReportDesignWindow::settings()
void ReportDesignWindow::slotNewReport() 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() void ReportDesignWindow::slotNewTextItem()
@ -872,10 +920,30 @@ void ReportDesignWindow::slotLoadReport()
QApplication::processEvents(); QApplication::processEvents();
setCursor(Qt::WaitCursor); setCursor(Qt::WaitCursor);
m_reportDesignWidget->clear(); m_reportDesignWidget->clear();
m_reportDesignWidget->loadFromFile(fileName); if (m_reportDesignWidget->loadFromFile(fileName)){
m_lblReportName->setText(fileName); m_lblReportName->setText(fileName);
m_propertyModel->setObject(0); m_propertyModel->setObject(0);
updateRedoUndo(); updateRedoUndo();
setWindowTitle(m_reportDesignWidget->report()->reportName() + " - Lime Report Designer");
if (!m_recentFiles.contains(fileName)){
if (m_recentFiles.count()==10){
QMap<QString, QDateTime>::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(); unsetCursor();
setWindowTitle(m_reportDesignWidget->report()->reportName() + " - Lime Report Designer"); setWindowTitle(m_reportDesignWidget->report()->reportName() + " - Lime Report Designer");
addRecentFile(fileName); addRecentFile(fileName);
@ -951,13 +1019,13 @@ void ReportDesignWindow::slotTest()
void ReportDesignWindow::slotPrintReport() void ReportDesignWindow::slotPrintReport()
{ {
setCursor(Qt::WaitCursor); setCursor(Qt::WaitCursor);
m_reportDesignWidget->report()->printReport(); m_reportDesignWidget->printReport();
setCursor(Qt::ArrowCursor); setCursor(Qt::ArrowCursor);
} }
void ReportDesignWindow::slotPreviewReport() void ReportDesignWindow::slotPreviewReport()
{ {
m_reportDesignWidget->report()->previewReport(); m_reportDesignWidget->previewReport();
} }
void ReportDesignWindow::slotItemActionCliked() void ReportDesignWindow::slotItemActionCliked()
@ -1010,6 +1078,12 @@ void ReportDesignWindow::slotBandDeleted(PageDesignIntf *, BandDesignIntf *band)
} }
} }
void ReportDesignWindow::slotActivePageChanged()
{
m_propertyModel->setObject(0);
updateRedoUndo();
}
void ReportDesignWindow::renderStarted() void ReportDesignWindow::renderStarted()
{ {
if (m_showProgressDialog){ 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) void ReportDesignWindow::closeEvent(QCloseEvent * event)
{ {
if (checkNeedToSave()){ if (checkNeedToSave()){

View File

@ -50,6 +50,7 @@ class ObjectInspectorWidget;
class QObjectPropertyModel; class QObjectPropertyModel;
class ReportDesignWidget; class ReportDesignWidget;
class DataBrowser; class DataBrowser;
class ScriptBrowser;
class BaseDesignIntf; class BaseDesignIntf;
class PageDesignIntf; class PageDesignIntf;
class ObjectBrowser; class ObjectBrowser;
@ -72,6 +73,8 @@ public:
private slots: private slots:
void slotNewReport(); void slotNewReport();
void slotNewPage();
void slotDeletePage();
void slotNewTextItem(); void slotNewTextItem();
void slotNewBand(const QString& bandType); void slotNewBand(const QString& bandType);
void slotNewBand(int bandType); void slotNewBand(int bandType);
@ -103,6 +106,7 @@ private slots:
void slotItemActionCliked(); void slotItemActionCliked();
void slotBandAdded(LimeReport::PageDesignIntf*, LimeReport::BandDesignIntf*band); void slotBandAdded(LimeReport::PageDesignIntf*, LimeReport::BandDesignIntf*band);
void slotBandDeleted(LimeReport::PageDesignIntf*, LimeReport::BandDesignIntf*band); void slotBandDeleted(LimeReport::PageDesignIntf*, LimeReport::BandDesignIntf*band);
void slotActivePageChanged();
void renderStarted(); void renderStarted();
void renderPageFinished(int renderedPageCount); void renderPageFinished(int renderedPageCount);
void renderFinished(); void renderFinished();
@ -113,6 +117,8 @@ private slots:
void slotUseGrid(bool value); void slotUseGrid(bool value);
void slotUseMagnet(bool value); void slotUseMagnet(bool value);
void slotLoadRecentFile(const QString fileName); void slotLoadRecentFile(const QString fileName);
void slotPageAdded(PageDesignIntf* page);
void slotPageDeleted();
protected: protected:
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
void resizeEvent(QResizeEvent *); void resizeEvent(QResizeEvent *);
@ -130,6 +136,7 @@ private:
void createObjectsBrowser(); void createObjectsBrowser();
void initReportEditor(ReportEnginePrivate* report); void initReportEditor(ReportEnginePrivate* report);
void createDataWindow(); void createDataWindow();
void createScriptWindow();
void updateRedoUndo(); void updateRedoUndo();
void startNewReport(); void startNewReport();
void writePosition(); void writePosition();
@ -174,6 +181,8 @@ private:
QAction* m_settingsAction; QAction* m_settingsAction;
QAction* m_useGridAction; QAction* m_useGridAction;
QAction* m_useMagnetAction; QAction* m_useMagnetAction;
QAction* m_newPageAction;
QAction* m_deletePageAction;
QAction* m_newPageHeader; QAction* m_newPageHeader;
QAction* m_newPageFooter; QAction* m_newPageFooter;
@ -202,6 +211,7 @@ private:
ReportDesignWidget* m_reportDesignWidget; ReportDesignWidget* m_reportDesignWidget;
DataBrowser * m_dataBrowser; DataBrowser * m_dataBrowser;
ScriptBrowser* m_scriptBrowser;
ObjectBrowser* m_objectsBrowser; ObjectBrowser* m_objectsBrowser;

View File

@ -61,6 +61,7 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) :
m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")) m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview"))
{ {
m_datasources= new DataSourceManager(this); m_datasources= new DataSourceManager(this);
m_scriptEngineContext = new ScriptEngineContext(this);
m_datasources->setObjectName("datasources"); m_datasources->setObjectName("datasources");
connect(m_datasources,SIGNAL(loadCollectionFinished(QString)),this,SLOT(slotDataSourceCollectionLoaded(QString))); connect(m_datasources,SIGNAL(loadCollectionFinished(QString)),this,SLOT(slotDataSourceCollectionLoaded(QString)));
} }
@ -103,6 +104,17 @@ PageDesignIntf *ReportEnginePrivate::appendPage(const QString &pageName)
return page; return page;
} }
bool ReportEnginePrivate::deletePage(PageDesignIntf *page){
QList<PageDesignIntf*>::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() PageDesignIntf *ReportEnginePrivate::createPreviewPage()
{ {
return createPage(); return createPage();
@ -152,6 +164,7 @@ void ReportEnginePrivate::clearReport()
m_pages.clear(); m_pages.clear();
m_datasources->clear(DataSourceManager::Owned); m_datasources->clear(DataSourceManager::Owned);
m_fileName=""; m_fileName="";
m_scriptEngineContext->clear();
emit cleared(); emit cleared();
} }
@ -262,8 +275,43 @@ bool ReportEnginePrivate::printReport(QPrinter* printer)
if (printer&&printer->isValid()){ if (printer&&printer->isValid()){
try{ try{
dataManager()->setDesignTime(false); dataManager()->setDesignTime(false);
printReport(renderToPages(),*printer,PrintRange()); ReportPages pages = renderToPages();
dataManager()->setDesignTime(true); 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){ } catch(ReportError &exception){
saveError(exception.what()); saveError(exception.what());
} }
@ -401,6 +449,11 @@ void ReportEnginePrivate::cancelRender()
m_reportRender->cancelRender(); m_reportRender->cancelRender();
} }
PageDesignIntf* ReportEngine::createPreviewScene(QObject* parent){
Q_D(ReportEngine);
return d->createPreviewScene(parent);
}
void ReportEnginePrivate::designReport() void ReportEnginePrivate::designReport()
{ {
if (!m_designerWindow) { if (!m_designerWindow) {
@ -457,6 +510,7 @@ bool ReportEnginePrivate::loadFromFile(const QString &fileName)
return true; return true;
}; };
} }
m_lastError = reader->lastError();
return false; return false;
} }
@ -555,6 +609,7 @@ QString ReportEnginePrivate::renderToString()
dataManager()->setDesignTime(false); dataManager()->setDesignTime(false);
if (m_pages.count()){ if (m_pages.count()){
render.setDatasources(dataManager()); render.setDatasources(dataManager());
render.setScriptContext(scriptContext());
return render.renderPageToString(m_pages.at(0)); return render.renderPageToString(m_pages.at(0));
}else return QString(); }else return QString();
} }
@ -588,10 +643,16 @@ ReportPages ReportEnginePrivate::renderToPages()
connect(m_reportRender.data(),SIGNAL(pageRendered(int)), connect(m_reportRender.data(),SIGNAL(pageRendered(int)),
this, SIGNAL(renderPageFinished(int))); this, SIGNAL(renderPageFinished(int)));
if (m_pages.count()){ if (m_pages.count()){
ReportPages result;
emit renderStarted(); emit renderStarted();
m_reportRender->setDatasources(dataManager()); 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(); emit renderFinished();
m_reportRender.clear();
return result; return result;
} else { } else {
return ReportPages(); return ReportPages();
@ -628,6 +689,11 @@ bool ReportEngine::printReport(QPrinter *printer)
return d->printReport(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) void ReportEngine::printToFile(const QString &fileName)
{ {
Q_D(ReportEngine); Q_D(ReportEngine);

View File

@ -60,6 +60,10 @@ private:
class DataSourceManager; class DataSourceManager;
class ReportEnginePrivate; class ReportEnginePrivate;
class PageDesignIntf;
class PageItemDesignIntf;
typedef QList< QSharedPointer<PageItemDesignIntf> > ReportPages;
class LIMEREPORT_EXPORT ReportEngine : public QObject{ class LIMEREPORT_EXPORT ReportEngine : public QObject{
Q_OBJECT Q_OBJECT
@ -69,7 +73,9 @@ public:
explicit ReportEngine(QObject *parent = 0); explicit ReportEngine(QObject *parent = 0);
~ReportEngine(); ~ReportEngine();
bool printReport(QPrinter *printer=0); bool printReport(QPrinter *printer=0);
bool printPages(ReportPages pages, QPrinter *printer, PrintRange printRange = PrintRange());
void printToFile(const QString& fileName); void printToFile(const QString& fileName);
PageDesignIntf *createPreviewScene(QObject *parent = 0);
bool printToPDF(const QString& fileName); bool printToPDF(const QString& fileName);
void previewReport(); void previewReport();
void designReport(); void designReport();

View File

@ -55,7 +55,8 @@ class ReportEnginePrivate : public QObject, public ICollectionContainer
Q_OBJECT Q_OBJECT
Q_DECLARE_PUBLIC(ReportEngine) Q_DECLARE_PUBLIC(ReportEngine)
Q_PROPERTY(ACollectionProperty pages READ fakeCollectionReader()) 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; friend class PreviewReportWidget;
public: public:
static void printReport(ItemsReaderIntf::Ptr reader, QPrinter &printer); static void printReport(ItemsReaderIntf::Ptr reader, QPrinter &printer);
@ -63,11 +64,15 @@ public:
public: public:
explicit ReportEnginePrivate(QObject *parent = 0); explicit ReportEnginePrivate(QObject *parent = 0);
virtual ~ReportEnginePrivate(); virtual ~ReportEnginePrivate();
PageDesignIntf* appendPage(const QString& pageName=""); PageDesignIntf* appendPage(const QString& pageName="");
bool deletePage(PageDesignIntf *page);
PageDesignIntf* createPreviewPage(); PageDesignIntf* createPreviewPage();
PageDesignIntf* pageAt(int index){return (index<=(m_pages.count()-1)) ? m_pages.at(index):0;} PageDesignIntf* pageAt(int index){return (index<=(m_pages.count()-1)) ? m_pages.at(index):0;}
int pageCount() {return m_pages.count();} int pageCount() {return m_pages.count();}
DataSourceManager* dataManager(){return m_datasources;} DataSourceManager* dataManager(){return m_datasources;}
ScriptEngineContext* scriptContext(){return m_scriptEngineContext;}
ScriptEngineManager* scriptManager(){return &ScriptEngineManager::instance();}
IDataSourceManager* dataManagerIntf(){return m_datasources;} IDataSourceManager* dataManagerIntf(){return m_datasources;}
IScriptEngineManager* scriptManagerIntf(){ IScriptEngineManager* scriptManagerIntf(){
@ -77,6 +82,7 @@ public:
void clearReport(); void clearReport();
bool printReport(QPrinter *printer=0); bool printReport(QPrinter *printer=0);
bool printPages(ReportPages pages, QPrinter *printer, PrintRange printRange = PrintRange());
void printToFile(const QString& fileName); void printToFile(const QString& fileName);
bool printToPDF(const QString& fileName); bool printToPDF(const QString& fileName);
void previewReport(); void previewReport();
@ -144,6 +150,7 @@ private:
private: private:
QList<PageDesignIntf*> m_pages; QList<PageDesignIntf*> m_pages;
DataSourceManager* m_datasources; DataSourceManager* m_datasources;
ScriptEngineContext* m_scriptEngineContext;
ReportRender::Ptr m_reportRender; ReportRender::Ptr m_reportRender;
QString m_fileName; QString m_fileName;
QString m_lastError; QString m_lastError;

View File

@ -158,6 +158,19 @@ void ReportRender::setDatasources(DataSourceManager *value)
m_datasources=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(){ void ReportRender::initDatasources(){
try{ try{
datasources()->setAllDatasourcesToFirst(); datasources()->setAllDatasourcesToFirst();
@ -181,6 +194,20 @@ void ReportRender::renderPage(PageDesignIntf* patternPage)
initVariables(); initVariables();
initGroupFunctions(); 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(); clearPageMap();
resetPageNumber(); resetPageNumber();
@ -205,6 +232,7 @@ void ReportRender::renderPage(PageDesignIntf* patternPage)
if (!m_renderCanceled) if (!m_renderCanceled)
secondRenderPass(); secondRenderPass();
} }
}
int ReportRender::pageCount() int ReportRender::pageCount()
{ {
@ -244,6 +272,18 @@ void ReportRender::initVariables()
m_datasources->setReportVariable("#PAGE_COUNT",0); 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() void ReportRender::clearPageMap()
{ {
m_renderedPages.clear(); m_renderedPages.clear();
@ -523,6 +563,10 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da
dataSource->next(); dataSource->next();
} }
closeDataGroup(band); closeDataGroup(band);
// if (gb->isNeedToStartNewPage()){
// savePage();
// startNewPage();
// }
} }
if (!gb->isStarted()){ if (!gb->isStarted()){
if (band->reprintOnEachPage()) if (band->reprintOnEachPage())
@ -851,6 +895,7 @@ void ReportRender::startNewPage()
m_currentIndex=0; m_currentIndex=0;
renderPageHeader(m_patternPageItem); renderPageHeader(m_patternPageItem);
//renderPageFooter(m_patternPageItem);
m_pageFooterHeight = calcPageFooterHeight(m_patternPageItem); m_pageFooterHeight = calcPageFooterHeight(m_patternPageItem);
m_maxHeightByColumn[m_currentColumn] -= m_pageFooterHeight; m_maxHeightByColumn[m_currentColumn] -= m_pageFooterHeight;
m_currentIndex=10; m_currentIndex=10;

View File

@ -33,6 +33,7 @@
#include "lrcollection.h" #include "lrcollection.h"
#include "lrdatasourcemanager.h" #include "lrdatasourcemanager.h"
#include "lrpageitemdesignintf.h" #include "lrpageitemdesignintf.h"
#include "lrscriptenginemanager.h"
#include "serializators/lrstorageintf.h" #include "serializators/lrstorageintf.h"
namespace LimeReport{ namespace LimeReport{
@ -55,7 +56,6 @@ private:
bool m_footerGroup; bool m_footerGroup;
}; };
typedef QList<PageItemDesignIntf::Ptr> ReportPages;
struct PagesRange{ struct PagesRange{
int firstPage; int firstPage;
@ -73,6 +73,7 @@ public:
~ReportRender(); ~ReportRender();
ReportRender(QObject *parent = 0); ReportRender(QObject *parent = 0);
void setDatasources(DataSourceManager* value); void setDatasources(DataSourceManager* value);
void setScriptContext(ScriptEngineContext* scriptContext);
DataSourceManager* datasources(){return m_datasources;} DataSourceManager* datasources(){return m_datasources;}
int pageCount(); int pageCount();
PageItemDesignIntf::Ptr pageAt(int index); PageItemDesignIntf::Ptr pageAt(int index);
@ -86,7 +87,11 @@ private:
void renderPage(PageDesignIntf *patternPage); void renderPage(PageDesignIntf *patternPage);
void initDatasources(); void initDatasources();
void initRenderPage(); void initRenderPage();
#ifdef HAVE_UI_LOADER
void initDialogs();
#endif
void initVariables(); void initVariables();
bool runInitScript();
void clearPageMap(); void clearPageMap();
void renderBand(BandDesignIntf *patternBand, DataRenderMode mode = NotStartNewPage, bool isLast = false); void renderBand(BandDesignIntf *patternBand, DataRenderMode mode = NotStartNewPage, bool isLast = false);
void renderDataBand(BandDesignIntf* dataBand); void renderDataBand(BandDesignIntf* dataBand);
@ -141,6 +146,7 @@ private:
void renameChildItems(BaseDesignIntf *item); void renameChildItems(BaseDesignIntf *item);
private: private:
DataSourceManager* m_datasources; DataSourceManager* m_datasources;
ScriptEngineContext* m_scriptEngineContext;
PageItemDesignIntf* m_renderPageItem; PageItemDesignIntf* m_renderPageItem;
PageItemDesignIntf* m_patternPageItem; PageItemDesignIntf* m_patternPageItem;
QList<PageItemDesignIntf::Ptr> m_renderedPages; QList<PageItemDesignIntf::Ptr> m_renderedPages;

View File

@ -32,6 +32,11 @@
#include <QDate> #include <QDate>
#include <QStringList> #include <QStringList>
#include <QScriptValueIterator> #include <QScriptValueIterator>
#ifdef HAVE_UI_LOADER
#include <QUiLoader>
#include <QBuffer>
#include <QWidget>
#endif
#include "lrdatasourcemanager.h" #include "lrdatasourcemanager.h"
Q_DECLARE_METATYPE(QColor) Q_DECLARE_METATYPE(QColor)
@ -375,6 +380,11 @@ void ScriptEngineManager::setDataManager(DataSourceManager *dataManager){
} }
} }
void ScriptEngineManager::updateModel()
{
}
ScriptEngineManager::ScriptEngineManager() ScriptEngineManager::ScriptEngineManager()
:m_model(0), m_dataManager(0) :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); 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<DialogDescriber::Ptr>::Iterator it = m_dialogs.begin();
while(it!=m_dialogs.end()){
if ((*it)->name()==dialogName){
it = m_dialogs.erase(it);
} else {
++it;
}
}
}
{
QList<DialogPtr>::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<QDialog*>(loader.load(&buffer));
m_createdDialogs.push_back(QSharedPointer<QDialog>(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 } //namespace LimeReport

View File

@ -39,8 +39,13 @@
#include <QScriptable> #include <QScriptable>
#include <QFont> #include <QFont>
#ifdef HAVE_UI_LOADER
#include <QDialog>
#endif
#include "base/lrsingleton.h" #include "base/lrsingleton.h"
#include "lrscriptenginemanagerintf.h" #include "lrscriptenginemanagerintf.h"
#include "lrcollection.h"
namespace LimeReport{ namespace LimeReport{
@ -57,7 +62,7 @@ struct ScriptFunctionDesc{
class ScriptEngineNode { class ScriptEngineNode {
public: 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()) 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){} :m_name(name), m_description(description), m_icon(icon), m_type(type), m_parent(parent){}
virtual ~ScriptEngineNode(); virtual ~ScriptEngineNode();
@ -95,6 +100,7 @@ public:
int columnCount(const QModelIndex &parent) const; int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const; QVariant data(const QModelIndex &index, int role) const;
void setScriptEngineManager(ScriptEngineManager* scriptManager); void setScriptEngineManager(ScriptEngineManager* scriptManager);
inline ScriptEngineManager* scriptEngineManager(){return m_scriptManager;}
private slots: private slots:
void slotScriptEngineChanged(); void slotScriptEngineChanged();
private: private:
@ -105,6 +111,64 @@ private:
ScriptEngineNode* m_rootNode; 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<DialogDescriber> 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<QDialog> 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<DialogDescriber::Ptr>& 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<DialogDescriber::Ptr> m_dialogs;
QList<DialogPtr> m_createdDialogs;
#endif
QString m_lastError;
QString m_initScript;
};
class ScriptEngineManager : public QObject, public Singleton<ScriptEngineManager>, public IScriptEngineManager class ScriptEngineManager : public QObject, public Singleton<ScriptEngineManager>, public IScriptEngineManager
{ {
Q_OBJECT Q_OBJECT
@ -122,8 +186,11 @@ public:
QStringList functionsNames(); QStringList functionsNames();
const QList<ScriptFunctionDesc>& functionsDescriber(){return m_functions;} const QList<ScriptFunctionDesc>& functionsDescriber(){return m_functions;}
ScriptEngineModel* model(){return m_model;} ScriptEngineModel* model(){return m_model;}
void setContext(ScriptEngineContext* context){m_context=context;}
DataSourceManager* dataManager() const {return m_dataManager;} DataSourceManager* dataManager() const {return m_dataManager;}
void setDataManager(DataSourceManager* dataManager); void setDataManager(DataSourceManager* dataManager);
protected:
void updateModel();
private: private:
Q_DISABLE_COPY(ScriptEngineManager) Q_DISABLE_COPY(ScriptEngineManager)
private: private:
@ -132,6 +199,7 @@ private:
QString m_lastError; QString m_lastError;
QList<ScriptFunctionDesc> m_functions; QList<ScriptFunctionDesc> m_functions;
ScriptEngineModel* m_model; ScriptEngineModel* m_model;
ScriptEngineContext* m_context;
DataSourceManager* m_dataManager; DataSourceManager* m_dataManager;
}; };

View File

@ -53,6 +53,7 @@ ColorEditor::ColorEditor(QWidget *parent) :
setFocusProxy(m_button); setFocusProxy(m_button);
setAutoFillBackground(true); setAutoFillBackground(true);
setLayout(layout); setLayout(layout);
setAutoFillBackground(true);
connect(m_button,SIGNAL(clicked()),this,SLOT(slotClicked())); connect(m_button,SIGNAL(clicked()),this,SLOT(slotClicked()));
} }

View File

@ -37,13 +37,17 @@ ImageEditor::ImageEditor(QWidget* parent)
:QWidget(parent) :QWidget(parent)
{ {
m_button.setIcon(QIcon(":items/ImageItem")); m_button.setIcon(QIcon(":items/ImageItem"));
m_clearButton.setIcon(QIcon(":items/clear.png"));
QHBoxLayout* layout = new QHBoxLayout(this); QHBoxLayout* layout = new QHBoxLayout(this);
layout->addWidget(&m_button); layout->addWidget(&m_button);
layout->setSpacing(0); layout->addWidget(&m_clearButton);
layout->setSpacing(1);
layout->setContentsMargins(1,0,1,1); layout->setContentsMargins(1,0,1,1);
setLayout(layout); setLayout(layout);
setFocusProxy(&m_button); setFocusProxy(&m_button);
setAutoFillBackground(true);
connect(&m_button,SIGNAL(clicked()),this,SLOT(slotButtonClicked())); connect(&m_button,SIGNAL(clicked()),this,SLOT(slotButtonClicked()));
connect(&m_clearButton,SIGNAL(clicked()),this,SLOT(slotClearButtonClicked()));
} }
QImage ImageEditor::image() QImage ImageEditor::image()
@ -57,4 +61,10 @@ void ImageEditor::slotButtonClicked()
emit editingFinished(); emit editingFinished();
} }
void ImageEditor::slotClearButtonClicked()
{
m_image = QImage();
emit editingFinished();
}
} //namespace LimeReport } //namespace LimeReport

View File

@ -46,8 +46,10 @@ signals:
void editingFinished(); void editingFinished();
private slots: private slots:
void slotButtonClicked(); void slotButtonClicked();
void slotClearButtonClicked();
private: private:
QPushButton m_button; QPushButton m_button;
QPushButton m_clearButton;
QImage m_image; QImage m_image;
}; };

View File

@ -88,7 +88,7 @@ namespace LimeReport{
void setColorIndex(int propertyValue); void setColorIndex(int propertyValue);
void setModel(QAbstractItemModel* model){m_model=model;} void setModel(QAbstractItemModel* model){m_model=model;}
QAbstractItemModel* model(){return m_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;} QModelIndex modelIndex(){return m_index;}
bool isClass(){return m_isClass;} bool isClass(){return m_isClass;}
#ifdef INSPECT_BASEDESIGN #ifdef INSPECT_BASEDESIGN

View File

@ -106,6 +106,7 @@ void ObjectBrowser::buildTree(BaseDesignIntf* ignoredItem){
m_treeView->clear(); m_treeView->clear();
m_itemsMap.clear(); m_itemsMap.clear();
if (!m_report->activePage()) return;
ObjectBrowserNode *topLevelItem=new ObjectBrowserNode(m_treeView); ObjectBrowserNode *topLevelItem=new ObjectBrowserNode(m_treeView);
topLevelItem->setText(0,m_report->activePage()->objectName()); topLevelItem->setText(0,m_report->activePage()->objectName());
@ -204,7 +205,7 @@ void ObjectBrowser::slotItemDeleted(PageDesignIntf *, BaseDesignIntf *item)
void ObjectBrowser::slotObjectTreeItemSelectionChanged() void ObjectBrowser::slotObjectTreeItemSelectionChanged()
{ {
if (!m_changingItemSelection){ if (!m_changingItemSelection && m_report->activePage()){
m_changingItemSelection = true; m_changingItemSelection = true;
m_report->activePage()->clearSelection(); m_report->activePage()->clearSelection();
foreach(QTreeWidgetItem* item, m_treeView->selectedItems()){ foreach(QTreeWidgetItem* item, m_treeView->selectedItems()){
@ -214,6 +215,10 @@ void ObjectBrowser::slotObjectTreeItemSelectionChanged()
if (si) { if (si) {
m_report->activePage()->animateItem(si); m_report->activePage()->animateItem(si);
si->setSelected(true); si->setSelected(true);
QPointF p = si->mapToScene(si->pos());
if (si->parentItem())
p = si->parentItem()->mapToScene(si->pos());
m_report->activeView()->centerOn(p);
} }
} }
} }

View File

@ -165,5 +165,7 @@
<file>images/FitWidth.png</file> <file>images/FitWidth.png</file>
<file>images/OneToOne.png</file> <file>images/OneToOne.png</file>
<file alias="/images/logo32">images/logo_32x32.png</file> <file alias="/images/logo32">images/logo_32x32.png</file>
<file alias="/images/addPage">images/addPage1.png</file>
<file alias="/images/deletePage">images/deletePage1.png</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 633 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 B

View File

@ -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 <http://www.gnu.org/licenses/>. *
* *
** 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 <http://www.gnu.org/licenses/>. *
* *
* 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 <QFileDialog>
#include <QUiLoader>
#endif
#include <QMessageBox>
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<QString,QTreeWidgetItem*> 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; i<item->metaObject()->propertyCount(); ++i){
QStringList row;
row<<item->metaObject()->property(i).typeName()<<item->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<QDialog*>(loader.load(&buff));
if (dialog){
foreach (QObject* child, dialog->children()) {
if (!child->objectName().isEmpty()){
QStringList row;
row<<child->metaObject()->className()<<child->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<QDialog*>(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

View File

@ -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 <http://www.gnu.org/licenses/>. *
* *
** 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 <http://www.gnu.org/licenses/>. *
* *
* 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 <QWidget>
#include <QMainWindow>
#include <QTreeWidgetItem>
#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

View File

@ -0,0 +1,14 @@
<RCC>
<qresource prefix="/scriptbrowser">
<file alias="/images/dialog">images/Dialog.png</file>
<file alias="/images/dialog_add">images/Dialog_add.png</file>
<file alias="/images/dialog_delete">images/Dialog_delete.png</file>
<file alias="/images/dialog_run">images/Dialog_run.png</file>
<file alias="/images/function">images/function3.png</file>
<file alias="/images/function_add">images/function_add.png</file>
<file alias="/images/function_delete">images/function_delete.png</file>
<file alias="/images/function_edit">images/function_edit.png</file>
<file>images/green_cube.png</file>
<file alias="/images/item">images/green_cube1.png</file>
</qresource>
</RCC>

View File

@ -0,0 +1,287 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LimeReport::ScriptBrowser</class>
<widget class="QWidget" name="LimeReport::ScriptBrowser">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>1</number>
</property>
<property name="leftMargin">
<number>1</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="tabPosition">
<enum>QTabWidget::South</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tpFunctions">
<attribute name="title">
<string>Functions</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>2</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QToolButton" name="toolButton_2">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="lrscriptbrowser.qrc">
<normaloff>:/scriptbrowser/images/function_add</normaloff>:/scriptbrowser/images/function_add</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="lrscriptbrowser.qrc">
<normaloff>:/scriptbrowser/images/function_edit</normaloff>:/scriptbrowser/images/function_edit</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_3">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="lrscriptbrowser.qrc">
<normaloff>:/scriptbrowser/images/function_delete</normaloff>:/scriptbrowser/images/function_delete</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QTreeWidget" name="twFunctions">
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tpDialogs">
<attribute name="title">
<string>Dialogs</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>2</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QToolButton" name="tbAddDialog">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="lrscriptbrowser.qrc">
<normaloff>:/scriptbrowser/images/dialog_add</normaloff>:/scriptbrowser/images/dialog_add</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="tbRunDialog">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="lrscriptbrowser.qrc">
<normaloff>:/scriptbrowser/images/dialog_run</normaloff>:/scriptbrowser/images/dialog_run</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="tbDeleteDialog">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="lrscriptbrowser.qrc">
<normaloff>:/scriptbrowser/images/dialog_delete</normaloff>:/scriptbrowser/images/dialog_delete</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QTreeWidget" name="twDialogs">
<property name="columnCount">
<number>2</number>
</property>
<attribute name="headerDefaultSectionSize">
<number>131</number>
</attribute>
<attribute name="headerMinimumSectionSize">
<number>100</number>
</attribute>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
<column>
<property name="text">
<string>Name</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="lrscriptbrowser.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -204,6 +204,10 @@ bool FileXMLReader::prepareReader(QDomDocument *doc)
QFile source(m_fileName); QFile source(m_fileName);
if (source.open(QFile::ReadOnly)) { if (source.open(QFile::ReadOnly)) {
doc->setContent(&source); 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;} } else {m_error=QString(QObject::tr("File %1 not opened")).arg(m_fileName); return false;}
} }
return true; return true;

View File

@ -37,12 +37,19 @@ namespace LimeReport{
XMLWriter::XMLWriter() : m_doc(new QDomDocument) XMLWriter::XMLWriter() : m_doc(new QDomDocument)
{ {
m_rootElement=m_doc->createElement("Report"); init();
m_doc->appendChild(m_rootElement);
} }
XMLWriter::XMLWriter(QSharedPointer<QDomDocument> doc) : m_doc(doc){ XMLWriter::XMLWriter(QSharedPointer<QDomDocument> doc) : m_doc(doc){
init();
}
void XMLWriter::init()
{
m_rootElement=m_doc->createElement("Report"); 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); m_doc->appendChild(m_rootElement);
} }

View File

@ -48,7 +48,7 @@ private:
bool saveToFile(QString fileName); bool saveToFile(QString fileName);
QString saveToString(); QString saveToString();
QByteArray saveToByteArray(); QByteArray saveToByteArray();
void init();
QDomElement putQObjectItem(QString name, QObject* item); QDomElement putQObjectItem(QString name, QObject* item);
void putChildQObjectItem(QString name, QObject* item, QDomElement* parentNode); void putChildQObjectItem(QString name, QObject* item, QDomElement* parentNode);
void putCollectionItem(QObject* item, QDomElement* parentNode=0); void putCollectionItem(QObject* item, QDomElement* parentNode=0);

Binary file not shown.

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS> <!DOCTYPE TS>
<TS version="2.1" language="es_ES"> <TS version="2.0" language="es_ES">
<context> <context>
<name>LRVariableDialog</name> <name>LRVariableDialog</name>
<message> <message>
@ -28,15 +28,15 @@
<name>LimeReport::AVariablesHolder</name> <name>LimeReport::AVariablesHolder</name>
<message> <message>
<source>variable with name </source> <source>variable with name </source>
<translation>variable con el nombre</translation> <translation type="obsolete">variable con el nombre</translation>
</message> </message>
<message> <message>
<source> already exists !!</source> <source> already exists !!</source>
<translation>ya existe !!</translation> <translation type="obsolete">ya existe !!</translation>
</message> </message>
<message> <message>
<source> does not exists !!</source> <source> does not exists !!</source>
<translation>no existe !!</translation> <translation type="obsolete">no existe !!</translation>
</message> </message>
</context> </context>
<context> <context>
@ -86,7 +86,7 @@ p, li { white-space: pre-wrap; }
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;arin_a@bk.ru&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;arin_a@bk.ru&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message utf8="true">
<source>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <source>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
@ -395,7 +395,7 @@ p, li { white-space: pre-wrap; }
</message> </message>
<message> <message>
<source>User variables</source> <source>User variables</source>
<translation>Variables de usuario</translation> <translation type="obsolete">Variables de usuario</translation>
</message> </message>
<message> <message>
<source>System variables</source> <source>System variables</source>
@ -413,6 +413,18 @@ p, li { white-space: pre-wrap; }
<source>Error</source> <source>Error</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Grab variable</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Report variables</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>External variables</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>LimeReport::DataFooterBand</name> <name>LimeReport::DataFooterBand</name>
@ -758,6 +770,14 @@ p, li { white-space: pre-wrap; }
<source>One to one</source> <source>One to one</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Font</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Text align</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>LimeReport::ProxyHolder</name> <name>LimeReport::ProxyHolder</name>
@ -993,6 +1013,22 @@ p, li { white-space: pre-wrap; }
<source>Report file name</source> <source>Report file name</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Page</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Script</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Wrong file format</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>LimeReport::ReportDesignWindow</name> <name>LimeReport::ReportDesignWindow</name>
@ -1220,6 +1256,18 @@ p, li { white-space: pre-wrap; }
<source>File &quot;%1&quot; not found!</source> <source>File &quot;%1&quot; not found!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>New Report Page</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delete Report Page</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Script Browser</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>LimeReport::ReportEnginePrivate</name> <name>LimeReport::ReportEnginePrivate</name>
@ -1227,6 +1275,10 @@ p, li { white-space: pre-wrap; }
<source>Error</source> <source>Error</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Preview</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>LimeReport::ReportFooter</name> <name>LimeReport::ReportFooter</name>
@ -1356,6 +1408,60 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>LimeReport::ScriptBrowser</name>
<message>
<source>Form</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Functions</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Dialogs</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Type</source>
<translation type="unfinished">Tipo</translation>
</message>
<message>
<source>Name</source>
<translation type="unfinished">Nombre</translation>
</message>
<message>
<source>NO CATEGORY</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Dialog with name: %1 already exists</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ui file must cointain QDialog instead QWidget or QMainWindow</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>wrong file format</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::ScriptEngineContext</name>
<message>
<source>Dialog with name: %1 can`t be created</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>LimeReport::ScriptEngineManager</name> <name>LimeReport::ScriptEngineManager</name>
<message> <message>
@ -1382,6 +1488,10 @@ p, li { white-space: pre-wrap; }
<source>Locale</source> <source>Locale</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>CurrencySymbol</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>LimeReport::SettingDialog</name> <name>LimeReport::SettingDialog</name>
@ -1494,6 +1604,21 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>LimeReport::VariablesHolder</name>
<message>
<source>variable with name </source>
<translation type="unfinished">variable con el nombre</translation>
</message>
<message>
<source> already exists !!</source>
<translation type="unfinished">ya existe !!</translation>
</message>
<message>
<source> does not exists !!</source>
<translation type="unfinished">no existe !!</translation>
</message>
</context>
<context> <context>
<name>QObject</name> <name>QObject</name>
<message> <message>
@ -1688,5 +1813,9 @@ p, li { white-space: pre-wrap; }
<source>Content is empty</source> <source>Content is empty</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Wrong file format</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>

Binary file not shown.

View File

@ -1,137 +1,137 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS> <!DOCTYPE TS>
<TS version="2.1" language="ru_RU"> <TS version="2.0" language="ru_RU">
<context> <context>
<name>AboutDialog</name> <name>AboutDialog</name>
<message> <message>
<source>About</source> <source>About</source>
<translation type="vanished">О программе</translation> <translation type="obsolete">О программе</translation>
</message> </message>
<message> <message>
<source>Author</source> <source>Author</source>
<translation type="vanished">Автор</translation> <translation type="obsolete">Автор</translation>
</message> </message>
<message> <message>
<source>License</source> <source>License</source>
<translation type="vanished">Лицензия</translation> <translation type="obsolete">Лицензия</translation>
</message> </message>
<message> <message>
<source>Close</source> <source>Close</source>
<translation type="vanished">Закрыть</translation> <translation type="obsolete">Закрыть</translation>
</message> </message>
<message> <message>
<source>Version 1.1.1</source> <source>Version 1.1.1</source>
<translation type="vanished">Версия</translation> <translation type="obsolete">Версия</translation>
</message> </message>
</context> </context>
<context> <context>
<name>ConnectionDialog</name> <name>ConnectionDialog</name>
<message> <message>
<source>Connection</source> <source>Connection</source>
<translation type="vanished">Соединение</translation> <translation type="obsolete">Соединение</translation>
</message> </message>
<message> <message>
<source>Connection Name</source> <source>Connection Name</source>
<translation type="vanished">Название</translation> <translation type="obsolete">Название</translation>
</message> </message>
<message> <message>
<source>Driver</source> <source>Driver</source>
<translation type="vanished">Драйвер</translation> <translation type="obsolete">Драйвер</translation>
</message> </message>
<message> <message>
<source>Server </source> <source>Server </source>
<translation type="vanished">Сервер</translation> <translation type="obsolete">Сервер</translation>
</message> </message>
<message> <message>
<source>User</source> <source>User</source>
<translation type="vanished">Пользователь</translation> <translation type="obsolete">Пользователь</translation>
</message> </message>
<message> <message>
<source>Password</source> <source>Password</source>
<translation type="vanished">Пароль</translation> <translation type="obsolete">Пароль</translation>
</message> </message>
<message> <message>
<source>Database</source> <source>Database</source>
<translation type="vanished">База данных</translation> <translation type="obsolete">База данных</translation>
</message> </message>
<message> <message>
<source>Auto connect</source> <source>Auto connect</source>
<translation type="vanished">Автоматическое соединение</translation> <translation type="obsolete">Автоматическое соединение</translation>
</message> </message>
<message> <message>
<source>Check connection</source> <source>Check connection</source>
<translation type="vanished">Проверить соединение</translation> <translation type="obsolete">Проверить соединение</translation>
</message> </message>
<message> <message>
<source>Cancel</source> <source>Cancel</source>
<translation type="vanished">Отмена</translation> <translation type="obsolete">Отмена</translation>
</message> </message>
<message> <message>
<source>Error</source> <source>Error</source>
<translation type="vanished">Ошибка</translation> <translation type="obsolete">Ошибка</translation>
</message> </message>
<message> <message>
<source>Connection succsesfully established!</source> <source>Connection succsesfully established!</source>
<translation type="vanished">Соединение успешно установлено!</translation> <translation type="obsolete">Соединение успешно установлено!</translation>
</message> </message>
<message> <message>
<source>Connection Name is empty</source> <source>Connection Name is empty</source>
<translation type="vanished">Наименование соединения не указано</translation> <translation type="obsolete">Наименование соединения не указано</translation>
</message> </message>
<message> <message>
<source>Connection with name </source> <source>Connection with name </source>
<translation type="vanished">Соединение</translation> <translation type="obsolete">Соединение</translation>
</message> </message>
<message> <message>
<source> already exists </source> <source> already exists </source>
<translation type="vanished">уже существует</translation> <translation type="obsolete">уже существует</translation>
</message> </message>
</context> </context>
<context> <context>
<name>DataBrowser</name> <name>DataBrowser</name>
<message> <message>
<source>Datasources</source> <source>Datasources</source>
<translation type="vanished">Источники данных</translation> <translation type="obsolete">Источники данных</translation>
</message> </message>
<message> <message>
<source>Add database connection</source> <source>Add database connection</source>
<translation type="vanished">Добавить соединение с базой</translation> <translation type="obsolete">Добавить соединение с базой</translation>
</message> </message>
<message> <message>
<source>Add new datasource</source> <source>Add new datasource</source>
<translation type="vanished">Добавить новый источник данных</translation> <translation type="obsolete">Добавить новый источник данных</translation>
</message> </message>
<message> <message>
<source>View data</source> <source>View data</source>
<translation type="vanished">Просмотр данных в источнике</translation> <translation type="obsolete">Просмотр данных в источнике</translation>
</message> </message>
<message> <message>
<source>Change datasource</source> <source>Change datasource</source>
<translation type="vanished">Изменить источник данных</translation> <translation type="obsolete">Изменить источник данных</translation>
</message> </message>
<message> <message>
<source>Delete datasource</source> <source>Delete datasource</source>
<translation type="vanished">Удалить источник данных</translation> <translation type="obsolete">Удалить источник данных</translation>
</message> </message>
<message> <message>
<source>Show error</source> <source>Show error</source>
<translation type="vanished">Показать ошибки</translation> <translation type="obsolete">Показать ошибки</translation>
</message> </message>
<message> <message>
<source>Variables</source> <source>Variables</source>
<translation type="vanished">Переменные</translation> <translation type="obsolete">Переменные</translation>
</message> </message>
<message> <message>
<source>Add new variable</source> <source>Add new variable</source>
<translation type="vanished">Добавить новую переменную</translation> <translation type="obsolete">Добавить новую переменную</translation>
</message> </message>
<message> <message>
<source>Edit variable</source> <source>Edit variable</source>
<translation type="vanished">Редактировать переменную</translation> <translation type="obsolete">Редактировать переменную</translation>
</message> </message>
<message> <message>
<source>Delete variable</source> <source>Delete variable</source>
<translation type="vanished">Удалить переменную</translation> <translation type="obsolete">Удалить переменную</translation>
</message> </message>
</context> </context>
<context> <context>
@ -161,15 +161,15 @@
<name>LimeReport::AVariablesHolder</name> <name>LimeReport::AVariablesHolder</name>
<message> <message>
<source>variable with name </source> <source>variable with name </source>
<translation>переменная</translation> <translation type="obsolete">переменная</translation>
</message> </message>
<message> <message>
<source> already exists !!</source> <source> already exists !!</source>
<translation>уже существует !!</translation> <translation type="obsolete">уже существует !!</translation>
</message> </message>
<message> <message>
<source> does not exists !!</source> <source> does not exists !!</source>
<translation>не существует !!</translation> <translation type="obsolete">не существует !!</translation>
</message> </message>
</context> </context>
<context> <context>
@ -223,7 +223,7 @@ p, li { white-space: pre-wrap; }
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;arin_a@bk.ru&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;arin_a@bk.ru&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message utf8="true">
<source>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <source>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
@ -525,7 +525,7 @@ p, li { white-space: pre-wrap; }
</message> </message>
<message> <message>
<source>User variables</source> <source>User variables</source>
<translation>Пользовательские переменные</translation> <translation type="obsolete">Пользовательские переменные</translation>
</message> </message>
<message> <message>
<source>System variables</source> <source>System variables</source>
@ -538,7 +538,7 @@ p, li { white-space: pre-wrap; }
</message> </message>
<message> <message>
<source>Do you really want delete variable &quot;%1&quot; ?</source> <source>Do you really want delete variable &quot;%1&quot; ?</source>
<translation type="vanished">Вы действительно хотите удалить переменную &quot;%1&quot; ?</translation> <translation type="obsolete">Вы действительно хотите удалить переменную &quot;%1&quot; ?</translation>
</message> </message>
<message> <message>
<source>Error</source> <source>Error</source>
@ -552,6 +552,18 @@ p, li { white-space: pre-wrap; }
<source>Do you really want to delete variable &quot;%1&quot; ?</source> <source>Do you really want to delete variable &quot;%1&quot; ?</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Grab variable</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Report variables</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>External variables</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>LimeReport::DataFooterBand</name> <name>LimeReport::DataFooterBand</name>
@ -779,11 +791,11 @@ p, li { white-space: pre-wrap; }
<name>LimeReport::PageDesignIntf</name> <name>LimeReport::PageDesignIntf</name>
<message> <message>
<source>Warning</source> <source>Warning</source>
<translation type="vanished">Предупреждение</translation> <translation type="obsolete">Предупреждение</translation>
</message> </message>
<message> <message>
<source>Multi band deletion not allowed</source> <source>Multi band deletion not allowed</source>
<translation type="vanished">Удаление нескольких бандов запрещено</translation> <translation type="obsolete">Удаление нескольких бандов запрещено</translation>
</message> </message>
</context> </context>
<context> <context>
@ -917,6 +929,14 @@ p, li { white-space: pre-wrap; }
<source>One to one</source> <source>One to one</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Font</source>
<translation type="unfinished">Шрифт</translation>
</message>
<message>
<source>Text align</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>LimeReport::ProxyHolder</name> <name>LimeReport::ProxyHolder</name>
@ -1152,6 +1172,22 @@ p, li { white-space: pre-wrap; }
<source>Report file name</source> <source>Report file name</source>
<translation>Файл отчета</translation> <translation>Файл отчета</translation>
</message> </message>
<message>
<source>Page</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Script</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error</source>
<translation type="unfinished">Ошибка</translation>
</message>
<message>
<source>Wrong file format</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>LimeReport::ReportDesignWindow</name> <name>LimeReport::ReportDesignWindow</name>
@ -1379,6 +1415,18 @@ p, li { white-space: pre-wrap; }
<source>File &quot;%1&quot; not found!</source> <source>File &quot;%1&quot; not found!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>New Report Page</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delete Report Page</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Script Browser</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>LimeReport::ReportEnginePrivate</name> <name>LimeReport::ReportEnginePrivate</name>
@ -1386,6 +1434,10 @@ p, li { white-space: pre-wrap; }
<source>Error</source> <source>Error</source>
<translation>Ошибка</translation> <translation>Ошибка</translation>
</message> </message>
<message>
<source>Preview</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>LimeReport::ReportFooter</name> <name>LimeReport::ReportFooter</name>
@ -1515,6 +1567,60 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>LimeReport::ScriptBrowser</name>
<message>
<source>Form</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Functions</source>
<translation type="unfinished">Функции</translation>
</message>
<message>
<source>...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Dialogs</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Type</source>
<translation type="unfinished">Тип</translation>
</message>
<message>
<source>Name</source>
<translation type="unfinished">Имя переменной</translation>
</message>
<message>
<source>NO CATEGORY</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error</source>
<translation type="unfinished">Ошибка</translation>
</message>
<message>
<source>Dialog with name: %1 already exists</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ui file must cointain QDialog instead QWidget or QMainWindow</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>wrong file format</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::ScriptEngineContext</name>
<message>
<source>Dialog with name: %1 can`t be created</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>LimeReport::ScriptEngineManager</name> <name>LimeReport::ScriptEngineManager</name>
<message> <message>
@ -1541,6 +1647,10 @@ p, li { white-space: pre-wrap; }
<source>Locale</source> <source>Locale</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>CurrencySymbol</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>LimeReport::SettingDialog</name> <name>LimeReport::SettingDialog</name>
@ -1653,91 +1763,106 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>LimeReport::VariablesHolder</name>
<message>
<source>variable with name </source>
<translation type="unfinished">переменная</translation>
</message>
<message>
<source> already exists !!</source>
<translation type="unfinished">уже существует !!</translation>
</message>
<message>
<source> does not exists !!</source>
<translation type="unfinished">не существует !!</translation>
</message>
</context>
<context> <context>
<name>PreviewReportWindow</name> <name>PreviewReportWindow</name>
<message> <message>
<source>Preview</source> <source>Preview</source>
<translation type="vanished">Предварительный просмотр</translation> <translation type="obsolete">Предварительный просмотр</translation>
</message> </message>
<message> <message>
<source>View</source> <source>View</source>
<translation type="vanished">Просмотр</translation> <translation type="obsolete">Просмотр</translation>
</message> </message>
<message> <message>
<source>Report</source> <source>Report</source>
<translation type="vanished">Отчет</translation> <translation type="obsolete">Отчет</translation>
</message> </message>
<message> <message>
<source>toolBar</source> <source>toolBar</source>
<translation type="vanished">Панель инструментов</translation> <translation type="obsolete">Панель инструментов</translation>
</message> </message>
<message> <message>
<source>Print</source> <source>Print</source>
<translation type="vanished">Печать</translation> <translation type="obsolete">Печать</translation>
</message> </message>
<message> <message>
<source>Zoom In</source> <source>Zoom In</source>
<translation type="vanished">Увеличить</translation> <translation type="obsolete">Увеличить</translation>
</message> </message>
<message> <message>
<source>Zoom Out</source> <source>Zoom Out</source>
<translation type="vanished">Уменьшить</translation> <translation type="obsolete">Уменьшить</translation>
</message> </message>
<message> <message>
<source>Prior Page</source> <source>Prior Page</source>
<translation type="vanished">Предыдущая страница</translation> <translation type="obsolete">Предыдущая страница</translation>
</message> </message>
<message> <message>
<source>Next Page</source> <source>Next Page</source>
<translation type="vanished">Следующая страница</translation> <translation type="obsolete">Следующая страница</translation>
</message> </message>
<message> <message>
<source>Close Preview</source> <source>Close Preview</source>
<translation type="vanished">Закрыть</translation> <translation type="obsolete">Закрыть</translation>
</message> </message>
<message> <message>
<source>Edit Mode</source> <source>Edit Mode</source>
<translation type="vanished">Режим редактирования</translation> <translation type="obsolete">Режим редактирования</translation>
</message> </message>
<message> <message>
<source>Save to file</source> <source>Save to file</source>
<translation type="vanished">Записать в файл</translation> <translation type="obsolete">Записать в файл</translation>
</message> </message>
<message> <message>
<source>Show errors</source> <source>Show errors</source>
<translation type="vanished">Показать ошибки</translation> <translation type="obsolete">Показать ошибки</translation>
</message> </message>
<message> <message>
<source>First Page</source> <source>First Page</source>
<translation type="vanished">Первая страница</translation> <translation type="obsolete">Первая страница</translation>
</message> </message>
<message> <message>
<source>First page</source> <source>First page</source>
<translation type="vanished">Первая страница</translation> <translation type="obsolete">Первая страница</translation>
</message> </message>
<message> <message>
<source>Last Page</source> <source>Last Page</source>
<translation type="vanished">Последняя страница</translation> <translation type="obsolete">Последняя страница</translation>
</message> </message>
<message> <message>
<source>Print To PDF</source> <source>Print To PDF</source>
<translation type="vanished">Печать в PDF</translation> <translation type="obsolete">Печать в PDF</translation>
</message> </message>
<message> <message>
<source>Page: </source> <source>Page: </source>
<translation type="vanished">Страница: </translation> <translation type="obsolete">Страница: </translation>
</message> </message>
<message> <message>
<source> of %1</source> <source> of %1</source>
<translation type="vanished"> из %1</translation> <translation type="obsolete"> из %1</translation>
</message> </message>
<message> <message>
<source>Report file name</source> <source>Report file name</source>
<translation type="vanished">Файл отчета</translation> <translation type="obsolete">Файл отчета</translation>
</message> </message>
<message> <message>
<source>PDF file name</source> <source>PDF file name</source>
<translation type="vanished">Имя PDF файла</translation> <translation type="obsolete">Имя PDF файла</translation>
</message> </message>
</context> </context>
<context> <context>
@ -1824,7 +1949,7 @@ p, li { white-space: pre-wrap; }
</message> </message>
<message> <message>
<source>Master datasource &quot;%1&quot; not found!</source> <source>Master datasource &quot;%1&quot; not found!</source>
<translation type="vanished">Главный источник данных &quot;%1&quot; не найден!</translation> <translation type="obsolete">Главный источник данных &quot;%1&quot; не найден!</translation>
</message> </message>
<message> <message>
<source>Child</source> <source>Child</source>
@ -1884,19 +2009,19 @@ p, li { white-space: pre-wrap; }
</message> </message>
<message> <message>
<source>TopLine</source> <source>TopLine</source>
<translation type="vanished">Верхняя граница</translation> <translation type="obsolete">Верхняя граница</translation>
</message> </message>
<message> <message>
<source>BottomLine</source> <source>BottomLine</source>
<translation type="vanished">Нижняя граница</translation> <translation type="obsolete">Нижняя граница</translation>
</message> </message>
<message> <message>
<source>LeftLine</source> <source>LeftLine</source>
<translation type="vanished">Левая граница</translation> <translation type="obsolete">Левая граница</translation>
</message> </message>
<message> <message>
<source>RightLine</source> <source>RightLine</source>
<translation type="vanished">Правая граница</translation> <translation type="obsolete">Правая граница</translation>
</message> </message>
<message> <message>
<source>content</source> <source>content</source>
@ -1954,161 +2079,165 @@ p, li { white-space: pre-wrap; }
<source>Content is empty</source> <source>Content is empty</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Wrong file format</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SQLEditDialog</name> <name>SQLEditDialog</name>
<message> <message>
<source>Datasource</source> <source>Datasource</source>
<translation type="vanished">Источник данных</translation> <translation type="obsolete">Источник данных</translation>
</message> </message>
<message> <message>
<source>Connection</source> <source>Connection</source>
<translation type="vanished">Соединение</translation> <translation type="obsolete">Соединение</translation>
</message> </message>
<message> <message>
<source>Datasource Name</source> <source>Datasource Name</source>
<translation type="vanished">Имя источника</translation> <translation type="obsolete">Имя источника</translation>
</message> </message>
<message> <message>
<source>Subdetail</source> <source>Subdetail</source>
<translation type="vanished">Подчиненный</translation> <translation type="obsolete">Подчиненный</translation>
</message> </message>
<message> <message>
<source>Master datasource</source> <source>Master datasource</source>
<translation type="vanished">Главный источник</translation> <translation type="obsolete">Главный источник</translation>
</message> </message>
<message> <message>
<source>Subquery mode</source> <source>Subquery mode</source>
<translation type="vanished">Режим подзапроса</translation> <translation type="obsolete">Режим подзапроса</translation>
</message> </message>
<message> <message>
<source>Filter mode</source> <source>Filter mode</source>
<translation type="vanished">Режим фильтрации</translation> <translation type="obsolete">Режим фильтрации</translation>
</message> </message>
<message> <message>
<source>SQL</source> <source>SQL</source>
<translation type="vanished">SQL запрос</translation> <translation type="obsolete">SQL запрос</translation>
</message> </message>
<message> <message>
<source>Preview</source> <source>Preview</source>
<translation type="vanished">Предпросмотр</translation> <translation type="obsolete">Предпросмотр</translation>
</message> </message>
<message> <message>
<source>Hide Preview</source> <source>Hide Preview</source>
<translation type="vanished">Скрыть</translation> <translation type="obsolete">Скрыть</translation>
</message> </message>
<message> <message>
<source>Child datasource</source> <source>Child datasource</source>
<translation type="vanished">Подчиненный источник</translation> <translation type="obsolete">Подчиненный источник</translation>
</message> </message>
<message> <message>
<source>Fields map</source> <source>Fields map</source>
<translation type="vanished">Поля для связи источников</translation> <translation type="obsolete">Поля для связи источников</translation>
</message> </message>
<message> <message>
<source>Data preview</source> <source>Data preview</source>
<translation type="vanished">Данные</translation> <translation type="obsolete">Данные</translation>
</message> </message>
<message> <message>
<source>Cancel</source> <source>Cancel</source>
<translation type="vanished">Отмена</translation> <translation type="obsolete">Отмена</translation>
</message> </message>
<message> <message>
<source>Error</source> <source>Error</source>
<translation type="vanished">Ошибка</translation> <translation type="obsolete">Ошибка</translation>
</message> </message>
<message> <message>
<source>Datasource Name is empty !</source> <source>Datasource Name is empty !</source>
<translation type="vanished">Имя источника данных не заполнено !</translation> <translation type="obsolete">Имя источника данных не заполнено !</translation>
</message> </message>
<message> <message>
<source>SQL is empty !</source> <source>SQL is empty !</source>
<translation type="vanished">SQL запрос пустой !</translation> <translation type="obsolete">SQL запрос пустой !</translation>
</message> </message>
<message> <message>
<source>Datasource with name: &quot;%1&quot; already exists !</source> <source>Datasource with name: &quot;%1&quot; already exists !</source>
<translation type="vanished">Источник данных с именем: &quot;%1&quot; уже существует !</translation> <translation type="obsolete">Источник данных с именем: &quot;%1&quot; уже существует !</translation>
</message> </message>
<message> <message>
<source>Datasource with name %1 already exist</source> <source>Datasource with name %1 already exist</source>
<translation type="vanished">Источник данных с именем: &quot;%1&quot; уже существует</translation> <translation type="obsolete">Источник данных с именем: &quot;%1&quot; уже существует</translation>
</message> </message>
<message> <message>
<source>Attention</source> <source>Attention</source>
<translation type="vanished">Внимание</translation> <translation type="obsolete">Внимание</translation>
</message> </message>
<message> <message>
<source>Connection is not specified</source> <source>Connection is not specified</source>
<translation type="vanished">Соединение не указано</translation> <translation type="obsolete">Соединение не указано</translation>
</message> </message>
<message> <message>
<source>Refresh</source> <source>Refresh</source>
<translation type="vanished">Обновить</translation> <translation type="obsolete">Обновить</translation>
</message> </message>
</context> </context>
<context> <context>
<name>SettingDialog</name> <name>SettingDialog</name>
<message> <message>
<source>Designer setting</source> <source>Designer setting</source>
<translation type="vanished">Настройки дизайнера</translation> <translation type="obsolete">Настройки дизайнера</translation>
</message> </message>
<message> <message>
<source>Default font</source> <source>Default font</source>
<translation type="vanished">Шрифт по умолчанию</translation> <translation type="obsolete">Шрифт по умолчанию</translation>
</message> </message>
<message> <message>
<source>Grid</source> <source>Grid</source>
<translation type="vanished">Сетка</translation> <translation type="obsolete">Сетка</translation>
</message> </message>
<message> <message>
<source>Vertical grid step</source> <source>Vertical grid step</source>
<translation type="vanished">Вертикальный шаг</translation> <translation type="obsolete">Вертикальный шаг</translation>
</message> </message>
<message> <message>
<source>Horizontal grid step</source> <source>Horizontal grid step</source>
<translation type="vanished">Горизонтальный шаг</translation> <translation type="obsolete">Горизонтальный шаг</translation>
</message> </message>
</context> </context>
<context> <context>
<name>TextItemEditor</name> <name>TextItemEditor</name>
<message> <message>
<source>Text Item Editor</source> <source>Text Item Editor</source>
<translation type="vanished">Редактор текстового элемента</translation> <translation type="obsolete">Редактор текстового элемента</translation>
</message> </message>
<message> <message>
<source>Content</source> <source>Content</source>
<translation type="vanished">Содержимое</translation> <translation type="obsolete">Содержимое</translation>
</message> </message>
<message> <message>
<source>Data</source> <source>Data</source>
<translation type="vanished">Источники данных</translation> <translation type="obsolete">Источники данных</translation>
</message> </message>
<message> <message>
<source>Functions</source> <source>Functions</source>
<translation type="vanished">Функции</translation> <translation type="obsolete">Функции</translation>
</message> </message>
<message> <message>
<source>Editor settings</source> <source>Editor settings</source>
<translation type="vanished">Настройки</translation> <translation type="obsolete">Настройки</translation>
</message> </message>
<message> <message>
<source>Editor font</source> <source>Editor font</source>
<translation type="vanished">Шрифт редактора</translation> <translation type="obsolete">Шрифт редактора</translation>
</message> </message>
<message> <message>
<source>Cancel</source> <source>Cancel</source>
<translation type="vanished">Отмена</translation> <translation type="obsolete">Отмена</translation>
</message> </message>
</context> </context>
<context> <context>
<name>WaitForm</name> <name>WaitForm</name>
<message> <message>
<source>Wait</source> <source>Wait</source>
<translation type="vanished">Ожидайте</translation> <translation type="obsolete">Ожидайте</translation>
</message> </message>
<message> <message>
<source>Please wait ...</source> <source>Please wait ...</source>
<translation type="vanished">Пожалуста подождите ...</translation> <translation type="obsolete">Пожалуста подождите ...</translation>
</message> </message>
</context> </context>
</TS> </TS>