refactor: Replace usage of StatusRadioButton under ui/shared to its corresponding StatusQ component

closes #3897
This commit is contained in:
Khushboo Mehta 2021-10-25 14:30:23 +02:00 committed by r4bbit.eth
parent 7037df9da0
commit ef4934cee4
10 changed files with 19 additions and 63 deletions

View File

@ -5,7 +5,6 @@ import utils 1.0
import "../../../../shared" import "../../../../shared"
import "../../../../shared/popups" import "../../../../shared/popups"
import "../../../../shared/panels" import "../../../../shared/panels"
import "../../../../shared/status"
import "../controls" import "../controls"
import "../panels" import "../panels"
@ -203,7 +202,7 @@ ModalPopup {
onClicked: radio.toggle() onClicked: radio.toggle()
} }
StatusRadioButton { StatusQControls.StatusRadioButton {
id: radio id: radio
visible: !!messageToPin visible: !!messageToPin
anchors.right: parent.right anchors.right: parent.right
@ -232,7 +231,7 @@ ModalPopup {
enabled: !!messageToUnpin enabled: !!messageToUnpin
//% "Unpin" //% "Unpin"
text: qsTrId("unpin") text: qsTrId("unpin")
type: StatusBaseButton.Type.Danger type: StatusQControls.StatusBaseButton.Type.Danger
anchors.right: parent.right anchors.right: parent.right
onClicked: { onClicked: {
const chatId = chatsModel.channelView.activeChannel.id const chatId = chatsModel.channelView.activeChannel.id

View File

@ -7,6 +7,8 @@ import "../../../../shared"
import "../../../../shared/panels" import "../../../../shared/panels"
import "../../../../shared/status" import "../../../../shared/status"
import StatusQ.Controls 0.1 as StatusQControls
Rectangle { Rectangle {
id: accountViewDelegate id: accountViewDelegate
@ -67,13 +69,12 @@ Rectangle {
color: Style.current.secondaryText color: Style.current.secondaryText
} }
StatusRadioButton { StatusQControls.StatusRadioButton {
id: radio id: radio
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: Style.current.padding anchors.rightMargin: Style.current.padding
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
checked: accountViewDelegate.selected checked: accountViewDelegate.selected
isHovered: accountViewDelegate.isHovered
} }
MouseArea { MouseArea {

View File

@ -5,8 +5,8 @@ import QtQuick.Layouts 1.13
import utils 1.0 import utils 1.0
import "../../../../shared" import "../../../../shared"
import "../../../../shared/panels" import "../../../../shared/panels"
import "../../../../shared/status"
import StatusQ.Controls 0.1
Rectangle { Rectangle {
property var buttonGroup property var buttonGroup

View File

@ -4,7 +4,8 @@ import "./"
import utils 1.0 import utils 1.0
import "../../../../shared" import "../../../../shared"
import "../../../../shared/status"
import StatusQ.Controls 0.1
Item { Item {
property bool checked: false property bool checked: false

View File

@ -5,7 +5,8 @@ import utils 1.0
import "../../../../shared" import "../../../../shared"
import "../../../../shared/panels" import "../../../../shared/panels"
import "../../../../shared/status"
import StatusQ.Controls 0.1 as StatusQControls
Item { Item {
id: modalBody id: modalBody
@ -58,10 +59,9 @@ Item {
anchors.leftMargin: Style.current.padding anchors.leftMargin: Style.current.padding
} }
StatusRadioButton { StatusQControls.StatusRadioButton {
id: currencyRadioBtn id: currencyRadioBtn
checked: currency === key checked: currency === key
isHovered: wrapper.hovered
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: Style.current.padding anchors.rightMargin: Style.current.padding
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter

View File

@ -3,10 +3,12 @@ import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13 import QtQuick.Layouts 1.13
import utils 1.0 import utils 1.0
import "../status"
import "../" import "../"
import "../panels" import "../panels"
import StatusQ.Controls 0.1
// TODO: use StatusQ components // TODO: use StatusQ components
Rectangle { Rectangle {
property var buttonGroup property var buttonGroup

View File

@ -7,6 +7,8 @@ import "../../shared"
import "../../shared/panels" import "../../shared/panels"
import "./" import "./"
import StatusQ.Controls 0.1 as StatusQControls
Rectangle { Rectangle {
id: root id: root
@ -33,7 +35,7 @@ Rectangle {
anchors.rightMargin: root.padding anchors.rightMargin: root.padding
} }
StatusRadioButton { StatusQControls.StatusRadioButton {
id: radioControl id: radioControl
anchors.top: img.bottom anchors.top: img.bottom
anchors.topMargin: root.padding anchors.topMargin: root.padding

View File

@ -1,50 +0,0 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQml 2.14
import utils 1.0
import "../../shared"
import "../../shared/panels"
RadioButton {
id: control
property bool isHovered: false
width: indicator.implicitWidth
function getColor() {
if (checked) {
return Style.current.blue
}
if (hovered || isHovered) {
return Style.current.secondaryHover
}
return Style.current.grey
}
indicator: Rectangle {
implicitWidth: 20
implicitHeight: 20
x: 0
y: 6
radius: 10
color: control.getColor()
Rectangle {
width: 12
height: 12
radius: 6
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
color: control.checked ? Style.current.white : Style.current.grey
visible: control.checked
}
}
contentItem: StyledText {
text: control.text
color: Style.current.textColor
verticalAlignment: Text.AlignVCenter
leftPadding: !!control.text ? control.indicator.width + control.spacing : control.indicator.width
font.pixelSize: 15
font.family: Style.current.fontRegular.name
}
}

View File

@ -6,6 +6,8 @@ import ".."
import "../panels" import "../panels"
import "." import "."
import StatusQ.Controls 0.1
Rectangle { Rectangle {
property alias text: textElement.text property alias text: textElement.text
property var buttonGroup property var buttonGroup

View File

@ -8,7 +8,6 @@ StatusEmojiSection 1.0 StatusEmojiSection.qml
StatusGifPopup 1.0 StatusGifPopup.qml StatusGifPopup 1.0 StatusGifPopup.qml
StatusGifColumn 1.0 StatusGifColumn.qml StatusGifColumn 1.0 StatusGifColumn.qml
StatusImageIdenticon 1.0 StatusImageIdenticon.qml StatusImageIdenticon 1.0 StatusImageIdenticon.qml
StatusRadioButton 1.0 StatusRadioButton.qml
StatusRoundButton 1.0 StatusRoundButton.qml StatusRoundButton 1.0 StatusRoundButton.qml
StatusSectionHeadline 1.0 StatusSectionHeadline.qml StatusSectionHeadline 1.0 StatusSectionHeadline.qml
StatusSlider 1.0 StatusSlider.qml StatusSlider 1.0 StatusSlider.qml