<commit_before>// ekke (<NAME>) @ekkescorner
import QtQuick 2.9
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.2
import QtGraphicalEffects 1.0
import "../common"
import "../popups"
import org.ekkescorner.btle 1.0

Page {
    id: btRunGeneralScanPage
    property MyBluetoothDeviceInfo deviceInfo
    property bool isSearchRunning: discoverDevicesPopup.isActive

    focus: true
    property string name: "BTRunGeneralScanPage"

    header: Pane {
        leftPadding: 24
        rightPadding: 8
        Material.elevation: 4
        RowLayout {
            width: appWindow.width - 32
            Column {
                Layout.fillWidth: true
                Row {
                    spacing: 6
                    IconActive {
                        imageName: "barcode.png"
                        anchors.verticalCenter: parent.verticalCenter
                    }
                    LabelHeadline {
                        text: deviceInfo? deviceInfo.deviceName : qsTr("no device")
                        color: primaryColor
                        wrapMode: Label.WordWrap
                        maximumLineCount: 2
                        elide: Label.ElideRight
                        anchors.verticalCenter: parent.verticalCenter
                    } // name
                    ButtonFlat {
                        visible: !deviceInfo
                        text: qsTr("Search Device")
                        textColor: accentColor
                        textAlignment: Text.AlignRight
                        anchors.verticalCenter: parent.verticalCenter
                        onClicked: {
                            btRunGeneralScanPage.searchDevice()
                        }
                    } // search devices button
                } // first row
                Row {
                    visible: deviceInfo
                    Column {
                        width: appWindow.width - 32 - 160 - 12
                        anchors.verticalCenter: parent.verticalCenter
                        LabelSubheading {
                            visible: Qt.platform.os != "ios" && !appWindow.isSmallDevice
                            width: parent.width
                            text: deviceInfo? deviceInfo.deviceAddress : ""
                            wrapMode: Label.WrapAtWordBoundaryOrAnywhere
                            maximumLineCount: 2
                            elide: Label.ElideRight
                        } // address
                        LabelBody {
                            visible: Qt.platform.os == "ios" || appWindow.isSmallDevice
                            width: parent.width
                            text: deviceInfo? deviceInfo.deviceAddress : ""
                            wrapMode: Label.WrapAtWordBoundaryOrAnywhere
                            maximumLineCount: 3
                            elide: Label.ElideRight
                        } // address
                        LabelBody {
                            width: parent.width
                            text: deviceInfo? deviceInfo.controllerStateDescription : ""
                            wrapMode: Label.WordWrap
                            maximumLineCount: 2
                            elide: Label.ElideRight
                        } // address
                    }
                    // retry if services hang in discovering
                    ButtonFlat {
                        visible: deviceInfo
                        width: 160
                        text: scanManager.featuresPrepared? qsTr("Disconnect") : qsTr("Initialize")
                        textColor: accentColor
                        textAlignment: Text.AlignRight
                        anchors.verticalCenter: parent.verticalCenter
                        anchors.verticalCenterOffset: 12
                        onClicked: {
                            if(scanManager.featuresPrepared) {
                                btRunGeneralScanPage.showDisconnectMessage = false
                                btRunGeneralScanPage.disconnectFromDevice()
                            } else {
                                // search the device, connect and create expected services if needed
                                btRunGeneralScanPage.searchDevice()
                            }
                        }
                    } // connect disconnect button
                } // 2nd row
            }// header main col
            DotMarker {
                width: 12
                height: 12
                color: deviceInfo? (deviceInfo.deviceIsConnected? "green":"red") : "transparent"
                anchors.rightMargin: 0
                anchors.bottom: undefined
                anchors.bottomMargin: undefined
                anchors.top: parent.top
            } // indicator top-right at row
        } // header row layout
    } // header pane

    Flickable {
        id: flickable
        contentHeight: root.implicitHeight + 60
        anchors.fill: parent
        Pane {
            id: root
            anchors.fill: parent
            ColumnLayout {
                Layout.fillWidth: true
                anchors.right: parent.right
                anchors.left: parent.left
                RowLayout {
                    Layout.leftMargin: 16
                    Layout.rightMargin: 16
                    Layout.bottomMargin: 12
                    ItemDelegate {
                        id: btSettingsMenuButton
                        anchors.top: parent.top
                        anchors.right: parent.right
                        visible: scanManager.featuresPrepared || (deviceInfo && deviceInfo.controllerState >=3)
                        focusPolicy: Qt.NoFocus
                        Image {
                            opacity: 0.6
                            anchors.centerIn: parent
                            source: "qrc:/images/black/more_vert.png"
                        }
                        onClicked: {
                            openSettingsMenu()
                        }
                    } // btSettingsMenuButton
                } // battery level
                RowLayout {
                    Layout.leftMargin: 16
                    Layout.rightMargin: 16
                    LabelSubheading {
                        Layout.alignment: Qt.AlignTop
                        Layout.preferredWidth: 1
                        text: qsTr("Barcode")
                        color: primaryColor
                    }
                    LabelSubheading {
                        id: theBarcodeValueField
                        Layout.alignment: Qt.AlignTop
                        Layout.preferredWidth: 3
                        leftPadding: 16
                        rightPadding: 10
                        wrapMode: Text.WrapAnywhere
                        text:scanManager.barcodeValue.length >0 ? scanManager.barcodeValue : qsTr("no barcode")
                    }
                } // key
                RowLayout {
                    visible: scanManager.scanNotificationsActive
                    Layout.leftMargin: 16
                    Layout.rightMargin: 16
                    Layout.bottomMargin: 12
                    LabelSubheading {
                        Layout.alignment: Qt.AlignTop
                        Layout.preferredWidth: 1
                        text: " "
                        color: primaryColor
                    }
                    ProgressBar {
                        id: commandProgressBar
                        Layout.preferredWidth: 3
                        Layout.fillWidth: true
                        leftPadding: 16
                        rightPadding: 10
                        indeterminate: true
                    }
                }
            } // main column
        } // root pane
    } // flickable
<commit_msg>UI device info characteristics<commit_after>// ekke (<NAME>) @ekkescorner
import QtQuick 2.9
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.2
import QtGraphicalEffects 1.0
import "../common"
import "../popups"
import org.ekkescorner.btle 1.0

Page {
    id: btRunGeneralScanPage
    property MyBluetoothDeviceInfo deviceInfo
    property bool isSearchRunning: discoverDevicesPopup.isActive

    focus: true
    property string name: "BTRunGeneralScanPage"

    header: Pane {
        leftPadding: 24
        rightPadding: 8
        Material.elevation: 4
        RowLayout {
            width: appWindow.width - 32
            Column {
                Layout.fillWidth: true
                Row {
                    spacing: 6
                    IconActive {
                        imageName: "barcode.png"
                        anchors.verticalCenter: parent.verticalCenter
                    }
                    LabelHeadline {
                        text: deviceInfo? deviceInfo.deviceName : qsTr("no device")
                        color: primaryColor
                        wrapMode: Label.WordWrap
                        maximumLineCount: 2
                        elide: Label.ElideRight
                        anchors.verticalCenter: parent.verticalCenter
                    } // name
                    ButtonFlat {
                        visible: !deviceInfo
                        text: qsTr("Search Device")
                        textColor: accentColor
                        textAlignment: Text.AlignRight
                        anchors.verticalCenter: parent.verticalCenter
                        onClicked: {
                            btRunGeneralScanPage.searchDevice()
                        }
                    } // search devices button
                } // first row
                Row {
                    visible: deviceInfo
                    Column {
                        width: appWindow.width - 32 - 160 - 12
                        anchors.verticalCenter: parent.verticalCenter
                        LabelSubheading {
                            visible: Qt.platform.os != "ios" && !appWindow.isSmallDevice
                            width: parent.width
                            text: deviceInfo? deviceInfo.deviceAddress : ""
                            wrapMode: Label.WrapAtWordBoundaryOrAnywhere
                            maximumLineCount: 2
                            elide: Label.ElideRight
                        } // address
                        LabelBody {
                            visible: Qt.platform.os == "ios" || appWindow.isSmallDevice
                            width: parent.width
                            text: deviceInfo? deviceInfo.deviceAddress : ""
                            wrapMode: Label.WrapAtWordBoundaryOrAnywhere
                            maximumLineCount: 3
                            elide: Label.ElideRight
                        } // address
                        LabelBody {
                            width: parent.width
                            text: deviceInfo? deviceInfo.controllerStateDescription : ""
                            wrapMode: Label.WordWrap
                            maximumLineCount: 2
                            elide: Label.ElideRight
                        } // address
                    }
                    // retry if services hang in discovering
                    ButtonFlat {
                        visible: deviceInfo
                        width: 160
                        text: scanManager.featuresPrepared? qsTr("Disconnect") : qsTr("Initialize")
                        textColor: accentColor
                        textAlignment: Text.AlignRight
                        anchors.verticalCenter: parent.verticalCenter
                        anchors.verticalCenterOffset: 12
                        onClicked: {
                            if(scanManager.featuresPrepared) {
                                btRunGeneralScanPage.showDisconnectMessage = false
                                btRunGeneralScanPage.disconnectFromDevice()
                            } else {
                                // search the device, connect and create expected services if needed
                                btRunGeneralScanPage.searchDevice()
                            }
                        }
                    } // connect disconnect button
                } // 2nd row
            }// header main col
            DotMarker {
                width: 12
                height: 12
                color: deviceInfo? (deviceInfo.deviceIsConnected? "green":"red") : "transparent"
                anchors.rightMargin: 0
                anchors.bottom: undefined
                anchors.bottomMargin: undefined
                anchors.top: parent.top
            } // indicator top-right at row
        } // header row layout
    } // header pane

    Flickable {
        id: flickable
        contentHeight: root.implicitHeight + 60
        anchors.fill: parent
        Pane {
            id: root
            anchors.fill: parent
            ColumnLayout {
                Layout.fillWidth: true
                anchors.right: parent.right
                anchors.left: parent.left
                RowLayout {
                    Layout.leftMargin: 16
                    Layout.rightMargin: 16
                    Layout.bottomMargin: 12
                    ItemDelegate {
                        id: btSettingsMenuButton
                        //anchors.top: parent.top
                        //anchors.right: parent.right
                        Layout.fillWidth: true
                        visible: scanManager.featuresPrepared || (deviceInfo && deviceInfo.controllerState >=3)
                        focusPolicy: Qt.NoFocus
                        Image {
                            width: 48
                            height: 48
                            anchors.left: parent.left
                            source: "qrc:/images/extra/ring_scanner.png"
                        }
                        Image {
                            opacity: 0.6
                            anchors.right: parent.right
                            source: "qrc:/images/black/more_vert.png"
                        }
                        onClicked: {
                            openSettingsMenu()
                        }
                    } // btSettingsMenuButton
                } // battery level
                RowLayout {
                    Layout.leftMargin: 16
                    Layout.rightMargin: 16
                    LabelSubheading {
                        Layout.alignment: Qt.AlignTop
                        Layout.preferredWidth: 1
                        text: qsTr("Barcode")
                        color: primaryColor
                    }
                    LabelSubheading {
                        id: theBarcodeValueField
                        Layout.alignment: Qt.AlignTop
                        Layout.preferredWidth: 3
                        leftPadding: 16
                        rightPadding: 10
                        wrapMode: Text.WrapAnywhere
                        text:scanManager.barcodeValue.length >0 ? scanManager.barcodeValue : qsTr("no barcode")
                    }
                } // key
                RowLayout {
                    visible: scanManager.scanNotificationsActive
                    Layout.leftMargin: 16
                    Layout.rightMargin: 16
                    Layout.bottomMargin: 12
                    LabelSubheading {
                        Layout.alignment: Qt.AlignTop
                        Layout.preferredWidth: 1
                        text: " "
                        color: primaryColor
                    }
                    ProgressBar {
                        id: commandProgressBar
                        Layout.preferredWidth: 3
                        Layout.fillWidth: true
                        leftPadding: 16
                        rightPadding: 10
                        indeterminate: true
                    }
                }
                RowLayout {
                    Layout.leftMargin: 16
                    Layout.rightMargin: 16
                    LabelBodySecondary {
                        Layout.alignment: Qt.AlignTop
                        Layout.preferredWidth: 1
                        wrapMode: Text.WrapAnywhere
                        text: qsTr("Manufacturer")
                    }
                    LabelBody {
                        Layout.alignment: Qt.AlignTop
                        Layout.preferredWidth: 1
                        leftPadding: 16
                        rightPadding: 10
                        wrapMode: Text.WrapAnywhere
                        text:scanManager.manufacturerNameValue
                    }
                } // manufacturer
                RowLayout {
                    Layout.leftMargin: 16
                    Layout.rightMargin: 16
                    LabelBodySecondary {
                        Layout.alignment: Qt.AlignTop
                        Layout.preferredWidth: 1
                        wrapMode: Text.WrapAnywhere
                        text: qsTr("Model")
                    }
                    LabelBody {
                        Layout.alignment: Qt.AlignTop
                        Layout.preferredWidth: 1
                        leftPadding: 16
                        rightPadding: 10
                        wrapMode: Text.WrapAnywhere
                        text:scanManager.modelNumberValue
                    }
                } // model number
                RowLayout {
                    Layout.leftMargin: 16
                    Layout.rightMargin: 16
                    LabelBodySecondary {
                        Layout.alignment: Qt.AlignTop
                        Layout.preferredWidth: 1
                        wrapMode: Text.WrapAnywhere
                        text: qsTr("S/N")
                    }
                    LabelBody {
                        Layout.alignment: Qt.AlignTop
                        Layout.preferredWidth: 1
                        leftPadding: 16
                        rightPadding: 10
                        wrapMode: Text.WrapAnywhere
                        text:scanManager.serialNumberValue
                    }
                } // serial number
                RowLayout {
                    Layout.leftMargin: 16
                    Layout.rightMargin: 16
                    LabelBodySecondary {
                        Layout.alignment: Qt.AlignTop
                        Layout.preferredWidth: 1
                        wrapMode: Text.WrapAnywhere
                        text: qsTr("Hardware Revision")
                    }
                    LabelBody {
                        Layout.alignment: Qt.AlignTop
                        Layout.preferredWidth: 1
                        leftPadding: 16
                        rightPadding: 10
                        wrapMode: Text.WrapAnywhere
                        text:scanManager.hardwareRevisionValue
                    }
                } // hw revision
                RowLayout {
                    Layout.leftMargin: 16
                    Layout.rightMargin: 16
                    LabelBodySecondary {
                        Layout.alignment: Qt.AlignTop
                        Layout.preferredWidth: 1
                        wrapMode: Text.WrapAnywhere
                        text: qsTr("Firmware Revision")
                    }
                    LabelBody {
                        Layout.alignment: Qt.AlignTop
                        Layout.preferredWidth: 1
                        leftPadding: 16
                        rightPadding: 10
                        wrapMode: Text.WrapAnywhere
                        text:scanManager.firmwareRevisionValue
                    }
                } // fw revision
                RowLayout {
                    Layout.leftMargin: 16
                    Layout.rightMargin: 16
                    LabelBodySecondary {
                        Layout.alignment: Qt.AlignTop
                        Layout.preferredWidth: 1
                        wrapMode: Text.WrapAnywhere
                        text: qsTr("Software Revision")
                    }
                    LabelBody {
                        Layout.alignment: Qt.AlignTop
                        Layout.preferredWidth: 1
                        leftPadding: 16
                        rightPadding: 10
                        wrapMode: Text.WrapAnywhere
                        text:scanManager.softwareRevisionValue
                    }
                } // sw revision
                RowLayout {
                    Layout.leftMargin: 16
                    Layout.rightMargin: 16
                    LabelBodySecondary {
                        Layout.alignment: Qt.AlignTop
                        Layout.preferredWidth: 1
                        wrapMode: Text.WrapAnywhere
                        text: qsTr("System Id")
                    }
                    LabelBody {
                        Layout.alignment: Qt.AlignTop
                        Layout.preferredWidth: 1
                        leftPadding: 16
                        rightPadding: 10
                        wrapMode: Text.WrapAnywhere
                        text:scanManager.systemIdValue
                    }
                } // sw revision
            } // main column
        } // root pane
    } // flickable

{'fraction_non_alphanumeric': 0.053594649823518484, 'fraction_numerical': 0.010403120936280884, 'mean_word_length': 0.8586965904186448, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1662525', 'n_tokens_mistral': 4754, 'n_tokens_neox': 4161, 'n_words': 923}