diff --git a/resources/desktop/com.github.rssguard.appdata.xml b/resources/desktop/com.github.rssguard.appdata.xml index e2ccf00e8..022aa4ad4 100755 --- a/resources/desktop/com.github.rssguard.appdata.xml +++ b/resources/desktop/com.github.rssguard.appdata.xml @@ -30,7 +30,7 @@ https://martinrotter.github.io/donate/ - + none diff --git a/resources/text/CHANGELOG b/resources/text/CHANGELOG index 351a3b2b9..354238539 100644 --- a/resources/text/CHANGELOG +++ b/resources/text/CHANGELOG @@ -1,3 +1,12 @@ +3.5.9 +————— + +Added: +▪ Font in message and feed lists is now changeable, including its size. (#187) + +Fixed: +▪ Broken backward compatibility to Qt 5.7. + 3.5.8 ————— diff --git a/src/core/feedsmodel.cpp b/src/core/feedsmodel.cpp index e359153ef..597229e59 100755 --- a/src/core/feedsmodel.cpp +++ b/src/core/feedsmodel.cpp @@ -47,7 +47,6 @@ FeedsModel::FeedsModel(QObject* parent) : QAbstractItemModel(parent), m_itemHeig << /*: Feed list header "counts" column tooltip.*/ tr("Counts of unread/all mesages."); setupFonts(); - updateItemHeight(); } FeedsModel::~FeedsModel() { @@ -466,12 +465,14 @@ void FeedsModel::onItemDataChanged(const QList& items) { } void FeedsModel::setupFonts() { - m_normalFont = Application::font("FeedsView"); + QFont fon; + + fon.fromString(qApp->settings()->value(GROUP(Feeds), Feeds::ListFont, Application::font("FeedsView").toString()).toString()); + + m_normalFont = fon; m_boldFont = m_normalFont; m_boldFont.setBold(true); -} -void FeedsModel::updateItemHeight() { m_itemHeight = qApp->settings()->value(GROUP(GUI), SETTING(GUI::HeightRowFeeds)).toInt(); if (m_itemHeight > 0) { diff --git a/src/core/feedsmodel.h b/src/core/feedsmodel.h index 9788886e6..684b52df9 100755 --- a/src/core/feedsmodel.h +++ b/src/core/feedsmodel.h @@ -17,7 +17,7 @@ class FeedsModel : public QAbstractItemModel { Q_OBJECT public: - explicit FeedsModel(QObject* parent = 0); + explicit FeedsModel(QObject* parent = nullptr); virtual ~FeedsModel(); // Model implementation. @@ -86,6 +86,8 @@ class FeedsModel : public QAbstractItemModel { // Access to root item. RootItem* rootItem() const; + void setupFonts(); + public slots: void loadActivatedServiceAccounts(); @@ -151,10 +153,6 @@ class FeedsModel : public QAbstractItemModel { // NOTE: View will probably expand dropped index. void requireItemValidationAfterDragDrop(const QModelIndex& source_index); - private: - void updateItemHeight(); - void setupFonts(); - private: RootItem* m_rootItem; int m_itemHeight; diff --git a/src/core/messagesmodel.cpp b/src/core/messagesmodel.cpp index 1fe95d31f..614195ead 100755 --- a/src/core/messagesmodel.cpp +++ b/src/core/messagesmodel.cpp @@ -22,7 +22,6 @@ MessagesModel::MessagesModel(QObject* parent) setupIcons(); setupHeaderData(); updateDateFormat(); - updateItemHeight(); loadMessages(nullptr); } @@ -37,17 +36,6 @@ void MessagesModel::setupIcons() { m_enclosuresIcon = qApp->icons()->fromTheme(QSL("mail-attachment")); } -void MessagesModel::updateItemHeight() { - m_itemHeight = qApp->settings()->value(GROUP(GUI), SETTING(GUI::HeightRowMessages)).toInt(); - - if (m_itemHeight > 0) { - m_boldFont.setPixelSize(int(m_itemHeight * 0.6)); - m_normalFont.setPixelSize(int(m_itemHeight * 0.6)); - m_boldStrikedFont.setPixelSize(int(m_itemHeight * 0.6)); - m_normalStrikedFont.setPixelSize(int(m_itemHeight * 0.6)); - } -} - void MessagesModel::repopulate() { m_cache->clear(); setQuery(selectStatement(), m_db); @@ -68,13 +56,26 @@ bool MessagesModel::setData(const QModelIndex& index, const QVariant& value, int } void MessagesModel::setupFonts() { - m_normalFont = Application::font("MessagesView"); + QFont fon; + + fon.fromString(qApp->settings()->value(GROUP(Messages), Messages::ListFont, Application::font("MessagesView").toString()).toString()); + + m_normalFont = fon; m_boldFont = m_normalFont; m_boldFont.setBold(true); m_normalStrikedFont = m_normalFont; m_boldStrikedFont = m_boldFont; m_normalStrikedFont.setStrikeOut(true); m_boldStrikedFont.setStrikeOut(true); + + m_itemHeight = qApp->settings()->value(GROUP(GUI), SETTING(GUI::HeightRowMessages)).toInt(); + + if (m_itemHeight > 0) { + m_boldFont.setPixelSize(int(m_itemHeight * 0.6)); + m_normalFont.setPixelSize(int(m_itemHeight * 0.6)); + m_boldStrikedFont.setPixelSize(int(m_itemHeight * 0.6)); + m_normalStrikedFont.setPixelSize(int(m_itemHeight * 0.6)); + } } void MessagesModel::loadMessages(RootItem* item) { diff --git a/src/core/messagesmodel.h b/src/core/messagesmodel.h index 28ab333df..f1d650321 100755 --- a/src/core/messagesmodel.h +++ b/src/core/messagesmodel.h @@ -29,7 +29,7 @@ class MessagesModel : public QSqlQueryModel, public MessagesModelSqlLayer { }; // Constructors and destructors. - explicit MessagesModel(QObject* parent = 0); + explicit MessagesModel(QObject* parent = nullptr); virtual ~MessagesModel(); // Fetches ALL available data to the model. @@ -50,6 +50,7 @@ class MessagesModel : public QSqlQueryModel, public MessagesModelSqlLayer { RootItem* loadedItem() const; + void setupFonts(); void updateDateFormat(); void reloadWholeLayout(); @@ -77,9 +78,7 @@ class MessagesModel : public QSqlQueryModel, public MessagesModelSqlLayer { bool setMessageReadById(int id, RootItem::ReadStatus read); private: - void updateItemHeight(); void setupHeaderData(); - void setupFonts(); void setupIcons(); MessagesModelCache* m_cache; diff --git a/src/gui/feedmessageviewer.cpp b/src/gui/feedmessageviewer.cpp index fb8ac28ff..3288c3d62 100755 --- a/src/gui/feedmessageviewer.cpp +++ b/src/gui/feedmessageviewer.cpp @@ -58,7 +58,8 @@ FeedMessageViewer::FeedMessageViewer(QWidget* parent) : TabContent(parent), m_to initialize(); initializeViews(); - loadMessageViewerFonts(); + + //loadMessageViewerFonts(); createConnections(); } @@ -122,6 +123,8 @@ void FeedMessageViewer::loadSize() { void FeedMessageViewer::loadMessageViewerFonts() { m_messagesBrowser->reloadFontSettings(); + m_messagesView->reloadFontSettings(); + m_feedsView->reloadFontSettings(); } bool FeedMessageViewer::areToolBarsEnabled() const { diff --git a/src/gui/feedsview.cpp b/src/gui/feedsview.cpp index a50841ca3..d45360b03 100755 --- a/src/gui/feedsview.cpp +++ b/src/gui/feedsview.cpp @@ -50,6 +50,10 @@ FeedsView::~FeedsView() { qDebug("Destroying FeedsView instance."); } +void FeedsView::reloadFontSettings() { + m_sourceModel->setupFonts(); +} + void FeedsView::setSortingEnabled(bool enable) { disconnect(header(), &QHeaderView::sortIndicatorChanged, this, &FeedsView::saveSortState); QTreeView::setSortingEnabled(enable); diff --git a/src/gui/feedsview.h b/src/gui/feedsview.h index 344ef34ea..f57d15735 100755 --- a/src/gui/feedsview.h +++ b/src/gui/feedsview.h @@ -19,7 +19,7 @@ class FeedsView : public QTreeView { public: // Constructors and destructors. - explicit FeedsView(QWidget* parent = 0); + explicit FeedsView(QWidget* parent = nullptr); virtual ~FeedsView(); // Fundamental accessors. @@ -31,6 +31,8 @@ class FeedsView : public QTreeView { return m_sourceModel; } + void reloadFontSettings(); + void setSortingEnabled(bool enable); // Returns list of selected/all feeds. diff --git a/src/gui/messagesview.cpp b/src/gui/messagesview.cpp index 3be6269ef..81d5276ab 100755 --- a/src/gui/messagesview.cpp +++ b/src/gui/messagesview.cpp @@ -49,12 +49,18 @@ MessagesView::MessagesView(QWidget* parent) : QTreeView(parent), m_contextMenu(n TreeViewColumnsMenu mm(header()); mm.exec(header()->mapToGlobal(point)); }); + + reloadFontSettings(); } MessagesView::~MessagesView() { qDebug("Destroying MessagesView instance."); } +void MessagesView::reloadFontSettings() { + m_sourceModel->setupFonts(); +} + void MessagesView::sort(int column, Qt::SortOrder order, bool repopulate_data, bool change_header, bool emit_changed_from_header) { if (change_header && !emit_changed_from_header) { header()->blockSignals(true); diff --git a/src/gui/messagesview.h b/src/gui/messagesview.h index 660b4c99d..65ecff94e 100755 --- a/src/gui/messagesview.h +++ b/src/gui/messagesview.h @@ -16,7 +16,7 @@ class MessagesView : public QTreeView { Q_OBJECT public: - explicit MessagesView(QWidget* parent = 0); + explicit MessagesView(QWidget* parent = nullptr); virtual ~MessagesView(); // Model accessors. @@ -28,6 +28,8 @@ class MessagesView : public QTreeView { return m_sourceModel; } + void reloadFontSettings(); + public slots: void keyboardSearch(const QString& search); diff --git a/src/gui/settings/settingsfeedsmessages.cpp b/src/gui/settings/settingsfeedsmessages.cpp index 339bfb4a8..b7a415dd0 100755 --- a/src/gui/settings/settingsfeedsmessages.cpp +++ b/src/gui/settings/settingsfeedsmessages.cpp @@ -57,7 +57,18 @@ SettingsFeedsMessages::SettingsFeedsMessages(Settings* settings, QWidget* parent connect(m_ui->m_cmbCountsFeedList, &QComboBox::currentTextChanged, this, &SettingsFeedsMessages::dirtifySettings); connect(m_ui->m_cmbCountsFeedList, static_cast(&QComboBox::currentIndexChanged), this, &SettingsFeedsMessages::dirtifySettings); - connect(m_ui->m_btnChangeMessagesFont, &QPushButton::clicked, this, &SettingsFeedsMessages::changeMessagesFont); + + connect(m_ui->m_btnChangeMessagesFont, &QPushButton::clicked, this, [&]() { + changeFont(*m_ui->m_lblMessagesFont); + }); + + connect(m_ui->m_btnChangeFeedListFont, &QPushButton::clicked, this, [&]() { + changeFont(*m_ui->m_lblFeedListFont); + }); + + connect(m_ui->m_btnChangeMessageListFont, &QPushButton::clicked, this, [&]() { + changeFont(*m_ui->m_lblMessageListFont); + }); if (!m_ui->m_spinFeedUpdateTimeout->suffix().startsWith(' ')) { m_ui->m_spinFeedUpdateTimeout->setSuffix(QSL(" ") + m_ui->m_spinFeedUpdateTimeout->suffix()); @@ -88,14 +99,14 @@ void SettingsFeedsMessages::initializeMessageDateFormats() { } } -void SettingsFeedsMessages::changeMessagesFont() { +void SettingsFeedsMessages::changeFont(QLabel& lbl) { bool ok; - QFont new_font = QFontDialog::getFont(&ok, m_ui->m_lblMessagesFont->font(), - this, tr("Select new font for message viewer"), + QFont new_font = QFontDialog::getFont(&ok, lbl.font(), + this, tr("Select new font"), QFontDialog::DontUseNativeDialog); if (ok) { - m_ui->m_lblMessagesFont->setFont(new_font); + lbl.setFont(new_font); dirtifySettings(); } } @@ -129,12 +140,28 @@ void SettingsFeedsMessages::loadSettings() { m_ui->m_cmbMessagesDateTimeFormat->setCurrentIndex(index_format); } - m_ui->m_lblMessagesFont->setText(tr("Font preview")); QFont fon; fon.fromString(settings()->value(GROUP(Messages), SETTING(Messages::PreviewerFontStandard)).toString()); m_ui->m_lblMessagesFont->setFont(fon); + + QFont fon2; + + // Keep in sync with void MessagesModel::setupFonts(). + fon2.fromString(settings()->value(GROUP(Messages), + Messages::ListFont, + Application::font("MessagesView").toString()).toString()); + m_ui->m_lblMessageListFont->setFont(fon2); + + QFont fon3; + + // Keep in sync with void FeedsModel::setupFonts(). + fon3.fromString(settings()->value(GROUP(Feeds), + Feeds::ListFont, + Application::font("FeedsView").toString()).toString()); + m_ui->m_lblFeedListFont->setFont(fon3); + onEndLoadSettings(); } @@ -164,12 +191,16 @@ void SettingsFeedsMessages::saveSettings() { // Save fonts. settings()->setValue(GROUP(Messages), Messages::PreviewerFontStandard, m_ui->m_lblMessagesFont->font().toString()); - qApp->mainForm()->tabWidget()->feedMessageViewer()->loadMessageViewerFonts(); - qApp->feedReader()->updateAutoUpdateStatus(); + settings()->setValue(GROUP(Messages), Messages::ListFont, m_ui->m_lblMessageListFont->font().toString()); + settings()->setValue(GROUP(Feeds), Feeds::ListFont, m_ui->m_lblFeedListFont->font().toString()); + qApp->mainForm()->tabWidget()->feedMessageViewer()->loadMessageViewerFonts(); + + qApp->feedReader()->updateAutoUpdateStatus(); qApp->feedReader()->feedsModel()->reloadWholeLayout(); qApp->feedReader()->messagesModel()->updateDateFormat(); qApp->feedReader()->messagesModel()->reloadWholeLayout(); + onEndSaveSettings(); } diff --git a/src/gui/settings/settingsfeedsmessages.h b/src/gui/settings/settingsfeedsmessages.h index 83a482c7b..1763d014a 100755 --- a/src/gui/settings/settingsfeedsmessages.h +++ b/src/gui/settings/settingsfeedsmessages.h @@ -22,8 +22,8 @@ class SettingsFeedsMessages : public SettingsPanel { void saveSettings(); - private slots: - void changeMessagesFont(); + private: + void changeFont(QLabel& lbl); private: void initializeMessageDateFormats(); diff --git a/src/gui/settings/settingsfeedsmessages.ui b/src/gui/settings/settingsfeedsmessages.ui index db5d1c74d..4ad29c6d0 100755 --- a/src/gui/settings/settingsfeedsmessages.ui +++ b/src/gui/settings/settingsfeedsmessages.ui @@ -7,7 +7,7 @@ 0 0 651 - 295 + 478 @@ -26,7 +26,7 @@ - 1 + 0 @@ -78,6 +78,29 @@ + + + Feed list font + + + + + + Font preview + + + + + + + &Change font + + + + + + + @@ -110,7 +133,7 @@ - + @@ -134,7 +157,7 @@ - + @@ -158,7 +181,7 @@ - + @@ -190,6 +213,13 @@ + + + + Display placeholders to indicate locations of pictures + + + @@ -197,6 +227,30 @@ + + + + + + Height or rows in message list (-1 = default height) + + + m_spinHeightRowsMessages + + + + + + + -1 + + + 100 + + + + + @@ -237,73 +291,56 @@ - - - - Internal message browser fonts - - - - - - - - - - - - - &Change font - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - + + - - - Height or rows in message list (-1 = default height) - - - m_spinHeightRowsMessages + + + Message list font + + + + + Font preview + + + + + + + &Change font + + + + - - - -1 - - - 100 + + + Internal message browser font + + + + + Font preview + + + + + + + &Change font + + + + - - - - Display placeholders to indicate locations of pictures - - - @@ -323,6 +360,7 @@ m_checkAutoUpdateNotification m_checkAutoUpdate m_spinAutoUpdateInterval + m_btnChangeFeedListFont m_spinFeedUpdateTimeout m_spinHeightRowsFeeds m_cmbCountsFeedList @@ -333,6 +371,7 @@ m_spinHeightImageAttachments m_checkMessagesDateTimeFormat m_cmbMessagesDateTimeFormat + m_btnChangeMessageListFont m_btnChangeMessagesFont diff --git a/src/miscellaneous/settings.cpp b/src/miscellaneous/settings.cpp index 93ba3abee..830c2fd6a 100755 --- a/src/miscellaneous/settings.cpp +++ b/src/miscellaneous/settings.cpp @@ -55,6 +55,8 @@ DKEY Feeds::ShowOnlyUnreadFeeds = "show_only_unread_feeds"; DVALUE(bool) Feeds::ShowOnlyUnreadFeedsDef = false; +DKEY Feeds::ListFont = "list_font"; + // Messages. DKEY Messages::ID = "messages"; DKEY Messages::MessageHeadImageHeight = "message_head_image_height"; @@ -91,6 +93,8 @@ DKEY Messages::PreviewerFontStandard = "previewer_font_standard"; NON_CONST_DVALUE(QString) Messages::PreviewerFontStandardDef = QFont(QFont().family(), 12).toString(); +DKEY Messages::ListFont = "list_font"; + // GUI. DKEY GUI::ID = "gui"; DKEY GUI::MessageViewState = "msg_view_state"; diff --git a/src/miscellaneous/settings.h b/src/miscellaneous/settings.h index 37d6b1f50..536281270 100755 --- a/src/miscellaneous/settings.h +++ b/src/miscellaneous/settings.h @@ -75,6 +75,8 @@ namespace Feeds { KEY ShowOnlyUnreadFeeds; VALUE(bool) ShowOnlyUnreadFeedsDef; + + KEY ListFont; } // Messages. @@ -113,6 +115,8 @@ namespace Messages { KEY PreviewerFontStandard; NON_CONST_VALUE(QString) PreviewerFontStandardDef; + + KEY ListFont; } // GUI.