fix: sync dock toggles and make autoplay toolbar-only
Some checks failed
Build for Windows / build-windows (push) Has been cancelled

This commit is contained in:
joren
2026-03-31 01:14:43 +02:00
parent 2aff8fda47
commit cdac82dbef
7 changed files with 26 additions and 8 deletions

View File

@@ -108,8 +108,10 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clan
if (UNIX AND NOT APPLE)
target_compile_options(qobuz-qt PRIVATE
-fstack-protector-strong
-D_FORTIFY_SOURCE=2
-fPIE
# _FORTIFY_SOURCE needs optimized builds; in Debug it causes warning spam.
$<$<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>,$<CONFIG:MinSizeRel>>:-D_FORTIFY_SOURCE=2>
$<$<CONFIG:Debug>:-U_FORTIFY_SOURCE>
)
target_link_options(qobuz-qt PRIVATE
-pie

View File

@@ -45,10 +45,6 @@ SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent)
m_gapless->setChecked(AppSettings::instance().gaplessEnabled());
playLayout->addRow(m_gapless);
m_autoplay = new QCheckBox(tr("Autoplay recommendations when queue ends"), playGroup);
m_autoplay->setChecked(AppSettings::instance().autoplayEnabled());
playLayout->addRow(m_autoplay);
layout->addWidget(playGroup);
// --- Last.fm group ---
@@ -105,7 +101,6 @@ void SettingsDialog::applyChanges()
AppSettings::instance().setPreferredFormat(m_formatBox->currentData().toInt());
AppSettings::instance().setReplayGainEnabled(m_replayGain->isChecked());
AppSettings::instance().setGaplessEnabled(m_gapless->isChecked());
AppSettings::instance().setAutoplayEnabled(m_autoplay->isChecked());
AppSettings::instance().setLastFmEnabled(m_lastFmEnabled->isChecked());
AppSettings::instance().setLastFmApiKey(m_lastFmApiKey->text().trimmed());
AppSettings::instance().setLastFmApiSecret(m_lastFmApiSecret->text().trimmed());

View File

@@ -20,7 +20,6 @@ private:
QComboBox *m_formatBox = nullptr;
QCheckBox *m_replayGain = nullptr;
QCheckBox *m_gapless = nullptr;
QCheckBox *m_autoplay = nullptr;
// Last.fm
QCheckBox *m_lastFmEnabled = nullptr;

View File

@@ -282,6 +282,12 @@ MainWindow::MainWindow(QobuzBackend *backend, QWidget *parent)
connect(m_toolBar, &MainToolBar::searchToggled, this, &MainWindow::onSearchToggled);
connect(m_toolBar, &MainToolBar::queueToggled,
this, [this](bool v) { m_queuePanel->setVisible(v); });
connect(m_queuePanel, &QDockWidget::visibilityChanged,
m_toolBar, &MainToolBar::setQueueToggleChecked);
connect(m_sidePanel, &QDockWidget::visibilityChanged,
m_toolBar, &MainToolBar::setSearchToggleChecked);
m_toolBar->setQueueToggleChecked(m_queuePanel->isVisible());
m_toolBar->setSearchToggleChecked(m_sidePanel->isVisible());
connect(m_toolBar, &MainToolBar::albumRequested, this, &MainWindow::onSearchAlbumSelected);
connect(m_toolBar, &MainToolBar::artistRequested, this, &MainWindow::onSearchArtistSelected);

View File

@@ -24,6 +24,7 @@ namespace Icon
inline QIcon previous() { return get("media-skip-backward"); }
inline QIcon shuffle() { return get("media-playlist-shuffle"); }
inline QIcon repeat() { return get("media-playlist-repeat"); }
inline QIcon autoplay() { return get("media-track-show-active"); }
// Volume
inline QIcon volumeHigh() { return get("audio-volume-high"); }

View File

@@ -6,6 +6,7 @@
#include <QResizeEvent>
#include <QMenu>
#include <QDateTime>
#include <QSignalBlocker>
MainToolBar::MainToolBar(QobuzBackend *backend, PlayQueue *queue, QWidget *parent)
: QToolBar(parent)
@@ -95,7 +96,7 @@ MainToolBar::MainToolBar(QobuzBackend *backend, PlayQueue *queue, QWidget *paren
m_shuffle->setCheckable(true);
connect(m_shuffle, &QAction::toggled, this, &MainToolBar::onShuffleToggled);
m_autoplay = addAction(Icon::repeat(), tr("Autoplay"));
m_autoplay = addAction(Icon::autoplay(), tr("Autoplay"));
m_autoplay->setCheckable(true);
m_autoplay->setChecked(AppSettings::instance().autoplayEnabled());
connect(m_autoplay, &QAction::toggled, this, &MainToolBar::onAutoplayToggled);
@@ -190,6 +191,18 @@ void MainToolBar::updateProgress(quint64 position, quint64 duration)
TrackListModel::formatDuration(static_cast<qint64>(duration))));
}
void MainToolBar::setQueueToggleChecked(bool checked)
{
const QSignalBlocker blocker(m_queueBtn);
m_queueBtn->setChecked(checked);
}
void MainToolBar::setSearchToggleChecked(bool checked)
{
const QSignalBlocker blocker(m_search);
m_search->setChecked(checked);
}
// ---- private slots ----
void MainToolBar::onPlayPause()

View File

@@ -24,6 +24,8 @@ public:
void setPlaying(bool playing);
void setCurrentTrack(const QJsonObject &track);
void updateProgress(quint64 position, quint64 duration);
void setQueueToggleChecked(bool checked);
void setSearchToggleChecked(bool checked);
signals:
void searchToggled(bool visible);