diff --git a/src/qtgui/guiutils.cpp b/src/qtgui/guiutils.cpp index 927cff29..a501ae35 100644 --- a/src/qtgui/guiutils.cpp +++ b/src/qtgui/guiutils.cpp @@ -427,7 +427,7 @@ void rwSettings(bool writing) } #ifdef USE_REGEX -/* font-size: 10pt; */ +/* font-size: 10px; */ static const std::string fntsz_exp( R"((\s*font-size\s*:\s*)([0-9]+)(p[tx]\s*;\s*))" ); @@ -463,24 +463,6 @@ std::string PrefsPack::scaleFonts(const std::string& style, float multiplier) return nstyle; } -int PrefsPack::fontsize() -{ - // While building the kio, we don't really care about QT Gui - // defaults and referencing QFont introduces a useless dependency -#ifdef BUILDING_RECOLLGUI - int fs; - if (prefs.reslistfontsize > 0) { - fs = prefs.reslistfontsize; - } else { - fs = QWidget().font().pixelSize(); - } - fs = round(fs * prefs.wholeuiscale); - return fs; -#else - return 12; -#endif -} - std::string PrefsPack::htmlHeaderContents() { auto comfn = path_cat(path_cat(theconfig->getDatadir(), "examples"), "recoll-common.css"); @@ -489,13 +471,10 @@ std::string PrefsPack::htmlHeaderContents() std::ostringstream oss; oss << comcss << "\n"; oss << "\n"; oss << qs2utf8s(prefs.darkreslistheadertext) << qs2utf8s(prefs.reslistheadertext); diff --git a/src/qtgui/guiutils.h b/src/qtgui/guiutils.h index 623d1b39..497e5b5b 100644 --- a/src/qtgui/guiutils.h +++ b/src/qtgui/guiutils.h @@ -51,10 +51,6 @@ public: int maxhltextkbs; QString reslistfontfamily; int reslistfontsize; - // Not saved in prefs for now. Computed from qt defaults and used to - // set main character color for webkit/textbrowser reslist and - // snippets window. - QString fontcolor; QString qtermstyle; // CSS style for query terms in reslist and other places // Result list format string QString reslistformat; @@ -190,7 +186,6 @@ public: // Scale font-sizes inside css or qss input and return changed sheet. The font-size statements // need to be on their own line. static std::string scaleFonts(const std::string& style, float multiplier); - int fontsize(); }; /** Global preferences record */ diff --git a/src/qtgui/rclmain_w.cpp b/src/qtgui/rclmain_w.cpp index 3f67d34f..39c29706 100644 --- a/src/qtgui/rclmain_w.cpp +++ b/src/qtgui/rclmain_w.cpp @@ -318,7 +318,9 @@ void RclMain::zoomIn() } void RclMain::zoomOut() { - prefs.reslistfontsize--; + if (prefs.reslistfontsize > 1) { + prefs.reslistfontsize--; + } emit uiPrefsChanged(); } diff --git a/src/qtgui/recoll.pro.in b/src/qtgui/recoll.pro.in index 9647b789..358e0a48 100644 --- a/src/qtgui/recoll.pro.in +++ b/src/qtgui/recoll.pro.in @@ -5,11 +5,6 @@ VPATH = @srcdir@ DEFINES += BUILDING_RECOLL DEFINES += BUILDING_RECOLLGUI -# Decide if we set font family and style with a css section in the html
or with qwebsettings -# setfont... calls. We used to do it with websettings because it gave a faster redisplay, and the -# css has a tendancy to not find some system fonts. We currently do it with css anyway. -DEFINES += SETFONT_WITH_HEADSTYLE=1 - @QMAKE_ENABLE_WEBKIT@ QT += webkit @QMAKE_ENABLE_WEBKIT@ DEFINES += USING_WEBKIT diff --git a/src/qtgui/reslist.cpp b/src/qtgui/reslist.cpp index 575d4d1d..e4a42c53 100644 --- a/src/qtgui/reslist.cpp +++ b/src/qtgui/reslist.cpp @@ -409,23 +409,13 @@ void ResList::runJS(const QString& js) void ResList::onUiPrefsChanged() { setFont(); + displayPage(); } void ResList::setFont() { -#if defined(USING_WEBKIT) || defined(USING_WEBENGINE) -#ifndef SETFONT_WITH_HEADSTYLE - if (prefs.reslistfontfamily != "") { - // For some reason there is (12-2014) an offset of 3 between what - // we request from webkit and what we get. - settings()->setFontSize(QWEBSETTINGS::DefaultFontSize, prefs.reslistfontsize + 3); - settings()->setFontFamily(QWEBSETTINGS::StandardFont, prefs.reslistfontfamily); - } else { - settings()->setFontSize(QWEBSETTINGS::DefaultFontSize, prefs.reslistfontsize + 3); - settings()->resetFontFamily(QWEBSETTINGS::StandardFont); - } -#endif -#else +#if !defined(USING_WEBKIT) && !defined(USING_WEBENGINE) + // Using QTextBrowser if (prefs.reslistfontfamily != "") { QFont nfont(prefs.reslistfontfamily, prefs.reslistfontsize); QTextBrowser::setFont(nfont); diff --git a/src/qtgui/restable.cpp b/src/qtgui/restable.cpp index 3fba08cb..0ea206f5 100644 --- a/src/qtgui/restable.cpp +++ b/src/qtgui/restable.cpp @@ -67,8 +67,8 @@ static const QKeySequence closeKeySeq("Ctrl+w"); static const int ROWHEIGHTPAD = 2; static const int TEXTINCELLVTRANS = -4; -// Adjust font size from prefs, display is slightly different here -static const int fsadjustdetail = 1; +// Adjust font size from prefs, display is slightly different in the table?? +static const int fsadjustdetail = -1; static PlainToRichQtReslist g_hiliter; @@ -92,9 +92,7 @@ public: virtual string absSep() override { return (const char *)(prefs.abssep.toUtf8());} virtual string headerContent() override { - // Note: the detail area is a qtextbrowser which gets confused by the general Html - // header. So we manage it differently from the snippets or main result list. - return qs2utf8s(prefs.darkreslistheadertext) + qs2utf8s(prefs.reslistheadertext); + return prefs.htmlHeaderContents(); } private: ResTable *m_parent; @@ -156,13 +154,13 @@ void ResTableDetailArea::createPopupMenu(const QPoint& pos) void ResTableDetailArea::setFont() { - int fs = prefs.fontsize() - fsadjustdetail; + int fs = m_table->fontsize(); if (prefs.reslistfontfamily != "") { QFont nfont(prefs.reslistfontfamily, fs); QTextBrowser::setFont(nfont); } else { QFont font; - font.setPointSize(fs); + font.setPixelSize(fs); QTextBrowser::setFont(font); } } @@ -390,8 +388,8 @@ QVariant RecollModel::data(const QModelIndex& index, int role) const // this to adjust the row height (there is probably a better way // to do it in the delegate?) if (role == Qt::FontRole && (prefs.reslistfontsize > 0 || prefs.wholeuiscale != 1.0)) { - if (m_reslfntszforcached != prefs.fontsize() - fsadjustdetail) { - m_reslfntszforcached = prefs.fontsize() - fsadjustdetail; + if (m_reslfntszforcached != m_table->fontsize() - fsadjustdetail) { + m_reslfntszforcached = m_table->fontsize() - fsadjustdetail; m_table->setDefRowHeight(); m_cachedfont = m_table->font(); m_cachedfont.setPixelSize(m_reslfntszforcached); @@ -533,13 +531,11 @@ public: QString color = opt.palette.color(QPalette::Base).name(); QString textcolor = opt.palette.color(QPalette::Text).name(); QString selcolor = opt.palette.color(QPalette::Highlight).name(); - QString seltextcolor = - opt.palette.color(QPalette::HighlightedText).name(); + QString seltextcolor = opt.palette.color(QPalette::HighlightedText).name(); QString fstyle; - if (prefs.reslistfontsize > 0 || prefs.wholeuiscale != 1.0) { - int fs = prefs.fontsize() - fsadjustdetail; - fstyle = QString("font-size: %1pt").arg(fs); - } + QFont fnt = qvariant_cast