From 89a0d7243993eebdbf006e62638535d1b3749fbf Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Tue, 23 Feb 2021 18:07:21 -0500 Subject: [PATCH] 2021-02-23 Fred Gleason * Removed the Qt3Support library from the build system. Signed-off-by: Fred Gleason --- ChangeLog | 2 + cae/Makefile.am | 5 +- cae/cae.cpp | 48 ++- cae/cae.h | 16 +- cae/cae_alsa.cpp | 30 +- cae/cae_hpi.cpp | 2 +- cae/cae_jack.cpp | 33 +- configure.ac | 2 +- importers/Makefile.am | 18 +- importers/nexgen_filter.cpp | 87 ++--- importers/rivendell_filter.cpp | 28 +- importers/sas_filter.cpp | 6 +- importers/wings_filter.cpp | 17 +- lib/Makefile.am | 2 +- lib/export_bmiemr.cpp | 2 +- lib/export_cutlog.cpp | 4 +- lib/export_deltaflex.cpp | 10 +- lib/export_musicclassical.cpp | 4 +- lib/export_musicplayout.cpp | 4 +- lib/export_musicsummary.cpp | 2 +- lib/export_nprsoundex.cpp | 2 +- lib/export_radiotraffic.cpp | 4 +- lib/export_resultsrecon.cpp | 2 +- lib/export_soundex.cpp | 2 +- lib/export_spincount.cpp | 2 +- lib/export_technical.cpp | 4 +- lib/export_textlog.cpp | 4 +- lib/rdadd_cart.cpp | 40 +-- lib/rdadd_log.cpp | 11 +- lib/rdapplication.cpp | 11 + lib/rdapplication.h | 1 + lib/rdaudioconvert.cpp | 36 +- lib/rdaudioexport.cpp | 54 +-- lib/rdaudioimport.cpp | 41 ++- lib/rdaudioinfo.cpp | 19 +- lib/rdaudiostore.cpp | 20 +- lib/rdbusybar.cpp | 10 +- lib/rdbusydialog.cpp | 2 +- lib/rdbutton_dialog.cpp | 29 +- lib/rdcae.cpp | 14 +- lib/rdcardselector.cpp | 24 +- lib/rdcart.cpp | 49 ++- lib/rdcart_dialog.cpp | 9 +- lib/rdcart_search_text.cpp | 9 +- lib/rdcartfilter.cpp | 38 +-- lib/rdcartslot.cpp | 6 +- lib/rdcastsearch.cpp | 2 +- lib/rdcatch_connect.cpp | 15 +- lib/rdcatch_connect.h | 14 +- lib/rdcddblookup.cpp | 26 +- lib/rdcdplayer.cpp | 23 +- lib/rdcdripper.cpp | 10 +- lib/rdcmd_switch.cpp | 9 +- lib/rdcmd_switch.h | 3 +- lib/rdcombobox.cpp | 16 +- lib/rdcombobox.h | 3 + lib/rdconf.cpp | 42 ++- lib/rdconf.h | 22 +- lib/rdconfig.cpp | 18 +- lib/rdcopyaudio.cpp | 33 +- lib/rdcoreapplication.cpp | 4 +- lib/rdcueedit.cpp | 92 +++--- lib/rdcut.cpp | 16 +- lib/rdcut_dialog.cpp | 7 +- lib/rddatedecode.cpp | 26 +- lib/rddatedialog.cpp | 4 +- lib/rddatepicker.cpp | 21 +- lib/rddatetime.cpp | 2 +- lib/rddb.cpp | 8 +- lib/rddebug.cpp | 4 +- lib/rddelete.cpp | 2 +- lib/rddisclookup.cpp | 5 +- lib/rddiscrecord.cpp | 2 +- lib/rddownload.cpp | 12 +- lib/rdedit_audio.cpp | 186 ++++++----- lib/rdedit_audio.h | 2 +- lib/rdedit_panel_name.cpp | 11 +- lib/rdescape_string.cpp | 2 +- lib/rdevent_line.cpp | 5 +- lib/rdevent_player.cpp | 7 +- lib/rdexport_settings_dialog.cpp | 380 +++++++++++----------- lib/rdfeed.cpp | 65 ++-- lib/rdflacdecode.cpp | 2 +- lib/rdformpost.cpp | 10 +- lib/rdget_ath.cpp | 13 +- lib/rdgpio.cpp | 12 +- lib/rdgpioselector.cpp | 30 +- lib/rdgroup.cpp | 2 +- lib/rdhash.cpp | 4 +- lib/rdhotkeylist.cpp | 12 +- lib/rdimport_audio.cpp | 25 +- lib/rdinstancelock.cpp | 8 +- lib/rdkernelgpio.cpp | 6 +- lib/rdlibrarymodel.cpp | 4 +- lib/rdlist_groups.cpp | 4 +- lib/rdlivewire.cpp | 110 ++++--- lib/rdlivewire.h | 8 +- lib/rdlivewiredestination.cpp | 6 +- lib/rdlivewiredestination.h | 10 +- lib/rdlivewiresource.cpp | 10 +- lib/rdlivewiresource.h | 12 +- lib/rdlog_line.cpp | 6 +- lib/rdlogfilter.cpp | 21 +- lib/rdloglock.cpp | 2 +- lib/rdlogplay.cpp | 12 +- lib/rdmacro.cpp | 10 +- lib/rdmacro.h | 18 +- lib/rdmacro_event.cpp | 25 +- lib/rdmacro_event.h | 7 +- lib/rdmarker_bar.cpp | 2 +- lib/rdmonitor_config.cpp | 2 +- lib/rdmulticaster.cpp | 8 +- lib/rdoneshot.cpp | 5 +- lib/rdpam.cpp | 4 +- lib/rdpanel_button.cpp | 12 +- lib/rdpasswd.cpp | 10 +- lib/rdpeaksexport.cpp | 30 +- lib/rdplay_deck.cpp | 37 ++- lib/rdpodcast.cpp | 14 +- lib/rdpodcastfilter.cpp | 5 +- lib/rdprofile.cpp | 14 +- lib/rdpushbutton.cpp | 16 +- lib/rdrehash.cpp | 25 +- lib/rdrenderer.cpp | 29 +- lib/rdreport.cpp | 2 +- lib/rdripc.cpp | 8 +- lib/rdripc.h | 2 +- lib/rdschedcartlist.cpp | 4 +- lib/rdsegmeter.cpp | 55 ++-- lib/rdsegmeter.h | 13 +- lib/rdsettings.cpp | 4 +- lib/rdslider.cpp | 168 +++++----- lib/rdslider.h | 6 +- lib/rdslotbox.cpp | 54 +-- lib/rdslotdialog.cpp | 24 +- lib/rdsocketstrings.cpp | 10 +- lib/rdsound_panel.cpp | 77 ++--- lib/rdstereometer.cpp | 5 +- lib/rdstringlist.cpp | 2 +- lib/rdsvc.cpp | 8 +- lib/rdsystemuser.cpp | 2 +- lib/rdtempdirectory.cpp | 4 +- lib/rdtextfile.cpp | 4 +- lib/rdtextvalidator.cpp | 4 +- lib/rdtextvalidator.h | 4 +- lib/rdtimeedit.cpp | 14 +- lib/rdtimeengine.cpp | 7 +- lib/rdtransportbutton.cpp | 199 ++++++----- lib/rdtrimaudio.cpp | 27 +- lib/rdttyout.cpp | 10 +- lib/rdupload.cpp | 12 +- lib/rdurl.cpp | 6 +- lib/rdwavedata_dialog.cpp | 8 +- lib/rdwavefile.cpp | 53 +-- lib/rdwavepainter.cpp | 3 +- lib/rdweb.cpp | 30 +- lib/rdwebresult.cpp | 2 +- rdadmin/Makefile.am | 4 +- rdadmin/add_feed.cpp | 4 +- rdadmin/add_group.cpp | 12 +- rdadmin/add_matrix.cpp | 24 +- rdadmin/add_replicator.cpp | 2 +- rdadmin/add_report.cpp | 2 +- rdadmin/add_schedcodes.cpp | 2 +- rdadmin/add_station.cpp | 11 +- rdadmin/add_svc.cpp | 28 +- rdadmin/add_user.cpp | 4 +- rdadmin/edit_audios.cpp | 85 +++-- rdadmin/edit_cartslots.cpp | 97 +++--- rdadmin/edit_channelgpios.cpp | 12 +- rdadmin/edit_decks.cpp | 181 +++++------ rdadmin/edit_dropbox.cpp | 78 ++--- rdadmin/edit_endpoint.cpp | 8 +- rdadmin/edit_feed.cpp | 128 +++----- rdadmin/edit_group.cpp | 62 ++-- rdadmin/edit_hostvar.cpp | 12 +- rdadmin/edit_jack.cpp | 23 +- rdadmin/edit_jack_client.cpp | 10 +- rdadmin/edit_matrix.cpp | 157 +++++---- rdadmin/edit_node.cpp | 10 +- rdadmin/edit_rdairplay.cpp | 218 ++++++------- rdadmin/edit_rdlibrary.cpp | 246 +++++++------- rdadmin/edit_rdlogedit.cpp | 148 ++++----- rdadmin/edit_rdpanel.cpp | 44 +-- rdadmin/edit_rdpanel.h | 3 +- rdadmin/edit_replicator.cpp | 35 +- rdadmin/edit_report.cpp | 56 ++-- rdadmin/edit_sas_resource.cpp | 7 +- rdadmin/edit_schedcodes.cpp | 6 +- rdadmin/edit_station.cpp | 88 ++--- rdadmin/edit_station.h | 7 +- rdadmin/edit_svc.cpp | 120 ++++--- rdadmin/edit_system.cpp | 76 ++--- rdadmin/edit_system.h | 4 +- rdadmin/edit_ttys.cpp | 152 +++++---- rdadmin/edit_user.cpp | 95 ++---- rdadmin/edit_vguest_resource.cpp | 9 +- rdadmin/help_audios.cpp | 2 +- rdadmin/importfields.cpp | 114 +++---- rdadmin/info_dialog.cpp | 8 +- rdadmin/license.cpp | 8 +- rdadmin/list_endpoints.cpp | 2 +- rdadmin/list_feeds.cpp | 8 +- rdadmin/list_gpis.cpp | 3 +- rdadmin/list_hostvars.cpp | 3 +- rdadmin/list_matrices.cpp | 3 +- rdadmin/list_replicator_carts.cpp | 2 +- rdadmin/list_replicators.cpp | 3 +- rdadmin/list_reports.cpp | 2 +- rdadmin/list_sas_resources.cpp | 2 +- rdadmin/list_schedcodes.cpp | 3 +- rdadmin/list_stations.cpp | 2 +- rdadmin/list_svcs.cpp | 5 +- rdadmin/list_vguest_resources.cpp | 2 +- rdadmin/login.cpp | 20 +- rdadmin/login.h | 7 +- rdadmin/rdadmin.cpp | 45 ++- rdadmin/rdadmin_cs.ts | 10 +- rdadmin/rdadmin_de.ts | 6 +- rdadmin/rdadmin_es.ts | 6 +- rdadmin/rdadmin_fr.ts | 6 +- rdadmin/rdadmin_nb.ts | 6 +- rdadmin/rdadmin_nn.ts | 6 +- rdadmin/rdadmin_pt_BR.ts | 6 +- rdadmin/rename_group.cpp | 15 +- rdadmin/test_import.cpp | 7 +- rdadmin/view_adapters.cpp | 4 +- rdadmin/view_node_info.cpp | 24 +- rdadmin/view_node_info.h | 2 +- rdairplay/Makefile.am | 6 +- rdairplay/edit_event.cpp | 34 +- rdairplay/hourselector.cpp | 4 +- rdairplay/list_log.cpp | 64 ++-- rdairplay/local_macros.cpp | 25 +- rdairplay/loglinebox.cpp | 76 ++--- rdairplay/logtableview.cpp | 8 +- rdairplay/mode_display.cpp | 12 +- rdairplay/pie_counter.cpp | 8 +- rdairplay/post_counter.cpp | 12 +- rdairplay/rdairplay.cpp | 93 +++--- rdairplay/start_button.cpp | 34 +- rdairplay/stop_counter.cpp | 10 +- rdairplay/wall_clock.cpp | 10 +- rdcartslots/Makefile.am | 8 +- rdcartslots/rdcartslots.cpp | 39 ++- rdcastmanager/Makefile.am | 8 +- rdcastmanager/edit_cast.cpp | 58 ++-- rdcastmanager/edit_cast.h | 16 +- rdcastmanager/rdcastmanager.cpp | 28 +- rdcastmanager/render_dialog.cpp | 12 +- rdcatch/Makefile.am | 6 +- rdcatch/add_recording.cpp | 2 +- rdcatch/deckmon.cpp | 15 +- rdcatch/edit_cartevent.cpp | 47 ++- rdcatch/edit_cartevent.h | 13 +- rdcatch/edit_download.cpp | 96 +++--- rdcatch/edit_download.h | 6 +- rdcatch/edit_playout.cpp | 69 ++-- rdcatch/edit_playout.h | 6 +- rdcatch/edit_recording.cpp | 97 +++--- rdcatch/edit_switchevent.cpp | 90 ++--- rdcatch/edit_switchevent.h | 20 +- rdcatch/edit_upload.cpp | 113 ++++--- rdcatch/edit_upload.h | 4 +- rdcatch/list_reports.cpp | 11 +- rdcatch/rdcatch.cpp | 126 ++++--- rdcatch/rdcatch_cs.ts | 12 +- rdcatch/rdcatch_de.ts | 12 +- rdcatch/rdcatch_es.ts | 12 +- rdcatch/rdcatch_fr.ts | 16 +- rdcatch/rdcatch_nb.ts | 12 +- rdcatch/rdcatch_nn.ts | 12 +- rdcatch/rdcatch_pt_BR.ts | 12 +- rdcatchd/Makefile.am | 8 +- rdcatchd/batch.cpp | 26 +- rdcatchd/event_player.cpp | 13 +- rdcatchd/rdcatchd.cpp | 112 ++++--- rdcatchd/rdcatchd.h | 8 +- rdhpi/Makefile.am | 9 +- rdhpi/rdhpiplaystream.cpp | 15 +- rdhpi/rdhpirecordstream.cpp | 13 +- rdhpi/rdhpisoundcard.cpp | 23 +- rdlibrary/Makefile.am | 6 +- rdlibrary/audio_cart.cpp | 16 +- rdlibrary/audio_controls.h | 9 +- rdlibrary/cdripper.cpp | 41 ++- rdlibrary/disk_gauge.cpp | 10 +- rdlibrary/disk_ripper.cpp | 27 +- rdlibrary/edit_cart.cpp | 180 +++++----- rdlibrary/edit_cart.h | 3 +- rdlibrary/edit_notes.cpp | 6 +- rdlibrary/edit_schedulercodes.cpp | 10 +- rdlibrary/list_reports.cpp | 18 +- rdlibrary/notebubble.cpp | 4 +- rdlibrary/rdlibrary.cpp | 45 +-- rdlibrary/record_cut.cpp | 83 +++-- rdlogedit/Makefile.am | 4 +- rdlogedit/edit_event.cpp | 17 +- rdlogedit/edit_log.cpp | 72 ++-- rdlogedit/edit_logline.cpp | 10 +- rdlogedit/list_reports.cpp | 17 +- rdlogedit/logtableview.cpp | 8 +- rdlogedit/rdlogedit.cpp | 36 +- rdlogedit/render_dialog.cpp | 28 +- rdlogedit/voice_tracker.cpp | 60 ++-- rdlogin/Makefile.am | 6 +- rdlogin/rdlogin.cpp | 52 ++- rdlogin/rdlogin.h | 2 +- rdlogin/rdlogin_cs.ts | 12 +- rdlogin/rdlogin_de.ts | 12 +- rdlogin/rdlogin_es.ts | 12 +- rdlogin/rdlogin_fr.ts | 16 +- rdlogin/rdlogin_nb.ts | 12 +- rdlogin/rdlogin_nn.ts | 12 +- rdlogin/rdlogin_pt_BR.ts | 12 +- rdlogmanager/Makefile.am | 6 +- rdlogmanager/add_clock.cpp | 9 +- rdlogmanager/add_event.cpp | 7 +- rdlogmanager/commandline_ops.cpp | 11 +- rdlogmanager/edit_clock.cpp | 22 +- rdlogmanager/edit_event.cpp | 119 ++++--- rdlogmanager/edit_event.h | 8 +- rdlogmanager/edit_eventline.cpp | 15 +- rdlogmanager/edit_grid.cpp | 10 +- rdlogmanager/edit_note.cpp | 4 +- rdlogmanager/edit_schedcoderules.cpp | 30 +- rdlogmanager/edit_schedcoderules.h | 4 +- rdlogmanager/edit_schedrules.cpp | 3 +- rdlogmanager/edit_track.cpp | 4 +- rdlogmanager/generate_log.cpp | 12 +- rdlogmanager/generate_log.h | 10 +- rdlogmanager/importcartsview.cpp | 4 +- rdlogmanager/list_clocks.cpp | 12 +- rdlogmanager/list_events.cpp | 41 ++- rdlogmanager/logobject.cpp | 21 +- rdlogmanager/pick_report_dates.cpp | 16 +- rdlogmanager/rdlogmanager.cpp | 40 +-- rdlogmanager/rdlogmanager_cs.ts | 4 + rdlogmanager/rdlogmanager_de.ts | 4 + rdlogmanager/rdlogmanager_es.ts | 4 + rdlogmanager/rdlogmanager_fr.ts | 4 + rdlogmanager/rdlogmanager_nb.ts | 4 + rdlogmanager/rdlogmanager_nn.ts | 4 + rdlogmanager/rdlogmanager_pt_BR.ts | 4 + rdlogmanager/rename_item.cpp | 12 +- rdlogmanager/svc_rec.cpp | 71 ++-- rdlogmanager/svc_rec_dialog.cpp | 25 +- rdmonitor/Makefile.am | 4 +- rdmonitor/positiondialog.cpp | 24 +- rdmonitor/rdmonitor.cpp | 60 ++-- rdpadd/Makefile.am | 6 +- rdpadengined/Makefile.am | 6 +- rdpadengined/rdpadengined.cpp | 9 +- rdpanel/Makefile.am | 6 +- rdpanel/rdpanel.cpp | 43 +-- rdrepld/Makefile.am | 6 +- rdrepld/citadelxds.cpp | 58 ++-- rdrepld/rdrepld.cpp | 11 +- rdrssd/Makefile.am | 6 +- rdrssd/rdrssd.cpp | 2 +- rdselect/Makefile.am | 6 +- rdselect/rdselect.cpp | 41 +-- rdservice/Makefile.am | 6 +- rdservice/rdservice.cpp | 4 +- rdvairplayd/Makefile.am | 6 +- rdvairplayd/local_macros.cpp | 6 +- rdvairplayd/rdvairplayd.cpp | 6 +- ripcd/Makefile.am | 5 +- ripcd/acu1p.cpp | 22 +- ripcd/am16.cpp | 11 +- ripcd/bt16x2.cpp | 28 +- ripcd/btacs82.cpp | 26 +- ripcd/btadms4422.cpp | 29 +- ripcd/btsentinel4web.cpp | 22 +- ripcd/btsrc16.cpp | 26 +- ripcd/btsrc8iii.cpp | 26 +- ripcd/btss164.cpp | 26 +- ripcd/btss21.cpp | 13 +- ripcd/btss41mlr.cpp | 11 +- ripcd/btss42.cpp | 26 +- ripcd/btss44.cpp | 26 +- ripcd/btss82.cpp | 26 +- ripcd/btu41mlrweb.cpp | 11 +- ripcd/gvc7000.cpp | 11 +- ripcd/harlond.cpp | 32 +- ripcd/kernelgpio.cpp | 19 +- ripcd/livewire_lwrpaudio.cpp | 7 +- ripcd/livewire_lwrpaudio.h | 8 +- ripcd/livewire_lwrpgpio.cpp | 24 +- ripcd/livewire_lwrpgpio.h | 13 +- ripcd/livewire_mcastgpio.cpp | 29 +- ripcd/livewire_mcastgpio.h | 14 +- ripcd/local_audio.cpp | 19 +- ripcd/local_gpio.cpp | 15 +- ripcd/local_macros.cpp | 28 +- ripcd/modbus.cpp | 39 ++- ripcd/modemlines.cpp | 19 +- ripcd/quartz1.cpp | 12 +- ripcd/ripcd.cpp | 31 +- ripcd/sas32000.cpp | 6 +- ripcd/sas64000gpi.cpp | 6 +- ripcd/sasusi.cpp | 25 +- ripcd/swauthority.cpp | 34 +- ripcd/swauthority.h | 2 +- ripcd/switcher.cpp | 6 +- ripcd/unity4000.cpp | 6 +- ripcd/vguest.cpp | 42 ++- ripcd/wheatnet_lio.cpp | 44 +-- ripcd/wheatnet_slio.cpp | 47 +-- tests/Makefile.am | 58 ++-- tests/audio_convert_test.cpp | 3 +- tests/audio_export_test.cpp | 9 +- tests/audio_import_test.cpp | 7 +- tests/audio_peaks_test.cpp | 16 +- tests/cmdline_parser_test.cpp | 2 +- tests/datedecode_test.cpp | 22 +- tests/dateparse_test.cpp | 20 +- tests/db_charset_test.cpp | 16 +- tests/delete_test.cpp | 14 +- tests/download_test.cpp | 12 +- tests/feed_image_test.cpp | 4 +- tests/getpids_test.cpp | 10 +- tests/log_unlink_test.cpp | 18 +- tests/mcast_recv_test.cpp | 18 +- tests/metadata_wildcard_test.cpp | 9 +- tests/notification_test.cpp | 11 +- tests/rdxml_parse_test.cpp | 19 +- tests/readcd_test.cpp | 9 +- tests/reserve_carts_test.cpp | 10 +- tests/sendmail_test.cpp | 10 +- tests/stringcode_test.cpp | 20 +- tests/test_hash.cpp | 8 +- tests/test_pam.cpp | 8 +- tests/timer_test.cpp | 10 +- tests/upload_test.cpp | 12 +- tests/wav_chunk_test.cpp | 10 +- utils/rdalsaconfig/Makefile.am | 6 +- utils/rdalsaconfig/rdalsaconfig.cpp | 4 +- utils/rdalsaconfig/rdalsamodel.cpp | 12 +- utils/rdcheckcuts/Makefile.am | 6 +- utils/rdcheckcuts/rdcheckcuts.cpp | 8 +- utils/rdcleandirs/Makefile.am | 6 +- utils/rdclilogedit/Makefile.am | 6 +- utils/rdclilogedit/help.cpp | 8 +- utils/rdclilogedit/operations.cpp | 38 +-- utils/rdclilogedit/parser.cpp | 29 +- utils/rdclilogedit/rdclilogedit.cpp | 18 +- utils/rdcollect/Makefile.am | 6 +- utils/rdcollect/rdcollect.cpp | 12 +- utils/rdconvert/Makefile.am | 6 +- utils/rdconvert/rdconvert.cpp | 9 +- utils/rddbconfig/Makefile.am | 6 +- utils/rddbconfig/createdb.cpp | 47 ++- utils/rddbconfig/db.cpp | 13 +- utils/rddbconfig/mysql_login.cpp | 14 +- utils/rddbconfig/rddbconfig.cpp | 50 ++- utils/rddbmgr/Makefile.am | 6 +- utils/rddbmgr/check.cpp | 138 ++++---- utils/rddbmgr/create.cpp | 24 +- utils/rddbmgr/printstatus.cpp | 8 +- utils/rddbmgr/rddbmgr.cpp | 28 +- utils/rddbmgr/revertschema.cpp | 6 +- utils/rddbmgr/schemamap.cpp | 19 +- utils/rddbmgr/updateschema.cpp | 29 +- utils/rddelete/Makefile.am | 6 +- utils/rddelete/rddelete.cpp | 36 +- utils/rddgimport/Makefile.am | 6 +- utils/rddgimport/rddgimport.cpp | 66 ++-- utils/rdexport/Makefile.am | 6 +- utils/rdexport/rdexport.cpp | 19 +- utils/rdgpimon/Makefile.am | 6 +- utils/rdgpimon/gpi_label.cpp | 10 +- utils/rdgpimon/rdgpimon.cpp | 119 +++---- utils/rdimport/Makefile.am | 6 +- utils/rdimport/markerset.cpp | 15 +- utils/rdimport/rdimport.cpp | 101 +++--- utils/rdmaint/Makefile.am | 6 +- utils/rdmaint/rdmaint.cpp | 10 +- utils/rdmarkerset/Makefile.am | 6 +- utils/rdmarkerset/rdmarkerset.cpp | 24 +- utils/rdmetadata/Makefile.am | 6 +- utils/rdmetadata/rdmetadata.cpp | 11 +- utils/rdpopup/Makefile.am | 6 +- utils/rdrender/Makefile.am | 6 +- utils/rdrender/rdrender.cpp | 30 +- utils/rdselect_helper/Makefile.am | 4 +- utils/rdselect_helper/rdselect_helper.cpp | 10 +- utils/rdsoftkeys/Makefile.am | 6 +- utils/rdsoftkeys/rdsoftkeys.cpp | 41 +-- utils/rmlsend/Makefile.am | 6 +- utils/rmlsend/rmlsend.cpp | 84 ++--- web/rdxport/Makefile.am | 6 +- web/rdxport/audiostore.cpp | 4 +- web/rdxport/carts.cpp | 28 +- web/rdxport/copyaudio.cpp | 8 +- web/rdxport/deleteaudio.cpp | 8 +- web/rdxport/export.cpp | 6 +- web/rdxport/groups.cpp | 4 +- web/rdxport/import.cpp | 6 +- web/rdxport/logs.cpp | 32 +- web/rdxport/podcasts.cpp | 6 +- web/rdxport/rdxport.cpp | 20 +- web/rdxport/schedcodes.cpp | 8 +- web/rdxport/services.cpp | 4 +- web/rdxport/systemsettings.cpp | 2 +- web/rdxport/tests.cpp | 8 +- web/webget/Makefile.am | 4 +- web/webget/webget.cpp | 8 +- 508 files changed, 5763 insertions(+), 6078 deletions(-) diff --git a/ChangeLog b/ChangeLog index 69973dfc..b5da9322 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21172,3 +21172,5 @@ * Removed the Q3SocketDevice dependency for metering data 'RDCae'. 2021-02-17 Fred Gleason * Removed the Q3SocketDevice dependency from 'RDCae'. +2021-02-23 Fred Gleason + * Removed the Qt3Support library from the build system. diff --git a/cae/Makefile.am b/cae/Makefile.am index c74ead2f..5316a096 100644 --- a/cae/Makefile.am +++ b/cae/Makefile.am @@ -19,7 +19,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -I$(top_srcdir)/lib -I$(top_srcdir)/rdhpi -Wno-strict-aliasing @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -I$(top_srcdir)/lib -I$(top_srcdir)/rdhpi -Wno-strict-aliasing @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib -L$(top_srcdir)/rdhpi MOC = @QT_MOC@ @@ -45,8 +45,7 @@ caed_LDADD = @LIB_RDLIBS@\ @LIBSRC@\ @LIBVORBIS@\ @QT4_LIBS@\ - @MUSICBRAINZ_LIBS@\ - -lQt3Support + @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ moc_* diff --git a/cae/cae.cpp b/cae/cae.cpp index 0a76506e..5f9f35fa 100644 --- a/cae/cae.cpp +++ b/cae/cae.cpp @@ -2,7 +2,7 @@ // // The Core Audio Engine component of Rivendell // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,10 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include -#include #include #include #include @@ -36,7 +32,8 @@ #include #include -#include +#include +#include #include #include @@ -88,8 +85,8 @@ void SigHandler(int signum) } -MainObject::MainObject(QObject *parent,const char *name) - :QObject(parent,name) +MainObject::MainObject(QObject *parent) + :QObject(parent) { // // Read Command Options @@ -731,8 +728,8 @@ void MainObject::loadRecordingData(int id,unsigned card,unsigned port, if(record_owner[card][port]==-1) { wavename=rd_config->audioFileName(name); - unlink(wavename); // So we don't trainwreck any current playouts! - unlink(wavename+".energy"); + unlink(wavename.toUtf8()); // So we don't trainwreck any current playouts! + unlink((wavename+".energy").toUtf8()); switch(cae_driver[card]) { case RDStation::Hpi: if(!hpiLoadRecord(card,port,coding,channels,samprate,bitrate, @@ -1458,20 +1455,20 @@ void MainObject::statePlayUpdate(int card,int stream,int state) switch(state) { case 1: // Playing cae_server->sendCommand(play_owner[card][stream], - (const char *)QString(). + QString(). sprintf("PY %d %d %d +!",handle, play_length[card][stream], - play_speed[card][stream])); + play_speed[card][stream]).toUtf8()); break; case 2: // Paused cae_server-> sendCommand(play_owner[card][stream],(const char *)QString(). - sprintf("SP %d +!",handle)); + sprintf("SP %d +!",handle).toUtf8()); break; case 0: // Stopped cae_server-> sendCommand(play_owner[card][stream],(const char *)QString(). - sprintf("SP %d +!",handle)); + sprintf("SP %d +!",handle).toUtf8()); break; } } @@ -1487,20 +1484,20 @@ void MainObject::stateRecordUpdate(int card,int stream,int state) sendCommand(record_owner[card][stream],(const char *)QString(). sprintf("RD %d %d %d %d +!",card,stream, record_length[card][stream], - record_threshold[card][stream])); + record_threshold[card][stream]).toUtf8()); break; case 4: // Record Started cae_server-> sendCommand(record_owner[card][stream],(const char *)QString(). - sprintf("RS %d %d +!",card,stream)); + sprintf("RS %d %d +!",card,stream).toUtf8()); break; case 2: // Paused case 3: // Stopped cae_server-> sendCommand(record_owner[card][stream],(const char *)QString(). - sprintf("SR %d %d +!",card,stream)); + sprintf("SR %d %d +!",card,stream).toUtf8()); break; } } @@ -1623,7 +1620,7 @@ void MainObject::InitProvisioning() const if(RDStation::create(rd_config->stationName(),&err_msg,rd_config->provisioningHostTemplate(),rd_config->provisioningHostIpAddress())) { RDApplication::syslog(rd_config,LOG_INFO, "created new host entry \"%s\"", - (const char *)rd_config->stationName()); + rd_config->stationName().toUtf8().constData()); if(!rd_config->provisioningHostShortName(rd_config->stationName()). isEmpty()) { RDStation *station=new RDStation(rd_config->stationName()); @@ -1634,7 +1631,7 @@ void MainObject::InitProvisioning() const } else { fprintf(stderr,"caed: unable to provision host [%s]\n", - (const char *)err_msg); + err_msg.toUtf8().constData()); exit(256); } } @@ -1657,11 +1654,11 @@ void MainObject::InitProvisioning() const rd_config->provisioningServiceTemplate(),rd_config)) { RDApplication::syslog(rd_config,LOG_INFO, "created new service entry \"%s\"", - (const char *)svcname); + svcname.toUtf8().constData()); } else { fprintf(stderr,"caed: unable to provision service [%s]\n", - (const char *)err_msg); + err_msg.toUtf8().constData()); exit(256); } } @@ -1803,7 +1800,7 @@ pid_t MainObject::GetPid(QString pidfile) FILE *handle; pid_t ret; - if((handle=fopen((const char *)pidfile,"r"))==NULL) { + if((handle=fopen(pidfile.toUtf8(),"r"))==NULL) { return -1; } if(fscanf(handle,"%d",&ret)!=1) { @@ -2103,7 +2100,8 @@ void MainObject::SendMeterLevelUpdate(const QString &type,int cardnum, if((cae_server->meterPort(ids.at(l))>0)&& cae_server->metersEnabled(ids.at(l),cardnum)) { SendMeterUpdate(QString().sprintf("ML %s %d %d %d %d", - (const char *)type,cardnum,portnum,levels[0],levels[1]), + type.toUtf8().constData(), + cardnum,portnum,levels[0],levels[1]), ids.at(l)); } } @@ -2178,7 +2176,7 @@ void MainObject::SendMeterOutputStatusUpdate(int card,int port,int stream) void MainObject::SendMeterUpdate(const QString &msg,int conn_id) { - meter_socket->writeDatagram(msg,msg.length(),cae_server->peerAddress(conn_id), + meter_socket->writeDatagram(msg.toUtf8(),cae_server->peerAddress(conn_id), cae_server->meterPort(conn_id)); } @@ -2187,7 +2185,7 @@ int main(int argc,char *argv[]) { int rc; QCoreApplication a(argc,argv,false); - new MainObject(NULL,"main"); + new MainObject(); rc=a.exec(); RDApplication::syslog(rd_config,LOG_DEBUG,"cae post a.exec() rc: %d",rc); return rc; diff --git a/cae/cae.h b/cae/cae.h index 744a4c94..1361109c 100644 --- a/cae/cae.h +++ b/cae/cae.h @@ -2,7 +2,7 @@ // // The Core Audio Engine component of Rivendell // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -27,13 +27,9 @@ #include -#include -#include -#include -#include -//#include -#include -#include +#include +#include +#include #include @@ -105,7 +101,7 @@ class MainObject : public QObject { Q_OBJECT public: - MainObject(QObject *parent=0,const char *name=0); + MainObject(QObject *parent=0); private slots: void loadPlaybackData(int id,unsigned card,const QString &name); @@ -168,7 +164,7 @@ class MainObject : public QObject bool debug; unsigned system_sample_rate; CaeServer *cae_server; - Q_INT16 tcp_port; + int16_t tcp_port; QUdpSocket *meter_socket; RDStation::AudioDriver cae_driver[RD_MAX_CARDS]; int record_owner[RD_MAX_CARDS][RD_MAX_STREAMS]; diff --git a/cae/cae_alsa.cpp b/cae/cae_alsa.cpp index a9ff81f0..dc50089c 100644 --- a/cae/cae_alsa.cpp +++ b/cae/cae_alsa.cpp @@ -2,7 +2,7 @@ // // The ALSA Driver for the Core Audio Engine component of Rivendell // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -657,16 +657,17 @@ void MainObject::alsaInit(RDStation *station) // // Stop & Fade Timers // - QSignalMapper *stop_mapper=new QSignalMapper(this,"stop_mapper"); + QSignalMapper *stop_mapper=new QSignalMapper(this); connect(stop_mapper,SIGNAL(mapped(int)),this,SLOT(alsaStopTimerData(int))); - QSignalMapper *fade_mapper=new QSignalMapper(this,"fade_mapper"); + QSignalMapper *fade_mapper=new QSignalMapper(this); connect(fade_mapper,SIGNAL(mapped(int)),this,SLOT(alsaFadeTimerData(int))); - QSignalMapper *record_mapper=new QSignalMapper(this,"record_mapper"); + QSignalMapper *record_mapper=new QSignalMapper(this); connect(record_mapper,SIGNAL(mapped(int)), this,SLOT(alsaRecordTimerData(int))); for(int i=0;isetSingleShot(true); stop_mapper->setMapping(alsa_stop_timer[i][j],i*RD_MAX_STREAMS+j); connect(alsa_stop_timer[i][j],SIGNAL(timeout()),stop_mapper,SLOT(map())); alsa_fade_timer[i][j]=new QTimer(this); @@ -675,6 +676,7 @@ void MainObject::alsaInit(RDStation *station) } for(int j=0;jsetSingleShot(true); record_mapper->setMapping(alsa_record_timer[i][j],i*RD_MAX_PORTS+j); connect(alsa_record_timer[i][j],SIGNAL(timeout()), record_mapper,SLOT(map())); @@ -700,7 +702,7 @@ void MainObject::alsaInit(RDStation *station) alsa_play_format[i].exiting = true; alsa_capture_format[i].exiting = true; dev=QString().sprintf("rd%d",card); - if(snd_pcm_open(&pcm_play_handle,(const char *)dev, + if(snd_pcm_open(&pcm_play_handle,dev.toUtf8(), SND_PCM_STREAM_PLAYBACK,0)==0){ pcm_opened=true; if(AlsaStartPlayDevice(dev,i,pcm_play_handle)) { @@ -710,7 +712,7 @@ void MainObject::alsaInit(RDStation *station) snd_pcm_close(pcm_play_handle); } } - if(snd_pcm_open(&pcm_capture_handle,(const char *)dev, + if(snd_pcm_open(&pcm_capture_handle,dev.toUtf8(), SND_PCM_STREAM_CAPTURE,0)==0) { pcm_opened=true; if(AlsaStartCaptureDevice(dev,i,pcm_capture_handle)) { @@ -722,13 +724,11 @@ void MainObject::alsaInit(RDStation *station) } if(cae_driver[i]==RDStation::Alsa) { station->setCardDriver(i,RDStation::Alsa); - if(snd_ctl_open(&snd_ctl,dev,0)<0) { + if(snd_ctl_open(&snd_ctl,dev.toUtf8(),0)<0) { RDApplication::syslog(rd_config,LOG_INFO, "no control device found for %s", - (const char *)dev); - station-> - setCardName(i, - QString().sprintf("ALSA Device %s",(const char *)dev)); + dev.toUtf8().constData()); + station->setCardName(i,tr("ALSA Device")+" "+dev); } else { snd_ctl_card_info_malloc(&card_info); @@ -900,7 +900,7 @@ bool MainObject::alsaPlaybackPosition(int card,int stream,unsigned pos) if(alsa_playing[card][stream]) { alsa_stop_timer[card][stream]->stop(); alsa_stop_timer[card][stream]-> - start(alsa_play_wave[card][stream]->getExtTimeLength()-pos,true); + start(alsa_play_wave[card][stream]->getExtTimeLength()-pos); } return true; #else @@ -919,7 +919,7 @@ bool MainObject::alsaPlay(int card,int stream,int length,int speed,bool pitch, } alsa_playing[card][stream]=true; if(length>0) { - alsa_stop_timer[card][stream]->start(length,true); + alsa_stop_timer[card][stream]->start(length); } statePlayUpdate(card,stream,1); return true; @@ -1039,7 +1039,7 @@ bool MainObject::alsaLoadRecord(int card,int stream,int coding,int chans, alsa_record_wave[card][stream]=NULL; return false; } - chown((const char *)wavename,rd_config->uid(),rd_config->gid()); + chown(wavename.toUtf8(),rd_config->uid(),rd_config->gid()); alsa_input_channels[card][stream]=chans; alsa_record_ring[card][stream]=new RDRingBuffer(RINGBUFFER_SIZE); alsa_record_ring[card][stream]->reset(); @@ -1081,7 +1081,7 @@ bool MainObject::alsaRecord(int card,int stream,int length,int thres) alsa_recording[card][stream]=true; if(alsa_input_vox[card][stream]==0.0) { if(length>0) { - alsa_record_timer[card][stream]->start(length,true); + alsa_record_timer[card][stream]->start(length); } stateRecordUpdate(card,stream,4); } diff --git a/cae/cae_hpi.cpp b/cae/cae_hpi.cpp index 0ca847de..c35aec02 100644 --- a/cae/cae_hpi.cpp +++ b/cae/cae_hpi.cpp @@ -225,7 +225,7 @@ bool MainObject::hpiLoadRecord(int card,int stream,int coding,int chans, record[card][stream]=NULL; return false; } - chown((const char *)wavename,rd_config->uid(),rd_config->gid()); + chown(wavename.toUtf8(),rd_config->uid(),rd_config->gid()); if(!record[card][stream]->recordReady()) { delete record[card][stream]; record[card][stream]=NULL; diff --git a/cae/cae_jack.cpp b/cae/cae_jack.cpp index 0251f96f..2de9a05e 100644 --- a/cae/cae_jack.cpp +++ b/cae/cae_jack.cpp @@ -2,7 +2,7 @@ // // The JACK Driver for the Core Audio Engine component of Rivendell // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -22,7 +22,7 @@ #include -#include +#include #include #include @@ -517,11 +517,12 @@ void MainObject::jackInit(RDStation *station) // jackopts=JackNoStartServer; if(station->jackServerName().isEmpty()) { - jack_client=jack_client_open(name,jackopts,&jackstat); + jack_client=jack_client_open(name.toUtf8(),jackopts,&jackstat); } else { - jack_client=jack_client_open(name,jackopts,&jackstat, - (const char *)station->jackServerName()); + jack_client= + jack_client_open(name.toUtf8(),jackopts,&jackstat, + station->jackServerName().toUtf8().constData()); } if(jack_client==NULL) { if((jackstat&JackInvalidOption)!=0) { @@ -607,9 +608,10 @@ void MainObject::jackInit(RDStation *station) // Start JACK Clients // jack_client_start_timer=new QTimer(this); + jack_client_start_timer->setSingleShot(true); connect(jack_client_start_timer,SIGNAL(timeout()), this,SLOT(jackClientStartData())); - jack_client_start_timer->start(6000,true); + jack_client_start_timer->start(6000); // // Tell the database about us @@ -656,6 +658,7 @@ void MainObject::jackInit(RDStation *station) this,SLOT(jackRecordTimerData(int))); for(int i=0;isetSingleShot(true); stop_mapper->setMapping(jack_stop_timer[i],i); connect(jack_stop_timer[i],SIGNAL(timeout()),stop_mapper,SLOT(map())); jack_fade_timer[i]=new QTimer(this); @@ -680,22 +683,22 @@ void MainObject::jackInit(RDStation *station) for(int i=0;ijackPorts();i++) { name=QString().sprintf("playout_%dL",i); jack_output_port[i][0]= - jack_port_register(jack_client,(const char *)name, + jack_port_register(jack_client,name.toUtf8(), JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput|JackPortIsTerminal,0); name=QString().sprintf("playout_%dR",i); jack_output_port[i][1]= - jack_port_register(jack_client,(const char *)name, + jack_port_register(jack_client,name.toUtf8(), JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput|JackPortIsTerminal,0); name=QString().sprintf("record_%dL",i); jack_input_port[i][0]= - jack_port_register(jack_client,(const char *)name, + jack_port_register(jack_client,name.toUtf8(), JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput|JackPortIsTerminal,0); name=QString().sprintf("record_%dR",i); jack_input_port[i][1]= - jack_port_register(jack_client,(const char *)name, + jack_port_register(jack_client,name.toUtf8(), JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput|JackPortIsTerminal,0); } @@ -865,7 +868,7 @@ bool MainObject::jackPlaybackPosition(int card,int stream,unsigned pos) if(jack_playing[stream]) { jack_stop_timer[stream]->stop(); jack_stop_timer[stream]-> - start(jack_play_wave[stream]->getExtTimeLength()-pos,true); + start(jack_play_wave[stream]->getExtTimeLength()-pos); } return true; #else @@ -890,7 +893,7 @@ bool MainObject::jackPlay(int card,int stream,int length,int speed,bool pitch, } jack_playing[stream]=true; if(length>0) { - jack_stop_timer[stream]->start(length,true); + jack_stop_timer[stream]->start(length); } statePlayUpdate(card,stream,1); return true; @@ -1010,7 +1013,7 @@ bool MainObject::jackLoadRecord(int card,int stream,int coding,int chans, jack_record_wave[stream]=NULL; return false; } - chown((const char *)wavename,rd_config->uid(),rd_config->gid()); + chown(wavename.toUtf8(),rd_config->uid(),rd_config->gid()); jack_input_channels[stream]=chans; jack_record_ring[stream]=new RDRingBuffer(RINGBUFFER_SIZE); jack_record_ring[stream]->reset(); @@ -1082,7 +1085,7 @@ bool MainObject::jackRecord(int card,int stream,int length,int thres) jack_recording[stream]=true; if(jack_input_vox[stream]==0.0) { if(length>0) { - jack_record_timer[stream]->start(length,true); + jack_record_timer[stream]->start(length); } stateRecordUpdate(card,stream,4); } @@ -1675,7 +1678,7 @@ void MainObject::JackSessionSetup() QString src=profile->stringValue("JackSession",src_tag,"",&src_ok); QString dest=profile->stringValue("JackSession",dest_tag,"",&dest_ok); while(src_ok&&dest_ok) { - if(jack_connect(jack_client,(const char *)src,(const char *)dest)!=0) { + if(jack_connect(jack_client,src.toUtf8(),dest.toUtf8())!=0) { RDApplication::syslog(rd_config,LOG_WARNING,"unable to connect %s to %s", (const char *)src.toUtf8(),(const char *)dest.toUtf8()); } diff --git a/configure.ac b/configure.ac index 509b0c70..faa9b48f 100644 --- a/configure.ac +++ b/configure.ac @@ -118,7 +118,7 @@ AC_ARG_ENABLE(rdxport-debug,[ --enable-rdxport-debug enable DEBUG support for # # Check for Qt4 (Mandatory) # -PKG_CHECK_MODULES(QT4,QtCore QtGui QtNetwork QtSql QtXml Qt3Support,,[AC_MSG_ERROR([*** Qt4 not found ***])]) +PKG_CHECK_MODULES(QT4,QtCore QtGui QtNetwork QtSql QtXml,,[AC_MSG_ERROR([*** Qt4 not found ***])]) AC_CHECK_PROG(MOC_NAME,moc-qt4,[moc-qt4],[moc]) AC_SUBST(QT_MOC,$MOC_NAME) diff --git a/importers/Makefile.am b/importers/Makefile.am index 137995fc..ec68f6a7 100644 --- a/importers/Makefile.am +++ b/importers/Makefile.am @@ -1,8 +1,8 @@ -## automake.am +## Makefile.am ## ## Automake.am for rivendell/importers ## -## (C) Copyright 2002-2020 Fred Gleason +## (C) Copyright 2002-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -20,7 +20,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -37,27 +37,27 @@ bin_PROGRAMS = nexgen_filter\ dist_nexgen_filter_SOURCES = nexgen_filter.cpp nexgen_filter.h nodist_nexgen_filter_SOURCES = moc_nexgen_filter.cpp -nexgen_filter_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +nexgen_filter_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_panel_copy_SOURCES = panel_copy.cpp panel_copy.h nodist_panel_copy_SOURCES = moc_panel_copy.cpp -panel_copy_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +panel_copy_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_rdcatch_copy_SOURCES = rdcatch_copy.cpp rdcatch_copy.h nodist_rdcatch_copy_SOURCES = moc_rdcatch_copy.cpp -rdcatch_copy_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdcatch_copy_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_rivendell_filter_SOURCES = rivendell_filter.cpp rivendell_filter.h nodist_rivendell_filter_SOURCES = moc_rivendell_filter.cpp -rivendell_filter_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rivendell_filter_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_sas_filter_SOURCES = sas_filter.cpp sas_filter.h nodist_sas_filter_SOURCES = moc_sas_filter.cpp -sas_filter_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +sas_filter_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_wings_filter_SOURCES = wings_filter.cpp wings_filter.h nodist_wings_filter_SOURCES = moc_wings_filter.cpp -wings_filter_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +wings_filter_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ EXTRA_DIST = export_slax diff --git a/importers/nexgen_filter.cpp b/importers/nexgen_filter.cpp index f0aa18fa..b680f606 100644 --- a/importers/nexgen_filter.cpp +++ b/importers/nexgen_filter.cpp @@ -69,7 +69,7 @@ MainObject::MainObject(QObject *parent) // rda=static_cast(new RDCoreApplication("nexgen_filter","nexgen_filter",NEXGEN_FILTER_USAGE,this)); if(!rda->open(&err_msg)) { - fprintf(stderr,"nexgen_filter: %s\n",(const char *)err_msg); + fprintf(stderr,"nexgen_filter: %s\n",err_msg.toUtf8().constData()); exit(1); } @@ -145,19 +145,19 @@ MainObject::MainObject(QObject *parent) filter_group=new RDGroup(group_name); if(!filter_group->exists()) { fprintf(stderr,"nexgen_filter: group \"%s\" does not exist\n", - (const char *)group_name); + group_name.toUtf8().constData()); exit(256); } filter_audio_dir=new QDir(audio_dir); if(!audio_dir.isEmpty()) { if(!filter_audio_dir->exists()) { fprintf(stderr,"nexgen_filter: audio directory \"%s\" does not exist\n", - (const char *)audio_dir); + audio_dir.toUtf8().constData()); exit(256); } if(!filter_audio_dir->isReadable()) { fprintf(stderr,"nexgen_filter: audio directory \"%s\" is not readable\n", - (const char *)audio_dir); + audio_dir.toUtf8().constData()); exit(256); } } @@ -172,7 +172,7 @@ MainObject::MainObject(QObject *parent) filter_reject_dir=new QDir(reject_dir); if(!filter_reject_dir->exists()) { fprintf(stderr,"nexgen_filter: reject directory \"%s\" does not exist\n", - (const char *)reject_dir); + reject_dir.toUtf8().constData()); exit(256); } } @@ -180,7 +180,8 @@ MainObject::MainObject(QObject *parent) // // Create Temp Directory // - strncpy(tempdir,RDTempDirectory::basePath()+"/nexgen_filterXXXXXX",PATH_MAX); + strncpy(tempdir,(RDTempDirectory::basePath()+"/nexgen_filterXXXXXX").toUtf8(), + PATH_MAX); filter_temp_dir=new QDir(mkdtemp(tempdir)); filter_temp_audiofile=filter_temp_dir->canonicalPath()+"/audio.dat"; @@ -191,7 +192,7 @@ MainObject::MainObject(QObject *parent) if(IsXmlFile(xml_files[i])) { if(audio_dir.isEmpty()) { fprintf(stderr,"unable to process \"%s\" [no --audio-dir specified]\n", - (const char *)xml_files[i]); + xml_files[i].toUtf8().constData()); } else { ProcessXmlFile(xml_files[i]); @@ -205,7 +206,7 @@ MainObject::MainObject(QObject *parent) // // Clean Up // - rmdir(filter_temp_dir->canonicalPath()); + rmdir(filter_temp_dir->canonicalPath().toUtf8()); exit(0); } @@ -235,7 +236,8 @@ void MainObject::ProcessArchive(const QString &filename) // // Create temporary directory // - snprintf(tempdir,PATH_MAX,"%s/XXXXXX",(const char *)RDTempDirectory::basePath()); + snprintf(tempdir,PATH_MAX,"%s/XXXXXX", + RDTempDirectory::basePath().toUtf8().constData()); if(mkdtemp(tempdir)==NULL) { return; } @@ -244,7 +246,7 @@ void MainObject::ProcessArchive(const QString &filename) // // Open Archive // - if((fd_in=open(filename,O_RDONLY))<0) { + if((fd_in=open(filename.toUtf8(),O_RDONLY))<0) { return; } @@ -253,17 +255,17 @@ void MainObject::ProcessArchive(const QString &filename) // while((read(fd_in,header,104)==104)&&(strncmp(header,"FR:",3)==0)) { files.push_back(dir+"/"+RDGetBasePart(QString(header+3).replace("\\","/"))); - if(files.back().right(4).lower()==".xml") { + if(files.back().right(4).toLower()==".xml") { xmlfile=files.back(); } - if(files.back().right(4).lower()==".wav") { + if(files.back().right(4).toLower()==".wav") { wavfile=files.back(); } len=((0xFF&header[103])<<24)+((0xFF&header[102])<<16)+ ((0xFF&header[101])<<8)+(0xFF&header[100]); - if((fd_out=open(files.back(),O_CREAT|O_WRONLY|O_TRUNC,S_IRUSR|S_IWUSR))<0) { + if((fd_out=open(files.back().toUtf8(),O_CREAT|O_WRONLY|O_TRUNC,S_IRUSR|S_IWUSR))<0) { fprintf(stderr,"unable to write temporary file \"%s\" [%s].\n", - (const char *)files.back(),strerror(errno)); + files.back().toUtf8().constData(),strerror(errno)); return; } if(fstat(fd_out,&stat)==0) { @@ -291,7 +293,7 @@ void MainObject::ProcessArchive(const QString &filename) // Clean Up // for(int i=0;i(int)filter_group->defaultHighCart())) { fprintf(stderr, "calculated cart number [%d] is invalid for group \"%s\"\n", - cartnum,(const char *)filter_group->name()); + cartnum,filter_group->name().toUtf8().constData()); WriteReject(xml); return; } @@ -354,17 +357,17 @@ void MainObject::ProcessXmlFile(const QString &xml,const QString &wavname, // Print(QString().sprintf("Importing cart %06d",cartnum)); if(!data.title().isEmpty()) { - Print(QString().sprintf(" [%s",(const char *)data.title())); + Print(QString().sprintf(" [%s",data.title().toUtf8().constData())); if(!data.artist().isEmpty()) { - Print(QString().sprintf("/%s",(const char *)data.artist())); + Print(QString().sprintf("/%s",data.artist().toUtf8().constData())); } Print(QString().sprintf("]")); } if(arcname.isEmpty()) { - Print(QString().sprintf(" from %s ...",(const char *)filename)); + Print(QString().sprintf(" from %s ...",filename.toUtf8().constData())); } else { - Print(QString().sprintf(" from %s ...",(const char *)arcname)); + Print(QString().sprintf(" from %s ...",arcname.toUtf8().constData())); } if(filter_delete_cuts) { delete_cuts_switch="--delete-cuts "; @@ -378,12 +381,12 @@ void MainObject::ProcessXmlFile(const QString &xml,const QString &wavname, filter_temp_audiofile; if(system(cmd.toUtf8())!=0) { Print(QString().sprintf(" aborted.\n")); - fprintf(stderr,"import of \"%s\" failed\n",(const char *)filename); + fprintf(stderr,"import of \"%s\" failed\n",filename.toUtf8().constData()); WriteReject(xml); return; } Print(QString().sprintf(" done.\n")); - unlink(filter_temp_audiofile); + unlink(filter_temp_audiofile.toUtf8()); // // Apply Metadata @@ -413,7 +416,7 @@ bool MainObject::OpenXmlFile(const QString &xml,RDWaveData *data, int fadeup_start=-1; int fadeup_len=-1; - if((f=fopen(xml,"r"))==NULL) { + if((f=fopen(xml.toUtf8(),"r"))==NULL) { return false; } if(fgets(line,1024,f)==NULL) { @@ -449,14 +452,14 @@ void MainObject::ProcessXmlLine(const QString &line,RDWaveData *data, int *fadeup_len) { QString tag= - line.mid(line.find("<")+1,line.find(">")-line.find("<")-1).lower(); - QString value=line.mid(line.find(">")+1,line.findRev("<")-line.find(">")-1); + line.mid(line.indexOf("<")+1,line.indexOf(">")-line.indexOf("<")-1).toLower(); + QString value=line.mid(line.indexOf(">")+1,line.lastIndexOf("<")-line.indexOf(">")-1); // printf("%s: %s\n",(const char *)tag,(const char *)value); if(tag=="file_name") { *filename=filter_audio_dir->canonicalPath()+"/"+ - value.right(value.length()-value.findRev('\\')-1); + value.right(value.length()-value.lastIndexOf('\\')-1); } if(tag=="cart") { *cartnum=value.toUInt()+filter_cart_offset; @@ -567,11 +570,11 @@ bool MainObject::PreprocessAudio(QString filename) int fd=-1; char c; - if((fd=open(filename,O_RDONLY))<0) { + if((fd=open(filename.toUtf8(),O_RDONLY))<0) { filename=SwapCase(filename); - if((fd=open(filename,O_RDONLY))<0) { + if((fd=open(filename.toUtf8(),O_RDONLY))<0) { fprintf(stderr,"unable to open audio file \"%s\"\n", - (const char *)filename); + filename.toUtf8().constData()); return false; } @@ -579,21 +582,22 @@ bool MainObject::PreprocessAudio(QString filename) lseek(fd,20,SEEK_SET); if(read(fd,&c,1)!=1) { close(fd); - fprintf(stderr,"truncated audio file \"%s\"\n",(const char *)filename); + fprintf(stderr,"truncated audio file \"%s\"\n",filename.toUtf8(). + constData()); return false; } close(fd); if(c==80) { // MPEG Audio - if(system(QString("madplay -Q -o wave:")+filter_temp_audiofile+" "+filename)!=0) { + if(system((QString("madplay -Q -o wave:")+filter_temp_audiofile+" "+filename).toUtf8())!=0) { fprintf(stderr,"MPEG converter error with file \"%s\"\n", - (const char *)filename); + filename.toUtf8().constData()); return false; } } else { // PCM Audio - if(symlink(filename,filter_temp_audiofile)!=0) { + if(symlink(filename.toUtf8(),filter_temp_audiofile.toUtf8())!=0) { fprintf(stderr,"unable to create symlink \"%s\"\n", - (const char *)filter_temp_audiofile); + filter_temp_audiofile.toUtf8().constData()); return false; } } @@ -608,7 +612,7 @@ void MainObject::WriteReject(const QString &filename) if(!RDCopy(filename,filter_reject_dir->canonicalPath()+"/"+ RDGetBasePart(filename))) { fprintf(stderr,"Unable to write to \"%s\"\n", - (const char *)filter_reject_dir->path()); + filter_reject_dir->path().toUtf8().constData()); } } } @@ -641,11 +645,12 @@ QDateTime MainObject::GetDateTime(const QString &str) const QString MainObject::SwapCase(const QString &str) const { QStringList parts=str.split("."); - if(parts[parts.size()-1].contains(QRegExp("*[a-z]*",true,true))>0) { - parts[parts.size()-1]=parts[parts.size()-1].upper(); + if(parts[parts.size()-1]. + contains(QRegExp("*[a-z]*",Qt::CaseSensitive,QRegExp::Wildcard))>0) { + parts[parts.size()-1]=parts[parts.size()-1].toUpper(); } else { - parts[parts.size()-1]=parts[parts.size()-1].lower(); + parts[parts.size()-1]=parts[parts.size()-1].toLower(); } return parts.join("."); } @@ -656,7 +661,7 @@ bool MainObject::IsXmlFile(const QString &filename) int fd=-1; char data[10]; - if((fd=open(filename,O_RDONLY))<0) { + if((fd=open(filename.toUtf8(),O_RDONLY))<0) { return false; } if(read(fd,data,8)!=8) { @@ -672,7 +677,7 @@ bool MainObject::IsXmlFile(const QString &filename) void MainObject::Print(const QString &msg) const { if(filter_verbose) { - printf("%s",(const char *)msg); + printf("%s",msg.toUtf8().constData()); fflush(stdout); } } diff --git a/importers/rivendell_filter.cpp b/importers/rivendell_filter.cpp index 0f6bf1a0..a998a572 100644 --- a/importers/rivendell_filter.cpp +++ b/importers/rivendell_filter.cpp @@ -190,8 +190,10 @@ MainObject::MainObject(QObject *parent) // // Verify that default group exists // - sql=QString().sprintf("select NAME from GROUPS where NAME=\"%s\"", - (const char *)default_group); + sql=QString("select ")+ + "NAME "+ + "from GROUPS where "+ + "NAME=\""+RDEscapeString(default_group)+"\""; q=new QSqlQuery(sql,filter_db); if(!q->next()) { fprintf(stderr,"rivendell_filter: default group does not exist\n"); @@ -237,7 +239,7 @@ MainObject::MainObject(QObject *parent) q=new QSqlQuery(sql,ext_db); while(q->next()) { printf("Transferring cart %06u [%s]...",q->value(0).toUInt(), - (const char *)q->value(3).toString()); + q->value(3).toString().toUtf8().constData()); fflush(stdout); // @@ -261,7 +263,7 @@ MainObject::MainObject(QObject *parent) q->value(0).toUInt()); q1=new QSqlQuery(sql,filter_db); while(q1->next()) { - unlink(RDCut::pathName(q1->value(0).toString())); + unlink(RDCut::pathName(q1->value(0).toString()).toUtf8()); } delete q1; sql=QString().sprintf("delete from CUTS where CART_NUMBER=%u", @@ -359,33 +361,27 @@ MainObject::MainObject(QObject *parent) start_datetime="null"; } else { - start_datetime=QString().sprintf("%s", - (const char *)RDCheckDateTime(q1->value(7). - toDateTime(),"yyyy-MM-dd hh:mm:ss"));//Could be invalid (0000-00-00) + start_datetime= + RDCheckDateTime(q1->value(7).toDateTime(),"yyyy-MM-dd hh:mm:ss"); } if(q1->value(8).isNull()) { end_datetime="null"; } else { - end_datetime=QString().sprintf("%s", - (const char *)RDCheckDateTime(q1->value(8). - toDateTime(),"yyyy-MM-dd hh:mm:ss"));//Could be invalid (0000-00-00) + end_datetime= + RDCheckDateTime(q1->value(8).toDateTime(),"yyyy-MM-dd hh:mm:ss"); } if(q1->value(16).isNull()) { start_daypart="null"; } else { - start_daypart=QString().sprintf("%s", - (const char *)RDCheckDateTime(q1->value(16). - toTime(),"hh:mm:ss"));//Invalid possible? + start_daypart=RDCheckDateTime(q1->value(16).toTime(),"hh:mm:ss"); } if(q1->value(17).isNull()) { end_daypart="null"; } else { - end_daypart=QString().sprintf("%s", - (const char *)RDCheckDateTime(q1->value(17). - toTime(),"hh:mm:ss"));//Invalid possible? + end_daypart=RDCheckDateTime(q1->value(17).toTime(),"hh:mm:ss"); } sql=QString("insert into CUTS set ")+ "CUT_NAME=\""+RDEscapeString(q1->value(0).toString())+"\","+ diff --git a/importers/sas_filter.cpp b/importers/sas_filter.cpp index 82a93824..fa89c8bc 100644 --- a/importers/sas_filter.cpp +++ b/importers/sas_filter.cpp @@ -45,7 +45,7 @@ MainObject::MainObject(QObject *parent) // rda=new RDApplication("sas_filter","sas_filter",SAS_FILTER_USAGE,this); if(!rda->open(&err_msg)) { - fprintf(stderr,"sas_filter: %s\n",(const char *)err_msg); + fprintf(stderr,"sas_filter: %s\n",err_msg.toUtf8().constData()); exit(1); } @@ -164,8 +164,8 @@ void MainObject::InjectLine(char *line) // Title // line[60]=0; - temp=QString(line+19).stripWhiteSpace(); - base_sql+=QString().sprintf("DESCRIPTION=\"%s\",",(const char *)temp); + temp=QString(line+19).trimmed(); + base_sql+=QString("DESCRIPTION=\"")+RDEscapeString(temp)+"\","; // // Active Flag diff --git a/importers/wings_filter.cpp b/importers/wings_filter.cpp index 989c44aa..1a6691fd 100644 --- a/importers/wings_filter.cpp +++ b/importers/wings_filter.cpp @@ -52,7 +52,7 @@ MainObject::MainObject(QObject *parent) // rda=static_cast(new RDCoreApplication("wings_filter","wings_filter",WINGS_FILTER_USAGE,this)); if(!rda->open(&err_msg)) { - fprintf(stderr,"wings_filter: %s\n",(const char *)err_msg); + fprintf(stderr,"wings_filter: %s\n",err_msg.toUtf8().constData()); exit(1); } @@ -88,7 +88,7 @@ MainObject::MainObject(QObject *parent) } } - FILE *file=fopen((const char *)dbname,"r"); + FILE *file=fopen(dbname.toUtf8(),"r"); if(file==NULL) { perror("wings_filter"); exit(1); @@ -101,18 +101,19 @@ MainObject::MainObject(QObject *parent) exit(256); } while(ReadLine(file,&wr)) { - strcpy(wr.extension,audio_extension); - audioname=QString().sprintf("%s/%s.%s",(const char *)audiodir, - wr.filename,(const char *)audio_extension); + strcpy(wr.extension,audio_extension.toUtf8()); + audioname=QString().sprintf("%s/%s.%s",audiodir.toUtf8().constData(), + wr.filename, + audio_extension.toUtf8().constData()); wavefile=new RDWaveFile(audioname); if(!wavefile->openWave()) { fprintf(stderr,"Unable to open %s, skipping...\n", - (const char *)audioname); + audioname.toUtf8().constData()); } else { if(wavefile->type()!=RDWaveFile::Atx) { fprintf(stderr,"ATX header in %s appears corrupt, skipping...\n", - (const char *)audioname); + audioname.toUtf8().constData()); } else { RDGroup *group=new RDGroup(wr.group); @@ -200,7 +201,7 @@ bool MainObject::ImportCut(RDGroup *group,struct WingsRecord *rec, destfile->closeWave(); printf("Importing %s - %s to cart %u, group %s\n", - rec->filename,rec->title,cartnum,(const char *)group->name()); + rec->filename,rec->title,cartnum,group->name().toUtf8().constData()); sql=QString("insert into CART set ")+ QString().sprintf("NUMBER=%u,",cartnum)+ diff --git a/lib/Makefile.am b/lib/Makefile.am index 6964bd16..f59052c8 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -20,7 +20,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -Wno-strict-aliasing -DQT3_SUPPORT -I/usr/include/Qt3Support -I/usr/include/taglib +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -Wno-strict-aliasing -I/usr/include/taglib MOC = @QT_MOC@ CWRAP = ../helpers/cwrap diff --git a/lib/export_bmiemr.cpp b/lib/export_bmiemr.cpp index 1cd98bee..394f2059 100644 --- a/lib/export_bmiemr.cpp +++ b/lib/export_bmiemr.cpp @@ -48,7 +48,7 @@ bool RDReport::ExportBmiEmr(const QString &filename,const QDate &startdate, return false; } QTextStream *strm=new QTextStream(file); - strm->setEncoding(QTextStream::UnicodeUTF8); + strm->setCodec("UTF-8"); // // Station Type diff --git a/lib/export_cutlog.cpp b/lib/export_cutlog.cpp index 273d3e9f..cc8b4c1c 100644 --- a/lib/export_cutlog.cpp +++ b/lib/export_cutlog.cpp @@ -49,7 +49,7 @@ bool RDReport::ExportCutLog(const QString &filename,const QDate &startdate, return false; } QTextStream *strm=new QTextStream(file); - strm->setEncoding(QTextStream::UnicodeUTF8); + strm->setCodec("UTF-8"); if(useLeadingZeros()) { cart_fmt=QString().sprintf("%%0%uu",cartDigits()); } @@ -108,7 +108,7 @@ bool RDReport::ExportCutLog(const QString &filename,const QDate &startdate, cut=" "; } } - cart_num=QString().sprintf(cart_fmt,q->value(1).toUInt()); + cart_num=QString().sprintf(cart_fmt.toUtf8(),q->value(1).toUInt()); QString desc=q->value(13).toString(); if(desc.isEmpty()) { desc=" "; diff --git a/lib/export_deltaflex.cpp b/lib/export_deltaflex.cpp index 8113c30b..d03d71d4 100644 --- a/lib/export_deltaflex.cpp +++ b/lib/export_deltaflex.cpp @@ -48,7 +48,7 @@ bool RDReport::ExportDeltaflex(const QString &filename,const QDate &startdate, return false; } QTextStream *strm=new QTextStream(file); - strm->setEncoding(QTextStream::UnicodeUTF8); + strm->setCodec("UTF-8"); if(useLeadingZeros()) { air_fmt=QString().sprintf("%%0%uu",cartDigits()); } @@ -115,14 +115,14 @@ bool RDReport::ExportDeltaflex(const QString &filename,const QDate &startdate, ext_data=""; if(q->value(6).toString().length()>0) { if(q->value(6).toString().length()<=8) { - for(int i=0;i<(8-q->value(6).toString().stripWhiteSpace().length()); + for(int i=0;i<(8-q->value(6).toString().trimmed().length()); i++) { ext_data+="0"; } - ext_data+=q->value(6).toString().stripWhiteSpace(); + ext_data+=q->value(6).toString().trimmed(); } else { - ext_data+=q->value(6).toString().stripWhiteSpace().left(8); + ext_data+=q->value(6).toString().trimmed().left(8); } } if(q->value(0).toUInt()<=999000) { @@ -148,7 +148,7 @@ bool RDReport::ExportDeltaflex(const QString &filename,const QDate &startdate, else { tfc_time=""; } - air_cartnum=QString().sprintf(air_fmt,q->value(1).toUInt()); + air_cartnum=QString().sprintf(air_fmt.toUtf8(),q->value(1).toUInt()); tfc_cartnum=q->value(10).toString(); *strm << q->value(2).toDateTime().toString("hhmm")+"|"; diff --git a/lib/export_musicclassical.cpp b/lib/export_musicclassical.cpp index 35cf8649..9b245895 100644 --- a/lib/export_musicclassical.cpp +++ b/lib/export_musicclassical.cpp @@ -47,7 +47,7 @@ bool RDReport::ExportMusicClassical(const QString &filename, return false; } QTextStream *strm=new QTextStream(file); - strm->setEncoding(QTextStream::UnicodeUTF8); + strm->setCodec("UTF-8"); if(useLeadingZeros()) { cart_fmt=QString().sprintf("%%0%uu",cartDigits()); } @@ -99,7 +99,7 @@ bool RDReport::ExportMusicClassical(const QString &filename, cut=" "; } } - cart_num=QString().sprintf(cart_fmt,q->value(1).toUInt()); + cart_num=QString().sprintf(cart_fmt.toUtf8(),q->value(1).toUInt()); *strm << q->value(2).toDateTime().time().toString("hhmm")+" "; *strm << RDGetTimeLength(q->value(0).toInt(),true,false).right(5)+" "; *strm << RDReport::leftJustify(q->value(3).toString(),30)+" "; diff --git a/lib/export_musicplayout.cpp b/lib/export_musicplayout.cpp index 8b8d220a..f51d37c6 100644 --- a/lib/export_musicplayout.cpp +++ b/lib/export_musicplayout.cpp @@ -48,7 +48,7 @@ bool RDReport::ExportMusicPlayout(const QString &filename, return false; } QTextStream *strm=new QTextStream(file); - strm->setEncoding(QTextStream::UnicodeUTF8); + strm->setCodec("UTF-8"); if(useLeadingZeros()) { cart_fmt=QString().sprintf("%%0%uu",cartDigits()); } @@ -102,7 +102,7 @@ bool RDReport::ExportMusicPlayout(const QString &filename, cut=" "; } } - cart_num=QString().sprintf(cart_fmt,q->value(1).toUInt()); + cart_num=QString().sprintf(cart_fmt.toUtf8(),q->value(1).toUInt()); *strm << q->value(2).toDateTime().time().toString("hh:mm:ss")+" "; *strm << cart_num+" "; *strm << cut+" "; diff --git a/lib/export_musicsummary.cpp b/lib/export_musicsummary.cpp index c11031bd..e1dde219 100644 --- a/lib/export_musicsummary.cpp +++ b/lib/export_musicsummary.cpp @@ -46,7 +46,7 @@ bool RDReport::ExportMusicSummary(const QString &filename, return false; } QTextStream *strm=new QTextStream(file); - strm->setEncoding(QTextStream::UnicodeUTF8); + strm->setCodec("UTF-8"); sql=QString("select ")+ "ELR_LINES.ARTIST,"+ // 00 "ELR_LINES.TITLE,"+ // 01 diff --git a/lib/export_nprsoundex.cpp b/lib/export_nprsoundex.cpp index d0d90cf6..db8e21ca 100644 --- a/lib/export_nprsoundex.cpp +++ b/lib/export_nprsoundex.cpp @@ -56,7 +56,7 @@ bool RDReport::ExportNprSoundEx(const QString &filename,const QDate &startdate, return false; } QTextStream *strm=new QTextStream(file); - strm->setEncoding(QTextStream::UnicodeUTF8); + strm->setCodec("UTF-8"); // // Generate Header diff --git a/lib/export_radiotraffic.cpp b/lib/export_radiotraffic.cpp index 8b5b8d5b..31f94ee5 100644 --- a/lib/export_radiotraffic.cpp +++ b/lib/export_radiotraffic.cpp @@ -55,7 +55,7 @@ bool RDReport::ExportRadioTraffic(const QString &filename, return false; } QTextStream *strm=new QTextStream(file); - strm->setEncoding(QTextStream::UnicodeUTF8); + strm->setCodec("UTF-8"); if(useLeadingZeros()) { air_fmt=QString().sprintf("%%0%uu ",cartDigits()); } @@ -101,7 +101,7 @@ bool RDReport::ExportRadioTraffic(const QString &filename, else { *strm << "00:00:00 "; } - *strm << QString().sprintf(air_fmt,q->value(1).toUInt()); + *strm << QString().sprintf(air_fmt.toUtf8(),q->value(1).toUInt()); *strm << RDReport::leftJustify(q->value(9).toString(),34)+" "; *strm << RDReport::leftJustify(q->value(6).toString(),32); *strm << "\x0d\x0a"; diff --git a/lib/export_resultsrecon.cpp b/lib/export_resultsrecon.cpp index 8cac987d..d985838b 100644 --- a/lib/export_resultsrecon.cpp +++ b/lib/export_resultsrecon.cpp @@ -43,7 +43,7 @@ bool RDReport::ExportResultsReport(const QString &filename, return false; } QTextStream *strm=new QTextStream(file); - strm->setEncoding(QTextStream::UnicodeUTF8); + strm->setCodec("UTF-8"); sql=QString("select ")+ "ELR_LINES.EVENT_DATETIME,"+ // 00 "ELR_LINES.EVENT_TYPE,"+ // 01 diff --git a/lib/export_soundex.cpp b/lib/export_soundex.cpp index 915bae3b..f5f5c6e2 100644 --- a/lib/export_soundex.cpp +++ b/lib/export_soundex.cpp @@ -63,7 +63,7 @@ bool RDReport::ExportSoundEx(const QString &filename,const QDate &startdate, return false; } QTextStream *strm=new QTextStream(file); - strm->setEncoding(QTextStream::UnicodeUTF8); + strm->setCodec("UTF-8"); // // Generate Header diff --git a/lib/export_spincount.cpp b/lib/export_spincount.cpp index 34cad70a..4c38c1eb 100644 --- a/lib/export_spincount.cpp +++ b/lib/export_spincount.cpp @@ -54,7 +54,7 @@ bool RDReport::ExportSpinCount(const QString &filename,const QDate &startdate, return false; } QTextStream *strm=new QTextStream(file); - strm->setEncoding(QTextStream::UnicodeUTF8); + strm->setCodec("UTF-8"); if(useLeadingZeros()) { cart_fmt=QString().sprintf("%%0%uu",cartDigits()); } diff --git a/lib/export_technical.cpp b/lib/export_technical.cpp index a15aa17e..b4ce8aad 100644 --- a/lib/export_technical.cpp +++ b/lib/export_technical.cpp @@ -51,7 +51,7 @@ bool RDReport::ExportTechnical(const QString &filename,const QDate &startdate, return false; } QTextStream *strm=new QTextStream(file); - strm->setEncoding(QTextStream::UnicodeUTF8); + strm->setCodec("UTF-8"); if(useLeadingZeros()) { cart_fmt=QString().sprintf("%%0%uu",cartDigits()); } @@ -117,7 +117,7 @@ bool RDReport::ExportTechnical(const QString &filename,const QDate &startdate, cut=" "; } } - cart_num=QString().sprintf(cart_fmt,q->value(1).toUInt()); + cart_num=QString().sprintf(cart_fmt.toUtf8(),q->value(1).toUInt()); *strm << q->value(2).toTime().toString("hh:mm:ss")+" "; *strm << cart_num+" "; *strm << cut+" "; diff --git a/lib/export_textlog.cpp b/lib/export_textlog.cpp index 3ac4f8ba..7d6940b5 100644 --- a/lib/export_textlog.cpp +++ b/lib/export_textlog.cpp @@ -47,7 +47,7 @@ bool RDReport::ExportTextLog(const QString &filename,const QDate &startdate, return false; } QTextStream *strm=new QTextStream(file); - strm->setEncoding(QTextStream::UnicodeUTF8); + strm->setCodec("UTF-8"); if(useLeadingZeros()) { cart_fmt=QString().sprintf("%%0%uu",cartDigits()); } @@ -105,7 +105,7 @@ bool RDReport::ExportTextLog(const QString &filename,const QDate &startdate, cut=" "; } } - cart_num=QString().sprintf(cart_fmt,q->value(1).toUInt()); + cart_num=QString().sprintf(cart_fmt.toUtf8(),q->value(1).toUInt()); *strm << q->value(2).toTime().toString("hh:mm:ss")+" "; *strm << RDReport::rightJustify(cart_num,6)+" "; *strm << cut+" "; diff --git a/lib/rdadd_cart.cpp b/lib/rdadd_cart.cpp index 13602392..986e4b02 100644 --- a/lib/rdadd_cart.cpp +++ b/lib/rdadd_cart.cpp @@ -52,19 +52,17 @@ RDAddCart::RDAddCart(QString *group,RDCart::Type *type,QString *title, // cart_group_box=new QComboBox(this); cart_group_box->setGeometry(145,11,160,19); - QLabel *cart_group_label= - new QLabel(cart_group_box,tr("&Group:"),this, - "cart_group_label"); + QLabel *cart_group_label=new QLabel(tr("&Group:"),this); cart_group_label->setGeometry(10,11,130,19); - cart_group_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + cart_group_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); cart_group_label->setFont(labelFont()); sql=QString("select GROUP_NAME from USER_PERMS where ")+ "USER_NAME=\""+RDEscapeString(username)+"\" order by GROUP_NAME"; q=new RDSqlQuery(sql); while(q->next()) { - cart_group_box->insertItem(q->value(0).toString()); + cart_group_box->insertItem(cart_group_box->count(),q->value(0).toString()); if(q->value(0).toString()==*cart_group) { - cart_group_box->setCurrentItem(cart_group_box->count()-1); + cart_group_box->setCurrentIndex(cart_group_box->count()-1); } } delete q; @@ -77,37 +75,35 @@ RDAddCart::RDAddCart(QString *group,RDCart::Type *type,QString *title, cart_number_edit=new QLineEdit(this); cart_number_edit->setGeometry(145,32,60,19); cart_number_edit->setMaxLength(6); - QIntValidator *validator=new QIntValidator(this,"validator"); + QIntValidator *validator=new QIntValidator(this); validator->setRange(1,999999); cart_number_edit->setValidator(validator); - QLabel *cart_number_label= - new QLabel(cart_number_edit,tr("&New Cart Number:"),this); + QLabel *cart_number_label=new QLabel(tr("&New Cart Number:"),this); cart_number_label->setGeometry(10,32,130,19); cart_number_label->setFont(labelFont()); - cart_number_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + cart_number_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Cart Type // cart_type_box=new QComboBox(this); cart_type_box->setGeometry(145,53,100,19); - QLabel *cart_type_label= - new QLabel(cart_type_box,tr("&New Cart Type:"),this); + QLabel *cart_type_label=new QLabel(tr("&New Cart Type:"),this); cart_type_label->setGeometry(10,53,130,19); cart_type_label->setFont(labelFont()); - cart_type_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + cart_type_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); if((*cart_type==RDCart::All)||(*cart_type==RDCart::Audio)) { - cart_type_box->insertItem(tr("Audio")); + cart_type_box->insertItem(cart_type_box->count(),tr("Audio")); } if((*cart_type==RDCart::All)||(*cart_type==RDCart::Macro)) { - cart_type_box->insertItem(tr("Macro")); + cart_type_box->insertItem(cart_type_box->count(),tr("Macro")); } if(*cart_type==RDCart::All) { sql=QString("select DEFAULT_CART_TYPE from GROUPS where ")+ "NAME=\""+RDEscapeString(*cart_group)+"\""; q=new RDSqlQuery(sql); if(q->first()) { - cart_type_box->setCurrentItem(q->value(0).toUInt()-1); + cart_type_box->setCurrentIndex(q->value(0).toUInt()-1); } delete q; } @@ -120,11 +116,10 @@ RDAddCart::RDAddCart(QString *group,RDCart::Type *type,QString *title, cart_title_edit->setMaxLength(255); // cart_title_edit->setValidator(text_validator); cart_title_edit->setText(tr("[new cart]")); - QLabel *cart_title_label= - new QLabel(cart_title_edit,tr("&New Cart Title:"),this); + QLabel *cart_title_label=new QLabel(tr("&New Cart Title:"),this); cart_title_label->setGeometry(10,73,130,19); cart_title_label->setFont(labelFont()); - cart_title_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + cart_title_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Ok Button @@ -187,9 +182,10 @@ void RDAddCart::okData() QString sql; unsigned num; RDGroup *group=new RDGroup(cart_group_box->currentText()); + bool ok=false; - if((sscanf((const char *)cart_number_edit->text(),"%d",&num)!=1)|| - (num<=0)) { + num=cart_number_edit->text().toUInt(&ok); + if((!ok)||(num==0)) { QMessageBox::warning(this,tr("Invalid Number"),tr("Invalid Cart Number!")); return; } @@ -234,7 +230,7 @@ void RDAddCart::okData() delete group; *cart_group=cart_group_box->currentText(); if(*cart_type==RDCart::All) { - *cart_type=(RDCart::Type)(cart_type_box->currentItem()+1); + *cart_type=(RDCart::Type)(cart_type_box->currentIndex()+1); } *cart_title=cart_title_edit->text(); done(num); diff --git a/lib/rdadd_log.cpp b/lib/rdadd_log.cpp index 20d2d3c6..691b0e05 100644 --- a/lib/rdadd_log.cpp +++ b/lib/rdadd_log.cpp @@ -45,7 +45,7 @@ RDAddLog::RDAddLog(QString *logname,QString *svcname, setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); - setCaption(tr("Create Log")); + setWindowTitle(tr("Create Log")); // // Validator @@ -60,7 +60,7 @@ RDAddLog::RDAddLog(QString *logname,QString *svcname, add_name_edit->setGeometry(115,11,sizeHint().width()-125,19); add_name_edit->setMaxLength(64); add_name_edit->setValidator(v); - QLabel *label=new QLabel(add_name_edit,tr("&New Log Name:"),this); + QLabel *label=new QLabel(tr("&New Log Name:"),this); label->setGeometry(10,13,100,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight); @@ -72,7 +72,7 @@ RDAddLog::RDAddLog(QString *logname,QString *svcname, // add_service_box=new QComboBox(this); add_service_box->setGeometry(115,33,100,19); - label=new QLabel(add_name_edit,tr("&Service:"),this); + label=new QLabel(tr("&Service:"),this); label->setGeometry(10,33,100,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight); @@ -121,7 +121,8 @@ RDAddLog::RDAddLog(QString *logname,QString *svcname, } q=new RDSqlQuery(sql); while(q->next()) { - add_service_box->insertItem(q->value(0).toString()); + add_service_box-> + insertItem(add_service_box->count(),q->value(0).toString()); } } @@ -151,7 +152,7 @@ void RDAddLog::okData() return; } - *log_name=add_name_edit->text().stripWhiteSpace(); + *log_name=add_name_edit->text().trimmed(); *log_svc=add_service_box->currentText(); done(0); } diff --git a/lib/rdapplication.cpp b/lib/rdapplication.cpp index 987c13b2..5bdc5308 100644 --- a/lib/rdapplication.cpp +++ b/lib/rdapplication.cpp @@ -40,3 +40,14 @@ RDIconEngine *RDApplication::iconEngine() const { return app_icon_engine; } + + +QString RDApplication::locale() +{ + QString ret; + + if(getenv("LANG")!=NULL) { + ret=getenv("LANG"); + } + return ret; +} diff --git a/lib/rdapplication.h b/lib/rdapplication.h index 29f748cf..57aa2bcf 100644 --- a/lib/rdapplication.h +++ b/lib/rdapplication.h @@ -32,6 +32,7 @@ class RDApplication : public RDCoreApplication const QString &usage,QObject *parent=0); ~RDApplication(); RDIconEngine *iconEngine() const; + static QString locale(); private: RDIconEngine *app_icon_engine; diff --git a/lib/rdaudioconvert.cpp b/lib/rdaudioconvert.cpp index 53bdb246..9f24e101 100644 --- a/lib/rdaudioconvert.cpp +++ b/lib/rdaudioconvert.cpp @@ -367,7 +367,7 @@ RDAudioConvert::ErrorCode RDAudioConvert::Stage1Flac(const QString &dstfile, sf_dst_info.format=SF_FORMAT_WAV|SF_FORMAT_FLOAT; sf_dst_info.channels=wave->getChannels(); sf_dst_info.samplerate=wave->getSamplesPerSec(); - if((sf_dst=sf_open(dstfile,SFM_WRITE,&sf_dst_info))==NULL) { + if((sf_dst=sf_open(dstfile.toUtf8(),SFM_WRITE,&sf_dst_info))==NULL) { return RDAudioConvert::ErrorNoDestination; } @@ -422,7 +422,7 @@ RDAudioConvert::ErrorCode RDAudioConvert::Stage1Vorbis(const QString &dstfile, sf_dst_info.format=SF_FORMAT_WAV|SF_FORMAT_FLOAT; sf_dst_info.channels=wave->getChannels(); sf_dst_info.samplerate=wave->getSamplesPerSec(); - if((sf_dst=sf_open(dstfile,SFM_WRITE,&sf_dst_info))==NULL) { + if((sf_dst=sf_open(dstfile.toUtf8(),SFM_WRITE,&sf_dst_info))==NULL) { return RDAudioConvert::ErrorNoDestination; } @@ -577,7 +577,7 @@ RDAudioConvert::ErrorCode RDAudioConvert::Stage1Mpeg(const QString &dstfile, sf_dst_info.format=SF_FORMAT_WAV|SF_FORMAT_FLOAT; sf_dst_info.channels=wave->getChannels(); sf_dst_info.samplerate=wave->getSamplesPerSec(); - if((sf_dst=sf_open(dstfile,SFM_WRITE,&sf_dst_info))==NULL) { + if((sf_dst=sf_open(dstfile.toUtf8(),SFM_WRITE,&sf_dst_info))==NULL) { return RDAudioConvert::ErrorNoDestination; } sf_command(sf_dst,SFC_SET_NORM_DOUBLE,NULL,SF_FALSE); @@ -872,7 +872,7 @@ RDAudioConvert::ErrorCode RDAudioConvert::Stage1SndFile(const QString &dstfile, // sf_dst_info=*sf_src_info; sf_dst_info.format=SF_FORMAT_WAV|SF_FORMAT_FLOAT; - if((sf_dst=sf_open(dstfile,SFM_WRITE,&sf_dst_info))==NULL) { + if((sf_dst=sf_open(dstfile.toUtf8(),SFM_WRITE,&sf_dst_info))==NULL) { return RDAudioConvert::ErrorNoDestination; } @@ -925,7 +925,7 @@ RDAudioConvert::ErrorCode RDAudioConvert::Stage2Convert(const QString &srcfile, // Open Files // memset(&src_info,0,sizeof(src_info)); - if((src_sf=sf_open(srcfile,SFM_READ,&src_info))==NULL) { + if((src_sf=sf_open(srcfile.toUtf8(),SFM_READ,&src_info))==NULL) { rda->syslog(LOG_WARNING,"Could not open %s",(const char *)srcfile.toUtf8()); return RDAudioConvert::ErrorInternal; } @@ -935,7 +935,7 @@ RDAudioConvert::ErrorCode RDAudioConvert::Stage2Convert(const QString &srcfile, dst_info.format=SF_FORMAT_WAV|SF_FORMAT_PCM_32; dst_info.channels=conv_settings->channels(); dst_info.samplerate=conv_settings->sampleRate(); - if((dst_sf=sf_open(dstfile,SFM_WRITE,&dst_info))==NULL) { + if((dst_sf=sf_open(dstfile.toUtf8(),SFM_WRITE,&dst_info))==NULL) { sf_close(src_sf); rda->syslog(LOG_WARNING,"Could not open %s",(const char *)dstfile.toUtf8()); return RDAudioConvert::ErrorInternal; @@ -1146,7 +1146,7 @@ RDAudioConvert::ErrorCode RDAudioConvert::Stage3Convert(const QString &srcfile, // // Open Source File // - if((src_sf=sf_open(srcfile,SFM_READ,&src_sf_info))==NULL) { + if((src_sf=sf_open(srcfile.toUtf8(),SFM_READ,&src_sf_info))==NULL) { rda->syslog(LOG_WARNING,"%s",sf_strerror(NULL)); return RDAudioConvert::ErrorInternal; } @@ -1207,7 +1207,7 @@ RDAudioConvert::ErrorCode RDAudioConvert::Stage3Flac(SNDFILE *src_sf, flac->set_sample_rate(src_sf_info->samplerate); //flac->set_compression_level(8); flac->set_blocksize(0); - unlink(dstfile); + unlink(dstfile.toUtf8()); /* * FLAC <1.2.x * @@ -1225,7 +1225,7 @@ RDAudioConvert::ErrorCode RDAudioConvert::Stage3Flac(SNDFILE *src_sf, /* * FLAC 1.2.x */ - switch(flac->init(dstfile.ascii())) { + switch(flac->init(dstfile.toAscii())) { case FLAC__STREAM_ENCODER_INIT_STATUS_OK: break; @@ -1297,8 +1297,8 @@ RDAudioConvert::ErrorCode RDAudioConvert::Stage3Vorbis(SNDFILE *src_sf, // // Open Destination File // - unlink(dstfile); - if((dst_fd=open(dstfile,O_WRONLY|O_CREAT|O_TRUNC, + unlink(dstfile.toUtf8()); + if((dst_fd=open(dstfile.toUtf8(),O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH))<0) { return RDAudioConvert::ErrorNoDestination; } @@ -1492,8 +1492,8 @@ RDAudioConvert::ErrorCode RDAudioConvert::Stage3Layer3(SNDFILE *src_sf, // // Open Destination File // - unlink(dstfile); - if((dst_fd=open(dstfile,O_WRONLY|O_CREAT|O_TRUNC, + unlink(dstfile.toUtf8()); + if((dst_fd=open(dstfile.toUtf8(),O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH))<0) { return RDAudioConvert::ErrorNoDestination; } @@ -1633,7 +1633,7 @@ RDAudioConvert::ErrorCode RDAudioConvert::Stage3Layer2Wav(SNDFILE *src_sf, wave->setCartChunk(conv_dst_wavedata!=NULL); wave->setLevlChunk(true); wave->setRdxlContents(conv_dst_rdxl); - unlink(dstfile); + unlink(dstfile.toUtf8()); if(!wave->createWave(conv_dst_wavedata,conv_start_point)) { return RDAudioConvert::ErrorNoDestination; } @@ -1737,8 +1737,8 @@ RDAudioConvert::ErrorCode RDAudioConvert::Stage3Layer2(SNDFILE *src_sf, // // Open Destination File // - unlink(dstfile); - if((dst_fd=open(dstfile,O_WRONLY|O_CREAT|O_TRUNC, + unlink(dstfile.toUtf8()); + if((dst_fd=open(dstfile.toUtf8(),O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH))<0) { return RDAudioConvert::ErrorNoDestination; } @@ -1831,7 +1831,7 @@ RDAudioConvert::ErrorCode RDAudioConvert::Stage3Pcm16(SNDFILE *src_sf, } wave->setLevlChunk(true); sf_buffer=new int16_t[2048*src_sf_info->channels]; - unlink(dstfile); + unlink(dstfile.toUtf8()); if(!wave->createWave(conv_dst_wavedata,conv_start_point)) { return RDAudioConvert::ErrorNoDestination; } @@ -1876,7 +1876,7 @@ RDAudioConvert::ErrorCode RDAudioConvert::Stage3Pcm24(SNDFILE *src_sf, wave->setLevlChunk(true); sf_buffer=new int[2048*src_sf_info->channels]; pcm24=new uint8_t[2048*src_sf_info->channels*sizeof(int)]; - unlink(dstfile); + unlink(dstfile.toUtf8()); if(!wave->createWave(conv_dst_wavedata,conv_start_point)) { return RDAudioConvert::ErrorNoDestination; } diff --git a/lib/rdaudioexport.cpp b/lib/rdaudioexport.cpp index 99d4ec66..3a7b2b53 100644 --- a/lib/rdaudioexport.cpp +++ b/lib/rdaudioexport.cpp @@ -133,7 +133,6 @@ RDAudioExport::ErrorCode RDAudioExport::runExport(const QString &username, long response_code; CURL *curl=NULL; FILE *f=NULL; - char url[1024]; struct curl_httppost *first=NULL; struct curl_httppost *last=NULL; RDAudioExport::ErrorCode ret; @@ -144,57 +143,58 @@ RDAudioExport::ErrorCode RDAudioExport::runExport(const QString &username, // curl_formadd(&first,&last,CURLFORM_PTRNAME,"COMMAND", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",RDXPORT_COMMAND_EXPORT), - CURLFORM_END); + QString().sprintf("%u",RDXPORT_COMMAND_EXPORT).toUtf8(). + constData(),CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"LOGIN_NAME", - CURLFORM_COPYCONTENTS,(const char *)username.utf8(),CURLFORM_END); + CURLFORM_COPYCONTENTS,username.toUtf8().constData(), + CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"PASSWORD", - CURLFORM_COPYCONTENTS,(const char *)password.utf8(),CURLFORM_END); + CURLFORM_COPYCONTENTS,password.toUtf8().constData(), + CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"CART_NUMBER", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_cart_number), + QString().sprintf("%u",conv_cart_number).toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"CUT_NUMBER", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_cut_number), + QString().sprintf("%u",conv_cut_number).toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"FORMAT", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_settings->format()), - CURLFORM_END); + QString().sprintf("%u",conv_settings->format()). + toUtf8().constData(),CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"CHANNELS", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_settings->channels()), - CURLFORM_END); + QString().sprintf("%u",conv_settings->channels()). + toUtf8().constData(),CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"SAMPLE_RATE", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_settings->sampleRate()), - CURLFORM_END); + QString().sprintf("%u",conv_settings->sampleRate()). + toUtf8().constData(),CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"BIT_RATE", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_settings->bitRate()), - CURLFORM_END); + QString().sprintf("%u",conv_settings->bitRate()). + toUtf8().constData(),CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"QUALITY", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_settings->quality()), - CURLFORM_END); + QString().sprintf("%u",conv_settings->quality()). + toUtf8().constData(),CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"START_POINT", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%d",conv_start_point), + QString().sprintf("%d",conv_start_point).toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"END_POINT", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%d",conv_end_point), + QString().sprintf("%d",conv_end_point).toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"NORMALIZATION_LEVEL", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%d",conv_settings-> - normalizationLevel()), - CURLFORM_END); + QString().sprintf("%d",conv_settings->normalizationLevel()). + toUtf8().constData(),CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"ENABLE_METADATA", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_enable_metadata), - CURLFORM_END); + QString().sprintf("%u",conv_enable_metadata). + toUtf8().constData(),CURLFORM_END); if((curl=curl_easy_init())==NULL) { curl_formfree(first); return RDAudioExport::ErrorInternal; @@ -209,12 +209,12 @@ RDAudioExport::ErrorCode RDAudioExport::runExport(const QString &username, // otherwise some versions of LibCurl will throw a 'bad/illegal format' // error. // - strncpy(url,rda->station()->webServiceUrl(rda->config()),1024); - curl_easy_setopt(curl,CURLOPT_URL,url); + // strncpy(url,rda->station()->webServiceUrl(rda->config()),1024); + curl_easy_setopt(curl,CURLOPT_URL,rda->station()->webServiceUrl(rda->config()).toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_HTTPPOST,first); curl_easy_setopt(curl,CURLOPT_WRITEDATA,f); curl_easy_setopt(curl,CURLOPT_USERAGENT, - (const char *)rda->config()->userAgent()); + rda->config()->userAgent().toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_PROGRESSFUNCTION,ExportProgressCallback); curl_easy_setopt(curl,CURLOPT_PROGRESSDATA,this); diff --git a/lib/rdaudioimport.cpp b/lib/rdaudioimport.cpp index 282feccc..1d4990c4 100644 --- a/lib/rdaudioimport.cpp +++ b/lib/rdaudioimport.cpp @@ -113,7 +113,6 @@ RDAudioImport::ErrorCode RDAudioImport::runImport(const QString &username, CURLcode curl_err; struct curl_httppost *first=NULL; struct curl_httppost *last=NULL; - char url[1024]; QString xml; RDWebResult web_result; @@ -124,39 +123,42 @@ RDAudioImport::ErrorCode RDAudioImport::runImport(const QString &username, // curl_formadd(&first,&last,CURLFORM_PTRNAME,"COMMAND", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",RDXPORT_COMMAND_IMPORT), - CURLFORM_END); + QString().sprintf("%u",RDXPORT_COMMAND_IMPORT). + toUtf8().constData(),CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"LOGIN_NAME", - CURLFORM_COPYCONTENTS,(const char *)username.utf8(),CURLFORM_END); + CURLFORM_COPYCONTENTS,username.toUtf8().constData(), + CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"PASSWORD", - CURLFORM_COPYCONTENTS,(const char *)password.utf8(),CURLFORM_END); + CURLFORM_COPYCONTENTS,password.toUtf8().constData(), + CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"CART_NUMBER", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_cart_number), + QString().sprintf("%u",conv_cart_number).toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"CUT_NUMBER", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_cut_number), + QString().sprintf("%u",conv_cut_number).toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"CHANNELS", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_settings->channels()), + QString().sprintf("%u",conv_settings->channels()). + toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"NORMALIZATION_LEVEL", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%d",conv_settings-> - normalizationLevel()), + QString().sprintf("%d",conv_settings->normalizationLevel()). + toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"AUTOTRIM_LEVEL", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%d",conv_settings-> - autotrimLevel()),CURLFORM_END); + QString().sprintf("%d",conv_settings->autotrimLevel()). + toUtf8().constData(),CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"USE_METADATA", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_use_metadata), + QString().sprintf("%u",conv_use_metadata).toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"FILENAME", - CURLFORM_FILE,(const char *)(conv_src_filename.utf8()), + CURLFORM_FILE,conv_src_filename.toUtf8().constData(), CURLFORM_END); // @@ -169,20 +171,15 @@ RDAudioImport::ErrorCode RDAudioImport::runImport(const QString &username, curl_easy_setopt(curl,CURLOPT_WRITEDATA,stdout); curl_easy_setopt(curl,CURLOPT_HTTPPOST,first); curl_easy_setopt(curl,CURLOPT_USERAGENT, - (const char *)rda->config()->userAgent()); + rda->config()->userAgent().toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_PROGRESSFUNCTION,ImportProgressCallback); curl_easy_setopt(curl,CURLOPT_PROGRESSDATA,this); curl_easy_setopt(curl,CURLOPT_NOPROGRESS,0); curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,ImportReadCallback); curl_easy_setopt(curl,CURLOPT_WRITEDATA,&xml); - // - // Write out URL as a C string before passing to curl_easy_setopt(), - // otherwise some versions of LibCurl will throw a 'bad/illegal format' - // error. - // - strncpy(url,rda->station()->webServiceUrl(rda->config()),1024); - curl_easy_setopt(curl,CURLOPT_URL,url); + curl_easy_setopt(curl,CURLOPT_URL,rda->station()-> + webServiceUrl(rda->config()).toUtf8().constData()); // // Send it diff --git a/lib/rdaudioinfo.cpp b/lib/rdaudioinfo.cpp index 462111a8..ffe31c7e 100644 --- a/lib/rdaudioinfo.cpp +++ b/lib/rdaudioinfo.cpp @@ -123,19 +123,22 @@ RDAudioInfo::ErrorCode RDAudioInfo::runInfo(const QString &username, // curl_formadd(&first,&last,CURLFORM_PTRNAME,"COMMAND", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",RDXPORT_COMMAND_AUDIOINFO), + QString().sprintf("%u",RDXPORT_COMMAND_AUDIOINFO). + toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"LOGIN_NAME", - CURLFORM_COPYCONTENTS,(const char *)username.utf8(),CURLFORM_END); + CURLFORM_COPYCONTENTS,username.toUtf8().constData(), + CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"PASSWORD", - CURLFORM_COPYCONTENTS,(const char *)password.utf8(),CURLFORM_END); + CURLFORM_COPYCONTENTS,password.toUtf8().constData(), + CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"CART_NUMBER", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_cart_number), + QString().sprintf("%u",conv_cart_number).toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"CUT_NUMBER", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_cut_number), + QString().sprintf("%u",conv_cut_number).toUtf8().constData(), CURLFORM_END); if((curl=curl_easy_init())==NULL) { curl_formfree(first); @@ -146,13 +149,13 @@ RDAudioInfo::ErrorCode RDAudioInfo::runInfo(const QString &username, // otherwise some versions of LibCurl will throw a 'bad/illegal format' // error. // - strncpy(url,rda->station()->webServiceUrl(rda->config()),1024); - curl_easy_setopt(curl,CURLOPT_URL,url); + curl_easy_setopt(curl,CURLOPT_URL,rda->station()-> + webServiceUrl(rda->config()).toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,RDAudioInfoCallback); curl_easy_setopt(curl,CURLOPT_WRITEDATA,&conv_xml); curl_easy_setopt(curl,CURLOPT_HTTPPOST,first); curl_easy_setopt(curl,CURLOPT_USERAGENT, - (const char *)rda->config()->userAgent()); + rda->config()->userAgent().toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); switch(curl_err=curl_easy_perform(curl)) { diff --git a/lib/rdaudiostore.cpp b/lib/rdaudiostore.cpp index 6df8df71..b6bdf67a 100644 --- a/lib/rdaudiostore.cpp +++ b/lib/rdaudiostore.cpp @@ -72,7 +72,6 @@ RDAudioStore::ErrorCode RDAudioStore::runStore(const QString &username, { long response_code; CURL *curl=NULL; - char url[1024]; CURLcode curl_err; struct curl_httppost *first=NULL; struct curl_httppost *last=NULL; @@ -82,29 +81,24 @@ RDAudioStore::ErrorCode RDAudioStore::runStore(const QString &username, // curl_formadd(&first,&last,CURLFORM_PTRNAME,"COMMAND", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",RDXPORT_COMMAND_AUDIOSTORE), + QString().sprintf("%u",RDXPORT_COMMAND_AUDIOSTORE).toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"LOGIN_NAME", - CURLFORM_COPYCONTENTS,(const char *)username.utf8(),CURLFORM_END); + CURLFORM_COPYCONTENTS,username.toUtf8().constData(),CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"PASSWORD", - CURLFORM_COPYCONTENTS,(const char *)password.utf8(),CURLFORM_END); + CURLFORM_COPYCONTENTS,(const char *)password.toUtf8(),CURLFORM_END); if((curl=curl_easy_init())==NULL) { curl_formfree(first); return RDAudioStore::ErrorInternal; } - // - // Write out URL as a C string before passing to curl_easy_setopt(), - // otherwise some versions of LibCurl will throw a 'bad/illegal format' - // error. - // - strncpy(url,conv_station->webServiceUrl(conv_config),1024); - curl_easy_setopt(curl,CURLOPT_URL,url); + curl_easy_setopt(curl,CURLOPT_URL,conv_station->webServiceUrl(conv_config). + toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,RDAudioStoreCallback); curl_easy_setopt(curl,CURLOPT_WRITEDATA,&conv_xml); curl_easy_setopt(curl,CURLOPT_HTTPPOST,first); - curl_easy_setopt(curl,CURLOPT_USERAGENT, - (const char *)conv_config->userAgent()); + curl_easy_setopt(curl,CURLOPT_USERAGENT,conv_config->userAgent(). + toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); switch(curl_err=curl_easy_perform(curl)) { diff --git a/lib/rdbusybar.cpp b/lib/rdbusybar.cpp index b1e1d7f6..2df45ce9 100644 --- a/lib/rdbusybar.cpp +++ b/lib/rdbusybar.cpp @@ -26,16 +26,16 @@ RDBusyBar::RDBusyBar(QWidget *parent,Qt::WFlags f) bar_pos=0; setFrameStyle(QFrame::StyledPanel|QFrame::Sunken); QPalette p=palette(); - p.setColor(QPalette::Active,QColorGroup::Background, - p.color(QPalette::Active,QColorGroup::Base)); + p.setColor(QPalette::Active,QPalette::Background, + p.color(QPalette::Active,QPalette::Base)); setPalette(p); bar_label=new QLabel(this); - p.setColor(QPalette::Active,QColorGroup::Background, - p.color(QPalette::Active,QColorGroup::Highlight)); + p.setColor(QPalette::Active,QPalette::Background, + p.color(QPalette::Active,QPalette::Highlight)); bar_label->setPalette(p); bar_label->setStyleSheet("background-color:"+ - p.color(QPalette::Active,QColorGroup::Highlight).name()); + p.color(QPalette::Active,QPalette::Highlight).name()); bar_label->hide(); bar_timer=new QTimer(this); diff --git a/lib/rdbusydialog.cpp b/lib/rdbusydialog.cpp index 97a84994..c5606a0e 100644 --- a/lib/rdbusydialog.cpp +++ b/lib/rdbusydialog.cpp @@ -47,7 +47,7 @@ QSize RDBusyDialog::sizeHint() const void RDBusyDialog::show(const QString &caption,const QString &label) { - setCaption(caption); + setWindowTitle(caption); bar_label->setText(label); bar_bar->activate(true); QDialog::show(); diff --git a/lib/rdbutton_dialog.cpp b/lib/rdbutton_dialog.cpp index e3386578..68a935bd 100644 --- a/lib/rdbutton_dialog.cpp +++ b/lib/rdbutton_dialog.cpp @@ -51,10 +51,9 @@ RDButtonDialog::RDButtonDialog(QString station_name,const QString &caption, // // Button Label // - edit_label_edit=new QLineEdit(this,"edit_label_edit"); + edit_label_edit=new QLineEdit(this); edit_label_edit->setGeometry(60,10,300,20); - QLabel *label=new QLabel(edit_label_edit,tr("Label:"), - this,"edit_label_label"); + QLabel *label=new QLabel(tr("Label:"),this); label->setGeometry(10,12,45,16); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight); @@ -62,10 +61,10 @@ RDButtonDialog::RDButtonDialog(QString station_name,const QString &caption, // // Button Cart // - edit_cart_edit=new QLineEdit(this,"edit_cart_edit"); + edit_cart_edit=new QLineEdit(this); edit_cart_edit->setGeometry(60,34,300,20); edit_cart_edit->setReadOnly(true); - label=new QLabel(edit_cart_edit,tr("Cart:"),this,"edit_cart_label"); + label=new QLabel(tr("Cart:"),this); label->setGeometry(10,36,45,16); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight); @@ -73,7 +72,7 @@ RDButtonDialog::RDButtonDialog(QString station_name,const QString &caption, // // Set Cart Button // - QPushButton *button=new QPushButton(this,"cart_button"); + QPushButton *button=new QPushButton(this); button->setGeometry(55,60,80,50); button->setFont(buttonFont()); button->setText(tr("Set\nCart")); @@ -82,7 +81,7 @@ RDButtonDialog::RDButtonDialog(QString station_name,const QString &caption, // // Clear Button // - button=new QPushButton(this,"cart_button"); + button=new QPushButton(this); button->setGeometry(145,60,80,50); button->setFont(buttonFont()); button->setText(tr("Clear")); @@ -91,7 +90,7 @@ RDButtonDialog::RDButtonDialog(QString station_name,const QString &caption, // // Color Button // - edit_color_button=new QPushButton(this,"edit_color_button"); + edit_color_button=new QPushButton(this); edit_color_button->setGeometry(sizeHint().width()-135,60,80,50); edit_color_button->setFont(buttonFont()); edit_color_button->setText(tr("Set\nColor")); @@ -100,7 +99,7 @@ RDButtonDialog::RDButtonDialog(QString station_name,const QString &caption, // // Ok Button // - button=new QPushButton(this,"ok_button"); + button=new QPushButton(this); button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50); button->setDefault(true); button->setFont(buttonFont()); @@ -110,7 +109,7 @@ RDButtonDialog::RDButtonDialog(QString station_name,const QString &caption, // // Cancel Button // - button=new QPushButton(this,"cancel_button"); + button=new QPushButton(this); button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,80,50); button->setFont(buttonFont()); button->setText(tr("&Cancel")); @@ -144,8 +143,8 @@ int RDButtonDialog::exec(RDPanelButton *button,bool hookmode, edit_user_password=passwd; edit_cart=edit_button->cart(); edit_color=edit_button->defaultColor(); - QPalette p=QPalette(edit_color,backgroundColor()); - p.setColor(QColorGroup::ButtonText,RDGetTextColor(edit_color)); + QPalette p=QPalette(edit_color,palette().color(QPalette::Background)); + p.setColor(QPalette::ButtonText,RDGetTextColor(edit_color)); edit_color_button->setPalette(p); edit_label_edit->setText(edit_button->text()); DisplayCart(edit_cart); @@ -165,7 +164,7 @@ void RDButtonDialog::clearCartData() { edit_cart=0; edit_color=Qt::lightGray; - edit_color_button->setPalette(QPalette(edit_color,backgroundColor())); + edit_color_button->setPalette(QPalette(edit_color,palette().color(QPalette::Background))); edit_label_edit->setText(""); edit_cart_edit->setText(""); } @@ -176,8 +175,8 @@ void RDButtonDialog::setColorData() QColor new_color=QColorDialog::getColor(edit_color,this,"edit_color_dialog"); if(new_color.isValid()) { edit_color=new_color; - QPalette p=QPalette(edit_color,backgroundColor()); - p.setColor(QColorGroup::ButtonText,RDGetTextColor(edit_color)); + QPalette p=QPalette(edit_color,palette().color(QPalette::Background)); + p.setColor(QPalette::ButtonText,RDGetTextColor(edit_color)); edit_color_button->setPalette(p); } } diff --git a/lib/rdcae.cpp b/lib/rdcae.cpp index 9f05c15f..f03a5aed 100644 --- a/lib/rdcae.cpp +++ b/lib/rdcae.cpp @@ -63,7 +63,7 @@ RDCae::RDCae(RDStation *station,RDConfig *config,QObject *parent) // Meter Connection // cae_meter_socket=new QUdpSocket(this); - for(Q_INT16 i=30000;i<30100;i++) { + for(int16_t i=30000;i<30100;i++) { if(cae_meter_socket->bind(i)) { i=31000; } @@ -93,7 +93,7 @@ RDCae::RDCae(RDStation *station,RDConfig *config,QObject *parent) // // The Clock Timer // - QTimer *timer=new QTimer(this,"clock_timer"); + QTimer *timer=new QTimer(this); connect(timer,SIGNAL(timeout()),this,SLOT(clockData())); timer->start(RD_METER_UPDATE_INTERVAL); } @@ -122,8 +122,7 @@ void RDCae::connectHost() } usleep(100000); if(count>0) { - SendCommand(QString().sprintf("PW %s!", - (const char *)cae_config->password())); + SendCommand("PW "+cae_config->password()+"!"); for(int i=0;i1000) { rda->syslog(LOG_ERR, "*** LoadPlay: CAE took %d mS to return stream for %s ***", - count,(const char *)name); + count,name.toUtf8().constData()); } cae_handle[card][*stream]=*handle; cae_pos[card][*stream]=0xFFFFFFFF; @@ -231,7 +229,7 @@ void RDCae::loadRecord(int card,int stream,QString name, // card,stream,(const char *)name,coding,chan,samp_rate,bit_rate); SendCommand(QString().sprintf("LR %d %d %d %d %d %d %s!", card,stream,(int)coding,chan,samp_rate, - bit_rate,(const char *)name)); + bit_rate,name.toUtf8().constData())); } diff --git a/lib/rdcardselector.cpp b/lib/rdcardselector.cpp index 5405740b..8b51a982 100644 --- a/lib/rdcardselector.cpp +++ b/lib/rdcardselector.cpp @@ -48,13 +48,13 @@ RDCardSelector::RDCardSelector(QWidget *parent) card_card_box=new QSpinBox(this); card_card_box->setGeometry(60,yoffset,50,19); card_card_box->setSpecialValueText("None"); - card_card_box->setMinValue(-1); - card_card_box->setMaxValue(RD_MAX_CARDS-1); + card_card_box->setMinimum(-1); + card_card_box->setMaximum(RD_MAX_CARDS-1); card_card_box->setValue(-1); connect(card_card_box,SIGNAL(valueChanged(int)),this,SLOT(cardData(int))); - card_card_label=new QLabel(card_card_box,tr("Card:"),this); + card_card_label=new QLabel(tr("Card:"),this); card_card_label->setGeometry(0,yoffset+2,55,19); - card_card_label->setAlignment(Qt::AlignRight|Qt::TextShowMnemonic); + card_card_label->setAlignment(Qt::AlignRight); // // Port @@ -62,13 +62,13 @@ RDCardSelector::RDCardSelector(QWidget *parent) card_port_box=new QSpinBox(this); card_port_box->setGeometry(60,yoffset+22,50,19); card_port_box->setSpecialValueText("None"); - card_port_box->setMinValue(-1); - card_port_box->setMaxValue(RD_MAX_PORTS-1); + card_port_box->setMinimum(-1); + card_port_box->setMaximum(RD_MAX_PORTS-1); card_port_box->setValue(-1); connect(card_port_box,SIGNAL(valueChanged(int)),this,SLOT(portData(int))); - card_port_label=new QLabel(card_port_box,tr("Port:"),this); + card_port_label=new QLabel(tr("Port:"),this); card_port_label->setGeometry(0,yoffset+24,55,19); - card_port_label->setAlignment(Qt::AlignRight|Qt::TextShowMnemonic); + card_port_label->setAlignment(Qt::AlignRight); for(int i=0;imaxValue()+1; + return card_card_box->maximum()+1; } void RDCardSelector::setMaxCards(int num) { - card_card_box->setMaxValue(num-1); + card_card_box->setMaximum(num-1); } @@ -189,7 +189,7 @@ void RDCardSelector::setMaxPorts(int card,int num) if(card>=0) { card_max_ports[card]=num; if (card == this->card()){ - card_port_box->setMaxValue(num-1); + card_port_box->setMaximum(num-1); if (num == 0){ card_port_box->setValue(-1); card_port_box->setDisabled(true); @@ -205,7 +205,7 @@ void RDCardSelector::cardData(int card) int c; if(card>=0) { c = card_max_ports[card]-1; - card_port_box->setMaxValue(c); + card_port_box->setMaximum(c); if (c <0){ card_port_box->setValue(-1); } diff --git a/lib/rdcart.cpp b/lib/rdcart.cpp index d9279f23..977497ac 100644 --- a/lib/rdcart.cpp +++ b/lib/rdcart.cpp @@ -2,7 +2,7 @@ // // Abstract a Rivendell Cart. // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -123,7 +123,7 @@ bool RDCart::selectCut(QString *cut,const QTime &time) const "(((START_DAYPART<=\""+time_str+"\")&&"+ "(END_DAYPART>=\""+time_str+"\")||"+ "START_DAYPART is null))&&"+ - "("+RDGetShortDayNameEN(current_date.dayOfWeek()).upper()+"=\"Y\")&&"+ + "("+RDGetShortDayNameEN(current_date.dayOfWeek()).toUpper()+"=\"Y\")&&"+ QString().sprintf("(CART_NUMBER=%u)&&(EVERGREEN=\"N\")&&",cart_number)+ "(LENGTH>0)"; if(useWeighting()) { @@ -270,7 +270,7 @@ QString RDCart::schedCodes() const QStringList list = schedCodesList(); for(int i=0;i0||add_codes.contains(wstr)>0)&&remove_codes.contains(wstr)==0) { - save_codes.push_back(wstr.stripWhiteSpace()); + save_codes.push_back(wstr.trimmed()); } } delete q; @@ -1533,7 +1533,7 @@ QString RDCart::xml(RDSqlQuery *q,bool include_cuts, xml+=" "+RDCut::xml(q,absolute,settings); } else { - q->prev(); + q->previous(); break; } } @@ -1700,14 +1700,13 @@ bool RDCart::removeCutAudio(RDStation *station,RDUser *user,unsigned cart_num, long response_code=0; struct curl_httppost *first=NULL; struct curl_httppost *last=NULL; - char url[1024]; QString xml=""; QString sql; RDSqlQuery *q; if(user==NULL) { - unlink(RDCut::pathName(cutname)); - unlink(RDCut::pathName(cutname)+".energy"); + unlink(RDCut::pathName(cutname).toUtf8()); + unlink((RDCut::pathName(cutname)+".energy").toUtf8()); sql=QString("delete from CUT_EVENTS where ")+ "CUT_NAME=\""+cutname+"\""; q=new RDSqlQuery(sql); @@ -1719,35 +1718,31 @@ bool RDCart::removeCutAudio(RDStation *station,RDUser *user,unsigned cart_num, // curl_formadd(&first,&last,CURLFORM_PTRNAME,"COMMAND", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",RDXPORT_COMMAND_DELETEAUDIO), - CURLFORM_END); + QString().sprintf("%u",RDXPORT_COMMAND_DELETEAUDIO). + toUtf8().constData(),CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"LOGIN_NAME", - CURLFORM_COPYCONTENTS,(const char *)user->name().utf8(),CURLFORM_END); + CURLFORM_COPYCONTENTS,user->name().toUtf8().constData(), + CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"PASSWORD", - CURLFORM_COPYCONTENTS,(const char *)user->password().utf8(), + CURLFORM_COPYCONTENTS,user->password().toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"CART_NUMBER", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",cart_num), + QString().sprintf("%u",cart_num).toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"CUT_NUMBER", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",RDCut::cutNumber(cutname)), - CURLFORM_END); + QString().sprintf("%u",RDCut::cutNumber(cutname)). + toUtf8().constData(),CURLFORM_END); if((curl=curl_easy_init())==NULL) { curl_formfree(first); return false; } - // - // Write out URL as a C string before passing to curl_easy_setopt(), - // otherwise some versions of LibCurl will throw a 'bad/illegal format' - // error. - // - strncpy(url,station->webServiceUrl(config),1024); - curl_easy_setopt(curl,CURLOPT_URL,url); + curl_easy_setopt(curl,CURLOPT_URL,station->webServiceUrl(config). + toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_HTTPPOST,first); curl_easy_setopt(curl,CURLOPT_USERAGENT, - (const char *)rda->config()->userAgent()); + rda->config()->userAgent().toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,CartWriteCallback); curl_easy_setopt(curl,CURLOPT_WRITEDATA,&xml); diff --git a/lib/rdcart_dialog.cpp b/lib/rdcart_dialog.cpp index 93317638..50a88d34 100644 --- a/lib/rdcart_dialog.cpp +++ b/lib/rdcart_dialog.cpp @@ -64,9 +64,8 @@ RDCartDialog::RDCartDialog(QString *filter,QString *group,QString *schedcode, // Progress Dialog // cart_progress_dialog= - new QProgressDialog(tr("Please Wait..."),tr("Cancel"),0,10,this, - Qt::WStyle_Customize|Qt::WStyle_NormalBorder); - cart_progress_dialog->setCaption(" "); + new QProgressDialog(tr("Please Wait..."),tr("Cancel"),0,10,this); + cart_progress_dialog->setWindowTitle(" "); QLabel *label=new QLabel(tr("Please Wait..."),cart_progress_dialog); label->setAlignment(Qt::AlignCenter); label->setFont(progressFont()); @@ -313,7 +312,7 @@ void RDCartDialog::editorData() delete q; if(fork()==0) { - system(cmd+" &"); + system((cmd+" &").toUtf8()); exit(0); } } @@ -499,7 +498,7 @@ void RDCartDialog::SaveState() return; } - if((f=fopen(state_file,"w"))==NULL) { + if((f=fopen(state_file.toUtf8(),"w"))==NULL) { return; } fprintf(f,"[RDCartDialog]\n"); diff --git a/lib/rdcart_search_text.cpp b/lib/rdcart_search_text.cpp index d26d08c1..ae2486e0 100644 --- a/lib/rdcart_search_text.cpp +++ b/lib/rdcart_search_text.cpp @@ -31,7 +31,7 @@ QString RDBaseSearchText(QString filter,bool incl_cuts) int pos=0; char find; - edit_filter=edit_filter.stripWhiteSpace(); + edit_filter=edit_filter.trimmed(); if(edit_filter.isEmpty()) { ret=QString(" ((CART.TITLE like \"%%\")||")+ "(CART.ARTIST like \"%%\")||"+ @@ -62,14 +62,14 @@ QString RDBaseSearchText(QString filter,bool incl_cuts) else { find=' '; } - pos=edit_filter.find(find); + pos=edit_filter.indexOf(find); if(pos>=0) { str=edit_filter.left(pos); edit_filter=edit_filter.remove(0,pos); if(find=='\"') { edit_filter=edit_filter.remove(0,1); } - edit_filter=edit_filter.stripWhiteSpace(); + edit_filter=edit_filter.trimmed(); } else { str=edit_filter; @@ -121,9 +121,8 @@ QString RDSchedSearchText(const QStringList &schedcodes) QString ret=""; for(int i=0;isetFont(labelFont()); d_filter_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); connect(d_filter_edit,SIGNAL(textChanged(const QString &)), @@ -77,7 +77,7 @@ RDCartFilter::RDCartFilter(bool show_drag_box,QWidget *parent) // d_group_box=new QComboBox(this); d_group_box->setModel(d_group_model); - d_group_label=new QLabel(d_group_box,tr("Group:"),this); + d_group_label=new QLabel(tr("Group:"),this); d_group_label->setFont(labelFont()); d_group_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); connect(d_group_box,SIGNAL(activated(const QString &)), @@ -87,7 +87,7 @@ RDCartFilter::RDCartFilter(bool show_drag_box,QWidget *parent) // Scheduler Codes Filter // d_codes_box=new QComboBox(this); - d_codes_label=new QLabel(d_codes_box,tr("Scheduler Code:"),this); + d_codes_label=new QLabel(tr("Scheduler Code:"),this); d_codes_label->setFont(labelFont()); d_codes_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); connect(d_codes_box,SIGNAL(activated(const QString &)), @@ -98,7 +98,7 @@ RDCartFilter::RDCartFilter(bool show_drag_box,QWidget *parent) // d_matches_edit=new QLineEdit(this); d_matches_edit->setReadOnly(true); - d_matches_label=new QLabel(d_matches_edit,tr("Matching Carts:"),this); + d_matches_label=new QLabel(tr("Matching Carts:"),this); d_matches_label->setFont(labelFont()); // @@ -106,8 +106,7 @@ RDCartFilter::RDCartFilter(bool show_drag_box,QWidget *parent) // d_allowdrag_box=new QCheckBox(this); d_allowdrag_box->setChecked(false); - d_allowdrag_label= - new QLabel(d_allowdrag_box,tr("Allow Cart Dragging"),this); + d_allowdrag_label=new QLabel(tr("Allow Cart Dragging"),this); d_allowdrag_label->setFont(labelFont()); d_allowdrag_label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); connect(d_allowdrag_box,SIGNAL(stateChanged(int)), @@ -122,7 +121,7 @@ RDCartFilter::RDCartFilter(bool show_drag_box,QWidget *parent) // d_showaudio_check=new QCheckBox(this); d_showaudio_check->setChecked(true); - d_showaudio_label=new QLabel(d_showaudio_check,tr("Show Audio Carts"),this); + d_showaudio_label=new QLabel(tr("Show Audio Carts"),this); d_showaudio_label->setFont(labelFont()); d_showaudio_label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); connect(d_showaudio_check,SIGNAL(stateChanged(int)), @@ -133,7 +132,7 @@ RDCartFilter::RDCartFilter(bool show_drag_box,QWidget *parent) // d_showmacro_check=new QCheckBox(this); d_showmacro_check->setChecked(true); - d_showmacro_label=new QLabel(d_showmacro_check,tr("Show Macro Carts"),this); + d_showmacro_label=new QLabel(tr("Show Macro Carts"),this); d_showmacro_label->setFont(labelFont()); d_showmacro_label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); connect(d_showmacro_check,SIGNAL(stateChanged(int)), @@ -145,7 +144,7 @@ RDCartFilter::RDCartFilter(bool show_drag_box,QWidget *parent) d_shownotes_box=new QCheckBox(this); d_shownotes_box->setChecked(true); d_shownotes_label= - new QLabel(d_shownotes_box,tr("Show Note Bubbles"),this); + new QLabel(tr("Show Note Bubbles"),this); d_shownotes_label->setFont(labelFont()); d_shownotes_label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -154,7 +153,7 @@ RDCartFilter::RDCartFilter(bool show_drag_box,QWidget *parent) // d_showmatches_box=new QCheckBox(this); d_showmatches_label= - new QLabel(d_showmatches_box,tr("Show Only First ")+ + new QLabel(tr("Show Only First ")+ QString().sprintf("%d",RD_LIMITED_CART_SEARCH_QUANTITY)+ tr(" Matches"),this); d_showmatches_label->setFont(labelFont()); @@ -234,7 +233,7 @@ QString RDCartFilter::filterSql(const QStringList &and_fields) const sql+=RDCartFilter::phraseFilter(d_filter_edit->text().trimmed(),true); QStringList groups; for(int i=0;icount();i++) { - groups.push_back(d_group_box->text(i)); + groups.push_back(d_group_box->itemData(i).toString()); } sql+=RDCartFilter::groupFilter(d_group_box->currentText(),groups); if(d_show_track_carts) { @@ -433,8 +432,8 @@ void RDCartFilter::setFilterText(const QString &str) void RDCartFilter::setSelectedGroup(const QString &grpname) { for(int i=0;icount();i++) { - if(d_group_box->text(i)==grpname) { - d_group_box->setCurrentItem(i); + if(d_group_box->itemData(i).toString()==grpname) { + d_group_box->setCurrentIndex(i); groupChangedData(d_group_box->currentText()); } } @@ -449,15 +448,16 @@ void RDCartFilter::changeUser() if(d_service.isEmpty()) { // LoadUserGroups(); d_group_model->changeUser(); - d_group_box->setCurrentText(tr("ALL")); + // d_group_box->setCurrentText(tr("ALL")); + d_group_box->setCurrentIndex(0); } d_codes_box->clear(); - d_codes_box->insertItem(tr("ALL")); - sql=QString().sprintf("select CODE from SCHED_CODES"); + d_codes_box->insertItem(0,tr("ALL")); + sql=QString().sprintf("select CODE from SCHED_CODES order by CODE"); q=new RDSqlQuery(sql); while(q->next()) { - d_codes_box->insertItem(q->value(0).toString()); + d_codes_box->insertItem(d_codes_box->count(),q->value(0).toString()); } delete q; d_search_button->setDisabled(true); @@ -661,7 +661,7 @@ void RDCartFilter::LoadUserGroups() RDSqlQuery *q; d_group_box->clear(); - d_group_box->insertItem(tr("ALL")); + d_group_box->insertItem(0,tr("ALL")); if(d_user_is_admin) { sql=QString("select NAME from GROUPS order by NAME "); } @@ -672,7 +672,7 @@ void RDCartFilter::LoadUserGroups() } q=new RDSqlQuery(sql); while(q->next()) { - d_group_box->insertItem(q->value(0).toString()); + d_group_box->insertItem(d_group_box->count(),q->value(0).toString()); } delete q; diff --git a/lib/rdcartslot.cpp b/lib/rdcartslot.cpp index 991d7b79..3003e5ff 100644 --- a/lib/rdcartslot.cpp +++ b/lib/rdcartslot.cpp @@ -63,9 +63,11 @@ RDCartSlot::RDCartSlot(int slotnum,RDRipc *ripc,RDCae *cae,RDStation *station, // Palettes // slot_ready_color= - QPalette(QColor(BUTTON_STOPPED_BACKGROUND_COLOR),backgroundColor()); + QPalette(QColor(BUTTON_STOPPED_BACKGROUND_COLOR), + palette().color(QPalette::Background)); slot_playing_color= - QPalette(QColor(BUTTON_PLAY_BACKGROUND_COLOR),backgroundColor()); + QPalette(QColor(BUTTON_PLAY_BACKGROUND_COLOR), + palette().color(QPalette::Background)); // // Slot Options diff --git a/lib/rdcastsearch.cpp b/lib/rdcastsearch.cpp index ae6fac2f..5fbf4c23 100644 --- a/lib/rdcastsearch.cpp +++ b/lib/rdcastsearch.cpp @@ -27,7 +27,7 @@ QString RDCastSearchString(const QString &filter,bool active_only) { QString ret; - if(!filter.stripWhiteSpace().isEmpty()) { + if(!filter.trimmed().isEmpty()) { QString fil=RDEscapeString(filter); ret+=QString("&&((PODCASTS.ITEM_TITLE like \"%")+fil+"%\")||"+ "(PODCASTS.ITEM_DESCRIPTION like \"%"+fil+"%\")||"+ diff --git a/lib/rdcatch_connect.cpp b/lib/rdcatch_connect.cpp index 927bb7ef..ff0266a7 100644 --- a/lib/rdcatch_connect.cpp +++ b/lib/rdcatch_connect.cpp @@ -48,9 +48,10 @@ RDCatchConnect::RDCatchConnect(int serial,QObject *parent) // Start the heartbeat timer // cc_heartbeat_timer=new QTimer(this); + cc_heartbeat_timer->setSingleShot(true); connect(cc_heartbeat_timer,SIGNAL(timeout()), this,SLOT(heartbeatTimeoutData())); - cc_heartbeat_timer->start(CC_HEARTBEAT_INTERVAL,true); + cc_heartbeat_timer->start(CC_HEARTBEAT_INTERVAL); cc_heartbeat_valid=true; } @@ -61,7 +62,7 @@ RDCatchConnect::~RDCatchConnect() } -void RDCatchConnect::connectHost(QString hostname,Q_UINT16 hostport, +void RDCatchConnect::connectHost(QString hostname,uint16_t hostport, QString password) { cc_password=password; @@ -156,13 +157,13 @@ void RDCatchConnect::setExitCode(int id,RDRecording::ExitCode code, const QString &msg) { SendCommand(QString().sprintf("SC %d %d %s!",id,code, - (const char *)msg.simplifyWhiteSpace())); + msg.trimmed().toUtf8().constData())); } void RDCatchConnect::connectedData() { - SendCommand(QString().sprintf("PW %s!",(const char *)cc_password)); + SendCommand(QString("PW ")+cc_password+"!"); } @@ -171,7 +172,7 @@ void RDCatchConnect::readyData() char buf[1024]; int c; - while((c=cc_socket->readBlock(buf,254))>0) { + while((c=cc_socket->read(buf,254))>0) { buf[c]=0; // printf("readyData: %s\n",buf); for(int i=0;iwriteBlock((const char *)cmd,cmd.length()); + cc_socket->write(cmd.toUtf8()); } @@ -327,7 +328,7 @@ void RDCatchConnect::DispatchCommand() if(!strcmp(args[0],"HB")) { // Heartbeat cc_heartbeat_timer->stop(); - cc_heartbeat_timer->start(CC_HEARTBEAT_INTERVAL,true); + cc_heartbeat_timer->start(CC_HEARTBEAT_INTERVAL); } if(!strcmp(args[0],"MN")) { // Monitor State diff --git a/lib/rdcatch_connect.h b/lib/rdcatch_connect.h index 684af84f..7a8b8f45 100644 --- a/lib/rdcatch_connect.h +++ b/lib/rdcatch_connect.h @@ -2,7 +2,7 @@ // // Connect to the Rivendell Netcatcher Daemon. // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,10 +18,12 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include -#include -#include +#include + +#include +#include +#include +#include #include #include @@ -40,7 +42,7 @@ class RDCatchConnect : public QObject public: RDCatchConnect(int serial,QObject *parent=0); ~RDCatchConnect(); - void connectHost(QString hostname,Q_UINT16 hostport,QString password); + void connectHost(QString hostname,uint16_t hostport,QString password); RDDeck::Status status(unsigned chan) const; int currentId(unsigned chan) const; void enableMetering(bool state); diff --git a/lib/rdcddblookup.cpp b/lib/rdcddblookup.cpp index 9318d311..af1da83f 100644 --- a/lib/rdcddblookup.cpp +++ b/lib/rdcddblookup.cpp @@ -2,7 +2,7 @@ // // RDDiscLookup instance class for accessing the FreeDB CD Database. // -// (C) Copyright 2003-2020 Fred Gleason +// (C) Copyright 2003-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License @@ -22,8 +22,6 @@ #include #include -#include - #include #include #include @@ -98,10 +96,10 @@ void RDCddbLookup::readyReadData() case 0: // Login Banner if((code==200)||(code==201)) { snprintf(buffer,2048,"cddb hello %s %s %s %s", - (const char *)lookup_username.utf8(), - (const char *)lookup_hostname.utf8(), - (const char *)lookup_appname.utf8(), - (const char *)lookup_appver.utf8()); + (const char *)lookup_username.toUtf8(), + (const char *)lookup_hostname.toUtf8(), + (const char *)lookup_appname.toUtf8(), + (const char *)lookup_appver.toUtf8()); SendToServer(buffer); lookup_state=1; } @@ -157,7 +155,7 @@ void RDCddbLookup::readyReadData() f0.erase(f0.begin()); discRecord()->setDiscTitle(f0.join(" ")); snprintf(buffer,2048,"cddb read %s %08x\n", - (const char *)discRecord()->discGenre().utf8(), + (const char *)discRecord()->discGenre().toUtf8(), discRecord()->discId()); SendToServer(buffer); lookup_state=5; @@ -210,7 +208,7 @@ void RDCddbLookup::readyReadData() discRecord()->setDiscTitle(titlesBox()->currentText().trimmed()); } snprintf(buffer,2048,"cddb read %s %08x\n", - (const char *)discRecord()->discGenre().utf8(), + (const char *)discRecord()->discGenre().toUtf8(), discRecord()->discId()); SendToServer(buffer); lookup_state=5; @@ -279,18 +277,14 @@ void RDCddbLookup::errorData(QAbstractSocket::SocketError err) { QString err_msg="Network error"; switch(err) { - case QTcpSocket::ErrConnectionRefused: + case QAbstractSocket::ConnectionRefusedError: err_msg="Connection to \""+rda->libraryConf()->cddbServer()+"\" refused"; break; - case QTcpSocket::ErrHostNotFound: + case QAbstractSocket::HostNotFoundError: err_msg="Host \""+rda->libraryConf()->cddbServer()+"\" not found"; break; - case QTcpSocket::ErrSocketRead: - err_msg="Socket read error"; - break; - default: break; } @@ -362,6 +356,6 @@ int RDCddbLookup::GetIndex(QString *tag) void RDCddbLookup::SendToServer(const QString &msg) { - lookup_socket->writeBlock(msg+"\n",msg.length()+1); + lookup_socket->write((msg+"\n").toUtf8()); profile("sent to server: \""+msg+"\""); } diff --git a/lib/rdcdplayer.cpp b/lib/rdcdplayer.cpp index 59c2931e..a42c47b5 100644 --- a/lib/rdcdplayer.cpp +++ b/lib/rdcdplayer.cpp @@ -47,15 +47,16 @@ RDCdPlayer::RDCdPlayer(FILE *profile_msgs,QWidget *parent) // // The Button Timer // - cdrom_button_timer=new QTimer(this,"cdrom_button_timer"); + cdrom_button_timer=new QTimer(this); connect(cdrom_button_timer,SIGNAL(timeout()),this,SLOT(buttonTimerData())); // // The Clock // - cdrom_clock=new QTimer(this,"cdrom_clock"); + cdrom_clock=new QTimer(this); + cdrom_clock->setSingleShot(true); connect(cdrom_clock,SIGNAL(timeout()),this,SLOT(clockData())); - cdrom_clock->start(RDCDPLAYER_CLOCK_INTERVAL,true); + cdrom_clock->start(RDCDPLAYER_CLOCK_INTERVAL); } @@ -91,7 +92,7 @@ void RDCdPlayer::setDevice(QString device) bool RDCdPlayer::open() { - if((cdrom_fd=::open((const char *)cdrom_device,O_RDONLY|O_NONBLOCK))<0) { + if((cdrom_fd=::open(cdrom_device.toUtf8(),O_RDONLY|O_NONBLOCK))<0) { return false; } return true; @@ -220,13 +221,13 @@ void RDCdPlayer::lock() void RDCdPlayer::unlock() { - system("eject -i off "+cdrom_device); + system(("eject -i off "+cdrom_device).toUtf8()); } void RDCdPlayer::eject() { - system("eject "+cdrom_device); + system(("eject "+cdrom_device).toUtf8()); } @@ -366,7 +367,7 @@ void RDCdPlayer::buttonTimerData() cdrom_button_queue.pop(); cdrom_track_queue.pop(); if(cdrom_button_queue.size()>0) { - cdrom_button_timer->start(RDCDPLAYER_BUTTON_DELAY,true); + cdrom_button_timer->start(RDCDPLAYER_BUTTON_DELAY); } } @@ -449,7 +450,7 @@ void RDCdPlayer::clockData() emit stopped(); } } - cdrom_clock->start(RDCDPLAYER_CLOCK_INTERVAL,true); + cdrom_clock->start(RDCDPLAYER_CLOCK_INTERVAL); } @@ -543,7 +544,7 @@ void RDCdPlayer::PushButton(RDCdPlayer::ButtonOp op,int track) cdrom_button_queue.push(op); cdrom_track_queue.push(track); if(!cdrom_button_timer->isActive()) { - cdrom_button_timer->start(RDCDPLAYER_BUTTON_DELAY,true); + cdrom_button_timer->start(RDCDPLAYER_BUTTON_DELAY); } } @@ -552,8 +553,8 @@ void RDCdPlayer::Profile(const QString &msg) { if(cdrom_profile_msgs!=NULL) { fprintf(cdrom_profile_msgs,"%s | RDCdPlayer::%s\n", - (const char *)QTime::currentTime().toString("hh:mm:ss.zzz"), - (const char *)msg.toUtf8()); + QTime::currentTime().toString("hh:mm:ss.zzz").toUtf8().constData(), + msg.toUtf8().constData()); } } diff --git a/lib/rdcdripper.cpp b/lib/rdcdripper.cpp index 1b369917..097cffbb 100644 --- a/lib/rdcdripper.cpp +++ b/lib/rdcdripper.cpp @@ -88,7 +88,7 @@ RDCdRipper::ErrorCode RDCdRipper::rip(int first_track,int last_track) // // Open the CD // - if((drive=cdda_identify(conv_device,1,&msg))==NULL) { + if((drive=cdda_identify(conv_device.toUtf8(),1,&msg))==NULL) { return RDCdRipper::ErrorNoDevice; } if((err=cdda_open(drive))!=0) { @@ -111,7 +111,7 @@ RDCdRipper::ErrorCode RDCdRipper::rip(int first_track,int last_track) sf_dst_info.format=SF_FORMAT_WAV|SF_FORMAT_PCM_32; sf_dst_info.channels=cdda_track_channels(drive,first_track+1); sf_dst_info.samplerate=44100; - if((sf_dst=sf_open(conv_dst_filename,SFM_WRITE,&sf_dst_info))==NULL) { + if((sf_dst=sf_open(conv_dst_filename.toUtf8(),SFM_WRITE,&sf_dst_info))==NULL) { cdda_close(drive); return RDCdRipper::ErrorNoDestination; } @@ -133,7 +133,7 @@ RDCdRipper::ErrorCode RDCdRipper::rip(int first_track,int last_track) qApp->processEvents(); if(conv_aborting) { sf_close(sf_dst); - unlink(conv_dst_filename); + unlink(conv_dst_filename.toUtf8()); cdda_close(drive); return RDCdRipper::ErrorAborted; } @@ -197,7 +197,7 @@ void RDCdRipper::Profile(const QString &msg) { if(conv_profile_msgs!=NULL) { fprintf(conv_profile_msgs,"%s | RDCdPlayer::%s\n", - (const char *)QTime::currentTime().toString("hh:mm:ss.zzz"), - (const char *)msg.toUtf8()); + QTime::currentTime().toString("hh:mm:ss.zzz").toUtf8().constData(), + msg.toUtf8().constData()); } } diff --git a/lib/rdcmd_switch.cpp b/lib/rdcmd_switch.cpp index c106916e..b8166155 100644 --- a/lib/rdcmd_switch.cpp +++ b/lib/rdcmd_switch.cpp @@ -26,19 +26,20 @@ #include -RDCmdSwitch::RDCmdSwitch(int argc,char *argv[],const char *modname, - const char *usage) +RDCmdSwitch::RDCmdSwitch(int argc,char *argv[],const QString &modname, + const QString &usage) { switch_debug=false; for(int i=1;ih_addr_list[0][1]&0xff)+ 256*(host_ent->h_addr_list[0][2]&0xff)+ (host_ent->h_addr_list[0][3]&0xff); - return QHostAddress((Q_UINT32)host_address); + return QHostAddress((uint32_t)host_address); } @@ -784,10 +782,10 @@ bool RDCopy(const QString &srcfile,const QString &destfile) int src_fd; int dest_fd; - if((src_fd=open((const char *)srcfile,O_RDONLY))<0) { + if((src_fd=open(srcfile.toUtf8(),O_RDONLY))<0) { return false; } - if((dest_fd=open((const char *)destfile,O_WRONLY|O_CREAT,S_IWUSR))<0) { + if((dest_fd=open(destfile.toUtf8(),O_WRONLY|O_CREAT,S_IWUSR))<0) { close(src_fd); return false; } @@ -803,7 +801,7 @@ bool RDCopy(const QString &srcfile,int dest_fd) { int src_fd; - if((src_fd=open((const char *)srcfile,O_RDONLY))<0) { + if((src_fd=open(srcfile.toUtf8(),O_RDONLY))<0) { return false; } bool ret=RDCopy(src_fd,dest_fd); @@ -817,7 +815,7 @@ bool RDCopy(int src_fd,const QString &destfile) { int dest_fd; - if((dest_fd=open((const char *)destfile,O_WRONLY|O_CREAT,S_IWUSR))<0) { + if((dest_fd=open(destfile.toUtf8(),O_WRONLY|O_CREAT,S_IWUSR))<0) { return false; } bool ret=RDCopy(src_fd,dest_fd); @@ -862,14 +860,14 @@ bool RDWritePid(const QString &dirname,const QString &filename,int owner, QString pathname=dirname+"/"+filename; prev_mask = umask(0113); // Set umask so pid files are user and group writable. - file=fopen((const char *)pathname,"w"); + file=fopen(pathname.toUtf8(),"w"); umask(prev_mask); if(file==NULL) { return false; } fprintf(file,"%d",getpid()); fclose(file); - chown((const char *)pathname,owner,group); + chown(pathname.toUtf8(),owner,group); return true; } @@ -878,7 +876,7 @@ bool RDWritePid(const QString &dirname,const QString &filename,int owner, void RDDeletePid(const QString &dirname,const QString &filename) { QString pid=dirname+"/"+filename; - unlink((const char *)pid); + unlink(pid.toUtf8()); } @@ -898,7 +896,7 @@ pid_t RDGetPid(const QString &pidfile) FILE *handle; pid_t ret; - if((handle=fopen((const char *)pidfile,"r"))==NULL) { + if((handle=fopen(pidfile.toUtf8(),"r"))==NULL) { return -1; } if(fscanf(handle,"%d",&ret)!=1) { @@ -938,7 +936,7 @@ QString RDGetHomeDir(bool *found) QString RDTruncateAfterWord(QString str,int word,bool add_dots) { - QString simple=str.simplifyWhiteSpace(); + QString simple=str.simplified(); int quan=0; int point; @@ -1124,7 +1122,7 @@ bool RDProcessActive(const QStringList &cmds) for(int i=0;i +// (C) Copyright 1996-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License @@ -26,17 +26,15 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* Function Prototypes */ int GetPrivateProfileBool(const char *,const char *,const char *,bool); diff --git a/lib/rdconfig.cpp b/lib/rdconfig.cpp index 2c92d5d8..b7230d63 100644 --- a/lib/rdconfig.cpp +++ b/lib/rdconfig.cpp @@ -252,7 +252,7 @@ QString RDConfig::provisioningHostShortName(const QString &hostname) const { QRegExp exp(conf_provisioning_host_short_name_regex); - exp.search(hostname); + exp.indexIn(hostname); QStringList texts=exp.capturedTexts(); if((unsigned)texts.size()stringValue("Identity","StationName",sname); conf_password=profile->stringValue("Identity","Password",""); @@ -590,27 +590,27 @@ bool RDConfig::load() profile->boolValue("Hacks","DisableMaintChecks",false); conf_lock_rdairplay_memory= profile->boolValue("Hacks","LockRdairplayMemory",false); - if((user=getpwnam(profile->stringValue("Identity","AudioOwner")))!=NULL) { + if((user=getpwnam(profile->stringValue("Identity","AudioOwner").toUtf8()))!=NULL) { conf_uid=user->pw_uid; } - if((groups=getgrnam(profile->stringValue("Identity","AudioGroup")))!=NULL) { + if((groups=getgrnam(profile->stringValue("Identity","AudioGroup").toUtf8()))!=NULL) { conf_gid=groups->gr_gid; } if((user=getpwnam(profile->stringValue("Identity","PypadOwner", - RD_DEFAULT_PYPAD_OWNER)))!=NULL) { + RD_DEFAULT_PYPAD_OWNER).toUtf8()))!=NULL) { conf_pypad_uid=user->pw_uid; } if((groups=getgrnam(profile->stringValue("Identity","PypadGroup", - RD_DEFAULT_PYPAD_GROUP)))!=NULL) { + RD_DEFAULT_PYPAD_GROUP).toUtf8()))!=NULL) { conf_pypad_gid=groups->gr_gid; } if((user=getpwnam(profile->stringValue("Identity","RnRmlOwner", - RD_DEFAULT_RN_RML_OWNER)))!=NULL) { + RD_DEFAULT_RN_RML_OWNER).toUtf8()))!=NULL) { conf_rn_rml_uid=user->pw_uid; } if((groups=getgrnam(profile->stringValue("Identity","RnRmlGroup", - RD_DEFAULT_RN_RML_GROUP)))!=NULL) { + RD_DEFAULT_RN_RML_GROUP).toUtf8()))!=NULL) { conf_rn_rml_gid=groups->gr_gid; } conf_syslog_facility=profile->intValue("Identity","SyslogFacility",LOG_USER); diff --git a/lib/rdcopyaudio.cpp b/lib/rdcopyaudio.cpp index 9c203562..ce2124b4 100644 --- a/lib/rdcopyaudio.cpp +++ b/lib/rdcopyaudio.cpp @@ -76,7 +76,6 @@ RDCopyAudio::ErrorCode RDCopyAudio::runCopy(const QString &username, { long response_code; CURL *curl=NULL; - char url[1024]; struct curl_httppost *first=NULL; struct curl_httppost *last=NULL; @@ -85,43 +84,45 @@ RDCopyAudio::ErrorCode RDCopyAudio::runCopy(const QString &username, // curl_formadd(&first,&last,CURLFORM_PTRNAME,"COMMAND", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",RDXPORT_COMMAND_COPYAUDIO), + QString().sprintf("%u",RDXPORT_COMMAND_COPYAUDIO). + toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"LOGIN_NAME", - CURLFORM_COPYCONTENTS,(const char *)username.utf8(),CURLFORM_END); + CURLFORM_COPYCONTENTS, + username.toUtf8().constData(),CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"PASSWORD", - CURLFORM_COPYCONTENTS,(const char *)password.utf8(),CURLFORM_END); + CURLFORM_COPYCONTENTS, + password.toUtf8().constData(),CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"SOURCE_CART_NUMBER", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_source_cart_number), + QString().sprintf("%u",conv_source_cart_number). + toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"SOURCE_CUT_NUMBER", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_source_cut_number), + QString().sprintf("%u",conv_source_cut_number). + toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"DESTINATION_CART_NUMBER", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_destination_cart_number), + QString().sprintf("%u",conv_destination_cart_number). + toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"DESTINATION_CUT_NUMBER", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_destination_cut_number), + QString().sprintf("%u",conv_destination_cut_number). + toUtf8().constData(), CURLFORM_END); if((curl=curl_easy_init())==NULL) { curl_formfree(first); return RDCopyAudio::ErrorInternal; } - // - // Write out URL as a C string before passing to curl_easy_setopt(), - // otherwise some versions of LibCurl will throw a 'bad/illegal format' - // error. - // - strncpy(url,conv_station->webServiceUrl(conv_config),1024); - curl_easy_setopt(curl,CURLOPT_URL,url); + curl_easy_setopt(curl,CURLOPT_URL,conv_station-> + webServiceUrl(conv_config).toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_HTTPPOST,first); curl_easy_setopt(curl,CURLOPT_USERAGENT, - (const char *)conv_config->userAgent()); + conv_config->userAgent().toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); switch(curl_easy_perform(curl)) { diff --git a/lib/rdcoreapplication.cpp b/lib/rdcoreapplication.cpp index 2efd9db5..51e5ab1b 100644 --- a/lib/rdcoreapplication.cpp +++ b/lib/rdcoreapplication.cpp @@ -156,10 +156,10 @@ bool RDCoreApplication::open(QString *err_msg,RDCoreApplication::ErrorType *err_ // Initialize Logging // if(app_cmd_switch->debugActive()) { - openlog(app_command_name,LOG_PERROR,app_config->syslogFacility()); + openlog(app_command_name.toUtf8(),LOG_PERROR,app_config->syslogFacility()); } else { - openlog(app_command_name,0,app_config->syslogFacility()); + openlog(app_command_name.toUtf8(),0,app_config->syslogFacility()); } // diff --git a/lib/rdcueedit.cpp b/lib/rdcueedit.cpp index 83645764..8c4da2a8 100644 --- a/lib/rdcueedit.cpp +++ b/lib/rdcueedit.cpp @@ -38,13 +38,14 @@ RDCueEdit::RDCueEdit(QWidget *parent) // Create Palettes // edit_play_color= - QPalette(QColor(BUTTON_PLAY_BACKGROUND_COLOR),backgroundColor()); + QPalette(QColor(BUTTON_PLAY_BACKGROUND_COLOR), + palette().color(QPalette::Background)); edit_start_color=palette(); - edit_start_color.setColor(QColorGroup::Foreground,RD_CUEEDITOR_START_MARKER); + edit_start_color.setColor(QPalette::Foreground,RD_CUEEDITOR_START_MARKER); edit_position_label=new QLabel(this); edit_position_label->setGeometry(0,0,sizeHint().width()-30,30); - edit_position_label->setBackgroundColor(QColor(Qt::white)); + edit_position_label->setStyleSheet("background-color: #FFFFFF"); edit_position_label->setLineWidth(1); edit_position_label->setMidLineWidth(0); edit_position_label->setFrameStyle(QFrame::Box|QFrame::Plain); @@ -54,13 +55,13 @@ RDCueEdit::RDCueEdit(QWidget *parent) edit_up_label=new QLabel("00:00:00",this); edit_up_label->setGeometry(5,8,70,14); - edit_up_label->setBackgroundColor(Qt::white); + edit_up_label->setStyleSheet("background-color: #FFFFFF"); edit_up_label->setFont(labelFont()); edit_up_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); edit_down_label=new QLabel("00:00:00",this); edit_down_label->setGeometry(sizeHint().width()-110,8,70,14); - edit_down_label->setBackgroundColor(Qt::white); + edit_down_label->setStyleSheet("background-color: #FFFFFF"); edit_down_label->setFont(labelFont()); edit_down_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -82,7 +83,7 @@ RDCueEdit::RDCueEdit(QWidget *parent) // QLabel *label=new QLabel(this); label->setGeometry(0,85,sizeHint().width()-30,60); - label->setBackgroundColor(QColor(Qt::gray)); + label->setStyleSheet("background-color: "+QColor(Qt::gray).name()); label->setLineWidth(1); label->setMidLineWidth(0); label->setFrameStyle(QFrame::Box|QFrame::Plain); @@ -94,7 +95,7 @@ RDCueEdit::RDCueEdit(QWidget *parent) new RDTransportButton(RDTransportButton::PlayBetween,this); edit_audition_button->setGeometry(sizeHint().width()/2-130,90,80,50); edit_audition_button-> - setPalette(QPalette(backgroundColor(),QColor(Qt::gray))); + setStyleSheet("background-color: "+QColor(Qt::gray).name()); edit_audition_button->setFont(buttonFont()); edit_audition_button-> setDisabled((rda->station()->cueCard()<0)||(rda->station()->cuePort()<0)); @@ -107,7 +108,8 @@ RDCueEdit::RDCueEdit(QWidget *parent) edit_pause_button=new RDTransportButton(RDTransportButton::Pause,this); edit_pause_button->setGeometry(sizeHint().width()/2-40,90,80,50); edit_pause_button-> - setPalette(QPalette(backgroundColor(),QColor(Qt::gray))); + setPalette(QPalette(palette().color(QPalette::Background), + QColor(Qt::gray))); edit_pause_button->setFont(buttonFont()); edit_pause_button-> setDisabled((rda->station()->cueCard()<0)||(rda->station()->cuePort()<0)); @@ -120,7 +122,8 @@ RDCueEdit::RDCueEdit(QWidget *parent) edit_stop_button->setGeometry(sizeHint().width()/2+50,90,80,50); edit_stop_button->setOnColor(QColor(Qt::red)); edit_stop_button-> - setPalette(QPalette(backgroundColor(),QColor(Qt::gray))); + setPalette(QPalette(palette().color(QPalette::Background), + QColor(Qt::gray))); edit_stop_button->setFont(buttonFont()); edit_stop_button-> setDisabled((rda->station()->cueCard()<0)||(rda->station()->cuePort()<0)); @@ -130,12 +133,13 @@ RDCueEdit::RDCueEdit(QWidget *parent) // Start Marker Control // edit_start_button=new RDPushButton(this); - edit_start_button->setToggleButton(true); + edit_start_button->setCheckable(true); edit_start_button->setGeometry(0,155,66,45); - edit_start_button->setFlashColor(backgroundColor()); + edit_start_button->setFlashColor(palette().color(QPalette::Background)); edit_start_button->setFlashPeriod(RD_CUEEDITOR_BUTTON_FLASH_PERIOD); - edit_start_button->setPalette(QPalette(QColor(RD_CUEEDITOR_START_MARKER), - backgroundColor())); + edit_start_button-> + setPalette(QPalette(QColor(RD_CUEEDITOR_START_MARKER), + palette().color(QPalette::Background))); edit_start_button->setFont(buttonFont()); edit_start_button->setText(tr("Start")); connect(edit_start_button,SIGNAL(clicked()),this,SLOT(startClickedData())); @@ -144,12 +148,12 @@ RDCueEdit::RDCueEdit(QWidget *parent) // End Marker Control // edit_end_button=new RDPushButton(this); - edit_end_button->setToggleButton(true); + edit_end_button->setCheckable(true); edit_end_button->setGeometry(90,155,66,45); - edit_end_button->setFlashColor(backgroundColor()); + edit_end_button->setFlashColor(palette().color(QPalette::Background)); edit_end_button->setFlashPeriod(RD_CUEEDITOR_BUTTON_FLASH_PERIOD); edit_end_button->setPalette(QPalette(QColor(RD_CUEEDITOR_START_MARKER), - backgroundColor())); + palette().color(QPalette::Background))); edit_end_button->setFont(buttonFont()); edit_end_button->setText(tr("End")); connect(edit_end_button,SIGNAL(clicked()),this,SLOT(endClickedData())); @@ -158,12 +162,13 @@ RDCueEdit::RDCueEdit(QWidget *parent) // Recue Marker Control // edit_recue_button=new RDPushButton(this); - edit_recue_button->setToggleButton(true); + edit_recue_button->setCheckable(true); edit_recue_button->setGeometry(180,155,66,45); - edit_recue_button->setFlashColor(backgroundColor()); + edit_recue_button->setFlashColor(palette().color(QPalette::Background)); edit_recue_button->setFlashPeriod(RD_CUEEDITOR_BUTTON_FLASH_PERIOD); - edit_recue_button->setPalette(QPalette(QColor(RD_CUEEDITOR_START_MARKER), - backgroundColor())); + edit_recue_button-> + setPalette(QPalette(QColor(RD_CUEEDITOR_START_MARKER), + palette().color(QPalette::Background))); edit_recue_button->setFont(buttonFont()); edit_recue_button->setText(tr("&Recue")); connect(edit_recue_button,SIGNAL(clicked()),this,SLOT(recue())); @@ -172,6 +177,7 @@ RDCueEdit::RDCueEdit(QWidget *parent) // Audition Stop Timer // edit_audition_timer=new QTimer(this); + edit_audition_timer->setSingleShot(true); connect(edit_audition_timer,SIGNAL(timeout()),this,SLOT(auditionTimerData())); // @@ -215,7 +221,7 @@ bool RDCueEdit::initialize(RDLogLine *logline) { edit_logline=logline; edit_position_bar->setLength(edit_logline->forcedLength()); - edit_start_button->setOn(false); + edit_start_button->setChecked(false); if(!(edit_logline->status()==RDLogLine::Scheduled) && !(edit_logline->status()==RDLogLine::Paused)) { edit_start_button->hide(); @@ -259,7 +265,7 @@ void RDCueEdit::stop() void RDCueEdit::recue() { edit_position_bar->setMarker(RDMarkerBar::Start,0); - if(edit_start_button->isOn()) { + if(edit_start_button->isChecked()) { edit_slider->setValue(0); } UpdateCounters(); @@ -268,11 +274,11 @@ void RDCueEdit::recue() void RDCueEdit::sliderChangedData(int pos) { - if(edit_start_button->isOn()) { + if(edit_start_button->isChecked()) { edit_position_bar->setMarker(RDMarkerBar::Start,pos); } else { - if(edit_end_button->isOn()) { + if(edit_end_button->isChecked()) { edit_position_bar->setMarker(RDMarkerBar::End,pos); } else { @@ -314,7 +320,7 @@ void RDCueEdit::auditionButtonData() if(!edit_play_deck->setCart(edit_logline,false)) { return; } - if(edit_start_button->isOn()) { + if(edit_start_button->isChecked()) { if(edit_play_deck->state()==RDPlayDeck::Stopped) { start_pos=edit_position_bar->marker(RDMarkerBar::Start); } @@ -324,7 +330,7 @@ void RDCueEdit::auditionButtonData() play_len=edit_position_bar->marker(RDMarkerBar::End)-start_pos; } else { - if(edit_end_button->isOn()) { + if(edit_end_button->isChecked()) { if(edit_play_deck->state()==RDPlayDeck::Stopped) { play_len=RD_CUEEDITOR_AUDITION_PREROLL; if(play_len>(edit_position_bar->marker(RDMarkerBar::End)- @@ -344,7 +350,7 @@ void RDCueEdit::auditionButtonData() } edit_play_deck->play(start_pos); if(play_len>=0) { - edit_audition_timer->start(play_len,true); + edit_audition_timer->start(play_len); } if((!edit_start_rml.isEmpty())&&(edit_event_player!=NULL)) { edit_event_player->exec(edit_logline->resolveWildcards(edit_start_rml)); @@ -408,7 +414,7 @@ void RDCueEdit::positionData(int id,int msecs) return; } edit_position_bar->setMarker(RDMarkerBar::Play,msecs); - if((!edit_start_button->isOn())&&(!edit_end_button->isOn())) { + if((!edit_start_button->isChecked())&&(!edit_end_button->isChecked())) { edit_slider->setValue(msecs); } UpdateCounters(); @@ -423,21 +429,21 @@ void RDCueEdit::auditionTimerData() void RDCueEdit::startClickedData() { - if(edit_end_button->isOn()) { + if(edit_end_button->isChecked()) { edit_end_button->toggle(); SetEndMode(false); } - SetStartMode(edit_start_button->isOn()); + SetStartMode(edit_start_button->isChecked()); } void RDCueEdit::endClickedData() { - if(edit_start_button->isOn()) { + if(edit_start_button->isChecked()) { edit_start_button->toggle(); SetStartMode(false); } - SetEndMode(edit_end_button->isOn()); + SetEndMode(edit_end_button->isChecked()); } @@ -452,7 +458,7 @@ void RDCueEdit::SetStartMode(bool state) (double)edit_logline-> forcedLength())),50); edit_slider->setValue(edit_position_bar->marker(RDMarkerBar::Start)); - edit_slider->setKnobColor(RD_CUEEDITOR_START_MARKER); + edit_slider->setKnobColor(QColor(RD_CUEEDITOR_START_MARKER)); edit_audition_button->setAccentColor(RD_CUEEDITOR_START_MARKER); edit_start_button->setFlashingEnabled(true); edit_up_label->setPalette(edit_start_color); @@ -463,7 +469,7 @@ void RDCueEdit::SetStartMode(bool state) edit_slider->setRange(0,edit_logline->forcedLength()); edit_slider->setGeometry(60,30,sizeHint().width()-150,50); edit_slider->setValue(edit_position_bar->marker(RDMarkerBar::Play)); - edit_slider->setKnobColor(RD_CUEEDITOR_PLAY_MARKER); + edit_slider->setKnobColor(QColor(RD_CUEEDITOR_PLAY_MARKER)); edit_audition_button->setAccentColor(RD_CUEEDITOR_PLAY_MARKER); edit_start_button->setFlashingEnabled(false); edit_up_label->setPalette(palette()); @@ -490,7 +496,7 @@ void RDCueEdit::SetEndMode(bool state) (double)edit_logline-> forcedLength())),50); edit_slider->setValue(edit_position_bar->marker(RDMarkerBar::End)); - edit_slider->setKnobColor(RD_CUEEDITOR_START_MARKER); + edit_slider->setKnobColor(QColor(RD_CUEEDITOR_START_MARKER)); edit_audition_button->setAccentColor(RD_CUEEDITOR_START_MARKER); edit_end_button->setFlashingEnabled(true); edit_up_label->setPalette(edit_start_color); @@ -501,7 +507,7 @@ void RDCueEdit::SetEndMode(bool state) edit_slider->setRange(0,edit_logline->forcedLength()); edit_slider->setGeometry(60,30,sizeHint().width()-150,50); edit_slider->setValue(edit_position_bar->marker(RDMarkerBar::Play)); - edit_slider->setKnobColor(RD_CUEEDITOR_PLAY_MARKER); + edit_slider->setKnobColor(QColor(RD_CUEEDITOR_PLAY_MARKER)); edit_audition_button->setAccentColor(RD_CUEEDITOR_PLAY_MARKER); edit_end_button->setFlashingEnabled(false); edit_up_label->setPalette(palette()); @@ -566,13 +572,13 @@ void RDCueEdit::Stopped(int id) ClearChannel(); edit_right_click_stop=false; } - if(edit_start_button->isOn()) { + if(edit_start_button->isChecked()) { edit_position_bar-> setMarker(RDMarkerBar::Play,edit_position_bar->marker(RDMarkerBar::Start)); edit_slider->setValue(edit_position_bar->marker(RDMarkerBar::Start)); } else { - if(edit_end_button->isOn()) { + if(edit_end_button->isChecked()) { edit_slider->setValue(edit_position_bar->marker(RDMarkerBar::End)); } else { @@ -585,7 +591,7 @@ void RDCueEdit::Stopped(int id) void RDCueEdit::UpdateCounters() { - if(edit_start_button->isOn()) { + if(edit_start_button->isChecked()) { edit_up_label-> setText(RDGetTimeLength(edit_position_bar->marker(RDMarkerBar::Start),true)); edit_down_label-> @@ -594,7 +600,7 @@ void RDCueEdit::UpdateCounters() marker(RDMarkerBar::Start),true)); } else { - if(edit_end_button->isOn()) { + if(edit_end_button->isChecked()) { edit_up_label-> setText(RDGetTimeLength(edit_position_bar->marker(RDMarkerBar::End), true)); @@ -630,7 +636,7 @@ void RDCueEdit::ClearChannel() void RDCueEdit::wheelEvent(QWheelEvent *e) { - if(edit_audition_button->isShown()) { + if(edit_audition_button->isVisible()) { if(edit_play_deck->state()==RDPlayDeck::Playing) { edit_play_deck->pause(); } @@ -649,7 +655,7 @@ void RDCueEdit::mousePressEvent(QMouseEvent *e) { switch(e->button()) { case Qt::RightButton: - if(edit_audition_button->isShown()) { + if(edit_audition_button->isVisible()) { if(edit_right_click_stop) { stopButtonData(); } @@ -660,7 +666,7 @@ void RDCueEdit::mousePressEvent(QMouseEvent *e) break; case Qt::MidButton: - if(edit_audition_button->isShown()) { + if(edit_audition_button->isVisible()) { if(edit_logline->forcedLength()>10000) { if(edit_play_deck->state()==RDPlayDeck::Playing) { edit_play_deck->pause(); diff --git a/lib/rdcut.cpp b/lib/rdcut.cpp index 3f6a49e0..67e1c6bc 100644 --- a/lib/rdcut.cpp +++ b/lib/rdcut.cpp @@ -52,8 +52,8 @@ RDCut::RDCut(const QString &name,bool create) return; } - sscanf((const char *)name+7,"%u",&cut_number); - sscanf((const char *)name.left(6),"%u",&cart_number); + cut_number=RDCut::cutNumber(name); + cart_number=RDCut::cartNumber(name); if(create) { RDCut::create(cut_name); } @@ -364,14 +364,14 @@ void RDCut::setStartDaypart(const QTime &time,bool valid) const bool RDCut::weekPart(int dayofweek) const { return RDBool(RDGetSqlValue("CUTS","CUT_NAME",cut_name, - RDGetShortDayNameEN(dayofweek).upper()). + RDGetShortDayNameEN(dayofweek).toUpper()). toString()); } void RDCut::setWeekPart(int dayofweek,bool state) const { - SetRow(RDGetShortDayNameEN(dayofweek).upper(),RDYesNo(state)); + SetRow(RDGetShortDayNameEN(dayofweek).toUpper(),RDYesNo(state)); } @@ -1271,7 +1271,7 @@ bool RDCut::checkInRecording(const QString &station_name, // Attempt to resolve IP address // if(addr.setAddress(src_hostname)) { - if(addr.isIPv4Address()) { + if(addr.protocol()==QAbstractSocket::IPv4Protocol) { QStringList f0=addr.toString().split("."); if(f0[0]=="127") { src_hostname=station_name; @@ -1285,7 +1285,7 @@ bool RDCut::checkInRecording(const QString &station_name, } } } - if(addr.isIPv6Address()) { + if(addr.protocol()==QAbstractSocket::IPv6Protocol) { QStringList f0=addr.toString().split(":"); if(f0.back()=="1") { src_hostname=station_name; @@ -1783,14 +1783,14 @@ bool RDCut::FileCopy(const QString &srcfile,const QString &destfile) const int previous_step=0; int step=0; - if((src_fd=open((const char *)srcfile.utf8(),O_RDONLY))<0) { + if((src_fd=open((const char *)srcfile.toUtf8(),O_RDONLY))<0) { return false; } if(fstat(src_fd,&src_stat)<0) { close(src_fd); return false; } - if((dest_fd=open((const char *)destfile.utf8(),O_RDWR|O_CREAT,src_stat.st_mode)) + if((dest_fd=open((const char *)destfile.toUtf8(),O_RDWR|O_CREAT,src_stat.st_mode)) <0) { close(src_fd); return false; diff --git a/lib/rdcut_dialog.cpp b/lib/rdcut_dialog.cpp index 77016b09..7889321f 100644 --- a/lib/rdcut_dialog.cpp +++ b/lib/rdcut_dialog.cpp @@ -65,9 +65,8 @@ RDCutDialog::RDCutDialog(QString *filter,QString *group,QString *schedcode, // Progress Dialog // cart_progress_dialog= - new QProgressDialog(tr("Please Wait..."),tr("Cancel"),0,10,this, - Qt::WStyle_Customize|Qt::WStyle_NormalBorder); - cart_progress_dialog->setCaption(" "); + new QProgressDialog(tr("Please Wait..."),tr("Cancel"),0,10,this); + cart_progress_dialog->setWindowTitle(" "); QLabel *label=new QLabel(tr("Please Wait..."),cart_progress_dialog); label->setAlignment(Qt::AlignCenter); label->setFont(progressFont()); @@ -365,7 +364,7 @@ void RDCutDialog::SaveState() return; } - if((f=fopen(state_file,"w"))==NULL) { + if((f=fopen(state_file.toUtf8(),"w"))==NULL) { return; } fprintf(f,"[RDCutDialog]\n"); diff --git a/lib/rddatedecode.cpp b/lib/rddatedecode.cpp index 7f74b5ef..8c053fc2 100644 --- a/lib/rddatedecode.cpp +++ b/lib/rddatedecode.cpp @@ -107,22 +107,22 @@ QString RDDateDecode(QString str,const QDate &date,RDStation *station, // // Wildcard Lookup // - switch(str.at(i).latin1()) { + switch(str.at(i).toLatin1()) { case 'a': // Abbreviated weekday name - field=QDate::shortDayName(dt.dayOfWeek()).lower(); + field=QDate::shortDayName(dt.dayOfWeek()).toLower(); break; case 'A': // Full weekday name - field=QDate::longDayName(dt.dayOfWeek()).lower(); + field=QDate::longDayName(dt.dayOfWeek()).toLower(); break; case 'b': // Abbreviated month name case 'h': - field=QDate::shortMonthName(dt.month()).lower(); + field=QDate::shortMonthName(dt.month()).toLower(); break; case 'B': // Full month name - field=QDate::longMonthName(dt.month()).lower(); + field=QDate::longMonthName(dt.month()).toLower(); break; case 'C': // Century @@ -220,10 +220,10 @@ QString RDDateDecode(QString str,const QDate &date,RDStation *station, break; } if(upper_case) { - field=field.upper(); + field=field.toUpper(); } if(initial_case) { - field=field.left(1).upper()+field.right(field.length()-1); + field=field.left(1).toUpper()+field.right(field.length()-1); } string+=field; } @@ -320,20 +320,20 @@ QString RDDateTimeDecode(QString str,const QDateTime &datetime, // switch(str.at(i).toLatin1()) { case 'a': // Abbreviated weekday name - field=QDate::shortDayName(dt.date().dayOfWeek()).lower(); + field=QDate::shortDayName(dt.date().dayOfWeek()).toLower(); break; case 'A': // Full weekday name - field=QDate::longDayName(dt.date().dayOfWeek()).lower(); + field=QDate::longDayName(dt.date().dayOfWeek()).toLower(); break; case 'b': // Abbreviated month name case 'h': - field=QDate::shortMonthName(dt.date().month()).lower(); + field=QDate::shortMonthName(dt.date().month()).toLower(); break; case 'B': // Full month name - field=QDate::longMonthName(dt.date().month()).lower(); + field=QDate::longMonthName(dt.date().month()).toLower(); break; case 'C': // Century @@ -463,10 +463,10 @@ QString RDDateTimeDecode(QString str,const QDateTime &datetime, break; } if(upper_case) { - field=field.upper(); + field=field.toUpper(); } if(initial_case) { - field=field.left(1).upper()+field.right(field.length()-1); + field=field.left(1).toUpper()+field.right(field.length()-1); } string+=field; } diff --git a/lib/rddatedialog.cpp b/lib/rddatedialog.cpp index 6f943d28..ae1f61ad 100644 --- a/lib/rddatedialog.cpp +++ b/lib/rddatedialog.cpp @@ -52,7 +52,7 @@ RDDateDialog::RDDateDialog(int low_year,int high_year,QWidget *parent) // // OK Button // - QPushButton *button=new QPushButton(this,"ok_button"); + QPushButton *button=new QPushButton(this); button->setGeometry(sizeHint().width()-130,sizeHint().height()-40,50,30); button->setFont(buttonFont()); button->setText(tr("&OK")); @@ -61,7 +61,7 @@ RDDateDialog::RDDateDialog(int low_year,int high_year,QWidget *parent) // // Cancel Button // - button=new QPushButton(this,"cancel_button"); + button=new QPushButton(this); button->setGeometry(sizeHint().width()-65,sizeHint().height()-40,55,30); button->setFont(buttonFont()); button->setText(tr("&Cancel")); diff --git a/lib/rddatepicker.cpp b/lib/rddatepicker.cpp index 6e81f86e..d94e1dc2 100644 --- a/lib/rddatepicker.cpp +++ b/lib/rddatepicker.cpp @@ -35,7 +35,7 @@ RDDatePicker::RDDatePicker(int low_year,int high_year,QWidget *parent) pick_month_box=new QComboBox(this); pick_month_box->setGeometry(0,0,120,26); for(int i=1;i<13;i++) { - pick_month_box->insertItem(QDate::longMonthName(i)); + pick_month_box->insertItem(pick_month_box->count(),QDate::longMonthName(i)); } connect(pick_month_box,SIGNAL(activated(int)), this,SLOT(monthActivatedData(int))); @@ -47,7 +47,8 @@ RDDatePicker::RDDatePicker(int low_year,int high_year,QWidget *parent) pick_year_box=new QComboBox(this); pick_year_box->setGeometry(130,0,90,26); for(int i=low_year;i<(high_year+1);i++) { - pick_year_box->insertItem(QString().sprintf("%04d",i)); + pick_year_box-> + insertItem(pick_year_box->count(),QString().sprintf("%04d",i)); } connect(pick_year_box,SIGNAL(activated(int)), this,SLOT(yearActivatedData(int))); @@ -165,9 +166,9 @@ bool RDDatePicker::setDate(QDate date) return false; } pick_date=date; - pick_month_box->setCurrentItem(date.month()-1); + pick_month_box->setCurrentIndex(date.month()-1); if(pick_year_box!=NULL) { - pick_year_box->setCurrentItem(date.year()-pick_low_year); + pick_year_box->setCurrentIndex(date.year()-pick_low_year); } else { pick_year_spin->setValue(date.year()); @@ -192,14 +193,14 @@ void RDDatePicker::monthActivatedData(int id) void RDDatePicker::yearActivatedData(int id) { - QDate date=QDate(pick_low_year+pick_year_box->currentItem(), + QDate date=QDate(pick_low_year+pick_year_box->currentIndex(), pick_date.month(),1); if(pick_date.day()<=date.daysInMonth()) { - pick_date=QDate(pick_low_year+pick_year_box->currentItem(), + pick_date=QDate(pick_low_year+pick_year_box->currentIndex(), pick_date.month(),pick_date.day()); } else { - pick_date=QDate(pick_low_year+pick_year_box->currentItem(), + pick_date=QDate(pick_low_year+pick_year_box->currentIndex(), pick_date.month(),date.daysInMonth()); } PrintDays(); @@ -275,11 +276,11 @@ void RDDatePicker::PrintDays() // Get Top of Month // if(pick_year_box!=NULL) { - top_date=QDate(pick_low_year+pick_year_box->currentItem(), - pick_month_box->currentItem()+1,1); + top_date=QDate(pick_low_year+pick_year_box->currentIndex(), + pick_month_box->currentIndex()+1,1); } else { - top_date=QDate(pick_year_spin->value(),pick_month_box->currentItem()+1,1); + top_date=QDate(pick_year_spin->value(),pick_month_box->currentIndex()+1,1); } // diff --git a/lib/rddatetime.cpp b/lib/rddatetime.cpp index 6d56eca2..f2796f90 100644 --- a/lib/rddatetime.cpp +++ b/lib/rddatetime.cpp @@ -89,7 +89,7 @@ QTime RDParseXmlTime(const QString &str,bool *ok,int *day_offset) return ret; } - if(f0[0].right(1).lower()=="z") { // GMT + if(f0[0].right(1).toLower()=="z") { // GMT tz=-RDTimeZoneOffset(); f0[0]=f0[0].left(f0[0].length()-1); f2=f0[0].split(":"); diff --git a/lib/rddb.cpp b/lib/rddb.cpp index c6db2e9a..e5590ece 100644 --- a/lib/rddb.cpp +++ b/lib/rddb.cpp @@ -58,9 +58,9 @@ RDSqlQuery::RDSqlQuery (const QString &query,bool reconnect): +"["+db.lastError().text()+"]"; } - fprintf(stderr,"%s\n",(const char *)err); + fprintf(stderr,"%s\n",err.toUtf8().constData()); if(rda!=NULL) { - rda->syslog(LOG_ERR,(const char *)err); + rda->syslog(LOG_ERR,err.toUtf8().constData()); } } @@ -85,9 +85,9 @@ RDSqlQuery::RDSqlQuery (const QString &query,bool reconnect): err=QObject::tr("invalid SQL or failed DB connection")+ +"["+lastError().text()+"]: "+query; - fprintf(stderr,"%s\n",(const char *)err); + fprintf(stderr,"%s\n",err.toUtf8().constData()); if(rda!=NULL) { - rda->syslog(LOG_ERR,(const char *)err); + rda->syslog(LOG_ERR,err.toUtf8().constData()); } } } diff --git a/lib/rddebug.cpp b/lib/rddebug.cpp index 7d6f5c9d..c6124630 100644 --- a/lib/rddebug.cpp +++ b/lib/rddebug.cpp @@ -24,6 +24,6 @@ void RDTimePoint(QString label) { - printf("RDTimePoint - %s: %s\n",(const char *)label, - (const char *)QTime::currentTime().toString("hh:mm:ss.zzz")); + printf("RDTimePoint - %s: %s\n",label.toUtf8().constData(), + QTime::currentTime().toString("hh:mm:ss.zzz").toUtf8().constData()); } diff --git a/lib/rddelete.cpp b/lib/rddelete.cpp index 8d392ba5..60ad4052 100644 --- a/lib/rddelete.cpp +++ b/lib/rddelete.cpp @@ -133,7 +133,7 @@ RDDelete::ErrorCode RDDelete::runDelete(const QString &username, curl_easy_setopt(curl,CURLOPT_KEYPASSWD,password.toUtf8().constData()); } else { - strncpy(userpwd,(username+":"+password).utf8(),256); + strncpy(userpwd,(username+":"+password).toUtf8(),256); curl_easy_setopt(curl,CURLOPT_USERPWD,userpwd); } diff --git a/lib/rddisclookup.cpp b/lib/rddisclookup.cpp index 223b71ce..5d795190 100644 --- a/lib/rddisclookup.cpp +++ b/lib/rddisclookup.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include @@ -191,8 +190,8 @@ void RDDiscLookup::profile(const QString &msg) { if(lookup_profile_msgs!=NULL) { printf("%s | RDDiscLookup::%s\n", - (const char *)QTime::currentTime().toString("hh:mm:ss.zzz"), - (const char *)msg.toUtf8()); + QTime::currentTime().toString("hh:mm:ss.zzz").toUtf8().constData(), + msg.toUtf8().constData()); } } diff --git a/lib/rddiscrecord.cpp b/lib/rddiscrecord.cpp index dee10ab0..fc923556 100644 --- a/lib/rddiscrecord.cpp +++ b/lib/rddiscrecord.cpp @@ -158,7 +158,7 @@ void RDDiscRecord::setDiscTitle(QString title) int n; disc_disc_title=title; - if((n=title.find(" / "))!=-1) { + if((n=title.indexOf(" / "))!=-1) { disc_disc_artist=title.left(n); disc_disc_album=title.right(title.length()-n-3); disc_disc_author=""; diff --git a/lib/rddownload.cpp b/lib/rddownload.cpp index e51b7483..06a030ba 100644 --- a/lib/rddownload.cpp +++ b/lib/rddownload.cpp @@ -132,7 +132,7 @@ RDDownload::ErrorCode RDDownload::runDownload(const QString &username, // // Validate User for file: transfers // - if((getuid()==0)&&(conv_src_url.protocol().lower()=="file")) { + if((getuid()==0)&&(conv_src_url.scheme().toLower()=="file")) { user=new RDSystemUser(username); if(!user->validatePassword(password)) { delete user; @@ -143,7 +143,7 @@ RDDownload::ErrorCode RDDownload::runDownload(const QString &username, if((curl=curl_easy_init())==NULL) { return RDDownload::ErrorInternal; } - if((f=fopen(conv_dst_filename,"w"))==NULL) { + if((f=fopen(conv_dst_filename.toUtf8(),"w"))==NULL) { curl_easy_cleanup(curl); return RDDownload::ErrorNoDestination; } @@ -170,7 +170,7 @@ RDDownload::ErrorCode RDDownload::runDownload(const QString &username, curl_easy_setopt(curl,CURLOPT_KEYPASSWD,password.toUtf8().constData()); } else { - strncpy(userpwd,(username+":"+password).utf8(),256); + strncpy(userpwd,(username+":"+password).toUtf8(),256); curl_easy_setopt(curl,CURLOPT_USERPWD,userpwd); } @@ -194,7 +194,7 @@ RDDownload::ErrorCode RDDownload::runDownload(const QString &username, } switch((curl_err=curl_easy_perform(curl))) { case CURLE_OK: - if(conv_src_url.protocol().lower()=="http") { + if(conv_src_url.scheme().toLower()=="http") { curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&response_code); if(response_code!=200) { ret=RDDownload::ErrorUrlInvalid; @@ -238,8 +238,8 @@ RDDownload::ErrorCode RDDownload::runDownload(const QString &username, } if((curl_err!=CURLE_OK)&&log_debug) { rda->syslog(LOG_WARNING,"CURL download failed: url: %s username: %s", - (const char *)conv_src_url.toString(), - (const char *)username); + conv_src_url.toString().toUtf8().constData(), + username.toUtf8().constData()); } curl_easy_cleanup(curl); fclose(f); diff --git a/lib/rdedit_audio.cpp b/lib/rdedit_audio.cpp index 87930685..382c9b42 100644 --- a/lib/rdedit_audio.cpp +++ b/lib/rdedit_audio.cpp @@ -77,7 +77,7 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, // The Cut // edit_cut=new RDCut(cut_name); - setCaption("RDLibrary - "+tr("Edit Audio")); + setWindowTitle("RDLibrary - "+tr("Edit Audio")); // // The Audio @@ -101,7 +101,7 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, } else { fprintf(stderr,"unable to download cut data, error was: \"%s\".\n", - (const char *)RDAudioInfo::errorText(audio_err)); + RDAudioInfo::errorText(audio_err).toUtf8().constData()); edit_sample_rate=RD_DEFAULT_SAMPLE_RATE; edit_sample_length=info->frames(); edit_channels=2; @@ -120,7 +120,7 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, // // Save Button // - QPushButton *button=new QPushButton(this,"save_button"); + QPushButton *button=new QPushButton(this); button->setFocusPolicy(Qt::NoFocus); button->setGeometry(EDITAUDIO_WIDGET_WIDTH-90,EDITAUDIO_WIDGET_HEIGHT-120, 80,50); @@ -132,7 +132,7 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, // // Cancel Button // - QPushButton *cancel_button=new QPushButton(this,"cancel_button"); + QPushButton *cancel_button=new QPushButton(this); cancel_button->setFocusPolicy(Qt::NoFocus); cancel_button->setGeometry(EDITAUDIO_WIDGET_WIDTH-90, EDITAUDIO_WIDGET_HEIGHT-60,80,50); @@ -184,8 +184,11 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, // // Time Origin Scroll Bar // - edit_hscroll=new QScrollBar(0,0,EDITAUDIO_PAN_SIZE/10, - EDITAUDIO_PAN_SIZE,0,Qt::Horizontal,this); + edit_hscroll=new QScrollBar(Qt::Horizontal,this); + edit_hscroll->setMinimum(0); + edit_hscroll->setMaximum(0); + edit_hscroll->setSingleStep(EDITAUDIO_PAN_SIZE/10); + edit_hscroll->setPageStep(EDITAUDIO_PAN_SIZE); edit_hscroll->setGeometry(10,10+EDITAUDIO_WAVEFORM_HEIGHT, EDITAUDIO_WAVEFORM_WIDTH,20); connect(edit_hscroll,SIGNAL(valueChanged(int)),this,SLOT(hscrollData(int))); @@ -273,13 +276,15 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, esc_mapper,SLOT(map())); edit_cue_button[RDEditAudio::Start]=new RDMarkerButton(this); - edit_cue_button[RDEditAudio::Start]->setToggleButton(true); + edit_cue_button[RDEditAudio::Start]->setCheckable(true); edit_cue_button[RDEditAudio::Start]->setGeometry(20,485,66,45); - edit_cue_button[RDEditAudio::Start]->setFlashColor(backgroundColor()); + edit_cue_button[RDEditAudio::Start]-> + setFlashColor(palette().color(QPalette::Background)); edit_cue_button[RDEditAudio::Start]-> setFlashPeriod(EDITAUDIO_BUTTON_FLASH_PERIOD); edit_cue_button[RDEditAudio::Start]-> - setPalette(QPalette(QColor(RD_START_END_MARKER_COLOR),backgroundColor())); + setPalette(QPalette(QColor(RD_START_END_MARKER_COLOR), + palette().color(QPalette::Background))); edit_cue_button[RDEditAudio::Start]-> setFont(buttonFont()); edit_cue_button[RDEditAudio::Start]->setText(tr("Cut\nStart")); @@ -301,14 +306,14 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, connect(edit_cursor_edit[RDEditAudio::End],SIGNAL(escapePressed()), esc_mapper,SLOT(map())); edit_cue_button[RDEditAudio::End]=new RDMarkerButton(this); - edit_cue_button[RDEditAudio::End]->setToggleButton(true); + edit_cue_button[RDEditAudio::End]->setCheckable(true); edit_cue_button[RDEditAudio::End]->setGeometry(20,530,66,45); - edit_cue_button[RDEditAudio::End]->setFlashColor(backgroundColor()); + edit_cue_button[RDEditAudio::End]->setFlashColor(palette().color(QPalette::Background)); edit_cue_button[RDEditAudio::End]-> setFlashPeriod(EDITAUDIO_BUTTON_FLASH_PERIOD); edit_cue_button[RDEditAudio::End]-> setPalette(QPalette(QColor(RD_START_END_MARKER_COLOR), - backgroundColor())); + palette().color(QPalette::Background) )); edit_cue_button[RDEditAudio::End]-> setFont(buttonFont()); edit_cue_button[RDEditAudio::End]->setText(tr("Cut\nEnd")); @@ -330,14 +335,15 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, connect(edit_cursor_edit[RDEditAudio::TalkStart],SIGNAL(escapePressed()), esc_mapper,SLOT(map())); edit_cue_button[RDEditAudio::TalkStart]=new RDMarkerButton(this); - edit_cue_button[RDEditAudio::TalkStart]->setToggleButton(true); + edit_cue_button[RDEditAudio::TalkStart]->setCheckable(true); edit_cue_button[RDEditAudio::TalkStart]->setGeometry(175,585,66,45); - edit_cue_button[RDEditAudio::TalkStart]->setFlashColor(backgroundColor()); + edit_cue_button[RDEditAudio::TalkStart]-> + setFlashColor(palette().color(QPalette::Background)); edit_cue_button[RDEditAudio::TalkStart]-> setFlashPeriod(EDITAUDIO_BUTTON_FLASH_PERIOD); edit_cue_button[RDEditAudio::TalkStart]-> setPalette(QPalette(QColor(RD_TALK_MARKER_COLOR), - backgroundColor())); + palette().color(QPalette::Background))); edit_cue_button[RDEditAudio::TalkStart]-> setFont(buttonFont()); edit_cue_button[RDEditAudio::TalkStart]->setText(tr("Talk\nStart")); @@ -359,14 +365,15 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, connect(edit_cursor_edit[RDEditAudio::TalkEnd],SIGNAL(escapePressed()), esc_mapper,SLOT(map())); edit_cue_button[RDEditAudio::TalkEnd]=new RDMarkerButton(this); - edit_cue_button[RDEditAudio::TalkEnd]->setToggleButton(true); + edit_cue_button[RDEditAudio::TalkEnd]->setCheckable(true); edit_cue_button[RDEditAudio::TalkEnd]->setGeometry(175,630,66,45); - edit_cue_button[RDEditAudio::TalkEnd]->setFlashColor(backgroundColor()); + edit_cue_button[RDEditAudio::TalkEnd]-> + setFlashColor(palette().color(QPalette::Background)); edit_cue_button[RDEditAudio::TalkEnd]-> setFlashPeriod(EDITAUDIO_BUTTON_FLASH_PERIOD); edit_cue_button[RDEditAudio::TalkEnd]-> setPalette(QPalette(QColor(RD_TALK_MARKER_COLOR), - backgroundColor())); + palette().color(QPalette::Background))); edit_cue_button[RDEditAudio::TalkEnd]-> setFont(buttonFont()); edit_cue_button[RDEditAudio::TalkEnd]->setText("Talk\nEnd"); @@ -390,14 +397,15 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, connect(edit_cursor_edit[RDEditAudio::SegueStart],SIGNAL(escapePressed()), esc_mapper,SLOT(map())); edit_cue_button[RDEditAudio::SegueStart]=new RDMarkerButton(this); - edit_cue_button[RDEditAudio::SegueStart]->setToggleButton(true); + edit_cue_button[RDEditAudio::SegueStart]->setCheckable(true); edit_cue_button[RDEditAudio::SegueStart]->setGeometry(330,585,66,45); - edit_cue_button[RDEditAudio::SegueStart]->setFlashColor(backgroundColor()); + edit_cue_button[RDEditAudio::SegueStart]-> + setFlashColor(palette().color(QPalette::Background)); edit_cue_button[RDEditAudio::SegueStart]-> setFlashPeriod(EDITAUDIO_BUTTON_FLASH_PERIOD); edit_cue_button[RDEditAudio::SegueStart]-> setPalette(QPalette(QColor(RD_SEGUE_MARKER_COLOR), - backgroundColor())); + palette().color(QPalette::Background))); edit_cue_button[RDEditAudio::SegueStart]-> setFont(buttonFont()); edit_cue_button[RDEditAudio::SegueStart]->setText(tr("Segue\nStart")); @@ -420,13 +428,15 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, connect(edit_cursor_edit[RDEditAudio::SegueEnd],SIGNAL(escapePressed()), esc_mapper,SLOT(map())); edit_cue_button[RDEditAudio::SegueEnd]=new RDMarkerButton(this); - edit_cue_button[RDEditAudio::SegueEnd]->setToggleButton(true); + edit_cue_button[RDEditAudio::SegueEnd]->setCheckable(true); edit_cue_button[RDEditAudio::SegueEnd]->setGeometry(330,630,66,45); - edit_cue_button[RDEditAudio::SegueEnd]->setFlashColor(backgroundColor()); + edit_cue_button[RDEditAudio::SegueEnd]-> + setFlashColor(palette().color(QPalette::Background)); edit_cue_button[RDEditAudio::SegueEnd]-> setFlashPeriod(EDITAUDIO_BUTTON_FLASH_PERIOD); edit_cue_button[RDEditAudio::SegueEnd]-> - setPalette(QPalette(QColor(RD_SEGUE_MARKER_COLOR),backgroundColor())); + setPalette(QPalette(QColor(RD_SEGUE_MARKER_COLOR), + palette().color(QPalette::Background))); edit_cue_button[RDEditAudio::SegueEnd]-> setFont(buttonFont()); edit_cue_button[RDEditAudio::SegueEnd]->setText(tr("Segue\nEnd")); @@ -448,13 +458,15 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, connect(edit_cursor_edit[RDEditAudio::FadeUp],SIGNAL(escapePressed()), esc_mapper,SLOT(map())); edit_cue_button[RDEditAudio::FadeUp]=new RDMarkerButton(this); - edit_cue_button[RDEditAudio::FadeUp]->setToggleButton(true); + edit_cue_button[RDEditAudio::FadeUp]->setCheckable(true); edit_cue_button[RDEditAudio::FadeUp]->setGeometry(20,585,66,45); - edit_cue_button[RDEditAudio::FadeUp]->setFlashColor(backgroundColor()); + edit_cue_button[RDEditAudio::FadeUp]-> + setFlashColor(palette().color(QPalette::Background)); edit_cue_button[RDEditAudio::FadeUp]-> setFlashPeriod(EDITAUDIO_BUTTON_FLASH_PERIOD); edit_cue_button[RDEditAudio::FadeUp]-> - setPalette(QPalette(QColor(RD_FADE_MARKER_COLOR),backgroundColor())); + setPalette(QPalette(QColor(RD_FADE_MARKER_COLOR), + palette().color(QPalette::Background))); edit_cue_button[RDEditAudio::FadeUp]-> setFont(buttonFont()); edit_cue_button[RDEditAudio::FadeUp]->setText(tr("Fade\nUp")); @@ -476,13 +488,15 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, connect(edit_cursor_edit[RDEditAudio::FadeDown],SIGNAL(escapePressed()), esc_mapper,SLOT(map())); edit_cue_button[RDEditAudio::FadeDown]=new RDMarkerButton(this); - edit_cue_button[RDEditAudio::FadeDown]->setToggleButton(true); + edit_cue_button[RDEditAudio::FadeDown]->setCheckable(true); edit_cue_button[RDEditAudio::FadeDown]->setGeometry(20,630,66,45); - edit_cue_button[RDEditAudio::FadeDown]->setFlashColor(backgroundColor()); + edit_cue_button[RDEditAudio::FadeDown]-> + setFlashColor(palette().color(QPalette::Background)); edit_cue_button[RDEditAudio::FadeDown]-> setFlashPeriod(EDITAUDIO_BUTTON_FLASH_PERIOD); edit_cue_button[RDEditAudio::FadeDown]-> - setPalette(QPalette(QColor(RD_FADE_MARKER_COLOR),backgroundColor())); + setPalette(QPalette(QColor(RD_FADE_MARKER_COLOR), + palette().color(QPalette::Background))); edit_cue_button[RDEditAudio::FadeDown]-> setFont(buttonFont()); edit_cue_button[RDEditAudio::FadeDown]->setText("Fade\nDown"); @@ -507,14 +521,15 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, esc_mapper,SLOT(map())); edit_cursor_edit[RDEditAudio::HookStart]->setReadOnly(true); edit_cue_button[RDEditAudio::HookStart]=new RDMarkerButton(this); - edit_cue_button[RDEditAudio::HookStart]->setToggleButton(true); + edit_cue_button[RDEditAudio::HookStart]->setCheckable(true); edit_cue_button[RDEditAudio::HookStart]->setGeometry(485,585,66,45); - edit_cue_button[RDEditAudio::HookStart]->setFlashColor(backgroundColor()); + edit_cue_button[RDEditAudio::HookStart]-> + setFlashColor(palette().color(QPalette::Background)); edit_cue_button[RDEditAudio::HookStart]-> setFlashPeriod(EDITAUDIO_BUTTON_FLASH_PERIOD); edit_cue_button[RDEditAudio::HookStart]-> setPalette(QPalette(QColor(RD_HOOK_MARKER_COLOR), - backgroundColor())); + palette().color(QPalette::Background))); edit_cue_button[RDEditAudio::HookStart]-> setFont(buttonFont()); edit_cue_button[RDEditAudio::HookStart]->setText(tr("Hook\nStart")); @@ -537,14 +552,15 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, connect(edit_cursor_edit[RDEditAudio::HookEnd],SIGNAL(escapePressed()), esc_mapper,SLOT(map())); edit_cue_button[RDEditAudio::HookEnd]=new RDMarkerButton(this); - edit_cue_button[RDEditAudio::HookEnd]->setToggleButton(true); + edit_cue_button[RDEditAudio::HookEnd]->setCheckable(true); edit_cue_button[RDEditAudio::HookEnd]->setGeometry(485,630,66,45); - edit_cue_button[RDEditAudio::HookEnd]->setFlashColor(backgroundColor()); + edit_cue_button[RDEditAudio::HookEnd]-> + setFlashColor(palette().color(QPalette::Background)); edit_cue_button[RDEditAudio::HookEnd]-> setFlashPeriod(EDITAUDIO_BUTTON_FLASH_PERIOD); edit_cue_button[RDEditAudio::HookEnd]-> setPalette(QPalette(QColor(RD_HOOK_MARKER_COLOR), - backgroundColor())); + palette().color(QPalette::Background))); edit_cue_button[RDEditAudio::HookEnd]-> setFont(buttonFont()); edit_cue_button[RDEditAudio::HookEnd]->setText(tr("Hook\nEnd")); @@ -570,7 +586,8 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, QPushButton *trim_start_button=new QPushButton(this); trim_start_button->setGeometry(175,485,66,45); trim_start_button-> - setPalette(QPalette(QColor(RD_START_END_MARKER_COLOR),backgroundColor())); + setPalette(QPalette(QColor(RD_START_END_MARKER_COLOR), + palette().color(QPalette::Background))); trim_start_button->setFont(buttonFont()); trim_start_button->setText(tr("Trim\nStart")); connect(trim_start_button,SIGNAL(clicked()),this,SLOT(trimHeadData())); @@ -578,7 +595,8 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, QPushButton *trim_end_button=new QPushButton(this); trim_end_button->setGeometry(175,530,66,45); trim_end_button-> - setPalette(QPalette(QColor(RD_START_END_MARKER_COLOR),backgroundColor())); + setPalette(QPalette(QColor(RD_START_END_MARKER_COLOR), + palette().color(QPalette::Background))); trim_end_button->setFont(buttonFont()); trim_end_button->setText(tr("Trim\nEnd")); connect(trim_end_button,SIGNAL(clicked()),this,SLOT(trimTailData())); @@ -588,7 +606,8 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, // edit_gain_control=new QAbstractSlider(this); edit_gain_control->setRange(-1000,1000); - edit_gain_control->setSteps(10,10); + edit_gain_control->setSingleStep(10); + edit_gain_control->setPageStep(10); edit_gain_edit=new RDMarkerEdit(this); edit_gain_edit->setGeometry(398,529,70,21); edit_gain_edit->setAcceptDrops(false); @@ -621,7 +640,7 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, edit_remove_button->setGeometry(485,510,66,45); edit_remove_button->setFont(buttonFont()); edit_remove_button->setText(tr("Remove\nMarker")); - edit_remove_button->setToggleButton(true); + edit_remove_button->setCheckable(true); edit_remove_button->setFlashColor(QColor(EDITAUDIO_REMOVE_FLASH_COLOR)); connect(edit_remove_button,SIGNAL(clicked()),this,SLOT(removeButtonData())); @@ -630,7 +649,7 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, // edit_overlap_box=new QCheckBox(this); edit_overlap_box->setGeometry(570,515,15,15); - label=new QLabel(edit_overlap_box,tr("No Fade on Segue Out"),this); + label=new QLabel(tr("No Fade on Segue Out"),this); label->setGeometry(590,513,130,20); label->setFont(subLabelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -643,7 +662,8 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, label->setFont(subLabelFont()); label->setAlignment(Qt::AlignHCenter); label-> - setPalette(QPalette(backgroundColor(),QColor(EDITAUDIO_HIGHLIGHT_COLOR))); + setPalette(QPalette(palette().color(QPalette::Background), + QColor(EDITAUDIO_HIGHLIGHT_COLOR))); edit_overall_edit=new QLineEdit(this); edit_overall_edit->setAcceptDrops(false); edit_overall_edit->setGeometry(60,400,70,21); @@ -654,7 +674,7 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, edit_region_edit_label->setFont(subLabelFont()); edit_region_edit_label->setAlignment(Qt::AlignHCenter); edit_region_edit_label-> - setPalette(QPalette(backgroundColor(),QColor(EDITAUDIO_HIGHLIGHT_COLOR))); + setPalette(QPalette(palette().color(QPalette::Background),QColor(EDITAUDIO_HIGHLIGHT_COLOR))); edit_region_edit=new QLineEdit(this); edit_region_edit->setAcceptDrops(false); edit_region_edit->setGeometry(158,400,70,21); @@ -665,7 +685,7 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,int card, label->setFont(subLabelFont()); label->setAlignment(Qt::AlignHCenter); label-> - setPalette(QPalette(backgroundColor(),QColor(EDITAUDIO_HIGHLIGHT_COLOR))); + setPalette(QPalette(palette().color(QPalette::Background),QColor(EDITAUDIO_HIGHLIGHT_COLOR))); edit_size_edit=new QLineEdit(this); edit_size_edit->setAcceptDrops(false); edit_size_edit->setGeometry(256,400,70,21); @@ -885,7 +905,7 @@ void RDEditAudio::xFullIn() (1.0-edit_factor_x/edit_max_factor_x))); CenterDisplay(); DrawMaps(); - repaint(false); + repaint(); } } @@ -904,7 +924,7 @@ void RDEditAudio::xUp() } CenterDisplay(); DrawMaps(); - repaint(false); + repaint(); } } @@ -923,7 +943,7 @@ void RDEditAudio::xDown() } CenterDisplay(); DrawMaps(); - repaint(false); + repaint(); } } @@ -935,7 +955,7 @@ void RDEditAudio::xFullOut() edit_hscroll->setRange(0,0); CenterDisplay(); DrawMaps(); - repaint(false); + repaint(); } } @@ -945,7 +965,7 @@ void RDEditAudio::yUp() if(edit_gain>-21) { edit_gain-=3; DrawMaps(); - repaint(false); + repaint(); } } @@ -955,7 +975,7 @@ void RDEditAudio::yDown() if(edit_gain<0) { edit_gain+=3; DrawMaps(); - repaint(false); + repaint(); } } @@ -970,20 +990,20 @@ void RDEditAudio::gotoCursorData() void RDEditAudio::gotoHomeData() { - edit_hscroll->setValue(edit_hscroll->minValue()); + edit_hscroll->setValue(edit_hscroll->minimum()); } void RDEditAudio::gotoEndData() { - edit_hscroll->setValue(edit_hscroll->maxValue()); + edit_hscroll->setValue(edit_hscroll->maximum()); } void RDEditAudio::hscrollData(int value) { DrawMaps(); - repaint(false); + repaint(); } @@ -1262,18 +1282,18 @@ void RDEditAudio::cuePointData(int id) break; } for(int i=1;i<11;i++) { - edit_cue_button[i]->setToggleButton(true); + edit_cue_button[i]->setCheckable(true); } edit_remove_button->setFlashingEnabled(false); - edit_remove_button->setOn(false); + edit_remove_button->setChecked(false); delete_marker=false; } else { - if(edit_cue_button[id]->isOn()) { + if(edit_cue_button[id]->isChecked()) { edit_cue_button[id]->setFlashingEnabled(true); if(edit_cue_point!=RDEditAudio::Play) { cueEditData(edit_cue_point); - edit_cue_button[edit_cue_point]->setOn(false); + edit_cue_button[edit_cue_point]->setChecked(false); edit_cue_button[edit_cue_point]->setFlashingEnabled(false); edit_cursor_edit[edit_cue_point]->setReadOnly(true); } @@ -1458,16 +1478,14 @@ void RDEditAudio::gainDownPressedData() void RDEditAudio::gainChangedData() { - int gain; + int gain=edit_gain_edit->text().toInt(); - if(sscanf((const char *)edit_gain_edit->text(),"%d",&gain)==1) { - edit_gain_control->setValue(gain*100); - } + edit_gain_control->setValue(gain*100); edit_gain_edit-> setText(QString().sprintf("%4.1f ", (double)edit_gain_control->value()/100.0)+tr("dB")); DrawMaps(); - repaint(false); + repaint(); } @@ -1483,16 +1501,20 @@ void RDEditAudio::gainTimerData() { switch(edit_gain_mode) { case RDEditAudio::GainUp: - edit_gain_control->addLine(); + edit_gain_control->setValue(edit_gain_control->value()+ + edit_gain_control->singleStep()); if(edit_gain_count++==1) { - edit_gain_timer->changeInterval(TYPO_RATE_2); + edit_gain_timer->stop(); + edit_gain_timer->start(TYPO_RATE_2); } break; case RDEditAudio::GainDown: - edit_gain_control->subtractLine(); + edit_gain_control->setValue(edit_gain_control->value()- + edit_gain_control->singleStep()); if(edit_gain_count++==1) { - edit_gain_timer->changeInterval(TYPO_RATE_2); + edit_gain_timer->stop(); + edit_gain_timer->start(TYPO_RATE_2); } break; @@ -1503,27 +1525,27 @@ void RDEditAudio::gainTimerData() setText(QString().sprintf("%4.1f ", (double)edit_gain_control->value()/100.0)+tr("dB")); DrawMaps(); - repaint(false); + repaint(); } void RDEditAudio::removeButtonData() { - if(edit_remove_button->isOn()) { + if(edit_remove_button->isChecked()) { if(edit_cue_point!=RDEditAudio::Play) { - edit_cue_button[edit_cue_point]->setOn(false); + edit_cue_button[edit_cue_point]->setChecked(false); edit_cue_button[edit_cue_point]->setFlashingEnabled(false); edit_cue_point=RDEditAudio::Play; } for(int i=1;i<11;i++) { - edit_cue_button[i]->setToggleButton(false); + edit_cue_button[i]->setCheckable(false); } edit_remove_button->setFlashingEnabled(true); delete_marker=true; } else { for(int i=1;i<11;i++) { - edit_cue_button[i]->setToggleButton(true); + edit_cue_button[i]->setCheckable(true); } edit_remove_button->setFlashingEnabled(false); delete_marker=false; @@ -1561,7 +1583,7 @@ void RDEditAudio::paintEvent(QPaintEvent *e) // // Transport Control Area // - p->setPen(QColor(colorGroup().shadow())); + p->setPen(QColor(palette().shadow().color())); p->fillRect(11,30+EDITAUDIO_WAVEFORM_HEIGHT,EDITAUDIO_WAVEFORM_WIDTH,92, QColor(EDITAUDIO_HIGHLIGHT_COLOR)); p->drawRect(11,30+EDITAUDIO_WAVEFORM_HEIGHT,EDITAUDIO_WAVEFORM_WIDTH,92); @@ -1679,10 +1701,10 @@ void RDEditAudio::keyPressEvent(QKeyEvent *e) stopData(); } else { - if(e->state()==0) { + if(e->modifiers()==Qt::NoModifier) { playCursorData(); } - if((e->state()&Qt::ControlButton)!=0) { + if((e->modifiers()&Qt::ControlModifier)!=0) { playStartData(); } } @@ -2207,7 +2229,7 @@ void RDEditAudio::UpdateCounters() setAccentColor(EDITAUDIO_WAVEFORM_COLOR); edit_region_edit_label->setText(tr("")); edit_region_edit_label-> - setPalette(QPalette(backgroundColor(), + setPalette(QPalette(palette().color(QPalette::Background), QColor(EDITAUDIO_HIGHLIGHT_COLOR))); break; @@ -2349,17 +2371,17 @@ void RDEditAudio::DrawMaps() if(edit_channels==1) { pix=new QPixmap(EDITAUDIO_WAVEFORM_WIDTH,EDITAUDIO_WAVEFORM_HEIGHT); DrawWave(EDITAUDIO_WAVEFORM_WIDTH,EDITAUDIO_WAVEFORM_HEIGHT,0,"",pix); - edit_left_image=pix->convertToImage(); + edit_left_image=pix->toImage(); delete pix; } if(edit_channels==2) { pix=new QPixmap(EDITAUDIO_WAVEFORM_WIDTH,EDITAUDIO_WAVEFORM_HEIGHT/2); DrawWave(EDITAUDIO_WAVEFORM_WIDTH,EDITAUDIO_WAVEFORM_HEIGHT/2,0,tr("L"), pix); - edit_left_image=pix->convertToImage(); + edit_left_image=pix->toImage(); DrawWave(EDITAUDIO_WAVEFORM_WIDTH,EDITAUDIO_WAVEFORM_HEIGHT/2,1,tr("R"), pix); - edit_right_image=pix->convertToImage(); + edit_right_image=pix->toImage(); delete pix; } } @@ -2610,13 +2632,13 @@ void RDEditAudio::EraseCursor(int xpos,int ypos,int xsize,int ysize,int chan, p->drawImage(prev,apos-5,edit_left_image,prev,apos-5,11,25); p->drawImage(prev,ysize-apos-5,edit_left_image,prev,ysize-apos-5, 11,25); - p->fillRect(xsize,0,10,ysize,QBrush(backgroundColor())); + p->fillRect(xsize,0,10,ysize,QBrush(palette().color(QPalette::Background))); } if(arrow==RDEditAudio::Right) { p->drawImage(prev-11,apos-5,edit_left_image,prev-11,apos-5,11,25); p->drawImage(prev-11,ysize-apos-5,edit_left_image,prev-11,ysize-apos-5, 11,25); - p->fillRect(-10,0,10,ysize,QBrush(backgroundColor())); + p->fillRect(-10,0,10,ysize,QBrush(palette().color(QPalette::Background))); } } if(chan==1) { @@ -2625,13 +2647,13 @@ void RDEditAudio::EraseCursor(int xpos,int ypos,int xsize,int ysize,int chan, p->drawImage(prev,apos-5,edit_right_image,prev,apos-5,11,25); p->drawImage(prev,ysize-apos-5,edit_right_image,prev, ysize-apos-5,11,25); - p->fillRect(xsize,0,10,ysize,QBrush(backgroundColor())); + p->fillRect(xsize,0,10,ysize,QBrush(palette().color(QPalette::Background))); } if(arrow==RDEditAudio::Right) { p->drawImage(prev-11,apos-5,edit_right_image,prev-11,apos-5,11,25); p->drawImage(prev-11,ysize-apos-5,edit_right_image,prev-11, ysize-apos-5,11,25); - p->fillRect(-10,0,10,ysize,QBrush(backgroundColor())); + p->fillRect(-10,0,10,ysize,QBrush(palette().color(QPalette::Background))); } } } diff --git a/lib/rdedit_audio.h b/lib/rdedit_audio.h index df311776..5bd500f4 100644 --- a/lib/rdedit_audio.h +++ b/lib/rdedit_audio.h @@ -58,7 +58,7 @@ #define EDITAUDIO_PLAY_COLOR Qt::white #define EDITAUDIO_REMOVE_FLASH_COLOR Qt::blue #define EDITAUDIO_WAVEFORM_COLOR Qt::black -#define EDITAUDIO_HIGHLIGHT_COLOR colorGroup().mid() +#define EDITAUDIO_HIGHLIGHT_COLOR palette().mid().color() class RDEditAudio : public RDDialog { diff --git a/lib/rdedit_panel_name.cpp b/lib/rdedit_panel_name.cpp index db597db6..d5ff0098 100644 --- a/lib/rdedit_panel_name.cpp +++ b/lib/rdedit_panel_name.cpp @@ -39,21 +39,20 @@ RDEditPanelName::RDEditPanelName(QString *panelname,QWidget *parent) // // Panel Name // - panel_name_edit=new QLineEdit(this,"panel_name_edit"); + panel_name_edit=new QLineEdit(this); panel_name_edit->setGeometry(95,11,sizeHint().width()-105,19); panel_name_edit->setMaxLength(64); panel_name_edit->setText(*panel_name); panel_name_edit->selectAll(); - QLabel *panel_name_label=new QLabel(panel_name_edit,tr("Panel &Name:"),this, - "panel_name_label"); + QLabel *panel_name_label=new QLabel(tr("Panel &Name:"),this); panel_name_label->setGeometry(10,13,80,19); panel_name_label->setFont(labelFont()); - panel_name_label->setAlignment(Qt::AlignRight|Qt::TextShowMnemonic); + panel_name_label->setAlignment(Qt::AlignRight); // // Ok Button // - QPushButton *ok_button=new QPushButton(this,"ok_button"); + QPushButton *ok_button=new QPushButton(this); ok_button->setGeometry(sizeHint().width()-180,45,80,50); ok_button->setDefault(true); ok_button->setFont(buttonFont()); @@ -63,7 +62,7 @@ RDEditPanelName::RDEditPanelName(QString *panelname,QWidget *parent) // // Cancel Button // - QPushButton *cancel_button=new QPushButton(this,"cancel_button"); + QPushButton *cancel_button=new QPushButton(this); cancel_button->setGeometry(sizeHint().width()-90,45,80,50); cancel_button->setFont(buttonFont()); cancel_button->setText(tr("&Cancel")); diff --git a/lib/rdescape_string.cpp b/lib/rdescape_string.cpp index 32aa9afd..9b7326de 100644 --- a/lib/rdescape_string.cpp +++ b/lib/rdescape_string.cpp @@ -80,7 +80,7 @@ QString RDEscapeString(QString const &str) QString res; for(int i=0;i -#include +#include #include "rdconf.h" #include "rdcart.h" @@ -323,7 +322,7 @@ bool RDEventLine::load() RDSqlQuery *q=new RDSqlQuery(sql); if(!q->first()) { fprintf(stderr,"RDEventLine::load() EVENT NOT FOUND: %s\n", - (const char *)event_name); + event_name.toUtf8().constData()); delete q; return false; } diff --git a/lib/rdevent_player.cpp b/lib/rdevent_player.cpp index 9f4f402b..f1f37dcf 100644 --- a/lib/rdevent_player.cpp +++ b/lib/rdevent_player.cpp @@ -30,10 +30,11 @@ RDEventPlayer::RDEventPlayer(RDRipc *ripc,QObject *parent) player_events[i]=NULL; player_state[i]=false; } - player_mapper=new QSignalMapper(this,"player_mapper"); + player_mapper=new QSignalMapper(this); connect(player_mapper,SIGNAL(mapped(int)), this,SLOT(macroFinishedData(int))); - player_timer=new QTimer(this,"player_timer"); + player_timer=new QTimer(this); + player_timer->setSingleShot(true); connect(player_timer,SIGNAL(timeout()),this,SLOT(macroTimerData())); } @@ -77,7 +78,7 @@ bool RDEventPlayer::exec(unsigned cartnum) void RDEventPlayer::macroFinishedData(int id) { player_state[id]=false; - player_timer->start(1,true); + player_timer->start(1); } diff --git a/lib/rdexport_settings_dialog.cpp b/lib/rdexport_settings_dialog.cpp index 26337f46..6c4b5e4c 100644 --- a/lib/rdexport_settings_dialog.cpp +++ b/lib/rdexport_settings_dialog.cpp @@ -43,7 +43,7 @@ RDExportSettingsDialog::RDExportSettingsDialog(const QString &caption, // Name // lib_name_edit=new QLineEdit(this); - lib_name_label=new QLabel(lib_name_edit,tr("Name")+":",this); + lib_name_label=new QLabel(tr("Name")+":",this); lib_name_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); lib_name_label->setFont(labelFont()); @@ -53,7 +53,7 @@ RDExportSettingsDialog::RDExportSettingsDialog(const QString &caption, lib_format_box=new QComboBox(this); connect(lib_format_box,SIGNAL(activated(const QString &)), this,SLOT(formatData(const QString &))); - lib_format_label=new QLabel(lib_format_box,tr("Format")+":",this); + lib_format_label=new QLabel(tr("Format")+":",this); lib_format_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); lib_format_label->setFont(labelFont()); @@ -61,8 +61,7 @@ RDExportSettingsDialog::RDExportSettingsDialog(const QString &caption, // Channels // lib_channels_box=new QComboBox(this); - lib_channels_label= - new QLabel(lib_channels_box,tr("Channels")+":",this); + lib_channels_label=new QLabel(tr("Channels")+":",this); lib_channels_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); lib_channels_label->setFont(labelFont()); @@ -72,8 +71,7 @@ RDExportSettingsDialog::RDExportSettingsDialog(const QString &caption, lib_samprate_box=new QComboBox(this); connect(lib_samprate_box,SIGNAL(activated(const QString &)), this,SLOT(samprateData(const QString &))); - lib_samprate_label= - new QLabel(lib_samprate_box,tr("Sample Rate")+":",this); + lib_samprate_label=new QLabel(tr("Sample Rate")+":",this); lib_samprate_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); lib_samprate_label->setFont(labelFont()); @@ -83,7 +81,7 @@ RDExportSettingsDialog::RDExportSettingsDialog(const QString &caption, lib_bitrate_box=new QComboBox(this); connect(lib_bitrate_box,SIGNAL(activated(const QString &)), this,SLOT(bitrateData(const QString &))); - lib_bitrate_label=new QLabel(lib_bitrate_box,tr("Bitrate")+":",this); + lib_bitrate_label=new QLabel(tr("Bitrate")+":",this); lib_bitrate_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); lib_bitrate_label->setFont(labelFont()); @@ -92,7 +90,7 @@ RDExportSettingsDialog::RDExportSettingsDialog(const QString &caption, // lib_quality_spin=new QSpinBox(this); lib_quality_spin->setRange(0,10); - lib_quality_label=new QLabel(lib_quality_spin,tr("Quality")+":",this); + lib_quality_label=new QLabel(tr("Quality")+":",this); lib_quality_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); lib_quality_label->setFont(labelFont()); @@ -101,8 +99,7 @@ RDExportSettingsDialog::RDExportSettingsDialog(const QString &caption, // lib_normalization_level_spin=new QSpinBox(this); lib_normalization_level_spin->setRange(-100,0); - lib_normalization_level_label= - new QLabel(lib_normalization_level_spin,tr("Normalization Level")+":",this); + lib_normalization_level_label=new QLabel(tr("Normalization Level")+":",this); lib_normalization_level_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); lib_normalization_level_label->setFont(labelFont()); lib_normalization_level_label->hide(); @@ -120,8 +117,7 @@ RDExportSettingsDialog::RDExportSettingsDialog(const QString &caption, // lib_autotrim_level_spin=new QSpinBox(this); lib_autotrim_level_spin->setRange(-100,0); - lib_autotrim_level_label= - new QLabel(lib_autotrim_level_spin,tr("Autotrim Level")+":",this); + lib_autotrim_level_label=new QLabel(tr("Autotrim Level")+":",this); lib_autotrim_level_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); lib_autotrim_level_label->setFont(labelFont()); lib_autotrim_level_label->hide(); @@ -208,48 +204,48 @@ int RDExportSettingsDialog::exec(RDSettings *s,unsigned id) lib_name_edit->show(); lib_name_edit->setText(lib_settings->name()); } - lib_format_box->insertItem(tr("PCM16")); + lib_format_box->insertItem(lib_format_box->count(),tr("PCM16")); if(lib_settings->format()==RDSettings::Pcm16) { - lib_format_box->setCurrentItem(lib_format_box->count()-1); + lib_format_box->setCurrentIndex(lib_format_box->count()-1); } - lib_format_box->insertItem(tr("PCM24")); + lib_format_box->insertItem(lib_format_box->count(),tr("PCM24")); if(lib_settings->format()==RDSettings::Pcm24) { - lib_format_box->setCurrentItem(lib_format_box->count()-1); + lib_format_box->setCurrentIndex(lib_format_box->count()-1); } if(rda->station()->haveCapability(RDStation::HaveFlac)) { - lib_format_box->insertItem(tr("FLAC")); + lib_format_box->insertItem(lib_format_box->count(),tr("FLAC")); if(lib_settings->format()==RDSettings::Flac) { - lib_format_box->setCurrentItem(lib_format_box->count()-1); + lib_format_box->setCurrentIndex(lib_format_box->count()-1); } } - lib_format_box->insertItem(tr("MPEG Layer 2")); + lib_format_box->insertItem(lib_format_box->count(),tr("MPEG Layer 2")); if(lib_settings->format()==RDSettings::MpegL2) { - lib_format_box->setCurrentItem(lib_format_box->count()-1); + lib_format_box->setCurrentIndex(lib_format_box->count()-1); } if(rda->station()->haveCapability(RDStation::HaveLame)) { - lib_format_box->insertItem(tr("MPEG Layer 3")); + lib_format_box->insertItem(lib_format_box->count(),tr("MPEG Layer 3")); if(lib_settings->format()==RDSettings::MpegL3) { - lib_format_box->setCurrentItem(lib_format_box->count()-1); + lib_format_box->setCurrentIndex(lib_format_box->count()-1); } } if(rda->station()->haveCapability(RDStation::HaveOggenc)) { - lib_format_box->insertItem(tr("OggVorbis")); + lib_format_box->insertItem(lib_format_box->count(),tr("OggVorbis")); if(lib_settings->format()==RDSettings::OggVorbis) { - lib_format_box->setCurrentItem(lib_format_box->count()-1); + lib_format_box->setCurrentIndex(lib_format_box->count()-1); } } - lib_channels_box->insertItem("1"); - lib_channels_box->insertItem("2"); - lib_channels_box->setCurrentItem(lib_settings->channels()-1); - lib_samprate_box->insertItem("16000"); - lib_samprate_box->insertItem("22050"); - lib_samprate_box->insertItem("24000"); - lib_samprate_box->insertItem("32000"); - lib_samprate_box->insertItem("44100"); - lib_samprate_box->insertItem("48000"); + lib_channels_box->insertItem(lib_channels_box->count(),"1"); + lib_channels_box->insertItem(lib_channels_box->count(),"2"); + lib_channels_box->setCurrentIndex(lib_settings->channels()-1); + lib_samprate_box->insertItem(lib_samprate_box->count(),"16000"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"22050"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"24000"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"32000"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"44100"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"48000"); for(int i=0;icount();i++) { - if(lib_samprate_box->text(i).toUInt()==lib_settings->sampleRate()) { - lib_samprate_box->setCurrentItem(i); + if(lib_samprate_box->itemData(i).toString().toUInt()==lib_settings->sampleRate()) { + lib_samprate_box->setCurrentIndex(i); } } ShowBitRates(lib_settings->format(),lib_settings->sampleRate(), @@ -331,7 +327,7 @@ void RDExportSettingsDialog::okData() lib_settings->setName(lib_name_edit->text()); } lib_settings->setFormat(GetFormat(lib_format_box->currentText())); - lib_settings->setChannels(lib_channels_box->currentItem()+1); + lib_settings->setChannels(lib_channels_box->currentIndex()+1); lib_settings->setSampleRate(lib_samprate_box->currentText().toInt()); switch(lib_settings->format()) { case RDSettings::Pcm16: @@ -345,7 +341,7 @@ void RDExportSettingsDialog::okData() case RDSettings::MpegL2Wav: case RDSettings::MpegL3: if(!lib_bitrate_box->currentText().isEmpty()){ - sscanf(lib_bitrate_box->currentText(),"%d",&rate); + rate=lib_bitrate_box->currentText().toInt(); } if(rate!=0) { lib_settings->setBitRate(1000*rate); @@ -439,11 +435,11 @@ void RDExportSettingsDialog::ShowBitRates(RDSettings::Format fmt, switch(fmt) { case RDSettings::Pcm16: // PCM16 case RDSettings::Pcm24: // PCM24 - lib_channels_box->insertItem("1"); - lib_channels_box->insertItem("2"); - lib_samprate_box->insertItem("32000"); - lib_samprate_box->insertItem("44100"); - lib_samprate_box->insertItem("48000"); + lib_channels_box->insertItem(lib_channels_box->count(),"1"); + lib_channels_box->insertItem(lib_channels_box->count(),"2"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"32000"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"44100"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"48000"); lib_bitrate_box->setDisabled(true); lib_bitrate_label->setDisabled(true); lib_quality_spin->setDisabled(true); @@ -451,33 +447,33 @@ void RDExportSettingsDialog::ShowBitRates(RDSettings::Format fmt, break; case RDSettings::MpegL1: // MPEG-1 Layer 1 - lib_channels_box->insertItem("1"); - lib_channels_box->insertItem("2"); - lib_samprate_box->insertItem("16000"); - lib_samprate_box->insertItem("22050"); - lib_samprate_box->insertItem("32000"); - lib_samprate_box->insertItem("44100"); - lib_samprate_box->insertItem("48000"); + lib_channels_box->insertItem(lib_channels_box->count(),"1"); + lib_channels_box->insertItem(lib_channels_box->count(),"2"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"16000"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"22050"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"32000"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"44100"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"48000"); lib_bitrate_box->setEnabled(true); lib_bitrate_label->setEnabled(true); - lib_bitrate_box->insertItem(tr("32 kbps")); - lib_bitrate_box->insertItem(tr("64 kbps")); - lib_bitrate_box->insertItem(tr("96 kbps")); - lib_bitrate_box->insertItem(tr("128 kbps")); - lib_bitrate_box->insertItem(tr("160 kbps")); - lib_bitrate_box->insertItem(tr("192 kbps")); - lib_bitrate_box->insertItem(tr("224 kbps")); - lib_bitrate_box->insertItem(tr("256 kbps")); - lib_bitrate_box->insertItem(tr("288 kbps")); - lib_bitrate_box->insertItem(tr("320 kbps")); - lib_bitrate_box->insertItem(tr("352 kbps")); - lib_bitrate_box->insertItem(tr("384 kbps")); - lib_bitrate_box->insertItem(tr("416 kbps")); - lib_bitrate_box->insertItem(tr("448 kbps")); - lib_bitrate_box->insertItem(tr("VBR")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("32 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("64 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("96 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("128 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("160 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("192 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("224 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("256 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("288 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("320 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("352 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("384 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("416 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("448 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("VBR")); switch(bitrate) { case 0: - lib_bitrate_box->setCurrentItem(14); + lib_bitrate_box->setCurrentIndex(14); lib_quality_spin->setEnabled(true); lib_quality_label->setEnabled(true); lib_quality_spin->setValue(qual); @@ -485,85 +481,85 @@ void RDExportSettingsDialog::ShowBitRates(RDSettings::Format fmt, break; case 32000: - lib_bitrate_box->setCurrentItem(0); + lib_bitrate_box->setCurrentIndex(0); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 64000: - lib_bitrate_box->setCurrentItem(1); + lib_bitrate_box->setCurrentIndex(1); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 96000: - lib_bitrate_box->setCurrentItem(2); + lib_bitrate_box->setCurrentIndex(2); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 128000: - lib_bitrate_box->setCurrentItem(3); + lib_bitrate_box->setCurrentIndex(3); lib_quality_label->setDisabled(true); lib_quality_spin->setDisabled(true); break; case 160000: - lib_bitrate_box->setCurrentItem(4); + lib_bitrate_box->setCurrentIndex(4); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 192000: - lib_bitrate_box->setCurrentItem(5); + lib_bitrate_box->setCurrentIndex(5); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 224000: - lib_bitrate_box->setCurrentItem(6); + lib_bitrate_box->setCurrentIndex(6); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 256000: - lib_bitrate_box->setCurrentItem(7); + lib_bitrate_box->setCurrentIndex(7); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 288000: - lib_bitrate_box->setCurrentItem(8); + lib_bitrate_box->setCurrentIndex(8); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 320000: - lib_bitrate_box->setCurrentItem(9); + lib_bitrate_box->setCurrentIndex(9); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 352000: - lib_bitrate_box->setCurrentItem(10); + lib_bitrate_box->setCurrentIndex(10); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 384000: - lib_bitrate_box->setCurrentItem(11); + lib_bitrate_box->setCurrentIndex(11); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 416000: - lib_bitrate_box->setCurrentItem(12); + lib_bitrate_box->setCurrentIndex(12); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 448000: - lib_bitrate_box->setCurrentItem(13); + lib_bitrate_box->setCurrentIndex(13); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; @@ -572,116 +568,116 @@ void RDExportSettingsDialog::ShowBitRates(RDSettings::Format fmt, case RDSettings::MpegL2: // MPEG-1 Layer 2 case RDSettings::MpegL2Wav: - lib_channels_box->insertItem("1"); - lib_channels_box->insertItem("2"); - lib_samprate_box->insertItem("16000"); - lib_samprate_box->insertItem("22050"); - lib_samprate_box->insertItem("32000"); - lib_samprate_box->insertItem("44100"); - lib_samprate_box->insertItem("48000"); + lib_channels_box->insertItem(lib_channels_box->count(),"1"); + lib_channels_box->insertItem(lib_channels_box->count(),"2"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"16000"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"22050"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"32000"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"44100"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"48000"); lib_bitrate_box->setEnabled(true); lib_bitrate_label->setEnabled(true); - lib_bitrate_box->insertItem(tr("32 kbps")); - lib_bitrate_box->insertItem(tr("48 kbps")); - lib_bitrate_box->insertItem(tr("56 kbps")); - lib_bitrate_box->insertItem(tr("64 kbps")); - lib_bitrate_box->insertItem(tr("80 kbps")); - lib_bitrate_box->insertItem(tr("96 kbps")); - lib_bitrate_box->insertItem(tr("112 kbps")); - lib_bitrate_box->insertItem(tr("128 kbps")); - lib_bitrate_box->insertItem(tr("160 kbps")); - lib_bitrate_box->insertItem(tr("192 kbps")); - lib_bitrate_box->insertItem(tr("224 kbps")); - lib_bitrate_box->insertItem(tr("256 kbps")); - lib_bitrate_box->insertItem(tr("320 kbps")); - lib_bitrate_box->insertItem(tr("384 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("32 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("48 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("56 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("64 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("80 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("96 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("112 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("128 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("160 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("192 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("224 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("256 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("320 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("384 kbps")); switch(bitrate) { case 0: - lib_bitrate_box->setCurrentItem(11); + lib_bitrate_box->setCurrentIndex(11); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 32000: - lib_bitrate_box->setCurrentItem(0); + lib_bitrate_box->setCurrentIndex(0); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 48000: - lib_bitrate_box->setCurrentItem(1); + lib_bitrate_box->setCurrentIndex(1); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 56000: - lib_bitrate_box->setCurrentItem(2); + lib_bitrate_box->setCurrentIndex(2); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 64000: - lib_bitrate_box->setCurrentItem(3); + lib_bitrate_box->setCurrentIndex(3); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 80000: - lib_bitrate_box->setCurrentItem(4); + lib_bitrate_box->setCurrentIndex(4); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 96000: - lib_bitrate_box->setCurrentItem(5); + lib_bitrate_box->setCurrentIndex(5); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 112000: - lib_bitrate_box->setCurrentItem(6); + lib_bitrate_box->setCurrentIndex(6); lib_quality_label->setDisabled(true); lib_quality_spin->setDisabled(true); break; case 128000: - lib_bitrate_box->setCurrentItem(7); + lib_bitrate_box->setCurrentIndex(7); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 160000: - lib_bitrate_box->setCurrentItem(8); + lib_bitrate_box->setCurrentIndex(8); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 192000: - lib_bitrate_box->setCurrentItem(9); + lib_bitrate_box->setCurrentIndex(9); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 224000: - lib_bitrate_box->setCurrentItem(10); + lib_bitrate_box->setCurrentIndex(10); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 256000: - lib_bitrate_box->setCurrentItem(11); + lib_bitrate_box->setCurrentIndex(11); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 320000: - lib_bitrate_box->setCurrentItem(12); + lib_bitrate_box->setCurrentIndex(12); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 384000: - lib_bitrate_box->setCurrentItem(13); + lib_bitrate_box->setCurrentIndex(13); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; @@ -689,11 +685,11 @@ void RDExportSettingsDialog::ShowBitRates(RDSettings::Format fmt, break; case RDSettings::MpegL3: // MPEG-1 Layer 3 - lib_channels_box->insertItem("1"); - lib_channels_box->insertItem("2"); - lib_samprate_box->insertItem("32000"); - lib_samprate_box->insertItem("44100"); - lib_samprate_box->insertItem("48000"); + lib_channels_box->insertItem(lib_channels_box->count(),"1"); + lib_channels_box->insertItem(lib_channels_box->count(),"2"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"32000"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"44100"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"48000"); lib_bitrate_box->setEnabled(true); lib_bitrate_label->setEnabled(true); switch(samprate) { @@ -701,24 +697,24 @@ void RDExportSettingsDialog::ShowBitRates(RDSettings::Format fmt, case 44100: case 48000: default: - lib_bitrate_box->insertItem(tr("32 kbps")); - lib_bitrate_box->insertItem(tr("40 kbps")); - lib_bitrate_box->insertItem(tr("48 kbps")); - lib_bitrate_box->insertItem(tr("56 kbps")); - lib_bitrate_box->insertItem(tr("64 kbps")); - lib_bitrate_box->insertItem(tr("80 kbps")); - lib_bitrate_box->insertItem(tr("96 kbps")); - lib_bitrate_box->insertItem(tr("112 kbps")); - lib_bitrate_box->insertItem(tr("128 kbps")); - lib_bitrate_box->insertItem(tr("160 kbps")); - lib_bitrate_box->insertItem(tr("192 kbps")); - lib_bitrate_box->insertItem(tr("224 kbps")); - lib_bitrate_box->insertItem(tr("256 kbps")); - lib_bitrate_box->insertItem(tr("320 kbps")); - lib_bitrate_box->insertItem(tr("VBR")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("32 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("40 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("48 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("56 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("64 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("80 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("96 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("112 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("128 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("160 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("192 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("224 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("256 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("320 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("VBR")); switch(bitrate) { case 0: - lib_bitrate_box->setCurrentItem(14); + lib_bitrate_box->setCurrentIndex(14); lib_quality_spin->setEnabled(true); lib_quality_label->setEnabled(true); lib_quality_spin->setRange(0,9); @@ -726,85 +722,85 @@ void RDExportSettingsDialog::ShowBitRates(RDSettings::Format fmt, break; case 32000: - lib_bitrate_box->setCurrentItem(0); + lib_bitrate_box->setCurrentIndex(0); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 40000: - lib_bitrate_box->setCurrentItem(1); + lib_bitrate_box->setCurrentIndex(1); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 48000: - lib_bitrate_box->setCurrentItem(2); + lib_bitrate_box->setCurrentIndex(2); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 56000: - lib_bitrate_box->setCurrentItem(3); + lib_bitrate_box->setCurrentIndex(3); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 64000: - lib_bitrate_box->setCurrentItem(4); + lib_bitrate_box->setCurrentIndex(4); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 80000: - lib_bitrate_box->setCurrentItem(5); + lib_bitrate_box->setCurrentIndex(5); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 96000: - lib_bitrate_box->setCurrentItem(6); + lib_bitrate_box->setCurrentIndex(6); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 112000: - lib_bitrate_box->setCurrentItem(7); + lib_bitrate_box->setCurrentIndex(7); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 128000: - lib_bitrate_box->setCurrentItem(8); + lib_bitrate_box->setCurrentIndex(8); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 160000: - lib_bitrate_box->setCurrentItem(9); + lib_bitrate_box->setCurrentIndex(9); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 192000: - lib_bitrate_box->setCurrentItem(10); + lib_bitrate_box->setCurrentIndex(10); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 224000: - lib_bitrate_box->setCurrentItem(11); + lib_bitrate_box->setCurrentIndex(11); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 256000: - lib_bitrate_box->setCurrentItem(12); + lib_bitrate_box->setCurrentIndex(12); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 320000: - lib_bitrate_box->setCurrentItem(13); + lib_bitrate_box->setCurrentIndex(13); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; @@ -814,24 +810,24 @@ void RDExportSettingsDialog::ShowBitRates(RDSettings::Format fmt, case 16000: case 22050: case 24000: - lib_bitrate_box->insertItem(tr("8 kbps")); - lib_bitrate_box->insertItem(tr("16 kbps")); - lib_bitrate_box->insertItem(tr("24 kbps")); - lib_bitrate_box->insertItem(tr("32 kbps")); - lib_bitrate_box->insertItem(tr("40 kbps")); - lib_bitrate_box->insertItem(tr("48 kbps")); - lib_bitrate_box->insertItem(tr("56 kbps")); - lib_bitrate_box->insertItem(tr("64 kbps")); - lib_bitrate_box->insertItem(tr("80 kbps")); - lib_bitrate_box->insertItem(tr("96 kbps")); - lib_bitrate_box->insertItem(tr("112 kbps")); - lib_bitrate_box->insertItem(tr("128 kbps")); - lib_bitrate_box->insertItem(tr("144 kbps")); - lib_bitrate_box->insertItem(tr("160 kbps")); - lib_bitrate_box->insertItem(tr("VBR")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("8 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("16 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("24 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("32 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("40 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("48 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("56 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("64 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("80 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("96 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("112 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("128 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("144 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("160 kbps")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("VBR")); switch(bitrate) { case 0: - lib_bitrate_box->setCurrentItem(14); + lib_bitrate_box->setCurrentIndex(14); lib_quality_spin->setEnabled(true); lib_quality_label->setEnabled(true); lib_quality_spin->setRange(0,9); @@ -839,85 +835,85 @@ void RDExportSettingsDialog::ShowBitRates(RDSettings::Format fmt, break; case 8000: - lib_bitrate_box->setCurrentItem(0); + lib_bitrate_box->setCurrentIndex(0); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 16000: - lib_bitrate_box->setCurrentItem(1); + lib_bitrate_box->setCurrentIndex(1); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 24000: - lib_bitrate_box->setCurrentItem(2); + lib_bitrate_box->setCurrentIndex(2); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 32000: - lib_bitrate_box->setCurrentItem(3); + lib_bitrate_box->setCurrentIndex(3); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 40000: - lib_bitrate_box->setCurrentItem(4); + lib_bitrate_box->setCurrentIndex(4); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 48000: - lib_bitrate_box->setCurrentItem(5); + lib_bitrate_box->setCurrentIndex(5); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 56000: - lib_bitrate_box->setCurrentItem(6); + lib_bitrate_box->setCurrentIndex(6); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 64000: - lib_bitrate_box->setCurrentItem(7); + lib_bitrate_box->setCurrentIndex(7); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 80000: - lib_bitrate_box->setCurrentItem(8); + lib_bitrate_box->setCurrentIndex(8); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 96000: - lib_bitrate_box->setCurrentItem(9); + lib_bitrate_box->setCurrentIndex(9); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 112000: - lib_bitrate_box->setCurrentItem(10); + lib_bitrate_box->setCurrentIndex(10); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 128000: - lib_bitrate_box->setCurrentItem(11); + lib_bitrate_box->setCurrentIndex(11); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 144000: - lib_bitrate_box->setCurrentItem(12); + lib_bitrate_box->setCurrentIndex(12); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; case 160000: - lib_bitrate_box->setCurrentItem(13); + lib_bitrate_box->setCurrentIndex(13); lib_quality_spin->setDisabled(true); lib_quality_label->setDisabled(true); break; @@ -927,11 +923,11 @@ void RDExportSettingsDialog::ShowBitRates(RDSettings::Format fmt, break; case RDSettings::Flac: - lib_channels_box->insertItem("1"); - lib_channels_box->insertItem("2"); - lib_samprate_box->insertItem("32000"); - lib_samprate_box->insertItem("44100"); - lib_samprate_box->insertItem("48000"); + lib_channels_box->insertItem(lib_channels_box->count(),"1"); + lib_channels_box->insertItem(lib_channels_box->count(),"2"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"32000"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"44100"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"48000"); lib_bitrate_box->setDisabled(true); lib_bitrate_label->setDisabled(true); lib_quality_spin->setDisabled(true); @@ -939,11 +935,11 @@ void RDExportSettingsDialog::ShowBitRates(RDSettings::Format fmt, break; case RDSettings::OggVorbis: - lib_channels_box->insertItem("1"); - lib_channels_box->insertItem("2"); - lib_samprate_box->insertItem("32000"); - lib_samprate_box->insertItem("44100"); - lib_samprate_box->insertItem("48000"); + lib_channels_box->insertItem(lib_channels_box->count(),"1"); + lib_channels_box->insertItem(lib_channels_box->count(),"2"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"32000"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"44100"); + lib_samprate_box->insertItem(lib_samprate_box->count(),"48000"); lib_bitrate_box->setDisabled(true); lib_bitrate_label->setDisabled(true); lib_quality_spin->setEnabled(true); @@ -960,8 +956,8 @@ void RDExportSettingsDialog::ShowBitRates(RDSettings::Format fmt, void RDExportSettingsDialog::SetCurrentItem(QComboBox *box,int value) { for(int i=0;icount();i++) { - if(box->text(i).toInt()==value) { - box->setCurrentItem(i); + if(box->itemData(i).toString().toInt()==value) { + box->setCurrentIndex(i); } } } diff --git a/lib/rdfeed.cpp b/lib/rdfeed.cpp index 12fece28..6a51ef00 100644 --- a/lib/rdfeed.cpp +++ b/lib/rdfeed.cpp @@ -808,7 +808,8 @@ bool RDFeed::postPodcast(unsigned cast_id) const // curl_formadd(&first,&last,CURLFORM_PTRNAME,"COMMAND", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",RDXPORT_COMMAND_POST_PODCAST), + QString().sprintf("%u",RDXPORT_COMMAND_POST_PODCAST).toUtf8(). + constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"LOGIN_NAME", CURLFORM_COPYCONTENTS,rda->user()->name().toUtf8().constData(), @@ -818,7 +819,7 @@ bool RDFeed::postPodcast(unsigned cast_id) const rda->user()->password().toUtf8().constData(),CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"ID", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",cast_id), + QString().sprintf("%u",cast_id).toUtf8().constData(), CURLFORM_END); // @@ -831,7 +832,7 @@ bool RDFeed::postPodcast(unsigned cast_id) const curl_easy_setopt(curl,CURLOPT_WRITEDATA,stdout); curl_easy_setopt(curl,CURLOPT_HTTPPOST,first); curl_easy_setopt(curl,CURLOPT_USERAGENT, - (const char *)rda->config()->userAgent()); + rda->config()->userAgent().toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_NOPROGRESS,1); curl_easy_setopt(curl,CURLOPT_URL, @@ -912,7 +913,8 @@ bool RDFeed::postXml() // curl_formadd(&first,&last,CURLFORM_PTRNAME,"COMMAND", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",RDXPORT_COMMAND_POST_RSS), + QString().sprintf("%u",RDXPORT_COMMAND_POST_RSS).toUtf8(). + constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"LOGIN_NAME", CURLFORM_COPYCONTENTS,rda->user()->name().toUtf8().constData(), @@ -922,7 +924,7 @@ bool RDFeed::postXml() rda->user()->password().toUtf8().constData(),CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"ID", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",feed_id), + QString().sprintf("%u",feed_id).toUtf8().constData(), CURLFORM_END); // @@ -935,7 +937,7 @@ bool RDFeed::postXml() curl_easy_setopt(curl,CURLOPT_WRITEDATA,stdout); curl_easy_setopt(curl,CURLOPT_HTTPPOST,first); curl_easy_setopt(curl,CURLOPT_USERAGENT, - (const char *)rda->config()->userAgent()); + rda->config()->userAgent().toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_NOPROGRESS,1); curl_easy_setopt(curl,CURLOPT_URL, @@ -994,7 +996,8 @@ bool RDFeed::removeRss() // curl_formadd(&first,&last,CURLFORM_PTRNAME,"COMMAND", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",RDXPORT_COMMAND_REMOVE_RSS), + QString().sprintf("%u",RDXPORT_COMMAND_REMOVE_RSS).toUtf8(). + constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"LOGIN_NAME", CURLFORM_COPYCONTENTS,rda->user()->name().toUtf8().constData(), @@ -1004,7 +1007,7 @@ bool RDFeed::removeRss() rda->user()->password().toUtf8().constData(),CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"ID", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",feed_id), + QString().sprintf("%u",feed_id).toUtf8().constData(), CURLFORM_END); // @@ -1017,7 +1020,7 @@ bool RDFeed::removeRss() curl_easy_setopt(curl,CURLOPT_WRITEDATA,stdout); curl_easy_setopt(curl,CURLOPT_HTTPPOST,first); curl_easy_setopt(curl,CURLOPT_USERAGENT, - (const char *)rda->config()->userAgent()); + rda->config()->userAgent().toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_NOPROGRESS,1); curl_easy_setopt(curl,CURLOPT_URL, @@ -1065,7 +1068,8 @@ bool RDFeed::postImage(int img_id) const // curl_formadd(&first,&last,CURLFORM_PTRNAME,"COMMAND", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",RDXPORT_COMMAND_POST_IMAGE), + QString().sprintf("%u",RDXPORT_COMMAND_POST_IMAGE).toUtf8(). + constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"LOGIN_NAME", CURLFORM_COPYCONTENTS,rda->user()->name().toUtf8().constData(), @@ -1075,7 +1079,7 @@ bool RDFeed::postImage(int img_id) const rda->user()->password().toUtf8().constData(),CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"ID", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",img_id), + QString().sprintf("%u",img_id).toUtf8().constData(), CURLFORM_END); // @@ -1088,7 +1092,7 @@ bool RDFeed::postImage(int img_id) const curl_easy_setopt(curl,CURLOPT_WRITEDATA,stdout); curl_easy_setopt(curl,CURLOPT_HTTPPOST,first); curl_easy_setopt(curl,CURLOPT_USERAGENT, - (const char *)rda->config()->userAgent()); + rda->config()->userAgent().toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_NOPROGRESS,1); curl_easy_setopt(curl,CURLOPT_URL, @@ -1136,7 +1140,8 @@ bool RDFeed::removeImage(int img_id) const // curl_formadd(&first,&last,CURLFORM_PTRNAME,"COMMAND", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",RDXPORT_COMMAND_REMOVE_IMAGE), + QString().sprintf("%u",RDXPORT_COMMAND_REMOVE_IMAGE).toUtf8(). + constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"LOGIN_NAME", CURLFORM_COPYCONTENTS,rda->user()->name().toUtf8().constData(), @@ -1146,7 +1151,7 @@ bool RDFeed::removeImage(int img_id) const rda->user()->password().toUtf8().constData(),CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"ID", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",img_id), + QString().sprintf("%u",img_id).toUtf8().constData(), CURLFORM_END); // @@ -1159,7 +1164,7 @@ bool RDFeed::removeImage(int img_id) const curl_easy_setopt(curl,CURLOPT_WRITEDATA,stdout); curl_easy_setopt(curl,CURLOPT_HTTPPOST,first); curl_easy_setopt(curl,CURLOPT_USERAGENT, - (const char *)rda->config()->userAgent()); + rda->config()->userAgent().toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_NOPROGRESS,1); curl_easy_setopt(curl,CURLOPT_URL, @@ -1256,7 +1261,7 @@ unsigned RDFeed::postCut(const QString &cutname,Error *err) delete settings; delete conv; *err=RDFeed::ErrorUnsupportedType; - unlink(tmpfile); + unlink(tmpfile.toUtf8()); emit postProgressChanged(5); return 0; @@ -1271,7 +1276,7 @@ unsigned RDFeed::postCut(const QString &cutname,Error *err) delete settings; delete conv; *err=RDFeed::ErrorGeneral; - unlink(tmpfile); + unlink(tmpfile.toUtf8()); emit postProgressChanged(5); return 0; } @@ -1287,7 +1292,7 @@ unsigned RDFeed::postCut(const QString &cutname,Error *err) unsigned cast_id=CreateCast(&destfile,length,cut->length()); cast=new RDPodcast(feed_config,cast_id); SavePodcast(cast_id,tmpfile); - unlink(tmpfile); + unlink(tmpfile.toUtf8()); // // Upload to remote archive @@ -1362,7 +1367,7 @@ unsigned RDFeed::postFile(const QString &srcfile,Error *err) delete settings; delete conv; *err=RDFeed::ErrorUnsupportedType; - unlink(tmpfile); + unlink(tmpfile.toUtf8()); emit postProgressChanged(6); return 0; @@ -1378,7 +1383,7 @@ unsigned RDFeed::postFile(const QString &srcfile,Error *err) delete settings; delete conv; *err=RDFeed::ErrorGeneral; - unlink(tmpfile); + unlink(tmpfile.toUtf8()); emit postProgressChanged(6); return 0; } @@ -1394,8 +1399,8 @@ unsigned RDFeed::postFile(const QString &srcfile,Error *err) unsigned cast_id=CreateCast(&destfile,length,time_length); RDPodcast *cast=new RDPodcast(feed_config,cast_id); SavePodcast(cast_id,tmpfile); - unlink(QString(tmpfile)+".wav"); - unlink(tmpfile); + unlink((QString(tmpfile)+".wav").toUtf8()); + unlink(tmpfile.toUtf8()); emit postProgressChanged(3); // @@ -1481,7 +1486,7 @@ unsigned RDFeed::postLog(const QString &logname,const QTime &start_time, delete renderer; delete settings; delete log_model; - unlink(tmpfile); + unlink(tmpfile.toUtf8()); return 0; } delete renderer; @@ -1495,7 +1500,7 @@ unsigned RDFeed::postLog(const QString &logname,const QTime &start_time, CreateCast(&destfile,f.size(),log_model->length(0,log_model->lineCount())); RDPodcast *cast=new RDPodcast(feed_config,cast_id); SavePodcast(cast_id,tmpfile); - unlink(tmpfile); + unlink(tmpfile.toUtf8()); emit postProgressChanged(2+(end_line-start_line)); // @@ -1525,7 +1530,7 @@ unsigned RDFeed::postLog(const QString &logname,const QTime &start_time, delete cast; delete settings; delete log_model; - unlink(tmpfile); + unlink(tmpfile.toUtf8()); return cast_id; } @@ -1841,7 +1846,8 @@ bool RDFeed::SavePodcast(unsigned cast_id,const QString &src_filename) const // curl_formadd(&first,&last,CURLFORM_PTRNAME,"COMMAND", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",RDXPORT_COMMAND_SAVE_PODCAST), + QString().sprintf("%u",RDXPORT_COMMAND_SAVE_PODCAST).toUtf8(). + constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"LOGIN_NAME", CURLFORM_COPYCONTENTS,rda->user()->name().toUtf8().constData(), @@ -1851,7 +1857,7 @@ bool RDFeed::SavePodcast(unsigned cast_id,const QString &src_filename) const rda->user()->password().toUtf8().constData(),CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"ID", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",cast_id), + QString().sprintf("%u",cast_id).toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"FILENAME", CURLFORM_FILE,src_filename.toUtf8().constData(), @@ -1867,7 +1873,7 @@ bool RDFeed::SavePodcast(unsigned cast_id,const QString &src_filename) const curl_easy_setopt(curl,CURLOPT_WRITEDATA,stdout); curl_easy_setopt(curl,CURLOPT_HTTPPOST,first); curl_easy_setopt(curl,CURLOPT_USERAGENT, - (const char *)rda->config()->userAgent()); + rda->config()->userAgent().toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_NOPROGRESS,1); curl_easy_setopt(curl,CURLOPT_URL, @@ -2090,7 +2096,8 @@ QString RDFeed::GetTempFilename() const { char tempname[PATH_MAX]; - sprintf(tempname,"%s/podcastXXXXXX",(const char *)RDTempDirectory::basePath()); + sprintf(tempname,"%s/podcastXXXXXX", + RDTempDirectory::basePath().toUtf8().constData()); if(mkstemp(tempname)<0) { return QString(); } diff --git a/lib/rdflacdecode.cpp b/lib/rdflacdecode.cpp index ff95e2a6..57833a9e 100644 --- a/lib/rdflacdecode.cpp +++ b/lib/rdflacdecode.cpp @@ -60,7 +60,7 @@ void RDFlacDecode::decode(RDWaveFile *wave,float *peak) (double)flac_end_point*(double)wave->getSamplesPerSec()/1000.0; } flac_total_frames=0; - init(wave->getName().ascii()); + init(wave->getName().toAscii()); //set_filename(wave->getName().ascii()); //init(); diff --git a/lib/rdformpost.cpp b/lib/rdformpost.cpp index a3829f75..77cd34e2 100644 --- a/lib/rdformpost.cpp +++ b/lib/rdformpost.cpp @@ -58,7 +58,7 @@ RDFormPost::RDFormPost(RDFormPost::Encoding encoding,unsigned maxsize, post_error=RDFormPost::ErrorNotPost; return; } - if(QString(getenv("REQUEST_METHOD")).lower()!="post") { + if(QString(getenv("REQUEST_METHOD")).toLower()!="post") { post_error=RDFormPost::ErrorNotPost; return; } @@ -128,7 +128,7 @@ RDFormPost::~RDFormPost() for(QMap::const_iterator ci=post_filenames.begin(); ci!=post_filenames.end();ci++) { if(ci.value()) { - unlink(post_values.value(ci.key()).toString()); + unlink(post_values.value(ci.key()).toString().toUtf8()); } } if(post_tempdir!=NULL) { @@ -488,7 +488,7 @@ QString RDFormPost::urlEncode(const QString &str) ret+=str.mid(i,1); } else { - ret+=QString().sprintf("%%%02X",str.at(i).latin1()); + ret+=QString().sprintf("%%%02X",str.at(i).toLatin1()); } } @@ -657,7 +657,7 @@ bool RDFormPost::GetMimePart(QString *name,QString *value,bool *is_file) line=QString::fromUtf8(GetLine()); QStringList f0=line.split(":"); if(f0.size()==2) { - if(f0[0].lower()=="content-disposition") { + if(f0[0].toLower()=="content-disposition") { QStringList f1=f0[1].split(";"); for(int i=0;ipath()+"/"+f2[1].replace("\"",""); - fd=open(value->utf8(),O_WRONLY|O_CREAT,S_IRUSR|S_IWUSR); + fd=open(value->toUtf8(),O_WRONLY|O_CREAT,S_IRUSR|S_IWUSR); *is_file=true; } } diff --git a/lib/rdget_ath.cpp b/lib/rdget_ath.cpp index a2bacf05..0b96784f 100644 --- a/lib/rdget_ath.cpp +++ b/lib/rdget_ath.cpp @@ -41,7 +41,7 @@ RDGetAth::RDGetAth(double *ath,QWidget *parent) // // Validator // - QDoubleValidator *validator=new QDoubleValidator(this,"validator"); + QDoubleValidator *validator=new QDoubleValidator(this); validator->setBottom(0.0); // @@ -53,19 +53,18 @@ RDGetAth::RDGetAth(double *ath,QWidget *parent) // // ATH // - ath_ath_edit=new QLineEdit(this,"ath_ath_edit"); + ath_ath_edit=new QLineEdit(this); ath_ath_edit->setGeometry(55,70,50,19); ath_ath_edit->setValidator(validator); - QLabel *ath_ath_label=new QLabel(ath_ath_edit,tr("ATH:"),this, - "ath_ath_label"); + QLabel *ath_ath_label=new QLabel(tr("ATH:"),this); ath_ath_label->setGeometry(10,70,40,19); ath_ath_label->setFont(labelFont()); - ath_ath_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + ath_ath_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Ok Button // - QPushButton *ok_button=new QPushButton(this,"ok_button"); + QPushButton *ok_button=new QPushButton(this); ok_button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50); ok_button->setDefault(true); ok_button->setFont(buttonFont()); @@ -75,7 +74,7 @@ RDGetAth::RDGetAth(double *ath,QWidget *parent) // // Cancel Button // - QPushButton *cancel_button=new QPushButton(this,"cancel_button"); + QPushButton *cancel_button=new QPushButton(this); cancel_button-> setGeometry(sizeHint().width()-90,sizeHint().height()-60,80,50); cancel_button->setFont(buttonFont()); diff --git a/lib/rdgpio.cpp b/lib/rdgpio.cpp index 5746d074..9dce3cb0 100644 --- a/lib/rdgpio.cpp +++ b/lib/rdgpio.cpp @@ -37,7 +37,7 @@ RDGpio::RDGpio(QObject *parent) // // Input Timer // - gpio_input_timer=new QTimer(this,"input_timer"); + gpio_input_timer=new QTimer(this); connect(gpio_input_timer,SIGNAL(timeout()),this,SLOT(inputTimerData())); gpio_revert_mapper=NULL; for(int i=0;isetSingleShot(true); gpio_revert_mapper->setMapping(gpio_revert_timer[i],i); connect(gpio_revert_timer[i],SIGNAL(timeout()), gpio_revert_mapper,SLOT(map())); @@ -364,10 +365,11 @@ void RDGpio::SetReversion(int line,unsigned interval) return; } if(gpio_revert_timer[line]->isActive()) { - gpio_revert_timer[line]->changeInterval(interval); + gpio_revert_timer[line]->stop(); + gpio_revert_timer[line]->start(interval); } else { - gpio_revert_timer[line]->start(interval,true); + gpio_revert_timer[line]->start(interval); } } diff --git a/lib/rdgpioselector.cpp b/lib/rdgpioselector.cpp index 35a974f2..974d392c 100644 --- a/lib/rdgpioselector.cpp +++ b/lib/rdgpioselector.cpp @@ -2,7 +2,7 @@ // // GPIO Pin selector widget for Rivendell // -// (C) Copyright 2002,2016 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -20,21 +20,8 @@ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include +#include "rd.h" +#include "rdgpioselector.h" RDGpioSelector::RDGpioSelector(QWidget *parent) @@ -43,17 +30,16 @@ RDGpioSelector::RDGpioSelector(QWidget *parent) // // Pin // - gpio_pin_box=new QSpinBox(this,"gpio_pin_box"); + gpio_pin_box=new QSpinBox(this); gpio_pin_box->setGeometry(60,22,50,19); gpio_pin_box->setSpecialValueText("None"); - gpio_pin_box->setMinValue(-1); - gpio_pin_box->setMaxValue(MAX_GPIO_PINS-1); + gpio_pin_box->setMinimum(-1); + gpio_pin_box->setMaximum(MAX_GPIO_PINS-1); gpio_pin_box->setValue(-1); connect(gpio_pin_box,SIGNAL(valueChanged(int)),this,SLOT(pinData(int))); - QLabel *gpio_pin_label=new QLabel(gpio_pin_box,tr("Pin:"),this, - "gpio_pin_label"); + QLabel *gpio_pin_label=new QLabel(tr("Pin:"),this); gpio_pin_label->setGeometry(0,24,55,19); - gpio_pin_label->setAlignment(Qt::AlignRight|Qt::TextShowMnemonic); + gpio_pin_label->setAlignment(Qt::AlignRight); } diff --git a/lib/rdgroup.cpp b/lib/rdgroup.cpp index 4b7c8b6a..9acc62c0 100644 --- a/lib/rdgroup.cpp +++ b/lib/rdgroup.cpp @@ -180,7 +180,7 @@ QString RDGroup::generateTitle(const QString &pathname) { QString title=defaultTitle(); QString basename=RDGetBasePart(pathname); - int ptr=basename.findRev("."); + int ptr=basename.lastIndexOf("."); title.replace("%p",RDGetPathPart(pathname)); title.replace("%f",basename.left(ptr)); title.replace("%e",basename.right(basename.length()-ptr-1)); diff --git a/lib/rdhash.cpp b/lib/rdhash.cpp index d167f640..609eadb1 100644 --- a/lib/rdhash.cpp +++ b/lib/rdhash.cpp @@ -2,7 +2,7 @@ // // Functions for generating hashes. // -// (C) Copyright 2017 Fred Gleason +// (C) Copyright 2017-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -38,7 +38,7 @@ QString RDSha1Hash(const QString &filename,bool throttle) char data[1024]; unsigned char md[SHA_DIGEST_LENGTH]; - if((fd=open(filename,O_RDONLY))<0) { + if((fd=open(filename.toUtf8(),O_RDONLY))<0) { return ret; } SHA1_Init(&ctx); diff --git a/lib/rdhotkeylist.cpp b/lib/rdhotkeylist.cpp index a64a51b7..e9351ffe 100644 --- a/lib/rdhotkeylist.cpp +++ b/lib/rdhotkeylist.cpp @@ -68,18 +68,18 @@ void RDHotKeyList::BuildKeyList( ) if (p != NULL) { while ( ( fgets(line,256,hkeyfile) != NULL) && (!(strstr(line,"}")) ) ) { QString buf = cleanStrings(line); - int acomment = buf.find("//"); - int eqsign = buf.find("="); + int acomment = buf.indexOf("//"); + int eqsign = buf.indexOf("="); if ((eqsign != -1) && (acomment != 0) ) { KeyString = buf.left((eqsign )); KeyString = KeyString.mid(4); // Remove 'Key_' - int comma = buf.find(","); + int comma = buf.indexOf(","); if (comma != -1) { KeyHex = buf.mid((eqsign + 1), (comma - eqsign)-1 ); } else { - int comment = buf.find("//"); + int comment = buf.indexOf("//"); if (comment != -1) { KeyHex = buf.mid( (eqsign+1), (comment - eqsign) ); @@ -108,7 +108,7 @@ QString RDHotKeyList::cleanStrings( const QString sent) { QString cleanstring; for (int i=0 ; isetGeometry(85,30,sizeHint().width()-180,20); connect(import_in_filename_edit,SIGNAL(textChanged(const QString &)), this,SLOT(filenameChangedData(const QString &))); - import_in_filename_label= - new QLabel(import_in_filename_edit,tr("Filename:"),this); + import_in_filename_label=new QLabel(tr("Filename:"),this); import_in_filename_label->setGeometry(10,30,70,20); import_in_filename_label->setFont(labelFont()); import_in_filename_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -118,8 +117,7 @@ RDImportAudio::RDImportAudio(QString cutname,QString *path, // import_channels_box=new QComboBox(this); import_channels_box->setGeometry(310,54,50,20); - import_channels_label= - new QLabel(import_channels_box,tr("Channels:"),this); + import_channels_label=new QLabel(tr("Channels:"),this); import_channels_label->setGeometry(230,54,75,20); import_channels_label->setFont(labelFont()); import_channels_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -140,7 +138,7 @@ RDImportAudio::RDImportAudio(QString cutname,QString *path, import_autotrim_spin=new QSpinBox(this); import_autotrim_spin->setGeometry(235,80,40,20); import_autotrim_spin->setRange(-99,0); - import_autotrim_label=new QLabel(import_autotrim_spin,tr("Level:"),this); + import_autotrim_label=new QLabel(tr("Level:"),this); import_autotrim_label->setGeometry(185,80,45,20); import_autotrim_label->setFont(labelFont()); import_autotrim_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -165,8 +163,7 @@ RDImportAudio::RDImportAudio(QString cutname,QString *path, connect(import_out_filename_edit,SIGNAL(textChanged(const QString &)), this,SLOT(filenameChangedData(const QString &))); import_out_filename_edit->setReadOnly(true); - import_out_filename_label= - new QLabel(import_out_filename_edit,tr("Filename:"),this); + import_out_filename_label=new QLabel(tr("Filename:"),this); import_out_filename_label->setGeometry(10,140,70,20); import_out_filename_label->setFont(labelFont()); import_out_filename_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -194,7 +191,7 @@ RDImportAudio::RDImportAudio(QString cutname,QString *path, import_format_edit->setGeometry(85,181,sizeHint().width()-180,20); import_format_edit->setReadOnly(true); import_format_edit->setText(import_settings->description()); - import_format_label=new QLabel(import_out_filename_edit,tr("Format:"),this); + import_format_label=new QLabel(tr("Format:"),this); import_format_label->setGeometry(10,181,70,20); import_format_label->setFont(labelFont()); import_format_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -229,7 +226,7 @@ RDImportAudio::RDImportAudio(QString cutname,QString *path, import_normalize_spin=new QSpinBox(this); import_normalize_spin->setGeometry(160,260,40,20); import_normalize_spin->setRange(-30,0); - import_normalize_label=new QLabel(import_normalize_spin,tr("Level:"),this); + import_normalize_label=new QLabel(tr("Level:"),this); import_normalize_label->setGeometry(110,260,45,20); import_normalize_label->setFont(labelFont()); import_normalize_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -262,9 +259,9 @@ RDImportAudio::RDImportAudio(QString cutname,QString *path, // import_normalize_spin->setValue(settings->normalizationLevel()/100); import_autotrim_spin->setValue(settings->autotrimLevel()/100); - import_channels_box->insertItem("1"); - import_channels_box->insertItem("2"); - import_channels_box->setCurrentItem(settings->channels()-1); + import_channels_box->insertItem(import_channels_box->count(),"1"); + import_channels_box->insertItem(import_channels_box->count(),"2"); + import_channels_box->setCurrentIndex(settings->channels()-1); filenameChangedData(""); modeClickedData(import_mode_group->checkedId()); @@ -316,7 +313,7 @@ void RDImportAudio::setNormalizationLevel(int lvl) void RDImportAudio::setChannels(int chans) { - import_channels_box->setCurrentItem(chans-1); + import_channels_box->setCurrentIndex(chans-1); } @@ -530,7 +527,7 @@ void RDImportAudio::Import() import_import_conv->setCartNumber(cut->cartNumber()); import_import_conv->setCutNumber(cut->cutNumber()); import_import_conv->setSourceFile(import_in_filename_edit->text()); - settings.setChannels(import_channels_box->currentItem()+1); + settings.setChannels(import_channels_box->currentIndex()+1); if(import_normalize_box->isChecked()) { settings.setNormalizationLevel(import_normalize_spin->value()); } diff --git a/lib/rdinstancelock.cpp b/lib/rdinstancelock.cpp index f6d84014..6b728309 100644 --- a/lib/rdinstancelock.cpp +++ b/lib/rdinstancelock.cpp @@ -54,7 +54,7 @@ bool RDInstanceLock::lock() lock_locked=true; return true; } - if((file=fopen((const char *)lock_path,"r"))==NULL) { + if((file=fopen(lock_path.toUtf8(),"r"))==NULL) { lock_locked=false; return false; } @@ -62,7 +62,7 @@ bool RDInstanceLock::lock() fclose(file); dir.setPath(QString().sprintf("/proc/%u",pid)); if(!dir.exists()) { - unlink((const char *)lock_path); + unlink(lock_path.toUtf8()); if(MakeLock()) { lock_locked=true; return true; @@ -76,7 +76,7 @@ bool RDInstanceLock::lock() void RDInstanceLock::unlock() { if(lock_locked) { - unlink((const char *)lock_path); + unlink(lock_path.toUtf8()); } lock_locked=false; } @@ -91,7 +91,7 @@ bool RDInstanceLock::locked() bool RDInstanceLock::MakeLock() { FILE *file; - int fd=open((const char *)lock_path,O_WRONLY|O_CREAT|O_EXCL,S_IRUSR|S_IWUSR); + int fd=open(lock_path.toUtf8(),O_WRONLY|O_CREAT|O_EXCL,S_IRUSR|S_IWUSR); if(fd<0) { return false; } diff --git a/lib/rdkernelgpio.cpp b/lib/rdkernelgpio.cpp index e6530eef..e7caae94 100644 --- a/lib/rdkernelgpio.cpp +++ b/lib/rdkernelgpio.cpp @@ -210,8 +210,8 @@ void RDKernelGpio::pollData() FILE *RDKernelGpio::OpenNode(const QString &name,const char *mode,int gpio) const { if(gpio<0) { - return fopen((KERNELGPIO_SYS_FILE+"/"+name),mode); + return fopen((KERNELGPIO_SYS_FILE+"/"+name).toUtf8(),mode); } - return fopen((KERNELGPIO_SYS_FILE+QString().sprintf("/gpio%d/",gpio)+name), - mode); + return fopen((KERNELGPIO_SYS_FILE+QString().sprintf("/gpio%d/",gpio)+name). + toUtf8(),mode); } diff --git a/lib/rdlibrarymodel.cpp b/lib/rdlibrarymodel.cpp index df27d9f8..e0ab3ce9 100644 --- a/lib/rdlibrarymodel.cpp +++ b/lib/rdlibrarymodel.cpp @@ -673,7 +673,7 @@ void RDLibraryModel::updateRow(int row,RDSqlQuery *q) case RDCart::AlwaysValid: d_background_colors[row]= - QColor(palette().color(QPalette::Active,QColorGroup::Base)); + QColor(palette().color(QPalette::Active,QPalette::Base)); break; case RDCart::EvergreenValid: @@ -683,7 +683,7 @@ void RDLibraryModel::updateRow(int row,RDSqlQuery *q) } if(q->value(15).toUInt()==RDCart::Macro) { d_background_colors[row]= - QColor(palette().color(QPalette::Active,QColorGroup::Base)); + QColor(palette().color(QPalette::Active,QPalette::Base)); } // diff --git a/lib/rdlist_groups.cpp b/lib/rdlist_groups.cpp index 9f63dd75..1a9eddf2 100644 --- a/lib/rdlist_groups.cpp +++ b/lib/rdlist_groups.cpp @@ -58,7 +58,7 @@ RDListGroups::RDListGroups(QString *groupname,const QString &caption, // // OK Button // - QPushButton *button=new QPushButton(tr("&OK"),this,"ok_button"); + QPushButton *button=new QPushButton(tr("&OK"),this); button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50); button->setFont(buttonFont()); button->setDefault(true); @@ -67,7 +67,7 @@ RDListGroups::RDListGroups(QString *groupname,const QString &caption, // // Cancel Button // - button=new QPushButton(tr("&Cancel"),this,"cancel_button"); + button=new QPushButton(tr("&Cancel"),this); button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,80,50); button->setFont(buttonFont()); connect(button,SIGNAL(clicked()),this,SLOT(cancelData())); diff --git a/lib/rdlivewire.cpp b/lib/rdlivewire.cpp index 6192a1f9..eb2651c7 100644 --- a/lib/rdlivewire.cpp +++ b/lib/rdlivewire.cpp @@ -2,7 +2,7 @@ // // A LiveWire Node Driver for Rivendell // -// (C) Copyright 2007-2019 Fred Gleason +// (C) Copyright 2007-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -22,13 +22,13 @@ #include #include -#include -#include +#include +#include -#include -#include -#include -#include +#include "rd.h" +#include "rdapplication.h" +#include "rdlivewire.h" +#include "rdsocketstrings.h" AString::AString() : QString() @@ -50,6 +50,28 @@ AString::AString(const QString &lhs) QStringList AString::split(const QString &sep,const QString &esc) const { + if(esc.isEmpty()) { + return QString::split(sep); + } + QStringList list; + bool escape=false; + QChar e=esc.at(0); + list.push_back(QString()); + for(int i=0;isetSingleShot(true); connect(live_watchdog_timer,SIGNAL(timeout()),this,SLOT(watchdogData())); live_watchdog_timeout_timer=new QTimer(this); @@ -113,6 +137,7 @@ RDLiveWire::RDLiveWire(unsigned id,QObject *parent) this,SLOT(watchdogTimeoutData())); live_holdoff_timer=new QTimer(this); + live_holdoff_timer->setSingleShot(true); connect(live_holdoff_timer,SIGNAL(timeout()),this,SLOT(holdoffData())); } @@ -129,7 +154,7 @@ QString RDLiveWire::hostname() const } -Q_UINT16 RDLiveWire::tcpPort() const +uint16_t RDLiveWire::tcpPort() const { return live_tcp_port; } @@ -141,7 +166,7 @@ unsigned RDLiveWire::baseOutput() } -void RDLiveWire::connectToHost(const QString &hostname,Q_UINT16 port, +void RDLiveWire::connectToHost(const QString &hostname,uint16_t port, const QString &passwd,unsigned base_output) { live_hostname=hostname; @@ -152,7 +177,7 @@ void RDLiveWire::connectToHost(const QString &hostname,Q_UINT16 port, } -bool RDLiveWire::loadSettings(const QString &hostname,Q_UINT16 port, +bool RDLiveWire::loadSettings(const QString &hostname,uint16_t port, const QString &passwd,unsigned base_output) { int passes=50; @@ -263,7 +288,7 @@ void RDLiveWire::gpiSet(int slot,int line,unsigned interval) live_gpi_states[slot][line]=true; if(interval>0) { live_gpi_timers[slot*RD_LIVEWIRE_GPIO_BUNDLE_SIZE+line]-> - start(interval,true); + start(interval); } emit gpiChanged(live_id,slot,line,true); } @@ -290,7 +315,7 @@ void RDLiveWire::gpiReset(int slot,int line,unsigned interval) live_gpi_states[slot][line]=false; if(interval>0) { live_gpi_timers[slot*RD_LIVEWIRE_GPIO_BUNDLE_SIZE+line]-> - start(interval,true); + start(interval); } emit gpiChanged(live_id,slot,line,false); } @@ -315,8 +340,7 @@ void RDLiveWire::gpoSet(int slot,int line,unsigned interval) SendCommand(cmd); live_gpo_states[slot][line]=true; if(interval>0) { - live_gpo_timers[slot*RD_LIVEWIRE_GPIO_BUNDLE_SIZE+line]-> - start(interval,true); + live_gpo_timers[slot*RD_LIVEWIRE_GPIO_BUNDLE_SIZE+line]->start(interval); } emit gpoChanged(live_id,slot,line,true); } @@ -342,7 +366,7 @@ void RDLiveWire::gpoReset(int slot,int line,unsigned interval) live_gpo_states[slot][line]=false; if(interval>0) { live_gpo_timers[slot*RD_LIVEWIRE_GPIO_BUNDLE_SIZE+line]-> - start(interval,true); + start(interval); } emit gpoChanged(live_id,slot,line,false); } @@ -375,8 +399,8 @@ void RDLiveWire::connectionClosedData() int holdoff=GetHoldoff(); emit watchdogStateChanged(live_id,QString().sprintf( "connection to LiveWire node at %s:%d closed, attempting reconnect, holdoff = %d mS", - (const char *)live_hostname,live_tcp_port,holdoff)); - live_holdoff_timer->start(holdoff,true); + live_hostname.toUtf8().constData(),live_tcp_port,holdoff)); + live_holdoff_timer->start(holdoff); } } @@ -387,7 +411,7 @@ void RDLiveWire::readyReadData() int n; - while((n=live_socket->readBlock(buf,RD_LIVEWIRE_MAX_CMD_LENGTH))>0) { + while((n=live_socket->read(buf,RD_LIVEWIRE_MAX_CMD_LENGTH))>0) { buf[n]=0; for(int i=0;istart(interval,true); + live_holdoff_timer->start(interval); break; default: rda->syslog(LOG_WARNING, "socket error on connection to LiveWire node at %s:%d: %s", - (const char *)live_hostname, + live_hostname.toUtf8().constData(), live_tcp_port, - (const char *)RDSocketStrings(err)); + RDSocketStrings(err).toUtf8().constData()); break; } } @@ -511,8 +535,8 @@ void RDLiveWire::watchdogTimeoutData() int holdoff=GetHoldoff(); emit watchdogStateChanged(live_id,QString().sprintf( "connection to LiveWire node at %s:%d lost, attempting reconnect, holdoff = %d mS", - (const char *)live_hostname,live_tcp_port,holdoff)); - live_holdoff_timer->start(holdoff,true); + live_hostname.toUtf8().constData(),live_tcp_port,holdoff)); + live_holdoff_timer->start(holdoff); } @@ -531,7 +555,7 @@ void RDLiveWire::resetConnectionData() void RDLiveWire::DespatchCommand(const QString &cmd) { - int offset=cmd.find(" "); + int offset=cmd.indexOf(" "); QString opcode=cmd.left(offset); QString str; if(opcode=="VER") { @@ -559,7 +583,7 @@ void RDLiveWire::DespatchCommand(const QString &cmd) if(opcode=="CFG") { str=cmd.right(cmd.length()-offset-1); - offset=str.find(" "); + offset=str.indexOf(" "); if(str.left(offset)=="GPO") { ReadGpioConfig(str.right(str.length()-offset-1)); } @@ -569,7 +593,7 @@ void RDLiveWire::DespatchCommand(const QString &cmd) void RDLiveWire::SendCommand(const QString &cmd) const { - live_socket->writeBlock((cmd+"\r\n").ascii(),cmd.length()+2); + live_socket->write((cmd+"\r\n").toAscii(),cmd.length()+2); } @@ -581,7 +605,7 @@ void RDLiveWire::ReadVersion(const QString &cmd) if(!live_connected) { f0=AString(cmd).split(" ","\""); for(int i=0;isetSingleShot(true); mapper->setMapping(live_gpi_timers.back(), i*RD_LIVEWIRE_GPIO_BUNDLE_SIZE+j); connect(live_gpi_timers.back(),SIGNAL(timeout()),mapper,SLOT(map())); @@ -654,6 +679,7 @@ void RDLiveWire::ReadVersion(const QString &cmd) live_gpo_states.back()[j]=false; live_gpo_channels.back()[j]=i*RD_LIVEWIRE_GPIO_BUNDLE_SIZE+j; live_gpo_timers.push_back(new QTimer(this)); + live_gpo_timers.back()->setSingleShot(true); mapper->setMapping(live_gpo_timers.back(), i*RD_LIVEWIRE_GPIO_BUNDLE_SIZE+j); connect(live_gpo_timers.back(),SIGNAL(timeout()),mapper,SLOT(map())); @@ -679,11 +705,11 @@ void RDLiveWire::ReadVersion(const QString &cmd) live_watchdog_state=false; emit watchdogStateChanged(live_id,QString().sprintf( "connection to LiveWire node at %s:%d restored", - (const char *)live_hostname,live_tcp_port)); + live_hostname.toUtf8().constData(),live_tcp_port)); } - live_watchdog_timer->start(RDLIVEWIRE_WATCHDOG_INTERVAL,true); + live_watchdog_timer->start(RDLIVEWIRE_WATCHDOG_INTERVAL); live_watchdog_timeout_timer->stop(); - live_watchdog_timeout_timer->start(RDLIVEWIRE_WATCHDOG_TIMEOUT,true); + live_watchdog_timeout_timer->start(RDLIVEWIRE_WATCHDOG_TIMEOUT); } @@ -695,7 +721,7 @@ void RDLiveWire::ReadSources(const QString &cmd) QStringList f0=AString(cmd).split(" ","\""); src->setSlotNumber(f0[0].toInt()); for(int i=1;isetPrimaryName(f1[1]); @@ -740,7 +766,7 @@ void RDLiveWire::ReadDestinations(const QString &cmd) QStringList f0=AString(cmd).split(" ","\""); dst->setSlotNumber(f0[0].toInt()); for(int i=1;isetPrimaryName(f1[1]); @@ -774,9 +800,9 @@ void RDLiveWire::ReadGpis(const QString &cmd) // printf("GPI: %s\n",(const char *)cmd); - int offset=cmd.find(" "); + int offset=cmd.indexOf(" "); int slot=cmd.left(offset).toInt()-1; - QString str=cmd.right(cmd.length()-offset-1).lower(); + QString str=cmd.right(cmd.length()-offset-1).toLower(); for(int i=0;i=0) { ret=str.left(offset); } diff --git a/lib/rdlivewire.h b/lib/rdlivewire.h index 4fcc6c20..b1072305 100644 --- a/lib/rdlivewire.h +++ b/lib/rdlivewire.h @@ -55,11 +55,11 @@ class RDLiveWire : public QObject RDLiveWire(unsigned id,QObject *parent=0); unsigned id() const; QString hostname() const; - Q_UINT16 tcpPort() const; + uint16_t tcpPort() const; unsigned baseOutput(); - void connectToHost(const QString &hostname,Q_UINT16 port, + void connectToHost(const QString &hostname,uint16_t port, const QString &passwd,unsigned base_output); - bool loadSettings(const QString &hostname,Q_UINT16 port, + bool loadSettings(const QString &hostname,uint16_t port, const QString &passwd,unsigned base_output); QString deviceName() const; QString protocolVersion() const; @@ -115,7 +115,7 @@ class RDLiveWire : public QObject unsigned live_id; unsigned live_base_output; QString live_hostname; - Q_UINT16 live_tcp_port; + uint16_t live_tcp_port; QString live_password; QString live_device_name; QString live_protocol_version; diff --git a/lib/rdlivewiredestination.cpp b/lib/rdlivewiredestination.cpp index f49eeed1..ee5d53af 100644 --- a/lib/rdlivewiredestination.cpp +++ b/lib/rdlivewiredestination.cpp @@ -2,7 +2,7 @@ // // Accessor Methods for LiveWire Destination Parameters // -// (C) Copyright 2007,2016 Fred Gleason +// (C) Copyright 2007-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -63,13 +63,13 @@ void RDLiveWireDestination::setStreamAddress(const QHostAddress &addr) } -Q_UINT16 RDLiveWireDestination::streamUdpPort() const +uint16_t RDLiveWireDestination::streamUdpPort() const { return live_stream_udp_port; } -void RDLiveWireDestination::setStreamUdpPort(Q_UINT16 port) +void RDLiveWireDestination::setStreamUdpPort(uint16_t port) { live_stream_udp_port=port; } diff --git a/lib/rdlivewiredestination.h b/lib/rdlivewiredestination.h index cab9b04c..8f228f08 100644 --- a/lib/rdlivewiredestination.h +++ b/lib/rdlivewiredestination.h @@ -2,7 +2,7 @@ // // Accessor Methods for LiveWire Destination Parameters // -// (C) Copyright 2007,2016 Fred Gleason +// (C) Copyright 2007-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -21,6 +21,8 @@ #ifndef RDLIVEWIREDESTINATION_H #define RDLIVEWIREDESTINATION_H +#include + #include class RDLiveWireDestination @@ -34,8 +36,8 @@ class RDLiveWireDestination void setPrimaryName(const QString &name); QHostAddress streamAddress() const; void setStreamAddress(const QHostAddress &addr); - Q_UINT16 streamUdpPort() const; - void setStreamUdpPort(Q_UINT16 port); + uint16_t streamUdpPort() const; + void setStreamUdpPort(uint16_t port); int channels() const; void setChannels(int chans); RDLiveWireDestination::Load load() const; @@ -49,7 +51,7 @@ class RDLiveWireDestination int live_slot_number; QString live_primary_name; QHostAddress live_stream_address; - Q_UINT16 live_stream_udp_port; + uint16_t live_stream_udp_port; int live_channels; RDLiveWireDestination::Load live_load; int live_output_gain; diff --git a/lib/rdlivewiresource.cpp b/lib/rdlivewiresource.cpp index 54da60b1..b598e124 100644 --- a/lib/rdlivewiresource.cpp +++ b/lib/rdlivewiresource.cpp @@ -2,7 +2,7 @@ // // Accessor Methods for LiveWire Source Parameters // -// (C) Copyright 2007,2016 Fred Gleason +// (C) Copyright 2007-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -20,8 +20,8 @@ #include -#include -#include +#include "rd.h" +#include "rdlivewiresource.h" RDLiveWireSource::RDLiveWireSource() { @@ -103,13 +103,13 @@ void RDLiveWireSource::setStreamAddress(const QHostAddress &addr) } -Q_UINT16 RDLiveWireSource::streamUdpPort() const +uint16_t RDLiveWireSource::streamUdpPort() const { return live_stream_udp_port; } -void RDLiveWireSource::setStreamUdpPort(Q_UINT16 port) +void RDLiveWireSource::setStreamUdpPort(uint16_t port) { live_stream_udp_port=port; } diff --git a/lib/rdlivewiresource.h b/lib/rdlivewiresource.h index 4a28e5e5..6ad09fce 100644 --- a/lib/rdlivewiresource.h +++ b/lib/rdlivewiresource.h @@ -2,7 +2,7 @@ // // Accessor Methods for LiveWire Source Parameters // -// (C) Copyright 2007,2016 Fred Gleason +// (C) Copyright 2007-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -21,7 +21,9 @@ #ifndef RDLIVEWIRESOURCE_H #define RDLIVEWIRESOURCE_H -#include +#include + +#include class RDLiveWireSource { @@ -39,8 +41,8 @@ class RDLiveWireSource void setRtpEnabled(bool state); QHostAddress streamAddress() const; void setStreamAddress(const QHostAddress &addr); - Q_UINT16 streamUdpPort() const; - void setStreamUdpPort(Q_UINT16 port); + uint16_t streamUdpPort() const; + void setStreamUdpPort(uint16_t port); bool shareable() const; void setShareable(bool state); int inputGain() const; @@ -56,7 +58,7 @@ class RDLiveWireSource QString live_label_name; bool live_rtp_enabled; QHostAddress live_stream_address; - Q_UINT16 live_stream_udp_port; + uint16_t live_stream_udp_port; bool live_shareable; int live_input_gain; int live_channels; diff --git a/lib/rdlog_line.cpp b/lib/rdlog_line.cpp index d0d487e3..7b791672 100644 --- a/lib/rdlog_line.cpp +++ b/lib/rdlog_line.cpp @@ -1856,7 +1856,7 @@ RDLogLine::State RDLogLine::setEvent(int mach,RDLogLine::TransType next_type, delete cart; rda->syslog(LOG_DEBUG, "RDLogLine::setEvent(): no cut record found, SQL=%s", - (const char *)sql); + sql.toUtf8().constData()); log_state=RDLogLine::NoCut; return RDLogLine::NoCut; } @@ -1865,7 +1865,7 @@ RDLogLine::State RDLogLine::setEvent(int mach,RDLogLine::TransType next_type, delete cart; rda->syslog(LOG_DEBUG, "RDLogLine::setEvent(): zero length cut audio, SQL=%s", - (const char *)sql); + sql.toUtf8().constData()); log_state=RDLogLine::NoCut; return RDLogLine::NoCut; } @@ -2446,7 +2446,7 @@ QString RDLogLine::resolveNowNextDateTime(const QString &str, std::vector dts; QString ret=str; - while((ptr=ret.find(code,ptr))>=0) { + while((ptr=ret.indexOf(code,ptr))>=0) { for(int i=ptr+3;isetBuddy(filter_service_box); switch(mode) { case RDLogFilter::NoFilter: - filter_service_box->insertItem(tr("ALL")); + filter_service_box->insertItem(filter_service_box->count(),tr("ALL")); sql=QString("select NAME from SERVICES order by NAME"); q=new RDSqlQuery(sql); while(q->next()) { - filter_service_box->insertItem(q->value(0).toString()); + filter_service_box-> + insertItem(filter_service_box->count(),q->value(0).toString()); } delete q; break; @@ -62,12 +63,13 @@ RDLogFilter::RDLogFilter(RDLogFilter::FilterMode mode,QWidget *parent) break; case RDLogFilter::StationFilter: - filter_service_box->insertItem(tr("ALL")); + filter_service_box->insertItem(filter_service_box->count(),tr("ALL")); sql=QString("select SERVICE_NAME from SERVICE_PERMS where ")+ "STATION_NAME=\""+RDEscapeString(rda->config()->stationName())+"\""; q=new RDSqlQuery(sql); while(q->next()) { - filter_service_box->insertItem(q->value(0).toString()); + filter_service_box-> + insertItem(filter_service_box->count(),q->value(0).toString()); } delete q; break; @@ -125,21 +127,21 @@ QString RDLogFilter::whereSql() const { QString sql=""; - if(filter_service_box->currentItem()!=0) { + if(filter_service_box->currentIndex()!=0) { sql+="&&(LOGS.SERVICE=\""+ RDEscapeString(filter_service_box->currentText())+"\")"; } else { sql+="&&("; for(int i=1;icount();i++) { - sql+="(SERVICE=\""+RDEscapeString(filter_service_box->text(i))+"\")||"; + sql+="(SERVICE=\""+RDEscapeString(filter_service_box->itemData(i).toString())+"\")||"; } sql=sql.left(sql.length()-2); sql+=")"; } QString filter=filter_filter_edit->text(); if(!filter.isEmpty()) { - if(filter_service_box->currentItem()==0) { + if(filter_service_box->currentIndex()==0) { sql+="&&((LOGS.NAME like \"%%"+RDEscapeString(filter)+"%%\")||"; sql+="(LOGS.DESCRIPTION like \"%%"+RDEscapeString(filter)+"%%\")||"; sql+="(LOGS.SERVICE like \"%%"+RDEscapeString(filter)+"%%\"))"; @@ -162,12 +164,13 @@ void RDLogFilter::changeUser() { if(filter_filter_mode==RDLogFilter::UserFilter) { filter_service_box->clear(); - filter_service_box->insertItem(tr("ALL")); + filter_service_box->insertItem(filter_service_box->count(),tr("ALL")); QString sql=QString("select SERVICE_NAME from USER_SERVICE_PERMS where ")+ "USER_NAME=\""+RDEscapeString(rda->user()->name())+"\""; RDSqlQuery *q=new RDSqlQuery(sql); while(q->next()) { - filter_service_box->insertItem(q->value(0).toString()); + filter_service_box-> + insertItem(filter_service_box->count(),q->value(0).toString()); } delete q; } diff --git a/lib/rdloglock.cpp b/lib/rdloglock.cpp index 18be68e9..b6048e7e 100644 --- a/lib/rdloglock.cpp +++ b/lib/rdloglock.cpp @@ -147,7 +147,7 @@ void RDLogLock::updateLock(const QString &log_name,const QString &guid) q=new RDSqlQuery(sql); if(q->numRowsAffected()==0) { rda->syslog(LOG_WARNING,"lock on log \"%s\" has evaporated!", - (const char *)log_name); + log_name.toUtf8().constData()); } delete q; } diff --git a/lib/rdlogplay.cpp b/lib/rdlogplay.cpp index a98b966b..12e1e36a 100644 --- a/lib/rdlogplay.cpp +++ b/lib/rdlogplay.cpp @@ -2184,18 +2184,18 @@ bool RDLogPlay::StartEvent(int line,RDLogLine::TransType trans_type, play_macro_deck-> load(QString().sprintf("LL %d %s -2!", play_id+1, - (const char *)logline->markerLabel())); + logline->markerLabel().toUtf8().constData())); } else { play_macro_deck-> load(QString().sprintf("LL %d %s -2!", play_id+1, - (const char *)logline->markerLabel())); + logline->markerLabel().toUtf8().constData())); } play_macro_deck->setLine(line); play_macro_deck->exec(); rda->syslog(LOG_INFO,"log engine: chained to log: Line: %d Log: %s", - line,(const char *)logline->markerLabel()); + line,logline->markerLabel().toUtf8().constData()); break; default: @@ -3167,10 +3167,10 @@ void RDLogPlay::SendNowNext() write(RDJsonField("hostName",rda->station()->name(),8).toUtf8()); play_pad_socket-> write(RDJsonField("shortHostName",rda->station()->shortName(),8).toUtf8()); - play_pad_socket->write(RDJsonField("machine",play_id+1,8)); - play_pad_socket->write(RDJsonField("onairFlag",play_onair_flag,8)); + play_pad_socket->write(RDJsonField("machine",play_id+1,8).toUtf8()); + play_pad_socket->write(RDJsonField("onairFlag",play_onair_flag,8).toUtf8()); play_pad_socket-> - write(RDJsonField("mode",RDAirPlayConf::logModeText(play_op_mode),8)); + write(RDJsonField("mode",RDAirPlayConf::logModeText(play_op_mode),8).toUtf8()); // // Service diff --git a/lib/rdmacro.cpp b/lib/rdmacro.cpp index 1b6525df..cd49d7de 100644 --- a/lib/rdmacro.cpp +++ b/lib/rdmacro.cpp @@ -56,7 +56,7 @@ void RDMacro::setCommand(RDMacro::Command cmd) void RDMacro::setCommand(const QString &str) { RDMacro::Command cmd=RDMacro::NN; - cmd=(RDMacro::Command)((str.at(0).latin1()<<8)+str.at(1).latin1()); + cmd=(RDMacro::Command)((str.at(0).toLatin1()<<8)+str.at(1).toLatin1()); switch(cmd) { case RDMacro::AG: case RDMacro::AL: @@ -141,13 +141,13 @@ void RDMacro::setAddress(QHostAddress addr) } -Q_UINT16 RDMacro::port() const +uint16_t RDMacro::port() const { return rml_port; } -void RDMacro::setPort(Q_UINT16 port) +void RDMacro::setPort(uint16_t port) { rml_port=port; } @@ -282,7 +282,7 @@ RDMacro RDMacro::fromString(const QString &str,RDMacro::Role role) // // Check for bang // - QString str2=str.stripWhiteSpace(); + QString str2=str.trimmed(); if(str2.right(1)!="!") { ret.setCommand(RDMacro::NN); return ret; @@ -296,7 +296,7 @@ RDMacro RDMacro::fromString(const QString &str,RDMacro::Role role) ret.setCommand(RDMacro::NN); return ret; } - cmd=(RDMacro::Command)((f0[0].at(0).latin1()<<8)+f0[0].at(1).latin1()); + cmd=(RDMacro::Command)((f0[0].at(0).toLatin1()<<8)+f0[0].at(1).toLatin1()); switch(cmd) { case RDMacro::AG: case RDMacro::AL: diff --git a/lib/rdmacro.h b/lib/rdmacro.h index f6ad76a3..fca7ee39 100644 --- a/lib/rdmacro.h +++ b/lib/rdmacro.h @@ -2,7 +2,7 @@ // // A container class for a Rivendell Macro Language Command // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -21,12 +21,14 @@ #ifndef RDMACRO_H #define RDMACRO_H +#include + #include -#include -#include -#include -#include +#include +#include +#include +#include #include @@ -53,8 +55,8 @@ class RDMacro void setCommand(const QString &str); QHostAddress address() const; void setAddress(QHostAddress addr); - Q_UINT16 port() const; - void setPort(Q_UINT16 port); + uint16_t port() const; + void setPort(uint16_t port); bool echoRequested() const; void setEchoRequested(bool state); QString arg(int n) const; @@ -77,7 +79,7 @@ class RDMacro RDMacro::Role rml_role; RDMacro::Command rml_cmd; QHostAddress rml_addr; - Q_UINT16 rml_port; + uint16_t rml_port; bool rml_echo_requested; QStringList rml_args; }; diff --git a/lib/rdmacro_event.cpp b/lib/rdmacro_event.cpp index 990f46f5..06d4951f 100644 --- a/lib/rdmacro_event.cpp +++ b/lib/rdmacro_event.cpp @@ -2,7 +2,7 @@ // // A container class for a list of RML macros. // -// (C) Copyright 2002-2004,2016 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -25,8 +25,8 @@ #include #include -RDMacroEvent::RDMacroEvent(RDRipc *ripc,QObject *parent,const char *name) - : QObject(parent,name) +RDMacroEvent::RDMacroEvent(RDRipc *ripc,QObject *parent) + : QObject(parent) { QHostAddress addr; addr.setAddress("127.0.0.1"); @@ -35,21 +35,22 @@ RDMacroEvent::RDMacroEvent(RDRipc *ripc,QObject *parent,const char *name) event_whole_list=false; event_line=-1; - event_sleep_timer=new QTimer(this,"event_sleep_timer"); + event_sleep_timer=new QTimer(this); + event_sleep_timer->setSingleShot(true); connect(event_sleep_timer,SIGNAL(timeout()),this,SLOT(sleepTimerData())); } -RDMacroEvent::RDMacroEvent(QHostAddress addr,RDRipc *ripc, - QObject *parent,const char *name) - : QObject(parent,name) +RDMacroEvent::RDMacroEvent(QHostAddress addr,RDRipc *ripc,QObject *parent) + : QObject(parent) { event_ripc=ripc; event_address=addr; event_whole_list=false; event_line=-1; - event_sleep_timer=new QTimer(this,"event_sleep_timer"); + event_sleep_timer=new QTimer(this); + event_sleep_timer->setSingleShot(true); connect(event_sleep_timer,SIGNAL(timeout()),this,SLOT(sleepTimerData())); } @@ -217,7 +218,7 @@ void RDMacroEvent::exec(int line) RDSqlQuery *q; QString stationname; QStringList args; - Q_UINT16 port=0; + uint16_t port=0; if(event_ripc==NULL) { return; @@ -229,16 +230,16 @@ void RDMacroEvent::exec(int line) switch(event_cmds[line]->command()) { case RDMacro::SP: // Sleep event_sleeping_line=line; - event_sleep_timer->start(event_cmds[line]->arg(0).toInt(),true); + event_sleep_timer->start(event_cmds[line]->arg(0).toInt()); break; case RDMacro::CC: // Send Command - args=args.split(":",event_cmds[line]->arg(0)); + args=event_cmds[line]->arg(0).split(":",QString::KeepEmptyParts); stationname=args[0]; if(args.size()==2) { port=args[1].toUInt(); } - if(stationname.lower()=="localhost") { + if(stationname.toLower()=="localhost") { addr.setAddress("127.0.0.2"); rml.setAddress(addr); } diff --git a/lib/rdmacro_event.h b/lib/rdmacro_event.h index f19a08fd..11066dd7 100644 --- a/lib/rdmacro_event.h +++ b/lib/rdmacro_event.h @@ -2,7 +2,7 @@ // // A container class for a list of RML macros. // -// (C) Copyright 2002-2003,2016 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -35,9 +35,8 @@ class RDMacroEvent : public QObject { Q_OBJECT public: - RDMacroEvent(RDRipc *ripc=0,QObject *parent=0,const char *name=0); - RDMacroEvent(QHostAddress addr,RDRipc *ripc=0, - QObject *parent=0,const char *name=0); + RDMacroEvent(RDRipc *ripc=0,QObject *parent=0); + RDMacroEvent(QHostAddress addr,RDRipc *ripc=0,QObject *parent=0); ~RDMacroEvent(); int line() const; void setLine(int line); diff --git a/lib/rdmarker_bar.cpp b/lib/rdmarker_bar.cpp index 97b1b449..d75fee6b 100644 --- a/lib/rdmarker_bar.cpp +++ b/lib/rdmarker_bar.cpp @@ -84,7 +84,7 @@ void RDMarkerBar::DrawMap() QPixmap *pix=new QPixmap(size()); QPainter *p=new QPainter(pix); QPolygon *pt; - p->fillRect(0,0,size().width(),size().height(),backgroundColor()); + p->fillRect(0,0,size().width(),size().height(),palette().color(QPalette::Background)); if(marker_length>0) { p->setPen(RD_CUEEDITOR_START_MARKER); p->setBrush(RD_CUEEDITOR_START_MARKER); diff --git a/lib/rdmonitor_config.cpp b/lib/rdmonitor_config.cpp index 0bcdd83c..04ac62a1 100644 --- a/lib/rdmonitor_config.cpp +++ b/lib/rdmonitor_config.cpp @@ -109,7 +109,7 @@ bool RDMonitorConfig::save() { FILE *f=NULL; - if((f=fopen(mon_filename,"w"))==NULL) { + if((f=fopen(mon_filename.toUtf8(),"w"))==NULL) { return false; } fprintf(f,"[Monitor]\n"); diff --git a/lib/rdmulticaster.cpp b/lib/rdmulticaster.cpp index 1db8a012..e54daeae 100644 --- a/lib/rdmulticaster.cpp +++ b/lib/rdmulticaster.cpp @@ -47,7 +47,7 @@ void RDMulticaster::enableLoopback(bool state) { int var=state; - setsockopt(multi_socket->socket(),IPPROTO_IP,IP_MULTICAST_LOOP, + setsockopt(multi_socket->socketDescriptor(),IPPROTO_IP,IP_MULTICAST_LOOP, &var,sizeof(var)); } @@ -61,7 +61,7 @@ void RDMulticaster::subscribe(const QHostAddress &addr) mreq.imr_multiaddr.s_addr=htonl(addr.toIPv4Address()); mreq.imr_address.s_addr=htonl(multi_iface_addresses[i].toIPv4Address()); mreq.imr_ifindex=0; - if(setsockopt(multi_socket->socket(),IPPROTO_IP,IP_ADD_MEMBERSHIP, + if(setsockopt(multi_socket->socketDescriptor(),IPPROTO_IP,IP_ADD_MEMBERSHIP, &mreq,sizeof(mreq))<0) { fprintf(stderr,"%s\n",(tr("Unable to subscribe to multicast address")+ " \""+addr.toString()+"\" ["+ @@ -81,7 +81,7 @@ void RDMulticaster::unsubscribe(const QHostAddress &addr) mreq.imr_multiaddr.s_addr=htonl(addr.toIPv4Address()); mreq.imr_address.s_addr=htonl(multi_iface_addresses[i].toIPv4Address()); mreq.imr_ifindex=0; - if(setsockopt(multi_socket->socket(),IPPROTO_IP,IP_DROP_MEMBERSHIP, + if(setsockopt(multi_socket->socketDescriptor(),IPPROTO_IP,IP_DROP_MEMBERSHIP, &mreq,sizeof(mreq))<0) { fprintf(stderr,"%s\n",(tr("Unable to subscribe to multicast address")+ " \""+addr.toString()+"\" ["+ @@ -95,7 +95,7 @@ void RDMulticaster::unsubscribe(const QHostAddress &addr) void RDMulticaster::send(const QString &msg,const QHostAddress &m_addr, uint16_t port) { - multi_socket->writeDatagram(msg.utf8(),msg.utf8().length(),m_addr,port); + multi_socket->writeDatagram(msg.toUtf8(),m_addr,port); } diff --git a/lib/rdoneshot.cpp b/lib/rdoneshot.cpp index d966f5cc..70d906ff 100644 --- a/lib/rdoneshot.cpp +++ b/lib/rdoneshot.cpp @@ -42,10 +42,11 @@ void RDOneShot::start(int value,int msecs) { shot_values[shot_count]=value; shot_timers[shot_count]=new QTimer(this); + shot_timers[shot_count]->setSingleShot(true); shot_mapper->setMapping(shot_timers[shot_count],shot_count); connect(shot_timers[shot_count],SIGNAL(timeout()), shot_mapper,SLOT(map())); - shot_timers[shot_count]->start(msecs,true); + shot_timers[shot_count]->start(msecs); shot_count++; } @@ -53,7 +54,7 @@ void RDOneShot::start(int value,int msecs) void RDOneShot::timeoutData(int id) { emit timeout(shot_values[id]); - shot_zombie_timer->start(10,true); + shot_zombie_timer->start(10); } diff --git a/lib/rdpam.cpp b/lib/rdpam.cpp index 75b72c75..3a23eeae 100644 --- a/lib/rdpam.cpp +++ b/lib/rdpam.cpp @@ -44,7 +44,7 @@ int RDPamCallback(int num_msg, const struct pam_message **msg, memset(resp[i]->resp,0,256); switch(msg[i]->msg_style) { case PAM_PROMPT_ECHO_OFF: - strncpy(resp[i]->resp,pam->system_token,255); + strncpy(resp[i]->resp,pam->system_token.toUtf8(),255); break; case PAM_PROMPT_ECHO_ON: @@ -79,7 +79,7 @@ bool RDPam::authenticate(const QString &username,const QString &token) memset(&conv,0,sizeof(conv)); conv.conv=RDPamCallback; conv.appdata_ptr=(RDPam *)this; - if((err=pam_start(system_pam_service,username,&conv,&pamh))!=PAM_SUCCESS) { + if((err=pam_start(system_pam_service.toUtf8(),username.toUtf8(),&conv,&pamh))!=PAM_SUCCESS) { rda->syslog(LOG_WARNING,"PAM error [%s]",pam_strerror(pamh,err)); pam_end(pamh,err); CleanupPam(); diff --git a/lib/rdpanel_button.cpp b/lib/rdpanel_button.cpp index 2ff983b3..521cf018 100644 --- a/lib/rdpanel_button.cpp +++ b/lib/rdpanel_button.cpp @@ -143,7 +143,7 @@ void RDPanelButton::setColor(QColor color) } button_color=color; if(button_flash) { - if(color==button_parent->backgroundColor()) { + if(color==palette().color(QPalette::Background)) { button_flashing=false; } else { @@ -396,8 +396,10 @@ void RDPanelButton::mouseReleaseEvent(QMouseEvent *e) void RDPanelButton::dragEnterEvent(QDragEnterEvent *e) { - e->accept(RDCartDrag::canDecode(e)&&button_allow_drags&& - ((button_play_deck==NULL)||(button_play_deck->state()==RDPlayDeck::Stopped))); + if(RDCartDrag::canDecode(e)&&button_allow_drags&& + ((button_play_deck==NULL)||(button_play_deck->state()==RDPlayDeck::Stopped))) { + e->accept(); + } } @@ -490,7 +492,7 @@ void RDPanelButton::WriteKeycap(int secs) } } p->end(); - setPixmap(*pix); + setIcon(*pix); delete p; delete pix; update(); @@ -561,7 +563,7 @@ QString RDPanelButton::GetNextLine(QString *str,const QFontMetrics &m,int len) while((!str->at(l--).isSpace())&&(l>=0)); if(l>0) { ret=str->left(l+1); - *str=str->right(str->length()-l-1).stripWhiteSpace(); + *str=str->right(str->length()-l-1).trimmed(); return ret; } } diff --git a/lib/rdpasswd.cpp b/lib/rdpasswd.cpp index 7656c7a6..d663c1b3 100644 --- a/lib/rdpasswd.cpp +++ b/lib/rdpasswd.cpp @@ -48,10 +48,9 @@ RDPasswd::RDPasswd(QString *password,QWidget *parent) passwd_password_1_edit->setEchoMode(QLineEdit::Password); passwd_password_1_edit->setFocus(); passwd_password_1_edit->setValidator(validator); - passwd_password_1_label= - new QLabel(passwd_password_1_edit,tr("&Password:"),this); + passwd_password_1_label=new QLabel(tr("&Password:"),this); passwd_password_1_label->setFont(labelFont()); - passwd_password_1_label->setAlignment(Qt::AlignRight|Qt::TextShowMnemonic); + passwd_password_1_label->setAlignment(Qt::AlignRight); // // Confirm Password @@ -60,10 +59,9 @@ RDPasswd::RDPasswd(QString *password,QWidget *parent) passwd_password_2_edit->setMaxLength(RD_MAX_PASSWORD_LENGTH); passwd_password_2_edit->setEchoMode(QLineEdit::Password); passwd_password_2_edit->setValidator(validator); - passwd_password_2_label= - new QLabel(passwd_password_2_edit,tr("C&onfirm:"),this); + passwd_password_2_label=new QLabel(tr("C&onfirm:"),this); passwd_password_2_label->setFont(labelFont()); - passwd_password_2_label->setAlignment(Qt::AlignRight|Qt::TextShowMnemonic); + passwd_password_2_label->setAlignment(Qt::AlignRight); // // OK Button diff --git a/lib/rdpeaksexport.cpp b/lib/rdpeaksexport.cpp index 3bb3536d..dbb31e76 100644 --- a/lib/rdpeaksexport.cpp +++ b/lib/rdpeaksexport.cpp @@ -2,7 +2,7 @@ // // Export peak data using the RdXport Web Service // -// (C) Copyright 2010,2016-2018 Fred Gleason +// (C) Copyright 2010-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -29,9 +29,6 @@ #include -#include -#include - #include "rd.h" #include "rdapplication.h" #include "rdxport_interface.h" @@ -91,7 +88,6 @@ RDPeaksExport::ErrorCode RDPeaksExport::runExport(const QString &username, long response_code; CURL *curl=NULL; CURLcode curl_err; - char url[1024]; struct curl_httppost *first=NULL; struct curl_httppost *last=NULL; @@ -100,19 +96,22 @@ RDPeaksExport::ErrorCode RDPeaksExport::runExport(const QString &username, // curl_formadd(&first,&last,CURLFORM_PTRNAME,"COMMAND", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",RDXPORT_COMMAND_EXPORT_PEAKS), + QString().sprintf("%u",RDXPORT_COMMAND_EXPORT_PEAKS).toUtf8(). + constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"LOGIN_NAME", - CURLFORM_COPYCONTENTS,(const char *)username.utf8(),CURLFORM_END); + CURLFORM_COPYCONTENTS,username.toUtf8().constData(), + CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"PASSWORD", - CURLFORM_COPYCONTENTS,(const char *)password.utf8(),CURLFORM_END); + CURLFORM_COPYCONTENTS,password.toUtf8().constData(), + CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"CART_NUMBER", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_cart_number), + QString().sprintf("%u",conv_cart_number).toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"CUT_NUMBER", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_cut_number), + QString().sprintf("%u",conv_cut_number).toUtf8().constData(), CURLFORM_END); if((curl=curl_easy_init())==NULL) { curl_formfree(first); @@ -121,18 +120,13 @@ RDPeaksExport::ErrorCode RDPeaksExport::runExport(const QString &username, curl_easy_setopt(curl,CURLOPT_WRITEDATA,this); curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,RDPeaksExportWrite); - // - // Write out URL as a C string before passing to curl_easy_setopt(), - // otherwise some versions of LibCurl will throw a 'bad/illegal format' - // error. - // - strncpy(url,rda->station()->webServiceUrl(rda->config()),1024); - curl_easy_setopt(curl,CURLOPT_URL,url); + curl_easy_setopt(curl,CURLOPT_URL,rda->station()-> + webServiceUrl(rda->config()).toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_HTTPPOST,first); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_NOPROGRESS,1); curl_easy_setopt(curl,CURLOPT_USERAGENT, - (const char *)rda->config()->userAgent()); + rda->config()->userAgent().toUtf8().constData()); //curl_easy_setopt(curl,CURLOPT_VERBOSE,1); switch((curl_err=curl_easy_perform(curl))) { diff --git a/lib/rdplay_deck.cpp b/lib/rdplay_deck.cpp index 20c2d378..e9203414 100644 --- a/lib/rdplay_deck.cpp +++ b/lib/rdplay_deck.cpp @@ -60,21 +60,25 @@ RDPlayDeck::RDPlayDeck(RDCae *cae,int id,QObject *parent) // // Timers // - QSignalMapper *mapper=new QSignalMapper(this,"timer_mapper"); + QSignalMapper *mapper=new QSignalMapper(this); connect(mapper,SIGNAL(mapped(int)),this,SLOT(pointTimerData(int))); for(int i=0;i<3;i++) { - play_point_timer[i]=new QTimer(this,"point_timer"); + play_point_timer[i]=new QTimer(this); + play_point_timer[i]->setSingleShot(true); connect(play_point_timer[i],SIGNAL(timeout()),mapper,SLOT(map())); mapper->setMapping(play_point_timer[i],i); } - play_position_timer=new QTimer(this,"play_position_timer"); + play_position_timer=new QTimer(this); connect(play_position_timer,SIGNAL(timeout()), this,SLOT(positionTimerData())); - play_fade_timer=new QTimer(this,"play_fade_timer"); + play_fade_timer=new QTimer(this); + play_fade_timer->setSingleShot(true); connect(play_fade_timer,SIGNAL(timeout()),this,SLOT(fadeTimerData())); - play_stop_timer=new QTimer(this,"play_stop_timer"); + play_stop_timer=new QTimer(this); + play_stop_timer->setSingleShot(true); connect(play_stop_timer,SIGNAL(timeout()),this,SLOT(stop())); - play_duck_timer=new QTimer(this,"play_duck_timer"); + play_duck_timer=new QTimer(this); + play_duck_timer->setSingleShot(true); connect(play_duck_timer,SIGNAL(timeout()),this,SLOT(duckTimerData())); } @@ -541,7 +545,7 @@ void RDPlayDeck::stop(int interval,int gain) if(level>play_duck_gain[1]){ play_cae->fadeOutputVolume(play_card,play_stream,play_port, play_duck_gain[1]+play_cut_gain+play_duck_level,play_duck_down); - play_duck_timer->start(play_duck_down,true); + play_duck_timer->start(play_duck_down); play_duck_down_state=true; play_segue_interval=interval; } @@ -552,7 +556,7 @@ void RDPlayDeck::stop(int interval,int gain) play_point_gain+play_cut_gain+play_duck_level,interval); } } - play_stop_timer->start(interval,true); + play_stop_timer->start(interval); stop_called=true; play_state=RDPlayDeck::Stopping; } @@ -566,7 +570,7 @@ void RDPlayDeck::duckDown(int interval) if(play_duck_gain[1]<0) { play_cae->fadeOutputVolume(play_card,play_stream,play_port, play_duck_gain[1]+play_cut_gain+play_duck_level,play_duck_down); - play_duck_timer->start(play_duck_down,true); + play_duck_timer->start(play_duck_down); play_duck_down_state=true; play_segue_interval=interval; @@ -635,7 +639,7 @@ void RDPlayDeck::pointTimerData(int point) else { play_point_state[point]=true; play_point_timer[point]-> - start(play_point_value[point][1]-play_point_value[point][0],true); + start(play_point_value[point][1]-play_point_value[point][0]); emit segueStart(play_id); } break; @@ -648,7 +652,7 @@ void RDPlayDeck::pointTimerData(int point) else { play_point_state[point]=true; play_point_timer[point]-> - start(play_point_value[point][1]-play_point_value[point][0],true); + start(play_point_value[point][1]-play_point_value[point][0]); emit hookStart(play_id); } break; @@ -661,7 +665,7 @@ void RDPlayDeck::pointTimerData(int point) else { play_point_state[point]=true; play_point_timer[point]-> - start(play_point_value[point][1]-play_point_value[point][0],true); + start(play_point_value[point][1]-play_point_value[point][0]); emit talkStart(play_id); } break; @@ -734,24 +738,23 @@ void RDPlayDeck::StartTimers(int offset) (double)play_timescale_speed); if((play_point_value[i][0]-audio_point-offset)>=0) { play_point_timer[i]-> - start(play_point_value[i][0]-audio_point-offset,true); + start(play_point_value[i][0]-audio_point-offset); } else { if((play_point_value[i][1]-audio_point-offset)>=0) { play_point_state[i]=true; play_point_timer[i]-> - start(play_point_value[i][1]-audio_point-offset,true); + start(play_point_value[i][1]-audio_point-offset); } } } } if((play_fade_point[1]!=-1)&&(offset0)) { - play_fade_timer->start(play_fade_point[1]-play_audio_point[0]-offset,true); + play_fade_timer->start(play_fade_point[1]-play_audio_point[0]-offset); } if(offset - start(play_duck_up_point-offset,true); + play_duck_timer->start(play_duck_up_point-offset); } } diff --git a/lib/rdpodcast.cpp b/lib/rdpodcast.cpp index 04905fa0..87a316f6 100644 --- a/lib/rdpodcast.cpp +++ b/lib/rdpodcast.cpp @@ -384,7 +384,8 @@ bool RDPodcast::removePodcast() const // curl_formadd(&first,&last,CURLFORM_PTRNAME,"COMMAND", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",RDXPORT_COMMAND_REMOVE_PODCAST), + QString().sprintf("%u",RDXPORT_COMMAND_REMOVE_PODCAST).toUtf8(). + constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"LOGIN_NAME", CURLFORM_COPYCONTENTS,rda->user()->name().toUtf8().constData(), @@ -394,7 +395,7 @@ bool RDPodcast::removePodcast() const rda->user()->password().toUtf8().constData(),CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"ID", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",podcast_id), + QString().sprintf("%u",podcast_id).toUtf8().constData(), CURLFORM_END); // @@ -407,7 +408,7 @@ bool RDPodcast::removePodcast() const curl_easy_setopt(curl,CURLOPT_WRITEDATA,stdout); curl_easy_setopt(curl,CURLOPT_HTTPPOST,first); curl_easy_setopt(curl,CURLOPT_USERAGENT, - (const char *)rda->config()->userAgent()); + rda->config()->userAgent().toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_NOPROGRESS,1); curl_easy_setopt(curl,CURLOPT_URL, @@ -469,7 +470,8 @@ bool RDPodcast::DeletePodcast(unsigned cast_id) const // curl_formadd(&first,&last,CURLFORM_PTRNAME,"COMMAND", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",RDXPORT_COMMAND_DELETE_PODCAST), + QString().sprintf("%u",RDXPORT_COMMAND_DELETE_PODCAST).toUtf8(). + constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"LOGIN_NAME", CURLFORM_COPYCONTENTS,rda->user()->name().toUtf8().constData(), @@ -479,7 +481,7 @@ bool RDPodcast::DeletePodcast(unsigned cast_id) const rda->user()->password().toUtf8().constData(),CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"ID", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",cast_id), + QString().sprintf("%u",cast_id).toUtf8().constData(), CURLFORM_END); // @@ -492,7 +494,7 @@ bool RDPodcast::DeletePodcast(unsigned cast_id) const curl_easy_setopt(curl,CURLOPT_WRITEDATA,stdout); curl_easy_setopt(curl,CURLOPT_HTTPPOST,first); curl_easy_setopt(curl,CURLOPT_USERAGENT, - (const char *)rda->config()->userAgent()); + rda->config()->userAgent().toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_NOPROGRESS,1); curl_easy_setopt(curl,CURLOPT_URL, diff --git a/lib/rdpodcastfilter.cpp b/lib/rdpodcastfilter.cpp index db8be2df..136d1289 100644 --- a/lib/rdpodcastfilter.cpp +++ b/lib/rdpodcastfilter.cpp @@ -34,7 +34,7 @@ RDPodcastFilter::RDPodcastFilter(QWidget *parent) // Filter Phrase // d_filter_edit=new QLineEdit(this); - d_filter_label=new QLabel(d_filter_edit,tr("Filter:"),this); + d_filter_label=new QLabel(tr("Filter:"),this); d_filter_label->setFont(labelFont()); d_filter_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); connect(d_filter_edit,SIGNAL(textChanged(const QString &)), @@ -44,8 +44,7 @@ RDPodcastFilter::RDPodcastFilter(QWidget *parent) // Show Audio Carts Checkbox // d_showactive_check=new QCheckBox(this); - d_showactive_label= - new QLabel(d_showactive_check,tr("Only Show Active Items"),this); + d_showactive_label=new QLabel(tr("Only Show Active Items"),this); d_showactive_label->setFont(labelFont()); d_showactive_label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); connect(d_showactive_check,SIGNAL(stateChanged(int)), diff --git a/lib/rdprofile.cpp b/lib/rdprofile.cpp index e5fb860e..09c76e9f 100644 --- a/lib/rdprofile.cpp +++ b/lib/rdprofile.cpp @@ -146,13 +146,13 @@ bool RDProfile::setSource(const QString &filename) profile_section.push_back(RDProfileSection()); profile_section.back().setName(section); } - else if(((offset=line.find('='))!=-1)) { + else if(((offset=line.indexOf('='))!=-1)) { profile_section.back(). addValue(line.left(offset), - line.right(line.length()-offset-1).stripWhiteSpace()); + line.right(line.length()-offset-1).trimmed()); } } - line=text->readLine().stripWhiteSpace(); + line=text->readLine().trimmed(); } delete text; delete file; @@ -179,10 +179,10 @@ void RDProfile::setSourceString(const QString &str) profile_section.push_back(RDProfileSection()); profile_section.back().setName(section); } - else if(((offset=line.find('='))!=-1)) { + else if(((offset=line.indexOf('='))!=-1)) { profile_section.back(). addValue(line.left(offset), - line.right(line.length()-offset-1).stripWhiteSpace()); + line.right(line.length()-offset-1).trimmed()); } } } @@ -240,7 +240,7 @@ int RDProfile::hexValue(QString section,QString tag, bool valid; QString str=stringValue(section,tag); - if(str.left(2).lower()=="0x") { + if(str.left(2).toLower()=="0x") { str=str.right(str.length()-2); } int result=str.toInt(&valid,16); @@ -300,7 +300,7 @@ bool RDProfile::boolValue(QString section,QString tag, { bool valid; - QString str=stringValue(section,tag,"",&valid).lower(); + QString str=stringValue(section,tag,"",&valid).toLower(); if(!valid) { if(ok!=NULL) { *ok=false; diff --git a/lib/rdpushbutton.cpp b/lib/rdpushbutton.cpp index 3cbf95ec..be2e3b01 100644 --- a/lib/rdpushbutton.cpp +++ b/lib/rdpushbutton.cpp @@ -2,7 +2,7 @@ // // A flashing button widget. // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License @@ -21,7 +21,6 @@ #include #include #include -#include #include #include //Added by qt3to4: @@ -94,7 +93,7 @@ void RDPushButton::setFlashColor(QColor color) int v=0; flash_color=color; - flash_palette=QPalette(QColor(flash_color),backgroundColor()); + flash_palette=QPalette(QColor(flash_color),palette().color(QPalette::Background)); color.getHsv(&h,&s,&v); if((h>180)&&(h<300)) { @@ -110,8 +109,8 @@ void RDPushButton::setFlashColor(QColor color) } s=0; color.setHsv(h,s,v); - flash_palette.setColor(QPalette::Active,QColorGroup::ButtonText,color); - flash_palette.setColor(QPalette::Inactive,QColorGroup::ButtonText,color); + flash_palette.setColor(QPalette::Active,QPalette::ButtonText,color); + flash_palette.setColor(QPalette::Inactive,QPalette::ButtonText,color); } @@ -216,7 +215,8 @@ void RDPushButton::setFlashPeriod(int period) { flash_period=period; if(flash_timer->isActive()) { - flash_timer->changeInterval(flash_period); + flash_timer->stop(); + flash_timer->start(flash_period); } } @@ -247,7 +247,6 @@ void RDPushButton::tickClock() if(!flashing_enabled) { return; } - QKeySequence a=accel(); if(flash_state) { flash_state=false; QPushButton::setPalette(flash_palette); @@ -256,7 +255,6 @@ void RDPushButton::tickClock() flash_state=true; QPushButton::setPalette(off_palette); } - setAccel(a); } @@ -265,7 +263,6 @@ void RDPushButton::tickClock(bool state) if(!flashing_enabled) { return; } - QKeySequence a=accel(); if(state) { flash_state=false; QPushButton::setPalette(flash_palette); @@ -274,7 +271,6 @@ void RDPushButton::tickClock(bool state) flash_state=true; QPushButton::setPalette(off_palette); } - setAccel(a); } diff --git a/lib/rdrehash.cpp b/lib/rdrehash.cpp index f7c7c816..8980500d 100644 --- a/lib/rdrehash.cpp +++ b/lib/rdrehash.cpp @@ -68,7 +68,6 @@ RDRehash::ErrorCode RDRehash::runRehash(const QString &username, { long response_code; CURL *curl=NULL; - char url[1024]; CURLcode curl_err; struct curl_httppost *first=NULL; struct curl_httppost *last=NULL; @@ -78,36 +77,34 @@ RDRehash::ErrorCode RDRehash::runRehash(const QString &username, // curl_formadd(&first,&last,CURLFORM_PTRNAME,"COMMAND", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",RDXPORT_COMMAND_REHASH), + QString().sprintf("%u",RDXPORT_COMMAND_REHASH).toUtf8(). + constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"LOGIN_NAME", - CURLFORM_COPYCONTENTS,(const char *)username.utf8(),CURLFORM_END); + CURLFORM_COPYCONTENTS,username.toUtf8().constData(), + CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"PASSWORD", - CURLFORM_COPYCONTENTS,(const char *)password.utf8(),CURLFORM_END); + CURLFORM_COPYCONTENTS,password.toUtf8().constData(), + CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"CART_NUMBER", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_cart_number), + QString().sprintf("%u",conv_cart_number).toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"CUT_NUMBER", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_cut_number), + QString().sprintf("%u",conv_cut_number).toUtf8().constData(), CURLFORM_END); if((curl=curl_easy_init())==NULL) { curl_formfree(first); return RDRehash::ErrorInternal; } - // - // Write out URL as a C string before passing to curl_easy_setopt(), - // otherwise some versions of LibCurl will throw a 'bad/illegal format' - // error. - // - strncpy(url,conv_station->webServiceUrl(conv_config),1024); - curl_easy_setopt(curl,CURLOPT_URL,url); + curl_easy_setopt(curl,CURLOPT_URL, + conv_station->webServiceUrl(conv_config).toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,__RDRehashCallback); curl_easy_setopt(curl,CURLOPT_HTTPPOST,first); curl_easy_setopt(curl,CURLOPT_USERAGENT, - (const char *)conv_config->userAgent()); + conv_config->userAgent().toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); switch(curl_err=curl_easy_perform(curl)) { diff --git a/lib/rdrenderer.cpp b/lib/rdrenderer.cpp index 419aee11..47831930 100644 --- a/lib/rdrenderer.cpp +++ b/lib/rdrenderer.cpp @@ -113,7 +113,7 @@ bool __RDRenderLogLine::open(const QTime &time) QString filename; if(GetCutFile(cutname,ll_cut->startPoint(),ll_cut->endPoint(), &filename)) { - ll_handle=sf_open(filename,SFM_READ,&sf_info); + ll_handle=sf_open(filename.toUtf8(),SFM_READ,&sf_info); if(ll_handle!=NULL) { DeleteCutFile(filename); return true; @@ -182,7 +182,8 @@ bool __RDRenderLogLine::GetCutFile(const QString &cutname,int start_pt, RDAudioExport::ErrorCode export_err; char tempdir[PATH_MAX]; - strncpy(tempdir,RDTempDirectory::basePath()+"/rdrenderXXXXXX",PATH_MAX); + strncpy(tempdir,(RDTempDirectory::basePath()+"/rdrenderXXXXXX").toUtf8(), + PATH_MAX); *dest_filename=QString(mkdtemp(tempdir))+"/"+cutname+".wav"; RDAudioExport *conv=new RDAudioExport(); conv->setDestinationFile(*dest_filename); @@ -216,10 +217,10 @@ bool __RDRenderLogLine::GetCutFile(const QString &cutname,int start_pt, void __RDRenderLogLine::DeleteCutFile(const QString &dest_filename) const { - unlink(dest_filename); + unlink(dest_filename.toUtf8()); QStringList f0=dest_filename.split("/"); - f0.erase(f0.fromLast()); - rmdir("/"+f0.join("/")); + f0.erase(f0.end()); + rmdir(("/"+f0.join("/")).toUtf8()); } @@ -258,7 +259,7 @@ bool RDRenderer::renderToFile(const QString &outfile,RDLogModel *model, // // Verify Destination // - if((f=fopen(outfile,"w"))==NULL) { + if((f=fopen(outfile.toUtf8(),"w"))==NULL) { *err_msg=tr("unable to open output file")+" ["+QString(strerror(errno))+"]"; return false; } @@ -272,7 +273,8 @@ bool RDRenderer::renderToFile(const QString &outfile,RDLogModel *model, // // Get Temporary File // - strncpy(tempdir,RDTempDirectory::basePath()+"/rdrenderXXXXXX",PATH_MAX); + strncpy(tempdir,(RDTempDirectory::basePath()+"/rdrenderXXXXXX").toUtf8(), + PATH_MAX); temp_output_filename=QString(mkdtemp(tempdir))+"/log.wav"; ProgressMessage(tr("Using temporary file")+" \""+temp_output_filename+"\"."); @@ -354,7 +356,8 @@ bool RDRenderer::renderToCart(unsigned cartnum,int cutnum,RDLogModel *model, // // Get Temporary File // - strncpy(tempdir,RDTempDirectory::basePath()+"/rdrenderXXXXXX",PATH_MAX); + strncpy(tempdir,(RDTempDirectory::basePath()+"/rdrenderXXXXXX").toUtf8(), + PATH_MAX); temp_output_filename=QString(mkdtemp(tempdir))+"/log.wav"; ProgressMessage(tr("Using temporary file")+" \""+temp_output_filename+"\"."); @@ -428,7 +431,7 @@ bool RDRenderer::Render(const QString &outfile,RDLogModel *model,RDSettings *s, else { sf_info.format=SF_FORMAT_WAV|SF_FORMAT_PCM_24; } - sf_out=sf_open(outfile,SFM_WRITE,&sf_info); + sf_out=sf_open(outfile.toUtf8(),SFM_WRITE,&sf_info); if(sf_out==NULL) { fprintf(stderr,"rdrender: unable to open output file [%s]\n", sf_strerror(sf_out)); @@ -631,10 +634,10 @@ bool RDRenderer::ImportCart(const QString &srcfile,unsigned cartnum,int cutnum, void RDRenderer::DeleteTempFile(const QString &filename) const { - unlink(filename); + unlink(filename.toUtf8()); QStringList f0=filename.split("/"); - f0.erase(f0.fromLast()); - rmdir("/"+f0.join("/")); + f0.erase(f0.end()); + rmdir(("/"+f0.join("/")).toUtf8()); } @@ -655,6 +658,6 @@ void RDRenderer::ProgressMessage(const QTime &time,int line, { QString str=QString().sprintf("%04d : ",line)+ time.toString("hh:mm:ss")+" : "+ - QString().sprintf("%-5s",(const char *)trans)+msg; + QString().sprintf("%-5s",trans.toUtf8().constData())+msg; emit progressMessageSent(str); } diff --git a/lib/rdreport.cpp b/lib/rdreport.cpp index abb3190e..5a049bc3 100644 --- a/lib/rdreport.cpp +++ b/lib/rdreport.cpp @@ -666,7 +666,7 @@ bool RDReport::generateReport(const QDate &startdate,const QDate &enddate, report_config,serviceName()); QString post_cmd=RDDateDecode(postExportCommand(RDReport::Linux),startdate, report_station,report_config,serviceName()); - system(post_cmd); + system(post_cmd.toUtf8()); sql=QString("delete from ELR_LINES where ")+ "SERVICE_NAME=\""+RDEscapeString(mixname)+"\""; RDSqlQuery::apply(sql); diff --git a/lib/rdripc.cpp b/lib/rdripc.cpp index 3be58866..d07b202c 100644 --- a/lib/rdripc.cpp +++ b/lib/rdripc.cpp @@ -90,7 +90,7 @@ void RDRipc::setIgnoreMask(bool state) } -void RDRipc::connectHost(QString hostname,Q_UINT16 hostport,QString password) +void RDRipc::connectHost(QString hostname,uint16_t hostport,QString password) { ripc_password=password; ripc_socket->connectToHost(hostname,hostport); @@ -163,7 +163,7 @@ void RDRipc::sendOnairFlag() void RDRipc::sendRml(RDMacro *macro) { QString cmd; - Q_UINT16 port=RD_RML_NOECHO_PORT; + uint16_t port=RD_RML_NOECHO_PORT; QDateTime now=QDateTime::currentDateTime(); if(macro->echoRequested()) { @@ -221,12 +221,12 @@ void RDRipc::readyData() QString line=QString::fromUtf8(data); for(int i=0;i +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License @@ -18,28 +18,15 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include -#include -#include -#include -#include -//Added by qt3to4: -#include -#include -#include -#include -#include -#include -#include - -#include +#include "rdsegmeter.h" RDSegMeter::RDSegMeter(RDSegMeter::Orientation o,QWidget *parent) : QWidget(parent) { orient=o; - setBackgroundColor(Qt::black); + QPalette pal=palette(); + pal.setColor(QPalette::Background,Qt::black); + setPalette(pal); dark_low_color=QColor(DEFAULT_DARK_LOW_COLOR); dark_high_color=QColor(DEFAULT_DARK_HIGH_COLOR); dark_clip_color=QColor(DEFAULT_DARK_CLIP_COLOR); @@ -56,7 +43,7 @@ RDSegMeter::RDSegMeter(RDSegMeter::Orientation o,QWidget *parent) floating_bar=-10000; seg_mode=RDSegMeter::Independent; - peak_timer=new QTimer(this,"peak_timer"); + peak_timer=new QTimer(this); connect(peak_timer,SIGNAL(timeout()),this,SLOT(peakData())); } @@ -77,7 +64,7 @@ void RDSegMeter::setRange(int min,int max) { range_min=min; range_max=max; - repaint(false); + repaint(); } @@ -85,7 +72,7 @@ void RDSegMeter::setDarkLowColor(QColor color) { if(dark_low_color!=color) { dark_low_color=color; - repaint(false); + repaint(); } } @@ -94,7 +81,7 @@ void RDSegMeter::setDarkHighColor(QColor color) { if(dark_high_color!=color) { dark_high_color=color; - repaint(false); + repaint(); } } @@ -103,7 +90,7 @@ void RDSegMeter::setDarkClipColor(QColor color) { if(dark_clip_color!=color) { dark_clip_color=color; - repaint(false); + repaint(); } } @@ -112,7 +99,7 @@ void RDSegMeter::setLowColor(QColor color) { if(low_color!=color) { low_color=color; - repaint(false); + repaint(); } } @@ -121,7 +108,7 @@ void RDSegMeter::setHighColor(QColor color) { if(high_color!=color) { high_color=color; - repaint(false); + repaint(); } } @@ -130,7 +117,7 @@ void RDSegMeter::setClipColor(QColor color) { if(clip_color!=color) { clip_color=color; - repaint(false); + repaint(); } } @@ -139,7 +126,7 @@ void RDSegMeter::setHighThreshold(int level) { if(high_threshold!=level) { high_threshold=level; - repaint(false); + repaint(); } } @@ -148,7 +135,7 @@ void RDSegMeter::setClipThreshold(int level) { if(clip_threshold!=level) { clip_threshold=level; - repaint(false); + repaint(); } } @@ -181,7 +168,7 @@ void RDSegMeter::setSolidBar(int level) { if((seg_mode==RDSegMeter::Independent)&&(solid_bar!=level)) { solid_bar=level; - repaint(false); + repaint(); } } @@ -190,7 +177,7 @@ void RDSegMeter::setFloatingBar(int level) { if((seg_mode==RDSegMeter::Independent)&&(solid_bar!=level)) { floating_bar=level; - repaint(false); + repaint(); } } @@ -206,7 +193,7 @@ void RDSegMeter::setPeakBar(int level) if(solid_bar +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License @@ -21,14 +21,9 @@ #ifndef RDSEGMETER_H #define RDSEGMETER_H -#include -#include -#include -#include -#include -#include -//Added by qt3to4: -#include +#include +#include +#include /* * Default Colors diff --git a/lib/rdsettings.cpp b/lib/rdsettings.cpp index 17849495..7503d70c 100644 --- a/lib/rdsettings.cpp +++ b/lib/rdsettings.cpp @@ -294,12 +294,12 @@ bool RDSettings::deletePreset(unsigned id) const QString RDSettings::pathName(QString pathname,RDSettings::Format fmt) { QString ext; - int index=pathname.findRev("."); + int index=pathname.lastIndexOf("."); if(index<0) { return pathname+"."+defaultExtension(fmt); } ext=pathname.right(pathname.length()-index); - if(ext.lower()==defaultExtension(fmt)) { + if(ext.toLower()==defaultExtension(fmt)) { return pathname; } return pathname.replace(index,ext.length(),"."+defaultExtension(fmt)); diff --git a/lib/rdslider.cpp b/lib/rdslider.cpp index 310e1413..c682b97d 100644 --- a/lib/rdslider.cpp +++ b/lib/rdslider.cpp @@ -92,13 +92,13 @@ void RDSlider::setTickmarks(RDSlider::TickSetting s) void RDSlider::setMinValue(int min_value) { - setRange(min_value,maxValue()); + setRange(min_value,maximum()); } void RDSlider::setMaxValue(int max_value) { - setRange(minValue(),max_value); + setRange(minimum(),max_value); } @@ -123,17 +123,17 @@ void RDSlider::setPageStep(int step) } -void RDSlider::setKnobColor(QColorGroup group) +void RDSlider::setKnobColor(const QPalette &pal) { - knob_color=group; + knob_color=pal; calcKnob(); update(); } -void RDSlider::setKnobColor(QColor color) +void RDSlider::setKnobColor(const QColor &color) { - knob_color.setColor(QColorGroup::Background,color); + knob_color.setColor(QPalette::Background,color); calcKnob(); update(); } @@ -201,9 +201,9 @@ void RDSlider::paintEvent(QPaintEvent *paintEvent) // // The groove // - p->setPen(QColor(colorGroup().dark())); + p->setPen(QColor(palette().dark().color())); p->drawLine(width()/2,knob_size.height()/2,width()/2,height()-knob_size.height()/2); - p->setPen(QColor(colorGroup().shadow())); + p->setPen(QColor(palette().shadow().color())); p->drawLine(width()/2-1,height()-knob_size.height()/2+1,width()/2-1,knob_size.height()/2-1); p->drawLine(width()/2-1,knob_size.height()/2-1,width()/2+1,knob_size.height()/2-1); @@ -213,20 +213,20 @@ void RDSlider::paintEvent(QPaintEvent *paintEvent) switch(rdslider_orient) { case RDSlider::Up: if((tick_setting==RDSlider::TicksLeft)||(tick_setting==RDSlider::TicksBothSides)) { - p->setPen(colorGroup().shadow()); - for(int i=minValue();i<=maxValue();i+=tick_interval) { + p->setPen(palette().shadow().color()); + for(int i=minimum();i<=maximum();i+=tick_interval) { tick_y=(geometry().height()-curr_knob.height())- - ((geometry().height()-curr_knob.height())*(i-minValue()))/ - (maxValue()-minValue())+curr_knob.height()/2; + ((geometry().height()-curr_knob.height())*(i-minimum()))/ + (maximum()-minimum())+curr_knob.height()/2; p->drawLine(0,tick_y,width()/2-2,tick_y); } } if((tick_setting==RDSlider::TicksRight)||(tick_setting==RDSlider::TicksBothSides)) { - p->setPen(colorGroup().shadow()); - for(int i=minValue();i<=maxValue();i+=tick_interval) { + p->setPen(palette().shadow().color()); + for(int i=minimum();i<=maximum();i+=tick_interval) { tick_y=(geometry().height()-curr_knob.height())- - ((geometry().height()-curr_knob.height())*(i-minValue()))/ - (maxValue()-minValue())+curr_knob.height()/2; + ((geometry().height()-curr_knob.height())*(i-minimum()))/ + (maximum()-minimum())+curr_knob.height()/2; p->drawLine(width()/2+2,tick_y,width(),tick_y); } } @@ -234,20 +234,20 @@ void RDSlider::paintEvent(QPaintEvent *paintEvent) case RDSlider::Down: if((tick_setting==RDSlider::TicksLeft)||(tick_setting==RDSlider::TicksBothSides)) { - p->setPen(colorGroup().shadow()); - for(int i=minValue();i<=maxValue();i+=tick_interval) { + p->setPen(palette().shadow().color()); + for(int i=minimum();i<=maximum();i+=tick_interval) { tick_y=(geometry().height()-curr_knob.height()/2)- abs((geometry().height()-curr_knob.height())*i)/ - (maxValue()-minValue()); + (maximum()-minimum()); p->drawLine(0,tick_y,width()/2-2,tick_y); } } if((tick_setting==RDSlider::TicksRight)||(tick_setting==RDSlider::TicksBothSides)) { - p->setPen(colorGroup().shadow()); - for(int i=minValue();i<=maxValue();i+=tick_interval) { + p->setPen(palette().shadow().color()); + for(int i=minimum();i<=maximum();i+=tick_interval) { tick_y=(geometry().height()-curr_knob.height()/2)- abs((geometry().height()-curr_knob.height())*i)/ - (maxValue()-minValue()); + (maximum()-minimum()); p->drawLine(width()/2+2,tick_y,width(),tick_y); } } @@ -261,13 +261,13 @@ void RDSlider::paintEvent(QPaintEvent *paintEvent) // // The groove // - p->setPen(QColor(colorGroup().light())); + p->setPen(QColor(palette().light().color())); p->drawLine(knob_size.width()/2,height()/2+1, width()-knob_size.width()/2,height()/2+1); - p->setPen(QColor(colorGroup().dark())); + p->setPen(QColor(palette().dark().color())); p->drawLine(knob_size.width()/2,height()/2, width()-knob_size.width()/2,height()/2); - p->setPen(QColor(colorGroup().shadow())); + p->setPen(QColor(palette().shadow().color())); p->drawLine(width()-knob_size.width()/2+1,height()/2-1, knob_size.width()/2-1,height()/2-1); @@ -277,40 +277,40 @@ void RDSlider::paintEvent(QPaintEvent *paintEvent) switch(rdslider_orient) { case RDSlider::Left: if((tick_setting==RDSlider::TicksAbove)||(tick_setting==RDSlider::TicksBothSides)) { - p->setPen(colorGroup().shadow()); - for(int i=minValue();i<=maxValue();i+=tick_interval) { + p->setPen(palette().shadow().color()); + for(int i=minimum();i<=maximum();i+=tick_interval) { tick_x=(geometry().width()-curr_knob.width())- - ((geometry().width()-curr_knob.width())*(i-minValue()))/ - (maxValue()-minValue())+curr_knob.width()/2; + ((geometry().width()-curr_knob.width())*(i-minimum()))/ + (maximum()-minimum())+curr_knob.width()/2; p->drawLine(tick_x,0,tick_x,height()/2-2); } } if((tick_setting==RDSlider::TicksBelow)||(tick_setting==RDSlider::TicksBothSides)) { - p->setPen(colorGroup().shadow()); - for(int i=minValue();i<=maxValue();i+=tick_interval) { + p->setPen(palette().shadow().color()); + for(int i=minimum();i<=maximum();i+=tick_interval) { tick_x=(geometry().width()-curr_knob.width())- - ((geometry().width()-curr_knob.width())*(i-minValue()))/ - (maxValue()-minValue())+curr_knob.width()/2; + ((geometry().width()-curr_knob.width())*(i-minimum()))/ + (maximum()-minimum())+curr_knob.width()/2; p->drawLine(tick_x,height()/2+2,tick_x,height()); } } break; case RDSlider::Right: if((tick_setting==RDSlider::TicksAbove)||(tick_setting==RDSlider::TicksBothSides)) { - p->setPen(colorGroup().shadow()); - for(int i=minValue();i<=maxValue();i+=tick_interval) { + p->setPen(palette().shadow().color()); + for(int i=minimum();i<=maximum();i+=tick_interval) { tick_x=(geometry().width()-curr_knob.width()/2)- abs((geometry().width()-curr_knob.width())*i)/ - (maxValue()-minValue()); + (maximum()-minimum()); p->drawLine(tick_x,0,tick_x,height()/2-2); } } if((tick_setting==RDSlider::TicksBelow)||(tick_setting==RDSlider::TicksBothSides)) { - p->setPen(colorGroup().shadow()); - for(int i=minValue();i<=maxValue();i+=tick_interval) { + p->setPen(palette().shadow().color()); + for(int i=minimum();i<=maximum();i+=tick_interval) { tick_x=(geometry().width()-curr_knob.width()/2)- abs((geometry().width()-curr_knob.width())*i)/ - (maxValue()-minValue()); + (maximum()-minimum()); p->drawLine(tick_x,height()/2+2,tick_x,height()); } } @@ -343,8 +343,8 @@ void RDSlider::mouseMoveEvent(QMouseEvent *mouse) if(prev_knob!=curr_knob) { switch(rdslider_orient) { case RDSlider::Up: - if(value()!=maxValue()) { - QAbstractSlider::setValue(maxValue()); + if(value()!=maximum()) { + QAbstractSlider::setValue(maximum()); if(tracking_enabled) { emit valueChanged(value()); } @@ -354,8 +354,8 @@ void RDSlider::mouseMoveEvent(QMouseEvent *mouse) } break; case RDSlider::Down: - if(value()!=minValue()) { - QAbstractSlider::setValue(minValue()); + if(value()!=minimum()) { + QAbstractSlider::setValue(minimum()); if(tracking_enabled) { emit valueChanged(value()); } @@ -380,8 +380,8 @@ void RDSlider::mouseMoveEvent(QMouseEvent *mouse) if(prev_knob!=curr_knob) { switch(rdslider_orient) { case RDSlider::Up: - if(value()!=minValue()) { - QAbstractSlider::setValue(minValue()); + if(value()!=minimum()) { + QAbstractSlider::setValue(minimum()); if(tracking_enabled) { emit valueChanged(value()); } @@ -391,8 +391,8 @@ void RDSlider::mouseMoveEvent(QMouseEvent *mouse) } break; case RDSlider::Down: - if(value()!=maxValue()) { - QAbstractSlider::setValue(maxValue()); + if(value()!=maximum()) { + QAbstractSlider::setValue(maximum()); if(tracking_enabled) { emit valueChanged(value()); } @@ -423,11 +423,11 @@ void RDSlider::mouseMoveEvent(QMouseEvent *mouse) base_y=mouse->y(); switch(rdslider_orient) { case RDSlider::Up: - knob_value=(maxValue()-minValue())* + knob_value=(maximum()-minimum())* (geometry().height()-curr_knob.y() -curr_knob.height())/ (geometry().height()-curr_knob.height()) - +minValue(); + +minimum(); if(value()!=knob_value) { QAbstractSlider::setValue(knob_value); if(tracking_enabled) { @@ -439,11 +439,11 @@ void RDSlider::mouseMoveEvent(QMouseEvent *mouse) } break; case RDSlider::Down: - knob_value=((minValue()-maxValue())* + knob_value=((minimum()-maximum())* curr_knob.y() +curr_knob.height()-geometry().height())/ (curr_knob.height()-geometry().height()) - +minValue(); + +minimum(); if(value()!=knob_value) { QAbstractSlider::setValue(knob_value); if(tracking_enabled) { @@ -469,8 +469,8 @@ void RDSlider::mouseMoveEvent(QMouseEvent *mouse) if(prev_knob!=curr_knob) { switch(rdslider_orient) { case RDSlider::Left: - if(value()!=maxValue()) { - QAbstractSlider::setValue(maxValue()); + if(value()!=maximum()) { + QAbstractSlider::setValue(maximum()); if(tracking_enabled) { emit valueChanged(value()); } @@ -480,8 +480,8 @@ void RDSlider::mouseMoveEvent(QMouseEvent *mouse) } break; case RDSlider::Right: - if(value()!=minValue()) { - QAbstractSlider::setValue(minValue()); + if(value()!=minimum()) { + QAbstractSlider::setValue(minimum()); if(tracking_enabled) { emit valueChanged(value()); } @@ -506,8 +506,8 @@ void RDSlider::mouseMoveEvent(QMouseEvent *mouse) if(prev_knob!=curr_knob) { switch(rdslider_orient) { case RDSlider::Left: - if(value()!=minValue()) { - QAbstractSlider::setValue(minValue()); + if(value()!=minimum()) { + QAbstractSlider::setValue(minimum()); if(tracking_enabled) { emit valueChanged(value()); } @@ -517,8 +517,8 @@ void RDSlider::mouseMoveEvent(QMouseEvent *mouse) } break; case RDSlider::Right: - if(value()!=maxValue()) { - QAbstractSlider::setValue(maxValue()); + if(value()!=maximum()) { + QAbstractSlider::setValue(maximum()); if(tracking_enabled) { emit valueChanged(value()); } @@ -549,11 +549,11 @@ void RDSlider::mouseMoveEvent(QMouseEvent *mouse) base_x=mouse->x(); switch(rdslider_orient) { case RDSlider::Left: - knob_value=(maxValue()-minValue())* + knob_value=(maximum()-minimum())* (geometry().width()-curr_knob.x() -curr_knob.width())/ (geometry().width()-curr_knob.width()) - +minValue(); + +minimum(); if(value()!=knob_value) { QAbstractSlider::setValue(knob_value); if(tracking_enabled) { @@ -565,10 +565,10 @@ void RDSlider::mouseMoveEvent(QMouseEvent *mouse) } break; case RDSlider::Right: - knob_value=((minValue()-maxValue())*curr_knob.x() + knob_value=((minimum()-maximum())*curr_knob.x() +curr_knob.width()-geometry().width())/ (curr_knob.width()-geometry().width()) - +minValue(); + +minimum(); if(value()!=knob_value) { QAbstractSlider::setValue(knob_value); if(tracking_enabled) { @@ -632,7 +632,7 @@ void RDSlider::init(RDSlider::Orientation orient) { rdslider_orient=orient; knob_map=NULL; - knob_color=colorGroup(); + knob_color=palette(); rdslider_moving=false; page_step=10; line_step=1; @@ -669,12 +669,12 @@ void RDSlider::calcKnob(int x,int y,int w,int h) knob_x=w/2-knob_w/2; switch(rdslider_orient) { case RDSlider::Up: - knob_y=(h-knob_h)-((h-knob_h)*(value()-minValue()))/ - (maxValue()-minValue()); + knob_y=(h-knob_h)-((h-knob_h)*(value()-minimum()))/ + (maximum()-minimum()); break; case RDSlider::Down: - knob_y=-(h-knob_h-((h-knob_h)*(value()-minValue())))/ - (maxValue()-minValue()); + knob_y=-(h-knob_h-((h-knob_h)*(value()-minimum())))/ + (maximum()-minimum()); break; default: @@ -710,18 +710,18 @@ void RDSlider::calcKnob(int x,int y,int w,int h) delete knob_map; } knob_map=new QPixmap(curr_knob.size()); - knob_map->fill(knob_color.background()); + knob_map->fill(knob_color.color(QPalette::Background)); p.begin(knob_map); // // The outline // - p.setPen(knob_color.light()); + p.setPen(knob_color.light().color()); p.drawLine(0,curr_knob.height()-1,0,0); p.drawLine(0,0,curr_knob.width()-1,0); p.drawLine(1,curr_knob.height()-1,1,1); p.drawLine(1,1,curr_knob.width()-1,1); - p.setPen(knob_color.dark()); + p.setPen(knob_color.dark().color()); p.drawLine(curr_knob.width()-1,1,curr_knob.width()-1,curr_knob.height()-1); p.drawLine(curr_knob.width()-1,curr_knob.height()-1,0,curr_knob.height()-1); p.drawLine(curr_knob.width()-2,1,curr_knob.width()-2,curr_knob.height()-2); @@ -731,12 +731,12 @@ void RDSlider::calcKnob(int x,int y,int w,int h) // The centerline // if(curr_knob.height()>=40) { - p.setPen(knob_color.dark()); + p.setPen(knob_color.dark().color()); p.drawLine(2,curr_knob.height()/2,curr_knob.width()-2,curr_knob.height()/2); - p.setPen(knob_color.shadow()); + p.setPen(knob_color.shadow().color()); p.drawLine(2,curr_knob.height()/2-1, curr_knob.width()-2,curr_knob.height()/2-1); - p.setPen(knob_color.light()); + p.setPen(knob_color.light().color()); p.drawLine(2,curr_knob.height()/2+1, curr_knob.width()-2,curr_knob.height()/2+1); } @@ -751,12 +751,12 @@ void RDSlider::calcKnob(int x,int y,int w,int h) knob_y=h/2-knob_h/2; switch(rdslider_orient) { case RDSlider::Left: - knob_x=(w-knob_w)-((w-knob_w)*(value()-minValue()))/ - (maxValue()-minValue()); + knob_x=(w-knob_w)-((w-knob_w)*(value()-minimum()))/ + (maximum()-minimum()); break; case RDSlider::Right: - knob_x=-(w-knob_w-((w-knob_w)*(value()-minValue())))/ - (maxValue()-minValue()); + knob_x=-(w-knob_w-((w-knob_w)*(value()-minimum())))/ + (maximum()-minimum()); break; default: @@ -789,18 +789,18 @@ void RDSlider::calcKnob(int x,int y,int w,int h) delete knob_map; } knob_map=new QPixmap(curr_knob.size()); - knob_map->fill(knob_color.background()); + knob_map->fill(knob_color.color(QPalette::Background)); p.begin(knob_map); // // The outline // - p.setPen(knob_color.light()); + p.setPen(knob_color.light().color()); p.drawLine(0,curr_knob.height()-1,0,0); p.drawLine(0,0,curr_knob.width()-1,0); p.drawLine(1,curr_knob.height()-1,1,1); p.drawLine(1,1,curr_knob.width()-1,1); - p.setPen(knob_color.dark()); + p.setPen(knob_color.dark().color()); p.drawLine(curr_knob.width()-1,1,curr_knob.width()-1,curr_knob.height()-1); p.drawLine(curr_knob.width()-1,curr_knob.height()-1,0,curr_knob.height()-1); p.drawLine(curr_knob.width()-2,1,curr_knob.width()-2,curr_knob.height()-2); @@ -810,13 +810,13 @@ void RDSlider::calcKnob(int x,int y,int w,int h) // The centerline // if(curr_knob.width()>=40) { - p.setPen(knob_color.dark()); + p.setPen(knob_color.dark().color()); p.drawLine(curr_knob.width()/2,2, curr_knob.width()/2,curr_knob.height()-2); - p.setPen(knob_color.shadow()); + p.setPen(knob_color.shadow().color()); p.drawLine(curr_knob.width()/2-1,2, curr_knob.width()/2-1,curr_knob.height()-2); - p.setPen(knob_color.light()); + p.setPen(knob_color.light().color()); p.drawLine(curr_knob.width()/2+1,2, curr_knob.width()/2+1,curr_knob.height()-2); } diff --git a/lib/rdslider.h b/lib/rdslider.h index 0349435e..7a7e7785 100644 --- a/lib/rdslider.h +++ b/lib/rdslider.h @@ -45,8 +45,8 @@ class RDSlider : public QAbstractSlider void setRange(int min_value,int max_value); void setLineStep(int step); void setPageStep(int step); - void setKnobColor(QColorGroup group); - void setKnobColor(QColor color); + void setKnobColor(const QPalette &pal); + void setKnobColor(const QColor &color); void setKnobSize(QSize size); void setKnobSize(int w,int h); @@ -72,7 +72,7 @@ class RDSlider : public QAbstractSlider void calcKnob(); void calcKnob(int x,int y,int w,int h); RDSlider::Orientation rdslider_orient; - QColorGroup knob_color; + QPalette knob_color; QRect curr_knob; QRect prev_knob; QRect page_up; diff --git a/lib/rdslotbox.cpp b/lib/rdslotbox.cpp index d36cf9f5..fb5ca9a0 100644 --- a/lib/rdslotbox.cpp +++ b/lib/rdslotbox.cpp @@ -18,6 +18,9 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // +#include +#include + #include "rdcartdrag.h" #include "rdconf.h" #include "rdslotbox.h" @@ -45,44 +48,44 @@ RDSlotBox::RDSlotBox(RDPlayDeck *deck,RDAirPlayConf *conf,QWidget *parent) // Create Palettes // line_unchanged_stop_palette=palette(); - line_unchanged_stop_palette.setColor(QPalette::Active,QColorGroup::Highlight, + line_unchanged_stop_palette.setColor(QPalette::Active,QPalette::Highlight, QColor(BAR_UNCHANGED_STOPPING_COLOR)); line_unchanged_stop_palette.setColor(QPalette::Inactive, - QColorGroup::Highlight, + QPalette::Highlight, QColor(BAR_UNCHANGED_STOPPING_COLOR)); line_unchanged_play_palette=palette(); - line_unchanged_play_palette.setColor(QPalette::Active,QColorGroup::Highlight, + line_unchanged_play_palette.setColor(QPalette::Active,QPalette::Highlight, QColor(BAR_UNCHANGED_TRANSITION_COLOR)); line_unchanged_play_palette.setColor(QPalette::Inactive, - QColorGroup::Highlight, + QPalette::Highlight, QColor(BAR_UNCHANGED_TRANSITION_COLOR)); line_changed_stop_palette=palette(); - line_changed_stop_palette.setColor(QPalette::Active,QColorGroup::Highlight, + line_changed_stop_palette.setColor(QPalette::Active,QPalette::Highlight, QColor(BAR_CHANGED_STOPPING_COLOR)); - line_changed_stop_palette.setColor(QPalette::Inactive,QColorGroup::Highlight, + line_changed_stop_palette.setColor(QPalette::Inactive,QPalette::Highlight, QColor(BAR_CHANGED_STOPPING_COLOR)); line_changed_play_palette=palette(); - line_changed_play_palette.setColor(QPalette::Active,QColorGroup::Highlight, + line_changed_play_palette.setColor(QPalette::Active,QPalette::Highlight, QColor(BAR_CHANGED_TRANSITION_COLOR)); - line_changed_play_palette.setColor(QPalette::Inactive,QColorGroup::Highlight, + line_changed_play_palette.setColor(QPalette::Inactive,QPalette::Highlight, QColor(BAR_CHANGED_TRANSITION_COLOR)); line_time_palette=palette(); line_hard_palette=palette(); - line_hard_palette.setColor(QPalette::Active,QColorGroup::Foreground, + line_hard_palette.setColor(QPalette::Active,QPalette::Foreground, QColor(LOG_HARDTIME_TEXT_COLOR)); - line_hard_palette.setColor(QPalette::Inactive,QColorGroup::Foreground, + line_hard_palette.setColor(QPalette::Inactive,QPalette::Foreground, QColor(LOG_HARDTIME_TEXT_COLOR)); line_timescale_palette=palette(); - line_timescale_palette.setColor(QPalette::Active,QColorGroup::Foreground, + line_timescale_palette.setColor(QPalette::Active,QPalette::Foreground, QColor(LABELBOX_TIMESCALE_COLOR)); - line_timescale_palette.setColor(QPalette::Inactive,QColorGroup::Foreground, + line_timescale_palette.setColor(QPalette::Inactive,QPalette::Foreground, QColor(LABELBOX_TIMESCALE_COLOR)); line_text_palette=palette(); - line_text_palette.setColor(QPalette::Active,QColorGroup::Foreground, + line_text_palette.setColor(QPalette::Active,QPalette::Foreground, QColor(Qt::black)); - line_text_palette.setColor(QPalette::Inactive,QColorGroup::Foreground, + line_text_palette.setColor(QPalette::Inactive,QPalette::Foreground, QColor(Qt::black)); // @@ -300,7 +303,7 @@ void RDSlotBox::setCart(RDLogLine *logline) } line_group_label->setText(cart->groupName()); p=line_group_label->palette(); - p.setColor(QColorGroup::Foreground,line_logline->groupColor()); + p.setColor(QPalette::Foreground,line_logline->groupColor()); line_group_label->setPalette(p); if(line_logline->talkLength()<=0) { line_talktime_label->setText(":00"); @@ -391,7 +394,7 @@ void RDSlotBox::setCart(RDLogLine *logline) line_cut_label->setText(""); line_group_label->setText(cart->groupName()); p=line_group_label->palette(); - p.setColor(QColorGroup::Foreground,line_logline->groupColor()); + p.setColor(QPalette::Foreground,line_logline->groupColor()); line_group_label->setPalette(p); line_length_label-> setText(RDGetTimeLength(line_logline->effectiveLength(), @@ -502,7 +505,7 @@ void RDSlotBox::mousePressEvent(QMouseEvent *e) RDCartDrag *cd= new RDCartDrag(line_logline->cartNumber(),line_logline->title(), line_group_label-> - palette().color(QColorGroup::Foreground)); + palette().color(QPalette::Foreground)); drag->setMimeData(cd); drag->setPixmap(*line_icon_label->pixmap()); drag->exec(); @@ -522,7 +525,7 @@ void RDSlotBox::paintEvent(QPaintEvent *e) QPainter *p=new QPainter(this); p->drawRect(0,0,sizeHint().width()-1,sizeHint().height()-1); p->fillRect(1,1,sizeHint().width()-3,sizeHint().height()-3, - backgroundColor()); + palette().color(QPalette::Background)); p->end(); delete p; } @@ -530,9 +533,11 @@ void RDSlotBox::paintEvent(QPaintEvent *e) void RDSlotBox::dragEnterEvent(QDragEnterEvent *e) { - e->accept(RDCartDrag::canDecode(e)&& - (line_mode==RDSlotOptions::CartDeckMode)&& - (line_deck->state()==RDPlayDeck::Stopped)); + if(RDCartDrag::canDecode(e)&& + (line_mode==RDSlotOptions::CartDeckMode)&& + (line_deck->state()==RDPlayDeck::Stopped)) { + e->accept(); + } } @@ -548,7 +553,11 @@ void RDSlotBox::dropEvent(QDropEvent *e) void RDSlotBox::SetColor(QColor color) { - setBackgroundColor(color); + QPalette pal=palette(); + pal.setColor(QPalette::Background,color); + setPalette(pal); + // setBackgroundColor(color); + /* line_cart_label->setBackgroundColor(color); line_cart_label->setPalette(line_text_palette); line_cut_label->setBackgroundColor(color); @@ -572,4 +581,5 @@ void RDSlotBox::SetColor(QColor color) line_down_label->setBackgroundColor(color); line_down_label->setPalette(line_text_palette); line_icon_label->setBackgroundColor(color); + */ } diff --git a/lib/rdslotdialog.cpp b/lib/rdslotdialog.cpp index ef6bcce2..828e34eb 100644 --- a/lib/rdslotdialog.cpp +++ b/lib/rdslotdialog.cpp @@ -52,7 +52,8 @@ RDSlotDialog::RDSlotDialog(const QString &caption,QWidget *parent) connect(edit_mode_box,SIGNAL(activated(int)), this,SLOT(modeActivatedData(int))); for(int i=0;iinsertItem(RDSlotOptions::modeText((RDSlotOptions::Mode)i)); + edit_mode_box->insertItem(edit_mode_box->count(), + RDSlotOptions::modeText((RDSlotOptions::Mode)i)); } edit_mode_label=new QLabel(tr("Slot Mode:"),this); edit_mode_label->setFont(labelFont()); @@ -62,8 +63,8 @@ RDSlotDialog::RDSlotDialog(const QString &caption,QWidget *parent) // Hook Mode // edit_hook_box=new QComboBox(this); - edit_hook_box->insertItem(tr("Full Cart")); - edit_hook_box->insertItem(tr("Hook")); + edit_hook_box->insertItem(edit_hook_box->count(),tr("Full Cart")); + edit_hook_box->insertItem(edit_hook_box->count(),tr("Hook")); edit_hook_label=new QLabel(tr("Play Mode:"),this); edit_hook_label->setFont(labelFont()); edit_hook_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -74,7 +75,8 @@ RDSlotDialog::RDSlotDialog(const QString &caption,QWidget *parent) edit_stop_action_box=new QComboBox(this); for(int i=0;i - insertItem(RDSlotOptions::stopActionText((RDSlotOptions::StopAction)i)); + insertItem(edit_stop_action_box->count(), + RDSlotOptions::stopActionText((RDSlotOptions::StopAction)i)); } edit_stop_action_label=new QLabel(tr("At Playout End:"),this); edit_stop_action_label->setFont(labelFont()); @@ -119,10 +121,10 @@ QSizePolicy RDSlotDialog::sizePolicy() const int RDSlotDialog::exec(RDSlotOptions *opt) { edit_options=opt; - edit_mode_box->setCurrentItem(edit_options->mode()); - edit_hook_box->setCurrentItem(edit_options->hookMode()); - edit_stop_action_box->setCurrentItem(edit_options->stopAction()); - modeActivatedData(edit_mode_box->currentItem()); + edit_mode_box->setCurrentIndex(edit_options->mode()); + edit_hook_box->setCurrentIndex(edit_options->hookMode()); + edit_stop_action_box->setCurrentIndex(edit_options->stopAction()); + modeActivatedData(edit_mode_box->currentIndex()); return QDialog::exec(); } @@ -139,10 +141,10 @@ void RDSlotDialog::modeActivatedData(int index) void RDSlotDialog::okData() { - edit_options->setMode((RDSlotOptions::Mode)edit_mode_box->currentItem()); - edit_options->setHookMode(edit_hook_box->currentItem()); + edit_options->setMode((RDSlotOptions::Mode)edit_mode_box->currentIndex()); + edit_options->setHookMode(edit_hook_box->currentIndex()); edit_options->setStopAction((RDSlotOptions::StopAction)edit_stop_action_box-> - currentItem()); + currentIndex()); done(0); } diff --git a/lib/rdsocketstrings.cpp b/lib/rdsocketstrings.cpp index c5b6050b..0456e96c 100644 --- a/lib/rdsocketstrings.cpp +++ b/lib/rdsocketstrings.cpp @@ -28,18 +28,14 @@ QString RDSocketStrings(QAbstractSocket::SocketError err) QString ret="unknown socket error"; switch(err) { - case QAbstractSocket::ErrConnectionRefused: + case QAbstractSocket::ConnectionRefusedError: ret="connection refused"; break; - case QAbstractSocket::ErrHostNotFound: + case QAbstractSocket::HostNotFoundError: ret="host not found"; break; - case QAbstractSocket::ErrSocketRead: - ret="socket read error"; - break; - case QAbstractSocket::RemoteHostClosedError: ret="remote host closed connection"; break; @@ -108,6 +104,8 @@ QString RDSocketStrings(QAbstractSocket::SocketError err) ret="proxy protocol error"; break; + case QAbstractSocket::UnknownSocketError: + break; } return ret; diff --git a/lib/rdsound_panel.cpp b/lib/rdsound_panel.cpp index b1bd5ba3..c0d79009 100644 --- a/lib/rdsound_panel.cpp +++ b/lib/rdsound_panel.cpp @@ -130,8 +130,8 @@ RDSoundPanel::RDSoundPanel(int cols,int rows,int station_panels, PANEL_BUTTON_SIZE_X+10,50); connect(panel_playmode_box,SIGNAL(activated(int)), this,SLOT(playmodeActivatedData(int))); - panel_playmode_box->insertItem(tr("Play All")); - panel_playmode_box->insertItem(tr("Play Hook")); + panel_playmode_box->insertItem(panel_playmode_box->count(),tr("Play All")); + panel_playmode_box->insertItem(panel_playmode_box->count(),tr("Play Hook")); // // Reset Button @@ -308,7 +308,7 @@ void RDSoundPanel::play(RDAirPlayConf::PanelType type,int panel, int row, int col,RDLogLine::StartSource src,int mport, bool pause_when_finished) { - PlayButton(type,panel,row,col,src,panel_playmode_box->currentItem()==1, + PlayButton(type,panel,row,col,src,panel_playmode_box->currentIndex()==1, mport,pause_when_finished); } @@ -507,7 +507,7 @@ void RDSoundPanel::setButton(RDAirPlayConf::PanelType type,int panel, else { button->setLength(true,cart->forcedLength()); } - button->setHookMode(panel_playmode_box->currentItem()==1); + button->setHookMode(panel_playmode_box->currentIndex()==1); switch(cart->type()) { case RDCart::Audio: if(button->length(button->hookMode())==0) { @@ -560,7 +560,7 @@ void RDSoundPanel::changeUser() // // Remove Old Panel Names // - int current_item=panel_selector_box->currentItem(); + int current_item=panel_selector_box->currentIndex(); for(int i=0;iremoveItem(panel_station_panels); } @@ -587,7 +587,7 @@ void RDSoundPanel::changeUser() } } delete q; - panel_selector_box->setCurrentItem(current_item); + panel_selector_box->setCurrentIndex(current_item); } @@ -745,7 +745,7 @@ void RDSoundPanel::buttonMapperData(int id) } if(panel_button_dialog-> exec(panel_buttons[PanelOffset(panel_type,panel_number)]-> - panelButton(row,col),panel_playmode_box->currentItem()==1, + panelButton(row,col),panel_playmode_box->currentIndex()==1, rda->user()->name(),rda->user()->password()) ==0) { SaveButton(panel_type,panel_number,row,col); @@ -763,7 +763,7 @@ void RDSoundPanel::buttonMapperData(int id) if(deck==NULL) { PlayButton(panel_type,panel_number,row,col, RDLogLine::StartManual, - panel_playmode_box->currentItem()==1); + panel_playmode_box->currentIndex()==1); } else { if(panel_pause_enabled) { @@ -844,7 +844,7 @@ void RDSoundPanel::panelSetupData() if(rda->user()->configPanels()||(panel_type==RDAirPlayConf::UserPanel)) { QString sql; RDSqlQuery *q; - int cutpt=panel_selector_box->currentText().find(" "); + int cutpt=panel_selector_box->currentText().indexOf(" "); if(panel_selector_box->currentText().left(5)==tr("Panel")) { cutpt=-1; } @@ -853,8 +853,9 @@ void RDSoundPanel::panelSetupData() RDEditPanelName *edn=new RDEditPanelName(&panel_name); if(edn->exec()==0) { panel_selector_box-> - setCurrentText("["+PanelTag(panel_selector_box->currentItem())+"] "+ - panel_name); + setCurrentIndex(panel_selector_box-> + findText("["+PanelTag(panel_selector_box-> + currentIndex())+"] "+panel_name)); sql=QString("delete from ")+panel_name_tablename+" where "+ QString().sprintf("(TYPE=%d)&&",panel_type)+ "(OWNER=\""+RDEscapeString(PanelOwner(panel_type))+"\")&&"+ @@ -1283,7 +1284,7 @@ void RDSoundPanel::LoadPanel(RDAirPlayConf::PanelType type,int panel) panel_buttons[offset]-> panelButton(q->value(0).toInt(),q->value(1).toInt())-> setLength(true,q->value(6).toInt()); - if((panel_playmode_box!=NULL)&&(panel_playmode_box->currentItem()==1)&& + if((panel_playmode_box!=NULL)&&(panel_playmode_box->currentIndex()==1)&& (q->value(6).toUInt()>0)) { panel_buttons[offset]-> panelButton(q->value(0).toInt(),q->value(1).toInt())-> @@ -1311,10 +1312,10 @@ void RDSoundPanel::LoadPanel(RDAirPlayConf::PanelType type,int panel) if(q->value(4).toString().isEmpty()) { panel_buttons[offset]-> panelButton(q->value(0).toInt(),q->value(1).toInt())-> - setColor(palette().active().background()); + setColor(palette().color(QPalette::Background)); panel_buttons[offset]-> panelButton(q->value(0).toInt(),q->value(1).toInt())-> - setDefaultColor(palette().active().background()); + setDefaultColor(palette().color(QPalette::Background)); } else { panel_buttons[offset]-> @@ -1498,7 +1499,7 @@ void RDSoundPanel::LogTraffic(RDPanelButton *button) "SERVICE_NAME=\""+RDEscapeString(panel_svcname)+"\","+ QString().sprintf("LENGTH=%d,",button->startTime().msecsTo(now.time()))+ QString().sprintf("CART_NUMBER=%u,",button->cart())+ - "STATION_NAME=\""+RDEscapeString(rda->station()->name().utf8())+"\","+ + "STATION_NAME=\""+RDEscapeString(rda->station()->name().toUtf8())+"\","+ "EVENT_DATETIME="+ RDCheckDateTime(QDateTime(now.date(),button->startTime()), "yyyy-MM-dd hh:mm:ss")+","+ @@ -1506,21 +1507,21 @@ void RDSoundPanel::LogTraffic(RDPanelButton *button) QString().sprintf("EVENT_SOURCE=%d,",RDLogLine::SoundPanel)+ QString().sprintf("PLAY_SOURCE=%d,",RDLogLine::SoundPanel)+ QString().sprintf("CUT_NUMBER=%d,",button->cutName().right(3).toInt())+ - "TITLE=\""+RDEscapeString(q->value(0).toString().utf8())+"\","+ - "ARTIST=\""+RDEscapeString(q->value(1).toString().utf8())+"\","+ - "PUBLISHER=\""+RDEscapeString(q->value(2).toString().utf8())+"\","+ - "COMPOSER=\""+RDEscapeString(q->value(3).toString().utf8())+"\","+ + "TITLE=\""+RDEscapeString(q->value(0).toString().toUtf8())+"\","+ + "ARTIST=\""+RDEscapeString(q->value(1).toString().toUtf8())+"\","+ + "PUBLISHER=\""+RDEscapeString(q->value(2).toString().toUtf8())+"\","+ + "COMPOSER=\""+RDEscapeString(q->value(3).toString().toUtf8())+"\","+ QString().sprintf("USAGE_CODE=%d,",q->value(4).toInt())+ - "ISRC=\""+RDEscapeString(q->value(5).toString().utf8())+"\","+ + "ISRC=\""+RDEscapeString(q->value(5).toString().toUtf8())+"\","+ QString().sprintf("START_SOURCE=%d,",button->startSource())+ - "ALBUM=\""+RDEscapeString(q->value(6).toString().utf8())+"\","+ - "LABEL=\""+RDEscapeString(q->value(7).toString().utf8())+"\","+ - "ISCI=\""+RDEscapeString(q->value(8).toString().utf8())+"\","+ - "DESCRIPTION=\""+RDEscapeString(q->value(12).toString().utf8())+"\","+ - "OUTCUE=\""+RDEscapeString(q->value(13).toString().utf8())+"\","+ - "CONDUCTOR=\""+RDEscapeString(q->value(9).toString().utf8())+"\","+ - "USER_DEFINED=\""+RDEscapeString(q->value(10).toString().utf8())+"\","+ - "SONG_ID=\""+RDEscapeString(q->value(11).toString().utf8())+"\","+ + "ALBUM=\""+RDEscapeString(q->value(6).toString().toUtf8())+"\","+ + "LABEL=\""+RDEscapeString(q->value(7).toString().toUtf8())+"\","+ + "ISCI=\""+RDEscapeString(q->value(8).toString().toUtf8())+"\","+ + "DESCRIPTION=\""+RDEscapeString(q->value(12).toString().toUtf8())+"\","+ + "OUTCUE=\""+RDEscapeString(q->value(13).toString().toUtf8())+"\","+ + "CONDUCTOR=\""+RDEscapeString(q->value(9).toString().toUtf8())+"\","+ + "USER_DEFINED=\""+RDEscapeString(q->value(10).toString().toUtf8())+"\","+ + "SONG_ID=\""+RDEscapeString(q->value(11).toString().toUtf8())+"\","+ "ONAIR_FLAG=\""+RDYesNo(panel_onair_flag)+"\""; delete q; q=new RDSqlQuery(sql); @@ -1544,19 +1545,19 @@ void RDSoundPanel::LogTrafficMacro(RDPanelButton *button) "SERVICE_NAME=\""+RDEscapeString(panel_svcname)+"\","+ QString().sprintf("LENGTH=%d,",q->value(5).toUInt())+ QString().sprintf("CART_NUMBER=%u,",button->cart())+ - "STATION_NAME=\""+RDEscapeString(rda->station()->name().utf8())+"\","+ + "STATION_NAME=\""+RDEscapeString(rda->station()->name().toUtf8())+"\","+ "EVENT_DATETIME=\""+datetime.toString("yyyy-MM-dd hh:mm:ss")+"\","+ QString().sprintf("EVENT_TYPE=%d,",RDAirPlayConf::TrafficMacro)+ QString().sprintf("EVENT_SOURCE=%d,",RDLogLine::SoundPanel)+ QString().sprintf("PLAY_SOURCE=%d,",RDLogLine::SoundPanel)+ - "TITLE=\""+RDEscapeString(q->value(0).toString().utf8())+"\","+ - "ARTIST=\""+RDEscapeString(q->value(1).toString().utf8())+"\","+ - "PUBLISHER=\""+RDEscapeString(q->value(2).toString().utf8())+"\","+ - "COMPOSER=\""+RDEscapeString(q->value(3).toString().utf8())+"\","+ + "TITLE=\""+RDEscapeString(q->value(0).toString().toUtf8())+"\","+ + "ARTIST=\""+RDEscapeString(q->value(1).toString().toUtf8())+"\","+ + "PUBLISHER=\""+RDEscapeString(q->value(2).toString().toUtf8())+"\","+ + "COMPOSER=\""+RDEscapeString(q->value(3).toString().toUtf8())+"\","+ QString().sprintf("USAGE_CODE=%d,",q->value(4).toInt())+ QString().sprintf("START_SOURCE=%d,",button->startSource())+ - "ALBUM=\""+RDEscapeString(q->value(6).toString().utf8())+"\","+ - "LABEL=\""+RDEscapeString(q->value(7).toString().utf8())+"\","+ + "ALBUM=\""+RDEscapeString(q->value(6).toString().toUtf8())+"\","+ + "LABEL=\""+RDEscapeString(q->value(7).toString().toUtf8())+"\","+ "ONAIR_FLAG=\""+RDYesNo(panel_onair_flag)+"\""; delete q; q=new RDSqlQuery(sql); @@ -1574,7 +1575,7 @@ void RDSoundPanel::LogLine(QString str) } QDateTime current=QDateTime::currentDateTime(); - if((file=fopen(panel_logfile,"a"))==NULL) { + if((file=fopen(panel_logfile.toUtf8(),"a"))==NULL) { return; } fprintf(file,"%02d/%02d/%4d - %02d:%02d:%02d.%03d : RDSoundPanel: %s\n", @@ -1585,7 +1586,7 @@ void RDSoundPanel::LogLine(QString str) current.time().minute(), current.time().second(), current.time().msec(), - (const char *)str); + str.toUtf8().constData()); fclose(file); } @@ -1640,7 +1641,7 @@ void RDSoundPanel::Stopped(int id) } else { panel_active_buttons[id]->setState(false); - panel_active_buttons[id]->setHookMode(panel_playmode_box->currentItem()==1); + panel_active_buttons[id]->setHookMode(panel_playmode_box->currentIndex()==1); } disconnect(this,SIGNAL(tick()),panel_active_buttons[id],SLOT(tickClock())); panel_active_buttons[id]->playDeck()->disconnect(); diff --git a/lib/rdstereometer.cpp b/lib/rdstereometer.cpp index 40672446..b2aca69d 100644 --- a/lib/rdstereometer.cpp +++ b/lib/rdstereometer.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #include @@ -47,7 +46,9 @@ RDStereoMeter::RDStereoMeter(QWidget *parent) clip_light_on=false; label_x=0; meter_label=QString(""); - setBackgroundColor(Qt::black); + QPalette pal=palette(); + pal.setColor(QPalette::Background,Qt::black); + setPalette(pal); left_meter=new RDSegMeter(RDSegMeter::Right,this); left_meter->setGeometry(25,10,300,10); left_meter->setRange(-4600,-800); diff --git a/lib/rdstringlist.cpp b/lib/rdstringlist.cpp index 0ef00707..1a51e7ca 100644 --- a/lib/rdstringlist.cpp +++ b/lib/rdstringlist.cpp @@ -42,7 +42,7 @@ RDStringList RDStringList::split(const QChar &sep,const QString &str, const QString &esc) { if(esc.isEmpty()) { - return (RDStringList)QStringList::split(sep,str); + return (RDStringList)str.split(sep,QString::KeepEmptyParts); } RDStringList list; bool escape=false; diff --git a/lib/rdsvc.cpp b/lib/rdsvc.cpp index f8a8cffe..8bb17c8b 100644 --- a/lib/rdsvc.cpp +++ b/lib/rdsvc.cpp @@ -467,8 +467,8 @@ bool RDSvc::import(ImportSource src,const QDate &date,const QString &break_str, return false; } QString infilename=q->value(0).toString(); - QString label_cart=q->value(1).toString().stripWhiteSpace(); - QString track_cart=q->value(2).toString().stripWhiteSpace(); + QString label_cart=q->value(1).toString().trimmed(); + QString track_cart=q->value(2).toString().trimmed(); QString preimport_cmd=q->value(3).toString(); RDSvc::SubEventInheritance inherit= (RDSvc::SubEventInheritance)q->value(4).toUInt(); @@ -478,7 +478,7 @@ bool RDSvc::import(ImportSource src,const QDate &date,const QString &break_str, // Open Source File // if((infile= - fopen(RDDateDecode(infilename,date,svc_station,svc_config,svc_name),"r"))== + fopen(RDDateDecode(infilename.toUtf8(),date,svc_station,svc_config,svc_name).toUtf8(),"r"))== NULL) { return false; } @@ -487,7 +487,7 @@ bool RDSvc::import(ImportSource src,const QDate &date,const QString &break_str, // Run Preimport Command // if(!preimport_cmd.isEmpty()) { - system(RDDateDecode(preimport_cmd,date,svc_station,svc_config,svc_name)); + system(RDDateDecode(preimport_cmd,date,svc_station,svc_config,svc_name).toUtf8()); } QString parser_table; diff --git a/lib/rdsystemuser.cpp b/lib/rdsystemuser.cpp index d0143229..f2035a53 100644 --- a/lib/rdsystemuser.cpp +++ b/lib/rdsystemuser.cpp @@ -40,7 +40,7 @@ RDSystemUser::RDSystemUser(const QString &username) system_username=username; system_exists=false; - if((user=getpwnam(username))==NULL) { + if((user=getpwnam(username.toUtf8()))==NULL) { return; } system_uid=user->pw_uid; diff --git a/lib/rdtempdirectory.cpp b/lib/rdtempdirectory.cpp index 33d03356..5e7cdb12 100644 --- a/lib/rdtempdirectory.cpp +++ b/lib/rdtempdirectory.cpp @@ -61,9 +61,9 @@ bool RDTempDirectory::create(QString *err_msg) { char tempdir[PATH_MAX]; - strncpy(tempdir,RDTempDirectory::basePath(),PATH_MAX); + strncpy(tempdir,RDTempDirectory::basePath().toUtf8(),PATH_MAX); strncat(tempdir,"/",PATH_MAX-strlen(tempdir)); - strncat(tempdir,temp_base_name,PATH_MAX-strlen(tempdir)); + strncat(tempdir,temp_base_name.toUtf8(),PATH_MAX-strlen(tempdir)); strncat(tempdir,"XXXXXX",PATH_MAX-strlen(tempdir)); if(mkdtemp(tempdir)==NULL) { *err_msg=strerror(errno); diff --git a/lib/rdtextfile.cpp b/lib/rdtextfile.cpp index 1c788eda..3f9564f4 100644 --- a/lib/rdtextfile.cpp +++ b/lib/rdtextfile.cpp @@ -57,13 +57,13 @@ bool RDTextFile(const QString &data,bool delete_on_exit) args[i]=(char *)malloc(f0.at(i).toUtf8().size()+1); strcpy(args[i],f0.at(i).toUtf8()); } - strcpy(tmpfile,RDTempDirectory::basePath()+"/rdreportXXXXXX"); + strcpy(tmpfile,(RDTempDirectory::basePath()+"/rdreportXXXXXX").toUtf8()); int fd=mkstemp(tmpfile); if(fd<0) { QMessageBox::warning(NULL,"File Error","Unable to create temporary file"); return false; } - write(fd,data.utf8(),data.utf8().length()); + write(fd,data.toUtf8(),data.toUtf8().length()); ::close(fd); if(delete_on_exit) { rda->addTempFile(tmpfile); diff --git a/lib/rdtextvalidator.cpp b/lib/rdtextvalidator.cpp index e66b818a..689f1882 100644 --- a/lib/rdtextvalidator.cpp +++ b/lib/rdtextvalidator.cpp @@ -20,8 +20,8 @@ #include -RDTextValidator::RDTextValidator(QObject *parent,const char *name,bool allow_quote) - : QValidator(parent,name) +RDTextValidator::RDTextValidator(QObject *parent,bool allow_quote) + : QValidator(parent) { if(!allow_quote) { banned_chars.push_back(34); // Double Quote diff --git a/lib/rdtextvalidator.h b/lib/rdtextvalidator.h index 25c8e4c7..be98bdf5 100644 --- a/lib/rdtextvalidator.h +++ b/lib/rdtextvalidator.h @@ -2,7 +2,7 @@ // // Validate a string as being valid for a SQL text datatype. // -// (C) Copyright 2004,2016 Fred Gleason +// (C) Copyright 2004-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -28,7 +28,7 @@ class RDTextValidator : public QValidator { public: - RDTextValidator(QObject *parent=0,const char *name=0,bool allow_quote=false); + RDTextValidator(QObject *parent=0,bool allow_quote=false); QValidator::State validate(QString &input,int &pos) const; void addBannedChar(char c); void addBannedChar(const QChar &c); diff --git a/lib/rdtimeedit.cpp b/lib/rdtimeedit.cpp index da7e8840..f741b7c3 100644 --- a/lib/rdtimeedit.cpp +++ b/lib/rdtimeedit.cpp @@ -33,8 +33,8 @@ RDTimeEdit::RDTimeEdit(QWidget *parent) setMidLineWidth(3); setFocusPolicy(Qt::StrongFocus); QPalette p=palette(); - p.setColor(QPalette::Active,QColorGroup::Background, - p.color(QPalette::Active,QColorGroup::Base)); + p.setColor(QPalette::Active,QPalette::Background, + p.color(QPalette::Active,QPalette::Base)); setPalette(p); edit_labels[0]=new QLabel("00",this); edit_labels[0]->setAlignment(Qt::AlignCenter); @@ -216,10 +216,10 @@ void RDTimeEdit::setFocus() for(int i=0;i<4;i++) { edit_labels[i]->setPalette(p); } - p.setColor(QPalette::Active,QColorGroup::Background, - p.color(QPalette::Active,QColorGroup::Highlight)); - p.setColor(QPalette::Active,QColorGroup::Foreground, - p.color(QPalette::Active,QColorGroup::HighlightedText)); + p.setColor(QPalette::Active,QPalette::Background, + p.color(QPalette::Active,QPalette::Highlight)); + p.setColor(QPalette::Active,QPalette::Foreground, + p.color(QPalette::Active,QPalette::HighlightedText)); edit_labels[edit_section]->setPalette(p); QFrame::setFocus(); } @@ -383,7 +383,7 @@ void RDTimeEdit::keyPressEvent(QKeyEvent *e) case Qt::Key_7: case Qt::Key_8: case Qt::Key_9: - ProcessKey(e->ascii()); + ProcessKey(e->text().at(0).toAscii()); e->accept(); break; diff --git a/lib/rdtimeengine.cpp b/lib/rdtimeengine.cpp index fd1b1cde..1790cf1c 100644 --- a/lib/rdtimeengine.cpp +++ b/lib/rdtimeengine.cpp @@ -26,7 +26,8 @@ RDTimeEngine::RDTimeEngine(QObject *parent) : QObject(parent) { engine_pending_id=-1; - engine_timer=new QTimer(this,"engine_timer"); + engine_timer=new QTimer(this); + engine_timer->setSingleShot(true); engine_time_offset=0; connect(engine_timer,SIGNAL(timeout()),this,SLOT(timerData())); } @@ -147,13 +148,13 @@ void RDTimeEngine::SetTimer() QTime current_time=QTime::currentTime().addMSecs(engine_time_offset); int diff=GetNextDiff(current_time,&engine_pending_id); if(diff!=86400001) { - engine_timer->start(diff,true); + engine_timer->start(diff); return; } diff=GetNextDiff(QTime(),&engine_pending_id); if(diff!=86400001) { diff+=(current_time.msecsTo(QTime(23,59,59))+1000); - engine_timer->start(diff,true); + engine_timer->start(diff); return; } } diff --git a/lib/rdtransportbutton.cpp b/lib/rdtransportbutton.cpp index 4e2f37c6..10131491 100644 --- a/lib/rdtransportbutton.cpp +++ b/lib/rdtransportbutton.cpp @@ -34,15 +34,15 @@ RDTransportButton::RDTransportButton(RDTransportButton::TransType type, button_type=type; button_state=RDTransportButton::Off; on_color=QColor(RDTRANSPORTBUTTON_DEFAULT_ON_COLOR); - accent_color=QColor(colorGroup().shadow()); + accent_color=QColor(palette().shadow().color()); on_cap=new QPixmap(); drawOnCap(); off_cap=new QPixmap(); drawOffCap(); - setPixmap(*off_cap); + setIcon(*off_cap); setFocusPolicy(Qt::NoFocus); - flash_timer=new QTimer(this,"flash_timer"); + flash_timer=new QTimer(this); connect(flash_timer,SIGNAL(timeout()),this,SLOT(flashClock())); flash_state=false; } @@ -94,19 +94,18 @@ void RDTransportButton::setAccentColor(QColor color) void RDTransportButton::setState(RDTransportButton::TransState state) { - QKeySequence a=accel(); button_state=state; switch(button_state) { case RDTransportButton::On: flashOff(); if(isEnabled()) { - setPixmap(*on_cap); + setIcon(*on_cap); } break; case RDTransportButton::Off: flashOff(); if(isEnabled()) { - setPixmap(*off_cap); + setIcon(*off_cap); } break; case RDTransportButton::Flashing: @@ -115,7 +114,6 @@ void RDTransportButton::setState(RDTransportButton::TransState state) } break; } - setAccel(a); } @@ -139,51 +137,45 @@ void RDTransportButton::flash() void RDTransportButton::resizeEvent(QResizeEvent *event) { - QKeySequence a=accel(); drawOnCap(); drawOffCap(); switch(button_state) { case RDTransportButton::Off: - setPixmap(*off_cap); + setIcon(*off_cap); break; case RDTransportButton::On: - setPixmap(*on_cap); + setIcon(*on_cap); break; default: - setPixmap(*off_cap); + setIcon(*off_cap); break; } - setAccel(a); } void RDTransportButton::enabledChange(bool oldEnabled) { - QKeySequence a=accel(); if(isEnabled()&&!oldEnabled) { setState(button_state); update(); } if(!isEnabled()&&oldEnabled) { -// setPixmap(*grey_cap); +// setIcon(*grey_cap); update(); - setAccel(a); } } void RDTransportButton::flashClock() { - QKeySequence a=accel(); if(flash_state) { flash_state=false; - setPixmap(*off_cap); + setIcon(*off_cap); } else { flash_state=true; - setPixmap(*on_cap); + setIcon(*on_cap); } - setAccel(a); } @@ -191,20 +183,20 @@ void RDTransportButton::updateCaps() { switch(button_state) { case RDTransportButton::On: - setPixmap(*on_cap); + setIcon(*on_cap); break; case RDTransportButton::Flashing: if(flash_state) { - setPixmap(*on_cap); + setIcon(*on_cap); } else { - setPixmap(*off_cap); + setIcon(*off_cap); } break; case RDTransportButton::Off: - setPixmap(*off_cap); + setIcon(*off_cap); break; } } @@ -223,7 +215,8 @@ void RDTransportButton::drawMask(QPixmap *cap) else { edge=capSize().width(); } - cap->resize(capSize()); + cap=new QPixmap(cap->copy(0,0,capSize().width(),capSize().height())); + // cap->resize(capSize()); b.begin(bitmap); b.fillRect(0,0,capSize().width(),capSize().height(),QColor(Qt::color0)); b.setPen(QColor(Qt::color1)); @@ -374,13 +367,13 @@ void RDTransportButton::drawOnCap() triangle.setPoint(1,capSize().width()/2+(3*edge)/10,capSize().height()/2); triangle.setPoint(2,capSize().width()/2-(3*edge)/10,capSize().height()/2+(3*edge)/10); p.drawPolygon(triangle); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2-(3*edge)/10,capSize().height()/2+(3*edge)/10, capSize().width()/2-(3*edge)/10,capSize().height()/2-(3*edge)/10); - p.setPen(QColor(colorGroup().dark())); + p.setPen(QColor(palette().dark().color())); p.drawLine(capSize().width()/2-(3*edge)/10,capSize().height()/2-(3*edge)/10, capSize().width()/2+(3*edge)/10,capSize().height()/2); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2+(3*edge)/10,capSize().height()/2, capSize().width()/2-(3*edge)/10,capSize().height()/2+(3*edge)/10); break; @@ -388,12 +381,12 @@ void RDTransportButton::drawOnCap() case RDTransportButton::Stop: p.fillRect(capSize().width()/2-edge*3/10,capSize().height()/2-edge*3/10, edge*3/5,edge*3/5,QColor(on_color)); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2-edge*3/10,capSize().height()/2+edge*3/10, capSize().width()/2-edge*3/10,capSize().height()/2-edge*3/10); p.drawLine(capSize().width()/2-edge*3/10,capSize().height()/2-edge*3/10, capSize().width()/2+edge*3/10,capSize().height()/2-edge*3/10); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2+edge*3/10,capSize().height()/2-edge*3/10, capSize().width()/2+edge*3/10,capSize().height()/2+edge*3/10); p.drawLine(capSize().width()/2+edge*3/10,capSize().height()/2+edge*3/10, @@ -412,26 +405,26 @@ void RDTransportButton::drawOnCap() triangle.setPoint(1,capSize().width()/2,capSize().height()/2); triangle.setPoint(2,capSize().width()/2-(3*edge)/10,capSize().height()/2+(3*edge)/10); p.drawPolygon(triangle); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2-(3*edge)/10,capSize().height()/2+(3*edge)/10, capSize().width()/2-(3*edge)/10,capSize().height()/2-(3*edge)/10); - p.setPen(QColor(colorGroup().dark())); + p.setPen(QColor(palette().dark().color())); p.drawLine(capSize().width()/2-(3*edge)/10,capSize().height()/2-(3*edge)/10, capSize().width()/2,capSize().height()/2); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2,capSize().height()/2, capSize().width()/2-(3*edge)/10,capSize().height()/2+(3*edge)/10); triangle.setPoint(0,capSize().width()/2,capSize().height()/2-(3*edge)/10); triangle.setPoint(1,capSize().width()/2+(3*edge)/10,capSize().height()/2); triangle.setPoint(2,capSize().width()/2,capSize().height()/2+(3*edge)/10); p.drawPolygon(triangle); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2,capSize().height()/2+(3*edge)/10, capSize().width()/2,capSize().height()/2-(3*edge)/10); - p.setPen(QColor(colorGroup().dark())); + p.setPen(QColor(palette().dark().color())); p.drawLine(capSize().width()/2,capSize().height()/2-(3*edge)/10, capSize().width()/2+(3*edge)/10,capSize().height()/2); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2+(3*edge)/10,capSize().height()/2, capSize().width()/2,capSize().height()/2+(3*edge)/10); break; @@ -441,13 +434,13 @@ void RDTransportButton::drawOnCap() triangle.setPoint(1,capSize().width()/2,capSize().height()/2); triangle.setPoint(2,capSize().width()/2+(3*edge)/10,capSize().height()/2+(3*edge)/10); p.drawPolygon(triangle); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2+(3*edge)/10,capSize().height()/2-(3*edge)/10, capSize().width()/2,capSize().height()/2); - p.setPen(QColor(colorGroup().dark())); + p.setPen(QColor(palette().dark().color())); p.drawLine(capSize().width()/2,capSize().height()/2, capSize().width()/2+(3*edge)/10,capSize().height()/2+(3*edge)/10); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2+(3*edge)/10,capSize().height()/2+(3*edge)/10, capSize().width()/2+(3*edge)/10,capSize().height()/2-(3*edge)/10); triangle.setPoint(0,capSize().width()/2,capSize().height()/2-(3*edge)/10); @@ -455,13 +448,13 @@ void RDTransportButton::drawOnCap() triangle.setPoint(2,capSize().width()/2,capSize().height()/2+(3*edge)/10); p.drawPolygon(triangle); p.drawPolygon(triangle); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2,capSize().height()/2-(3*edge)/10, capSize().width()/2-(3*edge)/10,capSize().height()/2); - p.setPen(QColor(colorGroup().dark())); + p.setPen(QColor(palette().dark().color())); p.drawLine(capSize().width()/2-(3*edge)/10,capSize().height()/2, capSize().width()/2,capSize().height()/2+(3*edge)/10); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2,capSize().height()/2+(3*edge)/10, capSize().width()/2,capSize().height()/2-(3*edge)/10); break; @@ -471,23 +464,23 @@ void RDTransportButton::drawOnCap() triangle.setPoint(1,capSize().width()/2+(3*edge)/10,capSize().height()/2); triangle.setPoint(2,capSize().width()/2-(3*edge)/10,capSize().height()/2); p.drawPolygon(triangle); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2-(3*edge)/10,capSize().height()/2, capSize().width()/2,capSize().height()/2-(3*edge)/10); - p.setPen(QColor(colorGroup().dark())); + p.setPen(QColor(palette().dark().color())); p.drawLine(capSize().width()/2,capSize().height()/2-(3*edge)/10, capSize().width()/2+(3*edge)/10,capSize().height()/2); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2+(3*edge)/10,capSize().height()/2, capSize().width()/2-(3*edge)/10,capSize().height()/2); p.fillRect(capSize().width()/2-(3*edge)/10,capSize().height()/2+edge/10, (3*edge)/5,edge/5,on_color); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2-(3*edge)/10,capSize().height()/2+edge/10+edge/5, capSize().width()/2-(3*edge)/10,capSize().height()/2+edge/10); p.drawLine(capSize().width()/2-(3*edge)/10,capSize().height()/2+edge/10, capSize().width()/2+(3*edge)/10,capSize().height()/2+edge/10); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2+(3*edge)/10,capSize().height()/2+edge/10, capSize().width()/2+(3*edge)/10,capSize().height()/2+edge/10+edge/5); p.drawLine(capSize().width()/2+(3*edge)/10,capSize().height()/2+edge/10+edge/5, @@ -497,24 +490,24 @@ void RDTransportButton::drawOnCap() case RDTransportButton::Pause: p.fillRect(capSize().width()/2-(3*edge)/10,capSize().height()/2-(3*edge)/10, (3*edge)/15,(3*edge)/5,on_color); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2-(3*edge)/10,capSize().height()/2+(3*edge)/10, capSize().width()/2-(3*edge)/10,capSize().height()/2-(3*edge)/10); p.drawLine(capSize().width()/2-(3*edge)/10,capSize().height()/2-(3*edge)/10, capSize().width()/2-(3*edge)/10+(3*edge)/15,capSize().height()/2-(3*edge)/10); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2-(3*edge)/10+(3*edge)/15,capSize().height()/2-(3*edge)/10, capSize().width()/2-(3*edge)/10+(3*edge)/15,capSize().height()/2+(3*edge)/10); p.drawLine(capSize().width()/2-(3*edge)/10+(3*edge)/15,capSize().height()/2+(3*edge)/10, capSize().width()/2-(3*edge)/10,capSize().height()/2+(3*edge)/10); p.fillRect(capSize().width()/2+(3*edge)/30,capSize().height()/2-(3*edge)/10, (3*edge)/15,(3*edge)/5,on_color); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2+(3*edge)/30,capSize().height()/2+(3*edge)/10, capSize().width()/2+(3*edge)/30,capSize().height()/2-(3*edge)/10); p.drawLine(capSize().width()/2+(3*edge)/30,capSize().height()/2-(3*edge)/10, capSize().width()/2+(3*edge)/10,capSize().height()/2-(3*edge)/10); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2+(3*edge)/10,capSize().height()/2-(3*edge)/10, capSize().width()/2+(3*edge)/10,capSize().height()/2+(3*edge)/10); p.drawLine(capSize().width()/2+(3*edge)/10,capSize().height()/2+(3*edge)/10, @@ -528,13 +521,13 @@ void RDTransportButton::drawOnCap() triangle.setPoint(1,capSize().width()/2+(3*edge)/10+1,capSize().height()/2); triangle.setPoint(2,capSize().width()/2-(2*edge)/10+1,capSize().height()/2+(3*edge)/10); p.drawPolygon(triangle); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2-(2*edge)/10+1,capSize().height()/2+(3*edge)/10, capSize().width()/2-(2*edge)/10+1,capSize().height()/2-(3*edge)/10); - p.setPen(QColor(colorGroup().dark())); + p.setPen(QColor(palette().dark().color())); p.drawLine(capSize().width()/2-(2*edge)/10+1,capSize().height()/2-(3*edge)/10, capSize().width()/2+(3*edge)/10+1,capSize().height()/2); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2+(3*edge)/10+1,capSize().height()/2, capSize().width()/2-(2*edge)/10+1,capSize().height()/2+(3*edge)/10); break; @@ -548,26 +541,26 @@ void RDTransportButton::drawOnCap() triangle.setPoint(1,capSize().width()/2+(2*edge)/10+1,capSize().height()/2); triangle.setPoint(2,capSize().width()/2-(2*edge)/10+1,capSize().height()/2+(3*edge)/10); p.drawPolygon(triangle); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2-(2*edge)/10+1,capSize().height()/2+(3*edge)/10, capSize().width()/2-(2*edge)/10+1,capSize().height()/2-(3*edge)/10); - p.setPen(QColor(colorGroup().dark())); + p.setPen(QColor(palette().dark().color())); p.drawLine(capSize().width()/2-(2*edge)/10+1,capSize().height()/2-(3*edge)/10, capSize().width()/2+(2*edge)/10+1,capSize().height()/2); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2+(2*edge)/10+1,capSize().height()/2, capSize().width()/2-(2*edge)/10+1,capSize().height()/2+(3*edge)/10); break; case RDTransportButton::Loop: - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2-(2*edge)/10+1,capSize().height()/2+(edge)/4, capSize().width()/2+(edge)/10+1,capSize().height()/2-edge/10); - p.setPen(QColor(colorGroup().dark())); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().dark().color())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2+(edge)/10+1,capSize().height()/2-edge/10, capSize().width()/2-(2*edge)/10+1,capSize().height()/2+(edge)/4); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawArc(capSize().width()/6,capSize().height()/2-edge/9,2*capSize().width()/3, capSize().height()/3+edge/10,1440,5760); triangle.setPoint(0,capSize().width()/2-(2*edge)/10+1,capSize().height()/2-(edge)/4); @@ -581,13 +574,13 @@ void RDTransportButton::drawOnCap() triangle.setPoint(1,capSize().width()/2+(3*edge)/10,capSize().height()-(3*edge)/10); triangle.setPoint(2,capSize().width()/2-(3*edge)/10,capSize().height()-(3*edge)/10); p.drawPolygon(triangle); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2-(3*edge)/10,capSize().height()-(3*edge)/10, capSize().width()/2,(3*edge)/10); - p.setPen(QColor(colorGroup().dark())); + p.setPen(QColor(palette().dark().color())); p.drawLine(capSize().width()/2,(3*edge)/10, capSize().width()/2+(3*edge)/10,capSize().height()-(3*edge)/10); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2+(3*edge)/10,capSize().height()-(3*edge)/10, capSize().width()/2-(3*edge)/10,capSize().height()-(3*edge)/10); break; @@ -597,13 +590,13 @@ void RDTransportButton::drawOnCap() triangle.setPoint(1,capSize().width()/2+(3*edge)/10,(3*edge)/10); triangle.setPoint(2,capSize().width()/2-(3*edge)/10,(3*edge)/10); p.drawPolygon(triangle); - p.setPen(QColor(colorGroup().dark())); + p.setPen(QColor(palette().dark().color())); p.drawLine(capSize().width()/2-(3*edge)/10,(3*edge)/10, capSize().width()/2,capSize().height()-(3*edge)/10); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2,capSize().height()-(3*edge)/10, capSize().width()/2+(3*edge)/10,(3*edge)/10); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2+(3*edge)/10,(3*edge)/10, capSize().width()/2-(3*edge)/10,(3*edge)/10); break; @@ -615,15 +608,15 @@ void RDTransportButton::drawOnCap() triangle.setPoint(1,capSize().width()/2+(2*edge)/10+1,capSize().height()/2); triangle.setPoint(2,capSize().width()/2-(3*edge)/10,capSize().height()/2+(3*edge)/10); p.drawPolygon(triangle); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2-(3*edge)/10,capSize().height()/2+(3*edge)/10, capSize().width()/2-(3*edge)/10,capSize().height()/2-(3*edge)/10); - p.setPen(QColor(colorGroup().dark())); + p.setPen(QColor(palette().dark().color())); p.drawLine(capSize().width()/2-(3*edge)/10,capSize().height()/2-(3*edge)/10, capSize().width()/2+(2*edge)/10+1,capSize().height()/2); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2+(2*edge)/10+1,capSize().height()/2, capSize().width()/2-(3*edge)/10,capSize().height()/2+(3*edge)/10); break; @@ -654,13 +647,13 @@ void RDTransportButton::drawOffCap() triangle.setPoint(1,capSize().width()/2+(3*edge)/10,capSize().height()/2); triangle.setPoint(2,capSize().width()/2-(3*edge)/10,capSize().height()/2+(3*edge)/10); p.drawPolygon(triangle); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2-(3*edge)/10,capSize().height()/2+(3*edge)/10, capSize().width()/2-(3*edge)/10,capSize().height()/2-(3*edge)/10); - p.setPen(QColor(colorGroup().dark())); + p.setPen(QColor(palette().dark().color())); p.drawLine(capSize().width()/2-(3*edge)/10,capSize().height()/2-(3*edge)/10, capSize().width()/2+(3*edge)/10,capSize().height()/2); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2+(3*edge)/10,capSize().height()/2, capSize().width()/2-(3*edge)/10,capSize().height()/2+(3*edge)/10); break; @@ -668,12 +661,12 @@ void RDTransportButton::drawOffCap() case RDTransportButton::Stop: p.fillRect(capSize().width()/2-edge*3/10,capSize().height()/2-edge*3/10, edge*3/5,edge*3/5,QColor(Qt::black)); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2-edge*3/10,capSize().height()/2+edge*3/10, capSize().width()/2-edge*3/10,capSize().height()/2-edge*3/10); p.drawLine(capSize().width()/2-edge*3/10,capSize().height()/2-edge*3/10, capSize().width()/2+edge*3/10,capSize().height()/2-edge*3/10); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2+edge*3/10,capSize().height()/2-edge*3/10, capSize().width()/2+edge*3/10,capSize().height()/2+edge*3/10); p.drawLine(capSize().width()/2+edge*3/10,capSize().height()/2+edge*3/10, @@ -692,13 +685,13 @@ void RDTransportButton::drawOffCap() triangle.setPoint(1,capSize().width()/2,capSize().height()/2); triangle.setPoint(2,capSize().width()/2-(3*edge)/10,capSize().height()/2+(3*edge)/10); p.drawPolygon(triangle); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2-(3*edge)/10,capSize().height()/2+(3*edge)/10, capSize().width()/2-(3*edge)/10,capSize().height()/2-(3*edge)/10); - p.setPen(QColor(colorGroup().dark())); + p.setPen(QColor(palette().dark().color())); p.drawLine(capSize().width()/2-(3*edge)/10,capSize().height()/2-(3*edge)/10, capSize().width()/2,capSize().height()/2); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2,capSize().height()/2, capSize().width()/2-(3*edge)/10,capSize().height()/2+(3*edge)/10); triangle.setPoint(0,capSize().width()/2,capSize().height()/2-(3*edge)/10); @@ -706,13 +699,13 @@ void RDTransportButton::drawOffCap() triangle.setPoint(2,capSize().width()/2,capSize().height()/2+(3*edge)/10); p.drawPolygon(triangle); p.drawPolygon(triangle); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2,capSize().height()/2+(3*edge)/10, capSize().width()/2,capSize().height()/2-(3*edge)/10); - p.setPen(QColor(colorGroup().dark())); + p.setPen(QColor(palette().dark().color())); p.drawLine(capSize().width()/2,capSize().height()/2-(3*edge)/10, capSize().width()/2+(3*edge)/10,capSize().height()/2); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2+(3*edge)/10,capSize().height()/2, capSize().width()/2,capSize().height()/2+(3*edge)/10); break; @@ -722,26 +715,26 @@ void RDTransportButton::drawOffCap() triangle.setPoint(1,capSize().width()/2,capSize().height()/2); triangle.setPoint(2,capSize().width()/2+(3*edge)/10,capSize().height()/2+(3*edge)/10); p.drawPolygon(triangle); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2+(3*edge)/10,capSize().height()/2-(3*edge)/10, capSize().width()/2,capSize().height()/2); - p.setPen(QColor(colorGroup().dark())); + p.setPen(QColor(palette().dark().color())); p.drawLine(capSize().width()/2,capSize().height()/2, capSize().width()/2+(3*edge)/10,capSize().height()/2+(3*edge)/10); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2+(3*edge)/10,capSize().height()/2+(3*edge)/10, capSize().width()/2+(3*edge)/10,capSize().height()/2-(3*edge)/10); triangle.setPoint(0,capSize().width()/2,capSize().height()/2-(3*edge)/10); triangle.setPoint(1,capSize().width()/2-(3*edge)/10,capSize().height()/2); triangle.setPoint(2,capSize().width()/2,capSize().height()/2+(3*edge)/10); p.drawPolygon(triangle); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2,capSize().height()/2-(3*edge)/10, capSize().width()/2-(3*edge)/10,capSize().height()/2); - p.setPen(QColor(colorGroup().dark())); + p.setPen(QColor(palette().dark().color())); p.drawLine(capSize().width()/2-(3*edge)/10,capSize().height()/2, capSize().width()/2,capSize().height()/2+(3*edge)/10); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2,capSize().height()/2+(3*edge)/10, capSize().width()/2,capSize().height()/2-(3*edge)/10); break; @@ -758,24 +751,24 @@ void RDTransportButton::drawOffCap() case RDTransportButton::Pause: p.fillRect(capSize().width()/2-(3*edge)/10,capSize().height()/2-(3*edge)/10, (3*edge)/15,(3*edge)/5,QColor(Qt::black)); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2-(3*edge)/10,capSize().height()/2+(3*edge)/10, capSize().width()/2-(3*edge)/10,capSize().height()/2-(3*edge)/10); p.drawLine(capSize().width()/2-(3*edge)/10,capSize().height()/2-(3*edge)/10, capSize().width()/2-(3*edge)/10+(3*edge)/15,capSize().height()/2-(3*edge)/10); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2-(3*edge)/10+(3*edge)/15,capSize().height()/2-(3*edge)/10, capSize().width()/2-(3*edge)/10+(3*edge)/15,capSize().height()/2+(3*edge)/10); p.drawLine(capSize().width()/2-(3*edge)/10+(3*edge)/15,capSize().height()/2+(3*edge)/10, capSize().width()/2-(3*edge)/10,capSize().height()/2+(3*edge)/10); p.fillRect(capSize().width()/2+(3*edge)/30,capSize().height()/2-(3*edge)/10, (3*edge)/15,(3*edge)/5,QColor(Qt::black)); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2+(3*edge)/30,capSize().height()/2+(3*edge)/10, capSize().width()/2+(3*edge)/30,capSize().height()/2-(3*edge)/10); p.drawLine(capSize().width()/2+(3*edge)/30,capSize().height()/2-(3*edge)/10, capSize().width()/2+(3*edge)/10,capSize().height()/2-(3*edge)/10); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2+(3*edge)/10,capSize().height()/2-(3*edge)/10, capSize().width()/2+(3*edge)/10,capSize().height()/2+(3*edge)/10); p.drawLine(capSize().width()/2+(3*edge)/10,capSize().height()/2+(3*edge)/10, @@ -789,13 +782,13 @@ void RDTransportButton::drawOffCap() triangle.setPoint(1,capSize().width()/2+(3*edge)/10+1,capSize().height()/2); triangle.setPoint(2,capSize().width()/2-(2*edge)/10+1,capSize().height()/2+(3*edge)/10); p.drawPolygon(triangle); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2-(2*edge)/10+1,capSize().height()/2+(3*edge)/10, capSize().width()/2-(2*edge)/10+1,capSize().height()/2-(3*edge)/10); - p.setPen(QColor(colorGroup().dark())); + p.setPen(QColor(palette().dark().color())); p.drawLine(capSize().width()/2-(2*edge)/10+1,capSize().height()/2-(3*edge)/10, capSize().width()/2+(3*edge)/10+1,capSize().height()/2); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2+(3*edge)/10+1,capSize().height()/2, capSize().width()/2-(2*edge)/10+1,capSize().height()/2+(3*edge)/10); break; @@ -809,13 +802,13 @@ void RDTransportButton::drawOffCap() triangle.setPoint(1,capSize().width()/2+(2*edge)/10+1,capSize().height()/2); triangle.setPoint(2,capSize().width()/2-(2*edge)/10+1,capSize().height()/2+(3*edge)/10); p.drawPolygon(triangle); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2-(2*edge)/10+1,capSize().height()/2+(3*edge)/10, capSize().width()/2-(2*edge)/10+1,capSize().height()/2-(3*edge)/10); - p.setPen(QColor(colorGroup().dark())); + p.setPen(QColor(palette().dark().color())); p.drawLine(capSize().width()/2-(2*edge)/10+1,capSize().height()/2-(3*edge)/10, capSize().width()/2+(2*edge)/10+1,capSize().height()/2); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2+(2*edge)/10+1,capSize().height()/2, capSize().width()/2-(2*edge)/10+1,capSize().height()/2+(3*edge)/10); break; @@ -825,14 +818,14 @@ void RDTransportButton::drawOffCap() triangle.setPoint(1,capSize().width()/2+(edge)/10+1,capSize().height()/2-edge/10); triangle.setPoint(2,capSize().width()/2-(2*edge)/10+1,capSize().height()/2+edge/20); p.drawPolygon(triangle); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2-(2*edge)/10+1,capSize().height()/2+(edge)/4, capSize().width()/2+(edge)/10+1,capSize().height()/2-edge/10); - p.setPen(QColor(colorGroup().dark())); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().dark().color())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2+(edge)/10+1,capSize().height()/2-edge/10, capSize().width()/2-(2*edge)/10+1,capSize().height()/2+(edge)/4); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawArc(capSize().width()/6,capSize().height()/2-edge/9,2*capSize().width()/3, capSize().height()/3+edge/10,1440,5760); break; @@ -858,13 +851,13 @@ void RDTransportButton::drawOffCap() triangle.setPoint(1,capSize().width()/2+(2*edge)/10+1,capSize().height()/2); triangle.setPoint(2,capSize().width()/2-(3*edge)/10,capSize().height()/2+(3*edge)/10); p.drawPolygon(triangle); - p.setPen(QColor(colorGroup().shadow())); + p.setPen(QColor(palette().shadow().color())); p.drawLine(capSize().width()/2-(3*edge)/10,capSize().height()/2+(3*edge)/10, capSize().width()/2-(3*edge)/10,capSize().height()/2-(3*edge)/10); - p.setPen(QColor(colorGroup().dark())); + p.setPen(QColor(palette().dark().color())); p.drawLine(capSize().width()/2-(3*edge)/10,capSize().height()/2-(3*edge)/10, capSize().width()/2+(2*edge)/10+1,capSize().height()/2); - p.setPen(QColor(colorGroup().light())); + p.setPen(QColor(palette().light().color())); p.drawLine(capSize().width()/2+(2*edge)/10+1,capSize().height()/2, capSize().width()/2-(3*edge)/10,capSize().height()/2+(3*edge)/10); break; diff --git a/lib/rdtrimaudio.cpp b/lib/rdtrimaudio.cpp index 31b3638c..90ad3df1 100644 --- a/lib/rdtrimaudio.cpp +++ b/lib/rdtrimaudio.cpp @@ -92,7 +92,6 @@ RDTrimAudio::ErrorCode RDTrimAudio::runTrim(const QString &username, { long response_code; CURL *curl=NULL; - char url[1024]; CURLcode curl_err; struct curl_httppost *first=NULL; struct curl_httppost *last=NULL; @@ -102,41 +101,39 @@ RDTrimAudio::ErrorCode RDTrimAudio::runTrim(const QString &username, // curl_formadd(&first,&last,CURLFORM_PTRNAME,"COMMAND", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",RDXPORT_COMMAND_TRIMAUDIO), + QString().sprintf("%u",RDXPORT_COMMAND_TRIMAUDIO).toUtf8(). + constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"LOGIN_NAME", - CURLFORM_COPYCONTENTS,(const char *)username.utf8(),CURLFORM_END); + CURLFORM_COPYCONTENTS,username.toUtf8().constData(), + CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"PASSWORD", - CURLFORM_COPYCONTENTS,(const char *)password.utf8(),CURLFORM_END); + CURLFORM_COPYCONTENTS,password.toUtf8().constData(), + CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"CART_NUMBER", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_cart_number), + QString().sprintf("%u",conv_cart_number).toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"CUT_NUMBER", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_cut_number), + QString().sprintf("%u",conv_cut_number).toUtf8().constData(), CURLFORM_END); curl_formadd(&first,&last,CURLFORM_PTRNAME,"TRIM_LEVEL", CURLFORM_COPYCONTENTS, - (const char *)QString().sprintf("%u",conv_trim_level), + QString().sprintf("%u",conv_trim_level).toUtf8().constData(), CURLFORM_END); if((curl=curl_easy_init())==NULL) { curl_formfree(first); return RDTrimAudio::ErrorInternal; } - // - // Write out URL as a C string before passing to curl_easy_setopt(), - // otherwise some versions of LibCurl will throw a 'bad/illegal format' - // error. - // - strncpy(url,conv_station->webServiceUrl(conv_config),1024); - curl_easy_setopt(curl,CURLOPT_URL,url); + curl_easy_setopt(curl,CURLOPT_URL,conv_station-> + webServiceUrl(conv_config).toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,RDTrimAudioCallback); curl_easy_setopt(curl,CURLOPT_WRITEDATA,&conv_xml); curl_easy_setopt(curl,CURLOPT_HTTPPOST,first); curl_easy_setopt(curl,CURLOPT_USERAGENT, - (const char *)conv_config->userAgent()); + conv_config->userAgent().toUtf8().constData()); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); switch(curl_err=curl_easy_perform(curl)) { diff --git a/lib/rdttyout.cpp b/lib/rdttyout.cpp index b2746f61..695eed48 100644 --- a/lib/rdttyout.cpp +++ b/lib/rdttyout.cpp @@ -38,19 +38,19 @@ bool RDTtyOut(const QString &station,unsigned port_id,const QString &str) delete tty_entry; return false; } - tty_device->write((const char *)str,strlen((const char *)str)); + tty_device->write(str.toUtf8()); switch(tty_entry->termination()) { case RDTty::CrTerm: - tty_device->putch(13); + tty_device->putChar(13); break; case RDTty::LfTerm: - tty_device->putch(10); + tty_device->putChar(10); break; case RDTty::CrLfTerm: - tty_device->putch(13); - tty_device->putch(10); + tty_device->putChar(13); + tty_device->putChar(10); break; case RDTty::NoTerm: diff --git a/lib/rdupload.cpp b/lib/rdupload.cpp index 4aa8a5cb..c45580a3 100644 --- a/lib/rdupload.cpp +++ b/lib/rdupload.cpp @@ -131,7 +131,7 @@ RDUpload::ErrorCode RDUpload::runUpload(const QString &username, // // Validate User for file: transfers // - if((getuid()==0)&&(conv_dst_url.protocol().lower()=="file")) { + if((getuid()==0)&&(conv_dst_url.scheme().toLower()=="file")) { user=new RDSystemUser(username); if(!user->validatePassword(password)) { delete user; @@ -142,7 +142,7 @@ RDUpload::ErrorCode RDUpload::runUpload(const QString &username, if((curl=curl_easy_init())==NULL) { return RDUpload::ErrorInternal; } - if((f=fopen(conv_src_filename,"r"))==NULL) { + if((f=fopen(conv_src_filename.toUtf8(),"r"))==NULL) { curl_easy_cleanup(curl); return RDUpload::ErrorNoSource; } @@ -169,7 +169,7 @@ RDUpload::ErrorCode RDUpload::runUpload(const QString &username, curl_easy_setopt(curl,CURLOPT_KEYPASSWD,password.toUtf8().constData()); } else { - strncpy(userpwd,(username+":"+password).utf8(),256); + strncpy(userpwd,(username+":"+password).toUtf8(),256); curl_easy_setopt(curl,CURLOPT_USERPWD,userpwd); } @@ -182,7 +182,7 @@ RDUpload::ErrorCode RDUpload::runUpload(const QString &username, curl_easy_setopt(curl,CURLOPT_PROGRESSDATA,this); curl_easy_setopt(curl,CURLOPT_NOPROGRESS,0); curl_easy_setopt(curl,CURLOPT_USERAGENT, - (const char *)rda->config()->userAgent().utf8()); + (const char *)rda->config()->userAgent().toUtf8()); if(log_debug) { curl_easy_setopt(curl,CURLOPT_VERBOSE,1); curl_easy_setopt(curl,CURLOPT_DEBUGFUNCTION,UploadErrorCallback); @@ -233,8 +233,8 @@ RDUpload::ErrorCode RDUpload::runUpload(const QString &username, } if((curl_err!=CURLE_OK)&&log_debug) { rda->syslog(LOG_WARNING,"CURL upload failed: url: %s username: %s", - (const char *)conv_dst_url.toString(), - (const char *)username); + conv_dst_url.toString().toUtf8().constData(), + username.toUtf8().constData()); } curl_easy_cleanup(curl); fclose(f); diff --git a/lib/rdurl.cpp b/lib/rdurl.cpp index 1a928060..295d8100 100644 --- a/lib/rdurl.cpp +++ b/lib/rdurl.cpp @@ -34,14 +34,14 @@ RDUrl::RDUrl(const QString &url) bool RDUrl::validSmbShare() const { - return (protocol()=="smb")&&(!host().isEmpty())&&(path()!="/"); + return (scheme()=="smb")&&(!host().isEmpty())&&(path()!="/"); } QString RDUrl::smbShare() const { int offset=0; - if((offset=path().right(path().length()-1).find("/"))<0) { + if((offset=path().right(path().length()-1).indexOf("/"))<0) { offset=path().length(); } return QString("//")+host()+path().left(offset+1); @@ -51,7 +51,7 @@ QString RDUrl::smbShare() const QString RDUrl::smbPath() const { int offset=0; - if((offset=path().right(path().length()-1).find("/"))<0) { + if((offset=path().right(path().length()-1).indexOf("/"))<0) { return QString("/"); } return path().right(path().length()-offset-1); diff --git a/lib/rdwavedata_dialog.cpp b/lib/rdwavedata_dialog.cpp index 94ce3431..ed2774d6 100644 --- a/lib/rdwavedata_dialog.cpp +++ b/lib/rdwavedata_dialog.cpp @@ -68,7 +68,8 @@ RDWaveDataDialog::RDWaveDataDialog(const QString &caption,QWidget *parent) wave_usage_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); wave_usage_box=new QComboBox(this); for(int i=0;i<(int)RDCart::UsageLast;i++) { - wave_usage_box->insertItem(RDCart::usageText((RDCart::UsageCode)i)); + wave_usage_box->insertItem(wave_usage_box->count(), + RDCart::usageText((RDCart::UsageCode)i)); } // @@ -212,7 +213,7 @@ int RDWaveDataDialog::exec(RDWaveData *data) if(wave_data->releaseYear()>0) { wave_year_edit->setText(QString().sprintf("%d",wave_data->releaseYear())); } - wave_usage_box->setCurrentItem(wave_data->usageCode()); + wave_usage_box->setCurrentIndex(wave_data->usageCode()); wave_songid_edit->setText(wave_data->tmciSongId()); wave_bpm_spin->setValue(wave_data->beatsPerMinute()); wave_album_edit->setText(wave_data->album()); @@ -247,7 +248,8 @@ void RDWaveDataDialog::okData() else { wave_data->setReleaseYear(wave_year_edit->text().toInt()); } - wave_data->setUsageCode((RDWaveData::UsageCode)wave_usage_box->currentItem()); + wave_data->setUsageCode((RDWaveData::UsageCode)wave_usage_box-> + currentIndex()); wave_data->setTmciSongId(wave_songid_edit->text()); wave_data->setBeatsPerMinute(wave_bpm_spin->value()); wave_data->setAlbum(wave_album_edit->text()); diff --git a/lib/rdwavefile.cpp b/lib/rdwavefile.cpp index 18dfd425..2662539e 100644 --- a/lib/rdwavefile.cpp +++ b/lib/rdwavefile.cpp @@ -64,7 +64,7 @@ RDWaveFile::RDWaveFile(QString file_name) // Initialize Class Structures // wave_file_name=file_name; - wave_file.setName(file_name); + wave_file.setFileName(file_name); wave_data=NULL; recordable=false; format_chunk=false; @@ -198,7 +198,7 @@ void RDWaveFile::nameWave(QString file_name) if(wave_file.isOpen()) { return; } - wave_file.setName(file_name); + wave_file.setFileName(file_name); wave_file_name=file_name; } @@ -536,7 +536,7 @@ bool RDWaveFile::createWave(RDWaveData *data,unsigned ptr_offset) } prev_mask = umask(0113); // Set umask so files are user and group writable. rc=wave_file.open(QIODevice::ReadWrite|QIODevice::Truncate); - unlink((wave_file_name+".energy").ascii()); + unlink((wave_file_name+".energy").toAscii()); umask(prev_mask); if(rc==false) { return false; @@ -2592,15 +2592,15 @@ void RDWaveFile::WriteChunk(int fd,const char *cname,unsigned char *buf, void RDWaveFile::WriteChunk(int fd,const char *cname,const QString &contents) { unsigned char size_buf[4]; - size_buf[0]=contents.utf8().length()&0xff; - size_buf[1]=(contents.utf8().length()>>8)&0xff; - size_buf[2]=(contents.utf8().length()>>16)&0xff; - size_buf[3]=(contents.utf8().length()>>24)&0xff; + size_buf[0]=contents.toUtf8().length()&0xff; + size_buf[1]=(contents.toUtf8().length()>>8)&0xff; + size_buf[2]=(contents.toUtf8().length()>>16)&0xff; + size_buf[3]=(contents.toUtf8().length()>>24)&0xff; lseek(fd,0,SEEK_END); write(fd,cname,4); write(fd,size_buf,4); - write(fd,contents.utf8(),contents.utf8().length()); + write(fd,contents.toUtf8(),contents.toUtf8().length()); } @@ -3098,7 +3098,7 @@ bool RDWaveFile::GetAv10(int fd) if(av10_chunk_data[i]==0) { // Found a label/value pair, see if we can // use it if(label=="1") { // Start/end markers - if((n=arg.find(","))>0) { + if((n=arg.indexOf(","))>0) { pos=arg.left(n).toInt(&ok); if(ok) { offset=arg.right(arg.length()-n-1).toInt(&ok); @@ -3113,7 +3113,7 @@ bool RDWaveFile::GetAv10(int fd) } } if(label=="2") { // Segue markers - if((n=arg.find(","))>0) { + if((n=arg.indexOf(","))>0) { pos=arg.left(n).toInt(&ok); if(ok) { offset=arg.right(arg.length()-n-1).toInt(&ok); @@ -4265,7 +4265,7 @@ void RDWaveFile::ReadFlacMetadata() // every entry is a name=value pair. Name is not allowed to contain a '=' // so we just scan to the first instance of it. - int nameLength = entry.find('='); + int nameLength = entry.indexOf('='); if(nameLength < 0) continue; // malformed comment, it would seem QString name = entry.left(nameLength), value = entry.mid(nameLength + 1); @@ -4422,31 +4422,31 @@ bool RDWaveFile::MakeCart(unsigned ptr_offset) CART_VERSION); if(!cart_title.isEmpty()) { sprintf((char *)cart_chunk_data+4,"%s", - (const char *)cart_title.left(64)); + cart_title.left(64).toAscii().constData()); } if(!cart_artist.isEmpty()) { sprintf((char *)cart_chunk_data+68,"%s", - (const char *)cart_artist.left(64)); + cart_artist.left(64).toAscii().constData()); } if(!cart_cut_id.isEmpty()) { sprintf((char *)cart_chunk_data+132,"%s", - (const char *)cart_cut_id.left(64)); + cart_cut_id.left(64).toAscii().constData()); } if(!cart_client_id.isEmpty()) { sprintf((char *)cart_chunk_data+196,"%s", - (const char *)cart_client_id.left(64)); + cart_client_id.left(64).toAscii().constData()); } if(!cart_category.isEmpty()) { sprintf((char *)cart_chunk_data+260,"%s", - (const char *)cart_category.left(64)); + cart_category.left(64).toAscii().constData()); } if(!cart_classification.isEmpty()) { sprintf((char *)cart_chunk_data+324,"%s", - (const char *)cart_classification.left(64)); + cart_classification.left(64).toAscii().constData()); } if(!cart_out_cue.isEmpty()) { sprintf((char *)cart_chunk_data+388,"%s", - (const char *)cart_out_cue.left(64)); + cart_out_cue.left(64).toAscii().constData()); } if(cart_start_date.isValid()) { sprintf((char *)cart_chunk_data+452,"%04d-%02d-%02d", @@ -4488,7 +4488,7 @@ bool RDWaveFile::MakeCart(unsigned ptr_offset) snprintf((char *)cart_chunk_data+552,64,"%s",VERSION); if(!cart_user_def.isEmpty()) { sprintf((char *)cart_chunk_data+616,"%s", - (const char *)cart_user_def.left(64)); + cart_user_def.left(64).toAscii().constData()); } WriteDword(cart_chunk_data,680,cart_level_ref); if(wave_data!=NULL) { @@ -4529,7 +4529,7 @@ bool RDWaveFile::MakeCart(unsigned ptr_offset) } if(!cart_url.isEmpty()) { sprintf((char *)cart_chunk_data+1020,"%s", - (const char *)cart_url.left(1024)); + cart_url.left(1024).toAscii().constData()); } return true; } @@ -4545,15 +4545,15 @@ bool RDWaveFile::MakeBext() } if(!bext_description.isEmpty()) { sprintf((char *)bext_coding_data,"%s", - (const char *)bext_description.left(256)); + bext_description.left(256).toAscii().constData()); } if(!bext_originator.isEmpty()) { sprintf((char *)bext_coding_data+256,"%s", - (const char *)bext_originator.left(32)); + bext_originator.left(32).toAscii().constData()); } if(!bext_originator_ref.isEmpty()) { sprintf((char *)bext_coding_data+288,"%s", - (const char *)bext_originator_ref.left(32)); + bext_originator_ref.left(32).toAscii().constData()); } sprintf((char *)bext_coding_data+320,"%04d-%02d-%02d", bext_origination_date.year(), @@ -4571,7 +4571,7 @@ bool RDWaveFile::MakeBext() } if(!bext_coding_history.isEmpty()) { sprintf((char *)bext_coding_data+602,"%s", - (const char *)bext_coding_history); + bext_coding_history.toAscii().constData()); } return true; } @@ -4625,7 +4625,8 @@ bool RDWaveFile::MakeLevl() WriteDword(levl_chunk_data,24,levl_peak_offset); // Offset to Peak-of-Peaks WriteDword(levl_chunk_data,28,132); // Offset to Peak Data sprintf((char *)levl_chunk_data+32,"%s", - (const char *)levl_timestamp.toString("yyyy:MM:dd:hh:mm:ss:000")); + levl_timestamp.toString("yyyy:MM:dd:hh:mm:ss:000").toAscii(). + constData()); return true; } @@ -4905,7 +4906,7 @@ bool RDWaveFile::ReadNormalizeLevel(QString wave_file_name) // // FIXME: This is really evil! // - energy_file.setName(wave_file_name+".energy"); + energy_file.setFileName(wave_file_name+".energy"); if(!energy_file.open(QIODevice::ReadOnly)) return false; if((n=energy_file.readLine(str,20)) <= 0) diff --git a/lib/rdwavepainter.cpp b/lib/rdwavepainter.cpp index 3b9d01db..d27beada 100644 --- a/lib/rdwavepainter.cpp +++ b/lib/rdwavepainter.cpp @@ -20,7 +20,6 @@ #include -#include #include #include #include @@ -121,7 +120,7 @@ void RDWavePainter::drawWaveBySamples(int x,int w,int startsamp,int endsamp, break; } save(); - resetXForm(); + resetTransform(); setPen(color); setBrush(color); QPolygon array(w+2); diff --git a/lib/rdweb.cpp b/lib/rdweb.cpp index 8a402aec..a3a99bfb 100644 --- a/lib/rdweb.cpp +++ b/lib/rdweb.cpp @@ -563,7 +563,7 @@ extern void RDXMLResult(const char *str,int resp_code, printf("Content-type: application/xml\n"); printf("Status: %d\n",resp_code); printf("\n"); - printf("%s",(const char *)we->xml()); + printf("%s",we->xml().toUtf8().constData()); delete we; exit(0); @@ -790,7 +790,7 @@ bool RDParsePost(std::map *vars) if(getenv("REQUEST_METHOD")==NULL) { return false; } - if(QString(getenv("REQUEST_METHOD")).lower()!="post") { + if(QString(getenv("REQUEST_METHOD")).toLower()!="post") { return false; } if((f=fdopen(0,"r"))==NULL) { @@ -799,13 +799,13 @@ bool RDParsePost(std::map *vars) if((n=getline(&data,(size_t *)&n,f))<=0) { return false; } - sep=QString(data).stripWhiteSpace(); + sep=QString(data).trimmed(); // // Get message parts // while((n=getline(&data,(size_t *)&n,f))>0) { - if(QString(data).stripWhiteSpace().contains(sep)>0) { // End of part + if(QString(data).trimmed().contains(sep)>0) { // End of part if(fd>=0) { ftruncate(fd,lseek(fd,0,SEEK_CUR)-2); // Remove extraneous final CR/LF ::close(fd); @@ -818,29 +818,29 @@ bool RDParsePost(std::map *vars) continue; } if(header) { // Read header - if(QString(data).stripWhiteSpace().isEmpty()) { + if(QString(data).trimmed().isEmpty()) { if(!headers["content-disposition"].isNull()) { QStringList fields; fields=headers["content-disposition"].split(";"); if(fields.size()>0) { - if(fields[0].lower().stripWhiteSpace()=="form-data") { + if(fields[0].toLower().trimmed()=="form-data") { for(int i=1;i *vars) else { QStringList hdr; hdr=QString(data).trimmed().split(":"); - headers[hdr[0].lower()]=hdr[1]; + headers[hdr[0].toLower()]=hdr[1]; } } else { // Read data @@ -1158,7 +1158,7 @@ QString RDUrlUnescape(const QString &str) QString ret=""; for(int i=0;isetValidator(validator); connect(feed_keyname_edit,SIGNAL(textChanged(const QString &)), this,SLOT(keynameChangedData(const QString &))); - feed_keyname_label=new QLabel(feed_keyname_edit,tr("&New Feed Name:"),this); + feed_keyname_label=new QLabel(tr("&New Feed Name:"),this); feed_keyname_label->setFont(labelFont()); feed_keyname_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -70,7 +70,7 @@ AddFeed::AddFeed(unsigned *id,QString *keyname,QWidget *parent) feed_users_box=new QCheckBox(this); feed_users_box->setChecked(true); feed_users_label= - new QLabel(feed_users_box,tr("Enable Feed for All Users"),this); + new QLabel(tr("Enable Feed for All Users"),this); feed_users_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // diff --git a/rdadmin/add_group.cpp b/rdadmin/add_group.cpp index 6e985039..241823c3 100644 --- a/rdadmin/add_group.cpp +++ b/rdadmin/add_group.cpp @@ -57,11 +57,11 @@ AddGroup::AddGroup(QString *group,QWidget *parent) group_name_edit->setGeometry(145,11,sizeHint().width()-150,19); group_name_edit->setMaxLength(10); group_name_edit->setValidator(validator); - QLabel *label=new QLabel(group_name_edit,tr("&New Group Name:"),this); + QLabel *label=new QLabel(tr("&New Group Name:"),this); label->setFont(labelFont()); label->setGeometry(10,11,130,19); label->setFont(labelFont()); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Enable Users Checkbox @@ -69,10 +69,10 @@ AddGroup::AddGroup(QString *group,QWidget *parent) group_users_box=new QCheckBox(this); group_users_box->setGeometry(40,40,15,15); group_users_box->setChecked(true); - label=new QLabel(group_users_box,tr("Enable Group for All Users"),this); + label=new QLabel(tr("Enable Group for All Users"),this); label->setFont(subLabelFont()); label->setGeometry(60,38,sizeHint().width()-60,19); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Enable Services Checkbox @@ -80,10 +80,10 @@ AddGroup::AddGroup(QString *group,QWidget *parent) group_svcs_box=new QCheckBox(this); group_svcs_box->setGeometry(40,61,15,15); group_svcs_box->setChecked(true); - label=new QLabel(group_svcs_box,tr("Enable Group for All Services"),this); + label=new QLabel(tr("Enable Group for All Services"),this); label->setFont(subLabelFont()); label->setGeometry(60,58,sizeHint().width()-60,19); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Ok Button diff --git a/rdadmin/add_matrix.cpp b/rdadmin/add_matrix.cpp index 63e482e4..919a1400 100644 --- a/rdadmin/add_matrix.cpp +++ b/rdadmin/add_matrix.cpp @@ -54,7 +54,7 @@ AddMatrix::AddMatrix(QString station,QWidget *parent) add_matrix_box=new QSpinBox(this); add_matrix_box->setGeometry(165,11,30,19); add_matrix_box->setRange(0,MAX_MATRICES-1); - QLabel *label=new QLabel(add_matrix_box,tr("&New Matrix Number:"),this); + QLabel *label=new QLabel(tr("&New Matrix Number:"),this); label->setGeometry(10,11,150,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -65,9 +65,10 @@ AddMatrix::AddMatrix(QString station,QWidget *parent) add_type_box=new QComboBox(this); add_type_box->setGeometry(165,36,200,19); for(int i=0;iinsertItem(RDMatrix::typeString((RDMatrix::Type)i)); + add_type_box-> + insertItem(add_type_box->count(),RDMatrix::typeString((RDMatrix::Type)i)); } - label=new QLabel(add_type_box,tr("&Switcher Type:"),this); + label=new QLabel(tr("&Switcher Type:"),this); label->setGeometry(10,36,150,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -143,16 +144,21 @@ void AddMatrix::okData() PORT_TYPE=%d,\ PORT_TYPE_2=%d", add_matrix_box->value(), - add_type_box->currentItem(), - RDMatrix::defaultControlValue((RDMatrix::Type)add_type_box->currentItem(), + add_type_box->currentIndex(), + RDMatrix::defaultControlValue((RDMatrix::Type)add_type_box-> + currentIndex(), RDMatrix::InputsControl), - RDMatrix::defaultControlValue((RDMatrix::Type)add_type_box->currentItem(), + RDMatrix::defaultControlValue((RDMatrix::Type)add_type_box-> + currentIndex(), RDMatrix::OutputsControl), - RDMatrix::defaultControlValue((RDMatrix::Type)add_type_box->currentItem(), + RDMatrix::defaultControlValue((RDMatrix::Type)add_type_box-> + currentIndex(), RDMatrix::GpisControl), - RDMatrix::defaultControlValue((RDMatrix::Type)add_type_box->currentItem(), + RDMatrix::defaultControlValue((RDMatrix::Type)add_type_box-> + currentIndex(), RDMatrix::GposControl), - RDMatrix::defaultControlValue((RDMatrix::Type)add_type_box->currentItem(), + RDMatrix::defaultControlValue((RDMatrix::Type)add_type_box-> + currentIndex(), RDMatrix::PortTypeControl), RDMatrix::NoPort); q=new RDSqlQuery(sql); diff --git a/rdadmin/add_replicator.cpp b/rdadmin/add_replicator.cpp index 1477a19b..0757d06f 100644 --- a/rdadmin/add_replicator.cpp +++ b/rdadmin/add_replicator.cpp @@ -55,7 +55,7 @@ AddReplicator::AddReplicator(QString *rname,QWidget *parent) repl_name_edit->setGeometry(145,11,sizeHint().width()-150,19); repl_name_edit->setMaxLength(10); repl_name_edit->setValidator(validator); - QLabel *label=new QLabel(repl_name_edit,tr("Replicator Name:"),this); + QLabel *label=new QLabel(tr("Replicator Name:"),this); label->setGeometry(10,11,130,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); diff --git a/rdadmin/add_report.cpp b/rdadmin/add_report.cpp index a87b7da9..af6aa2f8 100644 --- a/rdadmin/add_report.cpp +++ b/rdadmin/add_report.cpp @@ -58,7 +58,7 @@ AddReport::AddReport(QString *rptname,QWidget *parent) add_name_edit->setGeometry(170,10,sizeHint().width()-180,19); add_name_edit->setMaxLength(64); add_name_edit->setValidator(validator); - QLabel *label=new QLabel(add_name_edit,tr("&Report Name:"),this); + QLabel *label=new QLabel(tr("&Report Name:"),this); label->setGeometry(10,10,155,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); diff --git a/rdadmin/add_schedcodes.cpp b/rdadmin/add_schedcodes.cpp index a8db026f..9c407437 100644 --- a/rdadmin/add_schedcodes.cpp +++ b/rdadmin/add_schedcodes.cpp @@ -45,7 +45,7 @@ AddSchedCode::AddSchedCode(QWidget *parent) d_code_edit=new QLineEdit(this); d_code_edit->setGeometry(105,11,sizeHint().width()-150,19); d_code_edit->setMaxLength(10); - QLabel *label=new QLabel(d_code_edit,tr("&New Code:"),this); + QLabel *label=new QLabel(tr("&New Code:"),this); label->setGeometry(10,11,90,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); diff --git a/rdadmin/add_station.cpp b/rdadmin/add_station.cpp index a2c6d4af..bf2112b9 100644 --- a/rdadmin/add_station.cpp +++ b/rdadmin/add_station.cpp @@ -58,7 +58,7 @@ AddStation::AddStation(QString *stationname,QWidget *parent) add_name_edit->setGeometry(130,10,sizeHint().width()-140,19); add_name_edit->setMaxLength(64); add_name_edit->setValidator(validator); - QLabel *label=new QLabel(add_name_edit,tr("New &Host Name:"),this); + QLabel *label=new QLabel(tr("New &Host Name:"),this); label->setGeometry(10,10,115,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -68,7 +68,7 @@ AddStation::AddStation(QString *stationname,QWidget *parent) // add_exemplar_box=new QComboBox(this); add_exemplar_box->setGeometry(130,35,sizeHint().width()-140,19); - label=new QLabel(add_exemplar_box,tr("Base Host On:"),this); + label=new QLabel(tr("Base Host On:"),this); label->setGeometry(10,35,115,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -97,11 +97,12 @@ AddStation::AddStation(QString *stationname,QWidget *parent) // // Fill Exemplar List // - add_exemplar_box->insertItem(tr("Empty Host Config")); + add_exemplar_box->insertItem(0,tr("Empty Host Config")); QString sql="select NAME from STATIONS"; RDSqlQuery *q=new RDSqlQuery(sql); while(q->next()) { - add_exemplar_box->insertItem(q->value(0).toString()); + add_exemplar_box-> + insertItem(add_exemplar_box->count(),q->value(0).toString()); } delete q; } @@ -136,7 +137,7 @@ void AddStation::okData() return; } - if(add_exemplar_box->currentItem()==0) { // Create Blank Host Config + if(add_exemplar_box->currentIndex()==0) { // Create Blank Host Config ok=RDStation::create(add_name_edit->text(),&err_msg); } else { diff --git a/rdadmin/add_svc.cpp b/rdadmin/add_svc.cpp index b3c4a126..fad10331 100644 --- a/rdadmin/add_svc.cpp +++ b/rdadmin/add_svc.cpp @@ -58,8 +58,7 @@ AddSvc::AddSvc(QString *svcname,QWidget *parent) svc_name_edit->setGeometry(155,11,sizeHint().width()-165,19); svc_name_edit->setMaxLength(10); svc_name_edit->setValidator(validator); - QLabel *svc_name_label= - new QLabel(svc_name_edit,tr("&New Service Name:"),this); + QLabel *svc_name_label=new QLabel(tr("&New Service Name:"),this); svc_name_label->setGeometry(10,11,140,19); svc_name_label->setFont(labelFont()); svc_name_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -70,7 +69,7 @@ AddSvc::AddSvc(QString *svcname,QWidget *parent) svc_exemplar_box=new QComboBox(this); svc_exemplar_box->setGeometry(155,36,sizeHint().width()-165,19); QLabel *svc_exemplar_label= - new QLabel(svc_exemplar_box,tr("Base Service On:"),this); + new QLabel(tr("Base Service On:"),this); svc_exemplar_label->setGeometry(10,36,140,19); svc_exemplar_label->setFont(labelFont()); svc_exemplar_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -98,11 +97,12 @@ AddSvc::AddSvc(QString *svcname,QWidget *parent) // // Populate Exemplar List // - svc_exemplar_box->insertItem(tr("Empty Host Config")); + svc_exemplar_box->insertItem(0,tr("Empty Host Config")); QString sql="select NAME from SERVICES"; RDSqlQuery *q=new RDSqlQuery(sql); while(q->next()) { - svc_exemplar_box->insertItem(q->value(0).toString()); + svc_exemplar_box-> + insertItem(svc_exemplar_box->count(),q->value(0).toString()); } delete q; } @@ -137,29 +137,13 @@ void AddSvc::okData() return; } - if(svc_exemplar_box->currentItem()>0) { + if(svc_exemplar_box->currentIndex()>0) { exemplar=svc_exemplar_box->currentText(); } if(!RDSvc::create(svc_name_edit->text(),&err_msg,exemplar,rda->config())) { QMessageBox::warning(this,"RDAdmin - "+tr("Error"),err_msg); return; } - /* - RDSvc *svc=new RDSvc(svc_name_edit->text(),admin_station,admin_config,this); - if(svc->exists()) { - QMessageBox::warning(this,tr("Service Exists"), - tr("Service Already Exists!")); - delete svc; - return; - } - if(svc_exemplar_box->currentItem()==0) { // Create Empty Service - svc->create("",admin_config); - } - else { - svc->create(svc_exemplar_box->currentText(),admin_config); - } - delete svc; - */ *svc_name=svc_name_edit->text(); EditSvc *edit_svc=new EditSvc(svc_name_edit->text(),this); diff --git a/rdadmin/add_user.cpp b/rdadmin/add_user.cpp index 741a3f40..274448c8 100644 --- a/rdadmin/add_user.cpp +++ b/rdadmin/add_user.cpp @@ -50,10 +50,10 @@ AddUser::AddUser(QString *username,QWidget *parent) user_name_edit=new QLineEdit(this); user_name_edit->setGeometry(125,11,sizeHint().width()-135,19); user_name_edit->setMaxLength(255); - QLabel *user_name_label=new QLabel(user_name_edit,tr("&New User Name:"),this); + QLabel *user_name_label=new QLabel(tr("&New User Name:"),this); user_name_label->setGeometry(10,13,110,19); user_name_label->setFont(labelFont()); - user_name_label->setAlignment(Qt::AlignRight|Qt::TextShowMnemonic); + user_name_label->setAlignment(Qt::AlignRight); // // Ok Button diff --git a/rdadmin/edit_audios.cpp b/rdadmin/edit_audios.cpp index d714c5c5..555ca43f 100644 --- a/rdadmin/edit_audios.cpp +++ b/rdadmin/edit_audios.cpp @@ -2,7 +2,7 @@ // // Edit a Rivendell Audio Port Configuration // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,24 +18,14 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include #include "edit_audios.h" EditAudioPorts::EditAudioPorts(QString station,QWidget *parent) : RDDialog(parent) { - setModal(true); - QString str; // @@ -57,10 +47,9 @@ EditAudioPorts::EditAudioPorts(QString station,QWidget *parent) // edit_card_box=new QComboBox(this); edit_card_box->setGeometry(75,10,60,26); - edit_card_box->setInsertionPolicy(QComboBox::NoInsert); connect(edit_card_box,SIGNAL(activated(int)), this,SLOT(cardSelectedData(int))); - QLabel *label=new QLabel(edit_card_box,tr("Card:"),this); + QLabel *label=new QLabel(tr("Card:"),this); label->setGeometry(10,16,60,22); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight); @@ -71,7 +60,7 @@ EditAudioPorts::EditAudioPorts(QString station,QWidget *parent) card_driver_edit=new QLineEdit(this); card_driver_edit->setGeometry(225,15,170,19);//FIXME: size card_driver_edit->setReadOnly(true); - label=new QLabel(edit_card_box,tr("Card Driver:"),this); + label=new QLabel(tr("Card Driver:"),this); label->setGeometry(140,16,80,22); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight); @@ -81,8 +70,7 @@ EditAudioPorts::EditAudioPorts(QString station,QWidget *parent) // edit_clock_box=new QComboBox(this); edit_clock_box->setGeometry(500,10,150,26); - edit_clock_box->setInsertionPolicy(QComboBox::NoInsert); - edit_clock_label=new QLabel(edit_clock_box,tr("Clock Source:"),this); + edit_clock_label=new QLabel(tr("Clock Source:"),this); edit_clock_label->setGeometry(395,16,100,22); edit_clock_label->setFont(labelFont()); edit_clock_label->setAlignment(Qt::AlignRight); @@ -101,25 +89,32 @@ EditAudioPorts::EditAudioPorts(QString station,QWidget *parent) connect(mapper,SIGNAL(mapped(int)),this,SLOT(inputMapData(int))); edit_type_box[j*4+i]=new QComboBox(this); edit_type_box[j*4+i]->setGeometry(95+170*i,75+j*180,110,26); - edit_type_box[j*4+i]->insertItem(tr("Analog")); - edit_type_box[j*4+i]->insertItem(tr("AES/EBU")); - edit_type_box[j*4+i]->insertItem(tr("SP/DIFF")); + edit_type_box[j*4+i]-> + insertItem(edit_type_box[j*4+i]->count(),tr("Analog")); + edit_type_box[j*4+i]-> + insertItem(edit_type_box[j*4+i]->count(),tr("AES/EBU")); + edit_type_box[j*4+i]-> + insertItem(edit_type_box[j*4+i]->count(),tr("SP/DIFF")); mapper->setMapping(edit_type_box[j*4+i],j*4+i); connect(edit_type_box[j*4+i],SIGNAL(activated(int)),mapper,SLOT(map())); - edit_type_label[j*4+i]=new QLabel(edit_type_box[j*4+i],tr("Type:"),this); + edit_type_label[j*4+i]=new QLabel(tr("Type:"),this); edit_type_label[j*4+i]->setFont(labelFont()); edit_type_label[j*4+i]->setGeometry(50+170*i,81+j*180,40,22); edit_type_label[j*4+i]->setAlignment(Qt::AlignRight); edit_mode_box[j*4+i]=new QComboBox(this); edit_mode_box[j*4+i]->setGeometry(95+170*i,105+j*180,110,26); // NOTE: this drop down list box is populated to match RDCae::ChannelMode - edit_mode_box[j*4+i]->insertItem(tr("Normal")); - edit_mode_box[j*4+i]->insertItem(tr("Swap")); - edit_mode_box[j*4+i]->insertItem(tr("Left only")); - edit_mode_box[j*4+i]->insertItem(tr("Right only")); + edit_mode_box[j*4+i]-> + insertItem(edit_mode_box[j*4+i]->count(),tr("Normal")); + edit_mode_box[j*4+i]-> + insertItem(edit_mode_box[j*4+i]->count(),tr("Swap")); + edit_mode_box[j*4+i]-> + insertItem(edit_mode_box[j*4+i]->count(),tr("Left only")); + edit_mode_box[j*4+i]-> + insertItem(edit_mode_box[j*4+i]->count(),tr("Right only")); mapper->setMapping(edit_mode_box[j*4+i],j*4+i); connect(edit_mode_box[j*4+i],SIGNAL(activated(int)),mapper,SLOT(map())); - edit_mode_label[j*4+i]=new QLabel(edit_type_box[j*4+i],tr("Mode:"),this); + edit_mode_label[j*4+i]=new QLabel(tr("Mode:"),this); edit_mode_label[j*4+i]->setFont(labelFont()); edit_mode_label[j*4+i]->setGeometry(50+170*i,111+j*180,40,22); edit_mode_label[j*4+i]->setAlignment(Qt::AlignRight); @@ -128,8 +123,7 @@ EditAudioPorts::EditAudioPorts(QString station,QWidget *parent) edit_input_box[j*4+i]->setGeometry(95+170*i,135+j*180,60,24); edit_input_box[j*4+i]->setRange(-26,6); edit_input_box[j*4+i]->setSuffix(tr(" dB")); - edit_input_label[j*4+i]= - new QLabel(edit_type_box[j*4+i],tr("Ref. Level:"),this); + edit_input_label[j*4+i]=new QLabel(tr("Ref. Level:"),this); edit_input_label[j*4+i]->setFont(labelFont()); edit_input_label[j*4+i]->setGeometry(10+170*i,140+j*180,80,22); edit_input_label[j*4+i]->setAlignment(Qt::AlignRight); @@ -147,8 +141,7 @@ EditAudioPorts::EditAudioPorts(QString station,QWidget *parent) edit_output_box[j*4+i]->setGeometry(95+170*i,190+j*180,60,24); edit_output_box[j*4+i]->setRange(-26,6); edit_output_box[j*4+i]->setSuffix(tr(" dB")); - edit_output_label[j*4+i]= - new QLabel(edit_type_box[j*4+i],tr("Ref. Level:"),this); + edit_output_label[j*4+i]=new QLabel(tr("Ref. Level:"),this); edit_output_label[j*4+i]->setFont(labelFont()); edit_output_label[j*4+i]->setGeometry(10+170*i,195+j*180,80,22); edit_output_label[j*4+i]->setAlignment(Qt::AlignRight); @@ -179,13 +172,13 @@ EditAudioPorts::EditAudioPorts(QString station,QWidget *parent) // // for(int i=0;iinsertItem(QString().sprintf("%d",i)); + edit_card_box->insertItem(edit_card_box->count(),QString().sprintf("%d",i)); } - edit_clock_box->insertItem(tr("Internal")); - edit_clock_box->insertItem(tr("AES/EBU Signal")); - edit_clock_box->insertItem(tr("SP/DIFF Signal")); - edit_clock_box->insertItem(tr("Word Clock")); - edit_card_num=edit_card_box->currentItem(); + edit_clock_box->insertItem(edit_clock_box->count(),tr("Internal")); + edit_clock_box->insertItem(edit_clock_box->count(),tr("AES/EBU Signal")); + edit_clock_box->insertItem(edit_clock_box->count(),tr("SP/DIFF Signal")); + edit_clock_box->insertItem(edit_clock_box->count(),tr("Word Clock")); + edit_card_num=edit_card_box->currentIndex(); ReadRecord(edit_card_num); } @@ -210,7 +203,7 @@ QSizePolicy EditAudioPorts::sizePolicy() const void EditAudioPorts::cardSelectedData(int card) { WriteRecord(); - edit_card_num=edit_card_box->currentItem(); + edit_card_num=edit_card_box->currentIndex(); ReadRecord(edit_card_num); } @@ -221,7 +214,7 @@ void EditAudioPorts::inputMapData(int id) rdstation=new RDStation(edit_station); } if( (rdstation->cardDriver(edit_card_num)==RDStation::Hpi) && - (edit_type_box[id]->currentItem()==RDAudioPort::Analog) ) { + (edit_type_box[id]->currentIndex()==RDAudioPort::Analog) ) { edit_input_label[id]->setEnabled(true); edit_input_box[id]->setEnabled(true); } @@ -332,12 +325,12 @@ void EditAudioPorts::ReadRecord(int card) } break; } - edit_clock_box->setCurrentItem(edit_card->clockSource()); + edit_clock_box->setCurrentIndex(edit_card->clockSource()); // for(int i=0;isetCurrentItem((int)edit_card->inputPortType(i)); + edit_type_box[i]->setCurrentIndex((int)edit_card->inputPortType(i)); if( (rdstation->cardDriver(card)==RDStation::Hpi) && - ((RDAudioPort::PortType)edit_type_box[i]->currentItem()== + ((RDAudioPort::PortType)edit_type_box[i]->currentIndex()== RDAudioPort::Analog) ) { edit_input_label[i]->setEnabled(true); edit_input_box[i]->setEnabled(true); @@ -346,7 +339,7 @@ void EditAudioPorts::ReadRecord(int card) edit_input_label[i]->setDisabled(true); edit_input_box[i]->setDisabled(true); } - edit_mode_box[i]->setCurrentItem((int)edit_card->inputPortMode(i)); + edit_mode_box[i]->setCurrentIndex((int)edit_card->inputPortMode(i)); edit_input_box[i]->setValue(edit_card->inputPortLevel(i)/100); edit_output_box[i]->setValue(edit_card->outputPortLevel(i)/100); } @@ -356,13 +349,13 @@ void EditAudioPorts::ReadRecord(int card) void EditAudioPorts::WriteRecord() { edit_card-> - setClockSource((RDCae::ClockSource)edit_clock_box->currentItem()); + setClockSource((RDCae::ClockSource)edit_clock_box->currentIndex()); // for(int i=0;isetInputPortType(i, - (RDAudioPort::PortType)edit_type_box[i]->currentItem()); + (RDAudioPort::PortType)edit_type_box[i]->currentIndex()); edit_card->setInputPortMode(i, - (RDCae::ChannelMode)edit_mode_box[i]->currentItem()); + (RDCae::ChannelMode)edit_mode_box[i]->currentIndex()); edit_card->setInputPortLevel(i,edit_input_box[i]->value()*100); edit_card->setOutputPortLevel(i,edit_output_box[i]->value()*100); } diff --git a/rdadmin/edit_cartslots.cpp b/rdadmin/edit_cartslots.cpp index 34d4fa02..f9bb0410 100644 --- a/rdadmin/edit_cartslots.cpp +++ b/rdadmin/edit_cartslots.cpp @@ -2,7 +2,7 @@ // // Edit Rivendell CartSlot Configuration // -// (C) Copyright 2012-2019 Fred Gleason +// (C) Copyright 2012-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,9 +18,8 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include #include +#include #include #include @@ -70,7 +69,7 @@ EditCartSlots::EditCartSlots(RDStation *station,RDStation *cae_station, edit_slot_columns_spin->setRange(1,RDCARTSLOTS_MAX_COLUMNS); connect(edit_slot_columns_spin,SIGNAL(valueChanged(int)), this,SLOT(quantityChangedData(int))); - label=new QLabel(edit_slot_columns_spin,tr("Slot Columns:"),this); + label=new QLabel(tr("Slot Columns:"),this); label->setGeometry(10,32,112,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -83,7 +82,7 @@ EditCartSlots::EditCartSlots(RDStation *station,RDStation *cae_station, edit_slot_rows_spin->setRange(1,RDCARTSLOTS_MAX_ROWS); connect(edit_slot_rows_spin,SIGNAL(valueChanged(int)), this,SLOT(quantityChangedData(int))); - label=new QLabel(edit_slot_rows_spin,tr("Slot Rows:"),this); + label=new QLabel(tr("Slot Rows:"),this); label->setGeometry(10,54,112,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -95,7 +94,7 @@ EditCartSlots::EditCartSlots(RDStation *station,RDStation *cae_station, edit_slot_box->setGeometry(107,98,60,20); connect(edit_slot_box,SIGNAL(activated(int)), this,SLOT(slotChangedData(int))); - label=new QLabel(edit_slot_box,tr("Slot"),this); + label=new QLabel(tr("Slot"),this); label->setGeometry(10,98,92,20); label->setFont(sectionLabelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -121,7 +120,7 @@ EditCartSlots::EditCartSlots(RDStation *station,RDStation *cae_station, edit_card_spin->setSpecialValueText(tr("None")); connect(edit_card_spin,SIGNAL(valueChanged(int)), this,SLOT(cardChangedData(int))); - label=new QLabel(edit_card_spin,tr("Card:"),this); + label=new QLabel(tr("Card:"),this); label->setGeometry(10,145,112,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -133,7 +132,7 @@ EditCartSlots::EditCartSlots(RDStation *station,RDStation *cae_station, edit_input_spin->setGeometry(127,167,50,20); edit_input_spin->setRange(-1,RD_MAX_PORTS-1); edit_input_spin->setSpecialValueText(tr("None")); - label=new QLabel(edit_input_spin,tr("Input Port:"),this); + label=new QLabel(tr("Input Port:"),this); label->setGeometry(10,167,112,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -145,7 +144,7 @@ EditCartSlots::EditCartSlots(RDStation *station,RDStation *cae_station, edit_output_spin->setGeometry(127,189,50,20); edit_output_spin->setRange(-1,RD_MAX_PORTS-1); edit_output_spin->setSpecialValueText(tr("None")); - label=new QLabel(edit_output_spin,tr("Output Port:"),this); + label=new QLabel(tr("Output Port:"),this); label->setGeometry(10,189,112,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -163,15 +162,15 @@ EditCartSlots::EditCartSlots(RDStation *station,RDStation *cae_station, // edit_service_box=new QComboBox(this); edit_service_box->setGeometry(127,240,120,20); - edit_service_label= - new QLabel(edit_service_box,tr("Service:"),this); + edit_service_label=new QLabel(tr("Service:"),this); edit_service_label->setGeometry(10,240,112,20); edit_service_label->setFont(labelFont()); edit_service_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); sql="select NAME from SERVICES order by NAME"; q=new RDSqlQuery(sql); while(q->next()) { - edit_service_box->insertItem(q->value(0).toString()); + edit_service_box-> + insertItem(edit_service_box->count(),q->value(0).toString()); } delete q; @@ -180,12 +179,13 @@ EditCartSlots::EditCartSlots(RDStation *station,RDStation *cae_station, // edit_mode_box=new QComboBox(this); edit_mode_box->setGeometry(127,262,150,20); - edit_mode_box->insertItem(tr("User previous mode")); + edit_mode_box->insertItem(0,tr("User previous mode")); for(int i=0;iinsertItem(RDSlotOptions::modeText((RDSlotOptions::Mode)i)); + edit_mode_box->insertItem(edit_mode_box->count(), + RDSlotOptions::modeText((RDSlotOptions::Mode)i)); } connect(edit_mode_box,SIGNAL(activated(int)),this,SLOT(modeData(int))); - label=new QLabel(edit_mode_box,tr("Slot Mode:"),this); + label=new QLabel(tr("Slot Mode:"),this); label->setGeometry(10,262,112,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -195,10 +195,10 @@ EditCartSlots::EditCartSlots(RDStation *station,RDStation *cae_station, // edit_play_mode_box=new QComboBox(this); edit_play_mode_box->setGeometry(127,284,150,20); - edit_play_mode_box->insertItem(tr("Use previous mode")); - edit_play_mode_box->insertItem(tr("Full")); - edit_play_mode_box->insertItem(tr("Hook")); - edit_play_mode_label=new QLabel(edit_play_mode_box,tr("Play Mode:"),this); + edit_play_mode_box->insertItem(0,tr("Use previous mode")); + edit_play_mode_box->insertItem(1,tr("Full")); + edit_play_mode_box->insertItem(2,tr("Hook")); + edit_play_mode_label=new QLabel(tr("Play Mode:"),this); edit_play_mode_label->setGeometry(10,284,112,20); edit_play_mode_label->setFont(labelFont()); edit_play_mode_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -208,13 +208,12 @@ EditCartSlots::EditCartSlots(RDStation *station,RDStation *cae_station, // edit_cartaction_box=new QComboBox(this); edit_cartaction_box->setGeometry(127,306,150,20); - edit_cartaction_box->insertItem(tr("Use previous cart")); - edit_cartaction_box->insertItem(tr("Do Nothing")); - edit_cartaction_box->insertItem(tr("Load Specified Cart")); + edit_cartaction_box->insertItem(0,tr("Use previous cart")); + edit_cartaction_box->insertItem(1,tr("Do Nothing")); + edit_cartaction_box->insertItem(2,tr("Load Specified Cart")); connect(edit_cartaction_box,SIGNAL(activated(int)), this,SLOT(cartActionData(int))); - edit_cartaction_label= - new QLabel(edit_cartaction_box,tr("At Startup:"),this); + edit_cartaction_label=new QLabel(tr("At Startup:"),this); edit_cartaction_label->setGeometry(10,306,112,20); edit_cartaction_label->setFont(labelFont()); edit_cartaction_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -225,7 +224,7 @@ EditCartSlots::EditCartSlots(RDStation *station,RDStation *cae_station, edit_cart_edit=new QLineEdit(this); edit_cart_edit->setGeometry(147,333,60,20); edit_cart_edit->setReadOnly(true); - edit_cart_label=new QLabel(edit_cart_edit,tr("Cart:"),this); + edit_cart_label=new QLabel(tr("Cart:"),this); edit_cart_label->setGeometry(10,333,132,20); edit_cart_label->setFont(labelFont()); edit_cart_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -239,12 +238,13 @@ EditCartSlots::EditCartSlots(RDStation *station,RDStation *cae_station, // edit_stop_action_box=new QComboBox(this); edit_stop_action_box->setGeometry(127,360,150,20); - edit_stop_action_box->insertItem(tr("Use previous action")); + edit_stop_action_box->insertItem(0,tr("Use previous action")); for(int i=0;i - insertItem(RDSlotOptions::stopActionText((RDSlotOptions::StopAction)i)); + insertItem(edit_stop_action_box->count(), + RDSlotOptions::stopActionText((RDSlotOptions::StopAction)i)); } - edit_stop_action_label=new QLabel(edit_stop_action_box,tr("At Playout End:"),this); + edit_stop_action_label=new QLabel(tr("At Playout End:"),this); edit_stop_action_label->setGeometry(10,360,112,20); edit_stop_action_label->setFont(labelFont()); edit_stop_action_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -263,7 +263,7 @@ EditCartSlots::EditCartSlots(RDStation *station,RDStation *cae_station, edit_slot_columns_spin->setValue(station->cartSlotColumns()); edit_slot_rows_spin->setValue(station->cartSlotRows()); quantityChangedData(0); - ReadSlot(edit_slot_box->currentItem()); + ReadSlot(edit_slot_box->currentIndex()); } @@ -280,15 +280,16 @@ QSize EditCartSlots::sizeHint() const void EditCartSlots::quantityChangedData(int index) { - int slot=edit_slot_box->currentItem(); + int slot=edit_slot_box->currentIndex(); int slot_quan= edit_slot_columns_spin->value()*edit_slot_rows_spin->value(); edit_slot_box->clear(); for(int i=0;iinsertItem(QString().sprintf("%d",i+1)); + edit_slot_box->insertItem(edit_slot_box->count(), + QString().sprintf("%d",i+1)); if(i==slot) { - edit_slot_box->setCurrentItem(i); + edit_slot_box->setCurrentIndex(i); } } if(slot>slot_quan) { @@ -338,7 +339,7 @@ void EditCartSlots::modeData(int mode) cartActionData(0); } else { - cartActionData(edit_cartaction_box->currentItem()); + cartActionData(edit_cartaction_box->currentIndex()); } } @@ -365,7 +366,7 @@ void EditCartSlots::closeData() { edit_station->setCartSlotColumns(edit_slot_columns_spin->value()); edit_station->setCartSlotRows(edit_slot_rows_spin->value()); - WriteSlot(edit_slot_box->currentItem()); + WriteSlot(edit_slot_box->currentIndex()); done(0); } @@ -398,27 +399,27 @@ void EditCartSlots::ReadSlot(unsigned slotnum) edit_input_spin->setValue(q->value(1).toInt()); edit_output_spin->setValue(q->value(2).toInt()); cardChangedData(edit_card_spin->value()); - edit_mode_box->setCurrentItem(q->value(3).toInt()+1); - edit_play_mode_box->setCurrentItem(q->value(4).toInt()+1); - edit_stop_action_box->setCurrentItem(q->value(5).toInt()+1); + edit_mode_box->setCurrentIndex(q->value(3).toInt()+1); + edit_play_mode_box->setCurrentIndex(q->value(4).toInt()+1); + edit_stop_action_box->setCurrentIndex(q->value(5).toInt()+1); switch(q->value(6).toInt()) { case -1: - edit_cartaction_box->setCurrentItem(0); + edit_cartaction_box->setCurrentIndex(0); break; case 0: - edit_cartaction_box->setCurrentItem(1); + edit_cartaction_box->setCurrentIndex(1); break; default: - edit_cartaction_box->setCurrentItem(2); + edit_cartaction_box->setCurrentIndex(2); edit_cart_edit->setText(QString().sprintf("%06d",q->value(6).toInt())); } - cartActionData(edit_cartaction_box->currentItem()); - modeData(edit_mode_box->currentItem()); + cartActionData(edit_cartaction_box->currentIndex()); + modeData(edit_mode_box->currentIndex()); for(int i=0;icount();i++) { - if(q->value(7).toString()==edit_service_box->text(i)) { - edit_service_box->setCurrentItem(i); + if(q->value(7).toString()==edit_service_box->itemData(i).toString()) { + edit_service_box->setCurrentIndex(i); } } } @@ -437,12 +438,12 @@ void EditCartSlots::WriteSlot(unsigned slotnum) edit_input_spin->value(), edit_output_spin->value())+ QString().sprintf("DEFAULT_MODE=%d,", - edit_mode_box->currentItem()-1)+ + edit_mode_box->currentIndex()-1)+ QString().sprintf("DEFAULT_HOOK_MODE=%d,", - edit_play_mode_box->currentItem()-1)+ + edit_play_mode_box->currentIndex()-1)+ QString().sprintf("DEFAULT_STOP_ACTION=%d,", - edit_stop_action_box->currentItem()-1); - switch(edit_cartaction_box->currentItem()) { + edit_stop_action_box->currentIndex()-1); + switch(edit_cartaction_box->currentIndex()) { case 0: sql+="DEFAULT_CART_NUMBER=-1,"; break; diff --git a/rdadmin/edit_channelgpios.cpp b/rdadmin/edit_channelgpios.cpp index 5b3790a5..307657f3 100644 --- a/rdadmin/edit_channelgpios.cpp +++ b/rdadmin/edit_channelgpios.cpp @@ -2,7 +2,7 @@ // // Edit Rivendell Channel GPIO Settings // -// (C) Copyright 2013-2019 Fred Gleason +// (C) Copyright 2013-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include +#include "edit_channelgpios.h" EditChannelGpios::EditChannelGpios(RDAirPlayConf *conf, RDAirPlayConf::Channel chan,QWidget *parent) @@ -121,8 +121,8 @@ EditChannelGpios::EditChannelGpios(RDAirPlayConf *conf, edit_gpio_type_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); edit_gpio_type_box=new QComboBox(this); - edit_gpio_type_box->insertItem(tr("Edge")); - edit_gpio_type_box->insertItem(tr("Level")); + edit_gpio_type_box->insertItem(0,tr("Edge")); + edit_gpio_type_box->insertItem(1,tr("Level")); // // Buttons @@ -162,7 +162,7 @@ EditChannelGpios::EditChannelGpios(RDAirPlayConf *conf, edit_stop_gpo_line_spin-> setValue(edit_airplay_conf->stopGpoLine(edit_channel)); - edit_gpio_type_box->setCurrentItem(edit_airplay_conf->gpioType(edit_channel)); + edit_gpio_type_box->setCurrentIndex(edit_airplay_conf->gpioType(edit_channel)); } @@ -247,7 +247,7 @@ void EditChannelGpios::okData() setStopGpoLine(edit_channel,edit_stop_gpo_line_spin->value()); edit_airplay_conf->setGpioType(edit_channel, - (RDAirPlayConf::GpioType)edit_gpio_type_box->currentItem()); + (RDAirPlayConf::GpioType)edit_gpio_type_box->currentIndex()); done(0); } diff --git a/rdadmin/edit_decks.cpp b/rdadmin/edit_decks.cpp index 2ad1b27d..dc10157e 100644 --- a/rdadmin/edit_decks.cpp +++ b/rdadmin/edit_decks.cpp @@ -18,17 +18,8 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include #include #include @@ -36,7 +27,7 @@ #include #include -#include +#include "edit_decks.h" #include "globals.h" EditDecks::EditDecks(RDStation *station,RDStation *cae_station,QWidget *parent) @@ -62,10 +53,9 @@ EditDecks::EditDecks(RDStation *station,RDStation *cae_station,QWidget *parent) // edit_record_deck_box=new QComboBox(this); edit_record_deck_box->setGeometry(140,10,60,24); - edit_record_deck_box->setInsertionPolicy(QComboBox::NoInsert); connect(edit_record_deck_box,SIGNAL(activated(int)), this,SLOT(recordDeckActivatedData(int))); - QLabel *label=new QLabel(edit_record_deck_box,tr("Record Deck"),this); + QLabel *label=new QLabel(tr("Record Deck"),this); label->setFont(sectionLabelFont()); label->setGeometry(35,14,100,22); label->setAlignment(Qt::AlignRight); @@ -99,17 +89,16 @@ EditDecks::EditDecks(RDStation *station,RDStation *cae_station,QWidget *parent) edit_monitor_box->setSpecialValueText(tr("None")); connect(edit_monitor_box,SIGNAL(valueChanged(int)), this,SLOT(monitorPortChangedData(int))); - edit_monitor_label=new QLabel(edit_monitor_box,tr("Monitor Port:"),this); + edit_monitor_label=new QLabel(tr("Monitor Port:"),this); edit_monitor_label->setFont(labelFont()); edit_monitor_label->setGeometry(10,112,112,19); edit_monitor_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); edit_default_on_box=new QComboBox(this); edit_default_on_box->setGeometry(305,112,60,19); - edit_default_on_box->insertItem(tr("Off")); - edit_default_on_box->insertItem(tr("On")); - edit_default_on_label= - new QLabel(edit_default_on_box,tr("Monitor defaults to"),this); + edit_default_on_box->insertItem(0,tr("Off")); + edit_default_on_box->insertItem(1,tr("On")); + edit_default_on_label=new QLabel(tr("Monitor defaults to"),this); edit_default_on_label->setFont(labelFont()); edit_default_on_label->setGeometry(195,112,105,19); edit_default_on_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -119,10 +108,9 @@ EditDecks::EditDecks(RDStation *station,RDStation *cae_station,QWidget *parent) // edit_format_box=new QComboBox(this); edit_format_box->setGeometry(125,136,150,24); - edit_format_box->setInsertionPolicy(QComboBox::NoInsert); connect(edit_format_box,SIGNAL(activated(int)), this,SLOT(formatActivatedData(int))); - label=new QLabel(edit_format_box,tr("Format:"),this); + label=new QLabel(tr("Format:"),this); label->setFont(labelFont()); label->setGeometry(10,136,110,24); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -130,10 +118,9 @@ EditDecks::EditDecks(RDStation *station,RDStation *cae_station,QWidget *parent) // // Bit Rate // - edit_bitrate_box=new QComboBox(this,"edit_bitrate_box"); + edit_bitrate_box=new QComboBox(this); edit_bitrate_box->setGeometry(125,160,140,24); - edit_bitrate_box->setInsertionPolicy(QComboBox::NoInsert); - edit_bitrate_label=new QLabel(edit_bitrate_box,tr("Bit Rate:"),this); + edit_bitrate_label=new QLabel(tr("Bit Rate:"),this); edit_bitrate_label->setFont(labelFont()); edit_bitrate_label->setGeometry(10,160,110,24); edit_bitrate_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -144,7 +131,7 @@ EditDecks::EditDecks(RDStation *station,RDStation *cae_station,QWidget *parent) edit_swstation_box=new QComboBox(this); edit_swstation_box->setGeometry(125,190,250,24); edit_swstation_box->setModel(edit_station_model); - edit_swstation_label=new QLabel(edit_swstation_box,tr("Switcher Host:"),this); + edit_swstation_label=new QLabel(tr("Switcher Host:"),this); edit_swstation_label->setFont(labelFont()); edit_swstation_label->setGeometry(10,190,110,24); edit_swstation_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -156,9 +143,8 @@ EditDecks::EditDecks(RDStation *station,RDStation *cae_station,QWidget *parent) // edit_swmatrix_box=new QComboBox(this); edit_swmatrix_box->setGeometry(125,214,250,24); - edit_swmatrix_box->setInsertionPolicy(QComboBox::NoInsert); edit_swmatrix_box->setDisabled(true); - edit_swmatrix_label=new QLabel(edit_swmatrix_box,tr("Switcher Matrix:"),this); + edit_swmatrix_label=new QLabel(tr("Switcher Matrix:"),this); edit_swmatrix_label->setFont(labelFont()); edit_swmatrix_label->setGeometry(10,214,110,24); edit_swmatrix_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -171,9 +157,8 @@ EditDecks::EditDecks(RDStation *station,RDStation *cae_station,QWidget *parent) // edit_swoutput_box=new QComboBox(this); edit_swoutput_box->setGeometry(125,238,250,24); - edit_swoutput_box->setInsertionPolicy(QComboBox::NoInsert); edit_swoutput_box->setDisabled(true); - edit_swoutput_label=new QLabel(edit_swoutput_box,tr("Switcher Output:"),this); + edit_swoutput_label=new QLabel(tr("Switcher Output:"),this); edit_swoutput_label->setFont(labelFont()); edit_swoutput_label->setGeometry(10,238,110,24); edit_swoutput_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -186,12 +171,12 @@ EditDecks::EditDecks(RDStation *station,RDStation *cae_station,QWidget *parent) edit_swdelay_box->setGeometry(125,262,40,24); edit_swdelay_box->setRange(0,20); edit_swdelay_box->setDisabled(true); - edit_swdelay_label=new QLabel(edit_swdelay_box,tr("Switcher Delay:"),this); + edit_swdelay_label=new QLabel(tr("Switcher Delay:"),this); edit_swdelay_label->setFont(labelFont()); edit_swdelay_label->setGeometry(10,262,110,24); edit_swdelay_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); edit_swdelay_label->setDisabled(true); - edit_swdelay_unit=new QLabel(edit_swdelay_box,tr("1/10 sec"),this); + edit_swdelay_unit=new QLabel(tr("1/10 sec"),this); edit_swdelay_unit->setFont(labelFont()); edit_swdelay_unit->setGeometry(170,262,60,24); edit_swdelay_unit->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -212,8 +197,7 @@ EditDecks::EditDecks(RDStation *station,RDStation *cae_station,QWidget *parent) // edit_channels_box=new QComboBox(this); edit_channels_box->setGeometry(125,300,60,24); - edit_channels_box->setInsertionPolicy(QComboBox::NoInsert); - label=new QLabel(edit_channels_box,tr("Channels:"),this); + label=new QLabel(tr("Channels:"),this); label->setFont(labelFont()); label->setGeometry(10,300,110,24); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -225,7 +209,7 @@ EditDecks::EditDecks(RDStation *station,RDStation *cae_station,QWidget *parent) edit_threshold_box->setGeometry(125,324,70,24); edit_threshold_box->setSuffix(" dB"); edit_threshold_box->setRange(-100,0); - label=new QLabel(edit_threshold_box,tr("Trim Threshold:"),this); + label=new QLabel(tr("Trim Threshold:"),this); label->setFont(labelFont()); label->setGeometry(10,324,110,24); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -239,7 +223,7 @@ EditDecks::EditDecks(RDStation *station,RDStation *cae_station,QWidget *parent) edit_errorrml_edit=new QLineEdit(this); edit_errorrml_edit->setGeometry(125,393,248,24); - label=new QLabel(edit_errorrml_edit,tr("Error RML:"),this); + label=new QLabel(tr("Error RML:"),this); label->setFont(labelFont()); label->setGeometry(10,393,110,24); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -249,10 +233,9 @@ EditDecks::EditDecks(RDStation *station,RDStation *cae_station,QWidget *parent) // edit_play_deck_box=new QComboBox(this); edit_play_deck_box->setGeometry(475,10,60,24); - edit_play_deck_box->setInsertionPolicy(QComboBox::NoInsert); connect(edit_play_deck_box,SIGNAL(activated(int)), this,SLOT(playDeckActivatedData(int))); - label=new QLabel(edit_play_deck_box,tr("Play Deck"),this); + label=new QLabel(tr("Play Deck"),this); label->setFont(sectionLabelFont()); label->setGeometry(390,14,80,22); label->setAlignment(Qt::AlignRight); @@ -330,26 +313,28 @@ EditDecks::EditDecks(RDStation *station,RDStation *cae_station,QWidget *parent) edit_play_deck=NULL; edit_audition_deck=NULL; for(int i=0;iinsertItem(QString().sprintf("%d",i+1)); - edit_play_deck_box->insertItem(QString().sprintf("%d",i+1)); + edit_record_deck_box-> + insertItem(edit_record_deck_box->count(),QString().sprintf("%d",i+1)); + edit_play_deck_box-> + insertItem(edit_play_deck_box->count(),QString().sprintf("%d",i+1)); } - edit_record_channel=edit_record_deck_box->currentItem()+1; - edit_play_channel=edit_play_deck_box->currentItem()+129; - edit_format_box->insertItem(tr("PCM16")); - edit_format_box->insertItem(tr("PCM24")); - edit_format_box->insertItem(tr("MPEG Layer 2")); - edit_channels_box->insertItem("1"); - edit_channels_box->insertItem("2"); - edit_bitrate_box->insertItem(tr("32 kbps/chan")); - edit_bitrate_box->insertItem(tr("48 kbps/chan")); - edit_bitrate_box->insertItem(tr("56 kbps/chan")); - edit_bitrate_box->insertItem(tr("64 kbps/chan")); - edit_bitrate_box->insertItem(tr("80 kbps/chan")); - edit_bitrate_box->insertItem(tr("96 kbps/chan")); - edit_bitrate_box->insertItem(tr("112 kbps/chan")); - edit_bitrate_box->insertItem(tr("128 kbps/chan")); - edit_bitrate_box->insertItem(tr("160 kbps/chan")); - edit_bitrate_box->insertItem(tr("192 kbps/chan")); + edit_record_channel=edit_record_deck_box->currentIndex()+1; + edit_play_channel=edit_play_deck_box->currentIndex()+129; + edit_format_box->insertItem(edit_format_box->count(),tr("PCM16")); + edit_format_box->insertItem(edit_format_box->count(),tr("PCM24")); + edit_format_box->insertItem(edit_format_box->count(),tr("MPEG Layer 2")); + edit_channels_box->insertItem(0,"1"); + edit_channels_box->insertItem(1,"2"); + edit_bitrate_box->insertItem(edit_bitrate_box->count(),tr("32 kbps/chan")); + edit_bitrate_box->insertItem(edit_bitrate_box->count(),tr("48 kbps/chan")); + edit_bitrate_box->insertItem(edit_bitrate_box->count(),tr("56 kbps/chan")); + edit_bitrate_box->insertItem(edit_bitrate_box->count(),tr("64 kbps/chan")); + edit_bitrate_box->insertItem(edit_bitrate_box->count(),tr("80 kbps/chan")); + edit_bitrate_box->insertItem(edit_bitrate_box->count(),tr("96 kbps/chan")); + edit_bitrate_box->insertItem(edit_bitrate_box->count(),tr("112 kbps/chan")); + edit_bitrate_box->insertItem(edit_bitrate_box->count(),tr("128 kbps/chan")); + edit_bitrate_box->insertItem(edit_bitrate_box->count(),tr("160 kbps/chan")); + edit_bitrate_box->insertItem(edit_bitrate_box->count(),tr("192 kbps/chan")); ReadRecord(edit_record_channel); ReadRecord(edit_play_channel); ReadRecord(0); @@ -405,7 +390,7 @@ void EditDecks::recordCardChangedData(int card) { if((card>=0)&&edit_monitor_label->isEnabled()) { edit_monitor_box->setEnabled(true); - edit_monitor_box->setMaxValue(edit_station->cardOutputs(card)-1); + edit_monitor_box->setMaximum(edit_station->cardOutputs(card)-1); monitorPortChangedData(edit_monitor_box->value()); } else { @@ -463,10 +448,10 @@ void EditDecks::stationActivatedData(const QString &str) edit_swdelay_box->setEnabled(true); edit_swmatrix_box->clear(); - edit_swmatrix_box->insertStringList(GetActiveOutputMatrices()); + edit_swmatrix_box->insertItems(0,GetActiveOutputMatrices()); for(unsigned i=0;iswitchMatrix()) { - edit_swmatrix_box->setCurrentItem(i); + edit_swmatrix_box->setCurrentIndex(i); } } matrixActivatedData(edit_swmatrix_box->currentText()); @@ -493,10 +478,10 @@ void EditDecks::matrixActivatedData(const QString &str) edit_swdelay_box->setEnabled(true); edit_swoutput_box->clear(); - if(edit_swmatrix_box->currentItem()>=(int)edit_matrix_ids.size()) { + if(edit_swmatrix_box->currentIndex()>=(int)edit_matrix_ids.size()) { return; } - int matrix=edit_matrix_ids[edit_swmatrix_box->currentItem()]; + int matrix=edit_matrix_ids[edit_swmatrix_box->currentIndex()]; sql=QString("select NAME from OUTPUTS where ")+ "(STATION_NAME=\""+RDEscapeString(edit_swstation_box->currentText())+ "\")&&"+ @@ -504,7 +489,8 @@ void EditDecks::matrixActivatedData(const QString &str) "(NAME!=\"\")"; q=new RDSqlQuery(sql); while(q->next()) { - edit_swoutput_box->insertItem(q->value(0).toString()); + edit_swoutput_box-> + insertItem(edit_swoutput_box->count(),q->value(0).toString()); } delete q; } @@ -581,25 +567,25 @@ void EditDecks::ReadRecord(int chan) edit_record_selector->setPort(edit_record_deck->portNumber()); edit_monitor_box->setValue(edit_record_deck->monitorPortNumber()); if(edit_record_deck->defaultMonitorOn()) { - edit_default_on_box->setCurrentItem(1); + edit_default_on_box->setCurrentIndex(1); } else { - edit_default_on_box->setCurrentItem(0); + edit_default_on_box->setCurrentIndex(0); } switch(edit_record_deck->defaultFormat()) { case RDSettings::Pcm16: - edit_format_box->setCurrentItem(0); + edit_format_box->setCurrentIndex(0); edit_bitrate_box->setDisabled(true); break; case RDSettings::Pcm24: - edit_format_box->setCurrentItem(1); + edit_format_box->setCurrentIndex(1); edit_bitrate_box->setDisabled(true); break; case RDSettings::MpegL2: case RDSettings::MpegL2Wav: - edit_format_box->setCurrentItem(2); + edit_format_box->setCurrentIndex(2); edit_bitrate_box->setEnabled(true); break; @@ -609,71 +595,72 @@ void EditDecks::ReadRecord(int chan) case RDSettings::OggVorbis: break; } - edit_channels_box->setCurrentItem(edit_record_deck->defaultChannels()-1); + edit_channels_box->setCurrentIndex(edit_record_deck->defaultChannels()-1); switch(edit_record_deck->defaultBitrate()) { case 32000: - edit_bitrate_box->setCurrentItem(0); + edit_bitrate_box->setCurrentIndex(0); break; case 48000: - edit_bitrate_box->setCurrentItem(1); + edit_bitrate_box->setCurrentIndex(1); break; case 56000: - edit_bitrate_box->setCurrentItem(2); + edit_bitrate_box->setCurrentIndex(2); break; case 64000: - edit_bitrate_box->setCurrentItem(3); + edit_bitrate_box->setCurrentIndex(3); break; case 80000: - edit_bitrate_box->setCurrentItem(4); + edit_bitrate_box->setCurrentIndex(4); break; case 96000: - edit_bitrate_box->setCurrentItem(5); + edit_bitrate_box->setCurrentIndex(5); break; case 112000: - edit_bitrate_box->setCurrentItem(6); + edit_bitrate_box->setCurrentIndex(6); break; case 128000: - edit_bitrate_box->setCurrentItem(7); + edit_bitrate_box->setCurrentIndex(7); break; case 160000: - edit_bitrate_box->setCurrentItem(8); + edit_bitrate_box->setCurrentIndex(8); break; case 192000: - edit_bitrate_box->setCurrentItem(9); + edit_bitrate_box->setCurrentIndex(9); break; case 224000: - edit_bitrate_box->setCurrentItem(10); + edit_bitrate_box->setCurrentIndex(10); break; case 256000: - edit_bitrate_box->setCurrentItem(11); + edit_bitrate_box->setCurrentIndex(11); break; case 320000: - edit_bitrate_box->setCurrentItem(12); + edit_bitrate_box->setCurrentIndex(12); break; case 384000: - edit_bitrate_box->setCurrentItem(13); + edit_bitrate_box->setCurrentIndex(13); break; default: - edit_bitrate_box->setCurrentItem(7); // 128 kbps/chan + edit_bitrate_box->setCurrentIndex(7); // 128 kbps/chan break; } for(int i=0;icount();i++) { - if(edit_record_deck->switchStation()==edit_swstation_box->text(i)) { - edit_swstation_box->setCurrentItem(i); + if(edit_record_deck->switchStation()== + edit_swstation_box->itemData(i).toString()) { + edit_swstation_box->setCurrentIndex(i); stationActivatedData(edit_swstation_box->currentText()); } } QString matrix_name=edit_record_deck->switchMatrixName(); for(int i=0;icount();i++) { - if(edit_swmatrix_box->text(i)==matrix_name) { - edit_swmatrix_box->setCurrentItem(i); + if(edit_swmatrix_box->itemData(i).toString()==matrix_name) { + edit_swmatrix_box->setCurrentIndex(i); matrixActivatedData(edit_swmatrix_box->currentText()); } } QString output_name=edit_record_deck->switchOutputName(); for(int i=0;icount();i++) { - if(edit_swoutput_box->text(i)==output_name) { - edit_swoutput_box->setCurrentItem(i); + if(edit_swoutput_box->itemData(i).toString()==output_name) { + edit_swoutput_box->setCurrentIndex(i); } } edit_swdelay_box->setValue(edit_record_deck->switchDelay()/100); @@ -721,14 +708,14 @@ void EditDecks::WriteRecord(int chan) edit_record_deck->setDefaultMonitorOn(false); } else { - if(edit_default_on_box->currentItem()==0) { + if(edit_default_on_box->currentIndex()==0) { edit_record_deck->setDefaultMonitorOn(false); } else { edit_record_deck->setDefaultMonitorOn(true); } } - switch(edit_format_box->currentItem()) { + switch(edit_format_box->currentIndex()) { case 0: edit_record_deck->setDefaultFormat(RDSettings::Pcm16); break; @@ -741,8 +728,8 @@ void EditDecks::WriteRecord(int chan) edit_record_deck->setDefaultFormat(RDSettings::MpegL2); break; } - edit_record_deck->setDefaultChannels(edit_channels_box->currentItem()+1); - sscanf((const char *)edit_bitrate_box->currentText(),"%d",&temp); + edit_record_deck->setDefaultChannels(edit_channels_box->currentIndex()+1); + temp=edit_bitrate_box->currentText().toInt(); edit_record_deck->setDefaultBitrate(temp*1000); edit_record_deck->setSwitchStation(edit_swstation_box->currentText()); edit_record_deck->setSwitchMatrix(GetMatrix()); @@ -773,9 +760,9 @@ void EditDecks::WriteRecord(int chan) int EditDecks::GetMatrix() { - if(edit_swmatrix_box->currentItem()>=0) { - if(edit_swmatrix_box->currentItem()<(int)edit_matrix_ids.size()) { - return edit_matrix_ids[edit_swmatrix_box->currentItem()]; + if(edit_swmatrix_box->currentIndex()>=0) { + if(edit_swmatrix_box->currentIndex()<(int)edit_matrix_ids.size()) { + return edit_matrix_ids[edit_swmatrix_box->currentIndex()]; } } return -1; @@ -823,7 +810,7 @@ QStringList EditDecks::GetActiveOutputMatrices() RDLiveWire *lw=new RDLiveWire(0,this); if(!lw->loadSettings(q1->value(0).toString(),q1->value(2).toUInt(), q1->value(1).toString(),q1->value(3).toInt())) { - QMessageBox::warning(this,tr("RDAdmin - "+tr("Connection Error")), + QMessageBox::warning(this,"RDAdmin - "+tr("Connection Error"), tr("Unable to connect to node at")+" \""+ q1->value(0).toString()+"\"."+ tr("Check that the unit is online and try again.")); diff --git a/rdadmin/edit_dropbox.cpp b/rdadmin/edit_dropbox.cpp index 8e850098..913647c5 100644 --- a/rdadmin/edit_dropbox.cpp +++ b/rdadmin/edit_dropbox.cpp @@ -58,7 +58,7 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) // box_group_name_box=new QComboBox(this); box_group_name_box->setGeometry(140,10,100,20); - QLabel *label=new QLabel(box_group_name_box,tr("Default Group:"),this); + QLabel *label=new QLabel(tr("Default Group:"),this); label->setGeometry(10,10,125,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -69,7 +69,7 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) box_path_edit=new QLineEdit(this); box_path_edit->setGeometry(140,32,sizeHint().width()-210,19); box_path_edit->setMaxLength(255); - label=new QLabel(box_path_edit,tr("&Path Spec:"),this); + label=new QLabel(tr("&Path Spec:"),this); label->setGeometry(10,32,125,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -86,7 +86,7 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) box_to_cart_edit->setGeometry(140,54,60,19); box_to_cart_edit->setValidator(new QIntValidator(1,999999,this)); box_to_cart_edit->setMaxLength(6); - label=new QLabel(box_to_cart_edit,tr("To &Cart:"),this); + label=new QLabel(tr("To &Cart:"),this); label->setGeometry(10,54,125,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -102,8 +102,7 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) // box_delete_cuts_box=new QCheckBox(this); box_delete_cuts_box->setGeometry(280,56,15,15); - box_delete_cuts_label= - new QLabel(box_delete_cuts_box,tr("Delete cuts before importing"),this); + box_delete_cuts_label=new QLabel(tr("Delete cuts before importing"),this); box_delete_cuts_label->setGeometry(300,54,sizeHint().width()-150,20); box_delete_cuts_label->setFont(labelFont()); box_delete_cuts_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -114,7 +113,7 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) box_metadata_pattern_edit=new QLineEdit(this); box_metadata_pattern_edit->setGeometry(140,76,sizeHint().width()-170,19); box_metadata_pattern_edit->setMaxLength(64); - label=new QLabel(box_metadata_pattern_edit,tr("&Metadata Pattern:"),this); + label=new QLabel(tr("&Metadata Pattern:"),this); label->setGeometry(10,76,125,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -125,7 +124,7 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) box_user_defined_edit=new QLineEdit(this); box_user_defined_edit->setGeometry(140,98,sizeHint().width()-170,19); box_user_defined_edit->setMaxLength(255); - label=new QLabel(box_user_defined_edit,tr("&User Defined:"),this); + label=new QLabel(tr("&User Defined:"),this); label->setGeometry(10,98,125,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -135,7 +134,7 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) // box_log_to_syslog_check=new QCheckBox(this); box_log_to_syslog_check->setGeometry(50,124,15,15); - label=new QLabel(box_log_to_syslog_check,tr("Log events in Syslog"),this); + label=new QLabel(tr("Log events in Syslog"),this); label->setGeometry(70,122,250,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -145,8 +144,7 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) box_log_path_edit->setMaxLength(255); connect(box_log_to_syslog_check,SIGNAL(toggled(bool)), box_log_path_edit,SLOT(setDisabled(bool))); - box_log_path_label= - new QLabel(box_log_path_edit,tr("&Log File:"),this); + box_log_path_label=new QLabel(tr("&Log File:"),this); box_log_path_label->setGeometry(10,141,125,19); box_log_path_label->setFont(labelFont()); box_log_path_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -173,8 +171,7 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) // box_delete_source_box=new QCheckBox(this); box_delete_source_box->setGeometry(90,199,15,15); - label=new QLabel(box_delete_source_box,tr("Delete source files after import"), - this); + label=new QLabel(tr("Delete source files after import"),this); label->setGeometry(110,197,sizeHint().width()-120,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -184,7 +181,7 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) // box_send_email_box=new QCheckBox(this); box_send_email_box->setGeometry(90,221,15,15); - label=new QLabel(box_send_email_box,tr("Send e-mail reports"),this); + label=new QLabel(tr("Send e-mail reports"),this); label->setGeometry(110,219,sizeHint().width()-120,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -194,7 +191,7 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) // box_force_to_mono_box=new QCheckBox(this); box_force_to_mono_box->setGeometry(90,243,15,15); - label=new QLabel(box_force_to_mono_box,tr("Force to Monaural"),this); + label=new QLabel(tr("Force to Monaural"),this); label->setGeometry(110,241,sizeHint().width()-120,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -204,7 +201,7 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) // box_normalization_box=new QCheckBox(this); box_normalization_box->setGeometry(90,264,15,15); - label=new QLabel(box_normalization_box,tr("Normalize Levels"),this); + label=new QLabel(tr("Normalize Levels"),this); label->setGeometry(110,262,100,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -227,7 +224,7 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) // box_autotrim_box=new QCheckBox(this); box_autotrim_box->setGeometry(90,289,15,15); - label=new QLabel(box_autotrim_box,tr("Autotrim Cuts"),this); + label=new QLabel(tr("Autotrim Cuts"),this); label->setGeometry(110,287,100,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -250,19 +247,18 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) // box_segue_box=new QCheckBox(this); box_segue_box->setGeometry(90,315,15,15); - label=new QLabel(box_segue_box,tr("Insert Segue Markers"),this); + label=new QLabel(tr("Insert Segue Markers"),this); label->setGeometry(110,313,sizeHint().width()-40,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); box_segue_level_spin=new QSpinBox(this); box_segue_level_spin->setGeometry(285,339,50,20); box_segue_level_spin->setRange(-100,0); - box_segue_level_label= - new QLabel(box_segue_level_spin,tr("Segue Level:"),this); + box_segue_level_label=new QLabel(tr("Segue Level:"),this); box_segue_level_label->setGeometry(120,339,160,20); box_segue_level_label->setFont(labelFont()); box_segue_level_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); - box_segue_level_unit=new QLabel(box_segue_level_spin,("dBFS"),this); + box_segue_level_unit=new QLabel("dBFS",this); box_segue_level_unit->setFont(labelFont()); box_segue_level_unit->setGeometry(360,340,60,20); box_segue_level_unit->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -270,12 +266,11 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) box_segue_length_spin=new QSpinBox(this); box_segue_length_spin->setGeometry(285,364,70,20); box_segue_length_spin->setRange(0,180000); - box_segue_length_label= - new QLabel(box_segue_length_spin,tr("Segue Length:"),this); + box_segue_length_label=new QLabel(tr("Segue Length:"),this); box_segue_length_label->setGeometry(120,364,160,20); box_segue_length_label->setFont(labelFont()); box_segue_length_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); - box_segue_length_unit=new QLabel(box_segue_length_spin,("msec"),this); + box_segue_length_unit=new QLabel("msec",this); box_segue_length_unit->setFont(labelFont()); box_segue_length_unit->setGeometry(375,365,60,20); box_segue_length_unit->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -287,8 +282,7 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) // box_use_cartchunk_id_box=new QCheckBox(this); box_use_cartchunk_id_box->setGeometry(90,394,15,15); - label=new QLabel(box_use_cartchunk_id_box, - tr("Get cart number from CartChunk CutID"),this); + label=new QLabel(tr("Get cart number from CartChunk CutID"),this); label->setGeometry(110,392,sizeHint().width()-40,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -298,8 +292,7 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) // box_title_from_cartchunk_id_box=new QCheckBox(this); box_title_from_cartchunk_id_box->setGeometry(90,418,15,15); - label=new QLabel(box_title_from_cartchunk_id_box, - tr("Get cart title from CartChunk CutID"),this); + label=new QLabel(tr("Get cart title from CartChunk CutID"),this); label->setGeometry(110,416,sizeHint().width()-40,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -309,8 +302,7 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) // box_fix_broken_formats_box=new QCheckBox(this); box_fix_broken_formats_box->setGeometry(90,442,15,15); - label=new QLabel(box_fix_broken_formats_box, - tr("Attempt to work around malformatted input files"),this); + label=new QLabel(tr("Attempt to work around malformatted input files"),this); label->setGeometry(110,440,sizeHint().width()-40,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -321,11 +313,11 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) box_startoffset_spin=new QSpinBox(this); box_startoffset_spin->setGeometry(215,466,50,20); box_startoffset_spin->setRange(-7,7); - label=new QLabel(box_startoffset_spin,tr("Offset start date by"),this); + label=new QLabel(tr("Offset start date by"),this); label->setGeometry(90,466,120,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); - label=new QLabel(box_startoffset_spin,tr("days"),this); + label=new QLabel(tr("days"),this); label->setGeometry(275,468,100,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -336,11 +328,11 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) box_endoffset_spin=new QSpinBox(this); box_endoffset_spin->setGeometry(215,490,50,20); box_endoffset_spin->setRange(-7,7); - label=new QLabel(box_endoffset_spin,tr("Offset end date by"),this); + label=new QLabel(tr("Offset end date by"),this); label->setGeometry(90,490,120,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); - label=new QLabel(box_endoffset_spin,tr("days"),this); + label=new QLabel(tr("days"),this); label->setGeometry(275,490,100,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -350,8 +342,7 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) // box_create_dates_box=new QCheckBox(this); box_create_dates_box->setGeometry(90,514,15,15); - label=new QLabel(box_create_dates_box,tr("Create Dates when no Dates Exist"), - this); + label=new QLabel(tr("Create Dates when no Dates Exist"),this); label->setGeometry(110,512,sizeHint().width()-40,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -359,13 +350,11 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) box_create_startdate_offset_spin->setGeometry(285,538,50,20); box_create_startdate_offset_spin->setRange(-180,180); box_create_startdate_label= - new QLabel(box_create_startdate_offset_spin,tr("Create start date offset:"), - this); + new QLabel(tr("Create start date offset:"),this); box_create_startdate_label->setGeometry(120,538,160,20); box_create_startdate_label->setFont(labelFont()); box_create_startdate_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); - box_create_startdate_unit= - new QLabel(box_create_startdate_offset_spin,("days"),this); + box_create_startdate_unit=new QLabel(tr("days"),this); box_create_startdate_unit->setFont(labelFont()); box_create_startdate_unit->setGeometry(345,539,60,20); box_create_startdate_unit->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -373,14 +362,12 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) box_create_enddate_offset_spin=new QSpinBox(this); box_create_enddate_offset_spin->setGeometry(285,560,50,20); box_create_enddate_offset_spin->setRange(-180,180); - box_create_enddate_label= - new QLabel(box_create_enddate_offset_spin,tr("Create end date offset:"), - this); + box_create_enddate_label=new QLabel(tr("Create end date offset:"),this); box_create_enddate_label->setGeometry(120,558,160,20); box_create_enddate_label->setFont(labelFont()); box_create_enddate_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); box_create_enddate_unit= - new QLabel(box_create_enddate_offset_spin,("days"),this); + new QLabel(("days"),this); box_create_enddate_unit->setFont(labelFont()); box_create_enddate_unit->setGeometry(345,558,60,20); box_create_enddate_unit->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -425,9 +412,10 @@ EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent) q=new RDSqlQuery(sql); QString groupname=box_dropbox->groupName(); while(q->next()) { - box_group_name_box->insertItem(q->value(0).toString()); + box_group_name_box-> + insertItem(box_group_name_box->count(),q->value(0).toString()); if(q->value(0).toString()==groupname) { - box_group_name_box->setCurrentItem(box_group_name_box->count()-1); + box_group_name_box->setCurrentIndex(box_group_name_box->count()-1); } } delete q; diff --git a/rdadmin/edit_endpoint.cpp b/rdadmin/edit_endpoint.cpp index c62dea6a..543b35d9 100644 --- a/rdadmin/edit_endpoint.cpp +++ b/rdadmin/edit_endpoint.cpp @@ -49,7 +49,7 @@ EditEndpoint::EditEndpoint(RDMatrix::Type type,RDMatrix::Endpoint endpoint, edit_endpoint_edit=new QLineEdit(this); edit_endpoint_edit->setGeometry(75,10,sizeHint().width()-85,20); edit_endpoint_edit->setValidator(validator); - QLabel *label=new QLabel(edit_endpoint_edit,tr("Name: "),this); + QLabel *label=new QLabel(tr("Name: "),this); label->setGeometry(10,13,60,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight); @@ -59,8 +59,7 @@ EditEndpoint::EditEndpoint(RDMatrix::Type type,RDMatrix::Endpoint endpoint, // edit_enginenum_edit=new QLineEdit(this); edit_enginenum_edit->setGeometry(135,36,50,20); - edit_enginenum_label= - new QLabel(edit_enginenum_edit,tr("Engine")+":",this); + edit_enginenum_label=new QLabel(tr("Engine")+":",this); edit_enginenum_label->setGeometry(10,36,120,20); edit_enginenum_label->setFont(labelFont()); edit_enginenum_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -70,8 +69,7 @@ EditEndpoint::EditEndpoint(RDMatrix::Type type,RDMatrix::Endpoint endpoint, // edit_devicenum_edit=new QLineEdit(this); edit_devicenum_edit->setGeometry(135,62,50,20); - edit_devicenum_label= - new QLabel(edit_devicenum_edit,tr("Device (Hex)")+":",this); + edit_devicenum_label=new QLabel(tr("Device (Hex)")+":",this); edit_devicenum_label->setGeometry(10,62,120,20); edit_devicenum_label->setFont(labelFont()); edit_devicenum_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); diff --git a/rdadmin/edit_feed.cpp b/rdadmin/edit_feed.cpp index 8af8df0f..47308124 100644 --- a/rdadmin/edit_feed.cpp +++ b/rdadmin/edit_feed.cpp @@ -2,7 +2,7 @@ // // Edit a Rivendell Feed // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -20,14 +20,9 @@ #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include #include #include @@ -93,8 +88,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) // feed_channel_title_edit=new QLineEdit(this); feed_channel_title_edit->setMaxLength(191); - feed_channel_title_label= - new QLabel(feed_channel_title_edit,tr("Title:"),this); + feed_channel_title_label=new QLabel(tr("Title:"),this); feed_channel_title_label->setFont(labelFont()); feed_channel_title_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -111,8 +105,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) // feed_channel_link_edit=new QLineEdit(this); feed_channel_link_edit->setMaxLength(191); - feed_channel_link_label= - new QLabel(feed_channel_link_edit,tr("Link:"),this); + feed_channel_link_label=new QLabel(tr("Link:"),this); feed_channel_link_label->setFont(labelFont()); feed_channel_link_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -121,8 +114,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) // feed_channel_copyright_edit=new QLineEdit(this); feed_channel_copyright_edit->setMaxLength(64); - feed_channel_copyright_label= - new QLabel(feed_channel_copyright_edit,tr("Copyright:"),this); + feed_channel_copyright_label=new QLabel(tr("Copyright:"),this); feed_channel_copyright_label->setFont(labelFont()); feed_channel_copyright_label-> setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -132,8 +124,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) // feed_channel_editor_edit=new QLineEdit(this); feed_channel_editor_edit->setMaxLength(64); - feed_channel_editor_label= - new QLabel(feed_channel_editor_edit,tr("Editor:"),this); + feed_channel_editor_label=new QLabel(tr("Editor:"),this); feed_channel_editor_label->setFont(labelFont()); feed_channel_editor_label-> setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -144,7 +135,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) feed_channel_author_edit=new QLineEdit(this); feed_channel_author_edit->setMaxLength(64); feed_channel_author_label= - new QLabel(feed_channel_author_edit,tr("Author:"),this); + new QLabel(tr("Author:"),this); feed_channel_author_label->setFont(labelFont()); feed_channel_author_label-> setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -161,8 +152,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) // feed_channel_owner_name_edit=new QLineEdit(this); feed_channel_owner_name_edit->setMaxLength(64); - feed_channel_owner_name_label= - new QLabel(feed_channel_owner_name_edit,tr("Owner Name:"),this); + feed_channel_owner_name_label=new QLabel(tr("Owner Name:"),this); feed_channel_owner_name_label->setFont(labelFont()); feed_channel_owner_name_label-> setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -172,8 +162,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) // feed_channel_owner_email_edit=new QLineEdit(this); feed_channel_owner_email_edit->setMaxLength(64); - feed_channel_owner_email_label= - new QLabel(feed_channel_owner_email_edit,tr("Owner E-Mail:"),this); + feed_channel_owner_email_label=new QLabel(tr("Owner E-Mail:"),this); feed_channel_owner_email_label->setFont(labelFont()); feed_channel_owner_email_label-> setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -183,8 +172,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) // feed_channel_webmaster_edit=new QLineEdit(this); feed_channel_webmaster_edit->setMaxLength(64); - feed_channel_webmaster_label= - new QLabel(feed_channel_webmaster_edit,tr("Webmaster:"),this); + feed_channel_webmaster_label=new QLabel(tr("Webmaster:"),this); feed_channel_webmaster_label->setFont(labelFont()); feed_channel_webmaster_label-> setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -194,8 +182,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) // feed_channel_language_edit=new QLineEdit(this); feed_channel_language_edit->setMaxLength(8); - feed_channel_language_label= - new QLabel(feed_channel_language_edit,tr("Language:"),this); + feed_channel_language_label=new QLabel(tr("Language:"),this); feed_channel_language_label->setFont(labelFont()); feed_channel_language_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -203,8 +190,8 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) // Channel is Explicit // feed_channel_explicit_check=new QCheckBox(this); - feed_channel_explicit_label=new QLabel(feed_channel_explicit_check, - tr("Channel contains explicit content"),this); + feed_channel_explicit_label= + new QLabel(tr("Channel contains explicit content"),this); feed_channel_explicit_label->setFont(labelFont()); feed_channel_explicit_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -214,8 +201,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) feed_channel_image_box= new RDImagePickerBox("FEED_IMAGES","FEED_ID","ID",this); feed_channel_image_box->setCategoryId(feed_feed->id()); - feed_channel_image_label= - new QLabel(feed_channel_image_box,tr("Image")+":",this); + feed_channel_image_label=new QLabel(tr("Image")+":",this); feed_channel_image_label->setFont(labelFont()); feed_channel_image_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -224,8 +210,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) // feed_channel_description_edit=new QTextEdit(this); feed_channel_description_edit->setAcceptRichText(false); - feed_channel_description_label= - new QLabel(feed_channel_description_edit,tr("Description:"),this); + feed_channel_description_label=new QLabel(tr("Description:"),this); feed_channel_description_label->setFont(labelFont()); feed_channel_description_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -236,8 +221,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) feed_purge_url_edit->setMaxLength(191); connect(feed_purge_url_edit,SIGNAL(textChanged(const QString &)), this,SLOT(purgeUrlChangedData(const QString &))); - feed_purge_url_label= - new QLabel(feed_purge_url_edit,tr("Upload URL")+":",this); + feed_purge_url_label=new QLabel(tr("Upload URL")+":",this); feed_purge_url_label->setFont(labelFont()); feed_purge_url_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -248,8 +232,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) feed_purge_username_edit->setMaxLength(64); connect(feed_purge_username_edit,SIGNAL(textChanged(const QString &)), this,SLOT(lineeditChangedData(const QString &))); - feed_purge_username_label= - new QLabel(feed_purge_username_edit,tr("Username:"),this); + feed_purge_username_label=new QLabel(tr("Username:"),this); feed_purge_username_label->setFont(labelFont()); feed_purge_username_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -259,8 +242,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) feed_purge_password_edit=new QLineEdit(this); feed_purge_password_edit->setMaxLength(64); feed_purge_password_edit->setEchoMode(QLineEdit::Password); - feed_purge_password_label= - new QLabel(feed_purge_password_edit,tr("Password:"),this); + feed_purge_password_label=new QLabel(tr("Password:"),this); feed_purge_password_label->setFont(labelFont()); feed_purge_password_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -269,8 +251,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) // feed_purge_use_id_file_check=new QCheckBox(this); feed_purge_use_id_file_label= - new QLabel(feed_purge_use_id_file_check, - tr("Authenticate with local identity file"),this); + new QLabel(tr("Authenticate with local identity file"),this); feed_purge_use_id_file_label->setFont(labelFont()); feed_purge_use_id_file_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -279,7 +260,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) // feed_format_edit=new QLineEdit(this); feed_format_edit->setReadOnly(true); - feed_format_label=new QLabel(feed_format_edit,tr("Audio Format:"),this); + feed_format_label=new QLabel(tr("Audio Format:"),this); feed_format_label->setFont(labelFont()); feed_format_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); feed_format_button=new QPushButton(this); @@ -292,8 +273,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) // feed_normalize_check=new QCheckBox(this); feed_normalize_check->setChecked(true); - feed_normalize_check_label= - new QLabel(feed_normalize_check,tr("Normalize"),this); + feed_normalize_check_label=new QLabel(tr("Normalize"),this); feed_normalize_check_label->setFont(labelFont()); feed_normalize_check_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); connect(feed_normalize_check,SIGNAL(toggled(bool)), @@ -304,7 +284,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) // feed_normalize_spin=new QSpinBox(this); feed_normalize_spin->setRange(-30,-1); - feed_normalize_label=new QLabel(feed_normalize_spin,tr("Level:"),this); + feed_normalize_label=new QLabel(tr("Level:"),this); feed_normalize_label->setFont(labelFont()); feed_normalize_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); feed_normalize_unit_label=new QLabel(tr("dBFS"),this); @@ -316,8 +296,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) // feed_base_url_edit=new QLineEdit(this); feed_base_url_edit->setMaxLength(191); - feed_base_url_label= - new QLabel(feed_base_url_edit,tr("Download URL")+":",this); + feed_base_url_label=new QLabel(tr("Download URL")+":",this); feed_base_url_label->setFont(labelFont()); feed_base_url_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -327,8 +306,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) feed_autopost_box=new QComboBox(this); feed_autopost_box->insertItem(feed_autopost_box->count(),tr("No")); feed_autopost_box->insertItem(feed_autopost_box->count(),tr("Yes")); - feed_autopost_label= - new QLabel(feed_autopost_box,tr("Enable AutoPost")+":",this); + feed_autopost_label=new QLabel(tr("Enable AutoPost")+":",this); feed_autopost_label->setFont(labelFont()); feed_autopost_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -337,8 +315,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) // feed_base_preamble_edit=new QLineEdit(this); feed_base_preamble_edit->setMaxLength(191); - feed_base_preamble_label= - new QLabel(feed_base_preamble_edit,tr("Enclosure Preamble:"),this); + feed_base_preamble_label=new QLabel(tr("Enclosure Preamble:"),this); feed_base_preamble_label->setFont(labelFont()); feed_base_preamble_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -347,8 +324,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) // feed_extension_edit=new QLineEdit(this); feed_extension_edit->setMaxLength(16); - feed_extension_label= - new QLabel(feed_extension_edit,tr("Audio Extension:"),this); + feed_extension_label=new QLabel(tr("Audio Extension:"),this); feed_extension_label->setFont(labelFont()); feed_extension_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -358,12 +334,10 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) feed_max_shelf_life_spin=new QSpinBox(this); feed_max_shelf_life_spin->setRange(0,365); feed_max_shelf_life_spin->setSpecialValueText(tr("Unlimited")); - feed_max_shelf_life_label= - new QLabel(feed_max_shelf_life_spin,tr("Default Shelf Life")+":",this); + feed_max_shelf_life_label=new QLabel(tr("Default Shelf Life")+":",this); feed_max_shelf_life_label->setFont(labelFont()); feed_max_shelf_life_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); - feed_max_shelf_life_unit_label= - new QLabel(feed_max_shelf_life_spin,tr("days"),this); + feed_max_shelf_life_unit_label=new QLabel(tr("days"),this); feed_max_shelf_life_unit_label->setFont(labelFont()); feed_max_shelf_life_unit_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -371,10 +345,9 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) // Episode Order // feed_castorder_box=new QComboBox(this); - feed_castorder_box->insertItem(tr("Descending")); - feed_castorder_box->insertItem(tr("Ascending")); - feed_castorder_label= - new QLabel(feed_castorder_box,tr("Episode Sort Order:"),this); + feed_castorder_box->insertItem(0,tr("Descending")); + feed_castorder_box->insertItem(1,tr("Ascending")); + feed_castorder_label=new QLabel(tr("Episode Sort Order:"),this); feed_castorder_label->setFont(labelFont()); feed_castorder_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -383,8 +356,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) // feed_item_image_box=new RDImagePickerBox("FEED_IMAGES","FEED_ID","ID",this); feed_item_image_box->setCategoryId(feed_feed->id()); - feed_item_image_label= - new QLabel(feed_item_image_box,tr("Default Item Image")+":",this); + feed_item_image_label=new QLabel(tr("Default Item Image")+":",this); feed_item_image_label->setFont(labelFont()); feed_item_image_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -408,7 +380,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) // feed_header_xml_edit=new QTextEdit(this); feed_header_xml_edit->setAcceptRichText(false); - feed_header_xml_label=new QLabel(feed_header_xml_edit,tr("Header XML:"),this); + feed_header_xml_label=new QLabel(tr("Header XML:"),this); feed_header_xml_label->setFont(labelFont()); feed_header_xml_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); feed_header_xml_button=new QPushButton(tr("Copy to\nClipboard"),this); @@ -421,8 +393,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) // feed_channel_xml_edit=new QTextEdit(this); feed_channel_xml_edit->setAcceptRichText(false); - feed_channel_xml_label= - new QLabel(feed_channel_xml_edit,tr("Channel XML:"),this); + feed_channel_xml_label=new QLabel(tr("Channel XML:"),this); feed_channel_xml_label->setFont(labelFont()); feed_channel_xml_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); feed_channel_xml_button=new QPushButton(tr("Copy to\nClipboard"),this); @@ -435,7 +406,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) // feed_item_xml_edit=new QTextEdit(this); feed_item_xml_edit->setAcceptRichText(false); - feed_item_xml_label=new QLabel(feed_item_xml_edit,tr("Item XML:"),this); + feed_item_xml_label=new QLabel(tr("Item XML:"),this); feed_item_xml_label->setFont(labelFont()); feed_item_xml_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); feed_item_xml_button=new QPushButton(tr("Copy to\nClipboard"),this); @@ -491,7 +462,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) RDRssSchemas::RssSchema schema=feed_feed->rssSchema(); for(int i=0;icount();i++) { if(feed_rss_schema_box->itemData(i).toInt()==schema) { - feed_rss_schema_box->setCurrentItem(i); + feed_rss_schema_box->setCurrentIndex(i); continue; } } @@ -514,7 +485,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) feed_normalize_check->setChecked(true); feed_normalize_spin->setValue(feed_feed->normalizeLevel()/1000); } - feed_castorder_box->setCurrentItem(feed_feed->castOrder()); + feed_castorder_box->setCurrentIndex(feed_feed->castOrder()); feed_item_image_box->setCurrentImageId(feed_feed->defaultItemImageId()); UpdateControlState(); @@ -614,7 +585,7 @@ void EditFeed::copyHeaderXmlData() (RDRssSchemas::RssSchema)feed_rss_schema_box->currentIndex(); if(schema==RDRssSchemas::CustomSchema) { - QApplication::clipboard()->setText(feed_header_xml_edit->text()); + QApplication::clipboard()->setText(feed_header_xml_edit->toPlainText()); } else { QApplication::clipboard()-> @@ -629,7 +600,7 @@ void EditFeed::copyChannelXmlData() (RDRssSchemas::RssSchema)feed_rss_schema_box->currentIndex(); if(schema==RDRssSchemas::CustomSchema) { - QApplication::clipboard()->setText(feed_channel_xml_edit->text()); + QApplication::clipboard()->setText(feed_channel_xml_edit->toPlainText()); } else { QApplication::clipboard()-> @@ -644,7 +615,7 @@ void EditFeed::copyItemXmlData() (RDRssSchemas::RssSchema)feed_rss_schema_box->currentIndex(); if(schema==RDRssSchemas::CustomSchema) { - QApplication::clipboard()->setText(feed_item_xml_edit->text()); + QApplication::clipboard()->setText(feed_item_xml_edit->toPlainText()); } else { QApplication::clipboard()-> @@ -655,7 +626,7 @@ void EditFeed::copyItemXmlData() void EditFeed::okData() { - if(feed_is_superfeed_box->currentItem()&& + if(feed_is_superfeed_box->currentIndex()&& feed_feed->subfeedNames().size()==0) { QMessageBox::warning(this,"RDAdmin - "+tr("Error"), tr("Superfeed must have at least one subfeed assigned!")); @@ -673,7 +644,7 @@ void EditFeed::okData() } delete d; delete u; - feed_feed->setIsSuperfeed(feed_is_superfeed_box->currentItem()); + feed_feed->setIsSuperfeed(feed_is_superfeed_box->currentIndex()); feed_feed->setChannelTitle(feed_channel_title_edit->text()); feed_feed->setChannelCategory(feed_channel_category_box->category()); feed_feed->setChannelSubCategory(feed_channel_category_box->subCategory()); @@ -686,7 +657,8 @@ void EditFeed::okData() feed_feed->setChannelOwnerName(feed_channel_owner_name_edit->text()); feed_feed->setChannelOwnerEmail(feed_channel_owner_email_edit->text()); feed_feed->setChannelWebmaster(feed_channel_webmaster_edit->text()); - feed_feed->setChannelDescription(feed_channel_description_edit->text()); + feed_feed-> + setChannelDescription(feed_channel_description_edit->toPlainText()); feed_feed->setChannelLanguage(feed_channel_language_edit->text()); feed_feed->setChannelExplicit(feed_channel_explicit_check->isChecked()); feed_feed->setChannelImageId(feed_channel_image_box->currentImageId()); @@ -701,9 +673,9 @@ void EditFeed::okData() feed_feed-> setRssSchema((RDRssSchemas::RssSchema)feed_rss_schema_box-> itemData(feed_rss_schema_box->currentIndex()).toUInt()); - feed_feed->setHeaderXml(feed_header_xml_edit->text()); - feed_feed->setChannelXml(feed_channel_xml_edit->text()); - feed_feed->setItemXml(feed_item_xml_edit->text()); + feed_feed->setHeaderXml(feed_header_xml_edit->toPlainText()); + feed_feed->setChannelXml(feed_channel_xml_edit->toPlainText()); + feed_feed->setItemXml(feed_item_xml_edit->toPlainText()); feed_feed->setMaxShelfLife(feed_max_shelf_life_spin->value()); feed_feed->setEnableAutopost(feed_autopost_box->currentIndex()); feed_feed->setUploadFormat(feed_settings.format()); @@ -718,7 +690,7 @@ void EditFeed::okData() else { feed_feed->setNormalizeLevel(1); } - feed_feed->setCastOrder(feed_castorder_box->currentItem()); + feed_feed->setCastOrder(feed_castorder_box->currentIndex()); if(!feed_feed->postXmlConditional("RDAdmin",this)) { return; diff --git a/rdadmin/edit_group.cpp b/rdadmin/edit_group.cpp index 2d72b7e3..73147b22 100644 --- a/rdadmin/edit_group.cpp +++ b/rdadmin/edit_group.cpp @@ -57,7 +57,7 @@ EditGroup::EditGroup(QString group,QWidget *parent) group_name_edit=new QLineEdit(this); group_name_edit->setMaxLength(10); group_name_edit->setReadOnly(true); - group_name_label=new QLabel(group_name_edit,tr("&Group Name:"),this); + group_name_label=new QLabel(tr("&Group Name:"),this); group_name_label->setFont(labelFont()); group_name_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -67,8 +67,7 @@ EditGroup::EditGroup(QString group,QWidget *parent) group_description_edit=new QLineEdit(this); group_description_edit->setMaxLength(255); group_description_edit->setValidator(validator); - group_description_label= - new QLabel(group_description_edit,tr("Group &Description:"),this); + group_description_label=new QLabel(tr("Group &Description:"),this); group_description_label->setFont(labelFont()); group_description_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -78,8 +77,7 @@ EditGroup::EditGroup(QString group,QWidget *parent) group_title_edit=new QLineEdit(this); group_title_edit->setMaxLength(255); group_title_edit->setValidator(validator); - group_title_label= - new QLabel(group_title_edit,tr("Default Import &Title:"),this); + group_title_label=new QLabel(tr("Default Import &Title:"),this); group_title_label->setFont(labelFont()); group_title_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -88,8 +86,7 @@ EditGroup::EditGroup(QString group,QWidget *parent) // group_notify_email_addrs_edit=new QLineEdit(this); group_notify_email_addrs_label= - new QLabel(group_notify_email_addrs_edit, - tr("Notification E-Mail Addresses")+":",this); + new QLabel(tr("Notification E-Mail Addresses")+":",this); group_notify_email_addrs_label->setFont(labelFont()); group_notify_email_addrs_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -97,10 +94,9 @@ EditGroup::EditGroup(QString group,QWidget *parent) // Default Cart Type // group_carttype_box=new QComboBox(this); - group_carttype_box->insertItem(tr("Audio")); - group_carttype_box->insertItem(tr("Macro")); - group_carttype_label= - new QLabel(group_carttype_box,tr("Default Cart &Type:"),this); + group_carttype_box->insertItem(0,tr("Audio")); + group_carttype_box->insertItem(1,tr("Macro")); + group_carttype_label=new QLabel(tr("Default Cart &Type:"),this); group_carttype_label->setFont(labelFont()); group_carttype_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -110,14 +106,12 @@ EditGroup::EditGroup(QString group,QWidget *parent) group_lowcart_box=new QSpinBox(this); group_lowcart_box->setRange(0,999999); group_lowcart_box->setSpecialValueText(tr("None")); - group_cartrange_label= - new QLabel(group_lowcart_box,tr("Default Cart Number:"),this); + group_cartrange_label=new QLabel(tr("Default Cart Number:"),this); group_cartrange_label->setFont(labelFont()); group_cartrange_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); group_highcart_box=new QSpinBox(this); group_highcart_box->setRange(1,999999); - group_highcart_label= - new QLabel(group_highcart_box,tr("to"),this); + group_highcart_label=new QLabel(tr("to"),this); group_highcart_label->setFont(labelFont()); group_highcart_label->setAlignment(Qt::AlignCenter); connect(group_lowcart_box,SIGNAL(valueChanged(int)), @@ -127,8 +121,7 @@ EditGroup::EditGroup(QString group,QWidget *parent) // Enforce Cart Range Checkbox // group_enforcerange_box=new QCheckBox(this); - group_enforcerange_label= - new QLabel(group_enforcerange_box,tr("Enforce Cart Range"),this); + group_enforcerange_label=new QLabel(tr("Enforce Cart Range"),this); group_enforcerange_label->setFont(labelFont()); group_enforcerange_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -137,8 +130,7 @@ EditGroup::EditGroup(QString group,QWidget *parent) // group_traffic_check=new QCheckBox(this); group_traffic_label= - new QLabel(group_traffic_check,tr("Include this group in Traffic reports"), - this); + new QLabel(tr("Include this group in Traffic reports"),this); group_traffic_label->setFont(labelFont()); group_traffic_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -146,9 +138,7 @@ EditGroup::EditGroup(QString group,QWidget *parent) // Music Report Checkbox // group_music_check=new QCheckBox(this); - group_music_label= - new QLabel(group_music_check,tr("Include this group in Music reports"), - this); + group_music_label=new QLabel(tr("Include this group in Music reports"),this); group_music_label->setFont(labelFont()); group_music_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -160,12 +150,10 @@ EditGroup::EditGroup(QString group,QWidget *parent) this,SLOT(cutLifeEnabledData(bool))); group_cutlife_spin=new QSpinBox(this); group_cutlife_spin->setRange(0,999); - group_cutlife_label= - new QLabel(group_cutlife_check,tr("Set End Date/Time to"),this); + group_cutlife_label=new QLabel(tr("Set End Date/Time to"),this); group_cutlife_label->setFont(labelFont()); group_cutlife_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); - group_cutlife_unit= - new QLabel(group_cutlife_check,tr("days after cut creation"),this); + group_cutlife_unit=new QLabel(tr("days after cut creation"),this); group_cutlife_unit->setFont(labelFont()); group_cutlife_unit->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -177,18 +165,15 @@ EditGroup::EditGroup(QString group,QWidget *parent) this,SLOT(purgeEnabledData(bool))); group_shelflife_spin=new QSpinBox(this); group_shelflife_spin->setRange(0,30); - group_shelflife_label= - new QLabel(group_shelflife_check,tr("Purge expired cuts after"),this); + group_shelflife_label=new QLabel(tr("Purge expired cuts after"),this); group_shelflife_label->setFont(labelFont()); group_shelflife_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); - group_shelflife_unit= - new QLabel(group_shelflife_check,tr("days"),this); + group_shelflife_unit=new QLabel(tr("days"),this); group_shelflife_unit->setFont(labelFont()); group_shelflife_unit->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); group_delete_carts_check=new QCheckBox(this); - group_delete_carts_label= - new QLabel(group_delete_carts_check,tr("Delete cart if empty"),this); + group_delete_carts_label=new QLabel(tr("Delete cart if empty"),this); group_delete_carts_label->setFont(labelFont()); group_delete_carts_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -196,8 +181,7 @@ EditGroup::EditGroup(QString group,QWidget *parent) // Now & Next Data Checkbox // group_nownext_check=new QCheckBox(this); - group_nownext_label= - new QLabel(group_nownext_check,tr("Transmit Now && Next data"),this); + group_nownext_label=new QLabel(tr("Transmit Now && Next data"),this); group_nownext_label->setFont(labelFont()); group_nownext_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -238,7 +222,7 @@ EditGroup::EditGroup(QString group,QWidget *parent) group_description_edit->setText(group_group->description()); group_title_edit->setText(group_group->defaultTitle()); group_notify_email_addrs_edit->setText(group_group->notifyEmailAddress()); - group_carttype_box->setCurrentItem(group_group->defaultCartType()-1); + group_carttype_box->setCurrentIndex(group_group->defaultCartType()-1); group_lowcart_box->setValue(group_group->defaultLowCart()); group_highcart_box->setValue(group_group->defaultHighCart()); lowCartChangedData(group_group->defaultLowCart()); @@ -320,7 +304,7 @@ void EditGroup::colorData() { QColor color= QColorDialog::getColor(group_color_button->palette().color(QPalette::Active, - QColorGroup::ButtonText),this); + QPalette::ButtonText),this); if(color.isValid()) { SetButtonColor(color); } @@ -356,7 +340,7 @@ void EditGroup::okData() group_group->setDefaultTitle(group_title_edit->text()); group_group->setNotifyEmailAddress(group_notify_email_addrs_edit->text()); group_group-> - setDefaultCartType((RDCart::Type)(group_carttype_box->currentItem()+1)); + setDefaultCartType((RDCart::Type)(group_carttype_box->currentIndex()+1)); group_group->setDefaultLowCart(group_lowcart_box->value()); group_group->setDefaultHighCart(group_highcart_box->value()); if(group_lowcart_box->value()==0) { @@ -385,7 +369,7 @@ void EditGroup::okData() group_group->setEnableNowNext(group_nownext_check->isChecked()); group_group->setColor(group_color_button-> palette().color(QPalette::Active, - QColorGroup::ButtonText)); + QPalette::ButtonText)); // // Add New Services @@ -535,6 +519,6 @@ bool EditGroup::CheckRange() void EditGroup::SetButtonColor(const QColor &color) { QPalette p=group_color_button->palette(); - p.setColor(QColorGroup::ButtonText,color); + p.setColor(QPalette::ButtonText,color); group_color_button->setPalette(p); } diff --git a/rdadmin/edit_hostvar.cpp b/rdadmin/edit_hostvar.cpp index bf480280..7f4fb499 100644 --- a/rdadmin/edit_hostvar.cpp +++ b/rdadmin/edit_hostvar.cpp @@ -43,10 +43,10 @@ EditHostvar::EditHostvar(QWidget *parent) edit_name_edit=new QLineEdit(this); edit_name_edit->setGeometry(125,11,120,19); edit_name_edit->setReadOnly(true); - QLabel *label=new QLabel(edit_name_edit,tr("Variable Name:"),this); + QLabel *label=new QLabel(tr("Variable Name:"),this); label->setGeometry(10,11,110,19); label->setFont(labelFont()); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Variable Value @@ -54,10 +54,10 @@ EditHostvar::EditHostvar(QWidget *parent) edit_varvalue_edit=new QLineEdit(this); edit_varvalue_edit->setGeometry(125,33,sizeHint().width()-135,19); edit_varvalue_edit->setMaxLength(255); - label=new QLabel(edit_varvalue_edit,tr("Variable Value:"),this); + label=new QLabel(tr("Variable Value:"),this); label->setGeometry(10,33,110,19); label->setFont(labelFont()); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Remark @@ -65,10 +65,10 @@ EditHostvar::EditHostvar(QWidget *parent) edit_remark_edit=new QLineEdit(this); edit_remark_edit->setGeometry(125,55,sizeHint().width()-135,19); edit_remark_edit->setMaxLength(255); - label=new QLabel(edit_remark_edit,tr("Remark:"),this); + label=new QLabel(tr("Remark:"),this); label->setGeometry(10,55,110,19); label->setFont(labelFont()); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Ok Button diff --git a/rdadmin/edit_jack.cpp b/rdadmin/edit_jack.cpp index b1aeb172..2b9a60ec 100644 --- a/rdadmin/edit_jack.cpp +++ b/rdadmin/edit_jack.cpp @@ -49,21 +49,19 @@ EditJack::EditJack(RDStation *station,QWidget *parent) // Start JACK Server // edit_start_jack_box=new QCheckBox(this); - edit_start_jack_label= - new QLabel(edit_start_jack_box,tr("Start JACK Server"),this); + edit_start_jack_label=new QLabel(tr("Start JACK Server"),this); edit_start_jack_label->setFont(labelFont()); edit_start_jack_label-> - setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // JACK Server Name // edit_jack_server_name_edit=new QLineEdit(this); - edit_jack_server_name_label= - new QLabel(edit_jack_server_name_edit,tr("JACK Server Name:"),this); + edit_jack_server_name_label=new QLabel(tr("JACK Server Name:"),this); edit_jack_server_name_label->setFont(labelFont()); edit_jack_server_name_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // JACK Command Line @@ -71,28 +69,25 @@ EditJack::EditJack(RDStation *station,QWidget *parent) edit_jack_command_line_edit=new QLineEdit(this); connect(edit_start_jack_box,SIGNAL(toggled(bool)), this,SLOT(startJackData(bool))); - edit_jack_command_line_label= - new QLabel(edit_jack_command_line_edit,tr("JACK Command Line:"),this); + edit_jack_command_line_label=new QLabel(tr("JACK Command Line:"),this); edit_jack_command_line_label->setFont(labelFont()); edit_jack_command_line_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Active Audio Ports // edit_jack_audio_ports_spin=new QSpinBox(this); edit_jack_audio_ports_spin->setRange(0,24); - edit_jack_audio_ports_label= - new QLabel(edit_jack_audio_ports_spin,tr("Active Audio Ports")+":",this); + edit_jack_audio_ports_label=new QLabel(tr("Active Audio Ports")+":",this); edit_jack_audio_ports_label->setFont(labelFont()); - edit_jack_audio_ports_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + edit_jack_audio_ports_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // JACK Client List // edit_jack_client_view=new RDTableView(this); - edit_jack_client_label= - new QLabel(edit_jack_client_view,tr("JACK Clients to Start:"),this); + edit_jack_client_label=new QLabel(tr("JACK Clients to Start:"),this); edit_jack_client_label->setFont(labelFont()); edit_jack_client_model=new RDJackClientListModel(station->name(),this); edit_jack_client_view->setModel(edit_jack_client_model); diff --git a/rdadmin/edit_jack_client.cpp b/rdadmin/edit_jack_client.cpp index 168fb2a5..a5f00053 100644 --- a/rdadmin/edit_jack_client.cpp +++ b/rdadmin/edit_jack_client.cpp @@ -48,21 +48,19 @@ EditJackClient::EditJackClient(RDStation *station,QWidget *parent) // JACK Client Description // edit_jack_description_edit=new QLineEdit(this); - edit_jack_description_label= - new QLabel(edit_jack_description_edit,tr("Description:"),this); + edit_jack_description_label=new QLabel(tr("Description:"),this); edit_jack_description_label->setFont(labelFont()); edit_jack_description_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // JACK Client Description // edit_jack_command_line_edit=new QLineEdit(this); - edit_jack_command_line_label= - new QLabel(edit_jack_command_line_edit,tr("Command Line:"),this); + edit_jack_command_line_label=new QLabel(tr("Command Line:"),this); edit_jack_command_line_label->setFont(labelFont()); edit_jack_command_line_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Ok Button diff --git a/rdadmin/edit_matrix.cpp b/rdadmin/edit_matrix.cpp index ef5b9f83..c867c340 100644 --- a/rdadmin/edit_matrix.cpp +++ b/rdadmin/edit_matrix.cpp @@ -18,10 +18,8 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include -#include -#include +#include +#include #include #include @@ -93,7 +91,7 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) edit_name_edit=new QLineEdit(this); edit_name_edit->setGeometry(135,50,240,19); edit_name_edit->setValidator(validator); - label=new QLabel(edit_name_edit,tr("Description:"),this); + label=new QLabel(tr("Description:"),this); label->setGeometry(10,50,120,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -111,12 +109,12 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) // edit_porttype_box=new QComboBox(this); edit_porttype_box->setGeometry(90,96,70,19); - edit_porttype_label=new QLabel(edit_porttype_box,tr("Type:"),this); + edit_porttype_label=new QLabel(tr("Type:"),this); edit_porttype_label->setGeometry(15,96,70,19); edit_porttype_label->setFont(labelFont()); edit_porttype_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); - edit_porttype_box->insertItem(tr("Serial")); - edit_porttype_box->insertItem(tr("TCP/IP")); + edit_porttype_box->insertItem(0,tr("Serial")); + edit_porttype_box->insertItem(1,tr("TCP/IP")); connect(edit_porttype_box,SIGNAL(activated(int)), this,SLOT(portTypeActivatedData(int))); @@ -126,8 +124,7 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) edit_port_box=new QComboBox(this); edit_port_box->setGeometry(290,96,90,19); edit_port_box->setEditable(false); - edit_port_label= - new QLabel(edit_port_box,tr("Serial Port:"),this); + edit_port_label=new QLabel(tr("Serial Port:"),this); edit_port_label->setGeometry(195,96,90,19); edit_port_label->setFont(labelFont()); edit_port_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -137,7 +134,7 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) // edit_ipaddress_edit=new QLineEdit(this); edit_ipaddress_edit->setGeometry(90,118,115,19); - edit_ipaddress_label=new QLabel(edit_ipaddress_edit,tr("IP Address:"),this); + edit_ipaddress_label=new QLabel(tr("IP Address:"),this); edit_ipaddress_label->setGeometry(15,118,70,19); edit_ipaddress_label->setFont(labelFont()); edit_ipaddress_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -148,7 +145,7 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) edit_ipport_spin=new QSpinBox(this); edit_ipport_spin->setGeometry(290,118,65,19); edit_ipport_spin->setRange(0,0xFFFF); - edit_ipport_label=new QLabel(edit_ipport_spin,tr("IP Port:"),this); + edit_ipport_label=new QLabel(tr("IP Port:"),this); edit_ipport_label->setGeometry(215,118,70,19); edit_ipport_label->setFont(labelFont()); edit_ipport_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -158,7 +155,7 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) // edit_username_edit=new QLineEdit(this); edit_username_edit->setGeometry(90,140,115,19); - edit_username_label=new QLabel(edit_username_edit,tr("Username:"),this); + edit_username_label=new QLabel(tr("Username:"),this); edit_username_label->setGeometry(15,140,70,19); edit_username_label->setFont(labelFont()); edit_username_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -169,7 +166,7 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) edit_password_edit=new QLineEdit(this); edit_password_edit->setGeometry(290,140,115,19); edit_password_edit->setEchoMode(QLineEdit::Password); - edit_password_label=new QLabel(edit_password_edit,tr("Password:"),this); + edit_password_label=new QLabel(tr("Password:"),this); edit_password_label->setGeometry(215,140,70,19); edit_password_label->setFont(labelFont()); edit_password_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -179,8 +176,7 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) // edit_start_cart_edit=new QLineEdit(this); edit_start_cart_edit->setGeometry(120,164,80,19); - edit_start_cart_label= - new QLabel(edit_start_cart_edit,tr("Startup Cart:"),this); + edit_start_cart_label=new QLabel(tr("Startup Cart:"),this); edit_start_cart_label->setGeometry(15,164,100,19); edit_start_cart_label->setFont(labelFont()); edit_start_cart_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -194,8 +190,7 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) // edit_stop_cart_edit=new QLineEdit(this); edit_stop_cart_edit->setGeometry(120,188,80,19); - edit_stop_cart_label= - new QLabel(edit_stop_cart_edit,tr("Shutdown Cart:"),this); + edit_stop_cart_label=new QLabel(tr("Shutdown Cart:"),this); edit_stop_cart_label->setGeometry(15,188,100,19); edit_stop_cart_label->setFont(labelFont()); edit_stop_cart_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -217,13 +212,13 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) // edit_porttype2_box=new QComboBox(this); edit_porttype2_box->setGeometry(90,243,70,19); - edit_porttype2_label=new QLabel(edit_porttype2_box,tr("Type:"),this); + edit_porttype2_label=new QLabel(tr("Type:"),this); edit_porttype2_label->setGeometry(15,243,70,19); edit_porttype2_label->setFont(labelFont()); edit_porttype2_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); - edit_porttype2_box->insertItem(tr("Serial")); - edit_porttype2_box->insertItem(tr("TCP/IP")); - edit_porttype2_box->insertItem(tr("None")); + edit_porttype2_box->insertItem(0,tr("Serial")); + edit_porttype2_box->insertItem(1,tr("TCP/IP")); + edit_porttype2_box->insertItem(2,tr("None")); connect(edit_porttype2_box,SIGNAL(activated(int)), this,SLOT(portType2ActivatedData(int))); @@ -233,7 +228,7 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) edit_port2_box=new QComboBox(this); edit_port2_box->setGeometry(290,243,90,19); edit_port2_box->setEditable(false); - edit_port2_label=new QLabel(edit_port2_box,tr("Serial Port:"),this); + edit_port2_label=new QLabel(tr("Serial Port:"),this); edit_port2_label->setGeometry(195,243,90,19); edit_port2_label->setFont(labelFont()); edit_port2_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -243,7 +238,7 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) // edit_ipaddress2_edit=new QLineEdit(this); edit_ipaddress2_edit->setGeometry(90,265,115,19); - edit_ipaddress2_label=new QLabel(edit_ipaddress2_edit,tr("IP Address:"),this); + edit_ipaddress2_label=new QLabel(tr("IP Address:"),this); edit_ipaddress2_label->setGeometry(15,265,70,19); edit_ipaddress2_label->setFont(labelFont()); edit_ipaddress2_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -254,7 +249,7 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) edit_ipport2_spin=new QSpinBox(this); edit_ipport2_spin->setGeometry(290,265,65,19); edit_ipport2_spin->setRange(0,0xFFFF); - edit_ipport2_label=new QLabel(edit_ipport2_spin,tr("IP Port:"),this); + edit_ipport2_label=new QLabel(tr("IP Port:"),this); edit_ipport2_label->setGeometry(215,265,70,19); edit_ipport2_label->setFont(labelFont()); edit_ipport2_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -264,7 +259,7 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) // edit_username2_edit=new QLineEdit(this); edit_username2_edit->setGeometry(90,288,115,19); - edit_username2_label=new QLabel(edit_username2_edit,tr("Username:"),this); + edit_username2_label=new QLabel(tr("Username:"),this); edit_username2_label->setGeometry(15,288,70,19); edit_username2_label->setFont(labelFont()); edit_username2_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -275,7 +270,7 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) edit_password2_edit=new QLineEdit(this); edit_password2_edit->setGeometry(290,288,115,19); edit_password2_edit->setEchoMode(QLineEdit::Password); - edit_password2_label=new QLabel(edit_password2_edit,tr("Password:"),this); + edit_password2_label=new QLabel(tr("Password:"),this); edit_password2_label->setGeometry(215,288,70,19); edit_password2_label->setFont(labelFont()); edit_password2_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -285,8 +280,7 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) // edit_start_cart2_edit=new QLineEdit(this); edit_start_cart2_edit->setGeometry(120,312,80,19); - edit_start_cart2_label=new QLabel(edit_start_cart2_edit,tr("Startup Cart:"), - this); + edit_start_cart2_label=new QLabel(tr("Startup Cart:"),this); edit_start_cart2_label->setGeometry(15,312,100,19); edit_start_cart2_label->setFont(labelFont()); edit_start_cart2_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -301,8 +295,7 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) // edit_stop_cart2_edit=new QLineEdit(this); edit_stop_cart2_edit->setGeometry(120,336,80,19); - edit_stop_cart2_label=new QLabel(edit_stop_cart2_edit,tr("Shutdown Cart:"), - this); + edit_stop_cart2_label=new QLabel(tr("Shutdown Cart:"),this); edit_stop_cart2_label->setGeometry(15,336,100,19); edit_stop_cart2_label->setFont(labelFont()); edit_stop_cart2_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -317,7 +310,7 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) edit_card_box=new QSpinBox(this); edit_card_box->setGeometry(75,371,60,19); edit_card_box->setRange(0,9999); - edit_card_label=new QLabel(edit_card_box,tr("Card:"),this); + edit_card_label=new QLabel(tr("Card:"),this); edit_card_label->setGeometry(10,371,60,19); edit_card_label->setFont(labelFont()); edit_card_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -328,7 +321,7 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) edit_inputs_box=new QSpinBox(this); edit_inputs_box->setGeometry(230,371,50,19); edit_inputs_box->setRange(0,MAX_ENDPOINTS); - edit_inputs_label=new QLabel(edit_inputs_box,tr("Inputs:"),this); + edit_inputs_label=new QLabel(tr("Inputs:"),this); edit_inputs_label->setGeometry(175,371,50,19); edit_inputs_label->setFont(labelFont()); edit_inputs_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -341,7 +334,7 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) edit_outputs_box=new QSpinBox(this); edit_outputs_box->setGeometry(355,371,50,19); edit_outputs_box->setRange(0,MAX_ENDPOINTS); - edit_outputs_label=new QLabel(edit_outputs_box,tr("Outputs:"),this); + edit_outputs_label=new QLabel(tr("Outputs:"),this); edit_outputs_label->setGeometry(280,371,70,19); edit_outputs_label->setFont(labelFont()); edit_outputs_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -352,7 +345,7 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) edit_device_edit=new QLineEdit(this); edit_device_edit->setGeometry(75,396,90,19); edit_device_edit->setValidator(validator); - edit_device_label=new QLabel(edit_device_edit,tr("Device:"),this); + edit_device_label=new QLabel(tr("Device:"),this); edit_device_label->setGeometry(5,396,65,19); edit_device_label->setFont(labelFont()); edit_device_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -363,7 +356,7 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) edit_gpis_box=new QSpinBox(this); edit_gpis_box->setGeometry(230,396,50,19); edit_gpis_box->setRange(0,MAX_GPIO_PINS); - edit_gpis_label=new QLabel(edit_gpis_box,tr("GPIs:"),this); + edit_gpis_label=new QLabel(tr("GPIs:"),this); edit_gpis_label->setGeometry(175,396,50,19); edit_gpis_label->setFont(labelFont()); edit_gpis_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -376,7 +369,7 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) edit_gpos_box=new QSpinBox(this); edit_gpos_box->setGeometry(355,396,50,19); edit_gpos_box->setRange(0,MAX_GPIO_PINS); - edit_gpos_label=new QLabel(edit_gpos_box,tr("GPOs:"),this); + edit_gpos_label=new QLabel(tr("GPOs:"),this); edit_gpos_label->setGeometry(280,396,70,19); edit_gpos_label->setFont(labelFont()); edit_gpos_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -388,26 +381,26 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) // edit_layer_box=new QComboBox(this); edit_layer_box->setGeometry(75,421,50,19); - edit_layer_label=new QLabel(edit_layer_box,tr("Layer:"),this); + edit_layer_label=new QLabel(tr("Layer:"),this); edit_layer_label->setGeometry(10,421,60,19); edit_layer_label->setFont(labelFont()); edit_layer_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); - edit_layer_box->insertItem("V"); - edit_layer_box->insertItem("A"); - edit_layer_box->insertItem("B"); - edit_layer_box->insertItem("C"); - edit_layer_box->insertItem("D"); - edit_layer_box->insertItem("E"); - edit_layer_box->insertItem("F"); - edit_layer_box->insertItem("G"); - edit_layer_box->insertItem("H"); - edit_layer_box->insertItem("I"); - edit_layer_box->insertItem("J"); - edit_layer_box->insertItem("K"); - edit_layer_box->insertItem("L"); - edit_layer_box->insertItem("M"); - edit_layer_box->insertItem("N"); - edit_layer_box->insertItem("O"); + edit_layer_box->insertItem(0,"V"); + edit_layer_box->insertItem(1,"A"); + edit_layer_box->insertItem(2,"B"); + edit_layer_box->insertItem(3,"C"); + edit_layer_box->insertItem(4,"D"); + edit_layer_box->insertItem(5,"E"); + edit_layer_box->insertItem(6,"F"); + edit_layer_box->insertItem(7,"G"); + edit_layer_box->insertItem(8,"H"); + edit_layer_box->insertItem(9,"I"); + edit_layer_box->insertItem(10,"J"); + edit_layer_box->insertItem(11,"K"); + edit_layer_box->insertItem(12,"L"); + edit_layer_box->insertItem(13,"M"); + edit_layer_box->insertItem(14,"N"); + edit_layer_box->insertItem(15,"O"); // // Displays @@ -415,7 +408,7 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) edit_displays_box=new QSpinBox(this); edit_displays_box->setGeometry(355,421,50,19); edit_displays_box->setRange(0,1024); - edit_displays_label=new QLabel(edit_displays_box,tr("Displays:"),this); + edit_displays_label=new QLabel(tr("Displays:"),this); edit_displays_label->setGeometry(280,421,70,19); edit_displays_label->setFont(labelFont()); edit_displays_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -534,17 +527,19 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) edit_name_edit->setText(edit_matrix->name()); str=QString(tr("Serial")); for(int i=0;iinsertItem(str+QString().sprintf("%d",i)); - edit_port2_box->insertItem(str+QString().sprintf("%d",i)); + edit_port_box-> + insertItem(edit_port_box->count(),str+QString().sprintf("%d",i)); + edit_port2_box-> + insertItem(edit_port2_box->count(),str+QString().sprintf("%d",i)); } edit_porttype_box-> - setCurrentItem((int)edit_matrix->portType(RDMatrix::Primary)); + setCurrentIndex((int)edit_matrix->portType(RDMatrix::Primary)); edit_porttype2_box-> - setCurrentItem((int)edit_matrix->portType(RDMatrix::Backup)); - switch((RDMatrix::PortType)edit_porttype_box->currentItem()) { + setCurrentIndex((int)edit_matrix->portType(RDMatrix::Backup)); + switch((RDMatrix::PortType)edit_porttype_box->currentIndex()) { case RDMatrix::TtyPort: - edit_port_box->setCurrentItem(edit_matrix->port(RDMatrix::Primary)); - edit_port2_box->setCurrentItem(edit_matrix->port(RDMatrix::Backup)); + edit_port_box->setCurrentIndex(edit_matrix->port(RDMatrix::Primary)); + edit_port2_box->setCurrentIndex(edit_matrix->port(RDMatrix::Backup)); break; case RDMatrix::TcpPort: @@ -591,10 +586,10 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) } edit_displays_box->setValue(edit_matrix->displays()); if(edit_matrix->layer()=='V') { - edit_layer_box->setCurrentItem(0); + edit_layer_box->setCurrentIndex(0); } else { - edit_layer_box->setCurrentItem(edit_matrix->layer()-'@'); + edit_layer_box->setCurrentIndex(edit_matrix->layer()-'@'); } RDMatrix::Type type=edit_matrix->type(); @@ -753,14 +748,14 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) edit_gpis_box-> setEnabled(RDMatrix::controlActive(type,RDMatrix::GpisControl)); edit_gpis_box-> - setLineStep(RDMatrix::defaultControlValue(type,RDMatrix::GpioStepSize)); + setSingleStep(RDMatrix::defaultControlValue(type,RDMatrix::GpioStepSize)); edit_gpos_label-> setEnabled(RDMatrix::controlActive(type,RDMatrix::GposControl)); edit_gpos_box-> setEnabled(RDMatrix::controlActive(type,RDMatrix::GposControl)); edit_gpos_box-> - setLineStep(RDMatrix::defaultControlValue(type,RDMatrix::GpioStepSize)); + setSingleStep(RDMatrix::defaultControlValue(type,RDMatrix::GpioStepSize)); edit_displays_label-> setEnabled(RDMatrix::controlActive(type,RDMatrix::DisplaysControl)); @@ -792,8 +787,8 @@ EditMatrix::EditMatrix(RDMatrix *matrix,QWidget *parent) setEnabled(RDMatrix::controlActive(type, RDMatrix::SasSwitchesButtonControl)); - portTypeActivatedData(edit_porttype_box->currentItem()); - portType2ActivatedData(edit_porttype2_box->currentItem()); + portTypeActivatedData(edit_porttype_box->currentIndex()); + portType2ActivatedData(edit_porttype2_box->currentIndex()); gpisChangedData(edit_gpis_box->value()); gposChangedData(edit_gpos_box->value()); } @@ -836,7 +831,7 @@ void EditMatrix::portTypeActivatedData(int index) { RDMatrix::Type type=edit_matrix->type(); - switch((RDMatrix::PortType)edit_porttype_box->currentItem()) { + switch((RDMatrix::PortType)edit_porttype_box->currentIndex()) { case RDMatrix::TtyPort: edit_port_box->setEnabled(RDMatrix::controlActive(type, RDMatrix::Primary,RDMatrix::SerialPortControl)); @@ -897,7 +892,7 @@ void EditMatrix::portType2ActivatedData(int index) { RDMatrix::Type type=edit_matrix->type(); - switch((RDMatrix::PortType)edit_porttype2_box->currentItem()) { + switch((RDMatrix::PortType)edit_porttype2_box->currentIndex()) { case RDMatrix::TtyPort: edit_port2_box->setEnabled(RDMatrix::controlActive(type, RDMatrix::Backup,RDMatrix::SerialPortControl)); @@ -1211,7 +1206,7 @@ bool EditMatrix::WriteMatrix() // // Ensure Sane Values // - switch((RDMatrix::PortType)edit_porttype_box->currentItem()) { + switch((RDMatrix::PortType)edit_porttype_box->currentIndex()) { case RDMatrix::TcpPort: if(!addr.setAddress(edit_ipaddress_edit->text())) { QMessageBox::warning(this,"RDAdmin - "+tr("Invalid Address"), @@ -1236,14 +1231,14 @@ bool EditMatrix::WriteMatrix() } if(RDMatrix::controlActive(type,RDMatrix::Backup,RDMatrix::PortTypeControl)) { - switch((RDMatrix::PortType)edit_porttype2_box->currentItem()) { + switch((RDMatrix::PortType)edit_porttype2_box->currentIndex()) { case RDMatrix::TcpPort: if(!addr2.setAddress(edit_ipaddress2_edit->text())) { QMessageBox::warning(this,tr("Invalid Address"), tr("The backup IP address is invalid!")); return false; } - if(edit_porttype_box->currentItem()==RDMatrix::TcpPort) { + if(edit_porttype_box->currentIndex()==RDMatrix::TcpPort) { if((addr==addr2)&& (edit_ipport_spin->value()==edit_ipport2_spin->value())) { QMessageBox::warning(this,tr("Duplicate Connections"), @@ -1254,8 +1249,8 @@ bool EditMatrix::WriteMatrix() break; case RDMatrix::TtyPort: - if(edit_porttype_box->currentItem()==RDMatrix::TtyPort) { - if(edit_port_box->currentItem()==edit_port2_box->currentItem()) { + if(edit_porttype_box->currentIndex()==RDMatrix::TtyPort) { + if(edit_port_box->currentIndex()==edit_port2_box->currentIndex()) { QMessageBox::warning(this,tr("Duplicate Connections"), tr("The primary and backup connections must be different!")); return false; @@ -1276,10 +1271,10 @@ bool EditMatrix::WriteMatrix() } } - switch((RDMatrix::PortType)edit_porttype_box->currentItem()) { + switch((RDMatrix::PortType)edit_porttype_box->currentIndex()) { case RDMatrix::TtyPort: edit_matrix->setPortType(RDMatrix::Primary,RDMatrix::TtyPort); - edit_matrix->setPort(RDMatrix::Primary,edit_port_box->currentItem()); + edit_matrix->setPort(RDMatrix::Primary,edit_port_box->currentIndex()); edit_matrix->setIpAddress(RDMatrix::Primary,QHostAddress()); edit_matrix->setIpPort(RDMatrix::Primary,0); break; @@ -1294,10 +1289,10 @@ bool EditMatrix::WriteMatrix() case RDMatrix::NoPort: break; } - switch((RDMatrix::PortType)edit_porttype2_box->currentItem()) { + switch((RDMatrix::PortType)edit_porttype2_box->currentIndex()) { case RDMatrix::TtyPort: edit_matrix->setPortType(RDMatrix::Backup,RDMatrix::TtyPort); - edit_matrix->setPort(RDMatrix::Backup,edit_port2_box->currentItem()); + edit_matrix->setPort(RDMatrix::Backup,edit_port2_box->currentIndex()); edit_matrix->setIpAddress(RDMatrix::Backup,QHostAddress()); edit_matrix->setIpPort(RDMatrix::Backup,0); break; @@ -1313,11 +1308,11 @@ bool EditMatrix::WriteMatrix() edit_matrix->setPortType(RDMatrix::Backup,RDMatrix::NoPort); break; } - if(edit_layer_box->currentItem()==0) { + if(edit_layer_box->currentIndex()==0) { edit_matrix->setLayer('V'); } else { - edit_matrix->setLayer('@'+edit_layer_box->currentItem()); + edit_matrix->setLayer('@'+edit_layer_box->currentIndex()); } // diff --git a/rdadmin/edit_node.cpp b/rdadmin/edit_node.cpp index 47dd97dc..b9682fe4 100644 --- a/rdadmin/edit_node.cpp +++ b/rdadmin/edit_node.cpp @@ -52,7 +52,7 @@ EditNode::EditNode(int *id,RDMatrix *matrix,QWidget *parent) // edit_hostname_edit=new QLineEdit(this); edit_hostname_edit->setGeometry(100,10,180,20); - QLabel *label=new QLabel(edit_hostname_edit,tr("Hostname: "),this); + QLabel *label=new QLabel(tr("Hostname: "),this); label->setGeometry(10,10,90,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -63,7 +63,7 @@ EditNode::EditNode(int *id,RDMatrix *matrix,QWidget *parent) edit_tcpport_spin=new QSpinBox(this); edit_tcpport_spin->setGeometry(335,10,sizeHint().width()-345,20); edit_tcpport_spin->setRange(0,0xFFFF); - label=new QLabel(edit_tcpport_spin,tr("Port: "),this); + label=new QLabel(tr("Port: "),this); label->setGeometry(290,10,45,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -73,7 +73,7 @@ EditNode::EditNode(int *id,RDMatrix *matrix,QWidget *parent) // edit_description_edit=new QLineEdit(this); edit_description_edit->setGeometry(100,32,sizeHint().width()-110,20); - label=new QLabel(edit_description_edit,tr("Description: "),this); + label=new QLabel(tr("Description: "),this); label->setGeometry(10,32,90,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -85,7 +85,7 @@ EditNode::EditNode(int *id,RDMatrix *matrix,QWidget *parent) edit_output_spin->setGeometry(100,54,60,20); edit_output_spin->setRange(0,0x7FFF); edit_output_spin->setSpecialValueText(tr("None")); - label=new QLabel(edit_output_spin,tr("First Output: "),this); + label=new QLabel(tr("First Output: "),this); label->setGeometry(10,54,90,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -99,7 +99,7 @@ EditNode::EditNode(int *id,RDMatrix *matrix,QWidget *parent) edit_password_edit->setText("********"); connect(edit_password_edit,SIGNAL(textChanged(const QString &)), this,SLOT(passwordChangedData(const QString &))); - label=new QLabel(edit_password_edit,tr("Password: "),this); + label=new QLabel(tr("Password: "),this); label->setGeometry(170,54,80,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); diff --git a/rdadmin/edit_rdairplay.cpp b/rdadmin/edit_rdairplay.cpp index 8ad3daf3..095c7bec 100644 --- a/rdadmin/edit_rdairplay.cpp +++ b/rdadmin/edit_rdairplay.cpp @@ -88,15 +88,14 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_start_rml_edit[0]=new QLineEdit(this); air_start_rml_edit[0]->setGeometry(210,50,95,19); air_start_rml_edit[0]->setValidator(validator); - air_start_rml_label[0]= - new QLabel(air_start_rml_edit[0],tr("Start RML:"),this); + air_start_rml_label[0]=new QLabel(tr("Start RML:"),this); air_start_rml_label[0]->setFont(subLabelFont()); air_start_rml_label[0]->setGeometry(140,50,65,19); air_start_rml_label[0]->setAlignment(Qt::AlignVCenter|Qt::AlignRight); air_stop_rml_edit[0]=new QLineEdit(this); air_stop_rml_edit[0]->setGeometry(210,71,95,19); air_stop_rml_edit[0]->setValidator(validator); - air_stop_rml_label[0]=new QLabel(air_start_rml_edit[0],tr("Stop RML:"),this); + air_stop_rml_label[0]=new QLabel(tr("Stop RML:"),this); air_stop_rml_label[0]->setFont(subLabelFont()); air_stop_rml_label[0]->setGeometry(140,71,65,19); air_stop_rml_label[0]->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -122,14 +121,14 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_start_rml_edit[1]->setGeometry(210,118,95,19); air_start_rml_edit[1]->setValidator(validator); air_start_rml_label[1]= - new QLabel(air_start_rml_edit[1],tr("Start RML:"),this); + new QLabel(tr("Start RML:"),this); air_start_rml_label[1]->setFont(subLabelFont()); air_start_rml_label[1]->setGeometry(140,118,65,19); air_start_rml_label[1]->setAlignment(Qt::AlignVCenter|Qt::AlignRight); air_stop_rml_edit[1]=new QLineEdit(this); air_stop_rml_edit[1]->setGeometry(210,139,95,19); air_stop_rml_edit[1]->setValidator(validator); - air_stop_rml_label[1]=new QLabel(air_start_rml_edit[1],tr("Stop RML:"),this); + air_stop_rml_label[1]=new QLabel(tr("Stop RML:"),this); air_stop_rml_label[1]->setFont(subLabelFont()); air_stop_rml_label[1]->setGeometry(140,139,65,19); air_stop_rml_label[1]->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -155,14 +154,14 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_start_rml_edit[4]->setGeometry(210,186,95,19); air_start_rml_edit[4]->setValidator(validator); air_start_rml_label[4]= - new QLabel(air_start_rml_edit[4],tr("Start RML:"),this); + new QLabel(tr("Start RML:"),this); air_start_rml_label[4]->setFont(subLabelFont()); air_start_rml_label[4]->setGeometry(140,186,65,19); air_start_rml_label[4]->setAlignment(Qt::AlignVCenter|Qt::AlignRight); air_stop_rml_edit[4]=new QLineEdit(this); air_stop_rml_edit[4]->setGeometry(210,207,95,19); air_stop_rml_edit[4]->setValidator(validator); - air_stop_rml_label[4]=new QLabel(air_start_rml_edit[4],tr("Stop RML:"),this); + air_stop_rml_label[4]=new QLabel(tr("Stop RML:"),this); air_stop_rml_label[4]->setFont(subLabelFont()); air_stop_rml_label[4]->setGeometry(140,207,65,19); air_stop_rml_label[4]->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -188,14 +187,14 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_start_rml_edit[5]->setGeometry(210,254,95,19); air_start_rml_edit[5]->setValidator(validator); air_start_rml_label[5]= - new QLabel(air_start_rml_edit[5],tr("Start RML:"),this); + new QLabel(tr("Start RML:"),this); air_start_rml_label[5]->setFont(subLabelFont()); air_start_rml_label[5]->setGeometry(140,254,65,19); air_start_rml_label[5]->setAlignment(Qt::AlignVCenter|Qt::AlignRight); air_stop_rml_edit[5]=new QLineEdit(this); air_stop_rml_edit[5]->setGeometry(210,275,95,19); air_stop_rml_edit[5]->setValidator(validator); - air_stop_rml_label[5]=new QLabel(air_start_rml_edit[5],tr("Stop RML:"),this); + air_stop_rml_label[5]=new QLabel(tr("Stop RML:"),this); air_stop_rml_label[5]->setFont(subLabelFont()); air_stop_rml_label[5]->setGeometry(140,275,65,19); air_stop_rml_label[5]->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -218,11 +217,12 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_virtual_machine_box->setGeometry(270,309,100,20); for(int i=0;i - insertItem(QString().sprintf("vLog %d",i+RD_RDVAIRPLAY_LOG_BASE+1)); + insertItem(air_virtual_machine_box->count(), + QString().sprintf("vLog %d",i+RD_RDVAIRPLAY_LOG_BASE+1)); } connect(air_virtual_machine_box,SIGNAL(activated(int)), this,SLOT(virtualLogActivatedData(int))); - label=new QLabel(air_virtual_machine_box,tr("Log Machine")+":",this); + label=new QLabel(tr("Log Machine")+":",this); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); label->setGeometry(165,309,100,20); @@ -231,16 +231,14 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_virtual_start_rml_edit=new QLineEdit(this); air_virtual_start_rml_edit->setGeometry(210,332,95,19); air_virtual_start_rml_edit->setValidator(validator); - air_virtual_start_rml_label= - new QLabel(air_virtual_start_rml_edit,tr("Start RML:"),this); + air_virtual_start_rml_label=new QLabel(tr("Start RML:"),this); air_virtual_start_rml_label->setFont(subLabelFont()); air_virtual_start_rml_label->setGeometry(140,332,65,19); air_virtual_start_rml_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); air_virtual_stop_rml_edit=new QLineEdit(this); air_virtual_stop_rml_edit->setGeometry(210,353,95,19); air_virtual_stop_rml_edit->setValidator(validator); - air_virtual_stop_rml_label= - new QLabel(air_virtual_start_rml_edit,tr("Stop RML:"),this); + air_virtual_stop_rml_label=new QLabel(tr("Stop RML:"),this); air_virtual_stop_rml_label->setFont(subLabelFont()); air_virtual_stop_rml_label->setGeometry(140,353,65,19); air_virtual_stop_rml_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -255,14 +253,14 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_start_rml_edit[3]=new QLineEdit(this); air_start_rml_edit[3]->setGeometry(210,322,160,19); air_start_rml_edit[3]->setValidator(validator); - air_start_rml_label[3]=new QLabel(air_start_rml_edit[3],tr("Start RML:"),this); + air_start_rml_label[3]=new QLabel(tr("Start RML:"),this); air_start_rml_label[3]->setFont(subLabelFont()); air_start_rml_label[3]->setGeometry(140,322,65,19); air_start_rml_label[3]->setAlignment(Qt::AlignVCenter|Qt::AlignRight); air_stop_rml_edit[3]=new QLineEdit(this); air_stop_rml_edit[3]->setGeometry(210,343,160,19); air_stop_rml_edit[3]->setValidator(validator); - air_stop_rml_label[3]=new QLabel(air_start_rml_edit[3],tr("Stop RML:"),this); + air_stop_rml_label[3]=new QLabel(tr("Stop RML:"),this); air_stop_rml_label[3]->setFont(subLabelFont()); air_stop_rml_label[3]->setGeometry(140,343,65,19); air_stop_rml_label[3]->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -300,14 +298,14 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_start_rml_edit[2]=new QLineEdit(this); air_start_rml_edit[2]->setGeometry(580,50,95,19); air_start_rml_edit[2]->setValidator(validator); - air_start_rml_label[2]=new QLabel(air_start_rml_edit[2],tr("Start RML:"),this); + air_start_rml_label[2]=new QLabel(tr("Start RML:"),this); air_start_rml_label[2]->setFont(subLabelFont()); air_start_rml_label[2]->setGeometry(510,50,65,19); air_start_rml_label[2]->setAlignment(Qt::AlignVCenter|Qt::AlignRight); air_stop_rml_edit[2]=new QLineEdit(this); air_stop_rml_edit[2]->setGeometry(580,71,95,19); air_stop_rml_edit[2]->setValidator(validator); - air_stop_rml_label[2]=new QLabel(air_start_rml_edit[2],tr("Stop RML:"),this); + air_stop_rml_label[2]=new QLabel(tr("Stop RML:"),this); air_stop_rml_label[2]->setFont(subLabelFont()); air_stop_rml_label[2]->setGeometry(510,71,65,19); air_stop_rml_label[2]->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -332,15 +330,14 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_start_rml_edit[6]=new QLineEdit(this); air_start_rml_edit[6]->setGeometry(580,118,95,19); air_start_rml_edit[6]->setValidator(validator); - air_start_rml_label[6]= - new QLabel(air_start_rml_edit[6],tr("Start RML:"),this); + air_start_rml_label[6]=new QLabel(tr("Start RML:"),this); air_start_rml_label[6]->setFont(subLabelFont()); air_start_rml_label[6]->setGeometry(510,118,65,19); air_start_rml_label[6]->setAlignment(Qt::AlignVCenter|Qt::AlignRight); air_stop_rml_edit[6]=new QLineEdit(this); air_stop_rml_edit[6]->setGeometry(580,139,95,19); air_stop_rml_edit[6]->setValidator(validator); - air_stop_rml_label[6]=new QLabel(air_start_rml_edit[6],tr("Stop RML:"),this); + air_stop_rml_label[6]=new QLabel(tr("Stop RML:"),this); air_stop_rml_label[6]->setFont(subLabelFont()); air_stop_rml_label[6]->setGeometry(510,139,65,19); air_stop_rml_label[6]->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -365,15 +362,14 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_start_rml_edit[7]=new QLineEdit(this); air_start_rml_edit[7]->setGeometry(580,186,95,19); air_start_rml_edit[7]->setValidator(validator); - air_start_rml_label[7]= - new QLabel(air_start_rml_edit[7],tr("Start RML:"),this); + air_start_rml_label[7]=new QLabel(tr("Start RML:"),this); air_start_rml_label[7]->setFont(subLabelFont()); air_start_rml_label[7]->setGeometry(510,186,65,19); air_start_rml_label[7]->setAlignment(Qt::AlignVCenter|Qt::AlignRight); air_stop_rml_edit[7]=new QLineEdit(this); air_stop_rml_edit[7]->setGeometry(580,207,95,19); air_stop_rml_edit[7]->setValidator(validator); - air_stop_rml_label[7]=new QLabel(air_start_rml_edit[7],tr("Stop RML:"),this); + air_stop_rml_label[7]=new QLabel(tr("Stop RML:"),this); air_stop_rml_label[7]->setFont(subLabelFont()); air_stop_rml_label[7]->setGeometry(510,207,65,19); air_stop_rml_label[7]->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -398,15 +394,14 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_start_rml_edit[8]=new QLineEdit(this); air_start_rml_edit[8]->setGeometry(580,254,95,19); air_start_rml_edit[8]->setValidator(validator); - air_start_rml_label[8]= - new QLabel(air_start_rml_edit[8],tr("Start RML:"),this); + air_start_rml_label[8]=new QLabel(tr("Start RML:"),this); air_start_rml_label[8]->setFont(subLabelFont()); air_start_rml_label[8]->setGeometry(510,254,65,19); air_start_rml_label[8]->setAlignment(Qt::AlignVCenter|Qt::AlignRight); air_stop_rml_edit[8]=new QLineEdit(this); air_stop_rml_edit[8]->setGeometry(580,275,95,19); air_stop_rml_edit[8]->setValidator(validator); - air_stop_rml_label[8]=new QLabel(air_start_rml_edit[8],tr("Stop RML:"),this); + air_stop_rml_label[8]=new QLabel(tr("Stop RML:"),this); air_stop_rml_label[8]->setFont(subLabelFont()); air_stop_rml_label[8]->setGeometry(510,275,65,19); air_stop_rml_label[8]->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -431,15 +426,14 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_start_rml_edit[9]=new QLineEdit(this); air_start_rml_edit[9]->setGeometry(580,322,95,19); air_start_rml_edit[9]->setValidator(validator); - air_start_rml_label[9]= - new QLabel(air_start_rml_edit[9],tr("Start RML:"),this); + air_start_rml_label[9]=new QLabel(tr("Start RML:"),this); air_start_rml_label[9]->setFont(subLabelFont()); air_start_rml_label[9]->setGeometry(510,322,65,19); air_start_rml_label[9]->setAlignment(Qt::AlignVCenter|Qt::AlignRight); air_stop_rml_edit[9]=new QLineEdit(this); air_stop_rml_edit[9]->setGeometry(580,343,95,19); air_stop_rml_edit[9]->setValidator(validator); - air_stop_rml_label[9]=new QLabel(air_start_rml_edit[9],tr("Stop RML:"),this); + air_stop_rml_label[9]=new QLabel(tr("Stop RML:"),this); air_stop_rml_label[9]->setFont(subLabelFont()); air_stop_rml_label[9]->setGeometry(510,343,65,19); air_stop_rml_label[9]->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -464,11 +458,11 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, // air_segue_edit=new QLineEdit(this); air_segue_edit->setGeometry(895,32,50,20); - air_segue_label=new QLabel(air_segue_edit,tr("Manual Segue:"),this); + air_segue_label=new QLabel(tr("Manual Segue:"),this); air_segue_label->setFont(subLabelFont()); air_segue_label->setGeometry(790,32,100,20); air_segue_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); - air_segue_unit=new QLabel(air_segue_edit,tr("msecs"),this); + air_segue_unit=new QLabel(tr("msecs"),this); air_segue_unit->setFont(subLabelFont()); air_segue_unit->setGeometry(950,32,40,20); air_segue_unit->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -478,11 +472,11 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, // air_trans_edit=new QLineEdit(this); air_trans_edit->setGeometry(895,54,50,20); - air_trans_label=new QLabel(air_trans_edit,tr("Forced Segue:"),this); + air_trans_label=new QLabel(tr("Forced Segue:"),this); air_trans_label->setFont(subLabelFont()); air_trans_label->setGeometry(790,54,100,20); air_trans_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); - air_trans_unit=new QLabel(air_trans_edit,tr("msecs"),this); + air_trans_unit=new QLabel(tr("msecs"),this); air_trans_unit->setFont(subLabelFont()); air_trans_unit->setGeometry(950,54,40,20); air_trans_unit->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -493,7 +487,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_piecount_box=new QSpinBox(this); air_piecount_box->setGeometry(895,76,50,20); air_piecount_box->setRange(0,60); - air_piecount_label=new QLabel(air_piecount_box,tr("Pie Counts Last:"),this); + air_piecount_label=new QLabel(tr("Pie Counts Last:"),this); air_piecount_label->setFont(subLabelFont()); air_piecount_label->setGeometry(785,76,105,20); air_piecount_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -507,25 +501,25 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, // air_countto_box=new QComboBox(this); air_countto_box->setGeometry(895,98,100,20); - air_countto_label=new QLabel(air_countto_box,tr("Pie Counts To:"),this); + air_countto_label=new QLabel(tr("Pie Counts To:"),this); air_countto_label->setFont(subLabelFont()); air_countto_label->setGeometry(785,98,105,20); air_countto_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); - air_countto_box->insertItem(tr("Cart End")); - air_countto_box->insertItem(tr("Transition")); + air_countto_box->insertItem(0,tr("Cart End")); + air_countto_box->insertItem(1,tr("Transition")); // // Default Transition Type // air_default_transtype_box=new QComboBox(this); air_default_transtype_box->setGeometry(895,120,100,20); - label=new QLabel(air_default_transtype_box,tr("Default Trans. Type:"),this); + label=new QLabel(tr("Default Trans. Type:"),this); label->setFont(subLabelFont()); label->setGeometry(760,120,130,20); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); - air_default_transtype_box->insertItem(tr("Play")); - air_default_transtype_box->insertItem(tr("Segue")); - air_default_transtype_box->insertItem(tr("Stop")); + air_default_transtype_box->insertItem(0,tr("Play")); + air_default_transtype_box->insertItem(1,tr("Segue")); + air_default_transtype_box->insertItem(2,tr("Stop")); // // Default Service @@ -533,7 +527,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_defaultsvc_box=new QComboBox(this); air_defaultsvc_box->setGeometry(895,142,100,20); air_defaultsvc_box->setModel(air_service_model); - label=new QLabel(air_defaultsvc_box,tr("Default Service:"),this); + label=new QLabel(tr("Default Service:"),this); label->setFont(subLabelFont()); label->setGeometry(760,142,130,20); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -552,7 +546,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_station_box->setGeometry(895,204,50,20); air_station_box->setRange(0,MAX_PANELS); air_station_box->setSpecialValueText(tr("None")); - air_station_label=new QLabel(air_station_box,tr("System Panels:"),this); + air_station_label=new QLabel(tr("System Panels:"),this); air_station_label->setFont(subLabelFont()); air_station_label->setGeometry(750,204,140,20); air_station_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -564,7 +558,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_user_box->setGeometry(895,226,50,20); air_user_box->setRange(0,MAX_PANELS); air_user_box->setSpecialValueText(tr("None")); - air_user_label=new QLabel(air_user_box,tr("User Panels:"),this); + air_user_label=new QLabel(tr("User Panels:"),this); air_user_label->setFont(subLabelFont()); air_user_label->setGeometry(750,226,140,20); air_user_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -574,7 +568,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, // air_flash_box=new QCheckBox(this); air_flash_box->setGeometry(810,254,15,15); - label=new QLabel(air_flash_box,tr("Flash Active Buttons"),this); + label=new QLabel(tr("Flash Active Buttons"),this); label->setFont(subLabelFont()); label->setGeometry(830,254,150,15); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -584,7 +578,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, // air_panel_pause_box=new QCheckBox(this); air_panel_pause_box->setGeometry(810,276,15,15); - label=new QLabel(air_panel_pause_box,tr("Enable Button Pausing"),this); + label=new QLabel(tr("Enable Button Pausing"),this); label->setFont(subLabelFont()); label->setGeometry(830,276,150,15); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -594,7 +588,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, // air_label_template_edit=new QLineEdit(this); air_label_template_edit->setGeometry(895,298,sizeHint().width()-910,20); - label=new QLabel(air_label_template_edit,tr("Label Template:"),this); + label=new QLabel(tr("Label Template:"),this); label->setFont(subLabelFont()); label->setGeometry(790,298,100,20); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -611,7 +605,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, // air_timesync_box=new QCheckBox(this); air_timesync_box->setGeometry(810,356,15,15); - air_timesync_label=new QLabel(air_timesync_box,tr("Check TimeSync"),this); + air_timesync_label=new QLabel(tr("Check TimeSync"),this); air_timesync_label->setFont(subLabelFont()); air_timesync_label->setGeometry(830,356,100,15); air_timesync_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -621,14 +615,14 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, // air_auxlog_box[0]=new QCheckBox(this); air_auxlog_box[0]->setGeometry(810,378,15,15); - label=new QLabel(air_auxlog_box[0],tr("Show Auxlog 1 Button"),this); + label=new QLabel(tr("Show Auxlog 1 Button"),this); label->setFont(subLabelFont()); label->setGeometry(830,378,150,15); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); air_auxlog_box[1]=new QCheckBox(this); air_auxlog_box[1]->setGeometry(810,400,15,15); - label=new QLabel(air_auxlog_box[1],tr("Show Auxlog 2 Button"),this); + label=new QLabel(tr("Show Auxlog 2 Button"),this); label->setFont(subLabelFont()); label->setGeometry(830,400,150,15); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -638,7 +632,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, // air_clearfilter_box=new QCheckBox(this); air_clearfilter_box->setGeometry(810,422,15,15); - label=new QLabel(air_clearfilter_box,tr("Clear Cart Search Filter"),this); + label=new QLabel(tr("Clear Cart Search Filter"),this); label->setFont(subLabelFont()); label->setGeometry(830,422,150,15); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -648,7 +642,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, // air_pause_box=new QCheckBox(this); air_pause_box->setGeometry(810,444,15,15); - label=new QLabel(air_pause_box,tr("Enable Paused Events"),this); + label=new QLabel(tr("Enable Paused Events"),this); label->setFont(subLabelFont()); label->setGeometry(830,444,150,15); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -658,8 +652,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, // air_show_counters_box=new QCheckBox(this); air_show_counters_box->setGeometry(810,466,15,15); - label= - new QLabel(air_show_counters_box,tr("Show Extra Buttons/Counters"),this); + label=new QLabel(tr("Show Extra Buttons/Counters"),this); label->setFont(subLabelFont()); label->setGeometry(830,466,170,15); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -669,7 +662,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, // air_hour_selector_box=new QCheckBox(this); air_hour_selector_box->setGeometry(810,488,15,15); - label=new QLabel(air_hour_selector_box,tr("Show Hour Selector"),this); + label=new QLabel(tr("Show Hour Selector"),this); label->setFont(subLabelFont()); label->setGeometry(830,488,170,15); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -680,8 +673,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_audition_preroll_spin=new QSpinBox(this); air_audition_preroll_spin->setGeometry(895,507,45,20); air_audition_preroll_spin->setRange(1,60); - air_audition_preroll_label= - new QLabel(air_audition_preroll_spin,tr("Audition Preroll:"),this); + air_audition_preroll_label=new QLabel(tr("Audition Preroll:"),this); air_audition_preroll_label->setFont(subLabelFont()); air_audition_preroll_label->setGeometry(800,510,90,15); air_audition_preroll_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -697,8 +689,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_baraction_box->setGeometry(895,532,100,20); air_baraction_box->insertItem(0,tr("None")); air_baraction_box->insertItem(1,tr("Start Next")); - air_baraction_label= - new QLabel(air_baraction_box,tr("Space Bar Action")+":",this); + air_baraction_label=new QLabel(tr("Space Bar Action")+":",this); air_baraction_label->setFont(subLabelFont()); air_baraction_label->setGeometry(790,532,110,20); @@ -716,7 +707,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_exitpasswd_edit->setGeometry(100,474,sizeHint().width()-905,20); air_exitpasswd_edit->setEchoMode(QLineEdit::Password); air_exitpasswd_edit->setText("******"); - label=new QLabel(air_exitpasswd_edit,tr("Exit Password:"),this); + label=new QLabel(tr("Exit Password:"),this); label->setFont(subLabelFont()); label->setGeometry(0,474,95,20); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -728,12 +719,14 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, // air_logmachine_box=new QComboBox(this); air_logmachine_box->setGeometry(45,499,100,20); - air_logmachine_box->insertItem(tr("Main Log")); + air_logmachine_box->insertItem(0,tr("Main Log")); for(unsigned i=1;iinsertItem(QString().sprintf("Aux %d Log",i)); + air_logmachine_box->insertItem(air_logmachine_box->count(), + QString().sprintf("Aux %d Log",i)); } for(unsigned i=0;iinsertItem(QString().sprintf("vLog %d",i+RD_RDVAIRPLAY_LOG_BASE+1)); + air_logmachine_box->insertItem(air_logmachine_box->count(), + QString().sprintf("vLog %d",i+RD_RDVAIRPLAY_LOG_BASE+1)); } connect(air_logmachine_box,SIGNAL(activated(int)), this,SLOT(logActivatedData(int))); @@ -743,10 +736,10 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, // air_startmode_box=new QComboBox(this); air_startmode_box->setGeometry(100,524,240,20); - air_startmode_box->insertItem(tr("start with empty log")); - air_startmode_box->insertItem(tr("load previous log")); - air_startmode_box->insertItem(tr("load specified log")); - label=new QLabel(air_exitpasswd_edit,tr("At Startup:"),this); + air_startmode_box->insertItem(0,tr("start with empty log")); + air_startmode_box->insertItem(1,tr("load previous log")); + air_startmode_box->insertItem(2,tr("load specified log")); + label=new QLabel(tr("At Startup:"),this); label->setFont(subLabelFont()); label->setGeometry(30,524,65,20); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -759,8 +752,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_autorestart_box=new QCheckBox(this); air_autorestart_box->setGeometry(105,549,15,15); air_autorestart_label= - new QLabel(air_autorestart_box, - tr("Restart Log After Unclean Shutdown"),this); + new QLabel(tr("Restart Log After Unclean Shutdown"),this); air_autorestart_label->setFont(subLabelFont()); air_autorestart_label->setGeometry(125,549,250,15); air_autorestart_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -770,7 +762,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, // air_startlog_edit=new QLineEdit(this); air_startlog_edit->setGeometry(100,569,240,20); - air_startlog_label=new QLabel(air_startlog_edit,tr("Log:"),this); + air_startlog_label=new QLabel(tr("Log:"),this); air_startlog_label->setFont(subLabelFont()); air_startlog_label->setGeometry(30,569,65,20); air_startlog_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -796,7 +788,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, // air_skin_edit=new QLineEdit(this); air_skin_edit->setGeometry(555,403,180,20); - label=new QLabel(air_skin_edit,tr("Background Image:"),this); + label=new QLabel(tr("Background Image:"),this); label->setFont(subLabelFont()); label->setGeometry(435,403,115,20); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -810,7 +802,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, // air_title_template_edit=new QLineEdit(this); air_title_template_edit->setGeometry(555,425,180,20); - label=new QLabel(air_label_template_edit,tr("Title Template:"),this); + label=new QLabel(tr("Title Template:"),this); label->setFont(subLabelFont()); label->setGeometry(430,425,120,20); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -820,7 +812,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, // air_artist_template_edit=new QLineEdit(this); air_artist_template_edit->setGeometry(555,447,180,20); - label=new QLabel(air_label_template_edit,tr("Artist Template:"),this); + label=new QLabel(tr("Artist Template:"),this); label->setFont(subLabelFont()); label->setGeometry(430,447,120,20); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -830,7 +822,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, // air_outcue_template_edit=new QLineEdit(this); air_outcue_template_edit->setGeometry(555,469,180,20); - label=new QLabel(air_label_template_edit,tr("Outcue Template:"),this); + label=new QLabel(tr("Outcue Template:"),this); label->setFont(subLabelFont()); label->setGeometry(430,469,120,20); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -840,7 +832,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, // air_description_template_edit=new QLineEdit(this); air_description_template_edit->setGeometry(555,491,180,20); - label=new QLabel(air_label_template_edit,tr("Description Template:"),this); + label=new QLabel(tr("Description Template:"),this); label->setFont(subLabelFont()); label->setGeometry(430,491,120,20); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -859,12 +851,12 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_modecontrol_box->setGeometry(560,550,110,20); connect(air_modecontrol_box,SIGNAL(activated(int)), this,SLOT(modeControlActivatedData(int))); - label=new QLabel(air_modecontrol_box,tr("Mode Control Style:"),this); + label=new QLabel(tr("Mode Control Style:"),this); label->setFont(subLabelFont()); label->setGeometry(435,550,120,20); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); - air_modecontrol_box->insertItem(tr("Unified")); - air_modecontrol_box->insertItem(tr("Independent")); + air_modecontrol_box->insertItem(0,tr("Unified")); + air_modecontrol_box->insertItem(1,tr("Independent")); // // Startup Mode @@ -874,14 +866,14 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_logstartmode_box[i]->setGeometry(615,572+i*22,110,20); connect(air_logstartmode_box[i],SIGNAL(activated(int)), this,SLOT(logStartupModeActivatedData(int))); - air_logstartmode_label[i]=new QLabel(air_logstartmode_box[i],"",this); + air_logstartmode_label[i]=new QLabel(this); air_logstartmode_label[i]->setFont(subLabelFont()); air_logstartmode_label[i]->setGeometry(470,572+i*22,140,20); air_logstartmode_label[i]->setAlignment(Qt::AlignRight|Qt::AlignVCenter); - air_logstartmode_box[i]->insertItem(tr("Previous")); - air_logstartmode_box[i]->insertItem(tr("LiveAssist")); - air_logstartmode_box[i]->insertItem(tr("Automatic")); - air_logstartmode_box[i]->insertItem(tr("Manual")); + air_logstartmode_box[i]->insertItem(0,tr("Previous")); + air_logstartmode_box[i]->insertItem(1,tr("LiveAssist")); + air_logstartmode_box[i]->insertItem(2,tr("Automatic")); + air_logstartmode_box[i]->insertItem(3,tr("Manual")); } air_logstartmode_label[0]->setText(tr("Main Log Startup Mode:")); air_logstartmode_label[1]->setText(tr("Aux 1 Log Startup Mode:")); @@ -893,7 +885,8 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, this,SLOT(virtualModeActivatedData(int))); for(int i=0;i - insertItem(QString().sprintf("vLog %d",i+RD_RDVAIRPLAY_LOG_BASE+1)); + insertItem(air_virtual_logstartsel_box->count(), + QString().sprintf("vLog %d",i+RD_RDVAIRPLAY_LOG_BASE+1)); } label=new QLabel(":",this); label->setFont(subLabelFont()); @@ -901,10 +894,10 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, label->setAlignment(Qt::AlignCenter|Qt::AlignVCenter); air_virtual_logstartmode_box=new QComboBox(this); air_virtual_logstartmode_box->setGeometry(565,638,110,20); - air_virtual_logstartmode_box->insertItem(tr("Previous")); - air_virtual_logstartmode_box->insertItem(tr("LiveAssist")); - air_virtual_logstartmode_box->insertItem(tr("Automatic")); - air_virtual_logstartmode_box->insertItem(tr("Manual")); + air_virtual_logstartmode_box->insertItem(0,tr("Previous")); + air_virtual_logstartmode_box->insertItem(1,tr("LiveAssist")); + air_virtual_logstartmode_box->insertItem(2,tr("Automatic")); + air_virtual_logstartmode_box->insertItem(3,tr("Manual")); // // Ok Button @@ -954,9 +947,14 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_segue_edit->setText(QString().sprintf("%d",air_conf->segueLength())); air_trans_edit->setText(QString().sprintf("%d",air_conf->transLength())); air_piecount_box->setValue(air_conf->pieCountLength()/1000); - air_countto_box->setCurrentItem(air_conf->pieEndPoint()); - air_default_transtype_box->setCurrentItem(air_conf->defaultTransType()); - air_defaultsvc_box->setCurrentText(air_conf->defaultSvc()); + air_countto_box->setCurrentIndex(air_conf->pieEndPoint()); + air_default_transtype_box->setCurrentIndex(air_conf->defaultTransType()); + for(int i=0;icount();i++) { + if(air_defaultsvc_box->itemData(i).toString()==air_conf->defaultSvc()) { + air_defaultsvc_box->setCurrentIndex(i); + break; + } + } air_station_box->setValue(air_conf->panels(RDAirPlayConf::StationPanel)); air_user_box->setValue(air_conf->panels(RDAirPlayConf::UserPanel)); air_timesync_box->setChecked(air_conf->checkTimesync()); @@ -982,12 +980,12 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, air_stop_rml_edit[i]->setText(air_conf-> stopRml((RDAirPlayConf::Channel)i)); } - air_modecontrol_box->setCurrentItem((int)air_conf->opModeStyle()); + air_modecontrol_box->setCurrentIndex((int)air_conf->opModeStyle()); for(int i=0;istartMode(i); air_startlogs[i]=air_conf->logName(i); air_autorestarts[i]=air_conf->autoRestart(i); - air_logstartmode_box[i]->setCurrentItem(air_conf->logStartMode(i)); + air_logstartmode_box[i]->setCurrentIndex(air_conf->logStartMode(i)); } for(int i=0;ivirtualStartRml(i+RD_RDVAIRPLAY_LOG_BASE); air_virtual_stop_rmls[i]=air_conf->virtualStopRml(i+RD_RDVAIRPLAY_LOG_BASE); air_virtual_opmodes[i]=air_conf->opMode(i+RD_RDVAIRPLAY_LOG_BASE); - air_virtual_logstartmode_box->setCurrentItem((int)air_virtual_opmodes[0]); + air_virtual_logstartmode_box->setCurrentIndex((int)air_virtual_opmodes[0]); } air_virtual_card_sel->setCard(air_virtual_cards[air_virtual_logmachine]); air_virtual_card_sel->setPort(air_virtual_ports[air_virtual_logmachine]); @@ -1010,7 +1008,7 @@ EditRDAirPlay::EditRDAirPlay(RDStation *station,RDStation *cae_station, setText(air_virtual_start_rmls[air_virtual_logmachine]); air_virtual_stop_rml_edit-> setText(air_virtual_stop_rmls[air_virtual_logmachine]); - air_startmode_box->setCurrentItem((int)air_startmodes[air_logmachine]); + air_startmode_box->setCurrentIndex((int)air_startmodes[air_logmachine]); air_startlog_edit->setText(air_startlogs[air_logmachine]); air_autorestart_box->setChecked(air_autorestarts[air_logmachine]); air_skin_edit->setText(air_conf->skinPath()); @@ -1088,7 +1086,7 @@ void EditRDAirPlay::exitPasswordChangedData(const QString &str) void EditRDAirPlay::logActivatedData(int lognum) { air_startmodes[air_logmachine]= - (RDAirPlayConf::StartMode)air_startmode_box->currentItem(); + (RDAirPlayConf::StartMode)air_startmode_box->currentIndex(); air_startlogs[air_logmachine]=air_startlog_edit->text(); air_autorestarts[air_logmachine]=air_autorestart_box->isChecked(); @@ -1097,7 +1095,7 @@ void EditRDAirPlay::logActivatedData(int lognum) air_logmachine=lognum+RD_RDVAIRPLAY_LOG_BASE-3; } - air_startmode_box->setCurrentItem((int)air_startmodes[air_logmachine]); + air_startmode_box->setCurrentIndex((int)air_startmodes[air_logmachine]); air_startlog_edit->setText(air_startlogs[air_logmachine]); air_autorestart_box->setChecked(air_autorestarts[air_logmachine]); startModeChangedData((int)air_startmodes[air_logmachine]); @@ -1126,10 +1124,10 @@ void EditRDAirPlay::virtualLogActivatedData(int vlognum) void EditRDAirPlay::virtualModeActivatedData(int vlognum) { air_virtual_opmodes[air_virtual_logstartmachine]= - (RDAirPlayConf::OpMode)air_virtual_logstartmode_box->currentItem(); + (RDAirPlayConf::OpMode)air_virtual_logstartmode_box->currentIndex(); air_virtual_logstartmachine=vlognum; air_virtual_logstartmode_box-> - setCurrentItem((int)air_virtual_opmodes[air_virtual_logstartmachine]); + setCurrentIndex((int)air_virtual_opmodes[air_virtual_logstartmachine]); } @@ -1187,7 +1185,7 @@ void EditRDAirPlay::modeControlActivatedData(int n) if(n==0) { for(int i=1;i - setCurrentItem(air_logstartmode_box[0]->currentItem()); + setCurrentIndex(air_logstartmode_box[0]->currentIndex()); } } } @@ -1195,9 +1193,9 @@ void EditRDAirPlay::modeControlActivatedData(int n) void EditRDAirPlay::logStartupModeActivatedData(int n) { - if(air_modecontrol_box->currentItem()==0) { + if(air_modecontrol_box->currentIndex()==0) { for(int i=0;isetCurrentItem(n); + air_logstartmode_box[i]->setCurrentIndex(n); } } } @@ -1234,10 +1232,10 @@ void EditRDAirPlay::okData() air_conf->setTransLength(trans); air_conf->setPieCountLength(air_piecount_box->value()*1000); air_conf-> - setPieEndPoint((RDAirPlayConf::PieEndPoint)air_countto_box->currentItem()); + setPieEndPoint((RDAirPlayConf::PieEndPoint)air_countto_box->currentIndex()); air_conf->setDefaultTransType((RDLogLine::TransType) - air_default_transtype_box->currentItem()); - if(air_defaultsvc_box->currentItem()==0) { + air_default_transtype_box->currentIndex()); + if(air_defaultsvc_box->currentIndex()==0) { air_conf->setDefaultSvc(""); } else { @@ -1267,18 +1265,18 @@ void EditRDAirPlay::okData() air_conf->setExitPassword(air_exitpasswd_edit->text()); } air_startmodes[air_logmachine]= - (RDAirPlayConf::StartMode)air_startmode_box->currentItem(); + (RDAirPlayConf::StartMode)air_startmode_box->currentIndex(); air_startlogs[air_logmachine]=air_startlog_edit->text(); air_autorestarts[air_logmachine]=air_autorestart_box->isChecked(); air_conf->setOpModeStyle((RDAirPlayConf::OpModeStyle) - air_modecontrol_box->currentItem()); + air_modecontrol_box->currentIndex()); for(int i=0;isetStartMode(i,air_startmodes[i]); air_conf->setLogName(i,air_startlogs[i]); air_conf->setAutoRestart(i,air_autorestarts[i]); air_conf-> setLogStartMode(i,(RDAirPlayConf::OpMode)air_logstartmode_box[i]-> - currentItem()); + currentIndex()); } virtualLogActivatedData(air_virtual_logmachine); for(int i=0;isetGeometry(sizeHint().width()/5,29,120,117); - QLabel *label=new QLabel(lib_input_card,tr("Input"),this); + QLabel *label=new QLabel(tr("Input"),this); label->setGeometry(sizeHint().width()/5,10,120,19); label->setFont(sectionLabelFont()); label->setAlignment(Qt::AlignCenter|Qt::AlignVCenter); @@ -64,7 +64,7 @@ EditRDLibrary::EditRDLibrary(RDStation *station,RDStation *cae_station, // lib_output_card=new RDCardSelector(this); lib_output_card->setGeometry(4*sizeHint().width()/5-120,29,120,87); - label=new QLabel(lib_output_card,tr("Output"),this); + label=new QLabel(tr("Output"),this); label->setGeometry(4*sizeHint().width()/5-120,10,110,19); label->setFont(sectionLabelFont()); label->setAlignment(Qt::AlignCenter); @@ -75,7 +75,7 @@ EditRDLibrary::EditRDLibrary(RDStation *station,RDStation *cae_station, QLabel *setting_label=new QLabel(tr("Settings"),this); setting_label->setGeometry(25,80,120,19); setting_label->setFont(sectionLabelFont()); - setting_label->setAlignment(Qt::AlignRight|Qt::TextShowMnemonic); + setting_label->setAlignment(Qt::AlignRight); // // Maximum Record Length @@ -83,70 +83,66 @@ EditRDLibrary::EditRDLibrary(RDStation *station,RDStation *cae_station, lib_maxlength_time=new QTimeEdit(this); lib_maxlength_time->setDisplayFormat("hh:mm:ss"); lib_maxlength_time->setGeometry(190,100,85,19); - QLabel *lib_maxlength_label= - new QLabel(lib_maxlength_time,tr("&Max Record Time:"),this); + QLabel *lib_maxlength_label=new QLabel(tr("&Max Record Time:"),this); lib_maxlength_label->setFont(labelFont()); lib_maxlength_label->setGeometry(25,101,160,19); lib_maxlength_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // VOX threshold // lib_vox_spin=new QSpinBox(this); lib_vox_spin->setGeometry(190,122,40,19); - lib_vox_spin->setMinValue(-99); - lib_vox_spin->setMaxValue(0); - QLabel *lib_vox_spin_label= - new QLabel(lib_vox_spin,tr("&VOX Threshold:"),this); + lib_vox_spin->setMinimum(-99); + lib_vox_spin->setMaximum(0); + QLabel *lib_vox_spin_label=new QLabel(tr("&VOX Threshold:"),this); lib_vox_spin_label->setFont(labelFont()); lib_vox_spin_label->setGeometry(25,122,160,19); lib_vox_spin_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); QLabel *lib_vox_spin_unit=new QLabel(tr("dbFS"),this); lib_vox_spin_unit->setFont(labelFont()); lib_vox_spin_unit->setGeometry(235,122,120,19); lib_vox_spin_unit-> - setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // AutoTrim threshold // lib_trim_spin=new QSpinBox(this); lib_trim_spin->setGeometry(190,144,40,19); - lib_trim_spin->setMinValue(-99); - lib_trim_spin->setMaxValue(0); - QLabel *lib_trim_spin_label= - new QLabel(lib_trim_spin,tr("&AutoTrim Threshold:"),this); + lib_trim_spin->setMinimum(-99); + lib_trim_spin->setMaximum(0); + QLabel *lib_trim_spin_label=new QLabel(tr("&AutoTrim Threshold:"),this); lib_trim_spin_label->setFont(labelFont()); lib_trim_spin_label->setGeometry(25,144,160,19); lib_trim_spin_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); QLabel *lib_trim_spin_unit=new QLabel(tr("dbFS"),this); lib_trim_spin_unit->setFont(labelFont()); lib_trim_spin_unit->setGeometry(235,144,120,19); lib_trim_spin_unit-> - setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Tail Preroll // lib_preroll_spin=new QSpinBox(this); lib_preroll_spin->setGeometry(190,166,50,19); - lib_preroll_spin->setMinValue(0); - lib_preroll_spin->setMaxValue(10000); - lib_preroll_spin->setLineStep(100); - QLabel *lib_preroll_spin_label= - new QLabel(lib_preroll_spin,tr("&Tail Preroll:"),this); + lib_preroll_spin->setMinimum(0); + lib_preroll_spin->setMaximum(10000); + lib_preroll_spin->setSingleStep(100); + QLabel *lib_preroll_spin_label=new QLabel(tr("&Tail Preroll:"),this); lib_preroll_spin_label->setFont(labelFont()); lib_preroll_spin_label->setGeometry(25,166,160,19); lib_preroll_spin_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); QLabel *lib_preroll_spin_unit=new QLabel(tr("milliseconds"),this); lib_preroll_spin_unit->setFont(labelFont()); lib_preroll_spin_unit->setGeometry(245,166,120,19); lib_preroll_spin_unit-> - setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Ripper Device @@ -154,36 +150,33 @@ EditRDLibrary::EditRDLibrary(RDStation *station,RDStation *cae_station, lib_ripdev_edit=new QLineEdit(this); lib_ripdev_edit->setGeometry(190,188,100,19); lib_ripdev_edit->setValidator(validator); - QLabel *lib_ripdev_label= - new QLabel(lib_ripdev_edit,tr("&Ripper Device:"),this); + QLabel *lib_ripdev_label=new QLabel(tr("&Ripper Device:"),this); lib_ripdev_label->setFont(labelFont()); lib_ripdev_label->setGeometry(25,188,160,19); lib_ripdev_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Paranoia Level // lib_paranoia_box=new QComboBox(this); lib_paranoia_box->setGeometry(190,210,100,19); - QLabel *lib_paranoia_label= - new QLabel(lib_paranoia_box,tr("&Paranoia Level:"),this); + QLabel *lib_paranoia_label=new QLabel(tr("&Paranoia Level:"),this); lib_paranoia_label->setFont(labelFont()); lib_paranoia_label->setGeometry(25,210,160,19); lib_paranoia_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Read ISRC // lib_isrc_box=new QComboBox(this); lib_isrc_box->setGeometry(190,232,60,19); - QLabel *lib_isrc_label= - new QLabel(lib_isrc_box,tr("&Read ISRCs from CD:"),this); + QLabel *lib_isrc_label=new QLabel(tr("&Read ISRCs from CD:"),this); lib_isrc_label->setFont(labelFont()); lib_isrc_label->setGeometry(25,232,160,19); lib_isrc_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // CD Server Type @@ -198,11 +191,11 @@ EditRDLibrary::EditRDLibrary(RDStation *station,RDStation *cae_station, connect(lib_cd_server_type_box,SIGNAL(activated(int)), this,SLOT(cdServerTypeData(int))); lib_cd_server_label= - new QLabel(lib_cd_server_type_box,tr("&CD Metadata Source:"),this); + new QLabel(tr("&CD Metadata Source:"),this); lib_cd_server_label->setFont(labelFont()); lib_cd_server_label->setGeometry(25,256,160,19); lib_cd_server_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // CD Server @@ -217,7 +210,7 @@ EditRDLibrary::EditRDLibrary(RDStation *station,RDStation *cae_station, lib_cd_server_label->setFont(labelFont()); lib_cd_server_label->setGeometry(25,278,160,19); lib_cd_server_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Format @@ -225,36 +218,35 @@ EditRDLibrary::EditRDLibrary(RDStation *station,RDStation *cae_station, lib_format_box=new QComboBox(this); lib_format_box->setGeometry(190,302,150,19); connect(lib_format_box,SIGNAL(activated(int)),this,SLOT(formatData(int))); - QLabel *lib_format_label=new QLabel(lib_format_box,tr("&Format:"),this); + QLabel *lib_format_label=new QLabel(tr("&Format:"),this); lib_format_label->setFont(labelFont()); lib_format_label->setGeometry(25,302,160,19); lib_format_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Bitrate // lib_bitrate_box=new QComboBox(this); lib_bitrate_box->setGeometry(190,326,130,19); - QLabel *lib_bitrate_label=new QLabel(lib_bitrate_box,tr("&Bitrate:"),this); + QLabel *lib_bitrate_label=new QLabel(tr("&Bitrate:"),this); lib_bitrate_label->setFont(labelFont()); lib_bitrate_label->setGeometry(25,326,160,19); lib_bitrate_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Enable Editor // lib_editor_box=new QComboBox(this); lib_editor_box->setGeometry(190,350,60,19); - lib_editor_box->insertItem(tr("No")); - lib_editor_box->insertItem(tr("Yes")); - QLabel *lib_editor_label= - new QLabel(lib_editor_box,tr("Allow E&xternal Editing:"),this); + lib_editor_box->insertItem(0,tr("No")); + lib_editor_box->insertItem(1,tr("Yes")); + QLabel *lib_editor_label=new QLabel(tr("Allow E&xternal Editing:"),this); lib_editor_label->setFont(labelFont()); lib_editor_label->setGeometry(25,350,160,19); lib_editor_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Sample Rate Converter @@ -263,29 +255,29 @@ EditRDLibrary::EditRDLibrary(RDStation *station,RDStation *cae_station, lib_converter_box->setGeometry(190,374,sizeHint().width()-200,19); int conv=0; while(src_get_name(conv)!=NULL) { - lib_converter_box->insertItem(src_get_name(conv++)); + lib_converter_box-> + insertItem(lib_converter_box->count(),src_get_name(conv++)); } - QLabel *lib_converter_label= - new QLabel(lib_converter_box,tr("Sample Rate Converter:"),this); + QLabel *lib_converter_label=new QLabel(tr("Sample Rate Converter:"),this); lib_converter_label->setFont(labelFont()); lib_converter_label->setGeometry(10,374,175,19); lib_converter_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Limit Searches at Startup // lib_limit_search_box=new QComboBox(this); lib_limit_search_box->setGeometry(190,398,80,19); - lib_limit_search_box->insertItem(tr("No")); - lib_limit_search_box->insertItem(tr("Yes")); - lib_limit_search_box->insertItem(tr("Previous")); + lib_limit_search_box->insertItem(0,tr("No")); + lib_limit_search_box->insertItem(1,tr("Yes")); + lib_limit_search_box->insertItem(2,tr("Previous")); QLabel *lib_limit_search_label= - new QLabel(lib_limit_search_box,tr("Limit Searches at Startup")+":",this); + new QLabel(tr("Limit Searches at Startup")+":",this); lib_limit_search_label->setFont(labelFont()); lib_limit_search_label->setGeometry(10,398,175,19); lib_limit_search_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Defaults @@ -293,60 +285,58 @@ EditRDLibrary::EditRDLibrary(RDStation *station,RDStation *cae_station, QLabel *default_label=new QLabel(tr("Defaults"),this); default_label->setGeometry(25,436,120,19); default_label->setFont(sectionLabelFont()); - default_label->setAlignment(Qt::AlignRight|Qt::TextShowMnemonic); + default_label->setAlignment(Qt::AlignRight); // // Default Channels // lib_channels_box=new QComboBox(this); lib_channels_box->setGeometry(190,454,60,19); - QLabel *lib_channels_label=new QLabel(lib_channels_box,tr("&Channels:"),this); + QLabel *lib_channels_label=new QLabel(tr("&Channels:"),this); lib_channels_label->setFont(labelFont()); lib_channels_label->setGeometry(25,454,160,19); lib_channels_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Default Record Mode // lib_recmode_box=new QComboBox(this); lib_recmode_box->setGeometry(190,478,100,19); - QLabel *lib_recmode_label=new QLabel(lib_recmode_box,tr("Record Mode:"),this); + QLabel *lib_recmode_label=new QLabel(tr("Record Mode:"),this); lib_recmode_label->setFont(labelFont()); lib_recmode_label->setGeometry(25,478,160,19); lib_recmode_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Default Trim State // lib_trimstate_box=new QComboBox(this); lib_trimstate_box->setGeometry(190,502,100,19); - QLabel *lib_trimstate_label= - new QLabel(lib_trimstate_box,tr("AutoTrim:"),this); + QLabel *lib_trimstate_label=new QLabel(tr("AutoTrim:"),this); lib_trimstate_label->setFont(labelFont()); lib_trimstate_label->setGeometry(25,502,160,19); lib_trimstate_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Normalization Level // lib_riplevel_spin=new QSpinBox(this); lib_riplevel_spin->setGeometry(190,526,40,19); - lib_riplevel_spin->setMinValue(-99); - lib_riplevel_spin->setMaxValue(0); - QLabel *lib_riplevel_spin_label= - new QLabel(lib_riplevel_spin,tr("Normalization Level:"),this); + lib_riplevel_spin->setMinimum(-99); + lib_riplevel_spin->setMaximum(0); + QLabel *lib_riplevel_spin_label=new QLabel(tr("Normalization Level:"),this); lib_riplevel_spin_label->setFont(labelFont()); lib_riplevel_spin_label->setGeometry(25,526,160,19); lib_riplevel_spin_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); QLabel *lib_riplevel_spin_unit=new QLabel(tr("dbFS"),this); lib_riplevel_spin_unit->setFont(labelFont()); lib_riplevel_spin_unit->setGeometry(235,526,120,19); lib_riplevel_spin_unit-> - setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Ok Button @@ -394,62 +384,62 @@ EditRDLibrary::EditRDLibrary(RDStation *station,RDStation *cae_station, lib_trim_spin->setValue(lib_lib->trimThreshold()/100); lib_preroll_spin->setValue(lib_lib->tailPreroll()); lib_ripdev_edit->setText(lib_lib->ripperDevice()); - lib_paranoia_box->insertItem(tr("Normal")); - lib_paranoia_box->insertItem(tr("Low")); - lib_paranoia_box->insertItem(tr("None")); - lib_paranoia_box->setCurrentItem(lib_lib->paranoiaLevel()); - lib_isrc_box->insertItem(tr("No")); - lib_isrc_box->insertItem(tr("Yes")); - lib_isrc_box->setCurrentItem(lib_lib->readIsrc()); + lib_paranoia_box->insertItem(0,tr("Normal")); + lib_paranoia_box->insertItem(1,tr("Low")); + lib_paranoia_box->insertItem(2,tr("None")); + lib_paranoia_box->setCurrentIndex(lib_lib->paranoiaLevel()); + lib_isrc_box->insertItem(0,tr("No")); + lib_isrc_box->insertItem(1,tr("Yes")); + lib_isrc_box->setCurrentIndex(lib_lib->readIsrc()); lib_riplevel_spin->setValue(lib_lib->ripperLevel()/100); - lib_channels_box->insertItem("1"); - lib_channels_box->insertItem("2"); - lib_channels_box->setCurrentItem(lib_lib->defaultChannels()-1); - lib_format_box->insertItem(tr("PCM16")); - lib_format_box->insertItem(tr("PCM24")); - lib_format_box->insertItem(tr("MPEG Layer 2")); + lib_channels_box->insertItem(0,"1"); + lib_channels_box->insertItem(1,"2"); + lib_channels_box->setCurrentIndex(lib_lib->defaultChannels()-1); + lib_format_box->insertItem(0,tr("PCM16")); + lib_format_box->insertItem(1,tr("PCM24")); + lib_format_box->insertItem(2,tr("MPEG Layer 2")); switch(lib_lib->defaultFormat()) { case 0: // PCM16 - lib_format_box->setCurrentItem(0); + lib_format_box->setCurrentIndex(0); ShowBitRates(0,lib_lib->defaultBitrate()); break; case 1: // MPEG L2 - lib_format_box->setCurrentItem(2); + lib_format_box->setCurrentIndex(2); ShowBitRates(2,lib_lib->defaultBitrate()); break; case 2: // PCM24 - lib_format_box->setCurrentItem(1); + lib_format_box->setCurrentIndex(1); ShowBitRates(1,lib_lib->defaultBitrate()); break; } - lib_recmode_box->insertItem(tr("Manual")); - lib_recmode_box->insertItem(tr("VOX")); + lib_recmode_box->insertItem(0,tr("Manual")); + lib_recmode_box->insertItem(1,tr("VOX")); switch(lib_lib->defaultRecordMode()) { case RDLibraryConf::Manual: - lib_recmode_box->setCurrentItem(0); + lib_recmode_box->setCurrentIndex(0); break; case RDLibraryConf::Vox: - lib_recmode_box->setCurrentItem(1); + lib_recmode_box->setCurrentIndex(1); break; } - lib_trimstate_box->insertItem("On"); - lib_trimstate_box->insertItem("Off"); + lib_trimstate_box->insertItem(0,"On"); + lib_trimstate_box->insertItem(1,"Off"); if(lib_lib->defaultTrimState()) { - lib_trimstate_box->setCurrentItem(0); + lib_trimstate_box->setCurrentIndex(0); } else { - lib_trimstate_box->setCurrentItem(1); + lib_trimstate_box->setCurrentIndex(1); } lib_cd_server_type_box->setCurrentIndex((int)lib_lib->cdServerType()); lib_cddb_server_edit->setText(lib_lib->cddbServer()); lib_mb_server_edit->setText(lib_lib->mbServer()); cdServerTypeData(lib_cd_server_type_box->currentIndex()); - lib_editor_box->setCurrentItem(lib_lib->enableEditor()); - lib_converter_box->setCurrentItem(lib_lib->srcConverter()); - lib_limit_search_box->setCurrentItem((int)lib_lib->limitSearch()); + lib_editor_box->setCurrentIndex(lib_lib->enableEditor()); + lib_converter_box->setCurrentIndex(lib_lib->srcConverter()); + lib_limit_search_box->setCurrentIndex((int)lib_lib->limitSearch()); } @@ -526,10 +516,10 @@ void EditRDLibrary::okData() lib_lib->setTrimThreshold(100*lib_trim_spin->value()); lib_lib->setTailPreroll(lib_preroll_spin->value()); lib_lib->setRipperDevice(lib_ripdev_edit->text()); - lib_lib->setParanoiaLevel(lib_paranoia_box->currentItem()); - lib_lib->setReadIsrc(lib_isrc_box->currentItem()); + lib_lib->setParanoiaLevel(lib_paranoia_box->currentIndex()); + lib_lib->setReadIsrc(lib_isrc_box->currentIndex()); lib_lib->setRipperLevel(lib_riplevel_spin->value()*100); - switch(lib_format_box->currentItem()) { + switch(lib_format_box->currentIndex()) { case 0: // PCM16 lib_lib->setDefaultFormat(0); break; @@ -542,13 +532,13 @@ void EditRDLibrary::okData() lib_lib->setDefaultFormat(1); break; } - lib_lib->setDefaultChannels(lib_channels_box->currentItem()+1); + lib_lib->setDefaultChannels(lib_channels_box->currentIndex()+1); rate=0; - if(lib_format_box->currentItem()==2) { - sscanf(lib_bitrate_box->currentText(),"%d",&rate); + if(lib_format_box->currentIndex()==2) { + rate=lib_bitrate_box->currentText().toInt(); } lib_lib->setDefaultBitrate(rate*1000); - switch(lib_recmode_box->currentItem()) { + switch(lib_recmode_box->currentIndex()) { case 0: lib_lib->setDefaultRecordMode(RDLibraryConf::Manual); break; @@ -557,7 +547,7 @@ void EditRDLibrary::okData() lib_lib->setDefaultRecordMode(RDLibraryConf::Vox); break; } - switch(lib_trimstate_box->currentItem()) { + switch(lib_trimstate_box->currentIndex()) { case 0: lib_lib->setDefaultTrimState(true); break; @@ -570,10 +560,10 @@ void EditRDLibrary::okData() currentIndex()); lib_lib->setCddbServer(lib_cddb_server_edit->text()); lib_lib->setMbServer(lib_mb_server_edit->text()); - lib_lib->setEnableEditor(lib_editor_box->currentItem()); - lib_lib->setSrcConverter(lib_converter_box->currentItem()); + lib_lib->setEnableEditor(lib_editor_box->currentIndex()); + lib_lib->setSrcConverter(lib_converter_box->currentIndex()); lib_lib->setLimitSearch((RDLibraryConf::SearchLimit) - lib_limit_search_box->currentItem()); + lib_limit_search_box->currentIndex()); done(0); } @@ -595,59 +585,59 @@ void EditRDLibrary::ShowBitRates(int layer,int rate) case 2: // MPEG-1 Layer 2 lib_bitrate_box->setEnabled(true); - lib_bitrate_box->insertItem(tr("32 kbps/chan")); - lib_bitrate_box->insertItem(tr("48 kbps/chan")); - lib_bitrate_box->insertItem(tr("56 kbps/chan")); - lib_bitrate_box->insertItem(tr("64 kbps/chan")); - lib_bitrate_box->insertItem(tr("80 kbps/chan")); - lib_bitrate_box->insertItem(tr("96 kbps/chan")); - lib_bitrate_box->insertItem(tr("112 kbps/chan")); - lib_bitrate_box->insertItem(tr("128 kbps/chan")); - lib_bitrate_box->insertItem(tr("160 kbps/chan")); - lib_bitrate_box->insertItem(tr("192 kbps/chan")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("32 kbps/chan")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("48 kbps/chan")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("56 kbps/chan")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("64 kbps/chan")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("80 kbps/chan")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("96 kbps/chan")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("112 kbps/chan")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("128 kbps/chan")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("160 kbps/chan")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("192 kbps/chan")); switch(lib_lib->defaultBitrate()) { case 32000: - lib_bitrate_box->setCurrentItem(0); + lib_bitrate_box->setCurrentIndex(0); break; case 48000: - lib_bitrate_box->setCurrentItem(1); + lib_bitrate_box->setCurrentIndex(1); break; case 56000: - lib_bitrate_box->setCurrentItem(2); + lib_bitrate_box->setCurrentIndex(2); break; case 64000: - lib_bitrate_box->setCurrentItem(3); + lib_bitrate_box->setCurrentIndex(3); break; case 80000: - lib_bitrate_box->setCurrentItem(4); + lib_bitrate_box->setCurrentIndex(4); break; case 96000: - lib_bitrate_box->setCurrentItem(5); + lib_bitrate_box->setCurrentIndex(5); break; case 112000: - lib_bitrate_box->setCurrentItem(6); + lib_bitrate_box->setCurrentIndex(6); break; case 128000: - lib_bitrate_box->setCurrentItem(7); + lib_bitrate_box->setCurrentIndex(7); break; case 160000: - lib_bitrate_box->setCurrentItem(8); + lib_bitrate_box->setCurrentIndex(8); break; case 192000: - lib_bitrate_box->setCurrentItem(9); + lib_bitrate_box->setCurrentIndex(9); break; default: - lib_bitrate_box->setCurrentItem(7); // 128 kbps/chan + lib_bitrate_box->setCurrentIndex(7); // 128 kbps/chan break; } break; diff --git a/rdadmin/edit_rdlogedit.cpp b/rdadmin/edit_rdlogedit.cpp index 8957204e..c5c433e2 100644 --- a/rdadmin/edit_rdlogedit.cpp +++ b/rdadmin/edit_rdlogedit.cpp @@ -2,7 +2,7 @@ // // Edit an RDLogedit Configuration // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,8 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include +#include #include #include @@ -55,7 +54,7 @@ EditRDLogedit::EditRDLogedit(RDStation *station,RDStation *cae_station, // lib_input_card=new RDCardSelector(this); lib_input_card->setGeometry(sizeHint().width()/5,29,120,117); - QLabel *label=new QLabel(lib_input_card,tr("Input"),this); + QLabel *label=new QLabel(tr("Input"),this); label->setGeometry(sizeHint().width()/5,10,120,19); label->setFont(sectionLabelFont()); label->setAlignment(Qt::AlignCenter|Qt::AlignVCenter); @@ -65,7 +64,7 @@ EditRDLogedit::EditRDLogedit(RDStation *station,RDStation *cae_station, // lib_output_card=new RDCardSelector(this); lib_output_card->setGeometry(4*sizeHint().width()/5-120,29,120,87); - label=new QLabel(lib_output_card,tr("Output"),this); + label=new QLabel(tr("Output"),this); label->setGeometry(4*sizeHint().width()/5-120,10,120,19); label->setFont(sectionLabelFont()); label->setAlignment(Qt::AlignCenter); @@ -85,7 +84,7 @@ EditRDLogedit::EditRDLogedit(RDStation *station,RDStation *cae_station, lib_maxlength_time->setDisplayFormat("hh:mm:ss"); lib_maxlength_time->setGeometry(180,100,85,19); QLabel *lib_maxlength_label= - new QLabel(lib_maxlength_time,tr("&Max Record Time:"),this); + new QLabel(tr("&Max Record Time:"),this); lib_maxlength_label->setFont(labelFont()); lib_maxlength_label->setGeometry(25,101,150,19); lib_maxlength_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -95,9 +94,9 @@ EditRDLogedit::EditRDLogedit(RDStation *station,RDStation *cae_station, // lib_threshold_spin=new QSpinBox(this); lib_threshold_spin->setGeometry(180,124,50,19); - lib_threshold_spin->setMinValue(-99); - lib_threshold_spin->setMaxValue(0); - label=new QLabel(lib_threshold_spin,tr("&AutoTrim Threshold:"),this); + lib_threshold_spin->setMinimum(-99); + lib_threshold_spin->setMaximum(0); + label=new QLabel(tr("&AutoTrim Threshold:"),this); label->setFont(labelFont()); label->setGeometry(25,124,150,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -111,9 +110,9 @@ EditRDLogedit::EditRDLogedit(RDStation *station,RDStation *cae_station, // lib_normalization_spin=new QSpinBox(this); lib_normalization_spin->setGeometry(180,148,50,19); - lib_normalization_spin->setMinValue(-99); - lib_normalization_spin->setMaxValue(0); - label=new QLabel(lib_normalization_spin,tr("&Normalization Level:"),this); + lib_normalization_spin->setMinimum(-99); + lib_normalization_spin->setMaximum(0); + label=new QLabel(tr("&Normalization Level:"),this); label->setFont(labelFont()); label->setGeometry(25,148,150,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -127,11 +126,10 @@ EditRDLogedit::EditRDLogedit(RDStation *station,RDStation *cae_station, // lib_preroll_spin=new QSpinBox(this); lib_preroll_spin->setGeometry(180,172,60,19); - lib_preroll_spin->setMinValue(0); - lib_preroll_spin->setMaxValue(10000); - lib_preroll_spin->setLineStep(100); - QLabel *lib_preroll_spin_label= - new QLabel(lib_preroll_spin,tr("&Audio Margin:"),this); + lib_preroll_spin->setMinimum(0); + lib_preroll_spin->setMaximum(10000); + lib_preroll_spin->setSingleStep(100); + QLabel *lib_preroll_spin_label=new QLabel(tr("&Audio Margin:"),this); lib_preroll_spin_label->setFont(labelFont()); lib_preroll_spin_label->setGeometry(25,172,150,19); lib_preroll_spin_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -146,7 +144,7 @@ EditRDLogedit::EditRDLogedit(RDStation *station,RDStation *cae_station, lib_format_box=new QComboBox(this); lib_format_box->setGeometry(180,196,150,19); connect(lib_format_box,SIGNAL(activated(int)),this,SLOT(formatData(int))); - QLabel *lib_format_label=new QLabel(lib_format_box,tr("&Format:"),this); + QLabel *lib_format_label=new QLabel(tr("&Format:"),this); lib_format_label->setFont(labelFont()); lib_format_label->setGeometry(25,196,150,19); lib_format_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -156,7 +154,7 @@ EditRDLogedit::EditRDLogedit(RDStation *station,RDStation *cae_station, // lib_bitrate_box=new QComboBox(this); lib_bitrate_box->setGeometry(180,220,130,19); - QLabel *lib_bitrate_label=new QLabel(lib_bitrate_box,tr("&Bitrate:"),this); + QLabel *lib_bitrate_label=new QLabel(tr("&Bitrate:"),this); lib_bitrate_label->setFont(labelFont()); lib_bitrate_label->setGeometry(25,220,150,19); lib_bitrate_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -166,14 +164,13 @@ EditRDLogedit::EditRDLogedit(RDStation *station,RDStation *cae_station, // lib_enable_second_start_box=new QComboBox(this); lib_enable_second_start_box->setGeometry(180,244,60,19); - lib_enable_second_start_box->insertItem(tr("No")); - lib_enable_second_start_box->insertItem(tr("Yes")); + lib_enable_second_start_box->insertItem(0,tr("No")); + lib_enable_second_start_box->insertItem(1,tr("Yes")); QLabel *lib_enable_second_start_label= - new QLabel(lib_enable_second_start_box,tr("Enable &2nd Start Button:"),this); + new QLabel(tr("Enable &2nd Start Button:"),this); lib_enable_second_start_label->setFont(labelFont()); lib_enable_second_start_label->setGeometry(10,244,165,19); - lib_enable_second_start_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter); + lib_enable_second_start_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Validator @@ -186,8 +183,7 @@ EditRDLogedit::EditRDLogedit(RDStation *station,RDStation *cae_station, // lib_waveform_caption_edit=new QLineEdit(this); lib_waveform_caption_edit->setGeometry(180,268,sizeHint().width()-190,19); - QLabel *lib_waveform_caption_label= - new QLabel(lib_waveform_caption_edit,tr("WaveForm Caption:"),this); + QLabel *lib_waveform_caption_label=new QLabel(tr("WaveForm Caption:"),this); lib_waveform_caption_label->setFont(labelFont()); lib_waveform_caption_label->setGeometry(25,268,150,19); lib_waveform_caption_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -198,8 +194,7 @@ EditRDLogedit::EditRDLogedit(RDStation *station,RDStation *cae_station, lib_startcart_edit=new QLineEdit(this); lib_startcart_edit->setGeometry(180,290,70,19); lib_startcart_edit->setValidator(validator); - QLabel *lib_startcart_label= - new QLabel(lib_startcart_edit,tr("Play &Start Cart:"),this); + QLabel *lib_startcart_label=new QLabel(tr("Play &Start Cart:"),this); lib_startcart_label->setFont(labelFont()); lib_startcart_label->setGeometry(25,290,150,19); lib_startcart_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -215,8 +210,7 @@ EditRDLogedit::EditRDLogedit(RDStation *station,RDStation *cae_station, lib_endcart_edit=new QLineEdit(this); lib_endcart_edit->setGeometry(180,314,70,19); lib_endcart_edit->setValidator(validator); - QLabel *lib_endcart_label= - new QLabel(lib_endcart_edit,tr("Play &End Cart:"),this); + QLabel *lib_endcart_label=new QLabel(tr("Play &End Cart:"),this); lib_endcart_label->setFont(labelFont()); lib_endcart_label->setGeometry(25,314,150,19); lib_endcart_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -232,8 +226,7 @@ EditRDLogedit::EditRDLogedit(RDStation *station,RDStation *cae_station, lib_recstartcart_edit=new QLineEdit(this); lib_recstartcart_edit->setGeometry(180,338,70,19); lib_recstartcart_edit->setValidator(validator); - QLabel *lib_recstartcart_label= - new QLabel(lib_recstartcart_edit,tr("&Record Start Cart:"),this); + QLabel *lib_recstartcart_label=new QLabel(tr("&Record Start Cart:"),this); lib_recstartcart_label->setFont(labelFont()); lib_recstartcart_label->setGeometry(25,338,150,19); lib_recstartcart_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -249,8 +242,7 @@ EditRDLogedit::EditRDLogedit(RDStation *station,RDStation *cae_station, lib_recendcart_edit=new QLineEdit(this); lib_recendcart_edit->setGeometry(180,362,70,19); lib_recendcart_edit->setValidator(validator); - QLabel *lib_recendcart_label= - new QLabel(lib_recendcart_edit,tr("Re&cord End Cart:"),this); + QLabel *lib_recendcart_label=new QLabel(tr("Re&cord End Cart:"),this); lib_recendcart_label->setFont(labelFont()); lib_recendcart_label->setGeometry(25,362,150,19); lib_recendcart_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -265,7 +257,7 @@ EditRDLogedit::EditRDLogedit(RDStation *station,RDStation *cae_station, // lib_channels_box=new QComboBox(this); lib_channels_box->setGeometry(180,386,60,19); - QLabel *lib_channels_label=new QLabel(lib_channels_box,tr("&Channels:"),this); + QLabel *lib_channels_label=new QLabel(tr("&Channels:"),this); lib_channels_label->setFont(labelFont()); lib_channels_label->setGeometry(25,386,150,19); lib_channels_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -276,14 +268,14 @@ EditRDLogedit::EditRDLogedit(RDStation *station,RDStation *cae_station, lib_default_transtype_box=new QComboBox(this); lib_default_transtype_box->setGeometry(180,410,100,19); QLabel *lib_default_transtype_label= - new QLabel(lib_default_transtype_box,tr("Default Transition:"),this); + new QLabel(tr("Default Transition:"),this); lib_default_transtype_label->setFont(labelFont()); lib_default_transtype_label->setGeometry(25,410,150,19); lib_default_transtype_label-> setAlignment(Qt::AlignRight|Qt::AlignVCenter); - lib_default_transtype_box->insertItem(tr("Play")); - lib_default_transtype_box->insertItem(tr("Segue")); - lib_default_transtype_box->insertItem(tr("Stop")); + lib_default_transtype_box->insertItem(0,tr("Play")); + lib_default_transtype_box->insertItem(1,tr("Segue")); + lib_default_transtype_box->insertItem(2,tr("Stop")); // // Ok Button @@ -345,29 +337,29 @@ EditRDLogedit::EditRDLogedit(RDStation *station,RDStation *cae_station, lib_recendcart_edit->setText(QString().sprintf("%06u",cart)); } lib_preroll_spin->setValue(lib_lib->tailPreroll()); - lib_format_box->insertItem(tr("PCM16")); - lib_format_box->insertItem(tr("PCM24")); - lib_format_box->insertItem(tr("MPEG Layer 2")); + lib_format_box->insertItem(0,tr("PCM16")); + lib_format_box->insertItem(1,tr("PCM24")); + lib_format_box->insertItem(2,tr("MPEG Layer 2")); switch(lib_lib->format()) { case 0: // PCM16 - lib_format_box->setCurrentItem(0); + lib_format_box->setCurrentIndex(0); break; case 1: // MPEG L2 - lib_format_box->setCurrentItem(2); + lib_format_box->setCurrentIndex(2); break; case 2: // PCM24 - lib_format_box->setCurrentItem(1); + lib_format_box->setCurrentIndex(1); break; } - lib_channels_box->insertItem("1"); - lib_channels_box->insertItem("2"); - lib_channels_box->setCurrentItem(lib_lib->defaultChannels()-1); - ShowBitRates(lib_format_box->currentItem(),lib_lib->bitrate()); - lib_enable_second_start_box->setCurrentItem(lib_lib->enableSecondStart()); - lib_default_transtype_box->setCurrentItem(lib_lib->defaultTransType()); + lib_channels_box->insertItem(0,"1"); + lib_channels_box->insertItem(1,"2"); + lib_channels_box->setCurrentIndex(lib_lib->defaultChannels()-1); + ShowBitRates(lib_format_box->currentIndex(),lib_lib->bitrate()); + lib_enable_second_start_box->setCurrentIndex(lib_lib->enableSecondStart()); + lib_default_transtype_box->setCurrentIndex(lib_lib->defaultTransType()); } @@ -474,7 +466,7 @@ void EditRDLogedit::okData() else { lib_lib->setRecEndCart(lib_recendcart_edit->text().toUInt()); } - switch(lib_format_box->currentItem()) { + switch(lib_format_box->currentIndex()) { case 0: // PCM16 lib_lib->setFormat(0); break; @@ -487,15 +479,15 @@ void EditRDLogedit::okData() lib_lib->setFormat(1); break; } - lib_lib->setDefaultChannels(lib_channels_box->currentItem()+1); + lib_lib->setDefaultChannels(lib_channels_box->currentIndex()+1); rate=0; - if(lib_format_box->currentItem()==2) { - sscanf(lib_bitrate_box->currentText(),"%d",&rate); + if(lib_format_box->currentIndex()==2) { + rate=lib_bitrate_box->currentText().toInt(); } lib_lib->setBitrate(rate*1000); - lib_lib->setEnableSecondStart(lib_enable_second_start_box->currentItem()); + lib_lib->setEnableSecondStart(lib_enable_second_start_box->currentIndex()); lib_lib->setDefaultTransType( - (RDLogLine::TransType)lib_default_transtype_box->currentItem()); + (RDLogLine::TransType)lib_default_transtype_box->currentIndex()); done(0); } @@ -517,59 +509,59 @@ void EditRDLogedit::ShowBitRates(int index,int rate) case 2: // MPEG-1 Layer 2 lib_bitrate_box->setEnabled(true); - lib_bitrate_box->insertItem(tr("32 kbps/chan")); - lib_bitrate_box->insertItem(tr("48 kbps/chan")); - lib_bitrate_box->insertItem(tr("56 kbps/chan")); - lib_bitrate_box->insertItem(tr("64 kbps/chan")); - lib_bitrate_box->insertItem(tr("80 kbps/chan")); - lib_bitrate_box->insertItem(tr("96 kbps/chan")); - lib_bitrate_box->insertItem(tr("112 kbps/chan")); - lib_bitrate_box->insertItem(tr("128 kbps/chan")); - lib_bitrate_box->insertItem(tr("160 kbps/chan")); - lib_bitrate_box->insertItem(tr("192 kbps/chan")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("32 kbps/chan")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("48 kbps/chan")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("56 kbps/chan")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("64 kbps/chan")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("80 kbps/chan")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("96 kbps/chan")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("112 kbps/chan")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("128 kbps/chan")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("160 kbps/chan")); + lib_bitrate_box->insertItem(lib_bitrate_box->count(),tr("192 kbps/chan")); switch(lib_lib->bitrate()) { case 32000: - lib_bitrate_box->setCurrentItem(0); + lib_bitrate_box->setCurrentIndex(0); break; case 48000: - lib_bitrate_box->setCurrentItem(1); + lib_bitrate_box->setCurrentIndex(1); break; case 56000: - lib_bitrate_box->setCurrentItem(2); + lib_bitrate_box->setCurrentIndex(2); break; case 64000: - lib_bitrate_box->setCurrentItem(3); + lib_bitrate_box->setCurrentIndex(3); break; case 80000: - lib_bitrate_box->setCurrentItem(4); + lib_bitrate_box->setCurrentIndex(4); break; case 96000: - lib_bitrate_box->setCurrentItem(5); + lib_bitrate_box->setCurrentIndex(5); break; case 112000: - lib_bitrate_box->setCurrentItem(6); + lib_bitrate_box->setCurrentIndex(6); break; case 128000: - lib_bitrate_box->setCurrentItem(7); + lib_bitrate_box->setCurrentIndex(7); break; case 160000: - lib_bitrate_box->setCurrentItem(8); + lib_bitrate_box->setCurrentIndex(8); break; case 192000: - lib_bitrate_box->setCurrentItem(9); + lib_bitrate_box->setCurrentIndex(9); break; default: - lib_bitrate_box->setCurrentItem(7); // 128 kbps/chan + lib_bitrate_box->setCurrentIndex(7); // 128 kbps/chan break; } break; diff --git a/rdadmin/edit_rdpanel.cpp b/rdadmin/edit_rdpanel.cpp index ab774cf0..c1848a73 100644 --- a/rdadmin/edit_rdpanel.cpp +++ b/rdadmin/edit_rdpanel.cpp @@ -74,14 +74,14 @@ EditRDPanel::EditRDPanel(RDStation *station,RDStation *cae_station, air_start_rml_edit[0]=new QLineEdit(this); air_start_rml_edit[0]->setGeometry(205,50,160,19); air_start_rml_edit[0]->setValidator(validator); - label=new QLabel(air_start_rml_edit[0],tr("Start RML:"),this); + label=new QLabel(tr("Start RML:"),this); label->setFont(subLabelFont()); label->setGeometry(135,50,65,19); label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); air_stop_rml_edit[0]=new QLineEdit(this); air_stop_rml_edit[0]->setGeometry(205,71,160,19); air_stop_rml_edit[0]->setValidator(validator); - label=new QLabel(air_start_rml_edit[0],tr("Stop RML:"),this); + label=new QLabel(tr("Stop RML:"),this); label->setFont(subLabelFont()); label->setGeometry(135,71,65,19); label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -97,14 +97,14 @@ EditRDPanel::EditRDPanel(RDStation *station,RDStation *cae_station, air_start_rml_edit[1]=new QLineEdit(this); air_start_rml_edit[1]->setGeometry(205,118,160,19); air_start_rml_edit[1]->setValidator(validator); - label=new QLabel(air_start_rml_edit[1],tr("Start RML:"),this); + label=new QLabel(tr("Start RML:"),this); label->setFont(subLabelFont()); label->setGeometry(135,118,65,19); label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); air_stop_rml_edit[1]=new QLineEdit(this); air_stop_rml_edit[1]->setGeometry(205,139,160,19); air_stop_rml_edit[1]->setValidator(validator); - label=new QLabel(air_start_rml_edit[1],tr("Stop RML:"),this); + label=new QLabel(tr("Stop RML:"),this); label->setFont(subLabelFont()); label->setGeometry(135,139,65,19); label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -120,14 +120,14 @@ EditRDPanel::EditRDPanel(RDStation *station,RDStation *cae_station, air_start_rml_edit[2]=new QLineEdit(this); air_start_rml_edit[2]->setGeometry(205,186,160,19); air_start_rml_edit[2]->setValidator(validator); - label=new QLabel(air_start_rml_edit[2],tr("Start RML:"),this); + label=new QLabel(tr("Start RML:"),this); label->setFont(subLabelFont()); label->setGeometry(135,186,65,19); label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); air_stop_rml_edit[2]=new QLineEdit(this); air_stop_rml_edit[2]->setGeometry(205,207,160,19); air_stop_rml_edit[2]->setValidator(validator); - label=new QLabel(air_start_rml_edit[2],tr("Stop RML:"),this); + label=new QLabel(tr("Stop RML:"),this); label->setFont(subLabelFont()); label->setGeometry(135,207,65,19); label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -143,14 +143,14 @@ EditRDPanel::EditRDPanel(RDStation *station,RDStation *cae_station, air_start_rml_edit[3]=new QLineEdit(this); air_start_rml_edit[3]->setGeometry(205,254,160,19); air_start_rml_edit[3]->setValidator(validator); - label=new QLabel(air_start_rml_edit[3],tr("Start RML:"),this); + label=new QLabel(tr("Start RML:"),this); label->setFont(subLabelFont()); label->setGeometry(135,254,65,19); label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); air_stop_rml_edit[3]=new QLineEdit(this); air_stop_rml_edit[3]->setGeometry(205,275,160,19); air_stop_rml_edit[3]->setValidator(validator); - label=new QLabel(air_start_rml_edit[3],tr("Stop RML:"),this); + label=new QLabel(tr("Stop RML:"),this); label->setFont(subLabelFont()); label->setGeometry(135,275,65,19); label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -166,14 +166,14 @@ EditRDPanel::EditRDPanel(RDStation *station,RDStation *cae_station, air_start_rml_edit[4]=new QLineEdit(this); air_start_rml_edit[4]->setGeometry(205,322,160,19); air_start_rml_edit[4]->setValidator(validator); - label=new QLabel(air_start_rml_edit[4],tr("Start RML:"),this); + label=new QLabel(tr("Start RML:"),this); label->setFont(subLabelFont()); label->setGeometry(135,322,65,19); label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); air_stop_rml_edit[4]=new QLineEdit(this); air_stop_rml_edit[4]->setGeometry(205,343,160,19); air_stop_rml_edit[4]->setValidator(validator); - label=new QLabel(air_start_rml_edit[4],tr("Stop RML:"),this); + label=new QLabel(tr("Stop RML:"),this); label->setFont(subLabelFont()); label->setGeometry(135,343,65,19); label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -189,14 +189,14 @@ EditRDPanel::EditRDPanel(RDStation *station,RDStation *cae_station, air_start_rml_edit[5]=new QLineEdit(this); air_start_rml_edit[5]->setGeometry(205,390,160,19); air_start_rml_edit[5]->setValidator(validator); - label=new QLabel(air_start_rml_edit[5],tr("Start RML:"),this); + label=new QLabel(tr("Start RML:"),this); label->setFont(subLabelFont()); label->setGeometry(135,390,65,19); label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); air_stop_rml_edit[5]=new QLineEdit(this); air_stop_rml_edit[5]->setGeometry(205,411,160,19); air_stop_rml_edit[5]->setValidator(validator); - label=new QLabel(air_start_rml_edit[5],tr("Stop RML:"),this); + label=new QLabel(tr("Stop RML:"),this); label->setFont(subLabelFont()); label->setGeometry(135,411,65,19); label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -213,7 +213,7 @@ EditRDPanel::EditRDPanel(RDStation *station,RDStation *cae_station, // air_skin_edit=new QLineEdit(this); air_skin_edit->setGeometry(135,460,180,20); - label=new QLabel(air_skin_edit,tr("Background Image:"),this); + label=new QLabel(tr("Background Image:"),this); label->setFont(subLabelFont()); label->setGeometry(10,460,115,20); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -235,7 +235,7 @@ EditRDPanel::EditRDPanel(RDStation *station,RDStation *cae_station, air_station_box->setGeometry(510,35,50,20); air_station_box->setRange(0,MAX_PANELS); air_station_box->setSpecialValueText(tr("None")); - air_station_label=new QLabel(air_station_box,tr("Host Panels:"),this); + air_station_label=new QLabel(tr("Host Panels:"),this); air_station_label->setFont(subLabelFont()); air_station_label->setGeometry(405,35,100,20); air_station_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -247,7 +247,7 @@ EditRDPanel::EditRDPanel(RDStation *station,RDStation *cae_station, air_user_box->setGeometry(510,57,50,20); air_user_box->setRange(0,MAX_PANELS); air_user_box->setSpecialValueText(tr("None")); - air_user_label=new QLabel(air_user_box,tr("User Panels:"),this); + air_user_label=new QLabel(tr("User Panels:"),this); air_user_label->setFont(subLabelFont()); air_user_label->setGeometry(405,57,100,20); air_user_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -257,7 +257,7 @@ EditRDPanel::EditRDPanel(RDStation *station,RDStation *cae_station, // air_flash_box=new QCheckBox(this); air_flash_box->setGeometry(435,85,15,15); - label=new QLabel(air_flash_box,tr("Flash Active Buttons"),this); + label=new QLabel(tr("Flash Active Buttons"),this); label->setFont(subLabelFont()); label->setGeometry(455,85,150,15); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -267,7 +267,7 @@ EditRDPanel::EditRDPanel(RDStation *station,RDStation *cae_station, // air_panel_pause_box=new QCheckBox(this); air_panel_pause_box->setGeometry(435,107,15,15); - label=new QLabel(air_panel_pause_box,tr("Enable Button Pausing"),this); + label=new QLabel(tr("Enable Button Pausing"),this); label->setFont(subLabelFont()); label->setGeometry(455,107,150,15); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -277,7 +277,7 @@ EditRDPanel::EditRDPanel(RDStation *station,RDStation *cae_station, // air_clearfilter_box=new QCheckBox(this); air_clearfilter_box->setGeometry(435,129,15,15); - label=new QLabel(air_clearfilter_box,tr("Clear Cart Search Filter"),this); + label=new QLabel(tr("Clear Cart Search Filter"),this); label->setFont(subLabelFont()); label->setGeometry(455,129,150,15); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -285,10 +285,10 @@ EditRDPanel::EditRDPanel(RDStation *station,RDStation *cae_station, // // Default Service // - air_defaultsvc_box=new QComboBox(this); + air_defaultsvc_box=new RDComboBox(this); air_defaultsvc_box->setGeometry(520,151,100,20); air_defaultsvc_box->setModel(air_service_model); - label=new QLabel(air_defaultsvc_box,tr("Default Service:"),this); + label=new QLabel(tr("Default Service:"),this); label->setFont(subLabelFont()); label->setGeometry(385,151,130,20); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -298,7 +298,7 @@ EditRDPanel::EditRDPanel(RDStation *station,RDStation *cae_station, // air_label_template_edit=new QLineEdit(this); air_label_template_edit->setGeometry(520,173,sizeHint().width()-530,20); - label=new QLabel(air_label_template_edit,tr("Label Template:"),this); + label=new QLabel(tr("Label Template:"),this); label->setFont(subLabelFont()); label->setGeometry(415,173,100,20); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -468,7 +468,7 @@ void EditRDPanel::okData() air_conf->setCard(RDAirPlayConf::CueChannel,air_card_sel[5]->card()); air_conf->setPort(RDAirPlayConf::CueChannel,air_card_sel[5]->port()); air_conf->setSkinPath(air_skin_edit->text()); - if(air_defaultsvc_box->currentItem()==0) { + if(air_defaultsvc_box->currentIndex()==0) { air_conf->setDefaultSvc(""); } else { diff --git a/rdadmin/edit_rdpanel.h b/rdadmin/edit_rdpanel.h index 989106e6..be9deb98 100644 --- a/rdadmin/edit_rdpanel.h +++ b/rdadmin/edit_rdpanel.h @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -67,7 +68,7 @@ class EditRDPanel : public RDDialog QCheckBox *air_flash_box; QCheckBox *air_panel_pause_box; QLineEdit *air_label_template_edit; - QComboBox *air_defaultsvc_box; + RDComboBox *air_defaultsvc_box; QLineEdit *air_skin_edit; RDServiceListModel *air_service_model; }; diff --git a/rdadmin/edit_replicator.cpp b/rdadmin/edit_replicator.cpp index 13429dd3..79ce33f4 100644 --- a/rdadmin/edit_replicator.cpp +++ b/rdadmin/edit_replicator.cpp @@ -53,7 +53,7 @@ EditReplicator::EditReplicator(const QString &repl_name,QWidget *parent) repl_name_edit->setGeometry(105,11,sizeHint().width()-115,19); repl_name_edit->setMaxLength(32); repl_name_edit->setReadOnly(true); - QLabel *repl_name_label=new QLabel(repl_name_edit,tr("Name:"),this); + QLabel *repl_name_label=new QLabel(tr("Name:"),this); repl_name_label->setFont(labelFont()); repl_name_label->setGeometry(10,11,90,19); repl_name_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -64,8 +64,7 @@ EditReplicator::EditReplicator(const QString &repl_name,QWidget *parent) repl_description_edit=new QLineEdit(this); repl_description_edit->setGeometry(105,33,sizeHint().width()-115,19); repl_description_edit->setMaxLength(64); - QLabel *repl_description_label= - new QLabel(repl_description_edit,tr("Description:"),this); + QLabel *repl_description_label=new QLabel(tr("Description:"),this); repl_description_label->setFont(labelFont()); repl_description_label->setGeometry(10,33,90,19); repl_description_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -76,12 +75,13 @@ EditReplicator::EditReplicator(const QString &repl_name,QWidget *parent) repl_type_box=new QComboBox(this); repl_type_box->setGeometry(105,55,sizeHint().width()-115,19); for(unsigned i=0;i<(int)RDReplicator::TypeLast;i++) { - repl_type_box->insertItem(RDReplicator::typeString((RDReplicator::Type)i)); + repl_type_box->insertItem(repl_type_box->count(), + RDReplicator::typeString((RDReplicator::Type)i)); if(repl_replicator->type()==(RDReplicator::Type)i) { - repl_type_box->setCurrentItem(i); + repl_type_box->setCurrentIndex(i); } } - QLabel *repl_type_label=new QLabel(repl_type_box,tr("Type:"),this); + QLabel *repl_type_label=new QLabel(tr("Type:"),this); repl_type_label->setFont(labelFont()); repl_type_label->setGeometry(10,55,90,19); repl_type_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -94,14 +94,14 @@ EditReplicator::EditReplicator(const QString &repl_name,QWidget *parent) sql="select NAME from STATIONS order by NAME"; q=new RDSqlQuery(sql); while(q->next()) { - repl_station_box->insertItem(q->value(0).toString()); + repl_station_box->insertItem(repl_station_box->count(), + q->value(0).toString()); if(repl_replicator->stationName()==q->value(0).toString()) { - repl_station_box->setCurrentItem(repl_station_box->count()-1); + repl_station_box->setCurrentIndex(repl_station_box->count()-1); } } delete q; - QLabel *repl_station_label= - new QLabel(repl_station_box,tr("Host System:"),this); + QLabel *repl_station_label=new QLabel(tr("Host System:"),this); repl_station_label->setFont(labelFont()); repl_station_label->setGeometry(10,77,140,19); repl_station_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -112,7 +112,7 @@ EditReplicator::EditReplicator(const QString &repl_name,QWidget *parent) repl_url_edit=new QLineEdit(this); repl_url_edit->setGeometry(155,99,335,19); repl_url_edit->setMaxLength(255); - repl_url_label=new QLabel(repl_url_edit,tr("Audio Upload URL:"),this); + repl_url_label=new QLabel(tr("Audio Upload URL:"),this); repl_url_label->setFont(labelFont()); repl_url_label->setGeometry(20,99,130,19); repl_url_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -123,7 +123,7 @@ EditReplicator::EditReplicator(const QString &repl_name,QWidget *parent) repl_username_edit=new QLineEdit(this); repl_username_edit->setGeometry(225,121,95,19); repl_username_edit->setMaxLength(64); - repl_username_label=new QLabel(repl_username_edit,tr("Username:"),this); + repl_username_label=new QLabel(tr("Username:"),this); repl_username_label->setFont(labelFont()); repl_username_label->setGeometry(40,121,180,19); repl_username_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -135,7 +135,7 @@ EditReplicator::EditReplicator(const QString &repl_name,QWidget *parent) repl_password_edit->setGeometry(395,121,95,19); repl_password_edit->setMaxLength(64); repl_password_edit->setEchoMode(QLineEdit::Password); - repl_password_label=new QLabel(repl_password_edit,tr("Password:"),this); + repl_password_label=new QLabel(tr("Password:"),this); repl_password_label->setFont(labelFont()); repl_password_label->setGeometry(320,121,70,19); repl_password_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -146,7 +146,7 @@ EditReplicator::EditReplicator(const QString &repl_name,QWidget *parent) repl_format_edit=new QLineEdit(this); repl_format_edit->setGeometry(155,143,285,20); repl_format_edit->setReadOnly(true); - repl_format_label=new QLabel(repl_format_edit,tr("Upload Format:"),this); + repl_format_label=new QLabel(tr("Upload Format:"),this); repl_format_label->setFont(labelFont()); repl_format_label->setGeometry(5,143,145,20); repl_format_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -162,8 +162,7 @@ EditReplicator::EditReplicator(const QString &repl_name,QWidget *parent) repl_normalize_box=new QCheckBox(this); repl_normalize_box->setGeometry(155,167,15,15); repl_normalize_box->setChecked(true); - repl_normalize_check_label= - new QLabel(repl_normalize_box,tr("Normalize"),this); + repl_normalize_check_label=new QLabel(tr("Normalize"),this); repl_normalize_check_label->setFont(labelFont()); repl_normalize_check_label->setGeometry(175,165,83,20); repl_normalize_check_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -176,7 +175,7 @@ EditReplicator::EditReplicator(const QString &repl_name,QWidget *parent) repl_normalize_spin=new QSpinBox(this); repl_normalize_spin->setGeometry(295,165,40,20); repl_normalize_spin->setRange(-30,-1); - repl_normalize_label=new QLabel(repl_normalize_spin,tr("Level:"),this); + repl_normalize_label=new QLabel(tr("Level:"),this); repl_normalize_label->setFont(labelFont()); repl_normalize_label->setGeometry(245,165,45,20); repl_normalize_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -295,7 +294,7 @@ void EditReplicator::okData() RDSqlQuery *q; repl_replicator->setDescription(repl_description_edit->text()); - repl_replicator->setType((RDReplicator::Type)repl_type_box->currentItem()); + repl_replicator->setType((RDReplicator::Type)repl_type_box->currentIndex()); repl_replicator->setStationName(repl_station_box->currentText()); repl_replicator->setUrl(repl_url_edit->text()); repl_replicator->setUrlUsername(repl_username_edit->text()); diff --git a/rdadmin/edit_report.cpp b/rdadmin/edit_report.cpp index 521c29a9..d54e3680 100644 --- a/rdadmin/edit_report.cpp +++ b/rdadmin/edit_report.cpp @@ -57,8 +57,7 @@ EditReport::EditReport(QString rptname,QWidget *parent) edit_description_edit=new QLineEdit(this); edit_description_edit->setGeometry(200,10,sizeHint().width()-210,19); edit_description_edit->setMaxLength(64); - QLabel *label= - new QLabel(edit_description_edit,tr("&Report Description:"),this); + QLabel *label=new QLabel(tr("&Report Description:"),this); label->setGeometry(10,10,185,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -70,9 +69,9 @@ EditReport::EditReport(QString rptname,QWidget *parent) edit_filter_box->setGeometry(200,31,sizeHint().width()-210,19); for(int i=0;i<(int)RDReport::LastFilter;i++) { edit_filter_box-> - insertItem(RDReport::filterText((RDReport::ExportFilter)i)); + insertItem(i,RDReport::filterText((RDReport::ExportFilter)i)); } - label=new QLabel(edit_description_edit,tr("Export &Filter:"),this); + label=new QLabel(tr("Export &Filter:"),this); label->setGeometry(10,31,185,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -84,7 +83,7 @@ EditReport::EditReport(QString rptname,QWidget *parent) edit_stationid_edit->setGeometry(200,52,180,19); edit_stationid_edit->setMaxLength(16); edit_stationid_edit->setValidator(validator); - label=new QLabel(edit_stationid_edit,tr("Station ID:"),this); + label=new QLabel(tr("Station ID:"),this); label->setGeometry(10,52,185,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -101,7 +100,7 @@ EditReport::EditReport(QString rptname,QWidget *parent) edit_cartzeros_box->setGeometry(200,75,15,15); connect(edit_cartzeros_box,SIGNAL(toggled(bool)), this,SLOT(leadingZerosToggled(bool))); - label=new QLabel(edit_cartzeros_box,tr("Use Leading Zeros"),this); + label=new QLabel(tr("Use Leading Zeros"),this); label->setGeometry(217,73,120,19); label->setFont(subLabelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -109,7 +108,7 @@ EditReport::EditReport(QString rptname,QWidget *parent) edit_cartdigits_spin=new QSpinBox(this); edit_cartdigits_spin->setGeometry(380,73,40,19); edit_cartdigits_spin->setRange(1,6); - edit_cartdigits_label=new QLabel(edit_cartdigits_spin,tr("Digits:"),this); + edit_cartdigits_label=new QLabel(tr("Digits:"),this); edit_cartdigits_label->setGeometry(330,73,45,19); edit_cartdigits_label->setFont(subLabelFont()); edit_cartdigits_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -121,9 +120,10 @@ EditReport::EditReport(QString rptname,QWidget *parent) edit_stationtype_box->setGeometry(200,94,70,19); for(int i=0;i - insertItem(RDReport::stationTypeText((RDReport::StationType)i)); + insertItem(edit_stationtype_box->count(), + RDReport::stationTypeText((RDReport::StationType)i)); } - label=new QLabel(edit_stationtype_box,tr("Station Type:"),this); + label=new QLabel(tr("Station Type:"),this); label->setGeometry(10,94,185,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -134,7 +134,7 @@ EditReport::EditReport(QString rptname,QWidget *parent) edit_linesperpage_spin=new QSpinBox(this); edit_linesperpage_spin->setGeometry(360,94,50,19); edit_linesperpage_spin->setRange(10,200); - label=new QLabel(edit_linesperpage_spin,tr("Lines per Page:"),this); + label=new QLabel(tr("Lines per Page:"),this); label->setGeometry(255,94,100,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -147,7 +147,7 @@ EditReport::EditReport(QString rptname,QWidget *parent) edit_servicename_edit=new QLineEdit(this); edit_servicename_edit->setGeometry(200,115,sizeHint().width()-210,19); edit_servicename_edit->setMaxLength(64); - label=new QLabel(edit_servicename_edit,tr("Ser&vice Name:"),this); + label=new QLabel(tr("Ser&vice Name:"),this); label->setGeometry(10,115,185,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -158,7 +158,7 @@ EditReport::EditReport(QString rptname,QWidget *parent) edit_stationformat_edit=new QLineEdit(this); edit_stationformat_edit->setGeometry(200,136,sizeHint().width()-210,19); edit_stationformat_edit->setMaxLength(64); - label=new QLabel(edit_stationformat_edit,tr("Station &Format:"),this); + label=new QLabel(tr("Station &Format:"),this); label->setGeometry(10,136,185,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -170,7 +170,7 @@ EditReport::EditReport(QString rptname,QWidget *parent) edit_path_edit->setGeometry(200,157,sizeHint().width()-210,19); edit_path_edit->setMaxLength(255); edit_path_edit->setValidator(validator); - label=new QLabel(edit_path_edit,tr("Export Path:"),this); + label=new QLabel(tr("Export Path:"),this); label->setGeometry(10,157,185,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -181,7 +181,7 @@ EditReport::EditReport(QString rptname,QWidget *parent) edit_postexport_cmd_edit=new QLineEdit(this); edit_postexport_cmd_edit->setGeometry(200,178,sizeHint().width()-210,19); edit_postexport_cmd_edit->setValidator(validator); - label=new QLabel(edit_path_edit,tr("Post Export Cmd:"),this); + label=new QLabel(tr("Post Export Cmd:"),this); label->setGeometry(10,178,185,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -244,9 +244,9 @@ EditReport::EditReport(QString rptname,QWidget *parent) // edit_onairflag_box=new QComboBox(this); edit_onairflag_box->setGeometry(200,243,60,19); - edit_onairflag_box->insertItem(tr("No")); - edit_onairflag_box->insertItem(tr("Yes")); - label=new QLabel(edit_onairflag_box,tr("Include Only OnAir Events:"),this); + edit_onairflag_box->insertItem(0,tr("No")); + edit_onairflag_box->insertItem(1,tr("Yes")); + label=new QLabel(tr("Include Only OnAir Events:"),this); label->setGeometry(10,243,185,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -257,7 +257,7 @@ EditReport::EditReport(QString rptname,QWidget *parent) edit_daypart_check=new QCheckBox(this); edit_daypart_check->setGeometry(60,273,15,15); edit_daypart_label= - new QLabel(edit_daypart_check,tr("Filter by Daypart"),this); + new QLabel(tr("Filter by Daypart"),this); edit_daypart_label-> setGeometry(edit_daypart_check->geometry().x()+20,273,155,19); edit_daypart_label->setFont(labelFont()); @@ -266,7 +266,7 @@ EditReport::EditReport(QString rptname,QWidget *parent) edit_starttime_edit=new QTimeEdit(this); edit_starttime_edit->setDisplayFormat("hh:mm:ss"); edit_starttime_edit->setGeometry(150,294,80,20); - edit_starttime_label=new QLabel(edit_starttime_edit,tr("Start Time:"),this); + edit_starttime_label=new QLabel(tr("Start Time:"),this); edit_starttime_label->setGeometry(65,294,80,20); edit_starttime_label->setFont(labelFont()); edit_starttime_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -274,7 +274,7 @@ EditReport::EditReport(QString rptname,QWidget *parent) edit_endtime_edit=new QTimeEdit(this); edit_endtime_edit->setDisplayFormat("hh:mm:ss"); edit_endtime_edit->setGeometry(335,294,80,20); - edit_endtime_label=new QLabel(edit_endtime_edit,tr("End Time:"),this); + edit_endtime_label=new QLabel(tr("End Time:"),this); edit_endtime_label->setGeometry(250,294,80,20); edit_endtime_label->setFont(labelFont()); edit_endtime_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -324,7 +324,7 @@ EditReport::EditReport(QString rptname,QWidget *parent) edit_group_box=new QCheckBox(this); edit_group_box->setGeometry(60,531,15,15); - label=new QLabel(edit_group_box,tr("Filter by Groups"),this); + label=new QLabel(tr("Filter by Groups"),this); label->setGeometry(edit_group_box->geometry().x()+20,532,155,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -355,12 +355,12 @@ EditReport::EditReport(QString rptname,QWidget *parent) // Populate Fields // edit_description_edit->setText(edit_report->description()); - edit_filter_box->setCurrentItem((int)edit_report->filter()); + edit_filter_box->setCurrentIndex((int)edit_report->filter()); edit_stationid_edit->setText(edit_report->stationId()); edit_cartzeros_box->setChecked(edit_report->useLeadingZeros()); leadingZerosToggled(edit_cartzeros_box->isChecked()); edit_cartdigits_spin->setValue(edit_report->cartDigits()); - edit_stationtype_box->setCurrentItem((int)edit_report->stationType()); + edit_stationtype_box->setCurrentIndex((int)edit_report->stationType()); edit_servicename_edit->setText(edit_report->serviceName()); edit_stationformat_edit->setText(edit_report->stationFormat()); edit_linesperpage_spin->setValue(edit_report->linesPerPage()); @@ -379,10 +379,10 @@ EditReport::EditReport(QString rptname,QWidget *parent) setChecked(edit_report->exportTypeForced(RDReport::Music)); genericEventsToggledData(edit_generic_box->isChecked()); if(edit_report->filterOnairFlag()) { - edit_onairflag_box->setCurrentItem(1); + edit_onairflag_box->setCurrentIndex(1); } else { - edit_onairflag_box->setCurrentItem(0); + edit_onairflag_box->setCurrentIndex(0); } edit_starttime_edit->setTime(edit_report->startTime(&ok)); edit_starttime_label->setDisabled(ok); @@ -487,13 +487,13 @@ void EditReport::okData() edit_report->setDescription(edit_description_edit->text()); edit_report-> - setFilter((RDReport::ExportFilter)edit_filter_box->currentItem()); + setFilter((RDReport::ExportFilter)edit_filter_box->currentIndex()); edit_report->setStationId(edit_stationid_edit->text()); edit_report->setCartDigits(edit_cartdigits_spin->value()); edit_report->setUseLeadingZeros(edit_cartzeros_box->isChecked()); edit_report->setLinesPerPage(edit_linesperpage_spin->value()); edit_report-> - setStationType((RDReport::StationType)edit_stationtype_box->currentItem()); + setStationType((RDReport::StationType)edit_stationtype_box->currentIndex()); edit_report->setServiceName(edit_servicename_edit->text()); edit_report->setStationFormat(edit_stationformat_edit->text()); edit_report->setExportPath(RDReport::Linux,edit_path_edit->text()); @@ -509,7 +509,7 @@ void EditReport::okData() setExportTypeForced(RDReport::Music,edit_forcemusic_box->isChecked()); edit_report-> setExportTypeEnabled(RDReport::Generic,edit_generic_box->isChecked()); - edit_report->setFilterOnairFlag(edit_onairflag_box->currentItem()==1); + edit_report->setFilterOnairFlag(edit_onairflag_box->currentIndex()==1); edit_report->setFilterGroups(edit_group_box->isChecked()); if(edit_daypart_check->isChecked()) { edit_report->setStartTime(edit_starttime_edit->time()); diff --git a/rdadmin/edit_sas_resource.cpp b/rdadmin/edit_sas_resource.cpp index dcd30ea1..f02aa234 100644 --- a/rdadmin/edit_sas_resource.cpp +++ b/rdadmin/edit_sas_resource.cpp @@ -38,7 +38,7 @@ EditSasResource::EditSasResource(QWidget *parent) // edit_enginenum_edit=new QLineEdit(this); edit_enginenum_edit->setGeometry(165,10,50,20); - QLabel *label=new QLabel(edit_enginenum_edit,tr("Console Number: "),this); + QLabel *label=new QLabel(tr("Console Number: "),this); label->setGeometry(10,10,150,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -48,7 +48,7 @@ EditSasResource::EditSasResource(QWidget *parent) // edit_devicenum_edit=new QLineEdit(this); edit_devicenum_edit->setGeometry(165,36,50,20); - label=new QLabel(edit_devicenum_edit,tr("Source Number: "),this); + label=new QLabel(tr("Source Number: "),this); label->setGeometry(10,36,150,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -58,8 +58,7 @@ EditSasResource::EditSasResource(QWidget *parent) // edit_relaynum_edit=new QLineEdit(this); edit_relaynum_edit->setGeometry(165,62,50,20); - edit_relaynum_label= - new QLabel(edit_relaynum_edit,tr("Opto/Relay Number: "),this); + edit_relaynum_label=new QLabel(tr("Opto/Relay Number: "),this); edit_relaynum_label->setGeometry(10,62,150,20); edit_relaynum_label->setFont(labelFont()); edit_relaynum_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); diff --git a/rdadmin/edit_schedcodes.cpp b/rdadmin/edit_schedcodes.cpp index 26f6f233..155532f8 100644 --- a/rdadmin/edit_schedcodes.cpp +++ b/rdadmin/edit_schedcodes.cpp @@ -42,8 +42,7 @@ EditSchedCode::EditSchedCode(QWidget *parent) d_code_edit->setGeometry(125,11,100,19); d_code_edit->setMaxLength(10); d_code_edit->setReadOnly(true); - QLabel *schedcode_name_label= - new QLabel(d_code_edit,tr("Scheduler Code:"),this); + QLabel *schedcode_name_label=new QLabel(tr("Scheduler Code:"),this); schedcode_name_label->setGeometry(10,11,110,19); schedcode_name_label->setFont(labelFont()); schedcode_name_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -54,8 +53,7 @@ EditSchedCode::EditSchedCode(QWidget *parent) d_description_edit=new QLineEdit(this); d_description_edit->setGeometry(125,32,sizeHint().width()-135,19); d_description_edit->setMaxLength(255); - QLabel *schedcode_description_label= - new QLabel(d_description_edit,tr("Code Description:"),this); + QLabel *schedcode_description_label=new QLabel(tr("Code Description:"),this); schedcode_description_label->setGeometry(10,32,110,19); schedcode_description_label->setFont(labelFont()); schedcode_description_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); diff --git a/rdadmin/edit_station.cpp b/rdadmin/edit_station.cpp index 9b653e54..17def7cc 100644 --- a/rdadmin/edit_station.cpp +++ b/rdadmin/edit_station.cpp @@ -83,7 +83,7 @@ EditStation::EditStation(QString sname,QWidget *parent) // station_name_edit=new QLineEdit(this); station_name_edit->setReadOnly(true); - station_name_label=new QLabel(station_name_edit,tr("Ho&st Name:"),this); + station_name_label=new QLabel(tr("Ho&st Name:"),this); station_name_label->setFont(labelFont()); station_name_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -92,8 +92,7 @@ EditStation::EditStation(QString sname,QWidget *parent) // station_short_name_edit=new QLineEdit(this); station_short_name_edit->setMaxLength(64); - station_short_name_label= - new QLabel(station_short_name_edit,tr("Short Name:"),this); + station_short_name_label=new QLabel(tr("Short Name:"),this); station_short_name_label->setFont(labelFont()); station_short_name_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -103,20 +102,18 @@ EditStation::EditStation(QString sname,QWidget *parent) station_description_edit=new QLineEdit(this); station_description_edit->setMaxLength(64); station_description_edit->setValidator(validator); - station_description_label= - new QLabel(station_description_edit,tr("&Description:"),this); + station_description_label=new QLabel(tr("&Description:"),this); station_description_label->setFont(labelFont()); station_description_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Station Default User Name // - station_username_box=new QComboBox(this); + station_username_box=new RDComboBox(this); station_username_box->setEditable(false); station_username_model->setTypeFilter(RDUser::TypeUser); station_username_box->setModel(station_username_model); - station_username_label= - new QLabel(station_username_box,tr("Default &User:"),this); + station_username_label=new QLabel(tr("Default &User:"),this); station_username_label->setFont(labelFont()); station_username_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -126,8 +123,7 @@ EditStation::EditStation(QString sname,QWidget *parent) station_address_edit=new QLineEdit(this); station_address_edit->setMaxLength(15); station_address_edit->setValidator(validator); - station_address_label= - new QLabel(station_address_edit,tr("&IP Address:"),this); + station_address_label=new QLabel(tr("&IP Address:"),this); station_address_label->setFont(labelFont()); station_address_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -136,8 +132,7 @@ EditStation::EditStation(QString sname,QWidget *parent) // station_audio_editor_edit=new QLineEdit(this); station_audio_editor_edit->setMaxLength(191); - station_audio_editor_label= - new QLabel(station_audio_editor_edit,tr("Audio Editor")+":",this); + station_audio_editor_label=new QLabel(tr("Audio Editor")+":",this); station_audio_editor_label->setFont(labelFont()); station_audio_editor_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -146,8 +141,7 @@ EditStation::EditStation(QString sname,QWidget *parent) // station_report_editor_edit=new QLineEdit(this); station_report_editor_edit->setMaxLength(191); - station_report_editor_label= - new QLabel(station_report_editor_edit,tr("Report Editor")+":",this); + station_report_editor_label=new QLabel(tr("Report Editor")+":",this); station_report_editor_label->setFont(labelFont()); station_report_editor_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -156,8 +150,7 @@ EditStation::EditStation(QString sname,QWidget *parent) // station_web_browser_edit=new QLineEdit(this); station_web_browser_edit->setMaxLength(191); - station_web_browser_label= - new QLabel(station_web_browser_edit,tr("Web Browser")+":",this); + station_web_browser_label=new QLabel(tr("Web Browser")+":",this); station_web_browser_label->setFont(labelFont()); station_web_browser_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -166,8 +159,7 @@ EditStation::EditStation(QString sname,QWidget *parent) // station_ssh_identity_file_edit=new QLineEdit(this); station_ssh_identity_file_edit->setMaxLength(191); - station_ssh_identity_file_label= - new QLabel(station_ssh_identity_file_edit,tr("SSH Ident. File")+":",this); + station_ssh_identity_file_label=new QLabel(tr("SSH Ident. File")+":",this); station_ssh_identity_file_label->setFont(labelFont()); station_ssh_identity_file_label-> setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -178,8 +170,7 @@ EditStation::EditStation(QString sname,QWidget *parent) station_timeoffset_box=new QSpinBox(this); station_timeoffset_box->setRange(-RD_MAX_TIME_OFFSET,RD_MAX_TIME_OFFSET); station_timeoffset_box->setSuffix(tr(" mS")); - station_timeoffset_label= - new QLabel(station_timeoffset_box,tr("&Time Offset:"),this); + station_timeoffset_label=new QLabel(tr("&Time Offset:"),this); station_timeoffset_label->setFont(labelFont()); station_timeoffset_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -189,8 +180,7 @@ EditStation::EditStation(QString sname,QWidget *parent) station_startup_cart_edit=new QLineEdit(this); station_startup_cart_edit->setMaxLength(15); station_startup_cart_edit->setValidator(macro_validator); - station_startup_cart_label= - new QLabel(station_startup_cart_edit,tr("&Startup Cart:"),this); + station_startup_cart_label=new QLabel(tr("&Startup Cart:"),this); station_startup_cart_label->setFont(labelFont()); station_startup_cart_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -203,15 +193,13 @@ EditStation::EditStation(QString sname,QWidget *parent) // Cue Output // station_cue_sel=new RDCardSelector(this); - station_cue_sel_label= - new QLabel(station_cue_sel,tr("Cue &Output:"),this); + station_cue_sel_label=new QLabel(tr("Cue &Output:"),this); station_cue_sel_label->setFont(labelFont()); station_cue_sel_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); station_start_cart_edit=new QLineEdit(this); station_start_cart_edit->setValidator(macro_validator); - station_start_cart_label= - new QLabel(station_start_cart_edit,tr("Start Cart")+":",this); + station_start_cart_label=new QLabel(tr("Start Cart")+":",this); station_start_cart_label->setFont(subLabelFont()); station_start_cart_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -222,8 +210,7 @@ EditStation::EditStation(QString sname,QWidget *parent) station_stop_cart_edit=new QLineEdit(this); station_stop_cart_edit->setValidator(macro_validator); - station_stop_cart_label= - new QLabel(station_stop_cart_edit,tr("Stop Cart")+":",this); + station_stop_cart_label=new QLabel(tr("Stop Cart")+":",this); station_stop_cart_label->setFont(subLabelFont()); station_stop_cart_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -236,8 +223,7 @@ EditStation::EditStation(QString sname,QWidget *parent) // Heartbeat Checkbox // station_heartbeat_box=new QCheckBox(this); - station_heartbeat_label= - new QLabel(station_heartbeat_box,tr("Enable Heartbeat"),this); + station_heartbeat_label=new QLabel(tr("Enable Heartbeat"),this); station_heartbeat_label->setFont(labelFont()); station_heartbeat_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); connect(station_heartbeat_box,SIGNAL(toggled(bool)), @@ -247,8 +233,7 @@ EditStation::EditStation(QString sname,QWidget *parent) // Filter Checkbox // station_filter_box=new QCheckBox(this); - station_filter_label= - new QLabel(station_filter_box,tr("Use Realtime Filtering"),this); + station_filter_label=new QLabel(tr("Use Realtime Filtering"),this); station_filter_label->setFont(labelFont()); station_filter_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -257,7 +242,7 @@ EditStation::EditStation(QString sname,QWidget *parent) // station_hbcart_edit=new QLineEdit(this); station_hbcart_edit->setValidator(macro_validator); - station_hbcart_label=new QLabel(station_hbcart_edit,tr("Cart:"),this); + station_hbcart_label=new QLabel(tr("Cart:"),this); station_hbcart_label->setFont(labelFont()); station_hbcart_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); station_hbcart_button=new QPushButton(this); @@ -271,8 +256,7 @@ EditStation::EditStation(QString sname,QWidget *parent) // station_hbinterval_spin=new QSpinBox(this); station_hbinterval_spin->setRange(1,300); - station_hbinterval_label= - new QLabel(station_hbinterval_spin,tr("Interval:"),this); + station_hbinterval_label=new QLabel(tr("Interval:"),this); station_hbinterval_label->setFont(labelFont()); station_hbinterval_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); station_hbinterval_unit=new QLabel(tr("secs"),this); @@ -283,8 +267,7 @@ EditStation::EditStation(QString sname,QWidget *parent) // System Maintenance Checkbox // station_maint_box=new QCheckBox(this); - station_maint_label= - new QLabel(station_maint_box,tr("Include in System Maintenance Pool"),this); + station_maint_label=new QLabel(tr("Include in System Maintenance Pool"),this); station_maint_label->setFont(labelFont()); station_maint_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -292,8 +275,7 @@ EditStation::EditStation(QString sname,QWidget *parent) // Enable Drag & Drop Checkbox // station_dragdrop_box=new QCheckBox(this); - station_dragdrop_label= - new QLabel(station_dragdrop_box,tr("Enable Drag && Drop"),this); + station_dragdrop_label=new QLabel(tr("Enable Drag && Drop"),this); station_dragdrop_label->setFont(labelFont()); station_dragdrop_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -302,8 +284,7 @@ EditStation::EditStation(QString sname,QWidget *parent) // station_panel_enforce_box=new QCheckBox(this); station_panel_enforce_label= - new QLabel(station_panel_enforce_box, - tr("Allow Drops on Panels not in Setup Mode"),this); + new QLabel(tr("Allow Drops on Panels not in Setup Mode"),this); station_panel_enforce_label->setFont(labelFont()); station_panel_enforce_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); connect(station_dragdrop_box,SIGNAL(toggled(bool)), @@ -320,24 +301,22 @@ EditStation::EditStation(QString sname,QWidget *parent) // // HTTP Service Host // - station_http_station_box=new QComboBox(this); + station_http_station_box=new RDComboBox(this); station_http_station_box->setEditable(false); station_http_station_box->setModel(station_station_model); - station_http_station_label= - new QLabel(station_http_station_box,tr("HTTP Xport:"),this); + station_http_station_label=new QLabel(tr("HTTP Xport:"),this); station_http_station_label->setFont(labelFont()); station_http_station_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // CAE Service Host // - station_cae_station_box=new QComboBox(this); + station_cae_station_box=new RDComboBox(this); station_cae_station_box->setEditable(false); station_cae_station_box->setModel(station_station_model); connect(station_cae_station_box,SIGNAL(activated(const QString &)), this,SLOT(caeStationActivatedData(const QString &))); - station_cae_station_label= - new QLabel(station_cae_station_box,tr("Core Audio Engine:"),this); + station_cae_station_label=new QLabel(tr("Core Audio Engine:"),this); station_cae_station_label->setFont(labelFont()); station_cae_station_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -558,11 +537,13 @@ EditStation::EditStation(QString sname,QWidget *parent) station_http_station_box->setCurrentText(station_station->httpStation()); station_cae_station_box->setCurrentText(station_station->caeStation()); for(int i=0;icount();i++) { - if(station_http_station_box->text(i)==station_station->httpStation()) { - station_http_station_box->setCurrentItem(i); + if(station_http_station_box->itemData(i).toString()== + station_station->httpStation()) { + station_http_station_box->setCurrentIndex(i); } - if(station_cae_station_box->text(i)==station_station->caeStation()) { - station_cae_station_box->setCurrentItem(i); + if(station_cae_station_box->itemData(i).toString()== + station_station->caeStation()) { + station_cae_station_box->setCurrentIndex(i); } } } @@ -726,9 +707,10 @@ void EditStation::okData() // // Allow the event loop to run so the packets get delivered // - QTimer *timer=new QTimer(this,"ok_timer"); + QTimer *timer=new QTimer(this); + timer->setSingleShot(true); connect(timer,SIGNAL(timeout()),this,SLOT(okTimerData())); - timer->start(1,true); + timer->start(1); } diff --git a/rdadmin/edit_station.h b/rdadmin/edit_station.h index 84ce2162..cbb35ebd 100644 --- a/rdadmin/edit_station.h +++ b/rdadmin/edit_station.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -87,7 +88,7 @@ class EditStation : public RDDialog QLabel *station_description_label; QLineEdit *station_description_edit; QLabel *station_username_label; - QComboBox *station_username_box; + RDComboBox *station_username_box; RDUserListModel *station_username_model; QLabel *station_address_label; QLineEdit *station_address_edit; @@ -132,9 +133,9 @@ class EditStation : public RDDialog QCheckBox *station_panel_enforce_box; QGroupBox *station_systemservices_groupbox; QLabel *station_http_station_label; - QComboBox *station_http_station_box; + RDComboBox *station_http_station_box; QLabel *station_cae_station_label; - QComboBox *station_cae_station_box; + RDComboBox *station_cae_station_box; RDStationListModel *station_station_model; QPushButton *station_rdlibrary_button; QPushButton *station_rdcatch_button; diff --git a/rdadmin/edit_svc.cpp b/rdadmin/edit_svc.cpp index 0157495d..645f789a 100644 --- a/rdadmin/edit_svc.cpp +++ b/rdadmin/edit_svc.cpp @@ -2,7 +2,7 @@ // // Edit a Rivendell Service // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include +#include #include #include @@ -77,7 +77,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) svc_name_edit->setGeometry(185,31,80,19); svc_name_edit->setMaxLength(10); svc_name_edit->setReadOnly(true); - label=new QLabel(svc_name_edit,tr("&Service Name:"),this); + label=new QLabel(tr("&Service Name:"),this); label->setGeometry(10,31,170,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -88,7 +88,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) svc_description_edit->setGeometry(185,52,240,19); svc_description_edit->setMaxLength(255); svc_description_edit->setValidator(validator); - label=new QLabel(svc_description_edit,tr("Service &Description:"),this); + label=new QLabel(tr("Service &Description:"),this); label->setGeometry(10,52,170,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -99,7 +99,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) svc_program_code_edit->setGeometry(185,73,240,19); svc_program_code_edit->setMaxLength(255); svc_program_code_edit->setValidator(validator); - label=new QLabel(svc_program_code_edit,tr("&Program Code:"),this); + label=new QLabel(tr("&Program Code:"),this); label->setGeometry(10,73,170,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -110,7 +110,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) svc_name_template_edit->setGeometry(185,94,240,19); svc_name_template_edit->setMaxLength(255); svc_name_template_edit->setValidator(log_validator); - label=new QLabel(svc_name_template_edit,tr("Log Name &Template:"),this); + label=new QLabel(tr("Log Name &Template:"),this); label->setGeometry(10,94,170,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -120,8 +120,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) svc_description_template_edit=new QLineEdit(this); svc_description_template_edit->setGeometry(185,115,240,19); svc_description_template_edit->setMaxLength(255); - label=new QLabel(svc_description_template_edit, - tr("Log &Description Template:"),this); + label=new QLabel(tr("Log &Description Template:"),this); label->setGeometry(10,115,170,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -136,8 +135,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) insertItem((int)RDSvc::SchedFile,tr("From Scheduler File")); connect(svc_sub_event_inheritance_box,SIGNAL(activated(const QString &)), this,SLOT(textChangedData(const QString &))); - label=new QLabel(svc_sub_event_inheritance_box, - tr("Inline Event Start/Length")+":",this); + label=new QLabel(tr("Inline Event Start/Length")+":",this); label->setGeometry(10,136,170,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -146,8 +144,8 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // svc_voice_group_box=new QComboBox(this); svc_voice_group_box->setGeometry(185,157,240,19); - svc_voice_group_box->insertItem(tr("[none]")); - label=new QLabel(svc_voice_group_box,tr("Voicetrack Group:"),this); + svc_voice_group_box->insertItem(0,tr("[none]")); + label=new QLabel(tr("Voicetrack Group:"),this); label->setGeometry(10,157,170,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -156,8 +154,8 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // svc_autospot_group_box=new QComboBox(this); svc_autospot_group_box->setGeometry(185,178,240,19); - svc_autospot_group_box->insertItem(tr("[none]")); - label=new QLabel(svc_autospot_group_box,tr("AutoSpot Group:"),this); + svc_autospot_group_box->insertItem(0,tr("[none]")); + label=new QLabel(tr("AutoSpot Group:"),this); label->setGeometry(10,178,170,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -166,7 +164,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // svc_chain_box=new QCheckBox(this); svc_chain_box->setGeometry(30,201,15,15); - label=new QLabel(svc_chain_box,tr("Insert CHAIN TO at log end"),this); + label=new QLabel(tr("Insert CHAIN TO at log end"),this); label->setGeometry(50,201,170,19); label->setAlignment(Qt::AlignLeft); @@ -175,8 +173,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // svc_autorefresh_box=new QCheckBox(this); svc_autorefresh_box->setGeometry(230,201,15,15); - label= - new QLabel(svc_autorefresh_box,tr("Enable AutoRefresh By Default"),this); + label=new QLabel(tr("Enable AutoRefresh By Default"),this); label->setGeometry(250,201,200,19); label->setAlignment(Qt::AlignLeft); @@ -194,7 +191,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // svc_loglife_box=new QCheckBox(this); svc_loglife_box->setGeometry(460,95,15,15); - label=new QLabel(svc_loglife_box,tr("Set Logs to auto-delete"),this); + label=new QLabel(tr("Set Logs to auto-delete"),this); label->setGeometry(480,95,240,19); label->setAlignment(Qt::AlignLeft); svc_loglife_spin=new QSpinBox(this); @@ -202,14 +199,14 @@ EditSvc::EditSvc(QString svc,QWidget *parent) svc_loglife_spin->setRange(0,365); connect(svc_loglife_box,SIGNAL(toggled(bool)), svc_loglife_spin,SLOT(setEnabled(bool))); - svc_loglifeorigin_label=new QLabel(svc_loglife_box,tr("days after"),this); + svc_loglifeorigin_label=new QLabel(tr("days after"),this); svc_loglifeorigin_label->setGeometry(685,95,100,19); svc_loglifeorigin_label->setAlignment(Qt::AlignLeft); connect(svc_loglife_box,SIGNAL(toggled(bool)), svc_loglifeorigin_label,SLOT(setEnabled(bool))); svc_loglifeorigin_box=new QComboBox(this); - svc_loglifeorigin_box->insertItem(tr("air date")); - svc_loglifeorigin_box->insertItem(tr("creation")); + svc_loglifeorigin_box->insertItem(0,tr("air date")); + svc_loglifeorigin_box->insertItem(1,tr("creation")); svc_loglifeorigin_box->setGeometry(750,93,100,19); connect(svc_loglife_box,SIGNAL(toggled(bool)), svc_loglifeorigin_box,SLOT(setEnabled(bool))); @@ -219,7 +216,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // svc_shelflife_box=new QCheckBox(this); svc_shelflife_box->setGeometry(460,117,15,15); - label=new QLabel(svc_shelflife_box,tr("Purge ELR Data"),this); + label=new QLabel(tr("Purge ELR Data"),this); label->setGeometry(480,117,170,19); label->setAlignment(Qt::AlignLeft); svc_shelflife_spin=new QSpinBox(this); @@ -227,7 +224,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) svc_shelflife_spin->setRange(0,365); connect(svc_shelflife_box,SIGNAL(toggled(bool)), svc_shelflife_spin,SLOT(setEnabled(bool))); - label=new QLabel(svc_shelflife_box,tr("days after airing"),this); + label=new QLabel(tr("days after airing"),this); label->setGeometry(640,117,200,19); label->setAlignment(Qt::AlignLeft); @@ -236,9 +233,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // svc_import_markers_check=new QCheckBox(this); svc_import_markers_check->setGeometry(460,140,15,15); - label= - new QLabel(svc_shelflife_box,tr("Include Import Markers in Finished Logs"), - this); + label=new QLabel(tr("Include Import Markers in Finished Logs"),this); label->setGeometry(480,140,sizeHint().width()-490,19); label->setAlignment(Qt::AlignLeft); @@ -266,7 +261,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) svc_tfc_path_edit->setGeometry(185,255,240,19); svc_tfc_path_edit->setMaxLength(191); svc_tfc_path_edit->setValidator(validator); - label=new QLabel(svc_tfc_path_edit,tr("Import Path:"),this); + label=new QLabel(tr("Import Path:"),this); label->setGeometry(10,255,170,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(svc_tfc_path_edit,SIGNAL(textChanged(const QString &)), @@ -278,8 +273,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) svc_tfc_preimport_cmd_edit=new QLineEdit(this); svc_tfc_preimport_cmd_edit->setGeometry(185,276,240,19); svc_tfc_preimport_cmd_edit->setValidator(validator); - label= - new QLabel(svc_tfc_preimport_cmd_edit,tr("Preimport Command:"),this); + label=new QLabel(tr("Preimport Command:"),this); label->setGeometry(10,276,170,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(svc_tfc_preimport_cmd_edit,SIGNAL(textChanged(const QString &)), @@ -291,7 +285,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) svc_tfc_label_cart_edit=new QLineEdit(this); svc_tfc_label_cart_edit->setGeometry(185,297,240,19); svc_tfc_label_cart_edit->setMaxLength(32); - label=new QLabel(svc_tfc_label_cart_edit,tr("Insert Marker String")+":",this); + label=new QLabel(tr("Insert Marker String")+":",this); label->setGeometry(10,297,170,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(svc_tfc_label_cart_edit,SIGNAL(textChanged(const QString &)), @@ -303,7 +297,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) svc_tfc_track_edit=new QLineEdit(this); svc_tfc_track_edit->setGeometry(185,318,240,19); svc_tfc_track_edit->setMaxLength(32); - label=new QLabel(svc_tfc_track_edit,tr("Insert Voice Track String:"),this); + label=new QLabel(tr("Insert Voice Track String:"),this); label->setGeometry(10,318,170,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(svc_tfc_track_edit,SIGNAL(textChanged(const QString &)), @@ -314,7 +308,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // svc_tfc_import_template_box=new QComboBox(this); svc_tfc_import_template_box->setGeometry(185,339,240,19); - label=new QLabel(svc_tfc_import_template_box,tr("Import Template:"),this); + label=new QLabel(tr("Import Template:"),this); label->setGeometry(10,339,170,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(svc_tfc_import_template_box,SIGNAL(activated(int)), @@ -360,7 +354,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) svc_mus_path_edit->setGeometry(620,256,240,19); svc_mus_path_edit->setMaxLength(191); svc_mus_path_edit->setValidator(validator); - label=new QLabel(svc_mus_path_edit,tr("Import Path:"),this); + label=new QLabel(tr("Import Path:"),this); label->setGeometry(450,256,165,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(svc_mus_path_edit,SIGNAL(textChanged(const QString &)), @@ -373,7 +367,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) svc_mus_preimport_cmd_edit->setGeometry(620,276,240,19); svc_mus_preimport_cmd_edit->setValidator(validator); label= - new QLabel(svc_mus_preimport_cmd_edit,tr("Preimport Command:"),this); + new QLabel(tr("Preimport Command:"),this); label->setGeometry(450,276,165,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(svc_mus_preimport_cmd_edit,SIGNAL(textChanged(const QString &)), @@ -385,7 +379,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) svc_mus_label_cart_edit=new QLineEdit(this); svc_mus_label_cart_edit->setGeometry(620,297,240,19); svc_mus_label_cart_edit->setMaxLength(32); - label=new QLabel(svc_mus_label_cart_edit,tr("Insert Marker String")+":",this); + label=new QLabel(tr("Insert Marker String")+":",this); label->setGeometry(450,297,165,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(svc_mus_label_cart_edit,SIGNAL(textChanged(const QString &)), @@ -397,7 +391,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) svc_mus_track_edit=new QLineEdit(this); svc_mus_track_edit->setGeometry(620,318,240,19); svc_mus_track_edit->setMaxLength(255); - label=new QLabel(svc_mus_track_edit,tr("Insert Voice Track String:"),this); + label=new QLabel(tr("Insert Voice Track String:"),this); label->setGeometry(450,318,165,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(svc_mus_track_edit,SIGNAL(textChanged(const QString &)), @@ -409,7 +403,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) svc_mus_break_edit=new QLineEdit(this); svc_mus_break_edit->setGeometry(620,339,240,19); svc_mus_break_edit->setMaxLength(255); - label=new QLabel(svc_mus_break_edit,tr("Insert Traffic Break String:"),this); + label=new QLabel(tr("Insert Traffic Break String:"),this); label->setGeometry(450,339,165,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(svc_mus_break_edit,SIGNAL(textChanged(const QString &)), @@ -420,7 +414,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) // svc_mus_import_template_box=new QComboBox(this); svc_mus_import_template_box->setGeometry(620,360,240,19); - label=new QLabel(svc_mus_import_template_box,tr("Import Template:"),this); + label=new QLabel(tr("Import Template:"),this); label->setGeometry(450,360,165,19); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(svc_mus_import_template_box,SIGNAL(activated(int)), @@ -479,13 +473,15 @@ EditSvc::EditSvc(QString svc,QWidget *parent) sql="select NAME from GROUPS order by NAME"; q=new RDSqlQuery(sql); while(q->next()) { - svc_voice_group_box->insertItem(q->value(0).toString()); + svc_voice_group_box->insertItem(svc_voice_group_box->count(), + q->value(0).toString()); if(q->value(0).toString()==group) { - svc_voice_group_box->setCurrentItem(svc_voice_group_box->count()-1); + svc_voice_group_box->setCurrentIndex(svc_voice_group_box->count()-1); } - svc_autospot_group_box->insertItem(q->value(0).toString()); + svc_autospot_group_box->insertItem(svc_autospot_group_box->count(), + q->value(0).toString()); if(q->value(0).toString()==autospot) { - svc_autospot_group_box->setCurrentItem(svc_autospot_group_box->count()-1); + svc_autospot_group_box->setCurrentIndex(svc_autospot_group_box->count()-1); } } delete q; @@ -505,7 +501,7 @@ EditSvc::EditSvc(QString svc,QWidget *parent) if(svc_svc->defaultLogShelflife()>=0) { svc_loglife_box->setChecked(true); svc_loglife_spin->setValue(svc_svc->defaultLogShelflife()); - svc_loglifeorigin_box->setCurrentItem(svc_svc->logShelflifeOrigin()); + svc_loglifeorigin_box->setCurrentIndex(svc_svc->logShelflifeOrigin()); svc_loglifeorigin_label->setEnabled(true); } else { @@ -524,20 +520,22 @@ EditSvc::EditSvc(QString svc,QWidget *parent) svc_tfc_path_edit->setText(svc_svc->importPath(RDSvc::Traffic)); svc_tfc_preimport_cmd_edit-> setText(svc_svc->preimportCommand(RDSvc::Traffic)); - svc_tfc_import_template_box->insertItem(tr("[custom]")); - svc_mus_import_template_box->insertItem(tr("[custom]")); + svc_tfc_import_template_box->insertItem(0,tr("[custom]")); + svc_mus_import_template_box->insertItem(0,tr("[custom]")); sql="select NAME from IMPORT_TEMPLATES order by NAME"; q=new RDSqlQuery(sql); while(q->next()) { - svc_tfc_import_template_box->insertItem(q->value(0).toString()); + svc_tfc_import_template_box-> + insertItem(svc_tfc_import_template_box->count(),q->value(0).toString()); if(q->value(0).toString()==svc_svc->importTemplate(RDSvc::Traffic)) { svc_tfc_import_template_box-> - setCurrentItem(svc_tfc_import_template_box->count()-1); + setCurrentIndex(svc_tfc_import_template_box->count()-1); } - svc_mus_import_template_box->insertItem(q->value(0).toString()); + svc_mus_import_template_box-> + insertItem(svc_mus_import_template_box->count(),q->value(0).toString()); if(q->value(0).toString()==svc_svc->importTemplate(RDSvc::Music)) { svc_mus_import_template_box-> - setCurrentItem(svc_mus_import_template_box->count()-1); + setCurrentIndex(svc_mus_import_template_box->count()-1); } } delete q; @@ -551,8 +549,8 @@ EditSvc::EditSvc(QString svc,QWidget *parent) setText(svc_svc->breakString()); svc_mus_track_edit-> setText(svc_svc->trackString(RDSvc::Music)); - tfcTemplateActivatedData(svc_tfc_import_template_box->currentItem()); - musTemplateActivatedData(svc_mus_import_template_box->currentItem()); + tfcTemplateActivatedData(svc_tfc_import_template_box->currentIndex()); + musTemplateActivatedData(svc_mus_import_template_box->currentIndex()); import_changed=false; } @@ -606,7 +604,7 @@ void EditSvc::trafficCopyData() return; } svc_svc->setImportTemplate(RDSvc::Traffic,""); - svc_tfc_import_template_box->setCurrentItem(0); + svc_tfc_import_template_box->setCurrentIndex(0); svc_tfc_fields->setEnabled(1); svc_tfc_copy_button->setEnabled(0); } @@ -626,7 +624,7 @@ void EditSvc::musicCopyData() return; } svc_svc->setImportTemplate(RDSvc::Music,""); - svc_mus_import_template_box->setCurrentItem(0); + svc_mus_import_template_box->setCurrentIndex(0); svc_mus_fields->setEnabled(1); svc_mus_copy_button->setEnabled(0); } @@ -650,7 +648,7 @@ void EditSvc::tfcTemplateActivatedData(int index) // // Temporarily set selected template // - if(svc_tfc_import_template_box->currentItem()==0) { + if(svc_tfc_import_template_box->currentIndex()==0) { svc_svc->setImportTemplate(RDSvc::Traffic,""); } else { @@ -683,7 +681,7 @@ void EditSvc::musTemplateActivatedData(int index) // // Temporarily set selected template // - if(svc_mus_import_template_box->currentItem()==0) { + if(svc_mus_import_template_box->currentIndex()==0) { svc_svc->setImportTemplate(RDSvc::Music,""); } else { @@ -742,7 +740,7 @@ void EditSvc::Save() { svc_svc->setDescription(svc_description_edit->text()); svc_svc->setProgramCode(svc_program_code_edit->text()); - svc_svc->setNameTemplate(svc_name_template_edit->text().stripWhiteSpace()); + svc_svc->setNameTemplate(svc_name_template_edit->text().trimmed()); svc_svc->setDescriptionTemplate(svc_description_template_edit->text()); svc_svc-> setSubEventInheritance((RDSvc::SubEventInheritance) svc_sub_event_inheritance_box->currentIndex()); @@ -751,7 +749,7 @@ void EditSvc::Save() if(svc_loglife_box->isChecked()) { svc_svc->setDefaultLogShelflife(svc_loglife_spin->value()); svc_svc->setLogShelflifeOrigin((RDSvc::ShelflifeOrigin) - svc_loglifeorigin_box->currentItem()); + svc_loglifeorigin_box->currentIndex()); } else { svc_svc->setDefaultLogShelflife(-1); @@ -766,7 +764,7 @@ void EditSvc::Save() svc_svc->setImportPath(RDSvc::Traffic,svc_tfc_path_edit->text()); svc_svc-> setPreimportCommand(RDSvc::Traffic,svc_tfc_preimport_cmd_edit->text()); - if(svc_tfc_import_template_box->currentItem()==0) { + if(svc_tfc_import_template_box->currentIndex()==0) { svc_svc->setImportTemplate(RDSvc::Traffic,""); svc_tfc_fields->readFields(svc_svc,RDSvc::Traffic); } @@ -778,7 +776,7 @@ void EditSvc::Save() svc_svc->setTrackString(RDSvc::Traffic,svc_tfc_track_edit->text()); svc_svc->setImportPath(RDSvc::Music,svc_mus_path_edit->text()); svc_svc->setPreimportCommand(RDSvc::Music,svc_mus_preimport_cmd_edit->text()); - if(svc_mus_import_template_box->currentItem()==0) { + if(svc_mus_import_template_box->currentIndex()==0) { svc_svc->setImportTemplate(RDSvc::Music,""); svc_mus_fields->readFields(svc_svc,RDSvc::Music); } @@ -790,13 +788,13 @@ void EditSvc::Save() svc_svc->setTrackString(RDSvc::Music,svc_mus_track_edit->text()); svc_svc->setLabelCart(RDSvc::Music,svc_mus_label_cart_edit->text()); import_changed=false; - if(svc_voice_group_box->currentItem()==0) { + if(svc_voice_group_box->currentIndex()==0) { svc_svc->setTrackGroup(""); } else { svc_svc->setTrackGroup(svc_voice_group_box->currentText()); } - if(svc_autospot_group_box->currentItem()==0) { + if(svc_autospot_group_box->currentIndex()==0) { svc_svc->setAutospotGroup(""); } else { diff --git a/rdadmin/edit_system.cpp b/rdadmin/edit_system.cpp index 2843d08c..a7122311 100644 --- a/rdadmin/edit_system.cpp +++ b/rdadmin/edit_system.cpp @@ -56,19 +56,18 @@ EditSystem::EditSystem(QWidget *parent) // System Sample Rate // edit_sample_rate_box=new QComboBox(this); - edit_sample_rate_box->insertItem("32000"); - edit_sample_rate_box->insertItem("44100"); - edit_sample_rate_box->insertItem("48000"); - edit_sample_rate_label= - new QLabel(edit_sample_rate_box,tr("System Sample Rate:"),this); + edit_sample_rate_box->insertItem(0,"32000"); + edit_sample_rate_box->insertItem(1,"44100"); + edit_sample_rate_box->insertItem(2,"48000"); + edit_sample_rate_label=new QLabel(tr("System Sample Rate:"),this); edit_sample_rate_label->setFont(labelFont()); edit_sample_rate_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); edit_sample_rate_unit_label=new QLabel(tr("samples/second"),this); edit_sample_rate_unit_label->setGeometry(325,10,sizeHint().width()-285,20); edit_sample_rate_unit_label->setFont(labelFont()); edit_sample_rate_unit_label-> - setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Allow Duplicate Cart Titles Box @@ -77,49 +76,46 @@ EditSystem::EditSystem(QWidget *parent) connect(edit_duplicate_carts_box,SIGNAL(toggled(bool)), this,SLOT(duplicatesCheckedData(bool))); edit_duplicate_label= - new QLabel(edit_duplicate_carts_box,tr("Allow Duplicate Cart Titles"),this); + new QLabel(tr("Allow Duplicate Cart Titles"),this); edit_duplicate_label->setFont(labelFont()); edit_duplicate_label-> - setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignLeft|Qt::AlignVCenter); edit_fix_duplicate_carts_box=new QCheckBox(this); - edit_fix_duplicate_carts_label=new QLabel(edit_fix_duplicate_carts_box, - tr("Auto-Correct Duplicate Cart Titles"),this); + edit_fix_duplicate_carts_label= + new QLabel(tr("Auto-Correct Duplicate Cart Titles"),this); edit_fix_duplicate_carts_label->setFont(labelFont()); edit_fix_duplicate_carts_label-> - setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // ISCI Cross Reference Path // edit_isci_path_edit=new QLineEdit(this); - edit_isci_path_label= - new QLabel(edit_isci_path_edit,tr("ISCI Cross Reference Path:"),this); + edit_isci_path_label=new QLabel(tr("ISCI Cross Reference Path:"),this); edit_isci_path_label->setFont(labelFont()); edit_isci_path_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Origin Email Address // edit_origin_email_addr_edit=new QLineEdit(this); edit_origin_email_addr_edit->setMaxLength(64); - edit_origin_email_addr_label= - new QLabel(edit_origin_email_addr_edit,tr("Origin E-Mail Address")+":",this); + edit_origin_email_addr_label=new QLabel(tr("Origin E-Mail Address")+":",this); edit_origin_email_addr_label->setFont(labelFont()); edit_origin_email_addr_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Notification Address // edit_notification_address_edit=new QLineEdit(this); edit_notification_address_label= - new QLabel(edit_notification_address_edit, - tr("Multicast Address for Notifications"),this); + new QLabel(tr("Multicast Address for Notifications"),this); edit_notification_address_label->setFont(labelFont()); edit_notification_address_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Maximum POST Size @@ -127,36 +123,34 @@ EditSystem::EditSystem(QWidget *parent) edit_maxpost_spin=new QSpinBox(this); edit_maxpost_spin->setRange(1,1000); edit_maxpost_label= - new QLabel(edit_maxpost_spin,tr("Maximum Remote Post Length:"),this); + new QLabel(tr("Maximum Remote Post Length:"),this); edit_maxpost_label->setFont(labelFont()); edit_maxpost_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); edit_maxpost_unit_label=new QLabel(tr("Mbytes"),this); edit_maxpost_unit_label->setFont(labelFont()); edit_maxpost_unit_label-> - setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Temporary Cart Group // - edit_temp_cart_group_box=new QComboBox(this); + edit_temp_cart_group_box=new RDComboBox(this); edit_temp_cart_group_model=new RDGroupListModel(false,true,this); edit_temp_cart_group_box->setModel(edit_temp_cart_group_model); - edit_temp_cart_group_label= - new QLabel(edit_temp_cart_group_box,tr("Temporary Cart Group:"),this); + edit_temp_cart_group_label=new QLabel(tr("Temporary Cart Group:"),this); edit_temp_cart_group_label->setFont(labelFont()); edit_temp_cart_group_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Show User List // edit_show_user_list_box=new QCheckBox(this); - edit_show_user_list_label= - new QLabel(edit_show_user_list_box,tr("Show User List in RDLogin"),this); + edit_show_user_list_label=new QLabel(tr("Show User List in RDLogin"),this); edit_show_user_list_label->setFont(labelFont()); edit_show_user_list_label-> - setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // RSS Processor Host @@ -170,11 +164,10 @@ EditSystem::EditSystem(QWidget *parent) q->value(0).toString()); } delete q; - edit_rss_processor_label= - new QLabel(edit_rss_processor_box,tr("Process RSS Updates On")+":",this); + edit_rss_processor_label=new QLabel(tr("Process RSS Updates On")+":",this); edit_rss_processor_label->setFont(labelFont()); edit_rss_processor_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Duplicate List (initially hidden) @@ -238,14 +231,15 @@ EditSystem::EditSystem(QWidget *parent) QString station=edit_system->rssProcessorStation(); for(int i=0;icount();i++) { - if(edit_rss_processor_box->text(i)==station) { + if(edit_rss_processor_box->itemData(i).toString()==station) { edit_rss_processor_box->setCurrentIndex(i); } } for(int i=0;icount();i++) { - if(edit_sample_rate_box->text(i).toUInt()==edit_system->sampleRate()) { - edit_sample_rate_box->setCurrentItem(i); + if(edit_sample_rate_box->itemData(i).toString().toUInt()== + edit_system->sampleRate()) { + edit_sample_rate_box->setCurrentIndex(i); } } edit_temp_cart_group_box->setCurrentText(edit_system->tempCartGroup()); @@ -301,7 +295,7 @@ void EditSystem::saveData() if(filename.isNull()) { return; } - if(filename.find(".")<0) { + if(filename.indexOf(".")<0) { filename+=".txt"; } if(QFile::exists(filename)) { @@ -313,16 +307,16 @@ void EditSystem::saveData() return; } } - FILE *f=fopen(filename,"w"); + FILE *f=fopen(filename.toUtf8(),"w"); if(f==NULL) { QMessageBox::warning(this,tr("File Error"), - tr("Unable to write file \""+filename+"\".")); + tr("Unable to write file")+" \""+filename+"\"."); return; } QDateTime dt=QDateTime(QDate::currentDate(),QTime::currentTime()); fprintf(f,"Rivendell Duplicate Cart Title List\n"); fprintf(f,"Generated %s\n", - (const char *)dt.toString("hh:mm:ss - MM/dd/yyyy")); + dt.toString("hh:mm:ss - MM/dd/yyyy").toUtf8().constData()); fprintf(f,"\n"); fprintf(f,"Cart Title\n"); fprintf(f,"---- -----\n"); diff --git a/rdadmin/edit_system.h b/rdadmin/edit_system.h index 52c3c149..e5b876ae 100644 --- a/rdadmin/edit_system.h +++ b/rdadmin/edit_system.h @@ -22,13 +22,13 @@ #define EDIT_SYSTEM_H #include -#include #include #include #include #include #include +#include #include #include #include @@ -74,7 +74,7 @@ class EditSystem : public RDDialog QLabel *edit_origin_email_addr_label; QLineEdit *edit_origin_email_addr_edit; QLabel *edit_temp_cart_group_label; - QComboBox *edit_temp_cart_group_box; + RDComboBox *edit_temp_cart_group_box; RDGroupListModel *edit_temp_cart_group_model; QComboBox *edit_rss_processor_station_box; QLabel *edit_show_user_list_label; diff --git a/rdadmin/edit_ttys.cpp b/rdadmin/edit_ttys.cpp index f94c464c..85c82306 100644 --- a/rdadmin/edit_ttys.cpp +++ b/rdadmin/edit_ttys.cpp @@ -2,7 +2,7 @@ // // Edit a Rivendell TTY Configuration // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include +#include #include #include @@ -59,9 +59,8 @@ EditTtys::EditTtys(QString station,QWidget *parent) // edit_port_box=new QComboBox(this); edit_port_box->setGeometry(75,10,100,24); - edit_port_box->setInsertionPolicy(QComboBox::NoInsertion); connect(edit_port_box,SIGNAL(activated(int)),this,SLOT(idSelectedData())); - QLabel *label=new QLabel(edit_port_box,tr("Port ID:"),this); + QLabel *label=new QLabel(tr("Port ID:"),this); label->setGeometry(10,10,60,24); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -73,7 +72,7 @@ EditTtys::EditTtys(QString station,QWidget *parent) edit_enable_button->setGeometry(265,14,15,15); connect(edit_enable_button,SIGNAL(stateChanged(int)), this,SLOT(enableButtonData(int))); - label=new QLabel(edit_enable_button,tr("Enabled"),this); + label=new QLabel(tr("Enabled"),this); label->setGeometry(200,10,60,22); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -84,7 +83,7 @@ EditTtys::EditTtys(QString station,QWidget *parent) edit_port_edit=new QLineEdit(this); edit_port_edit->setGeometry(145,54,100,20); edit_port_edit->setValidator(validator); - edit_port_label=new QLabel(edit_port_edit,tr("TTY Device:"),this); + edit_port_label=new QLabel(tr("TTY Device:"),this); edit_port_label->setGeometry(20,54,120,20); edit_port_label->setFont(labelFont()); edit_port_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -94,8 +93,7 @@ EditTtys::EditTtys(QString station,QWidget *parent) // edit_baudrate_box=new QComboBox(this); edit_baudrate_box->setGeometry(145,80,90,24); - edit_baudrate_box->setInsertionPolicy(QComboBox::NoInsertion); - edit_baudrate_label=new QLabel(edit_baudrate_box,tr("Baud Rate:"),this); + edit_baudrate_label=new QLabel(tr("Baud Rate:"),this); edit_baudrate_label->setGeometry(20,80,120,24); edit_baudrate_label->setFont(labelFont()); edit_baudrate_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -105,8 +103,7 @@ EditTtys::EditTtys(QString station,QWidget *parent) // edit_parity_box=new QComboBox(this); edit_parity_box->setGeometry(145,108,90,24); - edit_parity_box->setInsertionPolicy(QComboBox::NoInsertion); - edit_parity_label=new QLabel(edit_parity_box,tr("Parity:"),this); + edit_parity_label=new QLabel(tr("Parity:"),this); edit_parity_label->setGeometry(20,108,120,24); edit_parity_label->setFont(labelFont()); edit_parity_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -116,8 +113,7 @@ EditTtys::EditTtys(QString station,QWidget *parent) // edit_databits_box=new QComboBox(this); edit_databits_box->setGeometry(145,136,60,24); - edit_databits_box->setInsertionPolicy(QComboBox::NoInsertion); - edit_databits_label=new QLabel(edit_databits_box,tr("Data Bits:"),this); + edit_databits_label=new QLabel(tr("Data Bits:"),this); edit_databits_label->setGeometry(20,136,120,24); edit_databits_label->setFont(labelFont()); edit_databits_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -127,8 +123,7 @@ EditTtys::EditTtys(QString station,QWidget *parent) // edit_stopbits_box=new QComboBox(this); edit_stopbits_box->setGeometry(145,164,60,24); - edit_stopbits_box->setInsertionPolicy(QComboBox::NoInsertion); - edit_stopbits_label=new QLabel(edit_stopbits_box,tr("Stop Bits:"),this); + edit_stopbits_label=new QLabel(tr("Stop Bits:"),this); edit_stopbits_label->setGeometry(20,164,120,24); edit_stopbits_label->setFont(labelFont()); edit_stopbits_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -138,9 +133,7 @@ EditTtys::EditTtys(QString station,QWidget *parent) // edit_termination_box=new QComboBox(this); edit_termination_box->setGeometry(145,192,90,24); - edit_termination_box->setInsertionPolicy(QComboBox::NoInsertion); - edit_termination_label= - new QLabel(edit_termination_box,tr("Terminator:"),this); + edit_termination_label=new QLabel(tr("Terminator:"),this); edit_termination_label->setGeometry(20,192,120,24); edit_termination_label->setFont(labelFont()); edit_termination_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -158,45 +151,46 @@ EditTtys::EditTtys(QString station,QWidget *parent) // Populate Data // for(int i=0;iinsertItem(tr("Serial")+QString().sprintf("%d",i)); + edit_port_box-> + insertItem(edit_port_box->count(),tr("Serial")+QString().sprintf("%d",i)); } - edit_baudrate_box->insertItem("50"); - edit_baudrate_box->insertItem("75"); - edit_baudrate_box->insertItem("110"); - edit_baudrate_box->insertItem("134"); - edit_baudrate_box->insertItem("150"); - edit_baudrate_box->insertItem("200"); - edit_baudrate_box->insertItem("300"); - edit_baudrate_box->insertItem("600"); - edit_baudrate_box->insertItem("1200"); - edit_baudrate_box->insertItem("1800"); - edit_baudrate_box->insertItem("2400"); - edit_baudrate_box->insertItem("4800"); - edit_baudrate_box->insertItem("9600"); - edit_baudrate_box->insertItem("19200"); - edit_baudrate_box->insertItem("38400"); - edit_baudrate_box->insertItem("57600"); - edit_baudrate_box->insertItem("115200"); - edit_baudrate_box->insertItem("230400"); + edit_baudrate_box->insertItem(0,"50"); + edit_baudrate_box->insertItem(1,"75"); + edit_baudrate_box->insertItem(2,"110"); + edit_baudrate_box->insertItem(3,"134"); + edit_baudrate_box->insertItem(4,"150"); + edit_baudrate_box->insertItem(5,"200"); + edit_baudrate_box->insertItem(6,"300"); + edit_baudrate_box->insertItem(7,"600"); + edit_baudrate_box->insertItem(8,"1200"); + edit_baudrate_box->insertItem(9,"1800"); + edit_baudrate_box->insertItem(10,"2400"); + edit_baudrate_box->insertItem(11,"4800"); + edit_baudrate_box->insertItem(12,"9600"); + edit_baudrate_box->insertItem(13,"19200"); + edit_baudrate_box->insertItem(14,"38400"); + edit_baudrate_box->insertItem(15,"57600"); + edit_baudrate_box->insertItem(16,"115200"); + edit_baudrate_box->insertItem(17,"230400"); - edit_parity_box->insertItem(tr("None")); - edit_parity_box->insertItem(tr("Even")); - edit_parity_box->insertItem(tr("Odd")); + edit_parity_box->insertItem(0,tr("None")); + edit_parity_box->insertItem(1,tr("Even")); + edit_parity_box->insertItem(2,tr("Odd")); - edit_databits_box->insertItem("5"); - edit_databits_box->insertItem("6"); - edit_databits_box->insertItem("7"); - edit_databits_box->insertItem("8"); + edit_databits_box->insertItem(0,"5"); + edit_databits_box->insertItem(1,"6"); + edit_databits_box->insertItem(2,"7"); + edit_databits_box->insertItem(3,"8"); - edit_stopbits_box->insertItem("1"); - edit_stopbits_box->insertItem("2"); + edit_stopbits_box->insertItem(0,"1"); + edit_stopbits_box->insertItem(1,"2"); - edit_termination_box->insertItem(tr("None")); - edit_termination_box->insertItem(tr("CR")); - edit_termination_box->insertItem(tr("LF")); - edit_termination_box->insertItem(tr("CR/LF")); + edit_termination_box->insertItem(0,tr("None")); + edit_termination_box->insertItem(1,tr("CR")); + edit_termination_box->insertItem(2,tr("LF")); + edit_termination_box->insertItem(3,tr("CR/LF")); - edit_id=edit_port_box->currentItem(); + edit_id=edit_port_box->currentIndex(); edit_tty=NULL; ReadRecord(edit_id); } @@ -235,7 +229,7 @@ QSizePolicy EditTtys::sizePolicy() const void EditTtys::idSelectedData() { WriteRecord(edit_id); - edit_id=edit_port_box->currentItem(); + edit_id=edit_port_box->currentIndex(); ReadRecord(edit_id); } @@ -326,85 +320,85 @@ void EditTtys::ReadRecord(int id) edit_port_edit->setText(edit_tty->port()); switch(edit_tty->baudRate()) { case 50: - edit_baudrate_box->setCurrentItem(0); + edit_baudrate_box->setCurrentIndex(0); break; case 75: - edit_baudrate_box->setCurrentItem(1); + edit_baudrate_box->setCurrentIndex(1); break; case 110: - edit_baudrate_box->setCurrentItem(2); + edit_baudrate_box->setCurrentIndex(2); break; case 134: - edit_baudrate_box->setCurrentItem(3); + edit_baudrate_box->setCurrentIndex(3); break; case 150: - edit_baudrate_box->setCurrentItem(4); + edit_baudrate_box->setCurrentIndex(4); break; case 200: - edit_baudrate_box->setCurrentItem(5); + edit_baudrate_box->setCurrentIndex(5); break; case 300: - edit_baudrate_box->setCurrentItem(6); + edit_baudrate_box->setCurrentIndex(6); break; case 600: - edit_baudrate_box->setCurrentItem(7); + edit_baudrate_box->setCurrentIndex(7); break; case 1200: - edit_baudrate_box->setCurrentItem(8); + edit_baudrate_box->setCurrentIndex(8); break; case 1800: - edit_baudrate_box->setCurrentItem(9); + edit_baudrate_box->setCurrentIndex(9); break; case 2400: - edit_baudrate_box->setCurrentItem(10); + edit_baudrate_box->setCurrentIndex(10); break; case 4800: - edit_baudrate_box->setCurrentItem(11); + edit_baudrate_box->setCurrentIndex(11); break; case 9600: - edit_baudrate_box->setCurrentItem(12); + edit_baudrate_box->setCurrentIndex(12); break; case 19200: - edit_baudrate_box->setCurrentItem(13); + edit_baudrate_box->setCurrentIndex(13); break; case 38400: - edit_baudrate_box->setCurrentItem(14); + edit_baudrate_box->setCurrentIndex(14); break; case 57600: - edit_baudrate_box->setCurrentItem(15); + edit_baudrate_box->setCurrentIndex(15); break; case 115200: - edit_baudrate_box->setCurrentItem(16); + edit_baudrate_box->setCurrentIndex(16); break; case 230400: - edit_baudrate_box->setCurrentItem(17); + edit_baudrate_box->setCurrentIndex(17); break; default: - edit_baudrate_box->setCurrentItem(12); + edit_baudrate_box->setCurrentIndex(12); break; } - edit_parity_box->setCurrentItem(edit_tty->parity()); - edit_databits_box->setCurrentItem(edit_tty->dataBits()-5); - edit_stopbits_box->setCurrentItem(edit_tty->stopBits()-1); - edit_termination_box->setCurrentItem(edit_tty->termination()); + edit_parity_box->setCurrentIndex(edit_tty->parity()); + edit_databits_box->setCurrentIndex(edit_tty->dataBits()-5); + edit_stopbits_box->setCurrentIndex(edit_tty->stopBits()-1); + edit_termination_box->setCurrentIndex(edit_tty->termination()); edit_enable_button->setChecked(edit_tty->active()); SetEnable(edit_tty->active()); } @@ -416,13 +410,13 @@ void EditTtys::WriteRecord(int id) edit_tty->setActive(edit_enable_button->isChecked()); edit_tty->setPort(edit_port_edit->text()); - sscanf((const char *)edit_baudrate_box->currentText(),"%d",&baud); + baud=edit_baudrate_box->currentText().toInt(); edit_tty->setBaudRate(baud); - edit_tty->setParity((RDTTYDevice::Parity)edit_parity_box->currentItem()); - edit_tty->setDataBits(edit_databits_box->currentItem()+5); - edit_tty->setStopBits(edit_stopbits_box->currentItem()+1); + edit_tty->setParity((RDTTYDevice::Parity)edit_parity_box->currentIndex()); + edit_tty->setDataBits(edit_databits_box->currentIndex()+5); + edit_tty->setStopBits(edit_stopbits_box->currentIndex()+1); edit_tty-> - setTermination((RDTty::Termination)edit_termination_box->currentItem()); + setTermination((RDTty::Termination)edit_termination_box->currentIndex()); edit_port_modified[id]=true; } diff --git a/rdadmin/edit_user.cpp b/rdadmin/edit_user.cpp index 458ba39c..5f7ef82c 100644 --- a/rdadmin/edit_user.cpp +++ b/rdadmin/edit_user.cpp @@ -2,7 +2,7 @@ // // Edit a Rivendell User // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -53,7 +53,7 @@ EditUser::EditUser(const QString &user,QWidget *parent) user_name_edit->setGeometry(130,11,sizeHint().width()-140,19); user_name_edit->setMaxLength(191); user_name_edit->setValidator(validator); - QLabel *user_name_label=new QLabel(user_name_edit,tr("&User Name:"),this); + QLabel *user_name_label=new QLabel(tr("&User Name:"),this); user_name_label->setGeometry(5,11,120,19); user_name_label->setFont(labelFont()); user_name_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -65,8 +65,7 @@ EditUser::EditUser(const QString &user,QWidget *parent) user_full_name_edit->setGeometry(130,32,sizeHint().width()-140,19); user_full_name_edit->setMaxLength(191); user_full_name_edit->setValidator(validator); - QLabel *user_full_name_label= - new QLabel(user_full_name_edit,tr("&Full Name:"),this); + QLabel *user_full_name_label=new QLabel(tr("&Full Name:"),this); user_full_name_label->setGeometry(10,32,115,19); user_full_name_label->setFont(labelFont()); user_full_name_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -78,8 +77,7 @@ EditUser::EditUser(const QString &user,QWidget *parent) user_description_edit->setGeometry(130,53,sizeHint().width()-140,19); user_description_edit->setMaxLength(191); user_description_edit->setValidator(validator); - QLabel *user_description_label= - new QLabel(user_description_edit,tr("&Description:"),this); + QLabel *user_description_label=new QLabel(tr("&Description:"),this); user_description_label->setGeometry(5,53,120,19); user_description_label->setFont(labelFont()); user_description_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -91,8 +89,7 @@ EditUser::EditUser(const QString &user,QWidget *parent) user_email_address_edit->setGeometry(130,74,sizeHint().width()-140,19); user_email_address_edit->setMaxLength(191); user_email_address_edit->setValidator(validator); - QLabel *user_email_address_label= - new QLabel(user_email_address_edit,tr("E-Mail Address")+":",this); + QLabel *user_email_address_label=new QLabel(tr("E-Mail Address")+":",this); user_email_address_label->setGeometry(5,74,120,19); user_email_address_label->setFont(labelFont()); user_email_address_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -104,7 +101,7 @@ EditUser::EditUser(const QString &user,QWidget *parent) user_phone_edit->setGeometry(130,95,sizeHint().width()-140,19); user_phone_edit->setMaxLength(20); user_phone_edit->setValidator(validator); - QLabel *user_phone_label=new QLabel(user_phone_edit,tr("&Phone:"),this); + QLabel *user_phone_label=new QLabel(tr("&Phone:"),this); user_phone_label->setGeometry(10,95,115,19); user_phone_label->setFont(labelFont()); user_phone_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -116,8 +113,7 @@ EditUser::EditUser(const QString &user,QWidget *parent) user_localauth_check->setGeometry(20,118,15,15); connect(user_localauth_check,SIGNAL(toggled(bool)), this,SLOT(localAuthToggledData(bool))); - user_localauth_label=new QLabel(user_localauth_check, - tr("Authenticate This User Locally"),this); + user_localauth_label=new QLabel(tr("Authenticate This User Locally"),this); user_localauth_label->setGeometry(40,116,200,19); user_localauth_label->setFont(labelFont()); user_localauth_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -128,8 +124,7 @@ EditUser::EditUser(const QString &user,QWidget *parent) user_pamservice_edit=new QLineEdit(this); user_pamservice_edit->setGeometry(130,140,140,19); user_pamservice_edit->setMaxLength(32); - user_pamservice_label= - new QLabel(user_pamservice_edit,tr("PAM Service")+":",this); + user_pamservice_label=new QLabel(tr("PAM Service")+":",this); user_pamservice_label->setGeometry(10,140,115,19); user_pamservice_label->setFont(labelFont()); user_pamservice_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -150,8 +145,7 @@ EditUser::EditUser(const QString &user,QWidget *parent) user_webapi_auth_spin->setGeometry(130,162,80,19); user_webapi_auth_spin->setRange(0,86400); user_webapi_auth_spin->setSpecialValueText(tr("Disabled")); - QLabel *user_webapi_auth_label= - new QLabel(user_webapi_auth_spin,tr("WebAPI Timeout:"),this); + QLabel *user_webapi_auth_label=new QLabel(tr("WebAPI Timeout:"),this); user_webapi_auth_label->setGeometry(10,162,115,19); user_webapi_auth_label->setFont(labelFont()); user_webapi_auth_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -167,10 +161,7 @@ EditUser::EditUser(const QString &user,QWidget *parent) user_admin_config_button->setGeometry(10,21,15,15); connect(user_admin_config_button,SIGNAL(toggled(bool)), this,SLOT(adminConfigToggledData(bool))); - user_admin_config_label= - new QLabel(user_admin_config_button,tr("Administer S&ystem"), - user_admin_group); - // user_admin_config_label->setGeometry(192,21,150,19); + user_admin_config_label=new QLabel(tr("Administer S&ystem"),user_admin_group); user_admin_config_label->setGeometry(30,21,150,19); user_admin_config_label->setFont(subLabelFont()); user_admin_config_label->setAlignment(Qt::AlignLeft); @@ -180,10 +171,8 @@ EditUser::EditUser(const QString &user,QWidget *parent) connect(user_admin_rss_button,SIGNAL(toggled(bool)), this,SLOT(adminRssToggledData(bool))); user_admin_rss_label= - new QLabel(user_admin_rss_button,tr("Administer RSS Feeds"), - user_admin_group); + new QLabel(tr("Administer RSS Feeds"),user_admin_group); user_admin_rss_label->setGeometry(192,21,150,19); - // user_admin_rss_label->setGeometry(30,21,150,19); user_admin_rss_label->setFont(subLabelFont()); user_admin_rss_label->setAlignment(Qt::AlignLeft); @@ -196,32 +185,28 @@ EditUser::EditUser(const QString &user,QWidget *parent) user_create_carts_button=new QCheckBox(user_prod_group); user_create_carts_button->setGeometry(10,21,15,15); - user_create_carts_label= - new QLabel(user_create_carts_button,tr("&Create Carts"),user_prod_group); + user_create_carts_label=new QLabel(tr("&Create Carts"),user_prod_group); user_create_carts_label->setGeometry(30,21,150,19); user_create_carts_label->setFont(subLabelFont()); user_create_carts_label->setAlignment(Qt::AlignLeft); user_delete_carts_button=new QCheckBox(user_prod_group); user_delete_carts_button->setGeometry(172,21,15,15); - user_delete_carts_label= - new QLabel(user_delete_carts_button,tr("&Delete Carts"),user_prod_group); + user_delete_carts_label=new QLabel(tr("&Delete Carts"),user_prod_group); user_delete_carts_label->setGeometry(192,21,150,19); user_delete_carts_label->setFont(subLabelFont()); user_delete_carts_label->setAlignment(Qt::AlignLeft); user_modify_carts_button=new QCheckBox(user_prod_group); user_modify_carts_button->setGeometry(10,42,15,15); - user_modify_carts_label= - new QLabel(user_modify_carts_button,tr("&Modify Carts"),user_prod_group); + user_modify_carts_label=new QLabel(tr("&Modify Carts"),user_prod_group); user_modify_carts_label->setGeometry(30,41,150,19); user_modify_carts_label->setFont(subLabelFont()); user_modify_carts_label->setAlignment(Qt::AlignLeft); user_edit_audio_button=new QCheckBox(user_prod_group); user_edit_audio_button->setGeometry(10,63,15,15); - user_edit_audio_label= - new QLabel(user_edit_audio_button,tr("&Edit Audio"),user_prod_group); + user_edit_audio_label=new QLabel(tr("&Edit Audio"),user_prod_group); user_edit_audio_label->setGeometry(30,62,150,19); user_edit_audio_label->setFont(subLabelFont()); user_edit_audio_label->setAlignment(Qt::AlignLeft); @@ -229,8 +214,7 @@ EditUser::EditUser(const QString &user,QWidget *parent) user_webget_login_button=new QCheckBox(user_prod_group); user_webget_login_button->setGeometry(10,84,15,15); user_webget_login_label= - new QLabel(user_webget_login_button,tr("Allow &WebGet Login"), - user_prod_group); + new QLabel(tr("Allow &WebGet Login"),user_prod_group); user_webget_login_label->setGeometry(30,83,150,19); user_webget_login_label->setFont(subLabelFont()); user_webget_login_label->setAlignment(Qt::AlignLeft); @@ -238,17 +222,14 @@ EditUser::EditUser(const QString &user,QWidget *parent) user_edit_catches_button=new QCheckBox(user_prod_group); user_edit_catches_button->setGeometry(172,42,15,15); user_edit_catches_label= - new QLabel(user_edit_catches_button,tr("&Edit Netcatch Schedule"), - user_prod_group); + new QLabel(tr("&Edit Netcatch Schedule"),user_prod_group); user_edit_catches_label->setGeometry(192,41,150,19); user_edit_catches_label->setFont(subLabelFont()); user_edit_catches_label->setAlignment(Qt::AlignLeft); user_voicetrack_log_button=new QCheckBox(user_prod_group); user_voicetrack_log_button->setGeometry(172,63,15,15); - user_voicetrack_log_label= - new QLabel(user_voicetrack_log_button,tr("&Voicetrack Logs"), - user_prod_group); + user_voicetrack_log_label=new QLabel(tr("&Voicetrack Logs"),user_prod_group); user_voicetrack_log_label->setGeometry(192,62,150,19); user_voicetrack_log_label->setFont(subLabelFont()); user_voicetrack_log_label->setAlignment(Qt::AlignLeft); @@ -262,16 +243,14 @@ EditUser::EditUser(const QString &user,QWidget *parent) user_create_log_button=new QCheckBox(user_traffic_group); user_create_log_button->setGeometry(10,21,15,15); - user_create_log_label= - new QLabel(user_create_log_button,tr("Create &Log"),user_traffic_group); + user_create_log_label=new QLabel(tr("Create &Log"),user_traffic_group); user_create_log_label->setGeometry(30,21,150,19); user_create_log_label->setFont(subLabelFont()); user_create_log_label->setAlignment(Qt::AlignLeft); user_delete_log_button=new QCheckBox(user_traffic_group); user_delete_log_button->setGeometry(172,21,15,15); - user_delete_log_label= - new QLabel(user_delete_log_button,tr("De&lete Log"),user_traffic_group); + user_delete_log_label=new QLabel(tr("De&lete Log"),user_traffic_group); user_delete_log_label->setGeometry(192,21,150,19); user_delete_log_label->setFont(subLabelFont()); user_delete_log_label->setAlignment(Qt::AlignLeft); @@ -279,8 +258,7 @@ EditUser::EditUser(const QString &user,QWidget *parent) user_delete_rec_button=new QCheckBox(user_traffic_group); user_delete_rec_button->setGeometry(172,42,15,15); user_delete_rec_label= - new QLabel(user_delete_rec_button,tr("Delete &Report Data"), - user_traffic_group); + new QLabel(tr("Delete &Report Data"),user_traffic_group); user_delete_rec_label->setGeometry(192,42,150,19); user_delete_rec_label->setFont(subLabelFont()); user_delete_rec_label->setAlignment(Qt::AlignLeft); @@ -288,8 +266,7 @@ EditUser::EditUser(const QString &user,QWidget *parent) user_modify_template_button=new QCheckBox(user_traffic_group); user_modify_template_button->setGeometry(10,42,15,15); user_modify_template_label= - new QLabel(user_modify_template_button,tr("&Modify Template"), - user_traffic_group); + new QLabel(tr("&Modify Template"),user_traffic_group); user_modify_template_label->setGeometry(30,42,100,19); user_modify_template_label->setFont(subLabelFont()); user_modify_template_label->setAlignment(Qt::AlignLeft); @@ -303,8 +280,7 @@ EditUser::EditUser(const QString &user,QWidget *parent) user_playout_log_button=new QCheckBox(user_onair_group); user_playout_log_button->setGeometry(10,21,15,15); - user_playout_log_label= - new QLabel(user_playout_log_button,tr("&Playout Logs"),user_onair_group); + user_playout_log_label=new QLabel(tr("&Playout Logs"),user_onair_group); user_playout_log_label->setGeometry(30,21,150,19); user_playout_log_label->setFont(subLabelFont()); user_playout_log_label->setAlignment(Qt::AlignLeft); @@ -312,16 +288,14 @@ EditUser::EditUser(const QString &user,QWidget *parent) user_arrange_log_button=new QCheckBox(user_onair_group); user_arrange_log_button->setGeometry(172,21,15,15); user_arrange_log_label= - new QLabel(user_arrange_log_button,tr("&Rearrange Log Items"), - user_onair_group); + new QLabel(tr("&Rearrange Log Items"),user_onair_group); user_arrange_log_label->setGeometry(192,21,150,19); user_arrange_log_label->setFont(subLabelFont()); user_arrange_log_label->setAlignment(Qt::AlignLeft); user_addto_log_button=new QCheckBox(user_onair_group); user_addto_log_button->setGeometry(10,42,15,15); - user_addto_log_label= - new QLabel(user_addto_log_button,tr("Add Log &Items"),user_onair_group); + user_addto_log_label=new QLabel(tr("Add Log &Items"),user_onair_group); user_addto_log_label->setGeometry(30,42,150,19); user_addto_log_label->setFont(subLabelFont()); user_addto_log_label->setAlignment(Qt::AlignLeft); @@ -329,8 +303,7 @@ EditUser::EditUser(const QString &user,QWidget *parent) user_removefrom_log_button=new QCheckBox(user_onair_group); user_removefrom_log_button->setGeometry(172,42,15,15); user_removefrom_log_label= - new QLabel(user_removefrom_log_button,tr("Delete Lo&g Items"), - user_onair_group); + new QLabel(tr("Delete Lo&g Items"),user_onair_group); user_removefrom_log_label->setGeometry(192,42,150,19); user_removefrom_log_label->setFont(subLabelFont()); user_removefrom_log_label->setAlignment(Qt::AlignLeft); @@ -338,8 +311,7 @@ EditUser::EditUser(const QString &user,QWidget *parent) user_config_panels_button=new QCheckBox(user_onair_group); user_config_panels_button->setGeometry(10,63,15,15); user_config_panels_label= - new QLabel(user_config_panels_button,tr("Configure System Panels"), - user_onair_group); + new QLabel(tr("Configure System Panels"),user_onair_group); user_config_panels_label->setGeometry(30,63,150,19); user_config_panels_label->setFont(subLabelFont()); user_config_panels_label->setAlignment(Qt::AlignLeft); @@ -353,17 +325,14 @@ EditUser::EditUser(const QString &user,QWidget *parent) user_add_podcast_button=new QCheckBox(user_podcast_group); user_add_podcast_button->setGeometry(10,21,15,15); - user_add_podcast_label= - new QLabel(user_add_podcast_button,tr("Cre&ate Podcast"), - user_podcast_group); + user_add_podcast_label=new QLabel(tr("Cre&ate Podcast"),user_podcast_group); user_add_podcast_label->setGeometry(30,21,150,19); user_add_podcast_label->setFont(subLabelFont()); user_add_podcast_label->setAlignment(Qt::AlignLeft); user_edit_podcast_button=new QCheckBox(user_podcast_group); user_edit_podcast_button->setGeometry(172,21,15,15); - user_edit_podcast_label= - new QLabel(user_edit_podcast_button,tr("E&dit Podcast"),user_podcast_group); + user_edit_podcast_label=new QLabel(tr("E&dit Podcast"),user_podcast_group); user_edit_podcast_label->setGeometry(192,21,150,19); user_edit_podcast_label->setFont(subLabelFont()); user_edit_podcast_label->setAlignment(Qt::AlignLeft); @@ -371,16 +340,14 @@ EditUser::EditUser(const QString &user,QWidget *parent) user_delete_podcast_button=new QCheckBox(user_podcast_group); user_delete_podcast_button->setGeometry(10,42,15,15); user_delete_podcast_label= - new QLabel(user_delete_podcast_button,tr("Dele&te Podcast"), - user_podcast_group); + new QLabel(tr("Dele&te Podcast"),user_podcast_group); user_delete_podcast_label->setGeometry(30,42,150,19); user_delete_podcast_label->setFont(subLabelFont()); user_delete_podcast_label->setAlignment(Qt::AlignLeft); user_web_box=new QCheckBox(user_podcast_group); user_web_box->setGeometry(172,42,15,15); - user_web_label=new QLabel(user_web_box,tr("Allow Web Login"), - user_podcast_group); + user_web_label=new QLabel(tr("Allow Web Login"),user_podcast_group); user_web_label->setGeometry(192,42,150,19); user_web_label->setFont(subLabelFont()); user_web_label->setAlignment(Qt::AlignLeft); diff --git a/rdadmin/edit_vguest_resource.cpp b/rdadmin/edit_vguest_resource.cpp index 51015287..05696188 100644 --- a/rdadmin/edit_vguest_resource.cpp +++ b/rdadmin/edit_vguest_resource.cpp @@ -38,7 +38,7 @@ EditVguestResource::EditVguestResource(QWidget *parent) // edit_enginenum_edit=new QLineEdit(this); edit_enginenum_edit->setGeometry(135,10,50,20); - QLabel *label=new QLabel(edit_enginenum_edit,tr("Engine")+":",this); + QLabel *label=new QLabel(tr("Engine")+":",this); label->setGeometry(10,10,120,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -48,7 +48,7 @@ EditVguestResource::EditVguestResource(QWidget *parent) // edit_devicenum_edit=new QLineEdit(this); edit_devicenum_edit->setGeometry(135,36,50,20); - label=new QLabel(edit_devicenum_edit,tr("Device (Hex): "),this); + label=new QLabel(tr("Device (Hex): "),this); label->setGeometry(10,36,120,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -58,7 +58,7 @@ EditVguestResource::EditVguestResource(QWidget *parent) // edit_surfacenum_edit=new QLineEdit(this); edit_surfacenum_edit->setGeometry(135,62,50,20); - label=new QLabel(edit_surfacenum_edit,tr("Surface")+":",this); + label=new QLabel(tr("Surface")+":",this); label->setGeometry(10,62,120,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -68,8 +68,7 @@ EditVguestResource::EditVguestResource(QWidget *parent) // edit_relaynum_edit=new QLineEdit(this); edit_relaynum_edit->setGeometry(135,88,50,20); - edit_relaynum_label= - new QLabel(edit_relaynum_edit,tr("Bus/Relay")+":",this); + edit_relaynum_label=new QLabel(tr("Bus/Relay")+":",this); edit_relaynum_label->setGeometry(10,88,120,20); edit_relaynum_label->setFont(labelFont()); edit_relaynum_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); diff --git a/rdadmin/help_audios.cpp b/rdadmin/help_audios.cpp index f3417d55..99a93479 100644 --- a/rdadmin/help_audios.cpp +++ b/rdadmin/help_audios.cpp @@ -37,7 +37,7 @@ HelpAudioPorts::HelpAudioPorts(QWidget *parent) help_edit=new QTextEdit(this); help_edit-> setGeometry(10,10,sizeHint().width()-20,sizeHint().height()-80); - help_edit->setTextFormat(Qt::RichText); + help_edit->setAcceptRichText(true); help_edit->setReadOnly(true); // FIXME: add context sensitive help for other options on the Audio Port screen. help_edit->setText(tr("Mode - short for Channel Mode, configures the Left and Right behaviour when recording.
\ diff --git a/rdadmin/importfields.cpp b/rdadmin/importfields.cpp index 401b6e02..590c1e26 100644 --- a/rdadmin/importfields.cpp +++ b/rdadmin/importfields.cpp @@ -2,7 +2,7 @@ // // Import Parser Parameters for RDAdmin. // -// (C) Copyright 2010-2019 Fred Gleason +// (C) Copyright 2010-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -20,7 +20,7 @@ #include -#include +#include "importfields.h" ImportFields::ImportFields(QWidget *parent) : RDWidget(parent) @@ -33,7 +33,7 @@ ImportFields::ImportFields(QWidget *parent) // label=new QLabel(tr("Cart Number:"),this); label->setGeometry(0,0,125,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Traffic Cart Offset @@ -41,9 +41,9 @@ ImportFields::ImportFields(QWidget *parent) cart_offset_spin=new QSpinBox(this); cart_offset_spin->setGeometry(175,0,50,19); cart_offset_spin->setRange(0,1024); - label=new QLabel(cart_offset_spin,tr("Offset:"),this); + label=new QLabel(tr("Offset:"),this); label->setGeometry(125,0,45,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(cart_offset_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); @@ -53,9 +53,9 @@ ImportFields::ImportFields(QWidget *parent) cart_length_spin=new QSpinBox(this); cart_length_spin->setGeometry(285,0,50,19); cart_length_spin->setRange(0,6); - label=new QLabel(cart_length_spin,tr("Length:"),this); + label=new QLabel(tr("Length:"),this); label->setGeometry(230,0,50,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(cart_length_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); @@ -64,7 +64,7 @@ ImportFields::ImportFields(QWidget *parent) // label=new QLabel(tr("Title:"),this); label->setGeometry(0,21,125,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Title Cart Offset @@ -72,9 +72,9 @@ ImportFields::ImportFields(QWidget *parent) title_offset_spin=new QSpinBox(this); title_offset_spin->setGeometry(175,21,50,19); title_offset_spin->setRange(0,1024); - label=new QLabel(title_offset_spin,tr("Offset:"),this); + label=new QLabel(tr("Offset:"),this); label->setGeometry(125,21,45,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(title_offset_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); @@ -84,9 +84,9 @@ ImportFields::ImportFields(QWidget *parent) title_length_spin=new QSpinBox(this); title_length_spin->setGeometry(285,21,50,19); title_length_spin->setRange(0,255); - label=new QLabel(title_length_spin,tr("Length:"),this); + label=new QLabel(tr("Length:"),this); label->setGeometry(230,21,50,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(title_length_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); @@ -95,7 +95,7 @@ ImportFields::ImportFields(QWidget *parent) // label=new QLabel(tr("Start Time - Hours:"),this); label->setGeometry(0,42,125,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Traffic Start Hours Offset @@ -103,9 +103,9 @@ ImportFields::ImportFields(QWidget *parent) hours_offset_spin=new QSpinBox(this); hours_offset_spin->setGeometry(175,42,50,19); hours_offset_spin->setRange(0,RD_MAX_IMPORT_LINE_LENGTH); - label=new QLabel(hours_offset_spin,tr("Offset:"),this); + label=new QLabel(tr("Offset:"),this); label->setGeometry(125,42,45,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(hours_offset_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); @@ -115,9 +115,9 @@ ImportFields::ImportFields(QWidget *parent) hours_length_spin=new QSpinBox(this); hours_length_spin->setGeometry(285,42,50,19); hours_length_spin->setRange(0,8); - label=new QLabel(hours_length_spin,tr("Length:"),this); + label=new QLabel(tr("Length:"),this); label->setGeometry(230,42,50,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(hours_length_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); @@ -126,7 +126,7 @@ ImportFields::ImportFields(QWidget *parent) // label=new QLabel(tr("Start Time - Minutes:"),this); label->setGeometry(0,63,125,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Traffic Start Minutes Offset @@ -134,9 +134,9 @@ ImportFields::ImportFields(QWidget *parent) minutes_offset_spin=new QSpinBox(this); minutes_offset_spin->setGeometry(175,63,50,19); minutes_offset_spin->setRange(0,RD_MAX_IMPORT_LINE_LENGTH); - label=new QLabel(minutes_offset_spin,tr("Offset:"),this); + label=new QLabel(tr("Offset:"),this); label->setGeometry(125,63,45,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(minutes_offset_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); @@ -146,9 +146,9 @@ ImportFields::ImportFields(QWidget *parent) minutes_length_spin=new QSpinBox(this); minutes_length_spin->setGeometry(285,63,50,19); minutes_length_spin->setRange(0,8); - label=new QLabel(minutes_length_spin,tr("Length:"),this); + label=new QLabel(tr("Length:"),this); label->setGeometry(230,63,50,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(minutes_length_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); @@ -157,7 +157,7 @@ ImportFields::ImportFields(QWidget *parent) // label=new QLabel(tr("Start Time - Seconds:"),this); label->setGeometry(0,84,125,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Traffic Start Seconds Offset @@ -165,9 +165,9 @@ ImportFields::ImportFields(QWidget *parent) seconds_offset_spin=new QSpinBox(this); seconds_offset_spin->setGeometry(175,84,50,19); seconds_offset_spin->setRange(0,RD_MAX_IMPORT_LINE_LENGTH); - label=new QLabel(seconds_offset_spin,tr("Offset:"),this); + label=new QLabel(tr("Offset:"),this); label->setGeometry(125,84,45,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(seconds_offset_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); @@ -177,9 +177,9 @@ ImportFields::ImportFields(QWidget *parent) seconds_length_spin=new QSpinBox(this); seconds_length_spin->setGeometry(285,84,50,19); seconds_length_spin->setRange(0,8); - label=new QLabel(seconds_length_spin,tr("Length:"),this); + label=new QLabel(tr("Length:"),this); label->setGeometry(230,84,50,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(seconds_length_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); @@ -188,7 +188,7 @@ ImportFields::ImportFields(QWidget *parent) // label=new QLabel(tr("Length - Hours:"),this); label->setGeometry(0,106,125,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Traffic Length Hours Offset @@ -196,9 +196,9 @@ ImportFields::ImportFields(QWidget *parent) len_hours_offset_spin=new QSpinBox(this); len_hours_offset_spin->setGeometry(175,106,50,19); len_hours_offset_spin->setRange(0,RD_MAX_IMPORT_LINE_LENGTH); - label=new QLabel(len_hours_offset_spin,tr("Offset:"),this); + label=new QLabel(tr("Offset:"),this); label->setGeometry(125,106,45,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(len_hours_offset_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); @@ -208,9 +208,9 @@ ImportFields::ImportFields(QWidget *parent) len_hours_length_spin=new QSpinBox(this); len_hours_length_spin->setGeometry(285,106,50,19); len_hours_length_spin->setRange(0,8); - label=new QLabel(len_hours_length_spin,tr("Length:"),this); + label=new QLabel(tr("Length:"),this); label->setGeometry(230,106,50,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(len_hours_length_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); @@ -219,7 +219,7 @@ ImportFields::ImportFields(QWidget *parent) // label=new QLabel(tr("Length - Minutes:"),this); label->setGeometry(0,127,125,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Traffic Length Minutes Offset @@ -227,9 +227,9 @@ ImportFields::ImportFields(QWidget *parent) len_minutes_offset_spin=new QSpinBox(this); len_minutes_offset_spin->setGeometry(175,127,50,19); len_minutes_offset_spin->setRange(0,RD_MAX_IMPORT_LINE_LENGTH); - label=new QLabel(len_minutes_offset_spin,tr("Offset:"),this); + label=new QLabel(tr("Offset:"),this); label->setGeometry(125,127,45,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(len_minutes_offset_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); @@ -239,9 +239,9 @@ ImportFields::ImportFields(QWidget *parent) len_minutes_length_spin=new QSpinBox(this); len_minutes_length_spin->setGeometry(285,127,50,19); len_minutes_length_spin->setRange(0,8); - label=new QLabel(len_minutes_length_spin,tr("Length:"),this); + label=new QLabel(tr("Length:"),this); label->setGeometry(230,127,50,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(len_minutes_length_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); @@ -250,7 +250,7 @@ ImportFields::ImportFields(QWidget *parent) // label=new QLabel(tr("Length - Seconds:"),this); label->setGeometry(0,148,125,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Traffic Length Seconds Offset @@ -258,9 +258,9 @@ ImportFields::ImportFields(QWidget *parent) len_seconds_offset_spin=new QSpinBox(this); len_seconds_offset_spin->setGeometry(175,148,50,19); len_seconds_offset_spin->setRange(0,RD_MAX_IMPORT_LINE_LENGTH); - label=new QLabel(len_seconds_offset_spin,tr("Offset:"),this); + label=new QLabel(tr("Offset:"),this); label->setGeometry(125,148,45,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(len_seconds_offset_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); @@ -270,9 +270,9 @@ ImportFields::ImportFields(QWidget *parent) len_seconds_length_spin=new QSpinBox(this); len_seconds_length_spin->setGeometry(285,148,50,19); len_seconds_length_spin->setRange(0,8); - label=new QLabel(len_seconds_length_spin,tr("Length:"),this); + label=new QLabel(tr("Length:"),this); label->setGeometry(230,148,50,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(len_seconds_length_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); @@ -281,7 +281,7 @@ ImportFields::ImportFields(QWidget *parent) // label=new QLabel(tr("Globally Unique ID:"),this); label->setGeometry(0,169,125,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Traffic Contract # Offset @@ -289,9 +289,9 @@ ImportFields::ImportFields(QWidget *parent) data_offset_spin=new QSpinBox(this); data_offset_spin->setGeometry(175,169,50,19); data_offset_spin->setRange(0,RD_MAX_IMPORT_LINE_LENGTH); - label=new QLabel(data_offset_spin,tr("Offset:"),this); + label=new QLabel(tr("Offset:"),this); label->setGeometry(125,169,45,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(data_offset_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); @@ -301,9 +301,9 @@ ImportFields::ImportFields(QWidget *parent) data_length_spin=new QSpinBox(this); data_length_spin->setGeometry(285,169,50,19); data_length_spin->setRange(0,32); - label=new QLabel(data_length_spin,tr("Length:"),this); + label=new QLabel(tr("Length:"),this); label->setGeometry(230,169,50,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(data_length_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); @@ -312,7 +312,7 @@ ImportFields::ImportFields(QWidget *parent) // label=new QLabel(tr("Event ID:"),this); label->setGeometry(0,190,125,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Traffic Event ID Offset @@ -320,9 +320,9 @@ ImportFields::ImportFields(QWidget *parent) event_id_offset_spin=new QSpinBox(this); event_id_offset_spin->setGeometry(175,190,50,19); event_id_offset_spin->setRange(0,RD_MAX_IMPORT_LINE_LENGTH); - label=new QLabel(event_id_offset_spin,tr("Offset:"),this); + label=new QLabel(tr("Offset:"),this); label->setGeometry(125,190,45,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(event_id_offset_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); @@ -332,9 +332,9 @@ ImportFields::ImportFields(QWidget *parent) event_id_length_spin=new QSpinBox(this); event_id_length_spin->setGeometry(285,190,50,19); event_id_length_spin->setRange(0,8); - label=new QLabel(event_id_length_spin,tr("Length:"),this); + label=new QLabel(tr("Length:"),this); label->setGeometry(230,190,50,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(event_id_length_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); @@ -343,7 +343,7 @@ ImportFields::ImportFields(QWidget *parent) // label=new QLabel(tr("Annc. Type:"),this); label->setGeometry(0,211,125,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Traffic Announcement Type Offset @@ -351,9 +351,9 @@ ImportFields::ImportFields(QWidget *parent) annctype_offset_spin=new QSpinBox(this); annctype_offset_spin->setGeometry(175,211,50,19); annctype_offset_spin->setRange(0,RD_MAX_IMPORT_LINE_LENGTH); - label=new QLabel(annctype_offset_spin,tr("Offset:"),this); + label=new QLabel(tr("Offset:"),this); label->setGeometry(125,211,45,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(annctype_offset_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); @@ -363,9 +363,9 @@ ImportFields::ImportFields(QWidget *parent) annctype_length_spin=new QSpinBox(this); annctype_length_spin->setGeometry(285,211,50,19); annctype_length_spin->setRange(0,8); - label=new QLabel(annctype_length_spin,tr("Length:"),this); + label=new QLabel(tr("Length:"),this); label->setGeometry(230,211,50,19); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(annctype_length_spin,SIGNAL(valueChanged(int)), this,SLOT(valueChangedData(int))); } diff --git a/rdadmin/info_dialog.cpp b/rdadmin/info_dialog.cpp index d130e240..7aeb9ec0 100644 --- a/rdadmin/info_dialog.cpp +++ b/rdadmin/info_dialog.cpp @@ -2,7 +2,7 @@ // // Display System Information for Rivendell // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,10 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include - #include #include @@ -58,7 +54,7 @@ InfoDialog::InfoDialog(QWidget *parent) // // Banners // - QImage *image=new QImage(460,35,16); + QImage *image=new QImage(460,35,QImage::Format_Invalid); image->loadFromData(xpm_info_banner1,strlen((const char *)xpm_info_banner1), "XPM"); QLabel *label=new QLabel(this); diff --git a/rdadmin/license.cpp b/rdadmin/license.cpp index afd1ebc9..a346c427 100644 --- a/rdadmin/license.cpp +++ b/rdadmin/license.cpp @@ -2,7 +2,7 @@ // // Display License Text. // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License @@ -19,8 +19,6 @@ // // -#include - #include "license.h" // @@ -66,13 +64,13 @@ void License::exec(License::Text lic) { switch(lic) { case License::Credits: - license_edit->setTextFormat(Qt::PlainText); + license_edit->setAcceptRichText(false); license_edit->setText(QString::fromUtf8((const char *)global_credits)); setWindowTitle(tr("Rivendell Credits")); break; case License::GplV2: - license_edit->setTextFormat(Qt::RichText); + license_edit->setAcceptRichText(true); license_edit->setText((const char *)global_gpl2); setWindowTitle(tr("GNU Public License v2")); break; diff --git a/rdadmin/list_endpoints.cpp b/rdadmin/list_endpoints.cpp index 26c009d6..639b6216 100644 --- a/rdadmin/list_endpoints.cpp +++ b/rdadmin/list_endpoints.cpp @@ -61,7 +61,7 @@ ListEndpoints::ListEndpoints(RDMatrix *matrix,RDMatrix::Endpoint endpoint, list_list_model->setFont(defaultFont()); list_list_model->setPalette(palette()); list_list_view->setModel(list_list_model); - list_type_label=new QLabel(list_list_view,list_table,this); + list_type_label=new QLabel(list_table,this); list_type_label->setFont(labelFont()); list_type_label->setGeometry(14,5,85,19); connect(list_list_view,SIGNAL(doubleClicked(const QModelIndex &)), diff --git a/rdadmin/list_feeds.cpp b/rdadmin/list_feeds.cpp index 7ad490d8..3796907c 100644 --- a/rdadmin/list_feeds.cpp +++ b/rdadmin/list_feeds.cpp @@ -22,10 +22,8 @@ #include #include -#include -#include -#include -#include +#include +#include #include #include @@ -106,7 +104,7 @@ ListFeeds::ListFeeds(QWidget *parent) list_feeds_model->setPalette(palette()); list_feeds_view->setModel(list_feeds_model); list_feeds_view->setColumnHidden(2,true); - list_box_label=new QLabel(list_feeds_view,tr("Podcast Feeds"),this); + list_box_label=new QLabel(tr("Podcast Feeds"),this); list_box_label->setFont(bigLabelFont()); connect(list_feeds_model,SIGNAL(modelReset()),this,SLOT(resetModelData())); connect(list_feeds_view,SIGNAL(doubleClicked(const QModelIndex &)), diff --git a/rdadmin/list_gpis.cpp b/rdadmin/list_gpis.cpp index 4c010197..c5b192c9 100644 --- a/rdadmin/list_gpis.cpp +++ b/rdadmin/list_gpis.cpp @@ -59,8 +59,7 @@ ListGpis::ListGpis(RDMatrix *matrix,RDMatrix::GpioType type,QWidget *parent) // Gpis List Box // list_list_view=new RDTableView(this); - list_list_label= - new QLabel(list_list_view,list_label,this); + list_list_label=new QLabel(list_label,this); list_list_label->setFont(labelFont()); list_list_model=new RDGpioListModel(matrix,type,this); list_list_model->setFont(defaultFont()); diff --git a/rdadmin/list_hostvars.cpp b/rdadmin/list_hostvars.cpp index 24ad7874..0828fda3 100644 --- a/rdadmin/list_hostvars.cpp +++ b/rdadmin/list_hostvars.cpp @@ -53,8 +53,7 @@ ListHostvars::ListHostvars(QString station,QWidget *parent) list_model->setFont(defaultFont()); list_model->setPalette(palette()); list_view->setModel(list_model); - list_title_label= - new QLabel(list_view,tr("Host Variables")+":",this); + list_title_label=new QLabel(tr("Host Variables")+":",this); list_title_label->setFont(labelFont()); list_title_label->setGeometry(14,5,sizeHint().width()-28,19); connect(list_view,SIGNAL(doubleClicked(const QModelIndex &)), diff --git a/rdadmin/list_matrices.cpp b/rdadmin/list_matrices.cpp index 9d3a7d0b..f16c3cdf 100644 --- a/rdadmin/list_matrices.cpp +++ b/rdadmin/list_matrices.cpp @@ -54,8 +54,7 @@ ListMatrices::ListMatrices(QString station,QWidget *parent) list_model->setFont(defaultFont()); list_model->setPalette(palette()); list_view->setModel(list_model); - list_title_label= - new QLabel(list_view,tr("Switcher/GPIO Devices")+":",this); + list_title_label=new QLabel(tr("Switcher/GPIO Devices")+":",this); list_title_label->setFont(labelFont()); connect(list_view,SIGNAL(doubleClicked(const QModelIndex &)), this,SLOT(doubleClickedData(const QModelIndex &))); diff --git a/rdadmin/list_replicator_carts.cpp b/rdadmin/list_replicator_carts.cpp index f7f418a1..fd76ad19 100644 --- a/rdadmin/list_replicator_carts.cpp +++ b/rdadmin/list_replicator_carts.cpp @@ -68,7 +68,7 @@ ListReplicatorCarts::ListReplicatorCarts(QWidget *parent) connect(list_model,SIGNAL(modelReset()), list_view,SLOT(resizeColumnsToContents())); - QLabel *list_box_label=new QLabel(list_view,tr("&Active Carts:"),this); + QLabel *list_box_label=new QLabel(tr("&Active Carts:"),this); list_box_label->setFont(labelFont()); list_box_label->setGeometry(14,11,85,19); } diff --git a/rdadmin/list_replicators.cpp b/rdadmin/list_replicators.cpp index 9a23ce0e..50e2509b 100644 --- a/rdadmin/list_replicators.cpp +++ b/rdadmin/list_replicators.cpp @@ -87,8 +87,7 @@ ListReplicators::ListReplicators(QWidget *parent) list_replicators_model->setFont(defaultFont()); list_replicators_model->setPalette(palette()); list_replicators_view->setModel(list_replicators_model); - list_replicators_label= - new QLabel(list_replicators_view,tr("&Replicators:"),this); + list_replicators_label=new QLabel(tr("&Replicators:"),this); list_replicators_label->setFont(labelFont()); connect(list_replicators_view,SIGNAL(doubleClicked(const QModelIndex &)), this,SLOT(doubleClickedData(const QModelIndex &))); diff --git a/rdadmin/list_reports.cpp b/rdadmin/list_reports.cpp index 7419ce2d..80911102 100644 --- a/rdadmin/list_reports.cpp +++ b/rdadmin/list_reports.cpp @@ -74,7 +74,7 @@ ListReports::ListReports(QWidget *parent) // Report List Box // list_box=new QListWidget(this); - QLabel *list_box_label=new QLabel(list_box,tr("R&eports:"),this); + QLabel *list_box_label=new QLabel(tr("R&eports:"),this); list_box_label->setFont(labelFont()); list_box_label->setGeometry(14,10,85,19); connect(list_box,SIGNAL(doubleClicked(const QModelIndex &)), diff --git a/rdadmin/list_sas_resources.cpp b/rdadmin/list_sas_resources.cpp index 60880c80..d12f6ccc 100644 --- a/rdadmin/list_sas_resources.cpp +++ b/rdadmin/list_sas_resources.cpp @@ -58,7 +58,7 @@ ListSasResources::ListSasResources(RDMatrix *matrix,int size,QWidget *parent) list_list_model->setFont(defaultFont()); list_list_model->setPalette(palette()); list_list_view->setModel(list_list_model); - list_title_label=new QLabel(list_list_view,tr("SAS Switches"),this); + list_title_label=new QLabel(tr("SAS Switches"),this); list_title_label->setFont(labelFont()); connect(list_list_view,SIGNAL(doubleClicked(const QModelIndex &)), this,SLOT(doubleClickedData(const QModelIndex &))); diff --git a/rdadmin/list_schedcodes.cpp b/rdadmin/list_schedcodes.cpp index 3ff8919a..c5cdbc36 100644 --- a/rdadmin/list_schedcodes.cpp +++ b/rdadmin/list_schedcodes.cpp @@ -87,8 +87,7 @@ ListSchedCodes::ListSchedCodes(QWidget *parent) list_schedcodes_model->setFont(defaultFont()); list_schedcodes_model->setPalette(palette()); list_schedcodes_view->setModel(list_schedcodes_model); - list_schedcodes_label= - new QLabel(list_schedcodes_view,tr("Replicators:"),this); + list_schedcodes_label=new QLabel(tr("Replicators:"),this); list_schedcodes_label->setFont(labelFont()); connect(list_schedcodes_view,SIGNAL(doubleClicked(const QModelIndex &)), this,SLOT(doubleClickedData(const QModelIndex &))); diff --git a/rdadmin/list_stations.cpp b/rdadmin/list_stations.cpp index 072d6c38..b61bc52d 100644 --- a/rdadmin/list_stations.cpp +++ b/rdadmin/list_stations.cpp @@ -75,7 +75,7 @@ ListStations::ListStations(QWidget *parent) // Station List Box // list_stations_view=new RDTableView(this); - list_title_label=new QLabel(list_stations_view,tr("H&osts:"),this); + list_title_label=new QLabel(tr("H&osts:"),this); list_title_label->setFont(labelFont()); list_title_label->setGeometry(14,11,85,19); list_stations_model=new RDStationListModel(false,"",this); diff --git a/rdadmin/list_svcs.cpp b/rdadmin/list_svcs.cpp index 2355a87b..ee823329 100644 --- a/rdadmin/list_svcs.cpp +++ b/rdadmin/list_svcs.cpp @@ -22,9 +22,6 @@ #include #include -#include -#include - #include #include #include @@ -81,7 +78,7 @@ ListSvcs::ListSvcs(QWidget *parent) // Services List Box // list_services_view=new RDTableView(this); - list_title_label=new QLabel(list_services_view,tr("&Services:"),this); + list_title_label=new QLabel(tr("&Services:"),this); list_title_label->setFont(labelFont()); list_title_label->setGeometry(14,11,85,19); list_services_model=new RDServiceListModel(false,this); diff --git a/rdadmin/list_vguest_resources.cpp b/rdadmin/list_vguest_resources.cpp index 825c4986..47d0033d 100644 --- a/rdadmin/list_vguest_resources.cpp +++ b/rdadmin/list_vguest_resources.cpp @@ -70,7 +70,7 @@ ListVguestResources::ListVguestResources(RDMatrix *matrix, list_list_model->setFont(defaultFont()); list_list_model->setPalette(palette()); list_list_view->setModel(list_list_model); - list_title_label=new QLabel(list_list_view,list_table,this); + list_title_label=new QLabel(list_table,this); list_title_label->setFont(labelFont()); connect(list_list_view,SIGNAL(doubleClicked(const QModelIndex &)), this,SLOT(doubleClickedData(const QModelIndex &))); diff --git a/rdadmin/login.cpp b/rdadmin/login.cpp index 2160c766..417d5007 100644 --- a/rdadmin/login.cpp +++ b/rdadmin/login.cpp @@ -2,7 +2,7 @@ // // Login widget for RDAdmin. // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -20,12 +20,8 @@ #include -#include -#include -#include -#include -#include -#include +#include +#include #include @@ -76,10 +72,10 @@ Login::Login(QString *username,QString *password,QWidget *parent) login_name_edit->setMaxLength(RD_MAX_PASSWORD_LENGTH); login_name_edit->setFocus(); login_name_edit->setValidator(validator); - QLabel *login_name_label=new QLabel(login_name_edit,tr("User &Name:"),this); + QLabel *login_name_label=new QLabel(tr("User &Name:"),this); login_name_label->setFont(labelFont()); login_name_label->setGeometry(10,10,85,19); - login_name_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + login_name_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Login Password @@ -89,12 +85,10 @@ Login::Login(QString *username,QString *password,QWidget *parent) login_password_edit->setMaxLength(16); login_password_edit->setEchoMode(QLineEdit::Password); login_password_edit->setValidator(validator); - QLabel *login_password_label= - new QLabel(login_password_edit,tr("&Password:"),this); + QLabel *login_password_label=new QLabel(tr("&Password:"),this); login_password_label->setGeometry(10,31,85,19); login_password_label->setFont(labelFont()); - login_password_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + login_password_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); } diff --git a/rdadmin/login.h b/rdadmin/login.h index 745a17ab..b3b368d6 100644 --- a/rdadmin/login.h +++ b/rdadmin/login.h @@ -2,7 +2,7 @@ // // Login Widget for RDAdmin. // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -21,10 +21,7 @@ #ifndef LOGIN_H #define LOGIN_H -#include -#include -#include -#include +#include #include diff --git a/rdadmin/rdadmin.cpp b/rdadmin/rdadmin.cpp index 457de425..4ebcc981 100644 --- a/rdadmin/rdadmin.cpp +++ b/rdadmin/rdadmin.cpp @@ -23,15 +23,9 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include #include #include @@ -66,7 +60,7 @@ void PrintError(const QString &str,bool interactive) QMessageBox::warning(NULL,QObject::tr("RDAdmin Error"),str); } else { - fprintf(stderr,QString().sprintf("rdadmin: %s\n",(const char *)str)); + fprintf(stderr,(QString("rdadmin: ")+str).toUtf8().constData()); } } @@ -369,28 +363,27 @@ int main(int argc,char *argv[]) // // Load Translations // - QTranslator qt(0); - qt.load(QString("/usr/share/qt4/translations/qt_")+QTextCodec::locale(),"."); - a.installTranslator(&qt); - QTranslator rd(0); - rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+ - QTextCodec::locale(),"."); - a.installTranslator(&rd); + QString loc=RDApplication::locale(); + if(!loc.isEmpty()) { + QTranslator qt(0); + qt.load(QString("/usr/share/qt4/translations/qt_")+loc,"."); + a.installTranslator(&qt); + QTranslator rd(0); + rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+loc,"."); + a.installTranslator(&rd); - QTranslator rdhpi(0); - rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+ - QTextCodec::locale(),"."); - a.installTranslator(&rdhpi); + QTranslator rdhpi(0); + rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+loc,"."); + a.installTranslator(&rdhpi); - QTranslator tr(0); - tr.load(QString(PREFIX)+QString("/share/rivendell/rdadmin_")+ - QTextCodec::locale(),"."); - a.installTranslator(&tr); + QTranslator tr(0); + tr.load(QString(PREFIX)+QString("/share/rivendell/rdadmin_")+loc,"."); + a.installTranslator(&tr); + } RDConfig *config=new RDConfig(); config->load(); MainWidget *w=new MainWidget(config); - a.setMainWidget(w); w->setGeometry(QRect(QPoint(0,0),w->sizeHint())); w->show(); return a.exec(); diff --git a/rdadmin/rdadmin_cs.ts b/rdadmin/rdadmin_cs.ts index acb824bc..27b8ce55 100644 --- a/rdadmin/rdadmin_cs.ts +++ b/rdadmin/rdadmin_cs.ts @@ -1142,10 +1142,6 @@ nastaveném pro běh služby CAE pro naplnění databáze se zdroji zvuku.Event Carts - - RDAdmin - - - EditDropbox @@ -4525,7 +4521,7 @@ Přepsat? Unable to write file " - Nelze zapsat soubor " + Nelze zapsat soubor " Progress @@ -4560,6 +4556,10 @@ List Save text file + + Unable to write file + + EditTtys diff --git a/rdadmin/rdadmin_de.ts b/rdadmin/rdadmin_de.ts index 2bfaf0b7..090ec70f 100644 --- a/rdadmin/rdadmin_de.ts +++ b/rdadmin/rdadmin_de.ts @@ -1058,10 +1058,6 @@ configured to run the CAE service in order to populate the audio resources datab Event Carts - - RDAdmin - - - EditDropbox @@ -4231,7 +4227,7 @@ Overwrite? - Unable to write file " + Unable to write file diff --git a/rdadmin/rdadmin_es.ts b/rdadmin/rdadmin_es.ts index 77991b0e..4655ee53 100644 --- a/rdadmin/rdadmin_es.ts +++ b/rdadmin/rdadmin_es.ts @@ -1144,10 +1144,6 @@ computador para obtener los recursos de audio de dicho equipo. Event Carts - - RDAdmin - - - EditDropbox @@ -4498,7 +4494,7 @@ List - Unable to write file " + Unable to write file diff --git a/rdadmin/rdadmin_fr.ts b/rdadmin/rdadmin_fr.ts index 7db34ab0..42ebea78 100644 --- a/rdadmin/rdadmin_fr.ts +++ b/rdadmin/rdadmin_fr.ts @@ -698,10 +698,6 @@ configured to run the CAE service in order to populate the audio resources datab Event Carts - - RDAdmin - - - EditDropbox @@ -3347,7 +3343,7 @@ Overwrite? - Unable to write file " + Unable to write file diff --git a/rdadmin/rdadmin_nb.ts b/rdadmin/rdadmin_nb.ts index b35d09b4..8ead674d 100644 --- a/rdadmin/rdadmin_nb.ts +++ b/rdadmin/rdadmin_nb.ts @@ -1040,10 +1040,6 @@ configured to run the CAE service in order to populate the audio resources datab Event Carts - - RDAdmin - - - EditDropbox @@ -4136,7 +4132,7 @@ Overwrite? - Unable to write file " + Unable to write file diff --git a/rdadmin/rdadmin_nn.ts b/rdadmin/rdadmin_nn.ts index b35d09b4..8ead674d 100644 --- a/rdadmin/rdadmin_nn.ts +++ b/rdadmin/rdadmin_nn.ts @@ -1040,10 +1040,6 @@ configured to run the CAE service in order to populate the audio resources datab Event Carts - - RDAdmin - - - EditDropbox @@ -4136,7 +4132,7 @@ Overwrite? - Unable to write file " + Unable to write file diff --git a/rdadmin/rdadmin_pt_BR.ts b/rdadmin/rdadmin_pt_BR.ts index 1671d9f5..cd2f032c 100644 --- a/rdadmin/rdadmin_pt_BR.ts +++ b/rdadmin/rdadmin_pt_BR.ts @@ -1029,10 +1029,6 @@ configured to run the CAE service in order to populate the audio resources datab Event Carts - - RDAdmin - - - EditDropbox @@ -4211,7 +4207,7 @@ Overwrite? - Unable to write file " + Unable to write file diff --git a/rdadmin/rename_group.cpp b/rdadmin/rename_group.cpp index 945b63fc..b023d6bf 100644 --- a/rdadmin/rename_group.cpp +++ b/rdadmin/rename_group.cpp @@ -18,10 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include -#include +#include #include #include @@ -56,11 +53,10 @@ RenameGroup::RenameGroup(QString group,QWidget *parent) group_name_edit->setGeometry(165,11,sizeHint().width()-175,19); group_name_edit->setMaxLength(10); group_name_edit->setReadOnly(true); - QLabel *group_name_label= - new QLabel(group_name_edit,tr("Current Group Name:"),this); + QLabel *group_name_label=new QLabel(tr("Current Group Name:"),this); group_name_label->setGeometry(10,11,150,19); group_name_label->setFont(labelFont()); - group_name_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + group_name_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // New Group Name @@ -69,11 +65,10 @@ RenameGroup::RenameGroup(QString group,QWidget *parent) group_newname_edit->setGeometry(165,33,sizeHint().width()-175,19); group_newname_edit->setMaxLength(10); group_newname_edit->setValidator(validator); - QLabel *group_newname_label= - new QLabel(group_newname_edit,tr("New &Group Name:"),this); + QLabel *group_newname_label=new QLabel(tr("New &Group Name:"),this); group_newname_label->setGeometry(10,33,150,19); group_newname_label->setFont(labelFont()); - group_newname_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + group_newname_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Ok Button diff --git a/rdadmin/test_import.cpp b/rdadmin/test_import.cpp index f32d9bdb..8c683808 100644 --- a/rdadmin/test_import.cpp +++ b/rdadmin/test_import.cpp @@ -62,7 +62,7 @@ TestImport::TestImport(RDSvc *svc,RDSvc::ImportSource src,QWidget *parent) // test_date_edit=new QDateEdit(this); test_date_edit->setDisplayFormat("MM/dd/yyyy"); - test_date_label=new QLabel(test_date_edit,tr("Test Date:"),this); + test_date_label=new QLabel(tr("Test Date:"),this); test_date_label->setFont(labelFont()); test_date_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); test_date_edit->setDate(current_date); @@ -91,8 +91,7 @@ TestImport::TestImport(RDSvc *svc,RDSvc::ImportSource src,QWidget *parent) // test_filename_edit=new QLineEdit(this); test_filename_edit->setReadOnly(true); - test_filename_label= - new QLabel(test_filename_edit,tr("Using source file:"),this); + test_filename_label=new QLabel(tr("Using source file:"),this); test_filename_label->setGeometry(15,115,sizeHint().width()-30,18); test_filename_label->setFont(labelFont()); @@ -102,7 +101,7 @@ TestImport::TestImport(RDSvc *svc,RDSvc::ImportSource src,QWidget *parent) test_events_view=new RDTableView(this); test_events_model=new RDLogImportModel(rda->station()->name(),getpid(),this); test_events_view->setModel(test_events_model); - test_events_label=new QLabel(test_events_view,tr("Imported Events"),this); + test_events_label=new QLabel(tr("Imported Events"),this); test_events_label->setGeometry(15,160,sizeHint().width()-30,18); test_events_label->setFont(labelFont()); connect(test_events_model,SIGNAL(modelReset()), diff --git a/rdadmin/view_adapters.cpp b/rdadmin/view_adapters.cpp index 9433c472..4b11d5aa 100644 --- a/rdadmin/view_adapters.cpp +++ b/rdadmin/view_adapters.cpp @@ -25,8 +25,6 @@ ViewAdapters::ViewAdapters(RDStation *rdstation,QWidget *parent) : RDDialog(parent) { - setModal(true); - // // Fix the Window Size // @@ -47,7 +45,7 @@ ViewAdapters::ViewAdapters(RDStation *rdstation,QWidget *parent) // // Resource List // - view_text_edit=new QTextEdit(this,"adapter_edit"); + view_text_edit=new QTextEdit(this); view_text_edit->setReadOnly(true); QString text; if(rdstation->scanned()) { diff --git a/rdadmin/view_node_info.cpp b/rdadmin/view_node_info.cpp index b9264a06..60efccac 100644 --- a/rdadmin/view_node_info.cpp +++ b/rdadmin/view_node_info.cpp @@ -51,7 +51,7 @@ ViewNodeInfo::ViewNodeInfo(QWidget *parent) view_hostname_edit=new QLineEdit(this); view_hostname_edit->setGeometry(90,10,190,20); view_hostname_edit->setReadOnly(true); - QLabel *label=new QLabel(view_hostname_edit,tr("Hostname:"),this); + QLabel *label=new QLabel(tr("Hostname:"),this); label->setGeometry(10,10,80,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -62,7 +62,7 @@ ViewNodeInfo::ViewNodeInfo(QWidget *parent) view_tcpport_edit=new QLineEdit(this); view_tcpport_edit->setGeometry(335,10,sizeHint().width()-345,20); view_tcpport_edit->setReadOnly(true); - label=new QLabel(view_tcpport_edit,tr("Port:"),this); + label=new QLabel(tr("Port:"),this); label->setGeometry(305,10,30,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -73,7 +73,7 @@ ViewNodeInfo::ViewNodeInfo(QWidget *parent) view_system_edit=new QLineEdit(this); view_system_edit->setGeometry(135,32,70,20); view_system_edit->setReadOnly(true); - label=new QLabel(view_system_edit,tr("System Version:"),this); + label=new QLabel(tr("System Version:"),this); label->setGeometry(10,32,120,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -84,7 +84,7 @@ ViewNodeInfo::ViewNodeInfo(QWidget *parent) view_protocol_edit=new QLineEdit(this); view_protocol_edit->setGeometry(335,32,40,20); view_protocol_edit->setReadOnly(true); - label=new QLabel(view_protocol_edit,tr("Protocol Version:"),this); + label=new QLabel(tr("Protocol Version:"),this); label->setGeometry(210,32,120,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -95,7 +95,7 @@ ViewNodeInfo::ViewNodeInfo(QWidget *parent) view_sources_edit=new QLineEdit(this); view_sources_edit->setGeometry(75,54,30,20); view_sources_edit->setReadOnly(true); - label=new QLabel(view_sources_edit,tr("Sources:"),this); + label=new QLabel(tr("Sources:"),this); label->setGeometry(10,54,60,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -106,7 +106,7 @@ ViewNodeInfo::ViewNodeInfo(QWidget *parent) view_destinations_edit=new QLineEdit(this); view_destinations_edit->setGeometry(225,54,30,20); view_destinations_edit->setReadOnly(true); - label=new QLabel(view_destinations_edit,tr("Destinations:"),this); + label=new QLabel(tr("Destinations:"),this); label->setGeometry(120,54,100,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -117,7 +117,7 @@ ViewNodeInfo::ViewNodeInfo(QWidget *parent) view_channels_edit=new QLineEdit(this); view_channels_edit->setGeometry(360,54,30,20); view_channels_edit->setReadOnly(true); - label=new QLabel(view_channels_edit,tr("Channels:"),this); + label=new QLabel(tr("Channels:"),this); label->setGeometry(260,54,95,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -128,7 +128,7 @@ ViewNodeInfo::ViewNodeInfo(QWidget *parent) view_gpis_edit=new QLineEdit(this); view_gpis_edit->setGeometry(135,76,70,20); view_gpis_edit->setReadOnly(true); - label=new QLabel(view_gpis_edit,tr("GPIs:"),this); + label=new QLabel(tr("GPIs:"),this); label->setGeometry(10,76,120,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -139,7 +139,7 @@ ViewNodeInfo::ViewNodeInfo(QWidget *parent) view_gpos_edit=new QLineEdit(this); view_gpos_edit->setGeometry(305,76,70,20); view_gpos_edit->setReadOnly(true); - label=new QLabel(view_gpos_edit,tr("GPOs:"),this); + label=new QLabel(tr("GPOs:"),this); label->setGeometry(210,76,90,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -147,7 +147,7 @@ ViewNodeInfo::ViewNodeInfo(QWidget *parent) // // Sources List // - label=new QLabel(view_gpos_edit,tr("Sources"),this); + label=new QLabel(tr("Sources"),this); label->setGeometry(15,98,90,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -168,7 +168,7 @@ ViewNodeInfo::ViewNodeInfo(QWidget *parent) // // Destinations List // - label=new QLabel(view_gpos_edit,tr("Destinations"),this); + label=new QLabel(tr("Destinations"),this); label->setGeometry(15,325,90,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -213,7 +213,7 @@ QSizePolicy ViewNodeInfo::sizePolicy() const } -void ViewNodeInfo::exec(const QString &hostname,Q_UINT16 port, +void ViewNodeInfo::exec(const QString &hostname,uint16_t port, const QString &passwd,unsigned base_output) { view_hostname_edit->setText(hostname); diff --git a/rdadmin/view_node_info.h b/rdadmin/view_node_info.h index 817dfa4b..cd83b727 100644 --- a/rdadmin/view_node_info.h +++ b/rdadmin/view_node_info.h @@ -36,7 +36,7 @@ class ViewNodeInfo : public RDDialog QSizePolicy sizePolicy() const; public slots: - void exec(const QString &hostname,Q_UINT16 port,const QString &passwd, + void exec(const QString &hostname,uint16_t port,const QString &passwd, unsigned base_output); private slots: diff --git a/rdairplay/Makefile.am b/rdairplay/Makefile.am index 4129e608..f351c727 100644 --- a/rdairplay/Makefile.am +++ b/rdairplay/Makefile.am @@ -1,4 +1,4 @@ -## automake.am +## Makefile.am ## ## Automake.am for rivendell/rdairplay ## @@ -20,7 +20,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib -Wno-strict-aliasing @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib -Wno-strict-aliasing @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -74,7 +74,7 @@ nodist_rdairplay_SOURCES = moc_button_log.cpp\ moc_stop_counter.cpp\ moc_wall_clock.cpp -rdairplay_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdairplay_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ rdairplay_LDFLAGS = -rdynamic EXTRA_DIST = rdairplay.pro\ diff --git a/rdairplay/edit_event.cpp b/rdairplay/edit_event.cpp index 7edc2474..21f82044 100644 --- a/rdairplay/edit_event.cpp +++ b/rdairplay/edit_event.cpp @@ -2,7 +2,7 @@ // // Event Editor for RDAirPlay // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,8 +18,8 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include +#include +#include #include "edit_event.h" @@ -34,7 +34,7 @@ EditEvent::EditEvent(RDLogPlay *log,QWidget *parent) // Time Type // edit_timetype_box=new QCheckBox(this); - edit_timetype_label=new QLabel(edit_timetype_box,tr("Start at:"),this); + edit_timetype_label=new QLabel(tr("Start at:"),this); edit_timetype_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // @@ -77,18 +77,16 @@ EditEvent::EditEvent(RDLogPlay *log,QWidget *parent) // edit_transtype_box=new QComboBox(this); edit_timetype_label->setFont(labelFont()); - edit_transtype_box->insertItem(tr("Play")); - edit_transtype_box->insertItem(tr("Segue")); - edit_transtype_box->insertItem(tr("Stop")); - edit_transtype_label= - new QLabel(edit_transtype_box,tr("Start Transition Type:"),this); + edit_transtype_box->insertItem(0,tr("Play")); + edit_transtype_box->insertItem(1,tr("Segue")); + edit_transtype_box->insertItem(2,tr("Stop")); + edit_transtype_label=new QLabel(tr("Start Transition Type:"),this); edit_transtype_label->setFont(labelFont()); edit_transtype_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // Overlap Box edit_overlap_box=new QCheckBox(this); - edit_overlap_label= - new QLabel(edit_overlap_box,tr("No Fade at Segue Out"),this); + edit_overlap_label=new QLabel(tr("No Fade at Segue Out"),this); edit_overlap_label->setFont(labelFont()); edit_overlap_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -101,7 +99,7 @@ EditEvent::EditEvent(RDLogPlay *log,QWidget *parent) QPainter *p=new QPainter(pix); p->setPen(Qt::black); p->setBrush(Qt::black); - p->fillRect(0,0,sizeHint().width(),3,backgroundColor()); + p->fillRect(0,0,sizeHint().width(),3,palette().color(QPalette::Background)); p->drawLine(10,1,sizeHint().width()-10,1); p->end(); edit_horizrule_label->setPixmap(*pix); @@ -193,7 +191,7 @@ int EditEvent::exec(int line) edit_grace_edit->setTime(QTime().addMSecs(edit_logline->graceTime())); break; } - edit_transtype_box->setCurrentItem((int)edit_logline->transType()); + edit_transtype_box->setCurrentIndex((int)edit_logline->transType()); if(edit_logline->segueStartPoint(RDLogLine::LogPointer)<0 && edit_logline->segueEndPoint(RDLogLine::LogPointer)<0 && edit_logline->endPoint(RDLogLine::LogPointer)<0 @@ -269,7 +267,7 @@ int EditEvent::exec(int line) break; case RDLogLine::Marker: - setCaption(tr("Edit Marker")); + setWindowTitle(tr("Edit Marker")); edit_cue_edit->hide(); edit_cart_notes_label->hide(); edit_cart_notes_text->hide(); @@ -277,7 +275,7 @@ int EditEvent::exec(int line) break; case RDLogLine::Track: - setCaption(tr("Edit Track")); + setWindowTitle(tr("Edit Track")); edit_cue_edit->hide(); edit_cart_notes_label->hide(); edit_cart_notes_text->hide(); @@ -285,7 +283,7 @@ int EditEvent::exec(int line) break; case RDLogLine::Chain: - setCaption(tr("Edit Log Track")); + setWindowTitle(tr("Edit Log Track")); edit_cue_edit->hide(); edit_cart_notes_label->hide(); edit_cart_notes_text->hide(); @@ -393,7 +391,7 @@ void EditEvent::okData() startTime(RDLogLine::Imported)); } edit_logline-> - setTransType((RDLogLine::TransType)edit_transtype_box->currentItem()); + setTransType((RDLogLine::TransType)edit_transtype_box->currentIndex()); if(edit_logline->segueStartPoint(RDLogLine::LogPointer)<0 && edit_logline->segueEndPoint(RDLogLine::LogPointer)<0 && edit_logline->endPoint(RDLogLine::LogPointer)<0 @@ -459,7 +457,7 @@ void EditEvent::resizeEvent(QResizeEvent *e) edit_cue_edit->setGeometry(20,132,edit_cue_edit->sizeHint().width(), edit_cue_edit->sizeHint().height()); - if(edit_cue_edit->isShown()) { + if(edit_cue_edit->isVisible()) { edit_cart_notes_label-> setGeometry(15,127+edit_cue_edit->sizeHint().height(), size().width()-20,20); diff --git a/rdairplay/hourselector.cpp b/rdairplay/hourselector.cpp index e43e9033..189f0d44 100644 --- a/rdairplay/hourselector.cpp +++ b/rdairplay/hourselector.cpp @@ -2,7 +2,7 @@ // // Hour Selector widget for RDAirPlay // -// (C) Copyright 2012-2019 Fred Gleason +// (C) Copyright 2012-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -27,7 +27,7 @@ HourSelector::HourSelector(QWidget *parent) // Palettes // hour_active_palette= - QPalette(QColor(BUTTON_STOPPED_BACKGROUND_COLOR),backgroundColor()); + QPalette(QColor(BUTTON_STOPPED_BACKGROUND_COLOR),palette().color(QPalette::Background)); // // Buttons diff --git a/rdairplay/list_log.cpp b/rdairplay/list_log.cpp index 059f67a8..24a83a74 100644 --- a/rdairplay/list_log.cpp +++ b/rdairplay/list_log.cpp @@ -2,7 +2,7 @@ // // The full log widget for RDAirPlay // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include +#include #include #include @@ -44,62 +44,62 @@ ListLog::ListLog(RDLogPlay *log,int id,bool allow_pause, // // Create Palettes // - QColor system_button_text_color = palette().active().buttonText(); - QColor system_button_color = palette().active().button(); - QColor system_mid_color = colorGroup().mid(); + QColor system_button_text_color = palette().buttonText().color(); + QColor system_button_color = palette().button().color(); + QColor system_mid_color = palette().mid().color(); list_from_color= QPalette(QColor(BUTTON_FROM_BACKGROUND_COLOR),QColor(system_mid_color)); list_from_color. - setColor(QColorGroup::ButtonText,QColor(BUTTON_FROM_TEXT_COLOR)); + setColor(QPalette::ButtonText,QColor(BUTTON_FROM_TEXT_COLOR)); list_to_color= QPalette(QColor(BUTTON_TO_BACKGROUND_COLOR),QColor(system_mid_color)); list_to_color. - setColor(QColorGroup::ButtonText,QColor(BUTTON_TO_TEXT_COLOR)); + setColor(QPalette::ButtonText,QColor(BUTTON_TO_TEXT_COLOR)); list_list_to_color=palette(); - list_list_to_color.setColor(QPalette::Active,QColorGroup::Highlight, + list_list_to_color.setColor(QPalette::Active,QPalette::Highlight, BUTTON_TO_BACKGROUND_COLOR); - list_list_to_color.setColor(QPalette::Active,QColorGroup::HighlightedText, + list_list_to_color.setColor(QPalette::Active,QPalette::HighlightedText, BUTTON_TO_TEXT_COLOR); - list_list_to_color.setColor(QPalette::Inactive,QColorGroup::Highlight, + list_list_to_color.setColor(QPalette::Inactive,QPalette::Highlight, BUTTON_TO_BACKGROUND_COLOR); - list_list_to_color.setColor(QPalette::Inactive,QColorGroup::HighlightedText, + list_list_to_color.setColor(QPalette::Inactive,QPalette::HighlightedText, BUTTON_TO_TEXT_COLOR); list_list_from_color=palette(); - list_list_from_color.setColor(QPalette::Active,QColorGroup::Highlight, + list_list_from_color.setColor(QPalette::Active,QPalette::Highlight, BUTTON_FROM_BACKGROUND_COLOR); - list_list_from_color.setColor(QPalette::Active,QColorGroup::HighlightedText, + list_list_from_color.setColor(QPalette::Active,QPalette::HighlightedText, BUTTON_FROM_TEXT_COLOR); - list_list_from_color.setColor(QPalette::Inactive,QColorGroup::Highlight, + list_list_from_color.setColor(QPalette::Inactive,QPalette::Highlight, BUTTON_FROM_BACKGROUND_COLOR); list_list_from_color. - setColor(QPalette::Inactive,QColorGroup::HighlightedText, + setColor(QPalette::Inactive,QPalette::HighlightedText, BUTTON_FROM_TEXT_COLOR); list_scroll_color[0]=palette(); - list_scroll_color[0].setColor(QPalette::Active,QColorGroup::ButtonText, + list_scroll_color[0].setColor(QPalette::Active,QPalette::ButtonText, BUTTON_LOG_ACTIVE_TEXT_COLOR); - list_scroll_color[0].setColor(QPalette::Active,QColorGroup::Button, + list_scroll_color[0].setColor(QPalette::Active,QPalette::Button, BUTTON_LOG_ACTIVE_BACKGROUND_COLOR); - list_scroll_color[0].setColor(QPalette::Active,QColorGroup::Background, + list_scroll_color[0].setColor(QPalette::Active,QPalette::Background, system_mid_color); - list_scroll_color[0].setColor(QPalette::Inactive,QColorGroup::ButtonText, + list_scroll_color[0].setColor(QPalette::Inactive,QPalette::ButtonText, BUTTON_LOG_ACTIVE_TEXT_COLOR); - list_scroll_color[0].setColor(QPalette::Inactive,QColorGroup::Button, + list_scroll_color[0].setColor(QPalette::Inactive,QPalette::Button, BUTTON_LOG_ACTIVE_BACKGROUND_COLOR); - list_scroll_color[0].setColor(QPalette::Inactive,QColorGroup::Background, + list_scroll_color[0].setColor(QPalette::Inactive,QPalette::Background, system_mid_color); list_scroll_color[1]=palette(); - list_scroll_color[1].setColor(QPalette::Active,QColorGroup::ButtonText, + list_scroll_color[1].setColor(QPalette::Active,QPalette::ButtonText, system_button_text_color); - list_scroll_color[1].setColor(QPalette::Active,QColorGroup::Button, + list_scroll_color[1].setColor(QPalette::Active,QPalette::Button, system_button_color); - list_scroll_color[1].setColor(QPalette::Active,QColorGroup::Background, + list_scroll_color[1].setColor(QPalette::Active,QPalette::Background, system_mid_color); - list_scroll_color[1].setColor(QPalette::Inactive,QColorGroup::ButtonText, + list_scroll_color[1].setColor(QPalette::Inactive,QPalette::ButtonText, system_button_text_color); - list_scroll_color[1].setColor(QPalette::Inactive,QColorGroup::Button, + list_scroll_color[1].setColor(QPalette::Inactive,QPalette::Button, system_button_color); - list_scroll_color[1].setColor(QPalette::Inactive,QColorGroup::Background, + list_scroll_color[1].setColor(QPalette::Inactive,QPalette::Background, system_mid_color); // @@ -172,11 +172,11 @@ ListLog::ListLog(RDLogPlay *log,int id,bool allow_pause, // list_stoptime_edit=new QLineEdit(this); list_stoptime_edit->setGeometry(407,sizeHint().height()-100,70,18); - list_stoptime_label=new QLabel(list_stoptime_edit,tr("Next Stop:"),this); + list_stoptime_label=new QLabel(tr("Next Stop:"),this); list_stoptime_label->setGeometry(337,sizeHint().height()-100,65,18); list_stoptime_label->setFont(labelFont()); list_stoptime_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); - list_stoptime_label->setBackgroundColor(QColor(system_mid_color)); + // list_stoptime_label->setBackgroundColor(QColor(system_mid_color)); if(!rda->airplayConf()->showCounters()) { list_stoptime_edit->hide(); list_stoptime_label->hide(); @@ -187,11 +187,11 @@ ListLog::ListLog(RDLogPlay *log,int id,bool allow_pause, // list_endtime_edit=new QLineEdit(this); list_endtime_edit->setGeometry(407,sizeHint().height()-80,70,18); - list_endtime_label=new QLabel(list_endtime_edit,tr("Log End:"),this); + list_endtime_label=new QLabel(tr("Log End:"),this); list_endtime_label->setGeometry(337,sizeHint().height()-80,65,18); list_endtime_label->setFont(labelFont()); list_endtime_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); - list_endtime_label->setBackgroundColor(QColor(system_mid_color)); + // list_endtime_label->setBackgroundColor(QColor(system_mid_color)); if(!rda->airplayConf()->showCounters()) { list_endtime_edit->hide(); list_endtime_label->hide(); @@ -346,7 +346,7 @@ ListLog::ListLog(RDLogPlay *log,int id,bool allow_pause, connect(list_log,SIGNAL(auditionStopped(int)), this,SLOT(auditionStoppedData(int))); - setBackgroundColor(QColor(system_mid_color)); + // setBackgroundColor(QColor(system_mid_color)); } diff --git a/rdairplay/local_macros.cpp b/rdairplay/local_macros.cpp index 045ce226..b4248db5 100644 --- a/rdairplay/local_macros.cpp +++ b/rdairplay/local_macros.cpp @@ -2,7 +2,7 @@ // // Local RML Macros for the Rivendell's RDAirPlay // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,8 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - #include #include #include @@ -61,8 +59,8 @@ void MainWidget::RunLocalMacros(RDMacro *rml) } str+=rml->arg(rml->argQuantity()-1); pal=air_message_label->palette(); - pal.setColor(QPalette::Active,QColorGroup::Foreground,QColor(Qt::black)); - pal.setColor(QPalette::Inactive,QColorGroup::Foreground, + pal.setColor(QPalette::Active,QPalette::Foreground,QColor(Qt::black)); + pal.setColor(QPalette::Inactive,QPalette::Foreground, QColor(Qt::black)); air_message_label->setPalette(pal); air_message_label->setFont(MessageFont(str)); @@ -88,8 +86,8 @@ void MainWidget::RunLocalMacros(RDMacro *rml) } str+=rml->arg(rml->argQuantity()-1); pal=air_message_label->palette(); - pal.setColor(QPalette::Active,QColorGroup::Foreground,color); - pal.setColor(QPalette::Inactive,QColorGroup::Foreground,color); + pal.setColor(QPalette::Active,QPalette::Foreground,color); + pal.setColor(QPalette::Inactive,QPalette::Foreground,color); air_message_label->setPalette(pal); air_message_label->setFont(MessageFont(str)); air_message_label->setText(str); @@ -888,8 +886,8 @@ void MainWidget::RunLocalMacros(RDMacro *rml) } return; } - if((rml->arg(0).lower()!="now")&& - (rml->arg(0).lower()!="next")) { + if((rml->arg(0).toLower()!="now")&& + (rml->arg(0).toLower()!="next")) { if(rml->echoRequested()) { rml->acknowledge(false); rda->ripc()->sendRml(rml); @@ -910,7 +908,7 @@ void MainWidget::RunLocalMacros(RDMacro *rml) } return; } - if(rml->arg(0).lower()=="now") { + if(rml->arg(0).toLower()=="now") { air_log[rml->arg(1).toInt()-1]->setNowCart(rml->arg(2).toUInt()); } else { @@ -942,7 +940,9 @@ QFont MainWidget::MessageFont(QString str) bool MainWidget::GetPanel(QString str,RDAirPlayConf::PanelType *type, int *panel) { - switch(((const char *)str)[0]) { + bool ok=false; + + switch(str.at(0).cell()) { case 's': case 'S': *type=RDAirPlayConf::StationPanel; @@ -964,7 +964,8 @@ bool MainWidget::GetPanel(QString str,RDAirPlayConf::PanelType *type, default: return false; } - if(sscanf(((const char *)str)+1,"%d",panel)!=1) { + *panel=str.right(str.length()-1).toInt(&ok); + if(!ok) { return false; } if((*panel<=0)||(*panel>rda->airplayConf()->panels(*type))) { diff --git a/rdairplay/loglinebox.cpp b/rdairplay/loglinebox.cpp index 3499422a..823b2a55 100644 --- a/rdairplay/loglinebox.cpp +++ b/rdairplay/loglinebox.cpp @@ -82,50 +82,50 @@ LogLineBox::LogLineBox(RDAirPlayConf *conf,QWidget *parent) // Create Palettes // line_unchanged_stop_palette=palette(); - line_unchanged_stop_palette.setColor(QPalette::Active,QColorGroup::Highlight, + line_unchanged_stop_palette.setColor(QPalette::Active,QPalette::Highlight, QColor(BAR_UNCHANGED_STOPPING_COLOR)); line_unchanged_stop_palette.setColor(QPalette::Inactive, - QColorGroup::Highlight, + QPalette::Highlight, QColor(BAR_UNCHANGED_STOPPING_COLOR)); line_unchanged_play_palette=palette(); - line_unchanged_play_palette.setColor(QPalette::Active,QColorGroup::Highlight, + line_unchanged_play_palette.setColor(QPalette::Active,QPalette::Highlight, QColor(BAR_UNCHANGED_TRANSITION_COLOR)); line_unchanged_play_palette.setColor(QPalette::Inactive, - QColorGroup::Highlight, + QPalette::Highlight, QColor(BAR_UNCHANGED_TRANSITION_COLOR)); line_changed_stop_palette=palette(); - line_changed_stop_palette.setColor(QPalette::Active,QColorGroup::Highlight, + line_changed_stop_palette.setColor(QPalette::Active,QPalette::Highlight, QColor(BAR_CHANGED_STOPPING_COLOR)); - line_changed_stop_palette.setColor(QPalette::Inactive,QColorGroup::Highlight, + line_changed_stop_palette.setColor(QPalette::Inactive,QPalette::Highlight, QColor(BAR_CHANGED_STOPPING_COLOR)); line_changed_play_palette=palette(); - line_changed_play_palette.setColor(QPalette::Active,QColorGroup::Highlight, + line_changed_play_palette.setColor(QPalette::Active,QPalette::Highlight, QColor(BAR_CHANGED_TRANSITION_COLOR)); - line_changed_play_palette.setColor(QPalette::Inactive,QColorGroup::Highlight, + line_changed_play_palette.setColor(QPalette::Inactive,QPalette::Highlight, QColor(BAR_CHANGED_TRANSITION_COLOR)); line_time_palette=palette(); line_hard_palette=palette(); - line_hard_palette.setColor(QPalette::Active,QColorGroup::Foreground, + line_hard_palette.setColor(QPalette::Active,QPalette::Foreground, QColor(LOG_HARDTIME_TEXT_COLOR)); - line_hard_palette.setColor(QPalette::Inactive,QColorGroup::Foreground, + line_hard_palette.setColor(QPalette::Inactive,QPalette::Foreground, QColor(LOG_HARDTIME_TEXT_COLOR)); line_timescale_palette=palette(); - line_timescale_palette.setColor(QPalette::Active,QColorGroup::Foreground, + line_timescale_palette.setColor(QPalette::Active,QPalette::Foreground, QColor(LOGLINEBOX_TIMESCALE_COLOR)); - line_timescale_palette.setColor(QPalette::Inactive,QColorGroup::Foreground, + line_timescale_palette.setColor(QPalette::Inactive,QPalette::Foreground, QColor(LOGLINEBOX_TIMESCALE_COLOR)); line_transition_palette=palette(); - line_transition_palette.setColor(QPalette::Active,QColorGroup::Foreground, + line_transition_palette.setColor(QPalette::Active,QPalette::Foreground, QColor(RD_CUSTOM_TRANSITION_COLOR)); - line_transition_palette.setColor(QPalette::Inactive,QColorGroup::Foreground, + line_transition_palette.setColor(QPalette::Inactive,QPalette::Foreground, QColor(RD_CUSTOM_TRANSITION_COLOR)); line_text_palette=palette(); - line_text_palette.setColor(QPalette::Active,QColorGroup::Foreground, + line_text_palette.setColor(QPalette::Active,QPalette::Foreground, QColor(Qt::black)); - line_text_palette.setColor(QPalette::Inactive,QColorGroup::Foreground, + line_text_palette.setColor(QPalette::Inactive,QPalette::Foreground, QColor(Qt::black)); // @@ -254,7 +254,7 @@ LogLineBox::LogLineBox(RDAirPlayConf *conf,QWidget *parent) line_trans_label->setAlignment(Qt::AlignRight); line_trans_label->setFont(line_bold_font); - setBackgroundColor(QColor(LOGLINEBOX_BACKGROUND_COLOR)); + // setBackgroundColor(QColor(LOGLINEBOX_BACKGROUND_COLOR)); // // Countdown Timer @@ -451,7 +451,7 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type, line_icon_label->setPixmap(*line_playout_map); break; } - setBackgroundColor(QColor(LOGLINEBOX_MISSING_COLOR)); + // setBackgroundColor(QColor(LOGLINEBOX_MISSING_COLOR)); } else { if(((cart->forcedLength()==0)&&(cart->type()==RDCart::Audio))|| @@ -472,16 +472,16 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type, line_comment_label->clear(); line_icon_label->setPixmap(*line_playout_map); line_title_label->setText(logline->title()); - setBackgroundColor(QColor(LOGLINEBOX_MISSING_COLOR)); + // setBackgroundColor(QColor(LOGLINEBOX_MISSING_COLOR)); } else { line_cart_label-> setText(QString().sprintf("%06u",logline->cartNumber())); if(line_logline->evergreen()) { - setBackgroundColor(QColor(LOGLINEBOX_EVERGREEN_COLOR)); + // setBackgroundColor(QColor(LOGLINEBOX_EVERGREEN_COLOR)); } else { - setBackgroundColor(QColor(LOGLINEBOX_BACKGROUND_COLOR)); + // setBackgroundColor(QColor(LOGLINEBOX_BACKGROUND_COLOR)); } if(line_logline->source()==RDLogLine::Tracker) { line_icon_label->setPixmap(*line_track_cart_map); @@ -500,7 +500,7 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type, } line_group_label->setText(cart->groupName()); p=line_group_label->palette(); - p.setColor(QColorGroup::Foreground,line_logline->groupColor()); + p.setColor(QPalette::Foreground,line_logline->groupColor()); line_group_label->setPalette(p); if(line_logline->talkLength()<=0) { line_talktime_label->setText(":00"); @@ -549,7 +549,7 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type, setText(line_logline->resolveWildcards(line_outcue_template)); } else { - setBackgroundColor(QColor(LOGLINEBOX_MISSING_COLOR)); + // setBackgroundColor(QColor(LOGLINEBOX_MISSING_COLOR)); line_cut_label->clear(); line_outcue_label->setText(tr("[NO VALID CUT AVAILABLE]")); } @@ -566,7 +566,7 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type, case RDLogLine::Marker: line_icon_label->setPixmap(*line_notemarker_map); - setBackgroundColor(QColor(LOGLINEBOX_MARKER_COLOR)); + // setBackgroundColor(QColor(LOGLINEBOX_MARKER_COLOR)); line_title_label->hide(); line_description_label->hide(); line_artist_label->hide(); @@ -581,7 +581,7 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type, case RDLogLine::Track: line_icon_label->setPixmap(*line_mic16_map); - setBackgroundColor(QColor(LOGLINEBOX_MARKER_COLOR)); + // setBackgroundColor(QColor(LOGLINEBOX_MARKER_COLOR)); line_title_label->hide(); line_description_label->hide(); line_artist_label->hide(); @@ -596,7 +596,7 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type, case RDLogLine::MusicLink: line_icon_label->setPixmap(*line_music_map); - setBackgroundColor(QColor(LOGLINEBOX_MARKER_COLOR)); + // setBackgroundColor(QColor(LOGLINEBOX_MARKER_COLOR)); line_title_label->hide(); line_description_label->hide(); line_artist_label->hide(); @@ -611,7 +611,7 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type, case RDLogLine::TrafficLink: line_icon_label->setPixmap(*line_traffic_map); - setBackgroundColor(QColor(LOGLINEBOX_MARKER_COLOR)); + // setBackgroundColor(QColor(LOGLINEBOX_MARKER_COLOR)); line_title_label->hide(); line_description_label->hide(); line_artist_label->hide(); @@ -626,7 +626,7 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type, case RDLogLine::Chain: line_icon_label->setPixmap(*line_chain_map); - setBackgroundColor(QColor(LOGLINEBOX_CHAIN_COLOR)); + // setBackgroundColor(QColor(LOGLINEBOX_CHAIN_COLOR)); line_title_label->setText(logline->markerLabel()); line_description_label->setText(""); line_artist_label->setText(logline->markerComment()); @@ -647,16 +647,16 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type, cut=new RDCut(QString().sprintf("%06u_%03u",logline->cartNumber(), logline->cutNumber())); if(!cart->exists()) { - setBackgroundColor(QColor(LOGLINEBOX_MISSING_COLOR)); + // setBackgroundColor(QColor(LOGLINEBOX_MISSING_COLOR)); } else { - setBackgroundColor(QColor(LOGLINEBOX_BACKGROUND_COLOR)); + // setBackgroundColor(QColor(LOGLINEBOX_BACKGROUND_COLOR)); } line_cart_label->setText(QString().sprintf("%06u",cart->number())); line_cut_label->setText(""); line_group_label->setText(cart->groupName()); p=line_group_label->palette(); - p.setColor(QColorGroup::Foreground,line_logline->groupColor()); + p.setColor(QPalette::Foreground,line_logline->groupColor()); line_group_label->setPalette(p); line_length_label-> setText(RDGetTimeLength(line_logline->effectiveLength(), @@ -694,7 +694,7 @@ void LogLineBox::setTimer(int msecs) void LogLineBox::clear() { - setBackgroundColor(QColor(LOGLINEBOX_BACKGROUND_COLOR)); + // setBackgroundColor(QColor(LOGLINEBOX_BACKGROUND_COLOR)); line_cart_label->setText(""); line_cut_label->setText(""); line_group_label->setText(""); @@ -798,7 +798,7 @@ void LogLineBox::mouseMoveEvent(QMouseEvent *e) RDCartDrag *cd=new RDCartDrag(line_logline->cartNumber(), line_logline->title(), line_group_label->palette(). - color(QColorGroup::Foreground)); + color(QPalette::Foreground)); drag->setMimeData(cd); drag->setPixmap(*(line_icon_label->pixmap())); drag->exec(); @@ -829,7 +829,7 @@ void LogLineBox::paintEvent(QPaintEvent *e) { QPainter *p=new QPainter(this); p->fillRect(0,0,sizeHint().width()-2,sizeHint().height()-2, - backgroundColor()); + palette().color(QPalette::Background)); p->drawRect(0,0,sizeHint().width()-2,sizeHint().height()-2); p->end(); delete p; @@ -838,9 +838,11 @@ void LogLineBox::paintEvent(QPaintEvent *e) void LogLineBox::dragEnterEvent(QDragEnterEvent *e) { - e->accept(RDCartDrag::canDecode(e)&& - ((line_status==RDLogLine::Scheduled)|| - (line_status==RDLogLine::Paused))); + if(RDCartDrag::canDecode(e)&& + ((line_status==RDLogLine::Scheduled)|| + (line_status==RDLogLine::Paused))) { + e->accept(); + } } diff --git a/rdairplay/logtableview.cpp b/rdairplay/logtableview.cpp index 52b0621b..72ea7812 100644 --- a/rdairplay/logtableview.cpp +++ b/rdairplay/logtableview.cpp @@ -33,13 +33,17 @@ LogTableView::LogTableView(QWidget *parent) void LogTableView::dragEnterEvent(QDragEnterEvent *e) { - e->accept(RDCartDrag::canDecode(e)); + if(RDCartDrag::canDecode(e)) { + e->accept(); + } } void LogTableView::dragMoveEvent(QDragMoveEvent *e) { - e->accept(RDCartDrag::canDecode(e)); + if(RDCartDrag::canDecode(e)) { + e->accept(); + } } diff --git a/rdairplay/mode_display.cpp b/rdairplay/mode_display.cpp index 216c2e94..83914be0 100644 --- a/rdairplay/mode_display.cpp +++ b/rdairplay/mode_display.cpp @@ -2,7 +2,7 @@ // // The mode display widget for RDAirPlay in Rivendell // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include +#include #include "colors.h" #include "mode_display.h" @@ -34,11 +34,11 @@ ModeDisplay::ModeDisplay(QWidget *parent) // Create Palettes // auto_color= - QPalette(QColor(BUTTON_MODE_AUTO_COLOR),backgroundColor()); + QPalette(QColor(BUTTON_MODE_AUTO_COLOR),palette().color(QPalette::Background)); live_assist_color= - QPalette(QColor(BUTTON_MODE_LIVE_ASSIST_COLOR),backgroundColor()); + QPalette(QColor(BUTTON_MODE_LIVE_ASSIST_COLOR),palette().color(QPalette::Background)); manual_color= - QPalette(QColor(BUTTON_MODE_MANUAL_COLOR),backgroundColor()); + QPalette(QColor(BUTTON_MODE_MANUAL_COLOR),palette().color(QPalette::Background)); setPalette(live_assist_color); } @@ -189,6 +189,6 @@ void ModeDisplay::WriteMap() p->end(); delete p; - setPixmap(*pix); + setIcon(*pix); delete pix; } diff --git a/rdairplay/pie_counter.cpp b/rdairplay/pie_counter.cpp index c337e49a..8a12e27c 100644 --- a/rdairplay/pie_counter.cpp +++ b/rdairplay/pie_counter.cpp @@ -2,7 +2,7 @@ // // The pie counter widget for Rivendell // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,9 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include -#include +#include #include @@ -220,7 +218,7 @@ void PieCounter::tickCounter() } else { pie_time_label->setText(QString().sprintf(":%02d",(1000+pie_time)/1000)); - repaint(false); + repaint(); } } } diff --git a/rdairplay/post_counter.cpp b/rdairplay/post_counter.cpp index 8911df95..8ab3d0f2 100644 --- a/rdairplay/post_counter.cpp +++ b/rdairplay/post_counter.cpp @@ -40,11 +40,11 @@ PostCounter::PostCounter(QWidget *parent) // post_idle_palette=palette(); post_early_palette= - QPalette(QColor(POSTPOINT_EARLY_COLOR),backgroundColor()); + QPalette(QColor(POSTPOINT_EARLY_COLOR),palette().color(QPalette::Background)); post_ontime_palette= - QPalette(QColor(POSTPOINT_ONTIME_COLOR),backgroundColor()); + QPalette(QColor(POSTPOINT_ONTIME_COLOR),palette().color(QPalette::Background)); post_late_palette= - QPalette(QColor(POSTPOINT_LATE_COLOR),backgroundColor()); + QPalette(QColor(POSTPOINT_LATE_COLOR),palette().color(QPalette::Background)); post_offset = 0; UpdateDisplay(); @@ -117,8 +117,8 @@ void PostCounter::keyPressEvent(QKeyEvent *e) void PostCounter::UpdateDisplay() { - QColor color=backgroundColor(); - QColor system_button_text_color=palette().active().buttonText(); + QColor color=palette().color(QPalette::Background); + QColor system_button_text_color=palette().buttonText().color(); QString str; QString point; QString state; @@ -174,5 +174,5 @@ void PostCounter::UpdateDisplay() fontMetrics().width(state))/2,48,state); p->end(); delete p; - setPixmap(pix); + setIcon(pix); } diff --git a/rdairplay/rdairplay.cpp b/rdairplay/rdairplay.cpp index 117a95c5..43b39db5 100644 --- a/rdairplay/rdairplay.cpp +++ b/rdairplay/rdairplay.cpp @@ -142,7 +142,7 @@ MainWidget::MainWidget(RDConfig *config,QWidget *parent) // // Create And Set Icon // - setIcon(rda->iconEngine()->applicationIcon(RDIconEngine::RdAirPlay,22)); + setWindowIcon(rda->iconEngine()->applicationIcon(RDIconEngine::RdAirPlay,22)); air_start_next=false; air_next_button=0; @@ -199,7 +199,9 @@ MainWidget::MainWidget(RDConfig *config,QWidget *parent) AudioChannel(rda->airplayConf()->card(chan),rda->airplayConf()->port(chan)); if(air_channel_timers[0][achan]==NULL) { air_channel_timers[0][achan]=new QTimer(this); + air_channel_timers[0][achan]->setSingleShot(true); air_channel_timers[1][achan]=new QTimer(this); + air_channel_timers[1][achan]->setSingleShot(true); } } } @@ -407,22 +409,22 @@ MainWidget::MainWidget(RDConfig *config,QWidget *parent) // Create Palettes // auto_color= - QPalette(QColor(BUTTON_MODE_AUTO_COLOR),backgroundColor()); + QPalette(QColor(BUTTON_MODE_AUTO_COLOR),palette().color(QPalette::Background)); manual_color= - QPalette(QColor(BUTTON_MODE_MANUAL_COLOR),backgroundColor()); + QPalette(QColor(BUTTON_MODE_MANUAL_COLOR),palette().color(QPalette::Background)); active_color=palette(); - active_color.setColor(QPalette::Active,QColorGroup::ButtonText, + active_color.setColor(QPalette::Active,QPalette::ButtonText, BUTTON_LOG_ACTIVE_TEXT_COLOR); - active_color.setColor(QPalette::Active,QColorGroup::Button, + active_color.setColor(QPalette::Active,QPalette::Button, BUTTON_LOG_ACTIVE_BACKGROUND_COLOR); - active_color.setColor(QPalette::Active,QColorGroup::Background, - backgroundColor()); - active_color.setColor(QPalette::Inactive,QColorGroup::ButtonText, + active_color.setColor(QPalette::Active,QPalette::Background, + palette().color(QPalette::Background)); + active_color.setColor(QPalette::Inactive,QPalette::ButtonText, BUTTON_LOG_ACTIVE_TEXT_COLOR); - active_color.setColor(QPalette::Inactive,QColorGroup::Button, + active_color.setColor(QPalette::Inactive,QPalette::Button, BUTTON_LOG_ACTIVE_BACKGROUND_COLOR); - active_color.setColor(QPalette::Inactive,QColorGroup::Background, - backgroundColor()); + active_color.setColor(QPalette::Inactive,QPalette::Background, + palette().color(QPalette::Background)); // // Add Button @@ -849,7 +851,7 @@ void MainWidget::ripcConnectedData(bool state) } else { fprintf(stderr,"rdairplay: log \"%s\" doesn't exist\n", - (const char *)air_start_logname[i]); + air_start_logname[i].toUtf8().constData()); } delete q; } @@ -897,7 +899,7 @@ void MainWidget::gpiStateChangedData(int matrix,int line,bool state) } else { air_channel_timers[1][air_audio_channels[i]]-> - start(AIR_CHANNEL_LOCKOUT_INTERVAL,true); + start(AIR_CHANNEL_LOCKOUT_INTERVAL); air_log[i-3]->channelPlay(0); } } @@ -1259,7 +1261,7 @@ void MainWidget::logReloadedData(int log) } else { fprintf(stderr,"rdairplay: line %d doesn't exist in log \"%s\"\n", - air_start_line[log],(const char *)air_start_logname[log]); + air_start_line[log],air_start_logname[log].toUtf8().constData()); } air_start_logname[log]=""; } @@ -1776,8 +1778,9 @@ void MainWidget::keyPressEvent(QKeyEvent *e) break; case Qt::Key_X: - if(((e->state()&Qt::AltModifier)!=0)&& - ((e->state()&Qt::ShiftModifier)==0)&&((e->state()&Qt::ControlModifier)==0)) { + if(((e->modifiers()&Qt::AltModifier)!=0)&& + ((e->modifiers()&Qt::ShiftModifier)==0)&& + ((e->modifiers()&Qt::ControlModifier)==0)) { QCloseEvent *ce=new QCloseEvent(); closeEvent(ce); delete ce; @@ -1876,56 +1879,56 @@ void MainWidget::keyReleaseEvent(QKeyEvent *e) if (hotkeystrokes.length() > 0) { hot_label=(*air_hotkeys).GetRowLabel(RDEscapeString(rda->config()->stationName()), - (const char *)"airplay",(const char *)hotkeystrokes); + "airplay",hotkeystrokes.toUtf8().constData()); if (hot_label.length()>0) { // "we found a keystroke label - if (strcmp(hot_label,"Add") == 0) + if (hot_label=="Add") { addButtonData(); return; } - if (strcmp(hot_label,"Delete") == 0) + if (hot_label=="Delete") { deleteButtonData(); return; } - if (strcmp(hot_label,"Copy") == 0) + if (hot_label=="Copy") { copyButtonData(); return; } - if (strcmp(hot_label,"Move") == 0) + if (hot_label=="Move") { moveButtonData(); return; } - if (strcmp(hot_label,"Sound Panel") == 0) + if (hot_label=="Sound Panel") { panelButtonData(); return; } - if (strcmp(hot_label,"Main Log") == 0) + if (hot_label=="Main Log") { fullLogButtonData(0); return; } - if ((strcmp(hot_label,"Aux Log 1") == 0) && + if ((hot_label=="Aux Log 1") && (rda->airplayConf()->showAuxButton(0) ) ) { fullLogButtonData(1); return; } - if ( (strcmp(hot_label,"Aux Log 2") == 0) && + if ((hot_label=="Aux Log 2") && (rda->airplayConf()->showAuxButton(1) ) ) { fullLogButtonData(2); @@ -1935,15 +1938,15 @@ void MainWidget::keyReleaseEvent(QKeyEvent *e) for (int i = 1; i < 8 ; i++) { temp_string = QString().sprintf("Start Line %d",i); - if (strcmp(hot_label,temp_string) == 0) + if (hot_label==temp_string) air_button_list->startButton(i-1); temp_string = QString().sprintf("Stop Line %d",i); - if (strcmp(hot_label,temp_string) == 0) + if (hot_label==temp_string) air_button_list->stopButtonHotkey(i-1); temp_string = QString().sprintf("Pause Line %d",i); - if (strcmp(hot_label,temp_string) == 0) + if (hot_label==temp_string) air_button_list->pauseButtonHotkey(i-1); } } @@ -2315,25 +2318,24 @@ int main(int argc,char *argv[]) // // Load Translations // - QTranslator qt(0); - qt.load(QString("/usr/share/qt4/translations/qt_")+QTextCodec::locale(), - "."); - a.installTranslator(&qt); + QString loc=RDApplication::locale(); + if(!loc.isEmpty()) { + QTranslator qt(0); + qt.load(QString("/usr/share/qt4/translations/qt_")+loc,"."); + a.installTranslator(&qt); - QTranslator rd(0); - rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+ - QTextCodec::locale(),"."); - a.installTranslator(&rd); + QTranslator rd(0); + rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+loc,"."); + a.installTranslator(&rd); - QTranslator rdhpi(0); - rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+ - QTextCodec::locale(),"."); - a.installTranslator(&rdhpi); + QTranslator rdhpi(0); + rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+loc,"."); + a.installTranslator(&rdhpi); - QTranslator tr(0); - tr.load(QString(PREFIX)+QString("/share/rivendell/rdairplay_")+ - QTextCodec::locale(),"."); - a.installTranslator(&tr); + QTranslator tr(0); + tr.load(QString(PREFIX)+QString("/share/rivendell/rdairplay_")+loc,"."); + a.installTranslator(&tr); + } // // Start Event Loop @@ -2341,7 +2343,6 @@ int main(int argc,char *argv[]) RDConfig *config=new RDConfig(); config->load(); MainWidget *w=new MainWidget(config); - a.setMainWidget(w); w->setGeometry(QRect(QPoint(0,0),w->sizeHint())); w->show(); return a.exec(); @@ -2377,7 +2378,7 @@ bool MainWidget::AssertChannelLock(int dir,int achan) air_channel_timers[odir][achan]->stop(); return false; } - air_channel_timers[dir][achan]->start(AIR_CHANNEL_LOCKOUT_INTERVAL,true); + air_channel_timers[dir][achan]->start(AIR_CHANNEL_LOCKOUT_INTERVAL); return true; } return false; diff --git a/rdairplay/start_button.cpp b/rdairplay/start_button.cpp index 7138e288..295989d5 100644 --- a/rdairplay/start_button.cpp +++ b/rdairplay/start_button.cpp @@ -2,7 +2,7 @@ // // The Start Button for RDAirPlay Rivendell // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include +#include #include "colors.h" #include "start_button.h" @@ -42,35 +42,35 @@ StartButton::StartButton(bool allow_pause,QWidget *parent) // Create Palettes // start_stop_color= - QPalette(QColor(BUTTON_STOPPED_BACKGROUND_COLOR),backgroundColor()); + QPalette(QColor(BUTTON_STOPPED_BACKGROUND_COLOR),palette().color(QPalette::Background)); start_play_color= - QPalette(QColor(BUTTON_PLAY_BACKGROUND_COLOR),backgroundColor()); + QPalette(QColor(BUTTON_PLAY_BACKGROUND_COLOR),palette().color(QPalette::Background)); start_play_color. - setColor(QColorGroup::ButtonText,QColor(BUTTON_PLAY_TEXT_COLOR)); + setColor(QPalette::ButtonText,QColor(BUTTON_PLAY_TEXT_COLOR)); start_pause_color= - QPalette(QColor(BUTTON_PAUSE_BACKGROUND_COLOR),backgroundColor()); + QPalette(QColor(BUTTON_PAUSE_BACKGROUND_COLOR),palette().color(QPalette::Background)); start_pause_color. - setColor(QColorGroup::ButtonText,QColor(BUTTON_PAUSE_TEXT_COLOR)); + setColor(QPalette::ButtonText,QColor(BUTTON_PAUSE_TEXT_COLOR)); start_from_color= - QPalette(QColor(BUTTON_FROM_BACKGROUND_COLOR),backgroundColor()); + QPalette(QColor(BUTTON_FROM_BACKGROUND_COLOR),palette().color(QPalette::Background)); start_from_color. - setColor(QColorGroup::ButtonText,QColor(BUTTON_FROM_TEXT_COLOR)); + setColor(QPalette::ButtonText,QColor(BUTTON_FROM_TEXT_COLOR)); start_to_color= - QPalette(QColor(BUTTON_TO_BACKGROUND_COLOR),backgroundColor()); + QPalette(QColor(BUTTON_TO_BACKGROUND_COLOR),palette().color(QPalette::Background)); start_to_color. - setColor(QColorGroup::ButtonText,QColor(BUTTON_TO_TEXT_COLOR)); + setColor(QPalette::ButtonText,QColor(BUTTON_TO_TEXT_COLOR)); start_disabled_color= - QPalette(QColor(BUTTON_DISABLED_BACKGROUND_COLOR),backgroundColor()); + QPalette(QColor(BUTTON_DISABLED_BACKGROUND_COLOR),palette().color(QPalette::Background)); start_disabled_color. - setColor(QColorGroup::ButtonText,QColor(BUTTON_DISABLED_TEXT_COLOR)); + setColor(QPalette::ButtonText,QColor(BUTTON_DISABLED_TEXT_COLOR)); start_error_color= - QPalette(QColor(BUTTON_ERROR_BACKGROUND_COLOR),backgroundColor()); + QPalette(QColor(BUTTON_ERROR_BACKGROUND_COLOR),palette().color(QPalette::Background)); start_error_color. - setColor(QColorGroup::ButtonText,QColor(BUTTON_ERROR_TEXT_COLOR)); + setColor(QPalette::ButtonText,QColor(BUTTON_ERROR_TEXT_COLOR)); start_mode=StartButton::Stop; setMode(StartButton::Disabled,RDCart::All); @@ -208,7 +208,7 @@ void StartButton::Resize(int x,int y,int w,int h) QPixmap *pix=new QPixmap(w,h); QPainter *p=new QPainter(); p->begin(pix); - p->fillRect(0,0,w,h,palette().color(QPalette::Active,QColorGroup::Button)); + p->fillRect(0,0,w,h,palette().color(QPalette::Active,QPalette::Button)); if(start_mode!=StartButton::Disabled) { p->setPen(QColor(Qt::color1)); p->setFont(labelFont()); @@ -235,7 +235,7 @@ void StartButton::Resize(int x,int y,int w,int h) p->drawText(15,70,start_port); } p->end(); - setPixmap(*pix); + setIcon(*pix); delete p; delete pix; } diff --git a/rdairplay/stop_counter.cpp b/rdairplay/stop_counter.cpp index c18dedd0..acf9cb86 100644 --- a/rdairplay/stop_counter.cpp +++ b/rdairplay/stop_counter.cpp @@ -2,7 +2,7 @@ // // The stop counter widget for Rivendell // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include +#include #include "stop_counter.h" @@ -116,7 +116,7 @@ void StopCounter::tickCounter() void StopCounter::UpdateTime() { QString text; - QColor system_button_text_color = palette().active().buttonText(); + QColor system_button_text_color = palette().buttonText().color(); int msecs=QTime::currentTime(). addMSecs(rda->station()->timeOffset()).msecsTo(stop_time); @@ -127,7 +127,7 @@ void StopCounter::UpdateTime() old_msecs = msecs; p->fillRect(0,0,sizeHint().width()-2,sizeHint().height()-2, - backgroundColor()); + palette().color(QPalette::Background)); p->setPen(QColor(system_button_text_color)); p->setFont(subLabelFont()); p->drawText((sizeHint().width()-2-p->fontMetrics().width(stop_text))/2,22, @@ -152,6 +152,6 @@ void StopCounter::UpdateTime() } p->end(); delete p; - setPixmap(pix); + setIcon(pix); } } diff --git a/rdairplay/wall_clock.cpp b/rdairplay/wall_clock.cpp index 9c2347ad..79d709da 100644 --- a/rdairplay/wall_clock.cpp +++ b/rdairplay/wall_clock.cpp @@ -2,7 +2,7 @@ // // A wall-clock widget with date. // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include +#include #include @@ -94,7 +94,7 @@ void WallClock::tickClock() { static QString date; QString accum; - QColor system_button_text_color = palette().active().buttonText(); + QColor system_button_text_color = palette().buttonText().color(); static QPixmap *pix=new QPixmap(sizeHint().width()-2,sizeHint().height()-2); static bool synced=true; @@ -140,7 +140,7 @@ void WallClock::tickClock() p.setPen(Qt::color1); } else { - p.fillRect(0,0,width()-2,height()-2,backgroundColor()); + p.fillRect(0,0,width()-2,height()-2,palette().color(QPalette::Background)); p.setPen(QColor(system_button_text_color)); } p.setFont(subLabelFont()); @@ -148,7 +148,7 @@ void WallClock::tickClock() p.setFont(bannerFont()); p.drawText((size().width()-2-p.fontMetrics().width(accum))/2,48,accum); p.end(); - setPixmap(*pix); + setIcon(*pix); } diff --git a/rdcartslots/Makefile.am b/rdcartslots/Makefile.am index 090996ed..bdb8c90b 100644 --- a/rdcartslots/Makefile.am +++ b/rdcartslots/Makefile.am @@ -1,8 +1,8 @@ -## automake.am +## Makefile.am ## ## Automake.am for rivendell/rdcartslots ## -## (C) Copyright 2012-2020 Fred Gleason +## (C) Copyright 2012-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -20,7 +20,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -47,7 +47,7 @@ dist_rdcartslots_SOURCES = local_macros.cpp\ nodist_rdcartslots_SOURCES = moc_rdcartslots.cpp -rdcartslots_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdcartslots_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ EXTRA_DIST = rdcartslots.pro\ rdcartslots_de.ts\ diff --git a/rdcartslots/rdcartslots.cpp b/rdcartslots/rdcartslots.cpp index 2a5cbafc..b8d67863 100644 --- a/rdcartslots/rdcartslots.cpp +++ b/rdcartslots/rdcartslots.cpp @@ -2,7 +2,7 @@ // // A Dedicated Cart Slot Utility for Rivendell. // -// (C) Copyright 2012-2019 Fred Gleason +// (C) Copyright 2012-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,9 +18,9 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include -#include +#include +#include +#include #include @@ -214,28 +214,27 @@ int main(int argc,char *argv[]) // // Load Translations // - QTranslator qt(0); - qt.load(QString("/usr/share/qt4/translations/qt_")+QTextCodec::locale(),"."); - a.installTranslator(&qt); - QTranslator rd(0); - rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+ - QTextCodec::locale(),"."); - a.installTranslator(&rd); + QString loc=RDApplication::locale(); + if(!loc.isEmpty()) { + QTranslator qt(0); + qt.load(QString("/usr/share/qt4/translations/qt_")+loc,"."); + a.installTranslator(&qt); + QTranslator rd(0); + rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+loc,"."); + a.installTranslator(&rd); - QTranslator rdhpi(0); - rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+ - QTextCodec::locale(),"."); - a.installTranslator(&rdhpi); + QTranslator rdhpi(0); + rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+loc,"."); + a.installTranslator(&rdhpi); - QTranslator tr(0); - tr.load(QString(PREFIX)+QString("/share/rivendell/rdcartslots_")+ - QTextCodec::locale(),"."); - a.installTranslator(&tr); + QTranslator tr(0); + tr.load(QString(PREFIX)+QString("/share/rivendell/rdcartslots_")+loc,"."); + a.installTranslator(&tr); + } RDConfig *config=new RDConfig(); config->load(); MainWidget *w=new MainWidget(config); - a.setMainWidget(w); w->setGeometry(QRect(QPoint(0,0),w->sizeHint())); w->show(); return a.exec(); diff --git a/rdcastmanager/Makefile.am b/rdcastmanager/Makefile.am index 0d716f6d..57260d8b 100644 --- a/rdcastmanager/Makefile.am +++ b/rdcastmanager/Makefile.am @@ -1,8 +1,8 @@ -## automake.am +## Makefile.am ## ## Automake.am for rivendell/rdcastmanager ## -## (C) Copyright 2002-2020 Fred Gleason +## (C) Copyright 2002-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -20,7 +20,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -55,7 +55,7 @@ nodist_rdcastmanager_SOURCES = moc_edit_cast.cpp\ moc_rdcastmanager.cpp\ moc_render_dialog.cpp -rdcastmanager_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdcastmanager_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ EXTRA_DIST = rdcastmanager.pro\ rdcastmanager_cs.ts\ diff --git a/rdcastmanager/edit_cast.cpp b/rdcastmanager/edit_cast.cpp index e056fd97..c10f5a16 100644 --- a/rdcastmanager/edit_cast.cpp +++ b/rdcastmanager/edit_cast.cpp @@ -2,7 +2,7 @@ // // Edit a Rivendell Cast // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include +#include #include #include @@ -38,8 +38,7 @@ EditCast::EditCast(unsigned cast_id,QWidget *parent) // Active Checkbox // cast_active_check=new QCheckBox(this); - cast_active_label= - new QLabel(cast_active_check,tr("Item Active"),this); + cast_active_label=new QLabel(tr("Item Active"),this); cast_active_label->setFont(labelFont()); cast_active_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -57,8 +56,7 @@ EditCast::EditCast(unsigned cast_id,QWidget *parent) // cast_item_title_edit=new QLineEdit(this); cast_item_title_edit->setMaxLength(255); - cast_item_title_label= - new QLabel(cast_item_title_edit,tr("Title:"),this); + cast_item_title_label=new QLabel(tr("Title:"),this); cast_item_title_label->setFont(labelFont()); cast_item_title_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -67,8 +65,7 @@ EditCast::EditCast(unsigned cast_id,QWidget *parent) // cast_item_author_edit=new QLineEdit(this); cast_item_author_edit->setMaxLength(255); - cast_item_author_label= - new QLabel(cast_item_author_edit,tr("Author E-Mail:"),this); + cast_item_author_label=new QLabel(tr("Author E-Mail:"),this); cast_item_author_label->setFont(labelFont()); cast_item_author_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -77,8 +74,7 @@ EditCast::EditCast(unsigned cast_id,QWidget *parent) // cast_item_category_edit=new QLineEdit(this); cast_item_category_edit->setMaxLength(64); - cast_item_category_label= - new QLabel(cast_item_category_edit,tr("Category:"),this); + cast_item_category_label=new QLabel(tr("Category:"),this); cast_item_category_label->setFont(labelFont()); cast_item_category_label-> setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -90,8 +86,7 @@ EditCast::EditCast(unsigned cast_id,QWidget *parent) cast_item_link_edit->setMaxLength(255); cast_item_link_edit-> setVisible(rda->rssSchemas()->supportsItemLinks(cast_schema)); - cast_item_link_label= - new QLabel(cast_item_link_edit,tr("Link URL:"),this); + cast_item_link_label=new QLabel(tr("Link URL:"),this); cast_item_link_label->setFont(labelFont()); cast_item_link_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); cast_item_link_label-> @@ -105,8 +100,7 @@ EditCast::EditCast(unsigned cast_id,QWidget *parent) cast_item_comments_edit->setMaxLength(64); cast_item_comments_edit-> setVisible(rda->rssSchemas()->supportsItemComments(cast_schema)); - cast_item_comments_label= - new QLabel(cast_item_comments_edit,tr("Comments URL:"),this); + cast_item_comments_label=new QLabel(tr("Comments URL:"),this); cast_item_comments_label->setFont(labelFont()); cast_item_comments_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); cast_item_comments_label-> @@ -116,8 +110,7 @@ EditCast::EditCast(unsigned cast_id,QWidget *parent) // Item Description // cast_item_description_edit=new QTextEdit(this); - cast_item_description_label= - new QLabel(cast_item_description_edit,tr("Description:"),this); + cast_item_description_label=new QLabel(tr("Description:"),this); cast_item_description_label->setFont(labelFont()); cast_item_description_label-> setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -126,13 +119,13 @@ EditCast::EditCast(unsigned cast_id,QWidget *parent) // Item Explicit // cast_item_explicit_check=new QCheckBox(this); - cast_item_explicit_label=new QLabel(cast_item_explicit_check, - tr("Item contains explicit content"),this); + cast_item_explicit_label= + new QLabel(tr("Item contains explicit content"),this); cast_item_explicit_label->setFont(labelFont()); cast_item_explicit_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); cast_item_image_box=new RDImagePickerBox("FEED_IMAGES","FEED_ID","ID",this); - cast_item_image_label=new QLabel(cast_item_image_box,tr("Image")+":",this); + cast_item_image_label=new QLabel(tr("Image")+":",this); cast_item_image_label->setFont(labelFont()); cast_item_image_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -141,8 +134,7 @@ EditCast::EditCast(unsigned cast_id,QWidget *parent) // cast_item_effective_edit=new QDateTimeEdit(this); cast_item_effective_edit->setDisplayFormat("MM/dd/yyyy hh:mm:ss"); - cast_item_effective_label= - new QLabel(cast_item_effective_edit,tr("Air Date/Time:"),this); + cast_item_effective_label=new QLabel(tr("Air Date/Time:"),this); cast_item_effective_label->setFont(labelFont()); cast_item_effective_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); cast_item_effective_label-> @@ -157,12 +149,11 @@ EditCast::EditCast(unsigned cast_id,QWidget *parent) // Item Expiration // cast_item_expiration_box=new QComboBox(this); - cast_item_expiration_box->insertItem(tr("No")); - cast_item_expiration_box->insertItem(tr("Yes")); + cast_item_expiration_box->insertItem(0,tr("No")); + cast_item_expiration_box->insertItem(1,tr("Yes")); connect(cast_item_expiration_box,SIGNAL(activated(int)), this,SLOT(expirationSelectedData(int))); - cast_item_expiration_box_label= - new QLabel(cast_item_expiration_box,tr("Item Expires")+":",this); + cast_item_expiration_box_label=new QLabel(tr("Item Expires")+":",this); cast_item_expiration_box_label->setFont(labelFont()); cast_item_expiration_box_label-> setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -172,8 +163,7 @@ EditCast::EditCast(unsigned cast_id,QWidget *parent) cast_item_expiration_edit=new QDateTimeEdit(this); cast_item_expiration_edit->setDisplayFormat("MM/dd/yyyy hh:mm:ss"); - cast_item_expiration_label= - new QLabel(cast_item_expiration_edit,tr("at"),this); + cast_item_expiration_label=new QLabel(tr("at"),this); cast_item_expiration_label->setFont(labelFont()); cast_item_expiration_label->setAlignment(Qt::AlignCenter); cast_item_expiration_button=new QPushButton(this); @@ -239,15 +229,15 @@ EditCast::EditCast(unsigned cast_id,QWidget *parent) cast_item_comments_edit->setText(cast_cast->itemComments()); cast_item_effective_edit->setDateTime(cast_cast->effectiveDateTime()); if(!cast_cast->expirationDateTime().isNull()) { - cast_item_expiration_box->setCurrentItem(1); + cast_item_expiration_box->setCurrentIndex(1); } cast_item_expiration_edit->setDateTime(cast_cast->expirationDateTime()); cast_item_expiration_edit-> - setEnabled(cast_item_expiration_box->currentItem()); + setEnabled(cast_item_expiration_box->currentIndex()); cast_item_expiration_button-> - setEnabled(cast_item_expiration_box->currentItem()); + setEnabled(cast_item_expiration_box->currentIndex()); cast_item_expiration_label-> - setEnabled(cast_item_expiration_box->currentItem()); + setEnabled(cast_item_expiration_box->currentIndex()); switch(cast_status) { case RDPodcast::StatusActive: @@ -337,7 +327,7 @@ void EditCast::okData() // // Sanity Checks // - if(cast_item_expiration_box->currentItem()) { + if(cast_item_expiration_box->currentIndex()) { if(cast_item_effective_edit->dateTime()> cast_item_expiration_edit->dateTime()) { QMessageBox::warning(this,"RDCastManager - "+tr("Error"), @@ -355,13 +345,13 @@ void EditCast::okData() cast_cast->setItemAuthor(cast_item_author_edit->text()); cast_cast->setItemCategory(cast_item_category_edit->text()); cast_cast->setItemLink(cast_item_link_edit->text()); - cast_cast->setItemDescription(cast_item_description_edit->text()); + cast_cast->setItemDescription(cast_item_description_edit->toPlainText()); cast_cast->setItemExplicit(cast_item_explicit_check->isChecked()); cast_cast->setItemImageId(cast_item_image_box->currentImageId()); cast_cast->setItemComments(cast_item_comments_edit->text()); cast_cast->setEffectiveDateTime(cast_item_effective_edit->dateTime()); if(cast_active_check->isEnabled()) { - if(cast_item_expiration_box->currentItem()) { + if(cast_item_expiration_box->currentIndex()) { int shelf_life=cast_cast->originDateTime().date(). daysTo(cast_item_expiration_edit->date()); if(shelf_life<1) { diff --git a/rdcastmanager/edit_cast.h b/rdcastmanager/edit_cast.h index 0527030e..b5487794 100644 --- a/rdcastmanager/edit_cast.h +++ b/rdcastmanager/edit_cast.h @@ -2,7 +2,7 @@ // // Edit a Rivendell Cast // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -21,15 +21,11 @@ #ifndef EDIT_CAST_H #define EDIT_CAST_H -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include diff --git a/rdcastmanager/rdcastmanager.cpp b/rdcastmanager/rdcastmanager.cpp index 610004c8..fb48b30c 100644 --- a/rdcastmanager/rdcastmanager.cpp +++ b/rdcastmanager/rdcastmanager.cpp @@ -259,21 +259,24 @@ int main(int argc,char *argv[]) tr_path=QString(PREFIX)+QString("/share/rivendell/"); qt_path=QString("/usr/share/qt4/translation/"); - QTranslator qt(0); - qt.load(qt_path+QString("qt_")+QTextCodec::locale(),"."); - a.installTranslator(&qt); + QString loc=RDApplication::locale(); + if(!loc.isEmpty()) { + QTranslator qt(0); + qt.load(qt_path+QString("qt_")+loc,"."); + a.installTranslator(&qt); - QTranslator rd(0); - rd.load(tr_path+QString("librd_")+QTextCodec::locale(),"."); - a.installTranslator(&rd); + QTranslator rd(0); + rd.load(tr_path+QString("librd_")+loc,"."); + a.installTranslator(&rd); - QTranslator rdhpi(0); - rdhpi.load(tr_path+QString("librdhpi_")+QTextCodec::locale(),"."); - a.installTranslator(&rdhpi); + QTranslator rdhpi(0); + rdhpi.load(tr_path+QString("librdhpi_")+loc,"."); + a.installTranslator(&rdhpi); - QTranslator tr(0); - tr.load(tr_path+QString("rdcastmanager_")+QTextCodec::locale(),"."); - a.installTranslator(&tr); + QTranslator tr(0); + tr.load(tr_path+QString("rdcastmanager_")+loc,"."); + a.installTranslator(&tr); + } // // Start Event Loop @@ -281,7 +284,6 @@ int main(int argc,char *argv[]) RDConfig *config=new RDConfig(); config->load(); MainWidget *w=new MainWidget(config); - a.setMainWidget(w); w->setGeometry(w->geometry().x(),w->geometry().y(),w->sizeHint().width(),w->sizeHint().height()); w->show(); return a.exec(); diff --git a/rdcastmanager/render_dialog.cpp b/rdcastmanager/render_dialog.cpp index 6de687d8..f62d48bf 100644 --- a/rdcastmanager/render_dialog.cpp +++ b/rdcastmanager/render_dialog.cpp @@ -2,7 +2,7 @@ // // Render Log Dialog for Rivendell. // -// (C) Copyright 2020 Fred Gleason +// (C) Copyright 2020-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,12 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include -#include -#include - #include #include "render_dialog.h" @@ -53,8 +47,8 @@ RenderDialog::RenderDialog(QWidget *parent) d_start_time_box=new QComboBox(this); connect(d_start_time_box,SIGNAL(activated(int)), this,SLOT(startTimeActivatedData(int))); - d_start_time_box->insertItem(tr("[now]")); - d_start_time_box->insertItem(tr("As Specified")); + d_start_time_box->insertItem(0,tr("[now]")); + d_start_time_box->insertItem(1,tr("As Specified")); d_start_time_label=new QLabel(tr("Virtual Start Time")+":",this); d_start_time_label->setFont(labelFont()); d_start_time_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); diff --git a/rdcatch/Makefile.am b/rdcatch/Makefile.am index a14eceb8..43390a2a 100644 --- a/rdcatch/Makefile.am +++ b/rdcatch/Makefile.am @@ -1,4 +1,4 @@ -## automake.am +## Makefile.am ## ## Automake.am for rivendell/rdcatch ## @@ -20,7 +20,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -74,7 +74,7 @@ nodist_rdcatch_SOURCES = moc_add_recording.cpp\ moc_vbox.cpp -rdcatch_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdcatch_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ EXTRA_DIST = rdcatch.pro\ diff --git a/rdcatch/add_recording.cpp b/rdcatch/add_recording.cpp index d79f6134..43f1ddc7 100644 --- a/rdcatch/add_recording.cpp +++ b/rdcatch/add_recording.cpp @@ -31,7 +31,7 @@ extern RDStation *rdstation_conf; AddRecording::AddRecording(QString *filter,QWidget *parent) - : RDDialog(parent,Qt::WStyle_Customize|Qt::WStyle_DialogBorder) + : RDDialog(parent,Qt::CustomizeWindowHint|Qt::WindowTitleHint) { add_id=-1; add_filter=filter; diff --git a/rdcatch/deckmon.cpp b/rdcatch/deckmon.cpp index fa294017..a6d85e47 100644 --- a/rdcatch/deckmon.cpp +++ b/rdcatch/deckmon.cpp @@ -2,7 +2,7 @@ // // Monitor a Rivendell RDCatch Deck // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -38,12 +38,12 @@ DeckMon::DeckMon(QString station,unsigned channel,QWidget *parent) // Generate Palettes // mon_red_palette=palette(); - mon_red_palette.setColor(QColorGroup::Background,Qt::darkRed); - mon_red_palette.setColor(QColorGroup::Foreground,Qt::white); + mon_red_palette.setColor(QPalette::Background,Qt::darkRed); + mon_red_palette.setColor(QPalette::Foreground,Qt::white); mon_dark_palette=palette(); mon_dark_palette. - setColor(QColorGroup::Background,palette().color(QPalette::Active,QColorGroup::Mid)); - mon_dark_palette.setColor(QColorGroup::Foreground,Qt::white); + setColor(QPalette::Background,palette().color(QPalette::Active,QPalette::Mid)); + mon_dark_palette.setColor(QPalette::Foreground,Qt::white); // // Station/Channel @@ -66,7 +66,7 @@ DeckMon::DeckMon(QString station,unsigned channel,QWidget *parent) mon_monitor_button->setFont(subButtonFont()); mon_monitor_button->setText(tr("MON")); mon_monitor_palette=new QPalette(QColor(BUTTON_MONITOR_FLASHING_COLOR), - backgroundColor()); + palette().color(QPalette::Background)); if((mon_channel>128)&&(mon_channel<(MAX_DECKS+129))) { mon_monitor_button->hide(); } @@ -98,6 +98,7 @@ DeckMon::DeckMon(QString station,unsigned channel,QWidget *parent) mon_event_label->setPalette(mon_dark_palette); mon_event_label->setText("--"); mon_event_timer=new QTimer(this); + mon_event_timer->setSingleShot(true); connect(mon_event_timer,SIGNAL(timeout()),this,SLOT(eventResetData())); // @@ -220,7 +221,7 @@ void DeckMon::setEvent(int number) { mon_event_label->setText(QString().sprintf("%d",number)); mon_event_label->setPalette(mon_red_palette); - mon_event_timer->start(1000,true); + mon_event_timer->start(1000); } diff --git a/rdcatch/edit_cartevent.cpp b/rdcatch/edit_cartevent.cpp index 3b829a1d..2d65f1c4 100644 --- a/rdcatch/edit_cartevent.cpp +++ b/rdcatch/edit_cartevent.cpp @@ -2,7 +2,7 @@ // // Edit a Rivendell Macro Cart Event // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,8 +18,8 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include +#include +#include #include #include @@ -30,8 +30,6 @@ EditCartEvent::EditCartEvent(int id,std::vector *adds,QWidget *parent) : RDDialog(parent) { - QString sql; - RDSqlQuery *q; QString temp; int cartnum; @@ -67,7 +65,7 @@ EditCartEvent::EditCartEvent(int id,std::vector *adds,QWidget *parent) // edit_active_button=new QCheckBox(this); edit_active_button->setGeometry(10,11,20,20); - QLabel *label=new QLabel(edit_active_button,tr("Event Active"),this); + QLabel *label=new QLabel(tr("Event Active"),this); label->setGeometry(30,11,125,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -75,9 +73,11 @@ EditCartEvent::EditCartEvent(int id,std::vector *adds,QWidget *parent) // // Station // - edit_station_box=new QComboBox(this); + edit_station_box=new RDComboBox(this); + edit_station_model=new RDStationListModel(false,"",this); + edit_station_box->setModel(edit_station_model); edit_station_box->setGeometry(200,10,140,23); - label=new QLabel(edit_station_box,tr("Location:"),this); + label=new QLabel(tr("Location:"),this); label->setGeometry(125,10,70,23); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -88,7 +88,7 @@ EditCartEvent::EditCartEvent(int id,std::vector *adds,QWidget *parent) edit_starttime_edit=new QTimeEdit(this); edit_starttime_edit->setGeometry(sizeHint().width()-90,12,80,20); edit_starttime_edit->setDisplayFormat("hh:mm:ss"); - label=new QLabel(edit_starttime_edit,tr("Start Time:"),this); + label=new QLabel(tr("Start Time:"),this); label->setGeometry(sizeHint().width()-175,12,80,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -99,7 +99,7 @@ EditCartEvent::EditCartEvent(int id,std::vector *adds,QWidget *parent) edit_description_edit=new QLineEdit(this); edit_description_edit->setGeometry(115,43,sizeHint().width()-125,20); edit_description_edit->setValidator(validator); - label=new QLabel(edit_description_edit,tr("Description:"),this); + label=new QLabel(tr("Description:"),this); label->setGeometry(10,43,100,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -110,7 +110,7 @@ EditCartEvent::EditCartEvent(int id,std::vector *adds,QWidget *parent) edit_destination_edit=new QLineEdit(this); edit_destination_edit->setGeometry(115,70,60,20); edit_destination_edit->setReadOnly(false); - label=new QLabel(edit_destination_edit,tr("Cart Number:"),this); + label=new QLabel(tr("Cart Number:"),this); label->setGeometry(10,73,100,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight); @@ -132,7 +132,7 @@ EditCartEvent::EditCartEvent(int id,std::vector *adds,QWidget *parent) // edit_mon_button=new QCheckBox(this); edit_mon_button->setGeometry(20,120,20,20); - label=new QLabel(edit_mon_button,tr("Monday"),this); + label=new QLabel(tr("Monday"),this); label->setGeometry(40,120,115,20); label->setFont(subLabelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -142,7 +142,7 @@ EditCartEvent::EditCartEvent(int id,std::vector *adds,QWidget *parent) // edit_tue_button=new QCheckBox(this); edit_tue_button->setGeometry(115,120,20,20); - label=new QLabel(edit_tue_button,tr("Tuesday"),this); + label=new QLabel(tr("Tuesday"),this); label->setGeometry(135,120,115,20); label->setFont(subLabelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -152,7 +152,7 @@ EditCartEvent::EditCartEvent(int id,std::vector *adds,QWidget *parent) // edit_wed_button=new QCheckBox(this); edit_wed_button->setGeometry(215,120,20,20); - label=new QLabel(edit_wed_button,tr("Wednesday"),this); + label=new QLabel(tr("Wednesday"),this); label->setGeometry(235,120,115,20); label->setFont(subLabelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -162,7 +162,7 @@ EditCartEvent::EditCartEvent(int id,std::vector *adds,QWidget *parent) // edit_thu_button=new QCheckBox(this); edit_thu_button->setGeometry(335,120,20,20); - label=new QLabel(edit_thu_button,tr("Thursday"),this); + label=new QLabel(tr("Thursday"),this); label->setGeometry(355,120,115,20); label->setFont(subLabelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -172,7 +172,7 @@ EditCartEvent::EditCartEvent(int id,std::vector *adds,QWidget *parent) // edit_fri_button=new QCheckBox(this); edit_fri_button->setGeometry(440,120,20,20); - label=new QLabel(edit_fri_button,tr("Friday"),this); + label=new QLabel(tr("Friday"),this); label->setGeometry(460,120,40,20); label->setFont(subLabelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -182,7 +182,7 @@ EditCartEvent::EditCartEvent(int id,std::vector *adds,QWidget *parent) // edit_sat_button=new QCheckBox(this); edit_sat_button->setGeometry(130,145,20,20); - label=new QLabel(edit_sat_button,tr("Saturday"),this); + label=new QLabel(tr("Saturday"),this); label->setGeometry(150,145,60,20); label->setFont(subLabelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -192,7 +192,7 @@ EditCartEvent::EditCartEvent(int id,std::vector *adds,QWidget *parent) // edit_sun_button=new QCheckBox(this); edit_sun_button->setGeometry(300,145,20,20); - label=new QLabel(edit_sun_button,tr("Sunday"),this); + label=new QLabel(tr("Sunday"),this); label->setGeometry(320,145,60,20); label->setFont(subLabelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -202,7 +202,7 @@ EditCartEvent::EditCartEvent(int id,std::vector *adds,QWidget *parent) // edit_oneshot_box=new QCheckBox(this); edit_oneshot_box->setGeometry(20,180,15,15); - label=new QLabel(edit_oneshot_box,tr("Make OneShot"),this); + label=new QLabel(tr("Make OneShot"),this); label->setGeometry(40,178,115,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -241,14 +241,7 @@ EditCartEvent::EditCartEvent(int id,std::vector *adds,QWidget *parent) // // Populate Data // - q=new RDSqlQuery("select NAME from STATIONS where NAME!=\"DEFAULT\""); - while(q->next()) { - edit_station_box->insertItem(q->value(0).toString()); - if(edit_recording->station()==q->value(0).toString()) { - edit_station_box->setCurrentItem(edit_station_box->count()-1); - } - } - delete q; + edit_station_box->setCurrentText(edit_recording->station()); edit_active_button->setChecked(edit_recording->isActive()); edit_starttime_edit->setTime(edit_recording->startTime()); edit_description_edit->setText(edit_recording->description()); diff --git a/rdcatch/edit_cartevent.h b/rdcatch/edit_cartevent.h index 103597aa..ae23bd91 100644 --- a/rdcatch/edit_cartevent.h +++ b/rdcatch/edit_cartevent.h @@ -2,7 +2,7 @@ // // Edit a Rivendell Netcatch Cart Event // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -21,15 +21,15 @@ #ifndef EDIT_CARTEVENT_H #define EDIT_CARTEVENT_H -#include - -#include -#include +#include +#include +#include #include #include #include #include +#include class EditCartEvent : public RDDialog { @@ -57,7 +57,8 @@ class EditCartEvent : public RDDialog RDCart *edit_cart; RDRecording *edit_recording; QCheckBox *edit_active_button; - QComboBox *edit_station_box; + RDComboBox *edit_station_box; + RDStationListModel *edit_station_model; QTimeEdit *edit_starttime_edit; QLineEdit *edit_description_edit; QString edit_cutname; diff --git a/rdcatch/edit_download.cpp b/rdcatch/edit_download.cpp index e77a9b5d..084d31d8 100644 --- a/rdcatch/edit_download.cpp +++ b/rdcatch/edit_download.cpp @@ -33,8 +33,6 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, QWidget *parent) : RDDialog(parent) { - QString sql; - RDSqlQuery *q; QString temp; edit_deck=NULL; @@ -70,7 +68,7 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, // edit_active_button=new QCheckBox(this); edit_active_button->setGeometry(10,11,20,20); - QLabel *label=new QLabel(edit_active_button,tr("Event Active"),this); + QLabel *label=new QLabel(tr("Event Active"),this); label->setGeometry(30,11,125,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -78,9 +76,11 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, // // Station // - edit_station_box=new QComboBox(this); + edit_station_box=new RDComboBox(this); + edit_station_model=new RDStationListModel(false,"",this); + edit_station_box->setModel(edit_station_model); edit_station_box->setGeometry(200,10,140,23); - label=new QLabel(edit_station_box,tr("Location:"),this); + label=new QLabel(tr("Location:"),this); label->setGeometry(125,10,70,23); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -91,7 +91,7 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, edit_starttime_edit=new QTimeEdit(this); edit_starttime_edit->setGeometry(sizeHint().width()-90,12,80,20); edit_starttime_edit->setDisplayFormat("hh:mm:ss"); - label=new QLabel(edit_starttime_edit,tr("Start Time:"),this); + label=new QLabel(tr("Start Time:"),this); label->setGeometry(sizeHint().width()-175,12,80,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -102,7 +102,7 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, edit_description_edit=new QLineEdit(this); edit_description_edit->setGeometry(115,43,sizeHint().width()-125,20); edit_description_edit->setValidator(validator); - label=new QLabel(edit_description_edit,tr("Description:"),this); + label=new QLabel(tr("Description:"),this); label->setGeometry(10,43,100,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -116,7 +116,7 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, edit_url_edit->setValidator(validator); connect(edit_url_edit,SIGNAL(textChanged(const QString &)), this,SLOT(urlChangedData(const QString &))); - label=new QLabel(edit_url_edit,tr("Url:"),this); + label=new QLabel(tr("Url:"),this); label->setGeometry(10,70,100,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -128,7 +128,7 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, edit_username_edit->setGeometry(115,97,150,20); edit_username_edit->setMaxLength(64); edit_username_edit->setValidator(validator); - edit_username_label=new QLabel(edit_username_edit,tr("Username:"),this); + edit_username_label=new QLabel(tr("Username:"),this); edit_username_label->setGeometry(10,97,100,20); edit_username_label->setFont(labelFont()); edit_username_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -141,7 +141,7 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, edit_password_edit->setEchoMode(QLineEdit::Password); edit_password_edit->setMaxLength(64); edit_username_edit->setValidator(validator); - edit_password_label=new QLabel(edit_password_edit,tr("Password:"),this); + edit_password_label=new QLabel(tr("Password:"),this); edit_password_label->setGeometry(275,97,80,20); edit_password_label->setFont(labelFont()); edit_password_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -152,7 +152,7 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, edit_destination_edit=new QLineEdit(this); edit_destination_edit->setGeometry(115,124,sizeHint().width()-195,20); edit_destination_edit->setReadOnly(true); - label=new QLabel(edit_destination_edit,tr("Destination:"),this); + label=new QLabel(tr("Destination:"),this); label->setGeometry(10,127,100,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight); @@ -167,9 +167,9 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, // edit_channels_box=new QComboBox(this); edit_channels_box->setGeometry(190,149,40,20); - edit_channels_box->insertItem("1"); - edit_channels_box->insertItem("2"); - label=new QLabel(edit_channels_box,tr("Channels:"),this); + edit_channels_box->insertItem(0,"1"); + edit_channels_box->insertItem(1,"2"); + label=new QLabel(tr("Channels:"),this); label->setGeometry(120,149,70,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -181,18 +181,18 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, edit_autotrim_box->setGeometry(120,175,15,15); connect(edit_autotrim_box,SIGNAL(toggled(bool)), this,SLOT(autotrimToggledData(bool))); - label=new QLabel(edit_autotrim_box,tr("Autotrim"),this); + label=new QLabel(tr("Autotrim"),this); label->setGeometry(140,173,80,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); edit_autotrim_spin=new QSpinBox(this); edit_autotrim_spin->setGeometry(265,173,40,20); edit_autotrim_spin->setRange(-99,-1); - edit_autotrim_label=new QLabel(edit_autotrim_spin,tr("Level:"),this); + edit_autotrim_label=new QLabel(tr("Level:"),this); edit_autotrim_label->setGeometry(220,173,40,20); edit_autotrim_label->setFont(labelFont()); edit_autotrim_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); - edit_autotrim_unit=new QLabel(edit_autotrim_spin,tr("dBFS"),this); + edit_autotrim_unit=new QLabel(tr("dBFS"),this); edit_autotrim_unit->setGeometry(310,173,40,20); edit_autotrim_unit->setFont(labelFont()); edit_autotrim_unit->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -204,18 +204,18 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, edit_normalize_box->setGeometry(120,199,15,15); connect(edit_normalize_box,SIGNAL(toggled(bool)), this,SLOT(normalizeToggledData(bool))); - label=new QLabel(edit_normalize_box,tr("Normalize"),this); + label=new QLabel(tr("Normalize"),this); label->setGeometry(140,197,80,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); edit_normalize_spin=new QSpinBox(this); edit_normalize_spin->setGeometry(265,197,40,20); edit_normalize_spin->setRange(-99,-1); - edit_normalize_label=new QLabel(edit_normalize_spin,tr("Level:"),this); + edit_normalize_label=new QLabel(tr("Level:"),this); edit_normalize_label->setGeometry(220,197,40,20); edit_normalize_label->setFont(labelFont()); edit_normalize_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); - edit_normalize_unit=new QLabel(edit_normalize_spin,tr("dBFS"),this); + edit_normalize_unit=new QLabel(tr("dBFS"),this); edit_normalize_unit->setGeometry(310,197,40,20); edit_normalize_unit->setFont(labelFont()); edit_normalize_unit->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -225,7 +225,7 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, // edit_metadata_box=new QCheckBox(this); edit_metadata_box->setGeometry(120,222,15,15); - label=new QLabel(edit_metadata_box,tr("Update Library Metadata"),this); + label=new QLabel(tr("Update Library Metadata"),this); label->setGeometry(140,222,160,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -242,7 +242,7 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, // edit_mon_button=new QCheckBox(this); edit_mon_button->setGeometry(20,273,20,20); - label=new QLabel(edit_mon_button,tr("Monday"),this); + label=new QLabel(tr("Monday"),this); label->setGeometry(40,273,115,20); label->setFont(subLabelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -252,7 +252,7 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, // edit_tue_button=new QCheckBox(this); edit_tue_button->setGeometry(115,273,20,20); - label=new QLabel(edit_tue_button,tr("Tuesday"),this); + label=new QLabel(tr("Tuesday"),this); label->setGeometry(135,273,115,20); label->setFont(subLabelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -262,7 +262,7 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, // edit_wed_button=new QCheckBox(this); edit_wed_button->setGeometry(215,273,20,20); - label=new QLabel(edit_wed_button,tr("Wednesday"),this); + label=new QLabel(tr("Wednesday"),this); label->setGeometry(235,273,115,20); label->setFont(subLabelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -272,7 +272,7 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, // edit_thu_button=new QCheckBox(this); edit_thu_button->setGeometry(335,273,20,20); - label=new QLabel(edit_thu_button,tr("Thursday"),this); + label=new QLabel(tr("Thursday"),this); label->setGeometry(355,273,115,20); label->setFont(subLabelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -282,7 +282,7 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, // edit_fri_button=new QCheckBox(this); edit_fri_button->setGeometry(440,273,20,20); - label=new QLabel(edit_fri_button,tr("Friday"),this); + label=new QLabel(tr("Friday"),this); label->setGeometry(460,273,40,20); label->setFont(subLabelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -292,7 +292,7 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, // edit_sat_button=new QCheckBox(this); edit_sat_button->setGeometry(130,298,20,20); - label=new QLabel(edit_sat_button,tr("Saturday"),this); + label=new QLabel(tr("Saturday"),this); label->setGeometry(150,298,60,20); label->setFont(subLabelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -302,7 +302,7 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, // edit_sun_button=new QCheckBox(this); edit_sun_button->setGeometry(300,298,20,20); - label=new QLabel(edit_sun_button,tr("Sunday"),this); + label=new QLabel(tr("Sunday"),this); label->setGeometry(320,298,60,20); label->setFont(subLabelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -312,7 +312,7 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, // edit_oneshot_box=new QCheckBox(this); edit_oneshot_box->setGeometry(20,335,15,15); - label=new QLabel(edit_oneshot_box,tr("Make OneShot"),this); + label=new QLabel(tr("Make OneShot"),this); label->setGeometry(40,333,115,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -323,11 +323,11 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, edit_eventoffset_spin=new QSpinBox(this); edit_eventoffset_spin->setGeometry(245,333,45,20); edit_eventoffset_spin->setRange(-30,30); - label=new QLabel(edit_eventoffset_spin,tr("Event Offset:"),this); + label=new QLabel(tr("Event Offset:"),this); label->setGeometry(140,333,100,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); - label=new QLabel(edit_eventoffset_spin,tr("days"),this); + label=new QLabel(tr("days"),this); label->setGeometry(295,333,40,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -366,14 +366,7 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, // // Populate Data // - q=new RDSqlQuery("select NAME from STATIONS where NAME!=\"DEFAULT\""); - while(q->next()) { - edit_station_box->insertItem(q->value(0).toString()); - if(edit_recording->station()==q->value(0).toString()) { - edit_station_box->setCurrentItem(edit_station_box->count()-1); - } - } - delete q; + edit_station_box->setCurrentText(edit_recording->station()); edit_active_button->setChecked(edit_recording->isActive()); edit_starttime_edit->setTime(edit_recording->startTime()); edit_description_edit->setText(edit_recording->description()); @@ -382,7 +375,7 @@ EditDownload::EditDownload(int record_id,std::vector *adds,QString *filter, edit_password_edit->setText(edit_recording->urlPassword()); edit_cutname=edit_recording->cutName(); edit_destination_edit->setText("Cut "+edit_cutname); - edit_channels_box->setCurrentItem(edit_recording->channels()-1); + edit_channels_box->setCurrentIndex(edit_recording->channels()-1); if(edit_recording->trimThreshold()>0) { edit_autotrim_box->setChecked(true); edit_autotrim_spin->setValue(-(edit_recording->trimThreshold()/100)); @@ -438,9 +431,9 @@ QSizePolicy EditDownload::sizePolicy() const void EditDownload::urlChangedData(const QString &str) { QUrl url(str); - QString protocol=url.protocol(); - if((protocol=="ftp")||(protocol=="ftps")||(protocol=="http")||(protocol=="file")|| - (protocol=="scp")||(protocol=="sftp")) { + QString scheme=url.scheme(); + if((scheme=="ftp")||(scheme=="ftps")||(scheme=="http")||(scheme=="file")|| + (scheme=="scp")||(scheme=="sftp")) { edit_username_label->setEnabled(true); edit_username_edit->setEnabled(true); edit_password_label->setEnabled(true); @@ -496,20 +489,19 @@ void EditDownload::saveasData() void EditDownload::okData() { - if(QUrl::isRelativeUrl(edit_url_edit->text())|| - (edit_url_edit->text().right(1)=="/")) { + QUrl url(edit_url_edit->text()); + if(url.isRelative()||(edit_url_edit->text().right(1)=="/")) { QMessageBox::warning(this,tr("Invalid URL"),tr("The URL is invalid!")); return; } - QUrl url(edit_url_edit->text()); - QString protocol=url.protocol(); - if((protocol!="ftp")&&(protocol!="ftps")&&(protocol!="http")&&(protocol!="https")&& - (protocol!="file")&&(protocol!="scp")&&(protocol!="sftp")) { + QString scheme=url.scheme(); + if((scheme!="ftp")&&(scheme!="ftps")&&(scheme!="http")&&(scheme!="https")&& + (scheme!="file")&&(scheme!="scp")&&(scheme!="sftp")) { QMessageBox::warning(this, - tr("Invalid URL"),tr("Unsupported URL protocol!")); + tr("Invalid URL"),tr("Unsupported URL scheme!")); return; } - if((protocol=="file")&&(edit_username_edit->text().isEmpty())) { + if((scheme=="file")&&(edit_username_edit->text().isEmpty())) { QMessageBox::warning(this,tr("Missing Username"), tr("You must specify a username!")); return; @@ -558,7 +550,7 @@ void EditDownload::Save() edit_recording->setType(RDRecording::Download); edit_recording->setStartTime(edit_starttime_edit->time()); edit_recording->setDescription(edit_description_edit->text()); - edit_recording->setChannels(edit_channels_box->currentItem()+1); + edit_recording->setChannels(edit_channels_box->currentIndex()+1); if(edit_autotrim_box->isChecked()) { edit_recording->setTrimThreshold(-100*edit_autotrim_spin->value()); } diff --git a/rdcatch/edit_download.h b/rdcatch/edit_download.h index c9c60b53..bfaf1b67 100644 --- a/rdcatch/edit_download.h +++ b/rdcatch/edit_download.h @@ -23,15 +23,16 @@ #include -#include #include #include #include +#include #include #include #include #include +#include class EditDownload : public RDDialog { @@ -63,7 +64,8 @@ class EditDownload : public RDDialog RDCutDialog *edit_cut_dialog; RDRecording *edit_recording; QCheckBox *edit_active_button; - QComboBox *edit_station_box; + RDComboBox *edit_station_box; + RDStationListModel *edit_station_model; QTimeEdit *edit_starttime_edit; QLineEdit *edit_description_edit; QLineEdit *edit_url_edit; diff --git a/rdcatch/edit_playout.cpp b/rdcatch/edit_playout.cpp index 3b81e2c8..52b50261 100644 --- a/rdcatch/edit_playout.cpp +++ b/rdcatch/edit_playout.cpp @@ -2,7 +2,7 @@ // // Edit a Rivendell RDCatch Playout // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include +#include #include #include @@ -65,20 +65,25 @@ EditPlayout::EditPlayout(int id,std::vector *adds,QString *filter, // edit_active_button=new QCheckBox(this); edit_active_button->setGeometry(10,11,20,20); - QLabel *label=new QLabel(edit_active_button,tr("Event Active"),this); + QLabel *label=new QLabel(tr("Event Active"),this); label->setGeometry(30,11,125,20); label->setFont(labelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Station // - edit_station_box=new QComboBox(this); + edit_station_box=new RDComboBox(this); + // + // FIXME: Make this work with a model + // + // edit_station_model=new RDStationListModel(false,"",this); + // edit_station_box->setModel(edit_station_model); edit_station_box->setGeometry(200,10,140,23); - label=new QLabel(edit_station_box,tr("Location:"),this); + label=new QLabel(tr("Location:"),this); label->setGeometry(125,10,70,23); label->setFont(labelFont()); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(edit_station_box,SIGNAL(activated(int)), this,SLOT(activateStationData(int))); @@ -88,10 +93,10 @@ EditPlayout::EditPlayout(int id,std::vector *adds,QString *filter, edit_starttime_edit=new QTimeEdit(this); edit_starttime_edit->setGeometry(sizeHint().width()-90,12,80,20); edit_starttime_edit->setDisplayFormat("hh:mm:ss"); - label=new QLabel(edit_starttime_edit,tr("Start Time:"),this); + label=new QLabel(tr("Start Time:"),this); label->setGeometry(sizeHint().width()-175,12,80,20); label->setFont(labelFont()); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Description @@ -99,10 +104,10 @@ EditPlayout::EditPlayout(int id,std::vector *adds,QString *filter, edit_description_edit=new QLineEdit(this); edit_description_edit->setGeometry(105,43,sizeHint().width()-115,20); edit_description_edit->setValidator(validator); - label=new QLabel(edit_description_edit,tr("Description:"),this); + label=new QLabel(tr("Description:"),this); label->setGeometry(10,43,90,20); label->setFont(labelFont()); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Destination @@ -110,10 +115,10 @@ EditPlayout::EditPlayout(int id,std::vector *adds,QString *filter, edit_destination_edit=new QLineEdit(this); edit_destination_edit->setGeometry(105,70,sizeHint().width()-185,20); edit_destination_edit->setReadOnly(true); - label=new QLabel(edit_destination_edit,tr("Destination:"),this); + label=new QLabel(tr("Destination:"),this); label->setGeometry(10,70,90,20); label->setFont(labelFont()); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); QPushButton *button=new QPushButton(this); button->setGeometry(sizeHint().width()-70,65,60,30); button->setFont(subButtonFont()); @@ -132,80 +137,80 @@ EditPlayout::EditPlayout(int id,std::vector *adds,QString *filter, // edit_mon_button=new QCheckBox(this); edit_mon_button->setGeometry(20,120,20,20); - label=new QLabel(edit_mon_button,tr("Monday"),this); + label=new QLabel(tr("Monday"),this); label->setGeometry(40,120,115,20); label->setFont(subLabelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Tuesday Button // edit_tue_button=new QCheckBox(this); edit_tue_button->setGeometry(115,120,20,20); - label=new QLabel(edit_tue_button,tr("Tuesday"),this); + label=new QLabel(tr("Tuesday"),this); label->setGeometry(135,120,115,20); label->setFont(subLabelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Wednesday Button // edit_wed_button=new QCheckBox(this); edit_wed_button->setGeometry(215,120,20,20); - label=new QLabel(edit_wed_button,tr("Wednesday"),this); + label=new QLabel(tr("Wednesday"),this); label->setGeometry(235,120,115,20); label->setFont(subLabelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Thursday Button // edit_thu_button=new QCheckBox(this); edit_thu_button->setGeometry(335,120,20,20); - label=new QLabel(edit_thu_button,tr("Thursday"),this); + label=new QLabel(tr("Thursday"),this); label->setGeometry(355,120,115,20); label->setFont(subLabelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Friday Button // edit_fri_button=new QCheckBox(this); edit_fri_button->setGeometry(440,120,20,20); - label=new QLabel(edit_fri_button,tr("Friday"),this); + label=new QLabel(tr("Friday"),this); label->setGeometry(460,120,40,20); label->setFont(subLabelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Saturday Button // edit_sat_button=new QCheckBox(this); edit_sat_button->setGeometry(130,145,20,20); - label=new QLabel(edit_sat_button,tr("Saturday"),this); + label=new QLabel(tr("Saturday"),this); label->setGeometry(150,145,60,20); label->setFont(subLabelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Sunday Button // edit_sun_button=new QCheckBox(this); edit_sun_button->setGeometry(300,145,20,20); - label=new QLabel(edit_sun_button,tr("Sunday"),this); + label=new QLabel(tr("Sunday"),this); label->setGeometry(320,145,60,20); label->setFont(subLabelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // OneShot Button // edit_oneshot_box=new QCheckBox(this); edit_oneshot_box->setGeometry(20,180,15,15); - label=new QLabel(edit_oneshot_box,tr("Make OneShot"),this); + label=new QLabel(tr("Make OneShot"),this); label->setGeometry(40,178,115,20); label->setFont(labelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Save As Button @@ -255,7 +260,7 @@ EditPlayout::EditPlayout(int id,std::vector *adds,QString *filter, edit_sat_button->setChecked(edit_recording->sat()); edit_sun_button->setChecked(edit_recording->sun()); edit_oneshot_box->setChecked(edit_recording->oneShot()); - activateStationData(edit_station_box->currentItem(),false); + activateStationData(edit_station_box->currentIndex(),false); } @@ -360,11 +365,11 @@ void EditPlayout::PopulateDecks(QComboBox *box) "(CHANNEL>128) order by STATION_NAME,CHANNEL"; RDSqlQuery *q=new RDSqlQuery(sql); while(q->next()) { - box->insertItem(q->value(0).toString()+ + box->insertItem(box->count(),q->value(0).toString()+ QString().sprintf(" : %dP",q->value(1).toInt()-128)); if((q->value(0).toString()==edit_recording->station())&& (q->value(1).toUInt()==edit_recording->channel())) { - box->setCurrentItem(count); + box->setCurrentIndex(count); } count++; } diff --git a/rdcatch/edit_playout.h b/rdcatch/edit_playout.h index 9d235a77..2b1d043a 100644 --- a/rdcatch/edit_playout.h +++ b/rdcatch/edit_playout.h @@ -22,13 +22,14 @@ #define EDIT_PLAYOUT_H #include -#include #include +#include #include #include #include #include +#include class EditPlayout : public RDDialog { @@ -58,7 +59,8 @@ class EditPlayout : public RDDialog RDCutDialog *edit_cut_dialog; RDRecording *edit_recording; QCheckBox *edit_active_button; - QComboBox *edit_station_box; + RDComboBox *edit_station_box; + // RDStationListModel *edit_station_model; QTimeEdit *edit_starttime_edit; QLineEdit *edit_description_edit; QString edit_cutname; diff --git a/rdcatch/edit_recording.cpp b/rdcatch/edit_recording.cpp index 481c93b8..e73b8280 100644 --- a/rdcatch/edit_recording.cpp +++ b/rdcatch/edit_recording.cpp @@ -2,7 +2,7 @@ // // Edit a Rivendell RDCatch Recording // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,9 +18,9 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include -#include +#include +#include +#include #include #include @@ -76,7 +76,7 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, // edit_station_box=new QComboBox(this); edit_station_box->setGeometry(200,10,140,23); - QLabel * label=new QLabel(edit_station_box,tr("Location:"),this); + QLabel * label=new QLabel(tr("Location:"),this); label->setGeometry(125,10,70,23); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -102,8 +102,7 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, edit_starttime_edit=new QTimeEdit(this); edit_starttime_edit->setGeometry(255,53,80,20); edit_starttime_edit->setDisplayFormat("hh:mm:ss"); - edit_starttime_label=new QLabel(edit_starttime_edit,tr("Record Start Time:"), - this); + edit_starttime_label=new QLabel(tr("Record Start Time:"),this); edit_starttime_label->setGeometry(135,57,115,15); edit_starttime_label->setFont(subLabelFont()); edit_starttime_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -115,8 +114,7 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, edit_start_startwindow_edit=new QTimeEdit(this); edit_start_startwindow_edit->setGeometry(255,77,80,20); edit_start_startwindow_edit->setDisplayFormat("hh:mm:ss"); - edit_start_startwindow_label= - new QLabel(edit_start_startwindow_edit,tr("Window Start Time:"),this); + edit_start_startwindow_label=new QLabel(tr("Window Start Time:"),this); edit_start_startwindow_label->setGeometry(135,81,115,15); edit_start_startwindow_label->setFont(subLabelFont()); edit_start_startwindow_label-> @@ -125,8 +123,7 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, edit_start_endwindow_edit=new QTimeEdit(this); edit_start_endwindow_edit->setGeometry(455,77,80,20); edit_start_endwindow_edit->setDisplayFormat("hh:mm:ss"); - edit_start_endwindow_label= - new QLabel(edit_start_endwindow_edit,"Window End Time:",this); + edit_start_endwindow_label=new QLabel(tr("Window End Time:"),this); edit_start_endwindow_label->setGeometry(345,81,105,15); edit_start_endwindow_label->setFont(subLabelFont()); edit_start_endwindow_label-> @@ -135,8 +132,7 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, edit_startmatrix_spin=new QSpinBox(this); edit_startmatrix_spin->setGeometry(185,99,30,20); edit_startmatrix_spin->setRange(0,MAX_MATRICES-1); - edit_startmatrix_label= - new QLabel(edit_startmatrix_spin,tr("GPI Matrix:"),this); + edit_startmatrix_label=new QLabel(tr("GPI Matrix:"),this); edit_startmatrix_label->setGeometry(100,100,80,20); edit_startmatrix_label->setFont(subLabelFont()); edit_startmatrix_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -144,7 +140,7 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, edit_startline_spin=new QSpinBox(this); edit_startline_spin->setGeometry(305,99,30,20); edit_startline_spin->setRange(1,MAX_GPIO_PINS); - edit_startline_label=new QLabel(edit_startline_spin,tr("GPI Line:"),this); + edit_startline_label=new QLabel(tr("GPI Line:"),this); edit_startline_label->setGeometry(240,100,60,20); edit_startline_label->setFont(subLabelFont()); edit_startline_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -152,8 +148,7 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, edit_startoffset_edit=new QTimeEdit(this); edit_startoffset_edit->setGeometry(455,99,80,20); edit_startoffset_edit->setDisplayFormat("hh:mm:ss"); - edit_startoffset_label= - new QLabel(edit_startoffset_edit,tr("Start Delay:"),this); + edit_startoffset_label=new QLabel(tr("Start Delay:"),this); edit_startoffset_label->setGeometry(345,100,105,20); edit_startoffset_label->setFont(subLabelFont()); edit_startoffset_label-> @@ -195,7 +190,7 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, edit_endtime_edit=new QTimeEdit(this); edit_endtime_edit->setGeometry(245,177,80,20); edit_endtime_edit->setDisplayFormat("hh:mm:ss"); - edit_endtime_label=new QLabel(edit_endtime_edit,tr("Record End Time:"),this); + edit_endtime_label=new QLabel(tr("Record End Time:"),this); edit_endtime_label->setGeometry(125,181,115,15); edit_endtime_label->setFont(subLabelFont()); edit_endtime_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -206,8 +201,7 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, edit_end_startwindow_edit=new QTimeEdit(this); edit_end_startwindow_edit->setGeometry(245,225,80,20); edit_end_startwindow_edit->setDisplayFormat("hh:mm:ss"); - edit_end_startwindow_label= - new QLabel(edit_end_startwindow_edit,tr("Window Start Time:"),this); + edit_end_startwindow_label=new QLabel(tr("Window Start Time:"),this); edit_end_startwindow_label->setGeometry(125,229,115,15); edit_end_startwindow_label->setFont(subLabelFont()); edit_end_startwindow_label-> @@ -216,8 +210,7 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, edit_end_endwindow_edit=new QTimeEdit(this); edit_end_endwindow_edit->setGeometry(455,225,80,20); edit_end_endwindow_edit->setDisplayFormat("hh:mm:ss"); - edit_end_endwindow_label= - new QLabel(edit_end_endwindow_edit,tr("Window End Time:"),this); + edit_end_endwindow_label=new QLabel(tr("Window End Time:"),this); edit_end_endwindow_label->setGeometry(345,229,105,15); edit_end_endwindow_label->setFont(subLabelFont()); edit_end_endwindow_label-> @@ -226,7 +219,7 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, edit_endmatrix_spin=new QSpinBox(this); edit_endmatrix_spin->setGeometry(185,247,30,20); edit_endmatrix_spin->setRange(0,MAX_MATRICES-1); - edit_endmatrix_label=new QLabel(edit_endmatrix_spin,tr("GPI Matrix:"),this); + edit_endmatrix_label=new QLabel(tr("GPI Matrix:"),this); edit_endmatrix_label->setGeometry(100,248,80,20); edit_endmatrix_label->setFont(subLabelFont()); edit_endmatrix_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -234,7 +227,7 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, edit_endline_spin=new QSpinBox(this); edit_endline_spin->setGeometry(295,247,30,20); edit_endline_spin->setRange(1,MAX_GPIO_PINS); - edit_endline_label=new QLabel(edit_endline_spin,tr("GPI Line:"),this); + edit_endline_label=new QLabel(tr("GPI Line:"),this); edit_endline_label->setGeometry(230,248,60,20); edit_endline_label->setFont(subLabelFont()); edit_endline_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -242,8 +235,7 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, edit_maxlength_edit=new QTimeEdit(this); edit_maxlength_edit->setGeometry(455,247,80,20); edit_maxlength_edit->setDisplayFormat("hh:mm:ss"); - edit_maxlength_label= - new QLabel(edit_maxlength_edit,tr("Max Record Length:"),this); + edit_maxlength_label=new QLabel(tr("Max Record Length:"),this); edit_maxlength_label->setGeometry(325,248,125,20); edit_maxlength_label->setFont(subLabelFont()); edit_maxlength_label-> @@ -257,7 +249,7 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, edit_description_edit=new QLineEdit(this); edit_description_edit->setGeometry(105,291,sizeHint().width()-115,20); edit_description_edit->setValidator(validator); - label=new QLabel(edit_description_edit,tr("Description:"),this); + label=new QLabel(tr("Description:"),this); label->setGeometry(10,291,90,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -267,7 +259,7 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, // edit_source_box=new QComboBox(this); edit_source_box->setGeometry(105,317,sizeHint().width()-115,24); - label=new QLabel(edit_source_box,tr("Source:"),this); + label=new QLabel(tr("Source:"),this); label->setGeometry(10,317,90,24); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -278,7 +270,7 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, edit_destination_edit=new QLineEdit(this); edit_destination_edit->setGeometry(105,345,sizeHint().width()-185,20); edit_destination_edit->setReadOnly(true); - label=new QLabel(edit_destination_edit,tr("Destination:"),this); + label=new QLabel(tr("Destination:"),this); label->setGeometry(10,345,90,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -293,9 +285,9 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, // edit_channels_box=new QComboBox(this); edit_channels_box->setGeometry(190,370,40,20); - edit_channels_box->insertItem("1"); - edit_channels_box->insertItem("2"); - label=new QLabel(edit_channels_box,tr("Channels:"),this); + edit_channels_box->insertItem(0,"1"); + edit_channels_box->insertItem(1,"2"); + label=new QLabel(tr("Channels:"),this); label->setGeometry(120,370,70,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -311,13 +303,11 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, edit_autotrim_spin=new QSpinBox(this); edit_autotrim_spin->setGeometry(265,393,40,20); edit_autotrim_spin->setRange(-99,-1); - edit_autotrim_label= - new QLabel(edit_autotrim_spin,tr("Level:"),this); + edit_autotrim_label=new QLabel(tr("Level:"),this); edit_autotrim_label->setGeometry(220,393,40,20); edit_autotrim_label->setFont(labelFont()); edit_autotrim_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); - edit_autotrim_unit= - new QLabel(edit_autotrim_spin,tr("dBFS"),this); + edit_autotrim_unit=new QLabel(tr("dBFS"),this); edit_autotrim_unit->setGeometry(310,393,40,20); edit_autotrim_unit->setFont(labelFont()); edit_autotrim_unit->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -333,13 +323,11 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, edit_normalize_spin=new QSpinBox(this); edit_normalize_spin->setGeometry(265,418,40,20); edit_normalize_spin->setRange(-99,-1); - edit_normalize_label= - new QLabel(edit_normalize_spin,tr("Level:"),this); + edit_normalize_label=new QLabel(tr("Level:"),this); edit_normalize_label->setGeometry(220,418,40,20); edit_normalize_label->setFont(labelFont()); edit_normalize_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); - edit_normalize_unit= - new QLabel(edit_normalize_spin,tr("dBFS"),this); + edit_normalize_unit=new QLabel(tr("dBFS"),this); edit_normalize_unit->setGeometry(310,418,40,20); edit_normalize_unit->setFont(labelFont()); edit_normalize_unit->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -407,7 +395,7 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, edit_startoffset_box->setGeometry(140,516,55,24); edit_startoffset_box->setRange(0,355); edit_startoffset_box->setSpecialValueText(tr("None")); - label=new QLabel(edit_startoffset_box,tr("Start Date Offset:"),this); + label=new QLabel(tr("Start Date Offset:"),this); label->setGeometry(10,516,125,24); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -419,7 +407,7 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, edit_endoffset_box->setGeometry(440,516,55,24); edit_endoffset_box->setRange(0,355); edit_endoffset_box->setSpecialValueText(tr("None")); - label=new QLabel(edit_endoffset_box,tr("End Date Offset:"),this); + label=new QLabel(tr("End Date Offset:"),this); label->setGeometry(310,516,125,24); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -525,12 +513,12 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, edit_sun_button->setChecked(edit_recording->sun()); edit_startoffset_box->setValue(edit_recording->startdateOffset()); edit_endoffset_box->setValue(edit_recording->enddateOffset()); - activateStationData(edit_station_box->currentItem(),false); + activateStationData(edit_station_box->currentIndex(),false); QString source=GetSourceName(edit_recording->switchSource()); for(int i=0;icount();i++) { - if(edit_source_box->text(i)==source) { - edit_source_box->setCurrentItem(i); + if(edit_source_box->itemData(i).toString()==source) { + edit_source_box->setCurrentIndex(i); } } if(edit_recording->trimThreshold()>0) { @@ -555,9 +543,9 @@ EditRecording::EditRecording(int id,std::vector *adds,QString *filter, // deck exists, use the deck default for num. channels. Otherwise use the // previously entered (or DB default) recording num. channels. if( (edit_recording->station().length() == 0) && (edit_deck!=NULL) ) { - edit_channels_box->setCurrentItem(edit_deck->defaultChannels()-1); + edit_channels_box->setCurrentIndex(edit_deck->defaultChannels()-1); } else { - edit_channels_box->setCurrentItem(edit_recording->channels()-1); + edit_channels_box->setCurrentIndex(edit_recording->channels()-1); } edit_oneshot_box->setChecked(edit_recording->oneShot()); } @@ -601,7 +589,7 @@ void EditRecording::activateStationData(int id,bool use_temp) } edit_deck=new RDDeck(f0[0],f0[1].left(f0[1].length()-1).toInt()); if(edit_channels_box->count()>0) { - edit_channels_box->setCurrentItem(edit_deck->defaultChannels()-1); + edit_channels_box->setCurrentIndex(edit_deck->defaultChannels()-1); } edit_source_box->clear(); sql=QString("select NAME from INPUTS where ")+ @@ -609,7 +597,8 @@ void EditRecording::activateStationData(int id,bool use_temp) QString().sprintf("(MATRIX=%d)",edit_deck->switchMatrix()); q=new RDSqlQuery(sql); while(q->next()) { - edit_source_box->insertItem(q->value(0).toString()); + edit_source_box-> + insertItem(edit_source_box->count(),q->value(0).toString()); } delete q; } @@ -780,11 +769,11 @@ void EditRecording::PopulateDecks(QComboBox *box) "order by STATION_NAME,CHANNEL"; RDSqlQuery *q=new RDSqlQuery(sql); while(q->next()) { - box->insertItem(q->value(0).toString()+ + box->insertItem(box->count(),q->value(0).toString()+ QString().sprintf(" : %dR",q->value(1).toInt())); if((q->value(0).toString()==edit_recording->station())&& (q->value(1).toUInt()==edit_recording->channel())) { - box->setCurrentItem(count); + box->setCurrentIndex(count); } count++; } @@ -795,12 +784,12 @@ void EditRecording::PopulateDecks(QComboBox *box) q->first(); edit_deck=new RDDeck(q->value(0).toString(),q->value(1).toUInt()); if(edit_channels_box->count()>0) { - edit_channels_box->setCurrentItem(edit_deck->defaultChannels()-1); + edit_channels_box->setCurrentIndex(edit_deck->defaultChannels()-1); } } delete q; if(box->count()==0) { // In case the deck has been disabled - box->insertItem(edit_recording->station()+ + box->insertItem(box->count(),edit_recording->station()+ QString().sprintf(" : %dR",edit_recording->channel())); } } @@ -829,12 +818,12 @@ void EditRecording::Save() edit_recording->setFormat(edit_deck->defaultFormat()); if(edit_deck->defaultFormat()>0) { edit_recording->setBitrate(edit_deck->defaultBitrate()* - (edit_channels_box->currentItem()+1)); + (edit_channels_box->currentIndex()+1)); } else { edit_recording->setBitrate(0); } - edit_recording->setChannels(edit_channels_box->currentItem()+1); + edit_recording->setChannels(edit_channels_box->currentIndex()+1); if(edit_autotrim_box->isChecked()) { edit_recording->setTrimThreshold(-100*edit_autotrim_spin->value()); } diff --git a/rdcatch/edit_switchevent.cpp b/rdcatch/edit_switchevent.cpp index 4ed73e38..6173bf32 100644 --- a/rdcatch/edit_switchevent.cpp +++ b/rdcatch/edit_switchevent.cpp @@ -2,7 +2,7 @@ // // Edit a Rivendell Netcatch Cart Event // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,8 +18,8 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include +#include +#include #include #include @@ -31,7 +31,7 @@ EditSwitchEvent::EditSwitchEvent(int id,std::vector *adds,QWidget *parent) : RDDialog(parent) { QString sql; - RDSqlQuery *q; + RDSqlQuery *q=NULL; QString temp; edit_matrix=NULL; edit_added_events=adds; @@ -61,20 +61,25 @@ EditSwitchEvent::EditSwitchEvent(int id,std::vector *adds,QWidget *parent) // edit_active_button=new QCheckBox(this); edit_active_button->setGeometry(10,11,20,20); - QLabel *label=new QLabel(edit_active_button,tr("Event Active"),this); + QLabel *label=new QLabel(tr("Event Active"),this); label->setGeometry(30,11,125,20); label->setFont(labelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Station // - edit_station_box=new QComboBox(this); + edit_station_box=new RDComboBox(this); + // + // FIXME: Make this work with a model + // + // edit_station_model=new RDStationListModel(false,"",this); + // edit_station_box->setModel(edit_station_model); edit_station_box->setGeometry(200,10,140,23); - label=new QLabel(edit_station_box,tr("Location:"),this); + label=new QLabel(tr("Location:"),this); label->setGeometry(125,10,70,23); label->setFont(labelFont()); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(edit_station_box,SIGNAL(activated(const QString &)), this,SLOT(activateStationData(const QString &))); @@ -84,10 +89,10 @@ EditSwitchEvent::EditSwitchEvent(int id,std::vector *adds,QWidget *parent) edit_starttime_edit=new QTimeEdit(this); edit_starttime_edit->setGeometry(sizeHint().width()-90,12,80,20); edit_starttime_edit->setDisplayFormat("hh:mm:ss"); - label=new QLabel(edit_starttime_edit,tr("Start Time:"),this); + label=new QLabel(tr("Start Time:"),this); label->setGeometry(sizeHint().width()-175,12,80,20); label->setFont(labelFont()); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Description @@ -95,32 +100,32 @@ EditSwitchEvent::EditSwitchEvent(int id,std::vector *adds,QWidget *parent) edit_description_edit=new QLineEdit(this); edit_description_edit->setGeometry(120,43,sizeHint().width()-130,20); edit_description_edit->setValidator(validator); - label=new QLabel(edit_description_edit,tr("Description:"),this); + label=new QLabel(tr("Description:"),this); label->setGeometry(10,43,105,20); label->setFont(labelFont()); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Switch Matrix // - edit_matrix_box=new QComboBox(this,"matrix"); + edit_matrix_box=new RDComboBox(this); edit_matrix_box->setGeometry(120,70,sizeHint().width()-130,20); - label=new QLabel(edit_matrix_box,tr("Switch Matrix:"),this); + label=new QLabel(tr("Switch Matrix:"),this); label->setGeometry(10,70,105,20); label->setFont(labelFont()); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(edit_matrix_box,SIGNAL(activated(const QString &)), this,SLOT(activateMatrixData(const QString &))); // // Switch Input // - edit_input_box=new QComboBox(this,"input"); + edit_input_box=new RDComboBox(this); edit_input_box->setGeometry(120,100,sizeHint().width()-130,20); - label=new QLabel(edit_input_box,tr("Switch Input:"),this); + label=new QLabel(tr("Switch Input:"),this); label->setGeometry(10,100,105,20); label->setFont(labelFont()); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); edit_input_spin=new QSpinBox(this); edit_input_spin->setGeometry(140,125,50,20); connect(edit_input_box,SIGNAL(activated(const QString &)), @@ -129,12 +134,12 @@ EditSwitchEvent::EditSwitchEvent(int id,std::vector *adds,QWidget *parent) // // Switch Output // - edit_output_box=new QComboBox(this,"output"); + edit_output_box=new RDComboBox(this); edit_output_box->setGeometry(120,155,sizeHint().width()-130,20); - label=new QLabel(edit_output_box,tr("Switch Output:"),this); + label=new QLabel(tr("Switch Output:"),this); label->setGeometry(10,155,105,20); label->setFont(labelFont()); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); edit_output_spin=new QSpinBox(this); edit_output_spin->setGeometry(140,180,50,20); connect(edit_output_box,SIGNAL(activated(const QString &)), @@ -152,80 +157,80 @@ EditSwitchEvent::EditSwitchEvent(int id,std::vector *adds,QWidget *parent) // edit_mon_button=new QCheckBox(this); edit_mon_button->setGeometry(20,228,20,20); - label=new QLabel(edit_mon_button,tr("Monday"),this); + label=new QLabel(tr("Monday"),this); label->setGeometry(40,228,115,20); label->setFont(subLabelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Tuesday Button // edit_tue_button=new QCheckBox(this); edit_tue_button->setGeometry(115,228,20,20); - label=new QLabel(edit_tue_button,tr("Tuesday"),this); + label=new QLabel(tr("Tuesday"),this); label->setGeometry(135,228,115,20); label->setFont(subLabelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Wednesday Button // edit_wed_button=new QCheckBox(this); edit_wed_button->setGeometry(215,228,20,20); - label=new QLabel(edit_wed_button,tr("Wednesday"),this); + label=new QLabel(tr("Wednesday"),this); label->setGeometry(235,228,115,20); label->setFont(subLabelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Thursday Button // edit_thu_button=new QCheckBox(this); edit_thu_button->setGeometry(335,228,20,20); - label=new QLabel(edit_thu_button,tr("Thursday"),this); + label=new QLabel(tr("Thursday"),this); label->setGeometry(355,228,115,20); label->setFont(subLabelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Friday Button // edit_fri_button=new QCheckBox(this); edit_fri_button->setGeometry(440,228,20,20); - label=new QLabel(edit_fri_button,tr("Friday"),this); + label=new QLabel(tr("Friday"),this); label->setGeometry(460,228,40,20); label->setFont(subLabelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Saturday Button // edit_sat_button=new QCheckBox(this); edit_sat_button->setGeometry(130,253,20,20); - label=new QLabel(edit_sat_button,tr("Saturday"),this); + label=new QLabel(tr("Saturday"),this); label->setGeometry(150,253,60,20); label->setFont(subLabelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Sunday Button // edit_sun_button=new QCheckBox(this); edit_sun_button->setGeometry(300,253,20,20); - label=new QLabel(edit_sun_button,tr("Sunday"),this); + label=new QLabel(tr("Sunday"),this); label->setGeometry(320,253,60,20); label->setFont(subLabelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // OneShot Button // edit_oneshot_box=new QCheckBox(this); edit_oneshot_box->setGeometry(20,290,15,15); - label=new QLabel(edit_oneshot_box,tr("Make OneShot"),this); + label=new QLabel(tr("Make OneShot"),this); label->setGeometry(40,288,115,20); label->setFont(labelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Save As Button @@ -266,10 +271,11 @@ EditSwitchEvent::EditSwitchEvent(int id,std::vector *adds,QWidget *parent) while(q->next()) { edit_station_box->insertItem(q->value(0).toString()); if(edit_recording->station()==q->value(0).toString()) { - edit_station_box->setCurrentItem(edit_station_box->count()-1); + edit_station_box->setCurrentIndex(edit_station_box->count()-1); } } delete q; + // edit_station_box->setCurrentText(edit_recording->station()); edit_starttime_edit->setTime(edit_recording->startTime()); edit_description_edit->setText(edit_recording->description()); edit_mon_button->setChecked(edit_recording->mon()); @@ -330,7 +336,7 @@ void EditSwitchEvent::activateStationData(const QString &str) while(q->next()) { edit_matrix_box->insertItem(q->value(0).toString()); if(q->value(1).toInt()==matrix) { - edit_matrix_box->setCurrentItem(edit_matrix_box->count()-1); + edit_matrix_box->setCurrentIndex(edit_matrix_box->count()-1); } } delete q; @@ -370,7 +376,7 @@ void EditSwitchEvent::activateMatrixData(const QString &str) while(q->next()) { edit_input_box->insertItem(q->value(0).toString()); if(q->value(1).toInt()==input) { - edit_input_box->setCurrentItem(edit_input_box->count()-1); + edit_input_box->setCurrentIndex(edit_input_box->count()-1); } } delete q; @@ -397,7 +403,7 @@ void EditSwitchEvent::activateMatrixData(const QString &str) while(q->next()) { edit_output_box->insertItem(q->value(0).toString()); if(q->value(1).toInt()==output) { - edit_output_box->setCurrentItem(edit_output_box->count()-1); + edit_output_box->setCurrentIndex(edit_output_box->count()-1); } } delete q; diff --git a/rdcatch/edit_switchevent.h b/rdcatch/edit_switchevent.h index 2e3f8647..b7d95779 100644 --- a/rdcatch/edit_switchevent.h +++ b/rdcatch/edit_switchevent.h @@ -2,7 +2,7 @@ // // Edit a Rivendell Netcatch Cart Event // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -21,15 +21,16 @@ #ifndef EDIT_SWITCHEVENT_H #define EDIT_SWITCHEVENT_H -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include #include +#include class EditSwitchEvent : public RDDialog { @@ -65,13 +66,14 @@ class EditSwitchEvent : public RDDialog RDDeck *edit_deck; RDRecording *edit_recording; QCheckBox *edit_active_button; - QComboBox *edit_station_box; + RDComboBox *edit_station_box; + RDStationListModel *edit_station_model; QTimeEdit *edit_starttime_edit; QLineEdit *edit_description_edit; - QComboBox *edit_matrix_box; - QComboBox *edit_input_box; + RDComboBox *edit_matrix_box; + RDComboBox *edit_input_box; QSpinBox *edit_input_spin; - QComboBox *edit_output_box; + RDComboBox *edit_output_box; QSpinBox *edit_output_spin; QCheckBox *edit_sun_button; QCheckBox *edit_mon_button; diff --git a/rdcatch/edit_upload.cpp b/rdcatch/edit_upload.cpp index b24c4f8e..f2812780 100644 --- a/rdcatch/edit_upload.cpp +++ b/rdcatch/edit_upload.cpp @@ -71,22 +71,22 @@ EditUpload::EditUpload(int id,std::vector *adds,QString *filter, // edit_active_button=new QCheckBox(this); edit_active_button->setGeometry(10,11,20,20); - QLabel *label=new QLabel(edit_active_button,tr("Event Active"),this); + QLabel *label=new QLabel(tr("Event Active"),this); label->setGeometry(30,11,125,20); label->setFont(labelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Station // - edit_station_box=new QComboBox(this); + edit_station_box=new RDComboBox(this); edit_station_box->setGeometry(200,10,140,23); connect(edit_station_box,SIGNAL(textChanged(const QString &)), this,SLOT(stationChangedData(const QString &))); - label=new QLabel(edit_station_box,tr("Location:"),this); + label=new QLabel(tr("Location:"),this); label->setGeometry(125,10,70,23); label->setFont(labelFont()); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Start Time @@ -94,21 +94,21 @@ EditUpload::EditUpload(int id,std::vector *adds,QString *filter, edit_starttime_edit=new QTimeEdit(this); edit_starttime_edit->setGeometry(sizeHint().width()-90,12,80,20); edit_starttime_edit->setDisplayFormat("hh:mm:ss"); - label=new QLabel(edit_starttime_edit,tr("Start Time:"),this); + label=new QLabel(tr("Start Time:"),this); label->setGeometry(sizeHint().width()-175,12,80,20); label->setFont(labelFont()); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // RSS Feed // edit_feed_box=new QComboBox(this); edit_feed_box->setGeometry(115,43,100,20); - edit_feed_box->insertItem(tr("[none]")); - label=new QLabel(edit_feed_box,tr("RSS Feed:"),this); + edit_feed_box->insertItem(0,tr("[none]")); + label=new QLabel(tr("RSS Feed:"),this); label->setGeometry(10,43,100,19); label->setFont(labelFont()); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Source @@ -116,10 +116,10 @@ EditUpload::EditUpload(int id,std::vector *adds,QString *filter, edit_destination_edit=new QLineEdit(this); edit_destination_edit->setGeometry(115,70,sizeHint().width()-195,20); edit_destination_edit->setReadOnly(true); - label=new QLabel(edit_destination_edit,tr("Source:"),this); + label=new QLabel(tr("Source:"),this); label->setGeometry(10,70,100,19); label->setFont(labelFont()); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); QPushButton *button=new QPushButton(this); button->setGeometry(sizeHint().width()-70,68,60,24); button->setFont(subButtonFont()); @@ -132,10 +132,10 @@ EditUpload::EditUpload(int id,std::vector *adds,QString *filter, edit_description_edit=new QLineEdit(this); edit_description_edit->setGeometry(115,97,sizeHint().width()-125,20); edit_description_edit->setValidator(validator); - label=new QLabel(edit_description_edit,tr("Description:"),this); + label=new QLabel(tr("Description:"),this); label->setGeometry(10,97,100,20); label->setFont(labelFont()); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Url @@ -146,10 +146,10 @@ EditUpload::EditUpload(int id,std::vector *adds,QString *filter, edit_url_edit->setValidator(validator); connect(edit_url_edit,SIGNAL(textChanged(const QString &)), this,SLOT(urlChangedData(const QString &))); - label=new QLabel(edit_url_edit,tr("Url:"),this); + label=new QLabel(tr("Url:"),this); label->setGeometry(10,124,100,20); label->setFont(labelFont()); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Username @@ -158,10 +158,10 @@ EditUpload::EditUpload(int id,std::vector *adds,QString *filter, edit_username_edit->setGeometry(115,151,150,20); edit_username_edit->setMaxLength(64); edit_username_edit->setValidator(validator); - edit_username_label=new QLabel(edit_username_edit,tr("Username:"),this); + edit_username_label=new QLabel(tr("Username:"),this); edit_username_label->setGeometry(10,151,100,20); edit_username_label->setFont(labelFont()); - edit_username_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + edit_username_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Password @@ -171,10 +171,10 @@ EditUpload::EditUpload(int id,std::vector *adds,QString *filter, edit_password_edit->setEchoMode(QLineEdit::Password); edit_password_edit->setMaxLength(64); edit_username_edit->setValidator(validator); - edit_password_label=new QLabel(edit_password_edit,tr("Password:"),this); + edit_password_label=new QLabel(tr("Password:"),this); edit_password_label->setGeometry(275,151,80,20); edit_password_label->setFont(labelFont()); - edit_password_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + edit_password_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Audio Format @@ -182,10 +182,10 @@ EditUpload::EditUpload(int id,std::vector *adds,QString *filter, edit_format_edit=new QLineEdit(this); edit_format_edit->setGeometry(115,178,sizeHint().width()-195,20); edit_format_edit->setReadOnly(true); - label=new QLabel(edit_format_edit,tr("Export Format:"),this); + label=new QLabel(tr("Export Format:"),this); label->setGeometry(5,178,105,20); label->setFont(labelFont()); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); button=new QPushButton(this); button->setGeometry(sizeHint().width()-70,176,60,24); button->setFont(subButtonFont()); @@ -198,7 +198,7 @@ EditUpload::EditUpload(int id,std::vector *adds,QString *filter, edit_normalize_box=new QCheckBox(this); edit_normalize_box->setGeometry(115,208,15,15); edit_normalize_box->setChecked(true); - label=new QLabel(edit_normalize_box,tr("Normalize"),this); + label=new QLabel(tr("Normalize"),this); label->setGeometry(135,206,83,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -211,7 +211,7 @@ EditUpload::EditUpload(int id,std::vector *adds,QString *filter, edit_normalize_spin=new QSpinBox(this); edit_normalize_spin->setGeometry(265,206,40,20); edit_normalize_spin->setRange(-30,0); - edit_normalize_label=new QLabel(edit_normalize_spin,tr("Level:"),this); + edit_normalize_label=new QLabel(tr("Level:"),this); edit_normalize_label->setGeometry(215,206,45,20); edit_normalize_label->setFont(labelFont()); edit_normalize_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -225,7 +225,7 @@ EditUpload::EditUpload(int id,std::vector *adds,QString *filter, // edit_metadata_box=new QCheckBox(this); edit_metadata_box->setGeometry(115,231,15,15); - label=new QLabel(edit_metadata_box,tr("Export Library Metadata"),this); + label=new QLabel(tr("Export Library Metadata"),this); label->setGeometry(135,231,160,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -242,80 +242,80 @@ EditUpload::EditUpload(int id,std::vector *adds,QString *filter, // edit_mon_button=new QCheckBox(this); edit_mon_button->setGeometry(20,282,20,20); - label=new QLabel(edit_mon_button,tr("Monday"),this); + label=new QLabel(tr("Monday"),this); label->setGeometry(40,282,115,20); label->setFont(subLabelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Tuesday Button // edit_tue_button=new QCheckBox(this); edit_tue_button->setGeometry(115,282,20,20); - label=new QLabel(edit_tue_button,tr("Tuesday"),this); + label=new QLabel(tr("Tuesday"),this); label->setGeometry(135,282,115,20); label->setFont(subLabelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Wednesday Button // edit_wed_button=new QCheckBox(this); edit_wed_button->setGeometry(215,282,20,20); - label=new QLabel(edit_wed_button,tr("Wednesday"),this); + label=new QLabel(tr("Wednesday"),this); label->setGeometry(235,282,115,20); label->setFont(subLabelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Thursday Button // edit_thu_button=new QCheckBox(this); edit_thu_button->setGeometry(335,282,20,20); - label=new QLabel(edit_thu_button,tr("Thursday"),this); + label=new QLabel(tr("Thursday"),this); label->setGeometry(355,282,115,20); label->setFont(subLabelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Friday Button // edit_fri_button=new QCheckBox(this); edit_fri_button->setGeometry(440,282,20,20); - label=new QLabel(edit_fri_button,tr("Friday"),this); + label=new QLabel(tr("Friday"),this); label->setGeometry(460,282,40,20); label->setFont(subLabelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Saturday Button // edit_sat_button=new QCheckBox(this); edit_sat_button->setGeometry(130,307,20,20); - label=new QLabel(edit_sat_button,tr("Saturday"),this); + label=new QLabel(tr("Saturday"),this); label->setGeometry(150,307,60,20); label->setFont(subLabelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Sunday Button // edit_sun_button=new QCheckBox(this); edit_sun_button->setGeometry(300,307,20,20); - label=new QLabel(edit_sun_button,tr("Sunday"),this); + label=new QLabel(tr("Sunday"),this); label->setGeometry(320,307,60,20); label->setFont(subLabelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // OneShot Button // edit_oneshot_box=new QCheckBox(this); edit_oneshot_box->setGeometry(20,342,15,15); - label=new QLabel(edit_oneshot_box,tr("Make OneShot"),this); + label=new QLabel(tr("Make OneShot"),this); label->setGeometry(40,340,115,20); label->setFont(labelFont()); - label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Event Offset @@ -323,11 +323,11 @@ EditUpload::EditUpload(int id,std::vector *adds,QString *filter, edit_eventoffset_spin=new QSpinBox(this); edit_eventoffset_spin->setGeometry(245,340,45,20); edit_eventoffset_spin->setRange(-30,30); - label=new QLabel(edit_eventoffset_spin,tr("Event Offset:"),this); + label=new QLabel(tr("Event Offset:"),this); label->setGeometry(140,340,100,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); - label=new QLabel(edit_eventoffset_spin,tr("days"),this); + label=new QLabel(tr("days"),this); label->setGeometry(295,335,40,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -370,7 +370,7 @@ EditUpload::EditUpload(int id,std::vector *adds,QString *filter, while(q->next()) { edit_station_box->insertItem(q->value(0).toString()); if(edit_recording->station()==q->value(0).toString()) { - edit_station_box->setCurrentItem(edit_station_box->count()-1); + edit_station_box->setCurrentIndex(edit_station_box->count()-1); } } delete q; @@ -412,9 +412,9 @@ EditUpload::EditUpload(int id,std::vector *adds,QString *filter, sql="select ID,KEY_NAME from FEEDS order by KEY_NAME"; q=new RDSqlQuery(sql); while(q->next()) { - edit_feed_box->insertItem(q->value(1).toString()); + edit_feed_box->insertItem(edit_feed_box->count(),q->value(1).toString()); if(q->value(0).toInt()==feed_id) { - edit_feed_box->setCurrentItem(edit_feed_box->count()-1); + edit_feed_box->setCurrentIndex(edit_feed_box->count()-1); } } delete q; @@ -454,9 +454,9 @@ void EditUpload::stationChangedData(const QString &str) void EditUpload::urlChangedData(const QString &str) { QUrl url(str); - QString protocol=url.protocol().lower(); - if((protocol=="ftp")||(protocol=="ftps")||(protocol=="file")|| - (protocol=="scp")||(protocol=="sftp")) { + QString scheme=url.scheme().toLower(); + if((scheme=="ftp")||(scheme=="ftps")||(scheme=="file")|| + (scheme=="scp")||(scheme=="sftp")) { edit_username_label->setEnabled(true); edit_username_edit->setEnabled(true); edit_password_label->setEnabled(true); @@ -521,20 +521,19 @@ void EditUpload::okData() tr("The currently selected export format is unsupported on host ")+edit_station_box->currentText()+"!"); return; } - if(QUrl::isRelativeUrl(edit_url_edit->text())|| - (edit_url_edit->text().right(1)=="/")) { + QUrl url(edit_url_edit->text()); + if(url.isRelative()||(edit_url_edit->text().right(1)=="/")) { QMessageBox::warning(this,tr("Invalid URL"),tr("The URL is invalid!")); return; } - QUrl url(edit_url_edit->text()); - QString protocol=url.protocol(); - if((protocol!="ftp")&&(protocol!="ftps")&&(protocol!="file")&& - (protocol!="scp")&&(protocol!="sftp")) { + QString scheme=url.scheme(); + if((scheme!="ftp")&&(scheme!="ftps")&&(scheme!="file")&& + (scheme!="scp")&&(scheme!="sftp")) { QMessageBox::warning(this, - tr("Invalid URL"),tr("Unsupported URL protocol!")); + tr("Invalid URL"),tr("Unsupported URL scheme!")); return; } - if((protocol=="file")&&(edit_username_edit->text().isEmpty())) { + if((scheme=="file")&&(edit_username_edit->text().isEmpty())) { QMessageBox::warning(this,tr("Missing Username"), tr("You must specify a username!")); return; diff --git a/rdcatch/edit_upload.h b/rdcatch/edit_upload.h index aad4478d..07a56e86 100644 --- a/rdcatch/edit_upload.h +++ b/rdcatch/edit_upload.h @@ -21,12 +21,12 @@ #ifndef EDIT_UPLOAD_H #define EDIT_UPLOAD_H -#include #include #include #include #include +#include #include #include #include @@ -64,7 +64,7 @@ class EditUpload : public RDDialog RDRecording *edit_recording; RDSettings edit_settings; QCheckBox *edit_active_button; - QComboBox *edit_station_box; + RDComboBox *edit_station_box; QTimeEdit *edit_starttime_edit; QComboBox *edit_feed_box; QLineEdit *edit_description_edit; diff --git a/rdcatch/list_reports.cpp b/rdcatch/list_reports.cpp index 9c084360..d258724c 100644 --- a/rdcatch/list_reports.cpp +++ b/rdcatch/list_reports.cpp @@ -2,7 +2,7 @@ // // List and Generate RDCatch Reports // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -50,10 +50,9 @@ ListReports::ListReports(bool today_only,bool active_only,int dow, // list_reports_box=new QComboBox(this); list_reports_box->setGeometry(50,10,sizeHint().width()-60,19); - list_reports_box->insertItem(tr("Event Report")); - list_reports_box->insertItem(tr("Upload/Download Report")); - QLabel *list_reports_label= - new QLabel(list_reports_box,tr("Type:"),this); + list_reports_box->insertItem(0,tr("Event Report")); + list_reports_box->insertItem(1,tr("Upload/Download Report")); + QLabel *list_reports_label=new QLabel(tr("Type:"),this); list_reports_label->setGeometry(10,10,35,19); list_reports_label->setFont(labelFont()); list_reports_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -102,7 +101,7 @@ void ListReports::generateData() { QString report; - switch(list_reports_box->currentItem()) { + switch(list_reports_box->currentIndex()) { case 0: // Event Report GenerateEventReport(&report); break; diff --git a/rdcatch/rdcatch.cpp b/rdcatch/rdcatch.cpp index 50a510c3..acd274e1 100644 --- a/rdcatch/rdcatch.cpp +++ b/rdcatch/rdcatch.cpp @@ -120,19 +120,19 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) // Generate Palettes // catch_scroll_color[0]=palette(); - catch_scroll_color[0].setColor(QPalette::Active,QColorGroup::ButtonText, + catch_scroll_color[0].setColor(QPalette::Active,QPalette::ButtonText, BUTTON_ACTIVE_TEXT_COLOR); - catch_scroll_color[0].setColor(QPalette::Active,QColorGroup::Button, + catch_scroll_color[0].setColor(QPalette::Active,QPalette::Button, BUTTON_ACTIVE_BACKGROUND_COLOR); - catch_scroll_color[0].setColor(QPalette::Active,QColorGroup::Background, - backgroundColor()); - catch_scroll_color[0].setColor(QPalette::Inactive,QColorGroup::ButtonText, + catch_scroll_color[0].setColor(QPalette::Active,QPalette::Background, + palette().color(QPalette::Background)); + catch_scroll_color[0].setColor(QPalette::Inactive,QPalette::ButtonText, BUTTON_ACTIVE_TEXT_COLOR); - catch_scroll_color[0].setColor(QPalette::Inactive,QColorGroup::Button, + catch_scroll_color[0].setColor(QPalette::Inactive,QPalette::Button, BUTTON_ACTIVE_BACKGROUND_COLOR); - catch_scroll_color[0].setColor(QPalette::Inactive,QColorGroup::Background, - backgroundColor()); - catch_scroll_color[1]=QPalette(backgroundColor(),backgroundColor()); + catch_scroll_color[0].setColor(QPalette::Inactive,QPalette::Background, + palette().color(QPalette::Background)); + catch_scroll_color[1]=QPalette(palette().color(QPalette::Background),palette().color(QPalette::Background)); str=QString("RDCatch")+" v"+VERSION+" - "+tr("Host")+":"; setWindowTitle(str+" "+rda->config()->stationName()); @@ -188,7 +188,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) new RDSqlQuery("select NAME,IPV4_ADDRESS from STATIONS\ where NAME!=\"DEFAULT\""); while(q->next()) { - catch_connect.push_back(new CatchConnector(new RDCatchConnect(catch_connect.size(),this),q->value(0).toString().lower())); + catch_connect.push_back(new CatchConnector(new RDCatchConnect(catch_connect.size(),this),q->value(0).toString().toLower())); connect(catch_connect.back()->connector(), SIGNAL(statusChanged(int,unsigned,RDDeck::Status,int,const QString &)), this, @@ -222,7 +222,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) "MON_PORT_NUMBER "+ // 01 "from DECKS where "+ "(CARD_NUMBER!=-1)&&(PORT_NUMBER!=-1)&&(CHANNEL>0)&&"+ - "(STATION_NAME=\""+RDEscapeString(q->value(0).toString().lower())+"\") "+ + "(STATION_NAME=\""+RDEscapeString(q->value(0).toString().toLower())+"\") "+ "order by CHANNEL"; q1=new RDSqlQuery(sql); while(q1->next()) { @@ -240,8 +240,8 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) catch_monitor.back()->deckMon()-> enableMonitorButton((q1->value(1).toInt()>=0)&& - (rda->config()->stationName().lower()== - q->value(0).toString().lower())); + (rda->config()->stationName().toLower()== + q->value(0).toString().toLower())); catch_monitor.back()->deckMon()->show(); mapper->setMapping(catch_monitor.back()->deckMon(), catch_monitor.size()-1); @@ -262,49 +262,46 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) // // Filter Selectors // - catch_show_active_box=new QCheckBox(this,"catch_show_active_box"); - catch_show_active_label=new QLabel(catch_show_active_box, - tr("Show Only Active Events"), - this,"catch_show_active_label"); + catch_show_active_box=new QCheckBox(this); + catch_show_active_label=new QLabel(tr("Show Only Active Events"),this); catch_show_active_label->setFont(labelFont()); catch_show_active_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); connect(catch_show_active_box,SIGNAL(toggled(bool)), this,SLOT(filterChangedData(bool))); catch_show_today_box=new QCheckBox(this); - catch_show_today_label= - new QLabel(catch_show_active_box,tr("Show Only Today's Events"),this); + catch_show_today_label=new QLabel(tr("Show Only Today's Events"),this); catch_show_today_label->setFont(labelFont()); catch_show_today_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); connect(catch_show_today_box,SIGNAL(toggled(bool)), this,SLOT(filterChangedData(bool))); catch_dow_box=new QComboBox(this); - catch_dow_label=new QLabel(catch_dow_box,tr("Show DayOfWeek:"),this); + catch_dow_label=new QLabel(tr("Show DayOfWeek:"),this); catch_dow_label->setFont(labelFont()); catch_dow_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); - catch_dow_box->insertItem(tr("All")); - catch_dow_box->insertItem(tr("Weekdays")); - catch_dow_box->insertItem(tr("Sunday")); - catch_dow_box->insertItem(tr("Monday")); - catch_dow_box->insertItem(tr("Tuesday")); - catch_dow_box->insertItem(tr("Wednesday")); - catch_dow_box->insertItem(tr("Thursday")); - catch_dow_box->insertItem(tr("Friday")); - catch_dow_box->insertItem(tr("Saturday")); + catch_dow_box->insertItem(0,tr("All")); + catch_dow_box->insertItem(1,tr("Weekdays")); + catch_dow_box->insertItem(2,tr("Sunday")); + catch_dow_box->insertItem(3,tr("Monday")); + catch_dow_box->insertItem(4,tr("Tuesday")); + catch_dow_box->insertItem(5,tr("Wednesday")); + catch_dow_box->insertItem(6,tr("Thursday")); + catch_dow_box->insertItem(7,tr("Friday")); + catch_dow_box->insertItem(8,tr("Saturday")); connect(catch_dow_box,SIGNAL(activated(int)),this,SLOT(filterActivatedData(int))); catch_type_box=new QComboBox(this); connect(catch_type_box,SIGNAL(activated(int)),this,SLOT(filterActivatedData(int))); - catch_type_label=new QLabel(catch_type_box,tr("Show Event Type")+":",this); + catch_type_label=new QLabel(tr("Show Event Type")+":",this); catch_type_label->setFont(labelFont()); catch_type_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); for(int i=0;iinsertItem(rda->iconEngine()-> + catch_type_box->insertItem(catch_type_box->count(),rda->iconEngine()-> catchIcon((RDRecording::Type)i), RDRecording::typeString((RDRecording::Type)i)); } - catch_type_box->insertItem(tr("All Types")); - catch_type_box->setCurrentItem(catch_type_box->count()-1); + catch_type_box->insertItem(catch_type_box->count(),tr("All Types")); + catch_type_box->setCurrentIndex(catch_type_box->count()-1); // // Cart Picker @@ -378,6 +375,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) catch_clock_label->setFont(progressFont()); catch_clock_label->setAlignment(Qt::AlignCenter); catch_clock_timer=new QTimer(this); + catch_clock_timer->setSingleShot(true); connect(catch_clock_timer,SIGNAL(timeout()),this,SLOT(clockData())); clockData(); @@ -418,12 +416,14 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) // Next Event Timer // catch_next_timer=new QTimer(this); + catch_next_timer->setSingleShot(true); connect(catch_next_timer,SIGNAL(timeout()),this,SLOT(nextEventData())); // // Midnight Timer // catch_midnight_timer=new QTimer(this); + catch_midnight_timer->setSingleShot(true); connect(catch_midnight_timer,SIGNAL(timeout()),this,SLOT(midnightData())); midnightData(); LoadGeometry(); @@ -432,7 +432,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) QDate current_date=QDate::currentDate(); QTime next_time; if(ShowNextEvents(current_date.dayOfWeek(),current_time,&next_time)>0) { - catch_next_timer->start(current_time.msecsTo(next_time),true); + catch_next_timer->start(current_time.msecsTo(next_time)); } nextEventData(); @@ -442,7 +442,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) // QTimer *timer=new QTimer(this); connect(timer,SIGNAL(timeout()),this,SLOT(resizeData())); - timer->start(1,true); + timer->start(1); catch_resize=true; } @@ -486,7 +486,7 @@ void MainWidget::nextEventData() QTime current_time=QTime::currentTime().addMSecs(catch_time_offset); QDate current_date=QDate::currentDate(); if(ShowNextEvents(current_date.dayOfWeek(),current_time,&next_time)>0) { - catch_next_timer->start(current_time.msecsTo(next_time),true); + catch_next_timer->start(current_time.msecsTo(next_time)); if(catch_scroll) { UpdateScroll(); } @@ -498,7 +498,7 @@ void MainWidget::nextEventData() int interval=current_time.msecsTo(QTime(23,59,59))+1000+ 86400000*extra_day+ QTime().msecsTo(next_time); - catch_next_timer->start(interval,true); + catch_next_timer->start(interval); if(catch_scroll) { UpdateScroll(); } @@ -511,7 +511,7 @@ void MainWidget::nextEventData() int interval=current_time.msecsTo(QTime(23,59,59))+1000+ 86400000*extra_day+ QTime().msecsTo(next_time); - catch_next_timer->start(interval,true); + catch_next_timer->start(interval); if(catch_scroll) { UpdateScroll(); } @@ -701,8 +701,8 @@ void MainWidget::ripcUserData() QString str; str=QString("RDCatch")+" v"+VERSION+" - "+tr("Host")+":"; - setCaption(str+" "+rda->config()->stationName()+", "+tr("User")+": "+ - rda->ripc()->user()); + setWindowTitle(str+" "+rda->config()->stationName()+", "+tr("User")+": "+ + rda->ripc()->user()); // // Set Control Perms @@ -773,7 +773,7 @@ void MainWidget::reportsButtonData() { ListReports *lr=new ListReports(catch_show_today_box->isChecked(), catch_show_active_box->isChecked(), - catch_dow_box->currentItem(),this); + catch_dow_box->currentIndex(),this); lr->exec(); delete lr; } @@ -1106,7 +1106,7 @@ void MainWidget::clockData() { QTime current_time=QTime::currentTime().addMSecs(catch_time_offset); catch_clock_label->setText(current_time.toString("hh:mm:ss")); - catch_clock_timer->start(1000-current_time.msec(),true); + catch_clock_timer->start(1000-current_time.msec()); } @@ -1115,7 +1115,7 @@ void MainWidget::midnightData() filterChangedData(false); catch_midnight_timer-> start(86400000+QTime::currentTime().addMSecs(catch_time_offset). - msecsTo(QTime()),true); + msecsTo(QTime())); } @@ -1190,7 +1190,7 @@ int MainWidget::ShowNextEvents(int day,QTime time,QTime *next) "START_TIME "+ // 01 "from RECORDINGS where "+ "(IS_ACTIVE=\"Y\")&&"+ - "("+RDGetShortDayNameEN(day).upper()+"=\"Y\") "+ + "("+RDGetShortDayNameEN(day).toUpper()+"=\"Y\") "+ "order by START_TIME"; } else { @@ -1201,7 +1201,7 @@ int MainWidget::ShowNextEvents(int day,QTime time,QTime *next) "(IS_ACTIVE=\"Y\")&&"+ "(time_to_sec(START_TIME)>time_to_sec(\""+ RDEscapeString(time.toString("hh:mm:ss"))+"\"))&&"+ - "("+RDGetShortDayNameEN(day).upper()+"=\"Y\")"+ + "("+RDGetShortDayNameEN(day).toUpper()+"=\"Y\")"+ "order by START_TIME"; } RDSqlQuery *q=new RDSqlQuery(sql); @@ -1295,7 +1295,7 @@ int MainWidget::GetMonitor(int serial,int chan) int MainWidget::GetConnection(QString station,unsigned chan) { for(unsigned i=0;istationName()==station.lower()) { + if(catch_connect[i]->stationName()==station.toLower()) { if(chan==0) { return i; } @@ -1342,7 +1342,7 @@ void MainWidget::SaveGeometry() if(geometry_file.isEmpty()) { return; } - FILE *file=fopen(geometry_file,"w"); + FILE *file=fopen(geometry_file.toUtf8(),"w"); if(file==NULL) { return; } @@ -1361,25 +1361,24 @@ int main(int argc,char *argv[]) // // Load Translations // - QTranslator qt(0); - qt.load(QString("/usr/share/qt4/translations/qt_")+QTextCodec::locale(), - "."); - a.installTranslator(&qt); + QString loc=RDApplication::locale(); + if(!loc.isEmpty()) { + QTranslator qt(0); + qt.load(QString("/usr/share/qt4/translations/qt_")+loc,"."); + a.installTranslator(&qt); - QTranslator rd(0); - rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+ - QTextCodec::locale(),"."); - a.installTranslator(&rd); + QTranslator rd(0); + rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+loc,"."); + a.installTranslator(&rd); - QTranslator rdhpi(0); - rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+ - QTextCodec::locale(),"."); - a.installTranslator(&rdhpi); + QTranslator rdhpi(0); + rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+loc,"."); + a.installTranslator(&rdhpi); - QTranslator tr(0); - tr.load(QString(PREFIX)+QString("/share/rivendell/rdcatch_")+ - QTextCodec::locale(),"."); - a.installTranslator(&tr); + QTranslator tr(0); + tr.load(QString(PREFIX)+QString("/share/rivendell/rdcatch_")+loc,"."); + a.installTranslator(&tr); + } // // Start Event Loop @@ -1387,7 +1386,6 @@ int main(int argc,char *argv[]) RDConfig *config=new RDConfig(); config->load(); MainWidget *w=new MainWidget(config); - a.setMainWidget(w); w->show(); return a.exec(); } diff --git a/rdcatch/rdcatch_cs.ts b/rdcatch/rdcatch_cs.ts index 9d689857..2acd5a86 100644 --- a/rdcatch/rdcatch_cs.ts +++ b/rdcatch/rdcatch_cs.ts @@ -336,7 +336,7 @@ nové Unsupported URL protocol! - Nepodporovaný protokol URL! + Nepodporovaný protokol URL! Event Offset: @@ -358,6 +358,10 @@ nové Update Library Metadata Obnovit knihovní popisná data + + Unsupported URL scheme! + + EditPlayout @@ -924,7 +928,7 @@ nové Unsupported URL protocol! - Nepodporovaný protokol URL! + Nepodporovaný protokol URL! Event Offset: @@ -946,6 +950,10 @@ nové Export Library Metadata Vyvést knihovní popisná data + + Unsupported URL scheme! + + ListReports diff --git a/rdcatch/rdcatch_de.ts b/rdcatch/rdcatch_de.ts index 13eece44..e1dc6bbe 100644 --- a/rdcatch/rdcatch_de.ts +++ b/rdcatch/rdcatch_de.ts @@ -336,7 +336,7 @@ Neu Unsupported URL protocol! - Nicht unterstütztes URL-Protokoll! + Nicht unterstütztes URL-Protokoll! Event Offset: @@ -358,6 +358,10 @@ Neu Update Library Metadata Bibliotheksmetadaten updaten + + Unsupported URL scheme! + + EditPlayout @@ -924,7 +928,7 @@ Neu Unsupported URL protocol! - Nicht unterstütztes URL-Protokoll! + Nicht unterstütztes URL-Protokoll! Event Offset: @@ -946,6 +950,10 @@ Neu Export Library Metadata Bibliotheksmetadaten exportieren + + Unsupported URL scheme! + + ListReports diff --git a/rdcatch/rdcatch_es.ts b/rdcatch/rdcatch_es.ts index bf18de44..9e1d0e1b 100644 --- a/rdcatch/rdcatch_es.ts +++ b/rdcatch/rdcatch_es.ts @@ -302,7 +302,7 @@ como nuevo Unsupported URL protocol! - ¡Protocolo de URL no soportado! + ¡Protocolo de URL no soportado! Duplicate Event @@ -358,6 +358,10 @@ como Nuevo Update Library Metadata Actualizar metadatos en biblioteca + + Unsupported URL scheme! + + EditPlayout @@ -874,7 +878,7 @@ como Nuevo Unsupported URL protocol! - ¡Protocolo de URL no soportado! + ¡Protocolo de URL no soportado! Export Format: @@ -946,6 +950,10 @@ como Nuevo Export Library Metadata Exportar Bibliot. Metadatos + + Unsupported URL scheme! + + ListReports diff --git a/rdcatch/rdcatch_fr.ts b/rdcatch/rdcatch_fr.ts index b1b8dda9..e0baa0aa 100644 --- a/rdcatch/rdcatch_fr.ts +++ b/rdcatch/rdcatch_fr.ts @@ -325,10 +325,6 @@ New The URL is invalid! - - Unsupported URL protocol! - - Event Offset: @@ -349,6 +345,10 @@ New Update Library Metadata + + Unsupported URL scheme! + + EditPlayout @@ -901,10 +901,6 @@ New The URL is invalid! - - Unsupported URL protocol! - - Event Offset: @@ -925,6 +921,10 @@ New Export Library Metadata + + Unsupported URL scheme! + + ListReports diff --git a/rdcatch/rdcatch_nb.ts b/rdcatch/rdcatch_nb.ts index fe6a10d3..5e5c4ed4 100644 --- a/rdcatch/rdcatch_nb.ts +++ b/rdcatch/rdcatch_nb.ts @@ -334,7 +334,7 @@ New Unsupported URL protocol! - Ikkje støtta adresseprotokoll! + Ikkje støtta adresseprotokoll! Event Offset: @@ -356,6 +356,10 @@ New Update Library Metadata + + Unsupported URL scheme! + + EditPlayout @@ -921,7 +925,7 @@ ny Unsupported URL protocol! - Ikkje støtta adresseprotokoll! + Ikkje støtta adresseprotokoll! Event Offset: @@ -943,6 +947,10 @@ ny Export Library Metadata + + Unsupported URL scheme! + + ListReports diff --git a/rdcatch/rdcatch_nn.ts b/rdcatch/rdcatch_nn.ts index fe6a10d3..5e5c4ed4 100644 --- a/rdcatch/rdcatch_nn.ts +++ b/rdcatch/rdcatch_nn.ts @@ -334,7 +334,7 @@ New Unsupported URL protocol! - Ikkje støtta adresseprotokoll! + Ikkje støtta adresseprotokoll! Event Offset: @@ -356,6 +356,10 @@ New Update Library Metadata + + Unsupported URL scheme! + + EditPlayout @@ -921,7 +925,7 @@ ny Unsupported URL protocol! - Ikkje støtta adresseprotokoll! + Ikkje støtta adresseprotokoll! Event Offset: @@ -943,6 +947,10 @@ ny Export Library Metadata + + Unsupported URL scheme! + + ListReports diff --git a/rdcatch/rdcatch_pt_BR.ts b/rdcatch/rdcatch_pt_BR.ts index 0ba092df..87c821ca 100644 --- a/rdcatch/rdcatch_pt_BR.ts +++ b/rdcatch/rdcatch_pt_BR.ts @@ -344,7 +344,7 @@ Novo Unsupported URL protocol! - Protocolo URL sem suporte! + Protocolo URL sem suporte! Update Library Metadata @@ -358,6 +358,10 @@ Novo You must specify a username! + + Unsupported URL scheme! + + EditPlayout @@ -932,7 +936,7 @@ Novo Unsupported URL protocol! - Protocolo URL sem suporte! + Protocolo URL sem suporte! Export Library Metadata @@ -946,6 +950,10 @@ Novo You must specify a username! + + Unsupported URL scheme! + + ListReports diff --git a/rdcatchd/Makefile.am b/rdcatchd/Makefile.am index 6fd417a2..eb0e0d21 100644 --- a/rdcatchd/Makefile.am +++ b/rdcatchd/Makefile.am @@ -1,8 +1,8 @@ -## automake.am +## Makefile.am ## ## rdcatchd/ Makefile.am for Rivendell ## -## (C) Copyright 2002-2018 Fred Gleason +## (C) Copyright 2002-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -20,7 +20,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -39,7 +39,7 @@ dist_rdcatchd_SOURCES = batch.cpp\ nodist_rdcatchd_SOURCES = moc_event_player.cpp\ moc_rdcatchd.cpp -rdcatchd_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdcatchd_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ moc_* diff --git a/rdcatchd/batch.cpp b/rdcatchd/batch.cpp index c43d7fed..4e56b087 100644 --- a/rdcatchd/batch.cpp +++ b/rdcatchd/batch.cpp @@ -2,7 +2,7 @@ // // Batch Routines for the Rivendell netcatcher daemon // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -33,13 +33,7 @@ #include #include -#include - -#include -#include -#include -#include -#include +#include #include #include @@ -208,7 +202,7 @@ void MainObject::RunDownload(CatchEvent *evt) QString url_username=evt->urlUsername(); QString url_password=evt->urlPassword(); if(url_username.isEmpty()&& - (QUrl(evt->resolvedUrl()).scheme().lower()=="ftp")) { + (QUrl(evt->resolvedUrl()).scheme().toLower()=="ftp")) { url_username=RD_ANON_FTP_USERNAME; url_password=QString(RD_ANON_FTP_PASSWORD)+"-"+VERSION; } @@ -233,7 +227,7 @@ void MainObject::RunDownload(CatchEvent *evt) (const char *)RDDownload::errorText(conv_err).toUtf8(), evt->id()); delete conv; - unlink(evt->tempName()); + unlink(evt->tempName().toUtf8()); exit(0); default: @@ -245,7 +239,7 @@ void MainObject::RunDownload(CatchEvent *evt) (const char *)RDDownload::errorText(conv_err).toUtf8(), evt->id()); delete conv; - unlink(evt->tempName()); + unlink(evt->tempName().toUtf8()); exit(0); } delete conv; @@ -259,7 +253,7 @@ void MainObject::RunDownload(CatchEvent *evt) } rda->syslog(LOG_INFO,"deleting file %s, id=%d", (const char *)evt->tempName().toUtf8(),evt->id()); - unlink(evt->tempName()); + unlink(evt->tempName().toUtf8()); catch_connect->setExitCode(evt->id(),RDRecording::Ok,"OK"); } @@ -323,7 +317,7 @@ void MainObject::RunUpload(CatchEvent *evt) QString url_username=evt->urlUsername(); QString url_password=evt->urlPassword(); if(url_username.isEmpty()&& - (QUrl(evt->resolvedUrl()).scheme().lower()=="ftp")) { + (QUrl(evt->resolvedUrl()).scheme().toLower()=="ftp")) { url_username=RD_ANON_FTP_USERNAME; url_password=QString(RD_ANON_FTP_PASSWORD)+"-"+VERSION; } @@ -370,12 +364,12 @@ void MainObject::RunUpload(CatchEvent *evt) CheckInPodcast(evt); } if(evt->deleteTempFile()) { - unlink(evt->tempName()); + unlink(evt->tempName().toUtf8()); rda->syslog(LOG_INFO,"deleted file %s", (const char *)evt->tempName().toUtf8()); } else { - chown(evt->tempName(),rda->config()->uid(),rda->config()->gid()); + chown(evt->tempName().toUtf8(),rda->config()->uid(),rda->config()->gid()); } } @@ -525,7 +519,7 @@ bool MainObject::Import(CatchEvent *evt) (const char *)evt->cutName().toUtf8(), evt->id()); if(evt->deleteTempFile()) { - unlink(evt->tempName()); + unlink(evt->tempName().toUtf8()); rda->syslog(LOG_DEBUG,"deleted file \"%s\"", (const char *)evt->tempName().toUtf8()); } diff --git a/rdcatchd/event_player.cpp b/rdcatchd/event_player.cpp index e54c9c05..8f803c77 100644 --- a/rdcatchd/event_player.cpp +++ b/rdcatchd/event_player.cpp @@ -2,7 +2,7 @@ // // A player class for Deck Events // -// (C) Copyright 2016-2019 Fred Gleason +// (C) Copyright 2016-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -20,9 +20,8 @@ #include -#include "rdapplication.h" -#include "rddb.h" -#include "rdescape_string.h" +#include +#include #include "event_player.h" @@ -32,6 +31,7 @@ EventPlayer::EventPlayer(RDStation *station,int chan,QObject *parent) event_channel=chan; event_timer=new QTimer(this); + event_timer->setSingleShot(true); connect(event_timer,SIGNAL(timeout()),this,SLOT(timeoutData())); } @@ -81,8 +81,7 @@ void EventPlayer::start(int start_ptr) for(unsigned i=0;i=event_start_point) { event_current_event=i; - event_timer-> - start(event_points[event_current_event]-event_start_point,true); + event_timer->start(event_points[event_current_event]-event_start_point); return; } } @@ -117,6 +116,6 @@ void EventPlayer::timeoutData() if(msec<0) { msec=0; } - event_timer->start(msec,true); + event_timer->start(msec); } } diff --git a/rdcatchd/rdcatchd.cpp b/rdcatchd/rdcatchd.cpp index 49507d90..c5e52d4a 100644 --- a/rdcatchd/rdcatchd.cpp +++ b/rdcatchd/rdcatchd.cpp @@ -165,7 +165,7 @@ MainObject::MainObject(QObject *parent) rda=static_cast(new RDCoreApplication("rdcatchd","rdcatchd", RDCATCHD_USAGE,this)); if(!rda->open(&err_msg,&err_type,false)) { - fprintf(stderr,"rdcatchd: %s\n",(const char *)err_msg); + fprintf(stderr,"rdcatchd: %s\n",err_msg.toUtf8().constData()); exit(1); } @@ -183,7 +183,7 @@ MainObject::MainObject(QObject *parent) } if(!rda->cmdSwitch()->processed(i)) { fprintf(stderr,"rdcatchdd: unknown command option \"%s\"\n", - (const char *)rda->cmdSwitch()->key(i)); + rda->cmdSwitch()->key(i).toUtf8().constData()); exit(2); } } @@ -224,7 +224,7 @@ MainObject::MainObject(QObject *parent) catch_event_mapper=new QSignalMapper(this); connect(catch_event_mapper,SIGNAL(mapped(int)), this,SLOT(eventFinishedData(int))); - QTimer *timer=new QTimer(this,"free_events_timer"); + QTimer *timer=new QTimer(this); connect(timer,SIGNAL(timeout()),this,SLOT(freeEventsData())); timer->start(RDCATCHD_FREE_EVENTS_INTERVAL); @@ -411,9 +411,10 @@ MainObject::MainObject(QObject *parent) // // Schedule Startup Cart // - timer=new QTimer(this,"startup_cart_timer"); + timer=new QTimer(this); + timer->setSingleShot(true); connect(timer,SIGNAL(timeout()),this,SLOT(startupCartData())); - timer->start(10000,true); + timer->start(10000); // // Set Realtime Permissions @@ -504,12 +505,12 @@ void MainObject::gpiStateChangedData(int matrix,int line,bool state) (catch_events[i].gpiStartTimer()->isActive())) { if(catch_events[i].startOffset()>0) { catch_events[i].gpiOffsetTimer()-> - start(catch_events[i].startOffset(),true); + start(catch_events[i].startOffset()); catch_events[i].gpiStartTimer()->stop(); BroadcastCommand(QString().sprintf("RE %d %d %d!", catch_events[i].channel(), RDDeck::Ready, - catch_events[i].id())); + catch_events[i].id()).toUtf8()); } else { if(StartRecording(i)) { @@ -559,7 +560,7 @@ void MainObject::startTimerData(int id) catch_record_id[deck]=0; BroadcastCommand(QString().sprintf("RE %d %d %d!", deck+1,catch_record_deck_status[deck], - id)); + id).toUtf8()); rda->syslog(LOG_INFO,"gpi start window closes: event: %d, gpi: %d:%d", id,catch_events[event].startMatrix(), catch_events[event].startLine()); @@ -620,7 +621,8 @@ void MainObject::engineData(int id) WriteExitCode(event,RDRecording::DeviceBusy); BroadcastCommand(QString().sprintf("RE 0 %d %d %s!",RDDeck::Recording, catch_events[event].id(), - (const char *)catch_events[event].cutName())); + catch_events[event].cutName(). + toUtf8().constData()).toUtf8()); return; } } @@ -637,10 +639,10 @@ void MainObject::engineData(int id) catch_events[event].channel(), catch_record_deck_status[catch_events[event]. channel()-1], - catch_events[event].id())); + catch_events[event].id()).toUtf8()); rda->syslog(LOG_WARNING,"record aborted: no such cut: %s, id: %d", - (const char *)catch_events[event].cutName(), - catch_events[event].id()); + catch_events[event].cutName().toUtf8().constData(), + catch_events[event].id()); return; } catch_record_card[catch_events[event].channel()-1]=-1; @@ -696,7 +698,7 @@ void MainObject::engineData(int id) catch_events[event].gpiStartTimer()-> start(catch_events[event].startLength()- (QTime().msecsTo(current_time)- - QTime().msecsTo(catch_events[event].startTime())),true); + QTime().msecsTo(catch_events[event].startTime()))); catch_record_deck_status[catch_events[event].channel()-1]= RDDeck::Waiting; catch_record_id[catch_events[event].channel()-1]= @@ -707,7 +709,7 @@ void MainObject::engineData(int id) catch_events[event].channel(), catch_record_deck_status[catch_events[event]. channel()-1], - catch_events[event].id())); + catch_events[event].id()).toUtf8()); rda->syslog(LOG_INFO,"gpi start window opens: event: %d, gpi: %d:%d", id,catch_events[event].startMatrix(), catch_events[event].startLine()); @@ -723,7 +725,7 @@ void MainObject::engineData(int id) catch_events[event].channel(), catch_playout_deck_status[catch_events[event]. channel()-129], - catch_events[event].id())); + catch_events[event].id()).toUtf8()); rda->syslog(LOG_WARNING,"playout aborted: no such cut: %s, id: %d", (const char *)catch_events[event].cutName().toUtf8(), catch_events[event].id()); @@ -762,7 +764,7 @@ void MainObject::engineData(int id) if(!RDCart::exists(catch_events[event].macroCart())) { WriteExitCode(event,RDRecording::NoCut); BroadcastCommand(QString(). - sprintf("RE 0 0 %d!",catch_events[event].id())); + sprintf("RE 0 0 %d!",catch_events[event].id()).toUtf8()); rda->syslog(LOG_WARNING,"macro aborted: no such cart: %u, id: %d", catch_events[event].macroCart(), catch_events[event].id()); @@ -779,7 +781,7 @@ void MainObject::engineData(int id) if(!RDCut::exists(catch_events[event].cutName())) { WriteExitCode(event,RDRecording::NoCut); BroadcastCommand(QString(). - sprintf("RE 0 0 %d!",catch_events[event].id())); + sprintf("RE 0 0 %d!",catch_events[event].id()).toUtf8()); rda->syslog(LOG_WARNING,"download aborted: no such cut: %s, id: %d", (const char *)catch_events[event].cutName().toUtf8(), catch_events[event].id()); @@ -823,7 +825,7 @@ void MainObject::engineData(int id) if(!RDCut::exists(catch_events[event].cutName())) { WriteExitCode(event,RDRecording::NoCut); BroadcastCommand(QString(). - sprintf("RE 0 0 %d!",catch_events[event].id())); + sprintf("RE 0 0 %d!",catch_events[event].id()).toUtf8()); rda->syslog(LOG_WARNING,"upload aborted: no such cut: %s, id: %d", (const char *)catch_events[event].cutName().toUtf8(), catch_events[event].id()); @@ -896,7 +898,7 @@ void MainObject::recordLoadedData(int card,int stream) catch_record_deck_status[deck-1]=RDDeck::Ready; BroadcastCommand(QString().sprintf("RE %d %d %d!", deck,catch_record_deck_status[deck-1], - catch_record_id[deck-1])); + catch_record_id[deck-1]).toUtf8()); rda->syslog(LOG_DEBUG,"Loaded - Card: %d Stream: %d\n",card,stream); } @@ -914,7 +916,7 @@ void MainObject::recordingData(int card,int stream) BroadcastCommand(QString().sprintf("RE %d %d %d %s!", deck,catch_record_deck_status[deck-1], catch_record_id[deck-1], - (const char *)cutname)); + cutname.toUtf8().constData()).toUtf8()); catch_record_status[deck-1]=true; if(debug) { printf("Recording - Card: %d Stream: %d, Id: %d\n",card,stream, @@ -974,7 +976,7 @@ void MainObject::recordUnloadedData(int card,int stream,unsigned msecs) } BroadcastCommand(QString().sprintf("RE %d %d %d!", deck,RDDeck::Idle, - catch_record_id[deck-1])); + catch_record_id[deck-1]).toUtf8()); catch_record_id[deck-1]=0; if(debug) { printf("Unloaded - Card: %d Stream: %d\n",card,stream); @@ -1011,7 +1013,7 @@ void MainObject::playLoadedData(int handle) catch_playout_deck_status[deck-129]=RDDeck::Ready; BroadcastCommand(QString().sprintf("RE %d %d %d!", deck,catch_playout_deck_status[deck-129], - catch_playout_id[deck-129])); + catch_playout_id[deck-129]).toUtf8()); if(debug) { printf("Play Loaded - Card: %d Stream: %d\n", catch_playout_card[deck-129], @@ -1028,7 +1030,7 @@ void MainObject::playingData(int handle) RDRecording::PlayActive); BroadcastCommand(QString().sprintf("RE %d %d %d!", deck,catch_playout_deck_status[deck-129], - catch_playout_id[deck-129])); + catch_playout_id[deck-129]).toUtf8()); catch_playout_status[GetPlayoutDeck(handle)]=true; if(debug) { printf("Playing - Card: %d Stream: %d\n", @@ -1067,7 +1069,7 @@ void MainObject::playUnloadedData(int handle) WriteExitCodeById(catch_playout_id[deck-129],RDRecording::Ok); BroadcastCommand(QString().sprintf("RE %d %d %d!",deck, catch_playout_deck_status[deck-129], - catch_playout_id[deck-129])); + catch_playout_id[deck-129]).toUtf8()); if(debug) { printf("Play unloaded - Card: %d Stream: %d\n", catch_playout_card[deck-129],catch_playout_stream[deck-129]); @@ -1125,7 +1127,7 @@ void MainObject::eventFinishedData(int id) catch_events[event].setStatus(RDDeck::Idle); BroadcastCommand(QString().sprintf("RE 0 %d %d!", RDDeck::Idle, - catch_macro_event_id[id])); + catch_macro_event_id[id]).toUtf8()); if(catch_events[event].oneShot()) { PurgeEvent(event); } @@ -1174,7 +1176,8 @@ void MainObject::updateXloadsData() it=catch_active_xloads.begin()+i; BroadcastCommand(QString(). sprintf("RE 0 %d %d!",RDDeck::Idle, - catch_events[catch_active_xloads[i]].id())); + catch_events[catch_active_xloads[i]].id()). + toUtf8()); catch_active_xloads.erase(it,it+1); break; @@ -1225,7 +1228,7 @@ bool MainObject::StartRecording(int event) WriteExitCodeById(catch_events[event].id(),RDRecording::InternalError); BroadcastCommand(QString().sprintf("RE %d %d %d!", deck,catch_record_deck_status[deck-1], - catch_events[event].id())); + catch_events[event].id()).toUtf8()); rda->syslog(LOG_WARNING,"invalid audio device for deck: %d, event: %d", deck,catch_events[event].id()); return false; @@ -1239,7 +1242,7 @@ bool MainObject::StartRecording(int event) WriteExitCodeById(catch_events[event].id(),RDRecording::DeviceBusy); BroadcastCommand(QString().sprintf("RE %d %d %d!", deck,catch_record_deck_status[deck-1], - catch_events[event].id())); + catch_events[event].id()).toUtf8()); rda->syslog(LOG_WARNING, "device busy for deck: %d, event: %d | in use by event: %d", deck,catch_events[event].id(),catch_record_id[deck-1]); @@ -1322,8 +1325,8 @@ bool MainObject::StartRecording(int event) str+=QString().sprintf(" card: %d, stream: %d, cut: %s length: %d", catch_record_card[deck-1], catch_record_stream[deck-1], - (const char *)cut_name,length); - rda->syslog(LOG_INFO,str); + cut_name.toUtf8().constData(),length); + rda->syslog(LOG_INFO,"%s",str.toUtf8().constData()); // // Cache Selected Fields @@ -1497,7 +1500,7 @@ void MainObject::StartDownloadEvent(int event) } BroadcastCommand(QString().sprintf("RE 0 %d %d!", RDDeck::Recording, - catch_events[event].id())); + catch_events[event].id()).toUtf8()); StartBatch(catch_events[event].id()); } @@ -1510,7 +1513,7 @@ void MainObject::StartUploadEvent(int event) catch_xload_timer->start(XLOAD_UPDATE_INTERVAL); } BroadcastCommand(QString().sprintf("RE 0 %d %d!",RDDeck::Recording, - catch_events[event].id())); + catch_events[event].id()).toUtf8()); StartBatch(catch_events[event].id()); } @@ -1526,11 +1529,12 @@ bool MainObject::ExecuteMacroCart(RDCart *cart,int id,int event) catch_events[event].setStatus(RDDeck::Recording); } if(id!=-1) { - BroadcastCommand(QString().sprintf("RE 0 %d %d!",RDDeck::Recording,id)); + BroadcastCommand(QString().sprintf("RE 0 %d %d!",RDDeck::Recording,id). + toUtf8()); } catch_macro_event_id[event_id]=id; catch_event_pool[event_id]= - new RDMacroEvent(rda->station()->address(),rda->ripc(),this,"event"); + new RDMacroEvent(rda->station()->address(),rda->ripc(),this); catch_event_mapper->setMapping(catch_event_pool[event_id],event_id); connect(catch_event_pool[event_id],SIGNAL(finished()), catch_event_mapper,SLOT(map())); @@ -1811,23 +1815,23 @@ void MainObject::DispatchCommand(ServerConnection *conn) } -void MainObject::EchoCommand(int ch,const char *command) +void MainObject::EchoCommand(int ch,const QString &cmd) { // LogLine(RDConfig::LogDebug,QString().sprintf("rdcatchd: EchoCommand(%d,%s)",ch,command)); ServerConnection *conn=catch_connections.at(ch); if(conn->socket()->state()==QAbstractSocket::ConnectedState) { - conn->socket()->write(command,strlen(command)); + conn->socket()->write(cmd.toUtf8()); } } -void MainObject::BroadcastCommand(const char *command,int except_ch) +void MainObject::BroadcastCommand(const QString &cmd,int except_ch) { // LogLine(RDConfig::LogDebug,QString().sprintf("rdcatchd: BroadcastCommand(%s)",command)); for(int i=0;istartType()==RDRecording::GpiStart) { - e->setGpiStartTimer(new QTimer(this)); + QTimer *timer; + timer=new QTimer(this); + timer->setSingleShot(true); + e->setGpiStartTimer(timer); catch_gpi_start_mapper->setMapping(e->gpiStartTimer(),e->id()); connect(e->gpiStartTimer(),SIGNAL(timeout()), catch_gpi_start_mapper,SLOT(map())); - e->setGpiOffsetTimer(new QTimer(this)); + timer=new QTimer(this); + timer->setSingleShot(true); + e->setGpiOffsetTimer(timer); catch_gpi_offset_mapper->setMapping(e->gpiOffsetTimer(),e->id()); connect(e->gpiOffsetTimer(),SIGNAL(timeout()), catch_gpi_offset_mapper,SLOT(map())); @@ -2343,7 +2352,8 @@ void MainObject::CheckInRecording(QString cutname,CatchEvent *evt, cart->updateLength(); delete cart; delete cut; - chown(RDCut::pathName(cutname),rda->config()->uid(),rda->config()->gid()); + chown(RDCut::pathName(cutname).toUtf8(),rda->config()->uid(), + rda->config()->gid()); } @@ -2383,7 +2393,7 @@ void MainObject::CheckInPodcast(CatchEvent *e) const // Add the Cast Entry // RDPodcast::Status status=RDPodcast::StatusPending; - if(q->value(0).toString().lower()=="y") { + if(q->value(0).toString().toLower()=="y") { status=RDPodcast::StatusActive; } sql=QString("insert into PODCASTS set ")+ @@ -2490,10 +2500,10 @@ QString MainObject::BuildTempName(CatchEvent *evt,QString str) QString MainObject::GetFileExtension(QString filename) { for(int i=filename.length()-1;i>=0;i--) { - if(((const char *)filename)[i]=='/') { + if(filename.at(i)==QChar('/')) { return QString(); } - if(((const char *)filename)[i]=='.') { + if(filename.at(i)==QChar('.')) { return filename.right(filename.length()-i-1); } } @@ -2525,7 +2535,7 @@ bool MainObject::SendErrorMessage(CatchEvent *event,const QString &err_desc, } catch_macro_event_id[event_id]=event->id()+RDCATCHD_ERROR_ID_OFFSET; catch_event_pool[event_id]= - new RDMacroEvent(rda->station()->address(),rda->ripc(),this,"event"); + new RDMacroEvent(rda->station()->address(),rda->ripc(),this); catch_event_mapper->setMapping(catch_event_pool[event_id],event_id); connect(catch_event_pool[event_id],SIGNAL(finished()), catch_event_mapper,SLOT(map())); @@ -2645,11 +2655,11 @@ void MainObject::StartBatch(int id) { if((fork())==0) { QString bin=QString(RD_PREFIX)+"/"+"sbin/rdcatchd"; - execl(bin,(const char *)bin, - (const char *)QString().sprintf("--event-id=%d",id), + execl(bin.toUtf8(),bin.toUtf8().constData(), + QString().sprintf("--event-id=%d",id).toUtf8().constData(), (char *)NULL); rda->syslog(LOG_ERR,"failed to exec %s --event-id=%d: %s", - (const char *)bin, + bin.toUtf8().constData(), id,strerror(errno)); exit(0); } @@ -2669,8 +2679,10 @@ void MainObject::SendNotification(RDNotification::Type type, QString MainObject::GetTempRecordingName(int id) const { return QString().sprintf("%s/rdcatchd-record-%d.%s", - RDConfiguration()->audioRoot().ascii(),id, - RDConfiguration()->audioExtension().ascii()); + RDConfiguration()->audioRoot().toAscii().constData(), + id, + RDConfiguration()->audioExtension().toAscii(). + constData()); } diff --git a/rdcatchd/rdcatchd.h b/rdcatchd/rdcatchd.h index 8df34ecd..5e87e585 100644 --- a/rdcatchd/rdcatchd.h +++ b/rdcatchd/rdcatchd.h @@ -2,7 +2,7 @@ // // The Rivendell Netcatcher. // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -160,8 +160,8 @@ class MainObject : public QObject void SendDeckEvent(int deck,int number); void ParseCommand(int); void DispatchCommand(ServerConnection *conn); - void EchoCommand(int,const char *); - void BroadcastCommand(const char *,int except_ch=-1); + void EchoCommand(int,const QString &cmd); + void BroadcastCommand(const QString &cmd,int except_ch=-1); void EchoArgs(int,const char); void LoadEngine(bool adv_day=false); QString LoadEventSql(); @@ -202,7 +202,7 @@ class MainObject : public QObject QString catch_host; bool debug; RDTimeEngine *catch_engine; - Q_INT16 tcp_port; + int16_t tcp_port; QTcpServer *server; RDCatchConnect *catch_connect; diff --git a/rdhpi/Makefile.am b/rdhpi/Makefile.am index 19b26d05..494ed278 100644 --- a/rdhpi/Makefile.am +++ b/rdhpi/Makefile.am @@ -1,12 +1,10 @@ -## automake.am +## Makefile.am ## ## Automake.am for rivendell/mlhpi ## ## by Fred Gleason ## -## Use automake to process this into a Makefile.in -## -## (C) Copyright 2002-2007,2016-2018 Fred Gleason +## (C) Copyright 2002-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -21,8 +19,9 @@ ## License along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ## +## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ CWRAP = ../helpers/cwrap diff --git a/rdhpi/rdhpiplaystream.cpp b/rdhpi/rdhpiplaystream.cpp index 1b826a88..32a2baf2 100644 --- a/rdhpi/rdhpiplaystream.cpp +++ b/rdhpi/rdhpiplaystream.cpp @@ -2,7 +2,7 @@ // // A class for playing Microsoft WAV file on AudioScience HPI devices. // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -25,13 +25,10 @@ #include #include #include -#include -#include -#include -#include #include #include + #include "rdhpiplaystream.h" #include "rdhpisoundcard.h" @@ -120,6 +117,7 @@ RDHPIPlayStream::RDHPIPlayStream(RDHPISoundCard *card,QWidget *parent) connect(clock,SIGNAL(timeout()),this,SLOT(tickClock())); play_timer=new QTimer(this); + play_timer->setSingleShot(true); connect(play_timer,SIGNAL(timeout()),this,SLOT(pause())); } @@ -160,7 +158,7 @@ QString RDHPIPlayStream::errorString(RDHPIPlayStream::Error err) default: str=QString(tr("Unknown RDHpiPlayStream Error:")); - return QString().sprintf("%s %d\n",(const char *)str,err); + return QString().sprintf("%s %d\n",str.toUtf8().constData(),err); break; } } @@ -527,7 +525,7 @@ bool RDHPIPlayStream::play() is_paused=false; stopping=false; if(play_length>0) { - play_timer->start(play_length,true); + play_timer->start(play_length); start_time=QTime::currentTime(); } stream_state=RDHPIPlayStream::Playing; @@ -699,7 +697,8 @@ void RDHPIPlayStream::setPlayLength(int length) if((diff=length-start_time.msecsTo(current_time))<=0) { diff=0; } - play_timer->changeInterval(diff); + play_timer->stop(); + play_timer->start(diff); start_time=current_time; } play_length=length; diff --git a/rdhpi/rdhpirecordstream.cpp b/rdhpi/rdhpirecordstream.cpp index 9939bc21..455c0086 100644 --- a/rdhpi/rdhpirecordstream.cpp +++ b/rdhpi/rdhpirecordstream.cpp @@ -2,7 +2,7 @@ // // A class for recording Microsoft WAV files. // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -25,10 +25,6 @@ #include #include #include -#include -#include -#include -#include #include @@ -100,6 +96,7 @@ RDHPIRecordStream::RDHPIRecordStream(RDHPISoundCard *card,QWidget *parent) connect(clock,SIGNAL(timeout()),this,SLOT(tickClock())); length_timer=new QTimer(this); + length_timer->setSingleShot(true); connect(length_timer,SIGNAL(timeout()),this,SLOT(pause())); } @@ -135,7 +132,7 @@ QString RDHPIRecordStream::errorString(RDHPIRecordStream::Error err) default: str=QString(tr("Unknown RDHpiRecordStream Error:")); - return QString().sprintf("%s %d\n",(const char *)str,err); + return QString().sprintf("%s %d\n",str.toUtf8().constData(),err); break; } } @@ -163,7 +160,7 @@ RDHPIRecordStream::Error RDHPIRecordStream::createWave(QString filename) if(is_open) { return RDHPIRecordStream::AlreadyOpen; } - setName(filename); + nameWave(filename); return createWave(); } @@ -664,7 +661,7 @@ void RDHPIRecordStream::tickClock() if((!record_started)&&(is_recording)) { if(samples_recorded>0) { if(record_length>0) { - length_timer->start(record_length,true); + length_timer->start(record_length); } emit recordStart(); emit stateChanged(card_number,stream_number,4); // RecordStarted diff --git a/rdhpi/rdhpisoundcard.cpp b/rdhpi/rdhpisoundcard.cpp index 4bb1b93e..becdf332 100644 --- a/rdhpi/rdhpisoundcard.cpp +++ b/rdhpi/rdhpisoundcard.cpp @@ -750,14 +750,15 @@ void RDHPISoundCard::HPIProbe() str=QString(tr("Input Stream")); for(int j=0;jstart(METER_INTERVAL); } diff --git a/rdlibrary/Makefile.am b/rdlibrary/Makefile.am index f37d73fd..7ee41332 100644 --- a/rdlibrary/Makefile.am +++ b/rdlibrary/Makefile.am @@ -2,7 +2,7 @@ ## ## Automake.am for rivendell/rdlibrary ## -## (C) Copyright 2002-2020 Fred Gleason +## (C) Copyright 2002-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -20,7 +20,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -75,7 +75,7 @@ nodist_rdlibrary_SOURCES = moc_audio_cart.cpp\ moc_rdlibrary.cpp\ moc_record_cut.cpp -rdlibrary_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdlibrary_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ EXTRA_DIST = rdlibrary.pro\ rdlibrary_cs.ts\ diff --git a/rdlibrary/audio_cart.cpp b/rdlibrary/audio_cart.cpp index 454fdfd7..e1c87f0e 100644 --- a/rdlibrary/audio_cart.cpp +++ b/rdlibrary/audio_cart.cpp @@ -18,8 +18,8 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include +#include +#include #include #include @@ -50,7 +50,7 @@ AudioCart::AudioCart(AudioControls *controls,RDCart *cart,QString *path, rdcart_use_weighting=true; - QColor system_button_text_color = palette().active().buttonText(); + QColor system_button_text_color = palette().buttonText().color(); // // Progress Dialog @@ -113,7 +113,7 @@ AudioCart::AudioCart(AudioControls *controls,RDCart *cart,QString *path, QPixmap *pix=new QPixmap(QSize(70,40)); QPainter *p=new QPainter(pix); QFontMetrics *m=new QFontMetrics(buttonFont()); - p->fillRect(0,0,70,40,palette().color(QPalette::Active,QColorGroup::Button)); + p->fillRect(0,0,70,40,palette().color(QPalette::Active,QPalette::Button)); p->setPen(QColor(system_button_text_color)); p->setFont(buttonFont()); p->drawText((70-m->width(tr("Cut Info")))/2,15,tr("Cut Info")); @@ -122,7 +122,7 @@ AudioCart::AudioCart(AudioControls *controls,RDCart *cart,QString *path, p->end(); QPushButton *record_cut_button=new QPushButton(this); record_cut_button->setGeometry(550,0,80,50); - record_cut_button->setPixmap(*pix); + record_cut_button->setIcon(*pix); connect(record_cut_button,SIGNAL(clicked()),this,SLOT(recordCutData())); // @@ -155,7 +155,7 @@ AudioCart::AudioCart(AudioControls *controls,RDCart *cart,QString *path, // p=new QPainter(pix); m=new QFontMetrics(buttonFont()); - p->fillRect(0,0,70,40,palette().color(QPalette::Active,QColorGroup::Button)); + p->fillRect(0,0,70,40,palette().color(QPalette::Active,QPalette::Button)); p->setPen(QColor(system_button_text_color)); p->setFont(buttonFont()); p->drawText((70-m->width(tr("Import")))/2,15,tr("Import")); @@ -163,7 +163,7 @@ AudioCart::AudioCart(AudioControls *controls,RDCart *cart,QString *path, p->drawText((70-m->width(tr("Export")))/2,33,tr("Export")); p->end(); QPushButton *import_cut_button=new QPushButton(this); - import_cut_button->setPixmap(*pix); + import_cut_button->setIcon(*pix); import_cut_button->setGeometry(550,120+yoffset,80,50); connect(import_cut_button,SIGNAL(clicked()),this,SLOT(importCutData())); @@ -417,7 +417,7 @@ void AudioCart::extEditorCutData() // and possibly also add some tooltips with help advice if(fork()==0) { - system(cmd+" &"); + system((cmd+" &").toUtf8()); exit(0); } } diff --git a/rdlibrary/audio_controls.h b/rdlibrary/audio_controls.h index cb1a1550..2b22918a 100644 --- a/rdlibrary/audio_controls.h +++ b/rdlibrary/audio_controls.h @@ -2,7 +2,7 @@ // // A Container Class for RDLibrary Cart Label Controls // -// (C) Copyright 2002-2006,2016 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -21,10 +21,9 @@ #ifndef AUDIO_CONTROLS_H #define AUDIO_CONTROLS_H -#include -#include -#include -#include +#include +#include +#include #include diff --git a/rdlibrary/cdripper.cpp b/rdlibrary/cdripper.cpp index 5018cab9..daa8a31c 100644 --- a/rdlibrary/cdripper.cpp +++ b/rdlibrary/cdripper.cpp @@ -94,7 +94,7 @@ CdRipper::CdRipper(QString cutname,RDDiscRecord *rec,RDLibraryConf *conf, rip_title_label->setFont(labelFont()); rip_title_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); rip_title_box=new QComboBox(this); - rip_title_box->insertItem(tr("[none]")); + rip_title_box->insertItem(0,tr("[none]")); // // Artist Label @@ -135,8 +135,7 @@ CdRipper::CdRipper(QString cutname,RDDiscRecord *rec,RDLibraryConf *conf, rip_apply_box=new QCheckBox(this); rip_apply_box->setChecked(true); rip_apply_box->setDisabled(true); - rip_apply_label=new QLabel(rip_apply_box,tr("Apply")+" "+ - rip_disc_lookup->sourceName()+" "+ + rip_apply_label=new QLabel(tr("Apply")+" "+rip_disc_lookup->sourceName()+" "+ tr("Values to Cart"),this); rip_apply_label->setFont(labelFont()); rip_apply_label->setAlignment(Qt::AlignLeft); @@ -149,7 +148,7 @@ CdRipper::CdRipper(QString cutname,RDDiscRecord *rec,RDLibraryConf *conf, // Web Browser Button // rip_browser_button=new QPushButton(this); - rip_browser_button->setPixmap(rip_disc_lookup->sourceLogo()); + rip_browser_button->setIcon(rip_disc_lookup->sourceLogo()); rip_browser_button->setDisabled(true); rip_browser_label=new QLabel(this); rip_browser_label->setPixmap(rip_disc_lookup->sourceLogo()); @@ -178,7 +177,7 @@ CdRipper::CdRipper(QString cutname,RDDiscRecord *rec,RDLibraryConf *conf, rip_track_model->setPalette(palette()); rip_track_view->setModel(rip_track_model); rip_track_view->hideColumn(5); - rip_track_label=new QLabel(rip_track_view,tr("Tracks"),this); + rip_track_label=new QLabel(tr("Tracks"),this); rip_track_label->setFont(sectionLabelFont()); connect(rip_track_view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, @@ -228,7 +227,7 @@ CdRipper::CdRipper(QString cutname,RDDiscRecord *rec,RDLibraryConf *conf, // rip_normalize_box=new QCheckBox(this); rip_normalize_box->setChecked(true); - rip_normalize_box_label=new QLabel(rip_normalize_box,tr("Normalize"),this); + rip_normalize_box_label=new QLabel(tr("Normalize"),this); rip_normalize_box_label->setFont(labelFont()); rip_normalize_box_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); connect(rip_normalize_box,SIGNAL(toggled(bool)), @@ -239,7 +238,7 @@ CdRipper::CdRipper(QString cutname,RDDiscRecord *rec,RDLibraryConf *conf, // rip_normalize_spin=new QSpinBox(this); rip_normalize_spin->setRange(-30,0); - rip_normalize_label=new QLabel(rip_normalize_spin,tr("Level:"),this); + rip_normalize_label=new QLabel(tr("Level:"),this); rip_normalize_label->setFont(labelFont()); rip_normalize_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); rip_normalize_unit=new QLabel(tr("dBFS"),this); @@ -251,7 +250,7 @@ CdRipper::CdRipper(QString cutname,RDDiscRecord *rec,RDLibraryConf *conf, // rip_autotrim_box=new QCheckBox(this); rip_autotrim_box->setChecked(true); - rip_autotrim_box_label=new QLabel(rip_autotrim_box,tr("Autotrim"),this); + rip_autotrim_box_label=new QLabel(tr("Autotrim"),this); rip_autotrim_box_label->setFont(labelFont()); rip_autotrim_box_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); connect(rip_autotrim_box,SIGNAL(toggled(bool)), @@ -262,7 +261,7 @@ CdRipper::CdRipper(QString cutname,RDDiscRecord *rec,RDLibraryConf *conf, // rip_autotrim_spin=new QSpinBox(this); rip_autotrim_spin->setRange(-99,0); - rip_autotrim_label=new QLabel(rip_autotrim_spin,tr("Level:"),this); + rip_autotrim_label=new QLabel(tr("Level:"),this); rip_autotrim_label->setFont(labelFont()); rip_autotrim_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); rip_autotrim_unit=new QLabel(tr("dBFS"),this); @@ -273,7 +272,7 @@ CdRipper::CdRipper(QString cutname,RDDiscRecord *rec,RDLibraryConf *conf, // Channels // rip_channels_box=new QComboBox(this); - rip_channels_label=new QLabel(rip_channels_box,tr("Channels:"),this); + rip_channels_label=new QLabel(tr("Channels:"),this); rip_channels_label->setFont(labelFont()); rip_channels_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -289,9 +288,9 @@ CdRipper::CdRipper(QString cutname,RDDiscRecord *rec,RDLibraryConf *conf, // rip_normalize_spin->setValue(rip_conf->ripperLevel()/100); rip_autotrim_spin->setValue(rip_conf->trimThreshold()/100); - rip_channels_box->insertItem("1"); - rip_channels_box->insertItem("2"); - rip_channels_box->setCurrentItem(rip_conf->defaultChannels()-1); + rip_channels_box->insertItem(0,"1"); + rip_channels_box->insertItem(1,"2"); + rip_channels_box->setCurrentIndex(rip_conf->defaultChannels()-1); rip_done=false; } @@ -350,17 +349,17 @@ void CdRipper::trackSelectionChangedData(const QItemSelection &before, rip_title_box->clear(); switch(titles.size()) { case 0: - rip_title_box->insertItem(tr("[none]")); + rip_title_box->insertItem(0,tr("[none]")); break; case 1: - rip_title_box->insertItem(titles[0]); + rip_title_box->insertItem(0,titles[0]); break; default: - rip_title_box->insertItem(titles.join(" / ")); + rip_title_box->insertItem(0,titles.join(" / ")); for(int i=0;iinsertItem(titles[i]); + rip_title_box->insertItem(rip_title_box->count(),titles[i]); } break; } @@ -529,8 +528,8 @@ void CdRipper::ripTrackButtonData() break; } delete ripper; - unlink(tmpfile); - rmdir(tmpdir); + unlink(tmpfile.toUtf8()); + rmdir(tmpdir.toUtf8()); rip_bar->reset(); rip_eject_button->setEnabled(true); rip_play_button->setEnabled(true); @@ -704,7 +703,7 @@ void CdRipper::Profile(const QString &msg) { if(rip_profile_rip) { printf("%s | CdRipper::%s\n", - (const char *)QTime::currentTime().toString("hh:mm:ss.zzz"), - (const char *)msg.utf8()); + QTime::currentTime().toString("hh:mm:ss.zzz").toUtf8().constData(), + msg.toUtf8().constData()); } } diff --git a/rdlibrary/disk_gauge.cpp b/rdlibrary/disk_gauge.cpp index 0d3182f3..376af168 100644 --- a/rdlibrary/disk_gauge.cpp +++ b/rdlibrary/disk_gauge.cpp @@ -2,7 +2,7 @@ // // Disk Gauge Widget for RDLibrary. // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,14 +18,9 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include - #include #include -#include #include #include "disk_gauge.h" @@ -57,6 +52,7 @@ DiskGauge::DiskGauge(int samp_rate,int chans,QWidget *parent) */ disk_timer=new QTimer(this); + disk_timer->setSingleShot(true); connect(disk_timer,SIGNAL(timeout()),this,SLOT(update())); disk_timer->start(100); } @@ -95,7 +91,7 @@ void DiskGauge::update() } delete conv; disk_timer->stop(); - disk_timer->start(DISK_GAUGE_UPDATE_INTERVAL,true); + disk_timer->start(DISK_GAUGE_UPDATE_INTERVAL); } diff --git a/rdlibrary/disk_ripper.cpp b/rdlibrary/disk_ripper.cpp index 46dc4fe9..fcdcb61a 100644 --- a/rdlibrary/disk_ripper.cpp +++ b/rdlibrary/disk_ripper.cpp @@ -124,8 +124,7 @@ DiskRipper::DiskRipper(QString *filter,QString *group,QString *schedcode, rip_apply_box=new QCheckBox(this); rip_apply_box->setChecked(true); rip_apply_box->setDisabled(true); - rip_apply_label=new QLabel(rip_apply_box,tr("Apply")+" "+ - rip_disc_lookup->sourceName()+" "+ + rip_apply_label=new QLabel(tr("Apply")+" "+rip_disc_lookup->sourceName()+" "+ tr("Values to Carts"),this); rip_apply_label->setFont(labelFont()); rip_apply_label->setAlignment(Qt::AlignLeft); @@ -138,7 +137,7 @@ DiskRipper::DiskRipper(QString *filter,QString *group,QString *schedcode, // Web Browser Button/Label // rip_browser_button=new QPushButton(this); - rip_browser_button->setPixmap(rip_disc_lookup->sourceLogo()); + rip_browser_button->setIcon(rip_disc_lookup->sourceLogo()); rip_browser_button->setDisabled(true); rip_browser_label=new QLabel(this); rip_browser_label->setPixmap(rip_disc_lookup->sourceLogo()); @@ -166,7 +165,7 @@ DiskRipper::DiskRipper(QString *filter,QString *group,QString *schedcode, rip_track_model->setFont(defaultFont()); rip_track_model->setPalette(palette()); rip_track_view->setModel(rip_track_model); - rip_track_label=new QLabel(rip_track_view,tr("Tracks"),this); + rip_track_label=new QLabel(tr("Tracks"),this); rip_track_label->setFont(sectionLabelFont()); connect(rip_track_view,SIGNAL(doubleClicked(const QModelIndex &)), this,SLOT(doubleClickedData(const QModelIndex &))); @@ -259,7 +258,7 @@ DiskRipper::DiskRipper(QString *filter,QString *group,QString *schedcode, // rip_normalize_box=new QCheckBox(this); rip_normalize_box->setChecked(true); - rip_normalizebox_label=new QLabel(rip_normalize_box,tr("Normalize"),this); + rip_normalizebox_label=new QLabel(tr("Normalize"),this); rip_normalizebox_label->setFont(labelFont()); rip_normalizebox_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); connect(rip_normalize_box,SIGNAL(toggled(bool)), @@ -270,7 +269,7 @@ DiskRipper::DiskRipper(QString *filter,QString *group,QString *schedcode, // rip_normalize_spin=new QSpinBox(this); rip_normalize_spin->setRange(-30,0); - rip_normalize_label=new QLabel(rip_normalize_spin,tr("Level:"),this); + rip_normalize_label=new QLabel(tr("Level:"),this); rip_normalize_label->setFont(labelFont()); rip_normalize_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); rip_normalize_unit=new QLabel(tr("dBFS"),this); @@ -282,7 +281,7 @@ DiskRipper::DiskRipper(QString *filter,QString *group,QString *schedcode, // rip_autotrim_box=new QCheckBox(this); rip_autotrim_box->setChecked(true); - rip_autotrimbox_label=new QLabel(rip_autotrim_box,tr("Autotrim"),this); + rip_autotrimbox_label=new QLabel(tr("Autotrim"),this); rip_autotrimbox_label->setFont(labelFont()); rip_autotrimbox_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); connect(rip_autotrim_box,SIGNAL(toggled(bool)), @@ -293,7 +292,7 @@ DiskRipper::DiskRipper(QString *filter,QString *group,QString *schedcode, // rip_autotrim_spin=new QSpinBox(this); rip_autotrim_spin->setRange(-99,0); - rip_autotrim_label=new QLabel(rip_autotrim_spin,tr("Level:"),this); + rip_autotrim_label=new QLabel(tr("Level:"),this); rip_autotrim_label->setFont(labelFont()); rip_autotrim_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); rip_autotrim_unit=new QLabel(tr("dBFS"),this); @@ -304,7 +303,7 @@ DiskRipper::DiskRipper(QString *filter,QString *group,QString *schedcode, // Channels // rip_channels_box=new QComboBox(this); - rip_channels_label=new QLabel(rip_channels_box,tr("Channels:"),this); + rip_channels_label=new QLabel(tr("Channels:"),this); rip_channels_label->setFont(labelFont()); rip_channels_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -328,9 +327,9 @@ DiskRipper::DiskRipper(QString *filter,QString *group,QString *schedcode, // rip_normalize_spin->setValue(rda->libraryConf()->ripperLevel()/100); rip_autotrim_spin->setValue(rda->libraryConf()->trimThreshold()/100); - rip_channels_box->insertItem("1"); - rip_channels_box->insertItem("2"); - rip_channels_box->setCurrentItem(rda->libraryConf()->defaultChannels()-1); + rip_channels_box->insertItem(0,"1"); + rip_channels_box->insertItem(1,"2"); + rip_channels_box->setCurrentIndex(rda->libraryConf()->defaultChannels()-1); rip_done=false; } @@ -999,8 +998,8 @@ void DiskRipper::RipTrack(int track,int end_track,QString cutname,QString title) break; } delete ripper; - unlink(tmpfile); - rmdir(tmpdir); + unlink(tmpfile.toUtf8()); + rmdir(tmpdir.toUtf8()); rip_track_bar->setValue(0); delete cart; diff --git a/rdlibrary/edit_cart.cpp b/rdlibrary/edit_cart.cpp index 2148b21f..24e4518b 100644 --- a/rdlibrary/edit_cart.cpp +++ b/rdlibrary/edit_cart.cpp @@ -18,7 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include +#include #include #include @@ -92,18 +92,17 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, rdcart_number_edit->setGeometry(135,11,70,21); rdcart_number_edit->setMaxLength(6); rdcart_number_edit->setReadOnly(true); - QLabel *rdcart_number_label= - new QLabel(rdcart_number_edit,tr("Number:"),this); + QLabel *rdcart_number_label=new QLabel(tr("Number:"),this); rdcart_number_label->setGeometry(10,13,120,21); rdcart_number_label->setFont(labelFont()); rdcart_number_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); } // // Cart Group // - rdcart_group_box=new QComboBox(this); + rdcart_group_box=new RDComboBox(this); if(cartnums.size()==1) { rdcart_group_box->setGeometry(280,11,140,21); } @@ -115,7 +114,7 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, rdcart_group_edit=new QLineEdit(this); rdcart_group_edit->setGeometry(280,11,140,21); rdcart_group_edit->setReadOnly(true); - QLabel *rdcart_group_label=new QLabel(rdcart_group_box,tr("Group:"),this); + QLabel *rdcart_group_label=new QLabel(tr("Group:"),this); if(cartnums.size()==1) { rdcart_group_label->setGeometry(215,13,60,21); } @@ -124,7 +123,7 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, } rdcart_group_label->setFont(labelFont()); rdcart_group_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Cart Type @@ -133,11 +132,11 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, rdcart_type_edit->setGeometry(500,11,80,21); rdcart_type_edit->setMaxLength(6); rdcart_type_edit->setReadOnly(true); - QLabel *rdcart_type_label=new QLabel(rdcart_type_edit,tr("Type:"),this); + QLabel *rdcart_type_label=new QLabel(tr("Type:"),this); rdcart_type_label->setGeometry(440,13,55,21); rdcart_type_label->setFont(labelFont()); rdcart_type_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); if(cartnums.size()>1) { rdcart_type_label->hide(); rdcart_type_edit->hide(); @@ -151,12 +150,11 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, rdcart_average_length_edit->setMaxLength(10); rdcart_average_length_edit->setAlignment(Qt::AlignRight); rdcart_average_length_edit->setReadOnly(true); - QLabel *rdcart_average_length_label= - new QLabel(rdcart_average_length_edit,tr("Average Length:"),this); + QLabel *rdcart_average_length_label=new QLabel(tr("Average Length:"),this); rdcart_average_length_label->setGeometry(10,38,120,21); rdcart_average_length_label->setFont(labelFont()); rdcart_average_length_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); if(cartnums.size()>1) { rdcart_average_length_label->hide(); rdcart_average_length_edit->hide(); @@ -167,12 +165,11 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, // rdcart_controls.enforce_length_box=new QCheckBox(this); rdcart_controls.enforce_length_box->setGeometry(285,41,20,15); - QLabel *rdcart_enforce_length_label= - new QLabel(rdcart_controls.enforce_length_box,tr("Enforce Length"),this); + QLabel *rdcart_enforce_length_label=new QLabel(tr("Enforce Length"),this); rdcart_enforce_length_label->setGeometry(305,38,110,21); rdcart_enforce_length_label->setFont(labelFont()); rdcart_enforce_length_label-> - setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignLeft|Qt::AlignVCenter); connect(rdcart_controls.enforce_length_box,SIGNAL(toggled(bool)), this,SLOT(forcedLengthData(bool))); if(cartnums.size()>1) { @@ -192,12 +189,11 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, rdcart_forced_length_ledit->setGeometry(535,36,80,21); rdcart_forced_length_ledit->hide(); rdcart_forced_length_ledit->setReadOnly(true); - rdcart_forced_length_label= - new QLabel(rdcart_controls.forced_length_edit,tr("Forced Length:"),this); + rdcart_forced_length_label=new QLabel(tr("Forced Length:"),this); rdcart_forced_length_label->setGeometry(415,38,110,20); rdcart_forced_length_label->setFont(labelFont()); rdcart_forced_length_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); if(cartnums.size()>1) { rdcart_forced_length_label->hide(); rdcart_controls.forced_length_edit->hide(); @@ -209,12 +205,11 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, rdcart_controls.title_edit=new QLineEdit(this); rdcart_controls.title_edit->setGeometry(135,60,480,21); rdcart_controls.title_edit->setMaxLength(255); - QLabel *rdcart_title_label= - new QLabel(rdcart_controls.title_edit,tr("&Title:"),this); + QLabel *rdcart_title_label=new QLabel(tr("&Title:"),this); rdcart_title_label->setGeometry(10,62,120,21); rdcart_title_label->setFont(labelFont()); rdcart_title_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Cart Start Date @@ -222,12 +217,11 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, rdcart_start_date_edit=new QLineEdit(this); rdcart_start_date_edit->setGeometry(135,84,100,21); rdcart_start_date_edit->setMaxLength(255); - QLabel *rdcart_start_date_label= - new QLabel(rdcart_start_date_edit,tr("&Start Date:"),this); + QLabel *rdcart_start_date_label=new QLabel(tr("&Start Date:"),this); rdcart_start_date_label->setGeometry(10,86,120,21); rdcart_start_date_label->setFont(labelFont()); rdcart_start_date_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); rdcart_start_date_edit->hide(); rdcart_start_date_label->hide(); @@ -237,12 +231,11 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, rdcart_end_date_edit=new QLineEdit(this); rdcart_end_date_edit->setGeometry(350,84,100,21); rdcart_end_date_edit->setMaxLength(255); - QLabel *rdcart_end_date_label= - new QLabel(rdcart_end_date_edit,tr("&End Date:"),this); + QLabel *rdcart_end_date_label=new QLabel(tr("&End Date:"),this); rdcart_end_date_label->setGeometry(260,86,85,21); rdcart_end_date_label->setFont(labelFont()); rdcart_end_date_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); rdcart_end_date_edit->hide(); rdcart_end_date_label->hide(); @@ -252,12 +245,11 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, rdcart_controls.artist_edit=new QLineEdit(this); rdcart_controls.artist_edit->setGeometry(135,84,480,21); rdcart_controls.artist_edit->setMaxLength(255); - QLabel *rdcart_artist_label= - new QLabel(rdcart_controls.artist_edit,tr("&Artist:"),this); + QLabel *rdcart_artist_label=new QLabel(tr("&Artist:"),this); rdcart_artist_label->setGeometry(10,86,120,21); rdcart_artist_label->setFont(labelFont()); rdcart_artist_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Cart Origination Year @@ -268,12 +260,11 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, rdcart_controls.year_edit->setGeometry(135,110,50,21); rdcart_controls.year_edit->setValidator(val); rdcart_controls.year_edit->setMaxLength(255); - QLabel *rdcart_year_label= - new QLabel(rdcart_controls.year_edit,tr("&Year Released:"),this); + QLabel *rdcart_year_label=new QLabel(tr("&Year Released:"),this); rdcart_year_label->setGeometry(10,112,120,21); rdcart_year_label->setFont(labelFont()); rdcart_year_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Cart Usage Code @@ -281,15 +272,16 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, rdcart_usage_box=new QComboBox(this); rdcart_usage_box->setGeometry(270,110,150,21); if(cartnums.size()>1) { - rdcart_usage_box->insertItem(""); + rdcart_usage_box->insertItem(0,""); } for(int i=0;i<(int)RDCart::UsageLast;i++) { - rdcart_usage_box->insertItem(RDCart::usageText((RDCart::UsageCode)i)); + rdcart_usage_box->insertItem(rdcart_usage_box->count(), + RDCart::usageText((RDCart::UsageCode)i)); } - QLabel *label=new QLabel(rdcart_usage_box,tr("U&sage:"),this); + QLabel *label=new QLabel(tr("U&sage:"),this); label->setGeometry(195,112,70,21); label->setFont(labelFont()); - label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); rdcart_usage_edit=new QLineEdit(this); rdcart_usage_edit->setGeometry(270,110,150,21); rdcart_usage_edit->setReadOnly(true); @@ -310,12 +302,11 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, rdcart_controls.song_id_edit=new QLineEdit(this); rdcart_controls.song_id_edit->setGeometry(135,135,240,21); rdcart_controls.song_id_edit->setMaxLength(32); - QLabel *rdcart_song_id_label= - new QLabel(rdcart_controls.song_id_edit,tr("Song &ID:"),this); + QLabel *rdcart_song_id_label=new QLabel(tr("Song &ID:"),this); rdcart_song_id_label->setGeometry(10,135,120,21); rdcart_song_id_label->setFont(labelFont()); rdcart_song_id_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Beats per Minute @@ -324,12 +315,11 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, rdcart_controls.bpm_spin->setGeometry(515,135,100,21); rdcart_controls.bpm_spin->setRange(0,300); rdcart_controls.bpm_spin->setSpecialValueText(tr("Unknown")); - QLabel *rdcart_bpm_label= - new QLabel(rdcart_controls.bpm_spin,tr("&Beats per Minute:"),this); + QLabel *rdcart_bpm_label=new QLabel(tr("&Beats per Minute:"),this); rdcart_bpm_label->setGeometry(390,135,120,21); rdcart_bpm_label->setFont(labelFont()); rdcart_bpm_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Cart Album @@ -337,12 +327,11 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, rdcart_controls.album_edit=new QLineEdit(this); rdcart_controls.album_edit->setGeometry(135,158,480,21); rdcart_controls.album_edit->setMaxLength(255); - QLabel *rdcart_album_label= - new QLabel(rdcart_controls.album_edit,tr("Al&bum:"),this); + QLabel *rdcart_album_label=new QLabel(tr("Al&bum:"),this); rdcart_album_label->setGeometry(10,158,120,21); rdcart_album_label->setFont(labelFont()); rdcart_album_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Cart Label @@ -350,12 +339,11 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, rdcart_controls.label_edit=new QLineEdit(this); rdcart_controls.label_edit->setGeometry(135,182,480,21); rdcart_controls.label_edit->setMaxLength(64); - QLabel *rdcart_label_label= - new QLabel(rdcart_controls.label_edit,tr("Re&cord Label:"),this); + QLabel *rdcart_label_label=new QLabel(tr("Re&cord Label:"),this); rdcart_label_label->setGeometry(10,182,120,21); rdcart_label_label->setFont(labelFont()); rdcart_label_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Cart Client @@ -363,12 +351,11 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, rdcart_controls.client_edit=new QLineEdit(this); rdcart_controls.client_edit->setGeometry(135,206,480,21); rdcart_controls.client_edit->setMaxLength(64); - QLabel *rdcart_client_label= - new QLabel(rdcart_controls.label_edit,tr("C&lient:"),this); + QLabel *rdcart_client_label=new QLabel(tr("C&lient:"),this); rdcart_client_label->setGeometry(10,206,120,21); rdcart_client_label->setFont(labelFont()); rdcart_client_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Cart Agency @@ -376,12 +363,11 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, rdcart_controls.agency_edit=new QLineEdit(this); rdcart_controls.agency_edit->setGeometry(135,230,480,21); rdcart_controls.agency_edit->setMaxLength(64); - QLabel *rdcart_agency_label= - new QLabel(rdcart_controls.label_edit,tr("A&gency:"),this); + QLabel *rdcart_agency_label=new QLabel(tr("A&gency:"),this); rdcart_agency_label->setGeometry(10,230,120,21); rdcart_agency_label->setFont(labelFont()); rdcart_agency_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Cart Publisher @@ -389,12 +375,11 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, rdcart_controls.publisher_edit=new QLineEdit(this); rdcart_controls.publisher_edit->setGeometry(135,254,480,21); rdcart_controls.publisher_edit->setMaxLength(64); - QLabel *rdcart_publisher_label= - new QLabel(rdcart_controls.label_edit,tr("&Publisher:"),this); + QLabel *rdcart_publisher_label=new QLabel(tr("&Publisher:"),this); rdcart_publisher_label->setGeometry(10,254,120,21); rdcart_publisher_label->setFont(labelFont()); rdcart_publisher_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Cart Composer @@ -402,12 +387,11 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, rdcart_controls.composer_edit=new QLineEdit(this); rdcart_controls.composer_edit->setGeometry(135,278,480,21); rdcart_controls.composer_edit->setMaxLength(64); - QLabel *rdcart_composer_label= - new QLabel(rdcart_controls.label_edit,tr("Compos&er:"),this); + QLabel *rdcart_composer_label=new QLabel(tr("Compos&er:"),this); rdcart_composer_label->setGeometry(10,278,120,21); rdcart_composer_label->setFont(labelFont()); rdcart_composer_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Cart Conductor @@ -415,12 +399,11 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, rdcart_controls.conductor_edit=new QLineEdit(this); rdcart_controls.conductor_edit->setGeometry(135,302,480,21); rdcart_controls.conductor_edit->setMaxLength(255); - QLabel *rdcart_conductor_label= - new QLabel(rdcart_controls.label_edit,tr("Cond&uctor:"),this); + QLabel *rdcart_conductor_label=new QLabel(tr("Cond&uctor:"),this); rdcart_conductor_label->setGeometry(10,302,120,21); rdcart_conductor_label->setFont(labelFont()); rdcart_conductor_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Cart User Defined @@ -428,12 +411,11 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, rdcart_controls.user_defined_edit=new QLineEdit(this); rdcart_controls.user_defined_edit->setGeometry(135,325,480,21); rdcart_controls.user_defined_edit->setMaxLength(255); - QLabel *rdcart_user_defined_label= - new QLabel(rdcart_controls.label_edit,tr("&User Defined:"),this); + QLabel *rdcart_user_defined_label=new QLabel(tr("&User Defined:"),this); rdcart_user_defined_label->setGeometry(10,325,120,21); rdcart_user_defined_label->setFont(labelFont()); rdcart_user_defined_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Synchronous Scheduling Policy @@ -443,12 +425,11 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, connect(rdcart_syncronous_box,SIGNAL(toggled(bool)), this,SLOT(asyncronousToggledData(bool))); rdcart_syncronous_box->hide(); - QLabel *rdcart_syncronous_label= - new QLabel(rdcart_syncronous_box,tr("Execute Asynchronously"),this); + QLabel *rdcart_syncronous_label=new QLabel(tr("Execute Asynchronously"),this); rdcart_syncronous_label->setGeometry(155,348,200,21); rdcart_syncronous_label->setFont(labelFont()); rdcart_syncronous_label-> - setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignLeft|Qt::AlignVCenter); rdcart_syncronous_label->hide(); // @@ -460,13 +441,11 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, this,SLOT(asyncronousToggledData(bool))); rdcart_use_event_length_box->hide(); QLabel *rdcart_use_event_length_label= - new QLabel(rdcart_use_event_length_box, - tr("Use RDLogManager Length for PAD Updates"),this); - // tr("Use Event Length for Now && Next Updates"),this); + new QLabel(tr("Use RDLogManager Length for PAD Updates"),this); rdcart_use_event_length_label->setGeometry(350,348,sizeHint().width()-350,21); rdcart_use_event_length_label->setFont(labelFont()); rdcart_use_event_length_label-> - setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignLeft|Qt::AlignVCenter); rdcart_use_event_length_label->hide(); // @@ -474,17 +453,16 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, // rdcart_cut_sched_box=new QComboBox(this); rdcart_cut_sched_box->setGeometry(135,348,150,21); - rdcart_cut_sched_box->insertItem(tr("By Specified Order")); - rdcart_cut_sched_box->insertItem(tr("By Weight")); + rdcart_cut_sched_box->insertItem(0,tr("By Specified Order")); + rdcart_cut_sched_box->insertItem(1,tr("By Weight")); rdcart_cut_sched_edit=new QLineEdit(this); rdcart_cut_sched_edit->setGeometry(135,348,150,21); rdcart_cut_sched_edit->hide(); - QLabel *rdcart_cut_sched_label= - new QLabel(rdcart_cut_sched_box,tr("Schedule Cuts")+":",this); + QLabel *rdcart_cut_sched_label=new QLabel(tr("Schedule Cuts")+":",this); rdcart_cut_sched_label->setGeometry(10,348,120,21); rdcart_cut_sched_label->setFont(labelFont()); rdcart_cut_sched_label-> - setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Notes Button @@ -637,23 +615,23 @@ EditCart::EditCart(const QList &cartnums,QString *path,bool new_cart, rdcart_controls.conductor_edit->setText(rdcart_cart->conductor()); rdcart_controls.composer_edit->setText(rdcart_cart->composer()); rdcart_controls.user_defined_edit->setText(rdcart_cart->userDefined()); - rdcart_usage_box->setCurrentItem((int)rdcart_cart->usageCode()); + rdcart_usage_box->setCurrentIndex((int)rdcart_cart->usageCode()); rdcart_usage_edit-> setText(RDCart::usageText((RDCart::UsageCode)rdcart_usage_box-> - currentItem())); + currentIndex())); rdcart_syncronous_box->setChecked(rdcart_cart->asyncronous()); rdcart_use_event_length_box-> setChecked(rdcart_cart->useEventLength()); - rdcart_cut_sched_box->setCurrentItem(rdcart_cart->useWeighting()); + rdcart_cut_sched_box->setCurrentIndex(rdcart_cart->useWeighting()); rdcart_cut_sched_edit->setText(rdcart_cut_sched_box->currentText()); } else {//multi edit if(rdcart_group_box->count() == 0) { rdcart_group_box->insertItem(""); // PopulateGroupList(); - rdcart_group_box->setCurrentItem(0); + rdcart_group_box->setCurrentIndex(0); } - rdcart_usage_box->setCurrentItem(0); + rdcart_usage_box->setCurrentIndex(0); rdcart_notes_button->hide(); } @@ -796,7 +774,7 @@ void EditCart::okData() } } } - if(rdcart_cut_sched_box->currentItem()==0) { + if(rdcart_cut_sched_box->currentIndex()==0) { QList dup_values; if(rdcart_audio_cart->cutListModel()->playOrderDuplicates(&dup_values)) { QString msg= @@ -848,66 +826,66 @@ void EditCart::okData() rdcart_cart->setComposer(rdcart_controls.composer_edit->text()); rdcart_cart->setUserDefined(rdcart_controls.user_defined_edit->text()); rdcart_cart-> - setUsageCode((RDCart::UsageCode)rdcart_usage_box->currentItem()); + setUsageCode((RDCart::UsageCode)rdcart_usage_box->currentIndex()); if(rdcart_cart->type()==RDCart::Macro) { rdcart_macro_cart->save(); rdcart_cart->setAsyncronous(rdcart_syncronous_box->isChecked()); rdcart_cart->setUseEventLength(rdcart_use_event_length_box->isChecked()); } else { - rdcart_cart->setUseWeighting(rdcart_cut_sched_box->currentItem()); + rdcart_cart->setUseWeighting(rdcart_cut_sched_box->currentIndex()); } } else { // Multi Edit for(int i=0;iowner().isEmpty()) { - if(!rdcart_group_box->currentText().stripWhiteSpace().isEmpty()) { + if(!rdcart_group_box->currentText().trimmed().isEmpty()) { cart->setGroupName(rdcart_group_box->currentText()); } - if(!rdcart_controls.title_edit->text().stripWhiteSpace().isEmpty()) { + if(!rdcart_controls.title_edit->text().trimmed().isEmpty()) { cart->setTitle(rdcart_controls.title_edit->text()); } if(rdcart_controls.year_edit->text().toInt()) { cart->setYear(rdcart_controls.year_edit->text().toInt()); } - if(!rdcart_controls.artist_edit->text().stripWhiteSpace().isEmpty()) { + if(!rdcart_controls.artist_edit->text().trimmed().isEmpty()) { cart->setArtist(rdcart_controls.artist_edit->text()); } - if(!rdcart_controls.album_edit->text().stripWhiteSpace().isEmpty()) { + if(!rdcart_controls.album_edit->text().trimmed().isEmpty()) { cart->setAlbum(rdcart_controls.album_edit->text()); } - if(!rdcart_controls.label_edit->text().stripWhiteSpace().isEmpty()) { + if(!rdcart_controls.label_edit->text().trimmed().isEmpty()) { cart->setLabel(rdcart_controls.label_edit->text()); } - if(!rdcart_controls.client_edit->text().stripWhiteSpace().isEmpty()) { + if(!rdcart_controls.client_edit->text().trimmed().isEmpty()) { cart->setClient(rdcart_controls.client_edit->text()); } - if(!rdcart_controls.agency_edit->text().stripWhiteSpace().isEmpty()) { + if(!rdcart_controls.agency_edit->text().trimmed().isEmpty()) { cart->setAgency(rdcart_controls.agency_edit->text()); } - if(!rdcart_controls.song_id_edit->text().stripWhiteSpace().isEmpty()) { + if(!rdcart_controls.song_id_edit->text().trimmed().isEmpty()) { cart->setSongId(rdcart_controls.song_id_edit->text()); } if(!rdcart_controls.publisher_edit->text(). - stripWhiteSpace().isEmpty()) { + trimmed().isEmpty()) { cart->setPublisher(rdcart_controls.publisher_edit->text()); } if(!rdcart_controls.composer_edit-> - text().stripWhiteSpace().isEmpty()) { + text().trimmed().isEmpty()) { cart->setComposer(rdcart_controls.composer_edit->text()); } if(!rdcart_controls.conductor_edit->text(). - stripWhiteSpace().isEmpty()) { + trimmed().isEmpty()) { cart->setConductor(rdcart_controls.conductor_edit->text()); } if(!rdcart_controls.user_defined_edit->text(). - stripWhiteSpace().isEmpty()) { + trimmed().isEmpty()) { cart->setUserDefined(rdcart_controls.user_defined_edit->text()); } - if(!rdcart_usage_box->currentText().stripWhiteSpace().isEmpty()) { + if(!rdcart_usage_box->currentText().trimmed().isEmpty()) { cart->setUsageCode((RDCart::UsageCode) - (rdcart_usage_box->currentItem()-1)); + (rdcart_usage_box->currentIndex()-1)); } cart->updateSchedCodes(add_codes,remove_codes); } diff --git a/rdlibrary/edit_cart.h b/rdlibrary/edit_cart.h index edc7388b..71ba9e7b 100644 --- a/rdlibrary/edit_cart.h +++ b/rdlibrary/edit_cart.h @@ -23,6 +23,7 @@ #include +#include #include #include @@ -61,7 +62,7 @@ class EditCart : public RDDialog RDCart *rdcart_cart; QLineEdit *rdcart_type_edit; QLineEdit *rdcart_number_edit; - QComboBox *rdcart_group_box; + RDComboBox *rdcart_group_box; RDGroupListModel *rdcart_group_model; QLineEdit *rdcart_group_edit; AudioControls rdcart_controls; diff --git a/rdlibrary/edit_notes.cpp b/rdlibrary/edit_notes.cpp index 73c567f8..cdce8d61 100644 --- a/rdlibrary/edit_notes.cpp +++ b/rdlibrary/edit_notes.cpp @@ -2,7 +2,7 @@ // // Edit Cart Notes. // -// (C) Copyright 2009-2019 Fred Gleason +// (C) Copyright 2009-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -36,7 +36,7 @@ EditNotes::EditNotes(RDCart *cart,QWidget *parent) // Variable Name // notes_view=new QTextEdit(this); - notes_view->setTextFormat(Qt::PlainText); + notes_view->setAcceptRichText(false); notes_view->setReadOnly(false); // @@ -86,7 +86,7 @@ void EditNotes::resizeEvent(QResizeEvent *e) void EditNotes::okData() { - notes_cart->setNotes(notes_view->text().stripWhiteSpace()); + notes_cart->setNotes(notes_view->toPlainText().trimmed()); done(0); } diff --git a/rdlibrary/edit_schedulercodes.cpp b/rdlibrary/edit_schedulercodes.cpp index 2efb5b15..b064db3d 100644 --- a/rdlibrary/edit_schedulercodes.cpp +++ b/rdlibrary/edit_schedulercodes.cpp @@ -3,7 +3,7 @@ // Edit the scheduler codes of a cart // // (C) Copyright Stefan Gabriel -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -19,8 +19,8 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include +#include +#include #include "edit_schedulercodes.h" @@ -98,11 +98,11 @@ EditSchedulerCodes::EditSchedulerCodes(QString *sched_codes, for(int i=0;ilength()/11;i++) { - codes_sel->destInsertItem(edit_sched_codes->mid(i*11,11).stripWhiteSpace()); + codes_sel->destInsertItem(edit_sched_codes->mid(i*11,11).trimmed()); } if(edit_remove_codes!=NULL) { for(int i=0;ilength()/11;i++) { - remove_codes_sel->destInsertItem(remove_codes->mid(i*11,11).stripWhiteSpace()); + remove_codes_sel->destInsertItem(remove_codes->mid(i*11,11).trimmed()); } } diff --git a/rdlibrary/list_reports.cpp b/rdlibrary/list_reports.cpp index 47916bd9..c7c088d7 100644 --- a/rdlibrary/list_reports.cpp +++ b/rdlibrary/list_reports.cpp @@ -18,9 +18,8 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include +#include -#include #include #include #include @@ -48,10 +47,10 @@ ListReports::ListReports(const QString &filter,const QString &grpname, // list_reports_box=new QComboBox(this); list_reports_box->setGeometry(50,10,sizeHint().width()-60,19); - list_reports_box->insertItem(tr("Cart Report")); - list_reports_box->insertItem(tr("Cut Report")); - list_reports_box->insertItem(tr("Cart Data Dump (CSV)")); - list_reports_label=new QLabel(list_reports_box,tr("Type:"),this); + list_reports_box->insertItem(0,tr("Cart Report")); + list_reports_box->insertItem(1,tr("Cut Report")); + list_reports_box->insertItem(2,tr("Cart Data Dump (CSV)")); + list_reports_label=new QLabel(tr("Type:"),this); list_reports_label->setGeometry(10,10,35,19); list_reports_label->setFont(labelFont()); list_reports_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -65,8 +64,7 @@ ListReports::ListReports(const QString &filter,const QString &grpname, list_fieldnames_check->setGeometry(55,34,15,15); list_fieldnames_check->setChecked(true); list_fieldnames_check->setDisabled(true); - list_fieldnames_label= - new QLabel(list_fieldnames_check,tr("Prepend Field Names"),this); + list_fieldnames_label=new QLabel(tr("Prepend Field Names"),this); list_fieldnames_label->setGeometry(75,32,sizeHint().width()-75,19); list_fieldnames_label->setFont(labelFont()); list_fieldnames_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -123,7 +121,7 @@ void ListReports::generateData() { QString report; - switch(list_reports_box->currentItem()) { + switch(list_reports_box->currentIndex()) { case 0: // Cart Report GenerateCartReport(&report); break; @@ -626,7 +624,7 @@ void ListReports::GenerateCartDumpCsv(QString *report,bool prepend_names) *report+=CsvField(q->value(2).toString()+".wav")+","; } *report+= - RDGetTimeLength(q->value(20).toInt(),false,false).stripWhiteSpace()+","; + RDGetTimeLength(q->value(20).toInt(),false,false).trimmed()+","; if(type==RDCart::Macro) { *report+="-1,"; *report+="-1,"; diff --git a/rdlibrary/notebubble.cpp b/rdlibrary/notebubble.cpp index 7863872d..1b78c51b 100644 --- a/rdlibrary/notebubble.cpp +++ b/rdlibrary/notebubble.cpp @@ -24,9 +24,7 @@ #include "notebubble.h" NoteBubble::NoteBubble(QWidget *parent) - : QLabel(parent,(Qt::WindowFlags)(Qt::WStyle_Customize| - Qt::WStyle_NoBorder| - Qt::WStyle_StaysOnTop)) + : QLabel(parent) { note_cart_number=0; diff --git a/rdlibrary/rdlibrary.cpp b/rdlibrary/rdlibrary.cpp index 3ed8c196..c652a00a 100644 --- a/rdlibrary/rdlibrary.cpp +++ b/rdlibrary/rdlibrary.cpp @@ -78,9 +78,11 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) // Progress Dialog // lib_progress_dialog= - new QProgressDialog(tr("Please Wait..."),tr("Cancel"),0,10,this, - Qt::WStyle_Customize|Qt::WStyle_NormalBorder); - lib_progress_dialog->setCaption(" "); + new QProgressDialog(tr("Please Wait..."),tr("Cancel"),0,10,this); + // lib_progress_dialog= + // new QProgressDialog(tr("Please Wait..."),tr("Cancel"),0,10,this, + // Qt::WStyle_Customize|Qt::WStyle_NormalBorder); + lib_progress_dialog->setWindowTitle(" "); QLabel *label=new QLabel(tr("Please Wait..."),lib_progress_dialog); label->setAlignment(Qt::AlignCenter); label->setFont(progressFont()); @@ -129,6 +131,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) connectHost("localhost",RIPCD_TCP_PORT,rda->config()->password()); cut_clipboard=NULL; lib_user_timer=new QTimer(this); + lib_user_timer->setSingleShot(true); connect(lib_user_timer,SIGNAL(timeout()),this,SLOT(userData())); // @@ -862,7 +865,7 @@ void MainWidget::LoadGeometry() void MainWidget::SaveGeometry() { QString geometry_file=GeometryFile(); - FILE *file=fopen(geometry_file,"w"); + FILE *file=fopen(geometry_file.toUtf8(),"w"); if(file==NULL) { return; } @@ -898,7 +901,7 @@ bool MainWidget::UnlockUser() bool ret=lib_user_changed; lib_edit_pending=false; if(lib_user_changed) { - lib_user_timer->start(0,true); + lib_user_timer->start(0); lib_user_changed=false; } @@ -948,25 +951,24 @@ int main(int argc,char *argv[]) // // Load Translations // - QTranslator qt(0); - qt.load(QString("/usr/share/qt4/translations/qt_")+QTextCodec::locale(), - "."); - a.installTranslator(&qt); + QString loc=RDApplication::locale(); + if(!loc.isEmpty()) { + QTranslator qt(0); + qt.load(QString("/usr/share/qt4/translations/qt_")+loc,"."); + a.installTranslator(&qt); - QTranslator rd(0); - rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+ - QTextCodec::locale(),"."); - a.installTranslator(&rd); + QTranslator rd(0); + rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+loc,"."); + a.installTranslator(&rd); - QTranslator rdhpi(0); - rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+ - QTextCodec::locale(),"."); - a.installTranslator(&rdhpi); + QTranslator rdhpi(0); + rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+loc,"."); + a.installTranslator(&rdhpi); - QTranslator tr(0); - tr.load(QString(PREFIX)+QString("/share/rivendell/rdlibrary_")+ - QTextCodec::locale(),"."); - a.installTranslator(&tr); + QTranslator tr(0); + tr.load(QString(PREFIX)+QString("/share/rivendell/rdlibrary_")+loc,"."); + a.installTranslator(&tr); + } // // Start Event Loop @@ -974,7 +976,6 @@ int main(int argc,char *argv[]) RDConfig *config=new RDConfig(); config->load(); MainWidget *w=new MainWidget(config); - a.setMainWidget(w); w->show(); return a.exec(); } diff --git a/rdlibrary/record_cut.cpp b/rdlibrary/record_cut.cpp index 35abdf0c..988a8afe 100644 --- a/rdlibrary/record_cut.cpp +++ b/rdlibrary/record_cut.cpp @@ -2,7 +2,7 @@ // // Record a Rivendell Cut // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include +#include #include #include @@ -104,8 +104,7 @@ RecordCut::RecordCut(RDCart *cart,QString cut,bool use_weight,QWidget *parent) // cut_description_edit=new QLineEdit(this); cut_description_edit->setMaxLength(64); - cut_description_label= - new QLabel(cut_description_edit,tr("&Description")+":",this); + cut_description_label=new QLabel(tr("&Description")+":",this); cut_description_label->setFont(labelFont()); cut_description_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -114,7 +113,7 @@ RecordCut::RecordCut(RDCart *cart,QString cut,bool use_weight,QWidget *parent) // cut_outcue_edit=new QLineEdit(this); cut_outcue_edit->setMaxLength(64); - cut_outcue_label=new QLabel(cut_outcue_edit,tr("&Outcue")+":",this); + cut_outcue_label=new QLabel(tr("&Outcue")+":",this); cut_outcue_label->setFont(labelFont()); cut_outcue_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -123,7 +122,7 @@ RecordCut::RecordCut(RDCart *cart,QString cut,bool use_weight,QWidget *parent) // cut_isci_edit=new QLineEdit(this); cut_isci_edit->setMaxLength(32); - cut_isci_label=new QLabel(cut_isci_edit,tr("&ISCI Code")+":",this); + cut_isci_label=new QLabel(tr("&ISCI Code")+":",this); cut_isci_label->setFont(labelFont()); cut_isci_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -132,7 +131,7 @@ RecordCut::RecordCut(RDCart *cart,QString cut,bool use_weight,QWidget *parent) // cut_isrc_edit=new QLineEdit(this); cut_isrc_edit->setMaxLength(64); - cut_isrc_label=new QLabel(cut_isrc_edit,tr("ISRC")+":",this); + cut_isrc_label=new QLabel(tr("ISRC")+":",this); cut_isrc_label->setFont(labelFont()); cut_isrc_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -141,7 +140,7 @@ RecordCut::RecordCut(RDCart *cart,QString cut,bool use_weight,QWidget *parent) // cut_source_edit=new QLineEdit(this); cut_source_edit->setReadOnly(true); - cut_source_label=new QLabel(cut_source_edit,tr("Source")+":",this); + cut_source_label=new QLabel(tr("Source")+":",this); cut_source_label->setFont(labelFont()); cut_source_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -150,7 +149,7 @@ RecordCut::RecordCut(RDCart *cart,QString cut,bool use_weight,QWidget *parent) // cut_ingest_edit=new QLineEdit(this); cut_ingest_edit->setReadOnly(true); - cut_ingest_label=new QLabel(cut_ingest_edit,tr("Ingest")+":",this); + cut_ingest_label=new QLabel(tr("Ingest")+":",this); cut_ingest_label->setFont(labelFont()); cut_ingest_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -160,7 +159,7 @@ RecordCut::RecordCut(RDCart *cart,QString cut,bool use_weight,QWidget *parent) cut_playdate_edit=new QLineEdit(this); cut_playdate_edit->setReadOnly(true); cut_playdate_edit->setMaxLength(64); - cut_playdate_label=new QLabel(cut_playdate_edit,tr("Last Played")+":",this); + cut_playdate_label=new QLabel(tr("Last Played")+":",this); cut_playdate_label->setFont(labelFont()); cut_playdate_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -171,8 +170,7 @@ RecordCut::RecordCut(RDCart *cart,QString cut,bool use_weight,QWidget *parent) cut_playcounter_edit->setAlignment(Qt::AlignRight); cut_playcounter_edit->setReadOnly(true); cut_playcounter_edit->setMaxLength(64); - cut_playcounter_label= - new QLabel(cut_playcounter_edit,tr("# of Plays")+":",this); + cut_playcounter_label=new QLabel(tr("# of Plays")+":",this); cut_playcounter_label->setFont(labelFont()); cut_playcounter_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -180,8 +178,7 @@ RecordCut::RecordCut(RDCart *cart,QString cut,bool use_weight,QWidget *parent) // Evergreen Checkbox // rec_evergreen_box=new QCheckBox(this); - rec_evergreen_label=new - QLabel(rec_evergreen_box,tr("Cut is EVERGREEN")+":",this); + rec_evergreen_label=new QLabel(tr("Cut is EVERGREEN")+":",this); rec_evergreen_label->setFont(labelFont()); rec_evergreen_label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); connect(rec_evergreen_box,SIGNAL(toggled(bool)), @@ -192,7 +189,7 @@ RecordCut::RecordCut(RDCart *cart,QString cut,bool use_weight,QWidget *parent) // cut_weight_box=new QSpinBox(this); cut_weight_box->setRange(0,100); - cut_weight_label=new QLabel(cut_weight_box,tr("Weight")+":",this); + cut_weight_label=new QLabel(tr("Weight")+":",this); cut_weight_label->setFont(labelFont()); cut_weight_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -211,12 +208,12 @@ RecordCut::RecordCut(RDCart *cart,QString cut,bool use_weight,QWidget *parent) cut_startdatetime_edit=new QDateTimeEdit(this); cut_startdatetime_edit->setDisplayFormat("MM/dd/yyyy - hh:mm:ss"); - cut_startdatetime_label=new QLabel(cut_startdatetime_edit,tr("&Start"),this); + cut_startdatetime_label=new QLabel(tr("&Start"),this); cut_startdatetime_label->setFont(subLabelFont()); cut_startdatetime_label->setAlignment(Qt::AlignRight); cut_enddatetime_edit=new QDateTimeEdit(this); cut_enddatetime_edit->setDisplayFormat("MM/dd/yyyy - hh:mm:ss"); - cut_enddatetime_label=new QLabel(cut_enddatetime_edit,tr("End"),this); + cut_enddatetime_label=new QLabel(tr("End"),this); cut_enddatetime_label->setFont(subLabelFont()); cut_enddatetime_label->setAlignment(Qt::AlignRight); @@ -235,13 +232,13 @@ RecordCut::RecordCut(RDCart *cart,QString cut,bool use_weight,QWidget *parent) cut_starttime_edit=new QTimeEdit(this); cut_starttime_edit->setDisplayFormat("hh:mm:ss"); - cut_starttime_label=new QLabel(cut_starttime_edit,tr("&Start Time"),this); + cut_starttime_label=new QLabel(tr("&Start Time"),this); cut_starttime_label->setFont(subLabelFont()); cut_starttime_label->setAlignment(Qt::AlignRight); cut_endtime_edit=new QTimeEdit(this); cut_endtime_edit->setDisplayFormat("hh:mm:ss"); - cut_endtime_label=new QLabel(cut_endtime_edit,tr("End Time"),this); + cut_endtime_label=new QLabel(tr("End Time"),this); cut_endtime_label->setFont(subLabelFont()); cut_endtime_label->setAlignment(Qt::AlignRight); @@ -251,37 +248,37 @@ RecordCut::RecordCut(RDCart *cart,QString cut,bool use_weight,QWidget *parent) rec_dayofweek_groupbox=new QGroupBox(tr("Day of the Week"),this); rec_dayofweek_groupbox->setFont(labelFont()); rec_weekpart_button[0]=new QCheckBox(this); - rec_weekpart_label[0]=new QLabel(rec_weekpart_button[0],tr("Monday"),this); + rec_weekpart_label[0]=new QLabel(tr("Monday"),this); rec_weekpart_label[0]->setFont(subLabelFont()); rec_weekpart_label[0]->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); rec_weekpart_button[1]=new QCheckBox(this); - rec_weekpart_label[1]=new QLabel(rec_weekpart_button[1],tr("Tuesday"),this); + rec_weekpart_label[1]=new QLabel(tr("Tuesday"),this); rec_weekpart_label[1]->setFont(subLabelFont()); rec_weekpart_label[1]->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); rec_weekpart_button[2]=new QCheckBox(this); - rec_weekpart_label[2]=new QLabel(rec_weekpart_button[2],tr("Wednesday"),this); + rec_weekpart_label[2]=new QLabel(tr("Wednesday"),this); rec_weekpart_label[2]->setFont(subLabelFont()); rec_weekpart_label[2]->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); rec_weekpart_button[3]=new QCheckBox(this); - rec_weekpart_label[3]=new QLabel(rec_weekpart_button[3],tr("Thursday"),this); + rec_weekpart_label[3]=new QLabel(tr("Thursday"),this); rec_weekpart_label[3]->setFont(subLabelFont()); rec_weekpart_label[3]->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); rec_weekpart_button[4]=new QCheckBox(this); - rec_weekpart_label[4]=new QLabel(rec_weekpart_button[4],tr("Friday"),this); + rec_weekpart_label[4]=new QLabel(tr("Friday"),this); rec_weekpart_label[4]->setFont(subLabelFont()); rec_weekpart_label[4]->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); rec_weekpart_button[5]=new QCheckBox(this); - rec_weekpart_label[5]=new QLabel(rec_weekpart_button[5],tr("Saturday"),this); + rec_weekpart_label[5]=new QLabel(tr("Saturday"),this); rec_weekpart_label[5]->setFont(subLabelFont()); rec_weekpart_label[5]->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); rec_weekpart_button[6]=new QCheckBox(this); - rec_weekpart_label[6]=new QLabel(rec_weekpart_button[6],tr("Sunday"),this); + rec_weekpart_label[6]=new QLabel(tr("Sunday"),this); rec_weekpart_label[6]->setFont(subLabelFont()); rec_weekpart_label[6]->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -328,7 +325,7 @@ RecordCut::RecordCut(RDCart *cart,QString cut,bool use_weight,QWidget *parent) // rec_channels_box=new QComboBox(this); rec_channels_edit=new QLineEdit(this); - rec_channels_box_label=new QLabel(rec_channels_box,tr("Channels"),this); + rec_channels_box_label=new QLabel(tr("Channels"),this); rec_channels_box_label->setAlignment(Qt::AlignHCenter); rec_channels_box_label->setFont(labelFont()); connect(rec_channels_box,SIGNAL(activated(int)), @@ -361,7 +358,7 @@ RecordCut::RecordCut(RDCart *cart,QString cut,bool use_weight,QWidget *parent) // Record Mode // rec_mode_box=new QComboBox(this); - rec_mode_box_label=new QLabel(rec_mode_box,tr("Record Mode"),this); + rec_mode_box_label=new QLabel(tr("Record Mode"),this); rec_mode_box_label->setAlignment(Qt::AlignHCenter); rec_mode_box_label->setFont(labelFont()); @@ -369,7 +366,7 @@ RecordCut::RecordCut(RDCart *cart,QString cut,bool use_weight,QWidget *parent) // AutoTrim Mode // rec_trim_box=new QComboBox(this); - rec_trim_box_label=new QLabel(rec_trim_box,tr("AutoTrim"),this); + rec_trim_box_label=new QLabel(tr("AutoTrim"),this); rec_trim_box_label->setAlignment(Qt::AlignHCenter); rec_trim_box_label->setFont(labelFont()); @@ -441,28 +438,28 @@ RecordCut::RecordCut(RDCart *cart,QString cut,bool use_weight,QWidget *parent) rec_weekpart_button[i]->setChecked(true); } } - rec_channels_box->insertItem("1"); - rec_channels_box->insertItem("2"); - rec_channels_box->setCurrentItem(rec_cut->channels()-1); + rec_channels_box->insertItem(0,"1"); + rec_channels_box->insertItem(1,"2"); + rec_channels_box->setCurrentIndex(rec_cut->channels()-1); rec_channels_edit->setText(QString().sprintf("%d",rec_cut->channels())); - rec_mode_box->insertItem(tr("Manual")); - rec_mode_box->insertItem(tr("VOX")); + rec_mode_box->insertItem(0,tr("Manual")); + rec_mode_box->insertItem(1,tr("VOX")); switch(rda->libraryConf()->defaultRecordMode()) { case RDLibraryConf::Manual: - rec_mode_box->setCurrentItem(0); + rec_mode_box->setCurrentIndex(0); break; case RDLibraryConf::Vox: - rec_mode_box->setCurrentItem(1); + rec_mode_box->setCurrentIndex(1); break; } - rec_trim_box->insertItem(tr("On")); - rec_trim_box->insertItem(tr("Off")); + rec_trim_box->insertItem(0,tr("On")); + rec_trim_box->insertItem(1,tr("Off")); if(rda->libraryConf()->defaultTrimState()) { - rec_trim_box->setCurrentItem(0); + rec_trim_box->setCurrentIndex(0); } else { - rec_trim_box->setCurrentItem(1); + rec_trim_box->setCurrentIndex(1); } aesAlarmData(rec_card_no[0],rec_port_no[0], rda->cae()->inputStatus(rec_card_no[0],rec_port_no[0])); @@ -651,7 +648,7 @@ void RecordCut::recordData() rec_cut->setSampleRate(rec_samprate); rec_bitrate=rda->libraryConf()->defaultBitrate(); rec_cut->setBitRate(rec_bitrate); - rec_channels=rec_channels_box->currentItem()+1; + rec_channels=rec_channels_box->currentIndex()+1; rec_cut->setChannels(rec_channels); rec_cut->setOriginDatetime(QDateTime::currentDateTime()); rec_cut->setOriginName(rda->station()->name()); @@ -681,7 +678,7 @@ void RecordCut::playData() rda->cae()->play(rec_play_handle,end-start,RD_TIMESCALE_DIVISOR,false); } if(is_ready&&(!is_recording)) { - if(rec_mode_box->currentItem()==1) { + if(rec_mode_box->currentIndex()==1) { rda->cae()-> record(rec_card_no[0],rec_port_no[0],rda->libraryConf()->maxLength(), rda->libraryConf()->voxThreshold()); @@ -796,7 +793,7 @@ void RecordCut::recordUnloadedData(int card,int stream,unsigned len) rda->station()->name(),s,len); RDRehash::rehash(rda->station(),rda->user(),rda->config(),rec_cut->cartNumber(), rec_cut->cutNumber()); - if(rec_trim_box->currentItem()==0) { + if(rec_trim_box->currentIndex()==0) { rec_cut->autoTrim(RDCut::AudioBoth,rda->libraryConf()->trimThreshold()); } rec_length=rec_cut->length(); diff --git a/rdlogedit/Makefile.am b/rdlogedit/Makefile.am index 98e2809f..75ed0b38 100644 --- a/rdlogedit/Makefile.am +++ b/rdlogedit/Makefile.am @@ -18,7 +18,7 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ## -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -68,7 +68,7 @@ nodist_rdlogedit_SOURCES = moc_add_meta.cpp\ moc_render_dialog.cpp\ moc_voice_tracker.cpp -rdlogedit_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdlogedit_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ EXTRA_DIST = rdlogedit.pro\ rdlogedit_cs.ts\ diff --git a/rdlogedit/edit_event.cpp b/rdlogedit/edit_event.cpp index 0c68d910..4378cd33 100644 --- a/rdlogedit/edit_event.cpp +++ b/rdlogedit/edit_event.cpp @@ -18,9 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - #include #include #include @@ -39,7 +36,7 @@ EditEvent::EditEvent(RDLogLine *line,QWidget *parent) // Time Type // edit_timetype_box=new QCheckBox(this); - edit_timetype_label=new QLabel(edit_timetype_box,tr("Start at:"),this); + edit_timetype_label=new QLabel(tr("Start at:"),this); edit_timetype_label->setGeometry(30,21,85,17); edit_timetype_label->setFont(labelFont()); edit_timetype_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -83,10 +80,10 @@ EditEvent::EditEvent(RDLogLine *line,QWidget *parent) // Transition Type // edit_transtype_box=new QComboBox(this); - edit_transtype_box->insertItem(tr("Play")); - edit_transtype_box->insertItem(tr("Segue")); - edit_transtype_box->insertItem(tr("Stop")); - edit_time_label=new QLabel(edit_transtype_box,tr("Transition Type:"),this); + edit_transtype_box->insertItem(0,tr("Play")); + edit_transtype_box->insertItem(1,tr("Segue")); + edit_transtype_box->insertItem(2,tr("Stop")); + edit_time_label=new QLabel(tr("Transition Type:"),this); edit_time_label->setGeometry(10,68,370,26); edit_time_label->setFont(labelFont()); edit_time_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -137,7 +134,7 @@ EditEvent::EditEvent(RDLogLine *line,QWidget *parent) graceClickedData(2); break; } - edit_transtype_box->setCurrentItem(edit_logline->transType()); + edit_transtype_box->setCurrentIndex(edit_logline->transType()); } @@ -229,7 +226,7 @@ void EditEvent::okData() edit_logline->setGraceTime(0); } edit_logline-> - setTransType((RDLogLine::TransType)edit_transtype_box->currentItem()); + setTransType((RDLogLine::TransType)edit_transtype_box->currentIndex()); done(edit_logline->id()); } } diff --git a/rdlogedit/edit_log.cpp b/rdlogedit/edit_log.cpp index 4769afa3..64bff21c 100644 --- a/rdlogedit/edit_log.cpp +++ b/rdlogedit/edit_log.cpp @@ -2,7 +2,7 @@ // // Edit a Rivendell Log // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -20,7 +20,6 @@ #include #include -#include #include #include @@ -43,8 +42,8 @@ EditLog::EditLog(QString logname,QString *filter,QString *group, QString sql; RDSqlQuery *q; QStringList services_list; - QColor system_mid_color = colorGroup().mid(); - QColor system_button_color = palette().active().button(); + QColor system_mid_color=palette().mid().color(); + QColor system_button_color=palette().button().color(); edit_logname=logname; edit_filter=filter; @@ -100,14 +99,14 @@ EditLog::EditLog(QString logname,QString *filter,QString *group, // Log Name // edit_modified_label=new QLabel(this); - edit_modified_label->setBackgroundColor(QColor(system_mid_color)); + // edit_modified_label->setBackgroundColor(QColor(system_mid_color)); edit_modified_label->setAlignment(Qt::AlignCenter|Qt::AlignVCenter); edit_modified_label->setFont(progressFont()); edit_logname_label=new QLabel(logname,this); - edit_logname_label->setBackgroundColor(QColor(system_mid_color)); + // edit_logname_label->setBackgroundColor(QColor(system_mid_color)); edit_logname_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); edit_logname_label_label=new QLabel(tr("Log Name:"),this); - edit_logname_label_label->setBackgroundColor(QColor(system_mid_color)); + // edit_logname_label_label->setBackgroundColor(QColor(system_mid_color)); edit_logname_label_label->setFont(labelFont()); edit_logname_label_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -115,10 +114,10 @@ EditLog::EditLog(QString logname,QString *filter,QString *group, // Track Counts // edit_track_label=new QLabel(this); - edit_track_label->setBackgroundColor(QColor(system_mid_color)); + // edit_track_label->setBackgroundColor(QColor(system_mid_color)); edit_track_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); edit_track_label_label=new QLabel(tr("Tracks:"),this); - edit_track_label_label->setBackgroundColor(QColor(system_mid_color)); + // edit_track_label_label->setBackgroundColor(QColor(system_mid_color)); edit_track_label_label->setFont(labelFont()); edit_track_label_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -129,10 +128,10 @@ EditLog::EditLog(QString logname,QString *filter,QString *group, new QLabel(edit_log->originUser()+QString(" - ")+ edit_log->originDatetime().toString("MM/dd/yyyy - hh:mm:ss"), this); - edit_origin_label->setBackgroundColor(QColor(system_mid_color)); + // edit_origin_label->setBackgroundColor(QColor(system_mid_color)); edit_origin_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); edit_origin_label_label=new QLabel(tr("Origin:"),this); - edit_origin_label_label->setBackgroundColor(QColor(system_mid_color)); + // edit_origin_label_label->setBackgroundColor(QColor(system_mid_color)); edit_origin_label_label->setFont(labelFont()); edit_origin_label_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -143,8 +142,7 @@ EditLog::EditLog(QString logname,QString *filter,QString *group, edit_description_edit->setValidator(validator); connect(edit_description_edit,SIGNAL(textChanged(const QString &)), this,SLOT(descriptionChangedData(const QString &))); - edit_description_label= - new QLabel(edit_description_edit,tr("Description:"),this); + edit_description_label=new QLabel(tr("Description:"),this); edit_description_label->setFont(labelFont()); edit_description_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -152,7 +150,7 @@ EditLog::EditLog(QString logname,QString *filter,QString *group, // Purge Date // edit_purgedate_box=new QCheckBox(this); - edit_purgedate_label=new QLabel(edit_purgedate_box,tr("Delete on"),this); + edit_purgedate_label=new QLabel(tr("Delete on"),this); edit_purgedate_label->setFont(labelFont()); edit_purgedate_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); edit_purgedate_edit=new QDateEdit(this); @@ -176,7 +174,7 @@ EditLog::EditLog(QString logname,QString *filter,QString *group, edit_service_box=new QComboBox(this); edit_service_edit=new QLineEdit(this); edit_service_edit->setReadOnly(true); - edit_service_label=new QLabel(edit_service_box,tr("Service:"),this); + edit_service_label=new QLabel(tr("Service:"),this); edit_service_label->setFont(labelFont()); edit_service_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(edit_service_box,SIGNAL(activated(const QString &)), @@ -186,12 +184,11 @@ EditLog::EditLog(QString logname,QString *filter,QString *group, // Auto Refresh // edit_autorefresh_box=new QComboBox(this); - edit_autorefresh_box->insertItem(tr("Yes")); - edit_autorefresh_box->insertItem(tr("No")); + edit_autorefresh_box->insertItem(0,tr("Yes")); + edit_autorefresh_box->insertItem(1,tr("No")); edit_autorefresh_edit=new QLineEdit(this); edit_autorefresh_edit->setReadOnly(true); - edit_autorefresh_label= - new QLabel(edit_autorefresh_box,tr("Enable AutoRefresh:"),this); + edit_autorefresh_label=new QLabel(tr("Enable AutoRefresh:"),this); edit_autorefresh_label->setFont(labelFont()); edit_autorefresh_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(edit_autorefresh_box,SIGNAL(activated(int)), @@ -202,7 +199,7 @@ EditLog::EditLog(QString logname,QString *filter,QString *group, // edit_startdate_edit=new QDateEdit(this); edit_startdate_edit->setDisplayFormat("MM/dd/yyyy"); - edit_startdate_label=new QLabel(edit_startdate_edit,tr("Start Date:"),this); + edit_startdate_label=new QLabel(tr("Start Date:"),this); edit_startdate_label->setFont(labelFont()); edit_startdate_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(edit_startdate_edit,SIGNAL(dateChanged(const QDate &)), @@ -214,7 +211,7 @@ EditLog::EditLog(QString logname,QString *filter,QString *group, // edit_enddate_edit=new QDateEdit(this); edit_enddate_edit->setDisplayFormat("MM/dd/yyyy"); - edit_enddate_label=new QLabel(edit_startdate_edit,tr("End Date:"),this); + edit_enddate_label=new QLabel(tr("End Date:"),this); edit_enddate_label->setFont(labelFont()); edit_enddate_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(edit_enddate_edit,SIGNAL(dateChanged(const QDate &)), @@ -226,8 +223,7 @@ EditLog::EditLog(QString logname,QString *filter,QString *group, edit_startdate_box=new QCheckBox(this); connect(edit_startdate_box,SIGNAL(toggled(bool)), this,SLOT(startDateEnabledData(bool))); - edit_startdate_box_label= - new QLabel(edit_startdate_box,tr("Start Date Enabled"),this); + edit_startdate_box_label=new QLabel(tr("Start Date Enabled"),this); edit_startdate_box_label->setFont(labelFont()); edit_startdate_box_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -237,8 +233,7 @@ EditLog::EditLog(QString logname,QString *filter,QString *group, edit_enddate_box=new QCheckBox(this); connect(edit_enddate_box,SIGNAL(toggled(bool)), this,SLOT(endDateEnabledData(bool))); - edit_enddate_box_label= - new QLabel(edit_enddate_box,tr("End Date Enabled"),this); + edit_enddate_box_label=new QLabel(tr("End Date Enabled"),this); edit_enddate_box_label->setFont(labelFont()); edit_enddate_box_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -252,7 +247,7 @@ EditLog::EditLog(QString logname,QString *filter,QString *group, // Stop Time Counter // edit_stoptime_edit=new QLineEdit(this); - edit_stoptime_label=new QLabel(edit_stoptime_edit,tr("Next Stop:"),this); + edit_stoptime_label=new QLabel(tr("Next Stop:"),this); edit_stoptime_label->setFont(labelFont()); edit_stoptime_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -260,7 +255,7 @@ EditLog::EditLog(QString logname,QString *filter,QString *group, // End Time Counter // edit_endtime_edit=new QLineEdit(this); - edit_endtime_label=new QLabel(edit_endtime_edit,tr("Log End:"),this); + edit_endtime_label=new QLabel(tr("Log End:"),this); edit_endtime_label->setFont(labelFont()); edit_endtime_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -433,8 +428,7 @@ EditLog::EditLog(QString logname,QString *filter,QString *group, edit_timestyle_box->setCurrentIndex(global_start_time_style); connect(edit_timestyle_box,SIGNAL(activated(int)), this,SLOT(timestyleChangedData(int))); - edit_timestyle_label= - new QLabel(edit_timestyle_box,tr("Show Start Times As"),this); + edit_timestyle_label=new QLabel(tr("Show Start Times As"),this); edit_timestyle_label->setFont(labelFont()); edit_timestyle_label->setAlignment(Qt::AlignCenter|Qt::AlignVCenter); @@ -482,7 +476,7 @@ EditLog::EditLog(QString logname,QString *filter,QString *group, QString service=edit_log->service(); for ( QStringList::Iterator it = services_list.begin(); it != services_list.end(); ++it ) { - edit_service_box->insertItem(*it); + edit_service_box->insertItem(edit_service_box->count(),*it); if(*it==service) { n=ncounter; edit_service_edit->setText(*it); @@ -490,14 +484,14 @@ EditLog::EditLog(QString logname,QString *filter,QString *group, ncounter++; } if(n>=0) { - edit_service_box->setCurrentItem(n); + edit_service_box->setCurrentIndex(n); } if(edit_log->autoRefresh()) { - edit_autorefresh_box->setCurrentItem(0); + edit_autorefresh_box->setCurrentIndex(0); edit_autorefresh_edit->setText(tr("Yes")); } else { - edit_autorefresh_box->setCurrentItem(1); + edit_autorefresh_box->setCurrentIndex(1); edit_autorefresh_edit->setText(tr("No")); } if(!edit_log->startDate().isNull()) { @@ -1015,7 +1009,7 @@ void EditLog::saveData() } SaveLog(); SetLogModified(false); - edit_log->setAutoRefresh(edit_autorefresh_box->currentItem()==0); + edit_log->setAutoRefresh(edit_autorefresh_box->currentIndex()==0); edit_log-> setModifiedDatetime(QDateTime(QDate::currentDate(),QTime::currentTime())); } @@ -1051,8 +1045,8 @@ void EditLog::saveasData() edit_log=new RDLog(logname); edit_log_model->setLogName(logname); for(int i=0;icount();i++) { - if(edit_service_box->text(i)==svcname) { - edit_service_box->setCurrentItem(i); + if(edit_service_box->itemData(i).toString()==svcname) { + edit_service_box->setCurrentIndex(i); } } SaveLog(); @@ -1097,7 +1091,7 @@ void EditLog::reportsData() ListReports *lr= new ListReports(edit_log->name(),edit_description_edit->text(), edit_service_box->currentText(),start_date,end_date, - edit_autorefresh_box->currentItem()==0, + edit_autorefresh_box->currentIndex()==0, edit_log_model,this); lr->exec(); delete lr; @@ -1230,7 +1224,7 @@ void EditLog::resizeEvent(QResizeEvent *e) void EditLog::paintEvent(QPaintEvent *e) { - QColor system_mid_color = colorGroup().mid(); + QColor system_mid_color = palette().mid().color(); QPainter *p=new QPainter(this); p->fillRect(60,8,size().width()-120,24,QColor(system_mid_color)); p->fillRect(9,size().height()-130,size().width()-20,60, @@ -1270,7 +1264,7 @@ void EditLog::SaveLog() else { edit_log->setEndDate(QDate()); } - edit_log->setAutoRefresh(edit_autorefresh_box->currentItem()==0); + edit_log->setAutoRefresh(edit_autorefresh_box->currentIndex()==0); edit_log_model->save(rda->config()); edit_log-> setModifiedDatetime(QDateTime(QDate::currentDate(),QTime::currentTime())); diff --git a/rdlogedit/edit_logline.cpp b/rdlogedit/edit_logline.cpp index 638af750..f952d7fa 100644 --- a/rdlogedit/edit_logline.cpp +++ b/rdlogedit/edit_logline.cpp @@ -2,7 +2,7 @@ // // Edit a Rivendell Log Entry // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include +#include #include "edit_logline.h" @@ -53,12 +53,10 @@ EditLogLine::EditLogLine(RDLogLine *line,QString *filter,QString *group, // edit_overlap_box=new QCheckBox(this); edit_overlap_box->setGeometry(30,94,15,15); - edit_overlap_label= - new QLabel(edit_overlap_box,tr("No Fade on Segue Out"),this); + edit_overlap_label=new QLabel(tr("No Fade on Segue Out"),this); edit_overlap_label->setGeometry(50,90,sizeHint().width()-60,26); edit_overlap_label->setFont(labelFont()); - edit_overlap_label-> - setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); + edit_overlap_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Cart Number diff --git a/rdlogedit/list_reports.cpp b/rdlogedit/list_reports.cpp index 044bc190..5701a176 100644 --- a/rdlogedit/list_reports.cpp +++ b/rdlogedit/list_reports.cpp @@ -2,7 +2,7 @@ // // List and Generate Log Reports // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,8 +18,8 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include +#include +#include #include #include @@ -56,10 +56,9 @@ ListReports::ListReports(const QString &logname,const QString &description, // list_reports_box=new QComboBox(this); list_reports_box->setGeometry(50,10,sizeHint().width()-60,19); - list_reports_box->insertItem(tr("Log Listing")); - list_reports_box->insertItem(tr("Log Exception Report")); - QLabel *list_reports_label= - new QLabel(list_reports_box,tr("Type:"),this); + list_reports_box->insertItem(0,tr("Log Listing")); + list_reports_box->insertItem(1,tr("Log Exception Report")); + QLabel *list_reports_label=new QLabel(tr("Type:"),this); list_reports_label->setGeometry(10,10,35,19); list_reports_label->setFont(labelFont()); list_reports_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -70,7 +69,7 @@ ListReports::ListReports(const QString &logname,const QString &description, list_date_edit=new QDateEdit(this); list_date_edit->setDisplayFormat("MM/dd/yyyy"); list_date_edit->setGeometry(110,34,100,19); - QLabel *list_date_label=new QLabel(list_date_edit,tr("Effective Date:"),this); + QLabel *list_date_label=new QLabel(tr("Effective Date:"),this); list_date_label->setGeometry(10,34,95,19); list_date_label->setFont(labelFont()); list_date_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -135,7 +134,7 @@ void ListReports::generateData() { QString report; - switch(list_reports_box->currentItem()) { + switch(list_reports_box->currentIndex()) { case 0: // Event Report GenerateLogReport(&report); break; diff --git a/rdlogedit/logtableview.cpp b/rdlogedit/logtableview.cpp index 9500887c..cf1cc106 100644 --- a/rdlogedit/logtableview.cpp +++ b/rdlogedit/logtableview.cpp @@ -52,13 +52,17 @@ LogTableView::LogTableView(QWidget *parent) void LogTableView::dragEnterEvent(QDragEnterEvent *e) { - e->accept(RDCartDrag::canDecode(e)); + if(RDCartDrag::canDecode(e)) { + e->accept(); + } } void LogTableView::dragMoveEvent(QDragMoveEvent *e) { - e->accept(RDCartDrag::canDecode(e)); + if(RDCartDrag::canDecode(e)) { + e->accept(); + } } diff --git a/rdlogedit/rdlogedit.cpp b/rdlogedit/rdlogedit.cpp index 042d17d9..3f18e75d 100644 --- a/rdlogedit/rdlogedit.cpp +++ b/rdlogedit/rdlogedit.cpp @@ -532,8 +532,8 @@ void MainWidget::reportData() } else { report+=q->value(10).toDate().toString("MM/dd/yyyy")+" "; - report+=QString().sprintf("%s ", - (const char *)q->value(10).toDate().toString("MM/dd/yyyy")); + report+=QString().sprintf("%s ",q->value(10).toDate(). + toString("MM/dd/yyyy").toUtf8().constData()); } // @@ -681,24 +681,27 @@ int main(int argc,char *argv[]) QString tr_path; QString qt_path; - tr_path=QString(PREFIX)+QString("/share/rivendell/"); - qt_path=QString("/usr/share/qt4/translation/"); + QString loc=RDApplication::locale(); + if(!loc.isEmpty()) { + tr_path=QString(PREFIX)+QString("/share/rivendell/"); + qt_path=QString("/usr/share/qt4/translation/"); - QTranslator qt(0); - qt.load(qt_path+QString("qt_")+QTextCodec::locale(),"."); - a.installTranslator(&qt); + QTranslator qt(0); + qt.load(qt_path+QString("qt_")+loc,"."); + a.installTranslator(&qt); - QTranslator rd(0); - rd.load(tr_path+QString("librd_")+QTextCodec::locale(),"."); - a.installTranslator(&rd); + QTranslator rd(0); + rd.load(tr_path+QString("librd_")+loc,"."); + a.installTranslator(&rd); - QTranslator rdhpi(0); - rdhpi.load(tr_path+QString("librdhpi_")+QTextCodec::locale(),"."); - a.installTranslator(&rdhpi); + QTranslator rdhpi(0); + rdhpi.load(tr_path+QString("librdhpi_")+loc,"."); + a.installTranslator(&rdhpi); - QTranslator tr(0); - tr.load(tr_path+QString("rdlogedit_")+QTextCodec::locale(),"."); - a.installTranslator(&tr); + QTranslator tr(0); + tr.load(tr_path+QString("rdlogedit_")+loc,"."); + a.installTranslator(&tr); + } // // Start Event Loop @@ -706,7 +709,6 @@ int main(int argc,char *argv[]) RDConfig *config=new RDConfig(); config->load(); MainWidget *w=new MainWidget(config); - a.setMainWidget(w); w->setGeometry(QRect(QPoint(w->geometry().x(),w->geometry().y()), w->sizeHint())); w->show(); diff --git a/rdlogedit/render_dialog.cpp b/rdlogedit/render_dialog.cpp index 61f01b4b..34a4d447 100644 --- a/rdlogedit/render_dialog.cpp +++ b/rdlogedit/render_dialog.cpp @@ -73,8 +73,8 @@ RenderDialog::RenderDialog(RDStation *station,RDSystem *system,RDConfig *config, // Render To Type // render_to_box=new QComboBox(this); - render_to_box->insertItem(tr("Cart/Cut")); - render_to_box->insertItem(tr("File")); + render_to_box->insertItem(0,tr("Cart/Cut")); + render_to_box->insertItem(1,tr("File")); connect(render_to_box,SIGNAL(activated(int)),this,SLOT(toChangedData(int))); render_to_label=new QLabel(tr("Render To")+":",this); render_to_label->setFont(labelFont()); @@ -110,8 +110,8 @@ RenderDialog::RenderDialog(RDStation *station,RDSystem *system,RDConfig *config, // Start Time // render_starttime_box=new QComboBox(this); - render_starttime_box->insertItem(tr("[now]")); - render_starttime_box->insertItem(tr("As Specified")); + render_starttime_box->insertItem(0,tr("[now]")); + render_starttime_box->insertItem(1,tr("As Specified")); connect(render_starttime_box,SIGNAL(activated(int)), this,SLOT(starttimeSourceData(int))); render_starttime_label=new QLabel(tr("Virtual Start Time")+":",this); @@ -125,8 +125,8 @@ RenderDialog::RenderDialog(RDStation *station,RDSystem *system,RDConfig *config, // Include Events // render_events_box=new QComboBox(this); - render_events_box->insertItem(tr("All Events")); - render_events_box->insertItem(tr("Only Selected Events")); + render_events_box->insertItem(0,tr("All Events")); + render_events_box->insertItem(1,tr("Only Selected Events")); render_events_label=new QLabel(tr("Include")+":",this); render_events_label->setFont(labelFont()); render_events_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -135,8 +135,8 @@ RenderDialog::RenderDialog(RDStation *station,RDSystem *system,RDConfig *config, // Ignore STOP // render_ignorestop_box=new QComboBox(this); - render_ignorestop_box->insertItem(tr("Stop Rendering")); - render_ignorestop_box->insertItem(tr("Treat as PLAY")); + render_ignorestop_box->insertItem(0,tr("Stop Rendering")); + render_ignorestop_box->insertItem(1,tr("Treat as PLAY")); render_ignorestop_label=new QLabel(tr("At STOP transition")+":",this); render_ignorestop_label->setFont(labelFont()); render_ignorestop_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -213,7 +213,7 @@ void RenderDialog::filenameChangedData(const QString &str) void RenderDialog::selectData() { - if(render_to_box->currentItem()) { + if(render_to_box->currentIndex()) { QString filename= QFileDialog::getSaveFileName(this,tr("Render Log"), render_save_path,RD_AUDIO_FILE_FILTER); @@ -265,28 +265,28 @@ void RenderDialog::renderData() int first_line=0; int last_line=render_model->lineCount(); - if(render_events_box->currentItem()) { + if(render_events_box->currentIndex()) { first_line=render_first_line; last_line=render_last_line; } QTime start_time=QTime::currentTime(); - if(render_starttime_box->currentItem()) { + if(render_starttime_box->currentIndex()) { start_time=render_starttime_edit->time(); } RDRenderer *r=new RDRenderer(this); connect(r,SIGNAL(lineStarted(int,int)),this,SLOT(lineStartedData(int,int))); connect(render_progress_dialog,SIGNAL(canceled()),r,SLOT(abort())); - if(render_to_box->currentItem()) { + if(render_to_box->currentIndex()) { result= r->renderToFile(render_filename_edit->text(),render_model,render_settings, - start_time,render_ignorestop_box->currentItem(), + start_time,render_ignorestop_box->currentIndex(), &err_msg,first_line,last_line); } else { result= r->renderToCart(render_to_cartnum,render_to_cutnum,render_model, render_settings,start_time, - render_ignorestop_box->currentItem(), + render_ignorestop_box->currentIndex(), &err_msg,first_line,last_line); } if(!result) { diff --git a/rdlogedit/voice_tracker.cpp b/rdlogedit/voice_tracker.cpp index 0115472e..14d3f0a5 100644 --- a/rdlogedit/voice_tracker.cpp +++ b/rdlogedit/voice_tracker.cpp @@ -2,7 +2,7 @@ // // Rivendell Voice Tracker // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -79,12 +79,12 @@ VoiceTracker::VoiceTracker(const QString &logname,QString *import_path, // // Create Palettes // - d_record_palette=QPalette(TRACKER_RECORD_BUTTON_COLOR,backgroundColor()); - d_start_palette=QPalette(TRACKER_START_BUTTON_COLOR,backgroundColor()); - d_done_palette=QPalette(TRACKER_DONE_BUTTON_COLOR,backgroundColor()); - d_abort_palette=QPalette(TRACKER_ABORT_BUTTON_COLOR,backgroundColor()); - QColor system_mid_color = colorGroup().mid(); - QColor system_button_color = palette().active().button(); + d_record_palette=QPalette(TRACKER_RECORD_BUTTON_COLOR,palette().color(QPalette::Background)); + d_start_palette=QPalette(TRACKER_START_BUTTON_COLOR,palette().color(QPalette::Background)); + d_done_palette=QPalette(TRACKER_DONE_BUTTON_COLOR,palette().color(QPalette::Background)); + d_abort_palette=QPalette(TRACKER_ABORT_BUTTON_COLOR,palette().color(QPalette::Background)); + QColor system_mid_color = palette().mid().color(); + QColor system_button_color = palette().button().color(); // // Create Track and Target Region @@ -319,7 +319,7 @@ VoiceTracker::VoiceTracker(const QString &logname,QString *import_path, d_length_label->setText("-:--:--.-"); d_length_label-> setStyleSheet("background-color: "+ - palette().color(QColorGroup::Background).name()); + palette().color(QPalette::Background).name()); d_length_label->setGeometry(565,255,110,25); d_length_label->setAlignment(Qt::AlignCenter); d_length_label->setFont(timerFont()); @@ -331,12 +331,12 @@ VoiceTracker::VoiceTracker(const QString &logname,QString *import_path, label->setGeometry(555,288,116,14); label->setFont(subLabelFont()); label->setAlignment(Qt::AlignHCenter); - label->setPalette(QPalette(backgroundColor(),colorGroup().mid())); + label->setPalette(QPalette(palette().color(QPalette::Background),palette().mid().color())); d_tracks_remaining_label=new QLabel(this); d_tracks_remaining_label->setText("0"); d_tracks_remaining_label-> setStyleSheet("background-color: "+ - palette().color(QColorGroup::Background).name()); + palette().color(QPalette::Background).name()); d_tracks_remaining_label->setGeometry(555,313,40,18); d_tracks_remaining_label->setAlignment(Qt::AlignCenter); d_tracks_remaining_label->setFont(labelFont()); @@ -344,27 +344,27 @@ VoiceTracker::VoiceTracker(const QString &logname,QString *import_path, label->setGeometry(555,300,40,14); label->setFont(subLabelFont()); label->setAlignment(Qt::AlignHCenter); - label->setPalette(QPalette(backgroundColor(),colorGroup().mid())); + label->setPalette(QPalette(palette().color(QPalette::Background),palette().mid().color())); d_time_remaining_label=new QLabel(this); d_time_remaining_label->setText("0:00:00.0"); d_time_remaining_label-> setStyleSheet("background-color: "+ - palette().color(QColorGroup::Background).name()); + palette().color(QPalette::Background).name()); d_time_remaining_label->setGeometry(600,313,80,18); d_time_remaining_label->setAlignment(Qt::AlignCenter); d_time_remaining_label->setFont(labelFont()); d_time_remaining_palette[0]=d_time_remaining_label->palette(); d_time_remaining_palette[1]=d_time_remaining_label->palette(); d_time_remaining_palette[1]. - setColor(QPalette::Active,QColorGroup::Foreground,Qt::red); + setColor(QPalette::Active,QPalette::Foreground,Qt::red); d_time_remaining_palette[1]. - setColor(QPalette::Inactive,QColorGroup::Foreground,Qt::red); + setColor(QPalette::Inactive,QPalette::Foreground,Qt::red); label=new QLabel(tr("Time"),this); label->setGeometry(605,300,60,14); label->setFont(subLabelFont()); label->setAlignment(Qt::AlignHCenter); - label->setPalette(QPalette(backgroundColor(),colorGroup().mid())); + label->setPalette(QPalette(palette().color(QPalette::Background),palette().mid().color())); // // Log List @@ -1858,7 +1858,7 @@ void VoiceTracker::paintEvent(QPaintEvent *e) for(int i=0;i<3;i++) { p->begin(d_wave_map[i]); p->setPen(TRACKER_TEXT_COLOR); - p->setBackgroundColor(Qt::gray); + p->setBackground(Qt::gray); p->eraseRect(0,0,d_wave_map[i]->size().width(), d_wave_map[i]->size().height()); p->end(); @@ -1872,7 +1872,7 @@ void VoiceTracker::paintEvent(QPaintEvent *e) p->fillRect(TRACKER_X_ORIGIN,TRACKER_Y_ORIGIN,TRACKER_X_WIDTH-1-2,238, Qt::white); p->fillRect(TRACKER_X_ORIGIN-2,TRACKER_Y_HEIGHT*3+TRACKER_Y_ORIGIN-1, - TRACKER_X_WIDTH+2,TRACKER_Y_HEIGHT+6,colorGroup().mid()); + TRACKER_X_WIDTH+2,TRACKER_Y_HEIGHT+6,palette().mid()); p->drawLine(TRACKER_X_ORIGIN-2,TRACKER_Y_ORIGIN-2, TRACKER_X_WIDTH+TRACKER_X_ORIGIN-1,TRACKER_Y_ORIGIN-2); @@ -2778,7 +2778,7 @@ void VoiceTracker::DrawTrackMap(int trackno) case 0: if(d_wave_name[0].isEmpty()) { p=new QPainter(d_wave_map[0]); - p->setBackgroundColor(Qt::gray); + p->setBackground(Qt::gray); p->eraseRect(0,0,d_wave_map[0]->size().width(), d_wave_map[0]->size().height()); p->end(); @@ -2788,7 +2788,7 @@ void VoiceTracker::DrawTrackMap(int trackno) d_wpg[0]->begin(d_wave_map[0]); d_wpg[0]->setFont(labelFont()); d_wpg[0]->setPen(TRACKER_TEXT_COLOR); - d_wpg[0]->setBackgroundColor(backgroundColor()); + d_wpg[0]->setBackground(palette().color(QPalette::Background)); d_wpg[0]->eraseRect(0,0,d_wave_map[0]->size().width(), d_wave_map[0]->size().height()); if(!d_wave_name[0].isEmpty()) { @@ -2867,7 +2867,7 @@ void VoiceTracker::DrawTrackMap(int trackno) if(d_wave_name[1].isEmpty()) { p=new QPainter(d_wave_map[1]); if(d_loaded) { - p->setBackgroundColor(backgroundColor()); + p->setBackground(palette().color(QPalette::Background)); p->setFont(labelFont()); p->setPen(TRACKER_TEXT_COLOR); p->eraseRect(0,0,d_wave_map[1]->size().width(), @@ -2875,7 +2875,7 @@ void VoiceTracker::DrawTrackMap(int trackno) p->drawText(5,14,d_loglines[1]->markerComment()); } else { - p->setBackgroundColor(Qt::gray); + p->setBackground(Qt::gray); p->eraseRect(0,0,d_wave_map[1]->size().width(), d_wave_map[1]->size().height()); } @@ -2890,7 +2890,7 @@ void VoiceTracker::DrawTrackMap(int trackno) } else { if((d_loglines[1]->transType()==RDLogLine::Segue)) { - back_color=backgroundColor(); + back_color=palette().color(QPalette::Background); } else { back_color=Qt::lightGray; @@ -2901,7 +2901,7 @@ void VoiceTracker::DrawTrackMap(int trackno) p=new QPainter(d_wave_map[1]); p->setPen(TRACKER_RECORD_COLOR); p->setBrush(TRACKER_RECORD_COLOR); - p->setBackgroundColor(back_color); + p->setBackground(back_color); p->eraseRect(0,0,d_wave_map[1]->size().width(), d_wave_map[1]->size().height()); p->fillRect(-d_wave_origin[1]/ @@ -2925,7 +2925,7 @@ void VoiceTracker::DrawTrackMap(int trackno) d_wpg[1]->begin(d_wave_map[1]); d_wpg[1]->setFont(labelFont()); d_wpg[1]->setPen(TRACKER_TEXT_COLOR); - d_wpg[1]->setBackgroundColor(back_color); + d_wpg[1]->setBackground(back_color); d_wpg[1]->eraseRect(0,0,d_wave_map[1]->size().width(), d_wave_map[1]->size().height()); if(!d_wave_name[1].isEmpty()) { @@ -3020,7 +3020,7 @@ void VoiceTracker::DrawTrackMap(int trackno) case 2: if(d_wave_name[2].isEmpty()) { p=new QPainter(d_wave_map[2]); - p->setBackgroundColor(Qt::gray); + p->setBackground(Qt::gray); p->eraseRect(0,0,d_wave_map[2]->size().width(), d_wave_map[2]->size().height()); p->end(); @@ -3028,14 +3028,14 @@ void VoiceTracker::DrawTrackMap(int trackno) } else { if((d_loglines[2]->transType()==RDLogLine::Segue)) { - back_color=backgroundColor(); + back_color=palette().color(QPalette::Background); } else { back_color=Qt::lightGray; } d_wpg[2]->begin(d_wave_map[2]); d_wpg[2]->setFont(labelFont()); - d_wpg[2]->setBackgroundColor(back_color); + d_wpg[2]->setBackground(back_color); d_wpg[2]->eraseRect(0,0,d_wave_map[2]->size().width(), d_wave_map[2]->size().height()); if(!d_wave_name[2].isEmpty()) { @@ -3662,8 +3662,8 @@ bool VoiceTracker::TrackAvailable() void VoiceTracker::LogLine(const QString &line) { fprintf(stderr,"%s: %s\n", - (const char *)QTime::currentTime().toString("hh:mm:ss.zzz"), - (const char *)line); + QTime::currentTime().toString("hh:mm:ss.zzz").toUtf8().constData(), + line.toUtf8().constData()); } @@ -3688,7 +3688,7 @@ bool VoiceTracker::InitTrack() d_track_cart=new RDCart(next_cart); d_track_cart->setOwner(d_log->name()); - d_track_cart->setTitle(d_loglines[1]->markerComment().stripWhiteSpace()); + d_track_cart->setTitle(d_loglines[1]->markerComment().trimmed()); if(d_track_cuts[1]!=NULL) { delete d_track_cuts[1]; } diff --git a/rdlogin/Makefile.am b/rdlogin/Makefile.am index c3ae57fe..117e8596 100644 --- a/rdlogin/Makefile.am +++ b/rdlogin/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2002-2020 Fred Gleason +## (C) Copyright 2002-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -44,7 +44,7 @@ dist_rdlogin_SOURCES = rdlogin.cpp rdlogin.h nodist_rdlogin_SOURCES = moc_rdlogin.cpp -rdlogin_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdlogin_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ EXTRA_DIST = rdlogin.pro\ rdlogin_cs.ts\ diff --git a/rdlogin/rdlogin.cpp b/rdlogin/rdlogin.cpp index 55a0ed59..39e0b4b9 100644 --- a/rdlogin/rdlogin.cpp +++ b/rdlogin/rdlogin.cpp @@ -18,11 +18,9 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include -#include -#include +#include +#include +#include #include #include @@ -108,9 +106,9 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) if(login_user_width>900) { login_user_width=900; } - login_username_label=new QLabel(login_username_box,tr("&Username:"),this); + login_username_label=new QLabel(tr("Username:"),this); login_username_label->setFont(labelFont()); - login_username_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + login_username_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); if(rda->system()->showUserList()) { login_username_edit->hide(); } @@ -124,9 +122,9 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) login_password_edit=new QLineEdit(this); login_password_edit->setMaxLength(RD_MAX_PASSWORD_LENGTH); login_password_edit->setEchoMode(QLineEdit::Password); - login_password_label=new QLabel(login_password_edit,tr("&Password:"),this); + login_password_label=new QLabel(tr("Password:"),this); login_password_label->setFont(labelFont()); - login_password_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + login_password_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(login_password_edit,SIGNAL(returnPressed()),this,SLOT(loginData())); // @@ -226,8 +224,8 @@ void MainWidget::logoutData() rda->ripc()->setUser(default_name); login_password_edit->clear(); for(int i=0;icount();i++) { - if(login_username_box->text(i)==default_name) { - login_username_box->setCurrentItem(i); + if(login_username_box->itemData(i).toString()==default_name) { + login_username_box->setCurrentIndex(i); qApp->processEvents(); cancelData(); return; @@ -272,25 +270,24 @@ int main(int argc,char *argv[]) // // Load Translations // - QTranslator qt(0); - qt.load(QString("/usr/share/qt4/translations/qt_")+QTextCodec::locale(), - "."); - a.installTranslator(&qt); + QString loc=RDApplication::locale(); + if(!loc.isEmpty()) { + QTranslator qt(0); + qt.load(QString("/usr/share/qt4/translations/qt_")+loc,"."); + a.installTranslator(&qt); - QTranslator rd(0); - rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+ - QTextCodec::locale(),"."); - a.installTranslator(&rd); + QTranslator rd(0); + rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+loc,"."); + a.installTranslator(&rd); - QTranslator rdhpi(0); - rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+ - QTextCodec::locale(),"."); - a.installTranslator(&rdhpi); + QTranslator rdhpi(0); + rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+loc,"."); + a.installTranslator(&rdhpi); - QTranslator tr(0); - tr.load(QString(PREFIX)+QString("/share/rivendell/rdlogin_")+ - QTextCodec::locale(),"."); - a.installTranslator(&tr); + QTranslator tr(0); + tr.load(QString(PREFIX)+QString("/share/rivendell/rdlogin_")+loc,"."); + a.installTranslator(&tr); + } // // Start Event Loop @@ -298,7 +295,6 @@ int main(int argc,char *argv[]) RDConfig *config=new RDConfig(); config->load(); MainWidget *w=new MainWidget(config); - a.setMainWidget(w); w->setGeometry(QRect(QPoint(0,0),w->sizeHint())); w->show(); return a.exec(); diff --git a/rdlogin/rdlogin.h b/rdlogin/rdlogin.h index babc00c7..c642a2cb 100644 --- a/rdlogin/rdlogin.h +++ b/rdlogin/rdlogin.h @@ -52,7 +52,7 @@ class MainWidget : public RDWidget void resizeEvent(QResizeEvent *e); private: - Q_UINT16 login_ripc_hostport; + uint16_t login_ripc_hostport; QLabel *login_label; QLabel *login_username_label; QComboBox *login_username_box; diff --git a/rdlogin/rdlogin_cs.ts b/rdlogin/rdlogin_cs.ts index c55fcee3..60a680de 100644 --- a/rdlogin/rdlogin_cs.ts +++ b/rdlogin/rdlogin_cs.ts @@ -21,11 +21,11 @@ &Username: - &Uživatelské jméno: + &Uživatelské jméno: &Password: - He&slo: + He&slo: &Set User @@ -69,5 +69,13 @@ uživatel Current User + + Username: + + + + Password: + + diff --git a/rdlogin/rdlogin_de.ts b/rdlogin/rdlogin_de.ts index 291c5a76..e567bf05 100644 --- a/rdlogin/rdlogin_de.ts +++ b/rdlogin/rdlogin_de.ts @@ -21,11 +21,11 @@ &Username: - Ben&utzername: + Ben&utzername: &Password: - &Paßwort: + &Paßwort: &Set User @@ -68,5 +68,13 @@ User Current User + + Username: + + + + Password: + + diff --git a/rdlogin/rdlogin_es.ts b/rdlogin/rdlogin_es.ts index 13f019de..bbc63862 100644 --- a/rdlogin/rdlogin_es.ts +++ b/rdlogin/rdlogin_es.ts @@ -43,11 +43,11 @@ User &Username: - &Usuario: + &Usuario: &Password: - &Contraseña: + &Contraseña: rdlogin : @@ -69,5 +69,13 @@ User Current User + + Username: + + + + Password: + + diff --git a/rdlogin/rdlogin_fr.ts b/rdlogin/rdlogin_fr.ts index 96a21c2f..cf5d7731 100644 --- a/rdlogin/rdlogin_fr.ts +++ b/rdlogin/rdlogin_fr.ts @@ -7,14 +7,6 @@ Current User: unknown - - &Username: - - - - &Password: - - &Set User @@ -48,5 +40,13 @@ User Current User + + Username: + + + + Password: + + diff --git a/rdlogin/rdlogin_nb.ts b/rdlogin/rdlogin_nb.ts index ffa98f70..a17b22bf 100644 --- a/rdlogin/rdlogin_nb.ts +++ b/rdlogin/rdlogin_nb.ts @@ -21,11 +21,11 @@ &Username: - Br&ukarnamn + Br&ukarnamn &Password: - &Passord: + &Passord: &Set User @@ -69,5 +69,13 @@ brukar Current User + + Username: + + + + Password: + + diff --git a/rdlogin/rdlogin_nn.ts b/rdlogin/rdlogin_nn.ts index ffa98f70..a17b22bf 100644 --- a/rdlogin/rdlogin_nn.ts +++ b/rdlogin/rdlogin_nn.ts @@ -21,11 +21,11 @@ &Username: - Br&ukarnamn + Br&ukarnamn &Password: - &Passord: + &Passord: &Set User @@ -69,5 +69,13 @@ brukar Current User + + Username: + + + + Password: + + diff --git a/rdlogin/rdlogin_pt_BR.ts b/rdlogin/rdlogin_pt_BR.ts index cf7827f2..9f1d6159 100644 --- a/rdlogin/rdlogin_pt_BR.ts +++ b/rdlogin/rdlogin_pt_BR.ts @@ -21,11 +21,11 @@ &Username: - &Usuário: + &Usuário: &Password: - &Senha: + &Senha: &Set User @@ -70,5 +70,13 @@ Padrão Current User + + Username: + + + + Password: + + diff --git a/rdlogmanager/Makefile.am b/rdlogmanager/Makefile.am index c4666d15..bb5692d6 100644 --- a/rdlogmanager/Makefile.am +++ b/rdlogmanager/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2002-2020 Fred Gleason +## (C) Copyright 2002-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -103,7 +103,7 @@ nodist_rdlogmanager_SOURCES = moc_add_clock.cpp\ moc_svc_rec_dialog.cpp\ moc_viewreportdialog.cpp -rdlogmanager_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdlogmanager_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ EXTRA_DIST = rdlogmanager.pro\ rdlogmanager_cs.ts\ diff --git a/rdlogmanager/add_clock.cpp b/rdlogmanager/add_clock.cpp index 3b25cb6c..1ee465bb 100644 --- a/rdlogmanager/add_clock.cpp +++ b/rdlogmanager/add_clock.cpp @@ -2,7 +2,7 @@ // // Add a Rivendell Clock // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,8 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - #include #include @@ -82,11 +80,10 @@ AddClock::AddClock(QString *logname,QWidget *parent) clock_name_edit->setGeometry(145,11,sizeHint().width()-155,19); clock_name_edit->setMaxLength(58); // MySQL limitation! clock_name_edit->setValidator(validator); - QLabel *clock_name_label= - new QLabel(clock_name_edit,tr("&New Clock Name:"),this); + QLabel *clock_name_label=new QLabel(tr("&New Clock Name:"),this); clock_name_label->setGeometry(10,11,130,19); clock_name_label->setFont(labelFont()); - clock_name_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + clock_name_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Ok Button diff --git a/rdlogmanager/add_event.cpp b/rdlogmanager/add_event.cpp index 4c314e0f..73d68a55 100644 --- a/rdlogmanager/add_event.cpp +++ b/rdlogmanager/add_event.cpp @@ -2,7 +2,7 @@ // // Add a Rivendell LogManager Event // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -78,11 +78,10 @@ AddEvent::AddEvent(QString *logname,QWidget *parent) event_name_edit->setGeometry(145,11,sizeHint().width()-155,19); event_name_edit->setMaxLength(58); // MySQL limitation! event_name_edit->setValidator(validator); - QLabel *event_name_label= - new QLabel(event_name_edit,tr("&New Event Name:"),this); + QLabel *event_name_label=new QLabel(tr("&New Event Name:"),this); event_name_label->setGeometry(10,11,130,19); event_name_label->setFont(labelFont()); - event_name_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); + event_name_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(event_name_edit,SIGNAL(textChanged(const QString &)), this,SLOT(nameChangedData(const QString &))); diff --git a/rdlogmanager/commandline_ops.cpp b/rdlogmanager/commandline_ops.cpp index c35cc994..ba9d9c00 100644 --- a/rdlogmanager/commandline_ops.cpp +++ b/rdlogmanager/commandline_ops.cpp @@ -18,10 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include -#include +#include #include #include @@ -68,15 +65,15 @@ int RunReportOperation(int argc,char *argv[],const QString &rptname, QDate yesterday=QDate::currentDate().addDays(-1); if(protect_existing&&report->outputExists(yesterday.addDays(start_offset))) { fprintf(stderr,"report \"%s\" for %s already exists\n", - (const char *)rptname.utf8(), - (const char *)yesterday.addDays(start_offset).toString()); + rptname.toUtf8().constData(), + yesterday.addDays(start_offset).toString().toUtf8().constData()); exit(RDApplication::ExitOutputProtected); } if(!report->generateReport(yesterday.addDays(start_offset), yesterday.addDays(end_offset),rda->station(), &out_path)) { fprintf(stderr,"rdlogmanager: report generation failed [%s]\n", - (const char *)RDReport::errorText(report->errorCode())); + RDReport::errorText(report->errorCode()).toUtf8().constData()); return RDApplication::ExitReportFailed; } return RDApplication::ExitOk; diff --git a/rdlogmanager/edit_clock.cpp b/rdlogmanager/edit_clock.cpp index 195feec6..50e035e8 100644 --- a/rdlogmanager/edit_clock.cpp +++ b/rdlogmanager/edit_clock.cpp @@ -67,7 +67,7 @@ EditClock::EditClock(QString clockname,bool new_clock, edit_shortname_edit=new QLineEdit(this); edit_shortname_edit->setGeometry(350,10,40,20); edit_shortname_edit->setMaxLength(3); - QLabel *label=new QLabel(edit_shortname_edit,tr("Code:"),this); + QLabel *label=new QLabel(tr("Code:"),this); label->setGeometry(295,10,50,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -136,8 +136,8 @@ EditClock::EditClock(QString clockname,bool new_clock, // edit_remarks_edit=new QTextEdit(this); edit_remarks_edit->setGeometry(10,sizeHint().height()-140,CENTER_LINE-20,130); - edit_remarks_edit->setTextFormat(Qt::PlainText); - label=new QLabel(edit_remarks_edit,tr("USER NOTES"),this); + edit_remarks_edit->setAcceptRichText(false); + label=new QLabel(tr("USER NOTES"),this); label->setGeometry(15,sizeHint().height()-155,CENTER_LINE-20,15); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -227,7 +227,7 @@ EditClock::EditClock(QString clockname,bool new_clock, edit_shortname_edit->setText(edit_clocks_model->shortName()); if(edit_clocks_model->color().isValid()) { edit_color_button-> - setPalette(QPalette(edit_clocks_model->color(),backgroundColor())); + setPalette(QPalette(edit_clocks_model->color(),palette().color(QPalette::Background))); } edit_remarks_edit->setText(edit_clocks_model->remarks()); edit_modified=false; @@ -486,7 +486,7 @@ void EditClock::saveAsData() } edit_clockname_label->setText(clockname); UpdateClock(); - setCaption("RDLogManager - "+tr("Edit Clock")+": "+edit_name); + setWindowTitle("RDLogManager - "+tr("Edit Clock")+": "+edit_name); } @@ -499,9 +499,9 @@ void EditClock::doubleClickedData(const QModelIndex &index) void EditClock::colorData() { QColor color= - QColorDialog::getColor(edit_color_button->backgroundColor(),this); + QColorDialog::getColor(edit_color_button->palette().color(QPalette::Background),this); if(color.isValid()) { - edit_color_button->setPalette(QPalette(color,backgroundColor())); + edit_color_button->setPalette(QPalette(color,palette().color(QPalette::Background))); } } @@ -576,9 +576,9 @@ void EditClock::closeEvent(QCloseEvent *e) void EditClock::Save() { - edit_clocks_model->setColor(edit_color_button->backgroundColor()); + edit_clocks_model->setColor(edit_color_button->palette().color(QPalette::Background)); edit_clocks_model->setShortName(edit_shortname_edit->text()); - edit_clocks_model->setRemarks(edit_remarks_edit->text()); + edit_clocks_model->setRemarks(edit_remarks_edit->toPlainText()); edit_clocks_model->save(); if(edit_clocks_model->getRulesModified()) { @@ -622,7 +622,7 @@ void EditClock::UpdateClock(int line) for(int i=0;isize();i++) { if(i==line) { p->setBrush(edit_clocks_view->palette(). - color(QPalette::Active,QColorGroup::Highlight)); + color(QPalette::Active,QPalette::Highlight)); p->drawPie(-size_x/2,-size_y/2,size_x,size_y, -QTime().secsTo(edit_clocks_model->eventLine(line)->startTime())*5760/3600, -(edit_clocks_model->eventLine(line)->length()/1000)*5760/3600); @@ -632,7 +632,7 @@ void EditClock::UpdateClock(int line) p->setBrush(edit_clocks_model->eventLine(i)->color()); } else { - p->setBrush(palette().color(QPalette::Active,QColorGroup::Base)); + p->setBrush(palette().color(QPalette::Active,QPalette::Base)); } p->drawPie(-size_x/2,-size_y/2,size_x,size_y, -QTime().secsTo(edit_clocks_model->eventLine(i)->startTime())*5760/3600, diff --git a/rdlogmanager/edit_event.cpp b/rdlogmanager/edit_event.cpp index ae4e43db..9290706b 100644 --- a/rdlogmanager/edit_event.cpp +++ b/rdlogmanager/edit_event.cpp @@ -18,9 +18,9 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include -#include +#include +#include +#include #include #include @@ -67,7 +67,7 @@ EditEvent::EditEvent(QString eventname,bool new_event, } connect(event_lib_filter_edit,SIGNAL(textChanged(const QString &)), this,SLOT(filterChangedData(const QString &))); - QLabel *label=new QLabel(event_lib_filter_edit,tr("Filter:"),this); + QLabel *label=new QLabel(tr("Filter:"),this); label->setFont(labelFont()); label->setGeometry(5,2,45,20); label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -89,7 +89,7 @@ EditEvent::EditEvent(QString eventname,bool new_event, event_group_box->setModel(event_group_model); connect(event_group_box,SIGNAL(activated(const QString &)), this,SLOT(filterActivatedData(const QString &))); - label=new QLabel(event_group_box,tr("Group:"),this); + label=new QLabel(tr("Group:"),this); label->setFont(labelFont()); label->setGeometry(5,25,45,20); label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -103,7 +103,7 @@ EditEvent::EditEvent(QString eventname,bool new_event, QRadioButton *rbutton=new QRadioButton(this); rbutton->setGeometry(55,55,15,15); event_lib_type_group->addButton(rbutton,0); - label=new QLabel(rbutton,tr("All"),this); + label=new QLabel(tr("All"),this); label->setFont(labelFont()); label->setGeometry(75,55,30,15); label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -112,7 +112,7 @@ EditEvent::EditEvent(QString eventname,bool new_event, rbutton=new QRadioButton(this); rbutton->setGeometry(125,55,15,15); event_lib_type_group->addButton(rbutton,1); - label=new QLabel(rbutton,tr("Audio Only"),this); + label=new QLabel(tr("Audio Only"),this); label->setFont(labelFont()); label->setGeometry(145,55,80,15); label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -120,7 +120,7 @@ EditEvent::EditEvent(QString eventname,bool new_event, rbutton=new QRadioButton(this); rbutton->setGeometry(235,55,15,15); event_lib_type_group->addButton(rbutton,2); - label=new QLabel(rbutton,tr("Macros Only"),this); + label=new QLabel(tr("Macros Only"),this); label->setFont(labelFont()); label->setGeometry(255,55,80,15); label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -183,8 +183,8 @@ EditEvent::EditEvent(QString eventname,bool new_event, event_remarks_edit=new QTextEdit(this); event_remarks_edit-> setGeometry(10,sizeHint().height()-150,CENTER_LINE-20,140); - event_remarks_edit->setTextFormat(Qt::PlainText); - label=new QLabel(event_remarks_edit,tr("USER NOTES"),this); + event_remarks_edit->setAcceptRichText(false); + label=new QLabel(tr("USER NOTES"),this); label->setFont(labelFont()); label->setGeometry(15,sizeHint().height()-165,100,15); label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -206,16 +206,14 @@ EditEvent::EditEvent(QString eventname,bool new_event, event_position_box->setGeometry(CENTER_LINE+15,19,15,22); connect(event_position_box,SIGNAL(toggled(bool)), this,SLOT(prepositionToggledData(bool))); - event_position_label= - new QLabel(event_position_box,tr("Cue to this event"),this); + event_position_label=new QLabel(tr("Cue to this event"),this); event_position_label->setFont(labelFont()); event_position_label->setGeometry(CENTER_LINE+35,18,150,22); event_position_label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); event_position_edit=new QTimeEdit(this); event_position_edit->setGeometry(CENTER_LINE+144,18,60,22); event_position_edit->setDisplayFormat("mm:ss"); - event_position_unit=new QLabel(event_position_box, - tr("before scheduled start. (First cart will have a STOP transition.)"), + event_position_unit=new QLabel(tr("before scheduled start. (First cart will have a STOP transition.)"), this); event_position_unit->setFont(labelFont()); event_position_unit->setGeometry(CENTER_LINE+212,18, @@ -235,8 +233,7 @@ EditEvent::EditEvent(QString eventname,bool new_event, // event_timetype_check=new QCheckBox(this); event_timetype_check->setGeometry(CENTER_LINE+15,70,15,15); - event_timetype_label= - new QLabel(event_timetype_check,tr("Use hard start time"),this); + event_timetype_label=new QLabel(tr("Use hard start time"),this); event_timetype_label->setGeometry(CENTER_LINE+35,69,120,16); event_timetype_label->setFont(labelFont()); event_timetype_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -294,9 +291,9 @@ EditEvent::EditEvent(QString eventname,bool new_event, event_firsttrans_box->setGeometry(event_firsttrans_label->geometry().x()+ event_firsttrans_label->geometry().width(), 134,90,20); - event_firsttrans_box->insertItem(tr("Play")); - event_firsttrans_box->insertItem(tr("Segue")); - event_firsttrans_box->insertItem(tr("Stop")); + event_firsttrans_box->insertItem(0,tr("Play")); + event_firsttrans_box->insertItem(1,tr("Segue")); + event_firsttrans_box->insertItem(2,tr("Stop")); event_firsttrans_unit=new QLabel("transition.",this); event_firsttrans_unit->setFont(labelFont()); event_firsttrans_unit-> @@ -321,9 +318,9 @@ EditEvent::EditEvent(QString eventname,bool new_event, event_defaulttrans_box-> setGeometry(event_defaulttrans_label->geometry().x()+ event_defaulttrans_label->geometry().width(),155,90,20); - event_defaulttrans_box->insertItem(tr("Play")); - event_defaulttrans_box->insertItem(tr("Segue")); - event_defaulttrans_box->insertItem(tr("Stop")); + event_defaulttrans_box->insertItem(0,tr("Play")); + event_defaulttrans_box->insertItem(1,tr("Segue")); + event_defaulttrans_box->insertItem(2,tr("Stop")); event_defaulttrans_unit=new QLabel(tr("transition."),this); event_defaulttrans_unit->setFont(labelFont()); event_defaulttrans_unit-> @@ -344,7 +341,7 @@ EditEvent::EditEvent(QString eventname,bool new_event, event_autofill_box->setGeometry(CENTER_LINE+15,207,15,15); connect(event_autofill_box,SIGNAL(toggled(bool)), this,SLOT(autofillToggledData(bool))); - label=new QLabel(event_autofill_box,tr("Use AutoFill"),this); + label=new QLabel(tr("Use AutoFill"),this); label->setFont(labelFont()); label->setGeometry(CENTER_LINE+35,207,150,15); label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -354,8 +351,7 @@ EditEvent::EditEvent(QString eventname,bool new_event, connect(event_autofill_slop_box,SIGNAL(toggled(bool)), this,SLOT(autofillWarnToggledData(bool))); event_autofill_slop_label1= - new QLabel(event_autofill_slop_box,tr("Warn if fill is over or under"), - this); + new QLabel(tr("Warn if fill is over or under"),this); event_autofill_slop_label1->setFont(labelFont()); event_autofill_slop_label1-> setGeometry(CENTER_LINE+230,207, @@ -365,8 +361,7 @@ EditEvent::EditEvent(QString eventname,bool new_event, event_autofill_slop_edit=new QTimeEdit(this); event_autofill_slop_edit->setDisplayFormat("mm:ss"); - event_autofill_slop_label= - new QLabel(event_autofill_slop_edit,tr("by at least")+" ",this); + event_autofill_slop_label=new QLabel(tr("by at least")+" ",this); event_autofill_slop_label-> setGeometry(event_autofill_slop_label1->geometry().x()+ event_autofill_slop_label1->geometry().width(),207, @@ -379,7 +374,7 @@ EditEvent::EditEvent(QString eventname,bool new_event, event_timescale_box=new QCheckBox(this); event_timescale_box->setGeometry(CENTER_LINE+250,207,15,15); - label=new QLabel(event_timescale_box,tr("Use Timescaling"),this); + label=new QLabel(tr("Use Timescaling"),this); label->setFont(labelFont()); label->setGeometry(CENTER_LINE+270,207,150,15); label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -406,7 +401,7 @@ EditEvent::EditEvent(QString eventname,bool new_event, event_preimport_length_edit=new QLineEdit(this); event_preimport_length_edit->setGeometry(sizeHint().width()-140,248,80,20); event_preimport_length_edit->setReadOnly(true); - label=new QLabel(event_preimport_length_edit,tr("Len:"),this); + label=new QLabel(tr("Len:"),this); label->setFont(labelFont()); label->setGeometry(sizeHint().width()-330,250,185,16); label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -457,7 +452,7 @@ EditEvent::EditEvent(QString eventname,bool new_event, rbutton=new QRadioButton(this); event_source_group->addButton(rbutton,RDEventLine::None); rbutton->setGeometry(CENTER_LINE+80,387,15,15); - label=new QLabel(rbutton,tr("None"),this); + label=new QLabel(tr("None"),this); label->setFont(labelFont()); label->setGeometry(CENTER_LINE+100,387,150,15); label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -465,7 +460,7 @@ EditEvent::EditEvent(QString eventname,bool new_event, rbutton=new QRadioButton(this); event_source_group->addButton(rbutton,RDEventLine::Traffic); rbutton->setGeometry(CENTER_LINE+160,387,15,15); - label=new QLabel(rbutton,tr("From Traffic"),this); + label=new QLabel(tr("From Traffic"),this); label->setFont(labelFont()); label->setGeometry(CENTER_LINE+180,387,150,15); label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -473,7 +468,7 @@ EditEvent::EditEvent(QString eventname,bool new_event, rbutton=new QRadioButton(this); rbutton->setGeometry(CENTER_LINE+280,387,15,15); event_source_group->addButton(rbutton,RDEventLine::Music); - label=new QLabel(rbutton,tr("From Music"),this); + label=new QLabel(tr("From Music"),this); label->setFont(labelFont()); label->setGeometry(CENTER_LINE+300,387,150,15); label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -481,7 +476,7 @@ EditEvent::EditEvent(QString eventname,bool new_event, rbutton=new QRadioButton(this); rbutton->setGeometry(CENTER_LINE+400,387,15,15); event_source_group->addButton(rbutton,RDEventLine::Scheduler); - label=new QLabel(rbutton,tr("Select from:"),this); + label=new QLabel(tr("Select from:"),this); label->setFont(labelFont()); label->setGeometry(CENTER_LINE+420,387,150,15); label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); @@ -489,7 +484,7 @@ EditEvent::EditEvent(QString eventname,bool new_event, // // Scheduler Group // - event_sched_group_box=new QComboBox(this); + event_sched_group_box=new RDComboBox(this); event_sched_group_box->setGeometry(CENTER_LINE+510,384,100,20); QString sql2="select NAME from GROUPS order by NAME"; RDSqlQuery *q2=new RDSqlQuery(sql2); @@ -508,8 +503,8 @@ EditEvent::EditEvent(QString eventname,bool new_event, event_artist_sep_spinbox=new QSpinBox(this); event_artist_sep_spinbox->setGeometry(CENTER_LINE+515,408,53,20); - event_artist_sep_spinbox->setMinValue( -1 ); - event_artist_sep_spinbox->setMaxValue( 50000 ); + event_artist_sep_spinbox->setMinimum( -1 ); + event_artist_sep_spinbox->setMaximum( 50000 ); event_artist_sep_spinbox->setSpecialValueText("None"); event_artist_none_button=new QPushButton(this); @@ -528,8 +523,8 @@ EditEvent::EditEvent(QString eventname,bool new_event, event_title_sep_spinbox=new QSpinBox(this); event_title_sep_spinbox->setGeometry(CENTER_LINE+515,429,53,20); - event_title_sep_spinbox->setMinValue( -1 ); - event_title_sep_spinbox->setMaxValue( 50000 ); + event_title_sep_spinbox->setMinimum( -1 ); + event_title_sep_spinbox->setMaximum( 50000 ); event_title_sep_spinbox->setSpecialValueText("None"); event_title_none_button=new QPushButton(this); @@ -546,7 +541,7 @@ EditEvent::EditEvent(QString eventname,bool new_event, event_have_code_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); event_have_code_label->setGeometry(CENTER_LINE+410,452,100,20); - event_have_code_box=new QComboBox(this); + event_have_code_box=new RDComboBox(this); event_have_code_box->setGeometry(CENTER_LINE+515,452,100,20); // @@ -557,14 +552,14 @@ EditEvent::EditEvent(QString eventname,bool new_event, event_have_code2_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); event_have_code2_label->setGeometry(CENTER_LINE+410,473,100,20); - event_have_code2_box=new QComboBox(this); + event_have_code2_box=new RDComboBox(this); event_have_code2_box->setGeometry(CENTER_LINE+515,473,100,20); // // Fill scheduler codes // - event_have_code_box->insertItem("[None]"); - event_have_code2_box->insertItem("[None]"); + event_have_code_box->insertItem(tr("[None]")); + event_have_code2_box->insertItem(tr("[None]")); sql2="select CODE from SCHED_CODES order by CODE"; q2=new RDSqlQuery(sql2); @@ -615,7 +610,7 @@ EditEvent::EditEvent(QString eventname,bool new_event, event_nestevent_label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); event_nestevent_box=new QComboBox(this); event_nestevent_box->setGeometry(CENTER_LINE+30,473,365,20); - event_nestevent_box->insertItem(tr("[none]")); + event_nestevent_box->insertItem(0,tr("[none]")); // // Post-Import Carts Section @@ -630,7 +625,7 @@ EditEvent::EditEvent(QString eventname,bool new_event, event_postimport_length_edit=new QLineEdit(this); event_postimport_length_edit->setGeometry(sizeHint().width()-140,503,80,20); event_postimport_length_edit->setReadOnly(true); - label=new QLabel(event_postimport_length_edit,tr("Len:"),this); + label=new QLabel(tr("Len:"),this); label->setFont(labelFont()); label->setGeometry(sizeHint().width()-330,505,185,16); label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); @@ -797,9 +792,9 @@ EditEvent::EditEvent(QString eventname,bool new_event, event_startslop_edit->setTime(QTime().addMSecs(event_event->startSlop())); event_endslop_edit->setTime(QTime().addMSecs(event_event->endSlop())); if(event_position_box->isChecked()||event_timetype_check->isChecked()) { - event_firsttrans_box->setCurrentItem(event_event->firstTransType()); + event_firsttrans_box->setCurrentIndex(event_event->firstTransType()); } - event_defaulttrans_box->setCurrentItem(event_event->defaultTransType()); + event_defaulttrans_box->setCurrentIndex(event_event->defaultTransType()); if(!event_event->schedGroup().isEmpty()) { event_sched_group_box->setCurrentText(event_event->schedGroup()); } @@ -813,7 +808,7 @@ EditEvent::EditEvent(QString eventname,bool new_event, } QColor color=event_event->color(); if(color.isValid()) { - event_color_button->setPalette(QPalette(color,backgroundColor())); + event_color_button->setPalette(QPalette(color,palette().color(QPalette::Background))); } QString str=event_event->nestedEvent(); sql=QString("select NAME from EVENTS where ")+ @@ -821,9 +816,10 @@ EditEvent::EditEvent(QString eventname,bool new_event, "order by NAME"; q=new RDSqlQuery(sql); while(q->next()) { - event_nestevent_box->insertItem(q->value(0).toString()); + event_nestevent_box->insertItem(event_nestevent_box->count(), + q->value(0).toString()); if(q->value(0).toString()==str) { - event_nestevent_box->setCurrentItem(event_nestevent_box->count()-1); + event_nestevent_box->setCurrentIndex(event_nestevent_box->count()-1); } } delete q; @@ -932,7 +928,7 @@ void EditEvent::prepositionToggledData(bool state) // TRANSITIONS Section // if(state) { - event_firsttrans_box->setCurrentItem(2); + event_firsttrans_box->setCurrentIndex(2); } event_firsttrans_box->setDisabled(state); event_firsttrans_label->setDisabled(state); @@ -1186,7 +1182,8 @@ void EditEvent::saveAsData() AbandonEvent(old_name); } str=QString(tr("Edit Event")); - setCaption("RDLogManager - "+tr("Edit Event")+" - "+event_event->name()); + setWindowTitle("RDLogManager - "+tr("Edit Event")+" - "+ + event_event->name()); } } @@ -1202,9 +1199,9 @@ void EditEvent::svcData() void EditEvent::colorData() { QColor color= - QColorDialog::getColor(event_color_button->backgroundColor(),this); + QColorDialog::getColor(event_color_button->palette().color(QPalette::Background),this); if(color.isValid()) { - event_color_button->setPalette(QPalette(color,backgroundColor())); + event_color_button->setPalette(QPalette(color,palette().color(QPalette::Background))); } } @@ -1270,7 +1267,7 @@ void EditEvent::Save() { QString properties; - event_event->setRemarks(event_remarks_edit->text()); + event_event->setRemarks(event_remarks_edit->toPlainText()); if(event_position_box->isChecked()) { event_event->setPreposition(QTime().msecsTo(event_position_edit->time())); } @@ -1280,7 +1277,7 @@ void EditEvent::Save() if(event_timetype_check->isChecked()) { event_event->setTimeType(RDLogLine::Hard); event_event->setFirstTransType((RDLogLine::TransType) - event_firsttrans_box->currentItem()); + event_firsttrans_box->currentIndex()); switch(event_grace_group->checkedId()) { case 0: event_event->setGraceTime(0); @@ -1317,13 +1314,13 @@ void EditEvent::Save() if(!event_timetype_check->isChecked()) { event_event-> setFirstTransType((RDLogLine::TransType)event_firsttrans_box-> - currentItem()); + currentIndex()); } event_event-> setDefaultTransType((RDLogLine::TransType)event_defaulttrans_box-> - currentItem()); - event_event->setColor(event_color_button->backgroundColor()); - if(event_nestevent_box->currentItem()==0) { + currentIndex()); + event_event->setColor(event_color_button->palette().color(QPalette::Background)); + if(event_nestevent_box->currentIndex()==0) { event_event->setNestedEvent(""); } else { @@ -1394,12 +1391,12 @@ QString EditEvent::GetProperties() return RDEventLine:: propertiesText(prepos_msec, - (RDLogLine::TransType)event_firsttrans_box->currentItem(), + (RDLogLine::TransType)event_firsttrans_box->currentIndex(), time_type, grace_msec, event_autofill_box->isChecked(), (RDEventLine::ImportSource)event_source_group->checkedId(), - event_nestevent_box->currentItem()>0); + event_nestevent_box->currentIndex()>0); } diff --git a/rdlogmanager/edit_event.h b/rdlogmanager/edit_event.h index bf70d631..bd0f6f74 100644 --- a/rdlogmanager/edit_event.h +++ b/rdlogmanager/edit_event.h @@ -24,7 +24,6 @@ #include #include -#include #include #include #include @@ -32,6 +31,7 @@ #include #include +#include #include #include #include @@ -103,16 +103,16 @@ class EditEvent : public RDDialog QButtonGroup *event_lib_type_group; QComboBox *event_group_box; RDGroupListModel *event_group_model; - QComboBox *event_sched_group_box; + RDComboBox *event_sched_group_box; QSpinBox* event_artist_sep_spinbox; QLabel *event_artist_sep_label; QPushButton *event_artist_none_button; QSpinBox* event_title_sep_spinbox; QLabel *event_title_sep_label; QPushButton *event_title_none_button; - QComboBox* event_have_code_box; + RDComboBox* event_have_code_box; QLabel *event_have_code_label; - QComboBox* event_have_code2_box; + RDComboBox* event_have_code2_box; QLabel *event_have_code2_label; LibraryTableView *event_lib_view; RDLibraryModel *event_lib_model; diff --git a/rdlogmanager/edit_eventline.cpp b/rdlogmanager/edit_eventline.cpp index bb8b1992..587cce36 100644 --- a/rdlogmanager/edit_eventline.cpp +++ b/rdlogmanager/edit_eventline.cpp @@ -18,8 +18,9 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include +#include +#include #include #include "edit_eventline.h" @@ -84,7 +85,7 @@ EditEventLine::EditEventLine(RDEventLine *eventline,RDClockModel *clock, edit_eventname_edit->setGeometry(65,12,sizeHint().width()-140,18); edit_eventname_edit->setMaxLength(64); edit_eventname_edit->setValidator(validator); - QLabel *label=new QLabel(edit_eventname_edit,tr("Event:"),this); + QLabel *label=new QLabel(tr("Event:"),this); label->setGeometry(10,12,50,18); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -105,7 +106,7 @@ EditEventLine::EditEventLine(RDEventLine *eventline,RDClockModel *clock, edit_starttime_edit->setGeometry(150,40,70,20); edit_starttime_edit-> setDisplay(RDTimeEdit::Minutes|RDTimeEdit::Seconds|RDTimeEdit::Tenths); - label=new QLabel(edit_starttime_edit,tr("Start Time:"),this); + label=new QLabel(tr("Start Time:"),this); label->setGeometry(65,42,80,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -117,7 +118,7 @@ EditEventLine::EditEventLine(RDEventLine *eventline,RDClockModel *clock, edit_endtime_edit->setGeometry(325,40,70,20); edit_endtime_edit-> setDisplay(RDTimeEdit::Minutes|RDTimeEdit::Seconds|RDTimeEdit::Tenths); - label=new QLabel(edit_endtime_edit,tr("End Time:"),this); + label=new QLabel(tr("End Time:"),this); label->setGeometry(250,42,70,20); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -185,8 +186,10 @@ void EditEventLine::okData() tr("The event end time cannot be earlier than the start time.")); return; } - QString sql=QString().sprintf("select NAME from EVENTS where NAME=\"%s\"", - (const char *)edit_eventname_edit->text()); + QString sql=QString("select ")+ + "NAME "+ + "from EVENTS where "+ + "NAME=\""+RDEscapeString(edit_eventname_edit->text())+"\""; RDSqlQuery *q=new RDSqlQuery(sql); if(!q->first()) { QMessageBox::information(this,tr("No Such Event"), diff --git a/rdlogmanager/edit_grid.cpp b/rdlogmanager/edit_grid.cpp index 4055c4d4..ad41877b 100644 --- a/rdlogmanager/edit_grid.cpp +++ b/rdlogmanager/edit_grid.cpp @@ -18,9 +18,9 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include -#include +#include +#include +#include #include @@ -270,7 +270,7 @@ void EditGrid::LoadButtons() void EditGrid::LabelButton(int dayofweek,int hour,QString clockname) { QString code=QString("---"); - QColor color=backgroundColor(); + QColor color=palette().color(QPalette::Background); QString sql=QString("select ")+ "SHORT_NAME,"+ // 00 @@ -287,7 +287,7 @@ void EditGrid::LabelButton(int dayofweek,int hour,QString clockname) edit_hour_button[dayofweek-1][hour]-> setText(QString().sprintf("%02d-%02d\n",hour,hour+1)+code); edit_hour_button[dayofweek-1][hour]-> - setPalette(QPalette(color,backgroundColor())); + setPalette(QPalette(color,palette().color(QPalette::Background))); } diff --git a/rdlogmanager/edit_note.cpp b/rdlogmanager/edit_note.cpp index 7d732976..e476ede8 100644 --- a/rdlogmanager/edit_note.cpp +++ b/rdlogmanager/edit_note.cpp @@ -2,7 +2,7 @@ // // Edit a Rivendell LogManager Note // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -71,7 +71,7 @@ QSizePolicy EditNote::sizePolicy() const void EditNote::okData() { - *edit_text=edit_text_edit->text(); + *edit_text=edit_text_edit->toPlainText(); done(true); } diff --git a/rdlogmanager/edit_schedcoderules.cpp b/rdlogmanager/edit_schedcoderules.cpp index 757b06b5..0ae0f0e5 100644 --- a/rdlogmanager/edit_schedcoderules.cpp +++ b/rdlogmanager/edit_schedcoderules.cpp @@ -41,47 +41,47 @@ EditSchedCodeRules::EditSchedCodeRules(QWidget* parent) edit_max_row_label=new QLabel(this); edit_max_row_label->setText(tr("Max. in a row:")); edit_max_row_label->setFont(labelFont()); - edit_max_row_label->setAlignment(int(Qt::AlignVCenter | Qt::AlignRight)); + edit_max_row_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); edit_min_wait_label=new QLabel(this); edit_min_wait_label->setText(tr("Min. wait:")); edit_min_wait_label->setFont(labelFont()); - edit_min_wait_label->setAlignment(int(Qt::AlignVCenter | Qt::AlignRight)); + edit_min_wait_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); edit_not_after_label=new QLabel(this); edit_not_after_label->setText(tr("Do not schedule after:")); edit_not_after_label->setFont(labelFont()); - edit_not_after_label->setAlignment(int(Qt::AlignVCenter | Qt::AlignRight)); + edit_not_after_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); edit_or_after_label=new QLabel(this); edit_or_after_label->setText(tr("Or after:")); edit_or_after_label->setFont(labelFont()); - edit_or_after_label->setAlignment(int(Qt::AlignVCenter | Qt::AlignRight)); + edit_or_after_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); edit_or_after_label_II=new QLabel(this); edit_or_after_label_II->setText(tr("Or after:")); edit_or_after_label_II->setFont(labelFont()); - edit_or_after_label_II->setAlignment(int(Qt::AlignVCenter | Qt::AlignRight)); + edit_or_after_label_II->setAlignment(Qt::AlignVCenter|Qt::AlignRight); edit_max_row_spin=new QSpinBox(this); - edit_max_row_spin->setMaxValue(999); - edit_max_row_spin->setLineStep(1); + edit_max_row_spin->setMaximum(999); + edit_max_row_spin->setSingleStep(1); edit_min_wait_spin=new QSpinBox(this); - edit_min_wait_spin->setMaxValue(999); - edit_max_row_spin->setLineStep(1); + edit_min_wait_spin->setMaximum(999); + edit_max_row_spin->setSingleStep(1); edit_schedcodes_model=new RDSchedCodeListModel(true,this); - edit_notafter_boxes[0]=new QComboBox(FALSE,this); - edit_notafter_boxes[0]->setDuplicatesEnabled(FALSE); + edit_notafter_boxes[0]=new RDComboBox(this); + edit_notafter_boxes[0]->setDuplicatesEnabled(false); edit_notafter_boxes[0]->setModel(edit_schedcodes_model); - edit_notafter_boxes[1]=new QComboBox(FALSE,this); - edit_notafter_boxes[1]->setDuplicatesEnabled(FALSE); + edit_notafter_boxes[1]=new RDComboBox(this); + edit_notafter_boxes[1]->setDuplicatesEnabled(false); edit_notafter_boxes[1]->setModel(edit_schedcodes_model); - edit_notafter_boxes[2]=new QComboBox(FALSE,this); - edit_notafter_boxes[2]->setDuplicatesEnabled(FALSE); + edit_notafter_boxes[2]=new RDComboBox(this); + edit_notafter_boxes[2]->setDuplicatesEnabled(false); edit_notafter_boxes[2]->setModel(edit_schedcodes_model); // diff --git a/rdlogmanager/edit_schedcoderules.h b/rdlogmanager/edit_schedcoderules.h index 9052745f..01a1e386 100644 --- a/rdlogmanager/edit_schedcoderules.h +++ b/rdlogmanager/edit_schedcoderules.h @@ -22,12 +22,12 @@ #ifndef EDIT_SCHEDCODERULES_H #define EDIT_SCHEDCODERULES_H -#include #include #include #include #include +#include #include #include #include @@ -62,7 +62,7 @@ class EditSchedCodeRules : public RDDialog QLabel *edit_or_after_label_II; QSpinBox *edit_max_row_spin; QSpinBox *edit_min_wait_spin; - QComboBox *edit_notafter_boxes[3]; + RDComboBox *edit_notafter_boxes[3]; RDSchedCodeListModel *edit_schedcodes_model; QLabel *edit_code_label; unsigned edit_rule_id; diff --git a/rdlogmanager/edit_schedrules.cpp b/rdlogmanager/edit_schedrules.cpp index 312b81f7..9d602024 100644 --- a/rdlogmanager/edit_schedrules.cpp +++ b/rdlogmanager/edit_schedrules.cpp @@ -90,8 +90,7 @@ EditSchedRules::EditSchedRules(QString clock,unsigned *artistsep, edit_schedcodes_view,SLOT(resizeColumnsToContents())); edit_schedcodes_view->resizeColumnsToContents(); - list_box_label= - new QLabel(edit_schedcodes_view,tr("Scheduler Codes:"),this); + list_box_label=new QLabel(tr("Scheduler Codes:"),this); list_box_label->setFont(labelFont()); edit_modified=false; } diff --git a/rdlogmanager/edit_track.cpp b/rdlogmanager/edit_track.cpp index 62e20d39..56f7acac 100644 --- a/rdlogmanager/edit_track.cpp +++ b/rdlogmanager/edit_track.cpp @@ -2,7 +2,7 @@ // // Edit a Rivendell LogManager Track // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -71,7 +71,7 @@ QSizePolicy EditTrack::sizePolicy() const void EditTrack::okData() { - *edit_text=edit_text_edit->text(); + *edit_text=edit_text_edit->toPlainText(); done(true); } diff --git a/rdlogmanager/generate_log.cpp b/rdlogmanager/generate_log.cpp index d5502202..1b06ae6e 100644 --- a/rdlogmanager/generate_log.cpp +++ b/rdlogmanager/generate_log.cpp @@ -2,7 +2,7 @@ // // Generate a Rivendell Log // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include +#include #include #include @@ -70,16 +70,16 @@ GenerateLog::GenerateLog(QWidget *parent,int cmd_switch,QString *cmd_service, // gen_progress_dialog= new QProgressDialog(tr("Generating Log..."),tr("Cancel"),0,24,this); - gen_progress_dialog->setCaption("Progress"); + gen_progress_dialog->setWindowTitle("Progress"); gen_progress_dialog->setCancelButton(NULL); // // Service Name // - gen_service_box=new QComboBox(this); + gen_service_box=new RDComboBox(this); connect(gen_service_box,SIGNAL(activated(int)), this,SLOT(serviceActivatedData(int))); - gen_service_label=new QLabel(gen_service_box,tr("Service:"),this); + gen_service_label=new QLabel(tr("Service:"),this); gen_service_label->setFont(labelFont()); gen_service_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -102,7 +102,7 @@ GenerateLog::GenerateLog(QWidget *parent,int cmd_switch,QString *cmd_service, // gen_date_edit=new QDateEdit(this); gen_date_edit->setDisplayFormat("MM/dd/yyyy"); - gen_date_label=new QLabel(gen_date_edit,tr("Date:"),this); + gen_date_label=new QLabel(tr("Date:"),this); gen_date_label->setFont(labelFont()); gen_date_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); if (cmdswitch==0) diff --git a/rdlogmanager/generate_log.h b/rdlogmanager/generate_log.h index 62762ec4..866431d8 100644 --- a/rdlogmanager/generate_log.h +++ b/rdlogmanager/generate_log.h @@ -2,7 +2,7 @@ // // Generate a Rivendell Log // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -22,10 +22,10 @@ #define GENERATE_LOG_H -#include -#include -#include +#include +#include +#include #include #include @@ -56,7 +56,7 @@ class GenerateLog : public RDDialog void UpdateControls(); void SendNotification(RDNotification::Action action,const QString &logname); QLabel *gen_service_label; - QComboBox *gen_service_box; + RDComboBox *gen_service_box; QLabel *gen_date_label; QDateEdit *gen_date_edit; QPushButton *gen_select_button; diff --git a/rdlogmanager/importcartsview.cpp b/rdlogmanager/importcartsview.cpp index bf5bd4ad..cb3f3dd4 100644 --- a/rdlogmanager/importcartsview.cpp +++ b/rdlogmanager/importcartsview.cpp @@ -215,7 +215,9 @@ void ImportCartsView::setSegueData() void ImportCartsView::dragEnterEvent(QDragEnterEvent *e) { - e->accept(RDCartDrag::canDecode(e)); + if(RDCartDrag::canDecode(e)) { + e->accept(); + } } diff --git a/rdlogmanager/list_clocks.cpp b/rdlogmanager/list_clocks.cpp index 136731aa..f141fe7b 100644 --- a/rdlogmanager/list_clocks.cpp +++ b/rdlogmanager/list_clocks.cpp @@ -45,7 +45,7 @@ ListClocks::ListClocks(QString *clockname,QWidget *parent) // Event Filter // edit_filter_box=new QComboBox(this); - edit_filter_label=new QLabel(edit_filter_box,tr("Filter:"),this); + edit_filter_label=new QLabel(tr("Filter:"),this); edit_filter_label->setFont(labelFont()); edit_filter_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); connect(edit_filter_box,SIGNAL(activated(int)), @@ -147,8 +147,8 @@ ListClocks::ListClocks(QString *clockname,QWidget *parent) // // Populate Data // - edit_filter_box->insertItem(tr("ALL")); - edit_filter_box->insertItem(tr("NONE")); + edit_filter_box->insertItem(0,tr("ALL")); + edit_filter_box->insertItem(1,tr("NONE")); QString sql="select NAME from SERVICES"; RDSqlQuery *q=new RDSqlQuery(sql); @@ -160,9 +160,9 @@ ListClocks::ListClocks(QString *clockname,QWidget *parent) for ( QStringList::Iterator it = services_list.begin(); it != services_list.end(); ++it ) { - edit_filter_box->insertItem(*it); + edit_filter_box->insertItem(edit_filter_box->count(),*it); if(*clock_filter==*it) { - edit_filter_box->setCurrentItem(edit_filter_box->count()-1); + edit_filter_box->setCurrentIndex(edit_filter_box->count()-1); } } if(edit_clockname!=NULL) { @@ -246,7 +246,7 @@ void ListClocks::addData() RDSqlQuery::apply(sql); } else { - if(edit_filter_box->currentItem()==0) { + if(edit_filter_box->currentIndex()==0) { // // Create default clock permissions // diff --git a/rdlogmanager/list_events.cpp b/rdlogmanager/list_events.cpp index 1b0473b7..97236fc9 100644 --- a/rdlogmanager/list_events.cpp +++ b/rdlogmanager/list_events.cpp @@ -46,7 +46,7 @@ ListEvents::ListEvents(QString *eventname,QWidget *parent) // Event Filter // edit_filter_box=new QComboBox(this); - edit_filter_label=new QLabel(edit_filter_box,tr("Filter:"),this); + edit_filter_label=new QLabel(tr("Filter:"),this); edit_filter_label->setGeometry(10,10,50,20); edit_filter_label->setFont(labelFont()); edit_filter_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -140,8 +140,8 @@ ListEvents::ListEvents(QString *eventname,QWidget *parent) // // Populate Data // - edit_filter_box->insertItem(tr("ALL")); - edit_filter_box->insertItem(tr("NONE")); + edit_filter_box->insertItem(0,tr("ALL")); + edit_filter_box->insertItem(1,tr("NONE")); QString sql="select NAME from SERVICES"; RDSqlQuery *q=new RDSqlQuery(sql); @@ -153,9 +153,9 @@ ListEvents::ListEvents(QString *eventname,QWidget *parent) for ( QStringList::Iterator it = services_list.begin(); it != services_list.end(); ++it ) { - edit_filter_box->insertItem(*it); + edit_filter_box->insertItem(edit_filter_box->count(),*it); if(*event_filter==*it) { - edit_filter_box->setCurrentItem(edit_filter_box->count()-1); + edit_filter_box->setCurrentIndex(edit_filter_box->count()-1); } } } @@ -187,8 +187,10 @@ void ListEvents::addData() return; } delete add_dialog; - QString sql=QString().sprintf("select NAME from EVENTS where NAME=\"%s\"", - (const char *)logname); + QString sql=QString("select ")+ + "NAME "+ + "from EVENTS where "+ + "NAME=\""+RDEscapeString(logname)+"\""; q=new RDSqlQuery(sql); if(q->first()) { QMessageBox:: @@ -202,14 +204,14 @@ void ListEvents::addData() delete event; EditEvent *event_dialog=new EditEvent(logname,true,&new_events,this); if(event_dialog->exec()<-1) { - sql=QString().sprintf("delete from EVENTS where NAME=\"%s\"", - (const char *)logname); + sql=QString("delete from EVENTS where ")+ + "NAME=\""+RDEscapeString(logname)+"\""; q=new RDSqlQuery(sql); delete q; return; } else { - if(edit_filter_box->currentItem()==0) { + if(edit_filter_box->currentIndex()==0) { sql=QString(" select ")+ "ID "+ // 00 "from EVENT_PERMS where "+ @@ -443,13 +445,16 @@ int ListEvents::ActiveEvents(QString event_name,QString *clock_list) sql="select NAME from CLOCKS"; q=new RDSqlQuery(sql); while(q->next()) { - sql=QString("select EVENT_NAME from CLOCK_LINES where ")+ + sql=QString("select ")+ + "EVENT_NAME "+ + "from CLOCK_LINES where "+ "CLOCK_NAME=\""+RDEscapeString(q->value(0).toString())+"\" && "+ "EVENT_NAME=\""+RDEscapeString(event_name)+"\""; q1=new RDSqlQuery(sql); if(q1->first()) { *clock_list+= - QString().sprintf(" %s\n",(const char *)q->value(0).toString()); + QString().sprintf(" %s\n", + q->value(0).toString().toUtf8().constData()); n++; } delete q1; @@ -483,16 +488,16 @@ void ListEvents::DeleteEvent(QString event_name) // // Delete Service Associations // - sql=QString().sprintf("delete from EVENT_PERMS where EVENT_NAME=\"%s\"", - (const char *)event_name); + sql=QString("delete from EVENT_PERMS where ")+ + "EVENT_NAME=\""+RDEscapeString(event_name)+"\""; q=new RDSqlQuery(sql); delete q; // // Delete Event Definition // - sql=QString().sprintf("delete from EVENTS where NAME=\"%s\"", - (const char *)event_name); + sql=QString("delete from EVENTS where ")+ + "NAME=\""+RDEscapeString(event_name)+"\""; RDSqlQuery::apply(sql); sql=QString("delete from EVENT_LINES where ")+ "EVENT_NAME=\""+RDEscapeString(event_name)+"\""; @@ -509,7 +514,7 @@ QString ListEvents::GetEventFilter(QString svc_name) if(q->size()>0) { while(q->next()) { filter+=QString().sprintf("(NAME=\"%s\")||", - (const char *)q->value(0).toString()); + q->value(0).toString().toUtf8().constData()); } filter=filter.left(filter.length()-2); } @@ -535,7 +540,7 @@ QString ListEvents::GetNoneFilter() } while(q->next()) { filter+=QString().sprintf("(NAME!=\"%s\")&&", - (const char *)q->value(0).toString()); + RDEscapeString(q->value(0).toString()).toUtf8().constData()); } if(q->size()>0) { filter=filter.left(filter.length()-2); diff --git a/rdlogmanager/logobject.cpp b/rdlogmanager/logobject.cpp index 687579ca..2c6bb296 100644 --- a/rdlogmanager/logobject.cpp +++ b/rdlogmanager/logobject.cpp @@ -2,7 +2,7 @@ // // Generate/merge logs from the command line. // -// (C) Copyright 2018-2020 Fred Gleason +// (C) Copyright 2018-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,9 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include +#include #include #include @@ -87,7 +85,7 @@ void LogObject::userData() if(log_generate_log) { if(log_protect_existing&&log->exists()) { fprintf(stderr,"log \"%s\" already exists\n", - log->name().utf8().constData()); + log->name().toUtf8().constData()); exit(RDApplication::ExitOutputProtected); } SendNotification(RDNotification::DeleteAction,log->name()); @@ -113,7 +111,8 @@ void LogObject::userData() model->load(); if((model->validate(&report,start_date)!=0)|| (!unused_report.isEmpty())) { - printf("%s\n\n%s",(const char*)report,(const char*)unused_report); + printf("%s\n\n%s",report.toUtf8().constData(), + unused_report.toUtf8().constData()); } delete model; } @@ -130,14 +129,14 @@ void LogObject::userData() (log->linkState(RDLog::SourceMusic)==RDLog::LinkDone)) { fprintf(stderr, "rdlogmanager: music for log \"%s\" is already imported\n", - log->name().utf8().constData()); + log->name().toUtf8().constData()); exit(RDApplication::ExitLogLinkFailed); } if((!log->includeImportMarkers())&& (log->linkState(RDLog::SourceMusic)!=RDLog::LinkMissing)) { fprintf(stderr, "rdlogmanager: music for log \"%s\" cannot be reimported\n", - log->name().utf8().constData()); + log->name().toUtf8().constData()); exit(RDApplication::ExitLogLinkFailed); } report=""; @@ -154,7 +153,7 @@ void LogObject::userData() } if(svc->linkLog(RDSvc::Music,start_date,logname,&report,rda->user(), &err_msg)) { - printf("%s\n",(const char*)report); + printf("%s\n",report.toUtf8().constData()); } else { fprintf(stderr,"rdlogmanager: music import failed\n"); @@ -176,14 +175,14 @@ void LogObject::userData() (log->linkState(RDLog::SourceTraffic)==RDLog::LinkDone)) { fprintf(stderr, "rdlogmanager: traffic for log \"%s\" is already imported\n", - (const char *)log->name().utf8()); + (const char *)log->name().toUtf8()); exit(RDApplication::ExitLogLinkFailed); } if((!log->includeImportMarkers())&& (log->linkState(RDLog::SourceTraffic)!=RDLog::LinkMissing)) { fprintf(stderr, "rdlogmanager: traffic for log \"%s\" cannot be reimported\n", - log->name().utf8().constData()); + log->name().toUtf8().constData()); exit(RDApplication::ExitLogLinkFailed); } report=""; diff --git a/rdlogmanager/pick_report_dates.cpp b/rdlogmanager/pick_report_dates.cpp index 9f1465fe..602c76f4 100644 --- a/rdlogmanager/pick_report_dates.cpp +++ b/rdlogmanager/pick_report_dates.cpp @@ -2,7 +2,7 @@ // // Select a Set of Dates for a Rivendell Report // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,9 +18,8 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include -#include +#include +#include #include #include @@ -56,7 +55,7 @@ PickReportDates::PickReportDates(const QString &svcname,QWidget *parent) // edit_report_box=new QComboBox(this); edit_report_box->setGeometry(75,11,sizeHint().width()-85,19); - QLabel *label=new QLabel(edit_report_box,tr("&Report:"),this); + QLabel *label=new QLabel(tr("&Report:"),this); label->setGeometry(10,11,60,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -65,7 +64,8 @@ PickReportDates::PickReportDates(const QString &svcname,QWidget *parent) "order by REPORT_NAME"; q=new RDSqlQuery(sql); while(q->next()) { - edit_report_box->insertItem(q->value(0).toString()); + edit_report_box-> + insertItem(edit_report_box->count(),q->value(0).toString()); } delete q; @@ -76,7 +76,7 @@ PickReportDates::PickReportDates(const QString &svcname,QWidget *parent) edit_startdate_edit->setGeometry(150,35,100,22); edit_startdate_edit->setDisplayFormat("MM/dd/yyyy"); edit_startdate_edit->setDate(yesterday_date); - label=new QLabel(edit_startdate_edit,tr("&Start Date:"),this); + label=new QLabel(tr("&Start Date:"),this); label->setGeometry(75,36,70,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -93,7 +93,7 @@ PickReportDates::PickReportDates(const QString &svcname,QWidget *parent) edit_enddate_edit->setGeometry(150,65,100,22); edit_enddate_edit->setDisplayFormat("MM/dd/yyyy"); edit_enddate_edit->setDate(yesterday_date); - label=new QLabel(edit_enddate_edit,tr("&End Date:"),this); + label=new QLabel(tr("&End Date:"),this); label->setGeometry(75,66,70,19); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); diff --git a/rdlogmanager/rdlogmanager.cpp b/rdlogmanager/rdlogmanager.cpp index eaeb8717..b276facd 100644 --- a/rdlogmanager/rdlogmanager.cpp +++ b/rdlogmanager/rdlogmanager.cpp @@ -18,9 +18,9 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include -#include +#include +#include +#include #include "generate_log.h" #include "globals.h" @@ -233,24 +233,27 @@ int gui_main(int argc,char *argv[]) // QString tr_path; QString qt_path; - tr_path=QString(PREFIX)+QString("/share/rivendell/"); - qt_path=QString("/usr/share/qt4/translation/"); + QString loc=RDApplication::locale(); + if(!loc.isEmpty()) { + tr_path=QString(PREFIX)+QString("/share/rivendell/"); + qt_path=QString("/usr/share/qt4/translation/"); - QTranslator qt(0); - qt.load(qt_path+QString("qt_")+QTextCodec::locale(),"."); - a.installTranslator(&qt); + QTranslator qt(0); + qt.load(qt_path+QString("qt_")+loc,"."); + a.installTranslator(&qt); - QTranslator rd(0); - rd.load(tr_path+QString("librd_")+QTextCodec::locale(),"."); - a.installTranslator(&rd); + QTranslator rd(0); + rd.load(tr_path+QString("librd_")+loc,"."); + a.installTranslator(&rd); - QTranslator rdhpi(0); - rdhpi.load(tr_path+QString("librdhpi_")+QTextCodec::locale(),"."); - a.installTranslator(&rdhpi); + QTranslator rdhpi(0); + rdhpi.load(tr_path+QString("librdhpi_")+loc,"."); + a.installTranslator(&rdhpi); - QTranslator tr(0); - tr.load(tr_path+QString("rdlogmanager_")+QTextCodec::locale(),"."); - a.installTranslator(&tr); + QTranslator tr(0); + tr.load(tr_path+QString("rdlogmanager_")+loc,"."); + a.installTranslator(&tr); + } // // Start Event Loop @@ -258,7 +261,6 @@ int gui_main(int argc,char *argv[]) RDConfig *config=new RDConfig(); config->load(); MainWidget *w=new MainWidget(config); - a.setMainWidget(w); w->setGeometry(QRect(QPoint(w->geometry().x(),w->geometry().y()), w->sizeHint())); w->show(); @@ -349,7 +351,7 @@ int main(int argc,char *argv[]) } if(!cmd->processed(i)) { fprintf(stderr,"rdlogmanager: unknown command option \"%s\"\n", - (const char *)cmd->key(i)); + cmd->key(i).toUtf8().constData()); exit(RDApplication::ExitInvalidOption); } } diff --git a/rdlogmanager/rdlogmanager_cs.ts b/rdlogmanager/rdlogmanager_cs.ts index 99c1c1c0..8fc8fab8 100644 --- a/rdlogmanager/rdlogmanager_cs.ts +++ b/rdlogmanager/rdlogmanager_cs.ts @@ -606,6 +606,10 @@ Chcete ji přepsat? USER NOTES + + [None] + + EditEventLine diff --git a/rdlogmanager/rdlogmanager_de.ts b/rdlogmanager/rdlogmanager_de.ts index 9ae8a2de..ae5f684f 100644 --- a/rdlogmanager/rdlogmanager_de.ts +++ b/rdlogmanager/rdlogmanager_de.ts @@ -606,6 +606,10 @@ Wollen Sie es überschreiben? USER NOTES + + [None] + + EditEventLine diff --git a/rdlogmanager/rdlogmanager_es.ts b/rdlogmanager/rdlogmanager_es.ts index 527ca8dc..d8daa5b3 100644 --- a/rdlogmanager/rdlogmanager_es.ts +++ b/rdlogmanager/rdlogmanager_es.ts @@ -608,6 +608,10 @@ Do you want to overwrite it? USER NOTES + + [None] + + EditEventLine diff --git a/rdlogmanager/rdlogmanager_fr.ts b/rdlogmanager/rdlogmanager_fr.ts index 77c7f5f1..282f125f 100644 --- a/rdlogmanager/rdlogmanager_fr.ts +++ b/rdlogmanager/rdlogmanager_fr.ts @@ -416,6 +416,10 @@ Do you want to overwrite it? USER NOTES + + [None] + + EditEventLine diff --git a/rdlogmanager/rdlogmanager_nb.ts b/rdlogmanager/rdlogmanager_nb.ts index 64cbbe1f..d6fd768f 100644 --- a/rdlogmanager/rdlogmanager_nb.ts +++ b/rdlogmanager/rdlogmanager_nb.ts @@ -607,6 +607,10 @@ Vil du byta henne ut? USER NOTES + + [None] + + EditEventLine diff --git a/rdlogmanager/rdlogmanager_nn.ts b/rdlogmanager/rdlogmanager_nn.ts index 64cbbe1f..d6fd768f 100644 --- a/rdlogmanager/rdlogmanager_nn.ts +++ b/rdlogmanager/rdlogmanager_nn.ts @@ -607,6 +607,10 @@ Vil du byta henne ut? USER NOTES + + [None] + + EditEventLine diff --git a/rdlogmanager/rdlogmanager_pt_BR.ts b/rdlogmanager/rdlogmanager_pt_BR.ts index 78f97005..4049dfaf 100644 --- a/rdlogmanager/rdlogmanager_pt_BR.ts +++ b/rdlogmanager/rdlogmanager_pt_BR.ts @@ -608,6 +608,10 @@ Você quer sobreescrêve-lo? USER NOTES + + [None] + + EditEventLine diff --git a/rdlogmanager/rename_item.cpp b/rdlogmanager/rename_item.cpp index 1acdfd95..5512d12c 100644 --- a/rdlogmanager/rename_item.cpp +++ b/rdlogmanager/rename_item.cpp @@ -2,7 +2,7 @@ // // Edit a Rivendell LogManager Note // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,8 +18,9 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include +#include +#include #include #include "rename_item.h" @@ -115,9 +116,10 @@ void RenameItem::okData() done(-1); return; } - QString sql=QString().sprintf("select NAME from %s where NAME=\"%s\"", - (const char *)edit_tablename, - (const char *)edit_name_edit->text()); + QString sql=QString("select ")+ + "NAME "+ + "from "+edit_tablename+" where "+ + "NAME=\""+RDEscapeString(edit_name_edit->text())+"\""; RDSqlQuery *q=new RDSqlQuery(sql); if(q->next()) { delete q; diff --git a/rdlogmanager/svc_rec.cpp b/rdlogmanager/svc_rec.cpp index 5d836079..2dc1d716 100644 --- a/rdlogmanager/svc_rec.cpp +++ b/rdlogmanager/svc_rec.cpp @@ -2,7 +2,7 @@ // // Calendar widget. // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -61,7 +61,7 @@ SvcRec::SvcRec(const QString &svcname,QWidget *parent) pick_month_box=new QComboBox(this); pick_month_box->setGeometry(0,0,120,26); for(int i=1;i<13;i++) { - pick_month_box->insertItem(QDate::longMonthName(i)); + pick_month_box->insertItem(pick_month_box->count(),QDate::longMonthName(i)); } connect(pick_month_box,SIGNAL(activated(int)), this,SLOT(monthActivatedData(int))); @@ -72,7 +72,8 @@ SvcRec::SvcRec(const QString &svcname,QWidget *parent) pick_year_box=new QComboBox(this); pick_year_box->setGeometry(130,0,90,26); for(int i=pick_low_year;i<(pick_high_year+1);i++) { - pick_year_box->insertItem(QString().sprintf("%04d",i)); + pick_year_box-> + insertItem(pick_year_box->count(),QString().sprintf("%04d",i)); } connect(pick_year_box,SIGNAL(activated(int)), this,SLOT(yearActivatedData(int))); @@ -82,12 +83,12 @@ SvcRec::SvcRec(const QString &svcname,QWidget *parent) // Date Labels // QPalette weekend_palette=palette(); - weekend_palette.setColor(QPalette::Active,QColorGroup::Background, + weekend_palette.setColor(QPalette::Active,QPalette::Background, palette().color(QPalette::Active, - QColorGroup::Mid)); - weekend_palette.setColor(QPalette::Inactive,QColorGroup::Background, + QPalette::Mid)); + weekend_palette.setColor(QPalette::Inactive,QPalette::Background, palette().color(QPalette::Active, - QColorGroup::Mid)); + QPalette::Mid)); QLabel *label=new QLabel(tr("Mo"),this); label->setGeometry(SVC_REC_X_ORIGIN,30,30,30); @@ -185,9 +186,9 @@ bool SvcRec::setDate(QDate date) return false; } pick_date=date; - pick_month_box->setCurrentItem(date.month()-1); + pick_month_box->setCurrentIndex(date.month()-1); if(pick_year_box!=NULL) { - pick_year_box->setCurrentItem(date.year()-pick_low_year); + pick_year_box->setCurrentIndex(date.year()-pick_low_year); } else { pick_year_spin->setValue(date.year()); @@ -236,14 +237,14 @@ void SvcRec::monthActivatedData(int id) void SvcRec::yearActivatedData(int id) { - QDate date=QDate(pick_low_year+pick_year_box->currentItem(), + QDate date=QDate(pick_low_year+pick_year_box->currentIndex(), pick_date.month(),1); if(pick_date.day()<=date.daysInMonth()) { - pick_date=QDate(pick_low_year+pick_year_box->currentItem(), + pick_date=QDate(pick_low_year+pick_year_box->currentIndex(), pick_date.month(),pick_date.day()); } else { - pick_date=QDate(pick_low_year+pick_year_box->currentItem(), + pick_date=QDate(pick_low_year+pick_year_box->currentIndex(), pick_date.month(),date.daysInMonth()); } GetActiveDays(pick_date); @@ -299,12 +300,12 @@ void SvcRec::PrintDays() // Clear Days // QPalette weekend_palette=palette(); - weekend_palette.setColor(QPalette::Active,QColorGroup::Background, + weekend_palette.setColor(QPalette::Active,QPalette::Background, palette().color(QPalette::Active, - QColorGroup::Mid)); - weekend_palette.setColor(QPalette::Inactive,QColorGroup::Background, + QPalette::Mid)); + weekend_palette.setColor(QPalette::Inactive,QPalette::Background, palette().color(QPalette::Active, - QColorGroup::Mid)); + QPalette::Mid)); for(int i=0;i<6;i++) { for(int j=0;j<5;j++) { pick_date_label[i][j]->clear(); @@ -322,11 +323,11 @@ void SvcRec::PrintDays() // Get Top of Month // if(pick_year_box!=NULL) { - top_date=QDate(pick_low_year+pick_year_box->currentItem(), - pick_month_box->currentItem()+1,1); + top_date=QDate(pick_low_year+pick_year_box->currentIndex(), + pick_month_box->currentIndex()+1,1); } else { - top_date=QDate(pick_year_spin->value(),pick_month_box->currentItem()+1,1); + top_date=QDate(pick_year_spin->value(),pick_month_box->currentIndex()+1,1); } // @@ -364,26 +365,26 @@ void SvcRec::SelectDay(int day,int dow_offset,bool state) int dow=slot-7*week; QPalette pal=palette(); if(state) { - pal.setColor(QPalette::Active,QColorGroup::Foreground, + pal.setColor(QPalette::Active,QPalette::Foreground, palette(). - color(QPalette::Active,QColorGroup::HighlightedText)); - pal.setColor(QPalette::Active,QColorGroup::Background, - palette().color(QPalette::Active,QColorGroup::Highlight)); - pal.setColor(QPalette::Inactive,QColorGroup::Foreground, + color(QPalette::Active,QPalette::HighlightedText)); + pal.setColor(QPalette::Active,QPalette::Background, + palette().color(QPalette::Active,QPalette::Highlight)); + pal.setColor(QPalette::Inactive,QPalette::Foreground, palette(). - color(QPalette::Active,QColorGroup::HighlightedText)); - pal.setColor(QPalette::Inactive,QColorGroup::Background, - palette().color(QPalette::Active,QColorGroup::Highlight)); + color(QPalette::Active,QPalette::HighlightedText)); + pal.setColor(QPalette::Inactive,QPalette::Background, + palette().color(QPalette::Active,QPalette::Highlight)); } else { - pal.setColor(QPalette::Active,QColorGroup::Foreground, - palette().color(QPalette::Active,QColorGroup::Text)); - pal.setColor(QPalette::Active,QColorGroup::Background, - palette().color(QPalette::Active,QColorGroup::Background)); - pal.setColor(QPalette::Inactive,QColorGroup::Foreground, - palette().color(QPalette::Active,QColorGroup::Text)); - pal.setColor(QPalette::Inactive,QColorGroup::Background, - palette().color(QPalette::Active,QColorGroup::Background)); + pal.setColor(QPalette::Active,QPalette::Foreground, + palette().color(QPalette::Active,QPalette::Text)); + pal.setColor(QPalette::Active,QPalette::Background, + palette().color(QPalette::Active,QPalette::Background)); + pal.setColor(QPalette::Inactive,QPalette::Foreground, + palette().color(QPalette::Active,QPalette::Text)); + pal.setColor(QPalette::Inactive,QPalette::Background, + palette().color(QPalette::Active,QPalette::Background)); } pick_date_label[week][dow]->setPalette(pal); } diff --git a/rdlogmanager/svc_rec_dialog.cpp b/rdlogmanager/svc_rec_dialog.cpp index 23cd3016..040f82e6 100644 --- a/rdlogmanager/svc_rec_dialog.cpp +++ b/rdlogmanager/svc_rec_dialog.cpp @@ -2,7 +2,7 @@ // // A Services/Reports Management Dialog. // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,18 +18,8 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include #include #include @@ -108,10 +98,11 @@ void SvcRecDialog::dateSelectedData(const QDate &,bool active) void SvcRecDialog::deleteData() { if(QMessageBox::question(this,tr("Delete Report Data"), - QString().sprintf("%s %s?", - (const char *)tr("Are you sure you want to delete report data for"), - (const char *)date_picker->date().toString("MM/dd/yyyy")), - QMessageBox::Yes,QMessageBox::No)!=QMessageBox::Yes) { + tr("Are you sure you want to delete report data for")+ + " "+ + date_picker->date().toString("MM/dd/yyyy"), + QMessageBox::Yes,QMessageBox::No)!= + QMessageBox::Yes) { return; } date_picker->deleteDay(); diff --git a/rdmonitor/Makefile.am b/rdmonitor/Makefile.am index 9ea08ee5..5d128426 100644 --- a/rdmonitor/Makefile.am +++ b/rdmonitor/Makefile.am @@ -18,7 +18,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -46,7 +46,7 @@ dist_rdmonitor_SOURCES = positiondialog.cpp positiondialog.h\ nodist_rdmonitor_SOURCES = moc_positiondialog.cpp\ moc_rdmonitor.cpp -rdmonitor_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdmonitor_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ EXTRA_DIST = rdmonitor.pro\ rdmonitor_cs.ts\ diff --git a/rdmonitor/positiondialog.cpp b/rdmonitor/positiondialog.cpp index dd152f5d..5e7acd92 100644 --- a/rdmonitor/positiondialog.cpp +++ b/rdmonitor/positiondialog.cpp @@ -2,7 +2,7 @@ // // Dialog to set RDMonitor screen position. // -// (C) Copyright 2013-2019 Fred Gleason +// (C) Copyright 2013-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -33,8 +33,7 @@ PositionDialog::PositionDialog(QDesktopWidget *dw,RDMonitorConfig *mconfig, // Screen Number // pos_screen_number_box=new QComboBox(this); - pos_screen_number_label= - new QLabel(pos_screen_number_box,tr("Screen")+":",this); + pos_screen_number_label=new QLabel(tr("Screen")+":",this); pos_screen_number_label->setFont(labelFont()); pos_screen_number_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -42,13 +41,12 @@ PositionDialog::PositionDialog(QDesktopWidget *dw,RDMonitorConfig *mconfig, // Position // pos_position_box=new QComboBox(this); - pos_position_label= - new QLabel(pos_position_box,tr("Position")+":",this); + pos_position_label=new QLabel(tr("Position")+":",this); pos_position_label->setFont(labelFont()); pos_position_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); for(int i=0;i - insertItem(RDMonitorConfig::positionText((RDMonitorConfig::Position)i)); + insertItem(i,RDMonitorConfig::positionText((RDMonitorConfig::Position)i)); } // @@ -56,7 +54,7 @@ PositionDialog::PositionDialog(QDesktopWidget *dw,RDMonitorConfig *mconfig, // pos_x_offset_spin=new QSpinBox(this); pos_x_offset_spin->setRange(0,99); - pos_x_offset_label=new QLabel(pos_x_offset_spin,tr("X Offset")+":",this); + pos_x_offset_label=new QLabel(tr("X Offset")+":",this); pos_x_offset_label->setFont(labelFont()); pos_x_offset_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -65,7 +63,7 @@ PositionDialog::PositionDialog(QDesktopWidget *dw,RDMonitorConfig *mconfig, // pos_y_offset_spin=new QSpinBox(this); pos_y_offset_spin->setRange(0,99); - pos_y_offset_label=new QLabel(pos_y_offset_spin,tr("Y Offset")+":",this); + pos_y_offset_label=new QLabel(tr("Y Offset")+":",this); pos_y_offset_label->setFont(labelFont()); pos_y_offset_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -104,12 +102,12 @@ int PositionDialog::exec() { pos_screen_number_box->clear(); for(int i=0;inumScreens();i++) { - pos_screen_number_box->insertItem(QString().sprintf("%d",i)); + pos_screen_number_box->insertItem(i,QString().sprintf("%d",i)); if(i==pos_config->screenNumber()) { - pos_screen_number_box->setCurrentItem(i); + pos_screen_number_box->setCurrentIndex(i); } } - pos_position_box->setCurrentItem((int)pos_config->position()); + pos_position_box->setCurrentIndex((int)pos_config->position()); pos_x_offset_spin->setValue(pos_config->xOffset()); pos_y_offset_spin->setValue(pos_config->yOffset()); @@ -119,9 +117,9 @@ int PositionDialog::exec() void PositionDialog::okData() { - pos_config->setScreenNumber(pos_screen_number_box->currentItem()); + pos_config->setScreenNumber(pos_screen_number_box->currentIndex()); pos_config-> - setPosition((RDMonitorConfig::Position)pos_position_box->currentItem()); + setPosition((RDMonitorConfig::Position)pos_position_box->currentIndex()); pos_config->setXOffset(pos_x_offset_spin->value()); pos_config->setYOffset(pos_y_offset_spin->value()); diff --git a/rdmonitor/rdmonitor.cpp b/rdmonitor/rdmonitor.cpp index c62051c1..9f5b4e63 100644 --- a/rdmonitor/rdmonitor.cpp +++ b/rdmonitor/rdmonitor.cpp @@ -2,7 +2,7 @@ // // System Monitor for Rivendell // -// (C) Copyright 2012-2019 Fred Gleason +// (C) Copyright 2012-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -20,12 +20,12 @@ #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include @@ -50,7 +50,7 @@ void SigHandler(int signo) } MainWidget::MainWidget(RDConfig *c,QWidget *parent) - : RDWidget(c,parent,(Qt::WindowFlags)(Qt::WStyle_Customize|Qt::WStyle_NoBorder|Qt::WStyle_StaysOnTop)) + : RDWidget(c,parent,Qt::CustomizeWindowHint|Qt::WindowStaysOnTopHint) { QString str; mon_dialog_x=0; @@ -77,7 +77,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) // // Create And Set Icon // - setIcon(QPixmap(rivendell_22x22_xpm)); + setWindowIcon(QPixmap(rivendell_22x22_xpm)); // // Dialogs @@ -115,9 +115,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) // Status Label // mon_status_label=new QLabel(tr("Status: unknown"),NULL, - (Qt::WindowFlags)(Qt::WStyle_Customize| - Qt::WStyle_NoBorder| - Qt::WStyle_StaysOnTop)); + Qt::CustomizeWindowHint|Qt::WindowStaysOnTopHint); mon_status_label->setAlignment(Qt::AlignCenter|Qt::AlignVCenter); mon_status_label-> setStyleSheet(QString("background-color:")+RD_STATUS_BACKGROUND_COLOR); @@ -130,8 +128,6 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) connect(mon_validate_timer,SIGNAL(timeout()),this,SLOT(validate())); mon_validate_timer->start(5000); - // mon_tooltip=new StatusTip(this); - mon_name_label->setText(mon_rdconfig->label()); SetPosition(); @@ -226,7 +222,9 @@ void MainWidget::mouseDoubleClickEvent(QMouseEvent *e) e->accept(); QDir dir(RD_DEFAULT_RDSELECT_DIR); dir.setFilter(QDir::Files|QDir::Readable); - dir.setNameFilter("*.conf"); + QStringList filters; + filters.push_back("*.conf"); + dir.setNameFilters(filters); if(dir.entryList().size()>1) { QProcess *proc=new QProcess(this); QStringList args; @@ -480,25 +478,24 @@ int main(int argc,char *argv[]) // // Load Translations // - QTranslator qt(0); - qt.load(QString("/usr/share/qt4/translations/qt_")+QTextCodec::locale(), - "."); - a.installTranslator(&qt); + QString loc=RDApplication::locale(); + if(!loc.isEmpty()) { + QTranslator qt(0); + qt.load(QString("/usr/share/qt4/translations/qt_")+loc,"."); + a.installTranslator(&qt); - QTranslator rd(0); - rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+ - QTextCodec::locale(),"."); - a.installTranslator(&rd); + QTranslator rd(0); + rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+loc,"."); + a.installTranslator(&rd); - QTranslator rdhpi(0); - rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+ - QTextCodec::locale(),"."); - a.installTranslator(&rdhpi); + QTranslator rdhpi(0); + rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+loc,"."); + a.installTranslator(&rdhpi); - QTranslator tr(0); - tr.load(QString(PREFIX)+QString("/share/rivendell/rdmonitor_")+ - QTextCodec::locale(),"."); - a.installTranslator(&tr); + QTranslator tr(0); + tr.load(QString(PREFIX)+QString("/share/rivendell/rdmonitor_")+loc,"."); + a.installTranslator(&tr); + } // // Start Event Loop @@ -506,7 +503,6 @@ int main(int argc,char *argv[]) RDConfig *config=new RDConfig(); config->load(); MainWidget *w=new MainWidget(config); - a.setMainWidget(w); w->show(); return a.exec(); } diff --git a/rdpadd/Makefile.am b/rdpadd/Makefile.am index 889c2bef..ec9b2d2e 100644 --- a/rdpadd/Makefile.am +++ b/rdpadd/Makefile.am @@ -2,7 +2,7 @@ ## ## Rivendell PAD Consolidation Server ## -## (C) Copyright 2018-2020 Fred Gleason +## (C) Copyright 2018-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -20,7 +20,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib -L$(top_srcdir)/rdhpi MOC = @QT_MOC@ @@ -35,7 +35,7 @@ dist_rdpadd_SOURCES = rdpadd.cpp rdpadd.h nodist_rdpadd_SOURCES = moc_rdpadd.cpp -rdpadd_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdpadd_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ *.idb\ diff --git a/rdpadengined/Makefile.am b/rdpadengined/Makefile.am index 43e0d8c0..3164e8ef 100644 --- a/rdpadengined/Makefile.am +++ b/rdpadengined/Makefile.am @@ -2,7 +2,7 @@ ## ## Rivendell PyPAD Script Host ## -## (C) Copyright 2018-2020 Fred Gleason +## (C) Copyright 2018-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -20,7 +20,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib -L$(top_srcdir)/rdhpi MOC = @QT_MOC@ @@ -35,7 +35,7 @@ dist_rdpadengined_SOURCES = rdpadengined.cpp rdpadengined.h nodist_rdpadengined_SOURCES = moc_rdpadengined.cpp -rdpadengined_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdpadengined_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ *.idb\ diff --git a/rdpadengined/rdpadengined.cpp b/rdpadengined/rdpadengined.cpp index 34bf1615..6c8cb78f 100644 --- a/rdpadengined/rdpadengined.cpp +++ b/rdpadengined/rdpadengined.cpp @@ -23,8 +23,7 @@ #include #include -#include -#include +#include #include #include @@ -57,7 +56,7 @@ MainObject::MainObject(QObject *parent) // rda=static_cast(new RDCoreApplication("rdpadengined","rdpadengined",RDPADENGINED_USAGE,this)); if(!rda->open(&err_msg,&err_type,false)) { - fprintf(stderr,"rdpadengined: %s\n",(const char *)err_msg); + fprintf(stderr,"rdpadengined: %s\n",err_msg.toUtf8().constData()); exit(1); } @@ -272,8 +271,8 @@ void MainObject::StartScript(unsigned id) args.push_back(QString().sprintf("%u",RD_PAD_CLIENT_TCP_PORT)); args.push_back(QString().sprintf("$%u",id)); pad_instances.value(id)->start(RD_PYPAD_PYTHON_PATH,args); - rda->syslog(LOG_INFO,"starting: "+proc->program()+" "+ - proc->arguments().join(" ").toUtf8()); + rda->syslog(LOG_INFO,"%s",(QString("starting: ")+proc->program()+" "+ + proc->arguments().join(" ")).toUtf8().constData()); } delete q; } diff --git a/rdpanel/Makefile.am b/rdpanel/Makefile.am index 6ca72a85..c5a0c952 100644 --- a/rdpanel/Makefile.am +++ b/rdpanel/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2002-2020 Fred Gleason +## (C) Copyright 2002-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -45,7 +45,7 @@ dist_rdpanel_SOURCES = globals.h\ nodist_rdpanel_SOURCES = moc_rdpanel.cpp -rdpanel_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdpanel_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ EXTRA_DIST = rdpanel.pro\ rdpanel_cs.ts\ diff --git a/rdpanel/rdpanel.cpp b/rdpanel/rdpanel.cpp index ea85aec9..036a0023 100644 --- a/rdpanel/rdpanel.cpp +++ b/rdpanel/rdpanel.cpp @@ -18,17 +18,11 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include #include #include @@ -373,29 +367,28 @@ int main(int argc,char *argv[]) // // Load Translations // - QTranslator qt(0); - qt.load(QString("/usr/share/qt4/translations/qt_")+QTextCodec::locale(),"."); - a.installTranslator(&qt); + QString loc=RDApplication::locale(); + if(!loc.isEmpty()) { + QTranslator qt(0); + qt.load(QString("/usr/share/qt4/translations/qt_")+loc,"."); + a.installTranslator(&qt); - QTranslator rd(0); - rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+ - QTextCodec::locale(),"."); - a.installTranslator(&rd); + QTranslator rd(0); + rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+loc,"."); + a.installTranslator(&rd); - QTranslator rdhpi(0); - rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+ - QTextCodec::locale(),"."); - a.installTranslator(&rdhpi); + QTranslator rdhpi(0); + rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+loc,"."); + a.installTranslator(&rdhpi); - QTranslator tr(0); - tr.load(QString(PREFIX)+QString("/share/rivendell/rdpanel_")+ - QTextCodec::locale(),"."); - a.installTranslator(&tr); + QTranslator tr(0); + tr.load(QString(PREFIX)+QString("/share/rivendell/rdpanel_")+loc,"."); + a.installTranslator(&tr); + } RDConfig *config=new RDConfig(); config->load(); MainWidget *w=new MainWidget(config); - a.setMainWidget(w); w->setGeometry(QRect(QPoint(0,0),w->sizeHint())); w->show(); return a.exec(); diff --git a/rdrepld/Makefile.am b/rdrepld/Makefile.am index 62b73a4a..5f851a17 100644 --- a/rdrepld/Makefile.am +++ b/rdrepld/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2010-2020 Fred Gleason +## (C) Copyright 2010-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -I$(top_srcdir)/lib @QT4_CFLAGS@ -DQT3_SUPPORT @MUSICBRAINZ_CFLAGS@ -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -32,7 +32,7 @@ dist_rdrepld_SOURCES = rdrepld.cpp rdrepld.h \ replfactory.cpp replfactory.h\ citadelxds.cpp citadelxds.h nodist_rdrepld_SOURCES = moc_rdrepld.cpp -rdrepld_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdrepld_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ CLEANFILES = *~ moc_* DISTCLEANFILES = moc_* diff --git a/rdrepld/citadelxds.cpp b/rdrepld/citadelxds.cpp index 56de3cd3..a6597a33 100644 --- a/rdrepld/citadelxds.cpp +++ b/rdrepld/citadelxds.cpp @@ -24,8 +24,6 @@ #include #include -#include - #include #include #include @@ -120,7 +118,7 @@ bool CitadelXds::LoadIsciXreference(const QString &filename) bool ok=false; unsigned linenum=3; - if((f=fopen(filename,"r"))==NULL) { + if((f=fopen(filename.toUtf8(),"r"))==NULL) { rda->syslog(LOG_WARNING, "unable to load ISCI cross reference file \"%s\" [%s]", (const char *)rda->system()->isciXreferencePath().toUtf8(), @@ -148,7 +146,7 @@ bool CitadelXds::LoadIsciXreference(const QString &filename) fields=fields.split(',',line,"\""); if(fields.size()==9) { for(int i=0;i")<0); - ret=ret&&(filename.find("?")<0); - ret=ret&&(filename.find("@")<0); - ret=ret&&(filename.find("[")<0); - ret=ret&&(filename.find("\\")<0); - ret=ret&&(filename.find("]")<0); - ret=ret&&(filename.find("^")<0); - ret=ret&&(filename.find("{")<0); - ret=ret&&(filename.find("|")<0); - ret=ret&&(filename.find("}")<0); + ret=ret&&(filename.indexOf(" ")<0); + ret=ret&&(filename.indexOf("\"")<0); + ret=ret&&(filename.indexOf("%")<0); + ret=ret&&(filename.indexOf("*")<0); + ret=ret&&(filename.indexOf("+")<0); + ret=ret&&(filename.indexOf("/")<0); + ret=ret&&(filename.indexOf(":")<0); + ret=ret&&(filename.indexOf(";")<0); + ret=ret&&(filename.indexOf("<")<0); + ret=ret&&(filename.indexOf("=")<0); + ret=ret&&(filename.indexOf(">")<0); + ret=ret&&(filename.indexOf("?")<0); + ret=ret&&(filename.indexOf("@")<0); + ret=ret&&(filename.indexOf("[")<0); + ret=ret&&(filename.indexOf("\\")<0); + ret=ret&&(filename.indexOf("]")<0); + ret=ret&&(filename.indexOf("^")<0); + ret=ret&&(filename.indexOf("{")<0); + ret=ret&&(filename.indexOf("|")<0); + ret=ret&&(filename.indexOf("}")<0); return ret; } @@ -378,16 +376,16 @@ bool CitadelXds::PostCut(const QString &cutname,const QString &filename) default: rda->syslog(LOG_WARNING,"CitadelXds: audio upload failed: %s", (const char *)RDUpload::errorText(upload_err).toUtf8()); - unlink(tempfile); + unlink(tempfile.toUtf8()); delete upload; return false; } - unlink(tempfile); + unlink(tempfile.toUtf8()); delete upload; rda->syslog(LOG_INFO,"CitadelXds: uploaded cut %s to %s/%s", - (const char *)cutname.toUtf8(), - (const char *)config()->url().toUtf8(), - (const char *)filename.toUtf8()); + cutname.toUtf8().constData(), + config()->url().toUtf8().constData(), + filename.toUtf8().constData()); return true; } @@ -419,7 +417,7 @@ void CitadelXds::PurgeCuts() } QUrl url(path+q->value(1).toString()); conv=new RDDelete(rda->config()); - conv->setTargetUrl(url); + conv->setTargetUrl(url.toString()); // // FIXME: Finish implementing ssh(1) key support! // diff --git a/rdrepld/rdrepld.cpp b/rdrepld/rdrepld.cpp index b0f75091..d2709ceb 100644 --- a/rdrepld/rdrepld.cpp +++ b/rdrepld/rdrepld.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include @@ -72,7 +72,7 @@ MainObject::MainObject(QObject *parent) // rda=static_cast(new RDCoreApplication("rdrepld","rdrepld",RDREPLD_USAGE,this)); if(!rda->open(&err_msg,&err_type,false)) { - fprintf(stderr,"rdrepld: %s\n",(const char *)err_msg); + fprintf(stderr,"rdrepld: %s\n",err_msg.toUtf8().constData()); exit(1); } @@ -86,7 +86,7 @@ MainObject::MainObject(QObject *parent) } if(!rda->cmdSwitch()->processed(i)) { fprintf(stderr,"rdrepld: unknown command option \"%s\"\n", - (const char *)rda->cmdSwitch()->key(i)); + rda->cmdSwitch()->key(i).toUtf8().constData()); exit(2); } } @@ -116,8 +116,9 @@ MainObject::MainObject(QObject *parent) // Start the Main Loop // repl_loop_timer=new QTimer(this); + repl_loop_timer->setSingleShot(true); connect(repl_loop_timer,SIGNAL(timeout()),this,SLOT(mainLoop())); - repl_loop_timer->start(RD_RDREPL_SCAN_INTERVAL,true); + repl_loop_timer->start(RD_RDREPL_SCAN_INTERVAL); rda->syslog(LOG_INFO,"started"); } @@ -128,7 +129,7 @@ void MainObject::mainLoop() LoadReplicators(); ProcessCarts(); FreeReplicators(); - repl_loop_timer->start(RD_RDREPL_SCAN_INTERVAL,true); + repl_loop_timer->start(RD_RDREPL_SCAN_INTERVAL); } diff --git a/rdrssd/Makefile.am b/rdrssd/Makefile.am index 2e0453a0..0ea295c0 100644 --- a/rdrssd/Makefile.am +++ b/rdrssd/Makefile.am @@ -2,7 +2,7 @@ ## ## Rivendell RSS Processor Service ## -## (C) Copyright 2020 Fred Gleason +## (C) Copyright 2020-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -20,7 +20,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib -L$(top_srcdir)/rdhpi MOC = @QT_MOC@ @@ -35,7 +35,7 @@ dist_rdrssd_SOURCES = rdrssd.cpp rdrssd.h nodist_rdrssd_SOURCES = moc_rdrssd.cpp -rdrssd_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdrssd_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ *.idb\ diff --git a/rdrssd/rdrssd.cpp b/rdrssd/rdrssd.cpp index fd678828..bf9d07a1 100644 --- a/rdrssd/rdrssd.cpp +++ b/rdrssd/rdrssd.cpp @@ -44,7 +44,7 @@ MainObject::MainObject(QObject *parent) // rda=static_cast(new RDCoreApplication("rdrssd","rdrssd",RDRSSD_USAGE,this)); if(!rda->open(&err_msg,&err_type,false)) { - fprintf(stderr,"rdrssd: %s\n",(const char *)err_msg); + fprintf(stderr,"rdrssd: %s\n",err_msg.toUtf8().constData()); exit(1); } diff --git a/rdselect/Makefile.am b/rdselect/Makefile.am index 416f26d2..0b8093fb 100644 --- a/rdselect/Makefile.am +++ b/rdselect/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2012-2020 Fred Gleason +## (C) Copyright 2012-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -48,7 +48,7 @@ dist_rdselect_SOURCES = rdselect.cpp rdselect.h nodist_rdselect_SOURCES = moc_rdselect.cpp -rdselect_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdselect_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ EXTRA_DIST = rd.audiostore.autofs\ rdselect.pro\ diff --git a/rdselect/rdselect.cpp b/rdselect/rdselect.cpp index dc7f0819..6ca81da0 100644 --- a/rdselect/rdselect.cpp +++ b/rdselect/rdselect.cpp @@ -114,7 +114,9 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) } QDir config_dir(RD_DEFAULT_RDSELECT_DIR); config_dir.setFilter(QDir::Files|QDir::Readable); - config_dir.setNameFilter("*.conf"); + QStringList filters; + filters.push_back("*.conf"); + config_dir.setNameFilters(filters); select_filenames=config_dir.entryList(); for(int i=0;iinsertItem(select_box->count(),select_configs[i]->label()); } - select_label=new QLabel(select_box,tr("Available Systems"),this); + select_label=new QLabel(tr("Available Systems"),this); select_label->setFont(labelFont()); // @@ -159,7 +161,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) // // Cancel Button // - cancel_button=new QPushButton(this,"cancel_button"); + cancel_button=new QPushButton(this); cancel_button->setFont(buttonFont()); cancel_button->setText(tr("&Cancel")); connect(cancel_button,SIGNAL(clicked()),this,SLOT(cancelData())); @@ -282,25 +284,25 @@ int main(int argc,char *argv[]) // // Load Translations // - QTranslator qt(0); - qt.load(QString("/usr/share/qt4/translations/qt_")+QTextCodec::locale(), - "."); - a.installTranslator(&qt); + QString loc=RDApplication::locale(); + if(!loc.isEmpty()) { + QTranslator qt(0); + qt.load(QString("/usr/share/qt4/translations/qt_")+loc, + "."); + a.installTranslator(&qt); - QTranslator rd(0); - rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+ - QTextCodec::locale(),"."); - a.installTranslator(&rd); + QTranslator rd(0); + rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+loc,"."); + a.installTranslator(&rd); - QTranslator rdhpi(0); - rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+ - QTextCodec::locale(),"."); - a.installTranslator(&rdhpi); + QTranslator rdhpi(0); + rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+loc,"."); + a.installTranslator(&rdhpi); - QTranslator tr(0); - tr.load(QString(PREFIX)+QString("/share/rivendell/rdselect_")+ - QTextCodec::locale(),"."); - a.installTranslator(&tr); + QTranslator tr(0); + tr.load(QString(PREFIX)+QString("/share/rivendell/rdselect_")+loc,"."); + a.installTranslator(&tr); + } // // Start Event Loop @@ -308,7 +310,6 @@ int main(int argc,char *argv[]) RDConfig *config=new RDConfig(); config->load(); MainWidget *w=new MainWidget(config); - a.setMainWidget(w); w->show(); return a.exec(); } diff --git a/rdservice/Makefile.am b/rdservice/Makefile.am index 626edd76..16a25fe2 100644 --- a/rdservice/Makefile.am +++ b/rdservice/Makefile.am @@ -2,7 +2,7 @@ ## ## Rivendell Services Manager ## -## (C) Copyright 2018-2020 Fred Gleason +## (C) Copyright 2018-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -20,7 +20,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -38,7 +38,7 @@ dist_rdservice_SOURCES = maint_routines.cpp\ nodist_rdservice_SOURCES = moc_rdservice.cpp -rdservice_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdservice_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ moc_* diff --git a/rdservice/rdservice.cpp b/rdservice/rdservice.cpp index 8efc3e4c..8a729b2c 100644 --- a/rdservice/rdservice.cpp +++ b/rdservice/rdservice.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include @@ -74,7 +74,7 @@ MainObject::MainObject(QObject *parent) rda=static_cast(new RDCoreApplication("rdservice","rdservice","\n\n",this)); if(!rda->open(&err_msg,&err_type,false)) { rda->syslog(LOG_ERR,"unable to open database [%s]", - (const char *)err_msg.utf8()); + err_msg.toUtf8().constData()); exit(RDApplication::ExitNoDb); } diff --git a/rdvairplayd/Makefile.am b/rdvairplayd/Makefile.am index a492d57f..fd91f938 100644 --- a/rdvairplayd/Makefile.am +++ b/rdvairplayd/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2018-2020 Fred Gleason +## (C) Copyright 2018-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -17,7 +17,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -32,7 +32,7 @@ dist_rdvairplayd_SOURCES = local_macros.cpp\ nodist_rdvairplayd_SOURCES = moc_rdvairplayd.cpp -rdvairplayd_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdvairplayd_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ *.idb\ diff --git a/rdvairplayd/local_macros.cpp b/rdvairplayd/local_macros.cpp index 1382ddf7..a1c6f1c6 100644 --- a/rdvairplayd/local_macros.cpp +++ b/rdvairplayd/local_macros.cpp @@ -545,8 +545,8 @@ void MainObject::rmlReceivedData(RDMacro *rml) } return; } - if((rml->arg(0).lower()!="now")&& - (rml->arg(0).lower()!="next")) { + if((rml->arg(0).toLower()!="now")&& + (rml->arg(0).toLower()!="next")) { if(rml->echoRequested()) { rml->acknowledge(false); rda->ripc()->sendRml(rml); @@ -567,7 +567,7 @@ void MainObject::rmlReceivedData(RDMacro *rml) } return; } - if(rml->arg(0).lower()=="now") { + if(rml->arg(0).toLower()=="now") { air_logs[index]->setNowCart(rml->arg(2).toUInt()); rda->syslog(LOG_INFO,"set default \"now\" cart to %06u on log machine %d", rml->arg(2).toUInt(),rml->arg(1).toInt()); diff --git a/rdvairplayd/rdvairplayd.cpp b/rdvairplayd/rdvairplayd.cpp index 8080e5f9..3b1c4bfe 100644 --- a/rdvairplayd/rdvairplayd.cpp +++ b/rdvairplayd/rdvairplayd.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include @@ -66,7 +66,7 @@ MainObject::MainObject(QObject *parent) // rda=static_cast(new RDCoreApplication("rdvairplayd","rdvairplayd",RDVAIRPLAYD_USAGE,this)); if(!rda->open(&err_msg,&err_type,false)) { - fprintf(stderr,"rdvairplayd: %s\n",(const char *)err_msg); + fprintf(stderr,"rdvairplayd: %s\n",err_msg.toUtf8().constData()); exit(1); } air_previous_exit_code=rda->airplayConf()->virtualExitCode(); @@ -78,7 +78,7 @@ MainObject::MainObject(QObject *parent) for(unsigned i=0;icmdSwitch()->keys();i++) { if(!rda->cmdSwitch()->processed(i)) { fprintf(stderr,"rdvairplayd: unknown command option \"%s\"\n", - (const char *)rda->cmdSwitch()->key(i)); + rda->cmdSwitch()->key(i).toUtf8().constData()); exit(2); } } diff --git a/ripcd/Makefile.am b/ripcd/Makefile.am index c374e219..64bde41e 100644 --- a/ripcd/Makefile.am +++ b/ripcd/Makefile.am @@ -20,7 +20,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib -L$(top_srcdir)/rdhpi MOC = @QT_MOC@ @@ -134,8 +134,7 @@ ripcd_LDADD = @LIB_RDLIBS@\ @QT4_LIBS@\ @LIBHPI@\ @LIBJACK@\ - @MUSICBRAINZ_LIBS@\ - -lQt3Support + @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ *.idb\ diff --git a/ripcd/acu1p.cpp b/ripcd/acu1p.cpp index 72b02583..28183ee8 100644 --- a/ripcd/acu1p.cpp +++ b/ripcd/acu1p.cpp @@ -2,7 +2,7 @@ // // Rivendell switcher driver for the Sine Systems ACU-1 (Prophet) // -// (C) Copyright 2012-2019 Fred Gleason +// (C) Copyright 2012-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -128,14 +128,14 @@ void Acu1p::processCommand(RDMacro *cmd) switch(cmd->command()) { case RDMacro::GO: if((cmd->argQuantity()!=5)|| - ((cmd->arg(1).lower()!="i")&& - (cmd->arg(1).lower()!="o"))|| + ((cmd->arg(1).toLower()!="i")&& + (cmd->arg(1).toLower()!="o"))|| (cmd->arg(2).toInt()<1)||(cmd->arg(3).toInt()>bt_gpos)|| (cmd->arg(2).toInt()>bt_gpos)|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(1).lower()!="i"))|| + (cmd->arg(1).toLower()!="i"))|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).lower()=="i"))|| + (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).toLower()=="i"))|| (cmd->arg(4).toInt()<0)) { cmd->acknowledge(false); emit rmlEcho(cmd); @@ -143,14 +143,14 @@ void Acu1p::processCommand(RDMacro *cmd) } if(cmd->arg(3).toInt()==0) { // Turn OFF if(cmd->arg(4).toInt()==0) { - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,false); bt_gpi_state[cmd->arg(2).toInt()-1]=false; } bt_gpi_mask[cmd->arg(2).toInt()-1]=true; } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { SetRelay(cmd->arg(2).toInt()-1,false); emit gpoChanged(bt_matrix,cmd->arg(2).toInt()-1,false); } @@ -170,20 +170,20 @@ void Acu1p::processCommand(RDMacro *cmd) } else { if(cmd->arg(4).toInt()==0) { // Turn ON - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(!bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,true); bt_gpi_state[cmd->arg(2).toInt()-1]=true; } bt_gpi_mask[cmd->arg(2).toInt()-1]=true; } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { SetRelay(cmd->arg(2).toInt()-1,true); emit gpoChanged(bt_matrix,cmd->arg(2).toInt()-1,true); } } else { // Pulse - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(!bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,true); bt_gpi_state[cmd->arg(2).toInt()-1]=true; @@ -191,7 +191,7 @@ void Acu1p::processCommand(RDMacro *cmd) bt_gpi_mask[cmd->arg(2).toInt()-1]=true; bt_gpi_oneshot->start(cmd->arg(2).toInt()-1,500); } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { PulseRelay(cmd->arg(2).toInt()-1); emit gpoChanged(bt_matrix,cmd->arg(2).toInt()-1,true); bt_gpo_oneshot->start(cmd->arg(2).toInt()-1,500); diff --git a/ripcd/am16.cpp b/ripcd/am16.cpp index c3420f11..6c646fdf 100644 --- a/ripcd/am16.cpp +++ b/ripcd/am16.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for the 360 Systems AM16 // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -44,9 +44,9 @@ Am16::Am16(RDMatrix *matrix,QObject *parent) bt_sysex_active=false; bt_data_ptr=0; - if((bt_midi_socket=open(matrix->gpioDevice(),O_RDWR))<0) { + if((bt_midi_socket=open(matrix->gpioDevice().toUtf8(),O_RDWR))<0) { rda->syslog(LOG_WARNING,"unable to open MIDI device at \"%s\"", - (const char *)matrix->gpioDevice()); + matrix->gpioDevice().toUtf8().constData()); return; } sockopt=O_NONBLOCK; @@ -59,6 +59,7 @@ Am16::Am16(RDMatrix *matrix,QObject *parent) // Timeout Timer // bt_timeout_timer=new QTimer(this); + bt_timeout_timer->setSingleShot(true); connect(bt_timeout_timer,SIGNAL(timeout()),this,SLOT(timeoutData())); } @@ -137,7 +138,7 @@ void Am16::processCommand(RDMacro *cmd) data[7]=AM16_PATCH_NUMBER; data[8]=AM16_SYSEX_END; write(bt_midi_socket,data,9); - bt_timeout_timer->start(AM16_TIMEOUT_INTERVAL,true); + bt_timeout_timer->start(AM16_TIMEOUT_INTERVAL); } cmd->acknowledge(true); emit rmlEcho(cmd); @@ -256,7 +257,7 @@ void Am16::ProcessMessage(char *msg,int len) } rda->syslog(LOG_DEBUG, "AM16 driver: received unrecognized MIDI message [%s]", - (const char *)str); + str.toUtf8().constData()); break; } } diff --git a/ripcd/bt16x2.cpp b/ripcd/bt16x2.cpp index 8d30537f..ce097259 100644 --- a/ripcd/bt16x2.cpp +++ b/ripcd/bt16x2.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for the BroadcastTools 16x2 // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,9 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include +#include #include @@ -73,7 +71,7 @@ Bt16x2::Bt16x2(RDMatrix *matrix,QObject *parent) // // The Poll Timer // - QTimer *timer=new QTimer(this,"poll_timer"); + QTimer *timer=new QTimer(this); connect(timer,SIGNAL(timeout()),this,SLOT(processStatus())); timer->start(BT16X2_POLL_INTERVAL); } @@ -124,14 +122,14 @@ void Bt16x2::processCommand(RDMacro *cmd) switch(cmd->command()) { case RDMacro::GO: if((cmd->argQuantity()!=5)|| - ((cmd->arg(1).lower()!="i")&& - (cmd->arg(1).lower()!="o"))|| + ((cmd->arg(1).toLower()!="i")&& + (cmd->arg(1).toLower()!="o"))|| (cmd->arg(2).toInt()<1)||(cmd->arg(3).toInt()>bt_gpos)|| (cmd->arg(2).toInt()>bt_gpos)|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(1).lower()!="i"))|| + (cmd->arg(1).toLower()!="i"))|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).lower()=="i"))|| + (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).toLower()=="i"))|| (cmd->arg(4).toInt()<0)) { cmd->acknowledge(false); emit rmlEcho(cmd); @@ -139,14 +137,14 @@ void Bt16x2::processCommand(RDMacro *cmd) } if(cmd->arg(3).toInt()==0) { // Turn OFF if(cmd->arg(4).toInt()==0) { - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,false); bt_gpi_state[cmd->arg(2).toInt()-1]=false; } bt_gpi_mask[cmd->arg(2).toInt()-1]=true; } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { sprintf(str,"*%dOR%02dF",BT16X2_UNIT_ID,cmd->arg(2).toInt()); bt_device->write(str,6); emit gpoChanged(bt_matrix,cmd->arg(2).toInt()-1,false); @@ -167,21 +165,21 @@ void Bt16x2::processCommand(RDMacro *cmd) } else { if(cmd->arg(4).toInt()==0) { // Turn ON - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(!bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,true); bt_gpi_state[cmd->arg(2).toInt()-1]=true; } bt_gpi_mask[cmd->arg(2).toInt()-1]=true; } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { sprintf(str,"*%dOR%02dL",BT16X2_UNIT_ID,cmd->arg(2).toInt()); bt_device->write(str,6); emit gpoChanged(bt_matrix,cmd->arg(2).toInt()-1,true); } } else { // Pulse - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(!bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,true); bt_gpi_state[cmd->arg(2).toInt()-1]=true; @@ -189,7 +187,7 @@ void Bt16x2::processCommand(RDMacro *cmd) bt_gpi_mask[cmd->arg(2).toInt()-1]=true; bt_gpi_oneshot->start(cmd->arg(2).toInt()-1,500); } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { sprintf(str,"*%dOR%02dP",BT16X2_UNIT_ID,cmd->arg(2).toInt()); bt_device->write(str,6); emit gpoChanged(bt_matrix,cmd->arg(2).toInt()-1,true); diff --git a/ripcd/btacs82.cpp b/ripcd/btacs82.cpp index 7e16755e..3491bf26 100644 --- a/ripcd/btacs82.cpp +++ b/ripcd/btacs82.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for the BroadcastTools ACS 8.2 // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,9 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include +#include #include @@ -121,14 +119,14 @@ void BtAcs82::processCommand(RDMacro *cmd) switch(cmd->command()) { case RDMacro::GO: if((cmd->argQuantity()!=5)|| - ((cmd->arg(1).lower()!="i")&& - (cmd->arg(1).lower()!="o"))|| + ((cmd->arg(1).toLower()!="i")&& + (cmd->arg(1).toLower()!="o"))|| (cmd->arg(2).toInt()<1)||(cmd->arg(3).toInt()>bt_gpos)|| (cmd->arg(2).toInt()>bt_gpos)|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(1).lower()!="i"))|| + (cmd->arg(1).toLower()!="i"))|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).lower()=="i"))|| + (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).toLower()=="i"))|| (cmd->arg(4).toInt()<0)) { cmd->acknowledge(false); emit rmlEcho(cmd); @@ -136,14 +134,14 @@ void BtAcs82::processCommand(RDMacro *cmd) } if(cmd->arg(3).toInt()==0) { // Turn OFF if(cmd->arg(4).toInt()==0) { - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,false); bt_gpi_state[cmd->arg(2).toInt()-1]=false; } bt_gpi_mask[cmd->arg(2).toInt()-1]=true; } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { sprintf(str,"*%dOR%dF",BTACS82_UNIT_ID,cmd->arg(2).toInt()); bt_device->write(str,6); emit gpoChanged(bt_matrix,cmd->arg(2).toInt()-1,false); @@ -164,21 +162,21 @@ void BtAcs82::processCommand(RDMacro *cmd) } else { if(cmd->arg(4).toInt()==0) { // Turn ON - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(!bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,true); bt_gpi_state[cmd->arg(2).toInt()-1]=true; } bt_gpi_mask[cmd->arg(2).toInt()-1]=true; } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { sprintf(str,"*%dOR%dL",BTACS82_UNIT_ID,cmd->arg(2).toInt()); bt_device->write(str,6); emit gpoChanged(bt_matrix,cmd->arg(2).toInt()-1,true); } } else { // Pulse - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(!bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,true); bt_gpi_state[cmd->arg(2).toInt()-1]=true; @@ -186,7 +184,7 @@ void BtAcs82::processCommand(RDMacro *cmd) bt_gpi_mask[cmd->arg(2).toInt()-1]=true; bt_gpi_oneshot->start(cmd->arg(2).toInt()-1,500); } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { sprintf(str,"*%dOR%dP",BTACS82_UNIT_ID,cmd->arg(2).toInt()); bt_device->write(str,6); emit gpoChanged(bt_matrix,cmd->arg(2).toInt()-1,true); diff --git a/ripcd/btadms4422.cpp b/ripcd/btadms4422.cpp index e4b7aa68..c8c5dd4b 100644 --- a/ripcd/btadms4422.cpp +++ b/ripcd/btadms4422.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for the BroadcastTools ADMS 44.22 // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -19,9 +19,7 @@ // #include -#include - -#include +#include #include @@ -62,7 +60,8 @@ BtAdms4422::BtAdms4422(RDMatrix *matrix,QObject *parent) bt_device->setParity(tty->parity()); if(bt_device->open(QIODevice::Unbuffered|QIODevice::ReadWrite)) { // Set Mix Mode - bt_device->write(QString().sprintf("*%uUM0\r\n",BTADMS4422_UNIT_ID),7); + bt_device-> + write(QString().sprintf("*%uUM0\r\n",BTADMS4422_UNIT_ID).toUtf8()); } else { rda->syslog(LOG_WARNING,"failed to open port \"%s\"", @@ -128,14 +127,14 @@ void BtAdms4422::processCommand(RDMacro *cmd) switch(cmd->command()) { case RDMacro::GO: if((cmd->argQuantity()!=5)|| - ((cmd->arg(1).lower()!="i")&& - (cmd->arg(1).lower()!="o"))|| + ((cmd->arg(1).toLower()!="i")&& + (cmd->arg(1).toLower()!="o"))|| (cmd->arg(2).toInt()<1)||(cmd->arg(3).toInt()>bt_gpos)|| (cmd->arg(2).toInt()>bt_gpos)|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(1).lower()!="i"))|| + (cmd->arg(1).toLower()!="i"))|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).lower()=="i"))|| + (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).toLower()=="i"))|| (cmd->arg(4).toInt()<0)) { cmd->acknowledge(false); emit rmlEcho(cmd); @@ -143,14 +142,14 @@ void BtAdms4422::processCommand(RDMacro *cmd) } if(cmd->arg(3).toInt()==0) { // Turn OFF if(cmd->arg(4).toInt()==0) { - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,false); bt_gpi_state[cmd->arg(2).toInt()-1]=false; } bt_gpi_mask[cmd->arg(2).toInt()-1]=true; } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { if(cmd->arg(2).toInt()<=4) { sprintf(str,"*%dOR%dF\r\n",BTADMS4422_UNIT_ID, cmd->arg(2).toInt()); @@ -179,7 +178,7 @@ void BtAdms4422::processCommand(RDMacro *cmd) } else { if(cmd->arg(4).toInt()==0) { // Turn ON - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(!bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,true); bt_gpi_state[cmd->arg(2).toInt()-1]=true; @@ -188,7 +187,7 @@ void BtAdms4422::processCommand(RDMacro *cmd) } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { if(cmd->arg(2).toInt()<=4) { sprintf(str,"*%dOR%dL\r\n",BTADMS4422_UNIT_ID,cmd->arg(2).toInt()); bt_device->write(str,8); @@ -202,7 +201,7 @@ void BtAdms4422::processCommand(RDMacro *cmd) } } else { // Pulse - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(!bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,true); bt_gpi_state[cmd->arg(2).toInt()-1]=true; @@ -210,7 +209,7 @@ void BtAdms4422::processCommand(RDMacro *cmd) bt_gpi_mask[cmd->arg(2).toInt()-1]=true; bt_gpi_oneshot->start(cmd->arg(2).toInt()-1,500); } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { if(cmd->arg(2).toInt()<=4) { sprintf(str,"*%dOR%dP\r\n",BTADMS4422_UNIT_ID, cmd->arg(2).toInt()); diff --git a/ripcd/btsentinel4web.cpp b/ripcd/btsentinel4web.cpp index d15d853e..21237340 100644 --- a/ripcd/btsentinel4web.cpp +++ b/ripcd/btsentinel4web.cpp @@ -2,7 +2,7 @@ // // Rivendell switcher driver for the BroadcastTools Sentinel4Web AES switcher // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,9 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - #include #include @@ -49,11 +46,12 @@ BtSentinel4Web::BtSentinel4Web(RDMatrix *matrix,QObject *parent) connect(bt_watchdog_timer,SIGNAL(timeout()),this,SLOT(watchdogData())); bt_watchdog_reset_timer=new QTimer(this); + bt_watchdog_reset_timer->setSingleShot(true); connect(bt_watchdog_reset_timer,SIGNAL(timeout()),this,SLOT(watchdogResetData())); bt_socket->connectToHost(bt_address.toString(),bt_port); - bt_watchdog_timer->start(BTSENTINEL4WEB_WATCHDOG_INTERVAL,true); + bt_watchdog_timer->start(BTSENTINEL4WEB_WATCHDOG_INTERVAL); } @@ -119,7 +117,7 @@ void BtSentinel4Web::processCommand(RDMacro *cmd) else { msg=QString().sprintf("*0%02u",input); } - bt_socket->writeBlock(msg,msg.length()); + bt_socket->write(msg.toUtf8()); cmd->acknowledge(true); emit rmlEcho(cmd); break; @@ -134,7 +132,7 @@ void BtSentinel4Web::processCommand(RDMacro *cmd) void BtSentinel4Web::connectedData() { - bt_socket->writeBlock("*0U",3); + bt_socket->write("*0U",3); rda->syslog(LOG_INFO,"connected to BT Sentinel4Web device at %s", (const char *)bt_socket->peerAddress().toString().toUtf8()); } @@ -150,10 +148,10 @@ void BtSentinel4Web::readyReadData() { char data[1500]; - while(bt_socket->readBlock(data,1500)>0); + while(bt_socket->read(data,1500)>0); bt_watchdog_timer->stop(); - bt_socket->writeBlock("*0U",3); - bt_watchdog_timer->start(BTSENTINEL4WEB_WATCHDOG_INTERVAL,true); + bt_socket->write("*0U",3); + bt_watchdog_timer->start(BTSENTINEL4WEB_WATCHDOG_INTERVAL); } @@ -161,7 +159,7 @@ void BtSentinel4Web::watchdogData() { rda->syslog(LOG_WARNING,"lost connection to BT Sentinel4Web device at %s", (const char *)bt_socket->peerAddress().toString().toUtf8()); - bt_watchdog_reset_timer->start(BTSENTINEL4WEB_WATCHDOG_INTERVAL,true); + bt_watchdog_reset_timer->start(BTSENTINEL4WEB_WATCHDOG_INTERVAL); } @@ -175,5 +173,5 @@ void BtSentinel4Web::watchdogResetData() connect(bt_socket,SIGNAL(readyRead()),this,SLOT(readyReadData())); bt_socket->connectToHost(bt_address.toString(),bt_port); - bt_watchdog_timer->start(BTSENTINEL4WEB_WATCHDOG_INTERVAL,true); + bt_watchdog_timer->start(BTSENTINEL4WEB_WATCHDOG_INTERVAL); } diff --git a/ripcd/btsrc16.cpp b/ripcd/btsrc16.cpp index 2c20e37b..0933f2cf 100644 --- a/ripcd/btsrc16.cpp +++ b/ripcd/btsrc16.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for the BroadcastTools SRC-16 // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,10 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include - #include #include "btsrc16.h" @@ -116,14 +112,14 @@ void BtSrc16::processCommand(RDMacro *cmd) switch(cmd->command()) { case RDMacro::GO: if((cmd->argQuantity()!=5)|| - ((cmd->arg(1).lower()!="i")&& - (cmd->arg(1).lower()!="o"))|| + ((cmd->arg(1).toLower()!="i")&& + (cmd->arg(1).toLower()!="o"))|| (cmd->arg(2).toInt()<1)||(cmd->arg(3).toInt()>bt_gpos)|| (cmd->arg(2).toInt()>bt_gpos)|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(1).lower()!="i"))|| + (cmd->arg(1).toLower()!="i"))|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).lower()=="i"))|| + (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).toLower()=="i"))|| (cmd->arg(4).toInt()<0)) { cmd->acknowledge(false); emit rmlEcho(cmd); @@ -131,14 +127,14 @@ void BtSrc16::processCommand(RDMacro *cmd) } if(cmd->arg(3).toInt()==0) { // Turn OFF if(cmd->arg(4).toInt()==0) { - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,false); bt_gpi_state[cmd->arg(2).toInt()-1]=false; } bt_gpi_mask[cmd->arg(2).toInt()-1]=true; } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { sprintf(str,"*%dOR%02dF\r\n",BTSRC16_UNIT_ID,cmd->arg(2).toInt()); bt_device->write(str,9); emit gpoChanged(bt_matrix,cmd->arg(2).toInt()-1,false); @@ -159,14 +155,14 @@ void BtSrc16::processCommand(RDMacro *cmd) } else { if(cmd->arg(4).toInt()==0) { // Turn ON - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(!bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,true); bt_gpi_state[cmd->arg(2).toInt()-1]=true; } bt_gpi_mask[cmd->arg(2).toInt()-1]=true; } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { sprintf(str,"*%dOR%02dL\r\n", BTSRC16_UNIT_ID,cmd->arg(2).toInt()); bt_device->write(str,9); @@ -174,7 +170,7 @@ void BtSrc16::processCommand(RDMacro *cmd) } } else { // Pulse - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(!bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,true); bt_gpi_state[cmd->arg(2).toInt()-1]=true; @@ -182,7 +178,7 @@ void BtSrc16::processCommand(RDMacro *cmd) bt_gpi_mask[cmd->arg(2).toInt()-1]=true; bt_gpi_oneshot->start(cmd->arg(2).toInt()-1,500); } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { sprintf(str,"*%dOR%02dP%02d\r\n", BTSRC16_UNIT_ID,cmd->arg(2).toInt(), cmd->arg(4).toInt()/100+1); diff --git a/ripcd/btsrc8iii.cpp b/ripcd/btsrc8iii.cpp index 3491278a..62894aa8 100644 --- a/ripcd/btsrc8iii.cpp +++ b/ripcd/btsrc8iii.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for the BroadcastTools SRC-8 III // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,10 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include - #include #include "btsrc8iii.h" @@ -116,14 +112,14 @@ void BtSrc8Iii::processCommand(RDMacro *cmd) switch(cmd->command()) { case RDMacro::GO: if((cmd->argQuantity()!=5)|| - ((cmd->arg(1).lower()!="i")&& - (cmd->arg(1).lower()!="o"))|| + ((cmd->arg(1).toLower()!="i")&& + (cmd->arg(1).toLower()!="o"))|| (cmd->arg(2).toInt()<1)||(cmd->arg(3).toInt()>bt_gpos)|| (cmd->arg(2).toInt()>bt_gpos)|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(1).lower()!="i"))|| + (cmd->arg(1).toLower()!="i"))|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).lower()=="i"))|| + (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).toLower()=="i"))|| (cmd->arg(4).toInt()<0)) { cmd->acknowledge(false); emit rmlEcho(cmd); @@ -131,14 +127,14 @@ void BtSrc8Iii::processCommand(RDMacro *cmd) } if(cmd->arg(3).toInt()==0) { // Turn OFF if(cmd->arg(4).toInt()==0) { - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,false); bt_gpi_state[cmd->arg(2).toInt()-1]=false; } bt_gpi_mask[cmd->arg(2).toInt()-1]=true; } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { sprintf(str,"*%dOR%dF\r\n",BTSRC8III_UNIT_ID,cmd->arg(2).toInt()); bt_device->write(str,8); emit gpoChanged(bt_matrix,cmd->arg(2).toInt()-1,false); @@ -159,14 +155,14 @@ void BtSrc8Iii::processCommand(RDMacro *cmd) } else { if(cmd->arg(4).toInt()==0) { // Turn ON - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(!bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,true); bt_gpi_state[cmd->arg(2).toInt()-1]=true; } bt_gpi_mask[cmd->arg(2).toInt()-1]=true; } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { sprintf(str,"*%dOR%dL\r\n", BTSRC8III_UNIT_ID,cmd->arg(2).toInt()); bt_device->write(str,8); @@ -174,7 +170,7 @@ void BtSrc8Iii::processCommand(RDMacro *cmd) } } else { // Pulse - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(!bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,true); bt_gpi_state[cmd->arg(2).toInt()-1]=true; @@ -182,7 +178,7 @@ void BtSrc8Iii::processCommand(RDMacro *cmd) bt_gpi_mask[cmd->arg(2).toInt()-1]=true; bt_gpi_oneshot->start(cmd->arg(2).toInt()-1,500); } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { sprintf(str,"*%dOR%dP%02d\r\n", BTSRC8III_UNIT_ID,cmd->arg(2).toInt(), cmd->arg(4).toInt()/100+1); diff --git a/ripcd/btss164.cpp b/ripcd/btss164.cpp index 5612efb2..9cf7e7b3 100644 --- a/ripcd/btss164.cpp +++ b/ripcd/btss164.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for the BroadcastTools SS 16.4 // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,10 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include - #include #include "btss164.h" @@ -118,14 +114,14 @@ void BtSs164::processCommand(RDMacro *cmd) switch(cmd->command()) { case RDMacro::GO: if((cmd->argQuantity()!=5)|| - ((cmd->arg(1).lower()!="i")&& - (cmd->arg(1).lower()!="o"))|| + ((cmd->arg(1).toLower()!="i")&& + (cmd->arg(1).toLower()!="o"))|| (cmd->arg(2).toInt()<1)||(cmd->arg(3).toInt()>bt_gpos)|| (cmd->arg(2).toInt()>bt_gpos)|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(1).lower()!="i"))|| + (cmd->arg(1).toLower()!="i"))|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).lower()=="i"))|| + (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).toLower()=="i"))|| (cmd->arg(4).toInt()<0)) { cmd->acknowledge(false); emit rmlEcho(cmd); @@ -133,14 +129,14 @@ void BtSs164::processCommand(RDMacro *cmd) } if(cmd->arg(3).toInt()==0) { // Turn OFF if(cmd->arg(4).toInt()==0) { - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,false); bt_gpi_state[cmd->arg(2).toInt()-1]=false; } bt_gpi_mask[cmd->arg(2).toInt()-1]=true; } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { if(cmd->arg(2).toInt()<8) { sprintf(str,"*%dOR%dF",BTSS164_UNIT_ID,cmd->arg(2).toInt()); bt_device->write(str,6); @@ -168,14 +164,14 @@ void BtSs164::processCommand(RDMacro *cmd) } else { if(cmd->arg(4).toInt()==0) { // Turn ON - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(!bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,true); bt_gpi_state[cmd->arg(2).toInt()-1]=true; } bt_gpi_mask[cmd->arg(2).toInt()-1]=true; } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { if(cmd->arg(2).toInt()<8) { sprintf(str,"*%dOR%dL",BTSS164_UNIT_ID,cmd->arg(2).toInt()); bt_device->write(str,6); @@ -189,7 +185,7 @@ void BtSs164::processCommand(RDMacro *cmd) } } else { // Pulse - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(!bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,true); bt_gpi_state[cmd->arg(2).toInt()-1]=true; @@ -197,7 +193,7 @@ void BtSs164::processCommand(RDMacro *cmd) bt_gpi_mask[cmd->arg(2).toInt()-1]=true; bt_gpi_oneshot->start(cmd->arg(2).toInt()-1,500); } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { if(cmd->arg(2).toInt()<8) { sprintf(str,"*%dOR%dP",BTSS164_UNIT_ID,cmd->arg(2).toInt()); bt_device->write(str,6); diff --git a/ripcd/btss21.cpp b/ripcd/btss21.cpp index 6014c82e..9716090a 100644 --- a/ripcd/btss21.cpp +++ b/ripcd/btss21.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for the BroadcastTools SS 2.1 // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,11 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - -#include - #include #include "btss21.h" @@ -48,7 +43,7 @@ BtSs21::BtSs21(RDMatrix *matrix,QObject *parent) bt_device->setSpeed(tty->baudRate()); bt_device->setWordLength(tty->dataBits()); bt_device->setParity(tty->parity()); - bt_device->open(QIODevice::IO_WriteOnly); + bt_device->open(QIODevice::WriteOnly); } delete tty; } @@ -104,11 +99,11 @@ void BtSs21::processCommand(RDMacro *cmd) } if(cmd->arg(1).toInt()==0) { str=QString().sprintf("*%dM",BTSS21_UNIT_ID); - bt_device->write(str,str.length()); + bt_device->write(str.toUtf8()); } else { str=QString().sprintf("*%d%d",BTSS21_UNIT_ID,cmd->arg(1).toInt()); - bt_device->write(str,str.length()); + bt_device->write(str.toUtf8()); } cmd->acknowledge(true); emit rmlEcho(cmd); diff --git a/ripcd/btss41mlr.cpp b/ripcd/btss41mlr.cpp index 6d6867ea..180a2057 100644 --- a/ripcd/btss41mlr.cpp +++ b/ripcd/btss41mlr.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for the BroadcastTools SS 4.1 MLR // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,11 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include -#include - #include #include "btss41mlr.h" @@ -126,12 +121,12 @@ void BtSs41Mlr::processCommand(RDMacro *cmd) } if(cmd->arg(1).toInt()==0) { str=QString().sprintf("*%dMA",BTSS41MLR_UNIT_ID); - bt_device->write(str,str.length()); + bt_device->write(str.toUtf8()); } else { str=QString().sprintf("*%d%02d",BTSS41MLR_UNIT_ID, cmd->arg(1).toInt()); - bt_device->write(str,str.length()); + bt_device->write(str.toUtf8()); } cmd->acknowledge(true); emit rmlEcho(cmd); diff --git a/ripcd/btss42.cpp b/ripcd/btss42.cpp index 0593afbd..be76c3c5 100644 --- a/ripcd/btss42.cpp +++ b/ripcd/btss42.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for the BroadcastTools SS 4.2 // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,10 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include - #include #include "btss42.h" @@ -118,14 +114,14 @@ void BtSs42::processCommand(RDMacro *cmd) switch(cmd->command()) { case RDMacro::GO: if((cmd->argQuantity()!=5)|| - ((cmd->arg(1).lower()!="i")&& - (cmd->arg(1).lower()!="o"))|| + ((cmd->arg(1).toLower()!="i")&& + (cmd->arg(1).toLower()!="o"))|| (cmd->arg(2).toInt()<1)||(cmd->arg(3).toInt()>bt_gpos)|| (cmd->arg(2).toInt()>bt_gpos)|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(1).lower()!="i"))|| + (cmd->arg(1).toLower()!="i"))|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).lower()=="i"))|| + (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).toLower()=="i"))|| (cmd->arg(4).toInt()<0)) { cmd->acknowledge(false); emit rmlEcho(cmd); @@ -133,14 +129,14 @@ void BtSs42::processCommand(RDMacro *cmd) } if(cmd->arg(3).toInt()==0) { // Turn OFF if(cmd->arg(4).toInt()==0) { - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,false); bt_gpi_state[cmd->arg(2).toInt()-1]=false; } bt_gpi_mask[cmd->arg(2).toInt()-1]=true; } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { if(cmd->arg(2).toInt()<=4) { sprintf(str,"*%dOO%dF",BTSS42_UNIT_ID,cmd->arg(2).toInt()); } @@ -166,14 +162,14 @@ void BtSs42::processCommand(RDMacro *cmd) } else { if(cmd->arg(4).toInt()==0) { // Turn ON - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(!bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,true); bt_gpi_state[cmd->arg(2).toInt()-1]=true; } bt_gpi_mask[cmd->arg(2).toInt()-1]=true; } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { if(cmd->arg(2).toInt()<=4) { sprintf(str,"*%dOO%dL",BTSS42_UNIT_ID,cmd->arg(2).toInt()); } @@ -185,7 +181,7 @@ void BtSs42::processCommand(RDMacro *cmd) } } else { // Pulse - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(!bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,true); bt_gpi_state[cmd->arg(2).toInt()-1]=true; @@ -193,7 +189,7 @@ void BtSs42::processCommand(RDMacro *cmd) bt_gpi_mask[cmd->arg(2).toInt()-1]=true; bt_gpi_oneshot->start(cmd->arg(2).toInt()-1,500); } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { if(cmd->arg(2).toInt()<=4) { sprintf(str,"*%dOO%dP",BTSS42_UNIT_ID,cmd->arg(2).toInt()); } diff --git a/ripcd/btss44.cpp b/ripcd/btss44.cpp index e3d41cf5..9ac3ac2c 100644 --- a/ripcd/btss44.cpp +++ b/ripcd/btss44.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for the BroadcastTools SS 4.4 // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,10 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include - #include #include "btss44.h" @@ -119,14 +115,14 @@ void BtSs44::processCommand(RDMacro *cmd) case RDMacro::GO: // NEW if((cmd->argQuantity()!=5)|| - ((cmd->arg(1).lower()!="i")&& - (cmd->arg(1).lower()!="o"))|| + ((cmd->arg(1).toLower()!="i")&& + (cmd->arg(1).toLower()!="o"))|| (cmd->arg(2).toInt()<1)||(cmd->arg(3).toInt()>bt_gpos)|| (cmd->arg(2).toInt()>bt_gpos)|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(1).lower()!="i"))|| + (cmd->arg(1).toLower()!="i"))|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).lower()=="i"))|| + (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).toLower()=="i"))|| (cmd->arg(4).toInt()<0)) { cmd->acknowledge(false); emit rmlEcho(cmd); @@ -134,14 +130,14 @@ void BtSs44::processCommand(RDMacro *cmd) } if(cmd->arg(3).toInt()==0) { // Turn OFF if(cmd->arg(4).toInt()==0) { - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,false); bt_gpi_state[cmd->arg(2).toInt()-1]=false; } bt_gpi_mask[cmd->arg(2).toInt()-1]=true; } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { if(cmd->arg(2).toInt()<=4) { sprintf(str,"*%dOO%dF",BTSS44_UNIT_ID,cmd->arg(2).toInt()); } @@ -167,14 +163,14 @@ void BtSs44::processCommand(RDMacro *cmd) } else { if(cmd->arg(4).toInt()==0) { // Turn ON - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(!bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,true); bt_gpi_state[cmd->arg(2).toInt()-1]=true; } bt_gpi_mask[cmd->arg(2).toInt()-1]=true; } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { if(cmd->arg(2).toInt()<=4) { sprintf(str,"*%dOO%dL",BTSS44_UNIT_ID,cmd->arg(2).toInt()); } @@ -186,7 +182,7 @@ void BtSs44::processCommand(RDMacro *cmd) } } else { // Pulse - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(!bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,true); bt_gpi_state[cmd->arg(2).toInt()-1]=true; @@ -194,7 +190,7 @@ void BtSs44::processCommand(RDMacro *cmd) bt_gpi_mask[cmd->arg(2).toInt()-1]=true; bt_gpi_oneshot->start(cmd->arg(2).toInt()-1,500); } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { if(cmd->arg(2).toInt()<=4) { sprintf(str,"*%dOO%dP",BTSS44_UNIT_ID,cmd->arg(2).toInt()); } diff --git a/ripcd/btss82.cpp b/ripcd/btss82.cpp index 31047673..fd2dffc4 100644 --- a/ripcd/btss82.cpp +++ b/ripcd/btss82.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for the BroadcastTools SS 8.2 // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,10 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include - #include #include "btss82.h" @@ -118,14 +114,14 @@ void BtSs82::processCommand(RDMacro *cmd) switch(cmd->command()) { case RDMacro::GO: if((cmd->argQuantity()!=5)|| - ((cmd->arg(1).lower()!="i")&& - (cmd->arg(1).lower()!="o"))|| + ((cmd->arg(1).toLower()!="i")&& + (cmd->arg(1).toLower()!="o"))|| (cmd->arg(2).toInt()<1)||(cmd->arg(3).toInt()>bt_gpos)|| (cmd->arg(2).toInt()>bt_gpos)|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(1).lower()!="i"))|| + (cmd->arg(1).toLower()!="i"))|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).lower()=="i"))|| + (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).toLower()=="i"))|| (cmd->arg(4).toInt()<0)) { cmd->acknowledge(false); emit rmlEcho(cmd); @@ -133,14 +129,14 @@ void BtSs82::processCommand(RDMacro *cmd) } if(cmd->arg(3).toInt()==0) { // Turn OFF if(cmd->arg(4).toInt()==0) { - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,false); bt_gpi_state[cmd->arg(2).toInt()-1]=false; } bt_gpi_mask[cmd->arg(2).toInt()-1]=true; } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { sprintf(str,"*%dOR%dF",BTSS82_UNIT_ID,cmd->arg(2).toInt()); bt_device->write(str,6); emit gpoChanged(bt_matrix,cmd->arg(2).toInt()-1,false); @@ -161,21 +157,21 @@ void BtSs82::processCommand(RDMacro *cmd) } else { if(cmd->arg(4).toInt()==0) { // Turn ON - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(!bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,true); bt_gpi_state[cmd->arg(2).toInt()-1]=true; } bt_gpi_mask[cmd->arg(2).toInt()-1]=true; } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { sprintf(str,"*%dOR%dL",BTSS82_UNIT_ID,cmd->arg(2).toInt()); bt_device->write(str,6); emit gpoChanged(bt_matrix,cmd->arg(2).toInt()-1,true); } } else { // Pulse - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(!bt_gpi_state[cmd->arg(2).toInt()-1]) { emit gpiChanged(bt_matrix,cmd->arg(2).toInt()-1,true); bt_gpi_state[cmd->arg(2).toInt()-1]=true; @@ -183,7 +179,7 @@ void BtSs82::processCommand(RDMacro *cmd) bt_gpi_mask[cmd->arg(2).toInt()-1]=true; bt_gpi_oneshot->start(cmd->arg(2).toInt()-1,500); } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { sprintf(str,"*%dOR%dP",BTSS82_UNIT_ID,cmd->arg(2).toInt()); bt_device->write(str,6); emit gpoChanged(bt_matrix,cmd->arg(2).toInt()-1,true); diff --git a/ripcd/btu41mlrweb.cpp b/ripcd/btu41mlrweb.cpp index 7a805615..56cc92a1 100644 --- a/ripcd/btu41mlrweb.cpp +++ b/ripcd/btu41mlrweb.cpp @@ -2,7 +2,7 @@ // // Rivendell switcher driver for the BroadcastTools Universal 4.1 MLR>>Web // -// (C) Copyright 2017-2020 Fred Gleason +// (C) Copyright 2017-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -115,7 +115,7 @@ void BtU41MlrWeb::connectedData() { rda->syslog(LOG_INFO, "connection to BroadcastTools device at %s:%u established", - (const char *)bt_ip_address.toString(),0xffff&bt_ip_port); + bt_ip_address.toString().toUtf8().constData(),0xffff&bt_ip_port); bt_watchdog_active=false; SendCommand("*0SPA"); bt_keepalive_timer->start(BTU41MLRWEB_KEEPALIVE_INTERVAL); @@ -128,7 +128,7 @@ void BtU41MlrWeb::readyReadData() char data[1501]; int n=0; - while((n=bt_socket->readBlock(data,1500))>0) { + while((n=bt_socket->read(data,1500))>0) { data[n]=0; for(int i=0;isyslog(LOG_WARNING, "connection to BroadcastTools device at %s:%u lost, attempting reconnect", - (const char *)bt_ip_address.toString(),0xffff&bt_ip_port); + bt_ip_address.toString().toUtf8().constData(), + 0xffff&bt_ip_port); bt_keepalive_timer->stop(); bt_watchdog_active=true; } @@ -198,5 +199,5 @@ void BtU41MlrWeb::ProcessCommand(const QString &cmd) void BtU41MlrWeb::SendCommand(const QString &cmd) { - bt_socket->writeBlock(cmd,cmd.length()); + bt_socket->write(cmd.toUtf8()); } diff --git a/ripcd/gvc7000.cpp b/ripcd/gvc7000.cpp index 7647f7cd..81924825 100644 --- a/ripcd/gvc7000.cpp +++ b/ripcd/gvc7000.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for Grass Valley Series 7000 Protocol // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,11 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - -#include - #include #include "gvc7000.h" @@ -151,7 +146,7 @@ void Gvc7000::disconnectedData() rda->syslog(LOG_WARNING, "connection to Gvc7000 device at %s:%d closed unexpectedly, attempting reconnect", (const char *)gvc_ipaddress.toString().toUtf8(),gvc_ipport); - gvc_reconnect_timer->start(GVC7000_RECONNECT_INTERVAL,true); + gvc_reconnect_timer->start(GVC7000_RECONNECT_INTERVAL); } @@ -162,7 +157,7 @@ void Gvc7000::errorData(QAbstractSocket::SocketError err) rda->syslog(LOG_WARNING, "connection to Gvc7000 device at %s:%d refused, attempting reconnect", (const char *)gvc_ipaddress.toString().toUtf8(),gvc_ipport); - gvc_reconnect_timer->start(GVC7000_RECONNECT_INTERVAL,true); + gvc_reconnect_timer->start(GVC7000_RECONNECT_INTERVAL); break; case QAbstractSocket::HostNotFoundError: diff --git a/ripcd/harlond.cpp b/ripcd/harlond.cpp index 8374cf5e..fedf27b8 100644 --- a/ripcd/harlond.cpp +++ b/ripcd/harlond.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for the Harlond Virtual Mixer // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,8 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - #include #include "globals.h" @@ -50,6 +48,7 @@ Harlond::Harlond(RDMatrix *matrix,QObject *parent) for(int i=0;isetSingleShot(true); bt_reset_mapper->setMapping(bt_reset_timers.back(),i); connect(bt_reset_timers.back(),SIGNAL(timeout()), bt_reset_mapper,SLOT(map())); @@ -65,8 +64,9 @@ Harlond::Harlond(RDMatrix *matrix,QObject *parent) connect(bt_socket,SIGNAL(error(QAbstractSocket::SocketError)), this,SLOT(socketErrorData(QAbstractSocket::SocketError))); bt_watchdog_timer=new QTimer(this); + bt_watchdog_timer->setSingleShot(true); connect(bt_watchdog_timer,SIGNAL(timeout()),this,SLOT(watchdogTimeoutData())); - bt_watchdog_timer->start(5000,true); + bt_watchdog_timer->start(5000); } @@ -193,7 +193,7 @@ void Harlond::resetTimeoutData(int line) void Harlond::socketConnectedData() { QString str=QString("PW ")+bt_password+"!"; - bt_socket->writeBlock(str,str.length()); + bt_socket->write(str.toUtf8()); if(bt_start_cart>0) { executeMacroCart(bt_start_cart); } @@ -202,7 +202,7 @@ void Harlond::socketConnectedData() void Harlond::socketDisconnectedData() { - bt_watchdog_timer->start(HARLOND_RECONNECT_INTERVAL,true); + bt_watchdog_timer->start(HARLOND_RECONNECT_INTERVAL); rda->syslog(LOG_WARNING, "connection to harlond device at %s:%d closed, attempting reconnect", (const char *)bt_ip_address.toString().toUtf8(), @@ -217,7 +217,7 @@ void Harlond::socketReadyReadData() { char data[1500]; int n; - while((n=bt_socket->readBlock(data,1500))>0) { + while((n=bt_socket->read(data,1500))>0) { for(int i=0;istart(HARLOND_RECONNECT_INTERVAL,true); + bt_watchdog_timer->start(HARLOND_RECONNECT_INTERVAL); switch(err) { case QAbstractSocket::ConnectionRefusedError: rda->syslog(LOG_WARNING, @@ -255,7 +255,7 @@ void Harlond::socketErrorData(QAbstractSocket::SocketError err) void Harlond::watchdogTimeoutData() { - if(bt_socket->state()!=QAbstractSocket::Connected) { + if(bt_socket->state()!=QAbstractSocket::ConnectedState) { bt_socket->connectToHost(bt_ip_address.toString(),bt_tcp_port); } } @@ -273,7 +273,7 @@ void Harlond::ProcessResponse(const QString &str) "connection to harlond device at %s:%d established", (const char *)bt_ip_address.toString().toUtf8(), bt_tcp_port); - bt_socket->writeBlock("SS!",3); + bt_socket->write("SS!",3); return; } } @@ -300,7 +300,7 @@ void Harlond::ProcessResponse(const QString &str) bool Harlond::ProcessSalvo(const QString &str) { QString arg=QString("LL ")+str+"!"; - bt_socket->writeBlock(arg,arg.length()); + bt_socket->write(arg.toUtf8()); return true; } @@ -318,10 +318,10 @@ bool Harlond::ProcessGpo(int line,bool state,int msecs) } bt_reset_states[line]=state; str=code+QString().sprintf(" %02d!",line); - bt_socket->writeBlock(str,str.length()); + bt_socket->write(str.toUtf8()); bt_reset_timers[line]->stop(); if(msecs>0) { - bt_reset_timers[line]->start(msecs,true); + bt_reset_timers[line]->start(msecs); } return true; @@ -336,7 +336,7 @@ bool Harlond::SetInputLevel(int input,int db) return false; } str=QString().sprintf("VL %02d %04d!",input,db); - bt_socket->writeBlock(str,str.length()); + bt_socket->write(str.toUtf8()); return true; } @@ -399,7 +399,7 @@ bool Harlond::AddCrosspoint(int input,int output) return false; } str=code+QString().sprintf(" %02d +!",input); - bt_socket->writeBlock(str,str.length()); + bt_socket->write(str.toUtf8()); return true; } @@ -413,7 +413,7 @@ bool Harlond::RemoveCrosspoint(int input,int output) return false; } str=code+QString().sprintf(" %02d -!",input); - bt_socket->writeBlock(str,str.length()); + bt_socket->write(str.toUtf8()); return true; } diff --git a/ripcd/kernelgpio.cpp b/ripcd/kernelgpio.cpp index ee12b3da..00e565c0 100644 --- a/ripcd/kernelgpio.cpp +++ b/ripcd/kernelgpio.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for the Kernel GPIO interface. // -// (C) Copyright 2017 Fred Gleason +// (C) Copyright 2017-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,10 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include - #include "kernelgpio.h" KernelGpio::KernelGpio(RDMatrix *matrix,QObject *parent) @@ -54,6 +50,7 @@ KernelGpio::KernelGpio(RDMatrix *matrix,QObject *parent) gpio_gpi_mask.push_back(false); gpio_reset_states.push_back(false); gpio_reset_timers.push_back(new QTimer(this)); + gpio_reset_timers.back()->setSingleShot(true); connect(gpio_reset_timers.back(),SIGNAL(timeout()), gpio_reset_mapper,SLOT(map())); gpio_reset_mapper->setMapping(gpio_reset_timers.back(),i); @@ -113,8 +110,8 @@ void KernelGpio::processCommand(RDMacro *cmd) switch(cmd->command()) { case RDMacro::GO: if((cmd->argQuantity()!=5)|| - ((cmd->arg(1).lower()!="i")&& - (cmd->arg(1).lower()!="o"))|| + ((cmd->arg(1).toLower()!="i")&& + (cmd->arg(1).toLower()!="o"))|| (cmd->arg(2).toInt()<1)||(cmd->arg(2).toInt()>gpio_gpos)|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& (cmd->arg(3).toInt()!=-1))||(cmd->arg(4).toInt()<0)) { @@ -122,7 +119,7 @@ void KernelGpio::processCommand(RDMacro *cmd) emit rmlEcho(cmd); return; } - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(cmd->arg(3).toInt()==0) { emit gpiChanged(gpio_matrix,cmd->arg(2).toInt()-1,false); gpio_gpi_mask[cmd->arg(2).toInt()-1]=true; @@ -148,13 +145,13 @@ void KernelGpio::processCommand(RDMacro *cmd) emit rmlEcho(cmd); return; } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { if(cmd->arg(3).toInt()==0) { gpio_gpio->setValue(gpio_gpis+cmd->arg(2).toInt()-1,false); if(cmd->arg(4).toInt()>0) { gpio_reset_states[cmd->arg(2).toInt()-1]=true; gpio_reset_timers[cmd->arg(2).toInt()-1]-> - start(cmd->arg(4).toInt(),true); + start(cmd->arg(4).toInt()); } } else { @@ -163,7 +160,7 @@ void KernelGpio::processCommand(RDMacro *cmd) if(cmd->arg(4).toInt()>0) { gpio_reset_states[cmd->arg(2).toInt()-1]=false; gpio_reset_timers[cmd->arg(2).toInt()-1]-> - start(cmd->arg(4).toInt(),true); + start(cmd->arg(4).toInt()); } } else { diff --git a/ripcd/livewire_lwrpaudio.cpp b/ripcd/livewire_lwrpaudio.cpp index c363cf37..5057e74d 100644 --- a/ripcd/livewire_lwrpaudio.cpp +++ b/ripcd/livewire_lwrpaudio.cpp @@ -2,7 +2,7 @@ // // A Rivendell LWRP audio switcher driver for LiveWire networks. // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,9 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - #include #include #include @@ -233,5 +230,5 @@ void LiveWireLwrpAudio::destinationChangedData(unsigned id,RDLiveWireDestination void LiveWireLwrpAudio::watchdogStateChangedData(unsigned id,const QString &msg) { - rda->syslog(LOG_WARNING,msg); + rda->syslog(LOG_WARNING,"%s",msg.toUtf8().constData()); } diff --git a/ripcd/livewire_lwrpaudio.h b/ripcd/livewire_lwrpaudio.h index 5167d568..2e603a8f 100644 --- a/ripcd/livewire_lwrpaudio.h +++ b/ripcd/livewire_lwrpaudio.h @@ -2,7 +2,7 @@ // // A Rivendell LWRP audio switcher driver for LiveWire networks. // -// (C) Copyright 2002-2013,2016 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -21,12 +21,6 @@ #ifndef LIVEWIRE_LWRPAUDIO_H #define LIVEWIRE_LWRPAUDIO_H -#include - -#include -#include -#include - #include #include #include diff --git a/ripcd/livewire_lwrpgpio.cpp b/ripcd/livewire_lwrpgpio.cpp index dd015466..b9675f95 100644 --- a/ripcd/livewire_lwrpgpio.cpp +++ b/ripcd/livewire_lwrpgpio.cpp @@ -2,7 +2,7 @@ // // A Rivendell LWRP GPIO driver for LiveWire networks. // -// (C) Copyright 2013-2019 Fred Gleason +// (C) Copyright 2013-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -100,15 +100,15 @@ void LiveWireLwrpGpio::processCommand(RDMacro *cmd) case RDMacro::GO: if((cmd->argQuantity()!=5)|| (cmd->arg(2).toInt()<1)|| - ((cmd->arg(1).lower()!="i")&& - (cmd->arg(1).lower()!="o"))) { + ((cmd->arg(1).toLower()!="i")&& + (cmd->arg(1).toLower()!="o"))) { cmd->acknowledge(false); emit rmlEcho(cmd); return; } - if(((cmd->arg(1).lower()=="i")&& + if(((cmd->arg(1).toLower()=="i")&& (cmd->arg(2).toUInt()>gpio_gpi_limit))|| - ((cmd->arg(1).lower()=="o")&& + ((cmd->arg(1).toLower()=="o")&& (cmd->arg(2).toUInt()>gpio_gpo_limit))) { cmd->acknowledge(false); emit rmlEcho(cmd); @@ -116,7 +116,7 @@ void LiveWireLwrpGpio::processCommand(RDMacro *cmd) } slot=(cmd->arg(2).toInt()-1)/5; line=(cmd->arg(2).toInt()-1)%5; - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(cmd->arg(3).toInt()==0) { if(gpio_is_virtual) { gpio_livewire->gpoReset(slot,line,cmd->arg(4).toInt()); @@ -134,7 +134,7 @@ void LiveWireLwrpGpio::processCommand(RDMacro *cmd) } } } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { if(cmd->arg(3).toInt()==0) { if(gpio_is_virtual) { gpio_livewire->gpiReset(slot,line,cmd->arg(4).toInt()); @@ -207,8 +207,8 @@ void LiveWireLwrpGpio::connectedData(unsigned id) } rda->syslog(LOG_DEBUG,"livewire LWRP gpio driver connected to %s at %s:%d", - (const char *)gpio_livewire->deviceName(), - (const char *)gpio_livewire->hostname(), + gpio_livewire->deviceName().toUtf8().constData(), + gpio_livewire->hostname().toUtf8().constData(), 0xFFFF&gpio_livewire->tcpPort()); } @@ -217,8 +217,8 @@ void LiveWireLwrpGpio::watchdogStateChangedData(unsigned id,const QString &msg) { rda->syslog(LOG_WARNING, "livewire LWRP driver watchdog update for device %s at %s:%d: %s", - (const char *)gpio_livewire->deviceName(), - (const char *)gpio_livewire->hostname(), + gpio_livewire->deviceName().toUtf8().constData(), + gpio_livewire->hostname().toUtf8().constData(), 0xFFFF&gpio_livewire->tcpPort(), - (const char *)msg); + msg.toUtf8().constData()); } diff --git a/ripcd/livewire_lwrpgpio.h b/ripcd/livewire_lwrpgpio.h index 83a0dd77..b000d08d 100644 --- a/ripcd/livewire_lwrpgpio.h +++ b/ripcd/livewire_lwrpgpio.h @@ -2,7 +2,7 @@ // // A Rivendell LWRP GPIO driver for LiveWire networks. // -// (C) Copyright 2013,2016 Fred Gleason +// (C) Copyright 2013-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -21,17 +21,6 @@ #ifndef LIVEWIRE_LWRPGPIO_H #define LIVEWIRE_LWRPGPIO_H -#include -#include - -#include - -#include -#include -#include -#include -#include - #include #include #include diff --git a/ripcd/livewire_mcastgpio.cpp b/ripcd/livewire_mcastgpio.cpp index 7e2684f6..c5529945 100644 --- a/ripcd/livewire_mcastgpio.cpp +++ b/ripcd/livewire_mcastgpio.cpp @@ -2,7 +2,7 @@ // // A Rivendell multicast GPIO driver for LiveWire networks. // -// (C) Copyright 2013-2019 Fred Gleason +// (C) Copyright 2013-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -67,6 +67,7 @@ LiveWireMcastGpio::LiveWireMcastGpio(RDMatrix *matrix,QObject *parent) this,SLOT(gpiTimeoutData(int))); for(unsigned i=0;isetSingleShot(true); livewire_gpi_timer_mapper->setMapping(livewire_gpi_timers.back(),i); connect(livewire_gpi_timers.back(),SIGNAL(timeout()), livewire_gpi_timer_mapper,SLOT(map())); @@ -76,6 +77,7 @@ LiveWireMcastGpio::LiveWireMcastGpio(RDMatrix *matrix,QObject *parent) this,SLOT(gpoOutTimeoutData(int))); for(unsigned i=0;isetSingleShot(true); livewire_gpo_out_timer_mapper->setMapping(livewire_gpo_out_timers.back(),i); connect(livewire_gpo_out_timers.back(),SIGNAL(timeout()), livewire_gpo_out_timer_mapper,SLOT(map())); @@ -87,6 +89,7 @@ LiveWireMcastGpio::LiveWireMcastGpio(RDMatrix *matrix,QObject *parent) this,SLOT(gpoInTimeoutData(int))); for(unsigned i=0;isetSingleShot(true); livewire_gpo_in_timer_mapper->setMapping(livewire_gpo_in_timers.back(),i); connect(livewire_gpo_in_timers.back(),SIGNAL(timeout()), livewire_gpo_in_timer_mapper,SLOT(map())); @@ -107,7 +110,7 @@ LiveWireMcastGpio::LiveWireMcastGpio(RDMatrix *matrix,QObject *parent) sa.sin_family=AF_INET; sa.sin_port=htons(htons(RD_LIVEWIRE_GPIO_SEND_PORT)); sa.sin_addr.s_addr= - htonl(matrix->ipAddress(RDMatrix::Primary).ip4Addr()); + htonl(matrix->ipAddress(RDMatrix::Primary).toIPv4Address()); if(bind(livewire_gpio_write_socket,(struct sockaddr *)&sa,sizeof(sa))<0) { rda->syslog(LOG_ERR,"unable to bind GPIO write socket [%s]", strerror(errno)); @@ -220,14 +223,14 @@ void LiveWireMcastGpio::processCommand(RDMacro *cmd) if((cmd->argQuantity()!=5)|| (cmd->arg(2).toInt()<1)|| (cmd->arg(2).toInt()>(int)livewire_gpios)|| - ((cmd->arg(1).lower()!="i")&& - (cmd->arg(1).lower()!="o"))) { + ((cmd->arg(1).toLower()!="i")&& + (cmd->arg(1).toLower()!="o"))) { cmd->acknowledge(false); emit rmlEcho(cmd); return; } - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { slot=(cmd->arg(2).toInt()-1)/5; line=(cmd->arg(2).toInt()-1)%5; if(livewire_source_numbers[slot]<=0) { @@ -237,12 +240,12 @@ void LiveWireMcastGpio::processCommand(RDMacro *cmd) } if(cmd->arg(4).toInt()>0) { livewire_gpo_in_timers[cmd->arg(2).toInt()-1]-> - start(cmd->arg(4).toInt(),true); + start(cmd->arg(4).toInt()); } ProcessGpoIn(livewire_source_numbers[slot],line,cmd->arg(3).toInt()); livewire_gpo_in_states[cmd->arg(2).toInt()-1]=cmd->arg(3).toInt(); } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { slot=(cmd->arg(2).toInt()-1)/5; line=(cmd->arg(2).toInt()-1)%5; if(livewire_source_numbers[slot]<=0) { @@ -252,7 +255,7 @@ void LiveWireMcastGpio::processCommand(RDMacro *cmd) } if(cmd->arg(4).toInt()>0) { livewire_gpo_out_timers[cmd->arg(2).toInt()-1]-> - start(cmd->arg(4).toInt(),true); + start(cmd->arg(4).toInt()); } ProcessGpoOut(livewire_source_numbers[slot],line,cmd->arg(3).toInt()); livewire_gpo_out_states[cmd->arg(2).toInt()-1]=cmd->arg(3).toInt(); @@ -333,7 +336,7 @@ void LiveWireMcastGpio::ProcessGpi(const QHostAddress &src_addr,int chan, emit gpiChanged(livewire_matrix,5*it->first+line,state); if(pulse) { livewire_gpi_timers[5*it->first+line]-> - start(RD_LIVEWIRE_GPIO_PULSE_WIDTH,true); + start(RD_LIVEWIRE_GPIO_PULSE_WIDTH); } } } @@ -469,8 +472,8 @@ void LiveWireMcastGpio::subscribe(const uint32_t addr) const sizeof(mreq))!=0) { if(errno!=EADDRINUSE) { rda->syslog(LOG_WARNING,"unable to subscribe to %s on %s [%s]", - (const char *)AddressString(addr), - (const char *)livewire_interface_addr.toString(), + AddressString(addr).toUtf8().constData(), + livewire_interface_addr.toString().toUtf8().constData(), strerror(errno)); } } @@ -495,8 +498,8 @@ void LiveWireMcastGpio::unsubscribe(const uint32_t addr) const sizeof(mreq))!=0) { if(errno!=ENODEV) { rda->syslog(LOG_WARNING,"unable to unsubscribe from %s on %s [%s]", - (const char *)AddressString(addr), - (const char *)livewire_interface_addr.toString(), + AddressString(addr).toUtf8().constData(), + livewire_interface_addr.toString().toUtf8().constData(), strerror(errno)); } } diff --git a/ripcd/livewire_mcastgpio.h b/ripcd/livewire_mcastgpio.h index 6b70e87c..f44883b2 100644 --- a/ripcd/livewire_mcastgpio.h +++ b/ripcd/livewire_mcastgpio.h @@ -2,7 +2,7 @@ // // A Rivendell multicast GPIO driver for LiveWire networks. // -// (C) Copyright 2013,2016 Fred Gleason +// (C) Copyright 2013-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -21,17 +21,7 @@ #ifndef LIVEWIRE_MCASTGPIO_H #define LIVEWIRE_MCASTGPIO_H -#include -#include - -#include -#include - -#include -#include -#include -#include -#include +#include #include #include diff --git a/ripcd/local_audio.cpp b/ripcd/local_audio.cpp index c034ca64..9dd92a87 100644 --- a/ripcd/local_audio.cpp +++ b/ripcd/local_audio.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for local audio cards. // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,9 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - #include #include @@ -102,14 +99,14 @@ void LocalAudio::processCommand(RDMacro *cmd) switch(cmd->command()) { case RDMacro::GO: if((cmd->argQuantity()!=5)|| - ((cmd->arg(1).lower()!="i")&& - (cmd->arg(1).lower()!="o"))|| + ((cmd->arg(1).toLower()!="i")&& + (cmd->arg(1).toLower()!="o"))|| (cmd->arg(2).toInt()<1)||(cmd->arg(3).toInt()>bt_gpos)|| (cmd->arg(2).toInt()>bt_gpos)|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(1).lower()!="i"))|| + (cmd->arg(1).toLower()!="i"))|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).lower()=="i"))|| + (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).toLower()=="i"))|| (cmd->arg(4).toInt()<0)) { cmd->acknowledge(false); emit rmlEcho(cmd); @@ -117,7 +114,7 @@ void LocalAudio::processCommand(RDMacro *cmd) } if(cmd->arg(3).toInt()==0) { // Turn OFF if(cmd->arg(4).toInt()==0) { - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { SetGpo(cmd->arg(2).toInt()-1,false); emit gpoChanged(matrixNumber(),cmd->arg(2).toInt()-1,false); } @@ -133,13 +130,13 @@ void LocalAudio::processCommand(RDMacro *cmd) else { if(cmd->arg(3).toInt()!=-1) { if(cmd->arg(4).toInt()==0) { // Turn ON - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { SetGpo(cmd->arg(2).toInt()-1,true); emit gpoChanged(matrixNumber(),cmd->arg(2).toInt()-1,true); } } else { // Pulse - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { SetGpo(cmd->arg(2).toInt()-1,true); emit gpoChanged(matrixNumber(),cmd->arg(2).toInt()-1,true); bt_gpo_oneshot-> diff --git a/ripcd/local_gpio.cpp b/ripcd/local_gpio.cpp index c8a726f3..2192ede1 100644 --- a/ripcd/local_gpio.cpp +++ b/ripcd/local_gpio.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for MeasurementComputing GPIO cards. // -// (C) Copyright 2002-2003,2016 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,10 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include -#include +#include "local_gpio.h" LocalGpio::LocalGpio(RDMatrix *matrix,QObject *parent) : Switcher(matrix,parent) @@ -108,8 +105,8 @@ void LocalGpio::processCommand(RDMacro *cmd) switch(cmd->command()) { case RDMacro::GO: if((!gpio_open)||(cmd->argQuantity()!=5)|| - ((cmd->arg(1).lower()!="i")&& - (cmd->arg(1).lower()!="o"))|| + ((cmd->arg(1).toLower()!="i")&& + (cmd->arg(1).toLower()!="o"))|| (cmd->arg(2).toInt()<1)||(cmd->arg(2).toInt()>gpio_gpos)|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& (cmd->arg(3).toInt()!=-1))||(cmd->arg(4).toInt()<0)) { @@ -117,7 +114,7 @@ void LocalGpio::processCommand(RDMacro *cmd) emit rmlEcho(cmd); return; } - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(cmd->arg(3).toInt()==0) { emit gpiChanged(gpio_matrix,cmd->arg(2).toInt()-1,false); gpio_gpi_mask[cmd->arg(2).toInt()-1]=true; @@ -143,7 +140,7 @@ void LocalGpio::processCommand(RDMacro *cmd) emit rmlEcho(cmd); return; } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { if(cmd->arg(3).toInt()==0) { gpio_gpio->gpoReset(cmd->arg(2).toInt()-1,cmd->arg(4).toInt()); } diff --git a/ripcd/local_macros.cpp b/ripcd/local_macros.cpp index 63c49d97..75648e3a 100644 --- a/ripcd/local_macros.cpp +++ b/ripcd/local_macros.cpp @@ -2,7 +2,7 @@ // // Local RML Macros for the Rivendell Interprocess Communication Daemon // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -273,7 +273,7 @@ void MainObject::RunLocalMacros(RDMacro *rml_in) return; } for(int i=1;i<(rml->argQuantity());i++) { - sscanf((const char *)rml->arg(i),"%x",&d); + d=rml->arg(i).toInt(NULL,16); bin_buf[i-1]=0xFF&d; } ripcd_tty_dev[tty_port]->write(bin_buf,rml->argQuantity()-1); @@ -291,11 +291,11 @@ void MainObject::RunLocalMacros(RDMacro *rml_in) return; } matrix_num=rml->arg(0).toInt(); - if(rml->arg(1).lower()=="i") { + if(rml->arg(1).toLower()=="i") { gpio_type=RDMatrix::GpioInput; } else { - if(rml->arg(1).lower()=="o") { + if(rml->arg(1).toLower()=="o") { gpio_type=RDMatrix::GpioOutput; } else { @@ -350,11 +350,11 @@ void MainObject::RunLocalMacros(RDMacro *rml_in) return; } matrix_num=rml->arg(0).toInt(); - if(rml->arg(1).lower()=="i") { + if(rml->arg(1).toLower()=="i") { gpio_type=RDMatrix::GpioInput; } else { - if(rml->arg(1).lower()=="o") { + if(rml->arg(1).toLower()=="o") { gpio_type=RDMatrix::GpioOutput; } else { @@ -621,9 +621,9 @@ void MainObject::RunLocalMacros(RDMacro *rml_in) } if(system(QString(). sprintf("rdpopup -display %s %s %s", - (const char *)rml->arg(0), - (const char *)rml->arg(1), - (const char *)RDEscapeString(rml->rollupArgs(2))))<0) { + rml->arg(0).toUtf8().constData(), + rml->arg(1).toUtf8().constData(), + RDEscapeString(rml->rollupArgs(2)).toUtf8().constData()).toUtf8().constData())<0) { rda->syslog(LOG_WARNING,"RDPopup returned an error"); } exit(0); @@ -664,7 +664,7 @@ void MainObject::RunLocalMacros(RDMacro *rml_in) ripc_macro_cart[rml->arg(0).toUInt()-1]=rml->arg(2).toUInt(); ripc_macro_timer[rml->arg(0).toUInt()-1]->stop(); ripc_macro_timer[rml->arg(0).toUInt()-1]-> - start(rml->arg(1).toInt(),true); + start(rml->arg(1).toInt()); if(rml->echoRequested()) { rml->acknowledge(true); sendRml(rml); @@ -709,7 +709,7 @@ void MainObject::RunLocalMacros(RDMacro *rml_in) } str+=rml->arg(rml->argQuantity()-1); ripcd_tty_trap[tty_port]->addTrap(rml->arg(1).toInt(), - str,str.length()); + str.toUtf8(),str.toUtf8().length()); rda->syslog(LOG_DEBUG,"added trap \"%s\" to tty port %d", (const char *)str.toUtf8(),rml->arg(1).toInt()); rml->acknowledge(true); @@ -752,8 +752,8 @@ void MainObject::RunLocalMacros(RDMacro *rml_in) case 3: ripcd_tty_trap[tty_port]->removeTrap(rml->arg(1).toInt(), - (const char *)rml->arg(2), - rml->arg(2).length()); + rml->arg(2).toUtf8(), + rml->arg(2).toUtf8().length()); if(rml->echoRequested()) { rml->acknowledge(true); sendRml(rml); @@ -984,7 +984,7 @@ void MainObject::RunLocalMacros(RDMacro *rml_in) rda->syslog(LOG_INFO,"sending \"%s\" to %s:%d",(const char *)str.toUtf8(), (const char *)addr.toString().toUtf8(),rml->arg(1).toInt()); data=RDStringToData(str); - ripcd_rml_send->writeDatagram(data,addr,(Q_UINT16)(rml->arg(1).toInt())); + ripcd_rml_send->writeDatagram(data,addr,(uint16_t)(rml->arg(1).toInt())); if(rml->echoRequested()) { rml->acknowledge(true); sendRml(rml); diff --git a/ripcd/modbus.cpp b/ripcd/modbus.cpp index 61040f61..bc4e3c9d 100644 --- a/ripcd/modbus.cpp +++ b/ripcd/modbus.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for Modbus TCP // -// (C) Copyright 2017-2020 Fred Gleason +// (C) Copyright 2017-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -49,6 +49,7 @@ Modbus::Modbus(RDMatrix *matrix,QObject *parent) modbus_socket->connectToHost(modbus_ip_address.toString(),modbus_ip_port); modbus_poll_timer=new QTimer(this); + modbus_poll_timer->setSingleShot(true); connect(modbus_poll_timer,SIGNAL(timeout()),this,SLOT(pollInputs())); modbus_reset_mapper=new QSignalMapper(this); @@ -56,6 +57,7 @@ Modbus::Modbus(RDMatrix *matrix,QObject *parent) this,SLOT(resetStateData(int))); for(int i=0;isetSingleShot(true); connect(modbus_reset_timers.back(),SIGNAL(timeout()), modbus_reset_mapper,SLOT(map())); modbus_reset_mapper->setMapping(modbus_reset_timers.back(),i); @@ -63,6 +65,7 @@ Modbus::Modbus(RDMatrix *matrix,QObject *parent) } modbus_watchdog_timer=new QTimer(this); + modbus_watchdog_timer->setSingleShot(true); connect(modbus_watchdog_timer,SIGNAL(timeout()),this,SLOT(watchdogData())); } @@ -114,14 +117,14 @@ void Modbus::processCommand(RDMacro *cmd) switch(cmd->command()) { case RDMacro::GO: if((cmd->argQuantity()!=5)|| - ((cmd->arg(1).lower()!="i")&& - (cmd->arg(1).lower()!="o"))|| + ((cmd->arg(1).toLower()!="i")&& + (cmd->arg(1).toLower()!="o"))|| (cmd->arg(2).toInt()<1)||(cmd->arg(3).toInt()>modbus_gpos)|| (cmd->arg(2).toInt()>modbus_gpos)|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(1).lower()!="i"))|| + (cmd->arg(1).toLower()!="i"))|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).lower()=="i"))|| + (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).toLower()=="i"))|| (cmd->arg(4).toInt()<0)) { cmd->acknowledge(false); emit rmlEcho(cmd); @@ -129,7 +132,7 @@ void Modbus::processCommand(RDMacro *cmd) } if(cmd->arg(3).toInt()==0) { // Turn OFF if(cmd->arg(4).toInt()==0) { - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { SetCoil(cmd->arg(2).toInt()-1,false); emit gpoChanged(matrixNumber(),cmd->arg(2).toInt()-1,false); } @@ -144,17 +147,17 @@ void Modbus::processCommand(RDMacro *cmd) } else { if(cmd->arg(4).toInt()==0) { // Turn ON - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { SetCoil(cmd->arg(2).toInt()-1,true); emit gpoChanged(matrixNumber(),cmd->arg(2).toInt()-1,true); } } else { // Pulse - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { SetCoil(cmd->arg(2).toInt()-1,cmd->arg(3).toInt()!=0); modbus_reset_states[cmd->arg(2).toInt()-1]=cmd->arg(3).toInt()==0; modbus_reset_timers[cmd->arg(2).toInt()-1]-> - start(cmd->arg(4).toInt(),true); + start(cmd->arg(4).toInt()); emit gpoChanged(matrixNumber(),cmd->arg(2).toInt()-1, cmd->arg(3).toInt()!=0); } @@ -177,7 +180,8 @@ void Modbus::connectedData() { rda->syslog(LOG_INFO, "connection to Modbus device at %s:%u established", - (const char *)modbus_ip_address.toString(),0xffff&modbus_ip_port); + modbus_ip_address.toString().toUtf8().constData(), + 0xffff&modbus_ip_port); modbus_watchdog_active=false; modbus_busy=false; pollInputs(); @@ -194,9 +198,9 @@ void Modbus::readyReadData() int base=0; modbus_watchdog_timer->stop(); - modbus_watchdog_timer->start(MODBUS_WATCHDOG_INTERVAL,true); + modbus_watchdog_timer->start(MODBUS_WATCHDOG_INTERVAL); - while((n=modbus_socket->readBlock(data,1500))>0) { + while((n=modbus_socket->read(data,1500))>0) { // logBytes((uint8_t *)data,n); for(int i=0;istart(MODBUS_POLL_INTERVAL,true); + modbus_poll_timer->start(MODBUS_POLL_INTERVAL); modbus_istate=0; modbus_busy=false; if(modbus_coil_lines.size()>0) { @@ -312,7 +316,7 @@ void Modbus::errorData(QAbstractSocket::SocketError err) void Modbus::pollInputs() { if(modbus_busy) { - modbus_poll_timer->start(MODBUS_POLL_INTERVAL,true); + modbus_poll_timer->start(MODBUS_POLL_INTERVAL); return; } @@ -336,7 +340,7 @@ void Modbus::pollInputs() msg[10]=0xff&(modbus_gpis>>8); // Quantity of Inputs msg[11]=0xff&modbus_gpis; - modbus_socket->writeBlock(msg,12); + modbus_socket->write(msg,12); modbus_busy=true; } @@ -353,7 +357,8 @@ void Modbus::watchdogData() if(!modbus_watchdog_active) { rda->syslog(LOG_WARNING, "connection to Modbus device at %s:%u lost, attempting reconnect", - (const char *)modbus_ip_address.toString(),0xffff&modbus_ip_port); + modbus_ip_address.toString().toUtf8().constData(), + 0xffff&modbus_ip_port); modbus_watchdog_active=true; } modbus_socket->close(); @@ -410,7 +415,7 @@ void Modbus::SetCoil(int line,bool state) msg[10]=0xff; } - modbus_socket->writeBlock(msg,12); + modbus_socket->write(msg,12); } diff --git a/ripcd/modemlines.cpp b/ripcd/modemlines.cpp index 462de8a4..77c07872 100644 --- a/ripcd/modemlines.cpp +++ b/ripcd/modemlines.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for using TTY modem lines for GPIO // -// (C) Copyright 2015-2019 Fred Gleason +// (C) Copyright 2015-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -58,9 +58,9 @@ ModemLines::ModemLines(RDMatrix *matrix,QObject *parent) // Open TTY // gpio_tty=new RDTty(rda->station()->name(),matrix->port(RDMatrix::Primary)); - if((gpio_fd=open(gpio_tty->port(),O_RDONLY))<0) { + if((gpio_fd=open(gpio_tty->port().toUtf8(),O_RDONLY))<0) { rda->syslog(LOG_WARNING,"unable to open tty \"%s\"", - (const char *)gpio_tty->port()); + gpio_tty->port().toUtf8().constData()); return; } for(int i=0;isetSingleShot(true); gpio_gpo_mapper->setMapping(gpio_gpo_timers[i],i); connect(gpio_gpo_timers[i],SIGNAL(timeout()),gpio_gpo_mapper,SLOT(map())); gpio_gpo_pending_states[i]=false; @@ -139,8 +140,8 @@ void ModemLines::processCommand(RDMacro *cmd) switch(cmd->command()) { case RDMacro::GO: if((gpio_fd<0)||(cmd->argQuantity()!=5)|| - ((cmd->arg(1).lower()!="i")&& - (cmd->arg(1).lower()!="o"))|| + ((cmd->arg(1).toLower()!="i")&& + (cmd->arg(1).toLower()!="o"))|| (cmd->arg(2).toInt()<1)||(cmd->arg(2).toInt()>gpio_gpos)|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& (cmd->arg(3).toInt()!=-1))||(cmd->arg(4).toInt()<0)) { @@ -148,7 +149,7 @@ void ModemLines::processCommand(RDMacro *cmd) emit rmlEcho(cmd); return; } - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { if(cmd->arg(3).toInt()==0) { emit gpiChanged(gpio_matrix,cmd->arg(2).toInt()-1,false); gpio_gpi_mask[cmd->arg(2).toInt()-1]=true; @@ -174,12 +175,12 @@ void ModemLines::processCommand(RDMacro *cmd) emit rmlEcho(cmd); return; } - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { if(cmd->arg(3).toInt()==0) { ioctl(gpio_fd,TIOCMBIC,&gpio_gpo_table[cmd->arg(2).toInt()-1]); if(cmd->arg(4).toInt()>0) { gpio_gpo_timers[cmd->arg(2).toInt()-1]-> - start(cmd->arg(4).toInt(),true); + start(cmd->arg(4).toInt()); gpio_gpo_pending_states[cmd->arg(2).toInt()-1]=true; } } @@ -188,7 +189,7 @@ void ModemLines::processCommand(RDMacro *cmd) ioctl(gpio_fd,TIOCMBIS,&gpio_gpo_table[cmd->arg(2).toInt()-1]); if(cmd->arg(4).toInt()>0) { gpio_gpo_timers[cmd->arg(2).toInt()-1]-> - start(cmd->arg(4).toInt(),true); + start(cmd->arg(4).toInt()); gpio_gpo_pending_states[cmd->arg(2).toInt()-1]=false; } } diff --git a/ripcd/quartz1.cpp b/ripcd/quartz1.cpp index 61a708dc..8e05b0c6 100644 --- a/ripcd/quartz1.cpp +++ b/ripcd/quartz1.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for the Quartz Type 1 Switcher Protocol // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,9 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - #include #include @@ -59,6 +56,7 @@ Quartz1::Quartz1(RDMatrix *matrix,QObject *parent) connect(mapper,SIGNAL(mapped(int)),this,SLOT(ipConnect(int))); for(int i=0;i<2;i++) { sas_reconnect_timer[i]=new QTimer(this); + sas_reconnect_timer[i]->setSingleShot(true); mapper->setMapping(sas_reconnect_timer[i],i); connect(sas_reconnect_timer[i],SIGNAL(timeout()),mapper,SLOT(map())); } @@ -206,7 +204,7 @@ void Quartz1::connectionClosedData(int conn) "connection to Quartz1 device at %s:%d closed unexpectedly, attempting reconnect", (const char *)sas_ipaddress[conn].toString().toUtf8(), sas_ipport[conn]); - sas_reconnect_timer[conn]->start(QUARTZ1_RECONNECT_INTERVAL,true); + sas_reconnect_timer[conn]->start(QUARTZ1_RECONNECT_INTERVAL); } @@ -218,7 +216,7 @@ void Quartz1::errorData(int conn,QAbstractSocket::SocketError err) "connection to Quartz1 device at %s:%d refused, attempting reconnect", (const char *)sas_ipaddress[conn].toString().toUtf8(), sas_ipport[conn]); - sas_reconnect_timer[conn]->start(QUARTZ1_RECONNECT_INTERVAL,true); + sas_reconnect_timer[conn]->start(QUARTZ1_RECONNECT_INTERVAL); break; case QAbstractSocket::HostNotFoundError: @@ -261,7 +259,7 @@ void Quartz1::SendCommand(const char *str) break; case RDMatrix::TcpPort: - sas_socket[i]->writeBlock(str,strlen(str)); + sas_socket[i]->write(str,strlen(str)); break; case RDMatrix::NoPort: diff --git a/ripcd/ripcd.cpp b/ripcd/ripcd.cpp index 423aab27..5a72322e 100644 --- a/ripcd/ripcd.cpp +++ b/ripcd/ripcd.cpp @@ -18,15 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include -#include -#include -#include -#include -#include -#include +#include #include #include @@ -81,7 +73,7 @@ MainObject::MainObject(QObject *parent) rda=static_cast(new RDCoreApplication("ripcd","ripcd",RIPCD_USAGE,this)); if(!rda->open(&err_msg,&err_type,false)) { - fprintf(stderr,"ripcd: %s\n",(const char *)err_msg.utf8()); + fprintf(stderr,"ripcd: %s\n",(const char *)err_msg.toUtf8()); exit(1); } @@ -121,6 +113,7 @@ MainObject::MainObject(QObject *parent) for(int i=0;isetSingleShot(true); mapper->setMapping(ripc_macro_timer[i],i); connect(ripc_macro_timer[i],SIGNAL(timeout()),mapper,SLOT(map())); } @@ -193,6 +186,7 @@ MainObject::MainObject(QObject *parent) // Garbage Timer // ripcd_garbage_timer=new QTimer(this); + ripcd_garbage_timer->setSingleShot(true); connect(ripcd_garbage_timer,SIGNAL(timeout()),this,SLOT(garbageData())); // @@ -269,13 +263,13 @@ void MainObject::sendRml(RDMacro *rml) str=rml->toString(); switch(rml->role()) { case RDMacro::Cmd: - ripcd_rml_send->writeDatagram(str.utf8(),str.utf8().length(), + ripcd_rml_send->writeDatagram(str.toUtf8(),str.toUtf8().length(), rml->address(),rml->port()); break; case RDMacro::Reply: if(!(ripcd_host_addr==rml->address())) { - ripcd_rml_send->writeDatagram(str.utf8(),str.utf8().length(), + ripcd_rml_send->writeDatagram(str.toUtf8(),str.toUtf8().length(), rml->address(),RD_RML_REPLY_PORT); } break; @@ -311,7 +305,7 @@ void MainObject::readyReadData(int conn_id) RipcdConnection *conn=ripcd_conns[conn_id]; QChar c; - while((n=conn->socket()->readBlock(data,1500))>0) { + while((n=conn->socket()->read(data,1500))>0) { data[n]=0; QString line=QString::fromUtf8(data); for(int i=0;iclose(); - ripcd_garbage_timer->start(1,true); + ripcd_garbage_timer->start(1); rda->syslog(LOG_DEBUG,"closed connection %d",conn_id); } @@ -391,7 +385,7 @@ void MainObject::startJackData() else { ripcd_jack_client= jack_client_open("rivendell-ripcd",jackopts,&jackstat, - (const char *)rda->station()->jackServerName()); + rda->station()->jackServerName().toUtf8().constData()); } if(ripcd_jack_client==NULL) { if((jackstat&JackInvalidOption)!=0) { @@ -516,7 +510,8 @@ bool MainObject::DispatchCommand(RipcdConnection *conn) return true; } if(cmds[0]=="RU") { // Request User - EchoCommand(conn->id(),(const char *)QString("RU ")+rda->station()->userName()+"!"); + EchoCommand(conn->id(),(QString("RU ")+rda->station()->userName()+"!"). + toUtf8()); return true; } @@ -644,9 +639,9 @@ bool MainObject::DispatchCommand(RipcdConnection *conn) void MainObject::EchoCommand(int ch,const QString &cmd) { - // printf("EchoCommand(%d,%s)\n",ch,(const char *)cmd.utf8()); + // printf("EchoCommand(%d,%s)\n",ch,(const char *)cmd.toUtf8()); if(ripcd_conns[ch]->socket()->state()==QAbstractSocket::ConnectedState) { - ripcd_conns[ch]->socket()->writeBlock(cmd.utf8(),cmd.utf8().length()); + ripcd_conns[ch]->socket()->write(cmd.toUtf8(),cmd.toUtf8().length()); } } diff --git a/ripcd/sas32000.cpp b/ripcd/sas32000.cpp index 45ced9d7..e1ecade2 100644 --- a/ripcd/sas32000.cpp +++ b/ripcd/sas32000.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for the SAS32000 // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,8 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - #include #include "globals.h" @@ -140,7 +138,7 @@ void Sas32000::runQueue() if(sas_commands.size()==0) { return; } - sas_device->write((const char *)sas_commands.front(),7); + sas_device->write(sas_commands.front().toUtf8()); sas_commands.pop(); if(sas_commands.size()==0) { sas_timer->stop(); diff --git a/ripcd/sas64000gpi.cpp b/ripcd/sas64000gpi.cpp index c563209a..3b37a4fb 100644 --- a/ripcd/sas64000gpi.cpp +++ b/ripcd/sas64000gpi.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for the SAS64000 connected via a GPI-1600 // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,8 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - #include #include "globals.h" @@ -122,7 +120,7 @@ void Sas64000Gpi::processCommand(RDMacro *cmd) break; case RDMacro::GO: - if((cmd->arg(1).lower()!="o")|| + if((cmd->arg(1).toLower()!="o")|| (cmd->arg(2).toInt()<1)||(cmd->arg(2).toInt()>sas_gpos)) { cmd->acknowledge(false); emit rmlEcho(cmd); diff --git a/ripcd/sasusi.cpp b/ripcd/sasusi.cpp index 65f89ec0..14403b41 100644 --- a/ripcd/sasusi.cpp +++ b/ripcd/sasusi.cpp @@ -18,9 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - #include #include @@ -72,6 +69,7 @@ SasUsi::SasUsi(RDMatrix *matrix,QObject *parent) // Reconnection Timer // sas_reconnect_timer=new QTimer(this); + sas_reconnect_timer->setSingleShot(true); connect(sas_reconnect_timer,SIGNAL(timeout()),this,SLOT(ipConnect())); // @@ -164,7 +162,8 @@ void SasUsi::processCommand(RDMacro *cmd) label+=" "; } snprintf(str,256,"%c21%03d%04d%s\x0D\x0A",26, - cmd->arg(1).toInt(),cmd->arg(2).toInt(),(const char *)label); + cmd->arg(1).toInt(),cmd->arg(2).toInt(), + label.toUtf8().constData()); SendCommand(str); cmd->acknowledge(true); emit rmlEcho(cmd); @@ -272,7 +271,7 @@ void SasUsi::processCommand(RDMacro *cmd) break; case RDMacro::GO: - if((cmd->arg(1).lower()!="o")|| + if((cmd->arg(1).toLower()!="o")|| (cmd->arg(2).toInt()<1)||(cmd->arg(2).toInt()>sas_gpos)) { cmd->acknowledge(false); emit rmlEcho(cmd); @@ -299,7 +298,7 @@ void SasUsi::processCommand(RDMacro *cmd) snprintf(str,256,"\x05R%d%04d\x0D\x0A",cmd_byte, sas_relay_numbers[cmd->arg(2).toUInt()-1]); rda->syslog(LOG_DEBUG,"USI: %s", - (const char *)PrettifyCommand(str)); + PrettifyCommand(str).toUtf8().constData()); SendCommand(str); cmd->acknowledge(true); emit rmlEcho(cmd); @@ -359,7 +358,7 @@ void SasUsi::connectionClosedData() if(sas_stop_cart>0) { ExecuteMacroCart(sas_stop_cart); } - sas_reconnect_timer->start(SASUSI_RECONNECT_INTERVAL,true); + sas_reconnect_timer->start(SASUSI_RECONNECT_INTERVAL); } @@ -368,7 +367,7 @@ void SasUsi::readyReadData() char buffer[256]; unsigned n; - while((n=sas_socket->readBlock(buffer,255))>0) { + while((n=sas_socket->read(buffer,255))>0) { buffer[n]=0; for(unsigned i=0;istart(SASUSI_RECONNECT_INTERVAL,true); + sas_reconnect_timer->start(SASUSI_RECONNECT_INTERVAL); break; case QAbstractSocket::HostNotFoundError: @@ -418,14 +417,14 @@ void SasUsi::errorData(QAbstractSocket::SocketError err) void SasUsi::SendCommand(char *str) { rda->syslog(LOG_INFO,"sending USI cmd: %s", - (const char *)PrettifyCommand(str)); + PrettifyCommand(str).toUtf8().constData()); switch(sas_porttype) { case RDMatrix::TtyPort: sas_device->write(str,strlen(str)); break; case RDMatrix::TcpPort: - sas_socket->writeBlock(str,strlen(str)); + sas_socket->write(str,strlen(str)); break; case RDMatrix::NoPort: @@ -456,7 +455,7 @@ void SasUsi::DispatchCommand() // Startup Sequence. Get the input and output lists. The response // to the ^EI command lets us know when the lists are done. // - if(QString("login sucessful")==(QString(sas_buffer).lower())) { + if(QString("login sucessful")==(QString(sas_buffer).toLower())) { sprintf(buffer,"%cX9999\x0D\x0A",5); // Request Input List SendCommand(buffer); sprintf(buffer,"%cY9999\x0D\x0A",5); // Request Output List @@ -476,7 +475,7 @@ void SasUsi::DispatchCommand() } rda->syslog(LOG_INFO,"received USI cmd: %s", - (const char *)PrettifyCommand(sas_buffer)); + PrettifyCommand(sas_buffer).toUtf8().constData()); // diff --git a/ripcd/swauthority.cpp b/ripcd/swauthority.cpp index 06c17326..40c90f6e 100644 --- a/ripcd/swauthority.cpp +++ b/ripcd/swauthority.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for systems using Software Authority Protocol // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,11 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - -#include - #include #include @@ -59,6 +54,7 @@ SoftwareAuthority::SoftwareAuthority(RDMatrix *matrix,QObject *parent) // Reconnection Timer // swa_reconnect_timer=new QTimer(this); + swa_reconnect_timer->setSingleShot(true); connect(swa_reconnect_timer,SIGNAL(timeout()),this,SLOT(ipConnect())); // @@ -125,14 +121,14 @@ void SoftwareAuthority::processCommand(RDMacro *cmd) break; case RDMacro::GO: - if(((cmd->arg(1).lower()!="i")&& - (cmd->arg(1).lower()!="o"))|| + if(((cmd->arg(1).toLower()!="i")&& + (cmd->arg(1).toLower()!="o"))|| (cmd->arg(2).toInt()<1)||(cmd->arg(2).toInt()>swa_gpos)) { cmd->acknowledge(false); emit rmlEcho(cmd); return; } - if(cmd->arg(1).lower()=="i") { + if(cmd->arg(1).toLower()=="i") { str="triggergpi"; } else { @@ -180,7 +176,7 @@ void SoftwareAuthority::connectionClosedData() if(swa_stop_cart>0) { ExecuteMacroCart(swa_stop_cart); } - swa_reconnect_timer->start(SWAUTHORITY_RECONNECT_INTERVAL,true); + swa_reconnect_timer->start(SWAUTHORITY_RECONNECT_INTERVAL); } @@ -189,7 +185,7 @@ void SoftwareAuthority::readyReadData() char buffer[256]; unsigned n; - while((n=swa_socket->readBlock(buffer,255))>0) { + while((n=swa_socket->read(buffer,255))>0) { buffer[n]=0; /// printf("RECV: %s\n",buffer); for(unsigned i=0;istart(SWAUTHORITY_RECONNECT_INTERVAL,true); + swa_reconnect_timer->start(SWAUTHORITY_RECONNECT_INTERVAL); break; case QAbstractSocket::HostNotFoundError: @@ -238,12 +234,12 @@ void SoftwareAuthority::errorData(QAbstractSocket::SocketError err) } -void SoftwareAuthority::SendCommand(const char *str) +void SoftwareAuthority::SendCommand(const QString &str) { // LogLine(RDConfig::LogDebug,QString().sprintf("sending SA cmd: %s",(const char *)PrettifyCommand(str))); - rda->syslog(LOG_DEBUG,"%p - sending \"%s\"",this,str); - QString cmd=QString().sprintf("%s\x0d\x0a",(const char *)str); - swa_socket->writeBlock((const char *)cmd,strlen(cmd)); + rda->syslog(LOG_DEBUG,"%p - sending \"%s\"",this,str.toUtf8().constData()); + QString cmd=QString().sprintf("%s\x0d\x0a",str.toUtf8().constData()); + swa_socket->write(cmd.toUtf8()); } @@ -260,7 +256,7 @@ void SoftwareAuthority::DispatchCommand() // LogLine(RDConfig::LogNotice,QString().sprintf("RECEIVED: %s",(const char *)swa_buffer)); QString line_in=swa_buffer; - QString section=line_in.lower().replace(">>",""); + QString section=line_in.toLower().replace(">>",""); rda->syslog(LOG_DEBUG,"%p - received \"%s\"",this, section.toUtf8().constData()); @@ -419,7 +415,7 @@ void SoftwareAuthority::DispatchCommand() // GPIO State Parser // f0=section.split(" "); - if((f0.size()==4)&&(f0[0].lower()=="gpistat")&&(f0[1].toInt()==swa_card)) { + if((f0.size()==4)&&(f0[0].toLower()=="gpistat")&&(f0[1].toInt()==swa_card)) { if(swa_gpi_states[f0[2].toInt()].isEmpty()) { swa_gpi_states[f0[2].toInt()]=f0[3]; } @@ -434,7 +430,7 @@ void SoftwareAuthority::DispatchCommand() } swa_is_gpio=true; } - if((f0.size()==4)&&(f0[0].lower()=="gpostat")&&(f0[1].toInt()==swa_card)) { + if((f0.size()==4)&&(f0[0].toLower()=="gpostat")&&(f0[1].toInt()==swa_card)) { if(swa_gpo_states[f0[2].toInt()].isEmpty()) { swa_gpo_states[f0[2].toInt()]=f0[3]; } diff --git a/ripcd/swauthority.h b/ripcd/swauthority.h index 1ce72163..641ac134 100644 --- a/ripcd/swauthority.h +++ b/ripcd/swauthority.h @@ -57,7 +57,7 @@ class SoftwareAuthority : public Switcher void errorData(QAbstractSocket::SocketError err); private: - void SendCommand(const char *str); + void SendCommand(const QString &str); void DispatchCommand(); void ExecuteMacroCart(unsigned cartnum); QString PrettifyCommand(const char *cmd) const; diff --git a/ripcd/switcher.cpp b/ripcd/switcher.cpp index b357b1fe..a81f2cdd 100644 --- a/ripcd/switcher.cpp +++ b/ripcd/switcher.cpp @@ -2,7 +2,7 @@ // // Abstract base class for Rivendell Switcher/GPIO drivers. // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,8 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - #include #include #include @@ -82,7 +80,7 @@ void Switcher::logBytes(uint8_t *data,int len) for(int i=0;isyslog(LOG_INFO,"bytes: %s",(const char *)str); + rda->syslog(LOG_INFO,"bytes: %s",str.toUtf8().constData()); } diff --git a/ripcd/unity4000.cpp b/ripcd/unity4000.cpp index 136ce8bc..fb5fa9c6 100644 --- a/ripcd/unity4000.cpp +++ b/ripcd/unity4000.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for the UNITY4000 // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,8 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - #include #include #include @@ -152,7 +150,7 @@ void Unity4000::processCommand(RDMacro *cmd) sprintf(str,"\x0DSETAUDIO %d %c %s\x0D", output+1, route, - (const char *)unity_feed[input].feed()); + unity_feed[input].feed().toUtf8().constData()); unity_device->write(str,strlen(str)); } cmd->acknowledge(true); diff --git a/ripcd/vguest.cpp b/ripcd/vguest.cpp index e5291a72..c971f2ee 100644 --- a/ripcd/vguest.cpp +++ b/ripcd/vguest.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for the Logitek vGuest Protocol // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,11 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - -#include - #include #include @@ -193,6 +188,7 @@ VGuest::VGuest(RDMatrix *matrix,QObject *parent) this,SLOT(pingResponseData(int))); for(int i=0;i<2;i++) { vguest_ping_timer[i]=new QTimer(this); + vguest_ping_timer[i]->setSingleShot(true); vguest_ping_mapper->setMapping(vguest_ping_timer[i],i); connect(vguest_ping_timer[i],SIGNAL(timeout()), vguest_ping_mapper,SLOT(map())); @@ -211,6 +207,7 @@ VGuest::VGuest(RDMatrix *matrix,QObject *parent) this,SLOT(ipConnect(int))); for(int i=0;i<2;i++) { vguest_reconnect_timer[i]=new QTimer(this); + vguest_reconnect_timer[i]->setSingleShot(true); reconnect_mapper->setMapping(vguest_reconnect_timer[i],i); connect(vguest_reconnect_timer[i],SIGNAL(timeout()), reconnect_mapper,SLOT(map())); @@ -337,7 +334,7 @@ void VGuest::processCommand(RDMacro *cmd) (char)(0xFF&cmd->arg(2).toInt()), (char)(0xFF&cmd->arg(3).toInt()), (char)(0xFF&cmd->arg(4).toInt()), - (const char *)label); + label.toUtf8().constData()); SendCommand(buffer,10+label.length()); break; @@ -370,8 +367,8 @@ void VGuest::processCommand(RDMacro *cmd) break; case RDMacro::GO: - if(((cmd->arg(1).lower()!="i")&& - (cmd->arg(1).lower()!="o"))|| + if(((cmd->arg(1).toLower()!="i")&& + (cmd->arg(1).toLower()!="o"))|| (cmd->arg(2).toInt()<1)||(cmd->arg(2).toInt()>vguest_gpos)|| (cmd->arg(3).toInt()<0)||(cmd->arg(3).toInt()>1)|| (cmd->arg(4).toInt()<0)) { @@ -473,7 +470,7 @@ void VGuest::connectionClosedData(int id) } vguest_ping_timer[id]->stop(); vguest_ping_response_timer[id]->stop(); - vguest_reconnect_timer[id]->start(interval,true); + vguest_reconnect_timer[id]->start(interval); } @@ -482,7 +479,7 @@ void VGuest::readyReadData(int id) char buffer[255]; int n=0; - while((n=vguest_socket[id]->readBlock(buffer,255))>0) { + while((n=vguest_socket[id]->read(buffer,255))>0) { for(int i=0;istart(interval,true); + vguest_reconnect_timer[id]->start(interval); break; case QAbstractSocket::HostNotFoundError: @@ -589,17 +586,18 @@ void VGuest::pingData(int id) buffer[0]=0x04; buffer[1]=0x01; buffer[2]=0x03; // LPCore Connection Ping - vguest_socket[id]->writeBlock(buffer,3); - vguest_ping_response_timer[id]->start(VGUEST_PING_INTERVAL,true); + vguest_socket[id]->write(buffer,3); + vguest_ping_response_timer[id]->start(VGUEST_PING_INTERVAL); } void VGuest::pingResponseData(int id) { vguest_socket[id]->close(); - rda->syslog(LOG_WARNING,"vGuest connection to "+ - vguest_ipaddress[id].toString()+ - " timed out, restarting connection"); + rda->syslog(LOG_WARNING,"%s", + ("vGuest connection to "+ + vguest_ipaddress[id].toString()+ + " timed out, restarting connection").toUtf8().constData()); } @@ -616,7 +614,7 @@ void VGuest::SendCommand(char *str,int len) case RDMatrix::TcpPort: if(vguest_socket[i]!=NULL) { - vguest_socket[i]->writeBlock(str,len); + vguest_socket[i]->write(str,len); } break; @@ -643,8 +641,8 @@ void VGuest::DispatchCommand(char *cmd,int len,int id) buffer[2]=0xF9; buffer[3]=VGUEST_ID_BYTE; sprintf(buffer+4,"%s%s", - (const char *)vguest_username[id], - (const char *)vguest_password[id]); + vguest_username[id].toUtf8().constData(), + vguest_password[id].toUtf8().constData()); SendCommand(buffer,36); break; @@ -664,7 +662,7 @@ void VGuest::DispatchCommand(char *cmd,int len,int id) buffer[0]=0x04; buffer[1]=0x01; buffer[2]=0x03; // LPCore Connection Ping - vguest_socket[id]->writeBlock(buffer,3); + vguest_socket[id]->write(buffer,3); } break; @@ -765,7 +763,7 @@ void VGuest::MetadataCommand(char *cmd,int len,int id) "vGuest system at %s understands ping, activating timeout monitoring", (const char *)vguest_ipaddress[id].toString().toUtf8()); } - vguest_ping_timer[id]->start(VGUEST_PING_INTERVAL,true); + vguest_ping_timer[id]->start(VGUEST_PING_INTERVAL); break; } } diff --git a/ripcd/wheatnet_lio.cpp b/ripcd/wheatnet_lio.cpp index 6af6c595..ed8d9d0a 100644 --- a/ripcd/wheatnet_lio.cpp +++ b/ripcd/wheatnet_lio.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for WheatNet LIO // -// (C) Copyright 2017-2020 Fred Gleason +// (C) Copyright 2017-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -42,6 +42,7 @@ WheatnetLio::WheatnetLio(RDMatrix *matrix,QObject *parent) lio_socket->connectToHost(lio_ip_address.toString(),lio_ip_port); lio_poll_timer=new QTimer(this); + lio_poll_timer->setSingleShot(true); connect(lio_poll_timer,SIGNAL(timeout()),this,SLOT(pollData())); lio_reset_mapper=new QSignalMapper(this); @@ -49,12 +50,14 @@ WheatnetLio::WheatnetLio(RDMatrix *matrix,QObject *parent) this,SLOT(resetStateData(int))); for(int i=0;isetSingleShot(true); connect(lio_reset_timers.back(),SIGNAL(timeout()), lio_reset_mapper,SLOT(map())); lio_reset_mapper->setMapping(lio_reset_timers.back(),i); lio_reset_states.push_back(false); } lio_watchdog_timer=new QTimer(this); + lio_watchdog_timer->setSingleShot(true); connect(lio_watchdog_timer,SIGNAL(timeout()),this,SLOT(watchdogData())); } @@ -106,14 +109,14 @@ void WheatnetLio::processCommand(RDMacro *cmd) switch(cmd->command()) { case RDMacro::GO: if((cmd->argQuantity()!=5)|| - ((cmd->arg(1).lower()!="i")&& - (cmd->arg(1).lower()!="o"))|| + ((cmd->arg(1).toLower()!="i")&& + (cmd->arg(1).toLower()!="o"))|| (cmd->arg(2).toInt()<1)||(cmd->arg(3).toInt()>lio_gpios)|| (cmd->arg(2).toInt()>lio_gpios)|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(1).lower()!="i"))|| + (cmd->arg(1).toLower()!="i"))|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).lower()=="i"))|| + (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).toLower()=="i"))|| (cmd->arg(4).toInt()<0)) { cmd->acknowledge(false); emit rmlEcho(cmd); @@ -121,7 +124,7 @@ void WheatnetLio::processCommand(RDMacro *cmd) } if(cmd->arg(3).toInt()==0) { // Turn OFF if(cmd->arg(4).toInt()==0) { - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { SendCommand(QString().sprintf("", cmd->arg(2).toInt()-1)); emit gpoChanged(matrixNumber(),cmd->arg(2).toInt()-1,false); @@ -137,20 +140,20 @@ void WheatnetLio::processCommand(RDMacro *cmd) } else { if(cmd->arg(4).toInt()==0) { // Turn ON - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { SendCommand(QString().sprintf("", cmd->arg(2).toInt()-1)); emit gpoChanged(matrixNumber(),cmd->arg(2).toInt()-1,true); } } else { // Pulse - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { SendCommand(QString().sprintf("", cmd->arg(2).toInt()-1, cmd->arg(3).toInt()!=0)); lio_reset_states[cmd->arg(2).toInt()-1]=cmd->arg(3).toInt()==0; lio_reset_timers[cmd->arg(2).toInt()-1]-> - start(cmd->arg(4).toInt(),true); + start(cmd->arg(4).toInt()); emit gpoChanged(matrixNumber(),cmd->arg(2).toInt()-1, cmd->arg(3).toInt()!=0); } @@ -173,7 +176,7 @@ void WheatnetLio::connectedData() { rda->syslog(LOG_INFO, "connection to WheatNet LIO device at %s:%u established", - (const char *)lio_ip_address.toString(),0xffff&lio_ip_port); + lio_ip_address.toString().toUtf8().constData(),0xffff&lio_ip_port); lio_watchdog_active=false; SendCommand(""); } @@ -184,7 +187,7 @@ void WheatnetLio::readyReadData() char data[1501]; int n=0; - while((n=lio_socket->readBlock(data,1500))>0) { + while((n=lio_socket->read(data,1500))>0) { data[n]=0; for(int i=0;isyslog(LOG_WARNING, "connection to Wheatnet LIO device at %s:%u lost, attempting reconnect", - (const char *)lio_ip_address.toString(),0xffff&lio_ip_port); + lio_ip_address.toString().toUtf8().constData(), + 0xffff&lio_ip_port); lio_watchdog_active=true; } lio_socket->close(); @@ -309,14 +313,14 @@ void WheatnetLio::ProcessSys(const QString &cmd) QString().sprintf("(MATRIX=%d)",matrixNumber()); q=new RDSqlQuery(sql); delete q; - lio_watchdog_timer->start(WHEATNET_LIO_WATCHDOG_INTERVAL,true); - lio_poll_timer->start(WHEATNET_LIO_POLL_INTERVAL,true); + lio_watchdog_timer->start(WHEATNET_LIO_WATCHDOG_INTERVAL); + lio_poll_timer->start(WHEATNET_LIO_POLL_INTERVAL); } } if((f0[0]=="BLID")&&(f0.size()==2)) { lio_watchdog_timer->stop(); - lio_watchdog_timer->start(WHEATNET_LIO_WATCHDOG_INTERVAL,true); - lio_poll_timer->start(WHEATNET_LIO_POLL_INTERVAL,true); + lio_watchdog_timer->start(WHEATNET_LIO_WATCHDOG_INTERVAL); + lio_poll_timer->start(WHEATNET_LIO_POLL_INTERVAL); } } @@ -336,12 +340,12 @@ void WheatnetLio::ProcessLioevent(int chan,QString &cmd) else { rda->syslog(LOG_WARNING, "WheatNet device at %s:%d sent invalid LIOEVENT LVL update [%s]", - (const char *)lio_ip_address.toString(), - lio_ip_port,(const char *)cmd); + lio_ip_address.toString().toUtf8().constData(), + lio_ip_port,cmd.toUtf8().constData()); } if((chan+1)==lio_gpios) { lio_watchdog_timer->stop(); - lio_watchdog_timer->start(1000,true); + lio_watchdog_timer->start(1000); } } } @@ -375,5 +379,5 @@ void WheatnetLio::ProcessCommand(const QString &cmd) void WheatnetLio::SendCommand(const QString &cmd) { - lio_socket->writeBlock(cmd+"\r\n",cmd.length()+2); + lio_socket->write((cmd+"\r\n").toUtf8()); } diff --git a/ripcd/wheatnet_slio.cpp b/ripcd/wheatnet_slio.cpp index c779e207..0b638a9d 100644 --- a/ripcd/wheatnet_slio.cpp +++ b/ripcd/wheatnet_slio.cpp @@ -2,7 +2,7 @@ // // A Rivendell switcher driver for WheatNet SLIO // -// (C) Copyright 2017-2020 Fred Gleason +// (C) Copyright 2017-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -41,6 +41,7 @@ WheatnetSlio::WheatnetSlio(RDMatrix *matrix,QObject *parent) slio_socket->connectToHost(slio_ip_address.toString(),slio_ip_port); slio_poll_timer=new QTimer(this); + slio_poll_timer->setSingleShot(true); connect(slio_poll_timer,SIGNAL(timeout()),this,SLOT(pollData())); slio_reset_mapper=new QSignalMapper(this); @@ -48,12 +49,14 @@ WheatnetSlio::WheatnetSlio(RDMatrix *matrix,QObject *parent) this,SLOT(resetStateData(int))); for(int i=0;isetSingleShot(true); connect(slio_reset_timers.back(),SIGNAL(timeout()), slio_reset_mapper,SLOT(map())); slio_reset_mapper->setMapping(slio_reset_timers.back(),i); slio_reset_states.push_back(false); } slio_watchdog_timer=new QTimer(this); + slio_watchdog_timer->setSingleShot(true); connect(slio_watchdog_timer,SIGNAL(timeout()),this,SLOT(watchdogData())); } @@ -105,14 +108,14 @@ void WheatnetSlio::processCommand(RDMacro *cmd) switch(cmd->command()) { case RDMacro::GO: if((cmd->argQuantity()!=5)|| - ((cmd->arg(1).lower()!="i")&& - (cmd->arg(1).lower()!="o"))|| + ((cmd->arg(1).toLower()!="i")&& + (cmd->arg(1).toLower()!="o"))|| (cmd->arg(2).toInt()<1)||(cmd->arg(3).toInt()>slio_gpios)|| (cmd->arg(2).toInt()>slio_gpios)|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(1).lower()!="i"))|| + (cmd->arg(1).toLower()!="i"))|| ((cmd->arg(3).toInt()!=1)&&(cmd->arg(3).toInt()!=0)&& - (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).lower()=="i"))|| + (cmd->arg(3).toInt()!=-1)&&(cmd->arg(1).toLower()=="i"))|| (cmd->arg(4).toInt()<0)) { cmd->acknowledge(false); emit rmlEcho(cmd); @@ -120,7 +123,7 @@ void WheatnetSlio::processCommand(RDMacro *cmd) } if(cmd->arg(3).toInt()==0) { // Turn OFF if(cmd->arg(4).toInt()==0) { - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { SendCommand(QString().sprintf("",cmd->arg(2).toInt())); emit gpoChanged(matrixNumber(),cmd->arg(2).toInt()-1,false); } @@ -135,19 +138,19 @@ void WheatnetSlio::processCommand(RDMacro *cmd) } else { if(cmd->arg(4).toInt()==0) { // Turn ON - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { SendCommand(QString().sprintf("",cmd->arg(2).toInt())); emit gpoChanged(matrixNumber(),cmd->arg(2).toInt()-1,true); } } else { // Pulse - if(cmd->arg(1).lower()=="o") { + if(cmd->arg(1).toLower()=="o") { SendCommand(QString().sprintf("", cmd->arg(2).toInt(), cmd->arg(3).toInt()!=0)); slio_reset_states[cmd->arg(2).toInt()-1]=cmd->arg(3).toInt()==0; slio_reset_timers[cmd->arg(2).toInt()-1]-> - start(cmd->arg(4).toInt(),true); + start(cmd->arg(4).toInt()); emit gpoChanged(matrixNumber(),cmd->arg(2).toInt()-1, cmd->arg(3).toInt()!=0); } @@ -170,7 +173,8 @@ void WheatnetSlio::connectedData() { rda->syslog(LOG_INFO, "connection to WheatNet SLIO device at %s:%u established", - (const char *)slio_ip_address.toString(),0xffff&slio_ip_port); + slio_ip_address.toString().toUtf8().constData(), + 0xffff&slio_ip_port); slio_watchdog_active=false; SendCommand(""); } @@ -181,7 +185,7 @@ void WheatnetSlio::readyReadData() char data[1501]; int n=0; - while((n=slio_socket->readBlock(data,1500))>0) { + while((n=slio_socket->read(data,1500))>0) { data[n]=0; for(int i=0;isyslog(LOG_WARNING, "connection to Wheatnet SLIO device at %s:%u lost, attempting reconnect", - (const char *)slio_ip_address.toString(),0xffff&slio_ip_port); + slio_ip_address.toString().toUtf8().constData(), + 0xffff&slio_ip_port); slio_watchdog_active=true; } slio_socket->close(); @@ -306,14 +311,14 @@ void WheatnetSlio::ProcessSys(const QString &cmd) QString().sprintf("(MATRIX=%d)",matrixNumber()); q=new RDSqlQuery(sql); delete q; - slio_watchdog_timer->start(WHEATNET_SLIO_WATCHDOG_INTERVAL,true); - slio_poll_timer->start(WHEATNET_SLIO_POLL_INTERVAL,true); + slio_watchdog_timer->start(WHEATNET_SLIO_WATCHDOG_INTERVAL); + slio_poll_timer->start(WHEATNET_SLIO_POLL_INTERVAL); } } if((f0[0]=="BLID")&&(f0.size()==2)) { slio_watchdog_timer->stop(); - slio_watchdog_timer->start(WHEATNET_SLIO_WATCHDOG_INTERVAL,true); - slio_poll_timer->start(WHEATNET_SLIO_POLL_INTERVAL,true); + slio_watchdog_timer->start(WHEATNET_SLIO_WATCHDOG_INTERVAL); + slio_poll_timer->start(WHEATNET_SLIO_POLL_INTERVAL); } } @@ -333,13 +338,13 @@ void WheatnetSlio::ProcessSlioevent(int chan,QString &cmd) else { rda->syslog(LOG_WARNING, "WheatNet device at %s:%d sent invalid SLIOEVENT LVL update [%s]", - (const char *)slio_ip_address.toString(), - slio_ip_port,(const char *)cmd); + slio_ip_address.toString().toUtf8().constData(), + slio_ip_port,cmd.toUtf8().constData()); } if(chan==slio_gpios) { - slio_poll_timer->start(50,true); + slio_poll_timer->start(50); slio_watchdog_timer->stop(); - slio_watchdog_timer->start(1000,true); + slio_watchdog_timer->start(1000); } } } @@ -370,5 +375,5 @@ void WheatnetSlio::ProcessCommand(const QString &cmd) void WheatnetSlio::SendCommand(const QString &cmd) { - slio_socket->writeBlock(cmd+"\r\n",cmd.length()+2); + slio_socket->write((cmd+"\r\n").toUtf8()); } diff --git a/tests/Makefile.am b/tests/Makefile.am index 0d45ffc7..ac5e2eaa 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2002-2020 Fred Gleason +## (C) Copyright 2002-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -55,90 +55,90 @@ noinst_PROGRAMS = audio_convert_test\ wav_chunk_test dist_audio_convert_test_SOURCES = audio_convert_test.cpp audio_convert_test.h -audio_convert_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +audio_convert_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_audio_export_test_SOURCES = audio_export_test.cpp audio_export_test.h -audio_export_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +audio_export_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_audio_import_test_SOURCES = audio_import_test.cpp audio_import_test.h -audio_import_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +audio_import_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_audio_metadata_test_SOURCES = audio_metadata_test.cpp audio_metadata_test.h -audio_metadata_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +audio_metadata_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_audio_peaks_test_SOURCES = audio_peaks_test.cpp audio_peaks_test.h -audio_peaks_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +audio_peaks_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_cmdline_parser_test_SOURCES = cmdline_parser_test.cpp cmdline_parser_test.h -cmdline_parser_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +cmdline_parser_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_datedecode_test_SOURCES = datedecode_test.cpp datedecode_test.h -datedecode_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +datedecode_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_dateparse_test_SOURCES = dateparse_test.cpp dateparse_test.h -dateparse_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +dateparse_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_db_charset_test_SOURCES = db_charset_test.cpp db_charset_test.h -db_charset_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +db_charset_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_delete_test_SOURCES = delete_test.cpp delete_test.h -delete_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +delete_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_download_test_SOURCES = download_test.cpp download_test.h -download_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +download_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_feed_image_test_SOURCES = feed_image_test.cpp feed_image_test.h -feed_image_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +feed_image_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_getpids_test_SOURCES = getpids_test.cpp getpids_test.h -getpids_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +getpids_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_log_unlink_test_SOURCES = log_unlink_test.cpp log_unlink_test.h nodist_log_unlink_test_SOURCES = moc_log_unlink_test.cpp -log_unlink_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +log_unlink_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_metadata_wildcard_test_SOURCES = metadata_wildcard_test.cpp metadata_wildcard_test.h nodist_metadata_wildcard_test_SOURCES = moc_metadata_wildcard_test.cpp -metadata_wildcard_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +metadata_wildcard_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_mcast_recv_test_SOURCES = mcast_recv_test.cpp mcast_recv_test.h nodist_mcast_recv_test_SOURCES = moc_mcast_recv_test.cpp -mcast_recv_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +mcast_recv_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_notification_test_SOURCES = notification_test.cpp notification_test.h nodist_notification_test_SOURCES = moc_notification_test.cpp -notification_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +notification_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_rdxml_parse_test_SOURCES = rdxml_parse_test.cpp rdxml_parse_test.h -rdxml_parse_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdxml_parse_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_readcd_test_SOURCES = readcd_test.cpp readcd_test.h -readcd_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +readcd_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_reserve_carts_test_SOURCES = reserve_carts_test.cpp reserve_carts_test.h -reserve_carts_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +reserve_carts_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_sendmail_test_SOURCES = sendmail_test.cpp sendmail_test.h -sendmail_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +sendmail_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_stringcode_test_SOURCES = stringcode_test.cpp stringcode_test.h -stringcode_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +stringcode_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_test_hash_SOURCES = test_hash.cpp test_hash.h -test_hash_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +test_hash_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_test_pam_SOURCES = test_pam.cpp test_pam.h -test_pam_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +test_pam_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_timer_test_SOURCES = timer_test.cpp timer_test.h nodist_timer_test_SOURCES = moc_timer_test.cpp -timer_test_LDADD = @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +timer_test_LDADD = @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_upload_test_SOURCES = upload_test.cpp upload_test.h -upload_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +upload_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ dist_wav_chunk_test_SOURCES = wav_chunk_test.cpp wav_chunk_test.h -wav_chunk_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +wav_chunk_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ EXTRA_DIST = rivendell_standard.txt\ visualtraffic.txt diff --git a/tests/audio_convert_test.cpp b/tests/audio_convert_test.cpp index 9afe78e2..6690510f 100644 --- a/tests/audio_convert_test.cpp +++ b/tests/audio_convert_test.cpp @@ -192,7 +192,8 @@ MainObject::MainObject(QObject *parent) conv->setSpeedRatio(speed_ratio); printf("Converting...\n"); conv_err=conv->convert(); - printf("Result: %s\n",(const char *)RDAudioConvert::errorText(conv_err)); + printf("Result: %s\n",RDAudioConvert::errorText(conv_err).toUtf8(). + constData()); delete conv; exit(0); diff --git a/tests/audio_export_test.cpp b/tests/audio_export_test.cpp index d05d7414..050de6d5 100644 --- a/tests/audio_export_test.cpp +++ b/tests/audio_export_test.cpp @@ -18,8 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - #include #include @@ -48,7 +46,7 @@ MainObject::MainObject(QObject *parent) // rda=static_cast(new RDCoreApplication("audio_export_test","audio_export_test",AUDIO_EXPORT_TEST_USAGE,this)); if(!rda->open(&err_msg)) { - fprintf(stderr,"audio_export_test: %s\n",(const char *)err_msg); + fprintf(stderr,"audio_export_test: %s\n",err_msg.toUtf8().constData()); exit(1); } @@ -170,7 +168,7 @@ MainObject::MainObject(QObject *parent) } if(!rda->cmdSwitch()->processed(i)) { fprintf(stderr,"audio_export_test: unknown command option \"%s\"\n", - (const char *)rda->cmdSwitch()->key(i)); + rda->cmdSwitch()->key(i).toUtf8().constData()); exit(2); } } @@ -205,7 +203,8 @@ MainObject::MainObject(QObject *parent) printf("Exporting...\n"); conv_err=conv->runExport(username,password,&audio_conv_err); printf("Result: %s\n", - (const char *)RDAudioExport::errorText(conv_err,audio_conv_err)); + RDAudioExport::errorText(conv_err,audio_conv_err).toUtf8(). + constData()); delete conv; exit(0); diff --git a/tests/audio_import_test.cpp b/tests/audio_import_test.cpp index b9531e73..810d2ef3 100644 --- a/tests/audio_import_test.cpp +++ b/tests/audio_import_test.cpp @@ -47,7 +47,7 @@ MainObject::MainObject(QObject *parent) // rda=static_cast(new RDCoreApplication("audio_import_test","audio_import_test",AUDIO_IMPORT_TEST_USAGE,this)); if(!rda->open(&err_msg)) { - fprintf(stderr,"audio_import_test: %s\n",(const char *)err_msg); + fprintf(stderr,"audio_import_test: %s\n",err_msg.toUtf8().constData()); exit(1); } @@ -116,7 +116,7 @@ MainObject::MainObject(QObject *parent) } if(!rda->cmdSwitch()->processed(i)) { fprintf(stderr,"audio_import_test: unknown command option \"%s\"\n", - (const char *)rda->cmdSwitch()->key(i)); + rda->cmdSwitch()->key(i).toUtf8().constData()); exit(2); } } @@ -149,7 +149,8 @@ MainObject::MainObject(QObject *parent) printf("Importing...\n"); conv_err=conv->runImport(username,password,&audio_conv_err); printf("Result: %s\n", - (const char *)RDAudioImport::errorText(conv_err,audio_conv_err)); + RDAudioImport::errorText(conv_err,audio_conv_err).toUtf8(). + constData()); delete conv; exit(0); diff --git a/tests/audio_peaks_test.cpp b/tests/audio_peaks_test.cpp index 0a685b51..ec1786e5 100644 --- a/tests/audio_peaks_test.cpp +++ b/tests/audio_peaks_test.cpp @@ -2,7 +2,7 @@ // // Test the Rivendell audio peak routines. // -// (C) Copyright 2015-2016 Fred Gleason +// (C) Copyright 2015-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,11 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - -#include -#include +#include #include #include @@ -59,7 +55,7 @@ MainObject::MainObject(QObject *parent) } if(!cmd->processed(i)) { fprintf(stderr,"audio_peaks_test: unknown option \"%s\"\n", - (const char *)cmd->value(i)); + cmd->value(i).toUtf8().constData()); exit(256); } } @@ -72,11 +68,11 @@ MainObject::MainObject(QObject *parent) wave->nameWave(filename); if(!wave->openWave()) { fprintf(stderr,"audio_peaks_test: unable to open \"%s\"\n", - (const char *)filename); + filename.toUtf8().constData()); exit(256); } if(wave->hasEnergy()) { - printf("\"%s\" has energy, size: %u\n",(const char *)filename, + printf("\"%s\" has energy, size: %u\n",filename.toUtf8().constData(), wave->energySize()); if(frame_used) { if(wave->getChannels()==1) { @@ -90,7 +86,7 @@ MainObject::MainObject(QObject *parent) } } else { - printf("\"%s\" does NOT have energy\n",(const char *)filename); + printf("\"%s\" does NOT have energy\n",filename.toUtf8().constData()); } wave->closeWave(); delete wave; diff --git a/tests/cmdline_parser_test.cpp b/tests/cmdline_parser_test.cpp index 3dca77fa..82a9180c 100644 --- a/tests/cmdline_parser_test.cpp +++ b/tests/cmdline_parser_test.cpp @@ -37,7 +37,7 @@ MainObject::MainObject(QObject *parent) new RDCmdSwitch(qApp->argc(),qApp->argv(),"cmdline_parser_test", CMDLINE_PARSER_TEST_USAGE); for(unsigned i=0;ikeys();i++) { - printf(" key[%d]: %s\n",i,cmd->key(i).utf8().constData()); + printf(" key[%d]: %s\n",i,cmd->key(i).toUtf8().constData()); printf("value[%d]: %s\n",i,cmd->value(i).toUtf8().constData()); } exit(0); diff --git a/tests/datedecode_test.cpp b/tests/datedecode_test.cpp index 58bfcbee..37f4e067 100644 --- a/tests/datedecode_test.cpp +++ b/tests/datedecode_test.cpp @@ -2,7 +2,7 @@ // // Test the Rivendell db connection routines. // -// (C) Copyright 2012,2016 Fred Gleason +// (C) Copyright 2012-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,11 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - -#include -#include +#include #include #include @@ -59,7 +55,7 @@ MainObject::MainObject(QObject *parent) } if(!cmd->processed(i)) { fprintf(stderr,"datedecode_test: unknown option \"%s\"\n", - (const char *)cmd->value(i)); + cmd->value(i).toUtf8().constData()); exit(256); } } @@ -85,7 +81,7 @@ MainObject::MainObject(QObject *parent) // QString err (tr("datedecode_test: ")); if(!RDOpenDb(&schema,&err,config)) { - fprintf(stderr,err.ascii()); + fprintf(stderr,err.toAscii()); delete cmd; exit(256); } @@ -96,13 +92,13 @@ MainObject::MainObject(QObject *parent) // if(!date.isNull()) { printf("%s\n", - (const char *)RDDateDecode(date,QDate::currentDate(),station,config, - service)); + RDDateDecode(date,QDate::currentDate(),station,config,service). + toUtf8().constData());; } if(!datetime.isNull()) { - printf("%s\n",(const char *)RDDateTimeDecode(datetime, - QDateTime(QDate::currentDate(),QTime::currentTime()),station, - config,service)); + printf("%s\n",RDDateTimeDecode(datetime,QDateTime(QDate::currentDate(), + QTime::currentTime()), + station,config,service).toUtf8().constData()); } exit(0); } diff --git a/tests/dateparse_test.cpp b/tests/dateparse_test.cpp index 0672ff7c..67239f4e 100644 --- a/tests/dateparse_test.cpp +++ b/tests/dateparse_test.cpp @@ -2,7 +2,7 @@ // // Test the Rivendell date/time parser routines. // -// (C) Copyright 2019 Fred Gleason +// (C) Copyright 2019-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,11 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - -#include -#include +#include #include #include @@ -91,7 +87,7 @@ MainObject::MainObject(QObject *parent) } if(!cmd->processed(i)) { fprintf(stderr,"dateparse_test: unknown option \"%s\"\n", - (const char *)cmd->value(i)); + cmd->value(i).toUtf8().constData()); exit(256); } } @@ -111,7 +107,7 @@ MainObject::MainObject(QObject *parent) exit(1); } printf("XML xs:date: %s\n", - (const char *)RDWriteXmlDate(QDate::currentDate())); + RDWriteXmlDate(QDate::currentDate()).toUtf8().constData()); break; case MainObject::Time: @@ -120,19 +116,21 @@ MainObject::MainObject(QObject *parent) exit(1); } printf("XML xs:time: %s\n", - (const char *)RDWriteXmlTime(QTime::currentTime())); + RDWriteXmlTime(QTime::currentTime()).toUtf8().constData()); break; case MainObject::DateTime: switch(format) { case MainObject::Xml: printf("XML xs:dateTime: %s\n", - (const char *)RDWriteXmlDateTime(QDateTime::currentDateTime())); + RDWriteXmlDateTime(QDateTime::currentDateTime()).toUtf8(). + constData()); break; case MainObject::Rfc822: printf("RFC822: %s\n", - (const char *)RDWriteRfc822DateTime(QDateTime::currentDateTime())); + RDWriteRfc822DateTime(QDateTime::currentDateTime()). + toUtf8().constData()); break; case MainObject::Auto: diff --git a/tests/db_charset_test.cpp b/tests/db_charset_test.cpp index b72de813..8522c06e 100644 --- a/tests/db_charset_test.cpp +++ b/tests/db_charset_test.cpp @@ -18,9 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include +#include #include @@ -38,7 +36,7 @@ MainObject::MainObject(QObject *parent) for(unsigned i=0;ikeys();i++) { if(!cmd->processed(i)) { fprintf(stderr,"db_charset_test: unknown option \"%s\"\n", - (const char *)cmd->value(i)); + cmd->value(i).toUtf8().constData()); exit(256); } } @@ -48,23 +46,23 @@ MainObject::MainObject(QObject *parent) // rda=static_cast(new RDApplication("db_charset_test","rdvairplayd",DB_CHARSET_TEST_USAGE,this)); if(!rda->open(&err_msg)) { - fprintf(stderr,"db_charset_test: %s\n",(const char *)err_msg); + fprintf(stderr,"db_charset_test: %s\n",err_msg.toUtf8().constData()); exit(1); } sql=QString("show variables like '%character_set%'"); q=new RDSqlQuery(sql); while(q->next()) { - printf("%s: %s\n",(const char *)q->value(0).toString(), - (const char *)q->value(1).toString()); + printf("%s: %s\n",q->value(0).toString().toUtf8().constData(), + q->value(1).toString().toUtf8().constData()); } delete q; sql=QString("show variables like '%collation%'"); q=new RDSqlQuery(sql); while(q->next()) { - printf("%s: %s\n",(const char *)q->value(0).toString(), - (const char *)q->value(1).toString()); + printf("%s: %s\n",q->value(0).toString().toUtf8().constData(), + q->value(1).toString().toUtf8().constData()); } delete q; diff --git a/tests/delete_test.cpp b/tests/delete_test.cpp index 98f4fad7..554d7c1d 100644 --- a/tests/delete_test.cpp +++ b/tests/delete_test.cpp @@ -2,7 +2,7 @@ // // Test Rivendell file deletion routines. // -// (C) Copyright 2010-2020 Fred Gleason +// (C) Copyright 2010-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,9 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include +#include #include #include @@ -43,7 +41,7 @@ MainObject::MainObject(QObject *parent) // rda=new RDApplication("delete_test","delete_test",DELETE_TEST_USAGE,this); if(!rda->open(&err_msg)) { - fprintf(stderr,"delete_test: %s\n",(const char *)err_msg); + fprintf(stderr,"delete_test: %s\n",err_msg.toUtf8().constData()); exit(1); } @@ -81,7 +79,7 @@ MainObject::MainObject(QObject *parent) } if(!rda->cmdSwitch()->processed(i)) { fprintf(stderr,"delete_test: unknown command option \"%s\"\n", - (const char *)rda->cmdSwitch()->key(i)); + rda->cmdSwitch()->key(i).toUtf8().constData()); exit(2); } } @@ -102,12 +100,12 @@ MainObject::MainObject(QObject *parent) fprintf(stderr,"delete_test: unsupported URL scheme\n"); exit(1); } - conv->setTargetUrl(target_url); + conv->setTargetUrl(target_url.toString()); printf("Deleting...\n"); conv_err=conv-> runDelete(username,password,ssh_identity_filename,use_identity_file, rda->config()->logXloadDebugData()); - printf("Result: %s\n",(const char *)RDDelete::errorText(conv_err)); + printf("Result: %s\n",RDDelete::errorText(conv_err).toUtf8().constData()); delete conv; exit(0); diff --git a/tests/download_test.cpp b/tests/download_test.cpp index d06e259a..9ba3210c 100644 --- a/tests/download_test.cpp +++ b/tests/download_test.cpp @@ -2,7 +2,7 @@ // // Test Rivendell file downloading. // -// (C) Copyright 2010-2020 Fred Gleason +// (C) Copyright 2010-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,9 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include +#include #include #include @@ -44,7 +42,7 @@ MainObject::MainObject(QObject *parent) // rda=new RDApplication("download_test","download_test",DOWNLOAD_TEST_USAGE,this); if(!rda->open(&err_msg)) { - fprintf(stderr,"download_test: %s\n",(const char *)err_msg); + fprintf(stderr,"download_test: %s\n",err_msg.toUtf8().constData()); exit(1); } @@ -78,7 +76,7 @@ MainObject::MainObject(QObject *parent) } if(!rda->cmdSwitch()->processed(i)) { fprintf(stderr,"download_test: unknown command option \"%s\"\n", - (const char *)rda->cmdSwitch()->key(i)); + rda->cmdSwitch()->key(i).toUtf8().constData()); exit(2); } } @@ -105,7 +103,7 @@ MainObject::MainObject(QObject *parent) conv_err=conv-> runDownload(username,password,ssh_identity_filename,use_identity_file, rda->config()->logXloadDebugData()); - printf("Result: %s\n",(const char *)RDDownload::errorText(conv_err)); + printf("Result: %s\n",RDDownload::errorText(conv_err).toUtf8().constData()); delete conv; exit(0); diff --git a/tests/feed_image_test.cpp b/tests/feed_image_test.cpp index 0be7d9b1..6612fcf7 100644 --- a/tests/feed_image_test.cpp +++ b/tests/feed_image_test.cpp @@ -47,7 +47,7 @@ MainObject::MainObject(QObject *parent) // rda=new RDApplication("feed_image_test","feed_image_test",FEED_IMAGE_TEST_USAGE,this); if(!rda->open(&err_msg)) { - fprintf(stderr,"feed_image_test: %s\n",(const char *)err_msg); + fprintf(stderr,"feed_image_test: %s\n",err_msg.toUtf8().constData()); exit(1); } @@ -104,7 +104,7 @@ MainObject::MainObject(QObject *parent) } if(!rda->cmdSwitch()->processed(i)) { fprintf(stderr,"feed_image_test: unknown command option \"%s\"\n", - (const char *)rda->cmdSwitch()->key(i)); + rda->cmdSwitch()->key(i).toUtf8().constData()); exit(2); } } diff --git a/tests/getpids_test.cpp b/tests/getpids_test.cpp index c9e74f18..a187deb2 100644 --- a/tests/getpids_test.cpp +++ b/tests/getpids_test.cpp @@ -2,7 +2,7 @@ // // Test the Rivendell RDGetPids() function. // -// (C) Copyright 2018 Fred Gleason +// (C) Copyright 2018-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,11 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - -#include -#include +#include #include #include @@ -50,7 +46,7 @@ MainObject::MainObject(QObject *parent) } if(!cmd->processed(i)) { fprintf(stderr,"getpids_test: unknown option \"%s\"\n", - (const char *)cmd->value(i)); + cmd->value(i).toUtf8().constData()); exit(256); } } diff --git a/tests/log_unlink_test.cpp b/tests/log_unlink_test.cpp index e037f794..6205545d 100644 --- a/tests/log_unlink_test.cpp +++ b/tests/log_unlink_test.cpp @@ -2,7 +2,7 @@ // // Test the Rivendell log unlinker methods. // -// (C) Copyright 2017 Fred Gleason +// (C) Copyright 2017-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,11 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - -#include -#include +#include #include #include @@ -52,11 +48,11 @@ MainObject::MainObject(QObject *parent) cmd->setProcessed(i,true); } if(cmd->key(i)=="--source") { - if(cmd->value(i).lower()=="traffic") { + if(cmd->value(i).toLower()=="traffic") { test_import_source=RDSvc::Traffic; } else { - if(cmd->value(i).lower()=="music") { + if(cmd->value(i).toLower()=="music") { test_import_source=RDSvc::Music; } else { @@ -69,7 +65,7 @@ MainObject::MainObject(QObject *parent) } if(!cmd->processed(i)) { fprintf(stderr,"log_unlink_test: unknown option \"%s\"\n", - (const char *)cmd->value(i)); + cmd->value(i).toUtf8().constData()); exit(256); } } @@ -90,7 +86,7 @@ MainObject::MainObject(QObject *parent) // QString err (tr("upload_test: ")); if(!RDOpenDb(&schema,&err,test_config)) { - fprintf(stderr,err.ascii()); + fprintf(stderr,err.toAscii()); delete cmd; exit(256); } @@ -116,7 +112,7 @@ void MainObject::userData() RDSvc *svc=new RDSvc(log->service(),test_station,test_config,this); if(!svc->clearLogLinks(test_import_source,test_log_name, new RDUser(test_ripc->user()),&err_msg)) { - fprintf(stderr,"log_unlink_test: %s\n",(const char *)err_msg); + fprintf(stderr,"log_unlink_test: %s\n",err_msg.toUtf8().constData()); exit(1); } diff --git a/tests/mcast_recv_test.cpp b/tests/mcast_recv_test.cpp index fcfdf500..318b424d 100644 --- a/tests/mcast_recv_test.cpp +++ b/tests/mcast_recv_test.cpp @@ -2,7 +2,7 @@ // // Test the Rivendell multicast receiver routines // -// (C) Copyright 2018 Fred Gleason +// (C) Copyright 2018-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,12 +18,8 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - -#include -#include -#include +#include +#include #include @@ -63,7 +59,7 @@ MainObject::MainObject(QObject *parent) } if(!cmd->processed(i)) { fprintf(stderr,"mcast_recv_test: unknown option \"%s\"\n", - (const char *)cmd->value(i)); + cmd->value(i).toUtf8().constData()); exit(256); } } @@ -84,15 +80,15 @@ MainObject::MainObject(QObject *parent) exit(1); } mcast_multicaster->subscribe(from_addr); - printf("listening for %s at %u\n",(const char *)from_addr.toString(), + printf("listening for %s at %u\n",from_addr.toString().toUtf8().constData(), 0xFFFF&from_port); } void MainObject::receivedData(const QString &msg,const QHostAddress &src_addr) { - printf("%15s: %s\n",(const char *)src_addr.toString(), - (const char *)msg); + printf("%15s: %s\n",src_addr.toString().toUtf8().constData(), + msg.toUtf8().constData()); } diff --git a/tests/metadata_wildcard_test.cpp b/tests/metadata_wildcard_test.cpp index ac8359c4..b6033fcc 100644 --- a/tests/metadata_wildcard_test.cpp +++ b/tests/metadata_wildcard_test.cpp @@ -2,7 +2,7 @@ // // Test the Rivendell multicast receiver routines // -// (C) Copyright 2018 Fred Gleason +// (C) Copyright 2018-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,10 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - -#include +#include #include #include @@ -71,7 +68,7 @@ MainObject::MainObject(QObject *parent) } if(!rda->cmdSwitch()->processed(i)) { fprintf(stderr,"metadata_wildcard_test: unknown option \"%s\"\n", - (const char *)rda->cmdSwitch()->value(i)); + rda->cmdSwitch()->value(i).toUtf8().constData()); exit(256); } } diff --git a/tests/notification_test.cpp b/tests/notification_test.cpp index 329ad445..3918151b 100644 --- a/tests/notification_test.cpp +++ b/tests/notification_test.cpp @@ -2,7 +2,7 @@ // // Test Rivendell file uploading. // -// (C) Copyright 2019 Fred Gleason +// (C) Copyright 2019-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,10 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - #include -#include #include @@ -34,14 +31,14 @@ MainObject::MainObject(QObject *parent) rda=new RDApplication("notification_test","notification_test",NOTIFICATION_TEST_USAGE,this); if(!rda->open(&err_msg)) { - fprintf(stderr,"notification_test: %s\n",(const char *)err_msg); + fprintf(stderr,"notification_test: %s\n",err_msg.toUtf8().constData()); exit(1); } for(unsigned i=0;icmdSwitch()->keys();i++) { if(!rda->cmdSwitch()->processed(i)) { fprintf(stderr,"rdrepld: unknown command option \"%s\"\n", - (const char *)rda->cmdSwitch()->key(i)); + rda->cmdSwitch()->key(i).toUtf8().constData()); exit(2); } } @@ -58,7 +55,7 @@ MainObject::MainObject(QObject *parent) void MainObject::notificationReceivedData(RDNotification *notify) { - printf("%s\n",(const char *)notify->write()); + printf("%s\n",notify->write().toUtf8().constData()); } diff --git a/tests/rdxml_parse_test.cpp b/tests/rdxml_parse_test.cpp index d5d16b93..cf516222 100644 --- a/tests/rdxml_parse_test.cpp +++ b/tests/rdxml_parse_test.cpp @@ -2,7 +2,7 @@ // // Test the Rivendell RDXML parser routines. // -// (C) Copyright 2016 Fred Gleason +// (C) Copyright 2016-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,13 +18,8 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - -#include - -#include -#include +#include +#include #include #include @@ -53,7 +48,7 @@ MainObject::MainObject(QObject *parent) } if(!cmd->processed(i)) { fprintf(stderr,"rdxml_parse_test: unknown option \"%s\"\n", - (const char *)cmd->value(i)); + cmd->value(i).toUtf8().constData()); exit(256); } } @@ -68,7 +63,7 @@ MainObject::MainObject(QObject *parent) file=new QFile(filename); if(!file->open(QIODevice::ReadOnly)) { fprintf(stderr,"rdxml_parse_test: unable to open \"%s\"\n", - (const char *)filename); + filename.toUtf8().constData()); exit(256); } while(file->readLine(line,1024)>=0) { @@ -87,12 +82,12 @@ MainObject::MainObject(QObject *parent) exit(256); } printf("*** CART DATA ***\n"); - printf("%s\n",(const char *)data[0].dump()); + printf("%s\n",data[0].dump().toUtf8().constData()); printf("\n"); for(unsigned i=1;i +// (C) Copyright 2013-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,10 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - -#include +#include #include @@ -53,7 +50,7 @@ MainObject::MainObject(QObject *parent) } if(!cmd->processed(i)) { fprintf(stderr,"readcd_test: unknown option \"%s\"\n", - (const char *)cmd->key(i)); + cmd->key(i).toUtf8().constData()); exit(1); } } diff --git a/tests/reserve_carts_test.cpp b/tests/reserve_carts_test.cpp index 34a06952..7126500f 100644 --- a/tests/reserve_carts_test.cpp +++ b/tests/reserve_carts_test.cpp @@ -18,11 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - #include -#include #include #include @@ -63,7 +59,7 @@ MainObject::MainObject(QObject *parent) } if(!cmd->processed(i)) { fprintf(stderr,"reserve_carts_test: unknown option \"%s\"\n", - (const char *)cmd->value(i)); + cmd->value(i).toUtf8().constData()); exit(256); } } @@ -92,7 +88,7 @@ MainObject::MainObject(QObject *parent) // QString err (tr("upload_test: ")); if(!RDOpenDb(&schema,&err,config)) { - fprintf(stderr,err.ascii()); + fprintf(stderr,err.toAscii()); delete cmd; exit(256); } @@ -103,7 +99,7 @@ MainObject::MainObject(QObject *parent) group=new RDGroup(group_name); if(!group->exists()) { fprintf(stderr,"group \"%s\" does not exist\n", - (const char *)group_name.utf8()); + (const char *)group_name.toUtf8()); exit(256); } if(group->reserveCarts(&cart_nums,config->stationName(),RDCart::Audio, diff --git a/tests/sendmail_test.cpp b/tests/sendmail_test.cpp index 9c5eea09..1f8f19ab 100644 --- a/tests/sendmail_test.cpp +++ b/tests/sendmail_test.cpp @@ -2,7 +2,7 @@ // // Test the Rivendell string encoder routines. // -// (C) Copyright 2013,2016 Fred Gleason +// (C) Copyright 2013-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,11 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - -#include -#include +#include #include #include @@ -89,7 +85,7 @@ MainObject::MainObject(QObject *parent) } if(!cmd->processed(i)) { fprintf(stderr,"sendmail_test: unknown option \"%s\"\n", - (const char *)cmd->key(i)); + cmd->key(i).toUtf8().constData()); exit(RDApplication::ExitInvalidOption); } } diff --git a/tests/stringcode_test.cpp b/tests/stringcode_test.cpp index f1da8104..fbab08cb 100644 --- a/tests/stringcode_test.cpp +++ b/tests/stringcode_test.cpp @@ -2,7 +2,7 @@ // // Test the Rivendell string encoder routines. // -// (C) Copyright 2013,2016 Fred Gleason +// (C) Copyright 2013-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,11 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - -#include -#include +#include #include #include @@ -64,7 +60,7 @@ MainObject::MainObject(QObject *parent) } if(!cmd->processed(i)) { fprintf(stderr,"stringcode_test: unknown option \"%s\"\n", - (const char *)cmd->key(i)); + cmd->key(i).toUtf8().constData()); exit(256); } } @@ -84,18 +80,18 @@ MainObject::MainObject(QObject *parent) } str=QString(teststr).replace("\n",""); - printf("Testing String: |%s|\n",(const char *)str); + printf("Testing String: |%s|\n",str.toUtf8().constData()); if(xml_encode) { - printf(" RDXmlEscape: |%s|\n",(const char *)RDXmlEscape(str)); + printf(" RDXmlEscape: |%s|\n",RDXmlEscape(str).toUtf8().constData()); } if(xml_decode) { - printf(" RDXmlUnescape: |%s|\n",(const char *)RDXmlUnescape(str)); + printf(" RDXmlUnescape: |%s|\n",RDXmlUnescape(str).toUtf8().constData()); } if(url_encode) { - printf(" RDUrlEscape: |%s|\n",(const char *)RDUrlEscape(str)); + printf(" RDUrlEscape: |%s|\n",RDUrlEscape(str).toUtf8().constData()); } if(url_decode) { - printf(" RDUrlUnescape: |%s|\n",(const char *)RDUrlUnescape(str)); + printf(" RDUrlUnescape: |%s|\n",RDUrlUnescape(str).toUtf8().constData()); } printf("\n"); diff --git a/tests/test_hash.cpp b/tests/test_hash.cpp index 0ed0003a..cffc5418 100644 --- a/tests/test_hash.cpp +++ b/tests/test_hash.cpp @@ -2,7 +2,7 @@ // // Test SHA1 hash generation // -// (C) Copyright 2017 Fred Gleason +// (C) Copyright 2017-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include +#include #include #include @@ -52,10 +52,10 @@ MainObject::MainObject(QObject *parent) QString hash=RDSha1Hash(filename); if(hash.isEmpty()) { fprintf(stderr,"test_hash: unable to open \"%s\"\n", - (const char *)filename); + filename.toUtf8().constData()); exit(256); } - printf("%s\n",(const char *)hash); + printf("%s\n",hash.toUtf8().constData()); exit(0); } diff --git a/tests/test_pam.cpp b/tests/test_pam.cpp index 7580dcdc..52dba3e3 100644 --- a/tests/test_pam.cpp +++ b/tests/test_pam.cpp @@ -2,7 +2,7 @@ // // Test PAM Authentication Service // -// (C) Copyright 2010,2016 Fred Gleason +// (C) Copyright 2010-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,11 +18,9 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - #include -#include +#include #include @@ -94,7 +92,7 @@ MainObject::MainObject(QObject *parent) memset(&conv,0,sizeof(conv)); conv.conv=ConversationResponseCallback; - if((err=pam_start(service_name,NULL,&conv,&pamh))!=PAM_SUCCESS) { + if((err=pam_start(service_name.toUtf8(),NULL,&conv,&pamh))!=PAM_SUCCESS) { perror(pam_strerror(pamh,err)); exit(256); } diff --git a/tests/timer_test.cpp b/tests/timer_test.cpp index 91a47928..36ae5e90 100644 --- a/tests/timer_test.cpp +++ b/tests/timer_test.cpp @@ -2,7 +2,7 @@ // // Test QTimer Accuracy // -// (C) Copyright 2013,2016 Fred Gleason +// (C) Copyright 2013-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,10 +18,9 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include #include -#include +#include #include @@ -32,6 +31,7 @@ MainObject::MainObject(QObject *parent) // Timer // test_timer=new QTimer(this); + test_timer->setSingleShot(true); connect(test_timer,SIGNAL(timeout()),this,SLOT(timeoutData())); // @@ -41,7 +41,7 @@ MainObject::MainObject(QObject *parent) if(gettimeofday(&test_start_tv,NULL) !=0) { perror("gettimeofday"); } - test_timer->start(test_interval,true); + test_timer->start(test_interval); } @@ -66,7 +66,7 @@ void MainObject::timeoutData() if(gettimeofday(&test_start_tv,NULL) !=0) { perror("gettimeofday"); } - test_timer->start(test_interval,true); + test_timer->start(test_interval); } diff --git a/tests/upload_test.cpp b/tests/upload_test.cpp index 20a504d5..5393fb41 100644 --- a/tests/upload_test.cpp +++ b/tests/upload_test.cpp @@ -2,7 +2,7 @@ // // Test Rivendell file uploading. // -// (C) Copyright 2010-2020 Fred Gleason +// (C) Copyright 2010-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,9 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include +#include #include #include @@ -44,7 +42,7 @@ MainObject::MainObject(QObject *parent) // rda=new RDApplication("upload_test","upload_test",UPLOAD_TEST_USAGE,this); if(!rda->open(&err_msg)) { - fprintf(stderr,"upload_test: %s\n",(const char *)err_msg); + fprintf(stderr,"upload_test: %s\n",err_msg.toUtf8().constData()); exit(1); } @@ -78,7 +76,7 @@ MainObject::MainObject(QObject *parent) } if(!rda->cmdSwitch()->processed(i)) { fprintf(stderr,"rdrepld: unknown command option \"%s\"\n", - (const char *)rda->cmdSwitch()->key(i)); + rda->cmdSwitch()->key(i).toUtf8().constData()); exit(2); } } @@ -105,7 +103,7 @@ MainObject::MainObject(QObject *parent) conv_err=conv-> runUpload(username,password,ssh_identity_filename,use_identity_file, rda->config()->logXloadDebugData()); - printf("Result: %s\n",(const char *)RDUpload::errorText(conv_err)); + printf("Result: %s\n",RDUpload::errorText(conv_err).toUtf8().constData()); delete conv; exit(0); diff --git a/tests/wav_chunk_test.cpp b/tests/wav_chunk_test.cpp index 85bf3c29..745c5dcb 100644 --- a/tests/wav_chunk_test.cpp +++ b/tests/wav_chunk_test.cpp @@ -2,7 +2,7 @@ // // Test Rivendell file uploading. // -// (C) Copyright 2010,2016-2018 Fred Gleason +// (C) Copyright 2010-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -28,7 +28,7 @@ #include #include -#include +#include #include @@ -68,7 +68,7 @@ MainObject::MainObject(QObject *parent) // // Open File // - if((file_fd=open(filename,O_RDONLY))<0) { + if((file_fd=open(filename.toUtf8(),O_RDONLY))<0) { fprintf(stderr,"wav_chunk_test: unable to open file [%s]\n", strerror(errno)); exit(256); @@ -126,7 +126,9 @@ MainObject::MainObject(QObject *parent) QString name; uint32_t start_pos; while((start_pos=NextChunk(name,&chunk_length))>0) { - printf("Chunk: %s Start: %u [0x%X] Length: %u [0x%X]\n",(const char *)name,start_pos,start_pos,chunk_length+8,chunk_length+8); + printf("Chunk: %s Start: %u [0x%X] Length: %u [0x%X]\n", + name.toUtf8().constData(),start_pos,start_pos,chunk_length+8, + chunk_length+8); lseek(file_fd,chunk_length,SEEK_CUR); } diff --git a/utils/rdalsaconfig/Makefile.am b/utils/rdalsaconfig/Makefile.am index ef1805a6..34d3dd05 100644 --- a/utils/rdalsaconfig/Makefile.am +++ b/utils/rdalsaconfig/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2009-2020 Fred Gleason +## (C) Copyright 2009-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ ## Use automake to process this into a Makefile.in ## -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib -I$(top_srcdir)/rdhpi @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib -I$(top_srcdir)/rdhpi @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib -L$(top_srcdir)/rdhpi MOC = @QT_MOC@ @@ -36,7 +36,7 @@ dist_rdalsaconfig_SOURCES = alsaitem.cpp alsaitem.h\ nodist_rdalsaconfig_SOURCES = moc_rdalsamodel.cpp\ moc_rdalsaconfig.cpp -rdalsaconfig_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @LIBALSA@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdalsaconfig_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @LIBALSA@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ EXTRA_DIST = rdalsaconfig.pro diff --git a/utils/rdalsaconfig/rdalsaconfig.cpp b/utils/rdalsaconfig/rdalsaconfig.cpp index 874923ba..135ca8b2 100644 --- a/utils/rdalsaconfig/rdalsaconfig.cpp +++ b/utils/rdalsaconfig/rdalsaconfig.cpp @@ -90,8 +90,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) // alsa_system_list=new QListView(this); alsa_system_list->setSelectionMode(QAbstractItemView::MultiSelection); - alsa_system_label= - new QLabel(alsa_system_list,tr("ALSA Sound Devices"),this); + alsa_system_label=new QLabel(tr("ALSA Sound Devices"),this); alsa_system_label->setFont(labelFont()); alsa_system_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); alsa_description_label=new QLabel(this); @@ -432,7 +431,6 @@ int main(int argc,char *argv[]) RDConfig *config=new RDConfig(); config->load(); MainWidget *w=new MainWidget(config); - a.setMainWidget(w); w->setGeometry(QRect(QPoint(0,0),w->sizeHint())); w->show(); return a.exec(); diff --git a/utils/rdalsaconfig/rdalsamodel.cpp b/utils/rdalsaconfig/rdalsamodel.cpp index d793802b..20ca3325 100644 --- a/utils/rdalsaconfig/rdalsamodel.cpp +++ b/utils/rdalsaconfig/rdalsamodel.cpp @@ -2,7 +2,7 @@ // // Abstract an ALSA configuration. // -// (C) Copyright 2009-2019 Fred Gleason +// (C) Copyright 2009-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,12 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include -#include - -#include - #include #include @@ -277,7 +271,7 @@ bool RDAlsaModel::saveConfig(const QString &filename) return false; } for(int i=0;i=0) { + while(snd_ctl_open(&snd_ctl,QString().sprintf("hw:%d",index).toUtf8(),0)>=0) { model_alsa_cards.push_back(new RDAlsaCard(snd_ctl,index)); for(int i=0;ipcmQuantity();i++) { model_card_index.push_back(index); diff --git a/utils/rdcheckcuts/Makefile.am b/utils/rdcheckcuts/Makefile.am index db0da22a..c364d722 100644 --- a/utils/rdcheckcuts/Makefile.am +++ b/utils/rdcheckcuts/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2012-2020 Fred Gleason +## (C) Copyright 2012-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -17,7 +17,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -29,7 +29,7 @@ bin_PROGRAMS = rdcheckcuts dist_rdcheckcuts_SOURCES = rdcheckcuts.cpp rdcheckcuts.h -rdcheckcuts_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdcheckcuts_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ *.idb\ diff --git a/utils/rdcheckcuts/rdcheckcuts.cpp b/utils/rdcheckcuts/rdcheckcuts.cpp index 2f33492e..2dbb5327 100644 --- a/utils/rdcheckcuts/rdcheckcuts.cpp +++ b/utils/rdcheckcuts/rdcheckcuts.cpp @@ -44,7 +44,7 @@ MainObject::MainObject(QObject *parent) // rda=static_cast(new RDCoreApplication("rdcheckcuts","rdcheckcuts",RDCHECKCUTS_USAGE,this)); if(!rda->open(&err_msg)) { - fprintf(stderr,"rdcheckcuts: %s\n",(const char *)err_msg); + fprintf(stderr,"rdcheckcuts: %s\n",err_msg.toUtf8().constData()); exit(1); } @@ -58,7 +58,7 @@ MainObject::MainObject(QObject *parent) } if(!rda->cmdSwitch()->processed(i)) { fprintf(stderr,"rdcheckcuts: unknown command option \"%s\"\n", - (const char *)rda->cmdSwitch()->key(i)); + rda->cmdSwitch()->key(i).toUtf8().constData()); exit(2); } } @@ -100,9 +100,9 @@ void MainObject::RenderCut(const QString &cutname) printf("Cut %03d [%s] in cart %06u [%s] is missing audio\n", cut->cutNumber(), - (const char *)cut->description(), + cut->description().toUtf8().constData(), cart->number(), - (const char *)cart->title()); + cart->title().toUtf8().constData()); delete cart; delete cut; } diff --git a/utils/rdcleandirs/Makefile.am b/utils/rdcleandirs/Makefile.am index dd5119fb..922bcf4a 100644 --- a/utils/rdcleandirs/Makefile.am +++ b/utils/rdcleandirs/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2015-2020 Fred Gleason +## (C) Copyright 2015-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -17,7 +17,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -29,7 +29,7 @@ sbin_PROGRAMS = rdcleandirs dist_rdcleandirs_SOURCES = rdcleandirs.cpp rdcleandirs.h -rdcleandirs_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdcleandirs_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ *.exe\ diff --git a/utils/rdclilogedit/Makefile.am b/utils/rdclilogedit/Makefile.am index b0b7ad1f..70c0d55f 100644 --- a/utils/rdclilogedit/Makefile.am +++ b/utils/rdclilogedit/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2016-2020 Fred Gleason +## (C) Copyright 2016-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -17,7 +17,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -34,7 +34,7 @@ dist_rdclilogedit_SOURCES = help.cpp\ nodist_rdclilogedit_SOURCES = moc_rdclilogedit.cpp -rdclilogedit_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdclilogedit_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ *.idb\ diff --git a/utils/rdclilogedit/help.cpp b/utils/rdclilogedit/help.cpp index 6d98e421..3a4549e9 100644 --- a/utils/rdclilogedit/help.cpp +++ b/utils/rdclilogedit/help.cpp @@ -2,7 +2,7 @@ // // A command-line log editor for Rivendell // -// (C) Copyright 2016 Fred Gleason +// (C) Copyright 2016-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -37,7 +37,7 @@ void MainObject::Help(const QStringList &cmds) const processed=true; } else { - QString verb=cmds[1].lower(); + QString verb=cmds[1].toLower(); if(verb=="addcart") { printf("\n"); printf(" addcart \n"); @@ -72,7 +72,7 @@ void MainObject::Help(const QStringList &cmds) const } if((verb=="bye")||(verb=="exit")||(verb=="quit")) { printf("\n"); - printf(" %s\n",(const char *)cmds[1]); + printf(" %s\n",cmds[1].toUtf8().constData()); printf("\n"); printf("Exit the program.\n"); printf("\n"); @@ -88,7 +88,7 @@ void MainObject::Help(const QStringList &cmds) const } if((verb=="?")||(verb=="help")) { printf("\n"); - printf(" %s \n",(const char *)cmds[1]); + printf(" %s \n",cmds[1].toUtf8().constData()); printf("\n"); printf("Print help about command \n"); printf("\n"); diff --git a/utils/rdclilogedit/operations.cpp b/utils/rdclilogedit/operations.cpp index 38557167..e5e4fb22 100644 --- a/utils/rdclilogedit/operations.cpp +++ b/utils/rdclilogedit/operations.cpp @@ -2,7 +2,7 @@ // // A command-line log editor for Rivendell // -// (C) Copyright 2016-2020 Fred Gleason +// (C) Copyright 2016-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -137,8 +137,8 @@ void MainObject::Deletelog(QString logname) void MainObject::Header() const { - printf(" Description: %s\n",(const char *)edit_description); - printf(" Service: %s\n",(const char *)edit_service); + printf(" Description: %s\n",edit_description.toUtf8().constData()); + printf(" Service: %s\n",edit_service.toUtf8().constData()); if(edit_auto_refresh) { printf("Auto Refresh: Yes\n"); } @@ -150,21 +150,21 @@ void MainObject::Header() const } else { printf(" Start Date: %s\n", - (const char *)edit_start_date.toString("yyyy-MM-dd")); + edit_start_date.toString("yyyy-MM-dd").toUtf8().constData()); } if(edit_end_date.isNull()) { printf(" End Date: None\n"); } else { printf(" End Date: %s\n", - (const char *)edit_end_date.toString("yyyy-MM-dd")); + edit_end_date.toString("yyyy-MM-dd").toUtf8().constData()); } if(edit_purge_date.isNull()) { printf(" Purge Date: None\n"); } else { printf(" Purge Date: %s\n", - (const char *)edit_purge_date.toString("yyyy-MM-dd")); + edit_purge_date.toString("yyyy-MM-dd").toUtf8().constData()); } } @@ -172,7 +172,7 @@ void MainObject::Header() const void MainObject::List() { for(int i=0;ilineCount();i++) { - printf("%4d %s\n",i,(const char *)ListLine(edit_log_model,i)); + printf("%4d %s\n",i,ListLine(edit_log_model,i).toUtf8().constData()); } printf("%4d --- end of log ---\n",edit_log_model->lineCount()); } @@ -186,7 +186,7 @@ void MainObject::ListLogs() const sql=QString("select NAME from LOGS order by NAME"); q=new RDSqlQuery(sql); while(q->next()) { - printf("%s\n",(const char *)q->value(0).toString()); + printf("%s\n",q->value(0).toString().toUtf8().constData()); } delete q; } @@ -200,7 +200,7 @@ void MainObject::Listservices() const sql=QString("select NAME from SERVICES order by NAME"); q=new RDSqlQuery(sql); while(q->next()) { - printf("%s\n",(const char *)q->value(0).toString()); + printf("%s\n",q->value(0).toString().toUtf8().constData()); } delete q; } @@ -261,7 +261,7 @@ void MainObject::Load(QString logname) edit_modified=false; } else { - fprintf(stderr,"log \"%s\" does not exist\n",(const char *)logname); + fprintf(stderr,"log \"%s\" does not exist\n",logname.toUtf8().constData()); delete edit_log; edit_log=NULL; } @@ -276,29 +276,29 @@ QString MainObject::ListLine(RDLogModel *model,int line) const switch(logline->timeType()) { case RDLogLine::Hard: ret+=QString(). - sprintf("T%s ",(const char *)logline->startTime(RDLogLine::Logged). - toString("hh:mm:ss")); + sprintf("T%s ",logline->startTime(RDLogLine::Logged). + toString("hh:mm:ss").toUtf8().constData()); break; case RDLogLine::Relative: ret+=QString(). - sprintf(" %s ",(const char *)model->blockStartTime(line). - toString("hh:mm:ss")); + sprintf(" %s ",model->blockStartTime(line). + toString("hh:mm:ss").toUtf8().constData()); break; case RDLogLine::NoTime: ret+=" "; break; } - ret+=QString().sprintf("%-7s", - (const char *)RDLogLine::transText(logline->transType())); + ret+=QString().sprintf("%-7s",RDLogLine::transText(logline->transType()). + toUtf8().constData()); switch(logline->type()) { case RDLogLine::Cart: case RDLogLine::Macro: ret+=QString().sprintf("%06u ",logline->cartNumber()); - ret+=QString().sprintf("%-12s",(const char *)logline->groupName()); - ret+=QString().sprintf("%5s", - (const char *)RDGetTimeLength(logline->forcedLength(),false,false))+" "; + ret+=QString().sprintf("%-12s",logline->groupName().toUtf8().constData()); + ret+=QString().sprintf("%5s",RDGetTimeLength(logline->forcedLength(),false, + false).toUtf8().constData())+" "; ret+=logline->title(); break; diff --git a/utils/rdclilogedit/parser.cpp b/utils/rdclilogedit/parser.cpp index cf1b53fa..35e9e815 100644 --- a/utils/rdclilogedit/parser.cpp +++ b/utils/rdclilogedit/parser.cpp @@ -2,7 +2,7 @@ // // A command-line log editor for Rivendell // -// (C) Copyright 2016-2020 Fred Gleason +// (C) Copyright 2016-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,11 +18,8 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - #include #include - #include #include "rdclilogedit.h" @@ -37,13 +34,13 @@ void MainObject::DispatchCommand(QString cmd) QStringList cmds; QString verb; - cmd=cmd.stripWhiteSpace(); + cmd=cmd.trimmed(); if(cmd.right(1)=="!") { overwrite=true; - cmd=cmd.left(cmd.length()-1).stripWhiteSpace(); + cmd=cmd.left(cmd.length()-1).trimmed(); } cmds=cmd.split(" ",QString::SkipEmptyParts); - verb=cmds[0].lower(); + verb=cmds[0].toLower(); // // No loaded log needed for these @@ -278,7 +275,7 @@ void MainObject::DispatchCommand(QString cmd) if(verb=="setautorefresh") { if(rda->user()->arrangeLog()) { if(cmds.size()==2) { - QString arg=cmds[1].lower(); + QString arg=cmds[1].toLower(); if((arg=="yes")||(arg=="true")||(arg=="y")) { Setautorefresh(true); processed=true; @@ -335,8 +332,8 @@ void MainObject::DispatchCommand(QString cmd) if(cmds.size()>=3) { line=cmds[1].toInt(&ok); if(ok&&(line>=0)&&(linelineCount())) { - cmds.remove(cmds.begin()); - cmds.remove(cmds.begin()); + cmds.removeFirst(); + cmds.removeFirst(); Setcomment(line,cmds.join(" ")); } else { @@ -496,10 +493,10 @@ void MainObject::DispatchCommand(QString cmd) line=cmds[1].toInt(&ok); if(ok&&(line>=0)&&(linelineCount())) { RDLogLine::TimeType ttype=RDLogLine::NoTime; - if(cmds[2].lower()=="hard") { + if(cmds[2].toLower()=="hard") { ttype=RDLogLine::Hard; } - if(cmds[2].lower()=="none") { + if(cmds[2].toLower()=="none") { ttype=RDLogLine::Relative; } switch(ttype) { @@ -548,13 +545,13 @@ void MainObject::DispatchCommand(QString cmd) line=cmds[1].toInt(&ok); if(ok&&(line>=0)&&(linelineCount())) { RDLogLine::TransType trans=RDLogLine::NoTrans; - if(cmds[2].lower()=="play") { + if(cmds[2].toLower()=="play") { trans=RDLogLine::Play; } - if(cmds[2].lower()=="segue") { + if(cmds[2].toLower()=="segue") { trans=RDLogLine::Segue; } - if(cmds[2].lower()=="stop") { + if(cmds[2].toLower()=="stop") { trans=RDLogLine::Stop; } if(trans!=RDLogLine::NoTrans) { @@ -590,7 +587,7 @@ void MainObject::DispatchCommand(QString cmd) } } else { - fprintf(stderr,"%s: no log loaded\n",(const char *)verb); + fprintf(stderr,"%s: no log loaded\n",verb.toUtf8().constData()); processed=true; } diff --git a/utils/rdclilogedit/rdclilogedit.cpp b/utils/rdclilogedit/rdclilogedit.cpp index 01dfe6f7..b867350d 100644 --- a/utils/rdclilogedit/rdclilogedit.cpp +++ b/utils/rdclilogedit/rdclilogedit.cpp @@ -2,7 +2,7 @@ // // A command-line log editor for Rivendell // -// (C) Copyright 2016-2020 Fred Gleason +// (C) Copyright 2016-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -24,9 +24,7 @@ #include #include -#include -#include -#include +#include #include #include @@ -52,7 +50,7 @@ MainObject::MainObject(QObject *parent) // rda=static_cast(new RDCoreApplication("rdclilogedit","rdclilogedit",RDCLILOGEDIT_USAGE,this)); if(!rda->open(&err_msg)) { - fprintf(stderr,"rdclilogedit: %s\n",(const char *)err_msg); + fprintf(stderr,"rdclilogedit: %s\n",err_msg.toUtf8().constData()); exit(1); } @@ -67,7 +65,7 @@ MainObject::MainObject(QObject *parent) } if(!rda->cmdSwitch()->processed(i)) { fprintf(stderr,"rdclilogedit: unknown command option \"%s\"\n", - (const char *)rda->cmdSwitch()->key(i)); + rda->cmdSwitch()->key(i).toUtf8().constData()); exit(2); } } @@ -135,7 +133,7 @@ bool MainObject::TryLock(RDLogLock *lock,const QString &logname) if(stationname!=addr.toString()) { msg+=" ["+addr.toString()+"]"; } - fprintf(stderr,"%s\n",(const char *)msg); + fprintf(stderr,"%s\n",msg.toUtf8().constData()); } return ret; } @@ -144,7 +142,7 @@ bool MainObject::TryLock(RDLogLock *lock,const QString &logname) void MainObject::OverwriteError(const QString &cmd) const { fprintf(stderr,"%s: buffer not saved (append \"!\" to override)\n", - (const char *)cmd); + cmd.toUtf8().constData()); } @@ -156,10 +154,10 @@ void MainObject::PrintPrompt() const } else { if(edit_modified) { - printf("logedit[%s*]> ",(const char *)edit_log->name()); + printf("logedit[%s*]> ",edit_log->name().toUtf8().constData()); } else { - printf("logedit[%s]> ",(const char *)edit_log->name()); + printf("logedit[%s]> ",edit_log->name().toUtf8().constData()); } } fflush(stdout); diff --git a/utils/rdcollect/Makefile.am b/utils/rdcollect/Makefile.am index bbbfab28..6dd92573 100644 --- a/utils/rdcollect/Makefile.am +++ b/utils/rdcollect/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2002-2020 Fred Gleason +## (C) Copyright 2002-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -17,7 +17,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -29,7 +29,7 @@ bin_PROGRAMS = rdcollect dist_rdcollect_SOURCES = rdcollect.cpp rdcollect.h -rdcollect_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdcollect_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ *.exe\ diff --git a/utils/rdcollect/rdcollect.cpp b/utils/rdcollect/rdcollect.cpp index 37243d1a..43fe0206 100644 --- a/utils/rdcollect/rdcollect.cpp +++ b/utils/rdcollect/rdcollect.cpp @@ -2,7 +2,7 @@ // // Collect and combine log exports into a single file. // -// (C) Copyright 2010,2016 Fred Gleason +// (C) Copyright 2010-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -21,8 +21,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -120,7 +120,7 @@ void MainObject::LoadSourceFiles(const QString &src_name, void MainObject::LoadSourceFile(const QString &filename,QStringList *lines) { - Q_LONG n; + long n; char line[1025]; QFile file(filename); if(!file.open(QIODevice::ReadOnly|QIODevice::Text)) { @@ -171,11 +171,11 @@ int MainObject::WriteOutputFile(const QString &filename, std::vector *index) { FILE *f=NULL; - if((f=fopen(filename,"w"))==NULL) { + if((f=fopen(filename.toUtf8(),"w"))==NULL) { return errno; } for(int i=0;iat(i)]); + fprintf(f,"%s\n",lines[index->at(i)].toUtf8().constData()); } fclose(f); return 0; diff --git a/utils/rdconvert/Makefile.am b/utils/rdconvert/Makefile.am index d9344f92..0e6d91f3 100644 --- a/utils/rdconvert/Makefile.am +++ b/utils/rdconvert/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2017-2020 Fred Gleason +## (C) Copyright 2017-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -17,7 +17,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -29,7 +29,7 @@ bin_PROGRAMS = rdconvert dist_rdconvert_SOURCES = rdconvert.cpp rdconvert.h -rdconvert_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdconvert_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ *.exe\ diff --git a/utils/rdconvert/rdconvert.cpp b/utils/rdconvert/rdconvert.cpp index 23513cea..afa312f1 100644 --- a/utils/rdconvert/rdconvert.cpp +++ b/utils/rdconvert/rdconvert.cpp @@ -2,7 +2,7 @@ // // Rivendell file format converter. // -// (C) Copyright 2017-2019 Fred Gleason +// (C) Copyright 2017-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include +#include #include #include @@ -44,7 +44,7 @@ MainObject::MainObject(QObject *parent) // rda=static_cast(new RDCoreApplication("rdconvert","rdconvert",RDCONVERT_USAGE,this)); if(!rda->open(&err_msg)) { - fprintf(stderr,"rdconvert: %s\n",(const char *)err_msg); + fprintf(stderr,"rdconvert: %s\n",err_msg.toUtf8().constData()); exit(1); } @@ -184,7 +184,8 @@ MainObject::MainObject(QObject *parent) conv->setSpeedRatio(speed_ratio); conv_err=conv->convert(); if(conv_err!=RDAudioConvert::ErrorOk) { - fprintf(stderr,"%s\n",(const char *)RDAudioConvert::errorText(conv_err)); + fprintf(stderr,"%s\n", + RDAudioConvert::errorText(conv_err).toUtf8().constData()); exit(256); } diff --git a/utils/rddbconfig/Makefile.am b/utils/rddbconfig/Makefile.am index b3be8191..dc545cde 100644 --- a/utils/rddbconfig/Makefile.am +++ b/utils/rddbconfig/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2009-2020 Fred Gleason +## (C) Copyright 2009-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ ## Use automake to process this into a Makefile.in ## -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib -I$(top_srcdir)/rdhpi @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib -I$(top_srcdir)/rdhpi @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib -L$(top_srcdir)/rdhpi MOC = @QT_MOC@ @@ -33,7 +33,7 @@ dist_rddbconfig_SOURCES = rddbconfig.cpp rddbconfig.h mysql_login.cpp mysql_logi nodist_rddbconfig_SOURCES = moc_rddbconfig.cpp moc_mysql_login.cpp -rddbconfig_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @LIBALSA@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rddbconfig_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @LIBALSA@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ *.qm\ diff --git a/utils/rddbconfig/createdb.cpp b/utils/rddbconfig/createdb.cpp index d920a9f9..4a84660a 100644 --- a/utils/rddbconfig/createdb.cpp +++ b/utils/rddbconfig/createdb.cpp @@ -2,7 +2,7 @@ // // Create Rivendell MySQL database RDDbConfig // -// (C) Copyright 2002-2018 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,9 +18,9 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include -#include +#include +#include +#include #include #include @@ -53,13 +53,15 @@ bool CreateDb::create(QWidget *parent,QString *err_str,RDConfig *rd_config) db.setUserName(db_user); db.setPassword(db_pass); if(!db.open()) { - *err_str+=QString().sprintf("Couldn't open MySQL connection on %s",(const char *)db_host); + *err_str+=QString().sprintf("Couldn't open MySQL connection on %s", + db_host.toUtf8().constData()); return true; } QSqlQuery *q; - sql=QString().sprintf("drop database if exists `%s`",(const char *)db_name); + sql=QString().sprintf("drop database if exists `%s`", + db_name.toUtf8().constData()); q=new QSqlQuery(sql,db); if (!q->isActive()) { *err_str+=QString(QObject::tr("Could not remove old database")); @@ -67,7 +69,8 @@ bool CreateDb::create(QWidget *parent,QString *err_str,RDConfig *rd_config) } delete q; - sql=QString().sprintf("create database if not exists `%s`",(const char *)db_name); + sql=QString().sprintf("create database if not exists `%s`", + db_name.toUtf8().constData()); q=new QSqlQuery(sql,db); if (!q->isActive()) { *err_str+=QString(QObject::tr("Could not create new database")); @@ -78,10 +81,12 @@ bool CreateDb::create(QWidget *parent,QString *err_str,RDConfig *rd_config) // // Drop any existing 'rduser'@'%' and 'rduser'@'localhost' users // - sql=QString().sprintf("drop user '%s'@'%%'",(const char *)rd_config->mysqlUsername()); + sql=QString().sprintf("drop user '%s'@'%%'", + rd_config->mysqlUsername().toUtf8().constData()); q=new QSqlQuery(sql,db); delete q; - sql=QString().sprintf("drop user '%s'@'localhost'",(const char *)rd_config->mysqlUsername()); + sql=QString().sprintf("drop user '%s'@'localhost'", + rd_config->mysqlUsername().toUtf8().constData()); q=new QSqlQuery(sql,db); delete q; @@ -90,29 +95,35 @@ bool CreateDb::create(QWidget *parent,QString *err_str,RDConfig *rd_config) delete q; sql=QString().sprintf("create user '%s'@'%%' identified by \"%s\"", - (const char *)rd_config->mysqlUsername(),(const char *)rd_config->mysqlPassword()); + rd_config->mysqlUsername().toUtf8().constData(), + rd_config->mysqlPassword().toUtf8().constData()); q=new QSqlQuery(sql,db); if (!q->isActive()) { - *err_str+=QString().sprintf("Could not create user: '%s'@'%%'",(const char *)sql); + *err_str+=QString().sprintf("Could not create user: '%s'@'%%'", + sql.toUtf8().constData()); return true; } delete q; sql=QString().sprintf("create user '%s'@'localhost' identified by \"%s\"", - (const char *)rd_config->mysqlUsername(),(const char *)rd_config->mysqlPassword()); + rd_config->mysqlUsername().toUtf8().constData(), + rd_config->mysqlPassword().toUtf8().constData()); q=new QSqlQuery(sql,db); if (!q->isActive()) { - *err_str+=QString().sprintf("Could not create user: '%s'@'localhost'",(const char *)sql); + *err_str+=QString().sprintf("Could not create user: '%s'@'localhost'", + sql.toUtf8().constData()); return true; } delete q; sql=QString().sprintf("grant SELECT, INSERT, UPDATE, DELETE, CREATE, DROP,\ INDEX, ALTER, LOCK TABLES on %s.* to %s", - (const char *)db_name, (const char *)rd_config->mysqlUsername()); + db_name.toUtf8().constData(), + rd_config->mysqlUsername().toUtf8().constData()); q=new QSqlQuery(sql,db); if (!q->isActive()) { - *err_str+=QString().sprintf("Could not set permissions: %s",(const char *)sql); + *err_str+=QString().sprintf("Could not set permissions: %s", + sql.toUtf8().constData()); return true; } delete q; @@ -129,8 +140,10 @@ bool CreateDb::create(QWidget *parent,QString *err_str,RDConfig *rd_config) rddbmgrProcess.waitForFinished(); QApplication::restoreOverrideCursor(); if (rddbmgrProcess.exitCode()) { - *err_str+=QString().sprintf("Failed to create %s database. Rddbmgr exit code=%d", - (const char *)db_name,rddbmgrProcess.exitCode()); + *err_str+= + QString().sprintf("Failed to create %s database. Rddbmgr exit code=%d", + db_name.toUtf8().constData(), + rddbmgrProcess.exitCode()); return true; } diff --git a/utils/rddbconfig/db.cpp b/utils/rddbconfig/db.cpp index 0e1a6234..fcf951d8 100644 --- a/utils/rddbconfig/db.cpp +++ b/utils/rddbconfig/db.cpp @@ -2,7 +2,7 @@ // // Create Rivendell MySQL database RDDbConfig // -// (C) Copyright 2002-2018 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,8 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include +#include #include "db.h" @@ -42,7 +41,7 @@ Db::Db(QString *err_str,RDConfig *config) db.setPassword(config->mysqlPassword()); if(!db.open()) { *err_str+=QString().sprintf("Couldn't open MySQL connection on %s", - (const char *)config->mysqlHostname()); + config->mysqlHostname().toUtf8().constData()); return; } @@ -69,10 +68,12 @@ void Db::clearDatabase(QString name) QSqlDatabase db=QSqlDatabase::database("Rivendell"); if(db.isOpen()){ - q=new QSqlQuery(QString().sprintf("drop database if exists `%s`",(const char *)name),db); + q=new QSqlQuery(QString().sprintf("drop database if exists `%s`", + name.toUtf8().constData()),db); delete q; - q=new QSqlQuery(QString().sprintf("create database `%s`",(const char *)name),db); + q=new QSqlQuery(QString().sprintf("create database `%s`", + name.toUtf8().constData()),db); delete q; } } diff --git a/utils/rddbconfig/mysql_login.cpp b/utils/rddbconfig/mysql_login.cpp index b361a3f0..a83894dc 100644 --- a/utils/rddbconfig/mysql_login.cpp +++ b/utils/rddbconfig/mysql_login.cpp @@ -2,7 +2,7 @@ // // mySQL Administrative Login widget for RDDbConfig // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,8 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include +#include #include "mysql_login.h" @@ -46,10 +45,10 @@ MySqlLogin::MySqlLogin(QString *username,QString *password, QWidget *parent) login_name_edit->setGeometry(sizeHint().width()/2-125+90,50,140,19); login_name_edit->setMaxLength(16); login_name_edit->setFocus(); - QLabel *login_name_label=new QLabel(login_name_edit,tr("&Username:"),this); + QLabel *login_name_label=new QLabel(tr("Username:"),this); login_name_label->setFont(labelFont()); login_name_label->setGeometry(sizeHint().width()/2-125,50,85,19); - login_name_label->setAlignment(Qt::AlignRight|Qt::ShowPrefix); + login_name_label->setAlignment(Qt::AlignRight); // // MySql Login Password @@ -58,11 +57,10 @@ MySqlLogin::MySqlLogin(QString *username,QString *password, QWidget *parent) login_password_edit->setGeometry(sizeHint().width()/2-125+90,70,140,19); login_password_edit->setMaxLength(16); login_password_edit->setEchoMode(QLineEdit::Password); - QLabel *login_password_label= - new QLabel(login_password_edit,tr("&Password:"),this); + QLabel *login_password_label=new QLabel(tr("Password:"),this); login_password_label->setFont(labelFont()); login_password_label->setGeometry(sizeHint().width()/2-125,70,85,19); - login_password_label->setAlignment(Qt::AlignRight|Qt::ShowPrefix); + login_password_label->setAlignment(Qt::AlignRight); // // OK Button diff --git a/utils/rddbconfig/rddbconfig.cpp b/utils/rddbconfig/rddbconfig.cpp index 317e08f2..09b0e59d 100644 --- a/utils/rddbconfig/rddbconfig.cpp +++ b/utils/rddbconfig/rddbconfig.cpp @@ -3,7 +3,7 @@ // A Qt-based application to configure, backup, and restore // the Rivendell database. // -// (C) Copyright 2009-2019 Fred Gleason +// (C) Copyright 2009-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -24,10 +24,9 @@ #include #include -#include -#include -#include -#include +#include +#include +#include #include #include @@ -87,19 +86,19 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) label->setAlignment(Qt::AlignCenter); label_hostname=new QLabel(QString().sprintf("SQL Server: %s", - (const char *)rd_config->mysqlHostname()),this); + rd_config->mysqlHostname().toUtf8().constData()),this); label_hostname->setGeometry(0,5,sizeHint().width(),16); label_hostname->setFont(day_font); label_hostname->setAlignment(Qt::AlignCenter); label_username=new QLabel(QString().sprintf("SQL Usename: %s", - (const char *)rd_config->mysqlUsername()),this); + rd_config->mysqlUsername().toUtf8().constData()),this); label_username->setGeometry(0,20,sizeHint().width(),16); label_username->setFont(day_font); label_username->setAlignment(Qt::AlignCenter); label_dbname=new QLabel(QString().sprintf("SQL Database: %s", - (const char *)rd_config->mysqlDbname()),this); + rd_config->mysqlDbname().toUtf8().constData()),this); label_dbname->setGeometry(0,35,sizeHint().width(),16); label_dbname->setFont(day_font); label_dbname->setAlignment(Qt::AlignCenter); @@ -191,7 +190,7 @@ void MainWidget::mismatchData() if(!stderr.isEmpty()) { QMessageBox::information(this,"Database Modified with Warnings", QString().sprintf("Modified database to version %d with warnings:\n\n%s", - RD_VERSION_DATABASE,(const char *)stderr)); + RD_VERSION_DATABASE,stderr.toUtf8().constData())); } else { QMessageBox::information(this,"Database Modified Successfully", @@ -296,7 +295,7 @@ void MainWidget::backupData() if (!db->isOpen()) { QMessageBox::critical(this,tr("RDDbConfig Error"), QString().sprintf("Could not open %s database.", - (const char *)rd_config->mysqlDbname())); + rd_config->mysqlDbname().toUtf8().constData())); return; } filename=QFileDialog::getSaveFileName(this,"RDDbConfig - "+ @@ -307,9 +306,9 @@ void MainWidget::backupData() if (!filename.isEmpty()) { QProcess backupProcess(this); QStringList args; - args << QString().sprintf("--user=%s",(const char *)rd_config->mysqlUsername()) - << QString().sprintf("--password=%s",(const char *)rd_config->mysqlPassword()) - << QString().sprintf("--host=%s",(const char *)rd_config->mysqlHostname()) + args << QString().sprintf("--user=%s",rd_config->mysqlUsername().toUtf8().constData()) + << QString().sprintf("--password=%s",rd_config->mysqlPassword().toUtf8().constData()) + << QString().sprintf("--host=%s",rd_config->mysqlHostname().toUtf8().constData()) << rd_config->mysqlDbname(); backupProcess.setStandardOutputFile(filename); QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); @@ -323,11 +322,11 @@ void MainWidget::backupData() else { QMessageBox::information(this,"Database Backed Up Successfully", QString().sprintf("Backed up %s database to %s", - (const char *)rd_config->mysqlDbname(), - (const char *)filename)); + rd_config->mysqlDbname().toUtf8().constData(), + filename.toUtf8().constData())); RDApplication::syslog(rd_config,LOG_INFO,"backed up %s database to %s", - (const char *)rd_config->mysqlDbname(), - (const char *)filename); + rd_config->mysqlDbname().toUtf8().constData(), + filename.toUtf8().constData()); } } } @@ -357,9 +356,9 @@ void MainWidget::restoreData() QProcess restoreProcess(this); QStringList args; - args << QString().sprintf("--user=%s",(const char *)rd_config->mysqlUsername()) - << QString().sprintf("--password=%s",(const char *)rd_config->mysqlPassword()) - << QString().sprintf("--host=%s",(const char *)rd_config->mysqlHostname()) + args << QString().sprintf("--user=%s",rd_config->mysqlUsername().toUtf8().constData()) + << QString().sprintf("--password=%s",rd_config->mysqlPassword().toUtf8().constData()) + << QString().sprintf("--host=%s",rd_config->mysqlHostname().toUtf8().constData()) << rd_config->mysqlDbname(); restoreProcess.setStandardInputFile(filename); QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); @@ -374,11 +373,11 @@ void MainWidget::restoreData() else { QMessageBox::information(this,"Database Restored Successfully", QString().sprintf("Restored %s database from %s", - (const char *)rd_config->mysqlDbname(), - (const char *)filename)); + rd_config->mysqlDbname().toUtf8().constData(), + filename.toUtf8().constData())); RDApplication::syslog(rd_config,LOG_INFO,"restored %s database from %s", - (const char *)rd_config->mysqlDbname(), - (const char *)filename); + rd_config->mysqlDbname().toUtf8().constData(), + filename.toUtf8().constData()); } emit updateLabels(); startDaemons(); @@ -448,7 +447,6 @@ int main(int argc,char *argv[]) RDConfig *config=new RDConfig(); config->load(); QApplication a(argc,argv); - MainWidget *w=new MainWidget(config); - a.setMainWidget(w); + new MainWidget(config); return a.exec(); } diff --git a/utils/rddbmgr/Makefile.am b/utils/rddbmgr/Makefile.am index a292c814..bea833fa 100644 --- a/utils/rddbmgr/Makefile.am +++ b/utils/rddbmgr/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2018-2020 Fred Gleason +## (C) Copyright 2018-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -17,7 +17,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -fno-var-tracking-assignments -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -fno-var-tracking-assignments -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -36,7 +36,7 @@ dist_rddbmgr_SOURCES = check.cpp\ schemamap.cpp\ updateschema.cpp -rddbmgr_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rddbmgr_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ *.exe\ diff --git a/utils/rddbmgr/check.cpp b/utils/rddbmgr/check.cpp index bb3fdc13..5c3377ae 100644 --- a/utils/rddbmgr/check.cpp +++ b/utils/rddbmgr/check.cpp @@ -2,7 +2,7 @@ // // Routines for --check for rddbmgr(8) // -// (C) Copyright 2018 Fred Gleason +// (C) Copyright 2018-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -25,19 +25,14 @@ #include #include -#include -#include +#include +#include #include -#include -#include #include -#include -#include #include #include #include -#include #include "rddbmgr.h" @@ -344,7 +339,7 @@ void MainObject::RewriteTable(const QString &tblname, unlink(temp2_filename.toUtf8()); unlink(temp3_filename.toUtf8()); unlink(out_filename.toUtf8()); - rmdir(tempdir); + rmdir(tempdir.toUtf8()); } @@ -435,7 +430,7 @@ void MainObject::RelinkAudio(const QString &srcdir) const // (Perhaps) delete the source file // if(db_relink_audio_move&&delete_source) { - unlink(filename); + unlink(filename.toUtf8()); } } } @@ -451,8 +446,8 @@ void MainObject::RelinkCut(const QString &src_filename,const QString &cutname, fflush(stdout); if(db_relink_audio_move) { - unlink(RDCut::pathName(cutname)); - if(link(src_filename,RDCut::pathName(cutname))<0) { + unlink(RDCut::pathName(cutname).toUtf8()); + if(link(src_filename.toUtf8(),RDCut::pathName(cutname).toUtf8())<0) { if(errno==EXDEV) { // We're crossing filesystems, so do a copy if(firstdest->isEmpty()) { if(CopyToAudioStore(RDCut::pathName(cutname),src_filename)) { @@ -460,24 +455,25 @@ void MainObject::RelinkCut(const QString &src_filename,const QString &cutname, } else { fprintf(stderr,"unable to copy file \"%s\"\n", - (const char *)src_filename); + src_filename.toUtf8().constData()); *delete_src=false; } } else { - unlink(RDCut::pathName(cutname)); - link(*firstdest,RDCut::pathName(cutname)); + unlink(RDCut::pathName(cutname).toUtf8()); + link((*firstdest).toUtf8(),RDCut::pathName(cutname).toUtf8()); } } else { fprintf(stderr,"unable to move file \"%s\" [%s]\n", - (const char *)src_filename,strerror(errno)); + src_filename.toUtf8().constData(),strerror(errno)); *delete_src=false; } } else { - chown(RDCut::pathName(cutname),db_config->uid(),db_config->gid()); - chmod(RDCut::pathName(cutname),S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP); + chown(RDCut::pathName(cutname).toUtf8(),db_config->uid(), + db_config->gid()); + chmod(RDCut::pathName(cutname).toUtf8(),S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP); } } else { @@ -487,12 +483,12 @@ void MainObject::RelinkCut(const QString &src_filename,const QString &cutname, } else { fprintf(stderr,"unable to copy file \"%s\"\n", - (const char *)src_filename); + src_filename.toUtf8().constData()); } } else { - unlink(RDCut::pathName(cutname)); - link(*firstdest,RDCut::pathName(cutname)); + unlink(RDCut::pathName(cutname).toUtf8()); + link((*firstdest).toUtf8(),RDCut::pathName(cutname).toUtf8()); } } printf(" done.\n"); @@ -511,8 +507,8 @@ void MainObject::RelinkCast(const QString &src_filename,const QString &keyname, fflush(stdout); if(db_relink_audio_move) { - unlink(destpath); - if(link(src_filename,destpath)<0) { + unlink(destpath.toUtf8()); + if(link(src_filename.toUtf8(),destpath.toUtf8())<0) { if(errno==EXDEV) { // We're crossing filesystems, so do a copy if(firstdest->isEmpty()) { if(CopyToAudioStore(destpath,src_filename)) { @@ -520,40 +516,40 @@ void MainObject::RelinkCast(const QString &src_filename,const QString &keyname, } else { fprintf(stderr,"unable to copy file \"%s\"\n", - (const char *)src_filename); + src_filename.toUtf8().constData()); *delete_src=false; } } else { - unlink(destpath); - link(*firstdest,destpath); + unlink(destpath.toUtf8()); + link((*firstdest).toUtf8(),destpath.toUtf8()); } } else { fprintf(stderr,"unable to move file \"%s\" [%s]\n", - (const char *)src_filename,strerror(errno)); + src_filename.toUtf8().constData(),strerror(errno)); *delete_src=false; } } else { - chown(destpath,db_config->uid(),db_config->gid()); - chmod(destpath,S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP); + chown(destpath.toUtf8(),db_config->uid(),db_config->gid()); + chmod(destpath.toUtf8(),S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP); } } else { if(firstdest->isEmpty()) { - unlink(destpath); + unlink(destpath.toUtf8()); if(CopyToAudioStore(destpath,src_filename)) { *firstdest=destpath; } else { fprintf(stderr,"unable to copy file \"%s\" [%s]\n", - (const char *)src_filename,strerror(errno)); + src_filename.toUtf8().constData(),strerror(errno)); } } else { - unlink(destpath); - link(*firstdest,destpath); + unlink(destpath.toUtf8()); + link((*firstdest).toUtf8(),destpath.toUtf8()); } } printf(" done.\n"); @@ -573,7 +569,7 @@ void MainObject::CheckOrphanedTracks() const q1=new QSqlQuery(sql); if(!q1->first()) { printf(" Found orphaned track %u - \"%s\". Delete? (y/N) ", - q->value(0).toUInt(),(const char *)q->value(1).toString()); + q->value(0).toUInt(),q->value(1).toString().toUtf8().constData()); fflush(NULL); if(UserResponse()) { RDCart *cart=new RDCart(q->value(0).toUInt()); @@ -607,7 +603,7 @@ void MainObject::CheckCutCounts() const q1=new QSqlQuery(sql); if(q1->size()!=q->value(1).toInt()) { printf(" Cart %u [%s] has invalid cut count, fix (y/N)?", - q->value(0).toUInt(),(const char *)q->value(2).toString()); + q->value(0).toUInt(),q->value(2).toString().toUtf8().constData()); if(UserResponse()) { RDCart *cart=new RDCart(q->value(0).toUInt()); cart->updateLength(); @@ -654,16 +650,17 @@ void MainObject::CheckOrphanedCarts() const q=new QSqlQuery(sql); while(q->next()) { printf(" Cart %06u [%s] has missing/invalid group.\n", - q->value(0).toUInt(),(const char *)q->value(1).toString()); + q->value(0).toUInt(),q->value(1).toString().toUtf8().constData()); if(db_orphan_group_name.isEmpty()) { printf(" Rerun rddbcheck with the --orphan-group= switch to fix.\n\n"); } else { - printf(" Assign to group \"%s\" (y/N)?",(const char *)db_orphan_group_name); + printf(" Assign to group \"%s\" (y/N)?", + db_orphan_group_name.toUtf8().constData()); if(UserResponse()) { sql=QString(). sprintf("update CART set GROUP_NAME=\"%s\" where NUMBER=%u", - (const char *)RDEscapeString(db_orphan_group_name), + RDEscapeString(db_orphan_group_name).toUtf8().constData(), q->value(0).toUInt()); q1=new QSqlQuery(sql); delete q1; @@ -688,8 +685,8 @@ void MainObject::CheckOrphanedCuts() const q=new QSqlQuery(sql); while(q->next()) { printf(" Cut %s [%s] is orphaned.\n", - (const char *)q->value(0).toString(), - (const char *)q->value(1).toString()); + q->value(0).toString().toUtf8().constData(), + q->value(1).toString().toUtf8().constData()); // // Try to repair it // @@ -705,7 +702,7 @@ void MainObject::CheckOrphanedCuts() const sql=QString(). sprintf("update CUTS set CART_NUMBER=%u where CUT_NAME=\"%s\"", q1->value(0).toUInt(), - (const char *)q->value(0).toString()); + q->value(0).toString().toUtf8().constData()); q2=new QSqlQuery(sql); delete q2; delete q1; @@ -724,7 +721,7 @@ void MainObject::CheckOrphanedCuts() const printf(" Clear it (y/N)?"); if(UserResponse()) { sql=QString().sprintf("delete from CUTS where CUT_NAME=\"%s\"", - (const char *)q->value(0).toString()); + q->value(0).toString().toUtf8().constData()); q1=new QSqlQuery(sql); delete q1; } @@ -736,13 +733,14 @@ void MainObject::CheckOrphanedCuts() const else { printf(" Clear it (y/N)?"); if(UserResponse()) { - system("mv "+file->filePath()+" "+db_dump_cuts_dir+"/"); + system(("mv "+file->filePath()+" "+db_dump_cuts_dir+"/").toUtf8()); sql=QString().sprintf("delete from CUTS where CUT_NAME=\"%s\"", - (const char *)q->value(0).toString()); + q->value(0).toString().toUtf8().constData()); q1=new QSqlQuery(sql); delete q1; - printf(" Saved audio in \"%s/%s\"\n",(const char *)db_dump_cuts_dir, - (const char *)file->fileName()); + printf(" Saved audio in \"%s/%s\"\n", + db_dump_cuts_dir.toUtf8().constData(), + file->fileName().toUtf8().constData()); } } } @@ -757,33 +755,41 @@ void MainObject::CheckOrphanedCuts() const void MainObject::CheckOrphanedAudio() const { QDir dir(db_config->audioRoot()); - QStringList list=dir.entryList("??????_???.wav",QDir::Files); + QStringList filters; + filters.push_back("??????_???.wav"); + QStringList list=dir.entryList(filters); for(int i=0;ifirst()) { printf(" File \"%s/%s\" is orphaned.\n", - (const char *)db_config->audioRoot(),(const char *)list[i]); + db_config->audioRoot().toUtf8().constData(), + list.at(i).toUtf8().constData()); if(db_dump_cuts_dir.isEmpty()) { printf( " Rerun rddbcheck with the --dump-cuts-dir= switch to fix.\n\n"); } else { - printf(" Move to \"%s\" (y/N)? ",(const char *)db_dump_cuts_dir); + printf(" Move to \"%s\" (y/N)? ", + db_dump_cuts_dir.toUtf8().constData()); if(UserResponse()) { system(QString().sprintf("mv %s/%s %s/", - (const char *)db_config->audioRoot(), - (const char *)list[i], - (const char *)db_dump_cuts_dir)); - printf(" Saved audio in \"%s/%s\"\n",(const char *)db_dump_cuts_dir, - (const char *)list[i]); + db_config->audioRoot().toUtf8(). + constData(), + list.at(i).toUtf8().constData(), + db_dump_cuts_dir.toUtf8().constData()). + toUtf8()); + printf(" Saved audio in \"%s/%s\"\n", + db_dump_cuts_dir.toUtf8().constData(), + list.at(i).toUtf8().constData()); } } } @@ -827,7 +833,7 @@ void MainObject::Rehash(const QString &arg) const unsigned cartnum; bool ok=false; - if(arg.lower()=="all") { + if(arg.toLower()=="all") { sql=QString("select NUMBER from CART where ")+ QString().sprintf("TYPE=%d ",RDCart::Audio)+ "order by NUMBER"; @@ -877,7 +883,7 @@ void MainObject::RehashCut(const QString &cutnum) const QString hash=RDSha1Hash(RDCut::pathName(cutnum),true); if(hash.isEmpty()) { printf(" Unable to generate hash for \"%s\"\n", - (const char *)RDCut::pathName(cutnum)); + RDCut::pathName(cutnum).toUtf8().constData()); } else { RDCut *cut=new RDCut(cutnum); @@ -890,9 +896,9 @@ void MainObject::RehashCut(const QString &cutnum) const RDCart *cart=new RDCart(RDCut::cartNumber(cutnum)); printf(" Cut %d [%s] in cart %06u [%s] has inconsistent SHA1 hash. Fix? (y/N) ", cut->cutNumber(), - (const char *)cut->description(), + cut->description().toUtf8().constData(), cart->number(), - (const char *)cart->title()); + cart->title().toUtf8().constData()); fflush(NULL); if(UserResponse()) { cut->setSha1Hash(hash); @@ -902,7 +908,7 @@ void MainObject::RehashCut(const QString &cutnum) const } } else { - printf(" Cut \"%s\" does not exist.\n",(const char *)cutnum); + printf(" Cut \"%s\" does not exist.\n",cutnum.toUtf8().constData()); } delete cut; } @@ -918,9 +924,9 @@ void MainObject::SetCutLength(const QString &cutname,int len) const printf(" Cut %d [%s] in cart %06u [%s] has invalid length. Correct? (y/N) ", cut->cutNumber(), - (const char *)cut->description(), + cut->description().toUtf8().constData(), cart->number(), - (const char *)cart->title()); + cart->title().toUtf8().constData()); fflush(NULL); if(UserResponse()) { fflush(NULL); @@ -986,12 +992,12 @@ bool MainObject::CopyToAudioStore(const QString &destfile, int blksize; char *data=NULL; - if((src_fd=open(srcfile,O_RDONLY))<0) { + if((src_fd=open(srcfile.toUtf8(),O_RDONLY))<0) { return false; } fstat(src_fd,&src_stat); mode_t mask=umask(S_IRWXO); - if((dest_fd=open(destfile,O_WRONLY|O_CREAT|O_TRUNC, + if((dest_fd=open(destfile.toUtf8(),O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP))<0) { close(src_fd); return false; diff --git a/utils/rddbmgr/create.cpp b/utils/rddbmgr/create.cpp index 5366a52c..ef5fc49a 100644 --- a/utils/rddbmgr/create.cpp +++ b/utils/rddbmgr/create.cpp @@ -2,7 +2,7 @@ // // Routines for --create for rddbmgr(8) // -// (C) Copyright 2018 Fred Gleason +// (C) Copyright 2018-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -2110,7 +2110,7 @@ bool MainObject::InititalizeNewDb(const QString &station_name,bool gen_audio, "DESCRIPTION=\"Workstation "+RDEscapeString(station_name)+"\","+ "USER_NAME=\"user\","+ "DEFAULT_NAME=\"user\""; - struct hostent *hostent=gethostbyname((const char *)station_name); + struct hostent *hostent=gethostbyname(station_name.toUtf8()); if(hostent!=NULL) { sql+=QString().sprintf(",IPV4_ADDRESS=\"%d.%d.%d.%d\"", 0xFF&hostent->h_addr[0],0xFF&hostent->h_addr[1], @@ -2317,9 +2317,9 @@ bool MainObject::InititalizeNewDb(const QString &station_name,bool gen_audio, while(q->next()) { sql=QString().sprintf("insert into AUDIO_PERMS set\ GROUP_NAME=\"%s\",SERVICE_NAME=\"%s\"", - (const char *) - RDEscapeString(q->value(0).toString()), - (const char *)RDEscapeString(RD_SERVICE_NAME)); + RDEscapeString(q->value(0).toString()). + toUtf8().constData(), + RDEscapeString(RD_SERVICE_NAME).toUtf8().constData()); if(!RDSqlQuery::apply(sql,err_msg)) { return false; } @@ -2483,15 +2483,17 @@ bool MainObject::InititalizeNewDb(const QString &station_name,bool gen_audio, if(gen_audio) { QString filename= QString().sprintf("%s/999999_001.%s", - RDConfiguration()->audioRoot().ascii(), - RDConfiguration()->audioExtension().ascii()); + RDConfiguration()->audioRoot().toAscii().constData(), + RDConfiguration()->audioExtension().toAscii(). + constData()); QString cmd=QString().sprintf("rdgen -t 10 -l 16 %s", - (const char *)filename); - system((const char *)cmd); + filename.toUtf8().constData()); + system(cmd.toUtf8()); if(getuid()==0) { - chown(filename,RDConfiguration()->uid(),RDConfiguration()->gid()); - chmod (filename,S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH); + chown(filename.toUtf8(),RDConfiguration()->uid(), + RDConfiguration()->gid()); + chmod (filename.toUtf8(),S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH); } } diff --git a/utils/rddbmgr/printstatus.cpp b/utils/rddbmgr/printstatus.cpp index 7d3521fd..c3ca9888 100644 --- a/utils/rddbmgr/printstatus.cpp +++ b/utils/rddbmgr/printstatus.cpp @@ -2,7 +2,7 @@ // // Print the status of a database. // -// (C) Copyright 2018 Fred Gleason +// (C) Copyright 2018-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,10 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - -#include - #include "rddbmgr.h" bool MainObject::PrintStatus(QString *err_msg) const @@ -45,7 +41,7 @@ bool MainObject::PrintStatus(QString *err_msg) const } printf("Rivendell database, schema %d [%s]\n",schema, - (const char *)GetSchemaVersion(schema)); + GetSchemaVersion(schema).toUtf8().constData()); *err_msg="ok"; return true; diff --git a/utils/rddbmgr/rddbmgr.cpp b/utils/rddbmgr/rddbmgr.cpp index 5e9cdb3c..ba5b1f91 100644 --- a/utils/rddbmgr/rddbmgr.cpp +++ b/utils/rddbmgr/rddbmgr.cpp @@ -157,7 +157,7 @@ MainObject::MainObject(QObject *parent) if(cmd->key(i)=="--set-version") { bool ok2=false; set_version=cmd->value(i); - QStringList f0=f0.split(".",set_version); + QStringList f0=set_version.split(".",QString::KeepEmptyParts); if(f0.size()==3) { ok2=true; for(int i=0;i<3;i++) { @@ -234,7 +234,7 @@ MainObject::MainObject(QObject *parent) if(!cmd->processed(i)) { fprintf(stderr,"rddbmgr: unrecognized option \"%s\"\n", - (const char *)cmd->key(i)); + cmd->key(i).toUtf8().constData()); exit(1); } } @@ -261,17 +261,17 @@ MainObject::MainObject(QObject *parent) QFileInfo file(db_dump_cuts_dir); if(!file.exists()) { fprintf(stderr,"rddbmgr: directory \"%s\" does not exist.\n", - (const char *)db_dump_cuts_dir); + db_dump_cuts_dir.toUtf8().constData()); exit(1); } if(!file.isDir()) { fprintf(stderr,"rddbmgr: \"%s\" is not a directory.\n", - (const char *)db_dump_cuts_dir); + db_dump_cuts_dir.toUtf8().constData()); exit(1); } if(!file.isWritable()) { fprintf(stderr,"rddbmgr: \"%s\" is not writable.\n", - (const char *)db_dump_cuts_dir); + db_dump_cuts_dir.toUtf8().constData()); exit(1); } } @@ -283,7 +283,7 @@ MainObject::MainObject(QObject *parent) RDSqlQuery *q=new RDSqlQuery(sql,false); if(!q->first()) { fprintf(stderr,"rddbmgr: invalid group \"%s\"\n", - (const char *)db_orphan_group_name); + db_orphan_group_name.toUtf8().constData()); delete q; exit(1); } @@ -293,12 +293,12 @@ MainObject::MainObject(QObject *parent) if(db_verbose) { fprintf(stderr,"Using DB Credentials:\n"); - fprintf(stderr," Hostname: %s\n",(const char *)db_mysql_hostname); - fprintf(stderr," Loginname: %s\n",(const char *)db_mysql_loginname); - fprintf(stderr," Password: %s\n",(const char *)db_mysql_password); - fprintf(stderr," Database: %s\n",(const char *)db_mysql_database); - fprintf(stderr," Driver: %s\n",(const char *)db_mysql_driver); - fprintf(stderr," Engine: %s\n",(const char *)db_mysql_engine); + fprintf(stderr," Hostname: %s\n",db_mysql_hostname.toUtf8().constData()); + fprintf(stderr," Loginname: %s\n",db_mysql_loginname.toUtf8().constData()); + fprintf(stderr," Password: %s\n",db_mysql_password.toUtf8().constData()); + fprintf(stderr," Database: %s\n",db_mysql_database.toUtf8().constData()); + fprintf(stderr," Driver: %s\n",db_mysql_driver.toUtf8().constData()); + fprintf(stderr," Engine: %s\n",db_mysql_engine.toUtf8().constData()); } // @@ -311,7 +311,7 @@ MainObject::MainObject(QObject *parent) db.setHostName(db_mysql_hostname); if(!db.open()) { fprintf(stderr,"rddbmgr: unable to open database [%s]\n", - (const char *)db.lastError().text()); + db.lastError().text().toUtf8().constData()); exit(1); } db_table_create_postfix=RDConfig::createTablePostfix(db_mysql_engine); @@ -372,7 +372,7 @@ MainObject::MainObject(QObject *parent) } if(!ok) { - fprintf(stderr,"rddbmgr: %s\n",(const char *)err_msg); + fprintf(stderr,"rddbmgr: %s\n",err_msg.toUtf8().constData()); exit(1); } exit(0); diff --git a/utils/rddbmgr/revertschema.cpp b/utils/rddbmgr/revertschema.cpp index 43467876..5b204caf 100644 --- a/utils/rddbmgr/revertschema.cpp +++ b/utils/rddbmgr/revertschema.cpp @@ -883,8 +883,10 @@ bool MainObject::RevertSchema(int cur_schema,int set_schema,QString *err_msg) q=new RDSqlQuery("select CART_NUMBER,SCHED_CODE from CART_SCHED_CODES order by CART_NUMBER",false); while(q->next()) { - schedcode=QString().sprintf("%-11s",(const char *)q->value(1).toString()); - q1=new RDSqlQuery(QString().sprintf("update CART set SCHED_CODES=CONCAT(\"%s\",SCHED_CODES) where NUMBER=%d",(const char *)schedcode,q->value(0).toUInt()),false); + schedcode=QString().sprintf("%-11s", + q->value(1).toString().toUtf8().constData()); + q1=new RDSqlQuery(QString().sprintf("update CART set SCHED_CODES=CONCAT(\"%s\",SCHED_CODES) where NUMBER=%d",schedcode.toUtf8().constData(), + q->value(0).toUInt()),false); delete q1; } delete q; diff --git a/utils/rddbmgr/schemamap.cpp b/utils/rddbmgr/schemamap.cpp index a0878fba..fdf6f8f2 100644 --- a/utils/rddbmgr/schemamap.cpp +++ b/utils/rddbmgr/schemamap.cpp @@ -2,7 +2,7 @@ // // DB schema version <==> Rivendell version map // -// (C) Copyright 2018-2020 Fred Gleason +// (C) Copyright 2018-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,9 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include - #include "rddbmgr.h" class VersionString : public QString @@ -53,7 +50,7 @@ VersionString::VersionString() VersionString::VersionString(const char *str) : QString(str) { - QStringList f0=f0.split(".",str); + QStringList f0=QString(str).split(".",QString::KeepEmptyParts); ver_major=f0[0].toInt(); if(f0.size()>=2) { ver_minor=f0[1].toInt(); @@ -174,10 +171,10 @@ int MainObject::GetVersionSchema(const QString &ver) const // // Normalize String // - if(version.left(1).lower()=="v") { + if(version.left(1).toLower()=="v") { version=version.right(version.length()-1); } - QStringList f0=f0.split(".",version); + QStringList f0=version.split(".",QString::KeepEmptyParts); if(f0.size()!=3) { return 0; } @@ -191,11 +188,11 @@ int MainObject::GetVersionSchema(const QString &ver) const // // Lookup Schema // - if(global_version_map.count(VersionString(f0[0]+"."+f0[1]))==0) { + if(global_version_map.count(VersionString((f0[0]+"."+f0[1]).toUtf8()))==0) { return 0; } - return global_version_map.value(VersionString(f0[0]+"."+f0[1])); + return global_version_map.value(VersionString((f0[0]+"."+f0[1]).toUtf8())); } @@ -205,10 +202,10 @@ QString MainObject::GetSchemaVersion(int schema) const for(QMap::const_iterator it=global_version_map.begin(); it!=global_version_map.end();it++) { - if(it.data()==schema) { + if(it.value()==schema) { return "v"+it.key()+".x"; } - if(it.data()>schema) { + if(it.value()>schema) { return tr("between")+" v"+prev_version+".x "+tr("and")+ " v"+it.key()+".x"; } diff --git a/utils/rddbmgr/updateschema.cpp b/utils/rddbmgr/updateschema.cpp index 5ad9c207..f20255f4 100644 --- a/utils/rddbmgr/updateschema.cpp +++ b/utils/rddbmgr/updateschema.cpp @@ -18,8 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - #include #include #include @@ -4539,7 +4537,7 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg) tablename.replace(" ","_"); sql=QString(). sprintf("alter table %s_LOG modify column ORIGIN_USER char(255)", - (const char *)tablename); + tablename.toUtf8().constData()); if(!RDSqlQuery::apply(sql,err_msg)) { return false; } @@ -4553,13 +4551,13 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg) tablename.replace(" ","_"); sql=QString(). sprintf("alter table %s_PRE modify column ORIGIN_USER char(255)", - (const char *)tablename); + tablename.toUtf8().constData()); if(!RDSqlQuery::apply(sql,err_msg)) { return false; } sql=QString(). sprintf("alter table %s_POST modify column ORIGIN_USER char(255)", - (const char *)tablename); + tablename.toUtf8().constData()); if(!RDSqlQuery::apply(sql,err_msg)) { return false; } @@ -5164,7 +5162,8 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg) sql="select NAME from STATIONS"; q=new RDSqlQuery(sql,false); while(q->next()) { - if (!InsertRDAirplayHotkeys((const char *)q->value(0).toString(),err_msg)) { + if (!InsertRDAirplayHotkeys(q->value(0).toString().toUtf8().constData(), + err_msg)) { return false; } } @@ -7128,7 +7127,7 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg) while(q->next()) { if(DropTable(q->value(0).toString(),err_msg)) { fprintf(stderr,"rddbmgr: dropping orphaned LOG table \"%s\"\n", - (const char *)q->value(0).toString()); + q->value(0).toString().toUtf8().constData()); } } delete q; @@ -7280,7 +7279,7 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg) while(q->next()) { if(DropTable(q->value(0).toString(),err_msg)) { fprintf(stderr,"rddbmgr: dropping orphaned SRT table \"%s\"\n", - (const char *)q->value(0).toString()); + q->value(0).toString().toUtf8().constData()); } } delete q; @@ -7395,7 +7394,7 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg) while(q->next()) { if(DropTable(q->value(0).toString(),err_msg)) { fprintf(stderr,"rddbmgr: dropping orphaned PRE table \"%s\"\n", - (const char *)q->value(0).toString()); + q->value(0).toString().toUtf8().constData()); } } delete q; @@ -7406,7 +7405,7 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg) while(q->next()) { if(DropTable(q->value(0).toString(),err_msg)) { fprintf(stderr,"rddbmgr: dropping orphaned POST table \"%s\"\n", - (const char *)q->value(0).toString()); + q->value(0).toString().toUtf8().constData()); } } delete q; @@ -7511,7 +7510,7 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg) while(q->next()) { if(DropTable(q->value(0).toString(),err_msg)) { fprintf(stderr,"rddbmgr: dropping orphaned CLK table \"%s\"\n", - (const char *)q->value(0).toString()); + q->value(0).toString().toUtf8().constData()); } } delete q; @@ -7583,7 +7582,7 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg) while(q->next()) { if(DropTable(q->value(0).toString(),err_msg)) { fprintf(stderr,"rddbmgr: dropping orphaned RULES table \"%s\"\n", - (const char *)q->value(0).toString()); + q->value(0).toString().toUtf8().constData()); } } delete q; @@ -7659,7 +7658,7 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg) while(q->next()) { if(DropTable(q->value(0).toString(),err_msg)) { fprintf(stderr,"rddbmgr: dropping orphaned STACK table \"%s\"\n", - (const char *)q->value(0).toString()); + q->value(0).toString().toUtf8().constData()); } } delete q; @@ -9574,7 +9573,7 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg) q=new RDSqlQuery("select NUMBER,SCHED_CODES from CART where TYPE=1",false); while(q->next()) { for(int i=0;i<255;i+=11) { - QString code=q->value(1).toString().mid(i,11).stripWhiteSpace(); + QString code=q->value(1).toString().mid(i,11).trimmed(); if((!code.isEmpty())&&(code!=".")) { sql=QString("insert into CART_SCHED_CODES set ")+ "CART_NUMBER="+q->value(0).toString()+","+ @@ -10745,7 +10744,7 @@ bool MainObject::StackLineTitles347(QString *err_msg) const while(q->next()) { if(!q->value(1).isNull()) { sql=QString("update STACK_LINES set ")+ - "TITLE=\""+RDEscapeString(q->value(1).toString().lower().replace(" ",""))+"\" "+ + "TITLE=\""+RDEscapeString(q->value(1).toString().toLower().replace(" ",""))+"\" "+ "where CART=\""+RDEscapeString(q->value(0).toString())+"\""; if(!RDSqlQuery::apply(sql,err_msg)) { delete q; diff --git a/utils/rddelete/Makefile.am b/utils/rddelete/Makefile.am index a38466fe..1ee3a21e 100644 --- a/utils/rddelete/Makefile.am +++ b/utils/rddelete/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2002-2020 Fred Gleason +## (C) Copyright 2002-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -17,7 +17,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -31,7 +31,7 @@ dist_rddelete_SOURCES = rddelete.cpp rddelete.h nodist_rddelete_SOURCES = moc_rddelete.cpp -rddelete_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rddelete_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ *.idb\ diff --git a/utils/rddelete/rddelete.cpp b/utils/rddelete/rddelete.cpp index 749ce73e..5554f7f1 100644 --- a/utils/rddelete/rddelete.cpp +++ b/utils/rddelete/rddelete.cpp @@ -2,7 +2,7 @@ // // A Batch Deleter for Rivendell. // -// (C) Copyright 2013,2016-2018 Fred Gleason +// (C) Copyright 2013-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,7 +18,7 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include +#include #include #include @@ -45,11 +45,9 @@ MainObject::MainObject(QObject *parent) // rda=static_cast(new RDCoreApplication("rddelete","rddelete",RDDELETE_USAGE,this)); if(!rda->open(&err_msg)) { - fprintf(stderr,"rddelete: %s\n",(const char *)err_msg); + fprintf(stderr,"rddelete: %s\n",err_msg.toUtf8().constData()); exit(1); } - // connect(RDDbStatus(),SIGNAL(logText(RDConfig::LogPriority,const QString &)), - // this,SLOT(log(RDConfig::LogPriority,const QString &))); // // Read Command Options @@ -90,7 +88,7 @@ MainObject::MainObject(QObject *parent) } if(!rda->cmdSwitch()->processed(i)) { fprintf(stderr,"rddelete: unknown command option \"%s\"\n", - (const char *)rda->cmdSwitch()->key(i)); + rda->cmdSwitch()->key(i).toUtf8().constData()); exit(2); } } @@ -156,7 +154,7 @@ void MainObject::userData() if(del_carts) { if(!rda->user()->editAudio()) { fprintf(stderr,"rdimport: user \"%s\" has no edit audio permission\n", - (const char *)rda->user()->name()); + rda->user()->name().toUtf8().constData()); exit(256); } DeleteCarts(); @@ -165,7 +163,7 @@ void MainObject::userData() if(del_logs) { if(!rda->user()->deleteLog()) { fprintf(stderr,"rdimport: user \"%s\" has no delete log permission\n", - (const char *)rda->user()->name()); + rda->user()->name().toUtf8().constData()); exit(256); } DeleteLogs(); @@ -191,23 +189,25 @@ void MainObject::DeleteCarts() QString title=cart->title(); if(!cart->owner().isEmpty()) { fprintf(stderr,"rddelete: cart %06u [%s] is a voice track\n", - cartnum,(const char *)title); + cartnum,title.toUtf8().constData()); return; } if(del_dry_run) { if(del_verbose) { - printf("would delete cart %06u [%s]\n",cartnum,(const char *)title); + printf("would delete cart %06u [%s]\n",cartnum, + title.toUtf8().constData()); } } else { if(cart->remove(rda->station(),rda->user(),rda->config())) { if(del_verbose) { - printf("deleted cart %06u [%s]\n",cartnum,(const char *)title); + printf("deleted cart %06u [%s]\n",cartnum, + title.toUtf8().constData()); } } else { fprintf(stderr,"unable to delete cart %06u [%s]\n",cartnum, - (const char *)title); + title.toUtf8().constData()); } } } @@ -236,24 +236,24 @@ void MainObject::DeleteLogs() if(log->exists()) { if(del_dry_run) { if(del_verbose) { - printf("would delete log \"%s\"\n",(const char *)logname); + printf("would delete log \"%s\"\n",logname.toUtf8().constData()); } } else { if(log->remove(rda->station(),rda->user(),rda->config())) { if(del_verbose) { - printf("deleted log \"%s\"\n",(const char *)logname); + printf("deleted log \"%s\"\n",logname.toUtf8().constData()); } } else { fprintf(stderr,"unable to delete log \"%s\".", - (const char *)logname); + logname.toUtf8().constData()); } } } else { fprintf(stderr,"rddelete: log \"%s\" does not exist\n", - (const char *)logname); + logname.toUtf8().constData()); if(!del_continue_after_error) { exit(256); } @@ -274,7 +274,7 @@ bool MainObject::GetNextObject(unsigned *cartnum) } *cartnum=id.toUInt(&ok); if((!ok)||(*cartnum==0)||(*cartnum>RD_MAX_CART_NUMBER)) { - fprintf(stderr,"invalid cart id: %s\n",(const char *)id); + fprintf(stderr,"invalid cart id: %s\n",id.toUtf8().constData()); *cartnum=0; } @@ -321,7 +321,7 @@ bool MainObject::GetNextStdinObject(QString *logname) } *logname+=c; } - *logname=logname->stripWhiteSpace(); + *logname=logname->trimmed(); return true; } diff --git a/utils/rddgimport/Makefile.am b/utils/rddgimport/Makefile.am index 243160d6..62e35986 100644 --- a/utils/rddgimport/Makefile.am +++ b/utils/rddgimport/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2002-2020 Fred Gleason +## (C) Copyright 2002-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -17,7 +17,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -44,7 +44,7 @@ dist_rddgimport_SOURCES = event.cpp event.h\ nodist_rddgimport_SOURCES = moc_rddgimport.cpp -rddgimport_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rddgimport_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ EXTRA_DIST = rddgimport.pro\ rddgimport_de.ts\ diff --git a/utils/rddgimport/rddgimport.cpp b/utils/rddgimport/rddgimport.cpp index 0f959fbe..f6f292ed 100644 --- a/utils/rddgimport/rddgimport.cpp +++ b/utils/rddgimport/rddgimport.cpp @@ -94,7 +94,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) dg_service_box=new QComboBox(this); connect(dg_service_box,SIGNAL(activated(int)), this,SLOT(serviceActivatedData(int))); - dg_service_label=new QLabel(dg_service_box,tr("Service:"),this); + dg_service_label=new QLabel(tr("Service:"),this); dg_service_label->setFont(labelFont()); dg_service_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -104,7 +104,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) dg_filename_edit=new QLineEdit(this); connect(dg_filename_edit,SIGNAL(textChanged(const QString &)), this,SLOT(filenameChangedData(const QString &))); - dg_filename_label=new QLabel(dg_filename_edit,tr("Filename:"),this); + dg_filename_label=new QLabel(tr("Filename:"),this); dg_filename_label->setFont(labelFont()); dg_filename_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); dg_filename_button=new QPushButton(tr("Select"),this); @@ -118,7 +118,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) dg_date_edit=new QDateEdit(this); dg_date_edit->setDisplayFormat("MM/dd/yyyy"); dg_date_edit->setDate(QDate::currentDate()); - dg_date_label=new QLabel(dg_date_edit,tr("Date:"),this); + dg_date_label=new QLabel(tr("Date:"),this); dg_date_label->setFont(labelFont()); dg_date_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); dg_date_button=new QPushButton(tr("Select"),this); @@ -137,7 +137,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) // dg_messages_text=new QTextEdit(this); dg_messages_text->setReadOnly(true); - dg_messages_label=new QLabel(dg_service_box,tr("Messages"),this); + dg_messages_label=new QLabel(tr("Messages"),this); dg_messages_label->setFont(labelFont()); dg_messages_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); @@ -163,7 +163,8 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) q=new RDSqlQuery(sql); while(q->next()) { if(!q->value(1).toString().isEmpty()) { - dg_service_box->insertItem(q->value(0).toString()); + dg_service_box-> + insertItem(dg_service_box->count(),q->value(0).toString()); } } delete q; @@ -294,7 +295,7 @@ bool MainWidget::LoadEvents() QString isci; dg_events.clear(); - if((f=fopen(dg_filename_edit->text(),"r"))==NULL) { + if((f=fopen(dg_filename_edit->text().toUtf8(),"r"))==NULL) { QMessageBox::warning(this,tr("RDDgImport"), tr("Unable to open source file")+"["+ QString(strerror(errno))+"]."); @@ -366,7 +367,7 @@ bool MainWidget::WriteTrafficFile() outname=RDDateDecode(dg_svc->importPath(RDSvc::Traffic), dg_date_edit->date(),rda->station(), rda->config(),dg_svc->name()); - if((f=fopen(outname,"w"))==NULL) { + if((f=fopen(outname.toUtf8(),"w"))==NULL) { LogMessage(tr("WARNING: Unable to open traffic output file")+" \""+ outname+"\" ["+QString(strerror(errno))+"]."); return false; @@ -377,14 +378,15 @@ bool MainWidget::WriteTrafficFile() // for(unsigned i=0;itime().toString("hh:mm:ss")); + fprintf(f,"%s ",evt->time().toString("hh:mm:ss").toUtf8().constData()); fprintf(f,"%06u ",dg_carts[evt->isci()]); - fprintf(f,"%-34s ",(const char *)evt->title()); + fprintf(f,"%-34s ",evt->title().toUtf8().constData()); if(evt->length()<600000) { fprintf(f,"0"); } - fprintf(f,"%s ",(const char *)RDGetTimeLength(evt->length(),true,false)); - fprintf(f,"%-32s ",(const char *)evt->isci()); + fprintf(f,"%s ",RDGetTimeLength(evt->length(),true,false).toUtf8(). + constData()); + fprintf(f,"%-32s ",evt->isci().toUtf8().constData()); fprintf(f,"%032u",i); fprintf(f,"\n"); } @@ -454,10 +456,11 @@ bool MainWidget::ImportSpot(Event *evt,QString *err_msg) // // Find File // - audiofile=dir+"/"+evt->isci()+"."+QString(RDDGIMPORT_FILE_EXTENSION).lower(); + audiofile=dir+"/"+evt->isci()+"."+QString(RDDGIMPORT_FILE_EXTENSION). + toLower(); if(!QFile::exists(audiofile)) { audiofile=dir+"/"+evt->isci()+"."+ - QString(RDDGIMPORT_FILE_EXTENSION).upper(); + QString(RDDGIMPORT_FILE_EXTENSION).toUpper(); if(!QFile::exists(audiofile)) { LogMessage(tr("Missing audio for")+" "+evt->isci()+" ["+evt->title()+ " / "+evt->client()+"]."); @@ -602,8 +605,8 @@ QString MainWidget::GetIsci(const QString &str) const { QString ret; - if(str.stripWhiteSpace().length()==15) { - ret=str.stripWhiteSpace(); + if(str.trimmed().length()==15) { + ret=str.trimmed(); } return ret; } @@ -625,25 +628,25 @@ int main(int argc,char *argv[]) // // Load Translations // - QTranslator qt(0); - qt.load(QString("/usr/share/qt4/translations/qt_")+QTextCodec::locale(), - "."); - a.installTranslator(&qt); + QString loc=RDApplication::locale(); + if(!loc.isEmpty()) { + QTranslator qt(0); + qt.load(QString("/usr/share/qt4/translations/qt_")+loc, + "."); + a.installTranslator(&qt); - QTranslator rd(0); - rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+ - QTextCodec::locale(),"."); - a.installTranslator(&rd); + QTranslator rd(0); + rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+loc,"."); + a.installTranslator(&rd); - QTranslator rdhpi(0); - rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+ - QTextCodec::locale(),"."); - a.installTranslator(&rdhpi); + QTranslator rdhpi(0); + rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+loc,"."); + a.installTranslator(&rdhpi); - QTranslator tr(0); - tr.load(QString(PREFIX)+QString("/share/rivendell/rdgpimon_")+ - QTextCodec::locale(),"."); - a.installTranslator(&tr); + QTranslator tr(0); + tr.load(QString(PREFIX)+QString("/share/rivendell/rdgpimon_")+loc,"."); + a.installTranslator(&tr); + } // // Start Event Loop @@ -651,7 +654,6 @@ int main(int argc,char *argv[]) RDConfig *config=new RDConfig(); config->load(); MainWidget *w=new MainWidget(config); - a.setMainWidget(w); w->setGeometry(QRect(QPoint(0,0),w->sizeHint())); w->show(); return a.exec(); diff --git a/utils/rdexport/Makefile.am b/utils/rdexport/Makefile.am index 206d0937..35cd3141 100644 --- a/utils/rdexport/Makefile.am +++ b/utils/rdexport/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2016-2020 Fred Gleason +## (C) Copyright 2016-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -17,7 +17,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -31,7 +31,7 @@ dist_rdexport_SOURCES = rdexport.cpp rdexport.h nodist_rdexport_SOURCES = moc_rdexport.cpp -rdexport_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdexport_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ *.idb\ diff --git a/utils/rdexport/rdexport.cpp b/utils/rdexport/rdexport.cpp index 9310f1d2..643af53a 100644 --- a/utils/rdexport/rdexport.cpp +++ b/utils/rdexport/rdexport.cpp @@ -22,9 +22,8 @@ #include #include -#include -#include -#include +#include +#include #include #include @@ -129,27 +128,27 @@ MainObject::MainObject(QObject *parent) if(rda->cmdSwitch()->key(i)=="--format") { export_format=rda->cmdSwitch()->value(i); bool ok=false; - if(export_format.lower()=="flac") { + if(export_format.toLower()=="flac") { export_set_format=RDSettings::Flac; ok=true; } - if(export_format.lower()=="mp2") { + if(export_format.toLower()=="mp2") { export_set_format=RDSettings::MpegL2; ok=true; } - if(export_format.lower()=="mp3") { + if(export_format.toLower()=="mp3") { export_set_format=RDSettings::MpegL3; ok=true; } - if(export_format.lower()=="pcm16") { + if(export_format.toLower()=="pcm16") { export_set_format=RDSettings::Pcm16; ok=true; } - if(export_format.lower()=="pcm24") { + if(export_format.toLower()=="pcm24") { export_set_format=RDSettings::Pcm24; ok=true; } - if(export_format.lower()=="vorbis") { + if(export_format.toLower()=="vorbis") { export_set_format=RDSettings::OggVorbis; ok=true; } @@ -491,7 +490,7 @@ void MainObject::ExportCut(RDCart *cart,RDCut *cut) filename+=f0[i]+"."; } filename+="xml"; - if((f=fopen(filename,"w"))!=NULL) { + if((f=fopen(filename.toUtf8(),"w"))!=NULL) { fprintf(f,"%s\n", (const char *)cart->xml(true,true,&settings,cut->cutNumber()). toUtf8()); diff --git a/utils/rdgpimon/Makefile.am b/utils/rdgpimon/Makefile.am index c01b292c..9a0cc0f2 100644 --- a/utils/rdgpimon/Makefile.am +++ b/utils/rdgpimon/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2002-2020 Fred Gleason +## (C) Copyright 2002-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -17,7 +17,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -45,7 +45,7 @@ dist_rdgpimon_SOURCES = gpi_label.cpp gpi_label.h\ nodist_rdgpimon_SOURCES = moc_gpi_label.cpp\ moc_rdgpimon.cpp -rdgpimon_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdgpimon_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ EXTRA_DIST = rdgpimon.pro\ rdgpimon_cs.ts\ diff --git a/utils/rdgpimon/gpi_label.cpp b/utils/rdgpimon/gpi_label.cpp index 8852ea81..47e4cdbe 100644 --- a/utils/rdgpimon/gpi_label.cpp +++ b/utils/rdgpimon/gpi_label.cpp @@ -2,7 +2,7 @@ // // A Qt-based application for testing general purpose input (GPI) devices. // -// (C) Copyright 2002-2019 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -39,8 +39,8 @@ GpiLabel::GpiLabel(QWidget *parent) // On Cart Label // QPalette p=palette(); - p.setColor(QPalette::Active,QColorGroup::Foreground,Qt::darkGreen); - p.setColor(QPalette::Inactive,QColorGroup::Foreground,Qt::darkGreen); + p.setColor(QPalette::Active,QPalette::Foreground,Qt::darkGreen); + p.setColor(QPalette::Inactive,QPalette::Foreground,Qt::darkGreen); gpi_oncart_label=new QLabel(this); gpi_oncart_label->setGeometry(0,33,59,16); gpi_oncart_label->setFont(labelFont()); @@ -50,8 +50,8 @@ GpiLabel::GpiLabel(QWidget *parent) // // Off Cart Label // - p.setColor(QPalette::Active,QColorGroup::Foreground,Qt::darkRed); - p.setColor(QPalette::Inactive,QColorGroup::Foreground,Qt::darkRed); + p.setColor(QPalette::Active,QPalette::Foreground,Qt::darkRed); + p.setColor(QPalette::Inactive,QPalette::Foreground,Qt::darkRed); gpi_offcart_label=new QLabel(this); gpi_offcart_label->setGeometry(0,49,59,16); gpi_offcart_label->setFont(labelFont()); diff --git a/utils/rdgpimon/rdgpimon.cpp b/utils/rdgpimon/rdgpimon.cpp index bd5dbb2f..5d7fa4cb 100644 --- a/utils/rdgpimon/rdgpimon.cpp +++ b/utils/rdgpimon/rdgpimon.cpp @@ -18,9 +18,9 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include -#include -#include +#include +#include +#include #include #include @@ -92,9 +92,9 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) // gpi_type_box=new QComboBox(this); gpi_type_box->setGeometry(80,10,120,21); - gpi_type_box->insertItem(tr("GPI (Inputs)")); - gpi_type_box->insertItem(tr("GPO (Outputs)")); - QLabel *label=new QLabel(gpi_type_box,tr("Show:"),this); + gpi_type_box->insertItem(0,tr("GPI (Inputs)")); + gpi_type_box->insertItem(1,tr("GPO (Outputs)")); + QLabel *label=new QLabel(tr("Show:"),this); label->setGeometry(20,10,55,21); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -107,9 +107,10 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) gpi_matrix_box=new QComboBox(this); gpi_matrix_box->setGeometry(280,10,80,21); for(int i=0;iinsertItem(QString().sprintf("%d",i)); + gpi_matrix_box-> + insertItem(gpi_matrix_box->count(),QString().sprintf("%d",i)); } - label=new QLabel(gpi_matrix_box,tr("Matrix:"),this); + label=new QLabel(tr("Matrix:"),this); label->setGeometry(220,10,55,21); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -154,18 +155,18 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); QPalette p=palette(); - p.setColor(QPalette::Active,QColorGroup::Foreground,Qt::darkGreen); - p.setColor(QPalette::Inactive,QColorGroup::Foreground,Qt::darkGreen); - p.setColor(QPalette::Disabled,QColorGroup::Foreground,Qt::darkGreen); + p.setColor(QPalette::Active,QPalette::Foreground,Qt::darkGreen); + p.setColor(QPalette::Inactive,QPalette::Foreground,Qt::darkGreen); + p.setColor(QPalette::Disabled,QPalette::Foreground,Qt::darkGreen); label->setPalette(p); label=new QLabel(tr("Red = OFF Cart"),this); label->setGeometry(200,392,300,12); label->setFont(labelFont()); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); - p.setColor(QPalette::Active,QColorGroup::Foreground,Qt::darkRed); - p.setColor(QPalette::Inactive,QColorGroup::Foreground,Qt::darkRed); - p.setColor(QPalette::Disabled,QColorGroup::Foreground,Qt::darkRed); + p.setColor(QPalette::Active,QPalette::Foreground,Qt::darkRed); + p.setColor(QPalette::Inactive,QPalette::Foreground,Qt::darkRed); + p.setColor(QPalette::Disabled,QPalette::Foreground,Qt::darkRed); label->setPalette(p); // @@ -180,17 +181,17 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) gpi_events_date_edit->setDisplayFormat("dd/MM/yyyy"); gpi_events_date_edit->setGeometry(155,453,100,20); gpi_events_date_edit->setDate(QDate::currentDate()); - gpi_events_date_label=new QLabel(gpi_events_date_edit,tr("Date")+":",this); + gpi_events_date_label=new QLabel(tr("Date")+":",this); gpi_events_date_label->setGeometry(100,453,50,20); gpi_events_date_label->setFont(labelFont()); gpi_events_date_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); gpi_events_state_box=new QComboBox(this); gpi_events_state_box->setGeometry(330,453,55,20); - gpi_events_state_box->insertItem(tr("On")); - gpi_events_state_box->insertItem(tr("Off")); - gpi_events_state_box->insertItem(tr("Both")); - gpi_events_state_label=new QLabel(gpi_events_state_box,tr("State")+":",this); + gpi_events_state_box->insertItem(0,tr("On")); + gpi_events_state_box->insertItem(1,tr("Off")); + gpi_events_state_box->insertItem(2,tr("Both")); + gpi_events_state_label=new QLabel(tr("State")+":",this); gpi_events_state_label->setGeometry(275,453,50,20); gpi_events_state_label->setFont(labelFont()); gpi_events_state_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); @@ -217,17 +218,17 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) connect(gpi_events_scroll_button,SIGNAL(clicked()), this,SLOT(eventsScrollData())); gpi_scroll_color=palette(); - gpi_scroll_color.setColor(QPalette::Active,QColorGroup::ButtonText, + gpi_scroll_color.setColor(QPalette::Active,QPalette::ButtonText, Qt::white); - gpi_scroll_color.setColor(QPalette::Active,QColorGroup::Button, + gpi_scroll_color.setColor(QPalette::Active,QPalette::Button, Qt::blue); - gpi_scroll_color.setColor(QPalette::Active,QColorGroup::Background, + gpi_scroll_color.setColor(QPalette::Active,QPalette::Background, Qt::lightGray); - gpi_scroll_color.setColor(QPalette::Inactive,QColorGroup::ButtonText, + gpi_scroll_color.setColor(QPalette::Inactive,QPalette::ButtonText, Qt::white); - gpi_scroll_color.setColor(QPalette::Inactive,QColorGroup::Button, + gpi_scroll_color.setColor(QPalette::Inactive,QPalette::Button, Qt::blue); - gpi_scroll_color.setColor(QPalette::Inactive,QColorGroup::Background, + gpi_scroll_color.setColor(QPalette::Inactive,QPalette::Background, Qt::lightGray); gpi_events_report_button=new QPushButton(tr("Report"),this); @@ -240,8 +241,9 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) // Start Up Timer // gpi_events_startup_timer=new QTimer(this); + gpi_events_startup_timer->setSingleShot(true); connect(gpi_events_startup_timer,SIGNAL(timeout()),this,SLOT(startUpData())); - gpi_events_startup_timer->start(GPIMON_START_UP_DELAY,true); + gpi_events_startup_timer->start(GPIMON_START_UP_DELAY); } @@ -282,7 +284,7 @@ void MainWidget::matrixActivatedData(int index) delete gpi_matrix; } gpi_matrix= - new RDMatrix(rda->config()->stationName(),gpi_matrix_box->currentItem()); + new RDMatrix(rda->config()->stationName(),gpi_matrix_box->currentIndex()); UpdateLabelsDown(0); gpi_up_button->setDisabled(true); // RefreshEventsList(); @@ -290,7 +292,7 @@ void MainWidget::matrixActivatedData(int index) setGpioType((RDMatrix::GpioType)gpi_type_box->currentIndex()); gpi_events_model->setMatrixNumber(index); - gpi_events_startup_timer->start(1000,true); + gpi_events_startup_timer->start(1000); } @@ -320,7 +322,7 @@ void MainWidget::eventsReportData() RDReport::center(QString("Date: ")+ gpi_events_date_edit->date().toString("MM/dd/yyyy")+ " "+rda->station()->name()+":"+ - QString().sprintf("%d ",gpi_matrix_box->currentItem())+ + QString().sprintf("%d ",gpi_matrix_box->currentIndex())+ " State Filter: "+ gpi_events_state_box->currentText(),78)+"\n"; report+="\n"; @@ -331,16 +333,16 @@ void MainWidget::eventsReportData() "EDGE "+ // 02 "from GPIO_EVENTS where "+ "(STATION_NAME=\""+RDEscapeString(rda->station()->name())+"\")&&"+ - QString().sprintf("(MATRIX=%d)&&",gpi_matrix_box->currentItem())+ - QString().sprintf("(TYPE=%d)&&",gpi_type_box->currentItem())+ + QString().sprintf("(MATRIX=%d)&&",gpi_matrix_box->currentIndex())+ + QString().sprintf("(TYPE=%d)&&",gpi_type_box->currentIndex())+ "(EVENT_DATETIME>=\""+gpi_events_date_edit->date().toString("yyyy-MM-dd")+ " 00:00:00\")&&"+ "(EVENT_DATETIME<\""+gpi_events_date_edit->date().addDays(1). toString("yyyy-MM-dd")+" 00:00:00\")"; - if(gpi_events_state_box->currentItem()==0) { + if(gpi_events_state_box->currentIndex()==0) { sql+="&&(EDGE=1)"; } - if(gpi_events_state_box->currentItem()==1) { + if(gpi_events_state_box->currentIndex()==1) { sql+="&&(EDGE=0)"; } report+=" -- Time -- - Line - - State -\n"; @@ -374,7 +376,7 @@ void MainWidget::gpiStateChangedData(int matrix,int line,bool state) { // printf("gpiStateChanged(%d,%d,%d)\n",matrix,line,state); - if(gpi_type_box->currentItem()!=RDMatrix::GpioInput) { + if(gpi_type_box->currentIndex()!=RDMatrix::GpioInput) { return; } if(matrix!=gpi_matrix->matrix()) { @@ -393,7 +395,7 @@ void MainWidget::gpoStateChangedData(int matrix,int line,bool state) { // printf("gpoStateChanged(%d,%d,%d)\n",matrix,line,state); - if(gpi_type_box->currentItem()!=RDMatrix::GpioOutput) { + if(gpi_type_box->currentIndex()!=RDMatrix::GpioOutput) { return; } if(matrix!=gpi_matrix->matrix()) { @@ -410,7 +412,7 @@ void MainWidget::gpoStateChangedData(int matrix,int line,bool state) void MainWidget::gpiMaskChangedData(int matrix,int line,bool state) { - if(gpi_type_box->currentItem()!=RDMatrix::GpioInput) { + if(gpi_type_box->currentIndex()!=RDMatrix::GpioInput) { return; } if(matrix!=gpi_matrix->matrix()) { @@ -427,7 +429,7 @@ void MainWidget::gpiMaskChangedData(int matrix,int line,bool state) void MainWidget::gpoMaskChangedData(int matrix,int line,bool state) { // printf("gpoMaskChangedData(%d,%d,%d)\n",matrix,line,state); - if(gpi_type_box->currentItem()!=RDMatrix::GpioOutput) { + if(gpi_type_box->currentIndex()!=RDMatrix::GpioOutput) { return; } if(matrix!=gpi_matrix->matrix()) { @@ -447,7 +449,7 @@ void MainWidget::gpiCartChangedData(int matrix,int line,int off_cartnum, // printf("gpiCartChangedData(%d,%d,%d,%d)\n",matrix,line,off_cartnum, // on_cartnum); - if(gpi_type_box->currentItem()!=RDMatrix::GpioInput) { + if(gpi_type_box->currentIndex()!=RDMatrix::GpioInput) { return; } if(off_cartnum<0) { @@ -472,7 +474,7 @@ void MainWidget::gpoCartChangedData(int matrix,int line,int off_cartnum, { // printf("gpoCartChangedData(%d,%d,%d,%d)\n",matrix,line,off_cartnum, // on_cartnum); - if(gpi_type_box->currentItem()!=RDMatrix::GpioOutput) { + if(gpi_type_box->currentIndex()!=RDMatrix::GpioOutput) { return; } if(off_cartnum<0) { @@ -531,7 +533,7 @@ void MainWidget::UpdateLabelsUp(int last_line) for(int i=0;i<(GPIMON_ROWS*GPIMON_COLS);i++) { gpi_labels[i]->hide(); } - switch((RDMatrix::GpioType)gpi_type_box->currentItem()) { + switch((RDMatrix::GpioType)gpi_type_box->currentIndex()) { case RDMatrix::GpioInput: tablename="GPIS"; break; @@ -583,7 +585,7 @@ void MainWidget::UpdateLabelsDown(int first_line) for(int i=0;i<(GPIMON_ROWS*GPIMON_COLS);i++) { gpi_labels[i]->hide(); } - switch((RDMatrix::GpioType)gpi_type_box->currentItem()) { + switch((RDMatrix::GpioType)gpi_type_box->currentIndex()) { case RDMatrix::GpioInput: tablename="GPIS"; break; @@ -654,10 +656,10 @@ void MainWidget::AddEventsItem(int line,bool state) if(gpi_events_startup_timer->isActive()) { return; } - if((gpi_events_state_box->currentItem()==0)&&(!state)) { + if((gpi_events_state_box->currentIndex()==0)&&(!state)) { return; } - if((gpi_events_state_box->currentItem()==1)&&state) { + if((gpi_events_state_box->currentIndex()==1)&&state) { return; } gpi_events_model->addEvent(line,state); @@ -672,24 +674,24 @@ int main(int argc,char *argv[]) // // Load Translations // - QTranslator qt(0); - qt.load(QString("/usr/share/qt4/translations/qt_")+QTextCodec::locale(),"."); - a.installTranslator(&qt); + QString loc=RDApplication::locale(); + if(!loc.isEmpty()) { + QTranslator qt(0); + qt.load(QString("/usr/share/qt4/translations/qt_")+loc,"."); + a.installTranslator(&qt); - QTranslator rd(0); - rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+ - QTextCodec::locale(),"."); - a.installTranslator(&rd); + QTranslator rd(0); + rd.load(QString(PREFIX)+QString("/share/rivendell/librd_")+loc,"."); + a.installTranslator(&rd); - QTranslator rdhpi(0); - rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+ - QTextCodec::locale(),"."); - a.installTranslator(&rdhpi); + QTranslator rdhpi(0); + rdhpi.load(QString(PREFIX)+QString("/share/rivendell/librdhpi_")+loc,"."); + a.installTranslator(&rdhpi); - QTranslator tr(0); - tr.load(QString(PREFIX)+QString("/share/rivendell/rdgpimon_")+ - QTextCodec::locale(),"."); - a.installTranslator(&tr); + QTranslator tr(0); + tr.load(QString(PREFIX)+QString("/share/rivendell/rdgpimon_")+loc,"."); + a.installTranslator(&tr); + } // // Start Event Loop @@ -697,7 +699,6 @@ int main(int argc,char *argv[]) RDConfig *config=new RDConfig(); config->load(); MainWidget *w=new MainWidget(config); - a.setMainWidget(w); w->setGeometry(QRect(QPoint(0,0),w->sizeHint())); w->show(); return a.exec(); diff --git a/utils/rdimport/Makefile.am b/utils/rdimport/Makefile.am index ca5f6f57..b5b9a682 100644 --- a/utils/rdimport/Makefile.am +++ b/utils/rdimport/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2002-2020 Fred Gleason +## (C) Copyright 2002-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -17,7 +17,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -33,7 +33,7 @@ dist_rdimport_SOURCES = journal.cpp journal.h\ nodist_rdimport_SOURCES = moc_rdimport.cpp -rdimport_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdimport_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ *.idb\ diff --git a/utils/rdimport/markerset.cpp b/utils/rdimport/markerset.cpp index 11807727..fdefedd4 100644 --- a/utils/rdimport/markerset.cpp +++ b/utils/rdimport/markerset.cpp @@ -2,7 +2,7 @@ // // Abstract a set of marker parameters. // -// (C) Copyright 2014 Fred Gleason +// (C) Copyright 2014-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -19,7 +19,6 @@ // #include -#include #include "markerset.h" @@ -81,7 +80,7 @@ void MarkerSet::loadMarker(RDCmdSwitch *cmd,const QString &marker) marker_start_value=cmd->value(i).toInt(&marker_start_valid); if(!marker_start_valid) { fprintf(stderr,"rdimport: invalid argment to %s\n", - (const char *)start_key); + start_key.toUtf8().constData()); exit(255); } cmd->setProcessed(i,true); @@ -90,7 +89,7 @@ void MarkerSet::loadMarker(RDCmdSwitch *cmd,const QString &marker) marker_end_value=cmd->value(i).toInt(&marker_end_valid); if(!marker_end_valid) { fprintf(stderr,"rdimport: invalid argment to %s\n", - (const char *)end_key); + end_key.toUtf8().constData()); exit(255); } cmd->setProcessed(i,true); @@ -112,7 +111,7 @@ void MarkerSet::loadFade(RDCmdSwitch *cmd,const QString &marker) marker_fade_value=cmd->value(i).toInt(&marker_fade_valid); if(!marker_fade_valid) { fprintf(stderr,"rdimport: invalid argment to %s\n", - (const char *)key); + key.toUtf8().constData()); exit(255); } cmd->setProcessed(i,true); @@ -134,15 +133,15 @@ void MarkerSet::setAudioLength(int msecs) void MarkerSet::dump() { if(marker_start_valid) { - printf(" Marker Start %s: ",(const char *)marker_marker); + printf(" Marker Start %s: ",marker_marker.toUtf8().constData()); printf("%d mS\n",marker_start_value); } if(marker_end_valid) { - printf(" Marker End %s: ",(const char *)marker_marker); + printf(" Marker End %s: ",marker_marker.toUtf8().constData()); printf("%d mS\n",marker_end_value); } if(marker_fade_valid) { - printf(" Marker %s: ",(const char *)marker_marker); + printf(" Marker %s: ",marker_marker.toUtf8().constData()); printf("%d mS\n",marker_fade_value); } } diff --git a/utils/rdimport/rdimport.cpp b/utils/rdimport/rdimport.cpp index dff938d6..1cd50711 100644 --- a/utils/rdimport/rdimport.cpp +++ b/utils/rdimport/rdimport.cpp @@ -2,7 +2,7 @@ // // A Batch Importer for Rivendell. // -// (C) Copyright 2002-2020 Fred Gleason +// (C) Copyright 2002-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -30,9 +30,7 @@ #include #include -#include -#include -#include +#include #include #include @@ -108,7 +106,7 @@ MainObject::MainObject(QObject *parent) rda=static_cast(new RDCoreApplication("rdimport","rdimport", RDIMPORT_USAGE,this)); if(!rda->open(&err_msg)) { - fprintf(stderr,"rdimport: %s\n",(const char *)err_msg); + fprintf(stderr,"rdimport: %s\n",err_msg.toUtf8().constData()); ErrorExit(RDApplication::ExitNoDb); } @@ -602,7 +600,7 @@ MainObject::MainObject(QObject *parent) if((!rda->cmdSwitch()->processed(i))&& (rda->cmdSwitch()->key(i).left(2)=="--")) { Log(LOG_ERR,QString().sprintf("rdimport: unknown command option \"%s\"\n", - (const char *)rda->cmdSwitch()->key(i))); + rda->cmdSwitch()->key(i).toUtf8().constData())); ErrorExit(RDApplication::ExitInvalidOption); } } @@ -683,32 +681,34 @@ MainObject::MainObject(QObject *parent) } if(!import_set_user_defined.isEmpty()) { Log(LOG_INFO,QString().sprintf(" Setting the User Defined field to \"%s\"\n", - (const char *)import_set_user_defined)); + import_set_user_defined.toUtf8().constData())); } if(!import_metadata_pattern.isEmpty()) { Log(LOG_INFO,QString().sprintf(" Using metadata pattern: %s\n", - (const char *)import_metadata_pattern)); + import_metadata_pattern.toUtf8().constData())); } if(!import_output_pattern.isEmpty()) { Log(LOG_INFO,QString().sprintf(" Using output pattern: %s\n", - (const char *)import_output_pattern)); + import_output_pattern.toUtf8().constData())); } Log(LOG_INFO,QString().sprintf(" Start Date Offset = %d days\n",import_startdate_offset)); Log(LOG_INFO,QString().sprintf(" End Date Offset = %d days\n",import_enddate_offset)); if((!import_dayparts[0].isNull())||(!import_dayparts[1].isNull())) { Log(LOG_INFO,QString().sprintf(" Start Daypart = %s\n", - (const char *)import_dayparts[0].toString("hh:mm:ss"))); + import_dayparts[0].toString("hh:mm:ss"). + toUtf8().constData())); Log(LOG_INFO,QString().sprintf(" End Daypart = %s\n", - (const char *)import_dayparts[1].toString("hh:mm:ss"))); + import_dayparts[1].toString("hh:mm:ss"). + toUtf8().constData())); } if(import_clear_dayparts) { Log(LOG_INFO,QString(" Clearing daypart times\n")); } if((!import_datetimes[0].isNull())||(!import_datetimes[1].isNull())) { Log(LOG_INFO,QString().sprintf(" Start DateTime = %s\n", - (const char *)import_datetimes[0].toString("MM/dd/yyyy hh:mm:ss"))); + import_datetimes[0].toString("MM/dd/yyyy hh:mm:ss").toUtf8().constData())); Log(LOG_INFO,QString().sprintf(" End DateTime = %s\n", - (const char *)import_datetimes[1].toString("MM/dd/yyyy hh:mm:ss"))); + import_datetimes[1].toString("MM/dd/yyyy hh:mm:ss").toUtf8().constData())); } if(import_clear_datetimes) { Log(LOG_INFO,QString(" Clearing datetimes\n")); @@ -742,60 +742,75 @@ MainObject::MainObject(QObject *parent) Log(LOG_INFO,QString().sprintf(" Persistent DropBox ID = %d\n",import_persistent_dropbox_id)); } if(!import_string_agency.isNull()) { - Log(LOG_INFO,QString().sprintf(" Agency set to: %s\n",(const char *)import_string_agency)); + Log(LOG_INFO,QString().sprintf(" Agency set to: %s\n",import_string_agency. + toUtf8().constData())); } if(!import_string_album.isNull()) { - Log(LOG_INFO,QString().sprintf(" Album set to: %s\n",(const char *)import_string_album)); + Log(LOG_INFO,QString().sprintf(" Album set to: %s\n", + import_string_album.toUtf8().constData())); } if(!import_string_artist.isNull()) { - Log(LOG_INFO,QString().sprintf(" Artist set to: %s\n",(const char *)import_string_artist)); + Log(LOG_INFO,QString().sprintf(" Artist set to: %s\n", + import_string_artist.toUtf8().constData())); } if(import_string_bpm!=0) { Log(LOG_INFO,QString().sprintf(" BPM set to: %d\n",import_string_bpm)); } if(!import_string_client.isNull()) { - Log(LOG_INFO,QString().sprintf(" Client set to: %s\n",(const char *)import_string_client)); + Log(LOG_INFO,QString().sprintf(" Client set to: %s\n", + import_string_client.toUtf8().constData())); } if(!import_string_composer.isNull()) { - Log(LOG_INFO,QString().sprintf(" Composer set to: %s\n",(const char *)import_string_composer)); + Log(LOG_INFO,QString().sprintf(" Composer set to: %s\n", + import_string_composer.toUtf8().constData())); } if(!import_string_conductor.isNull()) { - Log(LOG_INFO,QString().sprintf(" Conductor set to: %s\n",(const char *)import_string_conductor)); + Log(LOG_INFO,QString().sprintf(" Conductor set to: %s\n", + import_string_conductor.toUtf8().constData())); } if(!import_string_description.isNull()) { Log(LOG_INFO,QString().sprintf(" Description set to: %s\n", - (const char *)import_string_description)); + import_string_description.toUtf8().constData())); } if(!import_string_label.isNull()) { - Log(LOG_INFO,QString().sprintf(" Label set to: %s\n",(const char *)import_string_label)); + Log(LOG_INFO,QString().sprintf(" Label set to: %s\n", + import_string_label.toUtf8().constData())); } if(!import_string_outcue.isNull()) { - Log(LOG_INFO,QString().sprintf(" Outcue set to: %s\n",(const char *)import_string_outcue)); + Log(LOG_INFO,QString().sprintf(" Outcue set to: %s\n", + import_string_outcue.toUtf8().constData())); } if(!import_string_isci.isNull()) { - Log(LOG_INFO,QString().sprintf(" ISCI set to: %s\n",(const char *)import_string_isci)); + Log(LOG_INFO,QString().sprintf(" ISCI set to: %s\n", + import_string_isci.toUtf8().constData())); } if(!import_string_isrc.isNull()) { - Log(LOG_INFO,QString().sprintf(" ISRC set to: %s\n",(const char *)import_string_isrc)); + Log(LOG_INFO,QString().sprintf(" ISRC set to: %s\n", + import_string_isrc.toUtf8().constData())); } if(!import_string_recording_mbid.isNull()) { - Log(LOG_INFO,QString().sprintf(" MusicBrainz recording ID set to: %s\n",(const char *)import_string_recording_mbid)); + Log(LOG_INFO,QString().sprintf(" MusicBrainz recording ID set to: %s\n", + import_string_recording_mbid.toUtf8().constData())); } if(!import_string_release_mbid.isNull()) { - Log(LOG_INFO,QString().sprintf(" MusicBrainz release ID set to: %s\n",(const char *)import_string_release_mbid)); + Log(LOG_INFO,QString().sprintf(" MusicBrainz release ID set to: %s\n", + import_string_release_mbid.toUtf8().constData())); } if(!import_string_publisher.isNull()) { - Log(LOG_INFO,QString().sprintf(" Publisher set to: %s\n",(const char *)import_string_publisher)); + Log(LOG_INFO,QString().sprintf(" Publisher set to: %s\n", + import_string_publisher.toUtf8().constData())); } if(!import_string_song_id.isNull()) { - Log(LOG_INFO,QString().sprintf(" Song ID set to: %s\n",(const char *)import_string_song_id)); + Log(LOG_INFO,QString().sprintf(" Song ID set to: %s\n", + import_string_song_id.toUtf8().constData())); } if(!import_string_title.isNull()) { - Log(LOG_INFO,QString().sprintf(" Title set to: %s\n",(const char *)import_string_title)); + Log(LOG_INFO,QString().sprintf(" Title set to: %s\n", + import_string_title.toUtf8().constData())); } if(!import_string_user_defined.isNull()) { Log(LOG_INFO,QString().sprintf(" User Defined set to: %s\n", - (const char *)import_string_user_defined)); + import_string_user_defined.toUtf8().constData())); } if(import_string_year!=0) { Log(LOG_INFO,QString().sprintf(" Year set to: %d\n",import_string_year)); @@ -819,7 +834,7 @@ MainObject::MainObject(QObject *parent) } else { Log(LOG_INFO,QString().sprintf(" \"%s\"\n", - (const char *)rda->cmdSwitch()->key(i).toUtf8())); + rda->cmdSwitch()->key(i).toUtf8().constData())); } } @@ -947,10 +962,10 @@ void MainObject::ProcessFileEntry(const QString &entry) } globbuf.gl_offs=RDIMPORT_GLOB_SIZE; while((globbuf.gl_pathc==RDIMPORT_GLOB_SIZE)||(gflags==GLOB_MARK)) { - glob(RDEscapeString(entry.toUtf8()),gflags,NULL,&globbuf); + glob(RDEscapeString(entry).toUtf8(),gflags,NULL,&globbuf); if((globbuf.gl_pathc==0)&&(gflags==GLOB_MARK)&&(!import_drop_box)) { Log(LOG_WARNING,QString().sprintf(" Unable to open \"%s\", skipping...\n", - (const char *)entry)); + entry.toUtf8().constData())); globfree(&globbuf); } for(size_t i=0;ititle().stripWhiteSpace().toUtf8().constData(), + wavedata->title().trimmed().toUtf8().constData(), *cartnum)); } switch(conv_err=conv->runImport(rda->user()->name(),rda->user()->password(), @@ -1212,8 +1227,8 @@ MainObject::Result MainObject::ImportFile(const QString &filename, default: Log(LOG_INFO,QString().sprintf(" %s, skipping %s...\n", - (const char *)RDAudioImport::errorText(conv_err,audio_conv_err), - (const char *)filename.toUtf8())); + RDAudioImport::errorText(conv_err,audio_conv_err).toUtf8().constData(), + filename.toUtf8().constData())); if(cart_created) { cart->remove(rda->station(),rda->user(),rda->config()); } @@ -1560,7 +1575,7 @@ RDWaveFile *MainObject::FixFile(const QString &filename,RDWaveData *wavedata) // // Determine Fixability // - int fd=open(filename,O_RDONLY); + int fd=open(filename.toUtf8(),O_RDONLY); if(fd<0) { return NULL; } @@ -1582,8 +1597,9 @@ RDWaveFile *MainObject::FixFile(const QString &filename,RDWaveData *wavedata) // Copy File // char tempfile[PATH_MAX]; - strncpy(tempfile,RDTempDirectory::basePath()+ - QString().sprintf("/rdimport%dXXXXXX",getpid()),PATH_MAX); + strncpy(tempfile,(RDTempDirectory::basePath()+ + QString().sprintf("/rdimport%dXXXXXX",getpid())).toUtf8(), + PATH_MAX); int dest_fd=mkstemp(tempfile); if(dest_fd<0) { return NULL; @@ -1698,7 +1714,7 @@ bool MainObject::FixChunkSizes(const QString &filename) // // Open File // - if((fd=open(filename,O_RDWR))<0) { + if((fd=open(filename.toUtf8(),O_RDWR))<0) { return false; } lseek(fd,12,SEEK_SET); @@ -2213,13 +2229,14 @@ void MainObject::ReadXmlFile(const QString &basename,RDWaveData *wavedata) const xmlname+=f0[i]+"."; } xmlname+="xml"; - Log(LOG_INFO,QString().sprintf(" Reading xml metadata from \"%s\": ",(const char *)xmlname)); + Log(LOG_INFO,QString().sprintf(" Reading xml metadata from \"%s\": ", + xmlname.toUtf8().constData())); // // Read XML // wavedata->clear(); - if((f=fopen(xmlname,"r"))==NULL) { + if((f=fopen(xmlname.toUtf8(),"r"))==NULL) { Log(LOG_WARNING,QString().sprintf("failed [%s]\n",strerror(errno))); return; } diff --git a/utils/rdmaint/Makefile.am b/utils/rdmaint/Makefile.am index cde19e0c..793a2f5c 100644 --- a/utils/rdmaint/Makefile.am +++ b/utils/rdmaint/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2008-2020 Fred Gleason +## (C) Copyright 2008-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -17,7 +17,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -31,7 +31,7 @@ dist_rdmaint_SOURCES = rdmaint.cpp rdmaint.h nodist_rdmaint_SOURCES = moc_rdmaint.cpp -rdmaint_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdmaint_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ *.idb\ diff --git a/utils/rdmaint/rdmaint.cpp b/utils/rdmaint/rdmaint.cpp index 8600b1d9..6af48914 100644 --- a/utils/rdmaint/rdmaint.cpp +++ b/utils/rdmaint/rdmaint.cpp @@ -28,9 +28,7 @@ #include #include -#include -#include -#include +#include #include #include @@ -61,7 +59,7 @@ MainObject::MainObject(QObject *parent) // rda=static_cast(new RDCoreApplication("rdmaint","rdmaint",RDMAINT_USAGE,this)); if(!rda->open(&err_msg)) { - fprintf(stderr,"rdmaint: %s\n",(const char *)err_msg); + fprintf(stderr,"rdmaint: %s\n",err_msg.toUtf8().constData()); exit(1); } @@ -85,7 +83,7 @@ MainObject::MainObject(QObject *parent) } if(!rda->cmdSwitch()->processed(i)) { fprintf(stderr,"rdmaint: unknown command option \"%s\"\n", - (const char *)rda->cmdSwitch()->key(i)); + rda->cmdSwitch()->key(i).toUtf8().constData()); exit(2); } } @@ -404,7 +402,7 @@ void MainObject::RehashCuts() else { if(maint_verbose) { fprintf(stderr,"rehashed cut \"%s\"\n", - (const char *)q->value(0).toString()); + q->value(0).toString().toUtf8().constData()); } } sleep(1); diff --git a/utils/rdmarkerset/Makefile.am b/utils/rdmarkerset/Makefile.am index 236b3406..49a5b67a 100644 --- a/utils/rdmarkerset/Makefile.am +++ b/utils/rdmarkerset/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2002-2020 Fred Gleason +## (C) Copyright 2002-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -17,7 +17,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -31,7 +31,7 @@ dist_rdmarkerset_SOURCES = rdmarkerset.cpp rdmarkerset.h nodist_rdmarkerset_SOURCES = moc_rdmarkerset.cpp -rdmarkerset_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdmarkerset_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ EXTRA_DIST = diff --git a/utils/rdmarkerset/rdmarkerset.cpp b/utils/rdmarkerset/rdmarkerset.cpp index f14ca80a..ae653dda 100644 --- a/utils/rdmarkerset/rdmarkerset.cpp +++ b/utils/rdmarkerset/rdmarkerset.cpp @@ -2,7 +2,7 @@ // // Command-line tool for setting Rivendell Cut Markers // -// (C) Copyright 2014,2016-2018 Fred Gleason +// (C) Copyright 2014-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -26,11 +26,7 @@ #include #include -#include -#include -#include -//Added by qt3to4: -#include +#include #include #include @@ -63,7 +59,7 @@ MainObject::MainObject(QObject *parent) // rda=static_cast(new RDCoreApplication("rdmarkerset","rdmarkerset",RDMARKERSET_USAGE,this)); if(!rda->open(&err_msg)) { - fprintf(stderr,"rdmarkerset: %s\n",(const char *)err_msg); + fprintf(stderr,"rdmarkerset: %s\n",err_msg.toUtf8().constData()); exit(1); } @@ -101,7 +97,7 @@ MainObject::MainObject(QObject *parent) } if(!rda->cmdSwitch()->processed(i)) { fprintf(stderr,"rdmarkerset: unknown command option \"%s\"\n", - (const char *)rda->cmdSwitch()->key(i)); + rda->cmdSwitch()->key(i).toUtf8().constData()); exit(2); } } @@ -136,7 +132,7 @@ MainObject::MainObject(QObject *parent) // set_station=new RDStation(set_config->stationName()); if(!rda->station()->exists()) { fprintf(stderr,"rdmarkerset: no such host [\"%s\"]\n", - (const char *)rda->config()->stationName()); + rda->config()->stationName().toUtf8().constData()); exit(256); } @@ -157,7 +153,7 @@ MainObject::MainObject(QObject *parent) RDGroup *grp=new RDGroup(set_group_names[i]); if(!grp->exists()) { fprintf(stderr,"rdmarkerset: no such group named \"%s\"\n", - (const char *)set_group_names[i]); + set_group_names[i].toUtf8().constData()); bad=true; } delete grp; @@ -293,7 +289,7 @@ void MainObject::SetAutoTrim(unsigned cartnum,int cutnum,const QString &title, else { if(err!=RDTrimAudio::ErrorNoAudio) { fprintf(stderr,"rdmarkerset: cart %06u, cut %d trimmer error [%s]\n", - cartnum,cutnum,(const char *)RDTrimAudio::errorText(err)); + cartnum,cutnum,RDTrimAudio::errorText(err).toUtf8().constData()); exit(256); } } @@ -324,7 +320,7 @@ void MainObject::ClearAutoTrim(unsigned cartnum,int cutnum,const QString &title, else { if(err!=RDAudioInfo::ErrorNoAudio) { fprintf(stderr,"rdmarkerset: cart %06u, cut %d info error [%s]\n", - cartnum,cutnum,(const char *)RDAudioInfo::errorText(err)); + cartnum,cutnum,RDAudioInfo::errorText(err).toUtf8().constData()); exit(256); } } @@ -363,7 +359,7 @@ void MainObject::SetAutoSegue(unsigned cartnum,int cutnum,const QString &title, else { if(err!=RDTrimAudio::ErrorNoAudio) { fprintf(stderr,"rdmarkerset: cart %06u, cut %d trimmer error [%s]\n", - cartnum,cutnum,(const char *)RDTrimAudio::errorText(err)); + cartnum,cutnum,RDTrimAudio::errorText(err).toUtf8().constData()); exit(256); } } @@ -386,7 +382,7 @@ void MainObject::ClearAutoSegue(unsigned cartnum,int cutnum, void MainObject::Print(const QString &msg) { if(set_verbose) { - printf("%s\n",(const char *)msg); + printf("%s\n",msg.toUtf8().constData()); } } diff --git a/utils/rdmetadata/Makefile.am b/utils/rdmetadata/Makefile.am index dd77ae43..d9a2afff 100644 --- a/utils/rdmetadata/Makefile.am +++ b/utils/rdmetadata/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2002-2020 Fred Gleason +## (C) Copyright 2002-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -17,7 +17,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -31,7 +31,7 @@ dist_rdmetadata_SOURCES = rdmetadata.cpp rdmetadata.h nodist_rdmetadata_SOURCES = moc_rdmetadata.cpp -rdmetadata_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdmetadata_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ EXTRA_DIST = diff --git a/utils/rdmetadata/rdmetadata.cpp b/utils/rdmetadata/rdmetadata.cpp index 41d6d634..15dccca8 100644 --- a/utils/rdmetadata/rdmetadata.cpp +++ b/utils/rdmetadata/rdmetadata.cpp @@ -3,7 +3,7 @@ // Command-line tool for setting Rivendell Cart Metadata // // Patrick Linstruth -// (C) Copyright 2019 Fred Gleason +// (C) Copyright 2019-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -28,9 +28,6 @@ #include #include -#include -#include -#include #include "rd.h" #include "rdapplication.h" @@ -54,7 +51,7 @@ MainObject::MainObject(QObject *parent) // rda=static_cast(new RDCoreApplication("rdmetadata","rdmetadata",RDMETADATA_USAGE,this)); if(!rda->open(&err_msg)) { - fprintf(stderr,"rdmetadata: %s\n",(const char *)err_msg); + fprintf(stderr,"rdmetadata: %s\n",err_msg.toUtf8().constData()); exit(1); } @@ -125,7 +122,7 @@ MainObject::MainObject(QObject *parent) } if(!rda->cmdSwitch()->processed(i)) { fprintf(stderr,"rdmetadata: unknown command option \"%s\"\n", - (const char *)rda->cmdSwitch()->key(i)); + rda->cmdSwitch()->key(i).toUtf8().constData()); exit(2); } } @@ -299,7 +296,7 @@ void MainObject::SendNotification(RDNotification::Action action,unsigned cartnum void MainObject::Print(const QString &msg) { if(verbose) { - printf("%s\n",(const char *)msg); + printf("%s\n",msg.toUtf8().constData()); } } diff --git a/utils/rdpopup/Makefile.am b/utils/rdpopup/Makefile.am index 7d03f9bf..753140d3 100644 --- a/utils/rdpopup/Makefile.am +++ b/utils/rdpopup/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2009-2020 Fred Gleason +## (C) Copyright 2009-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -17,7 +17,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -29,7 +29,7 @@ bin_PROGRAMS = rdpopup dist_rdpopup_SOURCES = rdpopup.cpp rdpopup.h -rdpopup_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdpopup_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ *.idb\ diff --git a/utils/rdrender/Makefile.am b/utils/rdrender/Makefile.am index 101372d2..40886c2d 100644 --- a/utils/rdrender/Makefile.am +++ b/utils/rdrender/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2017-2020 Fred Gleason +## (C) Copyright 2017-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -17,7 +17,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -31,7 +31,7 @@ dist_rdrender_SOURCES = rdrender.cpp rdrender.h nodist_rdrender_SOURCES = moc_rdrender.cpp -rdrender_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdrender_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ *.idb\ diff --git a/utils/rdrender/rdrender.cpp b/utils/rdrender/rdrender.cpp index 57c8d9b7..176935c7 100644 --- a/utils/rdrender/rdrender.cpp +++ b/utils/rdrender/rdrender.cpp @@ -2,7 +2,7 @@ // // Render a Rivendell log. // -// (C) Copyright 2017-2020 Fred Gleason +// (C) Copyright 2017-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -22,9 +22,7 @@ #include #include -#include -#include -#include +#include #include #include @@ -108,33 +106,33 @@ MainObject::MainObject(QObject *parent) if(rda->cmdSwitch()->key(i)=="--format") { QString format=rda->cmdSwitch()->value(i); ok=false; - if(format.lower()=="flac") { + if(format.toLower()=="flac") { render_settings.setFormat(RDSettings::Flac); ok=true; } - if(format.lower()=="mp2") { + if(format.toLower()=="mp2") { render_settings.setFormat(RDSettings::MpegL2); ok=true; } - if(format.lower()=="mp3") { + if(format.toLower()=="mp3") { render_settings.setFormat(RDSettings::MpegL3); ok=true; } - if(format.lower()=="pcm16") { + if(format.toLower()=="pcm16") { render_settings.setFormat(RDSettings::Pcm16); ok=true; } - if(format.lower()=="pcm24") { + if(format.toLower()=="pcm24") { render_settings.setFormat(RDSettings::Pcm24); ok=true; } - if(format.lower()=="vorbis") { + if(format.toLower()=="vorbis") { render_settings.setFormat(RDSettings::OggVorbis); ok=true; } if(!ok) { fprintf(stderr,"rdrender: unknown --format \"%s\"\n", - (const char *)format); + format.toUtf8().constData()); exit(1); } rda->cmdSwitch()->setProcessed(i,true); @@ -231,7 +229,7 @@ MainObject::MainObject(QObject *parent) } if(!rda->cmdSwitch()->processed(i)) { fprintf(stderr,"rdrepld: unknown command option \"%s\"\n", - (const char *)rda->cmdSwitch()->key(i)); + rda->cmdSwitch()->key(i).toUtf8().constData()); exit(2); } } @@ -304,7 +302,7 @@ void MainObject::userData() &render_settings,render_start_time, render_ignore_stops,&err_msg,render_first_line, render_last_line,render_first_time,render_last_time)) { - fprintf(stderr,"rdrender: %s\n",(const char *)err_msg); + fprintf(stderr,"rdrender: %s\n",err_msg.toUtf8().constData()); exit(1); } } @@ -313,14 +311,14 @@ void MainObject::userData() render_start_time,render_ignore_stops, &err_msg,render_first_line,render_last_line, render_first_time,render_last_time)) { - fprintf(stderr,"rdrender: %s\n",(const char *)err_msg); + fprintf(stderr,"rdrender: %s\n",err_msg.toUtf8().constData()); exit(1); } } QStringList warnings=r->warnings(); for(int i=0;i +## (C) Copyright 2018-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -36,7 +36,7 @@ nodist_rdselect_helper_SOURCES = moc_rdselect_helper.cpp\ rdconfig.cpp rdconfig.h\ rdprofile.cpp rdprofile.h -rdselect_helper_LDADD = -lQtCore -lQtNetwork -lQt3Support @MUSICBRAINZ_LIBS@ +rdselect_helper_LDADD = -lQtCore -lQtNetwork @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ *.idb\ diff --git a/utils/rdselect_helper/rdselect_helper.cpp b/utils/rdselect_helper/rdselect_helper.cpp index 110d116e..c241b163 100644 --- a/utils/rdselect_helper/rdselect_helper.cpp +++ b/utils/rdselect_helper/rdselect_helper.cpp @@ -2,7 +2,7 @@ // // SETUID helper script for rdselect(1) // -// (C) Copyright 2018 Fred Gleason +// (C) Copyright 2018-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -135,7 +135,7 @@ void MainObject::Startup() // Start the rivendell service // unlink(RD_CONF_FILE); - if(symlink(helper_config_filename,RD_CONF_FILE)!=0) { + if(symlink(helper_config_filename.toUtf8(),RD_CONF_FILE)!=0) { fprintf(stderr,"rdselect_helper: unable to create new symlink [%s]\n", strerror(errno)); exit(RDConfig::RDSelectSymlinkFailed); @@ -189,10 +189,10 @@ void MainObject::Shutdown() // // Unmount the audio store // - if(umount(helper_prev_config->audioRoot())!=0) { + if(umount(helper_prev_config->audioRoot().toUtf8())!=0) { if(errno!=EINVAL) { // Ignore the error if we're already unmounted fprintf(stderr,"rdselect_helper: unmount of \"%s\" failed [%s]\n", - (const char *)helper_prev_config->audioRoot(), + helper_prev_config->audioRoot().toUtf8().constData(), strerror(errno)); exit(RDConfig::RDSelectAudioUnmountFailed); } @@ -254,7 +254,7 @@ bool MainObject::ProcessActive(const QStringList &cmds) const for(int i=0;i +## (C) Copyright 2002-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -17,7 +17,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -31,7 +31,7 @@ dist_rdsoftkeys_SOURCES = rdsoftkeys.cpp rdsoftkeys.h nodist_rdsoftkeys_SOURCES = moc_rdsoftkeys.cpp -rdsoftkeys_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdsoftkeys_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ CLEANFILES = *~\ *.exe\ diff --git a/utils/rdsoftkeys/rdsoftkeys.cpp b/utils/rdsoftkeys/rdsoftkeys.cpp index 3582d3ea..25ebe652 100644 --- a/utils/rdsoftkeys/rdsoftkeys.cpp +++ b/utils/rdsoftkeys/rdsoftkeys.cpp @@ -61,7 +61,7 @@ MainWidget::MainWidget(QWidget *parent) // Create And Set Icon // key_icon_map=new QPixmap(rivendell_22x22_xpm); - setIcon(*key_icon_map); + setWindowIcon(*key_icon_map); // // RML Send Socket @@ -106,7 +106,7 @@ MainWidget::MainWidget(QWidget *parent) QString().sprintf("Color%d",n+1),"")). isEmpty()) { color=QColor(color_name); - QPalette pal=QPalette(color,backgroundColor()); + QPalette pal=QPalette(color,palette().color(QPalette::Background)); color.getHsv(&h,&s,&v); if((h>180)&&(h<300)) { v=255; @@ -121,8 +121,8 @@ MainWidget::MainWidget(QWidget *parent) } s=0; color.setHsv(h,s,v); - pal.setColor(QPalette::Active,QColorGroup::ButtonText,color); - pal.setColor(QPalette::Inactive,QColorGroup::ButtonText,color); + pal.setColor(QPalette::Active,QPalette::ButtonText,color); + pal.setColor(QPalette::Inactive,QPalette::ButtonText,color); button->setPalette(pal); } mapper->setMapping(button,n); @@ -142,8 +142,7 @@ MainWidget::MainWidget(QWidget *parent) // if (!key_macros.size()) { QMessageBox::critical(this, tr("RDSoftKeys"), - tr(QString("No SoftKey definitions found in file\n%1") - .arg(map_filename))); + tr("No SoftKey definitions found in file")+"\n"+map_filename); exit(1); } @@ -182,7 +181,7 @@ QSizePolicy MainWidget::sizePolicy() const void MainWidget::buttonData(int id) { QHostAddress addr; - struct hostent *hostent=gethostbyname(key_addrs[id]); + struct hostent *hostent=gethostbyname(key_addrs[id].toUtf8().constData()); if(hostent==NULL) { QMessageBox::warning(this,tr("RDSoftKeys"),hstrerror(h_errno)); return; @@ -196,7 +195,7 @@ void MainWidget::buttonData(int id) addr.setAddress(key_addrs[id]); } key_socket-> - writeDatagram(key_macros[id].toUtf8(),addr,(Q_UINT16)RD_RML_NOECHO_PORT); + writeDatagram(key_macros[id].toUtf8(),addr,(uint16_t)RD_RML_NOECHO_PORT); } @@ -217,26 +216,28 @@ int main(int argc,char *argv[]) QString tr_path; QString qt_path; - tr_path=QString(PREFIX)+QString("/share/srlabs/"); - qt_path=QString("/usr/share/qt4/translation/"); + QString loc=RDApplication::locale(); + if(!loc.isEmpty()) { + tr_path=QString(PREFIX)+QString("/share/srlabs/"); + qt_path=QString("/usr/share/qt4/translation/"); - QTranslator qt(0); - qt.load(qt_path+QString("qt_")+QTextCodec::locale(),"."); - a.installTranslator(&qt); + QTranslator qt(0); + qt.load(qt_path+QString("qt_")+loc,"."); + a.installTranslator(&qt); - QTranslator libradio(0); - libradio.load(tr_path+QString("librd_")+QTextCodec::locale(),"."); - a.installTranslator(&libradio); + QTranslator libradio(0); + libradio.load(tr_path+QString("librd_")+loc,"."); + a.installTranslator(&libradio); - QTranslator tests(0); - tests.load(tr_path+QString("rdsoftkeys_")+QTextCodec::locale(),"."); - a.installTranslator(&tests); + QTranslator tests(0); + tests.load(tr_path+QString("rdsoftkeys_")+loc,"."); + a.installTranslator(&tests); + } // // Start Event Loop // MainWidget *w=new MainWidget(); - a.setMainWidget(w); w->setGeometry(w->geometry().x(),w->geometry().y(),w->sizeHint().width(),w->sizeHint().height()); w->show(); return a.exec(); diff --git a/utils/rmlsend/Makefile.am b/utils/rmlsend/Makefile.am index 48a0034f..fed4302c 100644 --- a/utils/rmlsend/Makefile.am +++ b/utils/rmlsend/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2002-2020 Fred Gleason +## (C) Copyright 2002-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -17,7 +17,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -43,7 +43,7 @@ dist_rmlsend_SOURCES = rmlsend.cpp rmlsend.h nodist_rmlsend_SOURCES = moc_rmlsend.cpp -rmlsend_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rmlsend_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ EXTRA_DIST = rmlsend.pro\ rmlsend_cs.ts\ diff --git a/utils/rmlsend/rmlsend.cpp b/utils/rmlsend/rmlsend.cpp index bda28a3b..525a1b97 100644 --- a/utils/rmlsend/rmlsend.cpp +++ b/utils/rmlsend/rmlsend.cpp @@ -21,10 +21,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include "rmlsend.h" @@ -58,7 +58,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) host=new QLineEdit(this); host->setGeometry(80,10,180,25); - QLabel *label=new QLabel(host,"Sent To:",this); + QLabel *label=new QLabel("Sent To:",this); label->setGeometry(10,16,65,14); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight); @@ -72,20 +72,20 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) port_box=new QComboBox(this); port_box->setGeometry(305,10,130,25); port_box->setEditable(false); - label=new QLabel(port_box,"Dest:",this); + label=new QLabel("Dest:",this); label->setGeometry(265,16,35,14); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight); - port_box->insertItem(tr("RML")); - port_box->insertItem(tr("RML (no echo)")); - port_box->insertItem(tr("Set Port")); - port_box->setCurrentItem(1); + port_box->insertItem(0,tr("RML")); + port_box->insertItem(1,tr("RML (no echo)")); + port_box->insertItem(2,tr("Set Port")); + port_box->setCurrentIndex(1); connect(port_box,SIGNAL(activated(int)),this,SLOT(destChangedData(int))); port_edit=new QLineEdit(this); port_edit->setGeometry(sizeHint().width()-60,10,50,25); port_edit->setDisabled(true); - port_edit_label=new QLabel(port_edit,tr("UDP Port:"),this); + port_edit_label=new QLabel(tr("UDP Port:"),this); port_edit_label->setGeometry(sizeHint().width()-130,16,65,14); port_edit_label->setFont(labelFont()); port_edit_label->setAlignment(Qt::AlignRight); @@ -93,14 +93,14 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) command=new QLineEdit(this); command->setGeometry(80,40,sizeHint().width()-90,25); - label=new QLabel(command,tr("Command:"),this); + label=new QLabel(tr("Command:"),this); label->setGeometry(10,46,65,14); label->setFont(labelFont()); label->setAlignment(Qt::AlignRight); response=new QLineEdit(this); response->setGeometry(80,70,sizeHint().width()-90,25); - response_label=new QLabel(response,tr("Response:"),this); + response_label=new QLabel(tr("Response:"),this); response_label->setGeometry(10,76,65,14); response_label->setFont(labelFont()); response_label->setAlignment(Qt::AlignRight); @@ -110,7 +110,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) send->setFont(buttonFont()); connect(send,SIGNAL(clicked()),this,SLOT(sendCommand())); - quit=new QPushButton("&Quit",this,"quit"); + quit=new QPushButton("&Quit",this); quit->setGeometry(sizeHint().width()-80,sizeHint().height()-50,70,40); quit->setFont(buttonFont()); quit->setDefault(true); @@ -134,22 +134,22 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent) if(ok&&(port<0xFFFF)) { switch(rdcmdswitch->value(i).toUInt()) { case RD_RML_ECHO_PORT: - port_box->setCurrentItem(0); + port_box->setCurrentIndex(0); break; case RD_RML_NOECHO_PORT: - port_box->setCurrentItem(1); + port_box->setCurrentIndex(1); break; default: - port_box->setCurrentItem(2); + port_box->setCurrentIndex(2); port_edit->setText(rdcmdswitch->value(i)); break; } } } } - destChangedData(port_box->currentItem()); + destChangedData(port_box->currentIndex()); } @@ -171,7 +171,7 @@ void MainWidget::sendCommand() unsigned port=0; bool ok=true; - switch((MainWidget::DestMode)port_box->currentItem()) { + switch((MainWidget::DestMode)port_box->currentIndex()) { case MainWidget::Rml: port=RD_RML_ECHO_PORT; break; @@ -189,7 +189,7 @@ void MainWidget::sendCommand() break; } response->setText(""); - struct hostent *hostent=gethostbyname(host->text()); + struct hostent *hostent=gethostbyname(host->text().toUtf8()); if(hostent==NULL) { QMessageBox::warning(this,tr("RMLSend"),hstrerror(h_errno)); return; @@ -203,7 +203,7 @@ void MainWidget::sendCommand() host_addr.setAddress(host->text()); } dcl_command=command->text(); - if(!udp_command->writeDatagram(dcl_command.utf8(),host_addr,(Q_UINT16)port)) { + if(!udp_command->writeDatagram(dcl_command.toUtf8(),host_addr,(uint16_t)port)) { QMessageBox::warning(this,tr("RMLSend"),tr("Connection Failed!")); return; } @@ -220,7 +220,7 @@ void MainWidget::readResponse() int n; QHostAddress peer_addr; - n=udp_response->readBlock(buffer,RD_RML_MAX_LENGTH); + n=udp_response->read(buffer,RD_RML_MAX_LENGTH); if(n<=0) { if(countdown==0) { response->setText(tr("no response")); @@ -323,7 +323,7 @@ void MainObject::ReadSwitches() void MainObject::ResolveName() { - struct hostent *hostent=gethostbyname(dest_hostname); + struct hostent *hostent=gethostbyname(dest_hostname.toUtf8()); if(hostent==NULL) { fprintf(stderr,"rmlsend: %s\n",hstrerror(h_errno)); exit(256); @@ -351,13 +351,13 @@ void MainObject::InitStream() f=stdin; } else { - if((f=fopen(input_file,"r"))==NULL) { + if((f=fopen(input_file.toUtf8(),"r"))==NULL) { perror("rmlsend"); exit(1); } } input_stream=new QTextStream(f,QIODevice::ReadOnly); - input_stream->setEncoding(QTextStream::UnicodeUTF8); + input_stream->setCodec("UTF-8"); } @@ -397,7 +397,7 @@ void MainObject::ProcessCommands() if(active) { if(c=='!') { rml+=c; - udp_command->writeDatagram(rml.utf8(),*dest_addr,dest_port); + udp_command->writeDatagram(rml.toUtf8(),*dest_addr,dest_port); rml=""; active=false; qApp->processEvents(); @@ -445,24 +445,27 @@ int main(int argc,char *argv[]) QString tr_path; QString qt_path; - tr_path=QString(PREFIX)+QString("/share/rivendell/"); - qt_path=QString("/usr/share/qt4/translation/"); + QString loc=RDApplication::locale(); + if(!loc.isEmpty()) { + tr_path=QString(PREFIX)+QString("/share/rivendell/"); + qt_path=QString("/usr/share/qt4/translation/"); - QTranslator qt(0); - qt.load(qt_path+QString("qt_")+QTextCodec::locale(),"."); - a.installTranslator(&qt); + QTranslator qt(0); + qt.load(qt_path+QString("qt_")+loc,"."); + a.installTranslator(&qt); - QTranslator rd(0); - rd.load(tr_path+QString("librd_")+QTextCodec::locale(),"."); - a.installTranslator(&rd); + QTranslator rd(0); + rd.load(tr_path+QString("librd_")+loc,"."); + a.installTranslator(&rd); - QTranslator rdhpi(0); - rdhpi.load(tr_path+QString("librdhpi_")+QTextCodec::locale(),"."); - a.installTranslator(&rdhpi); + QTranslator rdhpi(0); + rdhpi.load(tr_path+QString("librdhpi_")+loc,"."); + a.installTranslator(&rdhpi); - QTranslator tr(0); - tr.load(tr_path+QString("rmlsend_")+QTextCodec::locale(),"."); - a.installTranslator(&tr); + QTranslator tr(0); + tr.load(tr_path+QString("rmlsend_")+loc,"."); + a.installTranslator(&tr); + } // // Start Event Loop @@ -470,7 +473,6 @@ int main(int argc,char *argv[]) RDConfig *config=new RDConfig(); config->load(); MainWidget *w=new MainWidget(config); - a.setMainWidget(w); w->show(); return a.exec(); } diff --git a/web/rdxport/Makefile.am b/web/rdxport/Makefile.am index 442d6818..1c34524b 100644 --- a/web/rdxport/Makefile.am +++ b/web/rdxport/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am ## -## (C) Copyright 2010-2020 Fred Gleason +## (C) Copyright 2010-2021 Fred Gleason ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License version 2 as @@ -17,7 +17,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -51,7 +51,7 @@ dist_rdxport_cgi_SOURCES = audioinfo.cpp\ nodist_rdxport_cgi_SOURCES = moc_rdxport.cpp -rdxport_cgi_LDADD = @LIB_RDLIBS@ -lsndfile @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +rdxport_cgi_LDADD = @LIB_RDLIBS@ -lsndfile @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ EXTRA_DIST = rdxport.pro diff --git a/web/rdxport/audiostore.cpp b/web/rdxport/audiostore.cpp index ecaa645a..0c892cf7 100644 --- a/web/rdxport/audiostore.cpp +++ b/web/rdxport/audiostore.cpp @@ -2,7 +2,7 @@ // // Rivendell web service portal -- AudioStore service // -// (C) Copyright 2014,2016 Fred Gleason +// (C) Copyright 2014-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -39,7 +39,7 @@ void Xport::AudioStore() struct statvfs stat; memset(&stat,0,sizeof(stat)); - if(statvfs(rda->config()->audioRoot(),&stat)<0) { + if(statvfs(rda->config()->audioRoot().toUtf8(),&stat)<0) { XmlExit("Internal Error",400,"audiostore.cpp",LINE_NUMBER); } printf("Content-type: application/xml\n"); diff --git a/web/rdxport/carts.cpp b/web/rdxport/carts.cpp index 2d965db7..89e20f4e 100644 --- a/web/rdxport/carts.cpp +++ b/web/rdxport/carts.cpp @@ -2,7 +2,7 @@ // // Rivendell web service portal -- Cart services // -// (C) Copyright 2010-2018 Fred Gleason +// (C) Copyright 2010-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -55,11 +55,11 @@ void Xport::AddCart() if(!xport_post->getValue("TYPE",&type)) { XmlExit("Missing TYPE",400,"carts.cpp",LINE_NUMBER); } - if(type.lower()=="audio") { + if(type.toLower()=="audio") { cart_type=RDCart::Audio; } else { - if(type.lower()=="macro") { + if(type.toLower()=="macro") { cart_type=RDCart::Macro; } else { @@ -107,7 +107,7 @@ void Xport::AddCart() printf("\n"); printf("\n"); if(cart->exists()) { - printf("%s",(const char *)cart->xml(false,true).utf8()); + printf("%s",(const char *)cart->xml(false,true).toUtf8()); SendNotification(RDNotification::CartType,RDNotification::AddAction, QVariant(cart->number())); } @@ -137,10 +137,10 @@ void Xport::ListCarts() xport_post->getValue("FILTER",&filter); xport_post->getValue("INCLUDE_CUTS",&include_cuts); xport_post->getValue("TYPE",&type); - if(type.lower()=="audio") { + if(type.toLower()=="audio") { cart_type=RDCart::Audio; } - if(type.lower()=="macro") { + if(type.toLower()=="macro") { cart_type=RDCart::Macro; } @@ -174,7 +174,7 @@ void Xport::ListCarts() printf("Status: 200\n\n"); printf("\n"); printf("\n"); - printf("%s\n",(const char *)RDCart::xml(q,include_cuts,true).utf8()); + printf("%s\n",(const char *)RDCart::xml(q,include_cuts,true).toUtf8()); printf("\n"); delete q; Exit(0); @@ -213,7 +213,7 @@ void Xport::ListCart() printf("\n"); printf("\n"); cart=new RDCart(cart_number); - printf("%s",(const char *)cart->xml(include_cuts,true).utf8()); + printf("%s",(const char *)cart->xml(include_cuts,true).toUtf8()); delete cart; printf("\n"); @@ -298,7 +298,7 @@ void Xport::EditCart() case RDCart::Macro: line=0; while(xport_post->getValue(QString().sprintf("MACRO%d",line++),&value)) { - value.stripWhiteSpace(); + value.trimmed(); if(value.right(1)!="!") { delete cart; XmlExit("Invalid macro data",400,"carts.cpp",LINE_NUMBER); @@ -399,7 +399,7 @@ void Xport::EditCart() printf("Status: 200\n\n"); printf("\n"); printf("\n"); - printf("%s",(const char *)cart->xml(include_cuts,true).utf8()); + printf("%s",(const char *)cart->xml(include_cuts,true).toUtf8()); SendNotification(RDNotification::CartType,RDNotification::ModifyAction, QVariant(cart->number())); delete cart; @@ -493,7 +493,7 @@ void Xport::AddCut() cut=new RDCut(cart_number,cut_number); if(cut->exists()) { printf("%s", - (const char *)RDCart::cutXml(cart_number,cut_number,true).utf8()); + (const char *)RDCart::cutXml(cart_number,cut_number,true).toUtf8()); SendNotification(RDNotification::CartType,RDNotification::ModifyAction, QVariant(cart->number())); } @@ -536,7 +536,7 @@ void Xport::ListCuts() printf("\n"); printf("\n"); while(q->next()) { - printf("%s\n",(const char *)RDCut::xml(q,false).utf8()); + printf("%s\n",(const char *)RDCut::xml(q,false).toUtf8()); } printf("\n"); delete q; @@ -580,7 +580,7 @@ void Xport::ListCut() printf("Status: 200\n\n"); printf("\n"); printf("\n"); - printf("%s",(const char *)RDCart::cutXml(cart_number,cut_number,true).utf8()); + printf("%s",(const char *)RDCart::cutXml(cart_number,cut_number,true).toUtf8()); printf("\n"); delete cut; @@ -860,7 +860,7 @@ void Xport::EditCut() printf("Status: 200\n\n"); printf("\n"); printf("\n"); - printf("%s",(const char *)RDCart::cutXml(cart_number,cut_number,true).utf8()); + printf("%s",(const char *)RDCart::cutXml(cart_number,cut_number,true).toUtf8()); printf("\n"); SendNotification(RDNotification::CartType,RDNotification::ModifyAction, QVariant(cut->cartNumber())); diff --git a/web/rdxport/copyaudio.cpp b/web/rdxport/copyaudio.cpp index 9f488c3e..d7a14521 100644 --- a/web/rdxport/copyaudio.cpp +++ b/web/rdxport/copyaudio.cpp @@ -2,7 +2,7 @@ // // Rivendell web service portal -- CopyAudio service // -// (C) Copyright 2010-2018 Fred Gleason +// (C) Copyright 2010-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -72,9 +72,9 @@ void Xport::CopyAudio() // // Make the copy // - unlink(RDCut::pathName(destination_cartnum,destination_cutnum)); - if(link(RDCut::pathName(source_cartnum,source_cutnum), - RDCut::pathName(destination_cartnum,destination_cutnum))!=0) { + unlink(RDCut::pathName(destination_cartnum,destination_cutnum).toUtf8()); + if(link(RDCut::pathName(source_cartnum,source_cutnum).toUtf8(), + RDCut::pathName(destination_cartnum,destination_cutnum).toUtf8())!=0) { XmlExit(strerror(errno),400,"copyaudio.cpp",LINE_NUMBER); } SendNotification(RDNotification::CartType,RDNotification::ModifyAction, diff --git a/web/rdxport/deleteaudio.cpp b/web/rdxport/deleteaudio.cpp index 8188a187..13de2766 100644 --- a/web/rdxport/deleteaudio.cpp +++ b/web/rdxport/deleteaudio.cpp @@ -2,7 +2,7 @@ // // Rivendell web service portal -- DeleteAudio service // -// (C) Copyright 2010-2019 Fred Gleason +// (C) Copyright 2010-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -58,8 +58,8 @@ void Xport::DeleteAudio() delete cut; XmlExit("No such cut",404,"deleteaudio.cpp",LINE_NUMBER); } - unlink(RDCut::pathName(cartnum,cutnum)); - unlink(RDCut::pathName(cartnum,cutnum)+".energy"); + unlink(RDCut::pathName(cartnum,cutnum).toUtf8()); + unlink((RDCut::pathName(cartnum,cutnum)+".energy").toUtf8()); QString sql=QString("delete from CUT_EVENTS where ")+ "CUT_NAME=\""+RDCut::cutName(cartnum,cutnum)+"\""; RDSqlQuery *q=new RDSqlQuery(sql); @@ -67,7 +67,7 @@ void Xport::DeleteAudio() SendNotification(RDNotification::CartType,RDNotification::ModifyAction, QVariant(cartnum)); rda->syslog(LOG_DEBUG,"unlink(%s): %s", - (const char *)RDCut::pathName(cartnum,cutnum).utf8(), + (const char *)RDCut::pathName(cartnum,cutnum).toUtf8(), strerror(errno)); delete cut; XmlExit("OK",200,"deleteaudio.cpp",LINE_NUMBER); diff --git a/web/rdxport/export.cpp b/web/rdxport/export.cpp index 7a59ebd0..404295c7 100644 --- a/web/rdxport/export.cpp +++ b/web/rdxport/export.cpp @@ -2,7 +2,7 @@ // // Rivendell web service portal -- Export service // -// (C) Copyright 2010-2018 Fred Gleason +// (C) Copyright 2010-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -178,13 +178,13 @@ void Xport::Export() break; } fflush(NULL); - if((fd=open(tmpfile,O_RDONLY))>=0) { + if((fd=open(tmpfile.toUtf8(),O_RDONLY))>=0) { while((n=read(fd,data,2048))>0) { write(1,data,n); } } close(fd); - unlink(tmpfile); + unlink(tmpfile.toUtf8()); // rmdir(tmpdir); delete tempdir; Exit(0); diff --git a/web/rdxport/groups.cpp b/web/rdxport/groups.cpp index e9cb95fa..ef75af07 100644 --- a/web/rdxport/groups.cpp +++ b/web/rdxport/groups.cpp @@ -58,7 +58,7 @@ void Xport::ListGroups() printf("\n"); while(q->next()) { group=new RDGroup(q->value(0).toString()); - printf("%s",(const char *)group->xml().utf8()); + printf("%s",(const char *)group->xml().toUtf8()); delete group; } printf("\n"); @@ -102,7 +102,7 @@ void Xport::ListGroup() printf("Status: 200\n\n"); printf("\n"); group=new RDGroup(q->value(0).toString()); - printf("%s",(const char *)group->xml().utf8()); + printf("%s",(const char *)group->xml().toUtf8()); delete group; delete q; diff --git a/web/rdxport/import.cpp b/web/rdxport/import.cpp index 8a08a37d..8a4f3fda 100644 --- a/web/rdxport/import.cpp +++ b/web/rdxport/import.cpp @@ -2,7 +2,7 @@ // // Rivendell web service portal -- Import service // -// (C) Copyright 2010-2018 Fred Gleason +// (C) Copyright 2010-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -271,8 +271,8 @@ void Xport::Import() printf("\r\n"); SendNotification(RDNotification::CartType,RDNotification::ModifyAction, QVariant(cartnum)); - unlink(filename); - rmdir(xport_post->tempDir()); + unlink(filename.toUtf8()); + rmdir(xport_post->tempDir().toUtf8()); exit(0); } XmlExit(RDAudioConvert::errorText(conv_err),resp_code,"import.cpp", diff --git a/web/rdxport/logs.cpp b/web/rdxport/logs.cpp index 6588958d..5ff844b6 100644 --- a/web/rdxport/logs.cpp +++ b/web/rdxport/logs.cpp @@ -2,7 +2,7 @@ // // Rivendell web service portal -- Log services // -// (C) Copyright 2013-2020 Fred Gleason +// (C) Copyright 2013-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -126,7 +126,7 @@ void Xport::ListLogs() xport_post->getValue("LOG_NAME",&log_name); xport_post->getValue("TRACKABLE",&trackable); xport_post->getValue("FILTER",&filter); - filter=filter.stripWhiteSpace(); + filter=filter.trimmed(); xport_post->getValue("RECENT",&recent); // @@ -166,11 +166,11 @@ void Xport::ListLogs() sql+="(LOGS.DESCRIPTION like \"%%"+RDEscapeString(filter)+"%%\"))&&"; } } - sql=sql.stripWhiteSpace(); + sql=sql.trimmed(); if(sql.right(2)=="&&") { sql=sql.left(sql.length()-2); } - sql=sql.stripWhiteSpace(); + sql=sql.trimmed(); if(sql.right(5)=="where") { sql=sql.left(sql.length()-5); } @@ -192,7 +192,7 @@ void Xport::ListLogs() printf("\n"); while(q->next()) { log=new RDLog(q->value(0).toString()); - printf("%s",(const char *)log->xml().utf8()); + printf("%s",(const char *)log->xml().toUtf8()); delete log; } printf("\n"); @@ -233,7 +233,7 @@ void Xport::ListLog() printf("Content-type: application/xml\n"); printf("Status: 200\n\n"); printf("\n"); - printf("%s\n",(const char *)log_model->xml().utf8()); + printf("%s\n",(const char *)log_model->xml().toUtf8()); Exit(0); } @@ -346,13 +346,13 @@ void Xport::SaveLog() XmlExit("Missing "+line+"_TRANS_TYPE",400,"logs.cpp",LINE_NUMBER); } integer1=-1; - if(str.lower()=="play") { + if(str.toLower()=="play") { integer1=RDLogLine::Play; } - if(str.lower()=="segue") { + if(str.toLower()=="segue") { integer1=RDLogLine::Segue; } - if(str.lower()=="stop") { + if(str.toLower()=="stop") { integer1=RDLogLine::Stop; } if(integer1<0) { @@ -565,15 +565,15 @@ void Xport::LockLog() if(!xport_post->getValue("OPERATION",&op_string)) { XmlExit("Missing OPERATION",400,"logs.cpp",LINE_NUMBER); } - if(op_string.lower()=="create") { + if(op_string.toLower()=="create") { op_type=Xport::LockLogCreate; } else { - if(op_string.lower()=="update") { + if(op_string.toLower()=="update") { op_type=Xport::LockLogUpdate; } else { - if(op_string.lower()=="clear") { + if(op_string.toLower()=="clear") { op_type=Xport::LockLogClear; } else { @@ -603,24 +603,24 @@ void Xport::LockLog() addr=xport_remote_address; lock_guid=RDLogLock::makeGuid(xport_remote_hostname); if(RDLogLock::tryLock(&username,&stationname,&addr,log_name,lock_guid)) { - printf("%s",(const char *)LogLockXml(true,log_name,lock_guid,"","",addr).utf8()); + printf("%s",(const char *)LogLockXml(true,log_name,lock_guid,"","",addr).toUtf8()); } else { printf("%s",(const char *)LogLockXml(false,log_name,"",username, - stationname,addr).utf8()); + stationname,addr).toUtf8()); } Exit(0); break; case Xport::LockLogUpdate: RDLogLock::updateLock(log_name,lock_guid); - printf("%s",(const char *)LogLockXml(true,log_name,lock_guid,"","",addr).utf8()); + printf("%s",(const char *)LogLockXml(true,log_name,lock_guid,"","",addr).toUtf8()); Exit(0); break; case Xport::LockLogClear: RDLogLock::clearLock(lock_guid); - printf("%s",(const char *)LogLockXml(true,log_name,lock_guid,"","",addr).utf8()); + printf("%s",(const char *)LogLockXml(true,log_name,lock_guid,"","",addr).toUtf8()); Exit(0); break; } diff --git a/web/rdxport/podcasts.cpp b/web/rdxport/podcasts.cpp index 816328d1..c35921d6 100644 --- a/web/rdxport/podcasts.cpp +++ b/web/rdxport/podcasts.cpp @@ -2,7 +2,7 @@ // // Rivendell web service portal -- Podcast services // -// (C) Copyright 2010-2020 Fred Gleason +// (C) Copyright 2010-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -397,7 +397,7 @@ bool Xport::PostRssElemental(RDFeed *feed,const QDateTime &now,QString *err_msg) curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_NOPROGRESS,1); curl_easy_setopt(curl,CURLOPT_USERAGENT, - (const char *)rda->config()->userAgent().utf8()); + (const char *)rda->config()->userAgent().toUtf8()); curl_easy_setopt(curl,CURLOPT_ERRORBUFFER,errstr); // @@ -616,7 +616,7 @@ void Xport::PostImage() curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_NOPROGRESS,1); curl_easy_setopt(curl,CURLOPT_USERAGENT, - (const char *)rda->config()->userAgent().utf8()); + (const char *)rda->config()->userAgent().toUtf8()); curl_easy_setopt(curl,CURLOPT_ERRORBUFFER,errstr); // diff --git a/web/rdxport/rdxport.cpp b/web/rdxport/rdxport.cpp index ec7339fb..8fa6a5e9 100644 --- a/web/rdxport/rdxport.cpp +++ b/web/rdxport/rdxport.cpp @@ -2,7 +2,7 @@ // // Rivendell web service portal // -// (C) Copyright 2010-2020 Fred Gleason +// (C) Copyright 2010-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -29,9 +29,7 @@ #include -#include -#include -#include +#include #include #include @@ -56,7 +54,7 @@ Xport::Xport(QObject *parent) printf("Content-type: text/html\n"); printf("Status: 500\n"); printf("\n"); - printf("rdxport.cgi: %s\n",(const char *)err_msg.utf8()); + printf("rdxport.cgi: %s\n",(const char *)err_msg.toUtf8()); Exit(0); } @@ -69,7 +67,7 @@ Xport::Xport(QObject *parent) printf("Status: 500\n"); printf("\n"); printf("rdxport.cgi: unknown command option \"%s\"\n", - (const char *)rda->cmdSwitch()->key(i).utf8()); + (const char *)rda->cmdSwitch()->key(i).toUtf8()); Exit(0); } } @@ -96,7 +94,7 @@ Xport::Xport(QObject *parent) printf("rdxport: missing REQUEST_METHOD\n"); Exit(0); } - if(QString(getenv("REQUEST_METHOD")).lower()!="post") { + if(QString(getenv("REQUEST_METHOD")).toLower()!="post") { printf("Content-type: text/html\n\n"); printf("rdxport: invalid web method\n"); Exit(0); @@ -413,9 +411,9 @@ void Xport::TryCreateTicket(const QString &name) printf("Content-type: application/xml\n\n"); printf("\n"); printf("\n"); - printf(" %s\n",RDXmlField("ticket",ticket).utf8().constData()); + printf(" %s\n",RDXmlField("ticket",ticket).toUtf8().constData()); printf(" %s\n", - (const char *)RDXmlField("expires",expire_datetime).utf8()); + (const char *)RDXmlField("expires",expire_datetime).toUtf8()); printf("\n"); exit(0); } @@ -460,11 +458,11 @@ void Xport::XmlExit(const QString &str,int code,const QString &srcfile, } #ifdef RDXPORT_DEBUG if(srcline>0) { - RDXMLResult(str+" \""+srcfile+"\" "+QString().sprintf("line %d",srcline), + RDXMLResult((str+" \""+srcfile+"\" "+QString().sprintf("line %d",srcline)).toUtf8(), code,err); } else { - RDXMLResult(str,code,err); + RDXMLResult(str.toUtf8(),code,err); } #else RDXMLResult(str,code,err); diff --git a/web/rdxport/schedcodes.cpp b/web/rdxport/schedcodes.cpp index 8339bc45..f8b392e7 100644 --- a/web/rdxport/schedcodes.cpp +++ b/web/rdxport/schedcodes.cpp @@ -2,7 +2,7 @@ // // Rivendell web service portal // -// (C) Copyright 2015-2018 Fred Gleason +// (C) Copyright 2015-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -18,8 +18,6 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#include - #include #include #include @@ -48,7 +46,7 @@ void Xport::ListSchedCodes() printf("\n"); while(q->next()) { schedcode=new RDSchedCode(q->value(0).toString()); - printf("%s",(const char *)schedcode->xml().utf8()); + printf("%s",(const char *)schedcode->xml().toUtf8()); delete schedcode; } printf("\n"); @@ -178,7 +176,7 @@ void Xport::ListCartSchedCodes() printf("\n"); for(int i=0;ixml().utf8()); + printf("%s",(const char *)schedcode->xml().toUtf8()); delete schedcode; } printf("\n"); diff --git a/web/rdxport/services.cpp b/web/rdxport/services.cpp index 868e4c41..1974fdce 100644 --- a/web/rdxport/services.cpp +++ b/web/rdxport/services.cpp @@ -2,7 +2,7 @@ // // Rivendell web service portal -- Service services // -// (C) Copyright 2010-2018 Fred Gleason +// (C) Copyright 2010-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -78,7 +78,7 @@ void Xport::ListServices() printf("\n"); while(q->next()) { svc=new RDSvc(q->value(0).toString(),rda->station(),rda->config()); - printf("%s",(const char *)svc->xml().utf8()); + printf("%s",(const char *)svc->xml().toUtf8()); delete svc; } printf("\n"); diff --git a/web/rdxport/systemsettings.cpp b/web/rdxport/systemsettings.cpp index 15033c4d..f38a22dd 100644 --- a/web/rdxport/systemsettings.cpp +++ b/web/rdxport/systemsettings.cpp @@ -40,6 +40,6 @@ void Xport::ListSystemSettings() // printf("Content-type: application/xml\n\n"); printf("\n"); - printf("%s\n",(const char *)sys->xml().utf8()); + printf("%s\n",(const char *)sys->xml().toUtf8()); Exit(0); } diff --git a/web/rdxport/tests.cpp b/web/rdxport/tests.cpp index b41bb8f1..8b4fb03c 100644 --- a/web/rdxport/tests.cpp +++ b/web/rdxport/tests.cpp @@ -2,7 +2,7 @@ // // Rivendell web service portal -- save string test // -// (C) Copyright 2018-2019 Fred Gleason +// (C) Copyright 2018-2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -50,11 +50,11 @@ void Xport::SaveString() // // Process Request // - rda->syslog(LOG_INFO,"SAVESTRING: |%s|",(const char *)string.utf8()); + rda->syslog(LOG_INFO,"SAVESTRING: |%s|",(const char *)string.toUtf8()); printf("Content-type: application/xml; charset: UTF-8\n"); printf("Status: 200\n\n"); printf("\n"); - printf("%s\n",(const char *)RDXmlField("string",string).utf8()); + printf("%s\n",(const char *)RDXmlField("string",string).toUtf8()); Exit(0); } @@ -81,7 +81,7 @@ void Xport::SaveFile() printf("Content-type: text/html; charset: UTF-8\n"); printf("Status: 200\n\n"); - printf("%s\n",(const char *)msg.utf8()); + printf("%s\n",(const char *)msg.toUtf8()); Exit(0); } diff --git a/web/webget/Makefile.am b/web/webget/Makefile.am index 9173a3cd..79cecc56 100644 --- a/web/webget/Makefile.am +++ b/web/webget/Makefile.am @@ -17,7 +17,7 @@ ## ## Use automake to process this into a Makefile.in -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support +AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ @MUSICBRAINZ_CFLAGS@ LIBS = -L$(top_srcdir)/lib MOC = @QT_MOC@ @@ -41,7 +41,7 @@ dist_webget_cgi_SOURCES = webget.cpp webget.h nodist_webget_cgi_SOURCES = moc_webget.cpp -webget_cgi_LDADD = @LIB_RDLIBS@ -lsndfile @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support +webget_cgi_LDADD = @LIB_RDLIBS@ -lsndfile @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ EXTRA_DIST = webget.js diff --git a/web/webget/webget.cpp b/web/webget/webget.cpp index 60edb6e5..ba64807b 100644 --- a/web/webget/webget.cpp +++ b/web/webget/webget.cpp @@ -83,11 +83,11 @@ MainObject::MainObject(QObject *parent) rda->logAuthenticationFailure(webget_post->clientAddress()); TextExit("missing REQUEST_METHOD",500,LINE_NUMBER); } - if(QString(getenv("REQUEST_METHOD")).lower()=="get") { + if(QString(getenv("REQUEST_METHOD")).toLower()=="get") { ServeLogin(200); Exit(0); } - if(QString(getenv("REQUEST_METHOD")).lower()!="post") { + if(QString(getenv("REQUEST_METHOD")).toLower()!="post") { rda->syslog(LOG_WARNING,"unsupported web method \"%s\"", getenv("REQUEST_METHOD")); rda->logAuthenticationFailure(webget_post->clientAddress()); @@ -292,13 +292,13 @@ void MainObject::GetAudio() break; } fflush(NULL); - if((fd=open(tmpfile,O_RDONLY))>=0) { + if((fd=open(tmpfile.toUtf8(),O_RDONLY))>=0) { while((n=read(fd,data,2048))>0) { write(1,data,n); } } close(fd); - unlink(tmpfile); + unlink(tmpfile.toUtf8()); delete tempdir; Exit(0); break;