Changeset View
Changeset View
Standalone View
Standalone View
src/core-impl/collections/db/sql/SqlScanResultProcessor.cpp
Show All 27 Lines | |||||
28 | #include "collectionscanner/Playlist.h" | 28 | #include "collectionscanner/Playlist.h" | ||
29 | #include "core/support/Debug.h" | 29 | #include "core/support/Debug.h" | ||
30 | #include "core-impl/collections/db/MountPointManager.h" | 30 | #include "core-impl/collections/db/MountPointManager.h" | ||
31 | #include "core-impl/collections/db/sql/SqlQueryMaker.h" | 31 | #include "core-impl/collections/db/sql/SqlQueryMaker.h" | ||
32 | #include "playlistmanager/PlaylistManager.h" | 32 | #include "playlistmanager/PlaylistManager.h" | ||
33 | 33 | | |||
34 | #include <KMessageBox> | 34 | #include <KMessageBox> | ||
35 | 35 | | |||
36 | #include <QAbstractEventDispatcher> | ||||
36 | #include <QApplication> | 37 | #include <QApplication> | ||
37 | 38 | | |||
38 | SqlScanResultProcessor::SqlScanResultProcessor( GenericScanManager* manager, | 39 | SqlScanResultProcessor::SqlScanResultProcessor( GenericScanManager* manager, | ||
39 | Collections::SqlCollection* collection, | 40 | Collections::SqlCollection* collection, | ||
40 | QObject *parent ) | 41 | QObject *parent ) | ||
41 | : AbstractScanResultProcessor( manager, parent ) | 42 | : AbstractScanResultProcessor( manager, parent ) | ||
42 | , m_collection( collection ) | 43 | , m_collection( collection ) | ||
43 | { } | 44 | { } | ||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 89 | KMessageBox::error( The::mainWindow(), text, i18n( "Errors During Collection Scan" ), | |||
89 | KMessageBox::AllowLink ); | 90 | KMessageBox::AllowLink ); | ||
90 | 91 | | |||
91 | m_messages.clear(); | 92 | m_messages.clear(); | ||
92 | } | 93 | } | ||
93 | 94 | | |||
94 | void | 95 | void | ||
95 | SqlScanResultProcessor::blockUpdates() | 96 | SqlScanResultProcessor::blockUpdates() | ||
96 | { | 97 | { | ||
98 | DEBUG_BLOCK | ||||
99 | | ||||
97 | m_collection->blockUpdatedSignal(); | 100 | m_collection->blockUpdatedSignal(); | ||
98 | m_collection->registry()->blockDatabaseUpdate(); | 101 | m_collection->registry()->blockDatabaseUpdate(); | ||
99 | } | 102 | } | ||
100 | 103 | | |||
101 | void | 104 | void | ||
102 | SqlScanResultProcessor::unblockUpdates() | 105 | SqlScanResultProcessor::unblockUpdates() | ||
103 | { | 106 | { | ||
107 | DEBUG_BLOCK | ||||
108 | | ||||
104 | m_collection->registry()->unblockDatabaseUpdate(); | 109 | m_collection->registry()->unblockDatabaseUpdate(); | ||
105 | m_collection->unblockUpdatedSignal(); | 110 | m_collection->unblockUpdatedSignal(); | ||
106 | } | 111 | } | ||
107 | 112 | | |||
108 | void | 113 | void | ||
109 | SqlScanResultProcessor::message( const QString& message ) | 114 | SqlScanResultProcessor::message( const QString& message ) | ||
110 | { | 115 | { | ||
111 | m_messages.append( message ); | 116 | m_messages.append( message ); | ||
▲ Show 20 Lines • Show All 510 Lines • ▼ Show 20 Line(s) | 576 | { | |||
622 | } | 627 | } | ||
623 | 628 | | |||
624 | return idToDirEntryMap.values(); | 629 | return idToDirEntryMap.values(); | ||
625 | } | 630 | } | ||
626 | 631 | | |||
627 | void | 632 | void | ||
628 | SqlScanResultProcessor::urlsCacheInit() | 633 | SqlScanResultProcessor::urlsCacheInit() | ||
629 | { | 634 | { | ||
635 | DEBUG_BLOCK | ||||
636 | | ||||
630 | auto storage = m_collection->sqlStorage(); | 637 | auto storage = m_collection->sqlStorage(); | ||
631 | 638 | | |||
632 | QString query = QString( "SELECT id, deviceid, rpath, directory, uniqueid FROM urls;"); | 639 | QString query = QString( "SELECT id, deviceid, rpath, directory, uniqueid FROM urls;"); | ||
633 | QStringList res = storage->query( query ); | 640 | QStringList res = storage->query( query ); | ||
634 | 641 | | |||
635 | for( int i = 0; i < res.count(); ) | 642 | for( int i = 0; i < res.count(); ) | ||
636 | { | 643 | { | ||
637 | int id = res.at(i++).toInt(); | 644 | int id = res.at(i++).toInt(); | ||
Show All 17 Lines | |||||
655 | if( !directoryId ) | 662 | if( !directoryId ) | ||
656 | { | 663 | { | ||
657 | warning() << "Found urls entry without directory. A phantom track. Removing" << path; | 664 | warning() << "Found urls entry without directory. A phantom track. Removing" << path; | ||
658 | removeTrack( entry ); | 665 | removeTrack( entry ); | ||
659 | continue; | 666 | continue; | ||
660 | } | 667 | } | ||
661 | 668 | | |||
662 | urlsCacheInsert( entry ); | 669 | urlsCacheInsert( entry ); | ||
670 | | ||||
671 | QAbstractEventDispatcher::instance()->processEvents( QEventLoop::AllEvents ); | ||||
663 | } | 672 | } | ||
664 | } | 673 | } | ||
665 | 674 | | |||
666 | void | 675 | void | ||
667 | SqlScanResultProcessor::urlsCacheInsert( const UrlEntry &entry ) | 676 | SqlScanResultProcessor::urlsCacheInsert( const UrlEntry &entry ) | ||
668 | { | 677 | { | ||
669 | // this case is normal operation | 678 | // this case is normal operation | ||
670 | if( m_urlsCache.contains( entry.id ) ) | 679 | if( m_urlsCache.contains( entry.id ) ) | ||
▲ Show 20 Lines • Show All 58 Lines • Show Last 20 Lines |