Add reader`s options to settings dialog

Signed-off-by: Juraj Oravec <sgd.orava@gmail.com>
This commit is contained in:
Juraj Oravec 2019-06-20 22:48:43 +02:00
parent d4ad0c5078
commit 49089e7e45
No known key found for this signature in database
GPG Key ID: 63ACB65056BC8D07
2 changed files with 169 additions and 16 deletions

View File

@ -41,22 +41,58 @@ class SettingsDialog(QtWidgets.QDialog):
self.setLayout(layout)
self.translations()
self.ui.radioButtonLight.setChecked(self.config["icon"] == "light")
self.ui.radioButtonDark.setChecked(self.config["icon"] == "dark")
self.ui.checkBoxContextMenu.setChecked(self.config["contextMenu"])
self.applyConfig()
self.ui.buttonBoxConfirm.accepted.connect(self.accept)
self.ui.buttonBoxConfirm.rejected.connect(self.reject)
def applyConfig(self):
self.ui.radioButtonLight.setChecked(self.config["icon"] == "light")
self.ui.radioButtonDark.setChecked(self.config["icon"] == "dark")
self.ui.radioButtonSchemeLight.setChecked(self.config["colorTheme"] == "light")
self.ui.radioButtonSchemeSepia.setChecked(self.config["colorTheme"] == "sepia")
self.ui.radioButtonSchemeDark.setChecked(self.config["colorTheme"] == "dark")
self.ui.radioButtonFontSansSerif.setChecked(self.config["font"] == "sans-serif")
self.ui.radioButtonFontSerif.setChecked(self.config["font"] == "serif")
self.ui.comboBoxFontSize.setCurrentIndex(self.config["fontSize"] - 1)
self.ui.checkBoxContextMenu.setChecked(self.config["contextMenu"])
def translations(self):
self.setWindowTitle(i18n("Readability Settings"))
self.ui.groupBoxIcon.setTitle(i18n("Menu icon"))
self.ui.radioButtonLight.setText(i18n("Light"))
self.ui.radioButtonDark.setText(i18n("Dark"))
self.ui.groupBoxColorScheme.setTitle(i18n("Color scheme"))
self.ui.radioButtonSchemeLight.setText(i18n("Light"))
self.ui.radioButtonSchemeSepia.setText(i18n("Sepia"))
self.ui.radioButtonSchemeDark.setText(i18n("Dark"))
self.ui.groupBoxFont.setTitle(i18n("Font"))
self.ui.radioButtonFontSansSerif.setText(i18n("Sans-Serif"))
self.ui.radioButtonFontSerif.setText(i18n("Serif"))
self.ui.labelFontSize.setText(i18n("Font size:"))
self.ui.checkBoxContextMenu.setText(i18n("Show in context menu"))
def updateData(self):
self.config["icon"] = "light" if self.ui.radioButtonLight.isChecked() else "dark"
if self.ui.radioButtonSchemeLight.isChecked():
self.config["colorTheme"] = "light"
elif self.ui.radioButtonSchemeSepia.isChecked():
self.config["colorTheme"] = "sepia"
else:
self.config["colorTheme"] = "dark"
self.config["font"] = "sans-serif" if self.ui.radioButtonFontSansSerif.isChecked() else "serif"
self.config["fontSize"] = self.ui.comboBoxFontSize.currentIndex() + 1
self.config["contextMenu"] = self.ui.checkBoxContextMenu.isChecked()
def accept(self):

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>399</width>
<height>180</height>
<width>350</width>
<height>344</height>
</rect>
</property>
<property name="windowTitle">
@ -16,13 +16,15 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QGroupBox" name="groupBoxIcon">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Menu icon:</string>
<string>Menu icon</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
@ -42,6 +44,121 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxColorScheme">
<property name="title">
<string>Color scheme</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QRadioButton" name="radioButtonSchemeLight">
<property name="text">
<string>Light</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonSchemeSepia">
<property name="text">
<string>Sepia</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonSchemeDark">
<property name="text">
<string>Dark</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBoxFont">
<property name="title">
<string>Font</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QRadioButton" name="radioButtonFontSansSerif">
<property name="text">
<string>Sans-Serif</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonFontSerif">
<property name="text">
<string>Serif</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="1,0">
<item>
<widget class="QLabel" name="labelFontSize">
<property name="text">
<string>Font size:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxFontSize">
<item>
<property name="text">
<string>10 px</string>
</property>
</item>
<item>
<property name="text">
<string>12 px</string>
</property>
</item>
<item>
<property name="text">
<string>14 px</string>
</property>
</item>
<item>
<property name="text">
<string>16 px</string>
</property>
</item>
<item>
<property name="text">
<string>18 px</string>
</property>
</item>
<item>
<property name="text">
<string>20 px</string>
</property>
</item>
<item>
<property name="text">
<string>22 px</string>
</property>
</item>
<item>
<property name="text">
<string>24 px</string>
</property>
</item>
<item>
<property name="text">
<string>26 px</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxContextMenu">
<property name="text">