kopia lustrzana https://github.com/windytan/slowrx
"clear" button
rodzic
ce8eb4942d
commit
f6b2b8a115
11
common.c
11
common.c
|
@ -105,7 +105,7 @@ void changeDevices() {
|
|||
gtk_widget_set_tooltip_text(gui.devstatusicon, "Device was opened, but doesn't support 44100 Hz");
|
||||
break;
|
||||
case -2:
|
||||
gtk_image_set_from_stock(GTK_IMAGE(gui.devstatusicon),GTK_STOCK_NO,GTK_ICON_SIZE_SMALL_TOOLBAR);
|
||||
gtk_image_set_from_stock(GTK_IMAGE(gui.devstatusicon),GTK_STOCK_DIALOG_ERROR,GTK_ICON_SIZE_SMALL_TOOLBAR);
|
||||
gtk_widget_set_tooltip_text(gui.devstatusicon, "Failed to open device");
|
||||
break;
|
||||
}
|
||||
|
@ -115,3 +115,12 @@ void changeDevices() {
|
|||
pthread_create (&thread1, NULL, Listen, NULL);
|
||||
|
||||
}
|
||||
|
||||
// Clear received picture & metadata
|
||||
void clearPix() {
|
||||
gdk_pixbuf_fill (DispPixbuf, 0);
|
||||
gtk_image_set_from_pixbuf(GTK_IMAGE(gui.RxImage), DispPixbuf);
|
||||
gtk_label_set_markup (GTK_LABEL(gui.idlabel), "");
|
||||
gtk_label_set_markup (GTK_LABEL(gui.utclabel), "");
|
||||
gtk_label_set_markup (GTK_LABEL(gui.lastmodelabel), "");
|
||||
}
|
||||
|
|
2
common.h
2
common.h
|
@ -50,6 +50,7 @@ struct _GuiObjs {
|
|||
GtkWidget *picdirentry;
|
||||
GtkWidget *browsebtn;
|
||||
GtkWidget *aboutdialog;
|
||||
GtkWidget *btnclear;
|
||||
};
|
||||
extern GuiObjs gui;
|
||||
|
||||
|
@ -120,5 +121,6 @@ void populateDeviceList ();
|
|||
void setNewRxDir ();
|
||||
void chooseDir ();
|
||||
void show_aboutdialog();
|
||||
void clearPix ();
|
||||
|
||||
#endif
|
||||
|
|
4
gui.c
4
gui.c
|
@ -45,17 +45,19 @@ void createGUI() {
|
|||
gui.devstatusicon = GTK_WIDGET(gtk_builder_get_object(builder,"devstatusicon"));
|
||||
gui.browsebtn = GTK_WIDGET(gtk_builder_get_object(builder,"browsebtn"));
|
||||
gui.picdirentry = GTK_WIDGET(gtk_builder_get_object(builder,"picdirentry"));
|
||||
gui.btnclear = GTK_WIDGET(gtk_builder_get_object(builder,"BtnClear"));
|
||||
|
||||
iconview = GTK_WIDGET(gtk_builder_get_object(builder,"SavedIconView"));
|
||||
|
||||
g_signal_connect (quititem, "activate", G_CALLBACK(delete_event), NULL);
|
||||
g_signal_connect (gui.mainwindow,"delete-event",G_CALLBACK(delete_event), NULL);
|
||||
g_signal_connect (gui.mainwindow, "delete-event", G_CALLBACK(delete_event), NULL);
|
||||
g_signal_connect (aboutitem, "activate", G_CALLBACK(show_aboutdialog), NULL);
|
||||
g_signal_connect_swapped(gui.togadapt, "toggled", G_CALLBACK(GetAdaptive), NULL);
|
||||
g_signal_connect (gui.btnstart, "clicked", G_CALLBACK(ManualStart), NULL);
|
||||
g_signal_connect (gui.btnabort, "clicked", G_CALLBACK(AbortRx), NULL);
|
||||
g_signal_connect (gui.cardcombo, "changed", G_CALLBACK(changeDevices), NULL);
|
||||
g_signal_connect (gui.browsebtn, "clicked", G_CALLBACK(chooseDir), NULL);
|
||||
g_signal_connect (gui.btnclear, "clicked", G_CALLBACK(clearPix), NULL);
|
||||
|
||||
savedstore = GTK_LIST_STORE(gtk_icon_view_get_model(GTK_ICON_VIEW(iconview)));
|
||||
|
||||
|
|
9
pcm.c
9
pcm.c
|
@ -27,9 +27,12 @@ void readPcm(gint numsamples) {
|
|||
if (samplesread < numsamples) {
|
||||
|
||||
if (samplesread == -EPIPE) printf("ALSA: buffer overrun\n");
|
||||
else if (samplesread == -EBADFD) printf("ALSA: PCM is not in the right state\n");
|
||||
else if (samplesread == -ESTRPIPE) printf("ALSA: a suspend event occurred\n");
|
||||
else if (samplesread < 0) printf("ALSA error %d\n", samplesread);
|
||||
else if (samplesread < 0) {
|
||||
printf("ALSA error %d (%s)\n", samplesread, snd_strerror(samplesread));
|
||||
gtk_widget_set_tooltip_text(gui.devstatusicon, "ALSA error");
|
||||
Abort = true;
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
else printf("Can't read %d samples\n", numsamples);
|
||||
|
||||
// On first appearance of error, update the status icon
|
||||
|
|
9
slowrx.c
9
slowrx.c
|
@ -72,6 +72,7 @@ void *Listen() {
|
|||
gdk_threads_enter ();
|
||||
gtk_widget_set_sensitive (gui.vugrid, true);
|
||||
gtk_widget_set_sensitive (gui.btnabort, false);
|
||||
gtk_widget_set_sensitive (gui.btnclear, true);
|
||||
gdk_threads_leave ();
|
||||
|
||||
HedrShift = 0;
|
||||
|
@ -81,12 +82,15 @@ void *Listen() {
|
|||
snd_pcm_start (pcm_handle);
|
||||
Abort = false;
|
||||
|
||||
do {
|
||||
|
||||
// Wait for VIS
|
||||
Mode = GetVIS();
|
||||
|
||||
// Stop listening on ALSA error
|
||||
if (Abort) pthread_exit(NULL);
|
||||
|
||||
if (Mode == 0) exit(EXIT_FAILURE);
|
||||
} while (Mode == 0);
|
||||
|
||||
printf(" ==== %s ====\n", ModeSpec[Mode].Name);
|
||||
|
||||
|
@ -117,6 +121,7 @@ void *Listen() {
|
|||
gtk_widget_set_sensitive (gui.manualframe, false);
|
||||
gtk_widget_set_sensitive (gui.cardcombo, false);
|
||||
gtk_widget_set_sensitive (gui.btnabort, true);
|
||||
gtk_widget_set_sensitive (gui.btnclear, false);
|
||||
gtk_statusbar_push (GTK_STATUSBAR(gui.statusbar), 0, "Receiving video..." );
|
||||
gtk_label_set_markup (GTK_LABEL(gui.lastmodelabel), ModeSpec[Mode].Name);
|
||||
gtk_label_set_markup (GTK_LABEL(gui.utclabel), rctime);
|
||||
|
@ -247,7 +252,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
gtk_main();
|
||||
|
||||
// Save config
|
||||
// Save config on exit
|
||||
ConfFile = fopen(confpath->str,"w");
|
||||
if (ConfFile == NULL) {
|
||||
perror("Unable to open config file for writing");
|
||||
|
|
121
slowrx.ui
121
slowrx.ui
|
@ -97,12 +97,20 @@
|
|||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="top_padding">7</property>
|
||||
<property name="bottom_padding">6</property>
|
||||
<property name="left_padding">8</property>
|
||||
<property name="right_padding">8</property>
|
||||
<child>
|
||||
<object class="GtkNotebook" id="notebook1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment1">
|
||||
<object class="GtkAlignment" id="alignment2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="top_padding">10</property>
|
||||
|
@ -123,7 +131,7 @@
|
|||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment2">
|
||||
<object class="GtkAlignment" id="alignment3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
|
@ -155,12 +163,13 @@
|
|||
<object class="GtkBox" id="box1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkFrame" id="IDFrame">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment7">
|
||||
<property name="visible">True</property>
|
||||
|
@ -175,6 +184,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="width_chars">8</property>
|
||||
<attributes>
|
||||
<attribute name="font-desc" value="Monospace Bold 16"/>
|
||||
</attributes>
|
||||
|
@ -203,7 +213,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment8">
|
||||
<property name="visible">True</property>
|
||||
|
@ -215,8 +225,9 @@
|
|||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes"> </property>
|
||||
<property name="width_chars">5</property>
|
||||
<attributes>
|
||||
<attribute name="font-desc" value="Monospace 12"/>
|
||||
<attribute name="font-desc" value="Monospace 11"/>
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
|
@ -232,7 +243,7 @@
|
|||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">7</property>
|
||||
<property name="position">1</property>
|
||||
|
@ -243,7 +254,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment11">
|
||||
<property name="visible">True</property>
|
||||
|
@ -256,7 +267,7 @@
|
|||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes"> </property>
|
||||
<attributes>
|
||||
<attribute name="font-desc" value="Monospace 12"/>
|
||||
<attribute name="font-desc" value="Monospace 11"/>
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
|
@ -272,7 +283,7 @@
|
|||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">7</property>
|
||||
<property name="position">2</property>
|
||||
|
@ -320,7 +331,7 @@
|
|||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment3">
|
||||
<object class="GtkAlignment" id="alignment4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="top_padding">10</property>
|
||||
|
@ -465,6 +476,35 @@
|
|||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="BtnClear">
|
||||
<property name="label" translatable="yes">Clear</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator" id="separator2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_top">5</property>
|
||||
<property name="margin_bottom">5</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
@ -476,7 +516,7 @@
|
|||
<object class="GtkLabel" id="label7">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Rx options</property>
|
||||
<property name="label" translatable="yes">Rx control</property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
</child>
|
||||
|
@ -487,6 +527,46 @@
|
|||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame" id="SlantFrame">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment13">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="top_padding">10</property>
|
||||
<property name="bottom_padding">10</property>
|
||||
<property name="left_padding">10</property>
|
||||
<property name="right_padding">10</property>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="EdgeToggle">
|
||||
<property name="label" translatable="yes">Set left edge</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Manual resync</property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame" id="ManualFrame">
|
||||
<property name="visible">True</property>
|
||||
|
@ -629,7 +709,7 @@
|
|||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -724,12 +804,9 @@
|
|||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
|
@ -784,7 +861,7 @@
|
|||
<object class="GtkImage" id="devstatusicon">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
<property name="stock">gtk-dialog-error</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -899,6 +976,8 @@
|
|||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xpad">5</property>
|
||||
<property name="ypad">2</property>
|
||||
<property name="label" translatable="yes">Rx</property>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -906,7 +985,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment4">
|
||||
<object class="GtkAlignment" id="alignment12">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="top_padding">10</property>
|
||||
|
@ -921,7 +1000,7 @@
|
|||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment12">
|
||||
<object class="GtkAlignment" id="alignment14">
|
||||
<property name="width_request">110</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
|
@ -982,6 +1061,8 @@
|
|||
<object class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xpad">5</property>
|
||||
<property name="ypad">2</property>
|
||||
<property name="label" translatable="yes">Log</property>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -996,6 +1077,8 @@
|
|||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
|
|
2
vis.c
2
vis.c
|
@ -180,5 +180,3 @@ guchar GetVIS () {
|
|||
else printf(" No VIS found\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue