1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-15 06:52:34 +02:00

Make LICENSE stuff async

This commit is contained in:
Elias Steurer 2018-08-30 13:08:44 +02:00
parent d32047557c
commit 27b8982444
3 changed files with 44 additions and 35 deletions

View File

@ -8,6 +8,15 @@ Rectangle {
state: "off"
clip: true
Component.onCompleted: screenPlaySettings.requestAllLicenses()
Connections {
target: screenPlaySettings
onAllLicenseLoaded: {
txtLegal.text = licenses
}
}
Flickable {
anchors.fill: parent
contentHeight: txtLegal.paintedHeight
@ -29,8 +38,6 @@ Rectangle {
color: "#626262"
renderType: Text.NativeRendering
height: txtLegal.paintedHeight
onHeightChanged: print(height)
text: screenPlaySettings.getAllLicenes()
}
}

View File

@ -175,44 +175,46 @@ void Settings::writeSingleSettingConfig(QString name, QVariant value)
configTmp.close();
}
QString Settings::getAllLicenes()
void Settings::requestAllLicenses()
{
QString tmp;
QFile file;
QTextStream out(&file);
QtConcurrent::run([this]() {
QString tmp;
QFile file;
QTextStream out(&file);
file.setFileName(":/legal/Font Awesome Free License.txt");
file.open(QIODevice::ReadOnly | QIODevice::Text);
tmp += out.readAll();
file.close();
file.setFileName(":/legal/Font Awesome Free License.txt");
file.open(QIODevice::ReadOnly | QIODevice::Text);
tmp += out.readAll();
file.close();
file.setFileName(":/legal/gpl-3.0.txt");
file.open(QIODevice::ReadOnly | QIODevice::Text);
tmp += out.readAll();
file.close();
file.setFileName(":/legal/gpl-3.0.txt");
file.open(QIODevice::ReadOnly | QIODevice::Text);
tmp += out.readAll();
file.close();
file.setFileName(":/legal/gpl-3.0.txt");
file.open(QIODevice::ReadOnly | QIODevice::Text);
tmp += out.readAll();
file.close();
file.setFileName(":/legal/gpl-3.0.txt");
file.open(QIODevice::ReadOnly | QIODevice::Text);
tmp += out.readAll();
file.close();
file.setFileName(":/legal/OFL.txt");
file.open(QIODevice::ReadOnly | QIODevice::Text);
tmp += out.readAll();
file.close();
file.setFileName(":/legal/OFL.txt");
file.open(QIODevice::ReadOnly | QIODevice::Text);
tmp += out.readAll();
file.close();
file.setFileName(":/legal/OpenSSL.txt");
file.open(QIODevice::ReadOnly | QIODevice::Text);
tmp += out.readAll();
file.close();
file.setFileName(":/legal/OpenSSL.txt");
file.open(QIODevice::ReadOnly | QIODevice::Text);
tmp += out.readAll();
file.close();
file.setFileName(":/legal/Qt LGPLv3.txt");
file.open(QIODevice::ReadOnly | QIODevice::Text);
tmp += out.readAll();
file.close();
file.setFileName(":/legal/Qt LGPLv3.txt");
file.open(QIODevice::ReadOnly | QIODevice::Text);
tmp += out.readAll();
file.close();
return tmp;
emit this->allLicenseLoaded(tmp);
});
}
void Settings::setMuteAll(bool isMuted)
@ -270,7 +272,7 @@ QUrl Settings::getScreenPlayWidgetPath() const
return m_screenPlayWidgetPath;
}
void Settings::setScreenPlayWidgetPath(const QUrl &screenPlayWidgetPath)
void Settings::setScreenPlayWidgetPath(const QUrl& screenPlayWidgetPath)
{
m_screenPlayWidgetPath = screenPlayWidgetPath;
}
@ -311,4 +313,3 @@ void Settings::checkForOtherFullscreenApplication()
// }
}

View File

@ -11,6 +11,7 @@
#include <QProcess>
#include <QProcessEnvironment>
#include <QQmlPropertyMap>
#include <QtConcurrent/QtConcurrent>
#include <QSettings>
#include <QSharedPointer>
#include <QStandardPaths>
@ -134,8 +135,8 @@ signals:
void setMainWindowVisible(bool visible);
void activeWallpaperCounterChanged(int activeWallpaperCounter);
void pauseWallpaperWhenIngameChanged(bool pauseWallpaperWhenIngame);
void offlineModeChanged(bool offlineMode);
void allLicenseLoaded(QString licenses);
public slots:
void setMuteAll(bool isMuted);
@ -144,7 +145,7 @@ public slots:
void setGlobalVolume(float volume);
void setGlobalFillMode(QString fillMode);
void writeSingleSettingConfig(QString name, QVariant value);
QString getAllLicenes();
void requestAllLicenses();
bool autostart() const
{