diff --git a/src/controls/AboutDialog.qml b/src/controls/AboutDialog.qml index bbfae66..639f213 100644 --- a/src/controls/AboutDialog.qml +++ b/src/controls/AboutDialog.qml @@ -1,171 +1,174 @@ /* * Copyright 2018 Camilo Higuita * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.0 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 import org.kde.kirigami 2.7 as Kirigami import org.kde.mauikit 1.0 as Maui Maui.Dialog { id: control - property string appName : Maui.App.name - property string appVersion : Maui.App.version - property string organizationName : Maui.App.org - property string organizationDomain : Maui.App.domain - property string appDescription : Maui.App.description - property string appLink: "www.maui-project.org" - property string appDonation: "" - property string appIcon: Maui.App.iconName - + defaultButtons: false widthHint: 0.9 heightHint: 0.8 maxWidth: Maui.Style.unit * 400 maxHeight: Maui.Style.unit * 250 page.padding: Maui.Style.space.small footBar.middleContent: ToolButton { icon.name: "link" - onClicked: Maui.FM.openUrl(control.appLink) - + onClicked: Qt.openUrlExternally(Maui.App.webPage) } footBar.rightContent: ToolButton { icon.name: "love" - onClicked: Maui.FM.openUrl(control.appDonation) + onClicked: Qt.openUrlExternally(Maui.App.donationPage) } footBar.leftContent: ToolButton { icon.name: "documentinfo" + onClicked: Qt.openUrlExternally(Maui.App.reportPage) } RowLayout { id: layout anchors.centerIn: parent width: parent.width height: parent.height * 0.7 spacing: Maui.Style.space.big Item { visible: parent.width > control.maxWidth * 0.7 Layout.fillHeight: true Layout.margins: Maui.Style.space.small Layout.alignment: Qt.AlignVCenter Layout.preferredWidth: Maui.Style.iconSizes.huge Image { anchors.centerIn: parent - source: control.appIcon + source: Maui.App.iconName width: Math.max(Maui.Style.iconSizes.huge, parent.width) height: width sourceSize.width: width sourceSize.height: height asynchronous: true fillMode: Image.PreserveAspectFit } } Kirigami.ScrollablePage { id: _descriptionItem Layout.fillWidth: true Layout.fillHeight: true Layout.alignment: Qt.AlignLeft | Qt.AlignTop Kirigami.Theme.backgroundColor: "transparent" padding: 0 leftPadding: padding rightPadding: padding topPadding: padding bottomPadding: padding ColumnLayout { id: _columnInfo spacing: Maui.Style.space.medium Label { Layout.fillWidth: true Layout.alignment: Qt.AlignLeft color: Kirigami.Theme.textColor - text: appName + text: Maui.App.name font.weight: Font.Bold font.bold: true font.pointSize: Maui.Style.fontSizes.huge elide: Text.ElideRight wrapMode: Text.NoWrap - } + } Label { Layout.fillWidth: true Layout.alignment: Qt.AlignLeft color: Qt.lighter(Kirigami.Theme.textColor, 1.2) - text: appVersion + text: Maui.App.version font.weight: Font.Light font.pointSize: Maui.Style.fontSizes.default elide: Text.ElideRight wrapMode: Text.WrapAtWordBoundaryOrAnywhere + } + + Label + { + color: Kirigami.Theme.textColor + Layout.fillWidth: true + + text: qsTr("By ") + Maui.App.org + font.pointSize: Maui.Style.fontSizes.default + elide: Text.ElideRight + wrapMode: Text.WrapAtWordBoundaryOrAnywhere } Label { id: body Layout.fillWidth: true - text: appDescription + text: Maui.App.description color: Kirigami.Theme.textColor font.pointSize: Maui.Style.fontSizes.default elide: Text.ElideRight wrapMode: Text.WrapAtWordBoundaryOrAnywhere } Kirigami.Separator { Layout.fillWidth: true - Layout.margins: Maui.Style.space.big + Layout.margins: Maui.Style.space.tiny opacity: 0.4 } Label { color: Kirigami.Theme.textColor Layout.fillWidth: true - text: qsTr("Built with MauiKit " + Maui.App.mauikitVersion + " and Kirigami." ) + text: qsTr("Powered by") + " MauiKit " + Maui.App.mauikitVersion + " and Kirigami." font.pointSize: Maui.Style.fontSizes.default elide: Text.ElideRight wrapMode: Text.WrapAtWordBoundaryOrAnywhere } } } } } diff --git a/src/utils/mauiapp.h b/src/utils/mauiapp.h index b618cf9..6bb5a3b 100644 --- a/src/utils/mauiapp.h +++ b/src/utils/mauiapp.h @@ -1,134 +1,186 @@ /* * * Copyright (C) 2019 camilo * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef MAUIAPP_H #define MAUIAPP_H #include #include #include "handy.h" #include "fmh.h" #ifndef STATIC_MAUIKIT #include "mauikit_export.h" #endif class MauiAccounts; #ifdef STATIC_MAUIKIT class MauiApp : public QObject #else class MAUIKIT_EXPORT MauiApp : public QObject #endif { Q_OBJECT Q_PROPERTY(QString name READ getName CONSTANT) Q_PROPERTY(QString version READ getVersion CONSTANT) Q_PROPERTY(QString org READ getOrg CONSTANT) Q_PROPERTY(QString domain READ getDomain CONSTANT) Q_PROPERTY(QString iconName READ getIconName WRITE setIconName NOTIFY iconNameChanged) Q_PROPERTY(QString description READ getDescription WRITE setDescription NOTIFY descriptionChanged) + Q_PROPERTY(QString webPage READ getWebPage WRITE setWebPage NOTIFY webPageChanged) + Q_PROPERTY(QString reportPage READ getReportPage WRITE setReportPage NOTIFY reportPageChanged) + Q_PROPERTY(QString donationPage READ getDonationPage WRITE setDonationPage NOTIFY donationPageChanged) Q_PROPERTY(QString mauikitVersion READ getMauikitVersion CONSTANT) Q_PROPERTY(QString qtVersion READ getQtVersion CONSTANT) Q_PROPERTY(MauiAccounts * accounts READ getAccounts CONSTANT FINAL) public: static MauiApp *qmlAttachedProperties(QObject *object); static MauiApp *instance(); static QString getName() { return Handy::appInfo().value(FMH::MODEL_NAME[FMH::MODEL_KEY::NAME]).toString(); } static QString getVersion() { return Handy::appInfo().value(FMH::MODEL_NAME[FMH::MODEL_KEY::VERSION]).toString(); } static QString getOrg() { return Handy::appInfo().value(FMH::MODEL_NAME[FMH::MODEL_KEY::ORG]).toString(); } static QString getDomain() { return Handy::appInfo().value(FMH::MODEL_NAME[FMH::MODEL_KEY::DOMAIN]).toString(); } static QString getMauikitVersion() { return Handy::appInfo().value("mauikit_version").toString(); } static QString getQtVersion() { return Handy::appInfo().value("qt_version").toString(); } QString getDescription() const { return description; } void setDescription(const QString &value) { if(description == value) return; description = value; emit this->descriptionChanged(description); } QString getIconName() const { return iconName; } void setIconName(const QString &value) { if(iconName == value) return; iconName = value; emit this->iconNameChanged(iconName); } + QString getWebPage() const + { + return webPage; + } + + void setWebPage(const QString &value) + { + if(webPage == value) + return; + + webPage = value; + emit this->webPageChanged(webPage); + } + + QString getDonationPage() const + { + return donationPage; + } + + void setDonationPage(const QString &value) + { + if(donationPage == value) + return; + + donationPage = value; + emit this->donationPageChanged(donationPage); + } + + QString getReportPage() const + { + return reportPage; + } + + void setReportPage(const QString &value) + { + if(reportPage == value) + return; + + reportPage = value; + emit this->reportPageChanged(reportPage); + } + MauiAccounts *getAccounts() const; ~MauiApp(); private: static MauiApp *m_instance; MauiApp(QObject *parent = nullptr); MauiApp(const MauiApp &other) = delete; MauiAccounts *m_accounts; QString description; QString iconName; + QString webPage; + QString donationPage; + QString reportPage; + signals: void iconNameChanged(QString iconName); void descriptionChanged(QString description); + void webPageChanged(QString webPage); + void donationPageChanged(QString donationPage); + void reportPageChanged(QString reportPage); }; QML_DECLARE_TYPEINFO(MauiApp, QML_HAS_ATTACHED_PROPERTIES) #endif // MAUIAPP_H