mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 03:10:12 +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 )
|
||||
{
|
||||
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() ) );
|
||||
if ( !item )
|
||||
|
@@ -29,18 +29,8 @@ ZeroconfPlugin::connectPlugin( bool /*startup*/ )
|
||||
SLOT( lanHostFound( const QString&, int, const QString&, const QString& ) ) );
|
||||
|
||||
m_zeroconf->advertise();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -58,20 +48,15 @@ ZeroconfPlugin::disconnectPlugin()
|
||||
void
|
||||
ZeroconfPlugin::lanHostFound( const QString& host, int port, const QString& name, const QString& nodeid )
|
||||
{
|
||||
if ( sender() != m_zeroconf )
|
||||
return;
|
||||
|
||||
qDebug() << "Found LAN host:" << host << port << nodeid;
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
if ( !Servent::instance()->connectedToSession( nodeid ) )
|
||||
Servent::instance()->connectToPeer( host, port, "whitelist", name, nodeid );
|
||||
else
|
||||
qDebug() << "Already connected to" << host;
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN2( sip, ZeroconfPlugin )
|
||||
|
@@ -17,7 +17,6 @@ public:
|
||||
ZeroconfPlugin()
|
||||
: m_zeroconf( 0 )
|
||||
, m_isOnline( false )
|
||||
, m_cachedNodes()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
}
|
||||
@@ -55,7 +54,6 @@ private slots:
|
||||
private:
|
||||
TomahawkZeroconf* m_zeroconf;
|
||||
bool m_isOnline;
|
||||
QSet< QStringList* > m_cachedNodes;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user