Пример #1
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;
  }
}
Пример #2
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();
}