1 /*************************************************************************** 2 * Copyright (C) 2004-2021 by Pere Constans 3 * constans@molspaces.com 4 * cb2Bib version 2.0.1. Licensed under the GNU GPL version 3. 5 * See the LICENSE file that comes with this distribution. 6 ***************************************************************************/ 7 #include "preprocess.h" 8 #include "settings.h" 9 10 11 preprocess::preprocess(QObject* parento) : QObject(parento) 12 { 13 loadSettings(); 14 connect(settings::instance(), SIGNAL(newSettings()), this, SLOT(loadSettings())); 15 } 16 17 18 void preprocess::loadSettings() 19 { 20 FindReplaceInput = settings::instance()->value("cb2Bib/FindReplaceInput").toBool(); 21 FindReplaceInputList = settings::instance()->value("cb2Bib/FindReplaceInputList").toStringList(); 22 } 23 24 void preprocess::preprocessText(QString* text) 25 { 26 if (!FindReplaceInput) 27 return; 28 QStringList::Iterator i = FindReplaceInputList.begin(); 29 while (i != FindReplaceInputList.end()) 30 { 31 const QStringList spLine((*i).split('|')); 32 if (spLine.count() > 1) 33 text->replace(spLine.at(0), spLine.at(1)); 34 ++i; 35 } 36 }