mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-24 01:39:42 +01:00
Merge branch 'master' into watchforchanges-ng
This commit is contained in:
commit
7c3d0eba95
@ -25,8 +25,8 @@
|
||||
!define QT_DLL_PATH "${MING_BIN}"
|
||||
!define SQLITE_DLL_PATH "${MING_LIB}/qt4/plugins/sqldrivers"
|
||||
!define IMAGEFORMATS_DLL_PATH "${MING_LIB}/qt4/plugins/imageformats"
|
||||
!define VLC_PATH "${MING_BIN}"
|
||||
!define VLC_PLUGIN_PATH "${MING_LIB}\vlc\plugins"
|
||||
!define VLC_PATH "${ROOT_PATH}\..\vlc"
|
||||
!define VLC_PLUGIN_PATH "${VLC_PATH}\plugins"
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Increment installer revision number as part of this script.
|
||||
|
@ -45,7 +45,7 @@ DatabaseCommand_LogPlayback::postCommitHook()
|
||||
{
|
||||
emit trackPlayed( q );
|
||||
}
|
||||
else if ( m_action == Started )
|
||||
else if ( m_action == Started && QDateTime::fromTime_t( playtime() ).secsTo( QDateTime::currentDateTime() ) < 600 ) // if the play time is more than 10 minutes in the past, ignore
|
||||
{
|
||||
emit trackPlaying( q );
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "database/databasecommand_deleteplaylist.h"
|
||||
#include "database/databasecommand_renameplaylist.h"
|
||||
|
||||
#include "tomahawksettings.h"
|
||||
#include "pipeline.h"
|
||||
#include "source.h"
|
||||
#include "sourcelist.h"
|
||||
@ -219,6 +220,9 @@ Playlist::load( const QString& guid )
|
||||
bool
|
||||
Playlist::remove( const playlist_ptr& playlist )
|
||||
{
|
||||
TomahawkSettings *s = TomahawkSettings::instance();
|
||||
s->removePlaylistSettings( playlist->guid() );
|
||||
|
||||
DatabaseCommand_DeletePlaylist* cmd = new DatabaseCommand_DeletePlaylist( playlist->author(), playlist->guid() );
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "network/controlconnection.h"
|
||||
#include "database/databasecommand_addsource.h"
|
||||
#include "database/databasecommand_sourceoffline.h"
|
||||
#include "database/databasecommand_logplayback.h"
|
||||
#include "database/database.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
@ -50,6 +49,10 @@ Source::Source( int id, const QString& username )
|
||||
m_isLocal = true;
|
||||
m_online = true;
|
||||
}
|
||||
|
||||
m_currentTrackTimer.setInterval( 600000 ); // 10 minutes
|
||||
m_currentTrackTimer.setSingleShot( true );
|
||||
connect( &m_currentTrackTimer, SIGNAL( timeout() ), this, SLOT( trackTimerFired() ) );
|
||||
}
|
||||
|
||||
|
||||
@ -278,4 +281,14 @@ Source::onPlaybackFinished( const Tomahawk::query_ptr& query )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << query->toString();
|
||||
emit playbackFinished( query );
|
||||
|
||||
m_currentTrackTimer.start();
|
||||
}
|
||||
|
||||
void
|
||||
Source::trackTimerFired()
|
||||
{
|
||||
m_currentTrack.clear();
|
||||
|
||||
emit stateChanged();
|
||||
}
|
||||
|
@ -105,6 +105,7 @@ private slots:
|
||||
void onStateChanged( DBSyncConnection::State newstate, DBSyncConnection::State oldstate, const QString& info );
|
||||
void onPlaybackStarted( const Tomahawk::query_ptr& query );
|
||||
void onPlaybackFinished( const Tomahawk::query_ptr& query );
|
||||
void trackTimerFired();
|
||||
|
||||
private:
|
||||
bool m_isLocal;
|
||||
@ -118,6 +119,7 @@ private:
|
||||
|
||||
Tomahawk::query_ptr m_currentTrack;
|
||||
QString m_textStatus;
|
||||
QTimer m_currentTrackTimer;
|
||||
|
||||
ControlConnection* m_cc;
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
#include "sip/SipHandler.h"
|
||||
#include "playlistinterface.h"
|
||||
|
||||
#define VERSION 3
|
||||
|
||||
@ -215,7 +216,6 @@ TomahawkSettings::setWatchForChanges( bool watch )
|
||||
setValue( "watchForChanges", watch );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkSettings::setAcceptedLegalWarning( bool accept )
|
||||
{
|
||||
@ -409,6 +409,36 @@ TomahawkSettings::setPlaylistColumnSizes( const QString& playlistid, const QByte
|
||||
setValue( QString( "ui/playlist/%1/columnSizes" ).arg( playlistid ), state );
|
||||
}
|
||||
|
||||
bool
|
||||
TomahawkSettings::shuffleState( const QString& playlistid ) const
|
||||
{
|
||||
return value( QString( "ui/playlist/%1/shuffleState" ).arg( playlistid )).toBool();
|
||||
}
|
||||
|
||||
void
|
||||
TomahawkSettings::setShuffleState( const QString& playlistid, bool state)
|
||||
{
|
||||
setValue( QString( "ui/playlist/%1/shuffleState" ).arg( playlistid ), state );
|
||||
}
|
||||
|
||||
void
|
||||
TomahawkSettings::removePlaylistSettings( const QString& playlistid )
|
||||
{
|
||||
remove( QString( "ui/playlist/%1/shuffleState" ).arg( playlistid ) );
|
||||
remove( QString( "ui/playlist/%1/repeatMode" ).arg( playlistid ) );
|
||||
}
|
||||
|
||||
void
|
||||
TomahawkSettings::setRepeatMode( const QString& playlistid, PlaylistInterface::RepeatMode mode )
|
||||
{
|
||||
setValue( QString( "ui/playlist/%1/repeatMode" ).arg( playlistid ), (int)mode );
|
||||
}
|
||||
|
||||
PlaylistInterface::RepeatMode
|
||||
TomahawkSettings::repeatMode( const QString& playlistid )
|
||||
{
|
||||
return (PlaylistInterface::RepeatMode)value( QString( "ui/playlist/%1/repeatMode" ).arg( playlistid )).toInt();
|
||||
}
|
||||
|
||||
QList<Tomahawk::playlist_ptr>
|
||||
TomahawkSettings::recentlyPlayedPlaylists() const
|
||||
|
@ -73,6 +73,14 @@ public:
|
||||
QList<Tomahawk::playlist_ptr> recentlyPlayedPlaylists() const;
|
||||
QStringList recentlyPlayedPlaylistGuids( unsigned int amount = 0 ) const;
|
||||
void appendRecentlyPlayedPlaylist( const Tomahawk::playlist_ptr& playlist );
|
||||
|
||||
bool shuffleState( const QString& playlistid ) const;
|
||||
void setShuffleState( const QString& playlistid, bool state );
|
||||
PlaylistInterface::RepeatMode repeatMode( const QString& playlistid );
|
||||
void setRepeatMode( const QString& playlistid, PlaylistInterface::RepeatMode mode);
|
||||
|
||||
// remove shuffle state and repeat state
|
||||
void removePlaylistSettings( const QString& playlistid );
|
||||
|
||||
/// SIP plugins
|
||||
// all plugins we know about. loaded, unloaded, enabled, disabled.
|
||||
|
@ -142,6 +142,7 @@ ViewManager::ViewManager( QObject* parent )
|
||||
|
||||
ViewManager::~ViewManager()
|
||||
{
|
||||
saveCurrentPlaylistSettings();
|
||||
delete m_widget;
|
||||
}
|
||||
|
||||
@ -581,6 +582,9 @@ ViewManager::setPage( ViewPage* page, bool trackHistory )
|
||||
if ( !page )
|
||||
return;
|
||||
|
||||
// save the old playlist shuffle state in config before we change playlists
|
||||
saveCurrentPlaylistSettings();
|
||||
|
||||
unlinkPlaylist();
|
||||
|
||||
if ( !m_pageHistory.contains( page ) )
|
||||
@ -652,6 +656,24 @@ ViewManager::unlinkPlaylist()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ViewManager::saveCurrentPlaylistSettings()
|
||||
{
|
||||
TomahawkSettings* s = TomahawkSettings::instance();
|
||||
Tomahawk::playlist_ptr pl = playlistForInterface( currentPlaylistInterface() );
|
||||
|
||||
if ( !pl.isNull() ) {
|
||||
s->setShuffleState( pl->guid(), currentPlaylistInterface()->shuffled() );
|
||||
s->setRepeatMode( pl->guid(), currentPlaylistInterface()->repeatMode() );
|
||||
} else {
|
||||
Tomahawk::dynplaylist_ptr dynPl = dynamicPlaylistForInterface( currentPlaylistInterface() );
|
||||
if ( !dynPl.isNull() ) {
|
||||
s->setShuffleState( dynPl->guid(), currentPlaylistInterface()->shuffled() );
|
||||
s->setRepeatMode( dynPl->guid(), currentPlaylistInterface()->repeatMode() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ViewManager::updateView()
|
||||
@ -704,8 +726,26 @@ ViewManager::updateView()
|
||||
m_infobar->setCaption( currentPage()->title() );
|
||||
m_infobar->setDescription( currentPage()->description() );
|
||||
m_infobar->setPixmap( currentPage()->pixmap() );
|
||||
|
||||
// turn on shuffle/repeat mode for the new playlist view if specified in config
|
||||
loadCurrentPlaylistSettings();
|
||||
}
|
||||
|
||||
void
|
||||
ViewManager::loadCurrentPlaylistSettings()
|
||||
{
|
||||
TomahawkSettings* s = TomahawkSettings::instance();
|
||||
Tomahawk::playlist_ptr pl = playlistForInterface( currentPlaylistInterface() );
|
||||
if ( !pl.isNull() ) {
|
||||
currentPlaylistInterface()->setShuffled( s->shuffleState( pl->guid() ));
|
||||
currentPlaylistInterface()->setRepeatMode( s->repeatMode( pl->guid() ));
|
||||
} else {
|
||||
Tomahawk::dynplaylist_ptr dynPl = dynamicPlaylistForInterface( currentPlaylistInterface() );
|
||||
if ( !dynPl.isNull() ) {
|
||||
currentPlaylistInterface()->setShuffled( s->shuffleState( dynPl->guid() ));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ViewManager::onWidgetDestroyed( QWidget* widget )
|
||||
|
@ -162,7 +162,9 @@ private:
|
||||
void setPage( Tomahawk::ViewPage* page, bool trackHistory = true );
|
||||
void updateView();
|
||||
void unlinkPlaylist();
|
||||
|
||||
void saveCurrentPlaylistSettings();
|
||||
void loadCurrentPlaylistSettings();
|
||||
|
||||
Tomahawk::playlist_ptr playlistForInterface( PlaylistInterface* interface ) const;
|
||||
Tomahawk::dynplaylist_ptr dynamicPlaylistForInterface( PlaylistInterface* interface ) const;
|
||||
Tomahawk::collection_ptr collectionForInterface( PlaylistInterface* interface ) const;
|
||||
|
@ -233,7 +233,6 @@ TomahawkWindow::loadSettings()
|
||||
restoreState( s->mainWindowState() );
|
||||
if ( !s->mainWindowSplitterState().isEmpty() )
|
||||
ui->splitter->restoreState( s->mainWindowSplitterState() );
|
||||
|
||||
#ifdef QT_MAC_USE_COCOA
|
||||
if( workaround ) {
|
||||
// Make it visible again
|
||||
|
Loading…
x
Reference in New Issue
Block a user