mirror of
https://github.com/fralx/LimeReport.git
synced 2025-11-25 00:18:06 +03:00
plugin extracted
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QPluginLoader>
|
||||
|
||||
#include "time.h"
|
||||
|
||||
@@ -42,8 +43,9 @@
|
||||
|
||||
#include "lrpagedesignintf.h"
|
||||
#include "lrdatasourcemanager.h"
|
||||
#include "lrdatabrowser.h"
|
||||
#include "lrreportdesignwindow.h"
|
||||
//#include "lrdatabrowser.h"
|
||||
//#include "lrreportdesignwindow.h"
|
||||
|
||||
|
||||
#include "serializators/lrxmlwriter.h"
|
||||
#include "serializators/lrxmlreader.h"
|
||||
@@ -51,6 +53,8 @@
|
||||
#include "lrpreviewreportwindow.h"
|
||||
#include "lrpreviewreportwidget.h"
|
||||
#include "lrpreviewreportwidget_p.h"
|
||||
|
||||
|
||||
#ifdef HAVE_STATIC_BUILD
|
||||
#include "lrfactoryinitializer.h"
|
||||
#endif
|
||||
@@ -64,7 +68,7 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) :
|
||||
m_showProgressDialog(true), m_reportName(""), m_activePreview(0),
|
||||
m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")),
|
||||
m_reportRendering(false), m_resultIsEditable(true), m_passPhrase("HjccbzHjlbyfCkjy"),
|
||||
m_fileWatcher( new QFileSystemWatcher( this ) ), m_reportLanguage(QLocale::AnyLanguage)
|
||||
m_fileWatcher( new QFileSystemWatcher( this ) ), m_reportLanguage(QLocale::AnyLanguage), m_designerFactory(0)
|
||||
{
|
||||
#ifdef HAVE_STATIC_BUILD
|
||||
initResources();
|
||||
@@ -83,6 +87,29 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) :
|
||||
m_datasources->setObjectName("datasources");
|
||||
connect(m_datasources,SIGNAL(loadCollectionFinished(QString)),this,SLOT(slotDataSourceCollectionLoaded(QString)));
|
||||
connect(m_fileWatcher,SIGNAL(fileChanged(const QString &)),this,SLOT(slotLoadFromFile(const QString &)));
|
||||
|
||||
QDir pluginsDir( "../lib" );
|
||||
foreach( const QString& pluginName, pluginsDir.entryList( QDir::Files ) ) {
|
||||
qDebug() << "===============================================================================";
|
||||
qDebug() << "Found:" << pluginName;
|
||||
|
||||
QPluginLoader loader( pluginsDir.absoluteFilePath( pluginName ) );
|
||||
if( loader.load() ) {
|
||||
if( LimeReportPluginInterface* myPlugin = qobject_cast< LimeReportPluginInterface* >( loader.instance() ) ) {
|
||||
qDebug() << "Testing: \n" <<
|
||||
"(1)" << myPlugin->getString() << "\n" <<
|
||||
"(2)" << myPlugin->getVar();
|
||||
m_designerFactory = myPlugin;
|
||||
}
|
||||
//loader.unload();
|
||||
} else {
|
||||
qDebug() << "Failed to load :(";
|
||||
qDebug() << loader.errorString();
|
||||
}
|
||||
|
||||
qDebug() << "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ReportEnginePrivate::~ReportEnginePrivate()
|
||||
@@ -619,21 +646,32 @@ PageDesignIntf* ReportEngine::createPreviewScene(QObject* parent){
|
||||
void ReportEnginePrivate::designReport()
|
||||
{
|
||||
if (!m_designerWindow) {
|
||||
Q_Q(ReportEngine);
|
||||
m_designerWindow = new LimeReport::ReportDesignWindow(q,QApplication::activeWindow(),settings());
|
||||
m_designerWindow->setAttribute(Qt::WA_DeleteOnClose,true);
|
||||
m_designerWindow->setWindowIcon(QIcon(":report/images/logo32"));
|
||||
m_designerWindow->setShowProgressDialog(m_showProgressDialog);
|
||||
// Q_Q(ReportEngine);
|
||||
if (m_designerFactory){
|
||||
settings()->beginGroup("DesignerWindow");
|
||||
settings()->setValue("showProgressDialog",m_showProgressDialog);
|
||||
settings()->endGroup();
|
||||
m_designerWindow = m_designerFactory->getDesignerWindow(this,QApplication::activeWindow(),settings());
|
||||
//m_designerWindow->setAttribute(Qt::WA_DeleteOnClose,true);
|
||||
//m_designerWindow->setWindowIcon(QIcon(":report/images/logo32"));
|
||||
//m_designerWindow->setShowProgressDialog(m_showProgressDialog);
|
||||
} else {
|
||||
//m_designerWindow = new LimeReport::ReportDesignWindow(this,QApplication::activeWindow(),settings());
|
||||
//m_designerWindow->setAttribute(Qt::WA_DeleteOnClose,true);
|
||||
//m_designerWindow->setWindowIcon(QIcon(":report/images/logo32"));
|
||||
//m_designerWindow->setShowProgressDialog(m_showProgressDialog);
|
||||
}
|
||||
}
|
||||
m_datasources->updateDatasourceModel();
|
||||
#ifdef Q_OS_WIN
|
||||
m_designerWindow->setWindowModality(Qt::ApplicationModal);
|
||||
#endif
|
||||
if (QApplication::activeWindow()==0){
|
||||
m_designerWindow->show();;
|
||||
} else {
|
||||
m_designerWindow->showModal();
|
||||
}
|
||||
// if (QApplication::activeWindow()==0){
|
||||
// m_designerWindow->show();;
|
||||
// } else {
|
||||
// m_designerWindow->showModal();
|
||||
// }
|
||||
m_designerWindow->show();
|
||||
}
|
||||
|
||||
void ReportEnginePrivate::setSettings(QSettings* value)
|
||||
|
||||
Reference in New Issue
Block a user