GUI: reapply stylesheet when changed

This commit is contained in:
Jean-Francois Dockes 2012-03-25 08:59:07 +02:00
parent 1912ecd452
commit 247435084c
9 changed files with 58 additions and 31 deletions

View File

@ -173,6 +173,19 @@ static void sigcleanup(int)
exit(1);
}
void applyStyleSheet(const QString& ssfname)
{
const char *cfname = (const char *)ssfname.toLocal8Bit();
LOGDEB0(("Applying style sheet: [%s]\n", cfname));
if (cfname && *cfname) {
string stylesheet;
file_to_string(cfname, stylesheet);
qApp->setStyleSheet(QString::fromAscii(stylesheet.c_str()));
} else {
qApp->setStyleSheet(QString());
}
}
extern void qInitImages_recoll();
static const char *thisprog;
@ -316,11 +329,7 @@ int main(int argc, char **argv)
// 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()));
applyStyleSheet(prefs.stylesheetFile);
}
// Create main window and set its size to previous session's

View File

@ -954,7 +954,7 @@ void RclMain::showRTITool(bool modal)
void RclMain::showUIPrefs()
{
if (uiprefs == 0) {
uiprefs = new UIPrefsDialog(0);
uiprefs = new UIPrefsDialog(this);
connect(new QShortcut(quitKeySeq, uiprefs), SIGNAL (activated()),
this, SLOT (fileExit()));
connect(uiprefs, SIGNAL(uiprefsDone()), this, SLOT(setUIPrefs()));
@ -970,7 +970,7 @@ void RclMain::showUIPrefs()
void RclMain::showExtIdxDialog()
{
if (uiprefs == 0) {
uiprefs = new UIPrefsDialog(0);
uiprefs = new UIPrefsDialog(this);
connect(new QShortcut(quitKeySeq, uiprefs), SIGNAL (activated()),
this, SLOT (fileExit()));
connect(uiprefs, SIGNAL(uiprefsDone()), this, SLOT(setUIPrefs()));
@ -1822,3 +1822,8 @@ bool RclMain::eventFilter(QObject *, QEvent *event)
}
return false;
}
void RclMain::applyStyleSheet()
{
::applyStyleSheet(prefs.stylesheetFile);
}

View File

@ -132,6 +132,7 @@ public slots:
virtual void onSortDataChanged(DocSeqSortSpec);
virtual void resultCount(int);
virtual void showQueryDetails();
virtual void applyStyleSheet();
signals:
void docSourceChanged(RefCntr<DocSequence>);

View File

@ -22,6 +22,8 @@
#include "rcldb.h"
#include "ptmutex.h"
#include <QString>
// Misc declarations in need of sharing between the UI files
// Open the database if needed. We now force a close/open by default
@ -42,6 +44,8 @@ extern Rcl::Db *rcldb;
extern int recollNeedsExit;
extern void startManual(const string& helpindex);
extern void applyStyleSheet(const QString&);
#ifdef RCL_USE_ASPELL
class Aspell;
extern Aspell *aspell;

View File

@ -40,6 +40,7 @@
#include <qwhatsthis.h>
#include <qtextedit.h>
#include <qlist.h>
#include <QTimer>
#include "recoll.h"
#include "guiutils.h"
@ -50,6 +51,7 @@
#include "viewaction_w.h"
#include "debuglog.h"
#include "editdialog.h"
#include "rclmain_w.h"
void UIPrefsDialog::init()
{
@ -204,6 +206,7 @@ void UIPrefsDialog::accept()
prefs.reslistfontfamily = reslistFontFamily;
prefs.reslistfontsize = reslistFontSize;
prefs.stylesheetFile = stylesheetFile;
QTimer::singleShot(0, m_mainWindow, SLOT(applyStyleSheet()));
prefs.reslistformat = paraFormat;
prefs.reslistheadertext = headerText;
if (prefs.reslistformat.trimmed().isEmpty()) {

View File

@ -23,14 +23,15 @@
class QDialog;
class ViewAction;
class RclMain;
class UIPrefsDialog : public QDialog, public Ui::uiPrefsDialogBase
{
Q_OBJECT
public:
UIPrefsDialog(QDialog* parent = 0)
: QDialog(parent)
UIPrefsDialog(RclMain* parent)
: QDialog((QWidget*)parent), m_mainWindow(parent)
{
setupUi(this);
init();
@ -71,7 +72,7 @@ private:
QString headerText;
void setFromPrefs();
ViewAction *m_viewAction;
RclMain *m_mainWindow;
};
#endif /* _UIPREFS_W_H_INCLUDED_ */

View File

@ -35,9 +35,11 @@
supposedly fixed in later versions. Bugs listed in the
topmost section may also exist in older versions.</i></p>
<h2><a name="b_latest">recoll 1.16.2</a></h2>
<h2><a name="b_latest">recoll 1.17.0</a></h2>
<ul>
<li>The application style sheet is not reapplied when changed
from the preferences menu, you have to restart the GUI.</li>
<li>It will sometimes happen that the result list paragraph format
stored in the Qt preferences file will get garbled,
causing result lists with no displayed paragraphs (the
@ -45,31 +47,33 @@
mode, but not in list mode). The workaround is to go to
<blockquote>
Preferences->Query configuration->User interface
</blockquote>
and erase the result paragraph format string (^A DEL in the text area),
this will reset the string to the default value.</li>
</blockquote> and erase the result paragraph format string
(^A DEL in the text area), this will reset the string to the
default value.</li>
<li>Real time indexer: when running with gamin on FreeBSD, the
indexer can deadlock in the gamin dialog in some
cases.</li>
<li>Real time indexer: file move events are not detected when
running with inotify (at least for recent
versions). Workaround: restart indexer from time to time.</li>
<li>Real time indexer: directory moves are not handled at
all. Workaround: restart indexer from time to time.</li>
<li>Cancelling a preview in the GUI will also cancel the indexing
thread if it is running.</li>
<li>After an upgrade, the recoll GUI sometimes crashes on
startup. This is fixed by removing (back it up just in case)
~/.config/Recoll.org/recoll.conf, the QSettings storage for
recoll.</li>
</ul>
<h2><a name="b_1_16_2">recoll 1.16.2</a></h2>
<li>Real time indexer: directory moves are not handled at
all. Workaround: restart indexer from time to time.</li>
<li>Real time indexer: file move events are not detected when
running with inotify (at least for recent
versions). Workaround: restart indexer from time to time.</li>
<li>Cancelling a preview in the GUI will also cancel the indexing
thread if it is running.</li>
<li>Under Solaris, it is necessary to perform the initial
indexing with the recollindex program. For some unknown reason,
the recoll index thread does not work for creating the database.
The only idea I have is a problem with exception handling (recoll
catches an exception while trying the yet inexistant db).</li>
</ul>
<h2><a name="b_1_16_1">recoll 1.16.1</a></h2>
<ul>

View File

@ -360,7 +360,7 @@ I now use the OpenSUSE build service to create Recoll OpenSUSE packages.
<h2><a name="translations">Translations</a></h2>
<p>Most of the translations for 1.16 are incomplete
<p>Most of the translations for 1.17 are incomplete
The source translation files are included in the source
release. If your language has some english messages left and
you want to take a shot at fixing the problem, you can send

View File

@ -78,6 +78,12 @@
<ul>
<li>GUI/config: new set of dialogs to set up the indexing
schedule, either as automatic real time indexing started
with the user session or as discrete cron entries. This
will take care of the details of autostart files or crontab
editing.</li>
<li>Search: Recoll now supports filtering on file sizes. This
is accessible from the advanced search panel, or from the
query langage (ie: "size&gt;10k&nbsp;size&lt;1m"). For
@ -111,12 +117,6 @@
filtering on file dates and sizes, and has been split into two
tabs: for search terms, and for filtering.</li>
<li>GUI/config: new set of dialogs to set up the indexing
schedule, either as automatic real time indexing started
with the user session or as discrete cron entries. This
will take care of the details of autostart files or crontab
editing.</li>
<li>GUI: use Shift+PageUp instead of Shift+Home to rewind the
result list to the first page. Shift+Home is useful in the
search entry.</li>