Skip to content

Commit 150eb14

Browse files
committed
Update the UI label for disabling/enabling microphone recognition when the sound input uses monitor mode, for more clearness (see issue #149)
1 parent 139e660 commit 150eb14

File tree

19 files changed

+316
-169
lines changed

19 files changed

+316
-169
lines changed

src/gui/main_window.rs

+29-1
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ pub fn gui_main(recording: bool, input_file: Option<&str>, enable_mpris_cli: boo
498498
let current_volume_hbox: gtk::Box = main_builder.get_object("current_volume_hbox").unwrap();
499499
let current_volume_bar: gtk::ProgressBar = main_builder.get_object("current_volume_bar").unwrap();
500500

501-
combo_box.connect_changed(clone!(@strong microphone_stop_button, @strong combo_box,
501+
combo_box.connect_changed(clone!(@strong microphone_button, @strong microphone_stop_button, @strong combo_box,
502502
@strong combo_box_model, @strong recognize_from_my_speakers_checkbox, @strong gui_tx => move |_| {
503503

504504
if let Some(active_item) = combo_box.get_active_iter() {
@@ -515,6 +515,15 @@ pub fn gui_main(recording: bool, input_file: Option<&str>, enable_mpris_cli: boo
515515
// Sync the monitor check box
516516
if recognize_from_my_speakers_checkbox.is_visible() {
517517
recognize_from_my_speakers_checkbox.set_active(is_monitor);
518+
519+
if is_monitor {
520+
microphone_button.set_label(gettext("Turn on speakers recognition").as_str());
521+
microphone_stop_button.set_label(gettext("Turn off speakers recognition").as_str());
522+
}
523+
else {
524+
microphone_button.set_label(gettext("Turn on microphone recognition").as_str());
525+
microphone_stop_button.set_label(gettext("Turn off microphone recognition").as_str());
526+
}
518527
}
519528

520529
if microphone_stop_button.is_visible() {
@@ -586,11 +595,21 @@ pub fn gui_main(recording: bool, input_file: Option<&str>, enable_mpris_cli: boo
586595
}));
587596

588597
recognize_from_my_speakers_checkbox.connect_toggled(clone!(@strong recognize_from_my_speakers_checkbox,
598+
@strong microphone_button, @strong microphone_stop_button,
589599
@strong combo_box_model, @strong combo_box => move |_| {
590600

591601
if let Some(active_item) = combo_box.get_active_iter() {
592602
let is_currently_monitor: bool = combo_box_model.get_value(&active_item, 2).get().unwrap().unwrap();
593603

604+
if is_currently_monitor {
605+
microphone_button.set_label(gettext("Turn on speakers recognition").as_str());
606+
microphone_stop_button.set_label(gettext("Turn off speakers recognition").as_str());
607+
}
608+
else {
609+
microphone_button.set_label(gettext("Turn on microphone recognition").as_str());
610+
microphone_stop_button.set_label(gettext("Turn off microphone recognition").as_str());
611+
}
612+
594613
if is_currently_monitor != recognize_from_my_speakers_checkbox.get_active() {
595614

596615
if let Some(iter) = combo_box_model.get_iter_first() {
@@ -794,6 +813,15 @@ pub fn gui_main(recording: bool, input_file: Option<&str>, enable_mpris_cli: boo
794813
recognize_from_my_speakers_checkbox.set_active(
795814
devices[old_device_index as usize].is_monitor
796815
);
816+
817+
if devices[old_device_index as usize].is_monitor {
818+
microphone_button.set_label(gettext("Turn on speakers recognition").as_str());
819+
microphone_stop_button.set_label(gettext("Turn off speakers recognition").as_str());
820+
}
821+
else {
822+
microphone_button.set_label(gettext("Turn on microphone recognition").as_str());
823+
microphone_stop_button.set_label(gettext("Turn off microphone recognition").as_str());
824+
}
797825
}
798826
else {
799827
recognize_from_my_speakers_checkbox.hide();
178 Bytes
Binary file not shown.

translations/ca/LC_MESSAGES/songrec.po

+35-24
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: \n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2024-01-15 22:55+0100\n"
10+
"POT-Creation-Date: 2024-01-22 13:09+0100\n"
1111
"PO-Revision-Date: 2024-01-21 20:01+0100\n"
1212
"Last-Translator: Pau Giuli <pau@giuli.cat>\n"
1313
"Language-Team: \n"
@@ -40,7 +40,7 @@ msgstr "Avís: Xarxa no connectada"
4040

4141
#: ../src/cli_main.rs:147 ../src/core/http_thread.rs:49
4242
#: ../src/core/http_thread.rs:54 ../src/core/http_thread.rs:63
43-
#: ../src/core/http_thread.rs:89 ../src/gui/main_window.rs:744
43+
#: ../src/core/http_thread.rs:89 ../src/gui/main_window.rs:763
4444
msgid "No match for this song"
4545
msgstr "No hi ha coincidències per aquesta cançó"
4646

@@ -61,8 +61,8 @@ msgid ""
6161
"Run as a command-line program listening the microphone and printing "
6262
"recognized songs to stdout, exposing current song info via MPRIS"
6363
msgstr ""
64-
"Executar com a programa de terminal enregistrant el micròfon i retornant "
65-
"les cançons reconegudes a stdout, mostrant la cançó actual per MPRIS"
64+
"Executar com a programa de terminal enregistrant el micròfon i retornant les "
65+
"cançons reconegudes a stdout, mostrant la cançó actual per MPRIS"
6666

6767
#: ../src/main.rs:75 ../src/main.rs:104 ../src/main.rs:142
6868
msgid "Specify the audio device to use"
@@ -83,8 +83,7 @@ msgstr "Desactivar suport per a MPRIS"
8383
#: ../src/main.rs:98
8484
msgid "Recognize one song from a sound file or microphone and print its info."
8585
msgstr ""
86-
"Reconèixer una cançó des d'un arxiu de so o micròfon i mostrar la "
87-
"informació."
86+
"Reconèixer una cançó des d'un arxiu de so o micròfon i mostrar la informació."
8887

8988
#: ../src/main.rs:122
9089
msgid "Recognize a file instead of using mic input"
@@ -117,8 +116,8 @@ msgid ""
117116
"Generate a Shazam fingerprint from a sound file, and print it to the "
118117
"standard output."
119118
msgstr ""
120-
"Genereu una empremta digital de Shazam a partir d'un fitxer de so i "
121-
"retornar-la a la sortida estàndard."
119+
"Genereu una empremta digital de Shazam a partir d'un fitxer de so i retornar-"
120+
"la a la sortida estàndard."
122121

123122
#: ../src/main.rs:151
124123
msgid "The .WAV or .MP3 file to generate an audio fingerprint for."
@@ -202,27 +201,47 @@ msgstr "Freqüència de mostreig invàlida en codificar el paquet Shazam"
202201
msgid "Application::new failed"
203202
msgstr "Application::new ha fallat inesperadament"
204203

205-
#: ../src/gui/main_window.rs:465 ../src/gui/main_window.rs:728
204+
#: ../src/gui/main_window.rs:465 ../src/gui/main_window.rs:747
206205
msgid "Unable to enable MPRIS support"
207206
msgstr "No s'ha pogut activar el suport per MPRIS"
208207

209-
#: ../src/gui/main_window.rs:542
208+
#: ../src/gui/main_window.rs:520 ../src/gui/main_window.rs:605
209+
#: ../src/gui/main_window.rs:818
210+
msgid "Turn on speakers recognition"
211+
msgstr "Activar reconeixement de altaveus"
212+
213+
#: ../src/gui/main_window.rs:521 ../src/gui/main_window.rs:606
214+
#: ../src/gui/main_window.rs:819
215+
msgid "Turn off speakers recognition"
216+
msgstr "Desactivar reconeixement de altaveus"
217+
218+
#: ../src/gui/main_window.rs:524 ../src/gui/main_window.rs:609
219+
#: ../src/gui/main_window.rs:822 interface.glade.h:14
220+
msgid "Turn on microphone recognition"
221+
msgstr "Activar reconeixement de micròfon"
222+
223+
#: ../src/gui/main_window.rs:525 ../src/gui/main_window.rs:610
224+
#: ../src/gui/main_window.rs:823 interface.glade.h:15
225+
msgid "Turn off microphone recognition"
226+
msgstr "Desactivar reconeixement de micròfon"
227+
228+
#: ../src/gui/main_window.rs:551
210229
msgid "Select a file to recognize"
211230
msgstr "Escull un arxiu a reconèixer"
212231

213-
#: ../src/gui/main_window.rs:545
232+
#: ../src/gui/main_window.rs:554
214233
msgid "_Open"
215234
msgstr "_Obrir"
216235

217-
#: ../src/gui/main_window.rs:546
236+
#: ../src/gui/main_window.rs:555
218237
msgid "_Cancel"
219238
msgstr "_Cancel·lar"
220239

221-
#: ../src/gui/main_window.rs:554
240+
#: ../src/gui/main_window.rs:563
222241
msgid "Couldn't get filename"
223242
msgstr "No s'ha trobat el nom d'arxiu"
224243

225-
#: ../src/gui/main_window.rs:837
244+
#: ../src/gui/main_window.rs:865
226245
msgid "Song recognized"
227246
msgstr "Cançó reconeguda"
228247

@@ -250,8 +269,8 @@ msgstr "Ajustaments"
250269
msgid ""
251270
"Enable MPRIS (display playing song information in the GNOME control panel)"
252271
msgstr ""
253-
"Activar MPRIS (mostrar informació de la cançó actual al panell de control "
254-
"de GNOME)"
272+
"Activar MPRIS (mostrar informació de la cançó actual al panell de control de "
273+
"GNOME)"
255274

256275
#: interface.glade.h:3
257276
msgid "About"
@@ -301,14 +320,6 @@ msgstr "Quant a..."
301320
msgid "Recognize from file"
302321
msgstr "Reconèixer des d'arxiu"
303322

304-
#: interface.glade.h:14
305-
msgid "Turn on microphone recognition"
306-
msgstr "Activar reconeixement de micròfon"
307-
308-
#: interface.glade.h:15
309-
msgid "Turn off microphone recognition"
310-
msgstr "Desactivar reconeixement de micròfon"
311-
312323
#: interface.glade.h:16
313324
msgid "Enable notifications"
314325
msgstr "Activar notificacions"
163 Bytes
Binary file not shown.

translations/de_DE/LC_MESSAGES/songrec.po

+28-16
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: \n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2024-01-14 14:22+0100\n"
10+
"POT-Creation-Date: 2024-01-22 13:09+0100\n"
1111
"PO-Revision-Date: 2022-10-09 13:27+0200\n"
1212
"Last-Translator: \n"
1313
"Language-Team: \n"
@@ -40,7 +40,7 @@ msgstr "Warnung: Netzwerk nicht erreichbar"
4040

4141
#: ../src/cli_main.rs:147 ../src/core/http_thread.rs:49
4242
#: ../src/core/http_thread.rs:54 ../src/core/http_thread.rs:63
43-
#: ../src/core/http_thread.rs:89 ../src/gui/main_window.rs:744
43+
#: ../src/core/http_thread.rs:89 ../src/gui/main_window.rs:763
4444
msgid "No match for this song"
4545
msgstr "Keine Übereinstimmung für dieses Lied"
4646

@@ -204,27 +204,47 @@ msgstr "Ungültige Abtastrate bei der Codierung des Shazam Pakets übergeben"
204204
msgid "Application::new failed"
205205
msgstr "Application::new fehlgeschlagen"
206206

207-
#: ../src/gui/main_window.rs:465 ../src/gui/main_window.rs:728
207+
#: ../src/gui/main_window.rs:465 ../src/gui/main_window.rs:747
208208
msgid "Unable to enable MPRIS support"
209209
msgstr "MPRIS Unterstützung kann nicht aktiviert werden"
210210

211-
#: ../src/gui/main_window.rs:542
211+
#: ../src/gui/main_window.rs:520 ../src/gui/main_window.rs:605
212+
#: ../src/gui/main_window.rs:818
213+
msgid "Turn on speakers recognition"
214+
msgstr "Lautsprechern Erkennung aktivieren"
215+
216+
#: ../src/gui/main_window.rs:521 ../src/gui/main_window.rs:606
217+
#: ../src/gui/main_window.rs:819
218+
msgid "Turn off speakers recognition"
219+
msgstr "Lautsprechern Erkennung deaktivieren"
220+
221+
#: ../src/gui/main_window.rs:524 ../src/gui/main_window.rs:609
222+
#: ../src/gui/main_window.rs:822 interface.glade.h:14
223+
msgid "Turn on microphone recognition"
224+
msgstr "Mikrofon Erkennung aktivieren"
225+
226+
#: ../src/gui/main_window.rs:525 ../src/gui/main_window.rs:610
227+
#: ../src/gui/main_window.rs:823 interface.glade.h:15
228+
msgid "Turn off microphone recognition"
229+
msgstr "Mikrofon Erkennung deaktivieren"
230+
231+
#: ../src/gui/main_window.rs:551
212232
msgid "Select a file to recognize"
213233
msgstr "Wählen Sie eine zu erkennende Datei"
214234

215-
#: ../src/gui/main_window.rs:545
235+
#: ../src/gui/main_window.rs:554
216236
msgid "_Open"
217237
msgstr "_Öffnen"
218238

219-
#: ../src/gui/main_window.rs:546
239+
#: ../src/gui/main_window.rs:555
220240
msgid "_Cancel"
221241
msgstr "_Abbrechen"
222242

223-
#: ../src/gui/main_window.rs:554
243+
#: ../src/gui/main_window.rs:563
224244
msgid "Couldn't get filename"
225245
msgstr "Dateiname konnte nicht ermittelt werden"
226246

227-
#: ../src/gui/main_window.rs:837
247+
#: ../src/gui/main_window.rs:865
228248
msgid "Song recognized"
229249
msgstr "Lied erkannt"
230250

@@ -299,14 +319,6 @@ msgstr ""
299319
msgid "Recognize from file"
300320
msgstr "Erkennung aus Datei"
301321

302-
#: interface.glade.h:14
303-
msgid "Turn on microphone recognition"
304-
msgstr "Mikrofon Erkennung aktivieren"
305-
306-
#: interface.glade.h:15
307-
msgid "Turn off microphone recognition"
308-
msgstr "Mikrofon Erkennung deaktivieren"
309-
310322
#: interface.glade.h:16
311323
msgid "Enable notifications"
312324
msgstr "Aktiviere Benachrichtigungen"
168 Bytes
Binary file not shown.

translations/es/LC_MESSAGES/songrec.po

+28-16
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: Songrec\n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2024-01-14 14:22+0100\n"
10+
"POT-Creation-Date: 2024-01-22 13:09+0100\n"
1111
"PO-Revision-Date: 2022-07-24 13:29+0200\n"
1212
"Last-Translator: Ismael Ferreras Morezuelas <swyterzone+songrec@gmail.com>\n"
1313
"Language-Team: Swyter <swyterzone@gmail.com>\n"
@@ -40,7 +40,7 @@ msgstr "Advertencia: No parece haber conexión a Internet"
4040

4141
#: ../src/cli_main.rs:147 ../src/core/http_thread.rs:49
4242
#: ../src/core/http_thread.rs:54 ../src/core/http_thread.rs:63
43-
#: ../src/core/http_thread.rs:89 ../src/gui/main_window.rs:744
43+
#: ../src/core/http_thread.rs:89 ../src/gui/main_window.rs:763
4444
msgid "No match for this song"
4545
msgstr "No se ha podido detectar la canción"
4646

@@ -215,27 +215,47 @@ msgstr ""
215215
msgid "Application::new failed"
216216
msgstr "Parece que «Application::new» ha fallado"
217217

218-
#: ../src/gui/main_window.rs:465 ../src/gui/main_window.rs:728
218+
#: ../src/gui/main_window.rs:465 ../src/gui/main_window.rs:747
219219
msgid "Unable to enable MPRIS support"
220220
msgstr "No se ha podido activar la funcionalidad MPRIS"
221221

222-
#: ../src/gui/main_window.rs:542
222+
#: ../src/gui/main_window.rs:520 ../src/gui/main_window.rs:605
223+
#: ../src/gui/main_window.rs:818
224+
msgid "Turn on speakers recognition"
225+
msgstr "Activar reconocimiento por altavoces"
226+
227+
#: ../src/gui/main_window.rs:521 ../src/gui/main_window.rs:606
228+
#: ../src/gui/main_window.rs:819
229+
msgid "Turn off speakers recognition"
230+
msgstr "Desactivar reconocimiento por altavoces"
231+
232+
#: ../src/gui/main_window.rs:524 ../src/gui/main_window.rs:609
233+
#: ../src/gui/main_window.rs:822 interface.glade.h:14
234+
msgid "Turn on microphone recognition"
235+
msgstr "Activar reconocimiento por micrófono"
236+
237+
#: ../src/gui/main_window.rs:525 ../src/gui/main_window.rs:610
238+
#: ../src/gui/main_window.rs:823 interface.glade.h:15
239+
msgid "Turn off microphone recognition"
240+
msgstr "Desactivar reconocimiento por micrófono"
241+
242+
#: ../src/gui/main_window.rs:551
223243
msgid "Select a file to recognize"
224244
msgstr "Elige el archivo que quieres reconocer"
225245

226-
#: ../src/gui/main_window.rs:545
246+
#: ../src/gui/main_window.rs:554
227247
msgid "_Open"
228248
msgstr "_Abrir"
229249

230-
#: ../src/gui/main_window.rs:546
250+
#: ../src/gui/main_window.rs:555
231251
msgid "_Cancel"
232252
msgstr "_Cancelar"
233253

234-
#: ../src/gui/main_window.rs:554
254+
#: ../src/gui/main_window.rs:563
235255
msgid "Couldn't get filename"
236256
msgstr "No se pudo obtener el nombre del archivo"
237257

238-
#: ../src/gui/main_window.rs:837
258+
#: ../src/gui/main_window.rs:865
239259
msgid "Song recognized"
240260
msgstr "Canción encontrada"
241261

@@ -310,14 +330,6 @@ msgstr ""
310330
msgid "Recognize from file"
311331
msgstr "Reconocer a partir de un archivo"
312332

313-
#: interface.glade.h:14
314-
msgid "Turn on microphone recognition"
315-
msgstr "Activar reconocimiento por micrófono"
316-
317-
#: interface.glade.h:15
318-
msgid "Turn off microphone recognition"
319-
msgstr "Desactivar reconocimiento por micrófono"
320-
321333
#: interface.glade.h:16
322334
msgid "Enable notifications"
323335
msgstr "Activar notificaciones"
209 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)