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.respagesize, "/Recoll/prefs/reslist/pagelen", Int, 8);
SETTING_RW(prefs.collapseDuplicates, SETTING_RW(prefs.collapseDuplicates,
"/Recoll/prefs/reslist/collapseDuplicates", Bool, false); "/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.maxhltextmbs, "/Recoll/prefs/preview/maxhltextmbs", Int, 3);
SETTING_RW(prefs.qtermcolor, "/Recoll/prefs/qtermcolor", String, "blue"); SETTING_RW(prefs.qtermcolor, "/Recoll/prefs/qtermcolor", String, "blue");
if (!writing && prefs.qtermcolor == "") if (!writing && prefs.qtermcolor == "")

View File

@ -79,6 +79,8 @@ class PrefsPack {
bool startWithAdvSearchOpen; bool startWithAdvSearchOpen;
bool previewHtml; bool previewHtml;
bool collapseDuplicates; bool collapseDuplicates;
bool showResultsAsTable;
// Extra query indexes. This are stored in the history file, not qt prefs // Extra query indexes. This are stored in the history file, not qt prefs
list<string> allExtraDbs; list<string> allExtraDbs;
list<string> activeExtraDbs; 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> <height>600</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>Recoll</string> <string>Recoll</string>
</property> </property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing"> <property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>2</number> <number>2</number>
</property> </property>
<property name="margin"> <property name="rightMargin">
<number>4</number> <number>4</number>
</property> </property>
<property name="bottomMargin">
<number>2</number>
</property>
<item> <item>
<widget class="SSearch" name="sSearch" native="true"> <widget class="SSearch" name="sSearch" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
@ -34,7 +49,7 @@
<item> <item>
<widget class="QGroupBox" name="catgBGRP"> <widget class="QGroupBox" name="catgBGRP">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -51,7 +66,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>45</width> <width>45</width>
<height>29</height> <height>20</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
@ -103,6 +118,8 @@
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionSortByDateAsc"/> <addaction name="actionSortByDateAsc"/>
<addaction name="actionSortByDateDesc"/> <addaction name="actionSortByDateDesc"/>
<addaction name="separator"/>
<addaction name="actionShowResultsAsTable"/>
</widget> </widget>
<widget class="QMenuBar" name="MenuBar"> <widget class="QMenuBar" name="MenuBar">
<property name="geometry"> <property name="geometry">
@ -412,6 +429,21 @@
<string>Show Query Details</string> <string>Show Query Details</string>
</property> </property>
</action> </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> </widget>
<layoutdefault spacing="2" margin="2"/> <layoutdefault spacing="2" margin="2"/>
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction> <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>

View File

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

View File

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

View File

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