Importing Tracks into a collection

Jeff Mitchell kde-dev at emailgoeshere.com
Tue Oct 28 13:12:59 CET 2008


Maximilian Kossick wrote:
> a quick and dirty way would be to check the current thread in the
> sqlcollectionlocation showdestination dialog method, and use a default
> way to determine the file location if the thread is not the gui
> thread.
> 
> another way would be to add a setParameters(QMap<QString, QVariant>)
> method to collectionlocation, and check for some magic values in
> sqlcollectionlocation
> 
> Cheers, Max
> 
> On Tue, Oct 28, 2008 at 11:22 AM, Seb Ruiz <ruiz at kde.org> wrote:
>> Hi Max or anybody else,
>> With the importer I need to be able to insert Meta::TrackPtrs into the
>> SqlCollection. I've seen that when copying files to a collection this
>> is done through the CollectionLocation. There doesn't seem to be any
>> straight forward method of doing this. The only solution I can think
>> of is to use a dummy FileCollectionLocation and do a prepareCopy() on
>> the track that I need to import. However this is inappropriate since
>> the Collection Location will try to spawn an "organise" dialog should
>> not be done (as the file location shouldn't actually change) and
>> cannot be done since it is being executed outside of a GUI thread.

Maybe try using the static QThread::currentThread() compared to
MainWindow::thread()?  (All QObjects have ::thread(), which returns the
thread in which the object lives; QThread::currentThread() returns the
currently executing thread).  I am assuming comparing the pointers
should be okay...

--Jeff


More information about the Amarok-devel mailing list