0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 08:34:38 +03:00

Fix typos. s/contens/contents.

This commit is contained in:
Mateusz Skowroński 2017-11-04 19:17:49 +01:00
parent 27427e90aa
commit f42dde6211
4 changed files with 61 additions and 61 deletions

View File

@ -76,9 +76,9 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) :
m_datasources->setReportSettings(&m_reportSettings); m_datasources->setReportSettings(&m_reportSettings);
m_scriptEngineContext = new ScriptEngineContext(this); m_scriptEngineContext = new ScriptEngineContext(this);
ICallbackDatasource* tableOfContens = m_datasources->createCallbackDatasource("tableofcontens"); ICallbackDatasource* tableOfContents = m_datasources->createCallbackDatasource("tableofcontents");
connect(tableOfContens, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)), connect(tableOfContents, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
m_scriptEngineContext->tableOfContens(), SLOT(slotOneSlotDS(LimeReport::CallbackInfo,QVariant&))); m_scriptEngineContext->tableOfContents(), SLOT(slotOneSlotDS(LimeReport::CallbackInfo,QVariant&)));
m_datasources->setObjectName("datasources"); m_datasources->setObjectName("datasources");
connect(m_datasources,SIGNAL(loadCollectionFinished(QString)),this,SLOT(slotDataSourceCollectionLoaded(QString))); connect(m_datasources,SIGNAL(loadCollectionFinished(QString)),this,SLOT(slotDataSourceCollectionLoaded(QString)));

View File

@ -1055,7 +1055,7 @@ BandDesignIntf* ReportRender::sliceBand(BandDesignIntf *band, BandDesignIntf* pa
void ReportRender::updateTOC(BaseDesignIntf* item, int pageNumber){ void ReportRender::updateTOC(BaseDesignIntf* item, int pageNumber){
BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(item); BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(item);
if (band){ if (band){
TableOfContens* toc = m_scriptEngineContext->tableOfContens(); TableOfContents* toc = m_scriptEngineContext->tableOfContents();
foreach (QString key, band->bookmarks()){ foreach (QString key, band->bookmarks()){
toc->setItem(key, band->getBookMark(key).toString(), pageNumber); toc->setItem(key, band->getBookMark(key).toString(), pageNumber);
} }
@ -1065,7 +1065,7 @@ void ReportRender::updateTOC(BaseDesignIntf* item, int pageNumber){
void ReportRender::secondRenderPass(ReportPages renderedPages) void ReportRender::secondRenderPass(ReportPages renderedPages)
{ {
if (!m_scriptEngineContext->tableOfContens()->isEmpty()){ if (!m_scriptEngineContext->tableOfContents()->isEmpty()){
for(int i=0; i<renderedPages.count(); ++i){ for(int i=0; i<renderedPages.count(); ++i){
PageItemDesignIntf::Ptr page = renderedPages.at(i); PageItemDesignIntf::Ptr page = renderedPages.at(i);
foreach(BaseDesignIntf* item, page->childBaseItems()){ foreach(BaseDesignIntf* item, page->childBaseItems()){

View File

@ -347,9 +347,9 @@ void ScriptEngineManager::setDataManager(DataSourceManager *dataManager){
// qDebug()<<"is script context exists before set datamanager is called"<< (m_context == 0); // qDebug()<<"is script context exists before set datamanager is called"<< (m_context == 0);
// ICallbackDatasource* tableOfContens = m_dataManager->createCallbackDatasource("tableofcontens"); // ICallbackDatasource* tableOfContents = m_dataManager->createCallbackDatasource("tableofcontents");
// connect(tableOfContens, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)), // connect(tableOfContents, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
// m_tableOfContens, SLOT(slotOneSlotDS(LimeReport::CallbackInfo,QVariant&))); // m_tableOfContents, SLOT(slotOneSlotDS(LimeReport::CallbackInfo,QVariant&)));
} }
} }
} }
@ -540,21 +540,21 @@ QVariant ScriptEngineManager::evaluateScript(const QString& script){
return QVariant(); return QVariant();
} }
void ScriptEngineManager::addTableOfContensItem(const QString& uniqKey, const QString& content, int indent) void ScriptEngineManager::addTableOfContentsItem(const QString& uniqKey, const QString& content, int indent)
{ {
Q_ASSERT(m_context != 0); Q_ASSERT(m_context != 0);
if (m_context){ if (m_context){
BandDesignIntf* currentBand = m_context->getCurrentBand(); BandDesignIntf* currentBand = m_context->getCurrentBand();
m_context->tableOfContens()->setItem(uniqKey, content, 0, indent); m_context->tableOfContents()->setItem(uniqKey, content, 0, indent);
if (currentBand) if (currentBand)
currentBand->addBookmark(uniqKey, content); currentBand->addBookmark(uniqKey, content);
} }
} }
void ScriptEngineManager::clearTableOfContens(){ void ScriptEngineManager::clearTableOfContents(){
if (m_context) { if (m_context) {
if (m_context->tableOfContens()) if (m_context->tableOfContents())
m_context->tableOfContens()->clear(); m_context->tableOfContents()->clear();
} }
} }
@ -783,31 +783,31 @@ bool ScriptEngineManager::createGetFieldByKeyFunction()
return addFunction(fd); return addFunction(fd);
} }
bool ScriptEngineManager::createAddTableOfContensItemFunction() bool ScriptEngineManager::createAddTableOfContentsItemFunction()
{ {
JSFunctionDesc fd; JSFunctionDesc fd;
fd.setManager(m_functionManager); fd.setManager(m_functionManager);
fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME);
fd.setCategory(tr("GENERAL")); fd.setCategory(tr("GENERAL"));
fd.setName("addTableOfContensItem"); fd.setName("addTableOfContentsItem");
fd.setDescription("addTableOfContensItem(\""+tr("Unique identifier")+" \""+tr("Content")+"\", \""+tr("Indent")+"\")"); fd.setDescription("addTableOfContentsItem(\""+tr("Unique identifier")+" \""+tr("Content")+"\", \""+tr("Indent")+"\")");
fd.setScriptWrapper(QString("function addTableOfContensItem(uniqKey, content, indent){" fd.setScriptWrapper(QString("function addTableOfContentsItem(uniqKey, content, indent){"
"return %1.addTableOfContensItem(uniqKey, content, indent);}" "return %1.addTableOfContentsItem(uniqKey, content, indent);}"
).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME)
); );
return addFunction(fd); return addFunction(fd);
} }
bool ScriptEngineManager::createClearTableOfContensFunction() bool ScriptEngineManager::createClearTableOfContentsFunction()
{ {
JSFunctionDesc fd; JSFunctionDesc fd;
fd.setManager(m_functionManager); fd.setManager(m_functionManager);
fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME);
fd.setCategory(tr("GENERAL")); fd.setCategory(tr("GENERAL"));
fd.setName("clearTableOfContens"); fd.setName("clearTableOfContents");
fd.setDescription("clearTableOfContens()"); fd.setDescription("clearTableOfContents()");
fd.setScriptWrapper(QString("function clearTableOfContens(){" fd.setScriptWrapper(QString("function clearTableOfContents(){"
"return %1.clearTableOfContens();}" "return %1.clearTableOfContents();}"
).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME)
); );
return addFunction(fd); return addFunction(fd);
@ -863,8 +863,8 @@ ScriptEngineManager::ScriptEngineManager()
QScriptValue fontConstructor = m_scriptEngine->newFunction(QFontPrototype::constructorQFont, fontProto); QScriptValue fontConstructor = m_scriptEngine->newFunction(QFontPrototype::constructorQFont, fontProto);
m_scriptEngine->globalObject().setProperty("QFont", fontConstructor); m_scriptEngine->globalObject().setProperty("QFont", fontConstructor);
#endif #endif
createAddTableOfContensItemFunction(); createAddTableOfContentsItemFunction();
createClearTableOfContensFunction(); createClearTableOfContentsFunction();
createReopenDatasourceFunction(); createReopenDatasourceFunction();
m_model = new ScriptEngineModel(this); m_model = new ScriptEngineModel(this);
@ -1103,7 +1103,7 @@ void ScriptEngineContext::clear()
m_createdDialogs.clear(); m_createdDialogs.clear();
#endif #endif
m_initScript.clear(); m_initScript.clear();
m_tableOfContens->clear(); m_tableOfContents->clear();
m_lastError=""; m_lastError="";
} }
@ -1186,14 +1186,14 @@ DialogDescriber* ScriptEngineContext::findDialogContainer(const QString& dialogN
return 0; return 0;
} }
TableOfContens* ScriptEngineContext::tableOfContens() const TableOfContents* ScriptEngineContext::tableOfContents() const
{ {
return m_tableOfContens; return m_tableOfContents;
} }
void ScriptEngineContext::setTableOfContens(TableOfContens* tableOfContens) void ScriptEngineContext::setTableOfContents(TableOfContents* tableOfContents)
{ {
m_tableOfContens = tableOfContens; m_tableOfContents = tableOfContents;
} }
PageItemDesignIntf* ScriptEngineContext::getCurrentPage() const PageItemDesignIntf* ScriptEngineContext::getCurrentPage() const
@ -1321,9 +1321,9 @@ void ScriptEngineContext::initDialogs(){
bool ScriptEngineContext::runInitScript(){ bool ScriptEngineContext::runInitScript(){
ScriptEngineType* engine = ScriptEngineManager::instance().scriptEngine(); ScriptEngineType* engine = ScriptEngineManager::instance().scriptEngine();
ScriptEngineManager::instance().clearTableOfContens(); ScriptEngineManager::instance().clearTableOfContents();
ScriptEngineManager::instance().setContext(this); ScriptEngineManager::instance().setContext(this);
m_tableOfContens->clear(); m_tableOfContents->clear();
#ifndef USE_QJSENGINE #ifndef USE_QJSENGINE
engine->pushContext(); engine->pushContext();
@ -1538,14 +1538,14 @@ void ScriptFunctionsManager::reopenDatasource(const QString& datasourceName)
return dm->reopenDatasource(datasourceName); return dm->reopenDatasource(datasourceName);
} }
void ScriptFunctionsManager::addTableOfContensItem(const QString& uniqKey, const QString& content, int indent) void ScriptFunctionsManager::addTableOfContentsItem(const QString& uniqKey, const QString& content, int indent)
{ {
scriptEngineManager()->addTableOfContensItem(uniqKey, content, indent); scriptEngineManager()->addTableOfContentsItem(uniqKey, content, indent);
} }
void ScriptFunctionsManager::clearTableOfContens() void ScriptFunctionsManager::clearTableOfContents()
{ {
scriptEngineManager()->clearTableOfContens(); scriptEngineManager()->clearTableOfContents();
} }
@ -1627,12 +1627,12 @@ void ScriptFunctionsManager::setScriptEngineManager(ScriptEngineManager *scriptE
m_scriptEngineManager = scriptEngineManager; m_scriptEngineManager = scriptEngineManager;
} }
TableOfContens::~TableOfContens() TableOfContents::~TableOfContents()
{ {
clear(); clear();
} }
void TableOfContens::setItem(const QString& uniqKey, const QString& content, int pageNumber, int indent) void TableOfContents::setItem(const QString& uniqKey, const QString& content, int pageNumber, int indent)
{ {
ContentItem * item = 0; ContentItem * item = 0;
if (m_hash.contains(uniqKey)){ if (m_hash.contains(uniqKey)){
@ -1647,20 +1647,20 @@ void TableOfContens::setItem(const QString& uniqKey, const QString& content, int
item->pageNumber = pageNumber; item->pageNumber = pageNumber;
item->indent = indent; item->indent = indent;
item->uniqKey = uniqKey; item->uniqKey = uniqKey;
m_tableOfContens.append(item); m_tableOfContents.append(item);
m_hash.insert(uniqKey, item); m_hash.insert(uniqKey, item);
} }
} }
void TableOfContens::slotOneSlotDS(CallbackInfo info, QVariant& data) void TableOfContents::slotOneSlotDS(CallbackInfo info, QVariant& data)
{ {
QStringList columns; QStringList columns;
columns << "Content" << "Page number" << "Content Key"; columns << "Content" << "Page number" << "Content Key";
switch (info.dataType) { switch (info.dataType) {
case LimeReport::CallbackInfo::RowCount: case LimeReport::CallbackInfo::RowCount:
data = m_tableOfContens.count(); data = m_tableOfContents.count();
break; break;
case LimeReport::CallbackInfo::ColumnCount: case LimeReport::CallbackInfo::ColumnCount:
data = columns.size(); data = columns.size();
@ -1670,8 +1670,8 @@ void TableOfContens::slotOneSlotDS(CallbackInfo info, QVariant& data)
break; break;
} }
case LimeReport::CallbackInfo::ColumnData: case LimeReport::CallbackInfo::ColumnData:
if (info.index < m_tableOfContens.count()){ if (info.index < m_tableOfContents.count()){
ContentItem* item = m_tableOfContens.at(info.index); ContentItem* item = m_tableOfContents.at(info.index);
if (info.columnName.compare("Content",Qt::CaseInsensitive) == 0) if (info.columnName.compare("Content",Qt::CaseInsensitive) == 0)
data = item->content.rightJustified(item->indent+item->content.size()); data = item->content.rightJustified(item->indent+item->content.size());
if (info.columnName.compare("Content Key",Qt::CaseInsensitive) == 0) if (info.columnName.compare("Content Key",Qt::CaseInsensitive) == 0)
@ -1684,13 +1684,13 @@ void TableOfContens::slotOneSlotDS(CallbackInfo info, QVariant& data)
} }
} }
void LimeReport::TableOfContens::clear(){ void LimeReport::TableOfContents::clear(){
m_hash.clear(); m_hash.clear();
foreach(ContentItem* item, m_tableOfContens){ foreach(ContentItem* item, m_tableOfContents){
delete item; delete item;
} }
m_tableOfContens.clear(); m_tableOfContents.clear();
} }

View File

@ -66,18 +66,18 @@ struct ContentItem {
QString uniqKey; QString uniqKey;
}; };
class TableOfContens : public QObject{ class TableOfContents : public QObject{
Q_OBJECT Q_OBJECT
public: public:
TableOfContens(QObject* parent = 0):QObject(parent){} TableOfContents(QObject* parent = 0):QObject(parent){}
~TableOfContens(); ~TableOfContents();
void setItem(const QString& uniqKey, const QString& content, int pageNumber, int indent = 0); void setItem(const QString& uniqKey, const QString& content, int pageNumber, int indent = 0);
void clear(); void clear();
bool isEmpty(){ return m_tableOfContens.isEmpty();} bool isEmpty(){ return m_tableOfContents.isEmpty();}
private slots: private slots:
void slotOneSlotDS(LimeReport::CallbackInfo info, QVariant &data); void slotOneSlotDS(LimeReport::CallbackInfo info, QVariant &data);
private: private:
QVector<ContentItem*> m_tableOfContens; QVector<ContentItem*> m_tableOfContents;
QHash<QString, ContentItem* > m_hash; QHash<QString, ContentItem* > m_hash;
}; };
@ -169,7 +169,7 @@ public:
#ifdef HAVE_UI_LOADER #ifdef HAVE_UI_LOADER
typedef QSharedPointer<QDialog> DialogPtr; typedef QSharedPointer<QDialog> DialogPtr;
#endif #endif
explicit ScriptEngineContext(QObject* parent=0):QObject(parent), m_tableOfContens(new TableOfContens(this)){} explicit ScriptEngineContext(QObject* parent=0):QObject(parent), m_tableOfContents(new TableOfContents(this)){}
#ifdef HAVE_UI_LOADER #ifdef HAVE_UI_LOADER
void addDialog(const QString& name, const QByteArray& description); void addDialog(const QString& name, const QByteArray& description);
bool changeDialog(const QString& name, const QByteArray &description); bool changeDialog(const QString& name, const QByteArray &description);
@ -193,8 +193,8 @@ public:
void setCurrentBand(BandDesignIntf* currentBand); void setCurrentBand(BandDesignIntf* currentBand);
PageItemDesignIntf* getCurrentPage() const; PageItemDesignIntf* getCurrentPage() const;
void setCurrentPage(PageItemDesignIntf* currentPage); void setCurrentPage(PageItemDesignIntf* currentPage);
TableOfContens* tableOfContens() const; TableOfContents* tableOfContents() const;
void setTableOfContens(TableOfContens* tableOfContens); void setTableOfContents(TableOfContents* tableOfContents);
#ifdef HAVE_UI_LOADER #ifdef HAVE_UI_LOADER
signals: signals:
@ -221,7 +221,7 @@ private:
QString m_initScript; QString m_initScript;
BandDesignIntf* m_currentBand; BandDesignIntf* m_currentBand;
PageItemDesignIntf* m_currentPage; PageItemDesignIntf* m_currentPage;
TableOfContens* m_tableOfContens; TableOfContents* m_tableOfContents;
}; };
class JSFunctionDesc{ class JSFunctionDesc{
@ -329,8 +329,8 @@ public:
Q_INVOKABLE QVariant getFieldByKeyField(const QString& datasourceName, const QString& valueFieldName, const QString& keyFieldName, QVariant keyValue); Q_INVOKABLE QVariant getFieldByKeyField(const QString& datasourceName, const QString& valueFieldName, const QString& keyFieldName, QVariant keyValue);
Q_INVOKABLE void reopenDatasource(const QString& datasourceName); Q_INVOKABLE void reopenDatasource(const QString& datasourceName);
Q_INVOKABLE QVariant color(const QString& color){ return QColor(color);} Q_INVOKABLE QVariant color(const QString& color){ return QColor(color);}
Q_INVOKABLE void addTableOfContensItem(const QString& uniqKey, const QString& content, int indent = 0); Q_INVOKABLE void addTableOfContentsItem(const QString& uniqKey, const QString& content, int indent = 0);
Q_INVOKABLE void clearTableOfContens(); Q_INVOKABLE void clearTableOfContents();
#ifdef USE_QJSENGINE #ifdef USE_QJSENGINE
Q_INVOKABLE QFont font(const QString& family, int pointSize = -1, bool bold = false, bool italic = false, bool underLine = false); Q_INVOKABLE QFont font(const QString& family, int pointSize = -1, bool bold = false, bool italic = false, bool underLine = false);
@ -378,8 +378,8 @@ public:
QString expandDataFields(QString context, ExpandType expandType, QVariant &varValue, QObject* reportItem); QString expandDataFields(QString context, ExpandType expandType, QVariant &varValue, QObject* reportItem);
QString expandScripts(QString context, QVariant &varValue, QObject* reportItem); QString expandScripts(QString context, QVariant &varValue, QObject* reportItem);
QVariant evaluateScript(const QString &script); QVariant evaluateScript(const QString &script);
void addTableOfContensItem(const QString& uniqKey, const QString& content, int indent); void addTableOfContentsItem(const QString& uniqKey, const QString& content, int indent);
void clearTableOfContens(); void clearTableOfContents();
protected: protected:
void updateModel(); void updateModel();
@ -399,8 +399,8 @@ private:
bool createGetVariableFunction(); bool createGetVariableFunction();
bool createGetFieldFunction(); bool createGetFieldFunction();
bool createGetFieldByKeyFunction(); bool createGetFieldByKeyFunction();
bool createAddTableOfContensItemFunction(); bool createAddTableOfContentsItemFunction();
bool createClearTableOfContensFunction(); bool createClearTableOfContentsFunction();
bool createReopenDatasourceFunction(); bool createReopenDatasourceFunction();
private: private:
ScriptEngineManager(); ScriptEngineManager();