Result list: if a thumbnail exists for the result, display it instead of the file type icon
This commit is contained in:
@@ -37,7 +37,7 @@ RclDynConf *g_dynconf;
|
||||
// introducing blank space.
|
||||
const char *PrefsPack::dfltResListFormat =
|
||||
#if 1
|
||||
"<table><tr><td><img src='%I'></td>"
|
||||
"<table><tr><td><img src='%I' width='64'></td>"
|
||||
"<td>%R %S %L <b>%T</b><br>"
|
||||
"%M %D <i>%U</i><br>"
|
||||
"%A %K</td></tr></table>"
|
||||
@@ -49,10 +49,10 @@ const char *PrefsPack::dfltResListFormat =
|
||||
#endif
|
||||
;
|
||||
|
||||
const char *v114reslistformat = "<img src=\"%I\" align=\"left\">"
|
||||
"%R %S %L <b>%T</b><br>"
|
||||
"%M %D <i>%U</i> %i<br>"
|
||||
"%A %K";
|
||||
const char* v162reslistformat="<table><tr><td><img src='%I'></td>"
|
||||
"<td>%R %S %L <b>%T</b><br>"
|
||||
"%M %D <i>%U</i><br>"
|
||||
"%A %K</td></tr></table>";
|
||||
|
||||
|
||||
// The global preferences structure
|
||||
@@ -151,7 +151,7 @@ void rwSettings(bool writing)
|
||||
// If the current value of the format is the default for the
|
||||
// previous version, replace it with the new default. We
|
||||
// should have a flag to say if it was changed instead
|
||||
if (!prefs.creslistformat.compare(v114reslistformat)) {
|
||||
if (!prefs.creslistformat.compare(v162reslistformat)) {
|
||||
LOGDEB(("Replacing old default format\n"));
|
||||
prefs.reslistformat = rlfDflt;
|
||||
prefs.creslistformat = (const char*)prefs.reslistformat.toUtf8();
|
||||
|
||||
+20
-7
@@ -49,6 +49,7 @@
|
||||
#include "plaintorich.h"
|
||||
#include "refcntr.h"
|
||||
#include "internfile.h"
|
||||
#include "indexer.h"
|
||||
|
||||
#include "reslist.h"
|
||||
#include "moc_reslist.cpp"
|
||||
@@ -75,9 +76,9 @@ public:
|
||||
virtual string nextUrl();
|
||||
virtual string prevUrl();
|
||||
virtual string pageTop();
|
||||
virtual string iconPath(const string& mt);
|
||||
virtual void suggest(const vector<string>uterms, vector<string>&sugg);
|
||||
virtual string absSep() {return (const char *)(prefs.abssep.toUtf8());}
|
||||
virtual string iconUrl(RclConfig *, Rcl::Doc& doc);
|
||||
private:
|
||||
ResList *m_parent;
|
||||
};
|
||||
@@ -161,12 +162,6 @@ string QtGuiResListPager::pageTop()
|
||||
return string();
|
||||
}
|
||||
|
||||
string QtGuiResListPager::iconPath(const string& mtype)
|
||||
{
|
||||
string iconpath;
|
||||
theconfig->getMimeIconName(mtype, &iconpath);
|
||||
return iconpath;
|
||||
}
|
||||
|
||||
void QtGuiResListPager::suggest(const vector<string>uterms, vector<string>&sugg)
|
||||
{
|
||||
@@ -200,6 +195,24 @@ void QtGuiResListPager::suggest(const vector<string>uterms, vector<string>&sugg)
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
string QtGuiResListPager::iconUrl(RclConfig *config, Rcl::Doc& doc)
|
||||
{
|
||||
if (doc.ipath.empty()) {
|
||||
vector<Rcl::Doc> docs;
|
||||
docs.push_back(doc);
|
||||
vector<string> paths;
|
||||
ConfIndexer::docsToPaths(docs, paths);
|
||||
if (!paths.empty()) {
|
||||
string path;
|
||||
if (thumbPathForUrl(cstr_fileu + paths[0], 128, path)) {
|
||||
return cstr_fileu + path;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ResListPager::iconUrl(config, doc);
|
||||
}
|
||||
|
||||
/////// /////// End reslistpager methods
|
||||
|
||||
class PlainToRichQtReslist : public PlainToRich {
|
||||
|
||||
+16
-5
@@ -45,6 +45,7 @@
|
||||
#include "reslist.h"
|
||||
#include "rclconfig.h"
|
||||
#include "plaintorich.h"
|
||||
#include "indexer.h"
|
||||
|
||||
// Compensate for the default and somewhat bizarre vertical placement
|
||||
// of text in cells
|
||||
@@ -77,8 +78,8 @@ public:
|
||||
virtual bool append(const string& data, int idx, const Rcl::Doc& doc);
|
||||
virtual string trans(const string& in);
|
||||
virtual const string &parFormat();
|
||||
virtual string iconPath(const string& mt);
|
||||
virtual string absSep() {return (const char *)(prefs.abssep.toUtf8());}
|
||||
virtual string iconUrl(RclConfig *, Rcl::Doc& doc);
|
||||
private:
|
||||
ResTable *m_parent;
|
||||
};
|
||||
@@ -102,11 +103,21 @@ const string& ResTablePager::parFormat()
|
||||
return prefs.creslistformat;
|
||||
}
|
||||
|
||||
string ResTablePager::iconPath(const string& mtype)
|
||||
string ResTablePager::iconUrl(RclConfig *config, Rcl::Doc& doc)
|
||||
{
|
||||
string iconpath;
|
||||
theconfig->getMimeIconName(mtype, &iconpath);
|
||||
return iconpath;
|
||||
if (doc.ipath.empty()) {
|
||||
vector<Rcl::Doc> docs;
|
||||
docs.push_back(doc);
|
||||
vector<string> paths;
|
||||
ConfIndexer::docsToPaths(docs, paths);
|
||||
if (!paths.empty()) {
|
||||
string path;
|
||||
if (thumbPathForUrl(cstr_fileu + paths[0], 128, path)) {
|
||||
return cstr_fileu + path;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ResListPager::iconUrl(config, doc);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user