diff --git a/resources/icons/favorite_black_24dp.svg b/resources/icons/favorite_black_24dp.svg new file mode 100644 index 0000000000000000000000000000000000000000..134a5dadfaaf394eb957bf326d99ab95b424ae3b --- /dev/null +++ b/resources/icons/favorite_black_24dp.svg @@ -0,0 +1,5 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="21.5" height="20.112" viewBox="0 0 21.5 20.112"> + <g id="favorite_black_24dp" transform="translate(-1.25 -2.25)"> + <path id="Path_270" data-name="Path 270" d="M12,21.35l-1.45-1.32C5.4,15.36,2,12.28,2,8.5A5.447,5.447,0,0,1,7.5,3,5.988,5.988,0,0,1,12,5.09,5.988,5.988,0,0,1,16.5,3,5.447,5.447,0,0,1,22,8.5c0,3.78-3.4,6.86-8.55,11.54Z" fill="none" stroke="#03b9e9" stroke-width="1.5"/> + </g> +</svg> diff --git a/src/app/constant/JamiStrings.qml b/src/app/constant/JamiStrings.qml index 553dcc14f7d38bc98b3a060bfc8b35cf693a1ce8..eadba1a32d3541ba3c78af1e479c7a76e45abd67 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. <a href=\"https://jami.net/donate/\">Donate</a> 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 0000000000000000000000000000000000000000..18abdf1d12bbe735ac33c8f6304b28c76537a53d --- /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 <https://www.gnu.org/licenses/>. + */ +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 6c05c5629a4d9190b90d55dd61a1b903383d5cf0..c84929b58a00bfa07443bc84e79f11895988d469 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 f2025096dede5de9ac311f9f76fdad810547bcee..c1dfe0ee702809a5a7cda438939dc7b99b033935 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"},