コード例 #1
0
void PrefAssociations::getData(Preferences * pref)
{
	QStringList extensions; 

	for (int k = 0; k < listWidget->count(); k++)
	{
		QListWidgetItem* pItem = listWidget->item(k); 
		if (pItem && pItem->checkState() == Qt::Checked)
			extensions.append(pItem->text()); 
	}

	QStringList old = pref->extensions.split(","); 

	int processed = ProcessAssociations(extensions, old); 

	//Save the new associations
	pref->extensions = extensions.join(","); 

	if (processed != extensions.count())
	{
		QMessageBox::warning(this, tr("Warning"), 
            tr("Not all files could be associated. Please check your "
               "security permissions and retry."), QMessageBox::Ok);
	}

}
コード例 #2
0
void PrefAssociations::getData(Preferences *)
{
	qDebug("PrefAssociations::getData: something_changed: %d", something_changed);
	if (!something_changed) return;
	
	QStringList extensions; 

	for (int k = 0; k < listWidget->count(); k++)
	{
		QListWidgetItem* pItem = listWidget->item(k); 
		if (pItem && pItem->checkState() == Qt::Checked)
			extensions.append(pItem->text()); 
	}

	int processed = ProcessAssociations(extensions, m_regExtensions); 

	if (processed != extensions.count())
	{
		QMessageBox::warning(this, tr("Warning"), 
            tr("Not all files could be associated. Please check your "
               "security permissions and retry."), QMessageBox::Ok);
	}
	
	refreshList(); //Useless when OK is pressed... How to detect if apply or ok is pressed ?

	something_changed = false;
}
コード例 #3
0
	// This runs through all of the terms in a document and creates a mapping
	// between a word text string and the id. It also find the top N words
	// with the lowest occurrence and no suffix to add to a set of keywords.
	// @param doc_id - the current doc id being processed
	// @param doc_size - this is the number of words in the document
	inline void ProcessDocument(_int64 &doc_id, uLong doc_size) {

		static SToken token;
		static bool assoc_found;
		static uLong word_id;
		static int space = 0;
		static uChar enc;

		m_assoc_set.Initialize(2);
		for(uLong i=0; i<doc_size; i++) {

			token.pos = i;
			RetrieveNextTerm(token);

			if(++space >= 10000) {
				cout<<(m_excerpt_occur_map_file.PercentageFileRead() * 100)<<"% Done"<<endl;
				space = 0;
			}

			if(m_assoc_set.Size() < m_assoc_set.OverflowSize()) {
				continue;
			}

			if(m_assoc_set[0].word_id == m_assoc_set[1].word_id) {
				continue;
			}

			if(ProcessAssociations(i, doc_id, token)) {
				token.word_id = m_assoc_set[0].word_id;
				AddTermToSet(token);
				token.word_id = m_assoc_set[1].word_id;
				AddTermToSet(token);
			}
		}
	}