Przeglądaj źródła

ui: Add button with camera status.

Pavel Machek 2 miesięcy temu
rodzic
commit
9e4b760b77
2 zmienionych plików z 14 dodań i 0 usunięć
  1. 9 0
      data/camera.ui
  2. 5 0
      src/main.c

+ 9 - 0
data/camera.ui

@@ -87,6 +87,15 @@
                             </style>
                           </object>
                         </child>
+                        <child>
+                          <object class="GtkButton" id="status-button">
+                            <property name="valign">start</property>
+                            <style>
+                              <class name="flat"/>
+                              <class name="control"/>
+                            </style>
+                          </object>
+                        </child>
                       </object>
                     </child>
                     <child>

+ 5 - 0
src/main.c

@@ -72,6 +72,7 @@ GtkWidget *iso_button;
 GtkWidget *shutter_button;
 GtkWidget *focus_button;
 GtkWidget *flash_button;
+GtkWidget *status_button;
 
 LfbEvent *capture_event;
 static GtkWidget *movie;
@@ -234,6 +235,8 @@ update_state(const mp_state_main *new_state)
         // Even if there's no flash led/v4l, it'll just default to using the screen
         // as flash, so always enable this button
         gtk_widget_set_visible(flash_button, true);
+        gtk_widget_set_visible(status_button, true);
+        gtk_button_set_label(GTK_BUTTON(status_button), "(st)");
 
         return false;
 }
@@ -1316,6 +1319,8 @@ activate(GtkApplication *app, gpointer data)
                 GTK_WIDGET(gtk_builder_get_object(builder, "focus-controls-button"));
         flash_button =
                 GTK_WIDGET(gtk_builder_get_object(builder, "flash-controls-button"));
+        status_button =
+                GTK_WIDGET(gtk_builder_get_object(builder, "status-button"));
         GtkWidget *setting_dng_button =
                 GTK_WIDGET(gtk_builder_get_object(builder, "setting-raw"));
         GtkWidget *setting_postprocessor_combo =