fix: move media controls next to track info, not centered
Controls (prev/play/next) and progress bar are now stacked vertically to the right of the album art + track label, all in the left section. Right side keeps volume, shuffle, queue, search toggles. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -29,7 +29,7 @@ MainToolBar::MainToolBar(QobuzBackend *backend, PlayQueue *queue, QWidget *paren
|
||||
rootLo->setContentsMargins(6, 2, 6, 2);
|
||||
rootLo->setSpacing(0);
|
||||
|
||||
// ---- LEFT: album art + track info ----
|
||||
// ---- LEFT: album art + track info + controls + progress ----
|
||||
auto *leftWidget = new QWidget(root);
|
||||
auto *leftLo = new QHBoxLayout(leftWidget);
|
||||
leftLo->setContentsMargins(0, 0, 0, 0);
|
||||
@@ -42,28 +42,23 @@ MainToolBar::MainToolBar(QobuzBackend *backend, PlayQueue *queue, QWidget *paren
|
||||
m_artLabel->setPixmap(QIcon(":/res/icons/view-media-album-cover.svg").pixmap(40, 40));
|
||||
|
||||
m_trackLabel = new QLabel(tr("Not playing"), leftWidget);
|
||||
m_trackLabel->setMinimumWidth(120);
|
||||
m_trackLabel->setMaximumWidth(280);
|
||||
m_trackLabel->setMinimumWidth(100);
|
||||
m_trackLabel->setMaximumWidth(200);
|
||||
m_trackLabel->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
|
||||
m_trackLabel->setWordWrap(false);
|
||||
|
||||
leftLo->addWidget(m_artLabel);
|
||||
leftLo->addWidget(m_trackLabel);
|
||||
leftLo->addStretch(1);
|
||||
// Controls + progress stacked vertically
|
||||
auto *ctrlWidget = new QWidget(leftWidget);
|
||||
auto *ctrlVLo = new QVBoxLayout(ctrlWidget);
|
||||
ctrlVLo->setContentsMargins(0, 0, 0, 0);
|
||||
ctrlVLo->setSpacing(2);
|
||||
|
||||
// ---- CENTER: controls + progress ----
|
||||
auto *centerWidget = new QWidget(root);
|
||||
auto *centerLo = new QVBoxLayout(centerWidget);
|
||||
centerLo->setContentsMargins(0, 0, 0, 0);
|
||||
centerLo->setSpacing(2);
|
||||
|
||||
// Controls row: prev / play-pause / next
|
||||
auto *ctrlRow = new QHBoxLayout;
|
||||
ctrlRow->setSpacing(4);
|
||||
ctrlRow->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
auto makeBtn = [&](const QIcon &icon, const QString &tip) -> QToolButton * {
|
||||
auto *btn = new QToolButton(centerWidget);
|
||||
auto *btn = new QToolButton(ctrlWidget);
|
||||
btn->setIcon(icon);
|
||||
btn->setToolTip(tip);
|
||||
btn->setAutoRaise(true);
|
||||
@@ -80,28 +75,25 @@ MainToolBar::MainToolBar(QobuzBackend *backend, PlayQueue *queue, QWidget *paren
|
||||
connect(m_playBtn, &QToolButton::clicked, this, &MainToolBar::onPlayPause);
|
||||
connect(m_nextBtn, &QToolButton::clicked, this, &MainToolBar::onNext);
|
||||
|
||||
ctrlRow->addStretch(1);
|
||||
ctrlRow->addWidget(m_prevBtn);
|
||||
ctrlRow->addWidget(m_playBtn);
|
||||
ctrlRow->addWidget(m_nextBtn);
|
||||
ctrlRow->addStretch(1);
|
||||
ctrlRow->addSpacing(4);
|
||||
|
||||
// Progress row: elapsed / slider / total
|
||||
auto *progRow = new QHBoxLayout;
|
||||
progRow->setSpacing(6);
|
||||
progRow->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
m_elapsedLabel = new QLabel(QStringLiteral("0:00"), centerWidget);
|
||||
m_elapsedLabel = new QLabel(QStringLiteral("0:00"), ctrlWidget);
|
||||
m_elapsedLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
m_elapsedLabel->setMinimumWidth(36);
|
||||
|
||||
m_progress = new ClickableSlider(Qt::Horizontal, centerWidget);
|
||||
m_progress = new ClickableSlider(Qt::Horizontal, ctrlWidget);
|
||||
m_progress->setRange(0, 1000);
|
||||
m_progress->setValue(0);
|
||||
m_progress->setMinimumWidth(200);
|
||||
m_progress->setMaximumWidth(500);
|
||||
m_progress->setMinimumWidth(120);
|
||||
|
||||
m_totalLabel = new QLabel(QStringLiteral("0:00"), centerWidget);
|
||||
m_totalLabel = new QLabel(QStringLiteral("0:00"), ctrlWidget);
|
||||
m_totalLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
m_totalLabel->setMinimumWidth(36);
|
||||
|
||||
@@ -112,8 +104,12 @@ MainToolBar::MainToolBar(QobuzBackend *backend, PlayQueue *queue, QWidget *paren
|
||||
progRow->addWidget(m_progress, 1);
|
||||
progRow->addWidget(m_totalLabel);
|
||||
|
||||
centerLo->addLayout(ctrlRow);
|
||||
centerLo->addLayout(progRow);
|
||||
ctrlVLo->addLayout(ctrlRow);
|
||||
ctrlVLo->addLayout(progRow);
|
||||
|
||||
leftLo->addWidget(m_artLabel);
|
||||
leftLo->addWidget(m_trackLabel);
|
||||
leftLo->addWidget(ctrlWidget, 1);
|
||||
|
||||
// ---- RIGHT: volume + shuffle + queue + search ----
|
||||
auto *rightWidget = new QWidget(root);
|
||||
@@ -149,10 +145,9 @@ MainToolBar::MainToolBar(QobuzBackend *backend, PlayQueue *queue, QWidget *paren
|
||||
rightLo->addWidget(m_queueBtn);
|
||||
rightLo->addWidget(m_searchBtn);
|
||||
|
||||
// ---- Assemble root: equal stretch on left + right keeps center centred ----
|
||||
// ---- Assemble root ----
|
||||
rootLo->addWidget(leftWidget, 1);
|
||||
rootLo->addWidget(centerWidget, 0, Qt::AlignCenter);
|
||||
rootLo->addWidget(rightWidget, 1);
|
||||
rootLo->addWidget(rightWidget, 0);
|
||||
|
||||
root->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
addWidget(root);
|
||||
|
||||
Reference in New Issue
Block a user