diff --git a/qml.qrc b/qml.qrc index a2811172..b186f1c1 100644 --- a/qml.qrc +++ b/qml.qrc @@ -115,6 +115,7 @@ src/app/mainview/components/CallViewContextMenu.qml src/app/mainview/components/UserProfile.qml src/app/mainview/components/SwarmDetailsPanel.qml + src/app/mainview/components/SwarmDetailsItem.qml src/app/mainview/components/AddMemberPanel.qml src/app/mainview/components/SelectScreen.qml src/app/mainview/components/ScreenRubberBand.qml diff --git a/src/app/mainview/components/SwarmDetailsItem.qml b/src/app/mainview/components/SwarmDetailsItem.qml new file mode 100644 index 00000000..4249ebbf --- /dev/null +++ b/src/app/mainview/components/SwarmDetailsItem.qml @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2022 Savoir-faire Linux Inc. + * Author: Sébastien Blin + * + * 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 + +Rectangle { + id: root + + color: "transparent" + + HoverHandler { + target: parent + enabled: parent.visible + onHoveredChanged: { + parent.color = hovered ? Qt.darker(JamiTheme.selectedColor, 1.05) : "transparent" + } + } +} \ No newline at end of file diff --git a/src/app/mainview/components/SwarmDetailsPanel.qml b/src/app/mainview/components/SwarmDetailsPanel.qml index 4836a1ae..a74879d9 100644 --- a/src/app/mainview/components/SwarmDetailsPanel.qml +++ b/src/app/mainview/components/SwarmDetailsPanel.qml @@ -227,30 +227,33 @@ Rectangle { anchors.left: parent.left anchors.right: parent.right anchors.rightMargin: JamiTheme.settingsMarginSize - spacing: JamiTheme.preferredMarginSize visible: tabBar.currentIndex === 0 Layout.alignment: Qt.AlignTop - ToggleSwitch { - id: ignoreSwarm - + SwarmDetailsItem { Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize - Layout.topMargin: JamiTheme.preferredMarginSize + Layout.preferredHeight: JamiTheme.settingsFontSize + 2 * JamiTheme.preferredMarginSize + 4 - checked: false // TODO + ToggleSwitch { + id: ignoreSwarm - labelText: JamiStrings.ignoreTheSwarm - fontPointSize: JamiTheme.settingsFontSize + anchors.fill: parent + anchors.leftMargin: JamiTheme.preferredMarginSize - tooltipText: JamiStrings.ignoreTheSwarmTooltip + checked: false // TODO - onSwitchToggled: { - // TODO + labelText: JamiStrings.ignoreTheSwarm + fontPointSize: JamiTheme.settingsFontSize + + tooltipText: JamiStrings.ignoreTheSwarmTooltip + + onSwitchToggled: { + // TODO + } } } - Rectangle { + SwarmDetailsItem { Layout.fillWidth: true Layout.preferredHeight: JamiTheme.settingsFontSize + 2 * JamiTheme.preferredMarginSize + 4 @@ -268,16 +271,6 @@ Rectangle { color: JamiTheme.textColor } - color: "transparent" - - HoverHandler { - target: parent - enabled: parent.visible - onHoveredChanged: { - parent.color = hovered ? Qt.darker(JamiTheme.selectedColor, 1.05) : "transparent" - } - } - TapHandler { target: parent enabled: parent.visible @@ -287,40 +280,47 @@ Rectangle { } } - RowLayout { - Layout.leftMargin: JamiTheme.preferredMarginSize + SwarmDetailsItem { + Layout.fillWidth: true + Layout.preferredHeight: JamiTheme.settingsFontSize + 2 * JamiTheme.preferredMarginSize + 4 - Text { - Layout.fillWidth: true - Layout.preferredHeight: 30 - Layout.rightMargin: JamiTheme.preferredMarginSize + RowLayout { + anchors.fill: parent + anchors.leftMargin: JamiTheme.preferredMarginSize - text: JamiStrings.chooseAColor - font.pointSize: JamiTheme.settingsFontSize - font.kerning: true - elide: Text.ElideRight - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter + Text { + Layout.fillWidth: true + Layout.preferredHeight: 30 + Layout.rightMargin: JamiTheme.preferredMarginSize - color: JamiTheme.textColor + text: JamiStrings.chooseAColor + font.pointSize: JamiTheme.settingsFontSize + font.kerning: true + elide: Text.ElideRight + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + + color: JamiTheme.textColor + } + + Rectangle { + id: chooseAColorBtn + + Layout.alignment: Qt.AlignRight + + width: JamiTheme.aboutBtnSize + height: JamiTheme.aboutBtnSize + radius: JamiTheme.aboutBtnSize / 2 + + color: CurrentConversation.color + } } - Rectangle { - id: chooseAColorBtn - - Layout.alignment: Qt.AlignRight - - width: JamiTheme.aboutBtnSize - height: JamiTheme.aboutBtnSize - radius: JamiTheme.aboutBtnSize / 2 - - color: CurrentConversation.color - - MouseArea { - id: mouseArea - anchors.fill: parent - hoverEnabled: true - onClicked: colorDialog.open() + TapHandler { + target: parent + enabled: parent.visible + onTapped: function onTapped(eventPoint) { + colorDialog.open() } } } diff --git a/src/app/settingsview/components/ToggleSwitch.qml b/src/app/settingsview/components/ToggleSwitch.qml index eaa5e734..952dca9b 100644 --- a/src/app/settingsview/components/ToggleSwitch.qml +++ b/src/app/settingsview/components/ToggleSwitch.qml @@ -70,4 +70,12 @@ RowLayout { onToggled: switchToggled() } + + TapHandler { + target: parent + enabled: parent.visible + onTapped: function onTapped(eventPoint) { + switchOfLayout.checked = !switchOfLayout.checked + } + } }