1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-05 00:22:31 +02:00

Remove one of the parenting warnings.

This commit is contained in:
Jeff Mitchell 2012-06-21 15:59:48 -04:00
parent 6cfc4eeb51
commit a1146fbe53
3 changed files with 14 additions and 13 deletions

View File

@ -138,7 +138,9 @@ Database::impl()
QThread* thread = QThread::currentThread();
if ( !m_implHash.contains( thread ) )
{
DatabaseImpl* impl = m_impl->clone();
QPair< QString, QString > args = m_impl->cloneArgs();
DatabaseImpl* impl = new DatabaseImpl( args.first, args.second );
impl->setFuzzyIndex( m_impl->fuzzyIndex() );
m_implHash.insert( thread, impl );
}

View File

@ -85,12 +85,12 @@ DatabaseImpl::DatabaseImpl( const QString& dbname )
}
DatabaseImpl::DatabaseImpl( const QString& dbname, bool internal )
DatabaseImpl::DatabaseImpl( const QString &dbname, const QString &dbid )
: QObject( (QObject*) QThread::currentThread() )
{
Q_UNUSED( internal );
openDatabase( dbname, false );
init();
m_dbid = dbid;
}
@ -142,15 +142,12 @@ DatabaseImpl::database()
}
DatabaseImpl*
DatabaseImpl::clone() const
QPair< QString, QString >
DatabaseImpl::cloneArgs() const
{
QMutexLocker lock( &m_mutex );
DatabaseImpl* impl = new DatabaseImpl( m_db.databaseName(), true );
impl->setDatabaseID( m_dbid );
impl->setFuzzyIndex( m_fuzzyIndex );
return impl;
QPair< QString, QString > args( m_db.databaseName(), m_dbid );
return args;
}

View File

@ -48,7 +48,7 @@ public:
DatabaseImpl( const QString& dbname );
~DatabaseImpl();
DatabaseImpl* clone() const;
QPair< QString, QString > cloneArgs() const;
TomahawkSqlQuery newquery();
QSqlDatabase& database();
@ -82,9 +82,9 @@ signals:
void indexReady();
private:
DatabaseImpl( const QString& dbname, bool internal );
DatabaseImpl( const QString &dbname, const QString &dbid );
FuzzyIndex* fuzzyIndex() const { return m_fuzzyIndex; }
void setFuzzyIndex( FuzzyIndex* fi ) { m_fuzzyIndex = fi; }
void setDatabaseID( const QString& dbid ) { m_dbid = dbid; }
void init();
bool openDatabase( const QString& dbname, bool checkSchema = true );
@ -101,6 +101,8 @@ private:
QString m_dbid;
FuzzyIndex* m_fuzzyIndex;
mutable QMutex m_mutex;
friend class Database;
};
#endif // DATABASEIMPL_H