Ejemplo n.º 1
0
DomainInfoDock::DomainInfoDock(QWidget *parent) :
	EditorDock(parent),
	ui(new Ui::DomainInfoDock)
{
    ui->setupUi(this);

	//Resize the edit button so that it fits the icon button above
	ui->editButton->setMaximumWidth(ui->iconButton->geometry().width());

	//Update rules whenever they change
	ConfigurationStack &stack=ConfigurationStack::instance();
	connect(&stack, SIGNAL(domainChanged(QString,QString)), this, SLOT(onDomainChanged(QString,QString)));
	connect(&stack, SIGNAL(configurationChanged()), this, SLOT(onProgramsOrRulesChanged()));
	connect(&stack, SIGNAL(allRulesChanged()), this, SLOT(onProgramsOrRulesChanged()));
	connect(&stack, SIGNAL(loopsChanged()), this, SLOT(onProgramsOrRulesChanged()));
	connect(&stack, SIGNAL(rulesChanged()), this, SLOT(onProgramsOrRulesChanged()));
	connect(&stack, SIGNAL(programChanged(QString,QString)), this, SLOT(onProgramsOrRulesChanged()));
	connect(&stack, SIGNAL(warningsChanged()), this, SLOT(onProgramsOrRulesChanged()));

	//Connect the edit button
	connect(ui->editButton, SIGNAL(clicked()), this, SLOT(onEditClicked()));

	//Forward domain/program activated signals to parents
	connect(ui->loopsTreeWidget, SIGNAL(programActivated(QString)), this, SIGNAL(programActivated(QString)));
	connect(ui->loopsTreeWidget, SIGNAL(ruleActivated(int)), this, SIGNAL(ruleActivated(int)));
	connect(ui->incomingTreeWidget, SIGNAL(domainActivated(QString)), this, SIGNAL(domainActivated(QString)));
	connect(ui->incomingTreeWidget, SIGNAL(programActivated(QString)), this, SIGNAL(programActivated(QString)));
	connect(ui->incomingTreeWidget, SIGNAL(ruleActivated(int)), this, SIGNAL(ruleActivated(int)));
	connect(ui->leavingTreeWidget, SIGNAL(domainActivated(QString)), this, SIGNAL(domainActivated(QString)));
	connect(ui->leavingTreeWidget, SIGNAL(programActivated(QString)), this, SIGNAL(programActivated(QString)));
	connect(ui->leavingTreeWidget, SIGNAL(ruleActivated(int)), this, SIGNAL(ruleActivated(int)));
}
Ejemplo n.º 2
0
void SortedRulesTreeWidget::onItemActivated(QTreeWidgetItem *item, int /*column*/)
{
//	bool editRule=false;

    //Select the item on which we're going to work
    switch(item->data(0, ItemTypeRole).toInt())
    {
    case MRuleConditionItem:
        item=item->parent();
    case MRuleItem:
        item=item->parent();

    case RuleItem:
        emit ruleActivated(item->data(0, Qt::UserRole).toInt());
//		editRule=true;
        break;

    case DomainItem:
        emit domainActivated(item->data(0, Qt::UserRole).toString());
        break;

    case ProgramItem:
        emit programActivated(item->data(0, Qt::UserRole).toString());
        break;
    }

    //If the item is a Rule
//	if(editRule)
//	{
//		if(item->data(1, Qt::UserRole).toString()==Loop().ruleType())
//			LoopDialog::editLoop(item->data(0, Qt::UserRole).toInt());
//		else if(item->data(1, Qt::UserRole).toString()==Rule().ruleType())
//			RuleDialog::editRule(item->data(0, Qt::UserRole).toInt());
//	}
}