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 ""
"Project-Id-Version: pantalaimon.thrrgilag\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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -29,72 +29,92 @@ msgstr ""
msgid "InstanceName"
msgstr ""
#: ../qml/Components/EditServerPage.qml:118
#: ../qml/Components/EditServerPage.qml:119
msgid "Homeserver"
msgstr ""
#: ../qml/Components/EditServerPage.qml:140
#: ../qml/Components/EditServerPage.qml:141
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
#: ../qml/Components/EditServerPage.qml:158
msgid "ListenPort"
msgstr ""
#: ../qml/Components/EditServerPage.qml:177
#: ../qml/Components/EditServerPage.qml:179
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
#: ../qml/Components/EditServerPage.qml:196
msgid "Proxy"
msgstr ""
#: ../qml/Components/EditServerPage.qml:214
#: ../qml/Components/EditServerPage.qml:217
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
#: ../qml/Components/EditServerPage.qml:234
msgid "SSL"
msgstr ""
#: ../qml/Components/EditServerPage.qml:254
#: ../qml/Components/EditServerPage.qml:258
msgid ""
"SSL verification for outgoing connections to the homeserver. Defaults to "
"'True'."
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"
msgstr ""
#: ../qml/SettingsPage.qml:23
#: ../qml/SettingsPage.qml:30
msgid "About"
msgstr ""
#: ../qml/SettingsPage.qml:38
#: ../qml/SettingsPage.qml:45
msgid "Service start disabled"
msgstr ""
#: ../qml/SettingsPage.qml:38
#: ../qml/SettingsPage.qml:45
msgid "Service start enabled"
msgstr ""
#: ../qml/SettingsPage.qml:109
#: ../qml/SettingsPage.qml:92
msgid "LogLevel"
msgstr ""
#: ../qml/SettingsPage.qml:144
msgid "Delete homeserver"
msgstr ""
#: ../qml/SettingsPage.qml:127
#: ../qml/SettingsPage.qml:162
msgid "No homeservers"
msgstr ""
#: ../qml/SettingsPage.qml:180
#: ../qml/SettingsPage.qml:222
msgid "Add Homeserver"
msgstr ""

View file

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

View file

@ -13,6 +13,13 @@ Page {
property bool upstart: false
property string status_msg
property var loglevels: [
i18n.tr("warning"),
i18n.tr("info"),
i18n.tr("debug"),
i18n.tr("error")
]
header: PageHeader {
id: header
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 {
id: listView
width: parent.width
height: parent.height - bottomEdgeHint.height
anchors.top: serviceState.bottom
anchors.top: defaultlogLevel.bottom
visible: (listView.count !== 0)
model: ListModel {
id: listModel
@ -97,7 +132,7 @@ Page {
homeserver: item.homeserver,
listenport: item.listenport,
proxy: item.proxy,
ssl: ssl
ssl: item.ssl
});
}
}
@ -138,8 +173,12 @@ Page {
importModule('config', function() {
py.call('config.load', [], function(result) {
for (var i=0; i<result.length; i++) {
listModel.append(result[i])
console.log('DEBUG: ' + JSON.stringify(result));
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...");
@ -158,7 +197,10 @@ Page {
for (var i = 0; i < listModel.count; ++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() {