Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions src/Plugins/Tools/Signals/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
apx_plugin(SRCS "*.qml")
set(QRC_QML
ColorChoiceFact.qml
ColorChooser.qml
FilterBase.qml
FilterFact.qml
FilterKalman.qml
FilterRegistry.qml
FilterRunningAverage.qml
MenuItem.qml
MenuPage.qml
MenuSet.qml
MenuSets.qml
PageButton.qml
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PageButton.qml is included in QRC_QML, but it is not referenced anywhere in the repo (no PageButton usages found). If it’s truly unused, removing it from the resource list (and deleting the file) will avoid shipping dead UI variants and reduce maintenance overhead.

Suggested change
PageButton.qml

Copilot uses AI. Check for mistakes.
SignalButton.qml
Signals.qml
SignalsModel.qml
SignalsPlugin.qml
SignalsView.qml
)

apx_qrc(${MODULE} PREFIX ${MODULE} SRCS "*.qml")
apx_plugin(SRCS ${QRC_QML})

apx_qrc(${MODULE} PREFIX ${MODULE} SRCS ${QRC_QML})
42 changes: 42 additions & 0 deletions src/Plugins/Tools/Signals/ColorChoiceFact.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* APX Autopilot project <http://docs.uavos.com>
*
* Copyright (c) 2003-2020, Aliaksei Stratsilatau <sa@uavos.com>
* All rights reserved
*
* This file is part of APX Ground Control.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick

import APX.Facts

Fact {
id: colorFact

property bool isColorChoice: true
property var itemOwner: null
property string colorValue: ""

flags: Fact.CloseOnTrigger
opts: ({
"editor": Qt.resolvedUrl("ColorChooser.qml")
})

onTriggered: {
if (itemOwner && typeof itemOwner.setColorValue === "function")
itemOwner.setColorValue(colorValue)
}
}
59 changes: 59 additions & 0 deletions src/Plugins/Tools/Signals/ColorChooser.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* APX Autopilot project <http://docs.uavos.com>
*
* Copyright (c) 2003-2020, Aliaksei Stratsilatau <sa@uavos.com>
* All rights reserved
*
* This file is part of APX Ground Control.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick
import QtQuick.Controls.Material

Rectangle {
id: editor

readonly property string colorText: fact && fact.colorValue !== undefined
? String(fact.colorValue).trim().toUpperCase()
: (fact && fact.itemOwner && fact.itemOwner.colorValue !== undefined
? String(fact.itemOwner.colorValue).trim().toUpperCase()
: "")
readonly property bool selected: fact && fact.itemOwner
&& fact.itemOwner.colorValue === colorText

implicitHeight: factButton.height * 0.6
implicitWidth: factButton.height * 1.8
radius: height / 5
border.width: selected ? 2 : 1
border.color: selected ? "white" : "#66000000"
color: colorText !== "" ? colorText : "transparent"

Rectangle {
anchors.fill: parent
anchors.margins: 3
visible: colorText === ""
radius: parent.radius - 1
color: "transparent"
border.width: 1
border.color: Material.hintTextColor

Text {
anchors.centerIn: parent
text: qsTr("A")
font: apx.font_narrow(Math.max(10, parent.height * 0.55))
color: Material.hintTextColor
}
}
}
99 changes: 99 additions & 0 deletions src/Plugins/Tools/Signals/FilterBase.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
* APX Autopilot project <http://docs.uavos.com>
*
* Copyright (c) 2003-2020, Aliaksei Stratsilatau <sa@uavos.com>
* All rights reserved
*
* This file is part of APX Ground Control.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick

import APX.Facts

Fact {
id: filterSettingsFact

property var data: ({})
property string filterType: ""
property string filterTitle: ""
property string detailsText: ""
property real outputValue: 0

flags: (Fact.Group | Fact.Section)
title: filterTitle
descr: detailsText

Component.onCompleted: load(data)

function asNumber(value, fallback)
{
var number = Number(value)
return isFinite(number) ? number : fallback
}

function clamp(value, minValue, maxValue)
{
return Math.max(minValue, Math.min(maxValue, value))
}

function normalizedInput(inputValue)
{
return asNumber(inputValue, 0)
}

function passThrough(inputValue)
{
outputValue = normalizedInput(inputValue)
return outputValue
}

function load(filterData)
{
var source = filterData && typeof filterData === "object" ? filterData : {}
loadParameters(source)
reset()
}

function save()
{
var filterData = saveParameters()
if (!filterData || filterData instanceof Array || typeof filterData !== "object")
filterData = {}

filterData.type = filterType
return filterData
}

function loadParameters(filterData)
{
}

function saveParameters()
{
return ({})
}

function reset()
{
outputValue = 0
}

// Each concrete filter updates its own state and returns the latest output.
function update(inputValue)
{
return passThrough(inputValue)
}
}
Loading
Loading