Skip to content
Snippets Groups Projects

QDS-11424 Update user projects automatically

Merged Burak Hançerli requested to merge QDS-11424/update-user-projects-automatically into master
3 files
+ 76
35
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 39
5
@@ -73,9 +73,14 @@ void Backend::initialize()
@@ -73,9 +73,14 @@ void Backend::initialize()
}
}
// Check if updateInBackground is enabled
// Check if updateInBackground is enabled
// const bool updateInBackground = settings.value("system/updateInBackground").toBool();
updateInBackground(settings.value("system/updateInBackground").toBool());
const bool updateInBackground = true;
qDebug() << "Initialization complete";
if (updateInBackground) {
}
 
 
void Backend::updateInBackground(const bool &enabled)
 
{
 
QSettings().setValue("system/updateInBackground", enabled);
 
if (enabled) {
qDebug() << "Update in background is enabled";
qDebug() << "Update in background is enabled";
m_backgroundTimer.setInterval(1000 * 10);
m_backgroundTimer.setInterval(1000 * 10);
connect(&m_backgroundTimer, &QTimer::timeout, this, [&] {
connect(&m_backgroundTimer, &QTimer::timeout, this, [&] {
@@ -92,10 +97,29 @@ void Backend::initialize()
@@ -92,10 +97,29 @@ void Backend::initialize()
updateUserProjectList();
updateUserProjectList();
});
});
m_backgroundTimer.start();
m_backgroundTimer.start();
} else
} else {
qDebug() << "Update in background is disabled";
qDebug() << "Update in background is disabled";
 
m_backgroundTimer.stop();
 
}
 
}
qDebug() << "Initialization complete";
void Backend::cacheDemoProjects(const bool &enabled)
 
{
 
QSettings().setValue("system/cacheDemoProjects", enabled);
 
if (enabled) {
 
qDebug() << "Caching demo projects is enabled";
 
} else {
 
qDebug() << "Caching demo projects is disabled";
 
}
 
}
 
void Backend::cacheUserProjects(const bool &enabled)
 
{
 
QSettings().setValue("system/cacheUserProjects", enabled);
 
if (enabled) {
 
qDebug() << "Caching user projects is enabled";
 
} else {
 
qDebug() << "Caching user projects is disabled";
 
}
}
}
void Backend::updatePopup(const QString &text, bool indeterminate)
void Backend::updatePopup(const QString &text, bool indeterminate)
@@ -345,6 +369,16 @@ void Backend::updateUserProjectList()
@@ -345,6 +369,16 @@ void Backend::updateUserProjectList()
m_serviceConnector.reset(new ServiceConnector);
m_serviceConnector.reset(new ServiceConnector);
QJsonArray projectList = m_serviceConnector->fetchUserProjectList(m_userHash);
QJsonArray projectList = m_serviceConnector->fetchUserProjectList(m_userHash);
 
if (projectList.isEmpty()) {
 
qCritical("Could not fetch available project list");
 
return;
 
}
 
 
if (projectList == m_projectListArray) {
 
qDebug("No new projects available");
 
return;
 
}
 
m_projectListArray = projectList;
m_projectList.clear();
m_projectList.clear();
qDebug("List of available projects fetched:");
qDebug("List of available projects fetched:");
for (const auto &project : projectList) {
for (const auto &project : projectList) {
Loading