mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 05:37:29 +02:00
* Fixed SourceList assert. Fixed filesize calculation.
This commit is contained in:
@@ -195,7 +195,7 @@ DBSyncConnection::handleMsg( msg_ptr msg )
|
|||||||
QVariantMap m = msg->json().toMap();
|
QVariantMap m = msg->json().toMap();
|
||||||
if ( m.empty() )
|
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 );
|
Q_ASSERT( false );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,7 @@ public:
|
|||||||
void addCollection( const Tomahawk::collection_ptr& c );
|
void addCollection( const Tomahawk::collection_ptr& c );
|
||||||
void removeCollection( 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; }
|
ControlConnection* controlConnection() const { return m_cc; }
|
||||||
void setControlConnection( ControlConnection* cc );
|
void setControlConnection( ControlConnection* cc );
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ private:
|
|||||||
bool m_isLocal;
|
bool m_isLocal;
|
||||||
bool m_online;
|
bool m_online;
|
||||||
QString m_username, m_friendlyname;
|
QString m_username, m_friendlyname;
|
||||||
unsigned int m_id;
|
int m_id;
|
||||||
QList< QSharedPointer<Collection> > m_collections;
|
QList< QSharedPointer<Collection> > m_collections;
|
||||||
QVariantMap m_stats;
|
QVariantMap m_stats;
|
||||||
QString m_lastOpGuid;
|
QString m_lastOpGuid;
|
||||||
|
@@ -88,7 +88,9 @@ SourceList::add( const source_ptr& source )
|
|||||||
{
|
{
|
||||||
qDebug() << "Adding to sources:" << source->userName() << source->id();
|
qDebug() << "Adding to sources:" << source->userName() << source->id();
|
||||||
m_sources.insert( source->userName(), source );
|
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() ) );
|
connect( source.data(), SIGNAL( syncedWithDatabase() ), SLOT( sourceSynced() ) );
|
||||||
|
|
||||||
collection_ptr coll( new RemoteCollection( source ) );
|
collection_ptr coll( new RemoteCollection( source ) );
|
||||||
@@ -101,14 +103,11 @@ SourceList::add( const source_ptr& source )
|
|||||||
void
|
void
|
||||||
SourceList::removeAllRemote()
|
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() );
|
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() );
|
m_sources_id2name.insert( src->id(), src->userName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -205,7 +205,7 @@ filesizeToString( unsigned int size )
|
|||||||
|
|
||||||
if ( mb )
|
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 )
|
else if ( kb )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user