From d32047557c1b1b6bff3eeef24f13cb84a1d07b70 Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Thu, 30 Aug 2018 12:59:09 +0200 Subject: [PATCH] Add LICENSE inside of the settings --- ScreenPlay/Resources.qrc | 7 ++ ScreenPlay/qml/Settings/Settings.qml | 13 +++- ScreenPlay/qml/Settings/SettingsExpander.qml | 70 ++++++++++++++++++++ ScreenPlay/src/settings.cpp | 40 +++++++++++ ScreenPlay/src/settings.h | 1 + 5 files changed, 129 insertions(+), 2 deletions(-) create mode 100644 ScreenPlay/qml/Settings/SettingsExpander.qml diff --git a/ScreenPlay/Resources.qrc b/ScreenPlay/Resources.qrc index 815d9dee..e677a2db 100644 --- a/ScreenPlay/Resources.qrc +++ b/ScreenPlay/Resources.qrc @@ -108,5 +108,12 @@ assets/icons/icon_open_in_new.svg translations/ScreenPlay_de.qm translations/ScreenPlay_en.qm + qml/Settings/SettingsExpander.qml + legal/Font Awesome Free License.txt + legal/gpl-3.0.txt + legal/lgpl-2.1.txt + legal/OFL.txt + legal/OpenSSL.txt + legal/Qt LGPLv3.txt diff --git a/ScreenPlay/qml/Settings/Settings.qml b/ScreenPlay/qml/Settings/Settings.qml index e50fcb4a..1657f9cb 100644 --- a/ScreenPlay/qml/Settings/Settings.qml +++ b/ScreenPlay/qml/Settings/Settings.qml @@ -245,7 +245,7 @@ Item { Item { id: settingsAboutrapper - height: 350 + height: settingsAboutrapperWrapper.childrenRect.height + 100 width: parent.width RectangularGlow { @@ -265,6 +265,7 @@ Item { } Rectangle { + anchors.fill: parent radius: 4 clip: true @@ -281,6 +282,7 @@ Item { } Column { + id:settingsAboutrapperWrapper width: parent.width spacing: 10 anchors { @@ -350,7 +352,14 @@ Item { description: qsTr("ScreenPlay would not be possible without the work of others. A big thank you to: ") buttonText: qsTr("Licenses") onButtonPressed: { - utility.openLicenceFolder() + expander.toggle() + } + } + SettingsExpander { + id:expander + anchors { + left: parent.left + right: parent.right } } } diff --git a/ScreenPlay/qml/Settings/SettingsExpander.qml b/ScreenPlay/qml/Settings/SettingsExpander.qml new file mode 100644 index 00000000..3739b39e --- /dev/null +++ b/ScreenPlay/qml/Settings/SettingsExpander.qml @@ -0,0 +1,70 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.3 +import QtQuick.Dialogs 1.2 +import QtQuick.Layouts 1.3 + +Rectangle { + id: root + state: "off" + clip: true + + Flickable { + anchors.fill: parent + contentHeight: txtLegal.paintedHeight + z: 999 + focus: true + contentWidth: parent.width + ScrollBar.vertical: ScrollBar { + snapMode: ScrollBar.SnapOnRelease + policy: ScrollBar.AlwaysOn + } + Text { + id: txtLegal + anchors { + top: parent.top + right: parent.right + left: parent.left + margins: 20 + } + color: "#626262" + renderType: Text.NativeRendering + height: txtLegal.paintedHeight + onHeightChanged: print(height) + text: screenPlaySettings.getAllLicenes() + } + } + + function toggle() { + root.state = root.state == "on" ? "off" : "on" + } + + states: [ + State { + name: "on" + + PropertyChanges { + target: root + height: 500 + } + }, + State { + name: "off" + PropertyChanges { + target: root + height: 0 + } + } + ] + transitions: [ + Transition { + from: "off" + to: "on" + reversible: true + PropertyAnimation { + target: root + property: "height" + duration: 250 + } + } + ] +} diff --git a/ScreenPlay/src/settings.cpp b/ScreenPlay/src/settings.cpp index 411a72aa..0bf2655b 100644 --- a/ScreenPlay/src/settings.cpp +++ b/ScreenPlay/src/settings.cpp @@ -175,6 +175,46 @@ void Settings::writeSingleSettingConfig(QString name, QVariant value) configTmp.close(); } +QString Settings::getAllLicenes() +{ + + 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/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/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(); + + return tmp; +} + void Settings::setMuteAll(bool isMuted) { diff --git a/ScreenPlay/src/settings.h b/ScreenPlay/src/settings.h index ab14a003..f6e56f4b 100644 --- a/ScreenPlay/src/settings.h +++ b/ScreenPlay/src/settings.h @@ -144,6 +144,7 @@ public slots: void setGlobalVolume(float volume); void setGlobalFillMode(QString fillMode); void writeSingleSettingConfig(QString name, QVariant value); + QString getAllLicenes(); bool autostart() const {