예제 #1
0
파일: WDataSrc.cpp 프로젝트: zwvc/wagic-x
WCardFilter* WSrcCards::unhookFilters()
{
    WCardFilter* temp = filtersRoot;
    filtersRoot = NULL;
    clearFilters();
    return temp;
}
예제 #2
0
void ParameterWidget::applyDefaultFilterSet()
{
  XSqlQuery qry;
  QString filter_name;
  int filter_id;
	QString pname;

 

  //hides parameterwidget when it's embedded within another widget with a parent
  if (this->parent() && this->parent()->parent())
  {
    clearFilters();
    this->hide();

    return;
  }

	if(window())
    pname = window()->objectName() + "/";
	_settingsName2 = pname + this->objectName();

	if(_x_preferences)
  {
		_settingsName2 += "/filter_default";
		filter_id = _x_preferences->value(_settingsName2).toInt();
	}

  QString query = "SELECT filter_name "
                  "FROM filter "
                  "WHERE filter_id=:id ";
                  

  if (this->parent())
  {
    QString classname(parent()->objectName());
    if (classname.isEmpty())
      classname = parent()->metaObject()->className();

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

    if (qry.first())
    {
      filter_name = qry.value("filter_name").toString();
      setSavedFiltersIndex(filter_name);
      applySaved(0, filter_id);
    }
    else
    {
      addParam();
			applySaved(0, 0);
    }

  }

}
예제 #3
0
/**
 * Make the set of event filters that correspond with this
 * node inactive (including disabling the corresponding events
 * and freeing resources).
 */
jint
eventFilterRestricted_deinstall(HandlerNode *node)
{
    jint error1, error2;
    
    error1 = disableEvents(node);
    error2 = clearFilters(node);

    return error1 != JVMDI_ERROR_NONE? error1 : error2;
}
예제 #4
0
//Start MCP2515 communications
void CAN_MCP2515::begin(uint32_t bitrate, uint8_t mode)
{
  SPI.begin();//SPI communication begin
  reset();//Set MCP2515 into Config mode by soft reset. Note MCP2515 is in Config mode by default at power up.
  clearRxBuffers();
  clearTxBuffers();
  clearFilters();
  // enable Transmit Buffer Empty Interrupt Enable bits
  //enableInterrupts(MCP2515_TXnIE, MCP2515_TXnIE);
  setBitrate(bitrate); //Set CAN bit rate
  setMode(mode);    //Set CAN mode
}
예제 #5
0
	bool loadBlock(std::string &error) {
		clearFilters();

		position = -1;

		//LOG_VERBOSE("seeking to offset %i", (int) iter->block.compressed_file_offset);
		reader.seek(iter.block.compressed_file_offset);
		strm.avail_in = 0; /* make sure we read new data after lseek */

		if (!fill_input_buffer(error)) return false;
		if (0 == strm.avail_in) {
			error.assign("Unexpected end of file while trying to read block header");
			return false;
		}

		block.version = 0;
		block.check = iter.stream.flags->check;

		block.header_size = lzma_block_header_size_decode(strm.next_in[0]);
		if (block.header_size > strm.avail_in) {
			error.assign("Unexpected end of file while trying to read block header");
			return false;
		}

		// Decode the Block Header.
		lzma_ret ret = lzma_block_header_decode(&block, NULL, strm.next_in);
		if (LZMA_OK != ret) {
			errnoLzmaToStr("decoding block header failed", ret, error);
			return false;
		}

		ret = lzma_block_compressed_size(&block, iter.block.unpadded_size);
		if (LZMA_OK != ret) {
			errnoLzmaToStr("decoding block header failed, invalid compressed size", ret, error);
			return false;
		}

		strm.next_in += block.header_size;
		strm.avail_in -= block.header_size;

		lzma_end(&strm);
		ret = lzma_block_decoder(&strm, &block);
		if (LZMA_OK != ret) {
			errnoLzmaToStr("couldn't initialize block decoder", ret, error);
			return false;
		}

		position = iter.block.uncompressed_file_offset;
		return true;
	}
예제 #6
0
파일: WDataSrc.cpp 프로젝트: zwvc/wagic-x
void WSrcCards::bakeFilters()
{
    vector<MTGCard*> temp;

    setOffset(0);
    for (int t = 0; t < Size(); t++)
    {
        temp.push_back(getCard(t));
    }
    setOffset(0);
    cards.clear();
    cards.swap(temp);
    clearFilters();
    return;
}
예제 #7
0
void ParameterWidget::applyDefaultFilterSet()
{
  XSqlQuery qry;
  const QMetaObject *metaobject;
  QString classname;
  QString filter_name;
  int filter_id;

  //hides parameterwidget when it's embedded within another widget with a parent
  if (this->parent() && this->parent()->parent())
  {
    clearFilters();
    this->hide();

    return;
  }

  QString query = "SELECT filter_id, filter_name "
                  "FROM filter "
                  "WHERE filter_screen=:screen "
                  " AND filter_username=current_user "
                  " AND filter_selected=TRUE";

  if (this->parent())
  {
    metaobject = this->parent()->metaObject();
    classname = metaobject->className();
    qry.prepare(query);
    qry.bindValue(":screen", classname);

    qry.exec();

    if (qry.first())
    {
      filter_id = qry.value("filter_id").toInt();
      filter_name = qry.value("filter_name").toString();
      setSavedFiltersIndex(filter_name);
      applySaved(0, filter_id);
    }
    else
    {
      addParam();
    }

  }

}
bool GraphicsLayerTextureMapper::setFilters(const FilterOperations& filters)
{
    if (!m_layer.textureMapper())
        return false;

    bool canCompositeFilters = filtersCanBeComposited(filters);
    if (GraphicsLayer::filters() == filters)
        return canCompositeFilters;

    if (canCompositeFilters) {
        if (!GraphicsLayer::setFilters(filters))
            return false;
        notifyChange(FilterChange);
    } else if (GraphicsLayer::filters().size()) {
        clearFilters();
        notifyChange(FilterChange);
    }

    return canCompositeFilters;
}
예제 #9
0
std::vector< cv::Mat > PointTracker::predict( const float dt )
{
  // Iterate over all filters
  for( kf_list_ite it = filters.begin(); it != filters.end(); it++ )
    {
      // Adapt init_transition matrix with the elapsed time
      it->second.transitionMatrix.at< float >( 0, 2 ) = dt;
      it->second.transitionMatrix.at< float >( 1, 4 ) = dt;

      it->second.processNoiseCov = calcProcessNoise( dt );
      
      // Update kalman filter
      it->second.predict();

      it->second.statePost = it->second.statePre;
      it->second.errorCovPost = it->second.errorCovPre;
    }

  clearFilters();

  return returnStates();
}
예제 #10
0
파일: WDataSrc.cpp 프로젝트: zwvc/wagic-x
WSrcCards::~WSrcCards()
{
    clearFilters();
    cards.clear();
}
예제 #11
0
void ParameterWidget::applySaved(int pId, int filter_id)
{
  qDebug() << "in applySaved, pid is: " << pId;
  QGridLayout *container;
  QLayoutItem *child;
  QLayoutItem *child2;
  QHBoxLayout *layout2;
  QWidget *found;
  QDate tempdate;
  XSqlQuery qry;
  QString query;
  QString filterValue;
  int xid;

  QMapIterator<int, QPair<QString, QVariant> > j(_filterValues);

  clearFilters();

  if (!parent())
    return;

  //if (pId == 0)
  //addParam();

  if (_filterList->id() == -1)
  {
    _filterSetName->clear();
    setSelectedFilter(-1);
    emit updated();
    return;
  }

  if (filter_id == 0 && _filterList->id() != -1)
    filter_id = _filterList->id(_filterList->currentIndex());

  const QMetaObject *metaobject = this->parent()->metaObject();
  QString classname(metaobject->className());

  //look up filter from database
  query = " SELECT filter_value "
          " FROM filter "
          " WHERE filter_username=current_user "
          " AND filter_id=:id "
          " AND filter_screen=:screen ";

  qry.prepare(query);
  qry.bindValue(":screen", classname);
  qry.bindValue(":id", filter_id );

  qry.exec();

  if (qry.first())
    filterValue = qry.value("filter_value").toString();

  QStringList filterRows = filterValue.split("|");
  QString tempFilter = QString();

  int windowIdx = _filtersLayout->rowCount();

  for (int i = 0; i < filterRows.size(); ++i)
  {
    tempFilter = filterRows[i];
    if ( !(tempFilter.isEmpty()) )
    {
      //0 is filterType, 1 is filterValue, 2 is parameterwidgettype
      QStringList tempFilterList = tempFilter.split(":");
      this->addParam();

      QLayoutItem *test = _filtersLayout->itemAtPosition(windowIdx, 0)->layout()->itemAt(0);
      XComboBox *mybox = (XComboBox*)test->widget();

      QString key = this->getParameterTypeKey(tempFilterList[0]);
      int idx = mybox->findText(key);

      mybox->setCurrentIndex(idx);

      QString row;
      row = row.setNum(windowIdx);

      container = _filtersLayout->findChild<QGridLayout *>("topLayout" + row);
      child = container->itemAtPosition(0, 0)->layout()->itemAt(0);
      layout2 = (QHBoxLayout *)child->layout();
      child2 = layout2->itemAt(0);
      found = child2->widget();

      int widgetType = tempFilterList[2].toInt();

      //grab pointer to newly created filter object
      switch (widgetType)
      {
      case Date:
        DLineEdit *dLineEdit;
        dLineEdit = (DLineEdit*)found;
        dLineEdit->setDate(QDate::fromString(tempFilterList[1], "yyyy-MM-dd"), true);
        break;
      case User:
        UsernameCluster *usernameCluster;
        usernameCluster = (UsernameCluster*)found;
        usernameCluster->setUsername(tempFilterList[1]);
        break;
      case Crmacct:
        CRMAcctCluster *crmacctCluster;
        crmacctCluster = (CRMAcctCluster*)found;
        crmacctCluster->setId(tempFilterList[1].toInt());
        break;
      case Contact:
        ContactCluster *contactCluster;
        contactCluster = (ContactCluster*)found;
        contactCluster->setId(tempFilterList[1].toInt());
        break;
      case XComBox:
        XComboBox *xBox;
        xBox = (XComboBox*)found;

        //fix for setid not emitting id signal if id found for filter is first in list
        //set to any other valid id first to fix it
        xBox->setId(2);

        xid = tempFilterList[1].toInt();
        qDebug() << "xid is: " << xid;
        xBox->setId(xid);
        while (j.hasNext()) {
          j.next();
          QPair<QString, QVariant> tempPair = j.value();
          qDebug() << j.key() << ": " << tempPair.second << endl;
        }
        break;
      default:
        QLineEdit *lineEdit;
        lineEdit = (QLineEdit*)found;
        lineEdit->setText(tempFilterList[1]);
        storeFilterValue(-1, lineEdit);
        break;
      }
    }//end of if
    windowIdx++;
  }//end of for

  _filterSetName->setText( _filterList->currentText() );
  setSelectedFilter(filter_id);
  emit updated();
}
예제 #12
0
void ParameterWidget::applySaved(int pId, int filter_id)
{
  QWidget *found = 0;
  QDate tempdate;
  XSqlQuery qry;
  QString query;
  QString filterValue;
	QDate today = QDate::currentDate();
  int xid, init_filter_id;

	init_filter_id = filter_id;

  QMapIterator<int, QPair<QString, QVariant> > j(_filterValues);
	QPair<QString, ParameterWidgetTypes> tempPair;

  clearFilters();

  if (!parent())
    return;

  if (_filterList->id() == -1)
  {
    emit updated();
    return;
  }

  if (filter_id == 0 && _filterList->id() != -1)
    filter_id = _filterList->id(_filterList->currentIndex());

  QString classname(parent()->objectName());
  if (classname.isEmpty())
    classname = parent()->metaObject()->className();

  query = " SELECT filter_value, "
          "  CASE WHEN (filter_username IS NULL) THEN true "
          "  ELSE false END AS shared "
          " FROM filter "
          " WHERE filter_id=:id ";

  qry.prepare(query);
  qry.bindValue(":id", filter_id );

  qry.exec();

  if (qry.first())
  {
    filterValue = qry.value("filter_value").toString();
    _shared = qry.value("shared").toBool();
  }

	
  QStringList filterRows = filterValue.split("|");
  QString tempFilter = QString();

  int windowIdx = _filtersLayout->rowCount();

	if (filterRows.size() == 1  && pId == 0 && filter_id != 0)
	{
		emit updated();
		return;
	}

  for (int i = 0; i < filterRows.size(); ++i)
  {
    tempFilter = filterRows[i];
    if ( !(tempFilter.isEmpty()) )
    {
      //0 is filterType, 1 is filterValue, 2 is parameterwidgettype
      QStringList tempFilterList = tempFilter.split(":");
			QString key = this->getParameterTypeKey(tempFilterList[0]);
			if (key.isEmpty())
			{
				//parametertype is no longer found, prompt user to delete filter
				if (QMessageBox::question(this, tr("Invalid Filter Set"), tr("This filter set contains an obsolete filter and will be deleted. Do you want to do this?"),
					  QMessageBox::No | QMessageBox::Default,
            QMessageBox::Yes) == QMessageBox::No)
				return;
				else
				{
					QString query = "delete from filter where filter_id=:filter_id";
					XSqlQuery qry;

					qry.prepare(query);
					qry.bindValue(":filter_id", filter_id);
					qry.exec();

					setSavedFilters();
					return;
				}
			}
			else
			{
				this->addParam();

				QLayoutItem *test = _filtersLayout->itemAtPosition(windowIdx, 0)->layout()->itemAt(0);
				XComboBox *mybox = (XComboBox*)test->widget();

      
				int idx = mybox->findText(key);

				mybox->setCurrentIndex(idx);
	
		    found = getFilterWidget(windowIdx);

			  int widgetType = tempFilterList[2].toInt();

			  //grab pointer to newly created filter object
				switch (widgetType)
				{
					case Date:
						DLineEdit *dLineEdit;
						dLineEdit = qobject_cast<DLineEdit*>(found);
						if (dLineEdit != 0)
							dLineEdit->setDate(today.addDays(tempFilterList[1].toInt()), true);
						break;
					case User:
						UsernameCluster *usernameCluster;
							usernameCluster = qobject_cast<UsernameCluster*>(found);
						if (usernameCluster != 0)
							usernameCluster->setUsername(tempFilterList[1]);
						break;
					case Crmacct:
						CRMAcctCluster *crmacctCluster;
						crmacctCluster = qobject_cast<CRMAcctCluster*>(found);
						if (crmacctCluster != 0)
							crmacctCluster->setId(tempFilterList[1].toInt());
							break;
					case Contact:
						ContactCluster *contactCluster;
						contactCluster = qobject_cast<ContactCluster*>(found);
						if (contactCluster != 0)
							contactCluster->setId(tempFilterList[1].toInt());
						break;
					case XComBox:
						XComboBox *xBox;
						xBox = qobject_cast<XComboBox*>(found);
						if (xBox != 0)
						{
							//fix for setid not emitting id signal if id found for filter is first in list
							//set to any other valid id first to fix it
							xBox->setId(2);

							xid = tempFilterList[1].toInt();
							xBox->setId(xid);
						}
						break;
					case Multiselect:
					{
						QTableWidget *tab;
						tab = qobject_cast<QTableWidget*>(found);
						if (tab != 0)
						{
							QStringList   savedval = tempFilterList[1].split(",");
							bool oldblk = tab->blockSignals(true);
							/* the obvious, loop calling tab->selectRow(), gives one selected row,
							 so try this to get multiple selections:
							   make only the desired values selectable,
							   select everything, and
							   connect to a slot that can clean up after us.
							 yuck.
						*/
							for (int j = 0; j < tab->rowCount(); j++)
							{
								if (! savedval.contains(tab->item(j, 0)->data(Qt::UserRole).toString()))
									tab->item(j, 0)->setFlags(tab->item(j, 0)->flags() & (~ Qt::ItemIsSelectable));
							}
							QTableWidgetSelectionRange range(0, 0, tab->rowCount() - 1,
							                               tab->columnCount() - 1);
							tab->setRangeSelected(range, true);
							connect(tab, SIGNAL(itemClicked(QTableWidgetItem*)), this, SLOT(resetMultiselect(QTableWidgetItem*)));

							tab->blockSignals(oldblk);
							storeFilterValue(-1, tab);
						}
					}
					break;
					default:
					{
						QLineEdit *lineEdit;
						lineEdit = qobject_cast<QLineEdit*>(found);
						if (lineEdit != 0)
						{
							lineEdit->setText(tempFilterList[1]);
							storeFilterValue(-1, lineEdit);
						}
						}
								break;
				}//end of switch
				
			}//end of not empty key else
			windowIdx++;
		}//end of if tempfilter not empty
예제 #13
0
	~XZFileReaderState() {
		LOG_VERBOSE("~XZFileReaderState\n");
		clearFilters();
		lzma_end(&strm);
	}
예제 #14
0
void iduTable::finalize( void )
{
    clearColumns();
    clearFilters();
}
void LLFloaterPathfindingLinksets::onClearFiltersClicked()
{
	clearFilters();
	rebuildObjectsScrollList();
}