- Rust backend (qobuz-backend static lib): Qobuz API client (reqwest/tokio), Symphonia audio decoder, CPAL audio output, extern "C" FFI bridge - Qt 6 frontend mirroring spotify-qt layout: toolbar with playback controls, left library dock, central track list, right search panel - Auth: email/password login with MD5-signed requests; session token persisted via QSettings - Playback: double-click a track → Rust fetches stream URL → Symphonia decodes → CPAL outputs to default audio device - Dark Fusion palette matching spotify-qt feel Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
64 lines
1.6 KiB
C++
64 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include "../backend/qobuzbackend.hpp"
|
|
#include "../widget/volumebutton.hpp"
|
|
#include "../widget/clickableslider.hpp"
|
|
#include "../util/icon.hpp"
|
|
|
|
#include <QToolBar>
|
|
#include <QToolButton>
|
|
#include <QLabel>
|
|
#include <QAction>
|
|
#include <QJsonObject>
|
|
|
|
/// Main playback toolbar — mirrors MainToolBar from spotify-qt.
|
|
class MainToolBar : public QToolBar
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit MainToolBar(QobuzBackend *backend, QWidget *parent = nullptr);
|
|
|
|
void setPlaying(bool playing);
|
|
void setCurrentTrack(const QJsonObject &track);
|
|
void updateProgress(quint64 position, quint64 duration);
|
|
void setVolume(int volume);
|
|
|
|
signals:
|
|
void searchToggled(bool visible);
|
|
|
|
private slots:
|
|
void onPlayPause(bool checked);
|
|
void onPrevious();
|
|
void onNext();
|
|
void onProgressReleased();
|
|
void onVolumeChanged(int volume);
|
|
|
|
void onBackendStateChanged(const QString &state);
|
|
void onTrackChanged(const QJsonObject &track);
|
|
void onPositionChanged(quint64 position, quint64 duration);
|
|
void onTrackFinished();
|
|
|
|
private:
|
|
QobuzBackend *m_backend = nullptr;
|
|
|
|
QAction *m_previous = nullptr;
|
|
QAction *m_playPause = nullptr;
|
|
QAction *m_next = nullptr;
|
|
QAction *m_search = nullptr;
|
|
|
|
ClickableSlider *m_progress = nullptr;
|
|
QLabel *m_timeLabel = nullptr;
|
|
QLabel *m_trackLabel = nullptr;
|
|
VolumeButton *m_volume = nullptr;
|
|
|
|
bool m_playing = false;
|
|
bool m_seeking = false;
|
|
|
|
// Playback queue (track IDs) for next/prev
|
|
QVector<qint64> m_queue;
|
|
int m_queueIdx = -1;
|
|
|
|
void addSpacerWidget();
|
|
};
|