mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-19 07:19:42 +01:00
TWK-1389: Utilize private sessions, if private
This commit is contained in:
parent
063f0653ac
commit
580cb8032f
@ -32,6 +32,7 @@
|
||||
#include "SpotifyInfoPlugin.h"
|
||||
#include "infosystem/InfoSystem.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "TomahawkSettings.h"
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
#include "jobview/JobStatusView.h"
|
||||
@ -226,7 +227,7 @@ SpotifyAccount::hookupResolver()
|
||||
|
||||
connect( m_spotifyResolver.data(), SIGNAL( changed() ), this, SLOT( resolverChanged() ) );
|
||||
connect( m_spotifyResolver.data(), SIGNAL( customMessage( QString,QVariantMap ) ), this, SLOT( resolverMessage( QString, QVariantMap ) ) );
|
||||
|
||||
connect( ActionCollection::instance(), SIGNAL( privacyModeChanged() ), SLOT( privateModeChanged() ) );
|
||||
// Always get logged in status
|
||||
QVariantMap msg;
|
||||
msg[ "_msgtype" ] = "getCredentials";
|
||||
@ -433,6 +434,17 @@ SpotifyAccount::starTrack(const QString &artist, const QString &title, const boo
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SpotifyAccount::privateModeChanged()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << "Sending privateMode";
|
||||
QVariantMap msg;
|
||||
msg[ "_msgtype" ] = "setPrivacyMode";
|
||||
msg[ "private" ] = ( m_configWidget.data()->persitentPrivacy() || TomahawkSettings::instance()->privateListeningMode() != TomahawkSettings::PublicListening );
|
||||
sendMessage( msg );
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SpotifyAccount::loggedIn() const
|
||||
{
|
||||
@ -1123,6 +1135,7 @@ SpotifyAccount::configurationWidget()
|
||||
m_configWidget = QPointer< SpotifyAccountConfig >( new SpotifyAccountConfig( this ) );
|
||||
connect( m_configWidget.data(), SIGNAL( login( QString,QString ) ), this, SLOT( login( QString,QString ) ) );
|
||||
connect( m_configWidget.data(), SIGNAL( logout() ), this, SLOT( logout() ) );
|
||||
connect( m_configWidget.data(), SIGNAL( updatePrivacy( bool ) ), this, SLOT( privateModeChanged() ) );
|
||||
m_configWidget.data()->setPlaylists( m_allSpotifyPlaylists.values() );
|
||||
}
|
||||
|
||||
@ -1178,6 +1191,8 @@ SpotifyAccount::saveConfig()
|
||||
QVariantHash config = configuration();
|
||||
config[ "deleteOnUnsync" ] = m_configWidget.data()->deleteOnUnsync();
|
||||
config[ "loveSync" ] = m_configWidget.data()->loveSync();
|
||||
config[ "persitentPrivacy" ] = m_configWidget.data()->persitentPrivacy();
|
||||
|
||||
setConfiguration( config );
|
||||
|
||||
m_configWidget.data()->saveSettings();
|
||||
@ -1214,7 +1229,7 @@ SpotifyAccount::login( const QString& username, const QString& password )
|
||||
msg[ "_msgtype" ] = "login";
|
||||
msg[ "username" ] = username;
|
||||
msg[ "password" ] = password;
|
||||
|
||||
msg[ "privateSession" ] = ( m_configWidget.data()->persitentPrivacy() || TomahawkSettings::instance()->privateListeningMode() != TomahawkSettings::PublicListening );
|
||||
msg[ "highQuality" ] = m_configWidget.data()->highQuality();
|
||||
|
||||
m_spotifyResolver.data()->sendMessage( msg );
|
||||
@ -1465,6 +1480,13 @@ SpotifyAccount::loveSync() const
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SpotifyAccount::persitentPrivacy() const
|
||||
{
|
||||
return configuration().value( "persitentPrivacy", false ).toBool();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SpotifyAccount::stopPlaylistSync( SpotifyPlaylistInfo* playlist, bool forceDontDelete )
|
||||
{
|
||||
|
@ -112,6 +112,8 @@ public:
|
||||
|
||||
bool deleteOnUnsync() const;
|
||||
bool loveSync() const;
|
||||
bool persitentPrivacy() const;
|
||||
|
||||
void starTrack( const QString& artist, const QString& title, const bool starred );
|
||||
void setManualResolverPath( const QString& resolverPath );
|
||||
|
||||
@ -131,6 +133,7 @@ private slots:
|
||||
void resolverInstalled( const QString& resolverId );
|
||||
|
||||
void resolverMessage( const QString& msgType, const QVariantMap& msg );
|
||||
void privateModeChanged();
|
||||
|
||||
void login( const QString& username, const QString& password );
|
||||
void logout();
|
||||
|
@ -49,7 +49,9 @@ SpotifyAccountConfig::SpotifyAccountConfig( SpotifyAccount *account )
|
||||
m_ui->loginButton->setDefault( true );
|
||||
|
||||
connect( m_ui->loginButton, SIGNAL( clicked( bool ) ), this, SLOT( doLogin() ) );
|
||||
connect( m_ui->loveSync, SIGNAL( toggled(bool) ), this, SLOT( showStarredPlaylist(bool) ) );
|
||||
connect( m_ui->loveSync, SIGNAL( toggled( bool ) ), this, SLOT( showStarredPlaylist( bool ) ) );
|
||||
connect( m_ui->persitentPrivacy, SIGNAL( toggled( bool ) ), this, SIGNAL( updatePrivacy( bool ) ) );
|
||||
|
||||
connect( m_ui->usernameEdit, SIGNAL( textEdited( QString ) ), this, SLOT( resetLoginButton() ) );
|
||||
connect( m_ui->passwordEdit, SIGNAL( textEdited( QString ) ), this, SLOT( resetLoginButton() ) );
|
||||
connect( m_ui->selectAllCheckbox, SIGNAL( stateChanged( int ) ), this, SLOT( selectAllPlaylists() ) );
|
||||
@ -78,6 +80,7 @@ SpotifyAccountConfig::loadFromConfig()
|
||||
m_ui->streamingCheckbox->setChecked( m_account->credentials().value( "highQuality" ).toBool() );
|
||||
m_ui->deleteOnUnsync->setChecked( m_account->deleteOnUnsync() );
|
||||
m_ui->loveSync->setChecked( m_account->loveSync() );
|
||||
m_ui->persitentPrivacy->setChecked( m_account->persitentPrivacy() );
|
||||
|
||||
if ( m_account->loggedIn() )
|
||||
{
|
||||
@ -149,6 +152,13 @@ SpotifyAccountConfig::loveSync() const
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SpotifyAccountConfig::persitentPrivacy() const
|
||||
{
|
||||
return m_ui->persitentPrivacy->isChecked();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SpotifyAccountConfig::setPlaylists( const QList<SpotifyPlaylistInfo *>& playlists )
|
||||
{
|
||||
@ -223,6 +233,7 @@ SpotifyAccountConfig::loginResponse( bool success, const QString& msg, const QSt
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SpotifyAccountConfig::showStarredPlaylist( bool hide )
|
||||
{
|
||||
|
@ -53,6 +53,7 @@ public:
|
||||
bool highQuality() const;
|
||||
bool deleteOnUnsync() const;
|
||||
bool loveSync() const;
|
||||
bool persitentPrivacy() const;
|
||||
|
||||
void setPlaylists( const QList< SpotifyPlaylistInfo* >& playlists );
|
||||
|
||||
@ -66,6 +67,7 @@ public:
|
||||
signals:
|
||||
void login( const QString& username, const QString& pw );
|
||||
void logout();
|
||||
void updatePrivacy( bool );
|
||||
|
||||
protected:
|
||||
void showEvent( QShowEvent* event );
|
||||
@ -74,7 +76,7 @@ private slots:
|
||||
void doLogin();
|
||||
void resetLoginButton();
|
||||
void selectAllPlaylists();
|
||||
void showStarredPlaylist(bool);
|
||||
void showStarredPlaylist( bool );
|
||||
|
||||
private:
|
||||
void showLoggedIn();
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>375</width>
|
||||
<height>487</height>
|
||||
<width>406</width>
|
||||
<height>534</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -34,7 +34,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../../../resources.qrc">:/data/images/spotify-logo.png</pixmap>
|
||||
<pixmap resource="../../../../resources.qrc">:/data/images/spotify-logo.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
@ -178,10 +178,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="persitentPrivacy">
|
||||
<property name="toolTip">
|
||||
<string>Use this to force Spotify to never announce listening data to Social Networks</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Always run in Private Mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../../resources.qrc"/>
|
||||
<include location="../../../../resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
Loading…
x
Reference in New Issue
Block a user