mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-14 04:51:53 +02:00
* Fixed SourceList assert. Fixed filesize calculation.
This commit is contained in:
parent
b5f52f6c04
commit
4d1afb74bf
@ -195,7 +195,7 @@ DBSyncConnection::handleMsg( msg_ptr msg )
|
||||
QVariantMap m = msg->json().toMap();
|
||||
if ( m.empty() )
|
||||
{
|
||||
qDebug() << "Failed to parse msg in dbsync";
|
||||
qDebug() << "Failed to parse msg in dbsync" << m_source->id() << m_source->friendlyName();
|
||||
Q_ASSERT( false );
|
||||
return;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
void addCollection( const Tomahawk::collection_ptr& c );
|
||||
void removeCollection( const Tomahawk::collection_ptr& c );
|
||||
|
||||
unsigned int id() const { return m_id; }
|
||||
int id() const { return m_id; }
|
||||
ControlConnection* controlConnection() const { return m_cc; }
|
||||
void setControlConnection( ControlConnection* cc );
|
||||
|
||||
@ -90,7 +90,7 @@ private:
|
||||
bool m_isLocal;
|
||||
bool m_online;
|
||||
QString m_username, m_friendlyname;
|
||||
unsigned int m_id;
|
||||
int m_id;
|
||||
QList< QSharedPointer<Collection> > m_collections;
|
||||
QVariantMap m_stats;
|
||||
QString m_lastOpGuid;
|
||||
|
@ -88,7 +88,9 @@ SourceList::add( const source_ptr& source )
|
||||
{
|
||||
qDebug() << "Adding to sources:" << source->userName() << source->id();
|
||||
m_sources.insert( source->userName(), source );
|
||||
m_sources_id2name.insert( source->id(), source->userName() );
|
||||
|
||||
if ( source->id() > 0 )
|
||||
m_sources_id2name.insert( source->id(), source->userName() );
|
||||
connect( source.data(), SIGNAL( syncedWithDatabase() ), SLOT( sourceSynced() ) );
|
||||
|
||||
collection_ptr coll( new RemoteCollection( source ) );
|
||||
@ -101,14 +103,11 @@ SourceList::add( const source_ptr& source )
|
||||
void
|
||||
SourceList::removeAllRemote()
|
||||
{
|
||||
foreach( source_ptr s, m_sources )
|
||||
foreach( const source_ptr& s, m_sources )
|
||||
{
|
||||
if( s != m_local )
|
||||
if ( !s->isLocal() && s->controlConnection() )
|
||||
{
|
||||
if ( s->controlConnection() )
|
||||
{
|
||||
s->controlConnection()->shutdown( true );
|
||||
}
|
||||
s->controlConnection()->shutdown( true );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -162,12 +161,6 @@ SourceList::sourceSynced()
|
||||
{
|
||||
Source* src = qobject_cast< Source* >( sender() );
|
||||
|
||||
qDebug() << "Finding in sources:" << src->userName() << src->id();
|
||||
qDebug() << "Current sources values:" << m_sources_id2name.values();
|
||||
qDebug() << "Current sources keys:" << m_sources_id2name.keys();
|
||||
|
||||
Q_ASSERT( m_sources_id2name.values().contains( src->userName() ) );
|
||||
m_sources_id2name.remove( m_sources_id2name.key( src->userName() ) );
|
||||
m_sources_id2name.insert( src->id(), src->userName() );
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ filesizeToString( unsigned int size )
|
||||
|
||||
if ( mb )
|
||||
{
|
||||
return QString( "%1.%2 Mb" ).arg( mb ).arg( int( ( kb % 1024 ) / 100 ) );
|
||||
return QString( "%1.%2 Mb" ).arg( mb ).arg( int( ( kb % 1024 ) / 102.4 ) );
|
||||
}
|
||||
else if ( kb )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user