mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
* Invoke enqueuing DbCmds in the wrong thread.
* Fixed a few more TrackHeader issues.
This commit is contained in:
@@ -23,6 +23,7 @@ DatabaseCommand_UpdateSearchIndex::indexTable( DatabaseImpl* db, const QString&
|
|||||||
}
|
}
|
||||||
|
|
||||||
db->m_fuzzyIndex->appendFields( table, fields );
|
db->m_fuzzyIndex->appendFields( table, fields );
|
||||||
|
qDebug() << "Building index for" << table << "finished.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -40,6 +40,13 @@ DatabaseWorker::run()
|
|||||||
void
|
void
|
||||||
DatabaseWorker::enqueue( const QSharedPointer<DatabaseCommand>& cmd )
|
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++;
|
m_outstanding++;
|
||||||
|
|
||||||
QMutexLocker lock( &m_mut );
|
QMutexLocker lock( &m_mut );
|
||||||
|
@@ -25,11 +25,12 @@ public:
|
|||||||
DatabaseWorker( DatabaseImpl*, Database*, bool mutates );
|
DatabaseWorker( DatabaseImpl*, Database*, bool mutates );
|
||||||
~DatabaseWorker();
|
~DatabaseWorker();
|
||||||
|
|
||||||
void enqueue( const QSharedPointer<DatabaseCommand>& );
|
|
||||||
|
|
||||||
bool busy() const { return m_outstanding > 0; }
|
bool busy() const { return m_outstanding > 0; }
|
||||||
unsigned int outstandingJobs() const { return m_outstanding; }
|
unsigned int outstandingJobs() const { return m_outstanding; }
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void enqueue( const QSharedPointer<DatabaseCommand>& );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
|
@@ -26,14 +26,22 @@ TrackHeader::TrackHeader( TrackView* parent )
|
|||||||
// m_menu->addAction( tr( "Resize columns to fit window" ), this, SLOT( onToggleResizeColumns() ) );
|
// m_menu->addAction( tr( "Resize columns to fit window" ), this, SLOT( onToggleResizeColumns() ) );
|
||||||
// m_menu->addSeparator();
|
// 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 ) ) );
|
connect( m_sigmap, SIGNAL( mapped( int ) ), SLOT( toggleVisibility( int ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TrackHeader::~TrackHeader()
|
TrackHeader::~TrackHeader()
|
||||||
{
|
{
|
||||||
qDebug() << "Storing for:" << m_parent->guid();
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TrackHeader::onSectionResized()
|
||||||
|
{
|
||||||
|
if ( !m_init )
|
||||||
|
return;
|
||||||
|
|
||||||
TomahawkSettings::instance()->setPlaylistColumnSizes( m_parent->guid(), saveState() );
|
TomahawkSettings::instance()->setPlaylistColumnSizes( m_parent->guid(), saveState() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,10 +59,7 @@ TrackHeader::checkState()
|
|||||||
if ( !count() || m_init )
|
if ( !count() || m_init )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
qDebug() << "Restoring for:" << m_parent->guid();
|
|
||||||
m_init = true;
|
|
||||||
QByteArray state = TomahawkSettings::instance()->playlistColumnSizes( m_parent->guid() );
|
QByteArray state = TomahawkSettings::instance()->playlistColumnSizes( m_parent->guid() );
|
||||||
|
|
||||||
if ( !state.isEmpty() )
|
if ( !state.isEmpty() )
|
||||||
restoreState( state );
|
restoreState( state );
|
||||||
else
|
else
|
||||||
@@ -72,6 +77,8 @@ TrackHeader::checkState()
|
|||||||
resizeSection( i, qMax( minimumSectionSize(), int( nw - 0.5 ) ) );
|
resizeSection( i, qMax( minimumSectionSize(), int( nw - 0.5 ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -26,7 +26,7 @@ protected:
|
|||||||
void contextMenuEvent( QContextMenuEvent* e );
|
void contextMenuEvent( QContextMenuEvent* e );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
// void onSectionResized( int index );
|
void onSectionResized();
|
||||||
void onToggleResizeColumns();
|
void onToggleResizeColumns();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Reference in New Issue
Block a user