void filterManager::deleteFilter()
{
  QString query = "delete from filter where filter_id=:filter_id";
  XSqlQuery qry;

  qry.prepare(query);
  qry.bindValue(":filter_id", _filterSet->id());
  qry.exec();

  this->populate();

  emit filterDeleted();
}
void filterManager::shareFilter()
{
  XSqlQuery qry;

  // See if there is already a shared filter by this name
  qry.prepare("SELECT shr.filter_id AS filter_id "
              "FROM filter prv "
              " JOIN filter shr ON ((prv.filter_name=shr.filter_name) "
              "                 AND (prv.filter_screen=shr.filter_screen) "
              "                 AND (shr.filter_id != prv.filter_id)) "
              "WHERE ((shr.filter_username IS NULL) "
              " AND (prv.filter_id=:filter_id)); ");
  qry.bindValue(":filter_id", _filterSet->id());
  qry.exec();
  if (qry.first())
  {
    if ( QMessageBox::question( this, tr("Shared Filter Exists"),
                                tr("<p>This will replace a shared filter with the same name.\n"
                                   " Are you sure this is what you want to do?"),
                                QMessageBox::No | QMessageBox::Default,
                                QMessageBox::Yes) == QMessageBox::No )
      return;
    else
    {
      int filterid = qry.value("filter_id").toInt();
      qry.prepare("UPDATE filter shr SET filter_value=prv.filter_value "
                  "FROM filter prv "
                  "WHERE ((shr.filter_id=:shr_filter_id) "
                  " AND (prv.filter_id=:prv_filter_id)); "
                  "DELETE FROM filter WHERE (filter_id=:prv_filter_id);");
      qry.bindValue(":shr_filter_id", filterid);
      qry.bindValue(":prv_filter_id", _filterSet->id());
      qry.exec();

      emit filterDeleted();
    }
  }
  else
  {
    qry.prepare("UPDATE filter SET filter_username=NULL WHERE (filter_id=:filter_id);");
    qry.bindValue(":filter_id", _filterSet->id());
    qry.exec();
  }

  populate();
}
filterManager::filterManager(QWidget* parent, const char* name)
    : QDialog(parent)
{
  if(name)
    setObjectName(name);

  setupUi(this);

  _filterSet->addColumn(tr("Filter Set Name"), -1, Qt::AlignLeft, true, "filter_name" );
  _filterSet->addColumn(tr("Shared"), _ynColumn, Qt::AlignLeft, true, "shared");

  connect(_filterSet, SIGNAL(valid(bool)), this, SLOT( handleButtons(bool) ));
  connect(_share, SIGNAL(clicked()), this, SLOT( shareFilter() ));
  connect(_unshare, SIGNAL(clicked()), this, SLOT( unshareFilter() ));
  connect(_delete, SIGNAL(clicked()), this, SLOT( deleteFilter() ) );
  connect(this, SIGNAL(filterDeleted()), parent, SLOT(setSavedFilters()) );

  shortcuts::setStandardKeys(this);
}
StatusCode QueryOperatorImpl::GetChildCollections(QueryNodeImpl* target)
{
	return WINI_ERROR;
#if 0
	StatusCode status = srbGetDataDirInfo(m_conn, 0, m_qval, m_selval, &m_result, MAX_ROWS);

	if(0 != status)
	{
		if(-3005 == status)
			status = 0;

		return status;
	}

	filterDeleted(&m_result);

	INode* baby;

	CollectionOperatorImpl* cOp;

	char* original = getFromResultStruct(&m_result,dcs_tname[DATA_GRP_NAME], dcs_aname[DATA_GRP_NAME]);
	char* pathstring;

	for(int i = 0; i < m_result.row_count; i++)
	{
		pathstring = original + (i*MAX_DATA_SIZE);
		pathstring = pathstring + strlen(m_binding->GetPath());
		
		//highly inefficient but for right now it works...
blah:
		if(pathstring)
		{
			status = ((CollectionNodeImpl*)m_binding)->GetChild(pathstring, &baby);
				
			switch(status.GetCode())
			{
			case WINI_OK:
				target->AddChild(baby);
				break;
			case WINI_ERROR_NOT_FILLED:
				cOp = new CollectionOperatorImpl(m_session);
				cOp->GetChildren((CollectionNodeImpl*)baby);
				goto blah;
					break;
			default:
				return WINI_GENERAL_ERROR;
			}
		}else
		{
			target->AddChild(m_binding);
		}
	}

	//while(m_result.continuation_index >= 0)
	//{
		//add code for this later	
	//}

	return WINI_OK;
#endif
}
StatusCode QueryOperatorImpl::GetChildDatasets(QueryNodeImpl* target)
{
	return WINI_ERROR;
#if 0
	StatusCode status = srbGetDataDirInfo(m_conn, 0, m_qval, m_selval, &m_result, MAX_ROWS);

	if(!status.isOk())
		return status;

	filterDeleted(&m_result);

	char* szCollection = getFromResultStruct(&m_result,dcs_tname[DATA_GRP_NAME], dcs_aname[DATA_GRP_NAME]);
	char* szDataset = getFromResultStruct(&m_result,dcs_tname[DATA_NAME], dcs_aname[DATA_NAME]);

	char *szCPtr, *szDPtr;

	const char* path = m_binding->GetPath();
	int path_len = strlen(path);


	INode* parent = m_binding;
	INode *child, *dataset;

	for(int i = 0; i < m_result.row_count; i++)
	{
		szCPtr = szCollection;
		szDPtr = szDataset;

		szCPtr += i * MAX_DATA_SIZE;
		szDPtr += i * MAX_DATA_SIZE;

		szCPtr += path_len;
		//dataset?

		if(NULL == *szCPtr)
		{
			status = parent->GetChild(szDPtr, &dataset);
			if(!status.isOk())
				return WINI_ERROR;
			target->AddChild(dataset);
			continue;
		}

start:	status = ((CollectionNodeImpl*)parent)->GetChild(szCPtr, &child);

		CollectionOperatorImpl* collection_op = (CollectionOperatorImpl*)m_session->GetOperator(WINI_COLLECTION);

		switch(status.GetCode())
		{
		case WINI_OK:
			//dataset is in a child collection of the binding
			//child collection has been found
			//now locate the dataset
startd:		status = child->GetChild(szDPtr, &dataset);
			switch(status.GetCode())
			{
			case WINI_OK:
				target->AddChild(dataset);
				break;
			case WINI_ERROR_NOT_FILLED:
				collection_op->GetChildren((CollectionNodeImpl*)child);
				goto startd;
				break;
			default:
				return WINI_ERROR;
				break;
			}
			break;
		case WINI_ERROR_NOT_FILLED:
			//child is not opened yet
			//open the child and begin again
			collection_op->GetChildren((CollectionNodeImpl*)parent);
			goto start;
			break;
		default:
			return WINI_ERROR;
			break;
		}

	}

	//while(m_result.continuation_index >= 0)
	//{
		//add code for this later	
	//}

	return WINI_OK;
#endif
}
Exemple #6
0
        mDisplayActionGroup->addAction(action);
        if(choice == defaultChoice)
            action->setChecked(true);
    }
    ui->actionImageDisplays->setMenu(&mImageDisplayMenu);

    ui->actionStop->setChecked(true);
    ui->actionProblems->setVisible(false);
    connect(&mInterface, SIGNAL(portValueChanged(int, QString,QVariant)), SLOT(check()));
    connect(&mInterface, SIGNAL(filterConnected(PortId,PortId,int)), SLOT(check()));
    connect(&mInterface, SIGNAL(filterDisconnected(PortId,PortId,int)), SLOT(check()));
    connect(&mInterface,SIGNAL(processorsDisconnected(int,int)), SLOT(check()));
    connect(&mInterface,SIGNAL(inputPortConnected(QString,PortId,int)), SLOT(check()));
    connect(&mInterface,SIGNAL(inputPortDisconnected(QString,PortId,int)), SLOT(check()));
    connect(&mInterface, SIGNAL(filterCreated(FilterInfo,int)), SLOT(check()));
    connect(&mInterface, SIGNAL(filterDeleted(FilterInfo)), SLOT(check()));
    connect(&mInterface, SIGNAL(processorCreated(ProcessorInfo)), SLOT(check()));
    connect(&mInterface, SIGNAL(processorDeleted(ProcessorInfo)), SLOT(check()));
    connect(&mInterface, SIGNAL(cleared()), SLOT(check()));
    connect(&mInterface, SIGNAL(executionFinished()), SLOT(onExecutionFinished()));
    connect(&mInterface, SIGNAL(executionStarted()), SLOT(onExecutionStarted()));
    connect(&mInterface, SIGNAL(makroInputCreated(QString,PortId,int)), SLOT(check()));
    connect(&mInterface, SIGNAL(makroInputRemoved(PortId,int)), SLOT(check()));

    // connect signals to olvis interface always QUEUED, to be sure gui has finished all repaints and animations
    connect(this, SIGNAL(startRequested()),& mInterface, SLOT(start()), Qt::QueuedConnection);
    connect(this, SIGNAL(stopRequested()), &mInterface, SLOT(stop()), Qt::QueuedConnection);
    connect(this, SIGNAL(pauseRequested()), &mInterface, SLOT(pause()), Qt::QueuedConnection);
    connect(this, SIGNAL(stepRequested(bool)), &mInterface, SLOT(step(bool)), Qt::QueuedConnection);
    connect(this, SIGNAL(setTraceEnabled(bool)), &mInterface, SLOT(setTracingEnabled(bool)), Qt::QueuedConnection);
    onExecutionFinished();