Example #1
0
	void dirTrace(wxString path, TiXmlElement *pFilter) 
	{
		wxFileName f(path);

		TiXmlElement *pNewFilter = newFilter(f.GetName());
		treePrint(f.GetName());

		// link dir
		if (pFilter)
			pFilter->LinkEndChild(pNewFilter);

		m_iTreeLevel++;

		// find files first 
		wxArrayString arrayString;
		int num = GetAllFiles(path, &arrayString);
		for (int i=0; i<num; i++)
			fileTrace(arrayString[i], pNewFilter);

		wxDir dir(path);
		if (!dir.IsOpened()) {
			m_iTreeLevel--;
			return;
		}

		// find directory second
		wxString filename;
		bool cont = dir.GetFirst(&filename, wxEmptyString,  wxDIR_DIRS);
		while(cont) {
			wxString strPath = f.GetPath() + "\\" + f.GetName() + "\\" + filename;
			dirTrace(strPath, pNewFilter);
			cont = dir.GetNext(&filename);
		}
		m_iTreeLevel--;
	}
Example #2
0
void CountrySelect::onFilterUpdate() {
	QString newFilter(_filter.text().trimmed().toLower());
	if (newFilter != lastFilter) {
		lastFilter = newFilter;
		_list.updateFiltered();
	}
}
Example #3
0
void FilterBar::changeFilter()
{
	m_data->string = m_lineEdit->text();
	m_data->isFiltering = (!m_data->string.isEmpty() || m_data->tagFilterType != FilterData::DontCareTagsFilter);
	if (hasEditFocus())
		m_data->isFiltering = true;
	emit newFilter(*m_data);
}
Example #4
0
void TableModel::setSelection(const QString& selection)
{
    QString part("name LIKE ");
    QString newFilter(part + "\"" + selection.at(0) + "%\" ");
    for(int i=1; i<selection.length(); i++)
    {
        newFilter.append("OR " + part + "\"" + selection.at(i) + "%\" ");
    }
    _model->setFilter(newFilter);
    _model->setSort(1, Qt::AscendingOrder);
    _model->select();
}
Example #5
0
void FilterBar::reset()
{
	m_lineEdit->setText(""); // m_data->isFiltering will be set to false;
	m_lineEdit->clearFocus();
	changeFilter();
	if (m_tagsBox->currentItem() != 0) {
		m_tagsBox->setCurrentItem(0);
		tagChanged(0);
	}
	hide();
	emit newFilter(*m_data);
}
Example #6
0
    void EtherIPC::handleGetAccounts() {
        QJsonValue jv;
        if ( !readReply(jv) ) {
            return bail();
        }

        QJsonArray refs = jv.toArray();
        foreach( QJsonValue r, refs ) {
            const QString hash = r.toString("INVALID");
            fAccountList.append(AccountInfo(hash, QString(), 0));
        }

        emit getAccountsDone(fAccountList);

        // TODO: figure out a way to get account transaction history
        newFilter();

        done();
    }
/*! \fn Filter *linearAddFilter(Filter* filterOp1, Filter* filterOp2, double w1, double w2)
 * \brief Linear weighted sum of two Filters.
 *
 * It adds linearly the two filters arrays. Each array is first multiplied by a weight. The two filters
 * must have the same dimensions.
 * \param filterOp1 The pointer to the first Filter.
 * \param filterOp2 The pointer to the second Filter.
 * \param w1 Weigth for the first Filter.
 * \param w2 Weight for the second Filter.
 * \return A pointer to the new Filter structure that contains the sum result.
 */
