fix: sync dock toggles and make autoplay toolbar-only
Some checks failed
Build for Windows / build-windows (push) Has been cancelled
Some checks failed
Build for Windows / build-windows (push) Has been cancelled
This commit is contained in:
@@ -108,8 +108,10 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clan
|
|||||||
if (UNIX AND NOT APPLE)
|
if (UNIX AND NOT APPLE)
|
||||||
target_compile_options(qobuz-qt PRIVATE
|
target_compile_options(qobuz-qt PRIVATE
|
||||||
-fstack-protector-strong
|
-fstack-protector-strong
|
||||||
-D_FORTIFY_SOURCE=2
|
|
||||||
-fPIE
|
-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
|
target_link_options(qobuz-qt PRIVATE
|
||||||
-pie
|
-pie
|
||||||
|
|||||||
@@ -45,10 +45,6 @@ SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent)
|
|||||||
m_gapless->setChecked(AppSettings::instance().gaplessEnabled());
|
m_gapless->setChecked(AppSettings::instance().gaplessEnabled());
|
||||||
playLayout->addRow(m_gapless);
|
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);
|
layout->addWidget(playGroup);
|
||||||
|
|
||||||
// --- Last.fm group ---
|
// --- Last.fm group ---
|
||||||
@@ -105,7 +101,6 @@ void SettingsDialog::applyChanges()
|
|||||||
AppSettings::instance().setPreferredFormat(m_formatBox->currentData().toInt());
|
AppSettings::instance().setPreferredFormat(m_formatBox->currentData().toInt());
|
||||||
AppSettings::instance().setReplayGainEnabled(m_replayGain->isChecked());
|
AppSettings::instance().setReplayGainEnabled(m_replayGain->isChecked());
|
||||||
AppSettings::instance().setGaplessEnabled(m_gapless->isChecked());
|
AppSettings::instance().setGaplessEnabled(m_gapless->isChecked());
|
||||||
AppSettings::instance().setAutoplayEnabled(m_autoplay->isChecked());
|
|
||||||
AppSettings::instance().setLastFmEnabled(m_lastFmEnabled->isChecked());
|
AppSettings::instance().setLastFmEnabled(m_lastFmEnabled->isChecked());
|
||||||
AppSettings::instance().setLastFmApiKey(m_lastFmApiKey->text().trimmed());
|
AppSettings::instance().setLastFmApiKey(m_lastFmApiKey->text().trimmed());
|
||||||
AppSettings::instance().setLastFmApiSecret(m_lastFmApiSecret->text().trimmed());
|
AppSettings::instance().setLastFmApiSecret(m_lastFmApiSecret->text().trimmed());
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ private:
|
|||||||
QComboBox *m_formatBox = nullptr;
|
QComboBox *m_formatBox = nullptr;
|
||||||
QCheckBox *m_replayGain = nullptr;
|
QCheckBox *m_replayGain = nullptr;
|
||||||
QCheckBox *m_gapless = nullptr;
|
QCheckBox *m_gapless = nullptr;
|
||||||
QCheckBox *m_autoplay = nullptr;
|
|
||||||
|
|
||||||
// Last.fm
|
// Last.fm
|
||||||
QCheckBox *m_lastFmEnabled = nullptr;
|
QCheckBox *m_lastFmEnabled = nullptr;
|
||||||
|
|||||||
@@ -282,6 +282,12 @@ MainWindow::MainWindow(QobuzBackend *backend, QWidget *parent)
|
|||||||
connect(m_toolBar, &MainToolBar::searchToggled, this, &MainWindow::onSearchToggled);
|
connect(m_toolBar, &MainToolBar::searchToggled, this, &MainWindow::onSearchToggled);
|
||||||
connect(m_toolBar, &MainToolBar::queueToggled,
|
connect(m_toolBar, &MainToolBar::queueToggled,
|
||||||
this, [this](bool v) { m_queuePanel->setVisible(v); });
|
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::albumRequested, this, &MainWindow::onSearchAlbumSelected);
|
||||||
connect(m_toolBar, &MainToolBar::artistRequested, this, &MainWindow::onSearchArtistSelected);
|
connect(m_toolBar, &MainToolBar::artistRequested, this, &MainWindow::onSearchArtistSelected);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ namespace Icon
|
|||||||
inline QIcon previous() { return get("media-skip-backward"); }
|
inline QIcon previous() { return get("media-skip-backward"); }
|
||||||
inline QIcon shuffle() { return get("media-playlist-shuffle"); }
|
inline QIcon shuffle() { return get("media-playlist-shuffle"); }
|
||||||
inline QIcon repeat() { return get("media-playlist-repeat"); }
|
inline QIcon repeat() { return get("media-playlist-repeat"); }
|
||||||
|
inline QIcon autoplay() { return get("media-track-show-active"); }
|
||||||
|
|
||||||
// Volume
|
// Volume
|
||||||
inline QIcon volumeHigh() { return get("audio-volume-high"); }
|
inline QIcon volumeHigh() { return get("audio-volume-high"); }
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <QSignalBlocker>
|
||||||
|
|
||||||
MainToolBar::MainToolBar(QobuzBackend *backend, PlayQueue *queue, QWidget *parent)
|
MainToolBar::MainToolBar(QobuzBackend *backend, PlayQueue *queue, QWidget *parent)
|
||||||
: QToolBar(parent)
|
: QToolBar(parent)
|
||||||
@@ -95,7 +96,7 @@ MainToolBar::MainToolBar(QobuzBackend *backend, PlayQueue *queue, QWidget *paren
|
|||||||
m_shuffle->setCheckable(true);
|
m_shuffle->setCheckable(true);
|
||||||
connect(m_shuffle, &QAction::toggled, this, &MainToolBar::onShuffleToggled);
|
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->setCheckable(true);
|
||||||
m_autoplay->setChecked(AppSettings::instance().autoplayEnabled());
|
m_autoplay->setChecked(AppSettings::instance().autoplayEnabled());
|
||||||
connect(m_autoplay, &QAction::toggled, this, &MainToolBar::onAutoplayToggled);
|
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))));
|
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 ----
|
// ---- private slots ----
|
||||||
|
|
||||||
void MainToolBar::onPlayPause()
|
void MainToolBar::onPlayPause()
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ public:
|
|||||||
void setPlaying(bool playing);
|
void setPlaying(bool playing);
|
||||||
void setCurrentTrack(const QJsonObject &track);
|
void setCurrentTrack(const QJsonObject &track);
|
||||||
void updateProgress(quint64 position, quint64 duration);
|
void updateProgress(quint64 position, quint64 duration);
|
||||||
|
void setQueueToggleChecked(bool checked);
|
||||||
|
void setSearchToggleChecked(bool checked);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void searchToggled(bool visible);
|
void searchToggled(bool visible);
|
||||||
|
|||||||
Reference in New Issue
Block a user