mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
Revert "Miscellaneous cppcheck fixes"
This commit is contained in:
@@ -263,14 +263,9 @@ bool
|
|||||||
DropJob::validateLocalFiles(const QString &paths, const QString &suffix)
|
DropJob::validateLocalFiles(const QString &paths, const QString &suffix)
|
||||||
{
|
{
|
||||||
QStringList filePaths = paths.split( QRegExp( "\\s+" ), QString::SkipEmptyParts );
|
QStringList filePaths = paths.split( QRegExp( "\\s+" ), QString::SkipEmptyParts );
|
||||||
QStringList::iterator it = filePaths.begin();
|
for ( QStringList::iterator it = filePaths.begin(); it != filePaths.end(); ++it )
|
||||||
while (it != filePaths.end())
|
|
||||||
{
|
|
||||||
if ( !validateLocalFile( *it, suffix ) )
|
if ( !validateLocalFile( *it, suffix ) )
|
||||||
it = filePaths.erase( it );
|
filePaths.erase( it );
|
||||||
else
|
|
||||||
++it;
|
|
||||||
}
|
|
||||||
return !filePaths.isEmpty();
|
return !filePaths.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -982,7 +977,7 @@ DropJob::removeRemoteSources()
|
|||||||
foreach ( const Tomahawk::result_ptr& result, item->results() )
|
foreach ( const Tomahawk::result_ptr& result, item->results() )
|
||||||
{
|
{
|
||||||
if ( !result->collection().isNull() && !result->collection()->source().isNull() &&
|
if ( !result->collection().isNull() && !result->collection()->source().isNull() &&
|
||||||
result->collection()->source()->isLocal() )
|
!result->collection()->source().isNull() && result->collection()->source()->isLocal() )
|
||||||
hasLocalSource = true;
|
hasLocalSource = true;
|
||||||
}
|
}
|
||||||
if ( hasLocalSource )
|
if ( hasLocalSource )
|
||||||
|
@@ -235,6 +235,9 @@ Source::friendlyNamesLessThan( const QString& first, const QString& second )
|
|||||||
favored.append( QRegExp( "\\b([A-Z][a-z']* ?){2,10}" ) ); //properly capitalized person's name
|
favored.append( QRegExp( "\\b([A-Z][a-z']* ?){2,10}" ) ); //properly capitalized person's name
|
||||||
favored.append( QRegExp( "[a-zA-Z ']+" ) ); //kind of person's name
|
favored.append( QRegExp( "[a-zA-Z ']+" ) ); //kind of person's name
|
||||||
|
|
||||||
|
bool matchFirst = false;
|
||||||
|
bool matchSecond = false;
|
||||||
|
|
||||||
//We check if the strings match the regexps. The regexps represent friendly name patterns we do
|
//We check if the strings match the regexps. The regexps represent friendly name patterns we do
|
||||||
//*not* want (penalties) or want (favored), prioritized. If none of the strings match a regexp,
|
//*not* want (penalties) or want (favored), prioritized. If none of the strings match a regexp,
|
||||||
//we go to the next regexp. If one of the strings matches, and we're matching penalties, we say
|
//we go to the next regexp. If one of the strings matches, and we're matching penalties, we say
|
||||||
@@ -258,8 +261,8 @@ Source::friendlyNamesLessThan( const QString& first, const QString& second )
|
|||||||
isPenalty = false;
|
isPenalty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool matchFirst = rx.exactMatch( first );
|
matchFirst = rx.exactMatch( first );
|
||||||
bool matchSecond = rx.exactMatch( second );
|
matchSecond = rx.exactMatch( second );
|
||||||
|
|
||||||
if ( matchFirst == false && matchSecond == false )
|
if ( matchFirst == false && matchSecond == false )
|
||||||
continue;
|
continue;
|
||||||
|
@@ -184,7 +184,7 @@ LastFmConfig::onHistoryLoaded()
|
|||||||
else
|
else
|
||||||
finished = true;
|
finished = true;
|
||||||
}
|
}
|
||||||
catch( lastfm::ws::ParseError& e )
|
catch( lastfm::ws::ParseError e )
|
||||||
{
|
{
|
||||||
tDebug() << "XmlQuery error:" << e.message();
|
tDebug() << "XmlQuery error:" << e.message();
|
||||||
finished = true;
|
finished = true;
|
||||||
@@ -326,7 +326,7 @@ LastFmConfig::onLovedFinished( QNetworkReply* reply )
|
|||||||
emit sizeHintChanged();
|
emit sizeHintChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( lastfm::ws::ParseError& e )
|
catch( lastfm::ws::ParseError e )
|
||||||
{
|
{
|
||||||
m_ui->syncLovedTracks->setText( "Failed" );
|
m_ui->syncLovedTracks->setText( "Failed" );
|
||||||
m_ui->progressBar->hide();
|
m_ui->progressBar->hide();
|
||||||
|
@@ -119,6 +119,7 @@ DatabaseCommand_LoadPlaylistEntries::generateEntries( DatabaseImpl* dbi )
|
|||||||
if ( !query_entries_old.next() )
|
if ( !query_entries_old.next() )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
Q_ASSERT( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !query_entries_old.value( 0 ).isNull() )
|
if ( !query_entries_old.value( 0 ).isNull() )
|
||||||
|
@@ -274,7 +274,7 @@ Servent::isValidExternalIP( const QHostAddress& addr )
|
|||||||
if ( addr.isInSubnet(QHostAddress::parseSubnet( "224.0.0.0/4" ) ) )
|
if ( addr.isInSubnet(QHostAddress::parseSubnet( "224.0.0.0/4" ) ) )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (addr.protocol() == QAbstractSocket::IPv6Protocol)
|
else if (addr.protocol() == QAbstractSocket::IPv4Protocol)
|
||||||
{
|
{
|
||||||
// "unspecified address"
|
// "unspecified address"
|
||||||
if ( addr.isInSubnet(QHostAddress::parseSubnet( "::/128" ) ) )
|
if ( addr.isInSubnet(QHostAddress::parseSubnet( "::/128" ) ) )
|
||||||
|
@@ -144,9 +144,10 @@ AlbumModel::addAlbums( const QList<Tomahawk::album_ptr>& albums )
|
|||||||
|
|
||||||
emit beginInsertRows( QModelIndex(), crows.first, crows.second );
|
emit beginInsertRows( QModelIndex(), crows.first, crows.second );
|
||||||
|
|
||||||
|
PlayableItem* albumitem;
|
||||||
foreach( const album_ptr& album, trimmedAlbums )
|
foreach( const album_ptr& album, trimmedAlbums )
|
||||||
{
|
{
|
||||||
PlayableItem* albumitem = new PlayableItem( album, rootItem() );
|
albumitem = new PlayableItem( album, rootItem() );
|
||||||
albumitem->index = createIndex( rootItem()->children.count() - 1, 0, albumitem );
|
albumitem->index = createIndex( rootItem()->children.count() - 1, 0, albumitem );
|
||||||
|
|
||||||
connect( albumitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
connect( albumitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
||||||
@@ -189,9 +190,10 @@ AlbumModel::addArtists( const QList<Tomahawk::artist_ptr>& artists )
|
|||||||
|
|
||||||
emit beginInsertRows( QModelIndex(), crows.first, crows.second );
|
emit beginInsertRows( QModelIndex(), crows.first, crows.second );
|
||||||
|
|
||||||
|
PlayableItem* albumitem;
|
||||||
foreach ( const artist_ptr& artist, trimmedArtists )
|
foreach ( const artist_ptr& artist, trimmedArtists )
|
||||||
{
|
{
|
||||||
PlayableItem* albumitem = new PlayableItem( artist, rootItem() );
|
albumitem = new PlayableItem( artist, rootItem() );
|
||||||
albumitem->index = createIndex( rootItem()->children.count() - 1, 0, albumitem );
|
albumitem->index = createIndex( rootItem()->children.count() - 1, 0, albumitem );
|
||||||
|
|
||||||
connect( albumitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
connect( albumitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
||||||
@@ -217,9 +219,10 @@ AlbumModel::addQueries( const QList<Tomahawk::query_ptr>& queries )
|
|||||||
|
|
||||||
emit beginInsertRows( QModelIndex(), crows.first, crows.second );
|
emit beginInsertRows( QModelIndex(), crows.first, crows.second );
|
||||||
|
|
||||||
|
PlayableItem* albumitem;
|
||||||
foreach ( const query_ptr& query, queries )
|
foreach ( const query_ptr& query, queries )
|
||||||
{
|
{
|
||||||
PlayableItem* albumitem = new PlayableItem( query, rootItem() );
|
albumitem = new PlayableItem( query, rootItem() );
|
||||||
albumitem->index = createIndex( rootItem()->children.count() - 1, 0, albumitem );
|
albumitem->index = createIndex( rootItem()->children.count() - 1, 0, albumitem );
|
||||||
|
|
||||||
connect( albumitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
connect( albumitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
||||||
|
@@ -269,6 +269,7 @@ PlayableModel::queryData( const query_ptr& query, int column, int role ) const
|
|||||||
|
|
||||||
case Age:
|
case Age:
|
||||||
return TomahawkUtils::ageToString( QDateTime::fromTime_t( query->results().first()->modificationTime() ) );
|
return TomahawkUtils::ageToString( QDateTime::fromTime_t( query->results().first()->modificationTime() ) );
|
||||||
|
break;
|
||||||
|
|
||||||
case Year:
|
case Year:
|
||||||
if ( query->results().first()->track()->year() != 0 )
|
if ( query->results().first()->track()->year() != 0 )
|
||||||
@@ -277,9 +278,11 @@ PlayableModel::queryData( const query_ptr& query, int column, int role ) const
|
|||||||
|
|
||||||
case Filesize:
|
case Filesize:
|
||||||
return TomahawkUtils::filesizeToString( query->results().first()->size() );
|
return TomahawkUtils::filesizeToString( query->results().first()->size() );
|
||||||
|
break;
|
||||||
|
|
||||||
case Origin:
|
case Origin:
|
||||||
return query->results().first()->friendlySource();
|
return query->results().first()->friendlySource();
|
||||||
|
break;
|
||||||
|
|
||||||
case Score:
|
case Score:
|
||||||
{
|
{
|
||||||
@@ -290,6 +293,7 @@ PlayableModel::queryData( const query_ptr& query, int column, int role ) const
|
|||||||
score = 0.0;
|
score = 0.0;
|
||||||
|
|
||||||
return scoreText( score );
|
return scoreText( score );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -675,10 +679,11 @@ PlayableModel::insertInternal( const QList< T >& items, int row, const QList< To
|
|||||||
emit beginInsertRows( parent, crows.first, crows.second );
|
emit beginInsertRows( parent, crows.first, crows.second );
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
PlayableItem* plitem;
|
||||||
foreach ( const T& item, items )
|
foreach ( const T& item, items )
|
||||||
{
|
{
|
||||||
PlayableItem* pItem = itemFromIndex( parent );
|
PlayableItem* pItem = itemFromIndex( parent );
|
||||||
PlayableItem* plitem = new PlayableItem( item, pItem, row + i );
|
plitem = new PlayableItem( item, pItem, row + i );
|
||||||
plitem->index = createIndex( row + i, 0, plitem );
|
plitem->index = createIndex( row + i, 0, plitem );
|
||||||
|
|
||||||
if ( plitem->query() )
|
if ( plitem->query() )
|
||||||
|
@@ -290,10 +290,11 @@ PlaylistModel::insertEntries( const QList< Tomahawk::plentry_ptr >& entries, int
|
|||||||
|
|
||||||
QList< Tomahawk::query_ptr > queries;
|
QList< Tomahawk::query_ptr > queries;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
PlayableItem* plitem;
|
||||||
foreach( const plentry_ptr& entry, entries )
|
foreach( const plentry_ptr& entry, entries )
|
||||||
{
|
{
|
||||||
PlayableItem* pItem = itemFromIndex( parent );
|
PlayableItem* pItem = itemFromIndex( parent );
|
||||||
PlayableItem* plitem = new PlayableItem( entry, pItem, row + i );
|
plitem = new PlayableItem( entry, pItem, row + i );
|
||||||
plitem->index = createIndex( row + i, 0, plitem );
|
plitem->index = createIndex( row + i, 0, plitem );
|
||||||
|
|
||||||
if ( logs.count() > i )
|
if ( logs.count() > i )
|
||||||
|
@@ -193,9 +193,10 @@ TreeModel::addAlbums( const QModelIndex& parent, const QList<Tomahawk::album_ptr
|
|||||||
|
|
||||||
emit beginInsertRows( parent, crows.first, crows.second );
|
emit beginInsertRows( parent, crows.first, crows.second );
|
||||||
|
|
||||||
|
PlayableItem* albumitem = 0;
|
||||||
foreach( const album_ptr& album, albums )
|
foreach( const album_ptr& album, albums )
|
||||||
{
|
{
|
||||||
PlayableItem* albumitem = new PlayableItem( album, parentItem );
|
albumitem = new PlayableItem( album, parentItem );
|
||||||
albumitem->index = createIndex( parentItem->children.count() - 1, 0, albumitem );
|
albumitem->index = createIndex( parentItem->children.count() - 1, 0, albumitem );
|
||||||
connect( albumitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
connect( albumitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
||||||
|
|
||||||
@@ -282,9 +283,10 @@ TreeModel::onArtistsAdded( const QList<Tomahawk::artist_ptr>& artists )
|
|||||||
|
|
||||||
emit beginInsertRows( QModelIndex(), crows.first, crows.second );
|
emit beginInsertRows( QModelIndex(), crows.first, crows.second );
|
||||||
|
|
||||||
|
PlayableItem* artistitem;
|
||||||
foreach( const artist_ptr& artist, artists )
|
foreach( const artist_ptr& artist, artists )
|
||||||
{
|
{
|
||||||
PlayableItem* artistitem = new PlayableItem( artist, rootItem() );
|
artistitem = new PlayableItem( artist, rootItem() );
|
||||||
artistitem->index = createIndex( rootItem()->children.count() - 1, 0, artistitem );
|
artistitem->index = createIndex( rootItem()->children.count() - 1, 0, artistitem );
|
||||||
connect( artistitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
connect( artistitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
||||||
}
|
}
|
||||||
@@ -310,9 +312,10 @@ TreeModel::onTracksAdded( const QList<Tomahawk::query_ptr>& tracks, const QModel
|
|||||||
|
|
||||||
emit beginInsertRows( parent, crows.first, crows.second );
|
emit beginInsertRows( parent, crows.first, crows.second );
|
||||||
|
|
||||||
|
PlayableItem* item = 0;
|
||||||
foreach( const query_ptr& query, tracks )
|
foreach( const query_ptr& query, tracks )
|
||||||
{
|
{
|
||||||
PlayableItem* item = new PlayableItem( query, parentItem );
|
item = new PlayableItem( query, parentItem );
|
||||||
item->index = createIndex( parentItem->children.count() - 1, 0, item );
|
item->index = createIndex( parentItem->children.count() - 1, 0, item );
|
||||||
|
|
||||||
connect( item, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
connect( item, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
||||||
|
@@ -557,7 +557,7 @@ JSResolver::parseResultVariantList( const QVariantList& reslist )
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
unsigned int duration = m.value( "duration", 0 ).toUInt();
|
unsigned int duration = m.value( "duration", 0 ).toUInt();
|
||||||
if ( duration == 0 && m.contains( "durationString" ) )
|
if ( duration <= 0 && m.contains( "durationString" ) )
|
||||||
{
|
{
|
||||||
QTime time = QTime::fromString( m.value( "durationString" ).toString(), "hh:mm:ss" );
|
QTime time = QTime::fromString( m.value( "durationString" ).toString(), "hh:mm:ss" );
|
||||||
duration = time.secsTo( QTime( 0, 0 ) ) * -1;
|
duration = time.secsTo( QTime( 0, 0 ) ) * -1;
|
||||||
@@ -846,11 +846,12 @@ JSResolver::loadCollections()
|
|||||||
|
|
||||||
if ( collectionInfo.contains( "iconfile" ) )
|
if ( collectionInfo.contains( "iconfile" ) )
|
||||||
{
|
{
|
||||||
|
bool ok = false;
|
||||||
QString iconPath = QFileInfo( filePath() ).path() + "/"
|
QString iconPath = QFileInfo( filePath() ).path() + "/"
|
||||||
+ collectionInfo.value( "iconfile" ).toString();
|
+ collectionInfo.value( "iconfile" ).toString();
|
||||||
|
|
||||||
QPixmap iconPixmap;
|
QPixmap iconPixmap;
|
||||||
bool ok = iconPixmap.load( iconPath );
|
ok = iconPixmap.load( iconPath );
|
||||||
if ( ok && !iconPixmap.isNull() )
|
if ( ok && !iconPixmap.isNull() )
|
||||||
sc->setIcon( QIcon( iconPixmap ) );
|
sc->setIcon( QIcon( iconPixmap ) );
|
||||||
}
|
}
|
||||||
|
@@ -74,6 +74,7 @@ ScriptEngine::sslErrorHandler( QNetworkReply* qnr, const QList<QSslError>& errli
|
|||||||
tDebug() << Q_FUNC_INFO;
|
tDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
QByteArray digest = errlist.first().certificate().digest();
|
QByteArray digest = errlist.first().certificate().digest();
|
||||||
|
int result = -1;
|
||||||
|
|
||||||
if ( !TomahawkSettings::instance()->isSslCertKnown( digest ) )
|
if ( !TomahawkSettings::instance()->isSslCertKnown( digest ) )
|
||||||
{
|
{
|
||||||
@@ -91,7 +92,7 @@ ScriptEngine::sslErrorHandler( QNetworkReply* qnr, const QList<QSslError>& errli
|
|||||||
question.setStandardButtons( QMessageBox::No );
|
question.setStandardButtons( QMessageBox::No );
|
||||||
question.addButton( tr( "Trust certificate" ), QMessageBox::AcceptRole );
|
question.addButton( tr( "Trust certificate" ), QMessageBox::AcceptRole );
|
||||||
|
|
||||||
int result = question.exec();
|
result = question.exec();
|
||||||
|
|
||||||
//FIXME: discuss whether we want to store rejects, too (needs settings management to remove the decision?)
|
//FIXME: discuss whether we want to store rejects, too (needs settings management to remove the decision?)
|
||||||
if ( result == QMessageBox::AcceptRole )
|
if ( result == QMessageBox::AcceptRole )
|
||||||
|
Reference in New Issue
Block a user