Split the avatar images into a seperate cache

This commit is contained in:
Morgan McMillian 2017-11-18 16:58:57 -08:00
parent f298fe7f61
commit fde3a7cdec
5 changed files with 16 additions and 6 deletions

View file

@ -57,7 +57,7 @@ Container {
NetImageTracker { NetImageTracker {
id: tracker id: tracker
source: (postitem.ListItem.view.hideAvatar()) ? "" : ListItemData.user.content.avatar_image.link source: (postitem.ListItem.view.hideAvatar()) ? "" : ListItemData.user.content.avatar_image.link
manager: postitem.ListItem.view.listImageManager manager: postitem.ListItem.view.userImageManager
} }
] ]
} }

View file

@ -44,6 +44,7 @@ NavigationPane {
ListView { ListView {
id: streamView id: streamView
property variant listImageManager: feedImageManager property variant listImageManager: feedImageManager
property variant userImageManager: userImageManager
property bool fetching: false property bool fetching: false
dataModel: ArrayDataModel { dataModel: ArrayDataModel {
id: postModel id: postModel
@ -161,6 +162,10 @@ NavigationPane {
id: feedImageManager id: feedImageManager
cacheId: "feedImageManager" cacheId: "feedImageManager"
cacheSize: 250 cacheSize: 250
},
NetImageManager {
id: userImageManager
cacheId: "userImageManager"
} }
] ]
} }

View file

@ -33,6 +33,7 @@ Page {
ListView { ListView {
id: threadView id: threadView
property variant listImageManager: feedImageManager property variant listImageManager: feedImageManager
property variant userImageManager: userImageManager
dataModel: ArrayDataModel { dataModel: ArrayDataModel {
id: threadModel id: threadModel
} }
@ -88,6 +89,10 @@ Page {
id: feedImageManager id: feedImageManager
cacheId: "feedImageManager" cacheId: "feedImageManager"
cacheSize: 250 cacheSize: 250
},
NetImageManager {
id: userImageManager
cacheId: "userImageManager"
} }
] ]
} }

View file

@ -47,7 +47,7 @@ void NetImageTracker::onImageReady(const QString filePath, const QString imageNa
if (imageName.compare(mSource) == 0) { if (imageName.compare(mSource) == 0) {
if (imageName.compare("loading") == 0) { if (imageName.compare("loading") == 0) {
// If we don't have an image to display, let's display a loading image // If we don't have an image to display, let's display a loading image
QUrl url = QUrl("asset:///images/ca_rss_unread.png"); QUrl url = QUrl("asset:///icons/ic_doctype_picture.png");
setImageSource(url); setImageSource(url);
} else { } else {
// Set the path to the image that is now downloaded and cached in the data folder on the device. // Set the path to the image that is now downloaded and cached in the data folder on the device.

View file

@ -223,22 +223,22 @@
<context> <context>
<name>StreamTab</name> <name>StreamTab</name>
<message> <message>
<location filename="../assets/StreamTab.qml" line="170"/> <location filename="../assets/StreamTab.qml" line="175"/>
<source>New Post</source> <source>New Post</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/StreamTab.qml" line="184"/> <location filename="../assets/StreamTab.qml" line="189"/>
<source>To Top</source> <source>To Top</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/StreamTab.qml" line="212"/> <location filename="../assets/StreamTab.qml" line="217"/>
<source>To Bottom</source> <source>To Bottom</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/StreamTab.qml" line="199"/> <location filename="../assets/StreamTab.qml" line="204"/>
<source>Reload</source> <source>Reload</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>