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_scriptEngineContext = new ScriptEngineContext(this);
ICallbackDatasource* tableOfContens = m_datasources->createCallbackDatasource("tableofcontens");
connect(tableOfContens, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
m_scriptEngineContext->tableOfContens(), SLOT(slotOneSlotDS(LimeReport::CallbackInfo,QVariant&)));
ICallbackDatasource* tableOfContents = m_datasources->createCallbackDatasource("tableofcontents");
connect(tableOfContents, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
m_scriptEngineContext->tableOfContents(), SLOT(slotOneSlotDS(LimeReport::CallbackInfo,QVariant&)));
m_datasources->setObjectName("datasources");
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){
BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(item);
if (band){
TableOfContens* toc = m_scriptEngineContext->tableOfContens();
TableOfContents* toc = m_scriptEngineContext->tableOfContents();
foreach (QString key, band->bookmarks()){
toc->setItem(key, band->getBookMark(key).toString(), pageNumber);
}
@ -1065,7 +1065,7 @@ void ReportRender::updateTOC(BaseDesignIntf* item, int pageNumber){
void ReportRender::secondRenderPass(ReportPages renderedPages)
{
if (!m_scriptEngineContext->tableOfContens()->isEmpty()){
if (!m_scriptEngineContext->tableOfContents()->isEmpty()){
for(int i=0; i<renderedPages.count(); ++i){
PageItemDesignIntf::Ptr page = renderedPages.at(i);
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);
// ICallbackDatasource* tableOfContens = m_dataManager->createCallbackDatasource("tableofcontens");
// connect(tableOfContens, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
// m_tableOfContens, SLOT(slotOneSlotDS(LimeReport::CallbackInfo,QVariant&)));
// ICallbackDatasource* tableOfContents = m_dataManager->createCallbackDatasource("tableofcontents");
// connect(tableOfContents, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
// m_tableOfContents, SLOT(slotOneSlotDS(LimeReport::CallbackInfo,QVariant&)));
}
}
}
@ -540,21 +540,21 @@ QVariant ScriptEngineManager::evaluateScript(const QString& script){
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);
if (m_context){
BandDesignIntf* currentBand = m_context->getCurrentBand();
m_context->tableOfContens()->setItem(uniqKey, content, 0, indent);
m_context->tableOfContents()->setItem(uniqKey, content, 0, indent);
if (currentBand)
currentBand->addBookmark(uniqKey, content);
}
}
void ScriptEngineManager::clearTableOfContens(){
void ScriptEngineManager::clearTableOfContents(){
if (m_context) {
if (m_context->tableOfContens())
m_context->tableOfContens()->clear();
if (m_context->tableOfContents())
m_context->tableOfContents()->clear();
}
}
@ -783,31 +783,31 @@ bool ScriptEngineManager::createGetFieldByKeyFunction()
return addFunction(fd);
}
bool ScriptEngineManager::createAddTableOfContensItemFunction()
bool ScriptEngineManager::createAddTableOfContentsItemFunction()
{
JSFunctionDesc fd;
fd.setManager(m_functionManager);
fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME);
fd.setCategory(tr("GENERAL"));
fd.setName("addTableOfContensItem");
fd.setDescription("addTableOfContensItem(\""+tr("Unique identifier")+" \""+tr("Content")+"\", \""+tr("Indent")+"\")");
fd.setScriptWrapper(QString("function addTableOfContensItem(uniqKey, content, indent){"
"return %1.addTableOfContensItem(uniqKey, content, indent);}"
fd.setName("addTableOfContentsItem");
fd.setDescription("addTableOfContentsItem(\""+tr("Unique identifier")+" \""+tr("Content")+"\", \""+tr("Indent")+"\")");
fd.setScriptWrapper(QString("function addTableOfContentsItem(uniqKey, content, indent){"
"return %1.addTableOfContentsItem(uniqKey, content, indent);}"
).arg(LimeReport::Const::FUNCTION_MANAGER_NAME)
);
return addFunction(fd);
}
bool ScriptEngineManager::createClearTableOfContensFunction()
bool ScriptEngineManager::createClearTableOfContentsFunction()
{
JSFunctionDesc fd;
fd.setManager(m_functionManager);
fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME);
fd.setCategory(tr("GENERAL"));
fd.setName("clearTableOfContens");
fd.setDescription("clearTableOfContens()");
fd.setScriptWrapper(QString("function clearTableOfContens(){"
"return %1.clearTableOfContens();}"
fd.setName("clearTableOfContents");
fd.setDescription("clearTableOfContents()");
fd.setScriptWrapper(QString("function clearTableOfContents(){"
"return %1.clearTableOfContents();}"
).arg(LimeReport::Const::FUNCTION_MANAGER_NAME)
);
return addFunction(fd);
@ -863,8 +863,8 @@ ScriptEngineManager::ScriptEngineManager()
QScriptValue fontConstructor = m_scriptEngine->newFunction(QFontPrototype::constructorQFont, fontProto);
m_scriptEngine->globalObject().setProperty("QFont", fontConstructor);
#endif
createAddTableOfContensItemFunction();
createClearTableOfContensFunction();
createAddTableOfContentsItemFunction();
createClearTableOfContentsFunction();
createReopenDatasourceFunction();
m_model = new ScriptEngineModel(this);
@ -1103,7 +1103,7 @@ void ScriptEngineContext::clear()
m_createdDialogs.clear();
#endif
m_initScript.clear();
m_tableOfContens->clear();
m_tableOfContents->clear();
m_lastError="";
}
@ -1186,14 +1186,14 @@ DialogDescriber* ScriptEngineContext::findDialogContainer(const QString& dialogN
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
@ -1321,9 +1321,9 @@ void ScriptEngineContext::initDialogs(){
bool ScriptEngineContext::runInitScript(){
ScriptEngineType* engine = ScriptEngineManager::instance().scriptEngine();
ScriptEngineManager::instance().clearTableOfContens();
ScriptEngineManager::instance().clearTableOfContents();
ScriptEngineManager::instance().setContext(this);
m_tableOfContens->clear();
m_tableOfContents->clear();
#ifndef USE_QJSENGINE
engine->pushContext();
@ -1538,14 +1538,14 @@ void ScriptFunctionsManager::reopenDatasource(const QString& 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;
}
TableOfContens::~TableOfContens()
TableOfContents::~TableOfContents()
{
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;
if (m_hash.contains(uniqKey)){
@ -1647,20 +1647,20 @@ void TableOfContens::setItem(const QString& uniqKey, const QString& content, int
item->pageNumber = pageNumber;
item->indent = indent;
item->uniqKey = uniqKey;
m_tableOfContens.append(item);
m_tableOfContents.append(item);
m_hash.insert(uniqKey, item);
}
}
void TableOfContens::slotOneSlotDS(CallbackInfo info, QVariant& data)
void TableOfContents::slotOneSlotDS(CallbackInfo info, QVariant& data)
{
QStringList columns;
columns << "Content" << "Page number" << "Content Key";
switch (info.dataType) {
case LimeReport::CallbackInfo::RowCount:
data = m_tableOfContens.count();
data = m_tableOfContents.count();
break;
case LimeReport::CallbackInfo::ColumnCount:
data = columns.size();
@ -1670,8 +1670,8 @@ void TableOfContens::slotOneSlotDS(CallbackInfo info, QVariant& data)
break;
}
case LimeReport::CallbackInfo::ColumnData:
if (info.index < m_tableOfContens.count()){
ContentItem* item = m_tableOfContens.at(info.index);
if (info.index < m_tableOfContents.count()){
ContentItem* item = m_tableOfContents.at(info.index);
if (info.columnName.compare("Content",Qt::CaseInsensitive) == 0)
data = item->content.rightJustified(item->indent+item->content.size());
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();
foreach(ContentItem* item, m_tableOfContens){
foreach(ContentItem* item, m_tableOfContents){
delete item;
}
m_tableOfContens.clear();
m_tableOfContents.clear();
}

View File

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