Changeset View
Changeset View
Standalone View
Standalone View
app/documentinfoprovider.cpp
Show All 31 Lines | |||||
32 | 32 | | |||
33 | namespace Gwenview | 33 | namespace Gwenview | ||
34 | { | 34 | { | ||
35 | 35 | | |||
36 | DocumentInfoProvider::DocumentInfoProvider(SortedDirModel* model) | 36 | DocumentInfoProvider::DocumentInfoProvider(SortedDirModel* model) | ||
37 | : AbstractDocumentInfoProvider(model) | 37 | : AbstractDocumentInfoProvider(model) | ||
38 | { | 38 | { | ||
39 | mDirModel = model; | 39 | mDirModel = model; | ||
40 | connect(DocumentFactory::instance(), SIGNAL(documentBusyStateChanged(QUrl,bool)), | 40 | connect(DocumentFactory::instance(), &DocumentFactory::documentBusyStateChanged, | ||
41 | SLOT(emitBusyStateChanged(QUrl,bool))); | 41 | this, &AbstractDocumentInfoProvider::busyStateChanged); | ||
42 | 42 | connect(DocumentFactory::instance(), &DocumentFactory::documentChanged, | |||
43 | connect(DocumentFactory::instance(), SIGNAL(documentChanged(QUrl)), | 43 | this, &AbstractDocumentInfoProvider::documentChanged); | ||
44 | SLOT(emitDocumentChanged(QUrl))); | | |||
45 | } | 44 | } | ||
46 | 45 | | |||
47 | void DocumentInfoProvider::thumbnailForDocument(const QUrl &url, ThumbnailGroup::Enum group, QPixmap* outPix, QSize* outFullSize) const | 46 | void DocumentInfoProvider::thumbnailForDocument(const QUrl &url, ThumbnailGroup::Enum group, QPixmap* outPix, QSize* outFullSize) const | ||
48 | { | 47 | { | ||
49 | Q_ASSERT(outPix); | 48 | Q_ASSERT(outPix); | ||
50 | Q_ASSERT(outFullSize); | 49 | Q_ASSERT(outFullSize); | ||
51 | *outPix = QPixmap(); | 50 | *outPix = QPixmap(); | ||
52 | *outFullSize = QSize(); | 51 | *outFullSize = QSize(); | ||
Show All 31 Lines | 82 | { | |||
84 | Document::Ptr doc = DocumentFactory::instance()->getCachedDocument(url); | 83 | Document::Ptr doc = DocumentFactory::instance()->getCachedDocument(url); | ||
85 | if (doc) { | 84 | if (doc) { | ||
86 | return doc->isBusy(); | 85 | return doc->isBusy(); | ||
87 | } else { | 86 | } else { | ||
88 | return false; | 87 | return false; | ||
89 | } | 88 | } | ||
90 | } | 89 | } | ||
91 | 90 | | |||
92 | void DocumentInfoProvider::emitBusyStateChanged(const QUrl &url, bool busy) | | |||
93 | { | | |||
94 | QModelIndex index = mDirModel->indexForUrl(url); | | |||
95 | if (!index.isValid()) { | | |||
96 | return; | | |||
97 | } | | |||
98 | busyStateChanged(index, busy); | | |||
99 | } | | |||
100 | | ||||
101 | void DocumentInfoProvider::emitDocumentChanged(const QUrl &url) | | |||
102 | { | | |||
103 | QModelIndex index = mDirModel->indexForUrl(url); | | |||
104 | if (!index.isValid()) { | | |||
105 | return; | | |||
106 | } | | |||
107 | documentChanged(index); | | |||
108 | } | | |||
109 | | ||||
110 | } // namespace | 91 | } // namespace |