Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Graphics
Krita
Commits
dab1e85d
Commit
dab1e85d
authored
Dec 10, 2018
by
Halla Rempt
Browse files
Only try to load a thumbnail for a recent file item that still exists
BUG:401939
parent
95b09eaf
Changes
1
Hide whitespace changes
Inline
Side-by-side
libs/ui/KisWelcomePageWidget.cpp
View file @
dab1e85d
...
...
@@ -20,6 +20,8 @@
#include
"KisWelcomePageWidget.h"
#include
<QDebug>
#include
<QDesktopServices>
#include
<QFileInfo>
#include
"kis_action_manager.h"
#include
"kactioncollection.h"
#include
"kis_action.h"
...
...
@@ -205,29 +207,31 @@ void KisWelcomePageWidget::populateRecentDocuments()
recentItem
->
setIcon
(
m_thumbnailMap
[
recentFileUrlPath
]);
}
else
{
if
(
recentFileUrlPath
.
endsWith
(
"ora"
)
||
recentFileUrlPath
.
endsWith
(
"kra"
))
{
QScopedPointer
<
KoStore
>
store
(
KoStore
::
createStore
(
QUrl
(
recentFileUrlPath
),
KoStore
::
Read
));
if
(
store
)
{
if
(
store
->
open
(
QString
(
"Thumbnails/thumbnail.png"
))
||
store
->
open
(
QString
(
"preview.png"
)))
{
QByteArray
bytes
=
store
->
read
(
store
->
size
());
store
->
close
();
QImage
img
;
img
.
loadFromData
(
bytes
);
img
.
setDevicePixelRatio
(
devicePixelRatioF
());
recentItem
->
setIcon
(
QIcon
(
QPixmap
::
fromImage
(
img
)));
if
(
QFileInfo
(
recentFileUrlPath
).
exists
())
{
if
(
recentFileUrlPath
.
endsWith
(
"ora"
)
||
recentFileUrlPath
.
endsWith
(
"kra"
))
{
QScopedPointer
<
KoStore
>
store
(
KoStore
::
createStore
(
QUrl
(
recentFileUrlPath
),
KoStore
::
Read
));
if
(
store
)
{
if
(
store
->
open
(
QString
(
"Thumbnails/thumbnail.png"
))
||
store
->
open
(
QString
(
"preview.png"
)))
{
QByteArray
bytes
=
store
->
read
(
store
->
size
());
store
->
close
();
QImage
img
;
img
.
loadFromData
(
bytes
);
img
.
setDevicePixelRatio
(
devicePixelRatioF
());
recentItem
->
setIcon
(
QIcon
(
QPixmap
::
fromImage
(
img
)));
}
}
}
}
else
{
QImage
img
(
QUrl
(
recentFileUrlPath
).
toLocalFile
());
img
.
setDevicePixelRatio
(
devicePixelRatioF
())
;
if
(
!
img
.
isNull
())
{
recentItem
->
setIcon
(
QIcon
(
QPixmap
::
fromImage
(
img
.
scaledToWidth
(
48
))));
else
{
QImage
img
(
QUrl
(
recentFileUrlPath
).
toLocalFile
());
img
.
setDevicePixelRatio
(
devicePixelRatioF
());
if
(
!
img
.
isNull
())
{
recentItem
->
setIcon
(
QIcon
(
QPixmap
::
fromImage
(
img
.
scaledToWidth
(
48
))));
}
}
m_thumbnailMap
[
recentFileUrlPath
]
=
recentItem
->
icon
();
}
m_thumbnailMap
[
recentFileUrlPath
]
=
recentItem
->
icon
();
}
// set the recent object with the data
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment