Commit 5eefd709 authored by Johnny Jazeix's avatar Johnny Jazeix
Browse files

wordset, register correctly the wordset when the option is activated in the configuration

parent ccfb55e0
......@@ -22,6 +22,8 @@
#include "ApplicationSettings.h"
#include "ApplicationInfo.h"
#include "DownloadManager.h"
#include <qmath.h>
#include <QUrl>
#include <QUrlQuery>
......@@ -356,6 +358,14 @@ void ApplicationSettings::notifySectionVisibleChanged()
void ApplicationSettings::notifyWordsetChanged()
{
if(!m_wordset.isEmpty() &&
DownloadManager::getInstance()->haveLocalResource(m_wordset) &&
!DownloadManager::getInstance()->isDataRegistered("words")) {
// words.rcc is there -> register old file first
// then try to update in the background
DownloadManager::getInstance()->updateResource(m_wordset);
}
updateValueInConfig(GENERAL_GROUP_KEY, WORDSET, m_wordset);
qDebug() << "notifyWordset: " << m_wordset;
}
......
......@@ -177,14 +177,25 @@ Window {
else {
// Register voices-resources for current locale, updates/downloads only if
// not prohibited by the settings
if (!DownloadManager.areVoicesRegistered())
if (!DownloadManager.areVoicesRegistered()) {
if (DownloadManager.updateResource(
DownloadManager.getVoicesResourceForLocale(ApplicationSettings.locale))) {
DownloadManager.downloadFinished.connect(function() {
checkWordset();
DownloadManager.downloadFinished.disconnect(arguments.callee);
});
} else
DownloadManager.resourceRegistered.connect(function() {
// not sure if needed, we check if the resource registered is the one we updated here?
if(DownloadManager.getVoicesResourceForLocale(ApplicationSettings.locale) === arguments[0]) {
DownloadManager.resourceRegistered.disconnect(arguments.callee);
checkWordset();
}
});
}
else
checkWordset()
}
else
checkWordset()
if(changelog.isNewerVersion(ApplicationSettings.lastGCVersionRan, ApplicationInfo.GCVersionCode)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment