1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 03:22:33 +01:00

Fix QtConcurrent missing return value

This commit is contained in:
Elias Steurer 2022-04-24 10:36:22 +02:00
parent 4a5f9420b1
commit f8084ad58c
4 changed files with 50 additions and 17 deletions

View File

@ -146,6 +146,7 @@ private:
QNetworkAccessManager* m_networkAccessManager { nullptr };
QString m_debugMessages {};
QFuture<void> m_requestAllLicensesFuture;
};
// Used for redirect content from static logToGui to setDebugMessages

View File

@ -134,5 +134,8 @@ signals:
private:
const std::shared_ptr<GlobalVariables> m_globalVariables;
const std::optional<QString> createTemporaryFolder() const;
private:
QFuture<void> m_wizardFuture;
};
}

View File

@ -108,8 +108,10 @@ QString Util::toLocal(const QString& url)
*/
void Util::Util::requestAllLicenses()
{
if (m_requestAllLicensesFuture.isStarted())
return;
QtConcurrent::run([this]() {
m_requestAllLicensesFuture = QtConcurrent::run([this]() {
QString tmp;
QFile file;
QTextStream out(&file);
@ -154,18 +156,16 @@ void Util::Util::requestAllLicenses()
*/
void Util::Util::requestDataProtection()
{
QtConcurrent::run([this]() {
QString tmp;
QFile file;
QTextStream out(&file);
QString tmp;
QFile file;
QTextStream out(&file);
file.setFileName(":/legal/DataProtection.txt");
file.open(QIODevice::ReadOnly | QIODevice::Text);
tmp += out.readAll();
file.close();
file.setFileName(":/legal/DataProtection.txt");
file.open(QIODevice::ReadOnly | QIODevice::Text);
tmp += out.readAll();
file.close();
emit this->allDataProtectionLoaded(tmp);
});
emit this->allDataProtectionLoaded(tmp);
}
static const char*

View File

@ -31,8 +31,12 @@ void Wizards::createQMLWidget(const QString& title,
const QString& previewThumbnail,
const QVector<QString>& tags)
{
if (m_wizardFuture.isRunning()) {
qWarning() << "Another wizard is already running! Abort.";
return;
}
QtConcurrent::run([=]() {
m_wizardFuture = QtConcurrent::run([=]() {
std::optional<QString> folderName = createTemporaryFolder();
if (!folderName.has_value()) {
@ -93,7 +97,12 @@ void Wizards::createHTMLWidget(const QString& title,
const QString& previewThumbnail,
const QVector<QString>& tags)
{
QtConcurrent::run([=]() {
if (m_wizardFuture.isRunning()) {
qWarning() << "Another wizard is already running! Abort.";
return;
}
m_wizardFuture = QtConcurrent::run([=]() {
std::optional<QString> folderName = createTemporaryFolder();
if (!folderName.has_value()) {
@ -156,7 +165,12 @@ void Wizards::createHTMLWallpaper(
const QString& previewThumbnail,
const QVector<QString>& tags)
{
QtConcurrent::run([=]() {
if (m_wizardFuture.isRunning()) {
qWarning() << "Another wizard is already running! Abort.";
return;
}
m_wizardFuture = QtConcurrent::run([=]() {
std::optional<QString> folderName = createTemporaryFolder();
if (!folderName.has_value()) {
@ -218,7 +232,12 @@ void Wizards::createQMLWallpaper(
const QString& previewThumbnail,
const QVector<QString>& tags)
{
QtConcurrent::run([=]() {
if (m_wizardFuture.isRunning()) {
qWarning() << "Another wizard is already running! Abort.";
return;
}
m_wizardFuture = QtConcurrent::run([=]() {
std::optional<QString> folderName = createTemporaryFolder();
if (!folderName.has_value()) {
@ -271,7 +290,12 @@ void Wizards::createGifWallpaper(
const QString& file,
const QVector<QString>& tags)
{
auto con = QtConcurrent::run([=]() {
if (m_wizardFuture.isRunning()) {
qWarning() << "Another wizard is already running! Abort.";
return;
}
m_wizardFuture = QtConcurrent::run([=]() {
std::optional<QString> folderName = createTemporaryFolder();
if (!folderName.has_value()) {
@ -321,7 +345,12 @@ void Wizards::createWebsiteWallpaper(
const QUrl& url,
const QVector<QString>& tags)
{
QtConcurrent::run([=]() {
if (m_wizardFuture.isRunning()) {
qWarning() << "Another wizard is already running! Abort.";
return;
}
m_wizardFuture = QtConcurrent::run([=]() {
std::optional<QString> folderName = createTemporaryFolder();
if (!folderName.has_value()) {