mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-24 12:34:39 +03:00
Changes tracking has been fixed
This commit is contained in:
parent
2ed1b4b05f
commit
87d0bd5f28
@ -214,7 +214,7 @@ public:
|
||||
ReportSettings *reportSettings() const;
|
||||
void setReportSettings(ReportSettings *reportSettings);
|
||||
|
||||
bool isHasChanges(){ return m_hasChanges; }
|
||||
bool hasChanges(){ return m_hasChanges; }
|
||||
void dropChanges(){ m_hasChanges = false; }
|
||||
signals:
|
||||
void loadCollectionFinished(const QString& collectionName);
|
||||
|
@ -284,6 +284,7 @@ void ReportDesignWidget::createTabs(){
|
||||
}
|
||||
|
||||
m_scriptEditor = new ScriptEditor(this);
|
||||
connect(m_scriptEditor, SIGNAL(textChanged()), this, SLOT(slotScriptTextChanged()));
|
||||
m_scriptEditor->setReportEngine(m_report);
|
||||
pageIndex = m_tabWidget->addTab(m_scriptEditor,QIcon(),tr("Script"));
|
||||
m_tabWidget->setTabWhatsThis(pageIndex,"script");
|
||||
@ -882,6 +883,11 @@ void ReportDesignWidget::slotReportLoaded()
|
||||
m_dialogChanged = false;
|
||||
}
|
||||
|
||||
void ReportDesignWidget::slotScriptTextChanged()
|
||||
{
|
||||
m_report->scriptContext()->setInitScript(m_scriptEditor->toPlainText());
|
||||
}
|
||||
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
|
||||
void ReportDesignWidget::addNewDialog()
|
||||
|
@ -173,6 +173,7 @@ private slots:
|
||||
void slotSceneRectChanged(QRectF);
|
||||
void slotCurrentTabChanged(int index);
|
||||
void slotReportLoaded();
|
||||
void slotScriptTextChanged();
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
void slotDialogChanged(QString);
|
||||
void slotDialogNameChanged(QString oldName, QString newName);
|
||||
|
@ -662,6 +662,8 @@ void ReportDesignWindow::startNewReport()
|
||||
m_editorTabType = ReportDesignWidget::Page;
|
||||
showDefaultToolBars();
|
||||
m_reportDesignWidget->report()->dataManager()->dropChanges();
|
||||
m_reportDesignWidget->report()->scriptContext()->dropChanges();
|
||||
|
||||
}
|
||||
|
||||
void ReportDesignWindow::writePosition()
|
||||
|
@ -717,7 +717,7 @@ bool ReportEnginePrivate::slotLoadFromFile(const QString &fileName)
|
||||
EASY_BLOCK("Connect auto connections")
|
||||
dataManager()->connectAutoConnections();
|
||||
EASY_END_BLOCK;
|
||||
dataManager()->dropChanges();
|
||||
dropChanges();
|
||||
|
||||
if ( hasActivePreview() )
|
||||
{
|
||||
@ -881,7 +881,7 @@ bool ReportEnginePrivate::saveToFile(const QString &fileName)
|
||||
page->setToSaved();
|
||||
}
|
||||
}
|
||||
m_datasources->dropChanges();
|
||||
dropChanges();
|
||||
return saved;
|
||||
}
|
||||
|
||||
@ -896,7 +896,7 @@ QByteArray ReportEnginePrivate::saveToByteArray()
|
||||
page->setToSaved();
|
||||
}
|
||||
}
|
||||
m_datasources->dropChanges();
|
||||
dropChanges();
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -910,7 +910,7 @@ QString ReportEnginePrivate::saveToString(){
|
||||
page->setToSaved();
|
||||
}
|
||||
}
|
||||
m_datasources->dropChanges();
|
||||
dropChanges();
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -919,9 +919,11 @@ bool ReportEnginePrivate::isNeedToSave()
|
||||
foreach(PageDesignIntf* page, m_pages){
|
||||
if (page->isHasChanges()) return true;
|
||||
}
|
||||
if (dataManager()->isHasChanges()){
|
||||
if (dataManager()->hasChanges()){
|
||||
return true;
|
||||
}
|
||||
if (scriptContext()->hasChanges())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -249,6 +249,7 @@ private:
|
||||
PageItemDesignIntf *createRenderingPage(PageItemDesignIntf *page);
|
||||
void initReport();
|
||||
void paintByExternalPainter(const QString& objectName, QPainter* painter, const QStyleOptionGraphicsItem* options);
|
||||
void dropChanges(){ m_datasources->dropChanges(); m_scriptEngineContext->dropChanges();}
|
||||
private:
|
||||
QList<PageDesignIntf*> m_pages;
|
||||
QList<PageItemDesignIntf*> m_renderingPages;
|
||||
|
@ -1390,7 +1390,10 @@ QString ScriptEngineContext::initScript() const
|
||||
|
||||
void ScriptEngineContext::setInitScript(const QString& initScript)
|
||||
{
|
||||
if (m_initScript != initScript){
|
||||
m_initScript = initScript;
|
||||
m_hasChanges = true;
|
||||
}
|
||||
}
|
||||
|
||||
DialogDescriber::Ptr DialogDescriber::create(const QString& name, const QByteArray& desc) {
|
||||
@ -1884,7 +1887,7 @@ void TableBuilder::buildTable(const QString& datasourceName)
|
||||
fillInRowData(addRow());
|
||||
m_dataManager->dataSource(datasourceName)->next();
|
||||
}
|
||||
m_horizontalLayout->setVisible(false);
|
||||
m_horizontalLayout->setHeight(0);
|
||||
}
|
||||
|
||||
void TableBuilder::checkBaseLayout()
|
||||
|
@ -174,7 +174,9 @@ public:
|
||||
#ifdef HAVE_UI_LOADER
|
||||
typedef QSharedPointer<QDialog> DialogPtr;
|
||||
#endif
|
||||
explicit ScriptEngineContext(QObject* parent=0):QObject(parent), m_tableOfContents(new TableOfContents(this)){}
|
||||
explicit ScriptEngineContext(QObject* parent=0):
|
||||
QObject(parent),
|
||||
m_tableOfContents(new TableOfContents(this)), m_hasChanges(false) {}
|
||||
#ifdef HAVE_UI_LOADER
|
||||
void addDialog(const QString& name, const QByteArray& description);
|
||||
bool changeDialog(const QString& name, const QByteArray &description);
|
||||
@ -200,7 +202,8 @@ public:
|
||||
void setCurrentPage(PageItemDesignIntf* currentPage);
|
||||
TableOfContents* tableOfContents() const;
|
||||
void setTableOfContents(TableOfContents* tableOfContents);
|
||||
|
||||
void dropChanges(){ m_hasChanges = false;}
|
||||
bool hasChanges(){ return m_hasChanges;}
|
||||
#ifdef HAVE_UI_LOADER
|
||||
signals:
|
||||
void dialogNameChanged(QString dialogName);
|
||||
@ -227,6 +230,7 @@ private:
|
||||
BandDesignIntf* m_currentBand;
|
||||
PageItemDesignIntf* m_currentPage;
|
||||
TableOfContents* m_tableOfContents;
|
||||
bool m_hasChanges;
|
||||
};
|
||||
|
||||
class JSFunctionDesc{
|
||||
|
@ -282,8 +282,8 @@ void CodeEditor::insertCompletion(const QString &completion)
|
||||
return;
|
||||
QTextCursor tc = textCursor();
|
||||
int extra = completion.length() - m_compleater->completionPrefix().length();
|
||||
tc.movePosition(QTextCursor::Left);
|
||||
tc.movePosition(QTextCursor::EndOfWord);
|
||||
//tc.movePosition(QTextCursor::Left);
|
||||
//tc.movePosition(QTextCursor::EndOfWord);
|
||||
tc.insertText(completion.right(extra));
|
||||
setTextCursor(tc);
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ ScriptEditor::ScriptEditor(QWidget *parent) :
|
||||
ui->textEdit->setCompleter(m_completer);
|
||||
ui->textEdit->setTabStopWidth(ui->textEdit->fontMetrics().width("0")*m_tabIndention);
|
||||
connect(ui->splitter, SIGNAL(splitterMoved(int,int)), this, SIGNAL(splitterMoved(int,int)));
|
||||
connect(ui->textEdit, SIGNAL(textChanged()), this, SIGNAL(textChanged()));
|
||||
}
|
||||
|
||||
ScriptEditor::~ScriptEditor()
|
||||
@ -361,3 +362,5 @@ void ReportStructureCompleater::addChildItem(BaseDesignIntf *item, const QString
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -60,8 +60,11 @@ public:
|
||||
void setEditorFont(QFont font);
|
||||
QFont editorFont();
|
||||
QString toPlainText();
|
||||
bool hasChanges() const;
|
||||
void setHasChanges(bool hasChanges);
|
||||
signals:
|
||||
void splitterMoved(int, int);
|
||||
void textChanged();
|
||||
protected:
|
||||
void initEditor(DataSourceManager* dm);
|
||||
|
||||
@ -69,6 +72,7 @@ private slots:
|
||||
void on_twData_doubleClicked(const QModelIndex &index);
|
||||
void on_twScriptEngine_doubleClicked(const QModelIndex &index);
|
||||
void slotOnCurrentChanged(const QModelIndex& to, const QModelIndex&);
|
||||
|
||||
private:
|
||||
Ui::ScriptEditor *ui;
|
||||
ReportEnginePrivateInterface* m_reportEngine;
|
||||
|
Loading…
Reference in New Issue
Block a user