add gloabl setting for loglevel

This commit is contained in:
Morgan McMillian 2020-09-07 20:23:50 -07:00
parent 4896d2e0c9
commit 2f68728ea9
3 changed files with 88 additions and 21 deletions

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-09-04 04:36+0000\n" "POT-Creation-Date: 2020-09-08 03:23+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"
@ -29,72 +29,92 @@ msgstr ""
msgid "InstanceName" msgid "InstanceName"
msgstr "" msgstr ""
#: ../qml/Components/EditServerPage.qml:118 #: ../qml/Components/EditServerPage.qml:119
msgid "Homeserver" msgid "Homeserver"
msgstr "" msgstr ""
#: ../qml/Components/EditServerPage.qml:140 #: ../qml/Components/EditServerPage.qml:141
msgid "" msgid ""
"The URI of the homeserver that the pantalaimon proxy should forward requests " "The URI of the homeserver that the pantalaimon proxy should forward requests "
"to, without the matrix API path but including the http(s) schema." "to, without the matrix API path but including the http(s) schema."
msgstr "" msgstr ""
#: ../qml/Components/EditServerPage.qml:156 #: ../qml/Components/EditServerPage.qml:158
msgid "ListenPort" msgid "ListenPort"
msgstr "" msgstr ""
#: ../qml/Components/EditServerPage.qml:177 #: ../qml/Components/EditServerPage.qml:179
msgid "" msgid ""
"The port where the daemon will listen to client connections for this " "The port where the daemon will listen to client connections for this "
"homeserver. Note that the listen address/port combination needs to be unique " "homeserver. Note that the listen address/port combination needs to be unique "
"between different homeservers. Defaults to '8009'." "between different homeservers. Defaults to '8009'."
msgstr "" msgstr ""
#: ../qml/Components/EditServerPage.qml:193 #: ../qml/Components/EditServerPage.qml:196
msgid "Proxy" msgid "Proxy"
msgstr "" msgstr ""
#: ../qml/Components/EditServerPage.qml:214 #: ../qml/Components/EditServerPage.qml:217
msgid "" msgid ""
"The URI of a HTTP proxy that the daemon should use when making requests to " "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 " "the homeserver. pantalaimon only supports HTTP proxies. The default is to "
"make a direct connection to the homeserver." "make a direct connection to the homeserver."
msgstr "" msgstr ""
#: ../qml/Components/EditServerPage.qml:230 #: ../qml/Components/EditServerPage.qml:234
msgid "SSL" msgid "SSL"
msgstr "" msgstr ""
#: ../qml/Components/EditServerPage.qml:254 #: ../qml/Components/EditServerPage.qml:258
msgid "" msgid ""
"SSL verification for outgoing connections to the homeserver. Defaults to " "SSL verification for outgoing connections to the homeserver. Defaults to "
"'True'." "'True'."
msgstr "" msgstr ""
#: ../qml/SettingsPage.qml:18 pantalaimon.desktop.in.h:1 #: ../qml/SettingsPage.qml:17
msgid "warning"
msgstr ""
#: ../qml/SettingsPage.qml:18
msgid "info"
msgstr ""
#: ../qml/SettingsPage.qml:19
msgid "debug"
msgstr ""
#: ../qml/SettingsPage.qml:20
msgid "error"
msgstr ""
#: ../qml/SettingsPage.qml:25 pantalaimon.desktop.in.h:1
msgid "Pantalaimon UT" msgid "Pantalaimon UT"
msgstr "" msgstr ""
#: ../qml/SettingsPage.qml:23 #: ../qml/SettingsPage.qml:30
msgid "About" msgid "About"
msgstr "" msgstr ""
#: ../qml/SettingsPage.qml:38 #: ../qml/SettingsPage.qml:45
msgid "Service start disabled" msgid "Service start disabled"
msgstr "" msgstr ""
#: ../qml/SettingsPage.qml:38 #: ../qml/SettingsPage.qml:45
msgid "Service start enabled" msgid "Service start enabled"
msgstr "" msgstr ""
#: ../qml/SettingsPage.qml:109 #: ../qml/SettingsPage.qml:92
msgid "LogLevel"
msgstr ""
#: ../qml/SettingsPage.qml:144
msgid "Delete homeserver" msgid "Delete homeserver"
msgstr "" msgstr ""
#: ../qml/SettingsPage.qml:127 #: ../qml/SettingsPage.qml:162
msgid "No homeservers" msgid "No homeservers"
msgstr "" msgstr ""
#: ../qml/SettingsPage.qml:180 #: ../qml/SettingsPage.qml:222
msgid "Add Homeserver" msgid "Add Homeserver"
msgstr "" msgstr ""

