Add setting for enabling scrobbling based on song source

Fixes #416
This commit is contained in:
Jonas Kvinge
2020-08-25 23:44:27 +02:00
parent ae48008803
commit 1431916183
6 changed files with 193 additions and 1 deletions

View File

@@ -33,6 +33,7 @@
#include "settingspage.h"
#include "core/application.h"
#include "core/iconloader.h"
#include "core/song.h"
#include "widgets/loginstatewidget.h"
#include "scrobbler/audioscrobbler.h"
@@ -96,6 +97,15 @@ void ScrobblerSettingsPage::Load() {
ui_->checkbox_albumartist->setChecked(scrobbler_->PreferAlbumArtist());
ui_->checkbox_show_error_dialog->setChecked(scrobbler_->ShowErrorDialog());
ui_->checkbox_source_collection->setChecked(scrobbler_->sources().contains(Song::Source_Collection));
ui_->checkbox_source_local->setChecked(scrobbler_->sources().contains(Song::Source_LocalFile));
ui_->checkbox_source_cdda->setChecked(scrobbler_->sources().contains(Song::Source_CDDA));
ui_->checkbox_source_device->setChecked(scrobbler_->sources().contains(Song::Source_Device));
ui_->checkbox_source_tidal->setChecked(scrobbler_->sources().contains(Song::Source_Tidal));
ui_->checkbox_source_subsonic->setChecked(scrobbler_->sources().contains(Song::Source_Subsonic));
ui_->checkbox_source_stream->setChecked(scrobbler_->sources().contains(Song::Source_Stream));
ui_->checkbox_source_unknown->setChecked(scrobbler_->sources().contains(Song::Source_Unknown));
ui_->checkbox_lastfm_enable->setChecked(lastfmscrobbler_->IsEnabled());
ui_->checkbox_lastfm_https->setChecked(lastfmscrobbler_->IsUseHTTPS());
LastFM_RefreshControls(lastfmscrobbler_->IsAuthenticated());
@@ -123,6 +133,19 @@ void ScrobblerSettingsPage::Save() {
s.setValue("submit", ui_->spinbox_submit->value());
s.setValue("albumartist", ui_->checkbox_albumartist->isChecked());
s.setValue("show_error_dialog", ui_->checkbox_show_error_dialog->isChecked());
QStringList sources;
if (ui_->checkbox_source_collection->isChecked()) sources << Song::TextForSource(Song::Source_Collection);
if (ui_->checkbox_source_local->isChecked()) sources << Song::TextForSource(Song::Source_LocalFile);
if (ui_->checkbox_source_cdda->isChecked()) sources << Song::TextForSource(Song::Source_CDDA);
if (ui_->checkbox_source_device->isChecked()) sources << Song::TextForSource(Song::Source_Device);
if (ui_->checkbox_source_tidal->isChecked()) sources << Song::TextForSource(Song::Source_Tidal);
if (ui_->checkbox_source_subsonic->isChecked()) sources << Song::TextForSource(Song::Source_Subsonic);
if (ui_->checkbox_source_stream->isChecked()) sources << Song::TextForSource(Song::Source_Stream);
if (ui_->checkbox_source_unknown->isChecked()) sources << Song::TextForSource(Song::Source_Unknown);
s.setValue("sources", sources);
s.endGroup();
s.beginGroup(LastFMScrobbler::kSettingsGroup);

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>460</width>
<height>960</height>
<height>1009</height>
</rect>
</property>
<property name="windowTitle">
@@ -116,6 +116,131 @@
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Enable scrobbling for the following sources:</string>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="horizontalSpacing">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="checkbox_source_collection">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Collection</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="checkbox_source_tidal">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Tidal</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="checkbox_source_cdda">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>CDDA</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkbox_source_stream">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Stream</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="checkbox_source_unknown">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="checkbox_source_subsonic">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Subsonic</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkbox_source_local">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Local file</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkbox_source_device">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Device</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupbox_lastfm">
<property name="title">