linux.x86.linphone/Linphone/view/Control/Input/TextArea.qml
data 3b3bb966d4 Add ringtone selection dropdown and various bugfixes
- Add ComboBox for ringtone selection in Call Settings
- Convert MKV ringtones to WAV format (Linphone only supports WAV)
- Fix ComboSetting to support dialPlan type for international prefix
- Disable account devices feature to prevent API errors
- Disable automatic update check on startup
- Add ringtone fallback to default when custom file not found
- Fix ringtone dropdown to not override setting on initialization

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 08:31:15 +01:00

87 lines
2.3 KiB
QML
Executable file

import QtQuick
import QtQuick.Controls.Basic as Control
import QtQuick.Layouts
import Linphone
import UtilsCpp
import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils
TextEdit {
id: mainItem
property string placeholderText
property real placeholderPixelSize: Typography.p1.pixelSize
property real placeholderWeight: Typography.p1.weight
property color placeholderTextColor: color
property alias background: background.data
property bool hoverEnabled: true
property bool hovered: mouseArea.hoverEnabled && mouseArea.containsMouse
topPadding: Utils.getSizeWithScreenRatio(5)
bottomPadding: Utils.getSizeWithScreenRatio(5)
activeFocusOnTab: true
KeyNavigation.priority: KeyNavigation.BeforeItem
property bool displayAsRichText: false
property var encodeTextObj: UtilsCpp.encodeTextToQmlRichFormat(text)
property string richFormatText: encodeTextObj && encodeTextObj.value || ""
property color textAreaColor
Component.onCompleted: {
mainItem.textAreaColor = mainItem.color // backup original color
if (displayAsRichText)
mainItem.color = 'transparent'
}
onTextChanged: {
encodeTextObj = UtilsCpp.encodeTextToQmlRichFormat(text)
}
MouseArea {
id: mouseArea
anchors.fill: parent
enabled: mainItem.hoverEnabled
hoverEnabled: mainItem.hoverEnabled
acceptedButtons: Qt.NoButton
cursorShape: mainItem.hovered ? Qt.IBeamCursor : Qt.ArrowCursor
}
Item {
id: background
anchors.fill: parent
z: -1
}
Text {
anchors.verticalCenter: mainItem.verticalCenter
text: mainItem.placeholderText
color: mainItem.placeholderTextColor
visible: mainItem.text.length == 0 && !mainItem.activeFocus
x: mainItem.leftPadding
font {
pixelSize: mainItem.placeholderPixelSize
weight: mainItem.placeholderWeight
}
}
Text {
id: formattedText
visible: mainItem.displayAsRichText && mainItem.richFormatText !== ""
text: mainItem.richFormatText
textFormat: Text.RichText
wrapMode: mainItem.wrapMode
width: mainItem.width
elide: Text.ElideRight
font: mainItem.font
color: mainItem.textAreaColor
anchors.fill: parent
focus: false
onHoveredLinkChanged: {
mainItem.hovered = mainItem.displayAsRichText && hoveredLink !== ""
}
onLinkActivated: {
if (link.startsWith('sip'))
UtilsCpp.createCall(link)
else
Qt.openUrlExternally(link)
}
}
}