logging now uses c++ streams

This commit is contained in:
Jean-Francois Dockes
2016-07-12 09:41:04 +02:00
parent 7c4223088b
commit f6a999de84
123 changed files with 1974 additions and 2760 deletions
+4 -3
View File
@@ -38,7 +38,7 @@ using namespace std;
#include "recoll.h"
#include "rclconfig.h"
#include "debuglog.h"
#include "log.h"
#include "searchdata.h"
#include "guiutils.h"
#include "rclhelp.h"
@@ -443,7 +443,7 @@ void AdvSearch::runSearch()
entries.push_back(subtreeCMB->currentText());
entries.sort();
entries.unique();
LOGDEB(("Subtree list now has %d entries\n", entries.size()));
LOGDEB("Subtree list now has " << (entries.size()) << " entries\n" );
subtreeCMB->clear();
for (list<QString>::iterator it = entries.begin();
it != entries.end(); it++) {
@@ -479,7 +479,7 @@ void AdvSearch::fromSearch(STD_SHARED_PTR<SearchData> sdata)
for (unsigned int i = 0; i < sdata->m_query.size(); i++) {
// Set fields from clause
if (sdata->m_query[i]->getTp() == SCLT_SUB) {
LOGERR(("AdvSearch::fromSearch: SUB clause found !\n"));
LOGERR("AdvSearch::fromSearch: SUB clause found !\n" );
continue;
}
if (sdata->m_query[i]->getTp() == SCLT_PATH) {
@@ -576,3 +576,4 @@ void AdvSearch::slotHistoryPrev()
fromSearch(sd);
}
+2 -1
View File
@@ -19,7 +19,7 @@
#include "advshist.h"
#include "guiutils.h"
#include "debuglog.h"
#include "log.h"
#include "xmltosd.h"
using namespace std;
@@ -94,3 +94,4 @@ void AdvSearchHist::clear()
{
g_dynconf->eraseAll(advSearchHistSk);
}
+4 -3
View File
@@ -40,7 +40,7 @@
#include "confgui.h"
#include "smallut.h"
#include "debuglog.h"
#include "log.h"
#include "rcldb.h"
#include "guiutils.h"
@@ -376,7 +376,7 @@ void ConfParamSLW::showInputDialog()
void ConfParamSLW::listToConf()
{
list<string> ls;
LOGDEB2(("ConfParamSLW::listToConf. m_fsencoding %d\n", int(m_fsencoding)));
LOGDEB2("ConfParamSLW::listToConf. m_fsencoding " << (int(m_fsencoding)) << "\n" );
for (int i = 0; i < m_lb->count(); i++) {
// General parameters are encoded as utf-8. File names as
// local8bit There is no hope for 8bit file names anyway
@@ -423,7 +423,7 @@ void ConfParamSLW::deleteSelected()
}
for (vector<int>::reverse_iterator it = idxes.rbegin();
it != idxes.rend(); it++) {
LOGDEB0(("deleteSelected: %d was selected\n", *it));
LOGDEB0("deleteSelected: " << (*it) << " was selected\n" );
QListWidgetItem *item = m_lb->takeItem(*it);
emit entryDeleted(item->text());
delete item;
@@ -476,3 +476,4 @@ void ConfParamCSLW::showInputDialog()
}
} // Namespace confgui
+10 -9
View File
@@ -35,7 +35,7 @@ using std::list;
#include "recoll.h"
#include "confguiindex.h"
#include "smallut.h"
#include "debuglog.h"
#include "log.h"
#include "rcldb.h"
#include "conflinkrcl.h"
#include "execmd.h"
@@ -68,9 +68,9 @@ ConfIndexW::ConfIndexW(QWidget *parent, RclConfig *config)
void ConfIndexW::acceptChanges()
{
LOGDEB(("ConfIndexW::acceptChanges()\n"));
LOGDEB("ConfIndexW::acceptChanges()\n" );
if (!m_conf) {
LOGERR(("ConfIndexW::acceptChanges: no config\n"));
LOGERR("ConfIndexW::acceptChanges: no config\n" );
return;
}
// Let the changes to disk
@@ -88,7 +88,7 @@ void ConfIndexW::acceptChanges()
void ConfIndexW::rejectChanges()
{
LOGDEB(("ConfIndexW::rejectChanges()\n"));
LOGDEB("ConfIndexW::rejectChanges()\n" );
// Discard local changes.
delete m_conf;
m_conf = 0;
@@ -477,7 +477,7 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config,
string cmd = "iconv";
int status = ex.doexec(cmd, args, 0, &icout);
if (status) {
LOGERR(("Can't get list of charsets from 'iconv -l'"));
LOGERR("Can't get list of charsets from 'iconv -l'" );
}
icout = neutchars(icout, ",");
list<string> ccsets;
@@ -579,7 +579,7 @@ void ConfSubPanelW::reloadAll()
void ConfSubPanelW::subDirChanged(QListWidgetItem *current, QListWidgetItem *)
{
LOGDEB(("ConfSubPanelW::subDirChanged\n"));
LOGDEB("ConfSubPanelW::subDirChanged\n" );
if (current == 0 || current->text() == "") {
m_sk = "";
@@ -588,13 +588,13 @@ void ConfSubPanelW::subDirChanged(QListWidgetItem *current, QListWidgetItem *)
m_sk = (const char *) current->text().toUtf8();
m_groupbox->setTitle(current->text());
}
LOGDEB(("ConfSubPanelW::subDirChanged: now [%s]\n", m_sk.c_str()));
LOGDEB("ConfSubPanelW::subDirChanged: now [" << (m_sk) << "]\n" );
reloadAll();
}
void ConfSubPanelW::subDirDeleted(QString sbd)
{
LOGDEB(("ConfSubPanelW::subDirDeleted(%s)\n", (const char *)sbd.toUtf8()));
LOGDEB("ConfSubPanelW::subDirDeleted(" << ((const char *)sbd.toUtf8()) << ")\n" );
if (sbd == "") {
// Can't do this, have to reinsert it
QTimer::singleShot(0, this, SLOT(restoreEmpty()));
@@ -606,8 +606,9 @@ void ConfSubPanelW::subDirDeleted(QString sbd)
void ConfSubPanelW::restoreEmpty()
{
LOGDEB(("ConfSubPanelW::restoreEmpty()\n"));
LOGDEB("ConfSubPanelW::restoreEmpty()\n" );
m_subdirs->getListBox()->insertItem(0, "");
}
} // Namespace confgui
+5 -6
View File
@@ -25,7 +25,7 @@
*/
#include "confgui.h"
#include "conftree.h"
#include "debuglog.h"
#include "log.h"
namespace confgui {
@@ -42,10 +42,10 @@ public:
{
if (!m_conf)
return false;
LOGDEB1(("Setting [%s] value to [%s]\n", m_nm.c_str(), val.c_str()));
LOGDEB1("Setting [" << (m_nm) << "] value to [" << (val) << "]\n" );
bool ret = m_conf->set(m_nm, val, m_sk?*m_sk:"");
if (!ret)
LOGERR(("Value set failed\n"));
LOGERR("Value set failed\n" );
return ret;
}
virtual bool get(string& val)
@@ -53,9 +53,7 @@ public:
if (!m_conf)
return false;
bool ret = m_conf->get(m_nm, val, m_sk?*m_sk:"");
LOGDEB1(("ConfLinkRcl::get: [%s] sk [%s] -> [%s]\n",
m_nm.c_str(), m_sk?m_sk->c_str():"",
ret ? val.c_str() : "no value"));
LOGDEB1("ConfLinkRcl::get: [" << (m_nm) << "] sk [" << (m_sk?m_sk:"") << "] -> [" << (ret ? val : "no value") << "]\n" );
return ret;
}
private:
@@ -67,3 +65,4 @@ private:
} // Namespace confgui
#endif /* _CONFLINKRCL_H_INCLUDED_ */
+2 -4
View File
@@ -39,7 +39,7 @@ using namespace std;
#include "pathut.h"
#include "confguiindex.h"
#include "debuglog.h"
#include "log.h"
#include "rclconfig.h"
#include "execmd.h"
#include "conflinkrcl.h"
@@ -89,9 +89,6 @@ int main(int argc, char **argv)
argc--; argv++;
}
DebugLog::getdbl()->setloglevel(DEBDEB1);
DebugLog::setfilename("stderr");
string a_config = "tstconfdir";
config = new RclConfig(&a_config);
if (config == 0 || !config->ok()) {
@@ -130,3 +127,4 @@ int main(int argc, char **argv)
// Let's go
return app.exec();
}
+5 -4
View File
@@ -34,7 +34,7 @@
#include "pathut.h"
#include "smallut.h"
#include "recoll.h"
#include "debuglog.h"
#include "log.h"
#include "readfile.h"
#include "copyfile.h"
@@ -158,7 +158,7 @@ FragButs::FragButs(QWidget* parent)
QMessageBox::warning(0, "Recoll",
tr("%1 not found.").arg(
QString::fromLocal8Bit(m_fn.c_str())));
LOGERR(("Fragbuts:: can't read [%s]\n", m_fn.c_str()));
LOGERR("Fragbuts:: can't read [" << (m_fn) << "]\n" );
return;
}
FragButsParser parser(this, m_buttons);
@@ -199,7 +199,7 @@ bool FragButs::isStale(time_t *reftime)
void FragButs::onButtonClicked(bool on)
{
LOGDEB(("FragButs::onButtonClicked: [%d]\n", int(on)));
LOGDEB("FragButs::onButtonClicked: [" << (int(on)) << "]\n" );
emit fragmentsChanged();
}
@@ -208,8 +208,9 @@ void FragButs::getfrags(std::vector<std::string>& frags)
for (vector<ButFrag>::iterator it = m_buttons.begin();
it != m_buttons.end(); it++) {
if (it->button->isChecked() && !it->fragment.empty()) {
LOGDEB(("FragButs: fragment [%s]\n", it->fragment.c_str()));
LOGDEB("FragButs: fragment [" << (it->fragment) << "]\n" );
frags.push_back(it->fragment);
}
}
}
+7 -9
View File
@@ -20,7 +20,7 @@
#include <cstdio>
#include "recoll.h"
#include "debuglog.h"
#include "log.h"
#include "smallut.h"
#include "guiutils.h"
#include "pathut.h"
@@ -73,7 +73,7 @@ static bool havereadsettings;
void rwSettings(bool writing)
{
LOGDEB1(("rwSettings: write %d\n", int(writing)));
LOGDEB1("rwSettings: write " << (int(writing)) << "\n" );
if (writing && !havereadsettings)
return;
QSettings settings("Recoll.org", "recoll");
@@ -312,12 +312,11 @@ void rwSettings(bool writing)
continue;
bool stripped;
if (!Rcl::Db::testDbDir(dbdir, &stripped)) {
LOGERR(("Not a xapian index: [%s]\n", dbdir.c_str()));
LOGERR("Not a xapian index: [" << (dbdir) << "]\n" );
continue;
}
if (stripped != o_index_stripchars) {
LOGERR(("Incompatible character stripping: [%s]\n",
dbdir.c_str()));
LOGERR("Incompatible character stripping: [" << (dbdir) << "]\n" );
continue;
}
prefs.allExtraDbs.push_back(dbdir);
@@ -334,8 +333,7 @@ void rwSettings(bool writing)
bool stripped;
if (!Rcl::Db::testDbDir(*it, &stripped) ||
stripped != o_index_stripchars) {
LOGINFO(("Not a Xapian index or char stripping differs: [%s]\n",
it->c_str()));
LOGINFO("Not a Xapian index or char stripping differs: [" << *it << "]\n" );
it = prefs.activeExtraDbs.erase(it);
} else {
it++;
@@ -359,8 +357,7 @@ void rwSettings(bool writing)
bool strpd;
if (!Rcl::Db::testDbDir(dbdir, &strpd) ||
strpd != o_index_stripchars) {
LOGERR(("Not a Xapian dir or diff. char stripping: [%s]\n",
dbdir.c_str()));
LOGERR("Not a Xapian dir or diff. char stripping: [" << (dbdir) << "]\n" );
continue;
}
prefs.activeExtraDbs.push_back(dbdir);
@@ -414,3 +411,4 @@ string PrefsPack::stemlang()
}
return stemLang;
}
+11 -11
View File
@@ -36,7 +36,7 @@
#include "recoll.h"
#include "smallut.h"
#include "rclinit.h"
#include "debuglog.h"
#include "log.h"
#include "rclmain_w.h"
#include "ssearch_w.h"
#include "guiutils.h"
@@ -98,7 +98,7 @@ void startManual(const string& helpindex)
bool maybeOpenDb(string &reason, bool force, bool *maindberror)
{
LOGDEB2(("maybeOpenDb: force %d\n", force));
LOGDEB2("maybeOpenDb: force " << (force) << "\n" );
if (!rcldb) {
reason = "Internal error: db not created";
return false;
@@ -109,7 +109,7 @@ bool maybeOpenDb(string &reason, bool force, bool *maindberror)
rcldb->rmQueryDb("");
for (list<string>::const_iterator it = prefs.activeExtraDbs.begin();
it != prefs.activeExtraDbs.end(); it++) {
LOGDEB(("main: adding [%s]\n", it->c_str()));
LOGDEB("main: adding [" << *it << "]\n" );
rcldb->addQueryDb(*it);
}
Rcl::Db::OpenError error;
@@ -136,8 +136,7 @@ bool getStemLangs(vector<string>& vlangs)
string reason;
if (maybeOpenDb(reason)) {
vlangs = rcldb->getStemLangs();
LOGDEB0(("getStemLangs: from index: %s\n",
stringsToString(vlangs).c_str()));
LOGDEB0("getStemLangs: from index: " << (stringsToString(vlangs)) << "\n" );
return true;
} else {
// Cant get the langs from the index. Maybe it just does not
@@ -153,7 +152,7 @@ bool getStemLangs(vector<string>& vlangs)
static void recollCleanup()
{
LOGDEB2(("recollCleanup: closing database\n"));
LOGDEB2("recollCleanup: closing database\n" );
deleteZ(rcldb);
deleteZ(theconfig);
@@ -163,13 +162,13 @@ static void recollCleanup()
deleteZ(aspell);
#endif
LOGDEB2(("recollCleanup: done\n"));
LOGDEB2("recollCleanup: done\n" );
}
void applyStyleSheet(const QString& ssfname)
{
const char *cfname = (const char *)ssfname.toLocal8Bit();
LOGDEB0(("Applying style sheet: [%s]\n", cfname));
LOGDEB0("Applying style sheet: [" << (cfname) << "]\n" );
if (cfname && *cfname) {
string stylesheet;
file_to_string(cfname, stylesheet);
@@ -327,7 +326,7 @@ int main(int argc, char **argv)
aspell = new Aspell(theconfig);
aspell->init(reason);
if (!aspell || !aspell->ok()) {
LOGDEB(("Aspell speller creation failed %s\n", reason.c_str()));
LOGDEB("Aspell speller creation failed " << (reason) << "\n" );
aspell = 0;
}
#endif
@@ -396,7 +395,7 @@ int main(int argc, char **argv)
mainWindow->
sSearch->setSearchString(QString::fromLocal8Bit(question.c_str()));
} else if (!urltoview.empty()) {
LOGDEB(("MAIN: got urltoview [%s]\n", urltoview.c_str()));
LOGDEB("MAIN: got urltoview [" << (urltoview) << "]\n" );
mainWindow->setUrlToView(QString::fromLocal8Bit(urltoview.c_str()));
}
return app.exec();
@@ -404,7 +403,7 @@ int main(int argc, char **argv)
QString myGetFileName(bool isdir, QString caption, bool filenosave)
{
LOGDEB1(("myFileDialog: isdir %d\n", isdir));
LOGDEB1("myFileDialog: isdir " << (isdir) << "\n" );
QFileDialog dialog(0, caption);
if (isdir) {
@@ -430,3 +429,4 @@ QString myGetFileName(bool isdir, QString caption, bool filenosave)
}
return QString();
}
+6 -5
View File
@@ -30,7 +30,7 @@ using namespace std;
#include "recoll.h"
#include "multisave.h"
#include "smallut.h"
#include "debuglog.h"
#include "log.h"
#include "pathut.h"
#include "internfile.h"
@@ -52,7 +52,7 @@ void multiSave(QWidget *p, vector<Rcl::Doc>& docs)
return;
}
string dir((const char *)dirl[0].toLocal8Bit());
LOGDEB2(("multiSave: got dir %s\n", dir.c_str()));
LOGDEB2("multiSave: got dir " << (dir) << "\n" );
/* Save doc to files in target directory. Issues:
- It is quite common to have docs in the array with the save
@@ -90,13 +90,13 @@ void multiSave(QWidget *p, vector<Rcl::Doc>& docs)
string utf8fn;
it->getmeta(Rcl::Doc::keyfn, &utf8fn);
string suffix = path_suffix(utf8fn);
LOGDEB(("Multisave: [%s] suff [%s]\n", utf8fn.c_str(), suffix.c_str()));
LOGDEB("Multisave: [" << (utf8fn) << "] suff [" << (suffix) << "]\n" );
if (suffix.empty() || suffix.size() > 10) {
suffix = theconfig->getSuffixFromMimeType(it->mimetype);
LOGDEB(("Multisave: suff from config [%s]\n", suffix.c_str()));
LOGDEB("Multisave: suff from config [" << (suffix) << "]\n" );
}
string simple = path_basename(utf8fn, string(".") + suffix);
LOGDEB(("Multisave: simple [%s]\n", simple.c_str()));
LOGDEB("Multisave: simple [" << (simple) << "]\n" );
if (simple.empty())
simple = "rclsave";
if (simple.size() > maxlen) {
@@ -141,3 +141,4 @@ void multiSave(QWidget *p, vector<Rcl::Doc>& docs)
}
}
}
+3 -6
View File
@@ -16,7 +16,7 @@
*/
#include <string>
#include "debuglog.h"
#include "log.h"
#include "preview_load.h"
#include "internfile.h"
#include "rcldoc.h"
@@ -29,14 +29,10 @@ LoadThread::LoadThread(RclConfig *config, const Rcl::Doc& idc,
: QThread(parent), status(1), m_idoc(idc), m_previewHtml(pvhtm),
m_config(*config)
{
// Save log level while we're running in the calling thread.
m_loglevel = DebugLog::getdbl()->getlevel();
}
void LoadThread::run()
{
DebugLog::getdbl()->setloglevel(m_loglevel);
FileInterner interner(m_idoc, &m_config, FileInterner::FIF_forPreview);
FIMissingStore mst;
interner.setMissingStore(&mst);
@@ -69,7 +65,8 @@ void LoadThread::run()
status = -1;
}
} catch (CancelExcept) {
LOGDEB(("LoadThread: cancelled\n"));
LOGDEB("LoadThread: cancelled\n" );
status = -1;
}
}
-1
View File
@@ -51,7 +51,6 @@ public:
private:
Rcl::Doc m_idoc;
int m_loglevel;
bool m_previewHtml;
RclConfig m_config;
};
+6 -7
View File
@@ -26,7 +26,7 @@
#include "preview_plaintorich.h"
#include "plaintorich.h"
#include "debuglog.h"
#include "log.h"
#include "guiutils.h"
#include "cancelcheck.h"
@@ -71,9 +71,9 @@ string PlainToRichQtPreview::PlainToRichQtPreview::header()
string PlainToRichQtPreview::startMatch(unsigned int grpidx)
{
LOGDEB2(("startMatch, grpidx %u\n", grpidx));
LOGDEB2("startMatch, grpidx " << (grpidx) << "\n" );
grpidx = m_hdata->grpsugidx[grpidx];
LOGDEB2(("startMatch, ugrpidx %u\n", grpidx));
LOGDEB2("startMatch, ugrpidx " << (grpidx) << "\n" );
m_groupanchors[grpidx].push_back(++m_lastanchor);
m_groupcuranchors[grpidx] = 0;
return string("<span style='color: ").
@@ -105,7 +105,7 @@ string PlainToRichQtPreview::startChunk()
int PlainToRichQtPreview::nextAnchorNum(int grpidx)
{
LOGDEB2(("nextAnchorNum: group %d\n", grpidx));
LOGDEB2("nextAnchorNum: group " << (grpidx) << "\n" );
map<unsigned int, unsigned int>::iterator curit =
m_groupcuranchors.find(grpidx);
map<unsigned int, vector<int> >::iterator vecit =
@@ -122,7 +122,7 @@ int PlainToRichQtPreview::nextAnchorNum(int grpidx)
else
m_groupcuranchors[grpidx]++;
m_curanchor = vecit->second[m_groupcuranchors[grpidx]];
LOGDEB2(("nextAnchorNum: curanchor now %d\n", m_curanchor));
LOGDEB2("nextAnchorNum: curanchor now " << (m_curanchor) << "\n" );
}
return m_curanchor;
}
@@ -161,7 +161,6 @@ ToRichThread::ToRichThread(const string &i, const HighlightData& hd,
QObject *parent)
: QThread(parent), m_input(i), m_hdata(hd), m_ptr(ptr), m_output(qrichlist)
{
m_loglevel = DebugLog::getdbl()->getlevel();
}
// Insert into editor by chunks so that the top becomes visible
@@ -171,7 +170,6 @@ ToRichThread::ToRichThread(const string &i, const HighlightData& hd,
void ToRichThread::run()
{
DebugLog::getdbl()->setloglevel(m_loglevel);
list<string> out;
try {
m_ptr->plaintorich(m_input, out, m_hdata, CHUNKL);
@@ -185,3 +183,4 @@ void ToRichThread::run()
m_output.push_back(QString::fromUtf8(it->c_str(), it->length()));
}
}
-1
View File
@@ -64,7 +64,6 @@ public:
virtual void run();
private:
int m_loglevel;
const string &m_input;
const HighlightData &m_hdata;
STD_SHARED_PTR<PlainToRichQtPreview> m_ptr;
+48 -57
View File
@@ -45,7 +45,7 @@
#include <QShortcut>
#include <QTimer>
#include "debuglog.h"
#include "log.h"
#include "pathut.h"
#include "internfile.h"
#include "recoll.h"
@@ -195,7 +195,7 @@ void Preview::emitShowPrev()
void Preview::closeEvent(QCloseEvent *e)
{
LOGDEB(("Preview::closeEvent. m_loading %d\n", m_loading));
LOGDEB("Preview::closeEvent. m_loading " << (m_loading) << "\n" );
if (m_loading) {
CancelCheck::instance().setCancel();
e->ignore();
@@ -226,11 +226,10 @@ bool Preview::eventFilter(QObject *target, QEvent *event)
{
if (event->type() != QEvent::KeyPress) {
#if 0
LOGDEB(("Preview::eventFilter(): %s\n", eventTypeToStr(event->type())));
LOGDEB("Preview::eventFilter(): " << (eventTypeToStr(event->type())) << "\n" );
if (event->type() == QEvent::MouseButtonRelease) {
QMouseEvent *mev = (QMouseEvent *)event;
LOGDEB(("Mouse: GlobalY %d y %d\n", mev->globalY(),
mev->y()));
LOGDEB("Mouse: GlobalY " << (mev->globalY()) << " y " << (mev->y()) << "\n" );
}
#endif
return false;
@@ -241,7 +240,7 @@ bool Preview::eventFilter(QObject *target, QEvent *event)
if (m_dynSearchActive) {
if (keyEvent->key() == Qt::Key_F3) {
LOGDEB2(("Preview::eventFilter: got F3\n"));
LOGDEB2("Preview::eventFilter: got F3\n" );
doSearch(searchTextCMB->currentText(), true,
(keyEvent->modifiers() & Qt::ShiftModifier) != 0);
return true;
@@ -254,18 +253,18 @@ bool Preview::eventFilter(QObject *target, QEvent *event)
if (keyEvent->key() == Qt::Key_Slash ||
(keyEvent->key() == Qt::Key_F &&
(keyEvent->modifiers() & Qt::ControlModifier))) {
LOGDEB2(("Preview::eventFilter: got / or C-F\n"));
LOGDEB2("Preview::eventFilter: got / or C-F\n" );
searchTextCMB->setFocus();
m_dynSearchActive = true;
return true;
} else if (keyEvent->key() == Qt::Key_Space) {
LOGDEB2(("Preview::eventFilter: got Space\n"));
LOGDEB2("Preview::eventFilter: got Space\n" );
int value = edit->verticalScrollBar()->value();
value += edit->verticalScrollBar()->pageStep();
edit->verticalScrollBar()->setValue(value);
return true;
} else if (keyEvent->key() == Qt::Key_Backspace) {
LOGDEB2(("Preview::eventFilter: got Backspace\n"));
LOGDEB2("Preview::eventFilter: got Backspace\n" );
int value = edit->verticalScrollBar()->value();
value -= edit->verticalScrollBar()->pageStep();
edit->verticalScrollBar()->setValue(value);
@@ -279,8 +278,7 @@ bool Preview::eventFilter(QObject *target, QEvent *event)
void Preview::searchTextChanged(const QString & text)
{
LOGDEB1(("Search line text changed. text: '%s'\n",
(const char *)text.toUtf8()));
LOGDEB1("Search line text changed. text: '" << ((const char *)text.toUtf8()) << "'\n" );
m_searchTextFromIndex = -1;
if (text.isEmpty()) {
m_dynSearchActive = false;
@@ -294,13 +292,13 @@ void Preview::searchTextChanged(const QString & text)
void Preview::searchTextFromIndex(int idx)
{
LOGDEB1(("search line from index %d\n", idx));
LOGDEB1("search line from index " << (idx) << "\n" );
m_searchTextFromIndex = idx;
}
PreviewTextEdit *Preview::currentEditor()
{
LOGDEB2(("Preview::currentEditor()\n"));
LOGDEB2("Preview::currentEditor()\n" );
QWidget *tw = pvTab->currentWidget();
PreviewTextEdit *edit = 0;
if (tw) {
@@ -325,9 +323,7 @@ void Preview::emitSaveDocToFile()
void Preview::doSearch(const QString &_text, bool next, bool reverse,
bool wordOnly)
{
LOGDEB(("Preview::doSearch: text [%s] idx %d next %d rev %d word %d\n",
(const char *)_text.toUtf8(), m_searchTextFromIndex, int(next),
int(reverse), int(wordOnly)));
LOGDEB("Preview::doSearch: text [" << ((const char *)_text.toUtf8()) << "] idx " << (m_searchTextFromIndex) << " next " << (int(next)) << " rev " << (int(reverse)) << " word " << (int(wordOnly)) << "\n" );
QString text = _text;
bool matchCase = matchCheck->isChecked();
@@ -339,7 +335,7 @@ void Preview::doSearch(const QString &_text, bool next, bool reverse,
if (text.isEmpty() || m_searchTextFromIndex != -1) {
if (!edit->m_plaintorich->haveAnchors()) {
LOGDEB(("NO ANCHORS\n"));
LOGDEB("NO ANCHORS\n" );
return;
}
// The combobox indices are equal to the search ugroup indices
@@ -350,7 +346,7 @@ void Preview::doSearch(const QString &_text, bool next, bool reverse,
edit->m_plaintorich->nextAnchorNum(m_searchTextFromIndex);
}
QString aname = edit->m_plaintorich->curAnchorName();
LOGDEB(("Calling scrollToAnchor(%s)\n", (const char *)aname.toUtf8()));
LOGDEB("Calling scrollToAnchor(" << ((const char *)aname.toUtf8()) << ")\n" );
edit->scrollToAnchor(aname);
// Position the cursor approximately at the anchor (top of
// viewport) so that searches start from here
@@ -370,7 +366,7 @@ void Preview::doSearch(const QString &_text, bool next, bool reverse,
edit->setTextCursor(cursor);
}
Chrono chron;
LOGDEB(("Preview::doSearch: first find call\n"));
LOGDEB("Preview::doSearch: first find call\n" );
QTextDocument::FindFlags flags = 0;
if (reverse)
flags |= QTextDocument::FindBackward;
@@ -379,21 +375,19 @@ void Preview::doSearch(const QString &_text, bool next, bool reverse,
if (matchCase)
flags |= QTextDocument::FindCaseSensitively;
bool found = edit->find(text, flags);
LOGDEB(("Preview::doSearch: first find call return: found %d %.2f S\n",
found, chron.secs()));
LOGDEB("Preview::doSearch: first find call return: found " << (found) << " " << (chron.secs()) << " S\n" );
// If not found, try to wrap around.
if (!found) {
LOGDEB(("Preview::doSearch: wrapping around\n"));
LOGDEB("Preview::doSearch: wrapping around\n" );
if (reverse) {
edit->moveCursor (QTextCursor::End);
} else {
edit->moveCursor (QTextCursor::Start);
}
LOGDEB(("Preview::doSearch: 2nd find call\n"));
LOGDEB("Preview::doSearch: 2nd find call\n" );
chron.restart();
found = edit->find(text, flags);
LOGDEB(("Preview::doSearch: 2nd find call return found %d %.2f S\n",
found, chron.secs()));
LOGDEB("Preview::doSearch: 2nd find call return found " << (found) << " " << (chron.secs()) << " S\n" );
}
if (found) {
@@ -403,37 +397,37 @@ void Preview::doSearch(const QString &_text, bool next, bool reverse,
QApplication::beep();
m_canBeep = false;
}
LOGDEB(("Preview::doSearch: return\n"));
LOGDEB("Preview::doSearch: return\n" );
}
void Preview::nextPressed()
{
LOGDEB2(("Preview::nextPressed\n"));
LOGDEB2("Preview::nextPressed\n" );
doSearch(searchTextCMB->currentText(), true, false);
}
void Preview::prevPressed()
{
LOGDEB2(("Preview::prevPressed\n"));
LOGDEB2("Preview::prevPressed\n" );
doSearch(searchTextCMB->currentText(), true, true);
}
// Called when user clicks on tab
void Preview::currentChanged(int index)
{
LOGDEB2(("PreviewTextEdit::currentChanged\n"));
LOGDEB2("PreviewTextEdit::currentChanged\n" );
QWidget *tw = pvTab->widget(index);
PreviewTextEdit *edit =
tw->findChild<PreviewTextEdit*>("pvEdit");
LOGDEB1(("Preview::currentChanged(). Editor: %p\n", edit));
LOGDEB1("Preview::currentChanged(). Editor: " << (edit) << "\n" );
if (edit == 0) {
LOGERR(("Editor child not found\n"));
LOGERR("Editor child not found\n" );
return;
}
edit->setFocus();
// Disconnect the print signal and reconnect it to the current editor
LOGDEB(("Disconnecting reconnecting print signal\n"));
LOGDEB("Disconnecting reconnecting print signal\n" );
disconnect(this, SIGNAL(printCurrentPreviewRequest()), 0, 0);
connect(this, SIGNAL(printCurrentPreviewRequest()), edit, SLOT(print()));
edit->installEventFilter(this);
@@ -444,7 +438,7 @@ void Preview::currentChanged(int index)
void Preview::closeCurrentTab()
{
LOGDEB1(("Preview::closeCurrentTab: m_loading %d\n", m_loading));
LOGDEB1("Preview::closeCurrentTab: m_loading " << (m_loading) << "\n" );
if (m_loading) {
CancelCheck::instance().setCancel();
return;
@@ -461,7 +455,7 @@ void Preview::closeCurrentTab()
PreviewTextEdit *Preview::addEditorTab()
{
LOGDEB1(("PreviewTextEdit::addEditorTab()\n"));
LOGDEB1("PreviewTextEdit::addEditorTab()\n" );
QWidget *anon = new QWidget((QWidget *)pvTab);
QVBoxLayout *anonLayout = new QVBoxLayout(anon);
PreviewTextEdit *editor = new PreviewTextEdit(anon, "pvEdit", this);
@@ -475,7 +469,7 @@ PreviewTextEdit *Preview::addEditorTab()
void Preview::setCurTabProps(const Rcl::Doc &doc, int docnum)
{
LOGDEB1(("Preview::setCurTabProps\n"));
LOGDEB1("Preview::setCurTabProps\n" );
QString title;
string ctitle;
if (doc.getmeta(Rcl::Doc::keytt, &ctitle) && !ctitle.empty()) {
@@ -497,7 +491,7 @@ void Preview::setCurTabProps(const Rcl::Doc &doc, int docnum)
struct tm *tm = localtime(&mtime);
strftime(datebuf, 99, "%Y-%m-%d %H:%M:%S", tm);
}
LOGDEB(("Doc.url: [%s]\n", doc.url.c_str()));
LOGDEB("Doc.url: [" << (doc.url) << "]\n" );
string url;
printableUrl(theconfig->getDefCharset(), doc.url, url);
string tiptxt = url + string("\n");
@@ -517,10 +511,10 @@ void Preview::setCurTabProps(const Rcl::Doc &doc, int docnum)
bool Preview::makeDocCurrent(const Rcl::Doc& doc, int docnum, bool sametab)
{
LOGDEB(("Preview::makeDocCurrent: %s\n", doc.url.c_str()));
LOGDEB("Preview::makeDocCurrent: " << (doc.url) << "\n" );
if (m_loading) {
LOGERR(("Already loading\n"));
LOGERR("Already loading\n" );
return false;
}
@@ -609,7 +603,7 @@ public:
bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
{
LOGDEB1(("Preview::loadDocInCurrentTab()\n"));
LOGDEB1("Preview::loadDocInCurrentTab()\n" );
LoadGuard guard(&m_loading);
CancelCheck::instance().setCancel(false);
@@ -647,10 +641,7 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
progress.show();
}
LOGDEB(("loadDocInCurrentTab: after file load: cancel %d status %d"
" text length %d\n",
CancelCheck::instance().cancelState(), lthr.status,
lthr.fdoc.text.length()));
LOGDEB("loadDocInCurrentTab: after file load: cancel " << (CancelCheck::instance().cancelState()) << " status " << (lthr.status) << " text length " << (lthr.fdoc.text.length()) << "\n" );
if (CancelCheck::instance().cancelState())
return false;
@@ -719,10 +710,10 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
qApp->processEvents();
if (inputishtml) {
LOGDEB1(("Preview: got html %s\n", lthr.fdoc.text.c_str()));
LOGDEB1("Preview: got html " << (lthr.fdoc.text) << "\n" );
editor->m_plaintorich->set_inputhtml(true);
} else {
LOGDEB1(("Preview: got plain %s\n", lthr.fdoc.text.c_str()));
LOGDEB1("Preview: got plain " << (lthr.fdoc.text) << "\n" );
editor->m_plaintorich->set_inputhtml(false);
}
@@ -753,8 +744,7 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
}
}
} else {
LOGDEB(("Preview: no hilighting, loading %d bytes\n",
int(lthr.fdoc.text.size())));
LOGDEB("Preview: no hilighting, loading " << (int(lthr.fdoc.text.size())) << " bytes\n" );
// No plaintorich() call. In this case, either the text is
// html and the html quoting is hopefully correct, or it's
// plain-text and there is no need to escape special
@@ -804,7 +794,7 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
if (progress.wasCanceled()) {
editor->append("<b>Cancelled !</b>");
LOGDEB(("loadDocInCurrentTab: cancelled in editor load\n"));
LOGDEB("loadDocInCurrentTab: cancelled in editor load\n" );
break;
}
}
@@ -836,7 +826,7 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
if (fn.empty() || !idoc.ipath.empty()) {
TempFile temp = lthr.tmpimg;
if (temp) {
LOGDEB1(("Preview: load: got temp file from internfile\n"));
LOGDEB1("Preview: load: got temp file from internfile\n" );
} else if (!FileInterner::idocToFile(temp, string(),
theconfig, idoc)) {
temp.reset(); // just in case.
@@ -868,7 +858,7 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
// Position to the first query term
if (editor->m_plaintorich->haveAnchors()) {
QString aname = editor->m_plaintorich->curAnchorName();
LOGDEB2(("Call movetoanchor(%s)\n", (const char *)aname.toUtf8()));
LOGDEB2("Call movetoanchor(" << ((const char *)aname.toUtf8()) << ")\n" );
editor->scrollToAnchor(aname);
// Position the cursor approximately at the anchor (top of
// viewport) so that searches start from here
@@ -886,7 +876,7 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
editor->setFocus();
emit(previewExposed(this, m_searchId, docnum));
LOGDEB(("loadDocInCurrentTab: returning true\n"));
LOGDEB("loadDocInCurrentTab: returning true\n" );
return true;
}
@@ -905,7 +895,7 @@ PreviewTextEdit::PreviewTextEdit(QWidget* parent, const char* nm, Preview *pv)
void PreviewTextEdit::createPopupMenu(const QPoint& pos)
{
LOGDEB1(("PreviewTextEdit::createPopupMenu()\n"));
LOGDEB1("PreviewTextEdit::createPopupMenu()\n" );
QMenu *popup = new QMenu(this);
switch (m_curdsp) {
case PTE_DSPTXT:
@@ -944,7 +934,7 @@ void PreviewTextEdit::createPopupMenu(const QPoint& pos)
// Display main text
void PreviewTextEdit::displayText()
{
LOGDEB1(("PreviewTextEdit::displayText()\n"));
LOGDEB1("PreviewTextEdit::displayText()\n" );
if (m_format == Qt::PlainText)
setPlainText(m_richtxt);
else
@@ -955,7 +945,7 @@ void PreviewTextEdit::displayText()
// Display field values
void PreviewTextEdit::displayFields()
{
LOGDEB1(("PreviewTextEdit::displayFields()\n"));
LOGDEB1("PreviewTextEdit::displayFields()\n" );
QString txt = "<html><head></head><body>\n";
txt += "<b>" + QString::fromLocal8Bit(m_url.c_str());
@@ -977,7 +967,7 @@ void PreviewTextEdit::displayFields()
void PreviewTextEdit::displayImage()
{
LOGDEB1(("PreviewTextEdit::displayImage()\n"));
LOGDEB1("PreviewTextEdit::displayImage()\n" );
if (m_image.isNull())
displayText();
@@ -995,7 +985,7 @@ void PreviewTextEdit::displayImage()
void PreviewTextEdit::mouseDoubleClickEvent(QMouseEvent *event)
{
LOGDEB2(("PreviewTextEdit::mouseDoubleClickEvent\n"));
LOGDEB2("PreviewTextEdit::mouseDoubleClickEvent\n" );
QTextEdit::mouseDoubleClickEvent(event);
if (textCursor().hasSelection() && m_preview)
m_preview->emitWordSelect(textCursor().selectedText());
@@ -1003,7 +993,7 @@ void PreviewTextEdit::mouseDoubleClickEvent(QMouseEvent *event)
void PreviewTextEdit::print()
{
LOGDEB(("PreviewTextEdit::print\n"));
LOGDEB("PreviewTextEdit::print\n" );
if (!m_preview)
return;
@@ -1016,3 +1006,4 @@ void PreviewTextEdit::print()
QTextEdit::print(&printer);
#endif
}
+2 -1
View File
@@ -34,7 +34,7 @@ using namespace std;
#include <qlayout.h>
#include "recoll.h"
#include "debuglog.h"
#include "log.h"
#include "guiutils.h"
#include "conftree.h"
@@ -133,3 +133,4 @@ void EditTrans::on_transTW_itemSelectionChanged()
else
delPB->setEnabled(1);
}
+5 -5
View File
@@ -22,7 +22,7 @@
#include "recoll.h"
#include "rclhelp.h"
#include "debuglog.h"
#include "log.h"
map<string, string> HelpClient::helpmap;
@@ -42,7 +42,7 @@ bool HelpClient::eventFilter(QObject *obj, QEvent *event)
static time_t last_start;
if (event->type() == QEvent::KeyPress ||
event->type() == QEvent::ShortcutOverride) {
// LOGDEB(("HelpClient::eventFilter: %d\n", (int)event->type()));
// LOGDEB("HelpClient::eventFilter: " << ((int)event->type()) << "\n" );
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
if (ke->key() == Qt::Key_F1 || ke->key() == Qt::Key_Help) {
if (obj->isWidgetType()) {
@@ -57,11 +57,10 @@ bool HelpClient::eventFilter(QObject *obj, QEvent *event)
if (time(0) - last_start > 5) {
last_start = time(0);
if (it != helpmap.end()) {
LOGDEB(("HelpClient::eventFilter: %s->%s\n",
it->first.c_str(), it->second.c_str()));
LOGDEB("HelpClient::eventFilter: " << (it->first) << "->" << (it->second) << "\n" );
startManual(it->second);
} else {
LOGDEB(("HelpClient::eventFilter: no help section\n"));
LOGDEB("HelpClient::eventFilter: no help section\n" );
startManual("");
}
}
@@ -71,3 +70,4 @@ bool HelpClient::eventFilter(QObject *obj, QEvent *event)
}
return false;
}
+7 -7
View File
@@ -23,7 +23,7 @@
#include <QTimer>
#include "execmd.h"
#include "debuglog.h"
#include "log.h"
#include "transcode.h"
#include "indexer.h"
#include "rclmain_w.h"
@@ -83,7 +83,7 @@ void RclMain::updateIdxStatus()
// indexing, a possible need to exit, and cleanup exited viewers
void RclMain::periodic100()
{
LOGDEB2(("Periodic100\n"));
LOGDEB2("Periodic100\n" );
if (m_idxproc) {
// An indexing process was launched. If its' done, see status.
int status;
@@ -268,7 +268,7 @@ void RclMain::rebuildIndex()
case IXST_NOTRUNNING:
{
if (m_idxproc) {
LOGERR(("RclMain::rebuildIndex: current indexer exec not null\n"));
LOGERR("RclMain::rebuildIndex: current indexer exec not null\n" );
return;
}
int rep =
@@ -354,7 +354,7 @@ static string execToString(const string& cmd, const vector<string>& args)
void RclMain::specialIndex()
{
LOGDEB(("RclMain::specialIndex\n"));
LOGDEB("RclMain::specialIndex\n" );
switch (m_indexerState) {
case IXST_UNKNOWN:
case IXST_RUNNINGMINE:
@@ -365,7 +365,7 @@ void RclMain::specialIndex()
break;
}
if (m_idxproc) {
LOGERR(("RclMain::rebuildIndex: current indexer exec not null\n"));
LOGERR("RclMain::rebuildIndex: current indexer exec not null\n" );
return;
}
if (!specidx) // ??
@@ -418,8 +418,7 @@ void RclMain::specialIndex()
args.push_back(top);
}
m_idxproc = new ExecCmd;
LOGINFO(("specialIndex: exec: %s\n",
execToString("recollindex", args).c_str()));
LOGINFO("specialIndex: exec: " << execToString("recollindex", args) <<endl);
m_idxproc->startExec("recollindex", args, false, false);
}
@@ -449,3 +448,4 @@ void RclMain::updateIdxForDocs(vector<Rcl::Doc>& docs)
actionSpecial_Indexing->setEnabled(false);
}
+9 -10
View File
@@ -19,7 +19,7 @@
#include <QMessageBox>
#include <QShortcut>
#include "debuglog.h"
#include "log.h"
#include "internfile.h"
#include "rclzg.h"
#include "rclmain_w.h"
@@ -31,12 +31,12 @@ static const QKeySequence quitKeySeq("Ctrl+q");
// where the current one is closed
void RclMain::previewClosed(Preview *w)
{
LOGDEB(("RclMain::previewClosed(%p)\n", w));
LOGDEB("RclMain::previewClosed(" << (w) << ")\n" );
if (w == curPreview) {
LOGDEB(("Active preview closed\n"));
LOGDEB("Active preview closed\n" );
curPreview = 0;
} else {
LOGDEB(("Old preview closed\n"));
LOGDEB("Old preview closed\n" );
}
delete w;
}
@@ -114,7 +114,7 @@ bool RclMain::containerUpToDate(Rcl::Doc& doc)
QMessageBox::Cancel : QMessageBox::NoButton);
if (m_indexerState == IXST_NOTRUNNING && rep == QMessageBox::Ok) {
LOGDEB(("Requesting index update for %s\n", doc.url.c_str()));
LOGDEB("Requesting index update for " << (doc.url) << "\n" );
vector<Rcl::Doc> docs(1, doc);
updateIdxForDocs(docs);
}
@@ -135,7 +135,7 @@ bool RclMain::containerUpToDate(Rcl::Doc& doc)
*/
void RclMain::startPreview(int docnum, Rcl::Doc doc, int mod)
{
LOGDEB(("startPreview(%d, doc, %d)\n", docnum, mod));
LOGDEB("startPreview(" << (docnum) << ", doc, " << (mod) << ")\n" );
if (!containerUpToDate(doc))
return;
@@ -221,8 +221,7 @@ void RclMain::previewPrevInTab(Preview * w, int sid, int docnum)
// Combined next/prev from result list in current preview tab
void RclMain::previewPrevOrNextInTab(Preview * w, int sid, int docnum, bool nxt)
{
LOGDEB(("RclMain::previewNextInTab sid %d docnum %d, listId %d\n",
sid, docnum, reslist->listId()));
LOGDEB("RclMain::previewNextInTab sid " << (sid) << " docnum " << (docnum) << ", listId " << (reslist->listId()) << "\n" );
if (w == 0) // ??
return;
@@ -256,10 +255,10 @@ void RclMain::previewPrevOrNextInTab(Preview * w, int sid, int docnum, bool nxt)
// displayed result list, tell reslist (to color the paragraph)
void RclMain::previewExposed(Preview *, int sid, int docnum)
{
LOGDEB2(("RclMain::previewExposed: sid %d docnum %d, m_sid %d\n",
sid, docnum, reslist->listId()));
LOGDEB2("RclMain::previewExposed: sid " << (sid) << " docnum " << (docnum) << ", m_sid " << (reslist->listId()) << "\n" );
if (sid != reslist->listId()) {
return;
}
reslist->previewExposed(docnum);
}
+3 -2
View File
@@ -25,7 +25,7 @@
#include <QFileDialog>
#include "rclmain_w.h"
#include "debuglog.h"
#include "log.h"
#include "readfile.h"
#include "xmltosd.h"
#include "searchdata.h"
@@ -88,7 +88,7 @@ void RclMain::saveLastQuery()
string tofile((const char *)s.toLocal8Bit());
LOGDEB(("RclMain::saveLastQuery: XML: [%s]\n", xml.c_str()));
LOGDEB("RclMain::saveLastQuery: XML: [" << (xml) << "]\n" );
string reason;
if (!stringtofile(xml, tofile.c_str(), reason)) {
QMessageBox::warning(this, tr("Write failed"),
@@ -132,3 +132,4 @@ void RclMain::loadSavedQuery()
QMessageBox::warning(this, tr("Load error"),
tr("Could not load saved query"));
}
+8 -15
View File
@@ -24,7 +24,7 @@
#include "qxtconfirmationmessage.h"
#include "debuglog.h"
#include "log.h"
#include "fileudi.h"
#include "execmd.h"
#include "transcode.h"
@@ -47,9 +47,7 @@ void RclMain::viewUrl()
return;
QUrl qurl(m_urltoview);
LOGDEB(("RclMain::viewUrl: Path [%s] fragment [%s]\n",
(const char *)qurl.path().toLocal8Bit(),
(const char *)qurl.fragment().toLocal8Bit()));
LOGDEB("RclMain::viewUrl: Path [" << ((const char *)qurl.path().toLocal8Bit()) << "] fragment [" << ((const char *)qurl.fragment().toLocal8Bit()) << "]\n" );
/* In theory, the url might not be for a file managed by the fs
indexer so that the make_udi() call here would be
@@ -124,7 +122,7 @@ static bool lookForHtmlBrowser(string &exefile)
void RclMain::openWith(Rcl::Doc doc, string cmdspec)
{
LOGDEB(("RclMain::openWith: %s\n", cmdspec.c_str()));
LOGDEB("RclMain::openWith: " << (cmdspec) << "\n" );
// Split the command line
vector<string> lcmd;
@@ -159,11 +157,7 @@ void RclMain::startNativeViewer(Rcl::Doc doc, int pagenum, QString term)
{
string apptag;
doc.getmeta(Rcl::Doc::keyapptg, &apptag);
LOGDEB(("RclMain::startNativeViewer: mtype [%s] apptag [%s] page %d "
"term [%s] url [%s] ipath [%s]\n",
doc.mimetype.c_str(), apptag.c_str(), pagenum,
(const char *)(term.toUtf8()), doc.url.c_str(), doc.ipath.c_str()
));
LOGDEB("RclMain::startNativeViewer: mtype [" << (doc.mimetype) << "] apptag [" << (apptag) << "] page " << (pagenum) << " term [" << ((const char *)(term.toUtf8())) << "] url [" << (doc.url) << "] ipath [" << (doc.ipath) << "]\n" );
// Look for appropriate viewer
string cmdplusattr = theconfig->getMimeViewerDef(doc.mimetype, apptag,
@@ -293,8 +287,7 @@ void RclMain::startNativeViewer(Rcl::Doc doc, int pagenum, QString term)
bool enterHistory = false;
bool istempfile = false;
LOGDEB(("RclMain::startNV: groksipath %d wantsf %d wantsparentf %d\n",
groksipath, wantsfile, wantsparentfile));
LOGDEB("RclMain::startNV: groksipath " << (groksipath) << " wantsf " << (wantsfile) << " wantsparentf " << (wantsparentfile) << "\n" );
// If the command wants a file but this is not a file url, or
// there is an ipath that it won't understand, we need a temp file:
@@ -409,7 +402,7 @@ void RclMain::execViewer(const map<string, string>& subs, bool enterHistory,
for (vector<string>::const_iterator it = _lcmd.begin();
it != _lcmd.end(); it++) {
pcSubst(*it, ncmd, subs);
LOGDEB(("%s->%s\n", it->c_str(), ncmd.c_str()));
LOGDEB("" << *it << "->" << (ncmd) << "\n" );
lcmd.push_back(ncmd);
}
@@ -457,8 +450,7 @@ void RclMain::startManual(const string& index)
webhelp = path_cat(webhelp, "index.html");
bool has_wh = path_exists(webhelp);
LOGDEB(("RclMain::startManual: help index is %s\n",
index.empty()?"(null)":index.c_str()));
LOGDEB("RclMain::startManual: help index is " << (index.empty()?"(null)":index) << "\n" );
bool indexempty = index.empty();
#ifdef _WIN32
@@ -481,3 +473,4 @@ void RclMain::startManual(const string& index)
doc.mimetype = "text/html";
startNativeViewer(doc);
}
+6 -5
View File
@@ -19,7 +19,7 @@
#include <QShortcut>
#include <QMessageBox>
#include "debuglog.h"
#include "log.h"
#include "internfile.h"
#include "listdialog.h"
#include "confgui/confguiindex.h"
@@ -171,7 +171,7 @@ void RclMain::execIndexConfig()
}
void RclMain::showIndexConfig(bool modal)
{
LOGDEB(("showIndexConfig()\n"));
LOGDEB("showIndexConfig()\n" );
if (indexConfig == 0) {
indexConfig = new ConfIndexW(0, theconfig);
connect(new QShortcut(quitKeySeq, indexConfig), SIGNAL (activated()),
@@ -205,7 +205,7 @@ void RclMain::showIndexSched(bool modal)
"to update the index"));
return;
#endif
LOGDEB(("showIndexSched()\n"));
LOGDEB("showIndexSched()\n" );
if (indexSched == 0) {
indexSched = new IdxSchedW(this);
connect(new QShortcut(quitKeySeq, indexSched), SIGNAL (activated()),
@@ -246,7 +246,7 @@ void RclMain::execCronTool()
}
void RclMain::showCronTool(bool modal)
{
LOGDEB(("showCronTool()\n"));
LOGDEB("showCronTool()\n" );
if (cronTool == 0) {
cronTool = new CronToolW(0);
connect(new QShortcut(quitKeySeq, cronTool), SIGNAL (activated()),
@@ -273,7 +273,7 @@ void RclMain::execRTITool()
}
void RclMain::showRTITool(bool modal)
{
LOGDEB(("showRTITool()\n"));
LOGDEB("showRTITool()\n" );
if (rtiTool == 0) {
rtiTool = new RTIToolW(0);
connect(new QShortcut(quitKeySeq, rtiTool), SIGNAL (activated()),
@@ -453,3 +453,4 @@ void RclMain::showSnippets(Rcl::Doc doc)
sp, SLOT (close()));
sp->show();
}
+20 -24
View File
@@ -43,7 +43,7 @@
#include <QToolBar>
#include "recoll.h"
#include "debuglog.h"
#include "log.h"
#include "mimehandler.h"
#include "pathut.h"
#include "smallut.h"
@@ -585,7 +585,7 @@ void RclMain::initDbOpen()
void RclMain::setStemLang(QAction *id)
{
LOGDEB(("RclMain::setStemLang(%p)\n", id));
LOGDEB("RclMain::setStemLang(" << (id) << ")\n" );
// Check that the menu entry is for a stemming language change
// (might also be "show prefs" etc.
bool isLangId = false;
@@ -615,8 +615,7 @@ void RclMain::setStemLang(QAction *id)
lang = id->text();
}
prefs.queryStemLang = lang;
LOGDEB(("RclMain::setStemLang(%d): lang [%s]\n",
id, (const char *)prefs.queryStemLang.toUtf8()));
LOGDEB("RclMain::setStemLang(" << (id) << "): lang [" << ((const char *)prefs.queryStemLang.toUtf8()) << "]\n" );
rwSettings(true);
emit stemLangChanged(lang);
}
@@ -624,7 +623,7 @@ void RclMain::setStemLang(QAction *id)
// Set the checked stemming language item before showing the prefs menu
void RclMain::setStemLang(const QString& lang)
{
LOGDEB(("RclMain::setStemLang(%s)\n", (const char *)lang.toUtf8()));
LOGDEB("RclMain::setStemLang(" << ((const char *)lang.toUtf8()) << ")\n" );
QAction *id;
if (lang == "") {
id = m_idNoStem;
@@ -658,7 +657,7 @@ void RclMain::showTrayMessage(const QString& text)
void RclMain::closeEvent(QCloseEvent *ev)
{
LOGDEB(("RclMain::closeEvent\n"));
LOGDEB("RclMain::closeEvent\n" );
if (prefs.closeToTray && m_trayicon && m_trayicon->isVisible()) {
hide();
ev->ignore();
@@ -669,7 +668,7 @@ void RclMain::closeEvent(QCloseEvent *ev)
void RclMain::fileExit()
{
LOGDEB(("RclMain: fileExit\n"));
LOGDEB("RclMain: fileExit\n" );
// Don't save geometry if we're currently fullscreened
if (!isFullScreen()) {
prefs.mainwidth = width();
@@ -697,10 +696,9 @@ void RclMain::fileExit()
// Start a db query and set the reslist docsource
void RclMain::startSearch(STD_SHARED_PTR<Rcl::SearchData> sdata, bool issimple)
{
LOGDEB(("RclMain::startSearch. Indexing %s Active %d\n",
m_idxproc?"on":"off", m_queryActive));
LOGDEB("RclMain::startSearch. Indexing " << (m_idxproc?"on":"off") << " Active " << (m_queryActive) << "\n" );
if (m_queryActive) {
LOGDEB(("startSearch: already active\n"));
LOGDEB("startSearch: already active\n" );
return;
}
m_queryActive = true;
@@ -749,18 +747,15 @@ void RclMain::startSearch(STD_SHARED_PTR<Rcl::SearchData> sdata, bool issimple)
}
class QueryThread : public QThread {
int loglevel;
STD_SHARED_PTR<DocSequence> m_source;
public:
QueryThread(STD_SHARED_PTR<DocSequence> source)
: m_source(source)
{
loglevel = DebugLog::getdbl()->getlevel();
}
~QueryThread() { }
virtual void run()
{
DebugLog::getdbl()->setloglevel(loglevel);
cnt = m_source->getResCnt();
}
int cnt;
@@ -830,7 +825,7 @@ void RclMain::onSortCtlChanged()
if (m_sortspecnochange)
return;
LOGDEB(("RclMain::onSortCtlChanged()\n"));
LOGDEB("RclMain::onSortCtlChanged()\n" );
m_sortspec.reset();
if (actionSortByDateAsc->isChecked()) {
m_sortspec.field = "mtime";
@@ -856,7 +851,7 @@ void RclMain::onSortCtlChanged()
void RclMain::onSortDataChanged(DocSeqSortSpec spec)
{
LOGDEB(("RclMain::onSortDataChanged\n"));
LOGDEB("RclMain::onSortDataChanged\n" );
m_sortspecnochange = true;
if (spec.field.compare("mtime")) {
actionSortByDateDesc->setChecked(false);
@@ -879,7 +874,7 @@ void RclMain::onSortDataChanged(DocSeqSortSpec spec)
void RclMain::on_actionShowResultsAsTable_toggled(bool on)
{
LOGDEB(("RclMain::on_actionShowResultsAsTable_toggled(%d)\n", int(on)));
LOGDEB("RclMain::on_actionShowResultsAsTable_toggled(" << (int(on)) << ")\n" );
prefs.showResultsAsTable = on;
displayingTable = on;
restable->setVisible(on);
@@ -908,7 +903,7 @@ void RclMain::on_actionShowResultsAsTable_toggled(bool on)
void RclMain::on_actionSortByDateAsc_toggled(bool on)
{
LOGDEB(("RclMain::on_actionSortByDateAsc_toggled(%d)\n", int(on)));
LOGDEB("RclMain::on_actionSortByDateAsc_toggled(" << (int(on)) << ")\n" );
if (on) {
if (actionSortByDateDesc->isChecked()) {
actionSortByDateDesc->setChecked(false);
@@ -921,7 +916,7 @@ void RclMain::on_actionSortByDateAsc_toggled(bool on)
void RclMain::on_actionSortByDateDesc_toggled(bool on)
{
LOGDEB(("RclMain::on_actionSortByDateDesc_toggled(%d)\n", int(on)));
LOGDEB("RclMain::on_actionSortByDateDesc_toggled(" << (int(on)) << ")\n" );
if (on) {
if (actionSortByDateAsc->isChecked()) {
actionSortByDateAsc->setChecked(false);
@@ -951,7 +946,7 @@ void RclMain::saveDocToFile(Rcl::Doc doc)
void RclMain::showSubDocs(Rcl::Doc doc)
{
LOGDEB(("RclMain::showSubDocs\n"));
LOGDEB("RclMain::showSubDocs\n" );
string reason;
if (!maybeOpenDb(reason)) {
QMessageBox::critical(0, "Recoll", QString(reason.c_str()));
@@ -980,14 +975,14 @@ void RclMain::showSubDocs(Rcl::Doc doc)
// significant terms, and add them to the simple search entry.
void RclMain::docExpand(Rcl::Doc doc)
{
LOGDEB(("RclMain::docExpand()\n"));
LOGDEB("RclMain::docExpand()\n" );
if (!rcldb)
return;
list<string> terms;
terms = m_source->expand(doc);
if (terms.empty()) {
LOGDEB(("RclMain::docExpand: no terms\n"));
LOGDEB("RclMain::docExpand: no terms\n" );
return;
}
// Do we keep the original query. I think we'd better not.
@@ -1006,7 +1001,7 @@ void RclMain::docExpand(Rcl::Doc doc)
void RclMain::showDocHistory()
{
LOGDEB(("RclMain::showDocHistory\n"));
LOGDEB("RclMain::showDocHistory\n" );
emit searchReset();
m_source = STD_SHARED_PTR<DocSequence>();
curPreview = 0;
@@ -1062,7 +1057,7 @@ void RclMain::setUIPrefs()
{
if (!uiprefs)
return;
LOGDEB(("Recollmain::setUIPrefs\n"));
LOGDEB("Recollmain::setUIPrefs\n" );
reslist->setFont();
sSearch->setPrefs();
enbSynAction->setDisabled(prefs.synFile.isEmpty());
@@ -1100,7 +1095,7 @@ void RclMain::catgFilter(QAction *act)
// User pressed a filter button: set filter params in reslist
void RclMain::catgFilter(int id)
{
LOGDEB(("RclMain::catgFilter: id %d\n", id));
LOGDEB("RclMain::catgFilter: id " << (id) << "\n" );
if (id < 0 || id >= int(m_catgbutvec.size()))
return;
@@ -1173,3 +1168,4 @@ void RclMain::applyStyleSheet()
{
::applyStyleSheet(prefs.qssFile);
}
+3 -3
View File
@@ -20,7 +20,7 @@
#include "rclzg.h"
#include "debuglog.h"
#include "log.h"
#include "pathut.h"
#include <QString>
@@ -78,9 +78,9 @@ void zg_send_event(ZgSendType, const Rcl::Doc& doc)
QtZeitgeist::DataModel::EventList events;
events.push_back(event);
LOGDEB(("zg_send_event, sending for %s %s\n",
doc.mimetype.c_str(), doc.url.c_str()));
LOGDEB("zg_send_event, sending for " << (doc.mimetype) << " " << (doc.url) << "\n" );
zglogger.insertEvents(events);
}
#endif
+1
View File
@@ -6,6 +6,7 @@ DEFINES += BUILDING_RECOLL
@QMAKE_ENABLE_WEBKIT@ QT += webkit
@QMAKE_DISABLE_WEBKIT@ QMAKE_CXXFLAGS += -DRESLIST_TEXTBROWSER -DSNIPPETS_TEXTBROWSER
QMAKE_CXXFLAGS += -std=c++11
@QMAKE_ENABLE_ZEITGEIST@ QT += dbus
@QMAKE_ENABLE_ZEITGEIST@ QMAKE_CXXFLAGS += -DUSE_ZEITGEIST
+44 -54
View File
@@ -38,7 +38,7 @@
//#include <qx11info_x11.h>
#endif
#include "debuglog.h"
#include "log.h"
#include "smallut.h"
#include "recoll.h"
#include "guiutils.h"
@@ -116,7 +116,7 @@ void logdata(const char *data)
// /// QtGuiResListPager methods:
bool QtGuiResListPager::append(const string& data)
{
LOGDEB2(("QtGuiReslistPager::appendString : %s\n", data.c_str()));
LOGDEB2("QtGuiReslistPager::appendString : " << (data) << "\n" );
logdata(data.c_str());
m_reslist->append(QString::fromUtf8(data.c_str()));
return true;
@@ -125,8 +125,7 @@ bool QtGuiResListPager::append(const string& data)
bool QtGuiResListPager::append(const string& data, int docnum,
const Rcl::Doc&)
{
LOGDEB2(("QtGuiReslistPager::appendDoc: blockCount %d, %s\n",
m_reslist->document()->blockCount(), data.c_str()));
LOGDEB2("QtGuiReslistPager::appendDoc: blockCount " << (m_reslist->document()->blockCount()) << ", " << (data) << "\n" );
logdata(data.c_str());
#ifdef RESLIST_TEXTBROWSER
int blkcnt0 = m_reslist->document()->blockCount();
@@ -208,7 +207,7 @@ void QtGuiResListPager::suggest(const vector<string>uterms,
if (noaspell)
return;
if (!aspell) {
LOGERR(("QtGuiResListPager:: aspell not initialized\n"));
LOGERR("QtGuiResListPager:: aspell not initialized\n" );
return;
}
@@ -225,8 +224,7 @@ void QtGuiResListPager::suggest(const vector<string>uterms,
// frequencies and propose something anyway if a possible
// variation is much more common (as google does) ?
if (!aspell->suggest(*rcldb, *uit, asuggs, reason)) {
LOGERR(("QtGuiResListPager::suggest: aspell failed: %s\n",
reason.c_str()));
LOGERR("QtGuiResListPager::suggest: aspell failed: " << (reason) << "\n" );
continue;
}
@@ -261,16 +259,15 @@ string QtGuiResListPager::iconUrl(RclConfig *config, Rcl::Doc& doc)
ConfIndexer::docsToPaths(docs, paths);
if (!paths.empty()) {
string path;
LOGDEB0(("ResList::iconUrl: source path [%s]\n", paths[0].c_str()));
LOGDEB0("ResList::iconUrl: source path [" << (paths[0]) << "]\n" );
if (thumbPathForUrl(cstr_fileu + paths[0], 128, path)) {
LOGDEB0(("ResList::iconUrl: icon path [%s]\n", path.c_str()));
LOGDEB0("ResList::iconUrl: icon path [" << (path) << "]\n" );
return cstr_fileu + path;
} else {
LOGDEB0(("ResList::iconUrl: no icon: path [%s]\n",
path.c_str()));
LOGDEB0("ResList::iconUrl: no icon: path [" << (path) << "]\n" );
}
} else {
LOGDEB(("ResList::iconUrl: docsToPaths failed\n"));
LOGDEB("ResList::iconUrl: docsToPaths failed\n" );
}
}
return ResListPager::iconUrl(config, doc);
@@ -286,7 +283,7 @@ public:
string s1, s2;
stringsToString<vector<string> >(m_hdata->groups[idx], s1);
stringsToString<vector<string> >(m_hdata->ugroups[m_hdata->grpsugidx[idx]], s2);
LOGDEB(("Reslist startmatch: group %s user group %s\n", s1.c_str(), s2.c_str()));
LOGDEB("Reslist startmatch: group " << (s1) << " user group " << (s2) << "\n" );
}
return string("<span class='rclmatch' style='color: ")
@@ -310,7 +307,7 @@ ResList::ResList(QWidget* parent, const char* name)
else
setObjectName(name);
#ifdef RESLIST_TEXTBROWSER
LOGDEB(("Reslist: using QTextBrowser\n"));
LOGDEB("Reslist: using QTextBrowser\n" );
setReadOnly(TRUE);
setUndoRedoEnabled(FALSE);
setOpenLinks(FALSE);
@@ -319,7 +316,7 @@ ResList::ResList(QWidget* parent, const char* name)
connect(this, SIGNAL(anchorClicked(const QUrl &)),
this, SLOT(linkWasClicked(const QUrl &)));
#else
LOGDEB(("Reslist: using QWebView\n"));
LOGDEB("Reslist: using QWebView\n" );
// signals and slots connections
connect(this, SIGNAL(linkClicked(const QUrl &)),
this, SLOT(linkWasClicked(const QUrl &)));
@@ -426,7 +423,7 @@ extern "C" int XFlush(void *);
void ResList::setDocSource(STD_SHARED_PTR<DocSequence> nsource)
{
LOGDEB(("ResList::setDocSource()\n"));
LOGDEB("ResList::setDocSource()\n" );
m_source = STD_SHARED_PTR<DocSequence>(new DocSource(theconfig, nsource));
}
@@ -434,7 +431,7 @@ void ResList::setDocSource(STD_SHARED_PTR<DocSequence> nsource)
// re-read the results.
void ResList::readDocSource()
{
LOGDEB(("ResList::readDocSource()\n"));
LOGDEB("ResList::readDocSource()\n" );
resetView();
if (!m_source)
return;
@@ -449,7 +446,7 @@ void ResList::readDocSource()
void ResList::resetList()
{
LOGDEB(("ResList::resetList()\n"));
LOGDEB("ResList::resetList()\n" );
setDocSource(STD_SHARED_PTR<DocSequence>());
resetView();
}
@@ -513,15 +510,14 @@ int ResList::docnumfromparnum(int block)
// Get range of paragraph numbers which make up the result for document number
pair<int,int> ResList::parnumfromdocnum(int docnum)
{
LOGDEB(("parnumfromdocnum: docnum %d\n", docnum));
LOGDEB("parnumfromdocnum: docnum " << (docnum) << "\n" );
if (m_pager->pageNumber() < 0) {
LOGDEB(("parnumfromdocnum: no page return -1,-1\n"));
LOGDEB("parnumfromdocnum: no page return -1,-1\n" );
return pair<int,int>(-1,-1);
}
int winfirst = pageFirstDocNum();
if (docnum - winfirst < 0) {
LOGDEB(("parnumfromdocnum: docnum %d < winfirst %d return -1,-1\n",
docnum, winfirst));
LOGDEB("parnumfromdocnum: docnum " << (docnum) << " < winfirst " << (winfirst) << " return -1,-1\n" );
return pair<int,int>(-1,-1);
}
docnum -= winfirst;
@@ -535,11 +531,11 @@ pair<int,int> ResList::parnumfromdocnum(int docnum)
m_pageParaToReldocnums.end() && it1->second == docnum) {
last++;
}
LOGDEB(("parnumfromdocnum: return %d,%d\n", first, last));
LOGDEB("parnumfromdocnum: return " << (first) << "," << (last) << "\n" );
return pair<int,int>(first, last);
}
}
LOGDEB(("parnumfromdocnum: not found return -1,-1\n"));
LOGDEB("parnumfromdocnum: not found return -1,-1\n" );
return pair<int,int>(-1,-1);
}
#endif // TEXTBROWSER
@@ -550,8 +546,7 @@ pair<int,int> ResList::parnumfromdocnum(int docnum)
// result in a one-page change.
bool ResList::getDoc(int docnum, Rcl::Doc &doc)
{
LOGDEB(("ResList::getDoc: docnum %d winfirst %d\n", docnum,
pageFirstDocNum()));
LOGDEB("ResList::getDoc: docnum " << (docnum) << " winfirst " << (pageFirstDocNum()) << "\n" );
int winfirst = pageFirstDocNum();
int winlast = m_pager->pageLastDocNum();
if (docnum < 0 || winfirst < 0 || winlast < 0)
@@ -641,8 +636,7 @@ void ResList::resPageDownOrNext()
#ifdef RESLIST_TEXTBROWSER
int vpos = verticalScrollBar()->value();
verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepAdd);
LOGDEB(("ResList::resPageDownOrNext: vpos before %d, after %d\n",
vpos, verticalScrollBar()->value()));
LOGDEB("ResList::resPageDownOrNext: vpos before " << (vpos) << ", after " << (verticalScrollBar()->value()) << "\n" );
if (vpos == verticalScrollBar()->value())
resultPageNext();
#else
@@ -675,9 +669,9 @@ bool ResList::scrollIsAtBottom()
int max = frame->scrollBarMaximum(Qt::Vertical);
int cur = frame->scrollBarValue(Qt::Vertical);
ret = (max != 0) && (cur == max);
LOGDEB2(("Scrollatbottom: cur %d max %d\n", cur, max));
LOGDEB2("Scrollatbottom: cur " << (cur) << " max " << (max) << "\n" );
}
LOGDEB2(("scrollIsAtBottom: returning %d\n", ret));
LOGDEB2("scrollIsAtBottom: returning " << (ret) << "\n" );
return ret;
#endif
}
@@ -694,10 +688,10 @@ bool ResList::scrollIsAtTop()
} else {
int cur = frame->scrollBarValue(Qt::Vertical);
int min = frame->scrollBarMinimum(Qt::Vertical);
LOGDEB(("Scrollattop: cur %d min %d\n", cur, min));
LOGDEB("Scrollattop: cur " << (cur) << " min " << (min) << "\n" );
ret = (cur == min);
}
LOGDEB2(("scrollIsAtTop: returning %d\n", ret));
LOGDEB2("scrollIsAtTop: returning " << (ret) << "\n" );
return ret;
#endif
}
@@ -738,8 +732,7 @@ void ResList::resultPageFor(int docnum)
void ResList::append(const QString &text)
{
LOGDEB2(("QtGuiReslistPager::appendQString : %s\n",
(const char*)text.toUtf8()));
LOGDEB2("QtGuiReslistPager::appendQString : " << ((const char*)text.toUtf8()) << "\n" );
#ifdef RESLIST_TEXTBROWSER
QTextBrowser::append(text);
#else
@@ -757,9 +750,7 @@ void ResList::displayPage()
setHtml(m_text);
#endif
LOGDEB0(("ResList::displayPg: hasNext %d atBot %d hasPrev %d at Top %d \n",
m_pager->hasPrev(), scrollIsAtBottom(),
m_pager->hasNext(), scrollIsAtTop()));
LOGDEB0("ResList::displayPg: hasNext " << (m_pager->hasPrev()) << " atBot " << (scrollIsAtBottom()) << " hasPrev " << (m_pager->hasNext()) << " at Top " << (scrollIsAtTop()) << " \n" );
setupArrows();
// Possibly color paragraph of current preview if any
@@ -769,7 +760,7 @@ void ResList::displayPage()
// Color paragraph (if any) of currently visible preview
void ResList::previewExposed(int docnum)
{
LOGDEB(("ResList::previewExposed: doc %d\n", docnum));
LOGDEB("ResList::previewExposed: doc " << (docnum) << "\n" );
// Possibly erase old one to white
if (m_curPvDoc != -1) {
@@ -788,14 +779,13 @@ void ResList::previewExposed(int docnum)
#else
QString sel =
QString("div[rcldocnum=\"%1\"]").arg(m_curPvDoc - pageFirstDocNum());
LOGDEB2(("Searching for element, selector: [%s]\n",
qs2utf8s(sel).c_str()));
LOGDEB2("Searching for element, selector: [" << (qs2utf8s(sel)) << "]\n" );
QWebElement elt = page()->mainFrame()->findFirstElement(sel);
if (!elt.isNull()) {
LOGDEB2(("Found\n"));
LOGDEB2("Found\n" );
elt.removeAttribute("style");
} else {
LOGDEB2(("Not Found\n"));
LOGDEB2("Not Found\n" );
}
#endif
m_curPvDoc = -1;
@@ -825,14 +815,13 @@ void ResList::previewExposed(int docnum)
#else
QString sel =
QString("div[rcldocnum=\"%1\"]").arg(docnum - pageFirstDocNum());
LOGDEB2(("Searching for element, selector: [%s]\n",
qs2utf8s(sel).c_str()));
LOGDEB2("Searching for element, selector: [" << (qs2utf8s(sel)) << "]\n" );
QWebElement elt = page()->mainFrame()->findFirstElement(sel);
if (!elt.isNull()) {
LOGDEB2(("Found\n"));
LOGDEB2("Found\n" );
elt.setAttribute("style", "background: LightBlue;}");
} else {
LOGDEB2(("Not Found\n"));
LOGDEB2("Not Found\n" );
}
#endif
}
@@ -864,7 +853,7 @@ void ResList::showQueryDetails()
void ResList::linkWasClicked(const QUrl &url)
{
string ascurl = qs2utf8s(url.toString());
LOGDEB(("ResList::linkWasClicked: [%s]\n", ascurl.c_str()));
LOGDEB("ResList::linkWasClicked: [" << (ascurl) << "]\n" );
int what = ascurl[0];
switch (what) {
@@ -877,7 +866,7 @@ void ResList::linkWasClicked(const QUrl &url)
int i = atoi(ascurl.c_str()+1) - 1;
Rcl::Doc doc;
if (!getDoc(i, doc)) {
LOGERR(("ResList::linkWasClicked: can't get doc for %d\n", i));
LOGERR("ResList::linkWasClicked: can't get doc for " << (i) << "\n" );
return;
}
emit(showSnippets(doc));
@@ -892,7 +881,7 @@ void ResList::linkWasClicked(const QUrl &url)
int i = atoi(ascurl.c_str()+1) - 1;
Rcl::Doc doc;
if (!getDoc(i, doc)) {
LOGERR(("ResList::linkWasClicked: can't get doc for %d\n", i));
LOGERR("ResList::linkWasClicked: can't get doc for " << (i) << "\n" );
return;
}
vector<Rcl::Doc> dups;
@@ -908,7 +897,7 @@ void ResList::linkWasClicked(const QUrl &url)
int i = atoi(ascurl.c_str()+1) - 1;
Rcl::Doc doc;
if (!getDoc(i, doc)) {
LOGERR(("ResList::linkWasClicked: can't get doc for %d\n", i));
LOGERR("ResList::linkWasClicked: can't get doc for " << (i) << "\n" );
return;
}
emit editRequested(ResultPopup::getParent(STD_SHARED_PTR<DocSequence>(),
@@ -930,7 +919,7 @@ void ResList::linkWasClicked(const QUrl &url)
int i = atoi(ascurl.c_str()+1) - 1;
Rcl::Doc doc;
if (!getDoc(i, doc)) {
LOGERR(("ResList::linkWasClicked: can't get doc for %d\n", i));
LOGERR("ResList::linkWasClicked: can't get doc for " << (i) << "\n" );
return;
}
if (what == 'P') {
@@ -990,18 +979,18 @@ void ResList::linkWasClicked(const QUrl &url)
break;
default:
LOGERR(("ResList::linkWasClicked: bad link [%s]\n", ascurl.c_str()));
LOGERR("ResList::linkWasClicked: bad link [" << (ascurl) << "]\n" );
break;// ??
}
}
void ResList::createPopupMenu(const QPoint& pos)
{
LOGDEB(("ResList::createPopupMenu(%d, %d)\n", pos.x(), pos.y()));
LOGDEB("ResList::createPopupMenu(" << (pos.x()) << ", " << (pos.y()) << ")\n" );
#ifdef RESLIST_TEXTBROWSER
QTextCursor cursor = cursorForPosition(pos);
int blocknum = cursor.blockNumber();
LOGDEB(("ResList::createPopupMenu(): block %d\n", blocknum));
LOGDEB("ResList::createPopupMenu(): block " << (blocknum) << "\n" );
m_popDoc = docnumfromparnum(blocknum);
#else
QWebHitTestResult htr = page()->mainFrame()->hitTestContent(pos);
@@ -1122,3 +1111,4 @@ int ResList::pageFirstDocNum()
{
return m_pager->pageFirstDocNum();
}
+4 -5
View File
@@ -20,7 +20,7 @@
#include <qmenu.h>
#include <qclipboard.h>
#include "debuglog.h"
#include "log.h"
#include "smallut.h"
#include "recoll.h"
#include "docseq.h"
@@ -33,10 +33,8 @@ QMenu *create(QWidget *me, int opts, STD_SHARED_PTR<DocSequence> source, Rcl::Do
{
QMenu *popup = new QMenu(me);
LOGDEB(("ResultPopup::create: opts %x haspages %d %s %s\n", opts,
doc.haspages, source ? "Source not null" : "Source is Null",
source ? (source->snippetsCapable() ?
"snippetsCapable" : "not snippetsCapable") : ""));
LOGDEB("ResultPopup::create: opts " << (opts) << " haspages " << (doc.haspages) << " " << (source ? "Source not null" : "Source is Null") << " " << (source ? (source->snippetsCapable() ?
"snippetsCapable" : "not snippetsCapable") : "") << "\n" );
string apptag;
doc.getmeta(Rcl::Doc::keyapptg, &apptag);
@@ -175,3 +173,4 @@ void copyURL(const Rcl::Doc &doc)
}
}
+27 -32
View File
@@ -37,7 +37,7 @@
#include "recoll.h"
#include MEMORY_INCLUDE
#include "docseq.h"
#include "debuglog.h"
#include "log.h"
#include "restable.h"
#include "guiutils.h"
#include "reslistpager.h"
@@ -271,7 +271,7 @@ RecollModel::RecollModel(const QStringList fields, QObject *parent)
int RecollModel::rowCount(const QModelIndex&) const
{
LOGDEB2(("RecollModel::rowCount\n"));
LOGDEB2("RecollModel::rowCount\n" );
if (!m_source)
return 0;
return m_source->getResCnt();
@@ -279,20 +279,20 @@ int RecollModel::rowCount(const QModelIndex&) const
int RecollModel::columnCount(const QModelIndex&) const
{
LOGDEB2(("RecollModel::columnCount\n"));
LOGDEB2("RecollModel::columnCount\n" );
return m_fields.size();
}
void RecollModel::readDocSource()
{
LOGDEB(("RecollModel::readDocSource()\n"));
LOGDEB("RecollModel::readDocSource()\n" );
beginResetModel();
endResetModel();
}
void RecollModel::setDocSource(STD_SHARED_PTR<DocSequence> nsource)
{
LOGDEB(("RecollModel::setDocSource\n"));
LOGDEB("RecollModel::setDocSource\n" );
if (!nsource) {
m_source = STD_SHARED_PTR<DocSequence>();
} else {
@@ -317,7 +317,7 @@ void RecollModel::deleteColumn(int col)
void RecollModel::addColumn(int col, const string& field)
{
LOGDEB(("AddColumn: col %d fld [%s]\n", col, field.c_str()));
LOGDEB("AddColumn: col " << (col) << " fld [" << (field) << "]\n" );
if (col >= 0 && col < int(m_fields.size())) {
col++;
vector<string>::iterator it = m_fields.begin();
@@ -335,8 +335,7 @@ void RecollModel::addColumn(int col, const string& field)
QVariant RecollModel::headerData(int idx, Qt::Orientation orientation,
int role) const
{
LOGDEB2(("RecollModel::headerData: idx %d orientation %s role %d\n",
idx, orientation == Qt::Vertical ? "vertical":"horizontal", role));
LOGDEB2("RecollModel::headerData: idx " << (idx) << " orientation " << (orientation == Qt::Vertical ? "vertical":"horizontal") << " role " << (role) << "\n" );
if (orientation == Qt::Vertical && role == Qt::DisplayRole) {
return idx;
}
@@ -354,8 +353,7 @@ QVariant RecollModel::headerData(int idx, Qt::Orientation orientation,
QVariant RecollModel::data(const QModelIndex& index, int role) const
{
LOGDEB2(("RecollModel::data: row %d col %d role %d\n", index.row(),
index.column(), role));
LOGDEB2("RecollModel::data: row " << (index.row()) << " col " << (index.column()) << " role " << (role) << "\n" );
if (!m_source || role != Qt::DisplayRole || !index.isValid() ||
index.column() >= int(m_fields.size())) {
return QVariant();
@@ -410,7 +408,7 @@ void RecollModel::sort(int column, Qt::SortOrder order)
{
if (m_ignoreSort)
return;
LOGDEB(("RecollModel::sort(%d, %d)\n", column, int(order)));
LOGDEB("RecollModel::sort(" << (column) << ", " << (int(order)) << ")\n" );
DocSeqSortSpec spec;
if (column >= 0 && column < int(m_fields.size())) {
@@ -592,7 +590,7 @@ int ResTable::getDetailDocNumOrTopRow()
void ResTable::makeRowVisible(int row)
{
LOGDEB(("ResTable::showRow(%d)\n", row));
LOGDEB("ResTable::showRow(" << (row) << ")\n" );
QModelIndex modelIndex = m_model->index(row, 0);
tableView->scrollTo(modelIndex, QAbstractItemView::PositionAtTop);
tableView->selectionModel()->clear();
@@ -611,7 +609,7 @@ void ResTable::saveColState()
QHeaderView *header = tableView->horizontalHeader();
const vector<string>& vf = m_model->getFields();
if (!header) {
LOGERR(("ResTable::saveColState: no table header ??\n"));
LOGERR("ResTable::saveColState: no table header ??\n" );
return;
}
@@ -622,7 +620,7 @@ void ResTable::saveColState()
for (int vi = 0; vi < header->count(); vi++) {
int li = header->logicalIndex(vi);
if (li < 0 || li >= int(vf.size())) {
LOGERR(("saveColState: logical index beyond list size!\n"));
LOGERR("saveColState: logical index beyond list size!\n" );
continue;
}
newfields.push_back(QString::fromUtf8(vf[li].c_str()));
@@ -634,8 +632,7 @@ void ResTable::saveColState()
void ResTable::onTableView_currentChanged(const QModelIndex& index)
{
LOGDEB2(("ResTable::onTableView_currentChanged(%d, %d)\n",
index.row(), index.column()));
LOGDEB2("ResTable::onTableView_currentChanged(" << (index.row()) << ", " << (index.column()) << ")\n" );
if (!m_model || !m_model->getDocSource())
return;
@@ -653,21 +650,20 @@ void ResTable::onTableView_currentChanged(const QModelIndex& index)
void ResTable::on_tableView_entered(const QModelIndex& index)
{
LOGDEB2(("ResTable::on_tableView_entered(%d, %d)\n",
index.row(), index.column()));
LOGDEB2("ResTable::on_tableView_entered(" << (index.row()) << ", " << (index.column()) << ")\n" );
if (!tableView->selectionModel()->hasSelection())
onTableView_currentChanged(index);
}
void ResTable::takeFocus()
{
// LOGDEB(("resTable: take focus\n"));
// LOGDEB("resTable: take focus\n" );
tableView->setFocus(Qt::ShortcutFocusReason);
}
void ResTable::setDocSource(STD_SHARED_PTR<DocSequence> nsource)
{
LOGDEB(("ResTable::setDocSource\n"));
LOGDEB("ResTable::setDocSource\n" );
if (m_model)
m_model->setDocSource(nsource);
if (m_pager)
@@ -679,13 +675,13 @@ void ResTable::setDocSource(STD_SHARED_PTR<DocSequence> nsource)
void ResTable::resetSource()
{
LOGDEB(("ResTable::resetSource\n"));
LOGDEB("ResTable::resetSource\n" );
setDocSource(STD_SHARED_PTR<DocSequence>());
}
void ResTable::saveAsCSV()
{
LOGDEB(("ResTable::saveAsCSV\n"));
LOGDEB("ResTable::saveAsCSV\n" );
if (!m_model)
return;
QString s =
@@ -709,8 +705,7 @@ void ResTable::saveAsCSV()
// This is called when the sort order is changed from another widget
void ResTable::onSortDataChanged(DocSeqSortSpec spec)
{
LOGDEB(("ResTable::onSortDataChanged: [%s] desc %d\n",
spec.field.c_str(), int(spec.desc)));
LOGDEB("ResTable::onSortDataChanged: [" << (spec.field) << "] desc " << (int(spec.desc)) << "\n" );
QHeaderView *header = tableView->horizontalHeader();
if (!header || !m_model)
return;
@@ -734,7 +729,7 @@ void ResTable::onSortDataChanged(DocSeqSortSpec spec)
void ResTable::resetSort()
{
LOGDEB(("ResTable::resetSort()\n"));
LOGDEB("ResTable::resetSort()\n" );
QHeaderView *header = tableView->horizontalHeader();
if (header)
header->setSortIndicator(-1, Qt::AscendingOrder);
@@ -745,7 +740,7 @@ void ResTable::resetSort()
void ResTable::readDocSource(bool resetPos)
{
LOGDEB(("ResTable::readDocSource(%d)\n", int(resetPos)));
LOGDEB("ResTable::readDocSource(" << (int(resetPos)) << ")\n" );
if (resetPos)
tableView->verticalScrollBar()->setSliderPosition(0);
@@ -761,7 +756,7 @@ void ResTable::linkWasClicked(const QUrl &url)
}
QString s = url.toString();
const char *ascurl = s.toUtf8();
LOGDEB(("ResTable::linkWasClicked: [%s]\n", ascurl));
LOGDEB("ResTable::linkWasClicked: [" << (ascurl) << "]\n" );
int i = atoi(ascurl+1) -1;
int what = ascurl[0];
@@ -821,7 +816,7 @@ void ResTable::linkWasClicked(const QUrl &url)
break;
default:
LOGERR(("ResTable::linkWasClicked: bad link [%s]\n", ascurl));
LOGERR("ResTable::linkWasClicked: bad link [" << (ascurl) << "]\n" );
break;// ??
}
}
@@ -844,7 +839,7 @@ void ResTable::onDoubleClick(const QModelIndex& index)
void ResTable::createPopupMenu(const QPoint& pos)
{
LOGDEB(("ResTable::createPopupMenu: m_detaildocnum %d\n", m_detaildocnum));
LOGDEB("ResTable::createPopupMenu: m_detaildocnum " << (m_detaildocnum) << "\n" );
if (m_detaildocnum >= 0 && m_model) {
int opts = m_ismainres? ResultPopup::isMain : 0;
@@ -975,7 +970,7 @@ void ResTable::menuShowSubDocs()
void ResTable::createHeaderPopupMenu(const QPoint& pos)
{
LOGDEB(("ResTable::createHeaderPopupMenu(%d, %d)\n", pos.x(), pos.y()));
LOGDEB("ResTable::createHeaderPopupMenu(" << (pos.x()) << ", " << (pos.y()) << ")\n" );
QHeaderView *header = tableView->horizontalHeader();
if (!header || !m_model)
return;
@@ -1021,7 +1016,7 @@ void ResTable::addColumn()
if (!m_model)
return;
QAction *action = (QAction *)sender();
LOGDEB(("addColumn: text %s, data %s\n", qs2utf8s(action->text()).c_str(),
qs2utf8s(action->data().toString()).c_str()));
LOGDEB("addColumn: text " << (qs2utf8s(action->text())) << ", data " << (qs2utf8s(action->data().toString())) << "\n" );
m_model->addColumn(m_popcolumn, qs2utf8s(action->data().toString()));
}
+4 -4
View File
@@ -17,8 +17,7 @@
#include "autoconfig.h"
#include "recoll.h"
#include "debuglog.h"
#include "log.h"
#include "searchclause_w.h"
#include <qvariant.h>
@@ -142,7 +141,7 @@ SearchDataClause *SearchClauseW::getClause()
void SearchClauseW::setFromClause(SearchDataClauseSimple *cl)
{
LOGDEB(("SearchClauseW::setFromClause\n"));
LOGDEB("SearchClauseW::setFromClause\n" );
switch(cl->getTp()) {
case SCLT_OR: if (cl->getexclude()) tpChange(2); else tpChange(0); break;
case SCLT_AND: tpChange(1); break;
@@ -151,7 +150,7 @@ void SearchClauseW::setFromClause(SearchDataClauseSimple *cl)
case SCLT_FILENAME: tpChange(5); break;
default: return;
}
LOGDEB(("SearchClauseW::setFromClause: calling erase\n"));
LOGDEB("SearchClauseW::setFromClause: calling erase\n" );
clear();
QString text = QString::fromUtf8(cl->gettext().c_str());
@@ -220,3 +219,4 @@ void SearchClauseW::tpChange(int index)
fldCMB->show();
}
}
+5 -4
View File
@@ -32,7 +32,7 @@ using namespace std;
#endif
#include <QShortcut>
#include "debuglog.h"
#include "log.h"
#include "recoll.h"
#include "snippets_w.h"
#include "guiutils.h"
@@ -170,7 +170,7 @@ void SnippetsW::init()
}
list<string> lr;
if (!g_hiliter.plaintorich(it->snippet, lr, hdata)) {
LOGDEB1(("No match for [%s]\n", it->snippet.c_str()));
LOGDEB1("No match for [" << (it->snippet) << "]\n" );
continue;
}
nomatch = false;
@@ -238,7 +238,7 @@ void SnippetsW::slotSearchTextChanged(const QString& txt)
void SnippetsW::linkWasClicked(const QUrl &url)
{
string ascurl = (const char *)url.toString().toUtf8();
LOGDEB(("Snippets::linkWasClicked: [%s]\n", ascurl.c_str()));
LOGDEB("Snippets::linkWasClicked: [" << (ascurl) << "]\n" );
if (ascurl.size() > 3) {
int what = ascurl[0];
@@ -259,6 +259,7 @@ void SnippetsW::linkWasClicked(const QUrl &url)
}
}
}
LOGERR(("Snippets::linkWasClicked: bad link [%s]\n", ascurl.c_str()));
LOGERR("Snippets::linkWasClicked: bad link [" << (ascurl) << "]\n" );
}
+10 -9
View File
@@ -35,7 +35,7 @@
#include <QClipboard>
#include <QKeyEvent>
#include "debuglog.h"
#include "log.h"
#include "recoll.h"
#include "spell_w.h"
#include "guiutils.h"
@@ -147,7 +147,7 @@ void SpellW::doExpand()
string reason;
if (!maybeOpenDb(reason)) {
QMessageBox::critical(0, "Recoll", QString(reason.c_str()));
LOGDEB(("SpellW::doExpand: db error: %s\n", reason.c_str()));
LOGDEB("SpellW::doExpand: db error: " << (reason) << "\n" );
return;
}
@@ -178,7 +178,7 @@ void SpellW::doExpand()
string l_stemlang = qs2utf8s(stemLangCMB->currentText());
if (!rcldb->termMatch(mt, l_stemlang, expr, res, maxexpand)) {
LOGERR(("SpellW::doExpand:rcldb::termMatch failed\n"));
LOGERR("SpellW::doExpand:rcldb::termMatch failed\n" );
return;
}
statsLBL->setText(tr("Index: %1 documents, average length %2 terms."
@@ -192,19 +192,19 @@ void SpellW::doExpand()
#ifdef RCL_USE_ASPELL
case TYPECMB_ASPELL:
{
LOGDEB(("SpellW::doExpand: aspelling\n"));
LOGDEB("SpellW::doExpand: aspelling\n" );
if (!aspell) {
QMessageBox::warning(0, "Recoll",
tr("Aspell init failed. "
"Aspell not installed?"));
LOGDEB(("SpellW::doExpand: aspell init error\n"));
LOGDEB("SpellW::doExpand: aspell init error\n" );
return;
}
list<string> suggs;
if (!aspell->suggest(*rcldb, expr, suggs, reason)) {
QMessageBox::warning(0, "Recoll",
tr("Aspell expansion error. "));
LOGERR(("SpellW::doExpand:suggest failed: %s\n", reason.c_str()));
LOGERR("SpellW::doExpand:suggest failed: " << (reason) << "\n" );
}
for (list<string>::const_iterator it = suggs.begin();
it != suggs.end(); it++)
@@ -253,7 +253,7 @@ void SpellW::doExpand()
for (vector<Rcl::TermMatchEntry>::iterator it = res.entries.begin();
it != res.entries.end(); it++) {
LOGDEB2(("SpellW::expand: %6d [%s]\n", it->wcf, it->term.c_str()));
LOGDEB2("SpellW::expand: " << (it->wcf) << " [" << (it->term) << "]\n" );
char num[30];
if (it->wcf)
sprintf(num, "%d / %d", it->docs, it->wcf);
@@ -275,7 +275,7 @@ void SpellW::showStats()
Rcl::DbStats res;
if (!rcldb->dbStats(res)) {
LOGERR(("SpellW::doExpand:rcldb::dbStats failed\n"));
LOGERR("SpellW::doExpand:rcldb::dbStats failed\n" );
return;
}
@@ -365,7 +365,7 @@ void SpellW::showStats()
STD_SHARED_PTR<Rcl::SearchData> rq(sd);
Rcl::Query query(rcldb);
if (!query.setQuery(rq)) {
LOGERR(("Query setup failed: %s",query.getReason().c_str()));
LOGERR("Query setup failed: " << (query.getReason()) << "" );
return;
}
int cnt = query.getResCnt();
@@ -521,3 +521,4 @@ bool SpellW::eventFilter(QObject *target, QEvent *event)
}
return false;
}
+21 -27
View File
@@ -33,7 +33,7 @@
#include <QTimer>
#include <QCompleter>
#include "debuglog.h"
#include "log.h"
#include "guiutils.h"
#include "searchdata.h"
#include "ssearch_w.h"
@@ -95,7 +95,7 @@ void SSearch::init()
void SSearch::takeFocus()
{
LOGDEB2(("SSearch: take focus\n"));
LOGDEB2("SSearch: take focus\n" );
queryText->setFocus(Qt::ShortcutFocusReason);
// If the focus was already in the search entry, the text is not selected.
// Do it for consistency
@@ -105,15 +105,14 @@ void SSearch::takeFocus()
void SSearch::timerDone()
{
QString qs = queryText->currentText();
LOGDEB1(("SSearch::timerDone: qs [%s]\n", qs2utf8s(qs).c_str()));
LOGDEB1("SSearch::timerDone: qs [" << (qs2utf8s(qs)) << "]\n" );
searchTextChanged(qs);
}
void SSearch::searchTextChanged(const QString& text)
{
QString qs = queryText->currentText();
LOGDEB1(("SSearch::searchTextChanged. ks %d qs [%s]\n",
m_keystroke, qs2utf8s(text).c_str()));
LOGDEB1("SSearch::searchTextChanged. ks " << (m_keystroke) << " qs [" << (qs2utf8s(text)) << "]\n" );
if (text.isEmpty()) {
searchPB->setEnabled(false);
clearqPB->setEnabled(false);
@@ -130,8 +129,7 @@ void SSearch::searchTextChanged(const QString& text)
m_disableAutosearch = true;
string s;
int cs = partialWord(s);
LOGDEB1(("SSearch::searchTextChanged: autosearch. cs %d s [%s]\n",
cs, s.c_str()));
LOGDEB1("SSearch::searchTextChanged: autosearch. cs " << (cs) << " s [" << (s) << "]\n" );
if (cs < 0) {
startSimpleSearch();
} else if (!m_stroketimeout->isActive() && s.size() >= 2) {
@@ -146,7 +144,7 @@ void SSearch::searchTextChanged(const QString& text)
void SSearch::searchTypeChanged(int typ)
{
LOGDEB(("Search type now %d\n", typ));
LOGDEB("Search type now " << (typ) << "\n" );
// Adjust context help
if (typ == SST_LANG)
HelpClient::installMap((const char *)this->objectName().toUtf8(),
@@ -188,7 +186,7 @@ void SSearch::searchTypeChanged(int typ)
void SSearch::startSimpleSearch()
{
QString qs = queryText->currentText();
LOGDEB(("SSearch::startSimpleSearch(): qs [%s]\n", qs2utf8s(qs).c_str()));
LOGDEB("SSearch::startSimpleSearch(): qs [" << (qs2utf8s(qs)) << "]\n" );
if (qs.length() == 0)
return;
@@ -201,7 +199,7 @@ void SSearch::startSimpleSearch()
if (!startSimpleSearch(u8))
return;
LOGDEB(("startSimpleSearch: updating history\n"));
LOGDEB("startSimpleSearch: updating history\n" );
// Search terms history:
// We want to have the new text at the top and any older identical
// entry to be erased. There is no standard qt policy to do this ?
@@ -242,7 +240,7 @@ string SSearch::asXML()
bool SSearch::startSimpleSearch(const string& u8, int maxexp)
{
LOGDEB(("SSearch::startSimpleSearch(%s)\n", u8.c_str()));
LOGDEB("SSearch::startSimpleSearch(" << (u8) << ")\n" );
string stemlang = prefs.stemlang();
ostringstream xml;
@@ -309,7 +307,7 @@ bool SSearch::startSimpleSearch(const string& u8, int maxexp)
xml << "</SD>\n";
m_xml = xml.str();
LOGDEB(("SSearch::startSimpleSearch:xml:[%s]\n", m_xml.c_str()));
LOGDEB("SSearch::startSimpleSearch:xml:[" << (m_xml) << "]\n" );
STD_SHARED_PTR<Rcl::SearchData> rsdata(sdata);
emit startSearch(rsdata, true);
@@ -392,7 +390,7 @@ bool SSearch::hasSearchString()
static const char* punct = " \t()<>\"'[]{}!^*.,:;\n\r";
void SSearch::addTerm(QString term)
{
LOGDEB(("SSearch::AddTerm: [%s]\n", (const char *)term.toUtf8()));
LOGDEB("SSearch::AddTerm: [" << ((const char *)term.toUtf8()) << "]\n" );
string t = (const char *)term.toUtf8();
string::size_type pos = t.find_last_not_of(punct);
if (pos == string::npos)
@@ -414,8 +412,7 @@ void SSearch::addTerm(QString term)
void SSearch::onWordReplace(const QString& o, const QString& n)
{
LOGDEB(("SSearch::onWordReplace: o [%s] n [%s]\n",
qs2utf8s(o).c_str(), qs2utf8s(n).c_str()));
LOGDEB("SSearch::onWordReplace: o [" << (qs2utf8s(o)) << "] n [" << (qs2utf8s(n)) << "]\n" );
QString txt = queryText->currentText();
QRegExp exp = QRegExp(QString("\\b") + o + QString("\\b"));
exp.setCaseSensitivity(Qt::CaseInsensitive);
@@ -476,7 +473,7 @@ int SSearch::completionList(string s, QStringList& lst, int max)
// Complete last word in input by querying db for all possible terms.
void SSearch::completion()
{
LOGDEB(("SSearch::completion\n"));
LOGDEB("SSearch::completion\n" );
m_disableAutosearch = true;
m_stroketimeout->stop();
@@ -506,7 +503,7 @@ void SSearch::completion()
return;
}
if (lst.size() >= maxdpy) {
LOGDEB0(("SSearch::completion(): truncating list\n"));
LOGDEB0("SSearch::completion(): truncating list\n" );
lst = lst.mid(0, maxdpy);
lst.append("[...]");
}
@@ -542,7 +539,7 @@ void SSearch::completionTermChosen(const QString& text)
void SSearch::wrapupCompletion()
{
LOGDEB(("SSearch::wrapupCompletion\n"));
LOGDEB("SSearch::wrapupCompletion\n" );
queryText->clear();
queryText->addItems(prefs.ssearchHistory);
@@ -707,9 +704,7 @@ bool SSearch::eventFilter(QObject *target, QEvent *event)
event->type() == QEvent::UpdateRequest ||
event->type() == QEvent::Paint)
return false;
LOGDEB2(("SSearch::eventFilter: target %p (%p) type %s\n",
target, queryText->lineEdit(),
eventTypeToStr(event->type())));
LOGDEB2("SSearch::eventFilter: target " << (target) << " (" << (queryText->lineEdit()) << ") type " << (eventTypeToStr(event->type())) << "\n" );
#endif
if (target == queryText->view()) {
@@ -725,16 +720,15 @@ bool SSearch::eventFilter(QObject *target, QEvent *event)
if (event->type() == QEvent::KeyPress) {
QKeyEvent *ke = (QKeyEvent *)event;
LOGDEB1(("SSearch::eventFilter: keyPress (m_escape %d) key %d\n",
m_escape, ke->key()));
LOGDEB1("SSearch::eventFilter: keyPress (m_escape " << (m_escape) << ") key " << (ke->key()) << "\n" );
if (ke->key() == Qt::Key_Escape) {
LOGDEB(("Escape\n"));
LOGDEB("Escape\n" );
m_escape = true;
m_disableAutosearch = true;
m_stroketimeout->stop();
return true;
} else if (m_escape && ke->key() == Qt::Key_Space) {
LOGDEB(("Escape space\n"));
LOGDEB("Escape space\n" );
ke->accept();
completion();
m_escape = false;
@@ -750,11 +744,11 @@ bool SSearch::eventFilter(QObject *target, QEvent *event)
if (prefs.ssearchAsYouType) {
m_disableAutosearch = false;
QString qs = queryText->currentText();
LOGDEB0(("SSearch::eventFilter: start timer, qs [%s]\n",
qs2utf8s(qs).c_str()));
LOGDEB0("SSearch::eventFilter: start timer, qs [" << (qs2utf8s(qs)) << "]\n" );
m_stroketimeout->start(strokeTimeoutMS);
}
}
}
return false;
}
+3 -2
View File
@@ -49,7 +49,7 @@
#include "pathut.h"
#include "uiprefs_w.h"
#include "viewaction_w.h"
#include "debuglog.h"
#include "log.h"
#include "editdialog.h"
#include "rclmain_w.h"
#include "ptrans_w.h"
@@ -606,7 +606,7 @@ void UIPrefsDialog::addExtraDbPB_clicked()
}
}
LOGDEB(("ExtraDbDial: got: [%s]\n", dbdir.c_str()));
LOGDEB("ExtraDbDial: got: [" << (dbdir) << "]\n" );
path_catslash(dbdir);
bool stripped;
if (!Rcl::Db::testDbDir(dbdir, &stripped)) {
@@ -642,3 +642,4 @@ void UIPrefsDialog::addExtraDbPB_clicked()
item->setCheckState(Qt::Checked);
idxLV->sortItems();
}
+2 -1
View File
@@ -34,7 +34,7 @@ using namespace std;
#include <qlayout.h>
#include "recoll.h"
#include "debuglog.h"
#include "log.h"
#include "guiutils.h"
#include "viewaction_w.h"
@@ -234,3 +234,4 @@ void ViewAction::editActions()
theconfig->setMimeViewerAllEx(s);
fillLists();
}
+12 -24
View File
@@ -22,7 +22,7 @@
#include "ssearch_w.h"
#include "guiutils.h"
#include "debuglog.h"
#include "log.h"
#include "xmltosd.h"
#include "smallut.h"
#include "recoll.h"
@@ -82,21 +82,13 @@ bool SDHXMLHandler::startElement(const QString & /* namespaceURI */,
const QString &qName,
const QXmlAttributes &attrs)
{
LOGDEB2(("SDHXMLHandler::startElement: name [%s]\n",
(const char *)qName.toUtf8()));
LOGDEB2("SDHXMLHandler::startElement: name [" << ((const char *)qName.toUtf8()) << "]\n" );
if (qName == "SD") {
// Advanced search history entries have no type. So we're good
// either if type is absent, or if it's searchdata
int idx = attrs.index("type");
if (idx >= 0 && attrs.value(idx).compare("searchdata")) {
LOGDEB(("XMLTOSD: bad type\n"))
return false;
}
resetTemps();
// A new search descriptor. Allocate data structure
sd = STD_SHARED_PTR<SearchData>(new SearchData);
if (!sd) {
LOGERR(("SDHXMLHandler::startElement: out of memory\n"));
LOGDEB("XMLTOSD: bad type\n" );
return false;
}
}
@@ -107,8 +99,7 @@ bool SDHXMLHandler::endElement(const QString & /* namespaceURI */,
const QString & /* localName */,
const QString &qName)
{
LOGDEB2(("SDHXMLHandler::endElement: name [%s]\n",
(const char *)qName.toUtf8()));
LOGDEB2("SDHXMLHandler::endElement: name [" << ((const char *)qName.toUtf8()) << "]\n" );
if (qName == "CLT") {
if (currentText == "OR") {
@@ -147,7 +138,7 @@ bool SDHXMLHandler::endElement(const QString & /* namespaceURI */,
c = new SearchDataClauseDist(SCLT_NEAR, text, slack, field);
c->setexclude(exclude);
} else {
LOGERR(("Bad clause type [%s]\n", qs2utf8s(whatclause).c_str()));
LOGERR("Bad clause type [" << (qs2utf8s(whatclause)) << "]\n" );
return false;
}
sd->addClause(c);
@@ -219,8 +210,7 @@ STD_SHARED_PTR<Rcl::SearchData> xmlToSearchData(const string& xml)
xmlInputSource.setData(QString::fromUtf8(xml.c_str()));
if (!reader.parse(xmlInputSource) || !handler.isvalid) {
LOGERR(("xmlToSearchData: parse failed for [%s]\n",
xml.c_str()));
LOGERR("xmlToSearchData: parse failed for [" << (xml) << "]\n" );
return STD_SHARED_PTR<SearchData>();
}
return handler.sd;
@@ -270,13 +260,12 @@ bool SSHXMLHandler::startElement(const QString & /* namespaceURI */,
const QString &qName,
const QXmlAttributes &attrs)
{
LOGDEB2(("SSHXMLHandler::startElement: name [%s]\n",
(const char *)qName.toUtf8()));
LOGDEB2("SSHXMLHandler::startElement: name [" << ((const char *)qName.toUtf8()) << "]\n" );
if (qName == "SD") {
// Simple search saved data has a type='ssearch' attribute.
int idx = attrs.index("type");
if (idx < 0 && attrs.value(idx).compare("ssearch")) {
LOGDEB(("XMLTOSSS: bad type\n"));
LOGDEB("XMLTOSSS: bad type\n" );
return false;
}
resetTemps();
@@ -288,8 +277,7 @@ bool SSHXMLHandler::endElement(const QString & /* namespaceURI */,
const QString & /* localName */,
const QString &qName)
{
LOGDEB2(("SSHXMLHandler::endElement: name [%s]\n",
(const char *)qName.toUtf8()));
LOGDEB2("SSHXMLHandler::endElement: name [" << ((const char *)qName.toUtf8()) << "]\n" );
currentText = currentText.trimmed();
@@ -309,7 +297,7 @@ bool SSHXMLHandler::endElement(const QString & /* namespaceURI */,
} else if (!currentText.compare("AND")) {
data.mode = SSearch::SST_ALL;
} else {
LOGERR(("BAD SEARCH MODE: [%s]\n", qs2utf8s(currentText).c_str()));
LOGERR("BAD SEARCH MODE: [" << (qs2utf8s(currentText)) << "]\n" );
return false;
}
} else if (qName == "AS") {
@@ -336,10 +324,10 @@ bool xmlToSSearch(const string& xml, SSearchDef& data)
xmlInputSource.setData(QString::fromUtf8(xml.c_str()));
if (!reader.parse(xmlInputSource) || !handler.isvalid) {
LOGERR(("xmlToSSearch: parse failed for [%s]\n",
xml.c_str()));
LOGERR("xmlToSSearch: parse failed for [" << (xml) << "]\n" );
return false;
}
data = handler.data;
return true;
}