Skip to content

Commit

Permalink
Down the Rabbit hole, fixing more ui bugs (#711)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelscholle authored Jul 27, 2024
1 parent 2c0cd23 commit 9341c9a
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 50 deletions.
44 changes: 27 additions & 17 deletions qml/ui/configpopup/openhd_settings/ChooseCameraDialoque.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Card {
anchors.centerIn: parent
cardName: "Camera Selection"
cardNameColor: "black"
visible: true
visible: false

property int m_platform_type: 0;

Expand Down Expand Up @@ -53,9 +53,9 @@ Card {

var success= false;
if(m_is_for_secondary_camera){
success=_airCameraSettingsModel2.try_update_parameter_int("CAMERA_TYPE",openhd_core_cam_type)=="";
success=_airCameraSettingsModel2.try_update_parameter_int("CAMERA_TYPE",openhd_core_cam_type)=="";
}else{
success=_airCameraSettingsModel.try_update_parameter_int("CAMERA_TYPE",openhd_core_cam_type)=="";
success=_airCameraSettingsModel.try_update_parameter_int("CAMERA_TYPE",openhd_core_cam_type)=="";
}
if(!success){
_qopenhd.show_toast("Cannot save, please try again");
Expand Down Expand Up @@ -140,19 +140,19 @@ Card {
m_user_selected_camera_type=combobox_cameras.model.get(combobox_cameras.currentIndex).value;
}

cardBody: Column {
cardBody: Column{
padding: 10
spacing: 10
Text {
Text{
width: 300
text: "Your AIR Platform: " + get_platform_name();
text: "Your AIR Platform: "+get_platform_name();
}
ComboBox {
width: 300
id: comboBoxManufacturers
model: model_manufacturers
textRole: "title"
implicitWidth: elementComboBoxWidth
implicitWidth: elementComboBoxWidth
currentIndex: 0
onActivated: {
populate_main_camera_selector();
Expand All @@ -163,25 +163,33 @@ Card {
id: combobox_cameras
model: model_cameras_for_this_manufacturer
textRole: "title"
implicitWidth: elementComboBoxWidth
implicitWidth: elementComboBoxWidth
currentIndex: 0
onActivated: {
m_user_selected_camera_type = model.get(currentIndex).value;
m_user_selected_camera_type=model.get(currentIndex).value;
}
}
Text {
Text{
width: 300
text: "NOTE: Changing your camera automatically\nreboots your air unit";
visible: button_save.enabled
font.pixelSize: 13

}
}
hasFooter: true
cardFooter: Item {
anchors.fill: parent
Item {
anchors.fill: parent
anchors.top: parent.top
anchors.topMargin: 285

Rectangle {
width: parent.width
height: parent.height
color: "transparent"

RowLayout {
anchors.horizontalCenter: parent.horizontalCenter
spacing: 20
anchors.centerIn: parent

Button {
Layout.preferredWidth: 150
Expand All @@ -190,17 +198,19 @@ Card {
close();
}
}

Button {
id: button_save
Layout.preferredWidth: 150
text: "SAVE"
onPressed: {
on_user_clicked_save();
}
enabled: {
m_user_selected_camera_type >= 0 && m_user_selected_camera_type != (m_is_secondary_cam ? _cameraStreamModelSecondary.camera_type : _cameraStreamModelPrimary.camera_type);
}
enabled: m_user_selected_camera_type >= 0 && m_user_selected_camera_type != (m_is_secondary_cam ? _cameraStreamModelSecondary.camera_type : _cameraStreamModelPrimary.camera_type)
}
}
}
}

}

75 changes: 42 additions & 33 deletions qml/ui/configpopup/openhd_settings/ChooseResolutionDialoque.qml
Original file line number Diff line number Diff line change
Expand Up @@ -168,46 +168,55 @@ Card {
}
}
hasFooter: true
cardFooter: Item {
Item {
anchors.fill: parent
RowLayout{
anchors.fill: parent

Button{
Layout.preferredWidth: 150
text: "CANCEL"
onPressed: {
close();
}
}
Button{
Layout.preferredWidth: 150
text: "SAVE"
onPressed: {
var success=false;
const selected_res_fps=get_user_selected_resolution();
console.log("Setting "+(m_is_for_secondary ? "CAM2" : "CAM1")+" to {"+selected_res_fps+"}");
if(m_is_for_secondary){
success=_airCameraSettingsModel2.try_update_parameter_string("RESOLUTION_FPS",selected_res_fps)===""
}else{
success=_airCameraSettingsModel.try_update_parameter_string("RESOLUTION_FPS",selected_res_fps)===""
}
if(success){
_messageBoxInstance.set_text_and_show("Saved "+selected_res_fps);
anchors.top: parent.top
anchors.topMargin: 285

Rectangle {
width: parent.width
height: parent.height
color: "transparent"

RowLayout {
anchors.centerIn: parent

Button {
Layout.preferredWidth: 150
text: "CANCEL"
onPressed: {
close();
}else{
_messageBoxInstance.set_text_and_show("Failed,please try again");
}
}
enabled: {
if(argh_is_changing_model){
return false;
Button{
Layout.preferredWidth: 150
text: "SAVE"
onPressed: {
var success=false;
const selected_res_fps=get_user_selected_resolution();
console.log("Setting "+(m_is_for_secondary ? "CAM2" : "CAM1")+" to {"+selected_res_fps+"}");
if(m_is_for_secondary){
success=_airCameraSettingsModel2.try_update_parameter_string("RESOLUTION_FPS",selected_res_fps)===""
}else{
success=_airCameraSettingsModel.try_update_parameter_string("RESOLUTION_FPS",selected_res_fps)===""
}
if(success){
_messageBoxInstance.set_text_and_show("Saved "+selected_res_fps);
close();
}else{
_messageBoxInstance.set_text_and_show("Failed,please try again");
}
}
enabled: {
if(argh_is_changing_model){
return false;
}
const selected_res_fps=get_user_selected_resolution();
return _cameraStreamModelPrimary.is_valid_resolution_fps_string(selected_res_fps) && selected_res_fps!=m_current_resolution_fps;
}
const selected_res_fps=get_user_selected_resolution();
return _cameraStreamModelPrimary.is_valid_resolution_fps_string(selected_res_fps) && selected_res_fps!=m_current_resolution_fps;
}
}
}
}
}

}

0 comments on commit 9341c9a

Please sign in to comment.