0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-09-23 08:29:07 +03:00

Easyprofiler added

This commit is contained in:
Arin Alexander
2018-02-28 23:19:04 +03:00
parent edb89544f8
commit 6ad35d63be
218 changed files with 36639 additions and 17 deletions

View File

@@ -37,6 +37,8 @@
#include <QFileInfo>
#include <stdexcept>
#include "easy/profiler.h"
namespace LimeReport{
DataNode::~DataNode()
@@ -217,7 +219,7 @@ void DataSourceModel::updateModel()
}
DataSourceManager::DataSourceManager(QObject *parent) :
QObject(parent), m_lastError(""), m_designTime(true), m_needUpdate(false), m_dbCredentialsProvider(0)
QObject(parent), m_lastError(""), m_designTime(false), m_needUpdate(false), m_dbCredentialsProvider(0)
{
m_groupFunctionFactory.registerFunctionCreator(QLatin1String("COUNT"),new ConstructorGroupFunctionCreator<CountGroupFunction>);
m_groupFunctionFactory.registerFunctionCreator(QLatin1String("SUM"),new ConstructorGroupFunctionCreator<SumGroupFunction>);
@@ -1104,11 +1106,11 @@ QObject* DataSourceManager::elementAt(const QString &collectionName, int index)
void DataSourceManager::collectionLoadFinished(const QString &collectionName)
{
EASY_BLOCK("DataSourceManager::collectionLoadFinished");
if (collectionName.compare("connections",Qt::CaseInsensitive) == 0){
}
EASY_BLOCK("queryes");
if (collectionName.compare("queries",Qt::CaseInsensitive) == 0){
QMutableListIterator<QueryDesc*> it(m_queries);
@@ -1125,7 +1127,8 @@ void DataSourceManager::collectionLoadFinished(const QString &collectionName)
}
}
EASY_END_BLOCK;
EASY_BLOCK("subqueries")
if (collectionName.compare("subqueries",Qt::CaseInsensitive) == 0){
QMutableListIterator<SubQueryDesc*> it(m_subqueries);
@@ -1147,7 +1150,8 @@ void DataSourceManager::collectionLoadFinished(const QString &collectionName)
}
}
EASY_END_BLOCK;
EASY_BLOCK("subproxies");
if (collectionName.compare("subproxies",Qt::CaseInsensitive) == 0){
QMutableListIterator<ProxyDesc*> it(m_proxies);
while (it.hasNext()){
@@ -1160,7 +1164,8 @@ void DataSourceManager::collectionLoadFinished(const QString &collectionName)
}
}
}
EASY_END_BLOCK;
EASY_BLOCK("variables");
if (collectionName.compare("variables",Qt::CaseInsensitive) == 0){
foreach (VarDesc* item, m_tempVars) {
if (!m_reportVariables.containsVariable(item->name())){
@@ -1172,9 +1177,16 @@ void DataSourceManager::collectionLoadFinished(const QString &collectionName)
}
m_tempVars.clear();
}
emit datasourcesChanged();
EASY_END_BLOCK;
if (designTime()){
EASY_BLOCK("emit datasourcesChanged()");
emit datasourcesChanged();
EASY_END_BLOCK;
}
EASY_BLOCK("emit loadCollectionFinished(collectionName)");
emit loadCollectionFinished(collectionName);
EASY_END_BLOCK;
EASY_END_BLOCK;
}
void DataSourceManager::addVariable(const QString &name, const QVariant &value, VarDesc::VarType type, RenderPass pass)
@@ -1184,8 +1196,11 @@ void DataSourceManager::addVariable(const QString &name, const QVariant &value,
} else {
m_reportVariables.addVariable(name,value,type,pass);
}
if (designTime())
emit datasourcesChanged();
if (designTime()){
EASY_BLOCK("DataSourceManager::addVariable emit ds changed");
emit datasourcesChanged();
EASY_END_BLOCK;
}
}
void DataSourceManager::deleteVariable(const QString& name)

View File

