refactor: rewrite toolbar to match spotify-qt structure exactly
Flat QToolBar with sequential addAction/addWidget — no nested containers. Order: [art][track] | [prev][play][next] [leftSpacer] [progress][time] [rightSpacer] [shuffle][vol][queue][search] Centering via resizeEvent: both spacers get width/6 of total bar width, mirroring the exact approach used in spotify-qt. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
#include "../util/icon.hpp"
|
||||
|
||||
#include <QToolBar>
|
||||
#include <QToolButton>
|
||||
#include <QLabel>
|
||||
#include <QAction>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QJsonObject>
|
||||
@@ -28,6 +28,9 @@ signals:
|
||||
void searchToggled(bool visible);
|
||||
void queueToggled(bool visible);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void onPlayPause();
|
||||
void onPrevious();
|
||||
@@ -49,23 +52,19 @@ private:
|
||||
QobuzBackend *m_backend = nullptr;
|
||||
PlayQueue *m_queue = nullptr;
|
||||
|
||||
// Left
|
||||
QLabel *m_artLabel = nullptr;
|
||||
QLabel *m_trackLabel = nullptr;
|
||||
|
||||
// Center
|
||||
QToolButton *m_prevBtn = nullptr;
|
||||
QToolButton *m_playBtn = nullptr;
|
||||
QToolButton *m_nextBtn = nullptr;
|
||||
ClickableSlider *m_progress = nullptr;
|
||||
QLabel *m_elapsedLabel = nullptr;
|
||||
QLabel *m_totalLabel = nullptr;
|
||||
|
||||
// Right
|
||||
VolumeButton *m_volume = nullptr;
|
||||
QToolButton *m_shuffleBtn = nullptr;
|
||||
QToolButton *m_queueBtn = nullptr;
|
||||
QToolButton *m_searchBtn = nullptr;
|
||||
QLabel *m_artLabel = nullptr;
|
||||
QLabel *m_trackLabel = nullptr;
|
||||
QAction *m_previous = nullptr;
|
||||
QAction *m_playPause = nullptr;
|
||||
QAction *m_next = nullptr;
|
||||
QWidget *m_leftSpacer = nullptr;
|
||||
ClickableSlider *m_progress = nullptr;
|
||||
QLabel *m_position = nullptr;
|
||||
QWidget *m_rightSpacer = nullptr;
|
||||
QAction *m_shuffle = nullptr;
|
||||
VolumeButton *m_volume = nullptr;
|
||||
QAction *m_queueBtn = nullptr;
|
||||
QAction *m_search = nullptr;
|
||||
|
||||
QNetworkAccessManager *m_nam = nullptr;
|
||||
QString m_currentArtUrl;
|
||||
|
||||
Reference in New Issue
Block a user