Fixed light theme slider colors in voice mixer

This commit is contained in:
Deniz Şafak
2025-10-27 17:43:54 +03:00
parent 47fe6341b4
commit 7883b8865b
2 changed files with 45 additions and 14 deletions
+1
View File
@@ -3,6 +3,7 @@
- Added tooltip indicators in queue manager to display book handler options (`Save chapters separately` and `Merge chapters at the end`) for queued items. - Added tooltip indicators in queue manager to display book handler options (`Save chapters separately` and `Merge chapters at the end`) for queued items.
- Added `Open processed file` and `Open input file` options for items in the queue manager, instead of just `Open file` option. - Added `Open processed file` and `Open input file` options for items in the queue manager, instead of just `Open file` option.
- Added loading gif animation to book handler window. - Added loading gif animation to book handler window.
- Fixed light theme slider colors in voice mixer for better visibility (for non-Windows users).
- Fixed subtitle word-count splitting logic for more accurate segmentation. - Fixed subtitle word-count splitting logic for more accurate segmentation.
# 1.2.0 # 1.2.0
+44 -14
View File
@@ -242,20 +242,8 @@ class VoiceMixer(QWidget):
) )
self.slider.setFixedWidth(SLIDER_WIDTH) self.slider.setFixedWidth(SLIDER_WIDTH)
# Fix slider in Windows # Apply slider styling after widget is added to window (see showEvent)
if platform.system() == "Windows": self._slider_style_applied = False
appstyle = QApplication.instance().style().objectName().lower()
if appstyle != "windowsvista":
# Set custom groove color for disabled state using COLORS["GREY_BACKGROUND"]
self.slider.setStyleSheet(
f"""
QSlider::groove:vertical:disabled {{
background: {COLORS.get("GREY_BACKGROUND")};
width: 4px;
border-radius: 4px;
}}
"""
)
# Connect controls # Connect controls
self.slider.valueChanged.connect(lambda val: self.spin_box.setValue(val / 100)) self.slider.valueChanged.connect(lambda val: self.spin_box.setValue(val / 100))
@@ -285,6 +273,48 @@ class VoiceMixer(QWidget):
self.setLayout(layout) self.setLayout(layout)
self.toggle_inputs() self.toggle_inputs()
def showEvent(self, event):
super().showEvent(event)
# Apply slider styling once when widget is shown and has access to parent
if not self._slider_style_applied:
self._slider_style_applied = True
# Fix slider in Windows
if platform.system() == "Windows":
appstyle = QApplication.instance().style().objectName().lower()
if appstyle != "windowsvista":
# Set custom groove color for disabled state using COLORS["GREY_BACKGROUND"]
self.slider.setStyleSheet(
f"""
QSlider::groove:vertical:disabled {{
background: {COLORS.get("GREY_BACKGROUND")};
width: 4px;
border-radius: 4px;
}}
"""
)
else:
# Apply same fix for Light theme on non-Windows systems
# Get theme from parent window's config
parent_window = self.window()
theme = "system"
while parent_window:
if hasattr(parent_window, "config"):
theme = parent_window.config.get("theme", "system")
break
parent_window = parent_window.parent()
if theme == "light":
self.slider.setStyleSheet(
f"""
QSlider::groove:vertical:disabled {{
background: {COLORS.get("GREY_BACKGROUND")};
width: 4px;
border-radius: 4px;
}}
"""
)
def toggle_inputs(self): def toggle_inputs(self):
is_enabled = self.checkbox.isChecked() is_enabled = self.checkbox.isChecked()
self.spin_box.setEnabled(is_enabled) self.spin_box.setEnabled(is_enabled)