got rid of accesses to global config through getMainConfig()

This commit is contained in:
Jean-Francois Dockes
2011-03-02 13:47:07 +01:00
parent bac0c1eeb9
commit e1a20aa810
31 changed files with 98 additions and 124 deletions
-4
View File
@@ -106,10 +106,6 @@ Usage(void)
static RclConfig *config;
RclConfig *RclConfig::getMainConfig()
{
return config;
}
int main(int argc, char **argv)
{
+2 -2
View File
@@ -145,7 +145,7 @@ string QtGuiResListPager::pageTop()
string QtGuiResListPager::iconPath(const string& mtype)
{
string iconpath;
RclConfig::getMainConfig()->getMimeIconName(mtype, &iconpath);
rclconfig->getMimeIconName(mtype, &iconpath);
return iconpath;
}
@@ -511,7 +511,7 @@ void ResList::displayPage()
{
m_pageParaToReldocnums.clear();
clear();
m_pager->displayPage();
m_pager->displayPage(rclconfig);
LOGDEB0(("ResList::resultPageNext: hasNext %d hasPrev %d\n",
m_pager->hasPrev(), m_pager->hasNext()));
emit prevPageAvailable(m_pager->hasPrev());
+5 -5
View File
@@ -19,6 +19,7 @@ static char rcsid[] = "@(#$Id: reslist.cpp,v 1.52 2008-12-17 15:12:08 dockes Exp
#include <QTextDocument>
#include <QPainter>
#include "recoll.h"
#include "refcntr.h"
#include "docseq.h"
#include "debuglog.h"
@@ -84,7 +85,7 @@ const string& ResTablePager::parFormat()
string ResTablePager::iconPath(const string& mtype)
{
string iconpath;
RclConfig::getMainConfig()->getMimeIconName(mtype, &iconpath);
rclconfig->getMimeIconName(mtype, &iconpath);
return iconpath;
}
@@ -179,9 +180,8 @@ RecollModel::RecollModel(const QStringList fields, QObject *parent)
// Add dynamic "stored" fields to the full column list. This
// could be protected to be done only once, but it's no real
// problem
RclConfig *config = RclConfig::getMainConfig();
if (config) {
const set<string>& stored = config->getStoredFields();
if (rclconfig) {
const set<string>& stored = rclconfig->getStoredFields();
for (set<string>::const_iterator it = stored.begin();
it != stored.end(); it++) {
if (o_displayableFields.find(*it) == o_displayableFields.end()) {
@@ -488,7 +488,7 @@ void ResTable::onTableView_currentChanged(const QModelIndex& index)
if (m_model->getDocSource()->getDoc(index.row(), doc)) {
textBrowser->clear();
m_detaildocnum = index.row();
m_pager->displayDoc(index.row(), doc, m_model->m_hdata);
m_pager->displayDoc(rclconfig, index.row(), doc, m_model->m_hdata);
}
}
+2 -2
View File
@@ -135,9 +135,9 @@ void SSearch::startSimpleSearch()
if (tp == SST_LANG) {
string reason;
if (prefs.autoSuffsEnable)
sdata = wasaStringToRcl(u8, reason, (const char *)prefs.autoSuffs.toUtf8());
sdata = wasaStringToRcl(rclconfig, u8, reason, (const char *)prefs.autoSuffs.toUtf8());
else
sdata = wasaStringToRcl(u8, reason);
sdata = wasaStringToRcl(rclconfig, u8, reason);
if (sdata == 0) {
QMessageBox::warning(0, "Recoll", tr("Bad query string") +
QString::fromAscii(reason.c_str()));
+1 -1
View File
@@ -375,7 +375,7 @@ void UIPrefsDialog::addExtraDbPB_clicked()
}
struct stat st1, st2;
stat(dbdir.c_str(), &st1);
string rcldbdir = RclConfig::getMainConfig()->getDbDir();
string rcldbdir = rclconfig->getDbDir();
stat(rcldbdir.c_str(), &st2);
path_catslash(rcldbdir);