diff --git a/src/qtgui/guiutils.cpp b/src/qtgui/guiutils.cpp index 88764e68..651101cb 100644 --- a/src/qtgui/guiutils.cpp +++ b/src/qtgui/guiutils.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.22 2006-10-30 12:59:44 dockes Exp $ (C) 2005 Jean-Francois Dockes"; +static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.23 2006-11-10 13:32:08 dockes Exp $ (C) 2005 Jean-Francois Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -157,7 +157,13 @@ void rwSettings(bool writing) ""); SETTING_RW(prefs.reslistfontsize, "/Recoll/prefs/reslist/fontSize", Num, 0); - + QString rlfDflt =QString::fromAscii( + "%R %S %L   %T
" + "%M %D   %U
" + "%A %K"); + SETTING_RW(prefs.reslistformat, "/Recoll/prefs/reslist/format", , rlfDflt); + if (prefs.reslistformat.stripWhiteSpace().isEmpty()) + prefs.reslistformat = rlfDflt; SETTING_RW(prefs.queryStemLang, "/Recoll/prefs/query/stemLang", , "english"); SETTING_RW(prefs.queryBuildAbstract, diff --git a/src/qtgui/guiutils.h b/src/qtgui/guiutils.h index bf996037..f1999cc5 100644 --- a/src/qtgui/guiutils.h +++ b/src/qtgui/guiutils.h @@ -17,7 +17,7 @@ #ifndef _GUIUTILS_H_INCLUDED_ #define _GUIUTILS_H_INCLUDED_ /* - * @(#$Id: guiutils.h,v 1.14 2006-10-30 12:59:44 dockes Exp $ (C) 2005 Jean-Francois Dockes + * @(#$Id: guiutils.h,v 1.15 2006-11-10 13:32:08 dockes Exp $ (C) 2005 Jean-Francois Dockes * jean-francois.dockes@wanadoo.fr * * This program is free software; you can redistribute it and/or modify @@ -60,6 +60,8 @@ class PrefsPack { int respagesize; QString reslistfontfamily; int reslistfontsize; + // Result list format string + QString reslistformat; QString queryStemLang; int mainwidth; int mainheight; diff --git a/src/qtgui/rclmain_w.cpp b/src/qtgui/rclmain_w.cpp index 065b3ed5..946c7880 100644 --- a/src/qtgui/rclmain_w.cpp +++ b/src/qtgui/rclmain_w.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.4 2006-10-30 12:59:44 dockes Exp $ (C) 2005 J.F.Dockes"; +static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.5 2006-11-10 13:32:08 dockes Exp $ (C) 2005 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -635,23 +635,10 @@ void RclMain::startNativeViewer(int docnum) // Substitute %u (url) and %f (file name) inside prototype command string ncmd; - string::const_iterator it1; - for (it1 = cmd.begin(); it1 != cmd.end();it1++) { - if (*it1 == '%') { - if (++it1 == cmd.end()) { - ncmd += '%'; - break; - } - if (*it1 == '%') - ncmd += '%'; - if (*it1 == 'u') - ncmd += "'" + url + "'"; - if (*it1 == 'f') - ncmd += "'" + fn + "'"; - } else { - ncmd += *it1; - } - } + map subs; + subs['u'] = string("'") + url + "'"; + subs['f'] = string("'") + fn + "'"; + pcSubst(cmd, ncmd, subs); ncmd += " &"; QStatusBar *stb = statusBar(); diff --git a/src/qtgui/reslist.cpp b/src/qtgui/reslist.cpp index 764c897a..17ca0c2d 100644 --- a/src/qtgui/reslist.cpp +++ b/src/qtgui/reslist.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: reslist.cpp,v 1.5 2006-11-09 17:37:58 dockes Exp $ (C) 2005 J.F.Dockes"; +static char rcsid[] = "@(#$Id: reslist.cpp,v 1.6 2006-11-10 13:32:08 dockes Exp $ (C) 2005 J.F.Dockes"; #endif #include @@ -269,6 +269,10 @@ void ResList::resultPageNext() list qTerms; m_docsource->getTerms(qTerms); + // Result paragraph format + string sformat = string(prefs.reslistformat.utf8()); + LOGDEB(("resultPageNext: format: [%s]\n", sformat.c_str())); + // Insert results if any in result list window. We have to send // the text to the widgets, because we need the paragraph number // each time we add a result paragraph (its diffult and @@ -372,43 +376,49 @@ void ResList::resultPageNext() // Abstract string abst; plaintorich(doc.abstract, abst, qTerms, 0, true); - //string abst = escapeHtml(doc.abstract); LOGDEB1(("Abstract: {%s}\n", abst.c_str())); + // Links; + string linksbuf; + char vlbuf[100]; + if (canIntern(doc.mimetype, rclconfig)) { + sprintf(vlbuf, "\"P%d\"", m_winfirst+i); + linksbuf += string("" + "Preview" + "" + + "  "; + } + if (!rclconfig->getMimeViewerDef(doc.mimetype).empty()) { + sprintf(vlbuf, "E%d", m_winfirst+i); + linksbuf += string("" + "Edit" + ""; + } + // Concatenate chunks to build the result list paragraph: string result; + + // Subheader: this is used by history if (!sh.empty()) result += string("

