forked from Wobbl/Wobuzz
Added option to always clear the cache of the last track when another track starts to greatly reduce memory usage.
This commit is contained in:
parent
cba4fd67fa
commit
dc46ac07bb
5 changed files with 38 additions and 1 deletions
14
wobuzz/ui/settings/behavior.py
Normal file
14
wobuzz/ui/settings/behavior.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
from PyQt6.QtWidgets import QWidget, QFormLayout, QCheckBox
|
||||
|
||||
|
||||
class BehaviourSettings(QWidget):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
self.layout = QFormLayout(self)
|
||||
self.setLayout(self.layout)
|
||||
|
||||
self.clear_track_cache = QCheckBox(self)
|
||||
self.layout.addRow("Clear track cache immediately when finished", self.clear_track_cache)
|
|
@ -3,6 +3,7 @@
|
|||
from PyQt6.QtCore import Qt
|
||||
from PyQt6.QtWidgets import QWidget, QDockWidget, QTabWidget, QPushButton, QVBoxLayout
|
||||
from .file import FileSettings
|
||||
from .behavior import BehaviourSettings
|
||||
|
||||
|
||||
class Settings(QDockWidget):
|
||||
|
@ -24,10 +25,13 @@ class Settings(QDockWidget):
|
|||
self.content.setLayout(self.content_layout)
|
||||
|
||||
self.tabs = QTabWidget(self.content)
|
||||
self.content_layout.addWidget(self.tabs)
|
||||
|
||||
self.file_settings = FileSettings()
|
||||
self.tabs.addTab(self.file_settings, "Files")
|
||||
self.content_layout.addWidget(self.tabs)
|
||||
|
||||
self.behavior_settings = BehaviourSettings()
|
||||
self.tabs.addTab(self.behavior_settings, "Behavior")
|
||||
|
||||
self.save_button = QPushButton("&Save", self.content)
|
||||
self.content_layout.addWidget(self.save_button)
|
||||
|
@ -39,12 +43,17 @@ class Settings(QDockWidget):
|
|||
|
||||
def update_all(self, _=True): # ignore visible parameter passed by visibilityChanged event
|
||||
self.file_settings.library_path_input.setText(self.app.settings.library_path)
|
||||
self.behavior_settings.clear_track_cache.setChecked(self.app.settings.clear_track_cache)
|
||||
|
||||
def update_settings(self, key, value):
|
||||
match key:
|
||||
case "library_path":
|
||||
self.file_settings.library_path_input.setText(value)
|
||||
|
||||
case "clear_track_cache":
|
||||
self.behavior_settings.clear_track_cache.setDown(value)
|
||||
|
||||
def write_settings(self):
|
||||
self.app.settings.library_path = self.file_settings.library_path_input.text()
|
||||
self.app.settings.clear_track_cache = self.behavior_settings.clear_track_cache.isChecked()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue