2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
2020-05-27 21:28:25 +00:00
|
|
|
import "../../../../imports"
|
2020-06-19 18:06:58 +00:00
|
|
|
import "../../../../shared"
|
2020-06-17 12:53:51 +00:00
|
|
|
import "../../../../shared/xss.js" as XSS
|
2020-05-27 21:28:25 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
id: helpContainer
|
|
|
|
width: 200
|
|
|
|
height: 200
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
2020-06-17 12:53:51 +00:00
|
|
|
function linkify(inputText) {
|
|
|
|
//URLs starting with http://, https://, or ftp://
|
|
|
|
var replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;
|
2020-06-30 16:30:04 +00:00
|
|
|
var replacedText = inputText.replace(replacePattern1, "<a href='$1'>$1</a>");
|
2020-06-17 12:53:51 +00:00
|
|
|
|
|
|
|
//URLs starting with "www." (without // before it, or it'd re-link the ones done above).
|
|
|
|
var replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim;
|
|
|
|
replacedText = replacedText.replace(replacePattern2, "$1<a href='http://$2'>$2</a>");
|
|
|
|
|
|
|
|
replacedText = XSS.filterXSS(replacedText)
|
|
|
|
return replacedText;
|
|
|
|
}
|
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-05-27 21:28:25 +00:00
|
|
|
id: element8
|
|
|
|
text: qsTr("Help menus: FAQ, Glossary, etc.")
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 24
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 24
|
|
|
|
font.weight: Font.Bold
|
|
|
|
font.pixelSize: 20
|
|
|
|
}
|
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-05-27 21:28:25 +00:00
|
|
|
anchors.centerIn: parent
|
2020-06-17 12:53:51 +00:00
|
|
|
text: linkify(link)
|
2020-05-27 21:28:25 +00:00
|
|
|
onLinkActivated: Qt.openUrlExternally(link)
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
acceptedButtons: Qt.NoButton // we don't want to eat clicks on the Text
|
|
|
|
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
|
|
|
|
}
|
|
|
|
}
|
2020-06-17 19:18:31 +00:00
|
|
|
}
|