void RDSlotBox::setCart(RDLogLine *logline) { QString cutname; QPalette p; line_logline=logline; RDCart *cart; RDCut *cut; line_type=logline->type(); switch(line_type) { case RDLogLine::Cart: cart=new RDCart(logline->cartNumber()); cut=new RDCut(QString().sprintf("%06u_%03u",logline->cartNumber(), logline->cutNumber())); if(!cart->exists()) { line_cart_label-> setText(QString().sprintf("%06u",logline->cartNumber())); line_description_label->clear(); line_artist_label->clear(); line_cut_label->clear(); line_group_label->clear(); line_outcue_label->clear(); line_length_label->setText("00:00"); line_talktime_label->setText(":00"); line_up_label->setText("0:00:00"); line_down_label->setText("0:00:00"); line_title_label->setText(tr("[CART NOT FOUND]")); switch(cart->type()) { case RDCart::Audio: case RDCart::Macro: case RDCart::All: line_icon_label->setPixmap(*line_playout_map); break; } SetColor(QColor(LABELBOX_MISSING_COLOR)); } else { if(((cart->forcedLength()==0)&&(cart->type()==RDCart::Audio))|| (line_logline->state()==RDLogLine::NoCut)) { line_cart_label-> setText(QString().sprintf("%06u",logline->cartNumber())); line_description_label->setText(cut->description()); line_artist_label->setText(tr("[NO AUDIO AVAILABLE]")); line_cut_label->clear(); line_group_label->clear(); line_outcue_label->clear(); line_length_label->setText("00:00"); line_talktime_label->setText(":00"); line_up_label->setText("0:00:00"); line_down_label->setText("0:00:00"); line_icon_label->setPixmap(*line_playout_map); line_title_label->setText(logline->title()); SetColor(QColor(LABELBOX_MISSING_COLOR)); } else { line_cart_label-> setText(QString().sprintf("%06u",logline->cartNumber())); if(line_logline->evergreen()) { SetColor(QColor(LABELBOX_EVERGREEN_COLOR)); } else { SetColor(QColor(LABELBOX_BACKGROUND_COLOR)); } switch(cart->type()) { case RDCart::Audio: case RDCart::All: line_icon_label->setPixmap(*line_playout_map); break; case RDCart::Macro: line_icon_label->setPixmap(*line_macro_map); break; } line_group_label->setText(cart->groupName()); p=line_group_label->palette(); p.setColor(QColorGroup::Foreground,line_logline->groupColor()); line_group_label->setPalette(p); if(line_logline->talkLength()<=0) { line_talktime_label->setText(":00"); } else { line_talktime_label-> setText(RDGetTimeLength(line_logline->talkLength(), false,false)); } line_length_label-> setText(RDGetTimeLength(line_logline->effectiveLength(), false,false)); if(line_logline->timescalingActive()) { line_length_label->setPalette(line_hard_palette); } else { line_length_label->setPalette(line_time_palette); } if(line_logline->originUser().isEmpty()|| (!line_logline->originDateTime().isValid())) { line_title_label-> setText(RDResolveNowNext(line_airplay_conf->titleTemplate(), logline)); } else { line_title_label->setText(line_logline->title()+" -- "+ line_logline->originUser()+" "+ line_logline->originDateTime(). toString("M/d hh:mm")); } line_description_label-> setText(RDResolveNowNext(line_airplay_conf->descriptionTemplate(), logline)); line_artist_label-> setText(RDResolveNowNext(line_airplay_conf->artistTemplate(), logline)); line_up_label-> setText(RDGetTimeLength(line_logline->playPosition(),true,true)); line_down_label-> setText(RDGetTimeLength(line_logline->effectiveLength()- line_logline->playPosition(),true,true)); line_position_bar->setTotalSteps(line_logline->effectiveLength()); line_position_bar->setProgress(line_logline->playPosition()); if(logline->cutNumber()>=0) { line_cut_label-> setText(QString().sprintf("%03u",logline->cutNumber())); line_outcue_label-> setText(RDResolveNowNext(line_airplay_conf->outcueTemplate(), logline)); line_position_bar->show(); line_up_label->show(); line_down_label->show(); } else { SetColor(QColor(LABELBOX_MISSING_COLOR)); line_cut_label->clear(); line_outcue_label->setText(tr("[NO VALID CUT AVAILABLE]")); } line_title_label->show(); line_artist_label->show(); } } delete cart; delete cut; break; case RDLogLine::Macro: line_icon_label->setPixmap(*line_macro_map); line_position_bar->hide(); line_up_label->hide(); line_down_label->hide(); cart=new RDCart(logline->cartNumber()); cut=new RDCut(QString().sprintf("%06u_%03u",logline->cartNumber(), logline->cutNumber())); if(!cart->exists()) { SetColor(QColor(LABELBOX_MISSING_COLOR)); } else { SetColor(QColor(LABELBOX_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()); line_group_label->setPalette(p); line_length_label-> setText(RDGetTimeLength(line_logline->effectiveLength(), false,false)); line_title_label->setText(cart->title()); line_description_label->setText(""); line_artist_label->setText(cart->artist()); line_outcue_label->setText(""); delete cart; delete cut; line_title_label->show(); line_artist_label->show(); break; default: break; } }
void Xport::EditCart() { QString where=""; RDCart *cart; RDGroup *group; int cart_number; int include_cuts=0; QString group_name; QString value; int number; bool ok; int line; QString macro; bool length_changed=false; // // Verify Post // if(!xport_post->getValue("CART_NUMBER",&cart_number)) { XmlExit("Missing CART_NUMBER",400); } xport_post->getValue("INCLUDE_CUTS",&include_cuts); // // Verify User Perms // if(!rda->user()->cartAuthorized(cart_number)) { XmlExit("No such cart",404); } if(!rda->user()->modifyCarts()) { XmlExit("Unauthorized",401); } if(xport_post->getValue("GROUP_NAME",&group_name)) { if(!rda->user()->groupAuthorized(group_name)) { XmlExit("No such group",404); } group=new RDGroup(group_name); if(!group->exists()) { delete group; XmlExit("No such group",404); } if(group->enforceCartRange()) { if(((unsigned)cart_number<group->defaultLowCart())|| ((unsigned)cart_number>group->defaultHighCart())) { delete group; XmlExit("Invalid cart number for group",409); } } delete group; } // // Process Request // cart=new RDCart(cart_number); if(!cart->exists()) { delete cart; XmlExit("No such cart",404); } if(xport_post->getValue("FORCED_LENGTH",&value)) { number=RDSetTimeLength(value); if(cart->type()==RDCart::Macro) { delete cart; XmlExit("Unsupported operation for cart type",403); } if(!cart->validateLengths(number)) { delete cart; XmlExit("Forced length out of range",403); } } switch(cart->type()) { case RDCart::Audio: break; case RDCart::Macro: line=0; while(xport_post->getValue(QString().sprintf("MACRO%d",line++),&value)) { value.stripWhiteSpace(); if(value.right(1)!="!") { delete cart; XmlExit("Invalid macro data",400); } macro+=value; } cart->setMacros(macro); break; case RDCart::All: break; } if(!group_name.isEmpty()) { cart->setGroupName(group_name); } if(xport_post->getValue("TITLE",&value)) { cart->setTitle(value); } if(xport_post->getValue("ARTIST",&value)) { cart->setArtist(value); } if(xport_post->getValue("ALBUM",&value)) { cart->setAlbum(value); } if(xport_post->getValue("YEAR",&value)) { number=value.toInt(&ok); if((ok)&&(number>0)) { cart->setYear(number); } } if(xport_post->getValue("LABEL",&value)) { cart->setLabel(value); } if(xport_post->getValue("CLIENT",&value)) { cart->setClient(value); } if(xport_post->getValue("AGENCY",&value)) { cart->setAgency(value); } if(xport_post->getValue("PUBLISHER",&value)) { cart->setPublisher(value); } if(xport_post->getValue("COMPOSER",&value)) { cart->setComposer(value); } if(xport_post->getValue("USER_DEFINED",&value)) { cart->setUserDefined(value); } if(xport_post->getValue("USAGE_CODE",&value)) { number=value.toInt(&ok); if((ok)&&(number>0)) { cart->setUsageCode((RDCart::UsageCode)number); } } if(xport_post->getValue("ENFORCE_LENGTH",&value)) { number=value.toInt(&ok); if((ok)&&(number>=0)&&(number<2)) { cart->setEnforceLength(number); length_changed=true; } } if(xport_post->getValue("FORCED_LENGTH",&value)) { cart->setForcedLength(RDSetTimeLength(value)); length_changed=true; } if(xport_post->getValue("ASYNCRONOUS",&value)) { number=value.toInt(&ok); if((ok)&&(number>=0)&&(number<2)) { cart->setAsyncronous(number); length_changed=true; } } if(xport_post->getValue("OWNER",&value)) { cart->setOwner(value); } if(xport_post->getValue("NOTES",&value)) { cart->setNotes(value); } if(xport_post->getValue("SCHED_CODES",&value)) { cart->setSchedCodes(value); } if(length_changed) { cart->updateLength(); } printf("Content-type: application/xml\n"); printf("Status: 200\n\n"); printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"); printf("<cartList>\n"); printf("%s",(const char *)cart->xml(include_cuts,true)); delete cart; printf("</cartList>\n"); Exit(0); }
void LogLineBox::setEvent(int line,RDLogLine::TransType next_type, RDLogLine *logline) { QString cutname; QPalette p; line_logline=logline; line_next_type=next_type; RDCart *cart; RDCut *cut; log_id=logline->id(); log_line=line; line_type=logline->type(); switch(line_logline->transType()) { case RDLogLine::Stop: line_trans_label->setText(tr("STOP")); line_trans_label->setPalette(palette()); break; case RDLogLine::Play: line_trans_label->setText(tr("PLAY")); line_trans_label->setPalette(palette()); break; case RDLogLine::Segue: line_trans_label->setText(tr("SEGUE")); if(logline->hasCustomTransition()) { line_trans_label->setPalette(line_transition_palette); } else { line_trans_label->setPalette(palette()); } break; default: break; } switch(line_type) { case RDLogLine::Cart: line_comment_label->hide(); cart=new RDCart(logline->cartNumber()); cut=new RDCut(logline->cartNumber(),logline->cutNumber()); if(!cart->exists()) { line_cart_label-> setText(QString().sprintf("%06u",logline->cartNumber())); line_description_label->clear(); line_artist_label->clear(); line_cut_label->clear(); line_group_label->clear(); line_outcue_label->clear(); line_length_label->setText("00:00"); line_talktime_label->setText(":00"); line_up_label->setText("0:00:00"); line_down_label->setText("0:00:00"); line_comment_label->clear(); line_title_label->setText(tr("[CART NOT FOUND]")); switch(cart->type()) { case RDCart::Audio: case RDCart::Macro: case RDCart::All: line_icon_label->setPixmap(*line_playout_map); break; } SetColor(QColor(LOGLINEBOX_MISSING_COLOR)); delete cart; delete cut; } else { if(((cart->forcedLength()==0)&&(cart->type()==RDCart::Audio))|| (line_logline->state()==RDLogLine::NoCut)) { line_cart_label-> setText(QString().sprintf("%06u",logline->cartNumber())); line_description_label->setText(cut->description()); line_artist_label->setText(tr("[NO AUDIO AVAILABLE]")); line_cut_label->clear(); line_group_label->clear(); line_outcue_label->clear(); line_length_label->setText("00:00"); line_talktime_label->setText(":00"); line_up_label->setText("0:00:00"); line_down_label->setText("0:00:00"); line_comment_label->clear(); line_icon_label->setPixmap(*line_playout_map); line_title_label->setText(logline->title()); SetColor(QColor(LOGLINEBOX_MISSING_COLOR)); delete cart; delete cut; } else { line_cart_label-> setText(QString().sprintf("%06u",logline->cartNumber())); if(line_logline->evergreen()) { SetColor(QColor(LOGLINEBOX_EVERGREEN_COLOR)); } else { SetColor(QColor(LOGLINEBOX_BACKGROUND_COLOR)); } if(line_logline->source()==RDLogLine::Tracker) { line_icon_label->setPixmap(*line_track_cart_map); } else { switch(cart->type()) { case RDCart::Audio: case RDCart::All: line_icon_label->setPixmap(*line_playout_map); break; case RDCart::Macro: line_icon_label->setPixmap(*line_macro_map); break; } } line_group_label->setText(cart->groupName()); p=line_group_label->palette(); p.setColor(QColorGroup::Foreground,line_logline->groupColor()); line_group_label->setPalette(p); if(line_logline->talkLength()<=0) { line_talktime_label->setText(":00"); } else { line_talktime_label-> setText(RDGetTimeLength(line_logline->talkLength(), false,false)); } line_length_label-> setText(RDGetTimeLength(line_logline->effectiveLength(), false,false)); if(line_logline->timescalingActive()) { line_length_label->setPalette(line_hard_palette); } else { line_length_label->setPalette(line_time_palette); } if((line_logline->source()!=RDLogLine::Tracker)|| line_logline->originUser().isEmpty()|| (!line_logline->originDateTime().isValid())) { line_title_label-> 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_description_label-> setText(RDResolveNowNext(line_description_template,line_logline)); line_artist_label-> setText(RDResolveNowNext(line_artist_template,line_logline)); line_up_label-> setText(RDGetTimeLength(line_logline->playPosition(),true,true)); line_down_label-> setText(RDGetTimeLength(line_logline->effectiveLength()- line_logline->playPosition(),true,true)); line_position_bar->setTotalSteps(line_logline->effectiveLength()); line_position_bar->setProgress(line_logline->playPosition()); if(logline->cutNumber()>=0) { line_cut_label-> setText(QString().sprintf("%03u",logline->cutNumber())); line_outcue_label-> setText(RDResolveNowNext(line_outcue_template,line_logline)); } else { SetColor(QColor(LOGLINEBOX_MISSING_COLOR)); line_cut_label->clear(); line_outcue_label->setText(tr("[NO VALID CUT AVAILABLE]")); } delete cart; delete cut; setMode(line_mode); line_title_label->show(); line_artist_label->show(); } } break; case RDLogLine::Marker: line_icon_label->setPixmap(*line_notemarker_map); SetColor(QColor(LOGLINEBOX_MARKER_COLOR)); line_title_label->hide(); line_description_label->hide(); line_artist_label->hide(); line_cart_label->setText(tr("MARKER")); line_group_label->setText(logline->markerLabel()); line_length_label->setText(":00"); line_transition=logline->transType(); line_comment_label->setText(logline->markerComment()); setMode(line_mode); line_comment_label->show(); break; case RDLogLine::Track: line_icon_label->setPixmap(*line_mic16_map); SetColor(QColor(LOGLINEBOX_MARKER_COLOR)); line_title_label->hide(); line_description_label->hide(); line_artist_label->hide(); line_cart_label->setText(tr("TRACK")); line_group_label->setText(""); line_length_label->setText(":00"); line_transition=logline->transType(); line_comment_label->setText(logline->markerComment()); setMode(line_mode); line_comment_label->show(); break; case RDLogLine::MusicLink: line_icon_label->setPixmap(*line_music_map); SetColor(QColor(LOGLINEBOX_MARKER_COLOR)); line_title_label->hide(); line_description_label->hide(); line_artist_label->hide(); line_cart_label->setText(tr("LINK")); line_group_label->setText(""); line_length_label->setText(":00"); line_transition=logline->transType(); line_comment_label->setText(tr("[music import]")); setMode(line_mode); line_comment_label->show(); break; case RDLogLine::TrafficLink: line_icon_label->setPixmap(*line_traffic_map); SetColor(QColor(LOGLINEBOX_MARKER_COLOR)); line_title_label->hide(); line_description_label->hide(); line_artist_label->hide(); line_cart_label->setText(tr("LINK")); line_group_label->setText(""); line_length_label->setText(":00"); line_transition=logline->transType(); line_comment_label->setText(tr("[traffic import]")); setMode(line_mode); line_comment_label->show(); break; case RDLogLine::Chain: line_icon_label->setPixmap(*line_chain_map); SetColor(QColor(LOGLINEBOX_CHAIN_COLOR)); line_title_label->setText(logline->markerLabel()); line_description_label->setText(""); line_artist_label->setText(logline->markerComment()); line_cart_label->setText(tr("CHAIN")); line_group_label->setText(""); line_length_label->setText(":00"); line_transition=logline->transType(); line_comment_label->hide(); setMode(line_mode); line_title_label->show(); line_artist_label->show(); break; case RDLogLine::Macro: line_icon_label->setPixmap(*line_macro_map); line_comment_label->hide(); cart=new RDCart(logline->cartNumber()); cut=new RDCut(QString().sprintf("%06u_%03u",logline->cartNumber(), logline->cutNumber())); if(!cart->exists()) { SetColor(QColor(LOGLINEBOX_MISSING_COLOR)); } else { SetColor(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()); line_group_label->setPalette(p); line_length_label-> setText(RDGetTimeLength(line_logline->effectiveLength(), false,false)); line_title_label-> setText(RDResolveNowNext(line_title_template,line_logline)); line_description_label-> setText(RDResolveNowNext(line_description_template,line_logline)); line_artist_label-> setText(RDResolveNowNext(line_artist_template,line_logline)); line_outcue_label-> setText(RDResolveNowNext(line_outcue_template,line_logline)); delete cart; delete cut; setMode(line_mode); line_title_label->show(); line_artist_label->show(); break; default: break; } PrintTime(); }