Filter *linearAddFilter(Filter* filterOp1, Filter* filterOp2, double w1, double w2)
{
    int i;
    if(!filterOp1 || !filterOp2 )
    {
        fprintf(stderr, "Error! No input data. Please Check.\n");
        return NULL;
    }
    
    int width = filterOp1->width;
    int height = filterOp1->height;
    
    Filter* filter = newFilter(width,height);
    
    for (i = 0; i < width*height; i++) {
        filter->kernel[i] = w1*filterOp1->kernel[i] + w2*filterOp2->kernel[i];
    }
    
    return filter;
}
	ManageFiltersDlg::ManageFiltersDlg(Feed* feed,FilterList* filters,SyndicationActivity* act,QWidget* parent) : KDialog(parent),feed(feed),filters(filters),act(act)
	{
		setWindowTitle(i18n("Add/Remove Filters"));
		setupUi(mainWidget());
		m_feed_text->setText(i18n("Feed: <b>%1</b>",feed->title()));
		m_add->setIcon(KIcon("go-previous"));
		m_add->setText(QString());
		m_remove->setIcon(KIcon("go-next"));
		m_remove->setText(QString());
		connect(m_add,SIGNAL(clicked()),this,SLOT(add()));
		connect(m_remove,SIGNAL(clicked()),this,SLOT(remove()));
		connect(m_remove_all,SIGNAL(clicked()),this,SLOT(removeAll()));
		connect(m_new_filter,SIGNAL(clicked()),this,SLOT(newFilter()));
		
		active = new FilterListModel(this);
		available = new FilterListModel(this);
		m_active_filters->setModel(active);
		m_available_filters->setModel(available);
		
		int nfilters = filters->rowCount(QModelIndex());
		for (int i = 0;i < nfilters;i++)
		{
			Filter* f = filters->filterByRow(i);
			if (!f)
				continue;
			
			if (feed->usingFilter(f))
				active->addFilter(f);
			else
				available->addFilter(f);
		}
		
		m_add->setEnabled(false);
		connect(m_available_filters->selectionModel(),SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)),
				this,SLOT(availableSelectionChanged(const QItemSelection&, const QItemSelection&)));
		m_remove->setEnabled(false);
		connect(m_active_filters->selectionModel(),SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)),
				this,SLOT(activeSelectionChanged(const QItemSelection&, const QItemSelection&)));
		
		m_remove_all->setEnabled(active->rowCount(QModelIndex()) > 0);
	}
