~ubuntu-branches/ubuntu/trusty/bibletime/trusty

« back to all changes in this revision

Viewing changes to src/backend/managers/cswordbackend.cpp

  • Committer: Package Import Robot
  • Author(s): Dmitrijs Ledkovs, Jonathan Marsden, Dmitrijs Ledkovs
  • Date: 2012-04-14 18:11:50 UTC
  • mfrom: (1.3.7)
  • Revision ID: package-import@ubuntu.com-20120414181150-17l2liq7bl7oaxjz
Tags: 2.9.1-1
[ Jonathan Marsden ]
* New upstream version 2.9.1
* debian/patches/*: Remove all patches (incorporated upstream)
* debian/control: bibletime now depends on a matching version of
  bibletime-data.

[ Dmitrijs Ledkovs ]
* Add more strict alternative build-dependency on the libqt4-dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
    cleanupFilters.push_back(thmlplain);
76
76
}
77
77
 
78
 
QList<CSwordModuleInfo*> CSwordBackend::takeModulesFromList(QStringList names) {
79
 
    int numberOfRemoved = 0;
 
78
QList<CSwordModuleInfo*> CSwordBackend::takeModulesFromList(const QStringList &names) {
80
79
    QList<CSwordModuleInfo*> list;
81
 
    foreach(QString name, names) {
 
80
    Q_FOREACH (const QString &name, names) {
82
81
        CSwordModuleInfo* mInfo = findModuleByName(name);
83
82
        if (mInfo) {
84
83
            m_dataModel.removeModule(mInfo);
85
 
            ++numberOfRemoved;
86
84
            list.append(mInfo);
87
85
        }
88
86
    }
89
 
    if (numberOfRemoved > 0)
 
87
    if (!list.isEmpty())
90
88
        emit sigSwordSetupChanged(RemovedModules);
91
89
    return list;
92
90
}
93
91
 
94
 
QList<CSwordModuleInfo*> CSwordBackend::getPointerList(const QStringList &names) {
 
92
QList<CSwordModuleInfo*> CSwordBackend::getPointerList(const QStringList &names) const {
95
93
    QList<CSwordModuleInfo*> list;
96
94
    Q_FOREACH (const QString &name, names) {
97
95
        CSwordModuleInfo *mInfo = findModuleByName(name);
103
101
}
104
102
 
105
103
QList<const CSwordModuleInfo*> CSwordBackend::getConstPointerList(
106
 
        const QStringList &names)
 
104
        const QStringList &names) const
107
105
{
108
106
    QList<const CSwordModuleInfo*> list;
109
107
    Q_FOREACH (const QString &name, names) {
133
131
 
134
132
        if (!strcmp(curMod->Type(), "Biblical Texts")) {
135
133
            newModule = new CSwordBibleModuleInfo(curMod, this);
136
 
            newModule->module()->Disp(&m_chapterDisplay);
 
134
            newModule->module()->setDisplay(&m_chapterDisplay);
137
135
        }
138
136
        else if (!strcmp(curMod->Type(), "Commentaries")) {
139
137
            newModule = new CSwordCommentaryModuleInfo(curMod, this);
140
 
            newModule->module()->Disp(&m_entryDisplay);
 
138
            newModule->module()->setDisplay(&m_entryDisplay);
141
139
        }
142
140
        else if (!strcmp(curMod->Type(), "Lexicons / Dictionaries")) {
143
141
            newModule = new CSwordLexiconModuleInfo(curMod, this);
144
 
            newModule->module()->Disp(&m_entryDisplay);
 
142
            newModule->module()->setDisplay(&m_entryDisplay);
145
143
        }
146
144
        else if (!strcmp(curMod->Type(), "Generic Books")) {
147
145
            newModule = new CSwordBookModuleInfo(curMod, this);
148
 
            newModule->module()->Disp(&m_bookDisplay);
 
146
            newModule->module()->setDisplay(&m_bookDisplay);
149
147
        }
150
148
 
151
149
        if (newModule) {
279
277
}
280
278
 
281
279
/** This function searches for a module with the specified description */
282
 
CSwordModuleInfo* CSwordBackend::findModuleByDescription(const QString& description) {
 
280
CSwordModuleInfo* CSwordBackend::findModuleByDescription(const QString &description) const {
283
281
    Q_FOREACH (CSwordModuleInfo *mod, m_dataModel.moduleList()) {
284
282
        if (mod->config(CSwordModuleInfo::Description) == description) return mod;
285
283
    }
287
285
}
288
286
 
289
287
/** This function searches for a module with the specified name */
290
 
CSwordModuleInfo* CSwordBackend::findModuleByName(const QString& name) {
 
288
CSwordModuleInfo* CSwordBackend::findModuleByName(const QString &name) const {
291
289
    Q_FOREACH (CSwordModuleInfo *mod, m_dataModel.moduleList()) {
292
290
        if (mod->name() == name) return mod;
293
291
    }
294
292
    return 0;
295
293
}
296
294
 
297
 
CSwordModuleInfo* CSwordBackend::findSwordModuleByPointer(const sword::SWModule* const swmodule) {
 
295
CSwordModuleInfo* CSwordBackend::findSwordModuleByPointer(const sword::SWModule * const swmodule) const {
298
296
    Q_FOREACH (CSwordModuleInfo *mod, m_dataModel.moduleList()) {
299
 
        if (mod->module() == swmodule ) return mod;
 
297
        if (mod->module() == swmodule) return mod;
300
298
    }
301
299
    return 0;
302
300
}