Exemplo n.º 1
0
void Xport::AddCut()
{
  RDCart *cart;
  RDCut *cut;
  int cart_number;
  int cut_number;

  //
  // Verify Post
  //
  if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
    XmlExit("Missing CART_NUMBER",400);
  }

  //
  // Verify User Perms
  //
  if(!rda->user()->cartAuthorized(cart_number)) {
    XmlExit("No such cart",404);
  }
  if(!rda->user()->editAudio()) {
    XmlExit("Unauthorized",401);
  }

  //
  // Process Request
  //
  cart=new RDCart(cart_number);
  if(!cart->exists()) {
    delete cart;
    XmlExit("No such cart",404);
  }
  if((cut_number=cart->addCut(0,0,2))<0) {
    delete cart;
    XmlExit("No new cuts available",500);
  }
  printf("Content-type: application/xml\n");
  printf("Status: 200\n\n");
  printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
  printf("<cutAdd>\n");
  cut=new RDCut(cart_number,cut_number);
  if(cut->exists()) {
    printf("%s",(const char *)cut->xml(true));
  }
  delete cut;
  delete cart;
  printf("</cutAdd>\n");

  Exit(0);
}
Exemplo n.º 2
0
void Xport::ListCuts()
{
  RDCut *cut;
  int cart_number;
  QString sql;
  RDSqlQuery *q;

  //
  // Verify Post
  //
  if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
    XmlExit("Missing CART_NUMBER",400);
  }

  //
  // Verify User Perms
  //
  if(!rda->user()->cartAuthorized(cart_number)) {
    XmlExit("No such cart",404);
  }

  //
  // Process Request
  //
  sql=QString("select CUT_NAME from CUTS where ")+
    QString().sprintf("CART_NUMBER=%u ",cart_number)+
    "order by CUT_NAME";
  q=new RDSqlQuery(sql);
  printf("Content-type: application/xml\n");
  printf("Status: 200\n\n");
  printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
  printf("<cutList>\n");
  while(q->next()) {
    cut=new RDCut(q->value(0).toString());
    if(cut->exists()) {
      printf("%s",(const char *)cut->xml(true));
    }
    delete cut;
  }
  delete q;
  printf("</cutList>\n");

  Exit(0);
}
Exemplo n.º 3
0
void Xport::ListCut()
{
  RDCut *cut;
  int cart_number;
  int cut_number;

  //
  // Verify Post
  //
  if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
    XmlExit("Missing CART_NUMBER",400);
  }
  if(!xport_post->getValue("CUT_NUMBER",&cut_number)) {
    XmlExit("Missing CUT_NUMBER",400);
  }

  //
  // Verify User Perms
  //
  if(!rda->user()->cartAuthorized(cart_number)) {
    XmlExit("No such cart",404);
  }

  //
  // Process Request
  //
  cut=new RDCut(cart_number,cut_number);
  if(!cut->exists()) {
    delete cut;
    XmlExit("No such cut",404);
  }
  printf("Content-type: application/xml\n");
  printf("Status: 200\n\n");
  printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
  printf("<cutList>\n");
  printf("%s",(const char *)cut->xml(true));
  printf("</cutList>\n");
  delete cut;

  Exit(0);
}
Exemplo n.º 4
0
void Xport::EditCut()
{
  RDCut *cut;
  int cart_number;
  int cut_number;
  QString str;
  int num;
  QDateTime datetime;
  QTime time;
  bool rotation_changed=false;
  bool length_changed=false;
  QDateTime start_datetime;
  bool use_start_datetime=false;
  QDateTime end_datetime;
  bool use_end_datetime=false;
  QTime start_daypart;
  bool use_start_daypart=false;
  QTime end_daypart;
  bool use_end_daypart=false;
  int talk_points[2];
  bool use_end_points[2]={false,false};
  int end_points[2];
  bool use_talk_points[2]={false,false};
  int segue_points[2];
  bool use_segue_points[2]={false,false};
  int hook_points[2];
  bool use_hook_points[2]={false,false};
  int fadeup_point;
  bool use_fadeup_point=false;
  int fadedown_point;
  bool use_fadedown_point=false;
  bool use_weight=false;
  int weight;
  bool ok=false;

  //
  // Verify Post
  //
  if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
    XmlExit("Missing CART_NUMBER",400);
  }
  if(!xport_post->getValue("CUT_NUMBER",&cut_number)) {
    XmlExit("Missing CUT_NUMBER",400);
  }

  //
  // Verify User Perms
  //
  if(!rda->user()->cartAuthorized(cart_number)) {
    XmlExit("No such cart",404);
  }
  if(!rda->user()->editAudio()) {
    XmlExit("Unauthorized",401);
  }

  //
  // Check Date/Time Values for Validity
  //
  if((use_start_datetime=xport_post->
      getValue("START_DATETIME",&start_datetime,&ok))) {
    if(!ok) {
      XmlExit("invalid START_DATETIME",400);
    }
  }
  if((use_end_datetime=xport_post->
      getValue("END_DATETIME",&end_datetime,&ok))) {
    if(!ok) {
      XmlExit("invalid END_DATETIME",400);
    }
  }
  if(use_start_datetime!=use_end_datetime) {
    XmlExit("both DATETIME values must be set together",400);
  }
  if(use_start_datetime&&(start_datetime>end_datetime)) {
    XmlExit("START_DATETIME is later than END_DATETIME",400);
  }

  if((use_start_daypart=xport_post->
      getValue("START_DAYPART",&start_daypart,&ok))) {
    if(!ok) {
      XmlExit("invalid START_DAYPART",400);
    }
  }
  if((use_end_daypart=xport_post->
      getValue("END_DAYPART",&end_daypart,&ok))) {
    if(!ok) {
      XmlExit("invalid END_DAYPART",400);
    }
  }
  if(use_start_daypart!=use_end_daypart) {
    XmlExit("both DAYPART values must be set together",400);
  }

  cut=new RDCut(cart_number,cut_number);
  if(!cut->exists()) {
    delete cut;
    XmlExit("No such cut",404);
  }

  //
  // Check pointers for validity
  //
  end_points[0]=cut->startPoint();
  end_points[1]=cut->endPoint();
  fadeup_point=cut->fadeupPoint();
  fadedown_point=cut->fadedownPoint();
  CheckPointerValidity(end_points,use_end_points,"",0);
  CheckPointerValidity(talk_points,use_talk_points,"TALK_",end_points[1]);
  CheckPointerValidity(segue_points,use_segue_points,"SEGUE_",end_points[1]);
  CheckPointerValidity(hook_points,use_hook_points,"HOOK_",end_points[1]);
  if((use_fadeup_point=xport_post->
      getValue("FADEUP_POINT",&fadeup_point,&ok))) {
    if(!ok) {
      XmlExit("invalid FADEUP_POINT",400);
    }
    if(fadeup_point>end_points[1]) {
      XmlExit("FADEUP_POINT exceeds length of cart",400);
    }
  }
  if((use_fadedown_point=xport_post->
      getValue("FADEDOWN_POINT",&fadedown_point,&ok))) {
    if(!ok) {
      XmlExit("invalid FADEDOWN_POINT",400);
    }
    if(fadeup_point>end_points[1]) {
      XmlExit("FADEDOWN_POINT exceeds length of cart",400);
    }
  }
  if(use_fadeup_point&&use_fadedown_point&&
     (fadeup_point>=0)&&(fadedown_point>=0)&&(fadeup_point>fadedown_point)) {
    XmlExit("FADEUP_POINT is greater than FADEDOWN_POINT",400);
  }

  //
  // Check Weight
  //
  if((use_weight=xport_post->getValue("WEIGHT",&weight,&ok))) {
    if((!ok)||(weight<0)) {
      XmlExit("invalid WEIGHT",400);
    }
  }

  //
  // Process Request
  //
  if(xport_post->getValue("EVERGREEN",&num)) {
    cut->setEvergreen(num);
    rotation_changed=true;
  }
  if(xport_post->getValue("DESCRIPTION",&str)) {
    cut->setDescription(str);
  }
  if(xport_post->getValue("OUTCUE",&str)) {
    cut->setOutcue(str);
  }
  if(xport_post->getValue("ISRC",&str)) {
    cut->setIsrc(str);
  }
  if(xport_post->getValue("ISCI",&str)) {
    cut->setIsci(str);
  }
  if(use_start_datetime) {
    cut->setStartDatetime(start_datetime,!start_datetime.isNull());
    length_changed=true;
    rotation_changed=true;
  }
  if(use_end_datetime) {
    cut->setEndDatetime(end_datetime,!end_datetime.isNull());
    length_changed=true;
    rotation_changed=true;
  }
  if(xport_post->getValue("MON",&num)) {
    cut->setWeekPart(1,num);
    rotation_changed=true;
  }
  if(xport_post->getValue("TUE",&num)) {
    cut->setWeekPart(2,num);
    rotation_changed=true;
  }
  if(xport_post->getValue("WED",&num)) {
    cut->setWeekPart(3,num);
    rotation_changed=true;
  }
  if(xport_post->getValue("THU",&num)) {
    cut->setWeekPart(4,num);
    rotation_changed=true;
  }
  if(xport_post->getValue("FRI",&num)) {
    cut->setWeekPart(5,num);
    rotation_changed=true;
  }
  if(xport_post->getValue("SAT",&num)) {
    cut->setWeekPart(6,num);
    rotation_changed=true;
  }
  if(xport_post->getValue("SUN",&num)) {
    cut->setWeekPart(7,num);
    rotation_changed=true;
  }
  if(use_start_daypart) {
    cut->setStartDaypart(start_daypart,!start_daypart.isNull());
    rotation_changed=true;
  }
  if(use_end_daypart) {
    cut->setEndDaypart(end_daypart,!end_daypart.isNull());
    rotation_changed=true;
  }
  if(use_weight) {
    cut->setWeight(weight);
    rotation_changed=true;
  }
  if(use_end_points[0]) {
    cut->setStartPoint(end_points[0]);
    length_changed=true;
  }
  if(use_end_points[1]) {
    cut->setEndPoint(end_points[1]);
    length_changed=true;
  }
  if(use_fadeup_point) {
    cut->setFadeupPoint(fadeup_point);
    length_changed=true;
  }
  if(use_fadedown_point) {
    cut->setFadedownPoint(fadedown_point);
    length_changed=true;
  }
  if(use_segue_points[0]) {
    cut->setSegueStartPoint(segue_points[0]);
    length_changed=true;
  }
  if(use_segue_points[1]) {
    cut->setSegueEndPoint(segue_points[1]);
    length_changed=true;
  }
  if(use_hook_points[0]) {
    cut->setHookStartPoint(hook_points[0]);
    length_changed=true;
  }
  if(use_hook_points[1]) {
    cut->setHookEndPoint(hook_points[1]);
    length_changed=true;
  }
  if(use_talk_points[0]) {
    cut->setTalkStartPoint(talk_points[0]);
    length_changed=true;
  }
  if(use_talk_points[1]) {
    cut->setTalkEndPoint(talk_points[1]);
    length_changed=true;
  }
  if(length_changed||rotation_changed) {
    RDCart *cart=new RDCart(cut->cartNumber());
    if(length_changed) {
      cart->updateLength();
    }
    if(rotation_changed) {
      cart->resetRotation();
    }
    delete cart;
  }
  printf("Content-type: application/xml\n");
  printf("Status: 200\n\n");
  printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
  printf("<cutList>\n");
  printf("%s",(const char *)cut->xml(true));
  printf("</cutList>\n");
  delete cut;

  Exit(0);
}
Exemplo n.º 5
0
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;
  }
}
Exemplo n.º 6
0
void Xport::EditCut()
{
  RDCut *cut;
  int cart_number;
  int cut_number;
  QString str;
  int num;
  QDateTime datetime;
  QTime time;
  bool rotation_changed=false;
  bool length_changed=false;

  //
  // Verify Post
  //
  if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
    XmlExit("Missing CART_NUMBER",400);
  }
  if(!xport_post->getValue("CUT_NUMBER",&cut_number)) {
    XmlExit("Missing CUT_NUMBER",400);
  }

  //
  // Verify User Perms
  //
  if(!xport_user->cartAuthorized(cart_number)) {
    XmlExit("No such cart",404);
  }
  if(!xport_user->editAudio()) {
    XmlExit("Unauthorized",401);
  }

  //
  // Process Request
  //
  cut=new RDCut(cart_number,cut_number);
  if(!cut->exists()) {
    delete cut;
    XmlExit("No such cut",404);
  }
  if(xport_post->getValue("EVERGREEN",&num)) {
    cut->setEvergreen(num);
    rotation_changed=true;
  }
  if(xport_post->getValue("DESCRIPTION",&str)) {
    cut->setDescription(str);
  }
  if(xport_post->getValue("OUTCUE",&str)) {
    cut->setOutcue(str);
  }
  if(xport_post->getValue("ISRC",&str)) {
    cut->setIsrc(str);
  }
  if(xport_post->getValue("ISCI",&str)) {
    cut->setIsci(str);
  }
  if(xport_post->getValue("START_DATETIME",&datetime)) {
    cut->setStartDatetime(datetime,!datetime.isNull());
    length_changed=true;
    rotation_changed=true;
  }
  if(xport_post->getValue("END_DATETIME",&datetime)) {
    cut->setEndDatetime(datetime,!datetime.isNull());
    length_changed=true;
    rotation_changed=true;
  }
  if(xport_post->getValue("MON",&num)) {
    cut->setWeekPart(1,num);
    rotation_changed=true;
  }
  if(xport_post->getValue("TUE",&num)) {
    cut->setWeekPart(2,num);
    rotation_changed=true;
  }
  if(xport_post->getValue("WED",&num)) {
    cut->setWeekPart(3,num);
    rotation_changed=true;
  }
  if(xport_post->getValue("THU",&num)) {
    cut->setWeekPart(4,num);
    rotation_changed=true;
  }
  if(xport_post->getValue("FRI",&num)) {
    cut->setWeekPart(5,num);
    rotation_changed=true;
  }
  if(xport_post->getValue("SAT",&num)) {
    cut->setWeekPart(6,num);
    rotation_changed=true;
  }
  if(xport_post->getValue("SUN",&num)) {
    cut->setWeekPart(7,num);
    rotation_changed=true;
  }
  if(xport_post->getValue("START_DAYPART",&time)) {
    cut->setStartDaypart(time,!time.isNull());
    rotation_changed=true;
  }
  if(xport_post->getValue("END_DAYPART",&time)) {
    cut->setEndDaypart(time,!time.isNull());
    rotation_changed=true;
  }
  if(xport_post->getValue("WEIGHT",&num)) {
    cut->setWeight(num);
    rotation_changed=true;
  }
  if(xport_post->getValue("START_POINT",&num)) {
    cut->setStartPoint(num);
    length_changed=true;
  }
  if(xport_post->getValue("END_POINT",&num)) {
    cut->setEndPoint(num);
    length_changed=true;
  }
  if(xport_post->getValue("FADEUP_POINT",&num)) {
    cut->setFadeupPoint(num);
    length_changed=true;
  }
  if(xport_post->getValue("FADEDOWN_POINT",&num)) {
    cut->setFadedownPoint(num);
    length_changed=true;
  }
  if(xport_post->getValue("SEGUE_START_POINT",&num)) {
    cut->setSegueStartPoint(num);
    length_changed=true;
  }
  if(xport_post->getValue("SEGUE_END_POINT",&num)) {
    cut->setSegueEndPoint(num);
    length_changed=true;
  }
  if(xport_post->getValue("HOOK_START_POINT",&num)) {
    cut->setHookStartPoint(num);
    length_changed=true;
  }
  if(xport_post->getValue("HOOK_END_POINT",&num)) {
    cut->setHookEndPoint(num);
    length_changed=true;
  }
  if(xport_post->getValue("TALK_START_POINT",&num)) {
    cut->setTalkStartPoint(num);
    length_changed=true;
  }
  if(xport_post->getValue("TALK_END_POINT",&num)) {
    cut->setTalkEndPoint(num);
    length_changed=true;
  }
  if(length_changed||rotation_changed) {
    RDCart *cart=new RDCart(cut->cartNumber());
    if(length_changed) {
      cart->updateLength();
    }
    if(rotation_changed) {
      cart->resetRotation();
    }
    delete cart;
  }
  delete cut;
  XmlExit("OK",200);
}
Exemplo n.º 7
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();
}