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
Plasma
Discover
Commits
a0128388
Commit
a0128388
authored
Jan 14, 2021
by
Aleix Pol Gonzalez
🐧
Browse files
flatpak: delay app size calculation
Only do it when we need it instead of fetching them all at start.
parent
53c31b01
Changes
3
Hide whitespace changes
Inline
Side-by-side
libdiscover/backends/FlatpakBackend/FlatpakBackend.cpp
View file @
a0128388
...
...
@@ -541,9 +541,6 @@ void FlatpakBackend::addResource(FlatpakResource *resource)
updateAppState
(
resource
);
// This will update also metadata (required runtime)
updateAppSize
(
resource
);
m_resources
.
insert
(
resource
->
uniqueId
(),
resource
);
if
(
!
resource
->
extends
().
isEmpty
())
{
m_extends
.
append
(
resource
->
extends
());
...
...
libdiscover/backends/FlatpakBackend/FlatpakBackend.h
View file @
a0128388
...
...
@@ -56,6 +56,8 @@ public:
FlatpakSourcesBackend
*
sources
()
const
{
return
m_sources
;
}
bool
updateAppSize
(
FlatpakResource
*
resource
);
private
Q_SLOTS
:
void
onFetchMetadataFinished
(
FlatpakResource
*
resource
,
const
QByteArray
&
metadata
);
void
onFetchSizeFinished
(
FlatpakResource
*
resource
,
guint64
downloadSize
,
guint64
installedSize
);
...
...
@@ -88,7 +90,6 @@ private:
bool
updateAppMetadata
(
FlatpakResource
*
resource
);
bool
updateAppMetadata
(
FlatpakResource
*
resource
,
const
QByteArray
&
data
);
bool
updateAppMetadata
(
FlatpakResource
*
resource
,
const
QString
&
path
);
bool
updateAppSize
(
FlatpakResource
*
resource
);
bool
updateAppSizeFromRemote
(
FlatpakResource
*
resource
);
void
updateAppState
(
FlatpakResource
*
resource
);
...
...
libdiscover/backends/FlatpakBackend/FlatpakResource.cpp
View file @
a0128388
...
...
@@ -350,6 +350,7 @@ QString FlatpakResource::sizeDescription()
KFormat
f
;
if
(
!
isInstalled
()
||
canUpgrade
())
{
if
(
propertyState
(
DownloadSize
)
==
NotKnownYet
||
propertyState
(
InstalledSize
)
==
NotKnownYet
||
propertyState
(
DownloadSize
)
==
Fetching
||
propertyState
(
InstalledSize
)
==
Fetching
)
{
qobject_cast
<
FlatpakBackend
*>
(
backend
())
->
updateAppSize
(
this
);
return
i18n
(
"Retrieving size information"
);
}
else
if
(
propertyState
(
DownloadSize
)
==
UnknownOrFailed
||
propertyState
(
InstalledSize
)
==
UnknownOrFailed
)
{
return
i18n
(
"Unknown size"
);
...
...
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