1st impl of catg filtering in reslist
This commit is contained in:
parent
66ffcc2b0b
commit
5d29d7504e
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.37 2008-07-01 08:26:08 dockes Exp $ (C) 2005 Jean-Francois Dockes";
|
static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.38 2008-09-28 14:20:50 dockes Exp $ (C) 2005 Jean-Francois Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -207,7 +207,7 @@ void rwSettings(bool writing)
|
|||||||
SETTING_RW(prefs.syntAbsCtx, "/Recoll/prefs/query/syntAbsCtx",
|
SETTING_RW(prefs.syntAbsCtx, "/Recoll/prefs/query/syntAbsCtx",
|
||||||
Num, 4);
|
Num, 4);
|
||||||
|
|
||||||
SETTING_RW(prefs.sortWidth, "/Recoll/prefs/query/sortWidth",
|
SETTING_RW(prefs.sortDepth, "/Recoll/prefs/query/sortDepth",
|
||||||
Num, 100);
|
Num, 100);
|
||||||
SETTING_RW(prefs.sortSpec, "/Recoll/prefs/query/sortSpec",
|
SETTING_RW(prefs.sortSpec, "/Recoll/prefs/query/sortSpec",
|
||||||
Num, 0);
|
Num, 0);
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
#ifndef _GUIUTILS_H_INCLUDED_
|
#ifndef _GUIUTILS_H_INCLUDED_
|
||||||
#define _GUIUTILS_H_INCLUDED_
|
#define _GUIUTILS_H_INCLUDED_
|
||||||
/*
|
/*
|
||||||
* @(#$Id: guiutils.h,v 1.27 2008-07-01 08:26:08 dockes Exp $ (C) 2005 Jean-Francois Dockes
|
* @(#$Id: guiutils.h,v 1.28 2008-09-28 14:20:50 dockes Exp $ (C) 2005 Jean-Francois Dockes
|
||||||
* jean-francois.dockes@wanadoo.fr
|
* jean-francois.dockes@wanadoo.fr
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -101,7 +101,7 @@ class PrefsPack {
|
|||||||
int syntAbsCtx;
|
int syntAbsCtx;
|
||||||
|
|
||||||
// Sort specs (sort_w.cpp knows how to deal with the values
|
// Sort specs (sort_w.cpp knows how to deal with the values
|
||||||
int sortWidth;
|
int sortDepth;
|
||||||
int sortSpec;
|
int sortSpec;
|
||||||
|
|
||||||
// Remembered term match mode
|
// Remembered term match mode
|
||||||
|
|||||||
@ -35,16 +35,35 @@
|
|||||||
</property>
|
</property>
|
||||||
<widget class="QLayoutWidget">
|
<widget class="QLayoutWidget">
|
||||||
<property name="name">
|
<property name="name">
|
||||||
<cstring>unnamed</cstring>
|
<cstring>layout4</cstring>
|
||||||
</property>
|
</property>
|
||||||
<vbox>
|
<vbox>
|
||||||
<property name="name">
|
<property name="name">
|
||||||
<cstring>unnamed</cstring>
|
<cstring>unnamed</cstring>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
<widget class="SSearch">
|
<widget class="SSearch">
|
||||||
<property name="name">
|
<property name="name">
|
||||||
<cstring>sSearch</cstring>
|
<cstring>sSearch</cstring>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy>
|
||||||
|
<hsizetype>7</hsizetype>
|
||||||
|
<vsizetype>0</vsizetype>
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QButtonGroup">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>catgBGRP</cstring>
|
||||||
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy>
|
<sizepolicy>
|
||||||
<hsizetype>5</hsizetype>
|
<hsizetype>5</hsizetype>
|
||||||
@ -53,6 +72,26 @@
|
|||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>GroupBoxPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>Sunken</enum>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string></string>
|
||||||
|
</property>
|
||||||
|
<property name="selectedId" stdset="0">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QRadioButton">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>allRDB</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>All</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="ResList">
|
<widget class="ResList">
|
||||||
<property name="name">
|
<property name="name">
|
||||||
@ -90,10 +129,10 @@
|
|||||||
</item>
|
</item>
|
||||||
<item text="&Preferences" name="preferencesMenu">
|
<item text="&Preferences" name="preferencesMenu">
|
||||||
<action name="indexConfigAction"/>
|
<action name="indexConfigAction"/>
|
||||||
<separator/>
|
<separator/>
|
||||||
<action name="queryPrefsAction"/>
|
<action name="queryPrefsAction"/>
|
||||||
<action name="extIdxAction"/>
|
<action name="extIdxAction"/>
|
||||||
<separator/>
|
<separator/>
|
||||||
</item>
|
</item>
|
||||||
<separator/>
|
<separator/>
|
||||||
<item text="&Help" name="helpMenu">
|
<item text="&Help" name="helpMenu">
|
||||||
@ -320,4 +359,8 @@
|
|||||||
</actions>
|
</actions>
|
||||||
<pixmapinproject/>
|
<pixmapinproject/>
|
||||||
<layoutdefaults spacing="6" margin="11"/>
|
<layoutdefaults spacing="6" margin="11"/>
|
||||||
|
<includehints>
|
||||||
|
<includehint>ssearch_w.h</includehint>
|
||||||
|
<includehint>reslist.h</includehint>
|
||||||
|
</includehints>
|
||||||
</UI>
|
</UI>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.52 2008-09-28 07:40:56 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.53 2008-09-28 14:20:50 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -95,6 +95,12 @@ static QIconSet createIconSet(const QString &name)
|
|||||||
|
|
||||||
void RclMain::init()
|
void RclMain::init()
|
||||||
{
|
{
|
||||||
|
// This is just to get the common catg strings into the message file
|
||||||
|
static const char* catg_strings[] = {
|
||||||
|
QT_TR_NOOP("All"), QT_TR_NOOP("media"), QT_TR_NOOP("message"),
|
||||||
|
QT_TR_NOOP("other"), QT_TR_NOOP("presentation"),
|
||||||
|
QT_TR_NOOP("spreadsheet"), QT_TR_NOOP("text")
|
||||||
|
};
|
||||||
|
|
||||||
curPreview = 0;
|
curPreview = 0;
|
||||||
asearchform = 0;
|
asearchform = 0;
|
||||||
@ -146,6 +152,22 @@ void RclMain::init()
|
|||||||
}
|
}
|
||||||
preferencesMenu->setItemChecked(curid, true);
|
preferencesMenu->setItemChecked(curid, true);
|
||||||
|
|
||||||
|
// Document categories buttons
|
||||||
|
catgBGRP->setColumnLayout(1, Qt::Vertical);
|
||||||
|
list<string> cats;
|
||||||
|
rclconfig->getMimeCategories(cats);
|
||||||
|
// Text for button 0 is not used. Next statement just avoids unused
|
||||||
|
// variable compiler warning for catg_strings
|
||||||
|
m_catgbutvec.push_back(catg_strings[0]);
|
||||||
|
for (list<string>::const_iterator it = cats.begin();
|
||||||
|
it != cats.end(); it++) {
|
||||||
|
QRadioButton *but = new QRadioButton(catgBGRP);
|
||||||
|
QString catgnm = QString::fromUtf8(it->c_str(), it->length());
|
||||||
|
m_catgbutvec.push_back(*it);
|
||||||
|
but->setText(tr(catgnm));
|
||||||
|
}
|
||||||
|
catgBGRP->setButton(0);
|
||||||
|
|
||||||
// Connections
|
// Connections
|
||||||
connect(sSearch, SIGNAL(startSearch(RefCntr<Rcl::SearchData>)),
|
connect(sSearch, SIGNAL(startSearch(RefCntr<Rcl::SearchData>)),
|
||||||
this, SLOT(startSearch(RefCntr<Rcl::SearchData>)));
|
this, SLOT(startSearch(RefCntr<Rcl::SearchData>)));
|
||||||
@ -203,7 +225,7 @@ void RclMain::init()
|
|||||||
connect(indexConfigAction, SIGNAL(activated()), this, SLOT(showIndexConfig()));
|
connect(indexConfigAction, SIGNAL(activated()), this, SLOT(showIndexConfig()));
|
||||||
connect(queryPrefsAction, SIGNAL(activated()), this, SLOT(showUIPrefs()));
|
connect(queryPrefsAction, SIGNAL(activated()), this, SLOT(showUIPrefs()));
|
||||||
connect(extIdxAction, SIGNAL(activated()), this, SLOT(showExtIdxDialog()));
|
connect(extIdxAction, SIGNAL(activated()), this, SLOT(showExtIdxDialog()));
|
||||||
|
connect(catgBGRP, SIGNAL(clicked(int)), this, SLOT(catgFilter(int)));
|
||||||
|
|
||||||
#if (QT_VERSION < 0x040000)
|
#if (QT_VERSION < 0x040000)
|
||||||
nextPageAction->setIconSet(createIconSet("nextpage.png"));
|
nextPageAction->setIconSet(createIconSet("nextpage.png"));
|
||||||
@ -229,7 +251,7 @@ void RclMain::init()
|
|||||||
if (prefs.keepSort && prefs.sortActive) {
|
if (prefs.keepSort && prefs.sortActive) {
|
||||||
SortForm sf(0);
|
SortForm sf(0);
|
||||||
connect(&sf, SIGNAL(sortDataChanged(DocSeqSortSpec)),
|
connect(&sf, SIGNAL(sortDataChanged(DocSeqSortSpec)),
|
||||||
resList, SLOT(sortDataChanged(DocSeqSortSpec)));
|
resList, SLOT(setSortParams(DocSeqSortSpec)));
|
||||||
// Have to call setdata again after sig connected...
|
// Have to call setdata again after sig connected...
|
||||||
sf.setData();
|
sf.setData();
|
||||||
}
|
}
|
||||||
@ -486,7 +508,7 @@ void RclMain::showSortDialog()
|
|||||||
if (sortform == 0) {
|
if (sortform == 0) {
|
||||||
sortform = new SortForm(0);
|
sortform = new SortForm(0);
|
||||||
connect(sortform, SIGNAL(sortDataChanged(DocSeqSortSpec)),
|
connect(sortform, SIGNAL(sortDataChanged(DocSeqSortSpec)),
|
||||||
resList, SLOT(sortDataChanged(DocSeqSortSpec)));
|
resList, SLOT(setSortParams(DocSeqSortSpec)));
|
||||||
connect(sortform, SIGNAL(applySortData()),
|
connect(sortform, SIGNAL(applySortData()),
|
||||||
resList, SLOT(setDocSource()));
|
resList, SLOT(setDocSource()));
|
||||||
sortform->show();
|
sortform->show();
|
||||||
@ -605,7 +627,7 @@ void RclMain::startPreview(int docnum, int mod)
|
|||||||
if (curPreview == 0) {
|
if (curPreview == 0) {
|
||||||
HiliteData hdata;
|
HiliteData hdata;
|
||||||
resList->getTerms(hdata.terms, hdata.groups, hdata.gslks);
|
resList->getTerms(hdata.terms, hdata.groups, hdata.gslks);
|
||||||
curPreview = new Preview(resList->searchId(), hdata);
|
curPreview = new Preview(resList->listId(), hdata);
|
||||||
if (curPreview == 0) {
|
if (curPreview == 0) {
|
||||||
QMessageBox::warning(0, tr("Warning"),
|
QMessageBox::warning(0, tr("Warning"),
|
||||||
tr("Can't create preview window"),
|
tr("Can't create preview window"),
|
||||||
@ -675,13 +697,13 @@ void RclMain::previewPrevInTab(Preview * w, int sid, int docnum)
|
|||||||
// Combined next/prev from result list in current preview tab
|
// Combined next/prev from result list in current preview tab
|
||||||
void RclMain::previewPrevOrNextInTab(Preview * w, int sid, int docnum, bool nxt)
|
void RclMain::previewPrevOrNextInTab(Preview * w, int sid, int docnum, bool nxt)
|
||||||
{
|
{
|
||||||
LOGDEB(("RclMain::previewNextInTab sid %d docnum %d, searchId %d\n",
|
LOGDEB(("RclMain::previewNextInTab sid %d docnum %d, listId %d\n",
|
||||||
sid, docnum, resList->searchId()));
|
sid, docnum, resList->listId()));
|
||||||
|
|
||||||
if (w == 0) // ??
|
if (w == 0) // ??
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (sid != resList->searchId()) {
|
if (sid != resList->listId()) {
|
||||||
QMessageBox::warning(0, "Recoll",
|
QMessageBox::warning(0, "Recoll",
|
||||||
tr("This search is not active any more"));
|
tr("This search is not active any more"));
|
||||||
return;
|
return;
|
||||||
@ -720,8 +742,8 @@ void RclMain::previewPrevOrNextInTab(Preview * w, int sid, int docnum, bool nxt)
|
|||||||
void RclMain::previewExposed(Preview *, int sid, int docnum)
|
void RclMain::previewExposed(Preview *, int sid, int docnum)
|
||||||
{
|
{
|
||||||
LOGDEB2(("RclMain::previewExposed: sid %d docnum %d, m_sid %d\n",
|
LOGDEB2(("RclMain::previewExposed: sid %d docnum %d, m_sid %d\n",
|
||||||
sid, docnum, resList->searchId()));
|
sid, docnum, resList->listId()));
|
||||||
if (sid != resList->searchId()) {
|
if (sid != resList->listId()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
resList->previewExposed(docnum);
|
resList->previewExposed(docnum);
|
||||||
@ -974,3 +996,25 @@ void RclMain::enablePrevPage(bool yesno)
|
|||||||
prevPageAction->setEnabled(yesno);
|
prevPageAction->setEnabled(yesno);
|
||||||
firstPageAction->setEnabled(yesno);
|
firstPageAction->setEnabled(yesno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// User pressed a category button: set filter params in reslist
|
||||||
|
void RclMain::catgFilter(int id)
|
||||||
|
{
|
||||||
|
LOGDEB(("RclMain::catgFilter: id %d\n"));
|
||||||
|
if (id < 0 || id >= int(m_catgbutvec.size()))
|
||||||
|
return;
|
||||||
|
|
||||||
|
DocSeqFiltSpec spec;
|
||||||
|
|
||||||
|
if (id != 0) {
|
||||||
|
string catg = m_catgbutvec[id];
|
||||||
|
list<string> tps;
|
||||||
|
rclconfig->getMimeCatTypes(catg, tps);
|
||||||
|
for (list<string>::const_iterator it = tps.begin();
|
||||||
|
it != tps.end(); it++)
|
||||||
|
spec.orCrit(DocSeqFiltSpec::DSFS_MIMETYPE, *it);
|
||||||
|
}
|
||||||
|
|
||||||
|
resList->setFilterParams(spec);
|
||||||
|
resList->setDocSource();
|
||||||
|
}
|
||||||
|
|||||||
@ -105,6 +105,7 @@ public slots:
|
|||||||
virtual void setStemLang(int id);
|
virtual void setStemLang(int id);
|
||||||
// Prefs menu about to show, set the checked lang entry
|
// Prefs menu about to show, set the checked lang entry
|
||||||
virtual void adjustPrefsMenu();
|
virtual void adjustPrefsMenu();
|
||||||
|
virtual void catgFilter(int);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void stemLangChanged(const QString& lang);
|
void stemLangChanged(const QString& lang);
|
||||||
@ -122,6 +123,7 @@ private:
|
|||||||
|
|
||||||
vector<TempFile> m_tempfiles;
|
vector<TempFile> m_tempfiles;
|
||||||
map<QString, int> m_stemLangToId;
|
map<QString, int> m_stemLangToId;
|
||||||
|
vector<string> m_catgbutvec;
|
||||||
int m_idNoStem;
|
int m_idNoStem;
|
||||||
int m_idAllStem;
|
int m_idAllStem;
|
||||||
bool m_idxStatusAck; // Did we act on last status?
|
bool m_idxStatusAck; // Did we act on last status?
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: reslist.cpp,v 1.44 2008-09-28 07:40:56 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: reslist.cpp,v 1.45 2008-09-28 14:20:50 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -81,14 +81,14 @@ ResList::ResList(QWidget* parent, const char* name)
|
|||||||
m_winfirst = -1;
|
m_winfirst = -1;
|
||||||
m_curPvDoc = -1;
|
m_curPvDoc = -1;
|
||||||
m_lstClckMod = 0;
|
m_lstClckMod = 0;
|
||||||
m_searchId = 0;
|
m_listId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResList::~ResList()
|
ResList::~ResList()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int ResList::newSearchId()
|
int ResList::newListId()
|
||||||
{
|
{
|
||||||
static int id;
|
static int id;
|
||||||
return ++id;
|
return ++id;
|
||||||
@ -98,41 +98,47 @@ extern "C" int XFlush(void *);
|
|||||||
|
|
||||||
void ResList::setDocSource(RefCntr<DocSequence> ndocsource)
|
void ResList::setDocSource(RefCntr<DocSequence> ndocsource)
|
||||||
{
|
{
|
||||||
resetList();
|
|
||||||
m_searchId = newSearchId();
|
|
||||||
m_baseDocSource = ndocsource;
|
m_baseDocSource = ndocsource;
|
||||||
if (m_sortspecs.sortwidth > 0) {
|
setDocSource();
|
||||||
m_docSource = RefCntr<DocSequence>(new DocSeqSorted(ndocsource,
|
|
||||||
m_sortspecs,
|
|
||||||
string(tr("Query results (sorted)").utf8())));
|
|
||||||
} else {
|
|
||||||
m_docSource = m_baseDocSource;
|
|
||||||
}
|
|
||||||
resultPageNext();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reapply parameters. Sort params probably changed
|
// Reapply parameters. Sort params probably changed
|
||||||
void ResList::setDocSource()
|
void ResList::setDocSource()
|
||||||
{
|
{
|
||||||
|
if (m_baseDocSource.isNull())
|
||||||
|
return;
|
||||||
resetList();
|
resetList();
|
||||||
m_searchId = newSearchId();
|
m_listId = newListId();
|
||||||
RefCntr<DocSequence> docsource;
|
m_docSource = m_baseDocSource;
|
||||||
if (m_sortspecs.sortwidth > 0) {
|
|
||||||
m_docSource = RefCntr<DocSequence>(new DocSeqSorted(m_baseDocSource,
|
// Filtering must be done before sorting, (which usually
|
||||||
|
// truncates the original list)
|
||||||
|
if (m_filtspecs.isNotNull()) {
|
||||||
|
m_docSource =
|
||||||
|
RefCntr<DocSequence>(new DocSeqFiltered(m_docSource,
|
||||||
|
m_filtspecs, ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_sortspecs.isNotNull()) {
|
||||||
|
m_docSource = RefCntr<DocSequence>(new DocSeqSorted(m_docSource,
|
||||||
m_sortspecs,
|
m_sortspecs,
|
||||||
string(tr("Query results (sorted)").utf8())));
|
string(tr("Query results (sorted)").utf8())));
|
||||||
} else {
|
|
||||||
m_docSource = m_baseDocSource;
|
|
||||||
}
|
}
|
||||||
resultPageNext();
|
resultPageNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResList::sortDataChanged(DocSeqSortSpec spec)
|
void ResList::setSortParams(const DocSeqSortSpec& spec)
|
||||||
{
|
{
|
||||||
LOGDEB(("RclMain::sortDataChanged\n"));
|
LOGDEB(("ResList::setSortParams\n"));
|
||||||
m_sortspecs = spec;
|
m_sortspecs = spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResList::setFilterParams(const DocSeqFiltSpec& spec)
|
||||||
|
{
|
||||||
|
LOGDEB(("ResList::setFilterParams\n"));
|
||||||
|
m_filtspecs = spec;
|
||||||
|
}
|
||||||
|
|
||||||
void ResList::resetList()
|
void ResList::resetList()
|
||||||
{
|
{
|
||||||
m_winfirst = -1;
|
m_winfirst = -1;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#ifndef _RESLIST_H_INCLUDED_
|
#ifndef _RESLIST_H_INCLUDED_
|
||||||
#define _RESLIST_H_INCLUDED_
|
#define _RESLIST_H_INCLUDED_
|
||||||
/* @(#$Id: reslist.h,v 1.14 2008-09-28 07:40:56 dockes Exp $ (C) 2005 J.F.Dockes */
|
/* @(#$Id: reslist.h,v 1.15 2008-09-28 14:20:50 dockes Exp $ (C) 2005 J.F.Dockes */
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
@ -22,6 +22,7 @@ class Q3PopupMenu;
|
|||||||
|
|
||||||
#include "docseq.h"
|
#include "docseq.h"
|
||||||
#include "sortseq.h"
|
#include "sortseq.h"
|
||||||
|
#include "filtseq.h"
|
||||||
#include "refcntr.h"
|
#include "refcntr.h"
|
||||||
#include "rcldoc.h"
|
#include "rcldoc.h"
|
||||||
|
|
||||||
@ -46,11 +47,10 @@ class ResList : public QTEXTBROWSER
|
|||||||
bool getTerms(vector<string>& terms,
|
bool getTerms(vector<string>& terms,
|
||||||
vector<vector<string> >& groups, vector<int>& gslks);
|
vector<vector<string> >& groups, vector<int>& gslks);
|
||||||
list<string> expand(Rcl::Doc& doc);
|
list<string> expand(Rcl::Doc& doc);
|
||||||
int searchId() const {return m_searchId;}
|
int listId() const {return m_listId;}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
// Erase list and forget current search
|
virtual void resetList(); // Erase current list
|
||||||
virtual void resetList();
|
|
||||||
virtual void doubleClicked(int, int);
|
virtual void doubleClicked(int, int);
|
||||||
virtual void resPageUpOrBack(); // Page up pressed
|
virtual void resPageUpOrBack(); // Page up pressed
|
||||||
virtual void resPageDownOrNext(); // Page down pressed
|
virtual void resPageDownOrNext(); // Page down pressed
|
||||||
@ -68,7 +68,8 @@ class ResList : public QTEXTBROWSER
|
|||||||
// Only used for qt ver >=4 but seems we cant undef it
|
// Only used for qt ver >=4 but seems we cant undef it
|
||||||
virtual void selecChanged();
|
virtual void selecChanged();
|
||||||
virtual void setDocSource();
|
virtual void setDocSource();
|
||||||
virtual void sortDataChanged(DocSeqSortSpec spec);
|
virtual void setSortParams(const DocSeqSortSpec &spec);
|
||||||
|
virtual void setFilterParams(const DocSeqFiltSpec &spec);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void nextPageAvailable(bool);
|
void nextPageAvailable(bool);
|
||||||
@ -96,8 +97,9 @@ class ResList : public QTEXTBROWSER
|
|||||||
RefCntr<DocSequence> m_baseDocSource;
|
RefCntr<DocSequence> m_baseDocSource;
|
||||||
// Possibly filtered/sorted docsource (the one displayed)
|
// Possibly filtered/sorted docsource (the one displayed)
|
||||||
RefCntr<DocSequence> m_docSource;
|
RefCntr<DocSequence> m_docSource;
|
||||||
// Current sort parameters
|
// Current sort and filtering parameters
|
||||||
DocSeqSortSpec m_sortspecs;
|
DocSeqSortSpec m_sortspecs;
|
||||||
|
DocSeqFiltSpec m_filtspecs;
|
||||||
// Docs for current page
|
// Docs for current page
|
||||||
std::vector<Rcl::Doc> m_curDocs;
|
std::vector<Rcl::Doc> m_curDocs;
|
||||||
// First docnum (in m_docSource sequence) for current page
|
// First docnum (in m_docSource sequence) for current page
|
||||||
@ -109,7 +111,7 @@ class ResList : public QTEXTBROWSER
|
|||||||
int m_curPvDoc;// Docnum for current preview
|
int m_curPvDoc;// Docnum for current preview
|
||||||
int m_lstClckMod; // Last click modifier.
|
int m_lstClckMod; // Last click modifier.
|
||||||
list<int> m_selDocs;
|
list<int> m_selDocs;
|
||||||
int m_searchId;
|
int m_listId;
|
||||||
|
|
||||||
virtual int docnumfromparnum(int);
|
virtual int docnumfromparnum(int);
|
||||||
virtual int parnumfromdocnum(int);
|
virtual int parnumfromdocnum(int);
|
||||||
@ -119,7 +121,7 @@ class ResList : public QTEXTBROWSER
|
|||||||
emit linkClicked(s, m_lstClckMod);
|
emit linkClicked(s, m_lstClckMod);
|
||||||
};
|
};
|
||||||
virtual RCLPOPUP *createPopupMenu(const QPoint& pos);
|
virtual RCLPOPUP *createPopupMenu(const QPoint& pos);
|
||||||
static int newSearchId();
|
static int newListId();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: sort_w.cpp,v 1.6 2007-06-19 16:19:24 dockes Exp $ (C) 2006 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: sort_w.cpp,v 1.7 2008-09-28 14:20:50 dockes Exp $ (C) 2006 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -45,7 +45,7 @@ void SortForm::init()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Initialize values from prefs:
|
// Initialize values from prefs:
|
||||||
mcntSB->setValue(prefs.sortWidth);
|
mcntSB->setValue(prefs.sortDepth);
|
||||||
unsigned int spec = (unsigned int)prefs.sortSpec;
|
unsigned int spec = (unsigned int)prefs.sortSpec;
|
||||||
|
|
||||||
// Restore active/inactive state from prefs, only if requested
|
// Restore active/inactive state from prefs, only if requested
|
||||||
@ -105,7 +105,7 @@ void SortForm::setData()
|
|||||||
prefs.sortActive = sortCB->isChecked();
|
prefs.sortActive = sortCB->isChecked();
|
||||||
|
|
||||||
if (!sortCB->isChecked()) {
|
if (!sortCB->isChecked()) {
|
||||||
spec.sortwidth = 0;
|
spec.sortdepth = 0;
|
||||||
} else {
|
} else {
|
||||||
bool desc = descCB1->isChecked();
|
bool desc = descCB1->isChecked();
|
||||||
switch (fldCMB1->currentItem()) {
|
switch (fldCMB1->currentItem()) {
|
||||||
@ -126,10 +126,10 @@ void SortForm::setData()
|
|||||||
spec.addCrit(DocSeqSortSpec::RCLFLD_MIMETYPE, desc?true:false);
|
spec.addCrit(DocSeqSortSpec::RCLFLD_MIMETYPE, desc?true:false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
spec.sortwidth = mcntSB->value();
|
spec.sortdepth = mcntSB->value();
|
||||||
|
|
||||||
// Save data to prefs;
|
// Save data to prefs;
|
||||||
prefs.sortWidth = spec.sortwidth;
|
prefs.sortDepth = spec.sortdepth;
|
||||||
unsigned int spec = 0, v, d;
|
unsigned int spec = 0, v, d;
|
||||||
v = fldCMB1->currentItem() & 0x7;
|
v = fldCMB1->currentItem() & 0x7;
|
||||||
d = descCB1->isChecked() ? 8 : 0;
|
d = descCB1->isChecked() ? 8 : 0;
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef _FILTSEQ_H_INCLUDED_
|
#ifndef _FILTSEQ_H_INCLUDED_
|
||||||
#define _FILTSEQ_H_INCLUDED_
|
#define _FILTSEQ_H_INCLUDED_
|
||||||
/* @(#$Id: filtseq.h,v 1.1 2008-09-28 07:40:56 dockes Exp $ (C) 2004 J.F.Dockes */
|
/* @(#$Id: filtseq.h,v 1.2 2008-09-28 14:20:50 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -34,6 +34,8 @@ class DocSeqFiltSpec {
|
|||||||
}
|
}
|
||||||
std::vector<Crit> crits;
|
std::vector<Crit> crits;
|
||||||
std::vector<string> values;
|
std::vector<string> values;
|
||||||
|
void reset() {crits.clear(); values.clear();}
|
||||||
|
bool isNotNull() {return crits.size() != 0;}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: sortseq.cpp,v 1.11 2007-01-19 15:22:50 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: sortseq.cpp,v 1.12 2008-09-28 14:20:50 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -87,10 +87,10 @@ DocSeqSorted::DocSeqSorted(RefCntr<DocSequence> iseq, DocSeqSortSpec &sortspec,
|
|||||||
: DocSequence(t), m_seq(iseq)
|
: DocSequence(t), m_seq(iseq)
|
||||||
{
|
{
|
||||||
m_spec = sortspec;
|
m_spec = sortspec;
|
||||||
LOGDEB(("DocSeqSorted:: count %d\n", m_spec.sortwidth));
|
LOGDEB(("DocSeqSorted:: count %d\n", m_spec.sortdepth));
|
||||||
m_docs.resize(m_spec.sortwidth);
|
m_docs.resize(m_spec.sortdepth);
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < m_spec.sortwidth; i++) {
|
for (i = 0; i < m_spec.sortdepth; i++) {
|
||||||
int percent;
|
int percent;
|
||||||
if (!iseq->getDoc(i, m_docs[i], &percent)) {
|
if (!iseq->getDoc(i, m_docs[i], &percent)) {
|
||||||
LOGERR(("DocSeqSorted: getDoc failed for doc %d\n", i));
|
LOGERR(("DocSeqSorted: getDoc failed for doc %d\n", i));
|
||||||
@ -98,11 +98,11 @@ DocSeqSorted::DocSeqSorted(RefCntr<DocSequence> iseq, DocSeqSortSpec &sortspec,
|
|||||||
}
|
}
|
||||||
m_docs[i].pc = percent;
|
m_docs[i].pc = percent;
|
||||||
}
|
}
|
||||||
m_spec.sortwidth = i;
|
m_spec.sortdepth = i;
|
||||||
LOGDEB(("DocSeqSorted:: m_count %d\n", m_spec.sortwidth));
|
LOGDEB(("DocSeqSorted:: m_count %d\n", m_spec.sortdepth));
|
||||||
m_docs.resize(m_spec.sortwidth);
|
m_docs.resize(m_spec.sortdepth);
|
||||||
m_docsp.resize(m_spec.sortwidth);
|
m_docsp.resize(m_spec.sortdepth);
|
||||||
for (i = 0; i < m_spec.sortwidth; i++)
|
for (i = 0; i < m_spec.sortdepth; i++)
|
||||||
m_docsp[i] = &m_docs[i];
|
m_docsp[i] = &m_docs[i];
|
||||||
|
|
||||||
CompareDocs cmp(sortspec);
|
CompareDocs cmp(sortspec);
|
||||||
@ -113,7 +113,7 @@ bool DocSeqSorted::getDoc(int num, Rcl::Doc &doc, int *percent, string *)
|
|||||||
{
|
{
|
||||||
LOGDEB1(("DocSeqSorted: fetching %d\n", num));
|
LOGDEB1(("DocSeqSorted: fetching %d\n", num));
|
||||||
|
|
||||||
if (num >= m_spec.sortwidth)
|
if (num >= m_spec.sortdepth)
|
||||||
return false;
|
return false;
|
||||||
if (percent)
|
if (percent)
|
||||||
*percent = (*m_docsp[num]).pc;
|
*percent = (*m_docsp[num]).pc;
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef _SORTSEQ_H_INCLUDED_
|
#ifndef _SORTSEQ_H_INCLUDED_
|
||||||
#define _SORTSEQ_H_INCLUDED_
|
#define _SORTSEQ_H_INCLUDED_
|
||||||
/* @(#$Id: sortseq.h,v 1.10 2007-01-19 15:22:50 dockes Exp $ (C) 2004 J.F.Dockes */
|
/* @(#$Id: sortseq.h,v 1.11 2008-09-28 14:20:50 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -26,13 +26,15 @@
|
|||||||
|
|
||||||
class DocSeqSortSpec {
|
class DocSeqSortSpec {
|
||||||
public:
|
public:
|
||||||
DocSeqSortSpec() : sortwidth(0) {}
|
DocSeqSortSpec() : sortdepth(0) {}
|
||||||
int sortwidth; // We only re-sort the first sortwidth most relevant docs
|
|
||||||
enum Field {RCLFLD_URL, RCLFLD_IPATH, RCLFLD_MIMETYPE, RCLFLD_MTIME};
|
enum Field {RCLFLD_URL, RCLFLD_IPATH, RCLFLD_MIMETYPE, RCLFLD_MTIME};
|
||||||
void addCrit(Field fld, bool desc = false) {
|
void addCrit(Field fld, bool desc = false) {
|
||||||
crits.push_back(fld);
|
crits.push_back(fld);
|
||||||
dirs.push_back(desc);
|
dirs.push_back(desc);
|
||||||
}
|
}
|
||||||
|
bool isNotNull() {return sortdepth > 0;}
|
||||||
|
|
||||||
|
int sortdepth; // We only re-sort the first sortdepth most relevant docs
|
||||||
std::vector<Field> crits;
|
std::vector<Field> crits;
|
||||||
std::vector<bool> dirs;
|
std::vector<bool> dirs;
|
||||||
};
|
};
|
||||||
@ -47,7 +49,7 @@ class DocSeqSorted : public DocSequence {
|
|||||||
const std::string &t);
|
const std::string &t);
|
||||||
virtual ~DocSeqSorted() {}
|
virtual ~DocSeqSorted() {}
|
||||||
virtual bool getDoc(int num, Rcl::Doc &doc, int *percent, string *sh = 0);
|
virtual bool getDoc(int num, Rcl::Doc &doc, int *percent, string *sh = 0);
|
||||||
virtual int getResCnt() {return m_spec.sortwidth;}
|
virtual int getResCnt() {return m_spec.sortdepth;}
|
||||||
virtual string getAbstract(Rcl::Doc& doc) {
|
virtual string getAbstract(Rcl::Doc& doc) {
|
||||||
return m_seq->getAbstract(doc);
|
return m_seq->getAbstract(doc);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
# @(#$Id: mimeconf,v 1.43 2008-09-15 08:03:37 dockes Exp $ (C) 2004 J.F.Dockes
|
# @(#$Id: mimeconf,v 1.44 2008-09-28 14:20:50 dockes Exp $ (C) 2004 J.F.Dockes
|
||||||
|
|
||||||
# Recoll : associations of mime types to processing filters.
|
# Recoll : associations of mime types to processing filters.
|
||||||
# There are different sections for decompression, 'interning' for indexing
|
# There are different sections for decompression, 'interning' for indexing
|
||||||
@ -159,6 +159,7 @@ text = \
|
|||||||
text/html \
|
text/html \
|
||||||
text/plain \
|
text/plain \
|
||||||
text/rtf \
|
text/rtf \
|
||||||
|
text/x-c \
|
||||||
text/x-html-sidux-man \
|
text/x-html-sidux-man \
|
||||||
text/x-man \
|
text/x-man \
|
||||||
text/x-python
|
text/x-python
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user