Add zoom to default zoom level on unknown hosts
Signed-off-by: Juraj Oravec <sgd.orava@gmail.com>
This commit is contained in:
parent
256de794a3
commit
ae01a4de54
|
@ -32,7 +32,8 @@ class AutoZoomer(QtCore.QObject):
|
|||
|
||||
self.config = {
|
||||
"settingsFile": os.path.join(settingsPath, "autoZoomer", "settings.ini"),
|
||||
"active": True
|
||||
"active": True,
|
||||
"defaultZoom": True
|
||||
}
|
||||
self.data = {}
|
||||
self.remove = []
|
||||
|
@ -50,6 +51,7 @@ class AutoZoomer(QtCore.QObject):
|
|||
|
||||
settings.beginGroup("AutoZoomer")
|
||||
self.config["active"] = str2bool(settings.value("active", True))
|
||||
self.config["defaultZoom"] = str2bool(settings.value("defaultZoom", True))
|
||||
settings.endGroup()
|
||||
|
||||
for group in settings.childGroups():
|
||||
|
@ -68,6 +70,7 @@ class AutoZoomer(QtCore.QObject):
|
|||
|
||||
settings.beginGroup("AutoZoomer")
|
||||
settings.setValue("active", self.config["active"])
|
||||
settings.setValue("defaultZoom", self.config["defaultZoom"])
|
||||
settings.endGroup()
|
||||
|
||||
for host in self.remove:
|
||||
|
@ -92,6 +95,8 @@ class AutoZoomer(QtCore.QObject):
|
|||
if host in self.data.keys():
|
||||
if self.data[host]["active"]:
|
||||
view.setZoomLevel(self.data[host]["zoom"])
|
||||
elif self.config["defaultZoom"]:
|
||||
view.setZoomLevel(Falkon.Settings.staticSettings().defaultZoomLevel)
|
||||
|
||||
def addItem(self, host, zoom=6, active=True):
|
||||
if not host:
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>379</width>
|
||||
<width>390</width>
|
||||
<height>334</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -102,6 +102,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxDefaultZoom">
|
||||
<property name="text">
|
||||
<string>On unknown host zoom to default zoom level</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBoxConfirm">
|
||||
<property name="tabletTracking">
|
||||
|
|
|
@ -46,6 +46,7 @@ class SettingsDialog(QtWidgets.QDialog):
|
|||
self.setLayout(layout)
|
||||
|
||||
self.ui.checkBoxEnableAutoZoomer.setChecked(self.config["active"])
|
||||
self.ui.checkBoxDefaultZoom.setChecked(self.config["defaultZoom"])
|
||||
|
||||
for key, value in self.data.items():
|
||||
widget = ListItem()
|
||||
|
@ -89,6 +90,7 @@ class SettingsDialog(QtWidgets.QDialog):
|
|||
|
||||
def updateData(self):
|
||||
self.config["active"] = self.ui.checkBoxEnableAutoZoomer.isChecked()
|
||||
self.config["defaultZoom"] = self.ui.checkBoxDefaultZoom.isChecked()
|
||||
|
||||
self.data.clear()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user