diff options
Diffstat (limited to 'src/backend/drivers/cswordbookmoduleinfo.cpp')
-rw-r--r-- | src/backend/drivers/cswordbookmoduleinfo.cpp | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/src/backend/drivers/cswordbookmoduleinfo.cpp b/src/backend/drivers/cswordbookmoduleinfo.cpp index 8c6b8b1..bae54b9 100644 --- a/src/backend/drivers/cswordbookmoduleinfo.cpp +++ b/src/backend/drivers/cswordbookmoduleinfo.cpp @@ -2,7 +2,7 @@ * * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2011 by the BibleTime developers. +* Copyright 1999-2014 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ @@ -16,11 +16,10 @@ #include <treekeyidx.h> -CSwordBookModuleInfo::CSwordBookModuleInfo(sword::SWModule *module, - CSwordBackend * const usedBackend) - : CSwordModuleInfo(module, usedBackend, - CSwordModuleInfo::GenericBook), - m_depth(-1) +CSwordBookModuleInfo::CSwordBookModuleInfo(sword::SWModule * module, + CSwordBackend & backend) + : CSwordModuleInfo(module, backend, CSwordModuleInfo::GenericBook) + , m_depth(-1) { sword::TreeKeyIdx *key = tree(); if (key) { @@ -29,25 +28,21 @@ CSwordBookModuleInfo::CSwordBookModuleInfo(sword::SWModule *module, } } -void CSwordBookModuleInfo::computeDepth(sword::TreeKeyIdx *key, int level) { - std::string savedKey; - // savedKey = key->getFullName(); //sword 1.5.8 - savedKey = key->getText(); - - if (level > m_depth) { +void CSwordBookModuleInfo::computeDepth(sword::TreeKeyIdx * const key, + const int level) +{ + const QByteArray savedKey(key->getText()); + if (level > m_depth) m_depth = level; - } if (key->hasChildren()) { key->firstChild(); - computeDepth(key, level + 1); - - key->setText( savedKey.c_str() );//return to the initial value + computeDepth(key, level + 1u); + key->setText(savedKey.constData()); // Return to the initial value } - if (key->nextSibling()) { + if (key->nextSibling()) computeDepth(key, level); - } } /** Returns a treekey filled with the structure of this module */ |