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

* Invoke enqueuing DbCmds in the wrong thread.

* Fixed a few more TrackHeader issues.
This commit is contained in:
Christian Muehlhaeuser 2011-02-14 17:12:10 +01:00
parent 0e5b8017f7
commit 0141f2b573
5 changed files with 24 additions and 8 deletions

View File

@ -23,6 +23,7 @@ DatabaseCommand_UpdateSearchIndex::indexTable( DatabaseImpl* db, const QString&
}
db->m_fuzzyIndex->appendFields( table, fields );
qDebug() << "Building index for" << table << "finished.";
}

View File

@ -40,6 +40,13 @@ DatabaseWorker::run()
void
DatabaseWorker::enqueue( const QSharedPointer<DatabaseCommand>& cmd )
{
if ( QThread::currentThread() != thread() )
{
// qDebug() << Q_FUNC_INFO << "Reinvoking in correct thread.";
QMetaObject::invokeMethod( this, "enqueue", Qt::QueuedConnection, Q_ARG( QSharedPointer<DatabaseCommand>, cmd ) );
return;
}
m_outstanding++;
QMutexLocker lock( &m_mut );

View File

@ -25,11 +25,12 @@ public:
DatabaseWorker( DatabaseImpl*, Database*, bool mutates );
~DatabaseWorker();
void enqueue( const QSharedPointer<DatabaseCommand>& );
bool busy() const { return m_outstanding > 0; }
unsigned int outstandingJobs() const { return m_outstanding; }
public slots:
void enqueue( const QSharedPointer<DatabaseCommand>& );
protected:
void run();

View File

@ -26,14 +26,22 @@ TrackHeader::TrackHeader( TrackView* parent )
// m_menu->addAction( tr( "Resize columns to fit window" ), this, SLOT( onToggleResizeColumns() ) );
// m_menu->addSeparator();
// connect( this, SIGNAL( sectionResized( int, int, int ) ), SLOT( onSectionResized( int ) ) );
connect( this, SIGNAL( sectionResized( int, int, int ) ), SLOT( onSectionResized() ) );
connect( m_sigmap, SIGNAL( mapped( int ) ), SLOT( toggleVisibility( int ) ) );
}
TrackHeader::~TrackHeader()
{
qDebug() << "Storing for:" << m_parent->guid();
}
void
TrackHeader::onSectionResized()
{
if ( !m_init )
return;
TomahawkSettings::instance()->setPlaylistColumnSizes( m_parent->guid(), saveState() );
}
@ -51,10 +59,7 @@ TrackHeader::checkState()
if ( !count() || m_init )
return;
qDebug() << "Restoring for:" << m_parent->guid();
m_init = true;
QByteArray state = TomahawkSettings::instance()->playlistColumnSizes( m_parent->guid() );
if ( !state.isEmpty() )
restoreState( state );
else
@ -72,6 +77,8 @@ TrackHeader::checkState()
resizeSection( i, qMax( minimumSectionSize(), int( nw - 0.5 ) ) );
}
}
m_init = true;
}

View File

@ -26,7 +26,7 @@ protected:
void contextMenuEvent( QContextMenuEvent* e );
private slots:
// void onSectionResized( int index );
void onSectionResized();
void onToggleResizeColumns();
private: