Changeset View
Changeset View
Standalone View
Standalone View
src/EngineController.cpp
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | |||||
49 | 49 | | |||
50 | #include <QCoreApplication> | 50 | #include <QCoreApplication> | ||
51 | #include <QUrlQuery> | 51 | #include <QUrlQuery> | ||
52 | #include <QTimer> | 52 | #include <QTimer> | ||
53 | #include <QtMath> | 53 | #include <QtMath> | ||
54 | 54 | | |||
55 | #include <KLocalizedString> | 55 | #include <KLocalizedString> | ||
56 | 56 | | |||
57 | #include <thread> | ||||
58 | | ||||
59 | | ||||
57 | // for slotMetaDataChanged() | 60 | // for slotMetaDataChanged() | ||
58 | typedef QPair<Phonon::MetaData, QString> FieldPair; | 61 | typedef QPair<Phonon::MetaData, QString> FieldPair; | ||
59 | 62 | | |||
60 | namespace The { | 63 | namespace The { | ||
61 | EngineController* engineController() { return EngineController::instance(); } | 64 | EngineController* engineController() { return EngineController::instance(); } | ||
62 | } | 65 | } | ||
63 | 66 | | |||
64 | EngineController * | 67 | EngineController * | ||
▲ Show 20 Lines • Show All 1172 Lines • ▼ Show 20 Line(s) | |||||
1237 | EngineController::slotTrackFinishedPlaying( Meta::TrackPtr track, double playedFraction ) | 1240 | EngineController::slotTrackFinishedPlaying( Meta::TrackPtr track, double playedFraction ) | ||
1238 | { | 1241 | { | ||
1239 | Q_ASSERT( track ); | 1242 | Q_ASSERT( track ); | ||
1240 | debug() << "slotTrackFinishedPlaying(" | 1243 | debug() << "slotTrackFinishedPlaying(" | ||
1241 | << ( track->artist() ? track->artist()->name() : QString( "[no artist]" ) ) | 1244 | << ( track->artist() ? track->artist()->name() : QString( "[no artist]" ) ) | ||
1242 | << "-" << ( track->album() ? track->album()->name() : QString( "[no album]" ) ) | 1245 | << "-" << ( track->album() ? track->album()->name() : QString( "[no album]" ) ) | ||
1243 | << "-" << track->name() | 1246 | << "-" << track->name() | ||
1244 | << "," << playedFraction << ")"; | 1247 | << "," << playedFraction << ")"; | ||
1245 | track->finishedPlaying( playedFraction ); | 1248 | | ||
1249 | // Track::finishedPlaying is thread-safe and can take a long time to finish. | ||||
1250 | std::thread thread( &Meta::Track::finishedPlaying, track, playedFraction ); | ||||
1251 | thread.detach(); | ||||
1246 | } | 1252 | } | ||
1247 | 1253 | | |||
1248 | void | 1254 | void | ||
1249 | EngineController::metadataChanged( Meta::TrackPtr track ) | 1255 | EngineController::metadataChanged( Meta::TrackPtr track ) | ||
1250 | { | 1256 | { | ||
1251 | Meta::AlbumPtr album = m_currentTrack->album(); | 1257 | Meta::AlbumPtr album = m_currentTrack->album(); | ||
1252 | if( m_currentAlbum != album ) { | 1258 | if( m_currentAlbum != album ) { | ||
1253 | if( m_currentAlbum ) | 1259 | if( m_currentAlbum ) | ||
▲ Show 20 Lines • Show All 117 Lines • Show Last 20 Lines |