Example #9
0
void FilterBar::tagChanged(int index)
{
	m_data->tag   = 0;
	m_data->state = 0;
	switch (index) {
		case 0:
			m_data->tagFilterType = FilterData::DontCareTagsFilter;
			break;
		case 1:
			m_data->tagFilterType = FilterData::NotTaggedFilter;
			break;
		case 2:
			m_data->tagFilterType = FilterData::TaggedFilter;
			break;
		default:
			// Try to find if we are filtering a tag:
			QMap<int, Tag*>::iterator it = m_tagsMap.find(index);
			if (it != m_tagsMap.end()) {
				m_data->tagFilterType = FilterData::TagFilter;
				m_data->tag           = *it;
			} else {
				// If not, try to find if we are filtering a state:
				QMap<int, State*>::iterator it2 = m_statesMap.find(index);
				if (it2 != m_statesMap.end()) {
					m_data->tagFilterType = FilterData::StateFilter;
					m_data->state         = *it2;
				} else {
					// If not (should never happens), do as if the tags filter was reseted:
					m_data->tagFilterType = FilterData::DontCareTagsFilter;
				}
			}
			break;
	}
	m_data->isFiltering = (!m_data->string.isEmpty() || m_data->tagFilterType != FilterData::DontCareTagsFilter);
	if (hasEditFocus())
		m_data->isFiltering = true;
	emit newFilter(*m_data);
}
Example #10
0
imagesequence::imagesequence(QWidget* parent, const char* name, bool modal, WFlags fl)
: imgSequenceDlg(parent,name, modal,fl)
{
  
  ksw = (KStars *) parent;
  INDIMenu *devMenu = ksw->getINDIMenu();

  if (devMenu)
  {
   connect (devMenu, SIGNAL(newDevice()), this, SLOT(newCCD()));
   connect (devMenu, SIGNAL(newDevice()), this, SLOT(newFilter()));
  }

  seqTimer = new QTimer(this);
  
  setModal(false);
  
  // Connect signals and slots
  connect(startB, SIGNAL(clicked()), this, SLOT(startSequence()));
  connect(stopB, SIGNAL(clicked()), this, SLOT(stopSequence()));
  connect(closeB, SIGNAL(clicked()), this, SLOT(close()));
  connect(seqTimer, SIGNAL(timeout()), this, SLOT(prepareCapture()));
  connect(CCDCombo, SIGNAL(activated(int)), this, SLOT(checkCCD(int)));
  connect(filterCombo, SIGNAL(activated(int)), this, SLOT(updateFilterCombo(int)));
  
  active 		= false;
  ISOStamp		= false;
  seqExpose		= 0;
  seqTotalCount 	= 0;
  seqCurrentCount	= 0;
  seqDelay		= 0;
  lastCCD              = 0;
  lastFilter            = 0;
  stdDevCCD             = NULL;
  stdDevFilter		= NULL;
  
}
Example #11
0
void HighlightConfig::load()
{
    m_filters.clear(); //clear filters

    const QString filename = KStandardDirs::locateLocal( "appdata", QString::fromLatin1( "highlight.xml" ) );
    if( filename.isEmpty() )
        return ;

    QDomDocument filterList( QString::fromLatin1( "highlight-plugin" ) );

    QFile filterListFile( filename );
    filterListFile.open( QIODevice::ReadOnly );
    filterList.setContent( &filterListFile );

    QDomElement list = filterList.documentElement();

    QDomNode node = list.firstChild();
    while( !node.isNull() )
    {
        QDomElement element = node.toElement();
        if( !element.isNull() )
        {
//			if( element.tagName() == QString::fromLatin1("filter")
//			{
            Filter *filtre=newFilter();
            QDomNode filterNode = node.firstChild();

            while( !filterNode.isNull() )
            {
                QDomElement filterElement = filterNode.toElement();
                if( !filterElement.isNull() )
                {
                    if( filterElement.tagName() == QString::fromLatin1( "display-name" ) )
                    {
                        filtre->displayName = filterElement.text();
                    }
                    else if( filterElement.tagName() == QString::fromLatin1( "search" ) )
                    {
                        filtre->search = filterElement.text();

                        filtre->caseSensitive= ( filterElement.attribute( QString::fromLatin1( "caseSensitive" ), QString::fromLatin1( "1" ) ) == QString::fromLatin1( "1" ) );
                        filtre->isRegExp= ( filterElement.attribute( QString::fromLatin1( "regExp" ), QString::fromLatin1( "0" ) ) == QString::fromLatin1( "1" ) );
                    }
                    else if( filterElement.tagName() == QString::fromLatin1( "FG" ) )
                    {
                        filtre->FG = filterElement.text();
                        filtre->setFG= ( filterElement.attribute( QString::fromLatin1( "set" ), QString::fromLatin1( "0" ) ) == QString::fromLatin1( "1" ) );
                    }
                    else if( filterElement.tagName() == QString::fromLatin1( "BG" ) )
                    {
                        filtre->BG = filterElement.text();
                        filtre->setBG= ( filterElement.attribute( QString::fromLatin1( "set" ), QString::fromLatin1( "0" ) ) == QString::fromLatin1( "1" ) );
                    }
                    else if( filterElement.tagName() == QString::fromLatin1( "importance" ) )
                    {
                        filtre->importance = filterElement.text().toUInt();
                        filtre->setImportance= ( filterElement.attribute( QString::fromLatin1( "set" ), QString::fromLatin1( "0" ) ) == QString::fromLatin1( "1" ) );
                    }
                    else if( filterElement.tagName() == QString::fromLatin1( "raise" ) )
                    {
                        filtre->raiseView = ( filterElement.attribute( QString::fromLatin1( "set" ), QString::fromLatin1( "0" ) ) == QString::fromLatin1( "1" ) );
                    }
                }
                filterNode = filterNode.nextSibling();
            }
//			}
        }
        node = node.nextSibling();
    }
    filterListFile.close();
}
Example #12
0
	virtual void OnbtnImportClick( wxCommandEvent& event ) 
	{
		wxString strInputPath = m_textCtrlVSPrjPath->GetValue();
		TiXmlDocument doc(strInputPath);
		wxFileName fn(strInputPath);
		int i;

		wxString strSavePath =wxString::Format("%s\\%s.import.vcproj", fn.GetPath(), fn.GetName());
		// 获取多个Filter的信息
		DoGetGridInfoString();
		int num = m_GridInfoPtr.GetCount();
		if (num<=0) {
			wxMessageBox("Not Import Path");
			return;
		}

		m_strInfo.empty();
		for (i=0; i<num; i++) {
			// 多个Filter
			m_iTreeLevel = 0;
			CGridInfo *pInfo = (CGridInfo*)m_GridInfoPtr[i];
			pInfo->pElement = newFilter(pInfo->strFilterName);
			dirTrace(pInfo->strFilterPath, pInfo->pElement);
		}
		m_textCtrlInfo->AppendText(m_strInfo);


		if (!doc.LoadFile()) {
			wxMessageBox(wxT("Load Fail"));
			return;
		}


		// 删除重复的多个Filter
		TiXmlElement* root = doc.FirstChildElement("VisualStudioProject"); 
		if (root) {
			TiXmlElement *files  = root->FirstChildElement("Files");
			if (files) {
				TiXmlElement* filter = files->FirstChildElement("Filter");
				while(filter) {
					wxString str = filter->Attribute("Name");

					for (i=0; i<num; i++) {
						CGridInfo *pInfo = (CGridInfo*)m_GridInfoPtr[i];
						if (str == pInfo->strFilterName) {
							files->RemoveChild(filter);
							break;
						}
					}
					filter = filter->NextSiblingElement("Filter");
				}
				for (i=0; i<num; i++) {
					CGridInfo *pInfo = (CGridInfo*)m_GridInfoPtr[i];
					files->LinkEndChild(pInfo->pElement);
				}
			}
		}

		doc.SaveFile(strSavePath);

		m_textCtrlInfo->AppendText("\n ** Output Project Path:  " + strSavePath);

		/*
		<Files>
			<Filter
			Name="源文件"
			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
			>
			<File
			RelativePath=".\main.cpp"
			>
			</File>
			</Filter>
			<Filter
			Name="头文件"
			Filter="h;hpp;hxx;hm;inl;inc;xsd"
			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
			>
			</Filter>
			<Filter
			Name="资源文件"
			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
			>
			</Filter>
			</Files>*/
	}
