multiple UX fixes, fix #570, prepare for better integration of nodejs

This commit is contained in:
Martin Rotter 2022-01-13 13:51:57 +01:00
parent 97e0699a1a
commit 95a5341967
27 changed files with 347 additions and 160 deletions

View File

@ -26,7 +26,7 @@
<url type="donation">https://github.com/sponsors/martinrotter</url>
<content_rating type="oars-1.1" />
<releases>
<release version="4.1.2" date="2022-01-12"/>
<release version="4.1.2" date="2022-01-13"/>
</releases>
<content_rating type="oars-1.0">
<content_attribute id="violence-cartoon">none</content_attribute>

View File

@ -6,6 +6,7 @@
#include "database/databasefactory.h"
#include "database/databasequeries.h"
#include "definitions/definitions.h"
#include "gui/messagesview.h"
#include "miscellaneous/application.h"
#include "miscellaneous/iconfactory.h"
#include "miscellaneous/skinfactory.h"
@ -21,8 +22,9 @@
#include <cmath>
MessagesModel::MessagesModel(QObject* parent)
: QSqlQueryModel(parent), m_cache(new MessagesModelCache(this)), m_messageHighlighter(MessageHighlighter::NoHighlighting),
m_customDateFormat(QString()), m_customTimeFormat(QString()), m_selectedItem(nullptr), m_displayFeedIcons(false) {
: QSqlQueryModel(parent), m_view(nullptr), m_cache(new MessagesModelCache(this)), m_messageHighlighter(MessageHighlighter::NoHighlighting),
m_customDateFormat(QString()), m_customTimeFormat(QString()), m_selectedItem(nullptr), m_displayFeedIcons(false),
m_multilineListItems(qApp->settings()->value(GROUP(Messages), SETTING(Messages::MultilineArticleList)).toBool()) {
setupFonts();
setupIcons();
setupHeaderData();
@ -79,6 +81,14 @@ QIcon MessagesModel::generateIconForScore(double score) {
return pix;
}
MessagesView* MessagesModel::view() const {
return m_view;
}
void MessagesModel::setView(MessagesView* newView) {
m_view = newView;
}
MessagesModelCache* MessagesModel::cache() const {
return m_cache;
}
@ -418,6 +428,29 @@ QVariant MessagesModel::data(const QModelIndex& idx, int role) const {
return QVariant();
}
case Qt::ItemDataRole::SizeHintRole: {
if (!m_multilineListItems || m_view == nullptr || m_view->isColumnHidden(idx.column())) {
return {};
}
else {
auto wd = m_view->columnWidth(idx.column());
QString str = data(idx, Qt::ItemDataRole::DisplayRole).toString();
if (str.simplified().isEmpty()) {
return {};
}
QFontMetrics fm(data(idx, Qt::ItemDataRole::FontRole).value<QFont>());
auto rct = fm.boundingRect(QRect(QPoint(0, 0), QPoint(wd - 20, 100000)),
Qt::TextFlag::TextWordWrap |
Qt::AlignmentFlag::AlignLeft |
Qt::AlignmentFlag::AlignVCenter,
str).size();
return rct;
}
}
case Qt::ItemDataRole::DecorationRole: {
const int index_column = idx.column();
@ -425,8 +458,8 @@ QVariant MessagesModel::data(const QModelIndex& idx, int role) const {
if (m_displayFeedIcons && m_selectedItem != nullptr) {
QModelIndex idx_feedid = index(idx.row(), MSG_DB_FEED_CUSTOM_ID_INDEX);
QVariant dta = m_cache->containsData(idx_feedid.row())
? m_cache->data(idx_feedid)
: QSqlQueryModel::data(idx_feedid);
? m_cache->data(idx_feedid)
: QSqlQueryModel::data(idx_feedid);
QString feed_custom_id = dta.toString();
auto acc = m_selectedItem->getParentServiceRoot()->feedIconForMessage(feed_custom_id);

View File

@ -13,6 +13,7 @@
#include <QFont>
#include <QIcon>
class MessagesView;
class MessagesModelCache;
class MessagesModel : public QSqlQueryModel, public MessagesModelSqlLayer {
@ -74,6 +75,9 @@ class MessagesModel : public QSqlQueryModel, public MessagesModelSqlLayer {
// Loads messages of given feeds.
void loadMessages(RootItem* item);
MessagesView* view() const;
void setView(MessagesView* newView);
public slots:
// NOTE: These methods DO NOT actually change data in the DB, just in the model.
@ -88,6 +92,7 @@ class MessagesModel : public QSqlQueryModel, public MessagesModelSqlLayer {
static QIcon generateIconForScore(double score);
private:
MessagesView* m_view;
MessagesModelCache* m_cache;
MessageHighlighter m_messageHighlighter;
QString m_customDateFormat;
@ -105,6 +110,7 @@ class MessagesModel : public QSqlQueryModel, public MessagesModelSqlLayer {
QIcon m_enclosuresIcon;
QList<QIcon> m_scoreIcons;
bool m_displayFeedIcons;
bool m_multilineListItems;
};
Q_DECLARE_METATYPE(MessagesModel::MessageHighlighter)

View File

@ -16,6 +16,7 @@
#include "gui/settings/settingsgeneral.h"
#include "gui/settings/settingsgui.h"
#include "gui/settings/settingslocalization.h"
#include "gui/settings/settingsnodejs.h"
#include "gui/settings/settingsnotifications.h"
#include "gui/settings/settingsshortcuts.h"
@ -46,6 +47,7 @@ FormSettings::FormSettings(QWidget& parent)
addSettingsPanel(new SettingsLocalization(&m_settings, this));
addSettingsPanel(new SettingsShortcuts(&m_settings, this));
addSettingsPanel(new SettingsBrowserMail(&m_settings, this));
addSettingsPanel(new SettingsNodejs(&m_settings, this));
addSettingsPanel(new SettingsDownloads(&m_settings, this));
addSettingsPanel(new SettingsFeedsMessages(&m_settings, this));

View File

@ -31,6 +31,7 @@ MessagesView::MessagesView(QWidget* parent)
m_processingRightMouseButton(false) {
m_sourceModel = qApp->feedReader()->messagesModel();
m_proxyModel = qApp->feedReader()->messagesProxyModel();
m_sourceModel->setView(this);
// Forward count changes to the view.
createConnections();
@ -202,8 +203,21 @@ void MessagesView::reloadSelections() {
}
void MessagesView::setupAppearance() {
if (qApp->settings()->value(GROUP(Messages), SETTING(Messages::MultilineArticleList)).toBool()) {
// Enable some word wrapping for multiline list items.
//
// NOTE: If user explicitly changed height of rows, then respect this even if he enabled multiline support.
setUniformRowHeights(qApp->settings()->value(GROUP(GUI), SETTING(GUI::HeightRowMessages)).toInt() > 0);
setWordWrap(true);
setTextElideMode(Qt::TextElideMode::ElideNone);
}
else {
setUniformRowHeights(true);
setWordWrap(false);
setTextElideMode(Qt::TextElideMode::ElideRight);
}
setFocusPolicy(Qt::FocusPolicy::StrongFocus);
setUniformRowHeights(true);
setAcceptDrops(false);
setDragEnabled(false);
setDragDropMode(QAbstractItemView::DragDropMode::NoDragDrop);
@ -214,8 +228,8 @@ void MessagesView::setupAppearance() {
setSortingEnabled(true);
setAllColumnsShowFocus(false);
setSelectionMode(QAbstractItemView::SelectionMode::ExtendedSelection);
setItemDelegate(new StyledItemDelegateWithoutFocus(GUI::HeightRowMessages, this));
header()->setDefaultSectionSize(MESSAGES_VIEW_DEFAULT_COL);
header()->setMinimumSectionSize(MESSAGES_VIEW_MINIMUM_COL);
header()->setFirstSectionMovable(true);

View File

@ -33,7 +33,7 @@ HelpSpoiler::HelpSpoiler(QWidget* parent) : QWidget(parent),
m_animation->addAnimation(new QPropertyAnimation(this, QSL("maximumHeight").toLocal8Bit()));
m_animation->addAnimation(new QPropertyAnimation(m_content, QSL("maximumHeight").toLocal8Bit()));
// don't waste space
// Don't waste space.
m_layout->setHorizontalSpacing(0);
m_layout->setVerticalSpacing(0);
m_layout->setContentsMargins(0, 0, 0, 0);
@ -48,6 +48,27 @@ HelpSpoiler::HelpSpoiler(QWidget* parent) : QWidget(parent),
m_layout->addWidget(m_content, 1, 0, 1, 2);
QObject::connect(m_btnToggle, &QToolButton::clicked, [this](const bool checked) {
const auto collapsed_height = sizeHint().height() - m_content->maximumHeight();
auto content_height = m_text->fontMetrics().boundingRect(QRect(QPoint(0, 0),
QPoint(m_text->width(), 1000)),
Qt::TextFlag::TextWordWrap,
m_text->text()).height() +
(2 * m_text->fontMetrics().lineSpacing());
for (int i = 0; i < m_animation->animationCount() - 1; i++) {
QPropertyAnimation* spoiler_animation = static_cast<QPropertyAnimation*>(m_animation->animationAt(i));
spoiler_animation->setDuration(100);
spoiler_animation->setStartValue(collapsed_height);
spoiler_animation->setEndValue(collapsed_height + content_height);
}
QPropertyAnimation* content_animation = static_cast<QPropertyAnimation*>(m_animation->animationAt(m_animation->animationCount() - 1));
content_animation->setDuration(100);
content_animation->setStartValue(0);
content_animation->setEndValue(content_height);
m_btnToggle->setArrowType(checked
? Qt::ArrowType::DownArrow
: Qt::ArrowType::RightArrow);
@ -61,27 +82,15 @@ HelpSpoiler::HelpSpoiler(QWidget* parent) : QWidget(parent),
auto* content_layout = new QVBoxLayout(m_content);
content_layout->addWidget(m_text);
content_layout->addWidget(m_text, 1);
}
void HelpSpoiler::setHelpText(const QString& title, const QString& text, bool is_warning) {
m_btnToggle->setText(title);
setHelpText(text, is_warning);
}
void HelpSpoiler::setHelpText(const QString& text, bool is_warning) {
m_text->setText(text);
GuiUtilities::setLabelAsNotice(*m_text, is_warning, false);
const auto collapsed_height = sizeHint().height() - m_content->maximumHeight();
auto content_height = m_content->layout()->sizeHint().height();
for (int i = 0; i < m_animation->animationCount() - 1; i++) {
QPropertyAnimation* spoiler_animation = static_cast<QPropertyAnimation*>(m_animation->animationAt(i));
spoiler_animation->setDuration(100);
spoiler_animation->setStartValue(collapsed_height);
spoiler_animation->setEndValue(collapsed_height + content_height);
}
QPropertyAnimation* content_animation = static_cast<QPropertyAnimation*>(m_animation->animationAt(m_animation->animationCount() - 1));
content_animation->setDuration(100);
content_animation->setStartValue(0);
content_animation->setEndValue(content_height);
}

View File

@ -17,6 +17,7 @@ class HelpSpoiler : public QWidget {
public:
explicit HelpSpoiler(QWidget* parent = nullptr);
void setHelpText(const QString& title, const QString& text, bool is_warning);
void setHelpText(const QString& text, bool is_warning);
private:

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>481</width>
<width>537</width>
<height>330</height>
</rect>
</property>
@ -337,7 +337,7 @@
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="m_lblToolInfo">
<property name="text">
<string>On this page, you can setup a list of external tools which can open URLs of selected messages.</string>
<string>On this page, you can setup a list of external tools which can open URLs.</string>
</property>
</widget>
</item>

View File

@ -12,9 +12,34 @@ SettingsDatabase::SettingsDatabase(Settings* settings, QWidget* parent)
: SettingsPanel(settings, parent), m_ui(new Ui::SettingsDatabase) {
m_ui->setupUi(this);
GuiUtilities::setLabelAsNotice(*m_ui->m_lblDataStorageWarning, true);
GuiUtilities::setLabelAsNotice(*m_ui->m_lblMysqlInfo, false);
GuiUtilities::setLabelAsNotice(*m_ui->m_lblSqliteInMemoryWarnings, true);
m_ui->m_lblDataStorageWarning->setHelpText(tr("Note that switching to another data storage type will "
"NOT copy existing your data from currently active data "
"storage to newly selected one."),
true);
m_ui->m_lblMysqlInfo->setHelpText(tr("Note that speed of used MySQL server and latency of used connection "
"medium HEAVILY influences the final performance of this application. "
"Using slow database connections leads to bad performance when browsing "
"feeds or messages."),
false);
m_ui->m_lblSqliteInMemoryWarnings->setHelpText(tr("Usage of in-memory working database has several advantages "
"and pitfalls. Make sure that you are familiar with these "
"before you turn this feature on.\n"
"\n"
"Advantages:\n"
" • higher speed for feed/message manipulations "
"(especially with thousands of messages displayed),\n"
" • whole database stored in RAM, thus your hard drive can "
"rest more.\n"
"\n"
"Disadvantages:\n"
" • if application crashes, your changes from last session are lost,\n"
" • application startup and shutdown can take little longer "
"(max. 2 seconds).\n"
"\n"
"Authors of this application are NOT responsible for lost data."),
true);
m_ui->m_txtMysqlPassword->lineEdit()->setPasswordMode(true);

View File

@ -22,22 +22,7 @@
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="m_lblDataStorageWarning">
<property name="styleSheet">
<string notr="true">QLabel {
margin-top: 12px;
}</string>
</property>
<property name="text">
<string>WARNING: Note that switching to another data storage type will NOT copy existing your data from currently active data storage to newly selected one.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="HelpSpoiler" name="m_lblDataStorageWarning" native="true"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="m_lblDatabaseDriver">
@ -55,7 +40,7 @@
<item row="3" column="0" colspan="2">
<widget class="QStackedWidget" name="m_stackedDatabaseDriver">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="m_pageSqlite">
<layout class="QFormLayout" name="formLayout_15">
@ -82,30 +67,7 @@
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="m_lblSqliteInMemoryWarnings">
<property name="text">
<string>Usage of in-memory working database has several advantages and pitfalls. Make sure that you are familiar with these before you turn this feature on. Advantages:
&lt;ul&gt;
&lt;li&gt;higher speed for feed/message manipulations (especially with thousands of messages displayed),&lt;/li&gt;
&lt;li&gt;whole database stored in RAM, thus your hard drive can rest more.&lt;/li&gt;
&lt;/ul&gt;
Disadvantages:
&lt;ul&gt;
&lt;li&gt;if application crashes, your changes from last session are lost,&lt;/li&gt;
&lt;li&gt;application startup and shutdown can take little longer (max. 2 seconds).&lt;/li&gt;
&lt;/ul&gt;
Authors of this application are NOT responsible for lost data.</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="indent">
<number>20</number>
</property>
</widget>
<widget class="HelpSpoiler" name="m_lblSqliteInMemoryWarnings" native="true"/>
</item>
</layout>
</widget>
@ -236,17 +198,7 @@ Authors of this application are NOT responsible for lost data.</string>
</layout>
</item>
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="m_lblMysqlInfo">
<property name="text">
<string>Note that speed of used MySQL server and latency of used connection medium HEAVILY influences the final performance of this application. Using slow database connections leads to bad performance when browsing feeds or messages.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="HelpSpoiler" name="m_lblMysqlInfo" native="true"/>
</item>
</layout>
</widget>
@ -273,6 +225,12 @@ Authors of this application are NOT responsible for lost data.</string>
<zorder>m_lblDataStorageWarning</zorder>
</widget>
<customwidgets>
<customwidget>
<class>HelpSpoiler</class>
<extends>QWidget</extends>
<header>helpspoiler.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>LabelWithStatus</class>
<extends>QWidget</extends>

View File

@ -25,6 +25,10 @@ SettingsFeedsMessages::SettingsFeedsMessages(Settings* settings, QWidget* parent
initializeMessageDateFormats();
GuiUtilities::setLabelAsNotice(*m_ui->label_9, false);
m_ui->m_helpMultilineArticleList->setHelpText(tr("Note that enabling this might have drastic consequences on "
"performance of article list with big number of articles."),
true);
#if defined(USE_WEBENGINE)
m_ui->m_tabMessages->layout()->removeWidget(m_ui->m_checkDisplayPlaceholders);
m_ui->m_checkDisplayPlaceholders->hide();
@ -36,6 +40,9 @@ SettingsFeedsMessages::SettingsFeedsMessages(Settings* settings, QWidget* parent
m_ui->m_tabMessages->layout()->removeWidget(m_ui->m_cbShowEnclosuresDirectly);
m_ui->m_cbShowEnclosuresDirectly->hide();
m_ui->m_tabMessages->layout()->removeWidget(m_ui->m_lblHeightImageAttachments);
m_ui->m_lblHeightImageAttachments->hide();
m_ui->m_tabMessages->layout()->removeWidget(m_ui->m_spinHeightImageAttachments);
m_ui->m_spinHeightImageAttachments->hide();
@ -79,6 +86,8 @@ SettingsFeedsMessages::SettingsFeedsMessages(Settings* settings, QWidget* parent
connect(m_ui->m_cmbCountsFeedList, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&SettingsFeedsMessages::dirtifySettings);
connect(m_ui->m_checkShowTooltips, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings);
connect(m_ui->m_checkMultilineArticleList, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings);
connect(m_ui->m_checkMultilineArticleList, &QCheckBox::toggled, this, &SettingsFeedsMessages::requireRestart);
connect(m_ui->m_btnChangeMessagesFont, &QPushButton::clicked, this, [&]() {
changeFont(*m_ui->m_lblMessagesFont);
@ -168,6 +177,8 @@ void SettingsFeedsMessages::loadSettings() {
m_ui->m_checkShowTooltips->setChecked(settings()->value(GROUP(Feeds), SETTING(Feeds::EnableTooltipsFeedsMessages)).toBool());
m_ui->m_cmbIgnoreContentsChanges->setChecked(settings()->value(GROUP(Messages),
SETTING(Messages::IgnoreContentsChanges)).toBool());
m_ui->m_checkMultilineArticleList->setChecked(settings()->value(GROUP(Messages),
SETTING(Messages::MultilineArticleList)).toBool());
#if !defined (USE_WEBENGINE)
m_ui->m_checkDisplayPlaceholders->setChecked(settings()->value(GROUP(Messages), SETTING(Messages::DisplayImagePlaceholders)).toBool());
@ -245,6 +256,7 @@ void SettingsFeedsMessages::saveSettings() {
settings()->setValue(GROUP(Feeds), Feeds::CountFormat, m_ui->m_cmbCountsFeedList->currentText());
settings()->setValue(GROUP(Feeds), Feeds::EnableTooltipsFeedsMessages, m_ui->m_checkShowTooltips->isChecked());
settings()->setValue(GROUP(Messages), Messages::IgnoreContentsChanges, m_ui->m_cmbIgnoreContentsChanges->isChecked());
settings()->setValue(GROUP(Messages), Messages::MultilineArticleList, m_ui->m_checkMultilineArticleList->isChecked());
#if !defined (USE_WEBENGINE)
settings()->setValue(GROUP(Messages), Messages::DisplayImagePlaceholders, m_ui->m_checkDisplayPlaceholders->isChecked());

View File

@ -6,15 +6,15 @@
<rect>
<x>0</x>
<y>0</y>
<width>479</width>
<height>433</height>
<width>489</width>
<height>434</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QTabWidget" name="m_tabFeedsMessages">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="m_tabFeeds">
<attribute name="title">
@ -268,6 +268,13 @@
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="m_cmbIgnoreContentsChanges">
<property name="text">
<string>Ignore changes in article body when new articles are being fetched</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="m_checkDisplayPlaceholders">
<property name="text">
@ -303,7 +310,7 @@
</property>
</widget>
</item>
<item row="7" column="0">
<item row="9" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Article list row height</string>
@ -313,7 +320,7 @@
</property>
</widget>
</item>
<item row="7" column="1">
<item row="9" column="1">
<widget class="QSpinBox" name="m_spinHeightRowsMessages">
<property name="minimumSize">
<size>
@ -332,24 +339,18 @@
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label">
<item row="10" column="0">
<widget class="QLabel" name="m_lblHeightImageAttachments">
<property name="text">
<string>Height of image attachments</string>
<string>Image attachments height</string>
</property>
<property name="buddy">
<cstring>m_spinHeightImageAttachments</cstring>
</property>
</widget>
</item>
<item row="8" column="1">
<item row="10" column="1">
<widget class="QSpinBox" name="m_spinHeightImageAttachments">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="suffix">
<string notr="true"> px</string>
</property>
@ -361,7 +362,7 @@
</property>
</widget>
</item>
<item row="9" column="0">
<item row="11" column="0">
<widget class="QCheckBox" name="m_checkMessagesDateTimeFormat">
<property name="text">
<string>Use custom date/time format</string>
@ -374,7 +375,7 @@
</property>
</widget>
</item>
<item row="9" column="1">
<item row="11" column="1">
<widget class="QComboBox" name="m_cmbMessagesDateTimeFormat">
<property name="minimumSize">
<size>
@ -384,7 +385,30 @@
</property>
</widget>
</item>
<item row="11" column="0" colspan="2">
<item row="12" column="0">
<widget class="QCheckBox" name="m_checkMessagesTimeFormat">
<property name="text">
<string>Show only time for today articles</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QComboBox" name="m_cmbMessagesTimeFormat">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="13" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QGroupBox" name="groupBox_5">
@ -453,7 +477,7 @@
</item>
</layout>
</item>
<item row="13" column="0" colspan="2">
<item row="15" column="0" colspan="2">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -466,36 +490,23 @@
</property>
</spacer>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="m_cmbIgnoreContentsChanges">
<item row="7" column="0" colspan="2">
<widget class="QCheckBox" name="m_checkMultilineArticleList">
<property name="text">
<string>Ignore changes in article body when new articles are being fetched</string>
<string>Enable multiline article list items</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QComboBox" name="m_cmbMessagesTimeFormat">
<item row="8" column="0" colspan="2">
<widget class="HelpSpoiler" name="m_helpMultilineArticleList" native="true">
<property name="minimumSize">
<size>
<width>150</width>
<width>50</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QCheckBox" name="m_checkMessagesTimeFormat">
<property name="text">
<string>Show only time for today articles</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
@ -508,6 +519,12 @@
<extends>QDoubleSpinBox</extends>
<header>timespinbox.h</header>
</customwidget>
<customwidget>
<class>HelpSpoiler</class>
<extends>QWidget</extends>
<header>helpspoiler.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>m_tabFeedsMessages</tabstop>
@ -530,6 +547,7 @@
<tabstop>m_checkDisplayFeedIcons</tabstop>
<tabstop>m_checkBringToForegroundAfterMsgOpened</tabstop>
<tabstop>m_checkKeppMessagesInTheMiddle</tabstop>
<tabstop>m_checkMultilineArticleList</tabstop>
<tabstop>m_spinHeightRowsMessages</tabstop>
<tabstop>m_spinHeightImageAttachments</tabstop>
<tabstop>m_checkMessagesDateTimeFormat</tabstop>

View File

@ -0,0 +1,25 @@
// For license of this file, see <project-root-folder>/LICENSE.md.
#include "gui/settings/settingsnodejs.h"
#include "definitions/definitions.h"
SettingsNodejs::SettingsNodejs(Settings* settings, QWidget* parent) : SettingsPanel(settings, parent) {
m_ui.setupUi(this);
m_ui.m_helpInfo->setHelpText(tr("What is Node.js?"),
tr("Node.js is asynchronous event-driven JavaScript runtime, designed to build "
"scalable network applications.\n\n"
"%1 integrates Node.js to bring some modern features like Adblock.").arg(APP_NAME),
false);
}
QString SettingsNodejs::title() const {
return QSL("Node.js");
}
void SettingsNodejs::loadSettings()
{}
void SettingsNodejs::saveSettings()
{}

View File

@ -0,0 +1,24 @@
// For license of this file, see <project-root-folder>/LICENSE.md.
#ifndef SETTINGSNODEJS_H
#define SETTINGSNODEJS_H
#include "gui/settings/settingspanel.h"
#include "ui_settingsnodejs.h"
class SettingsNodejs : public SettingsPanel {
Q_OBJECT
public:
explicit SettingsNodejs(Settings* settings, QWidget* parent = nullptr);
virtual QString title() const;
virtual void loadSettings();
virtual void saveSettings();
private:
Ui::SettingsNodejs m_ui;
};
#endif // SETTINGSNODEJS_H

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SettingsNodejs</class>
<widget class="QWidget" name="SettingsNodejs">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0" colspan="2">
<widget class="HelpSpoiler" name="m_helpInfo" native="true"/>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>HelpSpoiler</class>
<extends>QWidget</extends>
<header>helpspoiler.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -14,8 +14,9 @@
SettingsNotifications::SettingsNotifications(Settings* settings, QWidget* parent) : SettingsPanel(settings, parent) {
m_ui.setupUi(this);
GuiUtilities::setLabelAsNotice(*m_ui.m_lblAvailableSounds, false);
GuiUtilities::setLabelAsNotice(*m_ui.m_lblInfo, true);
m_ui.m_lblInfo->setHelpText(tr("You must have \"tray icon\" activated to have balloon notifications working.\n\n"
"Also, there are some built-in sounds. Just start typing \":\" and they will show up."),
true);
connect(m_ui.m_checkEnableNotifications, &QCheckBox::toggled, this, &SettingsNotifications::dirtifySettings);
connect(m_ui.m_editor, &NotificationsEditor::someNotificationChanged, this, &SettingsNotifications::dirtifySettings);

View File

@ -18,7 +18,10 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<item row="2" column="0" colspan="2">
<widget class="HelpSpoiler" name="m_lblInfo" native="true"/>
</item>
<item row="3" column="0" colspan="2">
<widget class="NotificationsEditor" name="m_editor" native="true">
<property name="enabled">
<bool>false</bool>
@ -31,29 +34,15 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="m_lblAvailableSounds">
<property name="text">
<string>There are some built-in sounds. Just start typing &quot;:&quot; and they will show up.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="m_lblInfo">
<property name="text">
<string>You must have &quot;tray icon&quot; activated to have balloon notifications working.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>HelpSpoiler</class>
<extends>QWidget</extends>
<header>helpspoiler.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>NotificationsEditor</class>
<extends>QWidget</extends>

View File

@ -68,6 +68,7 @@ HEADERS += core/feeddownloader.h \
gui/reusable/helpspoiler.h \
gui/reusable/progressbarwithtext.h \
gui/reusable/resizablestackedwidget.h \
gui/settings/settingsnodejs.h \
gui/settings/settingsnotifications.h \
gui/toolbars/basetoolbar.h \
gui/reusable/comboboxwithstatus.h \
@ -128,6 +129,7 @@ HEADERS += core/feeddownloader.h \
miscellaneous/iofactory.h \
miscellaneous/localization.h \
miscellaneous/mutex.h \
miscellaneous/nodejs.h \
miscellaneous/notification.h \
miscellaneous/notificationfactory.h \
miscellaneous/regexfactory.h \
@ -259,6 +261,7 @@ SOURCES += core/feeddownloader.cpp \
gui/reusable/helpspoiler.cpp \
gui/reusable/progressbarwithtext.cpp \
gui/reusable/resizablestackedwidget.cpp \
gui/settings/settingsnodejs.cpp \
gui/settings/settingsnotifications.cpp \
gui/toolbars/basetoolbar.cpp \
gui/reusable/comboboxwithstatus.cpp \
@ -319,6 +322,7 @@ SOURCES += core/feeddownloader.cpp \
miscellaneous/iofactory.cpp \
miscellaneous/localization.cpp \
miscellaneous/mutex.cpp \
miscellaneous/nodejs.cpp \
miscellaneous/notification.cpp \
miscellaneous/notificationfactory.cpp \
miscellaneous/regexfactory.cpp \
@ -432,6 +436,7 @@ FORMS += gui/dialogs/formabout.ui \
gui/settings/settingsgeneral.ui \
gui/settings/settingsgui.ui \
gui/settings/settingslocalization.ui \
gui/settings/settingsnodejs.ui \
gui/settings/settingsnotifications.ui \
gui/settings/settingsshortcuts.ui \
gui/toolbars/toolbareditor.ui \

View File

@ -15,6 +15,7 @@
#include "miscellaneous/iconfactory.h"
#include "miscellaneous/iofactory.h"
#include "miscellaneous/mutex.h"
#include "miscellaneous/nodejs.h"
#include "miscellaneous/notificationfactory.h"
#include "network-web/webfactory.h"
#include "services/abstract/serviceroot.h"
@ -67,6 +68,7 @@ Application::Application(const QString& id, int& argc, char** argv)
m_database = new DatabaseFactory(this);
m_downloadManager = nullptr;
m_notifications = new NotificationFactory(this);
m_nodejs = new NodeJs(this);
m_shouldRestart = false;
determineFirstRuns();

View File

@ -33,6 +33,7 @@ class FormMain;
class IconFactory;
class QAction;
class Mutex;
class NodeJs;
#if QT_VERSION_MAJOR == 6
class QWebEngineDownloadRequest;
@ -224,6 +225,7 @@ class RSSGUARD_DLLSPEC Application : public SingleApplication {
DatabaseFactory* m_database;
DownloadManager* m_downloadManager;
NotificationFactory* m_notifications;
NodeJs* m_nodejs;
bool m_shouldRestart;
bool m_firstRunEver;
bool m_firstRunCurrentVersion;

View File

@ -0,0 +1,5 @@
// For license of this file, see <project-root-folder>/LICENSE.md.
#include "miscellaneous/nodejs.h"
NodeJs::NodeJs(QObject* parent) : QObject{parent} {}

View File

@ -0,0 +1,15 @@
// For license of this file, see <project-root-folder>/LICENSE.md.
#ifndef NODEJS_H
#define NODEJS_H
#include <QObject>
class NodeJs : public QObject {
Q_OBJECT
public:
explicit NodeJs(QObject* parent = nullptr);
};
#endif // NODEJS_H

View File

@ -105,6 +105,9 @@ DVALUE(bool) Messages::UseCustomDateDef = false;
DKEY Messages::CustomDateFormat = "custom_date_format";
DVALUE(char*) Messages::CustomDateFormatDef = "";
DKEY Messages::MultilineArticleList = "multiline_article_list";
DVALUE(bool) Messages::MultilineArticleListDef = false;
DKEY Messages::UseCustomTime = "use_custom_time";
DVALUE(bool) Messages::UseCustomTimeDef = false;

View File

@ -125,6 +125,9 @@ namespace Messages {
KEY UseCustomTime;
VALUE(bool) UseCustomTimeDef;
KEY MultilineArticleList;
VALUE(bool) MultilineArticleListDef;
KEY CustomTimeFormat;
VALUE(QString) CustomTimeFormatDef;

View File

@ -26,10 +26,10 @@ CookieJar::CookieJar(QObject* parent) : QNetworkCookieJar(parent) {
// When cookies change in WebEngine, then change in main cookie jar too.
connect(m_webEngineCookies, &QWebEngineCookieStore::cookieAdded, this, [=](const QNetworkCookie& cookie) {
//insertCookieInternal(cookie, false, true);
insertCookieInternal(cookie, false, true);
});
connect(m_webEngineCookies, &QWebEngineCookieStore::cookieRemoved, this, [=](const QNetworkCookie& cookie) {
//deleteCookieInternal(cookie, false);
deleteCookieInternal(cookie, false);
});
#endif
@ -80,6 +80,7 @@ void CookieJar::loadCookies() {
<< "Failed to load cookie"
<< QUOTE_W_SPACE(cookie_key)
<< "from settings.";
sett->remove(Cookies::ID, cookie_key);
}
}
}
@ -124,7 +125,7 @@ bool CookieJar::insertCookieInternal(const QNetworkCookie& cookie, bool notify_o
#if defined(USE_WEBENGINE)
if (notify_others) {
m_webEngineCookies->setCookie(cookie);
//m_webEngineCookies->setCookie(cookie);
}
#else
Q_UNUSED(notify_others)

View File

@ -108,7 +108,13 @@ StandardFeedDetails::StandardFeedDetails(QWidget* parent) : QWidget(parent) {
setTabOrder(m_ui.m_txtPostProcessScript->textEdit(), m_ui.m_btnFetchMetadata);
setTabOrder(m_ui.m_btnFetchMetadata, m_ui.m_btnIcon);
GuiUtilities::setLabelAsNotice(*m_ui.m_lblScriptInfo, false);
m_ui.m_lblScriptInfo->setHelpText(tr("What is post-processing script?"),
tr("You can use URL as a source of your feed or you can produce your feed with "
"custom script.\n\n"
"Also, you can post-process generated feed data with yet "
"another script if you wish. These are advanced features and make sure to "
"read the documentation before your use them."),
true);
onTitleChanged({});
onDescriptionChanged({});

View File

@ -132,7 +132,7 @@
<item row="7" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Post-process script</string>
<string>Post-processing script</string>
</property>
</widget>
</item>
@ -153,17 +153,7 @@
</widget>
</item>
<item row="8" column="0" colspan="2">
<widget class="QLabel" name="m_lblScriptInfo">
<property name="text">
<string>You can use URL as a source of your feed or you can produce your feed with custom script. Also, you can post-process generated feed data with yet another script if you wish. These are advanced features and make sure to read the documentation before your use them.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="HelpSpoiler" name="m_lblScriptInfo" native="true"/>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_7">
@ -262,6 +252,12 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>HelpSpoiler</class>
<extends>QWidget</extends>
<header>helpspoiler.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>LabelWithStatus</class>
<extends>QWidget</extends>