Esempio n. 1
0
void ChaserEditor::slotLowerClicked()
{
  QListViewItem* item = m_stepList->currentItem();
  t_function_id fid = 0;
  int index = 0;
  int newIndex = 0;

  if (item != NULL)
    {
      index = item->text(COL_NUM).toInt() - 1;
      fid = item->text(COL_FID).toInt();

      if (m_chaser->lowerStep(index))
	{
	  updateStepList();
	  
	  // Select the item again, now it's one step below
	  QListViewItemIterator it(m_stepList);
	  while (it.current() != NULL)
	    {
	      if (newIndex == index + 1)
		{
		  m_stepList->setSelected(it.current(), true);
		  break;
		}
	      
	      newIndex++;
	      ++it;
	    }
	}
    }
}
Esempio n. 2
0
void ChaserEditor::slotRemoveClicked()
{
	QTreeWidgetItem* item = m_tree->currentItem();
	if (item != NULL)
	{
		int index = item->text(KColumnNumber).toInt() - 1;
		m_chaser->removeStep(index);
		updateStepList(index - 1);
	}
}
Esempio n. 3
0
void ChaserEditor::slotRemoveClicked()
{
  QListViewItem* item = m_stepList->currentItem();

  if (item != NULL)
    {
      m_chaser->removeStep(item->text(COL_NUM).toInt() - 1);
    }

  updateStepList();
}
Esempio n. 4
0
void ChaserEditor::slotAddClicked()
{
	FunctionSelection fs(this, true, m_original->id());
	if (fs.exec() == QDialog::Accepted)
	{
		QListIterator <t_function_id> it(fs.selection());
		while (it.hasNext() == true)
			m_chaser->addStep(it.next());

		// Update all steps in the list
		updateStepList();
	}
}
Esempio n. 5
0
void ChaserEditor::slotAddClicked()
{
  FunctionTree* ft = new FunctionTree(this);
  ft->setInactiveID(m_original->id());

  if (ft->exec() == QDialog::Accepted && ft->functionID() != KNoID)
    {
      m_chaser->addStep(ft->functionID());
    }

  delete ft;

  updateStepList();
}
Esempio n. 6
0
void ChaserEditor::slotLowerClicked()
{
	QTreeWidgetItem* item;
	int index;

	item = m_tree->currentItem();
	if (item != NULL)
	{
		index = m_tree->indexOfTopLevelItem(item);

		/* Raise the step */
		m_chaser->lowerStep(index);

		/* Update step list and select the same item */
		updateStepList(index + 1);
	}
}
Esempio n. 7
0
void ChaserEditor::init()
{
  m_nameEdit->setText(m_chaser->name());
  m_nameEdit->setSelection(0, m_nameEdit->text().length());

  m_addStep->setPixmap(QPixmap(QString(PIXMAPS) + QString("/add.xpm")));
  m_removeStep->setPixmap(QPixmap(QString(PIXMAPS) + QString("/remove.xpm")));

  m_raiseButton->setPixmap(QPixmap(QString(PIXMAPS) + QString("/up.xpm")));
  m_lowerButton->setPixmap(QPixmap(QString(PIXMAPS) + QString("/down.xpm")));

  m_runOrderGroup->setButton((int) m_chaser->runOrder());
  m_directionGroup->setButton((int) m_chaser->direction());

  m_stepList->setSorting(-1);

  updateStepList();
}
Esempio n. 8
0
ChaserEditor::ChaserEditor(QWidget* parent, Chaser* chaser) : QDialog(parent)
{
	Q_ASSERT(chaser != NULL);

	setupUi(this);

	/* Resize columns to fit contents */
	m_tree->header()->setResizeMode(QHeaderView::ResizeToContents);

	/* Connect UI controls */
	connect(m_nameEdit, SIGNAL(textEdited(const QString&)),
		this, SLOT(slotNameEdited(const QString&)));
	connect(m_add, SIGNAL(clicked()), this, SLOT(slotAddClicked()));
	connect(m_remove, SIGNAL(clicked()), this, SLOT(slotRemoveClicked()));
	connect(m_raise, SIGNAL(clicked()), this, SLOT(slotRaiseClicked()));
	connect(m_lower, SIGNAL(clicked()), this, SLOT(slotLowerClicked()));
	
	/* Create a copy of the original chaser so that we can freely modify
	   it and keep a pointer to the original so that we can move the
	   contents from the copied chaser to the original when OK is clicked */
	m_chaser = new Chaser(this);
	m_chaser->copyFrom(chaser);
	Q_ASSERT(m_chaser != NULL);
	m_original = chaser;

	/* Name edit */
	m_nameEdit->setText(m_chaser->name());
	m_nameEdit->setSelection(0, m_nameEdit->text().length());
	setWindowTitle(tr("Chaser - %1").arg(m_chaser->name()));

	/* Bus */
	connect(m_busCombo, SIGNAL(activated(int)),
		this, SLOT(slotBusComboActivated(int)));
	fillBusCombo();

	/* Running order */
	switch (m_chaser->runOrder())
	{
	default:
	case Chaser::Loop:
		m_loop->setChecked(true);
		break;
	case Chaser::PingPong:
		m_pingPong->setChecked(true);
		break;
	case Chaser::SingleShot:
		m_singleShot->setChecked(true);
		break;
	}

	/* Running direction */
	switch (m_chaser->direction())
	{
	default:
	case Chaser::Forward:
		m_forward->setChecked(true);
		break;
	case Chaser::Backward:
		m_backward->setChecked(true);
		break;
	}

	/* Chaser steps */
	updateStepList(0);
}