gui: integrate table to main window

This commit is contained in:
Jean-Francois Dockes 2010-12-24 18:30:08 +01:00
parent 3bd39d893e
commit 829b4b3b4e
7 changed files with 69 additions and 11 deletions

View File

@ -117,6 +117,8 @@ void rwSettings(bool writing)
SETTING_RW(prefs.respagesize, "/Recoll/prefs/reslist/pagelen", Int, 8);
SETTING_RW(prefs.collapseDuplicates,
"/Recoll/prefs/reslist/collapseDuplicates", Bool, false);
SETTING_RW(prefs.showResultsAsTable,
"/Recoll/prefs/showResultsAsTable", Bool, false);
SETTING_RW(prefs.maxhltextmbs, "/Recoll/prefs/preview/maxhltextmbs", Int, 3);
SETTING_RW(prefs.qtermcolor, "/Recoll/prefs/qtermcolor", String, "blue");
if (!writing && prefs.qtermcolor == "")

View File

@ -79,6 +79,8 @@ class PrefsPack {
bool startWithAdvSearchOpen;
bool previewHtml;
bool collapseDuplicates;
bool showResultsAsTable;
// Extra query indexes. This are stored in the history file, not qt prefs
list<string> allExtraDbs;
list<string> activeExtraDbs;

BIN
src/qtgui/images/table.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -10,17 +10,32 @@
<height>600</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Recoll</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="margin">
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="SSearch" name="sSearch" native="true">
<property name="sizePolicy">
@ -34,7 +49,7 @@
<item>
<widget class="QGroupBox" name="catgBGRP">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -51,7 +66,7 @@
<x>0</x>
<y>0</y>
<width>45</width>
<height>29</height>
<height>20</height>
</rect>
</property>
<property name="text">
@ -103,6 +118,8 @@
<addaction name="separator"/>
<addaction name="actionSortByDateAsc"/>
<addaction name="actionSortByDateDesc"/>
<addaction name="separator"/>
<addaction name="actionShowResultsAsTable"/>
</widget>
<widget class="QMenuBar" name="MenuBar">
<property name="geometry">
@ -412,6 +429,21 @@
<string>Show Query Details</string>
</property>
</action>
<action name="actionShowResultsAsTable">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="recoll.qrc">
<normaloff>:/images/table.png</normaloff>:/images/table.png</iconset>
</property>
<property name="text">
<string>Show results as table</string>
</property>
<property name="toolTip">
<string>Show results as table</string>
</property>
</action>
</widget>
<layoutdefault spacing="2" margin="2"/>
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>

View File

@ -195,8 +195,14 @@ void RclMain::init()
actionSortByDateAsc->setChecked(true);
onSortCtlChanged();
}
restable = new ResTable(this);
verticalLayout->insertWidget(2, restable);
actionShowResultsAsTable->setChecked(prefs.showResultsAsTable);
on_actionShowResultsAsTable_toggled(prefs.showResultsAsTable);
restable = new ResTable();
// Must not do this when restable is a child of rclmain
// sc = new QShortcut(quitKeySeq, restable);
// connect(sc, SIGNAL (activated()), this, SLOT (fileExit()));
// A shortcut to get the focus back to the search entry.
QKeySequence seq("Ctrl+Shift+s");
@ -237,6 +243,7 @@ void RclMain::init()
this, SLOT(showUIPrefs()));
connect(extIdxAction, SIGNAL(activated()),
this, SLOT(showExtIdxDialog()));
if (prefs.catgToolBar && catgCMB)
connect(catgCMB, SIGNAL(activated(int)),
this, SLOT(catgFilter(int)));
@ -246,10 +253,6 @@ void RclMain::init()
this, SLOT(showQueryDetails()));
connect(periodictimer, SIGNAL(timeout()),
this, SLOT(periodic100()));
sc = new QShortcut(quitKeySeq, restable);
connect(sc, SIGNAL (activated()),
this, SLOT (fileExit()));
connect(this, SIGNAL(docSourceChanged(RefCntr<DocSequence>)),
restable, SLOT(setDocSource(RefCntr<DocSequence>)));
connect(this, SIGNAL(searchReset()),
@ -309,7 +312,6 @@ void RclMain::init()
// Start timer on a slow period (used for checking ^C). Will be
// speeded up during indexing
periodictimer->start(1000);
restable->show();
}
void RclMain::resultCount(int n)
@ -886,13 +888,31 @@ void RclMain::onSortCtlChanged()
void RclMain::onResTableSortBy(DocSeqSortSpec spec)
{
m_sortspecnochange = true;
actionSortByDateDesc->setChecked(false);
actionSortByDateAsc->setChecked(false);
if (spec.field.compare("mtime")) {
actionSortByDateDesc->setChecked(false);
actionSortByDateAsc->setChecked(false);
} else {
actionSortByDateDesc->setChecked(spec.desc);
actionSortByDateAsc->setChecked(!spec.desc);
}
m_sortspecnochange = false;
m_sortspec = spec;
emit applyFiltSortData();
}
void RclMain::on_actionShowResultsAsTable_toggled(bool on)
{
LOGDEB(("RclMain::on_actionShowResultsAsTable_toggled(%d)\n", int(on)));
prefs.showResultsAsTable = on;
if (on) {
restable->show();
reslist->hide();
} else {
restable->hide();
reslist->show();
}
}
void RclMain::on_actionSortByDateAsc_toggled(bool on)
{
LOGDEB(("RclMain::on_actionSortByDateAsc_toggled(%d)\n", int(on)));

View File

@ -95,6 +95,7 @@ public slots:
virtual void focusToSearch();
virtual void on_actionSortByDateAsc_toggled(bool on);
virtual void on_actionSortByDateDesc_toggled(bool on);
virtual void on_actionShowResultsAsTable_toggled(bool on);
virtual void onResTableSortBy(DocSeqSortSpec);
virtual void resultCount(int);
virtual void showQueryDetails();

View File

@ -9,6 +9,7 @@
<file>images/firstpage.png</file>
<file>images/sortparms.png</file>
<file>images/spell.png</file>
<file>images/table.png</file>
<file>images/up.png</file>
<file>images/down.png</file>
</qresource>