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

View File

@ -778,14 +778,4 @@ 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();
}
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)
{
@ -116,22 +126,26 @@ void FontEditorWidget::slotFontChanged(const QFont &font)
void FontEditorWidget::slotFontSizeChanged(const QString &value)
{
if (reportEditor() && !m_ignoreSlots){
QFont resFont(m_fontNameEditor->currentFont());
resFont.setPointSize(value.toInt());
reportEditor()->setFont(resFont);
}
if (m_ignoreSlots) return;
QFont resFont(fontNameEditor()->currentFont());
resFont.setPointSize(value.toInt());
if (reportEditor()) reportEditor()->setFont(resFont);
if (page()) page()->setFont(resFont);
}
void FontEditorWidget::slotFontAttribsChanged(bool)
{
if (reportEditor()&& !m_ignoreSlots){
QFont resFont(m_fontNameEditor->currentFont());
resFont.setBold(m_fontBold->isChecked());
resFont.setItalic(m_fontItalic->isChecked());
resFont.setUnderline(m_fontUnderline->isChecked());
reportEditor()->setFont(resFont);
}
if (m_ignoreSlots) return;
QFont resFont(m_fontNameEditor->currentFont());
resFont.setBold(m_fontBold->isChecked());
resFont.setItalic(m_fontItalic->isChecked());
resFont.setUnderline(m_fontUnderline->isChecked());
if (reportEditor()) reportEditor()->setFont(resFont);
if (page()) page()->setFont(resFont);
}
void FontEditorWidget::slotPropertyChanged(const QString &objectName, const QString &property, const QVariant& oldValue, const QVariant& newValue)

View File

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

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)
{
painter->save();
QPen pen(m_shapeColor);
@ -150,21 +166,6 @@ void ShapeItem::setLineWidth(qreal value)
}
}
Qt::PenStyle ShapeItem::penStyle() const
{
return m_penStyle;
}
void ShapeItem::setPenStyle(const Qt::PenStyle &value)
{
if (m_penStyle!=value){
Qt::PenStyle oldValue = m_penStyle;
m_penStyle = value;
update();
notify("penStyle",(int)oldValue,(int)value);
}
}
BaseDesignIntf *ShapeItem::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
{
return new ShapeItem(owner,parent);

View File

@ -150,20 +150,45 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q
break;
}
// for(QTextBlock it=m_text->begin();it!=m_text->end();it=it.next()){
// for (int i=0;i<it.layout()->lineCount();i++){
// painter->setOpacity(qreal(foregroundOpacity())/100);
// it.layout()->lineAt(i).draw(painter,QPointF(0,0));
// }
// }
int lineHeight = painter->fontMetrics().height();
qreal curpos = 0;
if (m_underlines){
QPen pen = painter->pen();
pen.setWidth(m_underlineLineSize);
painter->setPen(pen);
}
painter->setOpacity(qreal(foregroundOpacity())/100);
//m_text->setDefaultTextOption();
QAbstractTextDocumentLayout::PaintContext ctx;
ctx.palette.setColor(QPalette::Text, fontColor());
for(QTextBlock it=m_text->begin();it!=m_text->end();it=it.next()){
it.blockFormat().setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight);
for (int i=0;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);
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),);
// ppainter->setFont(transformToSceneFont(font()));
// QTextOption o;
@ -186,6 +211,10 @@ void TextItem::Init()
// m_text->setDefaultFont(transformToSceneFont(font()));
m_textSize=QSizeF();
m_foregroundOpacity = 100;
m_underlines = false;
m_adaptFontToSize = false;
m_underlineLineSize = 1;
m_lineSpacing = 1;
}
void TextItem::setContent(const QString &value)
@ -204,9 +233,9 @@ void TextItem::setContent(const QString &value)
}
if (!isLoading()){
update(rect());
notify("content",oldValue,value);
//updateLayout();
initText();
update(rect());
notify("content",oldValue,value);
}
}
}
@ -223,7 +252,7 @@ void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, i
}
if ((m_textSize.height()>height()) && (m_autoHeight) ){
setHeight(m_textSize.height()+5);
setHeight(m_textSize.height()+borderLineSize()*2);
}
BaseDesignIntf::updateItemSize(dataManager, pass, maxHeight);
}
@ -262,23 +291,91 @@ QString TextItem::replaceReturns(QString text)
return result;
}
void TextItem::setTextFont(const QFont& value){
m_text->setDefaultFont(value);
if ((m_angle==Angle0)||(m_angle==Angle180)){
m_text->setTextWidth(rect().width()-fakeMarginSize()*2);
} else {
m_text->setTextWidth(rect().height()-fakeMarginSize()*2);
}
}
void TextItem::adaptFontSize(){
QFont _font = transformToSceneFont(font());
do{
setTextFont(_font);
if (_font.pixelSize()>2)
_font.setPixelSize(_font.pixelSize()-1);
else break;
} while(m_text->size().height()>this->height() || m_text->size().width()>(this->width())-fakeMarginSize()*2);
}
int TextItem::underlineLineSize() const
{
return m_underlineLineSize;
}
void TextItem::setUnderlineLineSize(int value)
{
int oldValue = m_underlineLineSize;
m_underlineLineSize = value;
update();
notify("underlineLineSize",oldValue,value);
}
int TextItem::lineSpacing() const
{
return m_lineSpacing;
}
void TextItem::setLineSpacing(int value)
{
int oldValue = m_lineSpacing;
m_lineSpacing = value;
initText();
update();
notify("lineSpacing",oldValue,value);
}
void TextItem::initText()
{
QTextOption to;
to.setAlignment(m_alignment);
if (m_autoWidth!=MaxStringLength)
to.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
if (m_adaptFontToSize && (!(m_autoHeight || m_autoWidth)))
to.setWrapMode(QTextOption::WordWrap);
else
to.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
else to.setWrapMode(QTextOption::NoWrap);
m_text->setDocumentMargin(0);
m_text->setDefaultTextOption(to);
m_text->setDefaultFont(transformToSceneFont(font()));
QFont _font = transformToSceneFont(font());
if (m_adaptFontToSize && (!(m_autoHeight || m_autoWidth))){
adaptFontSize();
} else {
setTextFont(transformToSceneFont(font()));
}
if ((m_angle==Angle0)||(m_angle==Angle180)){
m_text->setTextWidth(rect().width()-fakeMarginSize()*2);
} else {
m_text->setTextWidth(rect().height()-fakeMarginSize()*2);
}
for ( QTextBlock block = m_text->begin(); block.isValid(); block = block.next())
{
QTextCursor tc = QTextCursor(block);
QTextBlockFormat fmt = block.blockFormat();
if(fmt.lineHeight() != m_lineSpacing) {
fmt.setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight);
tc.setBlockFormat( fmt );
}
}
m_textSize=m_text->size();
}
@ -320,9 +417,11 @@ bool TextItem::trimValue() const
return m_trimValue;
}
void TextItem::setTrimValue(bool trimValue)
void TextItem::setTrimValue(bool value)
{
m_trimValue = trimValue;
bool oldValue = m_trimValue;
m_trimValue = value;
notify("trimValue",oldValue,value);
}
@ -333,8 +432,9 @@ void TextItem::geometryChangedEvent(QRectF , QRectF)
// } else {
// m_text->setTextWidth(rect().height()-fakeMarginSize()*2);
// }
// m_textSize=m_text->size();
if (itemMode() == DesignMode) initText();
else if (adaptFontToSize()) initText();
}
bool TextItem::isNeedUpdateSize(RenderPass pass) const
@ -395,6 +495,17 @@ void TextItem::setAutoWidth(TextItem::AutoWidth value)
}
}
void TextItem::setAdaptFontToSize(bool value)
{
if (m_adaptFontToSize!=value){
bool oldValue = m_adaptFontToSize;
m_adaptFontToSize=value;
initText();
invalidateRect(rect());
notify("updateFontToSize",oldValue,value);
}
}
bool TextItem::canBeSplitted(int height) const
{
return height>(m_text->begin().layout()->lineAt(0).height());
@ -409,8 +520,10 @@ BaseDesignIntf *TextItem::cloneUpperPart(int height, QObject *owner, QGraphicsIt
for (QTextBlock it=m_text->begin();it!=m_text->end();it=it.next()){
for (int i=0;i<it.layout()->lineCount();i++){
linesHeight+=it.layout()->lineAt(i).height();
if (linesHeight>(height-(fakeMarginSize()*2+borderLineSize()*2))) {linesHeight-=it.layout()->lineAt(i).height(); goto loop_exit;}
linesHeight+=it.layout()->lineAt(i).height()+lineSpacing();
if (linesHeight>(height-(fakeMarginSize()*2+borderLineSize()*2))) {
linesHeight-=it.layout()->lineAt(i).height(); goto loop_exit;
}
tmpText+=it.text().mid(it.layout()->lineAt(i).textStart(),it.layout()->lineAt(i).textLength())+'\n';
}
}
@ -433,7 +546,7 @@ BaseDesignIntf *TextItem::cloneBottomPart(int height, QObject *owner, QGraphicsI
for (curBlock=m_text->begin();curBlock!=m_text->end();curBlock=curBlock.next()){
for (curLine=0;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;}
}
}
@ -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

View File

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

View File

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

View File

@ -681,6 +681,13 @@ void BandDesignIntf::initMode(ItemMode mode)
BaseDesignIntf::initMode(mode);
if ((mode==PreviewMode)||(mode==PrintMode)){
m_bandMarker->setVisible(false);
} else {
if (!m_bandMarker->scene() && this->scene()){
this->scene()->addItem(m_bandMarker);
m_bandMarker->setParentItem(this->parentItem());
m_bandMarker->setHeight(this->height());
}
m_bandMarker->setVisible(true);
}
}

View File

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

View File

@ -29,7 +29,17 @@ void GraphicsViewZoomer::setModifiers(Qt::KeyboardModifiers modifiers) {
}
void GraphicsViewZoomer::setZoomFactorBase(double value) {
m_zoomFactorBase = value;
m_zoomFactorBase = value;
}
void GraphicsViewZoomer::setView(QGraphicsView *view)
{
if (m_view!=view){
m_view->viewport()->removeEventFilter(this);
m_view = view;
m_view->viewport()->installEventFilter(this);
m_view->setMouseTracking(true);
}
}
bool GraphicsViewZoomer::eventFilter(QObject *object, QEvent *event) {

View File

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

View File

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

View File

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

View File

@ -61,12 +61,25 @@ PreviewReportWindow::PreviewReportWindow(ReportEnginePrivate *report,QWidget *pa
setCentralWidget(m_previewReportWidget);
layout()->setContentsMargins(1,1,1,1);
connect(m_previewReportWidget,SIGNAL(pageChanged(int)), this,SLOT(slotPageChanged(int)) );
connect(m_previewReportWidget->d_ptr->m_previewPage,SIGNAL(selectionChanged()),this,SLOT(slotSelectionChanged()));
connect(m_pagesNavigator,SIGNAL(valueChanged(int)),this,SLOT(slotPageNavigatorChanged(int)));
m_fontEditor = new FontEditorWidget(m_previewReportWidget->d_ptr->m_previewPage,tr("Font"),this);
m_fontEditor->setObjectName("fontTools");
m_fontEditor->setIconSize(ui->toolBar->iconSize());
m_textAlignmentEditor = new TextAlignmentEditorWidget(m_previewReportWidget->d_ptr->m_previewPage,tr("Text align"),this);
m_textAlignmentEditor->setObjectName("textAlignmentTools");
m_textAlignmentEditor->setIconSize(ui->toolBar->iconSize());
addToolBar(Qt::TopToolBarArea,m_fontEditor);
addToolBar(Qt::TopToolBarArea,m_textAlignmentEditor);
m_scalePercent = new QComboBox(this);
m_scalePercent->setEditable(true);
ui->toolBar->insertWidget(ui->actionZoomOut, m_scalePercent);
initPercentCombobox();
// connect(ui->graphicsView->verticalScrollBar(),SIGNAL(valueChanged(int)), this, SLOT(slotSliderMoved(int)));
connect(ui->actionShowMessages, SIGNAL(triggered()), this, SLOT(slotShowErrors()));
connect(m_previewReportWidget, SIGNAL(scalePercentChanged(int)), this, SLOT(slotScalePercentChanged(int)));
connect(m_scalePercent, SIGNAL(currentIndexChanged(QString)), this, SLOT(scaleComboboxChanged(QString)));
restoreSetting();
@ -209,6 +222,12 @@ void PreviewReportWindow::moveEvent(QMoveEvent* e)
#endif
}
void PreviewReportWindow::showEvent(QShowEvent *)
{
m_fontEditor->setVisible(ui->actionEdit_Mode->isChecked());
m_textAlignmentEditor->setVisible(ui->actionEdit_Mode->isChecked());
}
void PreviewReportWindow::slotPrint()
{
m_previewReportWidget->print();
@ -244,6 +263,28 @@ void PreviewReportWindow::slotShowErrors()
m_previewReportWidget->setErrorsMesagesVisible(ui->actionShowMessages->isChecked());
}
void PreviewReportWindow::on_actionEdit_Mode_triggered(bool checked)
{
m_previewReportWidget->d_ptr->m_previewPage->setItemMode((checked)?ItemModes(DesignMode):PreviewMode);
m_textAlignmentEditor->setVisible(checked);
m_fontEditor->setVisible(checked);
//m_reportPages.at(m_currentPage)->setItemMode((checked)?DesignMode:PreviewMode);
}
void PreviewReportWindow::slotSelectionChanged()
{
QGraphicsScene* page=dynamic_cast<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()
{
return m_reader.data();
@ -312,4 +353,4 @@ void PreviewReportWindow::on_actionShowMessages_toggled(bool value)
m_previewReportWidget->setErrorsMesagesVisible(value);
}
}// namespace LimeReport
}// namespace LimeReport

View File

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

View File

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

View File

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

View File

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

View File

@ -47,6 +47,7 @@
#include "lrbasedesignobjectmodel.h"
#include "lrreportdesignwidget.h"
#include "lrdatabrowser.h"
#include "scriptbrowser/lrscriptbrowser.h"
#include "lrbasedesignintf.h"
#include "lrpagedesignintf.h"
@ -70,6 +71,7 @@ ReportDesignWindow::ReportDesignWindow(ReportEnginePrivate *report, QWidget *par
createToolBars();
createObjectInspector();
createDataWindow();
createScriptWindow();
createObjectsBrowser();
m_instance=this;
m_statusBar=new QStatusBar(this);
@ -96,6 +98,15 @@ void ReportDesignWindow::createActions()
m_newReportAction->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_N));
connect(m_newReportAction,SIGNAL(triggered()),this,SLOT(slotNewReport()));
m_newPageAction = new QAction(tr("New Report Page"),this);
m_newPageAction->setIcon(QIcon(":/report/images/addPage"));
connect(m_newPageAction,SIGNAL(triggered()),this,SLOT(slotNewPage()));
m_deletePageAction = new QAction(tr("Delete Report Page"),this);
m_deletePageAction->setIcon(QIcon(":/report/images/deletePage"));
connect(m_deletePageAction,SIGNAL(triggered()),this,SLOT(slotDeletePage()));
m_deletePageAction->setEnabled(false);
m_editModeAction = new QAction(tr("Edit Mode"),this);
m_editModeAction->setIcon(QIcon(":/report/images/editMode"));
m_editModeAction->setCheckable(true);
@ -261,6 +272,10 @@ void ReportDesignWindow::createToolBars()
m_mainToolBar->addAction(m_settingsAction);
m_mainToolBar->addSeparator();
m_mainToolBar->addAction(m_newPageAction);
m_mainToolBar->addAction(m_deletePageAction);
m_mainToolBar->addSeparator();
m_mainToolBar->addAction(m_copyAction);
m_mainToolBar->addAction(m_pasteAction);
m_mainToolBar->addAction(m_cutAction);
@ -421,18 +436,18 @@ void ReportDesignWindow::initReportEditor(ReportEnginePrivate* report)
{
m_reportDesignWidget=new ReportDesignWidget(report,this,this);
setCentralWidget(m_reportDesignWidget);
connect(m_reportDesignWidget, SIGNAL(itemSelected(LimeReport::BaseDesignIntf*)),
this, SLOT(slotItemSelected(LimeReport::BaseDesignIntf*)));
connect(m_reportDesignWidget, SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)),
this, SLOT(slotItemPropertyChanged(QString,QString,QVariant,QVariant)));
connect(m_reportDesignWidget, SIGNAL(insertModeStarted()), this, SLOT(slotInsertModeStarted()));
connect(m_reportDesignWidget, SIGNAL(multiItemSelected()), this, SLOT(slotMultiItemSelected()));
connect(m_reportDesignWidget, SIGNAL(itemInserted(LimeReport::PageDesignIntf*,QPointF,QString)),
this, SLOT(slotItemInserted(LimeReport::PageDesignIntf*,QPointF,QString)));
connect(m_reportDesignWidget, SIGNAL(itemInsertCanceled(QString)), this, SLOT(slotItemInsertCanceled(QString)));
connect(m_reportDesignWidget->report(),SIGNAL(datasourceCollectionLoadFinished(QString)), this, SLOT(slotUpdateDataBrowser(QString)));
connect(m_reportDesignWidget, SIGNAL(commandHistoryChanged()),this,SLOT(slotCommandHistoryChanged()));
connect(m_reportDesignWidget,SIGNAL(itemSelected(LimeReport::BaseDesignIntf*)),
this,SLOT(slotItemSelected(LimeReport::BaseDesignIntf*)));
connect(m_reportDesignWidget,SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)),
this,SLOT(slotItemPropertyChanged(QString,QString,QVariant,QVariant)));
connect(m_reportDesignWidget,SIGNAL(insertModeStarted()),this,SLOT(slotInsertModeStarted()));
connect(m_reportDesignWidget,SIGNAL(multiItemSelected()),this,SLOT(slotMultiItemSelected()));
connect(m_reportDesignWidget,SIGNAL(itemInserted(LimeReport::PageDesignIntf*,QPointF,QString)),
this,SLOT(slotItemInserted(LimeReport::PageDesignIntf*,QPointF,QString)));
connect(m_reportDesignWidget,SIGNAL(itemInsertCanceled(QString)),this,SLOT(slotItemInsertCanceled(QString)));
connect(m_reportDesignWidget->report(),SIGNAL(datasourceCollectionLoadFinished(QString)),this,SLOT(slotUpdateDataBrowser(QString)));
connect(m_reportDesignWidget,SIGNAL(commandHistoryChanged()),this,SLOT(slotCommandHistoryChanged()));
connect(m_reportDesignWidget,SIGNAL(activePageChanged()),this,SLOT(slotActivePageChanged()));
connect(m_reportDesignWidget, SIGNAL(bandAdded(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)),
this, SLOT(slotBandAdded(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)));
connect(m_reportDesignWidget, SIGNAL(bandDeleted(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)),
@ -440,6 +455,8 @@ void ReportDesignWindow::initReportEditor(ReportEnginePrivate* report)
connect(m_reportDesignWidget->report(), SIGNAL(renderStarted()), this, SLOT(renderStarted()));
connect(m_reportDesignWidget->report(), SIGNAL(renderPageFinished(int)), this, SLOT(renderPageFinished(int)));
connect(m_reportDesignWidget->report(), SIGNAL(renderFinished()), this, SLOT(renderFinished()));
connect(m_reportDesignWidget, SIGNAL(pageAdded(PageDesignIntf*)), this, SLOT(slotPageAdded(PageDesignIntf*)));
connect(m_reportDesignWidget, SIGNAL(pageDeleted()), this, SLOT(slotPageDeleted()));
}
void ReportDesignWindow::createObjectInspector()
@ -491,6 +508,20 @@ void ReportDesignWindow::createDataWindow()
m_dataBrowser->setReportEditor(m_reportDesignWidget);
}
void ReportDesignWindow::createScriptWindow()
{
QDockWidget *dataDoc = new QDockWidget(this);
dataDoc->setWindowTitle(tr("Script Browser"));
m_scriptBrowser=new ScriptBrowser(dataDoc);
dataDoc->setWidget(m_scriptBrowser);
dataDoc->setObjectName("scriptDoc");
addDockWidget(Qt::LeftDockWidgetArea,dataDoc);
m_scriptBrowser->setReportEditor(m_reportDesignWidget);
#ifdef HAVE_UI_LOADER
m_scriptBrowser->updateDialogsTree();
#endif
}
void ReportDesignWindow::updateRedoUndo()
{
m_undoAction->setEnabled(m_reportDesignWidget->isCanUndo());
@ -701,7 +732,24 @@ QSettings*ReportDesignWindow::settings()
void ReportDesignWindow::slotNewReport()
{
if (checkNeedToSave()) startNewReport();
if (checkNeedToSave()) {
m_lblReportName->setText("");
startNewReport();
m_deletePageAction->setEnabled(false);
}
}
void ReportDesignWindow::slotNewPage(){
if (m_reportDesignWidget){
m_reportDesignWidget->addPage();
}
}
void ReportDesignWindow::slotDeletePage()
{
if (m_reportDesignWidget && m_reportDesignWidget->report()->pageCount()>1){
m_reportDesignWidget->deleteCurrentPage();
}
}
void ReportDesignWindow::slotNewTextItem()
@ -872,12 +920,32 @@ void ReportDesignWindow::slotLoadReport()
QApplication::processEvents();
setCursor(Qt::WaitCursor);
m_reportDesignWidget->clear();
m_reportDesignWidget->loadFromFile(fileName);
m_lblReportName->setText(fileName);
m_propertyModel->setObject(0);
updateRedoUndo();
if (m_reportDesignWidget->loadFromFile(fileName)){
m_lblReportName->setText(fileName);
m_propertyModel->setObject(0);
updateRedoUndo();
setWindowTitle(m_reportDesignWidget->report()->reportName() + " - Lime Report Designer");
if (!m_recentFiles.contains(fileName)){
if (m_recentFiles.count()==10){
QMap<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();
setWindowTitle(m_reportDesignWidget->report()->reportName() + " - Lime Report Designer");
setWindowTitle(m_reportDesignWidget->report()->reportName() + " - Lime Report Designer");
addRecentFile(fileName);
}
}
@ -951,13 +1019,13 @@ void ReportDesignWindow::slotTest()
void ReportDesignWindow::slotPrintReport()
{
setCursor(Qt::WaitCursor);
m_reportDesignWidget->report()->printReport();
m_reportDesignWidget->printReport();
setCursor(Qt::ArrowCursor);
}
void ReportDesignWindow::slotPreviewReport()
{
m_reportDesignWidget->report()->previewReport();
m_reportDesignWidget->previewReport();
}
void ReportDesignWindow::slotItemActionCliked()
@ -1010,6 +1078,12 @@ void ReportDesignWindow::slotBandDeleted(PageDesignIntf *, BandDesignIntf *band)
}
}
void ReportDesignWindow::slotActivePageChanged()
{
m_propertyModel->setObject(0);
updateRedoUndo();
}
void ReportDesignWindow::renderStarted()
{
if (m_showProgressDialog){
@ -1104,6 +1178,16 @@ void ReportDesignWindow::slotLoadRecentFile(const QString fileName)
}
}
void ReportDesignWindow::slotPageAdded(PageDesignIntf *page)
{
m_deletePageAction->setEnabled(m_reportDesignWidget->report()->pageCount()>1);
}
void ReportDesignWindow::slotPageDeleted()
{
m_deletePageAction->setEnabled(m_reportDesignWidget->report()->pageCount()>1);
}
void ReportDesignWindow::closeEvent(QCloseEvent * event)
{
if (checkNeedToSave()){

View File

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

View File

@ -61,6 +61,7 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) :
m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview"))
{
m_datasources= new DataSourceManager(this);
m_scriptEngineContext = new ScriptEngineContext(this);
m_datasources->setObjectName("datasources");
connect(m_datasources,SIGNAL(loadCollectionFinished(QString)),this,SLOT(slotDataSourceCollectionLoaded(QString)));
}
@ -103,6 +104,17 @@ PageDesignIntf *ReportEnginePrivate::appendPage(const QString &pageName)
return page;
}
bool ReportEnginePrivate::deletePage(PageDesignIntf *page){
QList<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()
{
return createPage();
@ -152,6 +164,7 @@ void ReportEnginePrivate::clearReport()
m_pages.clear();
m_datasources->clear(DataSourceManager::Owned);
m_fileName="";
m_scriptEngineContext->clear();
emit cleared();
}
@ -261,9 +274,44 @@ bool ReportEnginePrivate::printReport(QPrinter* printer)
printer =(printer)?printer:m_printer.data();
if (printer&&printer->isValid()){
try{
dataManager()->setDesignTime(false);
printReport(renderToPages(),*printer,PrintRange());
dataManager()->setDesignTime(false);
ReportPages pages = renderToPages();
dataManager()->setDesignTime(true);
if (pages.count()>0){
printReport(pages,*printer,PrintRange());
}
} catch(ReportError &exception){
saveError(exception.what());
}
return true;
} else return false;
}
bool ReportEnginePrivate::printPages(ReportPages pages, QPrinter *printer, PrintRange printRange)
{
if (!printer&&!m_printerSelected){
QPrintDialog dialog(m_printer.data(),QApplication::activeWindow());
m_printerSelected = dialog.exec()!=QDialog::Rejected;
if (m_printerSelected){
printRange.setRangeType(dialog.printRange());
printRange.setFromPage(dialog.fromPage());
printRange.setToPage(dialog.toPage());
}
}
if (!printer&&!m_printerSelected) return false;
printer =(printer)?printer:m_printer.data();
if (printer&&printer->isValid()){
try{
if (pages.count()>0){
printReport(
pages,
*printer,
printRange
);
}
} catch(ReportError &exception){
saveError(exception.what());
}
@ -401,6 +449,11 @@ void ReportEnginePrivate::cancelRender()
m_reportRender->cancelRender();
}
PageDesignIntf* ReportEngine::createPreviewScene(QObject* parent){
Q_D(ReportEngine);
return d->createPreviewScene(parent);
}
void ReportEnginePrivate::designReport()
{
if (!m_designerWindow) {
@ -456,7 +509,8 @@ bool ReportEnginePrivate::loadFromFile(const QString &fileName)
dataManager()->connectAutoConnections();
return true;
};
}
}
m_lastError = reader->lastError();
return false;
}
@ -555,6 +609,7 @@ QString ReportEnginePrivate::renderToString()
dataManager()->setDesignTime(false);
if (m_pages.count()){
render.setDatasources(dataManager());
render.setScriptContext(scriptContext());
return render.renderPageToString(m_pages.at(0));
}else return QString();
}
@ -588,12 +643,18 @@ ReportPages ReportEnginePrivate::renderToPages()
connect(m_reportRender.data(),SIGNAL(pageRendered(int)),
this, SIGNAL(renderPageFinished(int)));
if (m_pages.count()){
ReportPages result;
emit renderStarted();
m_reportRender->setDatasources(dataManager());
ReportPages result = m_reportRender->renderPageToPages(m_pages.at(0));
m_reportRender->setScriptContext(scriptContext());
foreach(PageDesignIntf* page , m_pages){
result.append(m_reportRender->renderPageToPages(page));
}
emit renderFinished();
m_reportRender.clear();
return result;
}else {
} else {
return ReportPages();
}
}
@ -628,6 +689,11 @@ bool ReportEngine::printReport(QPrinter *printer)
return d->printReport(printer);
}
bool ReportEngine::printPages(ReportPages pages, QPrinter *printer, PrintRange printRange){
Q_D(ReportEngine);
return d->printPages(pages,printer, printRange);
}
void ReportEngine::printToFile(const QString &fileName)
{
Q_D(ReportEngine);

View File

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

View File

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

View File

@ -158,6 +158,19 @@ void ReportRender::setDatasources(DataSourceManager *value)
m_datasources=value;
}
void ReportRender::setScriptContext(ScriptEngineContext* scriptContext)
{
m_scriptEngineContext=scriptContext;
}
bool ReportRender::runInitScript(){
if (m_scriptEngineContext){
QScriptValue res = ScriptEngineManager::instance().scriptEngine()->evaluate(m_scriptEngineContext->initScript());
if (res.isBool()) return res.toBool();
}
return true;
}
void ReportRender::initDatasources(){
try{
datasources()->setAllDatasourcesToFirst();
@ -181,6 +194,20 @@ void ReportRender::renderPage(PageDesignIntf* patternPage)
initVariables();
initGroupFunctions();
#ifdef HAVE_UI_LOADER
initDialogs();
#endif
if (runInitScript()){
clearPageMap();
try{
datasources()->setAllDatasourcesToFirst();
} catch(ReportError &exception){
//TODO posible should thow exeption
QMessageBox::critical(0,tr("Error"),exception.what());
return;
}
clearPageMap();
resetPageNumber();
@ -204,6 +231,7 @@ void ReportRender::renderPage(PageDesignIntf* patternPage)
savePage();
if (!m_renderCanceled)
secondRenderPass();
}
}
int ReportRender::pageCount()
@ -244,6 +272,18 @@ void ReportRender::initVariables()
m_datasources->setReportVariable("#PAGE_COUNT",0);
}
#ifdef HAVE_UI_LOADER
void ReportRender::initDialogs(){
if (m_scriptEngineContext){
QScriptEngine* se = ScriptEngineManager::instance().scriptEngine();
foreach(DialogDescriber::Ptr dialog, m_scriptEngineContext->dialogsDescriber()){
QScriptValue sv = se->newQObject(m_scriptEngineContext->getDialog(dialog->name()));
se->globalObject().setProperty(dialog->name(),sv);
}
}
}
#endif
void ReportRender::clearPageMap()
{
m_renderedPages.clear();
@ -523,6 +563,10 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da
dataSource->next();
}
closeDataGroup(band);
// if (gb->isNeedToStartNewPage()){
// savePage();
// startNewPage();
// }
}
if (!gb->isStarted()){
if (band->reprintOnEachPage())
@ -851,6 +895,7 @@ void ReportRender::startNewPage()
m_currentIndex=0;
renderPageHeader(m_patternPageItem);
//renderPageFooter(m_patternPageItem);
m_pageFooterHeight = calcPageFooterHeight(m_patternPageItem);
m_maxHeightByColumn[m_currentColumn] -= m_pageFooterHeight;
m_currentIndex=10;

View File

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

View File

@ -32,6 +32,11 @@
#include <QDate>
#include <QStringList>
#include <QScriptValueIterator>
#ifdef HAVE_UI_LOADER
#include <QUiLoader>
#include <QBuffer>
#include <QWidget>
#endif
#include "lrdatasourcemanager.h"
Q_DECLARE_METATYPE(QColor)
@ -375,6 +380,11 @@ void ScriptEngineManager::setDataManager(DataSourceManager *dataManager){
}
}
void ScriptEngineManager::updateModel()
{
}
ScriptEngineManager::ScriptEngineManager()
:m_model(0), m_dataManager(0)
{
@ -523,5 +533,196 @@ QString ScriptExtractor::substring(const QString &value, int start, int end)
return value.mid(start,end-start);
}
QString DialogDescriber::name() const
{
return m_name;
}
void DialogDescriber::setName(const QString& name)
{
m_name = name;
}
QByteArray DialogDescriber::description() const
{
return m_description;
}
void DialogDescriber::setDescription(const QByteArray &description)
{
m_description = description;
}
#ifdef HAVE_UI_LOADER
void ScriptEngineContext::addDialog(const QString& name, const QByteArray& description)
{
m_dialogs.push_back(DialogDescriber::create(name,description));
}
bool ScriptEngineContext::previewDialog(const QString& dialogName)
{
QDialog* dialog = getDialog(dialogName);
if (dialog) {
dialog->exec();
return true;
} else {
m_lastError = tr("Dialog with name: %1 can`t be created").arg(dialogName);
return false;
}
}
bool ScriptEngineContext::containsDialog(const QString& dialogName)
{
foreach(DialogDescriber::Ptr dialog, m_dialogs){
if (dialog->name()==dialogName)
return true;
}
return false;
}
void ScriptEngineContext::deleteDialog(const QString& dialogName)
{
{
QVector<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

View File

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

View File

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

View File

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

View File

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

View File

@ -88,7 +88,7 @@ namespace LimeReport{
void setColorIndex(int propertyValue);
void setModel(QAbstractItemModel* model){m_model=model;}
QAbstractItemModel* model(){return m_model;}
void setModelIndex(QModelIndex index){m_index=index;}
void setModelIndex(const QModelIndex& index){m_index=index;}
QModelIndex modelIndex(){return m_index;}
bool isClass(){return m_isClass;}
#ifdef INSPECT_BASEDESIGN

View File

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

View File

@ -165,5 +165,7 @@
<file>images/FitWidth.png</file>
<file>images/OneToOne.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>
</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);
if (source.open(QFile::ReadOnly)) {
doc->setContent(&source);
if (doc->documentElement().nodeName()!="Report") {
m_error = QString(QObject::tr("Wrong file format"));
return false;
}
} else {m_error=QString(QObject::tr("File %1 not opened")).arg(m_fileName); return false;}
}
return true;

View File

@ -37,12 +37,19 @@ namespace LimeReport{
XMLWriter::XMLWriter() : m_doc(new QDomDocument)
{
m_rootElement=m_doc->createElement("Report");
m_doc->appendChild(m_rootElement);
init();
}
XMLWriter::XMLWriter(QSharedPointer<QDomDocument> doc) : m_doc(doc){
init();
}
void XMLWriter::init()
{
m_rootElement=m_doc->createElement("Report");
QDomNode xmlNode = m_doc->createProcessingInstruction("xml",
"version=\"1.0\" encoding=\"UTF8\"");
m_doc->insertBefore(xmlNode,m_doc->firstChild());
m_doc->appendChild(m_rootElement);
}

View File

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

Binary file not shown.

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="es_ES">
<TS version="2.0" language="es_ES">
<context>
<name>LRVariableDialog</name>
<message>
@ -28,15 +28,15 @@
<name>LimeReport::AVariablesHolder</name>
<message>
<source>variable with name </source>
<translation>variable con el nombre</translation>
<translation type="obsolete">variable con el nombre</translation>
</message>
<message>
<source> already exists !!</source>
<translation>ya existe !!</translation>
<translation type="obsolete">ya existe !!</translation>
</message>
<message>
<source> does not exists !!</source>
<translation>no existe !!</translation>
<translation type="obsolete">no existe !!</translation>
</message>
</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>
<translation></translation>
</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;
&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; }
@ -395,7 +395,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<source>User variables</source>
<translation>Variables de usuario</translation>
<translation type="obsolete">Variables de usuario</translation>
</message>
<message>
<source>System variables</source>
@ -413,6 +413,18 @@ p, li { white-space: pre-wrap; }
<source>Error</source>
<translation type="unfinished"></translation>
</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>
<name>LimeReport::DataFooterBand</name>
@ -758,6 +770,14 @@ p, li { white-space: pre-wrap; }
<source>One to one</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Font</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Text align</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::ProxyHolder</name>
@ -993,6 +1013,22 @@ p, li { white-space: pre-wrap; }
<source>Report file name</source>
<translation type="unfinished"></translation>
</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>
<name>LimeReport::ReportDesignWindow</name>
@ -1220,6 +1256,18 @@ p, li { white-space: pre-wrap; }
<source>File &quot;%1&quot; not found!</source>
<translation type="unfinished"></translation>
</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>
<name>LimeReport::ReportEnginePrivate</name>
@ -1227,6 +1275,10 @@ p, li { white-space: pre-wrap; }
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Preview</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::ReportFooter</name>
@ -1356,6 +1408,60 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
</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>
<name>LimeReport::ScriptEngineManager</name>
<message>
@ -1382,6 +1488,10 @@ p, li { white-space: pre-wrap; }
<source>Locale</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CurrencySymbol</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::SettingDialog</name>
@ -1494,6 +1604,21 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
</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>
<name>QObject</name>
<message>
@ -1688,5 +1813,9 @@ p, li { white-space: pre-wrap; }
<source>Content is empty</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Wrong file format</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

Binary file not shown.

View File

@ -1,137 +1,137 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ru_RU">
<TS version="2.0" language="ru_RU">
<context>
<name>AboutDialog</name>
<message>
<source>About</source>
<translation type="vanished">О программе</translation>
<translation type="obsolete">О программе</translation>
</message>
<message>
<source>Author</source>
<translation type="vanished">Автор</translation>
<translation type="obsolete">Автор</translation>
</message>
<message>
<source>License</source>
<translation type="vanished">Лицензия</translation>
<translation type="obsolete">Лицензия</translation>
</message>
<message>
<source>Close</source>
<translation type="vanished">Закрыть</translation>
<translation type="obsolete">Закрыть</translation>
</message>
<message>
<source>Version 1.1.1</source>
<translation type="vanished">Версия</translation>
<translation type="obsolete">Версия</translation>
</message>
</context>
<context>
<name>ConnectionDialog</name>
<message>
<source>Connection</source>
<translation type="vanished">Соединение</translation>
<translation type="obsolete">Соединение</translation>
</message>
<message>
<source>Connection Name</source>
<translation type="vanished">Название</translation>
<translation type="obsolete">Название</translation>
</message>
<message>
<source>Driver</source>
<translation type="vanished">Драйвер</translation>
<translation type="obsolete">Драйвер</translation>
</message>
<message>
<source>Server </source>
<translation type="vanished">Сервер</translation>
<translation type="obsolete">Сервер</translation>
</message>
<message>
<source>User</source>
<translation type="vanished">Пользователь</translation>
<translation type="obsolete">Пользователь</translation>
</message>
<message>
<source>Password</source>
<translation type="vanished">Пароль</translation>
<translation type="obsolete">Пароль</translation>
</message>
<message>
<source>Database</source>
<translation type="vanished">База данных</translation>
<translation type="obsolete">База данных</translation>
</message>
<message>
<source>Auto connect</source>
<translation type="vanished">Автоматическое соединение</translation>
<translation type="obsolete">Автоматическое соединение</translation>
</message>
<message>
<source>Check connection</source>
<translation type="vanished">Проверить соединение</translation>
<translation type="obsolete">Проверить соединение</translation>
</message>
<message>
<source>Cancel</source>
<translation type="vanished">Отмена</translation>
<translation type="obsolete">Отмена</translation>
</message>
<message>
<source>Error</source>
<translation type="vanished">Ошибка</translation>
<translation type="obsolete">Ошибка</translation>
</message>
<message>
<source>Connection succsesfully established!</source>
<translation type="vanished">Соединение успешно установлено!</translation>
<translation type="obsolete">Соединение успешно установлено!</translation>
</message>
<message>
<source>Connection Name is empty</source>
<translation type="vanished">Наименование соединения не указано</translation>
<translation type="obsolete">Наименование соединения не указано</translation>
</message>
<message>
<source>Connection with name </source>
<translation type="vanished">Соединение</translation>
<translation type="obsolete">Соединение</translation>
</message>
<message>
<source> already exists </source>
<translation type="vanished">уже существует</translation>
<translation type="obsolete">уже существует</translation>
</message>
</context>
<context>
<name>DataBrowser</name>
<message>
<source>Datasources</source>
<translation type="vanished">Источники данных</translation>
<translation type="obsolete">Источники данных</translation>
</message>
<message>
<source>Add database connection</source>
<translation type="vanished">Добавить соединение с базой</translation>
<translation type="obsolete">Добавить соединение с базой</translation>
</message>
<message>
<source>Add new datasource</source>
<translation type="vanished">Добавить новый источник данных</translation>
<translation type="obsolete">Добавить новый источник данных</translation>
</message>
<message>
<source>View data</source>
<translation type="vanished">Просмотр данных в источнике</translation>
<translation type="obsolete">Просмотр данных в источнике</translation>
</message>
<message>
<source>Change datasource</source>
<translation type="vanished">Изменить источник данных</translation>
<translation type="obsolete">Изменить источник данных</translation>
</message>
<message>
<source>Delete datasource</source>
<translation type="vanished">Удалить источник данных</translation>
<translation type="obsolete">Удалить источник данных</translation>
</message>
<message>
<source>Show error</source>
<translation type="vanished">Показать ошибки</translation>
<translation type="obsolete">Показать ошибки</translation>
</message>
<message>
<source>Variables</source>
<translation type="vanished">Переменные</translation>
<translation type="obsolete">Переменные</translation>
</message>
<message>
<source>Add new variable</source>
<translation type="vanished">Добавить новую переменную</translation>
<translation type="obsolete">Добавить новую переменную</translation>
</message>
<message>
<source>Edit variable</source>
<translation type="vanished">Редактировать переменную</translation>
<translation type="obsolete">Редактировать переменную</translation>
</message>
<message>
<source>Delete variable</source>
<translation type="vanished">Удалить переменную</translation>
<translation type="obsolete">Удалить переменную</translation>
</message>
</context>
<context>
@ -161,15 +161,15 @@
<name>LimeReport::AVariablesHolder</name>
<message>
<source>variable with name </source>
<translation>переменная</translation>
<translation type="obsolete">переменная</translation>
</message>
<message>
<source> already exists !!</source>
<translation>уже существует !!</translation>
<translation type="obsolete">уже существует !!</translation>
</message>
<message>
<source> does not exists !!</source>
<translation>не существует !!</translation>
<translation type="obsolete">не существует !!</translation>
</message>
</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>
<translation type="unfinished"></translation>
</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;
&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; }
@ -525,7 +525,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<source>User variables</source>
<translation>Пользовательские переменные</translation>
<translation type="obsolete">Пользовательские переменные</translation>
</message>
<message>
<source>System variables</source>
@ -538,7 +538,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<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>
<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>
<translation type="unfinished"></translation>
</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>
<name>LimeReport::DataFooterBand</name>
@ -779,11 +791,11 @@ p, li { white-space: pre-wrap; }
<name>LimeReport::PageDesignIntf</name>
<message>
<source>Warning</source>
<translation type="vanished">Предупреждение</translation>
<translation type="obsolete">Предупреждение</translation>
</message>
<message>
<source>Multi band deletion not allowed</source>
<translation type="vanished">Удаление нескольких бандов запрещено</translation>
<translation type="obsolete">Удаление нескольких бандов запрещено</translation>
</message>
</context>
<context>
@ -917,6 +929,14 @@ p, li { white-space: pre-wrap; }
<source>One to one</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Font</source>
<translation type="unfinished">Шрифт</translation>
</message>
<message>
<source>Text align</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::ProxyHolder</name>
@ -1152,6 +1172,22 @@ p, li { white-space: pre-wrap; }
<source>Report file name</source>
<translation>Файл отчета</translation>
</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>
<name>LimeReport::ReportDesignWindow</name>
@ -1379,6 +1415,18 @@ p, li { white-space: pre-wrap; }
<source>File &quot;%1&quot; not found!</source>
<translation type="unfinished"></translation>
</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>
<name>LimeReport::ReportEnginePrivate</name>
@ -1386,6 +1434,10 @@ p, li { white-space: pre-wrap; }
<source>Error</source>
<translation>Ошибка</translation>
</message>
<message>
<source>Preview</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::ReportFooter</name>
@ -1515,6 +1567,60 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
</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>
<name>LimeReport::ScriptEngineManager</name>
<message>
@ -1541,6 +1647,10 @@ p, li { white-space: pre-wrap; }
<source>Locale</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>CurrencySymbol</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LimeReport::SettingDialog</name>
@ -1653,91 +1763,106 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
</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>
<name>PreviewReportWindow</name>
<message>
<source>Preview</source>
<translation type="vanished">Предварительный просмотр</translation>
<translation type="obsolete">Предварительный просмотр</translation>
</message>
<message>
<source>View</source>
<translation type="vanished">Просмотр</translation>
<translation type="obsolete">Просмотр</translation>
</message>
<message>
<source>Report</source>
<translation type="vanished">Отчет</translation>
<translation type="obsolete">Отчет</translation>
</message>
<message>
<source>toolBar</source>
<translation type="vanished">Панель инструментов</translation>
<translation type="obsolete">Панель инструментов</translation>
</message>
<message>
<source>Print</source>
<translation type="vanished">Печать</translation>
<translation type="obsolete">Печать</translation>
</message>
<message>
<source>Zoom In</source>
<translation type="vanished">Увеличить</translation>
<translation type="obsolete">Увеличить</translation>
</message>
<message>
<source>Zoom Out</source>
<translation type="vanished">Уменьшить</translation>
<translation type="obsolete">Уменьшить</translation>
</message>
<message>
<source>Prior Page</source>
<translation type="vanished">Предыдущая страница</translation>
<translation type="obsolete">Предыдущая страница</translation>
</message>
<message>
<source>Next Page</source>
<translation type="vanished">Следующая страница</translation>
<translation type="obsolete">Следующая страница</translation>
</message>
<message>
<source>Close Preview</source>
<translation type="vanished">Закрыть</translation>
<translation type="obsolete">Закрыть</translation>
</message>
<message>
<source>Edit Mode</source>
<translation type="vanished">Режим редактирования</translation>
<translation type="obsolete">Режим редактирования</translation>
</message>
<message>
<source>Save to file</source>
<translation type="vanished">Записать в файл</translation>
<translation type="obsolete">Записать в файл</translation>
</message>
<message>
<source>Show errors</source>
<translation type="vanished">Показать ошибки</translation>
<translation type="obsolete">Показать ошибки</translation>
</message>
<message>
<source>First Page</source>
<translation type="vanished">Первая страница</translation>
<translation type="obsolete">Первая страница</translation>
</message>
<message>
<source>First page</source>
<translation type="vanished">Первая страница</translation>
<translation type="obsolete">Первая страница</translation>
</message>
<message>
<source>Last Page</source>
<translation type="vanished">Последняя страница</translation>
<translation type="obsolete">Последняя страница</translation>
</message>
<message>
<source>Print To PDF</source>
<translation type="vanished">Печать в PDF</translation>
<translation type="obsolete">Печать в PDF</translation>
</message>
<message>
<source>Page: </source>
<translation type="vanished">Страница: </translation>
<translation type="obsolete">Страница: </translation>
</message>
<message>
<source> of %1</source>
<translation type="vanished"> из %1</translation>
<translation type="obsolete"> из %1</translation>
</message>
<message>
<source>Report file name</source>
<translation type="vanished">Файл отчета</translation>
<translation type="obsolete">Файл отчета</translation>
</message>
<message>
<source>PDF file name</source>
<translation type="vanished">Имя PDF файла</translation>
<translation type="obsolete">Имя PDF файла</translation>
</message>
</context>
<context>
@ -1824,7 +1949,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<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>
<source>Child</source>
@ -1884,19 +2009,19 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<source>TopLine</source>
<translation type="vanished">Верхняя граница</translation>
<translation type="obsolete">Верхняя граница</translation>
</message>
<message>
<source>BottomLine</source>
<translation type="vanished">Нижняя граница</translation>
<translation type="obsolete">Нижняя граница</translation>
</message>
<message>
<source>LeftLine</source>
<translation type="vanished">Левая граница</translation>
<translation type="obsolete">Левая граница</translation>
</message>
<message>
<source>RightLine</source>
<translation type="vanished">Правая граница</translation>
<translation type="obsolete">Правая граница</translation>
</message>
<message>
<source>content</source>
@ -1954,161 +2079,165 @@ p, li { white-space: pre-wrap; }
<source>Content is empty</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Wrong file format</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SQLEditDialog</name>
<message>
<source>Datasource</source>
<translation type="vanished">Источник данных</translation>
<translation type="obsolete">Источник данных</translation>
</message>
<message>
<source>Connection</source>
<translation type="vanished">Соединение</translation>
<translation type="obsolete">Соединение</translation>
</message>
<message>
<source>Datasource Name</source>
<translation type="vanished">Имя источника</translation>
<translation type="obsolete">Имя источника</translation>
</message>
<message>
<source>Subdetail</source>
<translation type="vanished">Подчиненный</translation>
<translation type="obsolete">Подчиненный</translation>
</message>
<message>
<source>Master datasource</source>
<translation type="vanished">Главный источник</translation>
<translation type="obsolete">Главный источник</translation>
</message>
<message>
<source>Subquery mode</source>
<translation type="vanished">Режим подзапроса</translation>
<translation type="obsolete">Режим подзапроса</translation>
</message>
<message>
<source>Filter mode</source>
<translation type="vanished">Режим фильтрации</translation>
<translation type="obsolete">Режим фильтрации</translation>
</message>
<message>
<source>SQL</source>
<translation type="vanished">SQL запрос</translation>
<translation type="obsolete">SQL запрос</translation>
</message>
<message>
<source>Preview</source>
<translation type="vanished">Предпросмотр</translation>
<translation type="obsolete">Предпросмотр</translation>
</message>
<message>
<source>Hide Preview</source>
<translation type="vanished">Скрыть</translation>
<translation type="obsolete">Скрыть</translation>
</message>
<message>
<source>Child datasource</source>
<translation type="vanished">Подчиненный источник</translation>
<translation type="obsolete">Подчиненный источник</translation>
</message>
<message>
<source>Fields map</source>
<translation type="vanished">Поля для связи источников</translation>
<translation type="obsolete">Поля для связи источников</translation>
</message>
<message>
<source>Data preview</source>
<translation type="vanished">Данные</translation>
<translation type="obsolete">Данные</translation>
</message>
<message>
<source>Cancel</source>
<translation type="vanished">Отмена</translation>
<translation type="obsolete">Отмена</translation>
</message>
<message>
<source>Error</source>
<translation type="vanished">Ошибка</translation>
<translation type="obsolete">Ошибка</translation>
</message>
<message>
<source>Datasource Name is empty !</source>
<translation type="vanished">Имя источника данных не заполнено !</translation>
<translation type="obsolete">Имя источника данных не заполнено !</translation>
</message>
<message>
<source>SQL is empty !</source>
<translation type="vanished">SQL запрос пустой !</translation>
<translation type="obsolete">SQL запрос пустой !</translation>
</message>
<message>
<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>
<source>Datasource with name %1 already exist</source>
<translation type="vanished">Источник данных с именем: &quot;%1&quot; уже существует</translation>
<translation type="obsolete">Источник данных с именем: &quot;%1&quot; уже существует</translation>
</message>
<message>
<source>Attention</source>
<translation type="vanished">Внимание</translation>
<translation type="obsolete">Внимание</translation>
</message>
<message>
<source>Connection is not specified</source>
<translation type="vanished">Соединение не указано</translation>
<translation type="obsolete">Соединение не указано</translation>
</message>
<message>
<source>Refresh</source>
<translation type="vanished">Обновить</translation>
<translation type="obsolete">Обновить</translation>
</message>
</context>
<context>
<name>SettingDialog</name>
<message>
<source>Designer setting</source>
<translation type="vanished">Настройки дизайнера</translation>
<translation type="obsolete">Настройки дизайнера</translation>
</message>
<message>
<source>Default font</source>
<translation type="vanished">Шрифт по умолчанию</translation>
<translation type="obsolete">Шрифт по умолчанию</translation>
</message>
<message>
<source>Grid</source>
<translation type="vanished">Сетка</translation>
<translation type="obsolete">Сетка</translation>
</message>
<message>
<source>Vertical grid step</source>
<translation type="vanished">Вертикальный шаг</translation>
<translation type="obsolete">Вертикальный шаг</translation>
</message>
<message>
<source>Horizontal grid step</source>
<translation type="vanished">Горизонтальный шаг</translation>
<translation type="obsolete">Горизонтальный шаг</translation>
</message>
</context>
<context>
<name>TextItemEditor</name>
<message>
<source>Text Item Editor</source>
<translation type="vanished">Редактор текстового элемента</translation>
<translation type="obsolete">Редактор текстового элемента</translation>
</message>
<message>
<source>Content</source>
<translation type="vanished">Содержимое</translation>
<translation type="obsolete">Содержимое</translation>
</message>
<message>
<source>Data</source>
<translation type="vanished">Источники данных</translation>
<translation type="obsolete">Источники данных</translation>
</message>
<message>
<source>Functions</source>
<translation type="vanished">Функции</translation>
<translation type="obsolete">Функции</translation>
</message>
<message>
<source>Editor settings</source>
<translation type="vanished">Настройки</translation>
<translation type="obsolete">Настройки</translation>
</message>
<message>
<source>Editor font</source>
<translation type="vanished">Шрифт редактора</translation>
<translation type="obsolete">Шрифт редактора</translation>
</message>
<message>
<source>Cancel</source>
<translation type="vanished">Отмена</translation>
<translation type="obsolete">Отмена</translation>
</message>
</context>
<context>
<name>WaitForm</name>
<message>
<source>Wait</source>
<translation type="vanished">Ожидайте</translation>
<translation type="obsolete">Ожидайте</translation>
</message>
<message>
<source>Please wait ...</source>
<translation type="vanished">Пожалуста подождите ...</translation>
<translation type="obsolete">Пожалуста подождите ...</translation>
</message>
</context>
</TS>