Port EmoticonsPage to FormCard
This commit is contained in:
@@ -6,12 +6,12 @@ import QtQuick.Controls 2.15 as QQC2
|
|||||||
import QtQuick.Layouts 1.15
|
import QtQuick.Layouts 1.15
|
||||||
|
|
||||||
import org.kde.kirigami 2.19 as Kirigami
|
import org.kde.kirigami 2.19 as Kirigami
|
||||||
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm
|
import org.kde.kirigamiaddons.formcard 1.0 as FormCard
|
||||||
|
|
||||||
import org.kde.neochat 1.0
|
import org.kde.neochat 1.0
|
||||||
|
|
||||||
MobileForm.FormCard {
|
FormCard.FormCard {
|
||||||
id: emoticonFormCard
|
id: root
|
||||||
|
|
||||||
enum EmoticonType {
|
enum EmoticonType {
|
||||||
Emojis,
|
Emojis,
|
||||||
@@ -20,9 +20,6 @@ MobileForm.FormCard {
|
|||||||
|
|
||||||
property var emoticonType
|
property var emoticonType
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
contentItem: ColumnLayout {
|
|
||||||
spacing: 0
|
|
||||||
Flow {
|
Flow {
|
||||||
id: stickerFlow
|
id: stickerFlow
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -33,26 +30,26 @@ MobileForm.FormCard {
|
|||||||
id: stickerModel
|
id: stickerModel
|
||||||
connection: Controller.activeConnection
|
connection: Controller.activeConnection
|
||||||
}
|
}
|
||||||
showStickers: emoticonFormCard.emoticonType === EmoticonFormCard.Stickers
|
showStickers: root.emoticonType === EmoticonFormCard.Stickers
|
||||||
showEmojis: emoticonFormCard.emoticonType === EmoticonFormCard.Emojis
|
showEmojis: root.emoticonType === EmoticonFormCard.Emojis
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: MobileForm.AbstractFormDelegate {
|
delegate: FormCard.AbstractFormDelegate {
|
||||||
id: stickerDelegate
|
id: stickerDelegate
|
||||||
|
|
||||||
width: stickerFlow.width / 4
|
width: stickerFlow.width / 4
|
||||||
height: width
|
height: width
|
||||||
|
|
||||||
onClicked: pageSettingStack.pushDialogLayer(emoticonEditorPage, {
|
onClicked: pageStack.pushDialogLayer(emoticonEditorPage, {
|
||||||
description: model.body ?? "",
|
description: model.body ?? "",
|
||||||
index: model.index,
|
index: model.index,
|
||||||
url: model.url,
|
url: model.url,
|
||||||
shortcode: model.shortcode,
|
shortcode: model.shortcode,
|
||||||
model: stickerModel,
|
model: stickerModel,
|
||||||
proxyModel: emoticonFilterModel,
|
proxyModel: emoticonFilterModel,
|
||||||
emoticonType: emoticonFormCard.emoticonType
|
emoticonType: root.emoticonType
|
||||||
}, {
|
}, {
|
||||||
title: emoticonFormCard.emoticonType === EmoticonFormCard.Emojis ? i18nc("@title", "Edit Emoji") : i18nc("@title", "Edit Sticker")
|
title: root.emoticonType === EmoticonFormCard.Emojis ? i18nc("@title", "Edit Emoji") : i18nc("@title", "Edit Sticker")
|
||||||
});
|
});
|
||||||
|
|
||||||
contentItem: ColumnLayout {
|
contentItem: ColumnLayout {
|
||||||
@@ -63,7 +60,7 @@ MobileForm.FormCard {
|
|||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
autoTransform: true
|
autoTransform: true
|
||||||
Kirigami.Icon {
|
Kirigami.Icon {
|
||||||
source: emoticonFormCard.emoticonType === EmoticonFormCard.Emojis ? "preferences-desktop-emoticons" : "stickers"
|
source: root.emoticonType === EmoticonFormCard.Emojis ? "preferences-desktop-emoticons" : "stickers"
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
visible: parent.status !== Image.Ready
|
visible: parent.status !== Image.Ready
|
||||||
}
|
}
|
||||||
@@ -88,11 +85,11 @@ MobileForm.FormCard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MobileForm.AbstractFormDelegate {
|
FormCard.AbstractFormDelegate {
|
||||||
width: stickerFlow.width / 4
|
width: stickerFlow.width / 4
|
||||||
height: width
|
height: width
|
||||||
|
|
||||||
onClicked: pageSettingStack.pushDialogLayer(emoticonEditorPage, {
|
onClicked: pageStack.pushDialogLayer(emoticonEditorPage, {
|
||||||
description: "",
|
description: "",
|
||||||
index: -1,
|
index: -1,
|
||||||
url: "",
|
url: "",
|
||||||
@@ -100,9 +97,9 @@ MobileForm.FormCard {
|
|||||||
model: stickerModel,
|
model: stickerModel,
|
||||||
proxyModel: emoticonFilterModel,
|
proxyModel: emoticonFilterModel,
|
||||||
newEmoticon: true,
|
newEmoticon: true,
|
||||||
emoticonType: emoticonFormCard.emoticonType
|
emoticonType: root.emoticonType
|
||||||
}, {
|
}, {
|
||||||
title: emoticonFormCard.emoticonType === EmoticonFormCard.Emojis ? i18nc("@title", "Add Emoji") : i18nc("@title", "Add Sticker")
|
title: root.emoticonType === EmoticonFormCard.Emojis ? i18nc("@title", "Add Emoji") : i18nc("@title", "Add Sticker")
|
||||||
});
|
});
|
||||||
contentItem: ColumnLayout {
|
contentItem: ColumnLayout {
|
||||||
spacing: 0
|
spacing: 0
|
||||||
@@ -111,7 +108,7 @@ MobileForm.FormCard {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
QQC2.Label {
|
QQC2.Label {
|
||||||
text: emoticonFormCard.emoticonType === EmoticonFormCard.Emojis ? i18n("Add Emoji") : i18n("Add Sticker")
|
text: root.emoticonType === EmoticonFormCard.Emojis ? i18n("Add Emoji") : i18n("Add Sticker")
|
||||||
horizontalAlignment: Qt.AlignHCenter
|
horizontalAlignment: Qt.AlignHCenter
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
@@ -119,4 +116,3 @@ MobileForm.FormCard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -5,37 +5,31 @@ import QtQuick 2.15
|
|||||||
import QtQuick.Layouts 1.15
|
import QtQuick.Layouts 1.15
|
||||||
|
|
||||||
import org.kde.kirigami 2.19 as Kirigami
|
import org.kde.kirigami 2.19 as Kirigami
|
||||||
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm
|
import org.kde.kirigamiaddons.formcard 1.0 as FormCard
|
||||||
|
|
||||||
import org.kde.neochat 1.0
|
import org.kde.neochat 1.0
|
||||||
|
|
||||||
Kirigami.ScrollablePage {
|
FormCard.FormCardPage {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
title: emoticonType === EmoticonFormCard.Emojis ? i18n("Emojis") : i18n("Stickers")
|
title: i18nc("@title", "Stickers & Emojis")
|
||||||
topPadding: 0
|
|
||||||
leftPadding: 0
|
|
||||||
rightPadding: 0
|
|
||||||
|
|
||||||
ColumnLayout {
|
FormCard.FormHeader {
|
||||||
spacing: 0
|
|
||||||
MobileForm.FormHeader {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
title: i18n("Emojis")
|
title: i18n("Emojis")
|
||||||
}
|
}
|
||||||
EmoticonFormCard {
|
EmoticonFormCard {
|
||||||
emoticonType: EmoticonFormCard.Emojis
|
emoticonType: EmoticonFormCard.Emojis
|
||||||
}
|
}
|
||||||
MobileForm.FormHeader {
|
|
||||||
Layout.fillWidth: true
|
FormCard.FormHeader {
|
||||||
title: i18n("Stickers")
|
title: i18n("Stickers")
|
||||||
}
|
}
|
||||||
EmoticonFormCard {
|
EmoticonFormCard {
|
||||||
emoticonType: EmoticonFormCard.Stickers
|
emoticonType: EmoticonFormCard.Stickers
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
|
property Component emoticonEditorPage: Component {
|
||||||
id: emoticonEditorPage
|
id: emoticonEditorPage
|
||||||
EmoticonEditorPage {}
|
EmoticonEditorPage {}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user