fix settings window bug, fix shortcuts problem in lists
This commit is contained in:
parent
9af79b3ca3
commit
4929b5fd62
7 changed files with 38 additions and 21 deletions
|
@ -2,9 +2,11 @@
|
|||
|
||||
#include "gui/reusable/basetreeview.h"
|
||||
|
||||
#include "miscellaneous/application.h"
|
||||
|
||||
#include <QKeyEvent>
|
||||
|
||||
BaseTreeView::BaseTreeView(QWidget* parent) : QTreeView(parent), m_keyboardShortcutsLimited(false) {
|
||||
BaseTreeView::BaseTreeView(QWidget* parent) : QTreeView(parent) {
|
||||
m_allowedKeyboardKeys = {
|
||||
Qt::Key::Key_Back,
|
||||
Qt::Key::Key_Select,
|
||||
|
@ -22,16 +24,8 @@ BaseTreeView::BaseTreeView(QWidget* parent) : QTreeView(parent), m_keyboardShort
|
|||
};
|
||||
}
|
||||
|
||||
bool BaseTreeView::keyboardShortcutsLimited() const {
|
||||
return m_keyboardShortcutsLimited;
|
||||
}
|
||||
|
||||
void BaseTreeView::setKeyboardShortcutsLimited(bool limited) {
|
||||
m_keyboardShortcutsLimited = limited;
|
||||
}
|
||||
|
||||
void BaseTreeView::keyPressEvent(QKeyEvent* event) {
|
||||
if (m_keyboardShortcutsLimited &&
|
||||
if (qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::OnlyBasicShortcutsInLists)).toBool() &&
|
||||
!m_allowedKeyboardKeys.contains(event->key()) &&
|
||||
!event->matches(QKeySequence::StandardKey::SelectAll)) {
|
||||
event->ignore();
|
||||
|
|
|
@ -11,14 +11,10 @@ class BaseTreeView : public QTreeView {
|
|||
public:
|
||||
explicit BaseTreeView(QWidget* parent = nullptr);
|
||||
|
||||
bool keyboardShortcutsLimited() const;
|
||||
void setKeyboardShortcutsLimited(bool limited);
|
||||
|
||||
protected:
|
||||
virtual void keyPressEvent(QKeyEvent* event);
|
||||
|
||||
private:
|
||||
bool m_keyboardShortcutsLimited;
|
||||
QList<int> m_allowedKeyboardKeys;
|
||||
};
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="m_txtExternalBrowserExecutable">
|
||||
<widget class="BaseLineEdit" name="m_txtExternalBrowserExecutable">
|
||||
<property name="placeholderText">
|
||||
<string>Executable file of web browser</string>
|
||||
</property>
|
||||
|
@ -107,7 +107,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="m_txtExternalBrowserArguments">
|
||||
<widget class="BaseLineEdit" name="m_txtExternalBrowserArguments">
|
||||
<property name="placeholderText">
|
||||
<string>Parameters passed to executable</string>
|
||||
</property>
|
||||
|
@ -196,7 +196,7 @@
|
|||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="m_txtExternalEmailExecutable">
|
||||
<widget class="BaseLineEdit" name="m_txtExternalEmailExecutable">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
@ -225,7 +225,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="m_txtExternalEmailArguments">
|
||||
<widget class="BaseLineEdit" name="m_txtExternalEmailArguments">
|
||||
<property name="placeholderText">
|
||||
<string>Parameters passed to executable</string>
|
||||
</property>
|
||||
|
@ -359,6 +359,13 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BaseLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>baselineedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>m_tabBrowserProxy</tabstop>
|
||||
<tabstop>m_grpCustomExternalBrowser</tabstop>
|
||||
|
|
|
@ -47,6 +47,7 @@ SettingsFeedsMessages::SettingsFeedsMessages(Settings* settings, QWidget* parent
|
|||
connect(m_ui->m_spinHeightRowsFeeds, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
||||
this, &SettingsFeedsMessages::requireRestart);
|
||||
|
||||
connect(m_ui->m_cbListsRestrictedShortcuts, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings);
|
||||
connect(m_ui->m_cmbIgnoreContentsChanges, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings);
|
||||
connect(m_ui->m_cbHideCountsIfNoUnread, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings);
|
||||
connect(m_ui->m_checkAutoUpdate, &QCheckBox::toggled, this, &SettingsFeedsMessages::dirtifySettings);
|
||||
|
@ -137,6 +138,8 @@ void SettingsFeedsMessages::loadSettings() {
|
|||
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_cbListsRestrictedShortcuts->setChecked(settings()->value(GROUP(Feeds),
|
||||
SETTING(Feeds::OnlyBasicShortcutsInLists)).toBool());
|
||||
m_ui->m_cbHideCountsIfNoUnread->setChecked(settings()->value(GROUP(Feeds), SETTING(Feeds::HideCountsIfNoUnread)).toBool());
|
||||
m_ui->m_checkDisplayFeedIcons->setChecked(settings()->value(GROUP(Messages), SETTING(Messages::DisplayFeedIconsInList)).toBool());
|
||||
m_ui->m_checkBringToForegroundAfterMsgOpened->setChecked(settings()->value(GROUP(Messages),
|
||||
|
@ -204,6 +207,9 @@ void SettingsFeedsMessages::saveSettings() {
|
|||
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(Feeds), Feeds::OnlyBasicShortcutsInLists,
|
||||
m_ui->m_cbListsRestrictedShortcuts->isChecked());
|
||||
|
||||
settings()->setValue(GROUP(Feeds), Feeds::HideCountsIfNoUnread, m_ui->m_cbHideCountsIfNoUnread->isChecked());
|
||||
settings()->setValue(GROUP(Messages), Messages::DisplayFeedIconsInList, m_ui->m_checkDisplayFeedIcons->isChecked());
|
||||
settings()->setValue(GROUP(Messages), Messages::BringAppToFrontAfterMessageOpenedExternally,
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<item>
|
||||
<widget class="QTabWidget" name="m_tabFeedsMessages">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="m_tabFeeds">
|
||||
<attribute name="title">
|
||||
|
@ -236,14 +236,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0" colspan="2">
|
||||
<item row="10" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="m_checkShowTooltips">
|
||||
<property name="text">
|
||||
<string>Display tooltips for feeds and articles</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0" colspan="2">
|
||||
<item row="11" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
@ -256,6 +256,13 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="9" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="m_cbListsRestrictedShortcuts">
|
||||
<property name="text">
|
||||
<string>Allow only basic keyboard shortcuts for feed/article list</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="m_tabMessages">
|
||||
|
@ -494,6 +501,7 @@
|
|||
<tabstop>m_spinHeightRowsFeeds</tabstop>
|
||||
<tabstop>m_cmbCountsFeedList</tabstop>
|
||||
<tabstop>m_cbHideCountsIfNoUnread</tabstop>
|
||||
<tabstop>m_cbListsRestrictedShortcuts</tabstop>
|
||||
<tabstop>m_checkShowTooltips</tabstop>
|
||||
<tabstop>m_checkRemoveReadMessagesOnExit</tabstop>
|
||||
<tabstop>m_cmbIgnoreContentsChanges</tabstop>
|
||||
|
|
|
@ -72,6 +72,9 @@ DVALUE(bool) Feeds::HideCountsIfNoUnreadDef = false;
|
|||
DKEY Feeds::AutoExpandOnSelection = "auto_expand_on_selection";
|
||||
DVALUE(bool) Feeds::AutoExpandOnSelectionDef = false;
|
||||
|
||||
DKEY Feeds::OnlyBasicShortcutsInLists = "only_basic_shortcuts_in_lists";
|
||||
DVALUE(bool) Feeds::OnlyBasicShortcutsInListsDef = false;
|
||||
|
||||
DKEY Feeds::ListFont = "list_font";
|
||||
|
||||
// Messages.
|
||||
|
|
|
@ -89,6 +89,9 @@ namespace Feeds {
|
|||
KEY AutoExpandOnSelection;
|
||||
VALUE(bool) AutoExpandOnSelectionDef;
|
||||
|
||||
KEY OnlyBasicShortcutsInLists;
|
||||
VALUE(bool) OnlyBasicShortcutsInListsDef;
|
||||
|
||||
KEY ListFont;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue