Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Qt UI Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Design Studio
QML Viewer Projects
Qt UI Viewer
Commits
81763273
Verified
Commit
81763273
authored
1 year ago
by
Burak Hançerli
Browse files
Options
Downloads
Patches
Plain Diff
fix: clean cached project when it's removed from the cloud
parent
624ac893
No related branches found
No related tags found
No related merge requests found
Pipeline
#67619
failed
1 year ago
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/backend.cpp
+11
-3
11 additions, 3 deletions
src/backend.cpp
src/projectManager.cpp
+14
-0
14 additions, 0 deletions
src/projectManager.cpp
src/projectManager.h
+1
-0
1 addition, 0 deletions
src/projectManager.h
with
26 additions
and
3 deletions
src/backend.cpp
+
11
−
3
View file @
81763273
...
...
@@ -271,9 +271,7 @@ void Backend::clearDemoCaches()
{
emit
popupOpen
();
updatePopup
(
"Clearing demo caches..."
);
m_projectManager
.
reset
(
new
ProjectManager
);
m_projectManager
->
clearDemoCaches
();
m_projectManager
.
reset
();
ProjectManager
().
clearDemoCaches
();
emit
popupClose
();
}
...
...
@@ -389,6 +387,16 @@ void Backend::updateUserProjectList()
const
QString
projectName
{
project
.
toObject
().
value
(
"appName"
).
toString
()};
qDebug
()
<<
"--"
<<
projectName
;
}
// check if any project is removed on the cloud
for
(
const
auto
&
project
:
m_projectList
)
{
const
QString
projectName
{
project
.
toObject
().
value
(
"appName"
).
toString
()};
if
(
!
projectList
.
value
().
contains
(
project
))
{
qDebug
()
<<
"Project removed:"
<<
projectName
<<
". Removing from cache..."
;
// remove the project from the cache
ProjectManager
().
clearCachedProject
(
project
.
toObject
());
}
}
}
// we need to set m_projectList even if it is empty
...
...
This diff is collapsed.
Click to expand it.
src/projectManager.cpp
+
14
−
0
View file @
81763273
...
...
@@ -399,6 +399,20 @@ bool ProjectManager::isProjectCached(const QJsonObject &projectInfo)
return
true
;
}
void
ProjectManager
::
clearCachedProject
(
const
QJsonObject
&
projectInfo
)
{
const
QString
projectId
=
projectInfo
.
value
(
"id"
).
toString
();
qDebug
()
<<
"Clearing cache for project "
<<
projectId
;
const
QString
cachePath
=
m_projectCachePath
+
"/"
+
projectId
;
if
(
!
QDir
(
cachePath
).
exists
())
{
qDebug
()
<<
"Project "
<<
projectId
<<
" is not cached"
;
}
qDebug
()
<<
"Removing cache for project "
<<
projectId
;
QDir
(
cachePath
).
removeRecursively
();
}
bool
ProjectManager
::
runCachedProject
(
const
QJsonObject
&
projectInfo
)
{
const
QString
projectId
=
projectInfo
.
value
(
"id"
).
toString
();
...
...
This diff is collapsed.
Click to expand it.
src/projectManager.h
+
1
−
0
View file @
81763273
...
...
@@ -46,6 +46,7 @@ public:
bool
cacheProject
(
const
QByteArray
&
projectData
,
const
QJsonObject
&
projectInfo
);
bool
isProjectCached
(
const
QJsonObject
&
projectInfo
);
bool
runCachedProject
(
const
QJsonObject
&
projectInfo
);
void
clearCachedProject
(
const
QJsonObject
&
projectInfo
);
bool
cacheDemoProject
(
const
QByteArray
&
projectData
,
const
QJsonObject
&
projectInfo
);
bool
isDemoProjectCached
(
const
QJsonObject
&
projectName
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment