mirror of
				https://github.com/fralx/LimeReport.git
				synced 2025-11-04 07:01:26 +03:00 
			
		
		
		
	Optionally monitor changes to files loaded with ReportEngine::loadFromFile()
When using the designer as a stand alone application and the renderer/preview in the user application, the preview window would have to be closed and opened again every time a change was made to the report. This change adds an optional QFileSystemWatcher to monitor changes to the report file and automatically refreshes the preview in the application when it is saved. It may be turned on using the new parameter to ReportEngine::loadFromFile(). If the preview window is open in the application and the file name changes or the file is removed, inform the user and close the preview window.
This commit is contained in:
		@@ -42,6 +42,8 @@
 | 
			
		||||
#include "serializators/lrstorageintf.h"
 | 
			
		||||
#include "lrscriptenginemanager.h"
 | 
			
		||||
 | 
			
		||||
class QFileSystemWatcher;
 | 
			
		||||
 | 
			
		||||
namespace LimeReport{
 | 
			
		||||
 | 
			
		||||
class PageDesignIntf;
 | 
			
		||||
@@ -91,7 +93,7 @@ public:
 | 
			
		||||
    void    setSettings(QSettings* value);
 | 
			
		||||
    void    setShowProgressDialog(bool value){m_showProgressDialog = value;}
 | 
			
		||||
    QSettings*  settings();
 | 
			
		||||
    bool    loadFromFile(const QString& fileName);
 | 
			
		||||
    bool    loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange);
 | 
			
		||||
    bool    loadFromByteArray(QByteArray *data, const QString& name = "");
 | 
			
		||||
    bool    loadFromString(const QString& report, const QString& name = "");
 | 
			
		||||
    QString reportFileName(){return m_fileName;}
 | 
			
		||||
@@ -138,6 +140,7 @@ signals:
 | 
			
		||||
    void    onSave();
 | 
			
		||||
    void    saveFinished();
 | 
			
		||||
public slots:
 | 
			
		||||
    bool    slotLoadFromFile(const QString& fileName);
 | 
			
		||||
    void    cancelRender();
 | 
			
		||||
protected:
 | 
			
		||||
    PageDesignIntf* createPage(const QString& pageName="");
 | 
			
		||||
@@ -178,6 +181,8 @@ private:
 | 
			
		||||
    bool m_reportRendering;
 | 
			
		||||
    bool m_resultIsEditable;
 | 
			
		||||
    QString m_passPhrase;
 | 
			
		||||
 | 
			
		||||
    QFileSystemWatcher  *m_fileWatcher;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user