Ejemplo n.º 1
0
void CPdaArrow::EditArrow()
{
    CPdaRuleDialog inputDialog(myStartItem->getName(), myEndItem->getName(), m_oldPdaRules);
    if(QDialog::Accepted == inputDialog.exec()) {
        QSet<CPDACompotutationalRule> newPdaRules = inputDialog.GetPdaRules();
        QSet<CPDACompotutationalRule> addedRules  = newPdaRules - m_oldPdaRules;
        QSet<CPDACompotutationalRule> deletedRules  =  m_oldPdaRules - newPdaRules;
        m_pa->AddPdaRules(addedRules);
        m_pa->RemovePdaRules(deletedRules);
        displayText = CPDACompotutationalRule::ToArrowText(m_pa->GetRules());
    }

    // TODO emit that PDA has changed
}
Ejemplo n.º 2
0
// Редактирование ссылки
void ReferenceFormatter::onReferenceClicked(void)
{
  // TRACELOG

  QString href="";

  // Если курсор установлен на ссылке
  if(editor->cursorPositionDetector->isCursorOnReference())
    href=editor->cursorPositionDetector->referenceHref(); // Выясняется текст ссылки

  // Создание виджета запроса URL с указанием редактора как родительского виджета
  QInputDialog inputDialog(editor);

  // Установка ширины виджета запроса URL
  int dialogWidth=int(0.8*(float)textArea->width());
  inputDialog.setMinimumWidth( dialogWidth );
  inputDialog.resize(inputDialog.size());

  inputDialog.setWindowTitle(tr("Reference or URL"));
  inputDialog.setLabelText(tr("Reference or URL"));
  inputDialog.setTextValue(href);
  inputDialog.setTextEchoMode(QLineEdit::Normal);

  bool ok=inputDialog.exec();
  QString refereceUrl=inputDialog.textValue();

  if(!ok)
    return;

  // Устанавливается текст ссылки
  QTextCharFormat charFormat;
  charFormat.setAnchorHref(refereceUrl);

  // Если текст ссылки задан
  if(refereceUrl.length()>0)
  {
    charFormat.setAnchor(true);
    charFormat.setForeground(QApplication::palette().color(QPalette::Link));
    charFormat.setFontUnderline(true);

    textArea->textCursor().mergeCharFormat(charFormat);
  }
  else
  {
    // Иначе текст ссылки пустой и ссылку надо убрать
    charFormat.setAnchor(false);

    textArea->textCursor().setCharFormat(charFormat);
  }
}
Ejemplo n.º 3
0
void CPDADiagramScene::AddArrow(StateNode *startItem, StateNode *endItem){
	CPdaRuleDialog inputDialog(startItem->getName(), endItem->getName(), QSet<CPDACompotutationalRule>());
	if(QDialog::Accepted == inputDialog.exec())
	{
		QSet<CPDACompotutationalRule> rules = inputDialog.GetPdaRules();
		CPdaArrow* arrow = new CPdaArrow(startItem, endItem, m_pa, rules, 0, this);
		m_pa->AddPdaRules(rules);
		startItem->addArrow(arrow);
		endItem->addArrow(arrow);
		arrow->setZValue(-1000.0);   //posun na pozadi
		addItem(arrow);
		arrow->updatePosition();
		// TODO: Emit FA changed // 						 emit FA_changed(FA);
	}
}
Ejemplo n.º 4
0
AMNumber CLSValueEditor::getEnumValue()
{
	AMNumber result = AMNumber(AMNumber::InvalidError);

	QString dialogTitle = (title_.isEmpty()) ? QString("Edit value") : QString("Editing %1").arg(title_.toLower());

	CLSValueSetpointEditorDialog inputDialog(this);
	inputDialog.setValues(moveValues_);
	inputDialog.setValue(value_);
	inputDialog.setWindowTitle(dialogTitle);
	inputDialog.move(mapToGlobal(QPoint(width()/2, height()/2)));

	if (inputDialog.exec())
		result = AMNumber(inputDialog.value());

	return result;
}
Ejemplo n.º 5
0
void ConfigurationListUI::onAddPattern()
{
    QInputDialog inputDialog(this);
    inputDialog.setWindowTitle(tr("Exclude pattern"));
    inputDialog.setLabelText(tr("Please enter a glob pattern, like 'Work?.txt', '*.txt', 'Trash', or 'lost+found',<br>"
                                "where '?' matches one character and '*' matches any number of characters.<br><br>"
                                "Any file or directory that matches one of the patterns will be excluded<br>"
                                "from the backup.") + "<br>");
    if (inputDialog.exec() == QDialog::Rejected) {
        return;
    }

    QString pattern = inputDialog.textValue();
    if (pattern.isEmpty()) {
        return;
    }

    int count = m_listModel->rowCount();
    m_listModel->insertRow(count);
    QModelIndex index = m_listModel->index(count);
    m_listModel->setData(index, pattern);
    m_list = m_listModel->stringList();
}