forked from trav/lintunes
v0.5.1: one cast control instead of two
The cast glyph showed up both under the volume slider and inside the visualizer, which was redundant. Dropped the volume-slider indicator (gui/cast_indicator.py deleted) and made the visualizer panel the single cast control — the volume slider goes back to sitting on its own, and nothing shifts position when a session starts. The panel's glyph is bigger (20 -> 40px) and always painted in the theme highlight rather than following the brightness mode. Clicking it now stops casting instead of cycling on/dim/off, which meant nothing when there are no bars to dim; that click was the useful behavior the volume-slider icon had, so it moves here rather than being lost. transport_icon() takes a size and scales the painter, so the bigger glyph is repainted crisply rather than being a blown-up 20px pixmap; size joins the cache key. The cast/cast_connected glyph pair collapses into one, since only the connected state was ever drawn. 450 tests pass.
This commit is contained in:
@@ -8,7 +8,6 @@ from PyQt6.QtCore import Qt, QTimer, pyqtSignal
|
||||
from PyQt6.QtGui import QColor, QFont
|
||||
|
||||
from lintunes.tap_tempo import TapTempo
|
||||
from lintunes.gui.cast_indicator import CastIndicator
|
||||
from lintunes.gui.icons import transport_icon
|
||||
from lintunes.gui.track_table import format_time
|
||||
from lintunes.gui.visualizer import VisualizerWidget
|
||||
@@ -282,9 +281,8 @@ class TransportBar(QWidget):
|
||||
layout.addSpacing(10)
|
||||
|
||||
# Master output volume: a slim horizontal slider in its own slot
|
||||
# between the visualizer and the timeline, with the cast indicator
|
||||
# parked directly beneath it. The column is shorter than the boxes
|
||||
# beside it, so the HBox still centers it and BAR_HEIGHT is untouched.
|
||||
# between the visualizer and the timeline. The HBox centers it
|
||||
# vertically, so nothing stacks above or below it (iTunes-style).
|
||||
self._volume_slider = ClickJumpSlider()
|
||||
self._volume_slider.setRange(0, 100)
|
||||
self._volume_slider.setFixedWidth(96)
|
||||
@@ -300,15 +298,7 @@ class TransportBar(QWidget):
|
||||
self._volume_save_timer.setInterval(400)
|
||||
self._volume_save_timer.timeout.connect(self._save_volume)
|
||||
self._volume_slider.valueChanged.connect(self._on_volume_changed)
|
||||
volume_col = QVBoxLayout()
|
||||
volume_col.setSpacing(2)
|
||||
volume_col.setContentsMargins(0, 0, 0, 0)
|
||||
volume_col.addWidget(self._volume_slider,
|
||||
alignment=Qt.AlignmentFlag.AlignHCenter)
|
||||
self._cast_indicator = CastIndicator()
|
||||
volume_col.addWidget(self._cast_indicator,
|
||||
alignment=Qt.AlignmentFlag.AlignHCenter)
|
||||
layout.addLayout(volume_col)
|
||||
layout.addWidget(self._volume_slider)
|
||||
layout.addSpacing(10)
|
||||
|
||||
center = QVBoxLayout()
|
||||
@@ -377,11 +367,10 @@ class TransportBar(QWidget):
|
||||
player.position_changed.connect(self._on_position_changed)
|
||||
player.duration_changed.connect(self._on_duration_changed)
|
||||
if cast is not None:
|
||||
cast.connected.connect(
|
||||
lambda name: self._cast_indicator.set_connected(True, name))
|
||||
cast.disconnected.connect(
|
||||
lambda _reason: self._cast_indicator.set_connected(False))
|
||||
self._cast_indicator.clicked.connect(lambda: cast.disconnect())
|
||||
# While casting, the visualizer panel *is* the cast indicator —
|
||||
# there is no spectrum to show, so a click there stops casting.
|
||||
self._visualizer.cast_stop_requested.connect(
|
||||
lambda: cast.disconnect())
|
||||
|
||||
def refresh_theme(self):
|
||||
"""Re-apply everything driven by Preferences: button glyphs (highlight
|
||||
@@ -395,7 +384,6 @@ class TransportBar(QWidget):
|
||||
box.setStyleSheet(_box_style(box_bg))
|
||||
self._apply_now_playing_bg()
|
||||
self._apply_now_playing_font()
|
||||
self._cast_indicator.refresh_theme()
|
||||
self._visualizer.update() # dim-mode bar color may have changed
|
||||
|
||||
def _apply_now_playing_bg(self):
|
||||
|
||||
Reference in New Issue
Block a user