//----------------------------------------------------------------------
// MessageFilterDialog
MessageFilterDialog::MessageFilterDialog(MessageFilters* filters, 
					 const QString& caption,
					 QWidget* parent,
					 const char* name)
  : QDialog(parent, name, false, WType_Dialog),
    m_filters(filters), 
    m_currentFilterNum(0xFF),
    m_currentFilter(0)
{
  // set the caption
  setCaption(caption);

  // don't support resizing the dialog
  setSizeGripEnabled(false);

  // connect to the MessageFilter signals
  connect(m_filters, SIGNAL(removed(uint32_t, uint8_t)),
	  this, SLOT(removedFilter(uint32_t, uint8_t)));
  connect(m_filters, SIGNAL(added(uint32_t, uint8_t, 
				  const MessageFilter&)),
	  this, SLOT(addedFilter(uint32_t, uint8_t, const MessageFilter&)));

  // setup the dialog
  QVBoxLayout* outerLayout = new QVBoxLayout(this, 5, -1, "outerlayout");
  QHBoxLayout* columnLayout = new QHBoxLayout(outerLayout, -1, "columns");
  QVBoxLayout* column1Layout = new QVBoxLayout(5, "column1");
  columnLayout->addLayout(column1Layout, 1);

  // layout 1st column
  QLabel* label = new QLabel("&Existing Filters", this);
  column1Layout->addWidget(label, 1, AlignCenter);

  m_existingFilters = new QListBox(this, "existingfilters");
  column1Layout->addWidget(m_existingFilters, 10);
  label->setBuddy(m_existingFilters);
  m_existingFilters->setSelectionMode(QListBox::Single);
  connect(m_existingFilters, SIGNAL(selectionChanged(QListBoxItem*)),
	  this, SLOT(existingFilterSelectionChanged(QListBoxItem*))); 

  m_new = new QPushButton("Ne&w", this);
  column1Layout->addWidget(m_new, 1, AlignCenter);
  connect(m_new, SIGNAL(clicked()),
	  this, SLOT(newFilter()));

  m_filterGroup = new QGroupBox(1, Vertical, 
				"New &Filter", this, "filtergroup");
  columnLayout->addWidget(m_filterGroup, 5);

  QFrame* dummy = new QFrame(m_filterGroup, "dummy");

  QGridLayout* filterLayout = new QGridLayout(dummy, 8, 3, 5, -1, "filterlayout");
  
  label = new QLabel("&Name", dummy);
  filterLayout->addWidget(label, 0, 0, AlignLeft | AlignVCenter);
  m_name = new QLineEdit(dummy, "name");
  filterLayout->addMultiCellWidget(m_name, 0, 0, 1, 2);
  label->setBuddy(m_name);
  connect(m_name, SIGNAL(textChanged(const QString&)),
	  this, SLOT(anyTextChanged(const QString&)));

  label = new QLabel("&Pattern", dummy);
  filterLayout->addWidget(label, 1, 0, AlignLeft | AlignVCenter);
  m_pattern = new QLineEdit(dummy, "pattern");
  filterLayout->addMultiCellWidget(m_pattern, 1, 1, 1, 2);
  label->setBuddy(m_pattern);
  connect(m_pattern, SIGNAL(textChanged(const QString&)),
	  this, SLOT(anyTextChanged(const QString&)));

  label = new QLabel("&Message Types", dummy);
  filterLayout->addWidget(label, 2, 0, AlignLeft | AlignVCenter);
  m_messageTypes = new QListBox(dummy, "messagetypes");
  filterLayout->addMultiCellWidget(m_messageTypes, 2, 6, 1, 2);
  label->setBuddy(m_messageTypes);
  m_messageTypes->setSelectionMode(QListBox::Multi);
  connect(m_messageTypes, SIGNAL(selectionChanged()),
	  this, SLOT(messageTypeSelectionChanged()));

  m_delete = new QPushButton("&Delete", dummy);
  filterLayout->addWidget(m_delete, 7, 0, AlignCenter);
  m_delete->setEnabled(false);
  connect(m_delete, SIGNAL(clicked()),
	  this, SLOT(deleteFilter()));

  m_update = new QPushButton("&Update", dummy);
  filterLayout->addWidget(m_update, 7, 1, AlignCenter);
  m_update->setEnabled(false);
  connect(m_update, SIGNAL(clicked()),
	  this, SLOT(updateFilter()));

  m_add = new QPushButton("&Add", dummy);
  filterLayout->addWidget(m_add, 7, 2, AlignCenter);
  m_add->setEnabled(false);
  connect(m_add, SIGNAL(clicked()),
	  this, SLOT(addFilter()));

  QPushButton* close = new QPushButton("&Close", this);
  outerLayout->addWidget(close, 1, AlignCenter);
  connect(close, SIGNAL(clicked()),
	  this, SLOT(accept()));

  // fill in message types
  QString typeName;
  for (int i = MT_Guild; i <= MT_Max; i++)
  {
    typeName = MessageEntry::messageTypeString((MessageType)i);
    if (!typeName.isEmpty())
      (void)new MessageFilterListBoxText(m_messageTypes, typeName, i);
  }

  // fill in existing messages
  const MessageFilter* filter;
  for (int i = 0; i < maxMessageFilters; i++)
  {
    filter = m_filters->filter(i);
    if (filter)
      (void)new MessageFilterListBoxText(m_existingFilters, filter->name(), i);
  }
}
void MessageFilterDialog::addFilter()
{
  uint32_t type;
  uint64_t types = 0;

  // iterate over the message types
  for (QListBoxItem* currentLBT = m_messageTypes->firstItem();
       currentLBT;
       currentLBT = currentLBT->next())
  {
    // if the item isn't selected, add in its type flag, and enable updates
    if (currentLBT->isSelected())
    {
      // get the message type of the selected item
      type = ((MessageFilterListBoxText*)currentLBT)->data();

      // add its flag to the types 
      types |= (uint64_t(1) << type);
    }
  } 

  // create a message filter object
  MessageFilter newFilter(m_name->text(), types, m_pattern->text());

  // if this isn't a valid filter, don't create it
  if (!newFilter.valid())
    return;

  // add the new filter
  m_currentFilterNum = m_filters->addFilter(newFilter);
  
  // if it is a valid filter, make the new filter the current selection
  if (m_currentFilterNum != 0xFF)
  {
    // retrieve the current item
    m_currentFilter = m_filters->filter(m_currentFilterNum);

    // iterate over the existing filters
    for (QListBoxItem* currentLBT = m_existingFilters->firstItem();
	 currentLBT;
	 currentLBT = currentLBT->next())
    {
      // find the current filter
      if (((MessageFilterListBoxText*)currentLBT)->data() == m_currentFilterNum)
      {
	// make the current filter the selected filter
	m_existingFilters->setSelected(currentLBT, true);
	break;
      }
    }
  }
  else // clear the current filter
  {
    // clear the current filter
    m_currentFilter = 0;
    clearFilter();
  }
  
  // setup the current dialog state
  checkState();
}
// performs the navigation i.e. goes from mime type view to category view to document view and back
void HierarchicalDocumentLauncherView::filterNavigate(FilterNavigation navigation, QModelIndex selectedItem) 
{
    QContentFilter lastFilter;
    
    if (navigation == NavigateBackward) {
        if (!selectedFilters.isEmpty()) {
            // pop the last filter from the list
            lastFilter = selectedFilters.takeLast();
            enterNavigationMode();
        } else
            exitNavigationMode();
    } else if (navigation == NavigateForward) {        
        if (selectedItem.isValid()) {
            
            // push the newly selected filter to the list
            AbstractContentFilterPropertyListModel *model = 
                    qobject_cast<AbstractContentFilterPropertyListModel *>(icons->model());
            if (model)
                selectedFilters.append(model->value(selectedItem.row()));
        }
    }
    
    switch (selectedFilters.count()) {
        case 0:
            // show types
            icons->setModel(modelTypes);
            selectedFilterLabel->setText(QString());
            break;
        case 1:
            // show categories
            icons->setModel(modelCategories);
            selectedFilterLabel->setText(modelTypes->findPropertyName(selectedFilters.first()));
            break;
        default:
            // both type and category have been selected
            
            selectedFilterLabel->setText(modelTypes->findPropertyName(selectedFilters.first()) 
                    + " / " + modelCategories->findPropertyName(selectedFilters.at(1)));
            
            // refresh filters of contentset
            QContentFilter newFilter(QContent::Document);
            foreach (QContentFilter filter, selectedFilters) {
                if (!filter.isValid()) 
					continue;
                
                newFilter &= filter;
            }
            
            // filter the content set
            contentSet->setCriteria(newFilter);
            
            // show filtered docs
            icons->setModel(bpModel);
            
            exitNavigationMode();
            break;
             
    }
    
    setCurrentItem(lastFilter);
}