mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-29 00:30:12 +01:00
customize padding for msg list
This commit is contained in:
parent
01efdab258
commit
6242bfa60c
@ -450,8 +450,6 @@ QVariant MessagesModel::data(const QModelIndex& idx, int role) const {
|
|||||||
Qt::AlignmentFlag::AlignVCenter,
|
Qt::AlignmentFlag::AlignVCenter,
|
||||||
str).size();
|
str).size();
|
||||||
|
|
||||||
//rct.setHeight(rct.height() + 20);
|
|
||||||
|
|
||||||
return rct;
|
return rct;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -805,7 +805,10 @@ void FeedsView::setupAppearance() {
|
|||||||
setAllColumnsShowFocus(false);
|
setAllColumnsShowFocus(false);
|
||||||
setRootIsDecorated(false);
|
setRootIsDecorated(false);
|
||||||
setSelectionMode(QAbstractItemView::SelectionMode::SingleSelection);
|
setSelectionMode(QAbstractItemView::SelectionMode::SingleSelection);
|
||||||
setItemDelegate(new StyledItemDelegateWithoutFocus(GUI::HeightRowFeeds, this));
|
setItemDelegate(new StyledItemDelegateWithoutFocus(qApp->settings()->value(GROUP(GUI),
|
||||||
|
SETTING(GUI::HeightRowFeeds)).toInt(),
|
||||||
|
-1,
|
||||||
|
this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeedsView::invalidateReadFeedsFilter(bool set_new_value, bool show_unread_only) {
|
void FeedsView::invalidateReadFeedsFilter(bool set_new_value, bool show_unread_only) {
|
||||||
|
@ -251,7 +251,11 @@ void MessagesView::setupAppearance() {
|
|||||||
setSortingEnabled(true);
|
setSortingEnabled(true);
|
||||||
setAllColumnsShowFocus(false);
|
setAllColumnsShowFocus(false);
|
||||||
setSelectionMode(QAbstractItemView::SelectionMode::ExtendedSelection);
|
setSelectionMode(QAbstractItemView::SelectionMode::ExtendedSelection);
|
||||||
setItemDelegate(new StyledItemDelegateWithoutFocus(GUI::HeightRowMessages, this));
|
setItemDelegate(new StyledItemDelegateWithoutFocus(qApp->settings()->value(GROUP(GUI),
|
||||||
|
SETTING(GUI::HeightRowMessages)).toInt(),
|
||||||
|
qApp->settings()->value(GROUP(Messages),
|
||||||
|
SETTING(Messages::ArticleListPadding)).toInt(),
|
||||||
|
this));
|
||||||
|
|
||||||
header()->setDefaultSectionSize(MESSAGES_VIEW_DEFAULT_COL);
|
header()->setDefaultSectionSize(MESSAGES_VIEW_DEFAULT_COL);
|
||||||
header()->setMinimumSectionSize(MESSAGES_VIEW_MINIMUM_COL);
|
header()->setMinimumSectionSize(MESSAGES_VIEW_MINIMUM_COL);
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
#include "miscellaneous/application.h"
|
#include "miscellaneous/application.h"
|
||||||
|
|
||||||
StyledItemDelegateWithoutFocus::StyledItemDelegateWithoutFocus(const QString& row_height_settings_key, QObject* parent)
|
StyledItemDelegateWithoutFocus::StyledItemDelegateWithoutFocus(int height_row, int padding_row, QObject* parent)
|
||||||
: QStyledItemDelegate(parent), m_rowHeightSettingsKey(row_height_settings_key) {}
|
: QStyledItemDelegate(parent), m_rowHeight(height_row), m_rowPadding(padding_row) {}
|
||||||
|
|
||||||
void StyledItemDelegateWithoutFocus::paint(QPainter* painter,
|
void StyledItemDelegateWithoutFocus::paint(QPainter* painter,
|
||||||
const QStyleOptionViewItem& option,
|
const QStyleOptionViewItem& option,
|
||||||
@ -26,13 +26,19 @@ void StyledItemDelegateWithoutFocus::paint(QPainter* painter,
|
|||||||
}
|
}
|
||||||
|
|
||||||
QSize StyledItemDelegateWithoutFocus::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const {
|
QSize StyledItemDelegateWithoutFocus::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const {
|
||||||
auto row_height = qApp->settings()->value(GROUP(GUI), m_rowHeightSettingsKey).toInt();
|
|
||||||
auto original_hint = QStyledItemDelegate::sizeHint(option, index);
|
auto original_hint = QStyledItemDelegate::sizeHint(option, index);
|
||||||
|
QSize new_hint;
|
||||||
|
|
||||||
if (row_height <= 0) {
|
if (m_rowHeight <= 0) {
|
||||||
return original_hint;
|
new_hint = original_hint;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return QSize(original_hint.width(), row_height);
|
new_hint = QSize(original_hint.width(), m_rowHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_rowPadding > 0) {
|
||||||
|
new_hint.setHeight(new_hint.height() + (2 * m_rowPadding));
|
||||||
|
}
|
||||||
|
|
||||||
|
return new_hint;
|
||||||
}
|
}
|
||||||
|
@ -15,13 +15,14 @@ class StyledItemDelegateWithoutFocus : public QStyledItemDelegate {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit StyledItemDelegateWithoutFocus(const QString& row_height_settings_key, QObject* parent = nullptr);
|
explicit StyledItemDelegateWithoutFocus(int height_row, int padding_row, QObject* parent = nullptr);
|
||||||
|
|
||||||
virtual void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
virtual void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
||||||
virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_rowHeightSettingsKey;
|
int m_rowHeight;
|
||||||
|
int m_rowPadding;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // STYLEDITEMDELEGATEWITHOUTFOCUS_H
|
#endif // STYLEDITEMDELEGATEWITHOUTFOCUS_H
|
||||||
|
@ -72,8 +72,16 @@ SettingsFeedsMessages::SettingsFeedsMessages(Settings* settings, QWidget* parent
|
|||||||
this, &SettingsFeedsMessages::dirtifySettings);
|
this, &SettingsFeedsMessages::dirtifySettings);
|
||||||
connect(m_ui->m_spinHeightRowsMessages, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
connect(m_ui->m_spinHeightRowsMessages, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
||||||
this, &SettingsFeedsMessages::dirtifySettings);
|
this, &SettingsFeedsMessages::dirtifySettings);
|
||||||
|
connect(m_ui->m_spinHeightRowsMessages, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
||||||
|
this, &SettingsFeedsMessages::requireRestart);
|
||||||
connect(m_ui->m_spinHeightRowsFeeds, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
connect(m_ui->m_spinHeightRowsFeeds, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
||||||
this, &SettingsFeedsMessages::dirtifySettings);
|
this, &SettingsFeedsMessages::dirtifySettings);
|
||||||
|
connect(m_ui->m_spinHeightRowsFeeds, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
||||||
|
this, &SettingsFeedsMessages::requireRestart);
|
||||||
|
connect(m_ui->m_spinPaddingRowsMessages, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
||||||
|
this, &SettingsFeedsMessages::dirtifySettings);
|
||||||
|
connect(m_ui->m_spinPaddingRowsMessages, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
||||||
|
this, &SettingsFeedsMessages::requireRestart);
|
||||||
connect(m_ui->m_checkAutoUpdate, &QCheckBox::toggled, m_ui->m_spinAutoUpdateInterval, &TimeSpinBox::setEnabled);
|
connect(m_ui->m_checkAutoUpdate, &QCheckBox::toggled, m_ui->m_spinAutoUpdateInterval, &TimeSpinBox::setEnabled);
|
||||||
connect(m_ui->m_checkUpdateAllFeedsOnStartup, &QCheckBox::toggled, m_ui->m_spinStartupUpdateDelay, &TimeSpinBox::setEnabled);
|
connect(m_ui->m_checkUpdateAllFeedsOnStartup, &QCheckBox::toggled, m_ui->m_spinStartupUpdateDelay, &TimeSpinBox::setEnabled);
|
||||||
connect(m_ui->m_spinFeedUpdateTimeout, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
|
connect(m_ui->m_spinFeedUpdateTimeout, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
|
||||||
@ -154,6 +162,7 @@ void SettingsFeedsMessages::changeFont(QLabel& lbl) {
|
|||||||
void SettingsFeedsMessages::loadSettings() {
|
void SettingsFeedsMessages::loadSettings() {
|
||||||
onBeginLoadSettings();
|
onBeginLoadSettings();
|
||||||
|
|
||||||
|
m_ui->m_spinPaddingRowsMessages->setValue(settings()->value(GROUP(Messages), SETTING(Messages::ArticleListPadding)).toInt());
|
||||||
m_ui->m_spinHeightRowsMessages->setValue(settings()->value(GROUP(GUI), SETTING(GUI::HeightRowMessages)).toInt());
|
m_ui->m_spinHeightRowsMessages->setValue(settings()->value(GROUP(GUI), SETTING(GUI::HeightRowMessages)).toInt());
|
||||||
m_ui->m_spinHeightRowsFeeds->setValue(settings()->value(GROUP(GUI), SETTING(GUI::HeightRowFeeds)).toInt());
|
m_ui->m_spinHeightRowsFeeds->setValue(settings()->value(GROUP(GUI), SETTING(GUI::HeightRowFeeds)).toInt());
|
||||||
|
|
||||||
@ -235,6 +244,7 @@ void SettingsFeedsMessages::loadSettings() {
|
|||||||
void SettingsFeedsMessages::saveSettings() {
|
void SettingsFeedsMessages::saveSettings() {
|
||||||
onBeginSaveSettings();
|
onBeginSaveSettings();
|
||||||
|
|
||||||
|
settings()->setValue(GROUP(Messages), Messages::ArticleListPadding, m_ui->m_spinPaddingRowsMessages->value());
|
||||||
settings()->setValue(GROUP(GUI), GUI::HeightRowMessages, m_ui->m_spinHeightRowsMessages->value());
|
settings()->setValue(GROUP(GUI), GUI::HeightRowMessages, m_ui->m_spinHeightRowsMessages->value());
|
||||||
settings()->setValue(GROUP(GUI), GUI::HeightRowFeeds, m_ui->m_spinHeightRowsFeeds->value());
|
settings()->setValue(GROUP(GUI), GUI::HeightRowFeeds, m_ui->m_spinHeightRowsFeeds->value());
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>489</width>
|
<width>489</width>
|
||||||
<height>476</height>
|
<height>531</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
@ -339,7 +339,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="0">
|
<item row="11" column="0">
|
||||||
<widget class="QLabel" name="m_lblHeightImageAttachments">
|
<widget class="QLabel" name="m_lblHeightImageAttachments">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Image attachments height</string>
|
<string>Image attachments height</string>
|
||||||
@ -349,7 +349,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="1">
|
<item row="11" column="1">
|
||||||
<widget class="QSpinBox" name="m_spinHeightImageAttachments">
|
<widget class="QSpinBox" name="m_spinHeightImageAttachments">
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string notr="true"> px</string>
|
<string notr="true"> px</string>
|
||||||
@ -362,7 +362,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="11" column="0">
|
<item row="12" column="0">
|
||||||
<widget class="QCheckBox" name="m_checkMessagesDateTimeFormat">
|
<widget class="QCheckBox" name="m_checkMessagesDateTimeFormat">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Use custom date/time format</string>
|
<string>Use custom date/time format</string>
|
||||||
@ -375,7 +375,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="11" column="1">
|
<item row="12" column="1">
|
||||||
<widget class="QComboBox" name="m_cmbMessagesDateTimeFormat">
|
<widget class="QComboBox" name="m_cmbMessagesDateTimeFormat">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@ -385,7 +385,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="12" column="0">
|
<item row="13" column="0">
|
||||||
<widget class="QCheckBox" name="m_checkMessagesTimeFormat">
|
<widget class="QCheckBox" name="m_checkMessagesTimeFormat">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Show only time for today articles</string>
|
<string>Show only time for today articles</string>
|
||||||
@ -398,7 +398,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="12" column="1">
|
<item row="13" column="1">
|
||||||
<widget class="QComboBox" name="m_cmbMessagesTimeFormat">
|
<widget class="QComboBox" name="m_cmbMessagesTimeFormat">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@ -408,7 +408,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="13" column="0" colspan="2">
|
<item row="14" column="0" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_5">
|
<widget class="QGroupBox" name="groupBox_5">
|
||||||
@ -477,7 +477,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="15" column="0" colspan="2">
|
<item row="16" column="0" colspan="2">
|
||||||
<spacer name="verticalSpacer_2">
|
<spacer name="verticalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -507,6 +507,35 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="10" column="1">
|
||||||
|
<widget class="QSpinBox" name="m_spinPaddingRowsMessages">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>150</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string notr="true"> px</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>-1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="10" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Article list top/bottom row padding</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>m_spinPaddingRowsMessages</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
@ -549,6 +578,7 @@
|
|||||||
<tabstop>m_checkKeppMessagesInTheMiddle</tabstop>
|
<tabstop>m_checkKeppMessagesInTheMiddle</tabstop>
|
||||||
<tabstop>m_checkMultilineArticleList</tabstop>
|
<tabstop>m_checkMultilineArticleList</tabstop>
|
||||||
<tabstop>m_spinHeightRowsMessages</tabstop>
|
<tabstop>m_spinHeightRowsMessages</tabstop>
|
||||||
|
<tabstop>m_spinPaddingRowsMessages</tabstop>
|
||||||
<tabstop>m_spinHeightImageAttachments</tabstop>
|
<tabstop>m_spinHeightImageAttachments</tabstop>
|
||||||
<tabstop>m_checkMessagesDateTimeFormat</tabstop>
|
<tabstop>m_checkMessagesDateTimeFormat</tabstop>
|
||||||
<tabstop>m_cmbMessagesDateTimeFormat</tabstop>
|
<tabstop>m_cmbMessagesDateTimeFormat</tabstop>
|
||||||
|
@ -105,6 +105,9 @@ DVALUE(bool) Messages::UseCustomDateDef = false;
|
|||||||
DKEY Messages::CustomDateFormat = "custom_date_format";
|
DKEY Messages::CustomDateFormat = "custom_date_format";
|
||||||
DVALUE(char*) Messages::CustomDateFormatDef = "";
|
DVALUE(char*) Messages::CustomDateFormatDef = "";
|
||||||
|
|
||||||
|
DKEY Messages::ArticleListPadding = "article_list_padding";
|
||||||
|
DVALUE(int) Messages::ArticleListPaddingDef = -1;
|
||||||
|
|
||||||
DKEY Messages::MultilineArticleList = "multiline_article_list";
|
DKEY Messages::MultilineArticleList = "multiline_article_list";
|
||||||
DVALUE(bool) Messages::MultilineArticleListDef = false;
|
DVALUE(bool) Messages::MultilineArticleListDef = false;
|
||||||
|
|
||||||
|
@ -125,6 +125,9 @@ namespace Messages {
|
|||||||
KEY UseCustomTime;
|
KEY UseCustomTime;
|
||||||
VALUE(bool) UseCustomTimeDef;
|
VALUE(bool) UseCustomTimeDef;
|
||||||
|
|
||||||
|
KEY ArticleListPadding;
|
||||||
|
VALUE(int) ArticleListPaddingDef;
|
||||||
|
|
||||||
KEY MultilineArticleList;
|
KEY MultilineArticleList;
|
||||||
VALUE(bool) MultilineArticleListDef;
|
VALUE(bool) MultilineArticleListDef;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user