settingsLog: fix layout glitch when loaded first time 🐛

This commit is contained in:
mmbyday 2018-12-13 10:02:02 -08:00
parent 59fc48bd8b
commit 564f256f81

View File

@ -68,57 +68,52 @@ Rectangle {
text: qsTr("Log level") + translationManager.emptyString text: qsTr("Log level") + translationManager.emptyString
} }
GridLayout { ColumnLayout {
id: logGrid spacing: 10 * scaleRatio
columns: appWindow.persistentSettings.logLevel === 5 ? 2 : 1
Layout.fillWidth: true Layout.fillWidth: true
columnSpacing: 32 * scaleRatio id: logColumn
z: parent.z + 1 z: parent.z + 1
ColumnLayout { ListModel {
spacing: 0 id: logLevel
Layout.fillWidth: true ListElement { column1: "0"; name: "none"; }
ListElement { column1: "1"; }
ListElement { column1: "2"; }
ListElement { column1: "3"; }
ListElement { column1: "4"; }
ListElement { column1: "custom"; }
}
ListModel { MoneroComponents.StandardDropdown {
id: logLevel id: logLevelDropdown
ListElement { column1: "0"; name: "none"; } dataModel: logLevel
ListElement { column1: "1"; } itemTopMargin: 2 * scaleRatio
ListElement { column1: "2"; } currentIndex: appWindow.persistentSettings.logLevel;
ListElement { column1: "3"; } onChanged: {
ListElement { column1: "4"; } if (currentIndex == 5) {
ListElement { column1: "custom"; } console.log("log categories changed: ", logCategories.text);
} walletManager.setLogCategories(logCategories.text);
MoneroComponents.StandardDropdown {
id: logLevelDropdown
dataModel: logLevel
itemTopMargin: 2 * scaleRatio
currentIndex: appWindow.persistentSettings.logLevel;
onChanged: {
if (currentIndex == 5) {
console.log("log categories changed: ", logCategories.text);
walletManager.setLogCategories(logCategories.text);
}
else {
console.log("log level changed: ",currentIndex);
walletManager.setLogLevel(currentIndex);
}
appWindow.persistentSettings.logLevel = currentIndex;
} }
Layout.fillWidth: true else {
Layout.preferredWidth: logGrid.width / 2 console.log("log level changed: ",currentIndex);
shadowReleasedColor: "#FF4304" walletManager.setLogLevel(currentIndex);
shadowPressedColor: "#B32D00" }
releasedColor: "#363636" appWindow.persistentSettings.logLevel = currentIndex;
pressedColor: "#202020"
} }
Layout.fillWidth: true
Layout.preferredWidth: logColumn.width
shadowReleasedColor: "#FF4304"
shadowPressedColor: "#B32D00"
releasedColor: "#363636"
pressedColor: "#202020"
z: parent.z + 1
} }
MoneroComponents.LineEdit { MoneroComponents.LineEdit {
id: logCategories id: logCategories
visible: persistentSettings.logLevel === 5 visible: logLevelDropdown.currentIndex === 5
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredWidth: logGrid.width / 2 Layout.preferredWidth: logColumn.width
text: appWindow.persistentSettings.logCategories text: appWindow.persistentSettings.logCategories
placeholderText: "(e.g. *:WARNING,net.p2p:DEBUG)" placeholderText: "(e.g. *:WARNING,net.p2p:DEBUG)"
placeholderFontSize: 14 * scaleRatio placeholderFontSize: 14 * scaleRatio
@ -236,7 +231,7 @@ Rectangle {
} }
Component.onCompleted: { Component.onCompleted: {
logLevelDropdown.currentIndex = persistentSettings.logLevel; logLevelDropdown.currentIndex = appWindow.persistentSettings.logLevel;
logLevelDropdown.update(); logLevelDropdown.update();
if(typeof daemonManager != "undefined") if(typeof daemonManager != "undefined")