diff --git a/images/icons/delete-24px.svg b/images/icons/delete-24px.svg new file mode 100644 index 0000000000000000000000000000000000000000..3acec0ade159b51224522734cea082ddb07eb2f0 --- /dev/null +++ b/images/icons/delete-24px.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg> \ No newline at end of file diff --git a/images/icons/settings_backup_restore-24px.svg b/images/icons/settings_backup_restore-24px.svg new file mode 100644 index 0000000000000000000000000000000000000000..8f3f1bdeba90149d36de10fa64a1282fe8fe1e43 --- /dev/null +++ b/images/icons/settings_backup_restore-24px.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M14 12c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2zm-2-9c-4.97 0-9 4.03-9 9H0l4 4 4-4H5c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.51 0-2.91-.49-4.06-1.3l-1.42 1.44C8.04 20.3 9.94 21 12 21c4.97 0 9-4.03 9-9s-4.03-9-9-9z"/></svg> \ No newline at end of file diff --git a/qml.qrc b/qml.qrc index 3afafbac757a715272041e30b26d353304f72bd5..640897b0e06aa7b7f8206e065b7374f2e28459fd 100644 --- a/qml.qrc +++ b/qml.qrc @@ -52,7 +52,6 @@ <file>src/settingsview/components/NameRegistrationDialog.qml</file> <file>src/settingsview/components/LinkDeviceDialog.qml</file> <file>src/settingsview/components/RevokeDevicePasswordDialog.qml</file> - <file>src/commoncomponents/HoverableRadiusButton.qml</file> <file>src/commoncomponents/PasswordDialog.qml</file> <file>src/commoncomponents/InfoLineEdit.qml</file> <file>src/commoncomponents/MaterialLineEdit.qml</file> diff --git a/resources.qrc b/resources.qrc index 51a1b2ec9b9e5091d2141f7fc118edbd7b41ccee..82877ee59e06e864b8ce6a9ec061f0243533382c 100644 --- a/resources.qrc +++ b/resources.qrc @@ -134,5 +134,7 @@ <file>images/icons/arrow_drop_down-24px.svg</file> <file>images/icons/expand_less-24px.svg</file> <file>images/icons/expand_more-24px.svg</file> + <file>images/icons/delete-24px.svg</file> + <file>images/icons/settings_backup_restore-24px.svg</file> </qresource> </RCC> diff --git a/src/commoncomponents/HoverableRadiusButton.qml b/src/commoncomponents/HoverableRadiusButton.qml deleted file mode 100644 index 2f69b88eff3d8671f6f8e73e4cf712b8275b3532..0000000000000000000000000000000000000000 --- a/src/commoncomponents/HoverableRadiusButton.qml +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2020 by Savoir-faire Linux - * Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com> - * - * 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 2.15 -import QtQuick.Controls 2.14 -import net.jami.Models 1.0 - - -// HoverableButton contains the following configurable properties: -// 1. Color changes on different button state -// 2. Radius control (rounded) -// 3. Text content or image content -// 4. Can use OnClicked slot to implement some click logic - -Button { - id: root - property int fontPointSize: 9 - property int buttonImageHeight: hoverableButtonBackground.height - 10 - property int buttonImageWidth: hoverableButtonBackground.width - 10 - property string backgroundColor: JamiTheme.normalButtonColor - property string onPressColor: JamiTheme.pressColor - property string onReleaseColor: backgroundColor - property string onEnterColor: JamiTheme.hoverColor - property string onExitColor: backgroundColor - property alias radius: hoverableButtonBackground.radius - property alias source: hoverableButtonImage.source - property string toolTipText: "" - radius: height / 2 - function enterBtn(){ - btnMouseArea.entered() - } - function exitBtn(){ - btnMouseArea.exited() - } - function pressBtn(){ - btnMouseArea.pressed() - } - function releaseBtn(){ - btnMouseArea.released() - } - - ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval - ToolTip.visible: hovered && (toolTipText.length > 0) - ToolTip.text: toolTipText - - font.pointSize: fontPointSize - font.kerning: true - hoverEnabled: true - background: Rectangle { - id: hoverableButtonBackground - color: backgroundColor - Image { - id: hoverableButtonImage - anchors.centerIn: hoverableButtonBackground - height: buttonImageHeight - width: buttonImageWidth - fillMode: Image.PreserveAspectFit - mipmap: true - asynchronous: true - } - MouseArea { - id: btnMouseArea - anchors.fill: parent - hoverEnabled: true - onPressed: { - hoverableButtonBackground.color = onPressColor - } - onReleased: { - hoverableButtonBackground.color = onReleaseColor - root.clicked() - } - onEntered: { - hoverableButtonBackground.color = onEnterColor - } - onExited: { - hoverableButtonBackground.color = onExitColor - } - } - } -} diff --git a/src/commoncomponents/PreferenceItemDelegate.qml b/src/commoncomponents/PreferenceItemDelegate.qml index 8b83b08cdaa440830e8ac0079248fdc978746c0c..17d2593edbf273da28f4b6052973c67ac6421523 100644 --- a/src/commoncomponents/PreferenceItemDelegate.qml +++ b/src/commoncomponents/PreferenceItemDelegate.qml @@ -61,7 +61,7 @@ ItemDelegate { btnPreferenceClicked() break case PreferenceItemDelegate.PATH: - if(index == 0){ + if(index === 0){ preferenceFilePathDialog.title = qsTr("Select An Image to " + preferenceName) preferenceFilePathDialog.nameFilters = fileFilters preferenceFilePathDialog.open() @@ -101,35 +101,27 @@ ItemDelegate { ToolTip.text: preferenceSummary } - HoverableRadiusButton { + PushButton { id: btnPreference + visible: preferenceType === PreferenceItemDelegate.DEFAULT - backgroundColor: "white" + normalColor: JamiTheme.primaryBackgroundColor Layout.alignment: Qt.AlignRight | Qt.AlingVCenter - Layout.rightMargin: 7 - Layout.preferredWidth: 30 - Layout.preferredHeight: 30 - - buttonImageHeight: 20 - buttonImageWidth: 20 + Layout.rightMargin: 8 + Layout.preferredWidth: preferredSize + Layout.preferredHeight: preferredSize - source: { - return "qrc:/images/icons/round-settings-24px.svg" - } + source: "qrc:/images/icons/round-settings-24px.svg" - ToolTip.visible: hovered - ToolTip.text: { - return qsTr("Edit preference") - } + toolTipText: qsTr("Edit preference") - onClicked: { - btnPreferenceClicked() - } + onClicked: btnPreferenceClicked() } SettingParaCombobox { id: listPreferenceComboBox + visible: preferenceType === PreferenceItemDelegate.LIST Layout.preferredWidth: root.width / 2 - 8 Layout.alignment: Qt.AlignRight | Qt.AlignVCenter @@ -147,23 +139,22 @@ ItemDelegate { } } - HoverableRadiusButton { + PushButton { id: pathPreferenceButton + visible: preferenceType === PreferenceItemDelegate.PATH - Layout.preferredWidth: root.width / 2 - 16 Layout.maximumWidth: root.width / 2 - 16 Layout.alignment: Qt.AlignRight | Qt.AlignVCenter Layout.rightMargin: 30 - Layout.preferredHeight: 30 - radius: height / 2 + width: root.width / 2 - 16 + Layout.preferredWidth: width + Layout.preferredHeight: 32 - icon.source: "qrc:/images/icons/round-folder-24px.svg" - icon.height: 24 - icon.width: 24 + source: "qrc:/images/icons/round-folder-24px.svg" toolTipText: JamiStrings.chooseImageFile - text: UtilsAdapter.fileName(preferenceCurrentValue) + buttonText: UtilsAdapter.fileName(preferenceCurrentValue) fontPointSize: JamiTheme.buttonFontSize onClicked: { diff --git a/src/commoncomponents/PushButton.qml b/src/commoncomponents/PushButton.qml index 821ce1dd3efa2791dbc8eadb5f223ac7515281ed..c12fedc820593b4757673974ca8ac150c662946e 100644 --- a/src/commoncomponents/PushButton.qml +++ b/src/commoncomponents/PushButton.qml @@ -71,6 +71,7 @@ AbstractButton { checkable: true checked: false hoverEnabled: true + focusPolicy: Qt.TabFocus ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval ToolTip.visible: hovered && (toolTipText.length > 0) diff --git a/src/mainview/components/MediaHandlerItemDelegate.qml b/src/mainview/components/MediaHandlerItemDelegate.qml index 6b4b4aae73521d0c6c89c1722119e1e61052ce74..9650ebe6020565e09fb0ca6dee42859f86db791c 100644 --- a/src/mainview/components/MediaHandlerItemDelegate.qml +++ b/src/mainview/components/MediaHandlerItemDelegate.qml @@ -42,7 +42,7 @@ ItemDelegate { RowLayout{ anchors.fill: parent - Label{ + Label { Layout.leftMargin: 8 Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter @@ -58,7 +58,7 @@ ItemDelegate { } } - Label{ + Label { id: labelDeviceId Layout.leftMargin: 8 Layout.fillWidth: true @@ -110,30 +110,18 @@ ItemDelegate { } } - HoverableRadiusButton{ + PushButton { id: btnPreferencesMediaHandler - backgroundColor: "white" - Layout.alignment: Qt.AlingVCenter | Qt.AlignRight Layout.rightMargin: 8 - Layout.preferredHeight: 25 - - buttonImageHeight: height - buttonImageWidth: height - source:{ - return "qrc:/images/icons/round-settings-24px.svg" - } + normalColor: JamiTheme.primaryBackgroundColor + source: "qrc:/images/icons/round-settings-24px.svg" - ToolTip.visible: hovered - ToolTip.text: { - return qsTr(pluginId) - } + toolTipText: qsTr(pluginId) - onClicked: { - openPreferences() - } + onClicked: openPreferences() } } } diff --git a/src/mainview/components/RecordBox.qml b/src/mainview/components/RecordBox.qml index 4e6737f60a56511ecf3de3be411170ad074ad584..fac61a0ccca712c8c7bc300bfebecdb56eea2b4e 100644 --- a/src/mainview/components/RecordBox.qml +++ b/src/mainview/components/RecordBox.qml @@ -262,106 +262,82 @@ Rectangle { anchors.verticalCenterOffset: (isVideo ? 0 : -100) } - HoverableRadiusButton { + PushButton { id: recordButton - width: btnSize - height: btnSize + preferredSize: btnSize anchors.horizontalCenter: recBox.horizontalCenter anchors.bottom: recBox.bottom anchors.bottomMargin: 5 - buttonImageHeight: height - buttonImageWidth: height - backgroundColor: isVideo? "#000000cc" : "white" + normalColor: isVideo? "#000000cc" : "white" - radius: height / 2 + source: "qrc:/images/icons/av_icons/fiber_manual_record-24px.svg" + imageColor: "#dc2719" - icon.source: "qrc:/images/icons/av_icons/fiber_manual_record-24px.svg" - icon.height: 24 - icon.width: 24 - icon.color: "#dc2719" onClicked: { updateState(RecordBox.States.RECORDING) startRecording() } } - HoverableRadiusButton { + PushButton { id: btnStop - width: btnSize - height: btnSize + preferredSize: btnSize anchors.horizontalCenter: recBox.horizontalCenter anchors.bottom: recBox.bottom anchors.bottomMargin: 5 - buttonImageHeight: height - buttonImageWidth: height - backgroundColor: isVideo? "#000000cc" : "white" + normalColor: isVideo? "#000000cc" : "white" - radius: height / 2 + source: "qrc:/images/icons/av_icons/stop-24px-red.svg" + imageColor: isVideo? "white" : "black" - icon.source: "qrc:/images/icons/av_icons/stop-24px-red.svg" - icon.height: 24 - icon.width: 24 - icon.color: isVideo? "white" : "black" onClicked: { stopRecording() updateState(RecordBox.States.REC_SUCCESS) } } - HoverableRadiusButton { + PushButton { id: btnRestart - width: btnSize - height: btnSize + preferredSize: btnSize anchors.horizontalCenter: recBox.horizontalCenter anchors.horizontalCenterOffset: -25 anchors.bottom: recBox.bottom anchors.bottomMargin: 5 - buttonImageHeight: height - buttonImageWidth: height - backgroundColor: isVideo? "#000000cc" : "white" + normalColor: isVideo? "#000000cc" : "white" - radius: height / 2 + source: "qrc:/images/icons/av_icons/re-record-24px.svg" + imageColor: isVideo? "white" : "black" - icon.source: "qrc:/images/icons/av_icons/re-record-24px.svg" - icon.height: 24 - icon.width: 24 - icon.color: isVideo? "white" : "black" onClicked: { stopRecording() updateState(RecordBox.States.INIT) } } - HoverableRadiusButton { + PushButton { id: btnSend - width: btnSize - height: btnSize + preferredSize: btnSize anchors.horizontalCenter: recBox.horizontalCenter anchors.horizontalCenterOffset: 25 anchors.bottom: parent.bottom anchors.bottomMargin: 5 - buttonImageHeight: height - buttonImageWidth: height - backgroundColor: isVideo? "#000000cc" : "white" + normalColor: isVideo? "#000000cc" : "white" - radius: height / 2 + source: "qrc:/images/icons/av_icons/send-24px.svg" + imageColor: isVideo? "white" : "black" - icon.source: "qrc:/images/icons/av_icons/send-24px.svg" - icon.height: 24 - icon.width: 24 - icon.color: isVideo? "white" : "black" onClicked: { stopRecording() sendRecord() diff --git a/src/mainview/components/WelcomePage.qml b/src/mainview/components/WelcomePage.qml index ab265180dd0758c275b705830a8b7e17a4c6fa9b..7693ee656c085bcbad2ecb175c2e7f4d02b0b581 100644 --- a/src/mainview/components/WelcomePage.qml +++ b/src/mainview/components/WelcomePage.qml @@ -126,11 +126,13 @@ Rectangle { PushButton { id: copyRegisterednameButton + Layout.alignment: Qt.AlignCenter + preferredSize: 34 imagePadding: 4 - Layout.alignment: Qt.AlignCenter source: "qrc:/images/icons/content_copy-24px.svg" + onClicked: { UtilsAdapter.setText( textMetricsjamiRegisteredNameText.text) diff --git a/src/settingsview/components/BannedItemDelegate.qml b/src/settingsview/components/BannedItemDelegate.qml index e71f7199b45b5d19d417fe9224a879980a0794fb..e0123d9e6bd619b1e4466008a536569f1babf905 100644 --- a/src/settingsview/components/BannedItemDelegate.qml +++ b/src/settingsview/components/BannedItemDelegate.qml @@ -36,22 +36,6 @@ ItemDelegate { signal btnReAddContactClicked - function btnReAddContactEnter(){ - btnReAddContact.enterBtn() - } - - function btnReAddContactExit(){ - btnReAddContact.exitBtn() - } - - function btnReAddContactPress(){ - btnReAddContact.pressBtn() - } - - function btnReAddContactRelease(){ - btnReAddContact.releaseBtn() - } - highlighted: ListView.isCurrentItem RowLayout { @@ -130,32 +114,19 @@ ItemDelegate { } } - HoverableRadiusButton{ + PushButton{ id: btnReAddContact Layout.alignment: Qt.AlignVCenter | Qt.AlignRight - Layout.rightMargin: 8 - + Layout.rightMargin: 16 Layout.preferredWidth: JamiTheme.preferredFieldHeight Layout.preferredHeight: JamiTheme.preferredFieldHeight - buttonImageHeight: height - 8 - buttonImageWidth: width - 8 - source: "qrc:/images/icons/person_add-24px.svg" - radius: height / 2 - width: 25 - height: 25 + toolTipText: JamiStrings.reinstateContact - backgroundColor: "transparent" - - ToolTip.visible: hovered - ToolTip.text: JamiStrings.reinstateContact - - onClicked: { - btnReAddContactClicked() - } + onClicked: btnReAddContactClicked() } } } diff --git a/src/settingsview/components/DeviceItemDelegate.qml b/src/settingsview/components/DeviceItemDelegate.qml index a651ef43484042df2339ecb9ea05ca4204bc4211..101e96562807c4ad11d816e05adfe2955e72fb2d 100644 --- a/src/settingsview/components/DeviceItemDelegate.qml +++ b/src/settingsview/components/DeviceItemDelegate.qml @@ -120,7 +120,7 @@ ItemDelegate { id: btnEditDevice Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - Layout.rightMargin: 8 + Layout.rightMargin: 16 Layout.preferredWidth: JamiTheme.preferredFieldHeight Layout.preferredHeight: JamiTheme.preferredFieldHeight diff --git a/src/settingsview/components/PluginItemDelegate.qml b/src/settingsview/components/PluginItemDelegate.qml index fd4ca4cf64a97c17437d07846eea29eaf77c1777..9e864a0fb236d84d0e5beda28b6f728a5b885ca0 100644 --- a/src/settingsview/components/PluginItemDelegate.qml +++ b/src/settingsview/components/PluginItemDelegate.qml @@ -103,24 +103,15 @@ ItemDelegate { } } - HoverableRadiusButton{ + PushButton { id: btnPreferencesPlugin - backgroundColor: "white" - Layout.alignment: Qt.AlingVCenter | Qt.AlignRight Layout.rightMargin: 8 - Layout.preferredHeight: 25 - - buttonImageHeight: height - buttonImageWidth: height - source:{ - return "qrc:/images/icons/round-settings-24px.svg" - } - - ToolTip.visible: hovered - ToolTip.text: JamiStrings.showHidePrefs + source: "qrc:/images/icons/round-settings-24px.svg" + normalColor: JamiTheme.primaryBackgroundColor + toolTipText: JamiStrings.showHidePrefs onClicked: btnPreferencesPluginClicked() } diff --git a/src/settingsview/components/PluginListPreferencesView.qml b/src/settingsview/components/PluginListPreferencesView.qml index 54c88078a81b517172ff9ade1271603b478d031d..39e8e64db25d39121c0703e0e4b3df2b02162590 100644 --- a/src/settingsview/components/PluginListPreferencesView.qml +++ b/src/settingsview/components/PluginListPreferencesView.qml @@ -110,8 +110,9 @@ Rectangle { Image { anchors.centerIn: parent source: pluginIcon === "" ? "" : "file:" + pluginIcon - height: 35 - width: 35 + height: 36 + width: 36 + mipmap: true } } } @@ -132,38 +133,26 @@ Rectangle { Layout.topMargin: 10 height: 30 - HoverableRadiusButton { + PushButton { id: resetButton - Layout.fillWidth: true - - radius: height / 2 - icon.source: "qrc:/images/icons/settings_backup_restore-black-18dp.svg" - icon.height: 24 - icon.width: 24 + Layout.fillWidth: true - text: JamiStrings.reset + source: "qrc:/images/icons/settings_backup_restore-24px.svg" + buttonText: JamiStrings.reset fontPointSize: JamiTheme.settingsFontSize - font.kerning: true - onClicked: { - resetPluginSlot() - } + onClicked: resetPluginSlot() } - HoverableRadiusButton { + PushButton { id: uninstallButton - Layout.fillWidth: true - radius: height / 2 - - icon.source: "qrc:/images/icons/ic_delete_black_18dp_2x.png" - icon.height: 24 - icon.width: 24 + Layout.fillWidth: true - text: qsTr("Uninstall") + source: "qrc:/images/icons/delete-24px.svg" + buttonText: qsTr("Uninstall") fontPointSize: JamiTheme.settingsFontSize - font.kerning: true onClicked: uninstallPluginSlot() } @@ -178,7 +167,7 @@ Rectangle { model: PluginAdapter.getPluginPreferencesModel(pluginId) - delegate: PreferenceItemDelegate{ + delegate: PreferenceItemDelegate { id: preferenceItemDelegate width: pluginPreferenceView.width