diff --git a/resources/icons/favorite_black_24dp.svg b/resources/icons/favorite_black_24dp.svg new file mode 100644 index 00000000..134a5dad --- /dev/null +++ b/resources/icons/favorite_black_24dp.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/app/constant/JamiStrings.qml b/src/app/constant/JamiStrings.qml index 553dcc14..eadba1a3 100644 --- a/src/app/constant/JamiStrings.qml +++ b/src/app/constant/JamiStrings.qml @@ -839,6 +839,7 @@ Item { property string zoomLevel: qsTr("Text zoom level") //Donation campaign + property string donationTipBoxText: qsTr("Free and private sharing. Donate to expand it.") property string donation: qsTr("Donate") property string donationText: qsTr("If you enjoy using Jami and believe in our mission, would you make a donation?") property string notNow: qsTr("Not now") diff --git a/src/app/mainview/components/DonationTipBox.qml b/src/app/mainview/components/DonationTipBox.qml new file mode 100644 index 00000000..18abdf1d --- /dev/null +++ b/src/app/mainview/components/DonationTipBox.qml @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2023 Savoir-faire Linux Inc. + * + * 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 . + */ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import net.jami.Models 1.1 +import net.jami.Adapters 1.1 +import net.jami.Constants 1.1 +import "../../commoncomponents" + +Item { + id: root + focus: true + width: parent.width + height: backupLayout.height + + property real iconSize: 26 + property real margin: 5 + property real preferredWidth: 170 + + property real maxHeight: 250 + + property color textColor: JamiTheme.textColor + property color iconColor: JamiTheme.tintedBlue + + ColumnLayout { + id: backupLayout + + anchors.top: parent.top + width: parent.width + + RowLayout { + id: rowlayout + + Layout.leftMargin: 15 + Layout.alignment: Qt.AlignLeft + + ResponsiveImage { + id: icon + + visible: !opened + + Layout.alignment: Qt.AlignLeft + Layout.topMargin: root.margin + Layout.preferredWidth: root.iconSize + Layout.preferredHeight: root.iconSize + + containerHeight: Layout.preferredHeight + containerWidth: Layout.preferredWidth + + color: JamiTheme.tintedBlue + + source: JamiResources.favorite_black_24dp_svg + } + + Text { + id: title + text: JamiStrings.donation + color: root.textColor + font.weight: Font.Medium + Layout.topMargin: root.margin + Layout.alignment: Qt.AlignLeft + Layout.leftMargin: root.margin + Layout.preferredWidth: root.preferredWidth - 2 * root.margin - root.iconSize + font.pixelSize: JamiTheme.tipBoxTitleFontSize + horizontalAlignment: Text.AlignLeft + elide: Qt.ElideRight + } + } + + Text { + id: content + Layout.preferredWidth: root.preferredWidth + focus: true + Layout.leftMargin: 20 + Layout.topMargin: 8 + Layout.bottomMargin: 8 + font.pixelSize: JamiTheme.tipBoxContentFontSize + visible: true + wrapMode: Text.WordWrap + font.weight: Font.Normal + text: JamiStrings.donationTipBoxText + color: root.textColor + horizontalAlignment: Text.AlignLeft + linkColor: JamiTheme.buttonTintedBlue + onLinkActivated: { + Qt.openUrlExternally(JamiTheme.donationUrl); + } + } + } +} diff --git a/src/app/mainview/components/TipBox.qml b/src/app/mainview/components/TipBox.qml index 6c05c562..c84929b5 100644 --- a/src/app/mainview/components/TipBox.qml +++ b/src/app/mainview/components/TipBox.qml @@ -37,7 +37,6 @@ FocusScope { property color textColor: JamiTheme.textColor property color iconColor: JamiTheme.tintedBlue - property string customizeTip: "CustomizeTipBox {}" property string backupTip: "BackupTipBox {" + " onIgnore: {" + " root.ignoreClicked()" + " }" + "}" @@ -56,7 +55,6 @@ FocusScope { focus: true activeFocusOnTab: true - Rectangle { id: rect anchors.fill: parent @@ -73,6 +71,18 @@ FocusScope { width: parent.width anchors.topMargin: 10 + Loader { + id: loader_donationTip + active: type === "donation" + focus: true + sourceComponent: DonationTipBox { + maxHeight: root.maximumHeight + textColor: root.textColor + iconColor: root.iconColor + } + width: parent.width + } + Loader { id: loader_backupTip active: type === "backup" @@ -95,7 +105,6 @@ FocusScope { } width: parent.width focus: true - } Loader { id: loader_infoTip @@ -106,7 +115,6 @@ FocusScope { iconColor: root.iconColor } width: parent.width - } } } @@ -119,6 +127,7 @@ FocusScope { TapHandler { target: rect + enabled: type !== "donation" onTapped: { return opened ? focus = false : root.forceActiveFocus(); } diff --git a/src/app/tipsmodel.cpp b/src/app/tipsmodel.cpp index f2025096..c1dfe0ee 100644 --- a/src/app/tipsmodel.cpp +++ b/src/app/tipsmodel.cpp @@ -75,6 +75,7 @@ TipsModel::reset() beginResetModel(); tips_.clear(); + tips_.append({{"id", "14"}, {"title", tr("Donate")}, {"desc", ""}, {"type", "donation"}}); tips_.append({{"id", "0"}, {"title", tr("Customize")}, {"desc", ""}, {"type", "customize"}}); tips_.append({{"id", "13"}, {"title", tr("Backup account")}, {"desc", ""}, {"type", "backup"}}); tips_.append({{"id", "1"},