reslist: fixed LOGXX indentation

This commit is contained in:
Jean-Francois Dockes 2017-12-21 10:01:01 +01:00
parent d88ba87d0e
commit 3779323ef9

View File

@ -113,7 +113,7 @@ void logdata(const char *data)
// /// QtGuiResListPager methods: // /// QtGuiResListPager methods:
bool QtGuiResListPager::append(const string& data) bool QtGuiResListPager::append(const string& data)
{ {
LOGDEB2("QtGuiReslistPager::appendString : " << (data) << "\n" ); LOGDEB2("QtGuiReslistPager::appendString : " << data << "\n");
logdata(data.c_str()); logdata(data.c_str());
m_reslist->append(QString::fromUtf8(data.c_str())); m_reslist->append(QString::fromUtf8(data.c_str()));
return true; return true;
@ -122,7 +122,8 @@ bool QtGuiResListPager::append(const string& data)
bool QtGuiResListPager::append(const string& data, int docnum, bool QtGuiResListPager::append(const string& data, int docnum,
const Rcl::Doc&) const Rcl::Doc&)
{ {
LOGDEB2("QtGuiReslistPager::appendDoc: blockCount " << (m_reslist->document()->blockCount()) << ", " << (data) << "\n" ); LOGDEB2("QtGuiReslistPager::appendDoc: blockCount " <<
m_reslist->document()->blockCount() << ", " << data << "\n");
logdata(data.c_str()); logdata(data.c_str());
#ifdef RESLIST_TEXTBROWSER #ifdef RESLIST_TEXTBROWSER
int blkcnt0 = m_reslist->document()->blockCount(); int blkcnt0 = m_reslist->document()->blockCount();
@ -263,7 +264,7 @@ public:
string s1, s2; string s1, s2;
stringsToString<vector<string> >(m_hdata->groups[idx], s1); stringsToString<vector<string> >(m_hdata->groups[idx], s1);
stringsToString<vector<string> >(m_hdata->ugroups[m_hdata->grpsugidx[idx]], s2); stringsToString<vector<string> >(m_hdata->ugroups[m_hdata->grpsugidx[idx]], s2);
LOGDEB2("Reslist startmatch: group " << s1 << " user group " << LOGDEB2("Reslist startmatch: group " << s1 << " user group " <<
s2 << "\n"); s2 << "\n");
} }
@ -288,7 +289,7 @@ ResList::ResList(QWidget* parent, const char* name)
else else
setObjectName(name); setObjectName(name);
#ifdef RESLIST_TEXTBROWSER #ifdef RESLIST_TEXTBROWSER
LOGDEB("Reslist: using QTextBrowser\n" ); LOGDEB("Reslist: using QTextBrowser\n");
setReadOnly(true); setReadOnly(true);
setUndoRedoEnabled(false); setUndoRedoEnabled(false);
setOpenLinks(false); setOpenLinks(false);
@ -297,7 +298,7 @@ ResList::ResList(QWidget* parent, const char* name)
connect(this, SIGNAL(anchorClicked(const QUrl &)), connect(this, SIGNAL(anchorClicked(const QUrl &)),
this, SLOT(linkWasClicked(const QUrl &))); this, SLOT(linkWasClicked(const QUrl &)));
#else #else
LOGDEB("Reslist: using QWebView\n" ); LOGDEB("Reslist: using QWebView\n");
// signals and slots connections // signals and slots connections
connect(this, SIGNAL(linkClicked(const QUrl &)), connect(this, SIGNAL(linkClicked(const QUrl &)),
this, SLOT(linkWasClicked(const QUrl &))); this, SLOT(linkWasClicked(const QUrl &)));
@ -404,7 +405,7 @@ extern "C" int XFlush(void *);
void ResList::setDocSource(std::shared_ptr<DocSequence> nsource) 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)); m_source = std::shared_ptr<DocSequence>(new DocSource(theconfig, nsource));
} }
@ -412,7 +413,7 @@ void ResList::setDocSource(std::shared_ptr<DocSequence> nsource)
// re-read the results. // re-read the results.
void ResList::readDocSource() void ResList::readDocSource()
{ {
LOGDEB("ResList::readDocSource()\n" ); LOGDEB("ResList::readDocSource()\n");
resetView(); resetView();
if (!m_source) if (!m_source)
return; return;
@ -427,7 +428,7 @@ void ResList::readDocSource()
void ResList::resetList() void ResList::resetList()
{ {
LOGDEB("ResList::resetList()\n" ); LOGDEB("ResList::resetList()\n");
setDocSource(std::shared_ptr<DocSequence>()); setDocSource(std::shared_ptr<DocSequence>());
resetView(); resetView();
} }
@ -491,14 +492,15 @@ int ResList::docnumfromparnum(int block)
// Get range of paragraph numbers which make up the result for document number // Get range of paragraph numbers which make up the result for document number
pair<int,int> ResList::parnumfromdocnum(int docnum) pair<int,int> ResList::parnumfromdocnum(int docnum)
{ {
LOGDEB("parnumfromdocnum: docnum " << (docnum) << "\n" ); LOGDEB("parnumfromdocnum: docnum " << docnum << "\n");
if (m_pager->pageNumber() < 0) { 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); return pair<int,int>(-1,-1);
} }
int winfirst = pageFirstDocNum(); int winfirst = pageFirstDocNum();
if (docnum - winfirst < 0) { if (docnum - winfirst < 0) {
LOGDEB("parnumfromdocnum: docnum " << (docnum) << " < winfirst " << (winfirst) << " return -1,-1\n" ); LOGDEB("parnumfromdocnum: docnum " << docnum << " < winfirst " <<
winfirst << " return -1,-1\n");
return pair<int,int>(-1,-1); return pair<int,int>(-1,-1);
} }
docnum -= winfirst; docnum -= winfirst;
@ -512,11 +514,11 @@ pair<int,int> ResList::parnumfromdocnum(int docnum)
m_pageParaToReldocnums.end() && it1->second == docnum) { m_pageParaToReldocnums.end() && it1->second == docnum) {
last++; last++;
} }
LOGDEB("parnumfromdocnum: return " << (first) << "," << (last) << "\n" ); LOGDEB("parnumfromdocnum: return " << first << "," << last << "\n");
return pair<int,int>(first, last); 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); return pair<int,int>(-1,-1);
} }
#endif // TEXTBROWSER #endif // TEXTBROWSER
@ -527,7 +529,8 @@ pair<int,int> ResList::parnumfromdocnum(int docnum)
// result in a one-page change. // result in a one-page change.
bool ResList::getDoc(int docnum, Rcl::Doc &doc) bool ResList::getDoc(int docnum, Rcl::Doc &doc)
{ {
LOGDEB("ResList::getDoc: docnum " << (docnum) << " winfirst " << (pageFirstDocNum()) << "\n" ); LOGDEB("ResList::getDoc: docnum " << docnum << " winfirst " <<
pageFirstDocNum() << "\n");
int winfirst = pageFirstDocNum(); int winfirst = pageFirstDocNum();
int winlast = m_pager->pageLastDocNum(); int winlast = m_pager->pageLastDocNum();
if (docnum < 0 || winfirst < 0 || winlast < 0) if (docnum < 0 || winfirst < 0 || winlast < 0)
@ -617,7 +620,8 @@ void ResList::resPageDownOrNext()
#ifdef RESLIST_TEXTBROWSER #ifdef RESLIST_TEXTBROWSER
int vpos = verticalScrollBar()->value(); int vpos = verticalScrollBar()->value();
verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepAdd); verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepAdd);
LOGDEB("ResList::resPageDownOrNext: vpos before " << (vpos) << ", after " << (verticalScrollBar()->value()) << "\n" ); LOGDEB("ResList::resPageDownOrNext: vpos before " << vpos << ", after "
<< verticalScrollBar()->value() << "\n");
if (vpos == verticalScrollBar()->value()) if (vpos == verticalScrollBar()->value())
resultPageNext(); resultPageNext();
#else #else
@ -650,9 +654,9 @@ bool ResList::scrollIsAtBottom()
int max = frame->scrollBarMaximum(Qt::Vertical); int max = frame->scrollBarMaximum(Qt::Vertical);
int cur = frame->scrollBarValue(Qt::Vertical); int cur = frame->scrollBarValue(Qt::Vertical);
ret = (max != 0) && (cur == max); ret = (max != 0) && (cur == max);
LOGDEB2("Scrollatbottom: cur " << (cur) << " max " << (max) << "\n" ); LOGDEB2("Scrollatbottom: cur " << cur << " max " << max << "\n");
} }
LOGDEB2("scrollIsAtBottom: returning " << (ret) << "\n" ); LOGDEB2("scrollIsAtBottom: returning " << ret << "\n");
return ret; return ret;
#endif #endif
} }
@ -669,10 +673,10 @@ bool ResList::scrollIsAtTop()
} else { } else {
int cur = frame->scrollBarValue(Qt::Vertical); int cur = frame->scrollBarValue(Qt::Vertical);
int min = frame->scrollBarMinimum(Qt::Vertical); int min = frame->scrollBarMinimum(Qt::Vertical);
LOGDEB("Scrollattop: cur " << (cur) << " min " << (min) << "\n" ); LOGDEB("Scrollattop: cur " << cur << " min " << min << "\n");
ret = (cur == min); ret = (cur == min);
} }
LOGDEB2("scrollIsAtTop: returning " << (ret) << "\n" ); LOGDEB2("scrollIsAtTop: returning " << ret << "\n");
return ret; return ret;
#endif #endif
} }
@ -713,7 +717,7 @@ void ResList::resultPageFor(int docnum)
void ResList::append(const QString &text) void ResList::append(const QString &text)
{ {
LOGDEB2("QtGuiReslistPager::appendQString : " << qs2utf8s(text) << "\n"); LOGDEB2("QtGuiReslistPager::appendQString : " << qs2utf8s(text) << "\n");
#ifdef RESLIST_TEXTBROWSER #ifdef RESLIST_TEXTBROWSER
QTextBrowser::append(text); QTextBrowser::append(text);
#else #else
@ -732,7 +736,7 @@ void ResList::displayPage()
#endif #endif
LOGDEB0("ResList::displayPg: hasNext " << m_pager->hasNext() << LOGDEB0("ResList::displayPg: hasNext " << m_pager->hasNext() <<
" atBot " << scrollIsAtBottom() << " hasPrev " << " atBot " << scrollIsAtBottom() << " hasPrev " <<
m_pager->hasPrev() << " at Top " << scrollIsAtTop() << " \n"); m_pager->hasPrev() << " at Top " << scrollIsAtTop() << " \n");
setupArrows(); setupArrows();
@ -743,7 +747,7 @@ void ResList::displayPage()
// Color paragraph (if any) of currently visible preview // Color paragraph (if any) of currently visible preview
void ResList::previewExposed(int docnum) void ResList::previewExposed(int docnum)
{ {
LOGDEB("ResList::previewExposed: doc " << (docnum) << "\n" ); LOGDEB("ResList::previewExposed: doc " << docnum << "\n");
// Possibly erase old one to white // Possibly erase old one to white
if (m_curPvDoc != -1) { if (m_curPvDoc != -1) {
@ -762,13 +766,13 @@ void ResList::previewExposed(int docnum)
#else #else
QString sel = QString sel =
QString("div[rcldocnum=\"%1\"]").arg(m_curPvDoc - pageFirstDocNum()); QString("div[rcldocnum=\"%1\"]").arg(m_curPvDoc - pageFirstDocNum());
LOGDEB2("Searching for element, selector: [" << (qs2utf8s(sel)) << "]\n" ); LOGDEB2("Searching for element, selector: [" << qs2utf8s(sel) << "]\n");
QWebElement elt = page()->mainFrame()->findFirstElement(sel); QWebElement elt = page()->mainFrame()->findFirstElement(sel);
if (!elt.isNull()) { if (!elt.isNull()) {
LOGDEB2("Found\n" ); LOGDEB2("Found\n");
elt.removeAttribute("style"); elt.removeAttribute("style");
} else { } else {
LOGDEB2("Not Found\n" ); LOGDEB2("Not Found\n");
} }
#endif #endif
m_curPvDoc = -1; m_curPvDoc = -1;
@ -798,13 +802,13 @@ void ResList::previewExposed(int docnum)
#else #else
QString sel = QString sel =
QString("div[rcldocnum=\"%1\"]").arg(docnum - pageFirstDocNum()); QString("div[rcldocnum=\"%1\"]").arg(docnum - pageFirstDocNum());
LOGDEB2("Searching for element, selector: [" << (qs2utf8s(sel)) << "]\n" ); LOGDEB2("Searching for element, selector: [" << qs2utf8s(sel) << "]\n");
QWebElement elt = page()->mainFrame()->findFirstElement(sel); QWebElement elt = page()->mainFrame()->findFirstElement(sel);
if (!elt.isNull()) { if (!elt.isNull()) {
LOGDEB2("Found\n" ); LOGDEB2("Found\n");
elt.setAttribute("style", "background: LightBlue;}"); elt.setAttribute("style", "background: LightBlue;}");
} else { } else {
LOGDEB2("Not Found\n" ); LOGDEB2("Not Found\n");
} }
#endif #endif
} }
@ -836,7 +840,7 @@ void ResList::showQueryDetails()
void ResList::linkWasClicked(const QUrl &url) void ResList::linkWasClicked(const QUrl &url)
{ {
string ascurl = qs2utf8s(url.toString()); string ascurl = qs2utf8s(url.toString());
LOGDEB("ResList::linkWasClicked: [" << (ascurl) << "]\n" ); LOGDEB("ResList::linkWasClicked: [" << ascurl << "]\n");
int what = ascurl[0]; int what = ascurl[0];
switch (what) { switch (what) {
@ -849,7 +853,7 @@ void ResList::linkWasClicked(const QUrl &url)
int i = atoi(ascurl.c_str()+1) - 1; int i = atoi(ascurl.c_str()+1) - 1;
Rcl::Doc doc; Rcl::Doc doc;
if (!getDoc(i, doc)) { if (!getDoc(i, doc)) {
LOGERR("ResList::linkWasClicked: can't get doc for " << (i) << "\n" ); LOGERR("ResList::linkWasClicked: can't get doc for " << i << "\n");
return; return;
} }
emit(showSnippets(doc)); emit(showSnippets(doc));
@ -864,7 +868,7 @@ void ResList::linkWasClicked(const QUrl &url)
int i = atoi(ascurl.c_str()+1) - 1; int i = atoi(ascurl.c_str()+1) - 1;
Rcl::Doc doc; Rcl::Doc doc;
if (!getDoc(i, doc)) { if (!getDoc(i, doc)) {
LOGERR("ResList::linkWasClicked: can't get doc for " << (i) << "\n" ); LOGERR("ResList::linkWasClicked: can't get doc for " << i << "\n");
return; return;
} }
vector<Rcl::Doc> dups; vector<Rcl::Doc> dups;
@ -880,7 +884,7 @@ void ResList::linkWasClicked(const QUrl &url)
int i = atoi(ascurl.c_str()+1) - 1; int i = atoi(ascurl.c_str()+1) - 1;
Rcl::Doc doc; Rcl::Doc doc;
if (!getDoc(i, doc)) { if (!getDoc(i, doc)) {
LOGERR("ResList::linkWasClicked: can't get doc for " << (i) << "\n" ); LOGERR("ResList::linkWasClicked: can't get doc for " << i << "\n");
return; return;
} }
emit editRequested(ResultPopup::getParent(std::shared_ptr<DocSequence>(), emit editRequested(ResultPopup::getParent(std::shared_ptr<DocSequence>(),
@ -902,7 +906,7 @@ void ResList::linkWasClicked(const QUrl &url)
int i = atoi(ascurl.c_str()+1) - 1; int i = atoi(ascurl.c_str()+1) - 1;
Rcl::Doc doc; Rcl::Doc doc;
if (!getDoc(i, doc)) { if (!getDoc(i, doc)) {
LOGERR("ResList::linkWasClicked: can't get doc for " << (i) << "\n" ); LOGERR("ResList::linkWasClicked: can't get doc for " << i << "\n");
return; return;
} }
if (what == 'P') { if (what == 'P') {
@ -962,18 +966,18 @@ void ResList::linkWasClicked(const QUrl &url)
break; break;
default: default:
LOGERR("ResList::linkWasClicked: bad link [" << (ascurl) << "]\n" ); LOGERR("ResList::linkWasClicked: bad link [" << ascurl << "]\n");
break;// ?? break;// ??
} }
} }
void ResList::createPopupMenu(const QPoint& pos) void ResList::createPopupMenu(const QPoint& pos)
{ {
LOGDEB("ResList::createPopupMenu(" << (pos.x()) << ", " << (pos.y()) << ")\n" ); LOGDEB("ResList::createPopupMenu(" << pos.x() << ", " << pos.y() << ")\n");
#ifdef RESLIST_TEXTBROWSER #ifdef RESLIST_TEXTBROWSER
QTextCursor cursor = cursorForPosition(pos); QTextCursor cursor = cursorForPosition(pos);
int blocknum = cursor.blockNumber(); int blocknum = cursor.blockNumber();
LOGDEB("ResList::createPopupMenu(): block " << (blocknum) << "\n" ); LOGDEB("ResList::createPopupMenu(): block " << blocknum << "\n");
m_popDoc = docnumfromparnum(blocknum); m_popDoc = docnumfromparnum(blocknum);
#else #else
QWebHitTestResult htr = page()->mainFrame()->hitTestContent(pos); QWebHitTestResult htr = page()->mainFrame()->hitTestContent(pos);