add additional settings

This commit is contained in:
Morgan McMillian 2020-09-03 15:04:34 -07:00
parent 653f888312
commit 961c34e37e
5 changed files with 183 additions and 22 deletions

View file

@ -20,7 +20,7 @@ execute_process(
set(QT_IMPORTS_DIR "lib/${ARCH_TRIPLET}") set(QT_IMPORTS_DIR "lib/${ARCH_TRIPLET}")
set(APP_NAME "Pantalaimon UT") set(APP_NAME "Pantalaimon UT")
set(APP_VERSION "0.3.0") set(APP_VERSION "0.4.0")
set(PROJECT_NAME "pantalaimon") set(PROJECT_NAME "pantalaimon")
set(FULL_PROJECT_NAME "pantalaimon.thrrgilag") set(FULL_PROJECT_NAME "pantalaimon.thrrgilag")
set(CMAKE_INSTALL_PREFIX /) set(CMAKE_INSTALL_PREFIX /)

View file

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: pantalaimon.thrrgilag\n" "Project-Id-Version: pantalaimon.thrrgilag\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-09 22:57+0000\n" "POT-Creation-Date: 2020-09-03 22:00+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,24 +17,58 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n" "Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: ../qml/Components/EditServerPage.qml:19 #: ../qml/Components/EditServerPage.qml:21
msgid "Homeserver Configuration" msgid "Homeserver Configuration"
msgstr "" msgstr ""
#: ../qml/Components/EditServerPage.qml:24 #: ../qml/Components/EditServerPage.qml:26
msgid "Save" msgid "Save"
msgstr "" msgstr ""
#: ../qml/Components/EditServerPage.qml:89 #: ../qml/Components/EditServerPage.qml:96
msgid "Description:" msgid "InstanceName"
msgstr "" msgstr ""
#: ../qml/Components/EditServerPage.qml:109 #: ../qml/Components/EditServerPage.qml:118
msgid "Homeserver URL:" msgid "Homeserver"
msgstr "" msgstr ""
#: ../qml/Components/EditServerPage.qml:131 #: ../qml/Components/EditServerPage.qml:140
msgid "Listen on 127.0.0.1:" msgid ""
"The URI of the homeserver that the pantalaimon proxy should forward requests "
"to, without the matrix API path but including the http(s) schema."
msgstr ""
#: ../qml/Components/EditServerPage.qml:156
msgid "ListenPort"
msgstr ""
#: ../qml/Components/EditServerPage.qml:177
msgid ""
"The port where the daemon will listen to client connections for this "
"homeserver. Note that the listen address/port combination needs to be unique "
"between different homeservers. Defaults to '8009'."
msgstr ""
#: ../qml/Components/EditServerPage.qml:193
msgid "Proxy"
msgstr ""
#: ../qml/Components/EditServerPage.qml:214
msgid ""
"The URI of a HTTP proxy that the daemon should use when making requests to "
"the homeserver. pantalaimon only supports HTTP proxies. The default is to "
"make a direct connection to the homeserver."
msgstr ""
#: ../qml/Components/EditServerPage.qml:230
msgid "SSL"
msgstr ""
#: ../qml/Components/EditServerPage.qml:254
msgid ""
"SSL verification for outgoing connections to the homeserver. Defaults to "
"'True'."
msgstr "" msgstr ""
#: ../qml/SettingsPage.qml:18 pantalaimon.desktop.in.h:1 #: ../qml/SettingsPage.qml:18 pantalaimon.desktop.in.h:1
@ -53,14 +87,14 @@ msgstr ""
msgid "Service start enabled" msgid "Service start enabled"
msgstr "" msgstr ""
#: ../qml/SettingsPage.qml:108 #: ../qml/SettingsPage.qml:109
msgid "Delete homeserver" msgid "Delete homeserver"
msgstr "" msgstr ""
#: ../qml/SettingsPage.qml:126 #: ../qml/SettingsPage.qml:127
msgid "No homeservers" msgid "No homeservers"
msgstr "" msgstr ""
#: ../qml/SettingsPage.qml:179 #: ../qml/SettingsPage.qml:180
msgid "Add Homeserver" msgid "Add Homeserver"
msgstr "" msgstr ""

View file

@ -11,6 +11,8 @@ Page {
property alias instance: instance.text property alias instance: instance.text
property alias homeserver: homeserver.text property alias homeserver: homeserver.text
property alias listenport: listenport.text property alias listenport: listenport.text
property alias proxy: proxy.text
property alias ssl: ssl.checked
signal save() signal save()
@ -32,7 +34,9 @@ Page {
var data = { var data = {
name: instance.text, name: instance.text,
homeserver: homeserver.text, homeserver: homeserver.text,
listenport: listenport.text listenport: listenport.text,
proxy: proxy.text,
ssl: ssl.checked
} }
if (editmode) { if (editmode) {
listModel.set(idx, data); listModel.set(idx, data);
@ -55,6 +59,8 @@ Page {
instance.text = ""; instance.text = "";
homeserver.text = ""; homeserver.text = "";
listenport.text = "8009"; // TODO: maybe autoincrement based on existing entries? listenport.text = "8009"; // TODO: maybe autoincrement based on existing entries?
proxy.text = "";
ssl.checked = true;
} }
Flickable { Flickable {
@ -85,15 +91,17 @@ Page {
spacing: units.gu(1) spacing: units.gu(1)
Label { Label {
id: instanceLabel
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: i18n.tr('Description:') text: i18n.tr('InstanceName')
font.bold: true
} }
TextField { TextField {
id: instance id: instance
text: "my-homeserver" text: "my-homeserver"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Layout.fillWidth: true width: parent.width - units.gu(6) - instanceLabel.width
} }
} }
@ -105,8 +113,10 @@ Page {
spacing: units.gu(1) spacing: units.gu(1)
Label { Label {
id: homeserverLabel
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: i18n.tr('Homeserver URL:') text: i18n.tr('Homeserver')
font.bold: true
} }
TextField { TextField {
@ -114,12 +124,26 @@ Page {
text: "" text: ""
placeholderText: "https://matrix.org" placeholderText: "https://matrix.org"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Layout.fillWidth: true width: parent.width - units.gu(6) - homeserverLabel.width
inputMethodHints: Qt.ImhUrlCharactersOnly inputMethodHints: Qt.ImhUrlCharactersOnly
} }
} }
Row {
width: parent.width
leftPadding: units.gu(2)
spacing: units.gu(1)
Label {
horizontalAlignment: Text.AlignLeft
text: i18n.tr("The URI of the homeserver that the pantalaimon proxy should forward requests to, without the matrix API path but including the http(s) schema.")
wrapMode: Text.WordWrap
width: parent.width - units.gu(4)
font.italic: true
}
}
Row { Row {
width: parent.width width: parent.width
height: units.gu(6) height: units.gu(6)
@ -127,19 +151,113 @@ Page {
spacing: units.gu(1) spacing: units.gu(1)
Label { Label {
id: listenportLabel
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: i18n.tr('Listen on 127.0.0.1:') text: i18n.tr('ListenPort')
font.bold: true
} }
TextField { TextField {
id: listenport id: listenport
text: "8009" text: "8009"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Layout.fillWidth: true width: parent.width - units.gu(6) - listenportLabel.width
inputMethodHints: Qt.ImhDigitsOnly inputMethodHints: Qt.ImhDigitsOnly
} }
} }
Row {
width: parent.width
leftPadding: units.gu(2)
spacing: units.gu(1)
Label {
horizontalAlignment: Text.AlignLeft
text: i18n.tr("The port where the daemon will listen to client connections for this homeserver. Note that the listen address/port combination needs to be unique between different homeservers. Defaults to '8009'.")
wrapMode: Text.WordWrap
width: parent.width - units.gu(4)
font.italic: true
}
}
Row {
width: parent.width
height: units.gu(6)
leftPadding: units.gu(2)
spacing: units.gu(1)
Label {
id: proxyLabel
anchors.verticalCenter: parent.verticalCenter
text: i18n.tr('Proxy')
font.bold: true
}
TextField {
id: proxy
text: ""
anchors.verticalCenter: parent.verticalCenter
width: parent.width - units.gu(6) - proxyLabel.width
inputMethodHints: Qt.ImhUrlCharactersOnly
}
}
Row {
width: parent.width
leftPadding: units.gu(2)
spacing: units.gu(1)
Label {
horizontalAlignment: Text.AlignLeft
text: i18n.tr("The URI of a HTTP proxy that the daemon should use when making requests to the homeserver. pantalaimon only supports HTTP proxies. The default is to make a direct connection to the homeserver.")
wrapMode: Text.WordWrap
width: parent.width - units.gu(4)
font.italic: true
}
}
Row {
width: parent.width
height: units.gu(6)
leftPadding: units.gu(2)
spacing: units.gu(1)
Label {
id: sslLabel
anchors.verticalCenter: parent.verticalCenter
text: i18n.tr('SSL')
font.bold: true
}
Label {
text: " "
width: parent.width - sslLabel.width - ssl.width - units.gu(8)
}
Switch {
id: ssl
checked: true
anchors.verticalCenter: parent.verticalCenter
}
}
Row {
width: parent.width
leftPadding: units.gu(2)
spacing: units.gu(1)
Label {
horizontalAlignment: Text.AlignLeft
text: i18n.tr("SSL verification for outgoing connections to the homeserver. Defaults to 'True'.")
wrapMode: Text.WordWrap
width: parent.width - units.gu(4)
font.italic: true
}
}
} }
} }

View file

@ -91,12 +91,13 @@ Page {
progression: true progression: true
onClicked: { onClicked: {
var item = listModel.get(index); var item = listModel.get(index);
console.log(item);
pageStack.push(editConfigPage, { pageStack.push(editConfigPage, {
idx: index, idx: index,
instance: item.name, instance: item.name,
homeserver: item.homeserver, homeserver: item.homeserver,
listenport: item.listenport listenport: item.listenport,
proxy: item.proxy,
ssl: ssl
}); });
} }
} }

View file

@ -20,6 +20,8 @@ def load():
item['homeserver'] = config[instance].get('homeserver') item['homeserver'] = config[instance].get('homeserver')
item['listenaddress'] = config[instance].get('listenaddress') item['listenaddress'] = config[instance].get('listenaddress')
item['listenport'] = config[instance].get('listenport') item['listenport'] = config[instance].get('listenport')
item['proxy'] = config[instance].get('proxy')
item['ssl'] = config[instance].getboolean('ssl')
item['ignoreverification'] = config[instance].get('ignoreverification') item['ignoreverification'] = config[instance].get('ignoreverification')
item['usekeyring'] = config[instance].get('usekeyring') item['usekeyring'] = config[instance].get('usekeyring')
@ -34,10 +36,16 @@ def save(data):
config = configparser.ConfigParser() config = configparser.ConfigParser()
for item in dataobj: for item in dataobj:
if item['ssl']:
sslval = 'true'
else:
sslval = 'false'
config[item['name']] = {} config[item['name']] = {}
config[item['name']]['homeserver'] = item['homeserver'] config[item['name']]['homeserver'] = item['homeserver']
config[item['name']]['listenaddress'] = "127.0.0.1" config[item['name']]['listenaddress'] = "127.0.0.1"
config[item['name']]['listenport'] = item['listenport'] config[item['name']]['listenport'] = item['listenport']
config[item['name']]['proxy'] = item['proxy']
config[item['name']]['ssl'] = sslval
config[item['name']]['ignoreverification'] = "true" config[item['name']]['ignoreverification'] = "true"
config[item['name']]['usekeyring'] = "false" config[item['name']]['usekeyring'] = "false"