") + sh + "

\n

"; else result += "

"; - // Percent relevant + size + preview/edit links + title - result += string(perbuf) + sizebuf; - char vlbuf[100]; - if (canIntern(doc.mimetype, rclconfig)) { - sprintf(vlbuf, "\"P%d\"", m_winfirst+i); - result += string("" + "Preview" + "" - + "  "; - } - if (!rclconfig->getMimeViewerDef(doc.mimetype).empty()) { - sprintf(vlbuf, "E%d", m_winfirst+i); - result += string("" + "Edit" + ""; - } - result += "  " + doc.title + "
"; - - // Mime type, date modified, url - result += doc.mimetype + " "; - result += string(datebuf) + "   "; if (!img_name.empty()) { result += ""; } - result += "" + url + +"
"; - // Text: abstract and keywords - if (!abst.empty()) - result += abst + "
"; - if (!doc.keywords.empty()) - result += doc.keywords + "
"; + // Configurable stuff + map subs; + subs['A'] = !doc.abstract.empty() ? doc.abstract + "
" : ""; + subs['D'] = datebuf; + subs['K'] = !doc.keywords.empty() ? doc.keywords + "
" : ""; + subs['L'] = linksbuf; + subs['M'] = doc.mimetype; + subs['R'] = perbuf; + subs['S'] = sizebuf; + subs['T'] = doc.title; + subs['U'] = url; + + string formatted; + pcSubst(sformat, formatted, subs); + result += formatted; result += "

\n"; diff --git a/src/qtgui/uiprefs.ui b/src/qtgui/uiprefs.ui index 54e0039f..30106088 100644 --- a/src/qtgui/uiprefs.ui +++ b/src/qtgui/uiprefs.ui @@ -22,164 +22,236 @@ unnamed - + - tabWidget2 + layout21 - + - tab + unnamed - - User interface - - + - unnamed + tabWidget2 - + - layout10 + tab + + User interface + unnamed - layout1 + layout20 - + unnamed - + - textLabel1 - - - - 5 - 5 - 1 - 0 - - - - Number of entries in a result page + layout1 + + + unnamed + + + + textLabel1 + + + + 5 + 5 + 1 + 0 + + + + Number of entries in a result page + + + + + pageLenSB + + + 1 + + + 8 + + + - + - pageLenSB - - - 1 - - - 8 + layout19 + + + unnamed + + + + layout4 + + + + unnamed + + + + textLabel4 + + + Result list font + + + + + reslistFontPB + + + Helvetica-10 + + + Opens a dialog to select the result list font + + + + + resetFontPB + + + Reset + + + Resets the result list font to the system default + + + + + + + layout18 + + + + unnamed + + + + textLabel1_4 + + + Result paragraph<br>format string + + + Defines the format for each result list paragraph. Use qt html format.<br>See manual for the significance of the %xx substitutions. + + + + + rlfTE + + + + 7 + 0 + 0 + 0 + + + + + 200 + 20 + + + + PlainText + + + + + + true + + + AutoNone + + + + + + + layout9 + + + + unnamed + + + + textLabel1_3 + + + HTML help browser + + + + + helpBrowserLE + + + + 200 + 0 + + + + + + helpBrowserPB + + + Select file + + + + + + + useIconsCB + + + Show document type icons in result list. + + + true + + + + + autoSearchCB + + + Auto-start simple search on whitespace entry. + + + false + + + - - - - - layout4 - - - - unnamed - - - - textLabel4 - - - Result list font - - - - - reslistFontPB - - - Helvetica-10 - - - Opens a dialog to select the result list font - - - - - resetFontPB - - - Reset - - - Resets the result list font to the system default - - - - - - - layout9 - - - - unnamed - - - - textLabel1_3 - - - HTML help browser - - - - - helpBrowserLE - - - - 200 - 0 - - - - - - helpBrowserPB - - - Select file - - - - - - - useIconsCB - - - Show document type icons in result list. - - - true - - - - - autoSearchCB - - - Auto-start simple search on whitespace entry. - - - false - + @@ -205,495 +277,495 @@ - - - - - tab - - - Search parameters - - - - unnamed - - + - layout7 + tab + + Search parameters + unnamed - layout6 + layout7 - + unnamed - + - textLabel1_2 + layout6 + + + + unnamed + + + + textLabel1_2 + + + Stemming language + + + + + stemLangCMB + + + + + + + autoPhraseCB - Stemming language + Automatically add phrase to simple searches - - - - stemLangCMB - - - - - - - autoPhraseCB - - - Automatically add phrase to simple searches - - - A search for [rolling stones] (2 terms) will be changed to [rolling or stones or (rolling phrase 2 stones)]. + + A search for [rolling stones] (2 terms) will be changed to [rolling or stones or (rolling phrase 2 stones)]. This should give higher precedence to the results where the search terms appear exactly as entered. - - - - - line2 - - - HLine - - - Sunken - - - Horizontal - - - - - buildAbsCB - - - Dynamically build abstracts - - - Do we try to build abstracts for result list entries by using the context of query terms ? + + + + + line2 + + + HLine + + + Sunken + + + Horizontal + + + + + buildAbsCB + + + Dynamically build abstracts + + + Do we try to build abstracts for result list entries by using the context of query terms ? May be slow for big documents. - - - - - replAbsCB - - - Replace abstracts from documents - - - Do we synthetize an abstract even if the document seemed to have one? - - - - - layout16 - - - - unnamed - - - - textLabel2 - - - 5 - 5 - 2 - 0 - + + + + replAbsCB - Synthetic abstract size (characters) + Replace abstracts from documents + + + Do we synthetize an abstract even if the document seemed to have one? - + - syntlenSB - - - - 7 - 0 - 1 - 0 - - - - 10 - - - 80 - - - 100000 - - - 250 + layout16 + + + unnamed + + + + textLabel2 + + + + 5 + 5 + 2 + 0 + + + + Synthetic abstract size (characters) + + + + + syntlenSB + + + + 7 + 0 + 1 + 0 + + + + 100000 + + + 80 + + + 10 + + + 250 + + + - + + + layout17 + + + + unnamed + + + + textLabel3 + + + + 5 + 5 + 1 + 0 + + + + Synthetic abstract context words + + + + + syntctxSB + + + 20000 + + + 2 + + + 4 + + + + + + + spacer2 + + + Vertical + + + Expanding + + + + 20 + 70 + + + + - - - layout17 - - - - unnamed - - - - textLabel3 - - - - 5 - 5 - 1 - 0 - - - - Synthetic abstract context words - - - - - syntctxSB - - - 20000 - - - 2 - - - 4 - - - - - - - spacer2 - - - Vertical - - - Expanding - - - - 20 - 70 - - - - - - - - ExtraDb - - - External Indexes - - - - unnamed - - + - layout15 + ExtraDb - - - unnamed - - - - addExtraDbPB - - - false - - - Add index - - - Select the xapiandb directory for the index you want to add, then click Add Index - - - - - extraDbLE - - - - 200 - 0 - - - - Select the xapiandb directory for the index you want to add, then click Add Index - - - - - browseDbPB - - - Browse - - - Select the xapiandb directory for the index you want to add, then click Add Index - - - - - - - layout12 - - + + External Indexes + + unnamed - layout13 + layout15 - + unnamed - + - textLabel2_2 - - - All indexes - - - Indexes currently not used - - - - - allDbsLB + addExtraDbPB - true + false + + + Add index + + + Select the xapiandb directory for the index you want to add, then click Add Index + + + + + extraDbLE 200 - 200 + 0 - - Extended - - - - - - - layout11 - - - - unnamed - - - - addAADbPB - - - true - - - All ----> - - - false - - - - - addADbPB - - - true - - - Sel -----> - - - false - - - - - delADbPB - - - true - - - <----- Sel - - - false - - - - - delAADbPB - - - true - - - <----- All - - - false - - - - - - - layout14 - - - - unnamed - - - - textLabel5 - - - Active indexes - - Indexes that will be searched in addition to the main one + Select the xapiandb directory for the index you want to add, then click Add Index - + - actDbsLB + browseDbPB - - true + + Browse - - - 200 - 200 - - - - Extended + + Select the xapiandb directory for the index you want to add, then click Add Index - + - + + + layout12 + + + + unnamed + + + + layout13 + + + + unnamed + + + + textLabel2_2 + + + All indexes + + + Indexes currently not used + + + + + allDbsLB + + + true + + + + 200 + 200 + + + + Extended + + + + + + + layout11 + + + + unnamed + + + + addAADbPB + + + true + + + All ----> + + + false + + + + + addADbPB + + + true + + + Sel -----> + + + false + + + + + delADbPB + + + true + + + <----- Sel + + + false + + + + + delAADbPB + + + true + + + <----- All + + + false + + + + + + + layout14 + + + + unnamed + + + + textLabel5 + + + Active indexes + + + Indexes that will be searched in addition to the main one + + + + + actDbsLB + + + true + + + + 200 + 200 + + + + Extended + + + + + + + - - - - - - Layout1 - - - - unnamed - - - 0 - - - 6 - - - - Horizontal Spacing2 - - - Horizontal - - - Expanding - - - - 20 - 20 - - - - - - buttonOk - - - &OK - - - - - - true - - - true - - - Apply changes - - + - buttonCancel - - - &Cancel - - - - - - true - - - Discard changes + Layout1 + + + unnamed + + + 0 + + + 6 + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonOk + + + &OK + + + + + + true + + + true + + + Apply changes + + + + + buttonCancel + + + &Cancel + + + + + + true + + + Discard changes + + + - + diff --git a/src/qtgui/uiprefs_w.cpp b/src/qtgui/uiprefs_w.cpp index 7aab7960..ded1b3e2 100644 --- a/src/qtgui/uiprefs_w.cpp +++ b/src/qtgui/uiprefs_w.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.9 2006-11-07 09:04:28 dockes Exp $ (C) 2005 J.F.Dockes"; +static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.10 2006-11-10 13:32:08 dockes Exp $ (C) 2005 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -40,6 +40,7 @@ static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.9 2006-11-07 09:04:28 dockes Ex #include #include #include +#include #include "recoll.h" #include "guiutils.h" @@ -93,6 +94,7 @@ void UIPrefsDialog::setFromPrefs() reslistFontPB->setText(reslistFontFamily + "-" + s.setNum(reslistFontSize)); } + rlfTE->setText(prefs.reslistformat); helpBrowserLE->setText(prefs.htmlBrowser); // Stemming language combobox @@ -152,6 +154,7 @@ void UIPrefsDialog::accept() prefs.reslistfontfamily = reslistFontFamily; prefs.reslistfontsize = reslistFontSize; + prefs.reslistformat = rlfTE->text(); prefs.htmlBrowser = helpBrowserLE->text();