Index: sources/gui/qml/pages/settings/SettingsExportLogs.qml =================================================================== diff -u -r5010eb3f788bf9422911a40eaf00a60a185ce03d -r5e0731af5ae5e11d3981e4d3065a886975fb7fc3 --- sources/gui/qml/pages/settings/SettingsExportLogs.qml (.../SettingsExportLogs.qml) (revision 5010eb3f788bf9422911a40eaf00a60a185ce03d) +++ sources/gui/qml/pages/settings/SettingsExportLogs.qml (.../SettingsExportLogs.qml) (revision 5e0731af5ae5e11d3981e4d3065a886975fb7fc3) @@ -21,7 +21,8 @@ // TODO: Add the fileCopy function to have control over the copy // TODO: Add cancel -// TODO: Add Service and Treatment log export and filter +// TODO: Add Service and Treatment log export and exit + // TODO: Add selecction export // TODO: Add error display @@ -38,6 +39,13 @@ */ SettingsBase { id: _root + //////////////////////////////////////////////////////////////////////////////// + // FIXME: The model being used here is the QML FileListModel. // + // This model is so limited and not updated well. // + // This model definitely has to be replaced with a C++ one, // + // like the other MVC classes we have. // + //////////////////////////////////////////////////////////////////////////////// + readonly property string sdcLabel : qsTr("SD-Card") readonly property string dvcUnit : "MB" // no translation readonly property string dvcUnitLabel : " (" + dvcUnit + ")\n" // no translation @@ -67,17 +75,21 @@ readonly property string typeFolderTreatmentSrc : typePathSrc + typeFolderTreatment readonly property string typeFolderTreatmentDst : typePathDst + typeFolderTreatment - readonly property var typeFilterClr : [] readonly property var typeFilterAll : ["*"] - readonly property var typeFilterApplication : ["*log" ] - readonly property var typeFilterService : ["*.err" ] - readonly property var typeFilterTreatment : ["*" ] + readonly property var typeFilterClr : [] itemIndex : SettingsStack.ExportLogs confirmVisible : false + function refreshModels() { + _usbFolderColumn.clearModel() + _usbFolderColumn.updateModel() + } + function doExport() { + refreshModels() + switch (_logTypeCombo.currentIndex) { case typeIndexApplication: _GuiView.doExportLog() @@ -89,43 +101,36 @@ _GuiView.doExportTreatment() break } + + refreshModels() } + property bool isUpdatePanels: false function updatePanels (vIndex) { - console.debug(vIndex) - _usbEjectButton .enabled = false - _logTypeExportButton.enabled = false - _logTypeCombo .enabled = false + isUpdatePanels = true _sdcFolderColumn.clearModel() _usbFolderColumn.clearModel() switch (vIndex) { case typeIndexApplication: _sdcFolderColumn.currentTypeFolderApplication = typeFolderApplicationSrc - _sdcFolderColumn.currentTypeFilterApplication = typeFilterApplication _usbFolderColumn.currentTypeFolderApplication = typeFolderApplicationDst - _usbFolderColumn.currentTypeFilterApplication = typeFilterApplication break case typeIndexService: _sdcFolderColumn.currentTypeFolderApplication = typeFolderServiceSrc - _sdcFolderColumn.currentTypeFilterApplication = typeFilterService _usbFolderColumn.currentTypeFolderApplication = typeFolderServiceDst - _usbFolderColumn.currentTypeFilterApplication = typeFilterService break case typeIndexTreatment: _sdcFolderColumn.currentTypeFolderApplication = typeFolderTreatmentSrc - _sdcFolderColumn.currentTypeFilterApplication = typeFilterTreatment _usbFolderColumn.currentTypeFolderApplication = typeFolderTreatmentDst - _usbFolderColumn.currentTypeFilterApplication = typeFilterTreatment break } + _sdcFolderColumn.updateModel() _usbFolderColumn.updateModel() - _logTypeExportButton.enabled = true - _logTypeCombo .enabled = true - _usbEjectButton .enabled = true + isUpdatePanels = false } USBButton { id: _usbEjectButton @@ -134,6 +139,7 @@ anchors.right : _root.right anchors.top : _root.top anchors.margins : Variables.headerButtonsMargin + enabled : ! _GuiView.exportRunning && ! isUpdatePanels } Row { id : _contentRect @@ -170,11 +176,11 @@ onCurrentIndexChanged : { _root.updatePanels(currentIndex) } - + enabled : ! _GuiView.exportRunning && ! isUpdatePanels currentIndex : 0 displayText : currentText font.pixelSize : Fonts.fontPixelTextRectExtra - width : parent.width // 2 + width : parent.width height : parent.height padding : 10 model : [ @@ -185,7 +191,7 @@ background : Rectangle { color : Colors.transparent - border.color : Colors.borderButton + border.color : enabled ? Colors.borderButton : Colors.borderDisableButton radius : Variables.dialogRadius } @@ -280,17 +286,17 @@ height : Variables.touchRectHeight radius : Variables.touchRectRadius border.width : Variables.borderWidth + enabled : ! _GuiView.exportRunning && ! isUpdatePanels onClicked : doExport() } } Column { id : _sdcFolderColumn property string currentTypeFolderApplication : _root.typeFolderApplicationSrc - property var currentTypeFilterApplication : _root.typeFilterApplication // FIXME: there has to be a View for this, and the timer should be removed and an event driven signal should be implemented there. function updateModel() { _sdcFolderModel.folder = currentTypeFolderApplication // FIXME: there has to be a View for this which also get changed by log type. - _sdcFolderModel.nameFilters = currentTypeFilterApplication // FIXME: there has to be a View for this which also get changed by log type. + _sdcFolderModel.nameFilters = _root.typeFilterAll } function clearModel() { _sdcFolderModel.folder = _root.typePathClr @@ -303,7 +309,7 @@ anchors.verticalCenter : parent.verticalCenter Label { id : _sdcLabel text : _root.sdcLabel + ": %1 files"/*, %2 %3"*/.arg(_sdcFolderModel.count)//.arg("__").arg(_root.dvcUnit) - width : parent.width // 2 + width : parent.width height : _root.headetRowHight verticalAlignment : Text.AlignVCenter } @@ -329,7 +335,6 @@ showDirs : false sortField : FolderListModel.Time folder : _sdcFolderColumn.currentTypeFolderApplication // FIXME: there has to be a View for this which also get changed by log type. - nameFilters : _sdcFolderColumn.currentTypeFilterApplication // FIXME: there has to be a View for this which also get changed by log type. } Component { id : _sdcFileDelegate Row { id : _sdcFileRow @@ -368,13 +373,11 @@ Column { id : _usbFolderColumn property string currentTypeFolderApplication : _root.typeFolderApplicationDst - property var currentTypeFilterApplication : _root.typeFilterApplication // FIXME: there has to be a View for this, and the timer should be removed and an event driven signal should be implemented there. function updateModel() { _usbFolderModel.folder = currentTypeFolderApplication // FIXME: there has to be a View for this which also get changed by log type. - _usbFolderModel.nameFilters = currentTypeFilterApplication // FIXME: there has to be a View for this which also get changed by log type. - console.debug("Update model") + _usbFolderModel.nameFilters = _root.typeFilterAll } function clearModel() { _usbFolderModel.folder = _root.typePathClr @@ -387,7 +390,7 @@ repeat : true running : _GuiView.exportRunning onTriggered : { - // _usbFolderColumn. clearModel() + _usbFolderColumn. clearModel() _usbFolderColumn.updateModel() } } @@ -434,7 +437,6 @@ showDirs : false sortField : FolderListModel.Time folder : _usbFolderColumn.currentTypeFolderApplication - nameFilters : _usbFolderColumn.currentTypeFilterApplication } Component { id : _usbFileDelegate Row { id : _usbFileRow