mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 20:00:13 +02:00
* Fixed off by one error in track removal.
This commit is contained in:
@@ -212,7 +212,7 @@ void
|
|||||||
CollectionFlatModel::onTracksRemoved( const QList<Tomahawk::query_ptr>& tracks, const Tomahawk::collection_ptr& collection )
|
CollectionFlatModel::onTracksRemoved( const QList<Tomahawk::query_ptr>& tracks, const Tomahawk::collection_ptr& collection )
|
||||||
{
|
{
|
||||||
QList<Tomahawk::query_ptr> t = tracks;
|
QList<Tomahawk::query_ptr> t = tracks;
|
||||||
for ( int i = rowCount( QModelIndex() ); i > 0 && t.count(); i-- )
|
for ( int i = rowCount( QModelIndex() ); i >= 0 && t.count(); i-- )
|
||||||
{
|
{
|
||||||
PlItem* item = itemFromIndex( index( i, 0, QModelIndex() ) );
|
PlItem* item = itemFromIndex( index( i, 0, QModelIndex() ) );
|
||||||
if ( !item )
|
if ( !item )
|
||||||
|
@@ -29,18 +29,8 @@ ZeroconfPlugin::connectPlugin( bool /*startup*/ )
|
|||||||
SLOT( lanHostFound( const QString&, int, const QString&, const QString& ) ) );
|
SLOT( lanHostFound( const QString&, int, const QString&, const QString& ) ) );
|
||||||
|
|
||||||
m_zeroconf->advertise();
|
m_zeroconf->advertise();
|
||||||
|
|
||||||
m_isOnline = true;
|
m_isOnline = true;
|
||||||
|
|
||||||
foreach( QStringList *currNode, m_cachedNodes )
|
|
||||||
{
|
|
||||||
QStringList nodeSet = *currNode;
|
|
||||||
if ( !Servent::instance()->connectedToSession( nodeSet[3] ) )
|
|
||||||
Servent::instance()->connectToPeer( nodeSet[0], nodeSet[1].toInt(), "whitelist", nodeSet[2], nodeSet[3] );
|
|
||||||
delete currNode;
|
|
||||||
}
|
|
||||||
m_cachedNodes.clear();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,20 +48,15 @@ ZeroconfPlugin::disconnectPlugin()
|
|||||||
void
|
void
|
||||||
ZeroconfPlugin::lanHostFound( const QString& host, int port, const QString& name, const QString& nodeid )
|
ZeroconfPlugin::lanHostFound( const QString& host, int port, const QString& name, const QString& nodeid )
|
||||||
{
|
{
|
||||||
qDebug() << "Found LAN host:" << host << port << nodeid;
|
if ( sender() != m_zeroconf )
|
||||||
|
|
||||||
//FIXME: This doesn't work...why? I never see Found LAN host in debug either, but somehow nodes are being connected...
|
|
||||||
if ( !m_isOnline )
|
|
||||||
{
|
|
||||||
qDebug() << "Not online, so not connecting";
|
|
||||||
QStringList *nodeSet = new QStringList();
|
|
||||||
*nodeSet << host << QString::number( port ) << name << nodeid;
|
|
||||||
m_cachedNodes.insert( nodeSet );
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
qDebug() << "Found LAN host:" << host << port << nodeid;
|
||||||
|
|
||||||
if ( !Servent::instance()->connectedToSession( nodeid ) )
|
if ( !Servent::instance()->connectedToSession( nodeid ) )
|
||||||
Servent::instance()->connectToPeer( host, port, "whitelist", name, nodeid );
|
Servent::instance()->connectToPeer( host, port, "whitelist", name, nodeid );
|
||||||
|
else
|
||||||
|
qDebug() << "Already connected to" << host;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EXPORT_PLUGIN2( sip, ZeroconfPlugin )
|
Q_EXPORT_PLUGIN2( sip, ZeroconfPlugin )
|
||||||
|
@@ -17,7 +17,6 @@ public:
|
|||||||
ZeroconfPlugin()
|
ZeroconfPlugin()
|
||||||
: m_zeroconf( 0 )
|
: m_zeroconf( 0 )
|
||||||
, m_isOnline( false )
|
, m_isOnline( false )
|
||||||
, m_cachedNodes()
|
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
}
|
}
|
||||||
@@ -55,7 +54,6 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
TomahawkZeroconf* m_zeroconf;
|
TomahawkZeroconf* m_zeroconf;
|
||||||
bool m_isOnline;
|
bool m_isOnline;
|
||||||
QSet< QStringList* > m_cachedNodes;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user