GUI: allow choosing a style sheet to be used by the recoll app
This commit is contained in:
parent
b5cfacb2f9
commit
7f57df250a
@ -3263,10 +3263,20 @@ while query.next >= 0 and query.next < nres:
|
|||||||
|
|
||||||
<para>Most of the parameters specific to the
|
<para>Most of the parameters specific to the
|
||||||
<command>recoll</command> GUI are set through the
|
<command>recoll</command> GUI are set through the
|
||||||
<guilabel>Preferences</guilabel> menu and stored in the
|
<guilabel>Preferences</guilabel> menu and stored in the standard Qt
|
||||||
standard Qt place (<filename>$HOME/.qt/recollrc</filename>).
|
place (<filename>$HOME/.config/Recoll.org/recoll.conf</filename>).
|
||||||
You probably do not want to edit this by hand.</para>
|
You probably do not want to edit this by hand.</para>
|
||||||
|
|
||||||
|
<note><para>One of these parameters is the name of a
|
||||||
|
<application>Qt</application> style sheet text file which is applied
|
||||||
|
to the whole Recoll application on startup. The default value is
|
||||||
|
empty, but there is a skeleton style sheet
|
||||||
|
(<filename>recoll.qss</filename>) inside the
|
||||||
|
<filename>/usr/share/recoll/examples</filename> directory. Using a
|
||||||
|
style sheet, you can change most Recoll graphical parameters: colors,
|
||||||
|
fonts, etc. See the sample file for a few simple examples.</para>
|
||||||
|
</note>
|
||||||
|
|
||||||
<para>&RCL; indexing options are set inside text configuration
|
<para>&RCL; indexing options are set inside text configuration
|
||||||
files located in a configuration directory. There can be
|
files located in a configuration directory. There can be
|
||||||
several such directories, each of which define the parameters
|
several such directories, each of which define the parameters
|
||||||
|
|||||||
@ -152,6 +152,7 @@ void rwSettings(bool writing)
|
|||||||
prefs.creslistformat = (const char*)prefs.reslistformat.toUtf8();
|
prefs.creslistformat = (const char*)prefs.reslistformat.toUtf8();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SETTING_RW(prefs.stylesheetFile, "/Recoll/prefs/stylesheet", String, "");
|
||||||
SETTING_RW(prefs.queryStemLang, "/Recoll/prefs/query/stemLang", String,
|
SETTING_RW(prefs.queryStemLang, "/Recoll/prefs/query/stemLang", String,
|
||||||
"english");
|
"english");
|
||||||
SETTING_RW(prefs.useDesktopOpen,
|
SETTING_RW(prefs.useDesktopOpen,
|
||||||
@ -330,7 +331,7 @@ void rwSettings(bool writing)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString myGetFileName(bool isdir, QString caption)
|
QString myGetFileName(bool isdir, QString caption, bool filenosave)
|
||||||
{
|
{
|
||||||
LOGDEB1(("myFileDialog: isdir %d\n", isdir));
|
LOGDEB1(("myFileDialog: isdir %d\n", isdir));
|
||||||
QFileDialog dialog(0, caption);
|
QFileDialog dialog(0, caption);
|
||||||
@ -340,7 +341,10 @@ QString myGetFileName(bool isdir, QString caption)
|
|||||||
dialog.setOptions(QFileDialog::ShowDirsOnly);
|
dialog.setOptions(QFileDialog::ShowDirsOnly);
|
||||||
} else {
|
} else {
|
||||||
dialog.setFileMode(QFileDialog::AnyFile);
|
dialog.setFileMode(QFileDialog::AnyFile);
|
||||||
dialog.setAcceptMode(QFileDialog::AcceptSave);
|
if (filenosave)
|
||||||
|
dialog.setAcceptMode(QFileDialog::AcceptOpen);
|
||||||
|
else
|
||||||
|
dialog.setAcceptMode(QFileDialog::AcceptSave);
|
||||||
}
|
}
|
||||||
dialog.setViewMode(QFileDialog::List);
|
dialog.setViewMode(QFileDialog::List);
|
||||||
QFlags<QDir::Filter> flags = QDir::NoDotAndDotDot | QDir::Hidden;
|
QFlags<QDir::Filter> flags = QDir::NoDotAndDotDot | QDir::Hidden;
|
||||||
@ -350,7 +354,6 @@ QString myGetFileName(bool isdir, QString caption)
|
|||||||
flags |= QDir::Dirs | QDir::Files;
|
flags |= QDir::Dirs | QDir::Files;
|
||||||
dialog.setFilter(flags);
|
dialog.setFilter(flags);
|
||||||
|
|
||||||
|
|
||||||
if (dialog.exec() == QDialog::Accepted) {
|
if (dialog.exec() == QDialog::Accepted) {
|
||||||
return dialog.selectedFiles().value(0);
|
return dialog.selectedFiles().value(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,6 +50,7 @@ class PrefsPack {
|
|||||||
string creslistformat;
|
string creslistformat;
|
||||||
// Abstract snippet separator
|
// Abstract snippet separator
|
||||||
QString abssep;
|
QString abssep;
|
||||||
|
QString stylesheetFile;
|
||||||
QString queryStemLang;
|
QString queryStemLang;
|
||||||
int mainwidth;
|
int mainwidth;
|
||||||
int mainheight;
|
int mainheight;
|
||||||
@ -136,6 +137,7 @@ extern QString g_stringAllStem, g_stringNoStem;
|
|||||||
|
|
||||||
/** Specialized version of the qt file dialog. Can't use getOpenFile()
|
/** Specialized version of the qt file dialog. Can't use getOpenFile()
|
||||||
etc. cause they hide dot files... */
|
etc. cause they hide dot files... */
|
||||||
extern QString myGetFileName(bool isdir, QString caption = QString());
|
extern QString myGetFileName(bool isdir, QString caption = QString(),
|
||||||
|
bool filenosave = false);
|
||||||
|
|
||||||
#endif /* _GUIUTILS_H_INCLUDED_ */
|
#endif /* _GUIUTILS_H_INCLUDED_ */
|
||||||
|
|||||||
@ -45,6 +45,8 @@
|
|||||||
#include "rclaspell.h"
|
#include "rclaspell.h"
|
||||||
#endif
|
#endif
|
||||||
#include "smallut.h"
|
#include "smallut.h"
|
||||||
|
#include "readfile.h"
|
||||||
|
|
||||||
#include "recollq.h"
|
#include "recollq.h"
|
||||||
|
|
||||||
RclConfig *theconfig;
|
RclConfig *theconfig;
|
||||||
@ -315,6 +317,13 @@ int main(int argc, char **argv)
|
|||||||
havereadsettings = true;
|
havereadsettings = true;
|
||||||
// fprintf(stderr, "Settings done\n");
|
// fprintf(stderr, "Settings done\n");
|
||||||
|
|
||||||
|
if (!prefs.stylesheetFile.isEmpty()) {
|
||||||
|
string stylesheet;
|
||||||
|
file_to_string((const char *)prefs.stylesheetFile.toLocal8Bit(),
|
||||||
|
stylesheet);
|
||||||
|
if (!stylesheet.empty())
|
||||||
|
app.setStyleSheet(QString::fromAscii(stylesheet.c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
// Create main window and set its size to previous session's
|
// Create main window and set its size to previous session's
|
||||||
RclMain w;
|
RclMain w;
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@ -61,19 +61,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="collapseDupsCB">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>If checked, results with the same content under different names will only be shown once.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Hide duplicate results.</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout">
|
<layout class="QHBoxLayout">
|
||||||
<item>
|
<item>
|
||||||
@ -201,6 +188,40 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="tLSTL">
|
||||||
|
<property name="text">
|
||||||
|
<string>Style sheet</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="stylesheetPB">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Opens a dialog to select the style sheet file</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Choose</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="resetSSPB">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Resets the style sheet to default</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Reset</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout">
|
<layout class="QHBoxLayout">
|
||||||
<item>
|
<item>
|
||||||
@ -323,6 +344,19 @@
|
|||||||
<string>Search parameters</string>
|
<string>Search parameters</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout">
|
<layout class="QVBoxLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="collapseDupsCB">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>If checked, results with the same content under different names will only be shown once.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Hide duplicate results.</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout">
|
<layout class="QVBoxLayout">
|
||||||
<item>
|
<item>
|
||||||
@ -342,6 +376,16 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="lineX">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::HLine</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Sunken</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="autoPhraseCB">
|
<widget class="QCheckBox" name="autoPhraseCB">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
|||||||
@ -57,6 +57,8 @@ void UIPrefsDialog::init()
|
|||||||
connect(viewActionPB, SIGNAL(clicked()), this, SLOT(showViewAction()));
|
connect(viewActionPB, SIGNAL(clicked()), this, SLOT(showViewAction()));
|
||||||
connect(reslistFontPB, SIGNAL(clicked()), this, SLOT(showFontDialog()));
|
connect(reslistFontPB, SIGNAL(clicked()), this, SLOT(showFontDialog()));
|
||||||
connect(resetFontPB, SIGNAL(clicked()), this, SLOT(resetReslistFont()));
|
connect(resetFontPB, SIGNAL(clicked()), this, SLOT(resetReslistFont()));
|
||||||
|
connect(stylesheetPB, SIGNAL(clicked()), this, SLOT(showStylesheetDialog()));
|
||||||
|
connect(resetSSPB, SIGNAL(clicked()), this, SLOT(resetStylesheet()));
|
||||||
|
|
||||||
connect(addExtraDbPB, SIGNAL(clicked()),
|
connect(addExtraDbPB, SIGNAL(clicked()),
|
||||||
this, SLOT(addExtraDbPB_clicked()));
|
this, SLOT(addExtraDbPB_clicked()));
|
||||||
@ -116,6 +118,16 @@ void UIPrefsDialog::setFromPrefs()
|
|||||||
reslistFontPB->setText(reslistFontFamily + "-" +
|
reslistFontPB->setText(reslistFontFamily + "-" +
|
||||||
s.setNum(reslistFontSize));
|
s.setNum(reslistFontSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Style sheet
|
||||||
|
stylesheetFile = prefs.stylesheetFile;
|
||||||
|
if (stylesheetFile.isEmpty()) {
|
||||||
|
stylesheetPB->setText(tr("Choose"));
|
||||||
|
} else {
|
||||||
|
string nm = path_getsimple((const char *)stylesheetFile.toLocal8Bit());
|
||||||
|
stylesheetPB->setText(QString::fromLocal8Bit(nm.c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
rlfTE->setPlainText(prefs.reslistformat);
|
rlfTE->setPlainText(prefs.reslistformat);
|
||||||
|
|
||||||
// Stemming language combobox
|
// Stemming language combobox
|
||||||
@ -185,11 +197,13 @@ void UIPrefsDialog::accept()
|
|||||||
|
|
||||||
prefs.reslistfontfamily = reslistFontFamily;
|
prefs.reslistfontfamily = reslistFontFamily;
|
||||||
prefs.reslistfontsize = reslistFontSize;
|
prefs.reslistfontsize = reslistFontSize;
|
||||||
|
prefs.stylesheetFile = stylesheetFile;
|
||||||
prefs.reslistformat = rlfTE->toPlainText();
|
prefs.reslistformat = rlfTE->toPlainText();
|
||||||
if (prefs.reslistformat.trimmed().isEmpty()) {
|
if (prefs.reslistformat.trimmed().isEmpty()) {
|
||||||
prefs.reslistformat = prefs.dfltResListFormat;
|
prefs.reslistformat = prefs.dfltResListFormat;
|
||||||
rlfTE->setPlainText(prefs.reslistformat);
|
rlfTE->setPlainText(prefs.reslistformat);
|
||||||
}
|
}
|
||||||
|
|
||||||
prefs.creslistformat = (const char*)prefs.reslistformat.toUtf8();
|
prefs.creslistformat = (const char*)prefs.reslistformat.toUtf8();
|
||||||
|
|
||||||
if (stemLangCMB->currentIndex() == 0) {
|
if (stemLangCMB->currentIndex() == 0) {
|
||||||
@ -289,6 +303,19 @@ void UIPrefsDialog::showFontDialog()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UIPrefsDialog::showStylesheetDialog()
|
||||||
|
{
|
||||||
|
stylesheetFile = myGetFileName(false, "Select stylesheet file", true);
|
||||||
|
string nm = path_getsimple((const char *)stylesheetFile.toLocal8Bit());
|
||||||
|
stylesheetPB->setText(QString::fromLocal8Bit(nm.c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void UIPrefsDialog::resetStylesheet()
|
||||||
|
{
|
||||||
|
stylesheetFile = "";
|
||||||
|
stylesheetPB->setText(tr("Choose"));
|
||||||
|
}
|
||||||
|
|
||||||
void UIPrefsDialog::resetReslistFont()
|
void UIPrefsDialog::resetReslistFont()
|
||||||
{
|
{
|
||||||
reslistFontFamily = "";
|
reslistFontFamily = "";
|
||||||
|
|||||||
@ -39,14 +39,17 @@ public:
|
|||||||
|
|
||||||
QString reslistFontFamily;
|
QString reslistFontFamily;
|
||||||
int reslistFontSize;
|
int reslistFontSize;
|
||||||
|
QString stylesheetFile;
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void showFontDialog();
|
virtual void showFontDialog();
|
||||||
|
virtual void resetReslistFont();
|
||||||
|
virtual void showStylesheetDialog();
|
||||||
|
virtual void resetStylesheet();
|
||||||
virtual void showViewAction();
|
virtual void showViewAction();
|
||||||
virtual void showViewAction(const QString& mt);
|
virtual void showViewAction(const QString& mt);
|
||||||
virtual void resetReslistFont();
|
|
||||||
virtual void addExtraDbPB_clicked();
|
virtual void addExtraDbPB_clicked();
|
||||||
virtual void delExtraDbPB_clicked();
|
virtual void delExtraDbPB_clicked();
|
||||||
virtual void togExtraDbPB_clicked();
|
virtual void togExtraDbPB_clicked();
|
||||||
|
|||||||
@ -117,6 +117,7 @@ ${INSTALL} -m 0444 \
|
|||||||
sampleconf/recoll.conf \
|
sampleconf/recoll.conf \
|
||||||
sampleconf/mimemap \
|
sampleconf/mimemap \
|
||||||
sampleconf/fields \
|
sampleconf/fields \
|
||||||
|
sampleconf/recoll.qss \
|
||||||
${datadir}/recoll/examples/ || exit 1
|
${datadir}/recoll/examples/ || exit 1
|
||||||
${INSTALL} -m 0755 index/rclmon.sh ${datadir}/recoll/examples/ || exit 1
|
${INSTALL} -m 0755 index/rclmon.sh ${datadir}/recoll/examples/ || exit 1
|
||||||
|
|
||||||
|
|||||||
44
src/sampleconf/recoll.qss
Normal file
44
src/sampleconf/recoll.qss
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/* Copyright (C) 2004 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
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the
|
||||||
|
* Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
This is an embryonic example Qt style sheet for Recoll. It is not really
|
||||||
|
supposed to be less ugly than the default look, it's just provided in
|
||||||
|
hope that someone with better taste will want to step in, or you can use
|
||||||
|
it to indulge your preference for bright red backgrounds...
|
||||||
|
|
||||||
|
If you do want to use it, and encounter a difficulty due to (lack of)
|
||||||
|
widget object names or whatever, please get in touch, I'll fix what
|
||||||
|
needs to be.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
* {
|
||||||
|
background: #eeeeee;
|
||||||
|
}
|
||||||
|
|
||||||
|
QComboBox[editable="true"], QTextEdit, QLineEdit, QTextBrowser, QTableView {
|
||||||
|
background: #ffffee;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Preview QTextEdit {
|
||||||
|
background: white;
|
||||||
|
font-family: Serif;
|
||||||
|
font-size: 12pt;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user