diff --git a/ChangeLog b/ChangeLog index 7f429be3..a76066fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17125,3 +17125,5 @@ * Cleaned up SQL quieries in 'lib/' ensure UTF-8 compatibility. 2018-07-16 Fred Gleason * Cleaned up SQL quieries in 'rdadmin/' ensure UTF-8 compatibility. +2018-07-16 Fred Gleason + * Cleaned up SQL quieries in 'rdairplay/' ensure UTF-8 compatibility. diff --git a/rdairplay/edit_event.cpp b/rdairplay/edit_event.cpp index 7ecbb0df..938a516b 100644 --- a/rdairplay/edit_event.cpp +++ b/rdairplay/edit_event.cpp @@ -242,9 +242,9 @@ int EditEvent::exec(int line) else { edit_time_edit->setTime(QTime()); } - setCaption(QString().sprintf("%d - %s", - edit_logline->cartNumber(), - (const char *)edit_logline->title())); + setCaption("RDAirPlay - "+ + QString().sprintf("%d - ",edit_logline->cartNumber())+ + edit_logline->title()); edit_cart_notes_text->setText(edit_logline->cartNotes()); switch(edit_logline->type()) { case RDLogLine::Cart: @@ -344,11 +344,9 @@ void EditEvent::timeChangedData(const QTime &time) QString str; if(edit_timetype_box->isChecked()) { - str=QString(tr("Transition If Previous Cart Ends Before")); - edit_time_label-> - setText(QString().sprintf("%s %s:",(const char *)str, - (const char *)edit_time_edit->time(). - toString("hh:mm:ss.zzz").left(10))); + edit_time_label->setText(tr("Transition If Previous Cart Ends Before")+ + " "+edit_time_edit->time(). + toString("hh:mm:ss.zzz").left(10)+":"); } } @@ -361,11 +359,9 @@ void EditEvent::timeToggledData(bool state) edit_grace_group->setEnabled(state); if(state) { graceClickedData(edit_grace_group->selectedId()); - str=QString(tr("Transition If Previous Cart Ends Before")); - edit_time_label-> - setText(QString().sprintf("%s %s:",(const char *)str, - (const char *)edit_time_edit->time(). - toString("hh:mm:ss.zzz").left(10))); + edit_time_label->setText(tr("Transition If Previous Cart Ends Before")+ + " "+edit_time_edit->time(). + toString("hh:mm:ss.zzz").left(10)+":"); } else { edit_grace_edit->setDisabled(true); diff --git a/rdairplay/list_log.cpp b/rdairplay/list_log.cpp index 6d82ab6e..fba5290f 100644 --- a/rdairplay/list_log.cpp +++ b/rdairplay/list_log.cpp @@ -1219,12 +1219,8 @@ void ListLog::RefreshItem(RDListViewItem *l,int line) l->setText(5,log_line->title()); } else { - l->setText(5,QString(). - sprintf("%s -- %s %s", - (const char *)log_line->title(), - (const char *)log_line->originUser(), - (const char *)log_line->originDateTime(). - toString("M/d hh:mm"))); + l->setText(5,log_line->title()+" -- "+log_line->originUser()+" "+ + log_line->originDateTime().toString("M/d hh:mm")); } l->setText(6,log_line->artist()); l->setText(7,log_line->groupName()); diff --git a/rdairplay/loglinebox.cpp b/rdairplay/loglinebox.cpp index 12c9f205..16daa253 100644 --- a/rdairplay/loglinebox.cpp +++ b/rdairplay/loglinebox.cpp @@ -529,12 +529,10 @@ void LogLineBox::setEvent(int line,RDLogLine::TransType next_type, setText(RDResolveNowNext(line_title_template,line_logline)); } else { - line_title_label->setText(QString(). - sprintf("%s -- %s %s", - (const char *)line_logline->title(), - (const char *)line_logline->originUser(), - (const char *)line_logline->originDateTime(). - toString("M/d hh:mm"))); + line_title_label->setText(line_logline->title()+" -- "+ + line_logline->originUser()+" "+ + line_logline->originDateTime(). + toString("M/d hh:mm")); } line_description_label-> setText(RDResolveNowNext(line_description_template,line_logline)); @@ -896,28 +894,22 @@ void LogLineBox::UpdateCountdown() void LogLineBox::PrintTime() { - QString str; - if(line_logline==NULL) { return; } switch(line_logline->timeType()) { case RDLogLine::Hard: line_time_label->setFont(line_bold_font); - str=QString(tr("T")); - line_time_label->setText(QString().sprintf("%s%s",(const char *)str, - (const char *)TimeString(line_logline-> - startTime(RDLogLine::Logged)))); + line_time_label->setText("T"+TimeString(line_logline-> + startTime(RDLogLine::Logged))); line_time_label->setPalette(line_hard_palette); break; default: line_time_label->setFont(line_font); if(!line_logline->startTime(RDLogLine::Logged).isNull()) { - line_time_label-> - setText(QString().sprintf("%s", - (const char *)TimeString(line_logline-> - startTime(RDLogLine::Logged)))); + line_time_label->setText(TimeString(line_logline-> + startTime(RDLogLine::Logged))); } else { line_time_label->setText(""); diff --git a/rdairplay/post_counter.cpp b/rdairplay/post_counter.cpp index 7e83935b..5c6e941b 100644 --- a/rdairplay/post_counter.cpp +++ b/rdairplay/post_counter.cpp @@ -143,15 +143,13 @@ void PostCounter::UpdateDisplay() if(post_offset_valid) { if(offset<-POST_COUNTER_MARGIN) { - state=QString().sprintf("-%s",(const char *) - QTime().addMSecs(-offset).toString()); + state="-"+QTime().addMSecs(-offset).toString(); setPalette(post_early_palette); color=POSTPOINT_EARLY_COLOR; } else { if(offset>POST_COUNTER_MARGIN) { - state=QString().sprintf("+%s",(const char *) - QTime().addMSecs(offset).toString()); + state="+"+QTime().addMSecs(offset).toString(); setPalette(post_late_palette); color=POSTPOINT_LATE_COLOR; } diff --git a/rdairplay/rdairplay.cpp b/rdairplay/rdairplay.cpp index 5b9177ee..c4846d86 100644 --- a/rdairplay/rdairplay.cpp +++ b/rdairplay/rdairplay.cpp @@ -110,8 +110,7 @@ MainWidget::MainWidget(QWidget *parent) // // Ensure Single Instance // - air_lock=new RDInstanceLock(QString().sprintf("%s/.rdairplaylock", - (const char *)RDHomeDir())); + air_lock=new RDInstanceLock(RDHomeDir()+"/.rdairplaylock"); if(!air_lock->lock()) { QMessageBox::information(this,tr("RDAirPlay"), tr("Multiple instances not allowed!")); @@ -852,22 +851,20 @@ MainWidget::MainWidget(QWidget *parent) // // Load Plugins // - sql=QString().sprintf("select PLUGIN_PATH,PLUGIN_ARG from NOWNEXT_PLUGINS \ - where (STATION_NAME=\"%s\")&&(LOG_MACHINE=0)", - (const char *) - RDEscapeString(rda->config()->stationName())); + sql=QString("select ")+ + "PLUGIN_PATH,"+ // 00 + "PLUGIN_ARG "+ // 01 + "from NOWNEXT_PLUGINS where "+ + "(STATION_NAME=\""+RDEscapeString(rda->config()->stationName())+"\")&&"+ + "(LOG_MACHINE=0)"; q=new RDSqlQuery(sql); while(q->next()) { air_plugin_hosts. push_back(new RDRLMHost(q->value(0).toString(),q->value(1).toString(), air_nownext_socket,this)); - LogLine(RDConfig::LogInfo,QString(). - sprintf("Loading RLM \"%s\"", - (const char *)q->value(0).toString())); + LogLine(RDConfig::LogInfo,"Loading RLM \""+q->value(0).toString()+"\""); if(!air_plugin_hosts.back()->load()) { - LogLine(RDConfig::LogWarning,QString(). - sprintf("Failed to load RLM \"%s\"", - (const char *)q->value(0).toString())); + LogLine(RDConfig::LogWarning,"Failed to load RLM \""+q->value(0).toString()+"\""); } } delete q; @@ -1008,8 +1005,8 @@ void MainWidget::ripcConnectedData(bool state) } } if(!air_start_logname[i].isEmpty()) { - sql=QString().sprintf("select NAME from LOGS where NAME=\"%s\"", - (const char *)air_start_logname[i]); + sql=QString("select NAME from LOGS where ")+ + "NAME=\""+RDEscapeString(air_start_logname[i])+"\""; q=new RDSqlQuery(sql); if(q->first()) { rml.setCommand(RDMacro::LL); // Load Log @@ -1335,37 +1332,27 @@ void MainWidget::panelChannelStoppedData(int mport,int card,int port) void MainWidget::logRenamedData(int log) { QString str; - QString logname= - air_log[log]->logName().left(air_log[log]->logName().length()-4); + QString logname=air_log[log]->logName(); QString labelname=logname; if(logname.isEmpty()) { labelname="--"; } switch(log) { - case 0: - str=QString(tr("Main Log")); - air_log_button[0]-> - setText(QString().sprintf("%s\n[%s]",(const char *)str, - (const char *)labelname)); - SetCaption(); - if(air_panel) { - air_panel->setLogName(logname); - } - break; + case 0: + air_log_button[0]->setText(tr("Main Log")+"\n["+labelname+"]"); + SetCaption(); + if(air_panel) { + air_panel->setLogName(logname); + } + break; - case 1: - str=QString(tr("Aux 1 Log")); - air_log_button[1]-> - setText(QString().sprintf("%s\n[%s]",(const char *)str, - (const char *)labelname)); - break; + case 1: + air_log_button[1]->setText(tr("Aux 1 Log")+"\n["+labelname+"]"); + break; - case 2: - str=QString(tr("Aux 2 Log")); - air_log_button[2]-> - setText(QString().sprintf("%s\n[%s]",(const char *)str, - (const char *)labelname)); - break; + case 2: + air_log_button[2]->setText(tr("Aux 2 Log")+"\n["+labelname+"]"); + break; } } @@ -1374,55 +1361,36 @@ void MainWidget::logReloadedData(int log) { QString str; QHostAddress addr; - QString labelname= - air_log[log]->logName().left(air_log[log]->logName().length()-4); + QString labelname=air_log[log]->logName(); if(labelname.isEmpty()) { labelname="--"; } switch(log) { - case 0: - str=QString(tr("Main Log")); - air_log_button[0]-> - setText(QString().sprintf("%s\n[%s]",(const char *)str, - (const char *)labelname)); - LogLine(RDConfig::LogInfo,QString(). - sprintf("loaded log '%s' in Main Log", - (const char *)air_log[0]->logName(). - left(air_log[0]->logName().length()-4))); - if(air_log[0]->logName().isEmpty()) { - if(air_panel!=NULL) { - air_panel->setSvcName(rda->airplayConf()->defaultSvc()); - } - } - else { - if(air_panel!=NULL) { - air_panel->setSvcName(air_log[0]->serviceName()); - } - } - break; + case 0: + air_log_button[0]->setText(tr("Main Log")+"\n["+labelname+"]"); + LogLine(RDConfig::LogInfo,"loaded log '"+air_log[0]->logName()+"' in Main Log"); + if(air_log[0]->logName().isEmpty()) { + if(air_panel!=NULL) { + air_panel->setSvcName(rda->airplayConf()->defaultSvc()); + } + } + else { + if(air_panel!=NULL) { + air_panel->setSvcName(air_log[0]->serviceName()); + } + } + break; - case 1: - str=QString(tr("Aux 1 Log")); - air_log_button[1]-> - setText(QString().sprintf("%s\n[%s]",(const char *)str, - (const char *)labelname)); - LogLine(RDConfig::LogInfo,QString(). - sprintf("loaded log '%s' in Aux 1 Log", - (const char *)air_log[1]->logName(). - left(air_log[1]->logName().length()-4))); - break; + case 1: + air_log_button[1]->setText(tr("Aux 1 Log")+"\n["+labelname+"]"); + LogLine(RDConfig::LogInfo,"loaded log '"+air_log[1]->logName()+"' in Aux 1 Log"); + break; - case 2: - str=QString(tr("Aux 2 Log")); - air_log_button[2]-> - setText(QString().sprintf("%s\n[%s]",(const char *)str, - (const char *)labelname)); - LogLine(RDConfig::LogInfo,QString(). - sprintf("loaded log '%s' in Aux 2 Log", - (const char *)air_log[2]->logName(). - left(air_log[2]->logName().length()-4))); - break; + case 2: + air_log_button[2]->setText(tr("Aux 2 Log")+"\n["+labelname+"]"); + LogLine(RDConfig::LogInfo,"loaded log '"+air_log[2]->logName()+"' in Aux 2 Log"); + break; } SetCaption(); @@ -1462,8 +1430,7 @@ void MainWidget::logReloadedData(int log) void MainWidget::userData() { - LogLine(RDConfig::LogInfo,QString(). - sprintf("user changed to '%s'",(const char *)rda->ripc()->user())); + LogLine(RDConfig::LogInfo,"user changed to '"+rda->ripc()->user()+"'"); SetCaption(); // @@ -2377,9 +2344,8 @@ void MainWidget::SetActionMode(StartButton::Mode mode) } } if(svc_quan==0) { - sql=QString().sprintf("select SERVICE_NAME from SERVICE_PERMS \ - where STATION_NAME=\"%s\"", - (const char *)rda->station()->name()); + sql=QString("select SERVICE_NAME from SERVICE_PERMS where ")+ + "STATION_NAME=\""+RDEscapeString(rda->station()->name())+"\""; q=new RDSqlQuery(sql); while(q->next()) { services_list.append( q->value(0).toString() ); diff --git a/rdairplay/rdairplay_cs.ts b/rdairplay/rdairplay_cs.ts index 80e73805..7c7d962e 100644 --- a/rdairplay/rdairplay_cs.ts +++ b/rdairplay/rdairplay_cs.ts @@ -525,7 +525,7 @@ poslechu T - T + T diff --git a/rdairplay/rdairplay_de.ts b/rdairplay/rdairplay_de.ts index 8a99896f..28639914 100644 --- a/rdairplay/rdairplay_de.ts +++ b/rdairplay/rdairplay_de.ts @@ -525,7 +525,7 @@ vorhören T - T + T diff --git a/rdairplay/rdairplay_es.ts b/rdairplay/rdairplay_es.ts index 8db64d51..b9ecf0f1 100644 --- a/rdairplay/rdairplay_es.ts +++ b/rdairplay/rdairplay_es.ts @@ -505,7 +505,7 @@ Final T - T + T TRACK diff --git a/rdairplay/rdairplay_fr.ts b/rdairplay/rdairplay_fr.ts index 7a89f3d2..8ffe9ab4 100644 --- a/rdairplay/rdairplay_fr.ts +++ b/rdairplay/rdairplay_fr.ts @@ -525,7 +525,7 @@ la Fin T - T + T diff --git a/rdairplay/rdairplay_nb.ts b/rdairplay/rdairplay_nb.ts index 45884536..6f0c8f55 100644 --- a/rdairplay/rdairplay_nb.ts +++ b/rdairplay/rdairplay_nb.ts @@ -535,7 +535,7 @@ Tail T - S + S diff --git a/rdairplay/rdairplay_nn.ts b/rdairplay/rdairplay_nn.ts index 45884536..6f0c8f55 100644 --- a/rdairplay/rdairplay_nn.ts +++ b/rdairplay/rdairplay_nn.ts @@ -535,7 +535,7 @@ Tail T - S + S diff --git a/rdairplay/rdairplay_pt_BR.ts b/rdairplay/rdairplay_pt_BR.ts index a343840a..85350b95 100644 --- a/rdairplay/rdairplay_pt_BR.ts +++ b/rdairplay/rdairplay_pt_BR.ts @@ -526,7 +526,7 @@ Log T - T + T diff --git a/rdairplay/stop_counter.cpp b/rdairplay/stop_counter.cpp index 8e3d2d5c..13f6ae5a 100644 --- a/rdairplay/stop_counter.cpp +++ b/rdairplay/stop_counter.cpp @@ -87,9 +87,7 @@ void StopCounter::setState(bool state) UpdateTime(); stop_running=true; str=QString(tr("Next Stop")); - stop_text= - QString().sprintf("%s [%s]",(const char *)str, - (const char *)stop_time.toString(time_format)); + stop_text=tr("Next Stop")+" ["+stop_time.toString(time_format)+"]"; } } else { @@ -110,11 +108,10 @@ void StopCounter::setTime(QTime time) stop_time=time; setState(true); str=QString(tr("Next Stop")); - stop_text=QString().sprintf("%s [%s]",(const char *)str, - (const char *)stop_time.toString(time_format)); + stop_text=tr("Next Stop")+" ["+stop_time.toString(time_format)+"]"; } else { - setState(false); + setState(false); } UpdateTime(); }