View file

@ -106,6 +106,7 @@ Page {
} }
// Homeserver
Row { Row {
width: parent.width width: parent.width
height: units.gu(6) height: units.gu(6)
@ -144,6 +145,7 @@ Page {
} }
} }
// ListenPort
Row { Row {
width: parent.width width: parent.width
height: units.gu(6) height: units.gu(6)
@ -181,6 +183,7 @@ Page {
} }
} }
// Proxy
Row { Row {
width: parent.width width: parent.width
height: units.gu(6) height: units.gu(6)
@ -218,6 +221,7 @@ Page {
} }
} }
// SSL
Row { Row {
width: parent.width width: parent.width
height: units.gu(6) height: units.gu(6)
@ -258,6 +262,7 @@ Page {
} }
} }
// END
} }
} }

View file

@ -13,6 +13,13 @@ Page {
property bool upstart: false property bool upstart: false
property string status_msg property string status_msg
property var loglevels: [
i18n.tr("warning"),
i18n.tr("info"),
i18n.tr("debug"),
i18n.tr("error")
]
header: PageHeader { header: PageHeader {
id: header id: header
title: i18n.tr('Pantalaimon UT') title: i18n.tr('Pantalaimon UT')
@ -73,11 +80,39 @@ Page {
} }
} }
Column {
id: defaultlogLevel
anchors.top: serviceState.bottom
width: parent.width
leftPadding: units.gu(2)
topPadding: units.gu(2)
OptionSelector {
id: loglevel
text: i18n.tr("LogLevel")
width: parent.width - units.gu(4)
model: loglevels
containerHeight: itemHeight * 6
onDelegateClicked: {
saveConfig();
}
}
Label {
text: " "
height: units.gu(2)
}
ListItems.Divider {
height: units.gu(.5)
}
}
ListView { ListView {
id: listView id: listView
width: parent.width width: parent.width
height: parent.height - bottomEdgeHint.height height: parent.height - bottomEdgeHint.height
anchors.top: serviceState.bottom anchors.top: defaultlogLevel.bottom
visible: (listView.count !== 0) visible: (listView.count !== 0)
model: ListModel { model: ListModel {
id: listModel id: listModel
@ -97,7 +132,7 @@ Page {
homeserver: item.homeserver, homeserver: item.homeserver,
listenport: item.listenport, listenport: item.listenport,
proxy: item.proxy, proxy: item.proxy,
ssl: ssl ssl: item.ssl
}); });
} }
} }
@ -138,8 +173,12 @@ Page {
importModule('config', function() { importModule('config', function() {
py.call('config.load', [], function(result) { py.call('config.load', [], function(result) {
for (var i=0; i<result.length; i++) { console.log('DEBUG: ' + JSON.stringify(result));
listModel.append(result[i]) var defaults = result[0];
loglevel.selectedIndex = defaults.loglevel_idx;
var data = result[1];
for (var i=0; i<data.length; i++) {
listModel.append(data[i]);
} }
}); });
console.log("debug: python config loaded..."); console.log("debug: python config loaded...");
@ -158,7 +197,10 @@ Page {
for (var i = 0; i < listModel.count; ++i) { for (var i = 0; i < listModel.count; ++i) {
lmdata.push(listModel.get(i)); lmdata.push(listModel.get(i));
} }
py.call("config.save", [JSON.stringify(lmdata)], function(result) {}); var defaults = {
'loglevel': loglevels[loglevel.selectedIndex]
}
py.call("config.save", [JSON.stringify(defaults), JSON.stringify(lmdata)], function(result) {});
} }
function get_status() { function get_status() {