Commit 769520f6 authored by Holger Kaelberer's avatar Holger Kaelberer
Browse files

core, DownloadManager: expose status of registering voices

Add getter and signal for the status of registering voices rcc. This
targets for now only voices rccs of the currently active locale.
Generalize if needed.
parent 2a45fcce
......@@ -21,6 +21,7 @@
#include "DownloadManager.h"
#include "ApplicationSettings.h"
#include "ApplicationInfo.h"
#include <QFile>
#include <QDir>
......@@ -502,10 +503,26 @@ bool DownloadManager::registerResource(const QString& filename)
<< filename
<< "(rcRoot=" << getResourceRootForFilename(filename) << ")";
QString v = getVoicesResourceForLocale(
QString relPath = getRelativeResourcePath(filename);
if (v == relPath)
emit voicesRegistered();
return false;
bool DownloadManager::areVoicesRegistered() const
QString relFilename = getVoicesResourceForLocale(
for (auto &base: getSystemResourcePaths())
if (isRegistered(base + "/" + relFilename))
return true;
return false;
/** Handle a finished download
* Called whenever a single download (sub-job) has finished. Responsible for
......@@ -113,6 +113,7 @@ public:
Q_INVOKABLE QString getVoicesResourceForLocale(const QString& locale) const;
Q_INVOKABLE bool haveLocalResource(const QString& path) const;
Q_INVOKABLE bool downloadIsRunning() const;
Q_INVOKABLE bool areVoicesRegistered() const; // checks whether voices for the currently active locale are registered
public slots:
Q_INVOKABLE bool updateResource(const QString& path);
......@@ -130,6 +131,7 @@ signals:
void downloadStarted(const QString& resource);
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
void downloadFinished(int code); // note: when using DownloadFinishedCode instead of int the code will not be passed to the QML layer
void voicesRegistered(); // emitted when voices for current locale have been registered
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