Skip to content

Commit

Permalink
A ton of things:
Browse files Browse the repository at this point in the history
1) async 'interface' for qml -> cpp param -> qml
2) Generic UI element for mavlink int-choices
3) Use this UI element in the sidebar where appropriate
  • Loading branch information
Consti10 committed Feb 11, 2024
1 parent 2327ab1 commit 62bffce
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 35 deletions.
81 changes: 49 additions & 32 deletions qml/ui/sidebar/MavlinkIntChoiceElement.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,47 @@ BaseJoyEditElement{

ListModel{
id: elements_model_brightness
ListElement {value: 0; verbose:"0"}
ListElement {value: 25; verbose:"25"}
ListElement {value: 50; verbose:"50"}
ListElement {value: 75; verbose:"75"}
ListElement {value: 100; verbose:"100\n(Default)"}
ListElement {value: 125; verbose:"125"}
ListElement {value: 150; verbose:"150"}
ListElement {value: 175; verbose:"175"}
ListElement {value: 200; verbose:"200"}
ListElement {value: 0; verbose:"0%"}
ListElement {value: 25; verbose:"25%"}
ListElement {value: 50; verbose:"50%"}
ListElement {value: 75; verbose:"75%"}
ListElement {value: 100; verbose:"100%\n(Default)"}
ListElement {value: 125; verbose:"125%"}
ListElement {value: 150; verbose:"150%"}
ListElement {value: 175; verbose:"175%"}
ListElement {value: 200; verbose:"200%"}
}
ListModel{
id: elements_model_saturation
ListElement {value: 50; verbose:"50"}
ListElement {value: 75; verbose:"75"}
ListElement {value: 100; verbose:"100\n(Default)"}
ListElement {value: 125; verbose:"125"}
ListElement {value: 150; verbose:"150"}
ListElement {value: 50; verbose:"50%"}
ListElement {value: 75; verbose:"75%"}
ListElement {value: 100; verbose:"100%\n(Default)"}
ListElement {value: 125; verbose:"125%"}
ListElement {value: 150; verbose:"150%"}
}
ListModel{
id: elements_model_contrast
ListElement {value: 50; verbose:"50%"}
ListElement {value: 75; verbose:"75%"}
ListElement {value: 100; verbose:"100%\n(Default)"}
ListElement {value: 125; verbose:"125%"}
ListElement {value: 150; verbose:"150%"}
}
ListModel{
id: elements_model_sharpness
ListElement {value: 50; verbose:"50%"}
ListElement {value: 75; verbose:"75%"}
ListElement {value: 100; verbose:"100%\n(Default)"}
ListElement {value: 125; verbose:"125%"}
ListElement {value: 150; verbose:"150%"}
}
ListModel{
id: elements_model_rotation
ListElement {value: 50; verbose:"50"}
ListElement {value: 75; verbose:"75"}
ListElement {value: 100; verbose:"100\n(Default)"}
ListElement {value: 125; verbose:"125"}
ListElement {value: 150; verbose:"150"}
ListElement {value: 50; verbose:"50%"}
ListElement {value: 75; verbose:"75%"}
ListElement {value: 100; verbose:"100%\n(Default)"}
ListElement {value: 125; verbose:"125%"}
ListElement {value: 150; verbose:"150%"}
}
ListModel{
id: elements_model_on_off
Expand All @@ -53,23 +69,16 @@ BaseJoyEditElement{
id: elements_model_air_recording
ListElement {value: 0; verbose:"ALWAYS\nOFF"}
ListElement {value: 1; verbose:"ALWAYS\nON"}
ListElement {value: 2; verbose:"AUTO\n(IF ARMED)"}
ListElement {value: 2; verbose:"AUTO\n(WHEN ARMED)"}
}
ListModel{
id: elements_model_hotspot
ListElement {value: 0; verbose:"ALWAYS\nOFF"}
ListElement {value: 1; verbose:"ALWAYS\nON"}
ListElement {value: 2; verbose:"AUTO\n(IF DISARMED)"}
}
ListModel{
id: elements_model_contrast
ListElement {value: 50; verbose:"50"}
ListElement {value: 75; verbose:"75"}
ListElement {value: 100; verbose:"100\n(Default)"}
ListElement {value: 125; verbose:"125"}
ListElement {value: 150; verbose:"150"}
ListElement {value: 2; verbose:"AUTO\n(WHEN DISARMED)"}
}


ListModel{
id: elements_model_undefined
ListElement {value: 0; verbose:"0\nUNDEFINED"}
Expand All @@ -84,8 +93,12 @@ BaseJoyEditElement{
function get_model(){
if(m_param_id=="BRIGHTNESS"){
return elements_model_brightness;
}else if(m_param_id=="SATURATION_LC"){
}else if(m_param_id=="SATURATION"){
return elements_model_saturation;
}else if(m_param_id=="CONTRAST"){
return elements_model_contrast;
}else if(m_param_id=="SHARPNESS"){
return elements_model_sharpness;
}else if(m_param_id=="ROTATION"){
return elements_model_rotation;
}else if(m_param_id=="ENABLE_JOY_RC"){
Expand All @@ -94,8 +107,6 @@ BaseJoyEditElement{
return elements_model_air_recording;
}else if(m_param_id=="WIFI_HOTSPOT_E"){
return elements_model_hotspot
}else if(m_param_id=="CONTRAST_LC"){
return elements_model_contrast;
}
return elements_model_undefined;
}
Expand All @@ -112,6 +123,12 @@ BaseJoyEditElement{
populate();
}
}
property bool m_has_params_fetched: m_settings_model.has_params_fetched
onM_has_params_fetchedChanged: {
if(visible){
populate();
}
}

function populate(){
// First, check if the system is alive
Expand Down
11 changes: 8 additions & 3 deletions qml/ui/sidebar/SideBarMain.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Item {


property int secondaryUiWidth: 335
property int secondaryUiHeight: 375
property int secondaryUiHeight: 420
property string secondaryUiColor: "#000"
property real secondaryUiOpacity: 0.75
property string mainDarkColor: "#302f30"
Expand Down Expand Up @@ -596,12 +596,17 @@ Item {
}
MavlinkIntChoiceElement{
m_title: "SATURATION"
m_param_id: "SATURATION_LC"
m_param_id: "SATURATION"
m_settings_model: _airCameraSettingsModel
}
MavlinkIntChoiceElement{
m_title: "CONTRAST"
m_param_id: "CONTRAST_LC"
m_param_id: "CONTRAST"
m_settings_model: _airCameraSettingsModel
}
MavlinkIntChoiceElement{
m_title: "SHARPNESS"
m_param_id: "SHARPNESS"
m_settings_model: _airCameraSettingsModel
}
}
Expand Down

0 comments on commit 62bffce

Please sign in to comment.