//
// Initialize the channel list view for level & submaster modes
//
void VCDockSliderProperties::fillChannelList()
{
  QString s;
  t_channel ch;
  t_channel channels;
  QCheckListItem* item = NULL;

  //
  // Fill the list view with available channels. Put only
  // those channels that are occupied by existing devices.
  //
  for (t_device_id i = 0; i < KDeviceArraySize; i++)
    {
      Device* d = _app->doc()->device(i);
      if (!d)
	{
	  continue;
	}
      else
	{
	  channels = (t_channel) d->deviceClass()->channels()->count();

	  for (ch = 0; ch < channels; ch++)
	    {
	      // DMX Channel
	      s.sprintf("%.3d", d->address() + ch + 1);
	      item = new QCheckListItem(m_channelList, s, 
					QCheckListItem::CheckBox);
	      
	      // Device name
	      item->setText(KColumnDevice, d->name());

	      // Device channel
	      s.sprintf("%.3d:" + 
			d->deviceClass()->channels()->at(ch)->name(), ch + 1);
	      item->setText(KColumnDeviceChannel, s);
	    }
	}
    }

  //
  // Check those channels that are found from slider's channel list
  //
  QValueList <t_channel>::iterator it;
  for (it = m_slider->channels()->begin();
       it != m_slider->channels()->end(); ++it)
    {
      s.sprintf("%.3d", (*it) + 1);
      item = static_cast<QCheckListItem*> (m_channelList
					   ->findItem(s, KColumnDMXChannel));
      if (item)
	{
	  item->setOn(true);
	}
    }
}
Exemple #2
0
void VCSliderProperties::levelUpdateFixtureNode(t_fixture_id id)
{
	Fixture* fxi = NULL;
	QCheckListItem* item = NULL;
	QString str;

	fxi = _app->doc()->fixture(id);
	Q_ASSERT(fxi != NULL);

	item = levelFixtureNode(id);
	if (item == NULL)
		item = new QCheckListItem(m_levelList, fxi->name(),
					  QCheckListItem::CheckBoxController);

	item->setText(KColumnType, fxi->type());
	str.setNum(id);
	item->setText(KColumnID, str);

	levelUpdateChannels(item, fxi);
}
Exemple #3
0
void VCSliderProperties::levelUpdateChannelNode(QCheckListItem* parent,
						Fixture* fxi,
						t_channel ch)
{
	QCheckListItem* item = NULL;
	QLCChannel* channel = NULL;
	QString str;

	Q_ASSERT(parent != NULL);

	channel = fxi->channel(ch);
	Q_ASSERT(channel != NULL);

	item = levelChannelNode(parent, ch);
	if (item == NULL)
		item = new QCheckListItem(parent, channel->name(),
					  QCheckListItem::CheckBox);

	item->setText(KColumnType, channel->group());
	str.setNum(ch);
	item->setText(KColumnID, str);

	levelUpdateCapabilities(item, channel);
}
Exemple #4
0
void K3bVideoDVDRippingDialog::populateTitleView( const QValueList<int>& titles )
{
  m_w->m_titleView->clear();
  m_titleRipInfos.clear();

  QCheckListItem* titleItem = 0;
  for( QValueList<int>::const_iterator it = titles.begin(); it != titles.end(); ++it ) {
    titleItem = new QCheckListItem( m_w->m_titleView,
				    titleItem,
				    i18n("Title %1 (%2)")
				    .arg(*it)
				    .arg(m_dvd[*it-1].playbackTime().toString()),
				    QCheckListItem::RadioButtonController );
    titleItem->setText( 1, QString("%1x%2")
		       .arg(m_dvd[*it-1].videoStream().realPictureWidth())
		       .arg(m_dvd[*it-1].videoStream().realPictureHeight()) );
    titleItem->setText( 3, QString("%1 Title %2.avi").arg(m_dvd.volumeIdentifier()).arg(*it) );

    // now for the rip info
    K3bVideoDVDRippingJob::TitleRipInfo ri( *it );

    //
    // Determine default language selection:
    // first try the configured locale, if that fails, fall back to the first audio stream
    //
    ri.audioStream = 0;
    for( unsigned int i = 0; i < m_dvd[*it-1].numAudioStreams(); ++i ) {
      if( m_dvd[*it-1].audioStream(i).langCode() == KGlobal::locale()->language() &&
	  m_dvd[*it-1].audioStream(i).format() != K3bVideoDVD::AUDIO_FORMAT_DTS ) {
	ri.audioStream = i;
	break;
      }
    }

    QListViewItem* asI = 0;
    for( unsigned int i = 0; i < m_dvd[*it-1].numAudioStreams(); ++i ) {
      QString text = i18n("%1 %2Ch (%3%4)")
	.arg( K3bVideoDVD::audioFormatString( m_dvd[*it-1].audioStream(i).format() ) )
	.arg( m_dvd[*it-1].audioStream(i).channels() )
	.arg( m_dvd[*it-1].audioStream(i).langCode().isEmpty()
	      ? i18n("unknown language")
	      : KGlobal::locale()->twoAlphaToLanguageName( m_dvd[*it-1].audioStream(i).langCode() ) )
	.arg( m_dvd[*it-1].audioStream(i).codeExtension() != K3bVideoDVD::AUDIO_CODE_EXT_UNSPECIFIED
	      ? QString(" ") + K3bVideoDVD::audioCodeExtensionString( m_dvd[*it-1].audioStream(i).codeExtension() )
	      : QString::null );

      if( m_dvd[*it-1].audioStream(i).format() == K3bVideoDVD::AUDIO_FORMAT_DTS ) {
	// width of the radio button from QCheckListItem::paintCell
	int buttonSize = style().pixelMetric( QStyle::PM_CheckListButtonSize, m_w->m_titleView ) + 4;
	int spaceWidth = fontMetrics().width( ' ' );
	int numSpaces = buttonSize/spaceWidth;
	asI = new QListViewItem( titleItem, asI, QString().fill( ' ', numSpaces ) + text + " (" + i18n("not supported") + ")" );
      }
      else {
	asI = new AudioStreamViewItem( this, titleItem, asI, text, i );

	if( ri.audioStream == (int)i )
	  ((AudioStreamViewItem*)asI)->setState( QCheckListItem::On );
      }
    }

    titleItem->setOpen( true );

    m_titleRipInfos[titleItem] = ri;
  }
}
//=====================================
// XKeyboard init page with infos...
//-------------------------------------
void XKeyboard::initPage (void) {
	// log (L_INFO,"XKeyboard::initPage() called\n");
    // ...
    // this function is called after the page was created.
    // It must only be used to init the widgets contents
    // with the data available for selections and other stuff
    // like that
    // ---
	XWrapPointer< QDict<char> > mText (mTextPtr);

	mLayoutHash = mRules.getLayouts();
	mModelHash  = mRules.getModels();
	mOptionHash = mRules.getOptions();
	//================================================
	// include available layouts
	//------------------------------------------------
	QDictIterator<char> itLayout (mLayoutHash);
	QListBox* layoutBox = new QListBox();
	for (; itLayout.current(); ++itLayout) {
		layoutBox -> insertItem ( QString::fromLocal8Bit (itLayout.current()) );
		QCheckListItem* item = new QCheckListItem (
			mAddView,"",QCheckListItem::CheckBox
		);
		item->setText ( 1, QString::fromLocal8Bit (itLayout.current()) );
		item->setText ( 2, itLayout.currentKey() );
	}
	layoutBox -> sort ( true );
	mLayout -> setListBox ( layoutBox );
	
	//================================================
	// include available models
	//------------------------------------------------
	QDictIterator<char> itModel (mModelHash);
	QListBox* typeBox = new QListBox();
	for (; itModel.current(); ++itModel) {
		typeBox -> insertItem ( QString::fromLocal8Bit (itModel.current()) );
    }
	typeBox -> sort ( true );
	mType -> setListBox ( typeBox );
	mAddView -> setSorting (1);
	//================================================
	// include available options
	//------------------------------------------------
	QString* xkbDefault = new QString (
		mText["Default"]
	);
	mXkbOption[0]->insertItem (*xkbDefault);
	mXkbOption[1]->insertItem (*xkbDefault);
	mXkbOption[6]->insertItem (*xkbDefault);
	QDictIterator<char> itOption (mOptionHash);
	for (; itOption.current(); ++itOption) {
		XStringList completeOption (itOption.currentKey());
		completeOption.setSeperator (":");
		QString optkey = completeOption.getList().getFirst();
		if (optkey == "grp") {
		mXkbOption[0] -> insertItem (
			QString::fromLocal8Bit (itOption.current())
		);
		}
		else if (optkey == "ctrl") {
		mXkbOption[1] -> insertItem (
			QString::fromLocal8Bit (itOption.current()) 
		);
		}
		else {
		mXkbOption[6] -> insertItem (
			QString::fromLocal8Bit (itOption.current())
		);
		}
	}
	for (int i=2;i<6;i++) {
		mXkbOption[i]->insertItem (*xkbDefault);
		mXkbOption[i]->insertItem ("Meta");
		mXkbOption[i]->insertItem ("Compose");
		mXkbOption[i]->insertItem ("ModeShift");
		mXkbOption[i]->insertItem ("ModeLock");
		mXkbOption[i]->insertItem ("ScrollLock");
		mXkbOption[i]->insertItem ("Control");
	}
	//================================================
	// set defaults
	//------------------------------------------------
	mCurrentDelay = XKBDDELAY_DEFAULT;
	mCurrentKrate = XKBDRATE_DEFAULT;
}