@@ -56,6 +56,8 @@
#include "lrpreviewreportwidget.h"
#include "lrpreviewreportwidget_p.h"
#include "easy/profiler.h"
#ifdef HAVE_STATIC_BUILD
#include "lrfactoryinitializer.h"
@@ -223,6 +225,12 @@ void ReportEnginePrivate::slotPreviewWindowDestroyed(QObject* window)
}
}
void ReportEnginePrivate::slotDesignerWindowDestroyed(QObject *window)
{
Q_UNUSED(window)
dataManager()->setDesignTime(false);
}
void ReportEnginePrivate::clearReport()
{
foreach(PageDesignIntf* page,m_pages) delete page;
@@ -375,7 +383,7 @@ void ReportEnginePrivate::setReportTranslation(const QString &languageName)
setReportLanguage(language);
}
}
};
}
bool ReportEnginePrivate::printReport(QPrinter* printer)
{
@@ -396,9 +404,10 @@ bool ReportEnginePrivate::printReport(QPrinter* printer)
printer =(printer)?printer:m_printer.data();
if (printer&&printer->isValid()){
try{
bool designTime = dataManager()->designTime();
dataManager()->setDesignTime(false);
ReportPages pages = renderToPages();
dataManager()->setDesignTime(true);
dataManager()->setDesignTime(designTime);
if (pages.count()>0){
printReport(pages,*printer);
}
@@ -601,6 +610,7 @@ void ReportEnginePrivate::setCurrentReportsDir(const QString &dirName)
bool ReportEnginePrivate::slotLoadFromFile(const QString &fileName)
{
EASY_BLOCK("ReportEnginePrivate::slotLoadFromFile")
PreviewReportWindow *currentPreview = qobject_cast<PreviewReportWindow *>(m_activePreview);
if (!QFile::exists(fileName))
@@ -642,17 +652,20 @@ bool ReportEnginePrivate::slotLoadFromFile(const QString &fileName)
}
}
}
EASY_BLOCK("Connect auto connections")
dataManager()->connectAutoConnections();
EASY_END_BLOCK;
if ( hasActivePreview() )
{
currentPreview->reloadPreview();
}
EASY_END_BLOCK;
return true;
};
}
m_lastError = reader->lastError();
EASY_END_BLOCK;
return false;
}
@@ -672,6 +685,8 @@ void ReportEnginePrivate::designReport()
{
ReportDesignWindowInterface* designerWindow = getDesignerWindow();
if (designerWindow){
dataManager()->setDesignTime(true);
connect(designerWindow, SIGNAL(destroyed(QObject*)), this, SLOT(slotDesignerWindowDestroyed(QObject*)));
#ifdef Q_OS_WIN
designerWindow->setWindowModality(Qt::ApplicationModal);
#endif
@@ -709,6 +724,7 @@ QSettings*ReportEnginePrivate::settings()
bool ReportEnginePrivate::loadFromFile(const QString &fileName, bool autoLoadPreviewOnChange)
{
// only watch one file at a time
if ( !m_fileWatcher->files().isEmpty() )
{
m_fileWatcher->removePaths( m_fileWatcher->files() );

View File

@@ -197,7 +197,8 @@ protected:
protected slots:
void slotDataSourceCollectionLoaded(const QString& collectionName);
private slots:
void slotPreviewWindowDestroyed(QObject *window);
void slotPreviewWindowDestroyed(QObject* window);
void slotDesignerWindowDestroyed(QObject* window);
private:
//ICollectionContainer
virtual QObject* createElement(const QString&,const QString&);

View File

@@ -36,6 +36,7 @@
#include "lrreporttranslation.h"
#include <QDebug>
#include "easy/profiler.h"
namespace LimeReport{
@@ -107,6 +108,7 @@ bool XMLReader::readItem(QObject *item)
void XMLReader::readItemFromNode(QObject* item,QDomElement *node)
{
EASY_BLOCK("readItemFromNode");
ObjectLoadingStateIntf* lf = dynamic_cast<ObjectLoadingStateIntf*>(item);
if(lf) lf->objectLoadStarted();
for (int i=0;i<node->childNodes().count();i++){
@@ -129,6 +131,7 @@ void XMLReader::readItemFromNode(QObject* item,QDomElement *node)
if (baseItem) baseItem->parentObjectLoadFinished();
}
}
EASY_END_BLOCK;
}
QString XMLReader::lastError()
@@ -183,13 +186,16 @@ QVariant XMLReader::getValue(QDomElement *node)
void XMLReader::readQObject(QObject* item, QDomElement* node)
{
EASY_BLOCK("readQObject");
QObject* childItem = qvariant_cast<QObject*>(item->property(node->nodeName().toLatin1()));
if (childItem)
readItemFromNode(childItem,node);
EASY_END_BLOCK;
}
void XMLReader::readCollection(QObject *item, QDomElement *node)
{
EASY_BLOCK("readCollection")
ICollectionContainer* collection = dynamic_cast<ICollectionContainer*>(item);
if (collection){
QString collectionName = node->nodeName();
@@ -201,6 +207,7 @@ void XMLReader::readCollection(QObject *item, QDomElement *node)
}
collection->collectionLoadFinished(collectionName);
}
EASY_END_BLOCK;
}
void XMLReader::readTranslation(QObject* item, QDomElement* node)