Index: sources/gui/qml/pages/settings/SettingsExportLogs.qml =================================================================== diff -u -r80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803 -r3c859e027546fa42ef215eb0d0d09e3f2bb953ab --- sources/gui/qml/pages/settings/SettingsExportLogs.qml (.../SettingsExportLogs.qml) (revision 80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803) +++ sources/gui/qml/pages/settings/SettingsExportLogs.qml (.../SettingsExportLogs.qml) (revision 3c859e027546fa42ef215eb0d0d09e3f2bb953ab) @@ -39,19 +39,11 @@ */ SettingsBase { id: _root itemIndex : SettingsStack.ExportLogs - - //////////////////////////////////////////////////////////////////////////////// - // FIXME: The model being used here is the QML FileListModel. // - // This model is so limited and do not update 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 devUnit : "MB" // no translation readonly property string devUnitLabel : " (" + devUnit + ")\n" // no translation readonly property string usbLabel : qsTr("USB Drive") - readonly property int headetRowHight : 50 + readonly property int headerRowHight : 50 readonly property int typeIndexApplication : 0 readonly property int typeIndexService : 1 @@ -62,25 +54,7 @@ readonly property string typeLabelTreatment : qsTr("Treatment" ) property bool isDevice : true //false // it has to be true to make it work on the devices. - readonly property string typePathClr : "" - readonly property string typePathPrefix : "file://" - readonly property string typePathSrc : typePathPrefix + (isDevice ? "/media/sd-card" : "/home/denali/Desktop/sd-card" ) - readonly property string typePathDst : typePathPrefix + (isDevice ? "/media/usb" : "/home/denali/Desktop/usb-disk") - readonly property string typeFolderApplication : "/log" - readonly property string typeFolderService : "/service" - readonly property string typeFolderTreatment : "/treatment" - readonly property string typeFolderApplicationSrc : typePathSrc + typeFolderApplication - readonly property string typeFolderApplicationDst : typePathDst + typeFolderApplication - readonly property string typeFolderServiceSrc : typePathSrc + typeFolderService - readonly property string typeFolderServiceDst : typePathDst + typeFolderService - readonly property string typeFolderTreatmentSrc : typePathSrc + typeFolderTreatment - readonly property string typeFolderTreatmentDst : typePathDst + typeFolderTreatment - - readonly property var typeFilterAll : ["*"] - readonly property var typeFilterClr : [] - - confirmVisible : false function refreshModels() { @@ -106,37 +80,7 @@ refreshModels() } - property bool isUpdatePanels: false - function updatePanels (vIndex) { - isUpdatePanels = true - - _GuiView.doExportListRemove() - _sdcFolderColumn.clearModel() - _usbFolderColumn.clearModel() - - switch (vIndex) { - case typeIndexApplication: - _sdcFolderColumn.currentTypeFolderApplication = typeFolderApplicationSrc - _usbFolderColumn.currentTypeFolderApplication = typeFolderApplicationDst - break - case typeIndexService: - _sdcFolderColumn.currentTypeFolderApplication = typeFolderServiceSrc - _usbFolderColumn.currentTypeFolderApplication = typeFolderServiceDst - break - case typeIndexTreatment: - _sdcFolderColumn.currentTypeFolderApplication = typeFolderTreatmentSrc - _usbFolderColumn.currentTypeFolderApplication = typeFolderTreatmentDst - break - } - - _sdcFolderColumn.updateModel() - _usbFolderColumn.updateModel() - - isUpdatePanels = false - } - Connections { target: _GuiView - function onSdIsReadyChanged ( vValue ) { _root.updatePanels() } function onDidExportStat ( vIndex, vFileName, vPercent ) { _sdcFolderView.positionViewAtIndex(vIndex, ListView.Center) } function onDidUSBDriveUmount ( ) { _usbFolderColumn. clearModel ( ) } function onDidUSBDriveRemove ( ) { _usbFolderColumn. clearModel ( ) } @@ -151,7 +95,7 @@ anchors.right : _root.right anchors.top : _root.top anchors.margins : Variables.headerButtonsMargin - enabled : _GuiView.usbIsReady && !_GuiView.exportRunning && ! isUpdatePanels + enabled : _GuiView.usbIsReady && !_GuiView.exportRunning } Row { id : _contentRect @@ -180,15 +124,20 @@ Row { id : _logTypeRow anchors.left : parent.left width : parent.width - height : _root.headetRowHight + height : _root.headerRowHight spacing : _logTypeCombo.width - _logTypeExportButton.width // FIXME: This combobox needs to be a global Component ComboBox { id : _logTypeCombo onCurrentIndexChanged : { - _root.updatePanels(currentIndex) +// _root.updatePanels(currentIndex) + + _GuiView.doExportListRemove() + + vUSBListModel.updateFolderWithType(currentIndex) + vSDCardListModel.updateFolderWithType(currentIndex) } - enabled : ! _GuiView.exportRunning && ! isUpdatePanels + enabled : ! _GuiView.exportRunning currentIndex : 0 displayText : currentText font.pixelSize : Fonts.fontPixelTextRectExtra @@ -298,31 +247,19 @@ height : Variables.touchRectHeight radius : Variables.touchRectRadius border.width : Variables.borderWidth - enabled : _GuiView.usbIsReady && !_GuiView.exportRunning && ! isUpdatePanels + enabled : _GuiView.usbIsReady && !_GuiView.exportRunning onClicked : doExport() } } Column { id : _sdcFolderColumn - property string currentTypeFolderApplication : _root.typeFolderApplicationSrc - - // 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 = _root.typeFilterAll - } - function clearModel() { - _sdcFolderModel.folder = _root.typePathClr - _sdcFolderModel.nameFilters = _root.typeFilterClr - } - spacing : 5 width : _contentRect.columnWidthFolder height : parent.height anchors.verticalCenter : parent.verticalCenter Label { id : _sdcLabel - text : _root.sdcLabel + ": %1 files"/*, %2 %3"*/.arg(_sdcFolderView.visibleFileCounter) + (_GuiView.exportCount ? " [Selected: %1]".arg(_GuiView.exportCount ) : "") //.arg("__").arg(_root.dvcUnit) + text : _root.sdcLabel + ": %1 files"/*, %2 %3"*/.arg(_sdcFolderView.count) + (_GuiView.exportCount ? " [Selected: %1]".arg(_GuiView.exportCount ) : "") //.arg("__").arg(_root.dvcUnit) width : parent.width - height : _root.headetRowHight + height : _root.headerRowHight verticalAlignment : Text.AlignVCenter } Rectangle { id : _sdcFolderRectangle @@ -340,27 +277,13 @@ } ListView { id : _sdcFolderView - property int visibleFileCounter : 0 - enabled : !_GuiView.exportRunning && ! isUpdatePanels + enabled : !_GuiView.exportRunning clip : true anchors.fill : parent anchors.margins : 10 anchors.leftMargin : 5 anchors.rightMargin : 5 spacing : 3 - FolderListModel { id : _sdcFolderModel - onStatusChanged: { - // onFolderChanged does not get emitted when switching folders, but status change does. - // Reset the displayed file counter when the state of the model is null - if (_sdcFolderModel.status == FolderListModel.Null) - { - _sdcFolderView.visibleFileCounter = 0 - } - } - showDirs : false - sortField : FolderListModel.Time - folder : _sdcFolderColumn.currentTypeFolderApplication // FIXME: there has to be a View for this which also get changed by log type. - } Component { id : _sdcFileDelegate ProgressBar { id : _sdcItemBackground @@ -375,16 +298,13 @@ : 0 onExportPercentChanged : console.log( "%", exportPercent) - property bool isShownInList : !_GuiView.isPathSymLink(_sdcFolderColumn.currentTypeFolderApplication.replace(typePathPrefix, "") + "/" + fileName) - Component.onCompleted: if ( isShownInList ) _sdcFolderView.visibleFileCounter++ - //DEBUG: onInExportListChanged: console.debug(" * ", index, inExportList) function exportListUpdate() { if (_GuiView.doExportListSelect( index ) ) { _GuiView.doExportListDelete( index ) } else { - _GuiView.doExportListInsert( index , fileName ) + _GuiView.doExportListInsert( index , filePath ) } } @@ -399,25 +319,21 @@ maximum : 100 // percent value : maximum - exportPercent - // Setting height and width to 0 when the file is not shown in the list because - // it is a symlink or other conditions - width : isShownInList ? _sdcFolderView.width : 0 - height : isShownInList ? 40 : 0 + width : _sdcFolderView.width + height : 40 bgColor : Colors.transparent color : inExportList ? Colors.borderButtonSelected : Colors.transparent radius : 5 Row { id : _sdcFileRow - // Setting height and width to 0 when the file is not shown in the list because - // it is a symlink or other conditions - width : isShownInList ? parent.width : 0 - height : isShownInList ? 40 : 0 + width : parent.width + height : 40 leftPadding : 5 Text { id : _sdcFileNameText x : 2 clip : true - width : isShownInList ? (_contentRect.columnWidthFileName - 2) : 0 + width : _contentRect.columnWidthFileName - 2 text : fileName color : Colors.textMain font.pixelSize : Fonts.fontPixelTextRectExtra @@ -426,12 +342,12 @@ } Rectangle { id : _sdcColumnVerticalLine color : Colors.borderButtonUnselected - width : isShownInList ? 1 : 0 + width : 1 height : parent.height + _usbFolderColumn.spacing } Text { id : _sdcFileSizeText clip : true - width : isShownInList ? _contentRect.columnWidthFileSize : 0 + width : _contentRect.columnWidthFileSize text : Variables.sizeConverted( fileSize, 1000, 3) color : Colors.textMain font.pixelSize : Fonts.fontPixelTextRectExtra @@ -441,23 +357,19 @@ } } } - model : _sdcFolderModel + model : vSDCardListModel delegate : _sdcFileDelegate } } } Column { id : _usbFolderColumn - property string currentTypeFolderApplication : _root.typeFolderApplicationDst - // 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 = _root.typeFilterAll + vUSBListModel.refreshModel() } function clearModel() { - _usbFolderModel.folder = _root.typePathClr - _usbFolderModel.nameFilters = _root.typeFilterClr + vUSBListModel.removeAllRows() } // FIXME: there has to be a View for this, and the timer should be removed and an event driven signal should be implemented there. @@ -486,9 +398,9 @@ anchors.verticalCenter : parent.verticalCenter Label { id : _usbLabel - text : _root.usbLabel + ": %1 files"/*", %2 %3"*/.arg(_usbFolderModel.count)//.arg("__").arg(_root.dvcUnit) + text : _root.usbLabel + ": %1 files"/*", %2 %3"*/.arg(_usbFolderView.count)//.arg("__").arg(_root.dvcUnit) width : parent.width - height : _root.headetRowHight + height : _root.headerRowHight verticalAlignment : Text.AlignVCenter } @@ -514,12 +426,6 @@ anchors.leftMargin : 5 anchors.rightMargin : 5 - - FolderListModel { id : _usbFolderModel // FIXME: I don't like this model, it's too lazy and I don't have control over it. There has to be a Model for this. - showDirs : false - sortField : FolderListModel.Time - folder : _usbFolderColumn.currentTypeFolderApplication - } Component { id : _usbFileDelegate Row { id : _usbFileRow width : _usbFolderView.width @@ -549,7 +455,7 @@ } } } - model : _usbFolderModel + model : vUSBListModel delegate : _usbFileDelegate } }