implement option to display the catg filter as a toolbar combobox

This commit is contained in:
dockes 2009-02-24 18:30:08 +00:00
parent ebd7d51935
commit 67f9c95a9b
5 changed files with 33 additions and 1 deletions

View File

@ -103,6 +103,7 @@ void rwSettings(bool writing)
SETTING_RW(prefs.autoSearchOnWS, "/Recoll/prefs/reslist/autoSearchOnWS",
Bool, false);
SETTING_RW(prefs.catgToolBar, "/Recoll/prefs/catgToolBar", Bool, false);
SETTING_RW(prefs.ssearchAutoPhrase,
"/Recoll/prefs/ssearchAutoPhrase", Bool, false);
SETTING_RW(prefs.respagesize, "/Recoll/prefs/reslist/pagelen", Num, 8);

View File

@ -60,6 +60,9 @@ extern bool startHelpBrowser(const string& url = "");
class PrefsPack {
public:
bool autoSearchOnWS;
// Decide if we display the doc category filter control as a
// toolbar+combobox or as a button group under simple search
bool catgToolBar;
int respagesize;
int maxhltextmbs;
QString reslistfontfamily;

View File

@ -43,6 +43,8 @@ using std::pair;
#else
#include <q3filedialog.h>
#define QFileDialog Q3FileDialog
#include <q3toolbar.h>
#define QToolBar Q3ToolBar
#endif
#include <qtabwidget.h>
@ -165,6 +167,14 @@ void RclMain::init()
}
preferencesMenu->setItemChecked(curid, true);
// Toolbar+combobox version of the category selector
QComboBox *catgCMB = 0;
if (prefs.catgToolBar) {
catgCMB = new QComboBox(FALSE, new QToolBar(this), "catCMB");
catgCMB->insertItem(tr("All"));
catgCMB->setToolTip(tr("Document category filter"));
}
// Document categories buttons
catgBGRP->setColumnLayout(1, Qt::Vertical);
list<string> cats;
@ -178,9 +188,12 @@ void RclMain::init()
QString catgnm = QString::fromUtf8(it->c_str(), it->length());
m_catgbutvec.push_back(*it);
but->setText(tr(catgnm));
if (prefs.catgToolBar && catgCMB)
catgCMB->insertItem(tr(catgnm));
}
catgBGRP->setButton(0);
if (prefs.catgToolBar)
catgBGRP->hide();
// Connections
connect(sSearch, SIGNAL(startSearch(RefCntr<Rcl::SearchData>)),
this, SLOT(startSearch(RefCntr<Rcl::SearchData>)));
@ -243,6 +256,8 @@ void RclMain::init()
connect(queryPrefsAction, SIGNAL(activated()), this, SLOT(showUIPrefs()));
connect(extIdxAction, SIGNAL(activated()), this, SLOT(showExtIdxDialog()));
connect(catgBGRP, SIGNAL(clicked(int)), this, SLOT(catgFilter(int)));
if (prefs.catgToolBar && catgCMB)
connect(catgCMB, SIGNAL(activated(int)), this, SLOT(catgFilter(int)));
#if (QT_VERSION < 0x040000)
nextPageAction->setIconSet(createIconSet("nextpage.png"));

View File

@ -284,6 +284,17 @@
<string>Choose editor applications</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>catgToolBarCB</cstring>
</property>
<property name="text">
<string>Display category filter as toolbar instead of button panel (needs restart).</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>autoSearchCB</cstring>

View File

@ -98,6 +98,7 @@ void UIPrefsDialog::setFromPrefs()
pageLenSB->setValue(prefs.respagesize);
collapseDupsCB->setChecked(prefs.collapseDuplicates);
maxHLTSB->setValue(prefs.maxhltextmbs);
catgToolBarCB->setChecked(prefs.catgToolBar);
autoSearchCB->setChecked(prefs.autoSearchOnWS);
syntlenSB->setValue(prefs.syntAbsLen);
syntctxSB->setValue(prefs.syntAbsCtx);
@ -171,6 +172,7 @@ void UIPrefsDialog::setFromPrefs()
void UIPrefsDialog::accept()
{
prefs.autoSearchOnWS = autoSearchCB->isChecked();
prefs.catgToolBar = catgToolBarCB->isChecked();
prefs.respagesize = pageLenSB->value();
prefs.collapseDuplicates = collapseDupsCB->isChecked();
prefs.maxhltextmbs = maxHLTSB->value();