Index: sources/gui/qml/pages/settings/SettingsExportLogs.qml =================================================================== diff -u -rdc8969f6c7bbdb46d2de22622e58e457ceb37df4 -r0ce9ad2246ce63e9fcb706c0025ccf2a6ee88199 --- sources/gui/qml/pages/settings/SettingsExportLogs.qml (.../SettingsExportLogs.qml) (revision dc8969f6c7bbdb46d2de22622e58e457ceb37df4) +++ sources/gui/qml/pages/settings/SettingsExportLogs.qml (.../SettingsExportLogs.qml) (revision 0ce9ad2246ce63e9fcb706c0025ccf2a6ee88199) @@ -33,6 +33,7 @@ import "qrc:/" import "qrc:/globals" import "qrc:/components" +import "qrc:/compounds" /*! * \brief SettingsExportLogs is used to Export logs, and display the SD-Card and USB device informaiton and list of files. @@ -51,7 +52,6 @@ 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 typeIndexApplication : 0 readonly property int typeIndexService : 1 @@ -84,7 +84,12 @@ readonly property bool horizontalLayout : _GuiView.useLogLongName confirmVisible : false - notificationMargin : Variables.notificationHeight + backEnabled : ! _GuiView.exportRunning + notificationAnchor { + bottom : _root.bottom + bottomMargin : 90 + verticalCenter : undefined + } function refreshModels() { _usbFolderColumn.clearModel() @@ -147,7 +152,6 @@ } Connections { target: _logTypeCombo - function onCurrentIndexChanged() { vLocalization.notification = "" } @@ -165,163 +169,141 @@ qsTr("log export to USB is complete") } } + BaseComboBox { id: _logTypeCombo + anchors.top : _root.top + anchors.topMargin : Variables.headerButtonsMargin + anchors.horizontalCenter : parent.horizontalCenter + height : Variables.contentHeight + currentIndex : 0 + model : [ + _root.typeLabelApplication , + _root.typeLabelService , + _root.typeLabelTreatment + ] + + onActivated: updatePanels( _logTypeCombo.currentIndex ) + } + USBButton { id: _usbEjectButton - width : 120 + width : 150 height : 50 anchors.right : _root.right anchors.top : _root.top anchors.margins : Variables.headerButtonsMargin - enabled : _GuiView.usbIsReady && !_GuiView.exportRunning && ! isUpdatePanels + enabled : _GuiView.usbIsReady && !_GuiView.exportRunning && ! _root.isUpdatePanels } - contentItem: Row { id : _contentRect - spacing : Variables.minVGap + contentItem: Item { id : _contentRect readonly property int columnWidthProgress : 375 - readonly property int columnWidthFolder : _root.horizontalLayout ? 840 : 725 + readonly property int columnWidthFolder : parent.width / 2.3 readonly property int columnWidthFileName : _root.horizontalLayout ? 685 : 575 // best combination - readonly property int columnWidthFileSize : _root.horizontalLayout ? 105 : 105 // best combination + readonly property int columnWidthFileSize : 120 + readonly property int columnCellHeight : 60 - Column { id : _progressColumn - property int progressWidth : 170 - property int progressHeight : height - _logTypeCombo.height - _logTypeExportButton.height + anchors.fill: parent - spacing : 10 - width : _contentRect.columnWidthProgress - height : parent.height + component Header: Rectangle { id: _header + width : parent.width + height : _contentRect.columnCellHeight + color : Colors.panelBackgroundColor + radius : 9 - Row { id : _logTypeRow - anchors.left : parent.left - width : parent.width - height : _root.headetRowHight - spacing : _logTypeCombo.width - _logTypeExportButton.width + border { + width: 1 + color: Colors.panelBorderColor + } - BaseComboBox { id: _logTypeCombo - width : parent.width - height : parent.height - currentIndex : 0 - model : [ - _root.typeLabelApplication , - _root.typeLabelService , - _root.typeLabelTreatment - ] + Item { + width : parent.width + height : _contentRect.columnCellHeight - onActivated: updatePanels( _logTypeCombo.currentIndex ) - } - } - Column { - width : _progressColumn.progressWidth - height : _progressColumn.progressHeight - 2 * _progressColumn.spacing - Item { id : _SDC_item - width : _progressColumn.progressWidth - height : parent.height / 2 + Row { id : _HeaderRow + anchors.fill : parent + height : parent.height + leftPadding : Variables.defaultMargin * 2 + rightPadding : Variables.defaultMargin * 2 - SDCProgressItem { id: _SDC_progressItem - thickness : 10 - displayInformation : false - anchors.fill : parent + Text { id : _HeaderNameText + width : _contentRect.columnWidthFileName + height : parent.height + text : qsTr("Log Name") + color : Colors.textMain + font.pixelSize : Fonts.fontPixelTextRectExtra + verticalAlignment : Text.AlignVCenter } - Label { - anchors.left : _SDC_progressItem.right - anchors.leftMargin : _progressColumn.spacing - anchors.verticalCenter : parent.verticalCenter - text : _root.sdcLabel + _root.devUnitLabel + ("Free : %1\nTotal: %2").arg( Variables.sizeConverted( _GuiView.sdAvail, 1000, 3) ).arg( Variables.sizeConverted( _GuiView.sdTotal, 1000, 3) ) - } - Label { - anchors.fill : parent - verticalAlignment : Text.AlignVCenter - horizontalAlignment : Text.AlignHCenter - text : _SDC_progressItem.percent - } - } - Item { id : _USB_item - width : _progressColumn.progressWidth - height : parent.height / 2 - USBProgressItem { id: _USB_progressItem - thickness : 10 - displayInformation : false - anchors.fill : parent + Text { id : _HeaderSizeText + width : _contentRect.columnWidthFileSize + height : parent.height + text : qsTr("Size") + color : Colors.textMain + font.pixelSize : Fonts.fontPixelTextRectExtra + verticalAlignment : Text.AlignVCenter } - Label { - anchors.left : _USB_progressItem.right - anchors.leftMargin : _progressColumn.spacing - anchors.verticalCenter : parent.verticalCenter - text : _root.usbLabel + _root.devUnitLabel + ("Free : %1\nTotal: %2").arg( Variables.sizeConverted( _GuiView.usbAvail, 1000, 3) ).arg( Variables.sizeConverted( _GuiView.usbTotal, 1000, 3) ) - } - Label { - anchors.fill : parent - verticalAlignment : Text.AlignVCenter - horizontalAlignment : Text.AlignHCenter - text : _USB_progressItem.percent - } } } - ExportButton { id : _logTypeExportButton - width : parent.width - height : Variables.touchRectHeight - radius : Variables.touchRectRadius - border.width : Variables.borderWidth - enabled : _GuiView.usbIsReady && !_GuiView.exportRunning && ! isUpdatePanels - onClicked : doExport() - } } - Grid { - columns : _root.horizontalLayout ? 1 : 2 - spacing : 5 + + Column { id : _sdcFolderColumn + property string currentTypeFolderApplication : _root.typeFolderApplicationSrc + + anchors.left : parent.left width : _contentRect.columnWidthFolder - height : parent.height - Column { id : _sdcFolderColumn - property string currentTypeFolderApplication : _root.typeFolderApplicationSrc + height : parent.height - ( Variables.notificationHeight + Variables.defaultMargin * 4) - // 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 - } + // 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 + } - spacing : 5 - width : _contentRect.columnWidthFolder - height : _root.horizontalLayout ? parent.height / 2 : parent.height - Label { id : _sdcLabel - text : _root.sdcLabel + ": %1 files"/*, %2 %3"*/.arg(_sdcFolderModel.count) + (_GuiView.exportCount ? " [Selected: %1]".arg(_GuiView.exportCount ) : "") //.arg("__").arg(_root.dvcUnit) - width : parent.width - height : _root.headetRowHight - verticalAlignment : Text.AlignVCenter + function clearModel() { + _sdcFolderModel.folder = _root.typePathClr + _sdcFolderModel.nameFilters = _root.typeFilterClr + } + + ExportLogsHeaderData { id: _sdcContainer + title : ("%1 (%2)").arg(_root.sdcLabel).arg(Variables.unitStorage) + fileCount : _root.sdcLabel + ": %1 files".arg(_sdcFolderModel.count) + (_GuiView.exportCount ? " [Selected: %1]".arg(_GuiView.exportCount ) : "") + freeValue : Variables.sizeConverted( _GuiView.sdAvail, 1000, 3) + totalValue : Variables.sizeConverted( _GuiView.sdTotal, 1000, 3) + + contentItem : SDCProgressItem { id: _SDC_progress } + } + + Rectangle { id : _sdcFolderRectangle + color : Colors.panelBackgroundColor + radius : Variables.dialogRadius + anchors.left : parent.left + width : parent.width + height : parent.height + border { + width : 1 + color : Colors.panelBorderColor } - Rectangle { id : _sdcFolderRectangle - color : Colors.transparent - border.color : Colors.borderButton - radius : Variables.dialogRadius - anchors.left : parent.left - width : parent.width - height : parent.height - _sdcLabel.height - ScrollBar { - anchors.fill : _sdcFolderView - flickable : _sdcFolderView - handleWidth : Variables.settingsExportLogsScrollBarWidth - } + Column { id: _sdcColumn + anchors.fill: parent - ListView { id : _sdcFolderView - enabled : !_GuiView.exportRunning && ! isUpdatePanels - clip : true - anchors.fill : parent - anchors.margins : 10 - anchors.leftMargin : 5 - anchors.rightMargin : 5 - spacing : 3 - FolderListModel { id : _sdcFolderModel - showDirs : false - sortField : FolderListModel.Time - folder : _sdcFolderColumn.currentTypeFolderApplication // FIXME: there has to be a View for this which also get changed by log type. - } + Header { id: _sdcHeader } - Component { id : _sdcFileDelegate - ProgressBar { id : _sdcItemBackground + Item { id: _sdcListItem + width : parent.width + height : parent.height - _sdcHeader.height + + ListView { id : _sdcFolderView + enabled : ! _GuiView.exportRunning && ! _root.isUpdatePanels + clip : true + width : parent.width + height : parent.height + + model: FolderListModel { id : _sdcFolderModel + showDirs : false + sortField : FolderListModel.Time + folder : _sdcFolderColumn.currentTypeFolderApplication // FIXME: there has to be a View for this which also get changed by log type. + } + + delegate: Item { id : _sdcItemBackground // *** IMPORTANT *** // QML kills the items when they get out of the view port in regards to the cacheBuffer, // and the next time it gets in the view port will be created with all the properties in their defaults. @@ -345,72 +327,121 @@ } } + ProgressBar { id: _progressRect + anchors{ + fill : parent + leftMargin : Variables.defaultMargin + topMargin : 5 + bottomMargin : 5 + rightMargin : Variables.defaultMargin + + } + color : inExportList ? Colors.borderButton : Colors.transparent + bgColor : Colors.transparent + width : parent.width + height : parent.height + minimum : 0 + maximum : 100 // percent + value : maximum - _sdcItemBackground.exportPercent + z : 0 + radius : 5 + minText.visible : false + maxText.visible : false + marker.visible : false + } + + // 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 ? _contentRect.columnCellHeight : 0 + MouseArea { anchors.fill : parent onClicked : exportListUpdate() } - progress.z : 0 - minText.visible : false - maxText.visible : false - marker.visible : false - 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 + Item { + width : isShownInList ? parent.width : 0 + height : isShownInList ? _contentRect.columnCellHeight : 0 - 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 + 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 + anchors.fill : parent + height : parent.height + leftPadding : Variables.defaultMargin * 2 + rightPadding : Variables.defaultMargin * 2 - leftPadding : 5 - Text { id : _sdcFileNameText - x : 2 - clip : true - width : isShownInList ? (_contentRect.columnWidthFileName - 2) : 0 - text : fileName - color : Colors.textMain - font.pixelSize : Fonts.fontPixelTextRectExtra - verticalAlignment : Text.AlignVCenter - horizontalAlignment : Text.AlignLeft + Text { id : _sdcFileNameText + clip : true + width : isShownInList ? (_contentRect.columnWidthFileName - 2) : 0 + height : parent.height + text : fileName + color : Colors.textMain + font.pixelSize : Fonts.fontPixelTextRectExtra + verticalAlignment : Text.AlignVCenter + } + + Text { id : _sdcFileSizeText + clip : true + width : isShownInList ? _contentRect.columnWidthFileSize : 0 + height : parent.height + text : Variables.sizeConverted( fileSize, 1000, 3) + color : Colors.textMain + font.pixelSize : Fonts.fontPixelTextRectExtra + verticalAlignment : Text.AlignVCenter + } } - Rectangle { id : _sdcColumnVerticalLine - color : Colors.borderButtonUnselected - width : isShownInList ? 1 : 0 - height : parent.height + _usbFolderColumn.spacing + + Line { id: _sdcDivider + color : Colors.panelBorderColor + visible : index !== _sdcFolderView.count - 1 + anchors { + bottom : parent.bottom + left : parent.left + leftMargin : Variables.defaultMargin * 2 + right : parent.right + rightMargin : Variables.defaultMargin * 2 + } } - Text { id : _sdcFileSizeText - clip : true - width : isShownInList ? _contentRect.columnWidthFileSize : 0 - text : Variables.sizeConverted( fileSize, 1000, 3) - color : Colors.textMain - font.pixelSize : Fonts.fontPixelTextRectExtra - verticalAlignment : Text.AlignVCenter - horizontalAlignment : Text.AlignRight - } } } } - model : _sdcFolderModel - delegate : _sdcFileDelegate + + ScrollBar { + anchors.fill : _sdcFolderView + flickable : _sdcFolderView + handleWidth : Variables.settingsExportLogsScrollBarWidth + scrollColor : Colors.scrollBarColor + } } } } - Column { id : _usbFolderColumn + } + + IconButton { id: _exportButton + anchors.centerIn: parent + iconImageSource : enabled ? "qrc:/images/iExport" : "qrc:/images/iExportDisabled" + enabled : _GuiView.usbIsReady && !_GuiView.exportRunning && ! _root.isUpdatePanels + isDefault : true + border.color : enabled ? Colors.borderButton : Colors.borderDisableButton + extraSpace : Variables.defaultMargin * 2 + onClicked : doExport() + } + + Column { id : _usbFolderColumn property string currentTypeFolderApplication : _root.typeFolderApplicationDst + anchors.right : parent.right + width : _contentRect.columnWidthFolder + height : parent.height - ( Variables.notificationHeight + Variables.defaultMargin * 4) + // 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 } + function clearModel() { _usbFolderModel.folder = _root.typePathClr _usbFolderModel.nameFilters = _root.typeFilterClr @@ -436,78 +467,123 @@ } } - spacing : 5 - width : _contentRect.columnWidthFolder - height : _root.horizontalLayout ? parent.height / 2 : parent.height - Label { id : _usbLabel - text : _root.usbLabel + ": %1 files"/*", %2 %3"*/.arg(_usbFolderModel.count)//.arg("__").arg(_root.dvcUnit) - width : parent.width - height : _root.headetRowHight - verticalAlignment : Text.AlignVCenter + ExportLogsHeaderData { id: _usbContainer + title : ("%1 (%2)").arg(_root.usbLabel).arg(Variables.unitStorage) + fileCount : _root.usbLabel + ": %1 files".arg(_usbFolderModel.count) + freeValue : Variables.sizeConverted( _GuiView.usbAvail, 1000, 3) + totalValue : Variables.sizeConverted( _GuiView.usbTotal, 1000, 3) + + contentItem : USBProgressItem { id: _USB_progress } } Rectangle { id : _usbFolderRectangle - color : Colors.transparent - border.color : Colors.borderButton + color : Colors.panelBackgroundColor radius : Variables.dialogRadius anchors.left : parent.left width : parent.width - height : parent.height - _sdcLabel.height - - ScrollBar { - anchors.fill : _usbFolderView - flickable : _usbFolderView - handleWidth : Variables.settingsExportLogsScrollBarWidth + height : parent.height + border { + width : 1 + color : Colors.panelBorderColor } - ListView { id : _usbFolderView - clip : true - anchors.fill : parent - anchors.margins : 10 - spacing : 3 + Column { id: _usbColumn + anchors.fill: parent - anchors.leftMargin : 5 - anchors.rightMargin : 5 + Header { id: _usbHeader } - 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 - height : 40 - Text { id : _usbFileNameText - clip : true - width : _contentRect.columnWidthFileName - text : fileName - color : Colors.textMain - font.pixelSize : Fonts.fontPixelTextRectExtra - verticalAlignment : Text.AlignVCenter - horizontalAlignment : Text.AlignLeft + Item { id: _usbListItem + width : parent.width + height : parent.height - _usbHeader.height + + ListView { id : _usbFolderView + clip : true + anchors.fill : parent + + model: 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 } - Rectangle { - color: Colors.borderButtonUnselected - width: 1 - height: parent.height + _usbFolderColumn.spacing + + delegate :Item { id: _usbDelegateItem + width : _usbFolderView.width + height : _contentRect.columnCellHeight + + ProgressBar { id: _usbProgressRect + anchors{ + fill : parent + leftMargin : Variables.defaultMargin + topMargin : 5 + bottomMargin : 5 + rightMargin : Variables.defaultMargin + + } + color : _GuiView.exportRunning ? Colors.progressGreen : Colors.transparent + bgColor : Colors.transparent + width : parent.width + height : parent.height + minimum : 0 + maximum : 100 // percent + value : _GuiView.exportPercent + z : 0 + radius : 5 + minText.visible : false + maxText.visible : false + marker.visible : false + visible : index === 0 + } + + Row { id : _usbFileRow + anchors.fill : parent + height : parent.height + leftPadding : Variables.defaultMargin * 2 + rightPadding : Variables.defaultMargin * 2 + + Text { id : _usbFileNameText + clip : true + width : _contentRect.columnWidthFileName + height : parent.height + text : fileName + color : Colors.textMain + font.pixelSize : Fonts.fontPixelTextRectExtra + verticalAlignment : Text.AlignVCenter + } + + Text { id : _usbFileSizeText + clip : true + width : _contentRect.columnWidthFileSize + height : parent.height + text : Variables.sizeConverted( fileSize, 1000, 3) + color : Colors.textMain + font.pixelSize : Fonts.fontPixelTextRectExtra + verticalAlignment : Text.AlignVCenter + } + } + + Line { id: _usbDivider + color : Colors.panelBorderColor + visible : index !== _usbFolderView.count - 1 + anchors { + bottom : parent.bottom + left : parent.left + leftMargin : Variables.defaultMargin * 2 + right : parent.right + rightMargin : Variables.defaultMargin * 2 + } + } } - Text { id : _usbFileSizeText - clip : true - width : _contentRect.columnWidthFileSize - text : Variables.sizeConverted( fileSize, 1000, 3) - color : Colors.textMain - font.pixelSize : Fonts.fontPixelTextRectExtra - verticalAlignment : Text.AlignVCenter - horizontalAlignment : Text.AlignRight - } } + + ScrollBar { + anchors.fill : _usbFolderView + flickable : _usbFolderView + handleWidth : Variables.settingsExportLogsScrollBarWidth + scrollColor : Colors.scrollBarColor + } } - model : _usbFolderModel - delegate : _usbFileDelegate } } } - } } }