Better UX in settings/gui.

This commit is contained in:
Martin Rotter 2020-12-23 18:03:10 +01:00
parent a3c15e7128
commit 5eac7b6f2a
4 changed files with 40 additions and 15 deletions

View File

@ -30,7 +30,7 @@
<url type="donation">https://martinrotter.github.io/donate/</url> <url type="donation">https://martinrotter.github.io/donate/</url>
<content_rating type="oars-1.1" /> <content_rating type="oars-1.1" />
<releases> <releases>
<release version="3.8.2" date="2020-11-21"/> <release version="3.8.4" date="2020-12-23"/>
</releases> </releases>
<content_rating type="oars-1.0"> <content_rating type="oars-1.0">
<content_attribute id="violence-cartoon">none</content_attribute> <content_attribute id="violence-cartoon">none</content_attribute>

View File

@ -55,7 +55,7 @@ SettingsGui::SettingsGui(Settings* settings, QWidget* parent) : SettingsPanel(se
connect(m_ui->m_editorMessagesToolbar, &ToolBarEditor::setupChanged, this, &SettingsGui::dirtifySettings); connect(m_ui->m_editorMessagesToolbar, &ToolBarEditor::setupChanged, this, &SettingsGui::dirtifySettings);
connect(m_ui->m_editorStatusbar, &ToolBarEditor::setupChanged, this, &SettingsGui::dirtifySettings); connect(m_ui->m_editorStatusbar, &ToolBarEditor::setupChanged, this, &SettingsGui::dirtifySettings);
connect(m_ui->m_editorStatusbar, &ToolBarEditor::setupChanged, this, &SettingsGui::requireRestart); connect(m_ui->m_editorStatusbar, &ToolBarEditor::setupChanged, this, &SettingsGui::requireRestart);
connect(m_ui->m_listStyles, &QListWidget::currentItemChanged, this, &SettingsGui::dirtifySettings); connect(m_ui->m_cmbStyles, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SettingsGui::dirtifySettings);
connect(m_ui->m_cmbSelectToolBar, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), m_ui->m_stackedToolbars, connect(m_ui->m_cmbSelectToolBar, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), m_ui->m_stackedToolbars,
&QStackedWidget::setCurrentIndex); &QStackedWidget::setCurrentIndex);
} }
@ -156,14 +156,14 @@ void SettingsGui::loadSettings() {
// Load styles. // Load styles.
for (const QString& style_name : QStyleFactory::keys()) { for (const QString& style_name : QStyleFactory::keys()) {
m_ui->m_listStyles->addItem(style_name); m_ui->m_cmbStyles->addItem(style_name);
} }
QList<QListWidgetItem*> items = m_ui->m_listStyles->findItems(settings()->value(GROUP(GUI), SETTING(GUI::Style)).toString(), int item_style = m_ui->m_cmbStyles->findText(settings()->value(GROUP(GUI), SETTING(GUI::Style)).toString(),
Qt::MatchFixedString); Qt::MatchFlag::MatchFixedString);
if (!items.isEmpty()) { if (item_style >= 0) {
m_ui->m_listStyles->setCurrentItem(items.at(0)); m_ui->m_cmbStyles->setCurrentIndex(item_style);
} }
// Load tab settings. // Load tab settings.
@ -243,8 +243,8 @@ void SettingsGui::saveSettings() {
} }
// Set new style. // Set new style.
if (!m_ui->m_listStyles->selectedItems().isEmpty()) { if (m_ui->m_cmbStyles->currentIndex() >= 0) {
const QString new_style = m_ui->m_listStyles->currentItem()->text(); const QString new_style = m_ui->m_cmbStyles->currentText();
const QString old_style = qApp->settings()->value(GROUP(GUI), SETTING(GUI::Style)).toString(); const QString old_style = qApp->settings()->value(GROUP(GUI), SETTING(GUI::Style)).toString();
if (old_style != new_style) { if (old_style != new_style) {

View File

@ -87,16 +87,19 @@
<property name="text"> <property name="text">
<string>Style</string> <string>Style</string>
</property> </property>
<property name="buddy">
<cstring>m_cmbStyles</cstring>
</property>
</widget> </widget>
</item> </item>
<item row="1" column="1">
<widget class="QListWidget" name="m_listStyles"/>
</item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="m_lblSkin"> <widget class="QLabel" name="m_lblSkin">
<property name="text"> <property name="text">
<string>Skin</string> <string>Skin</string>
</property> </property>
<property name="buddy">
<cstring>m_treeSkins</cstring>
</property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
@ -129,6 +132,22 @@
</column> </column>
</widget> </widget>
</item> </item>
<item row="1" column="1">
<widget class="QComboBox" name="m_cmbStyles"/>
</item>
<item row="3" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>
@ -337,6 +356,9 @@
<property name="text"> <property name="text">
<string>Toolbar button style</string> <string>Toolbar button style</string>
</property> </property>
<property name="buddy">
<cstring>m_cmbToolbarButtonStyle</cstring>
</property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
@ -344,6 +366,9 @@
<property name="text"> <property name="text">
<string>Select toolbar to edit</string> <string>Select toolbar to edit</string>
</property> </property>
<property name="buddy">
<cstring>m_cmbSelectToolBar</cstring>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -364,7 +389,7 @@
<tabstop>m_tabUi</tabstop> <tabstop>m_tabUi</tabstop>
<tabstop>m_scrollIconSkins</tabstop> <tabstop>m_scrollIconSkins</tabstop>
<tabstop>m_cmbIconTheme</tabstop> <tabstop>m_cmbIconTheme</tabstop>
<tabstop>m_listStyles</tabstop> <tabstop>m_cmbStyles</tabstop>
<tabstop>m_treeSkins</tabstop> <tabstop>m_treeSkins</tabstop>
<tabstop>m_grpTray</tabstop> <tabstop>m_grpTray</tabstop>
<tabstop>m_checkMonochromeIcons</tabstop> <tabstop>m_checkMonochromeIcons</tabstop>

View File

@ -1071,8 +1071,8 @@ int DatabaseQueries::updateMessages(QSqlDatabase db,
message.m_feedId != feed_id_existing_message || message.m_feedId != feed_id_existing_message ||
message.m_contents != contents_existing_message)) || message.m_contents != contents_existing_message)) ||
/* 2 */ (message.m_createdFromFeed && message.m_created.toMSecsSinceEpoch() != date_existing_message /* 2 */ (message.m_createdFromFeed && message.m_created.toMSecsSinceEpoch() != date_existing_message &&
&& message.m_contents != contents_existing_message) || message.m_contents != contents_existing_message) ||
/* 3 */ force_update) { /* 3 */ force_update) {
// Message exists, it is changed, update it. // Message exists, it is changed, update it.