remember sort criteria

This commit is contained in:
dockes
2006-09-21 09:37:28 +00:00
parent e3f89dca7e
commit 34341eae24
8 changed files with 75 additions and 31 deletions
+6 -1
View File
@@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.19 2006-09-15 16:49:27 dockes Exp $ (C) 2005 Jean-Francois Dockes";
static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.20 2006-09-21 09:37:28 dockes Exp $ (C) 2005 Jean-Francois Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@@ -157,6 +157,11 @@ void rwSettings(bool writing)
SETTING_RW(prefs.syntAbsCtx, "/Recoll/prefs/query/syntAbsCtx",
Num, 4);
SETTING_RW(prefs.sortWidth, "/Recoll/prefs/query/sortWidth",
Num, 100);
SETTING_RW(prefs.sortSpec, "/Recoll/prefs/query/sortSpec",
Num, 0);
// Ssearch combobox history list
if (writing) {
settings.writeEntry("/Recoll/prefs/query/ssearchHistory",
+5 -1
View File
@@ -17,7 +17,7 @@
#ifndef _GUIUTILS_H_INCLUDED_
#define _GUIUTILS_H_INCLUDED_
/*
* @(#$Id: guiutils.h,v 1.11 2006-09-15 16:49:27 dockes Exp $ (C) 2005 Jean-Francois Dockes
* @(#$Id: guiutils.h,v 1.12 2006-09-21 09:37:28 dockes Exp $ (C) 2005 Jean-Francois Dockes
* jean-francois.dockes@wanadoo.fr
*
* This program is free software; you can redistribute it and/or modify
@@ -84,6 +84,10 @@ class PrefsPack {
int syntAbsLen;
int syntAbsCtx;
// Sort specs (sort_w.cpp knows how to deal with the values
int sortWidth;
int sortSpec;
PrefsPack() :
showicons(true),
respagesize(8),
+4 -4
View File
@@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.32 2006-09-13 13:53:35 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.33 2006-09-21 09:37:28 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@@ -368,8 +368,8 @@ void RclMain::showSortDialog()
sortform = new SortForm(0, tr("Sort criteria"), FALSE,
WStyle_Customize | WStyle_NormalBorder |
WStyle_Title | WStyle_SysMenu);
connect(sortform, SIGNAL(sortDataChanged(RclSortSpec)),
this, SLOT(sortDataChanged(RclSortSpec)));
connect(sortform, SIGNAL(sortDataChanged(DocSeqSortSpec)),
this, SLOT(sortDataChanged(DocSeqSortSpec)));
sortform->show();
} else {
// Close and reopen, in hope that makes us visible...
@@ -694,7 +694,7 @@ void RclMain::showDocHistory()
}
void RclMain::sortDataChanged(RclSortSpec spec)
void RclMain::sortDataChanged(DocSeqSortSpec spec)
{
LOGDEB(("RclMain::sortDataChanged\n"));
sortspecs = spec;
+2 -2
View File
@@ -55,7 +55,7 @@ public slots:
virtual void showAboutDialog();
virtual void startManual();
virtual void showDocHistory();
virtual void sortDataChanged(RclSortSpec spec);
virtual void sortDataChanged(DocSeqSortSpec spec);
virtual void showUIPrefs();
virtual void setUIPrefs();
virtual void enableNextPage(bool);
@@ -72,7 +72,7 @@ private:
AdvSearch *asearchform;
SortForm *sortform;
UIPrefsDialog *uiprefs;
RclSortSpec sortspecs;
DocSeqSortSpec sortspecs;
int m_searchId; // Serial number of current search for this process.
// Used to match to preview windows
virtual void init();
+43 -8
View File
@@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: sort_w.cpp,v 1.1 2006-09-04 15:13:01 dockes Exp $ (C) 2006 J.F.Dockes";
static char rcsid[] = "@(#$Id: sort_w.cpp,v 1.2 2006-09-21 09:37:28 dockes Exp $ (C) 2006 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@@ -25,6 +25,8 @@ static char rcsid[] = "@(#$Id: sort_w.cpp,v 1.1 2006-09-04 15:13:01 dockes Exp $
#include "sortseq.h"
#include "debuglog.h"
#include "guiutils.h"
#include "sort_w.h"
void SortForm::init()
@@ -35,8 +37,30 @@ void SortForm::init()
labels[2] = "Mime type";
labels[3] = 0;
fldCMB1->insertStrList(labels, 3);
fldCMB1->setCurrentItem(0);
fldCMB2->insertStrList(labels, 3); fldCMB2->setCurrentItem(0);
fldCMB2->insertStrList(labels, 3);
// Initialize values from prefs:
mcntSB->setValue(prefs.sortWidth);
unsigned int spec = (unsigned int)prefs.sortSpec;
// We use 4 bits per spec hi is direction, 3 low bits = sort field
unsigned int v, d;
v = spec & (0xf & ~(1<<3));
d = spec & (1 << 3);
spec >>= 4;
fldCMB1->setCurrentItem(v < 3 ? v : 0);
descCB1->setChecked(d!=0?true:false);
v = spec & (0xf & ~(1<<3));
d = spec & (1 << 3);
spec >>= 4;
fldCMB2->setCurrentItem(v < 3 ? v : 0);
descCB2->setChecked(d!=0?true:false);
// Always start with sort disabled
sortCB->setChecked(false);
// signals and slots connections
connect(resetPB, SIGNAL(clicked()), this, SLOT(reset()));
connect(closePB, SIGNAL(clicked()), this, SLOT(close()));
@@ -62,7 +86,7 @@ void SortForm::reset()
void SortForm::setData()
{
LOGDEB(("SortForm::setData\n"));
RclSortSpec spec;
DocSeqSortSpec spec;
mcntSB->setEnabled(sortCB->isChecked());
fldCMB1->setEnabled(sortCB->isChecked());
@@ -76,23 +100,34 @@ void SortForm::setData()
bool desc = descCB1->isChecked();
switch (fldCMB1->currentItem()) {
case 1:
spec.addCrit(RclSortSpec::RCLFLD_MTIME, desc?true:false);
spec.addCrit(DocSeqSortSpec::RCLFLD_MTIME, desc?true:false);
break;
case 2:
spec.addCrit(RclSortSpec::RCLFLD_MIMETYPE, desc?true:false);
spec.addCrit(DocSeqSortSpec::RCLFLD_MIMETYPE, desc?true:false);
break;
}
desc = descCB2->isChecked();
switch (fldCMB2->currentItem()) {
case 1:
spec.addCrit(RclSortSpec::RCLFLD_MTIME, desc?true:false);
spec.addCrit(DocSeqSortSpec::RCLFLD_MTIME, desc?true:false);
break;
case 2:
spec.addCrit(RclSortSpec::RCLFLD_MIMETYPE, desc?true:false);
spec.addCrit(DocSeqSortSpec::RCLFLD_MIMETYPE, desc?true:false);
break;
}
spec.sortwidth = mcntSB->value();
// Set data in prefs;
prefs.sortWidth = spec.sortwidth;
unsigned int spec = 0, v, d;
v = fldCMB1->currentItem() & 0x7;
d = descCB1->isChecked() ? 8 : 0;
spec |= (d|v);
v = fldCMB2->currentItem() & 0x7;
d = descCB2->isChecked() ? 8 : 0;
spec |= (d|v) << 4;
prefs.sortSpec = (int) spec;
}
emit sortDataChanged(spec);
}
+2 -2
View File
@@ -1,4 +1,4 @@
/* @(#$Id: sort_w.h,v 1.1 2006-09-04 15:13:01 dockes Exp $ (C) 2005 J.F.Dockes */
/* @(#$Id: sort_w.h,v 1.2 2006-09-21 09:37:28 dockes Exp $ (C) 2005 J.F.Dockes */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -39,7 +39,7 @@ public slots:
virtual void setData();
signals:
void sortDataChanged(RclSortSpec);
void sortDataChanged(DocSeqSortSpec);
private:
virtual void init();