Refactor controls
This commit is contained in:
23
src/main.c
23
src/main.c
@@ -48,8 +48,6 @@ RENDERDOC_API_1_1_2 *rdoc_api = NULL;
|
||||
|
||||
mp_state_main state;
|
||||
|
||||
static bool camera_is_initialized = false;
|
||||
|
||||
static MPProcessPipelineBuffer *current_preview_buffer = NULL;
|
||||
|
||||
static char last_path[260] = "";
|
||||
@@ -65,7 +63,11 @@ GtkWidget *process_spinner;
|
||||
GtkWidget *scanned_codes;
|
||||
GtkWidget *preview_top_box;
|
||||
GtkWidget *preview_bottom_box;
|
||||
|
||||
GtkWidget *flash_button;
|
||||
GtkWidget *iso_button;
|
||||
GtkWidget *shutter_button;
|
||||
|
||||
LfbEvent *capture_event;
|
||||
|
||||
GSettings *settings;
|
||||
@@ -106,16 +108,14 @@ update_io_pipeline()
|
||||
mp_io_pipeline_update_state(&io_state);
|
||||
|
||||
// Make the right settings available for the camera
|
||||
gtk_widget_set_visible(flash_button, state.flash_enabled);
|
||||
gtk_widget_set_visible(flash_button, state.control_flash);
|
||||
gtk_widget_set_visible(iso_button, state.control_gain);
|
||||
gtk_widget_set_visible(shutter_button, state.control_exposure);
|
||||
}
|
||||
|
||||
static bool
|
||||
update_state(const mp_state_main *new_state)
|
||||
{
|
||||
if (!camera_is_initialized) {
|
||||
camera_is_initialized = true;
|
||||
}
|
||||
|
||||
if (state.camera == new_state->camera) {
|
||||
state.gain_is_manual = new_state->gain_is_manual;
|
||||
state.gain = new_state->gain;
|
||||
@@ -131,6 +131,11 @@ update_state(const mp_state_main *new_state)
|
||||
|
||||
state.preview_buffer_width = new_state->preview_buffer_width;
|
||||
state.preview_buffer_height = new_state->preview_buffer_height;
|
||||
|
||||
state.control_gain = new_state->control_gain;
|
||||
state.control_exposure = new_state->control_exposure;
|
||||
state.control_focus = new_state->control_focus;
|
||||
state.control_flash = new_state->control_flash;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1121,9 +1126,9 @@ activate(GtkApplication *app, gpointer data)
|
||||
"/org/postmarketos/Megapixels/camera.ui");
|
||||
|
||||
GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder, "window"));
|
||||
GtkWidget *iso_button =
|
||||
iso_button =
|
||||
GTK_WIDGET(gtk_builder_get_object(builder, "iso-controls-button"));
|
||||
GtkWidget *shutter_button = GTK_WIDGET(
|
||||
shutter_button = GTK_WIDGET(
|
||||
gtk_builder_get_object(builder, "shutter-controls-button"));
|
||||
flash_button =
|
||||
GTK_WIDGET(gtk_builder_get_object(builder, "flash-controls-button"));
|
||||
|
Reference in New Issue
Block a user