Skip to contentSkip to conversation

qconf ("make xconfig") Search Dialog Enhancement (rev8)

PATCH Roman Zippel 3 participants 5 messages Sep 16, 2007 – Oct 11, 2007 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi,

Quoted 8 lines · Shlomi Fish

This patch adds an option to use either substring match, regular expression match, or keywords search in the "make xconfig" Edit->Find dialog.

It also allows searching on the "help" field of the menus as well as the "name" of the symbol.

This change involved adding the sym_generic_search function to the LKC, and implementing sym_re_search using it.

I like the direction, but first of all please fix the coding style. I would also prefer to move more of the search functionality into the generic code, so it can be used by other front ends as well, otherwise a lot of this had to be duplicated.
I think a filter function makes it maybe a bit to flexible, if a front end wants to do some weird filtering, it can still access the symbol data base directly. So what I have in mind is something like this:

struct symbol **sym_generic_search(const char *pattern, unsigned int flags);

This means the back end provides a basic search facility for the most common search operations. The flags would specify what to search (e.g. symbol name, help text, prompts) and how to do it.

Quoted 25 lines
(quoted diff) +17 -0
@@ -1199,6 +1199,23 @@
 	layout2->addWidget(searchButton);
 	layout1->addLayout(layout2);
 
+	// Initialize the "Search Type" button group.
+	searchType = new QVButtonGroup("Search Type", this, "searchType");
+
+	substringSearch = new QRadioButton(
+		"Substring Match", searchType, "Substring Match"
+		);
+
+	keywordsSearch = new QRadioButton("Keywords", searchType, "Keywords");
+
+	regexSearch = new QRadioButton(
+		"Regular Expression", searchType, "Regular Expression"
+		);
+
+	substringSearch->setChecked(TRUE);
+	layout1->addWidget(searchType);
+
+	// Initialize the ConfigView and ConfigInfoView
 	split = new QSplitter(this);
 	split->setOrientation(QSplitter::Vertical);
 	list = new ConfigView(split, name);

Review line 1271

Quoted 10 lines
(quoted diff) +6 -0
@@ -1245,6 +1262,20 @@
 	}
 }
 
+SEARCH_TYPE ConfigSearchWindow::getSearchType()
+{
+	return	substringSearch->isChecked() ? SUBSTRING :
+		regexSearch->isChecked() ? REGEX :
+		KEYWORDS;
+}
 

If you use QButtonGroup::insert() you can assign id's to the indivual buttons and then use selectedId to make this part simpler.

bye, Roman

#2 lore raw

Hi!

Sorry for the late response.

Quoted 7 lines · Roman Zippel

Hi,

Quoted 4 lines · Shlomi Fish

This patch adds an option to use either substring match, regular expression match, or keywords search in the "make xconfig" Edit->Find dialog.

Quoted 7 lines
Quoted 5 lines

It also allows searching on the "help" field of the menus as well as the "name" of the symbol.

This change involved adding the sym_generic_search function to the LKC, and implementing sym_re_search using it.

I like the direction, but first of all please fix the coding style.

Which specific problems do you see with the coding style of the patch? Can you comment on it?

Quoted 3 lines

I would also prefer to move more of the search functionality into the generic code, so it can be used by other front ends as well, otherwise a lot of this had to be duplicated.

That would be a good idea, but I cannot use Qt there, which makes my job harder.

Quoted 3 lines

I think a filter function makes it maybe a bit to flexible, if a front end wants to do some weird filtering, it can still access the symbol data base directly.

A filter function would still be convenient in this context, as the symbol data base API may change, and the filter function has a little logic in it.

Quoted 8 lines

So what I have in mind is something like this:

struct symbol **sym_generic_search(const char *pattern, unsigned int flags);

This means the back end provides a basic search facility for the most common search operations. The flags would specify what to search (e.g. symbol name, help text, prompts) and how to do it.

I suggest we don't call it sym_generic_search, as generic implies it is a generic filter. We can call it "sym_string_search" or whatever. Then, I suggest we have separate arguments for every parameter (i.e: search type, case sensitivity, what to search, etc.).

Quoted 29 lines
Quoted 29 lines
(quoted diff) +17 -0
@@ -1199,6 +1199,23 @@
 	layout2->addWidget(searchButton);
 	layout1->addLayout(layout2);
 
+	// Initialize the "Search Type" button group.
+	searchType = new QVButtonGroup("Search Type", this, "searchType");
+
+	substringSearch = new QRadioButton(
+		"Substring Match", searchType, "Substring Match"
+		);
+
+	keywordsSearch = new QRadioButton("Keywords", searchType, "Keywords");
+
+	regexSearch = new QRadioButton(
+		"Regular Expression", searchType, "Regular Expression"
+		);
+
+	substringSearch->setChecked(TRUE);
+	layout1->addWidget(searchType);
+
+	// Initialize the ConfigView and ConfigInfoView
 	split = new QSplitter(this);
 	split->setOrientation(QSplitter::Vertical);
 	list = new ConfigView(split, name);
@@ -1245,6 +1262,20 @@
 	}
 }
 
Quoted 10 lines

Review line 1270

Quoted 6 lines
(quoted diff) +6 -0
+SEARCH_TYPE ConfigSearchWindow::getSearchType()
+{
+	return	substringSearch->isChecked() ? SUBSTRING :
+		regexSearch->isChecked() ? REGEX :
+		KEYWORDS;
+}

If you use QButtonGroup::insert() you can assign id's to the indivual buttons and then use selectedId to make this part simpler.

Ah, OK.

Regards,

Shlomi Fish

---------------------------------------------------------------------
Shlomi Fish [email protected]
Homepage: http://www.shlomifish.org/

If it's not in my E-mail it doesn't happen. And if my E-mail is saying one thing, and everything else says something else - E-mail will conquer.
-- An Israeli Linuxer

#3 lore raw

Hi Shlomi Fish.

When you address the comments of Roman just sent a replacemnt patch. I will drop the one I have in kbuild.git then.

Sam

#4 lore raw
In reply to Shlomi Fish

Hi,

Quoted 2 lines · Shlomi Fish

Which specific problems do you see with the coding style of the patch? Can you comment on it?

Mostly whitespace around any braces, please keep it close to the other source.

Quoted 6 lines
Quoted 3 lines

I would also prefer to move more of the search functionality into the generic code, so it can be used by other front ends as well, otherwise a lot of this had to be duplicated.

That would be a good idea, but I cannot use Qt there, which makes my job harder.

Where is the problem with implementing it in C? Just try to keep it a simple at first.

Quoted 6 lines
Quoted 3 lines

I think a filter function makes it maybe a bit to flexible, if a front end wants to do some weird filtering, it can still access the symbol data base directly.

A filter function would still be convenient in this context, as the symbol data base API may change, and the filter function has a little logic in it.

This API is not really fixed at the moment, so it's not really a problem.

Quoted 5 lines
Quoted 5 lines

So what I have in mind is something like this:

struct symbol **sym_generic_search(const char *pattern, unsigned int flags);

Quoted 8 lines
Quoted 3 lines

This means the back end provides a basic search facility for the most common search operations. The flags would specify what to search (e.g. symbol name, help text, prompts) and how to do it.

I suggest we don't call it sym_generic_search, as generic implies it is a generic filter. We can call it "sym_string_search" or whatever. Then, I suggest we have separate arguments for every parameter (i.e: search type, case sensitivity, what to search, etc.).

I don't care much about the name, but please keep it as a simple flag, which is a lot easier to extend.

bye, Roman

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 6 lines · Shlomi Fish

Hi!

Quoted 3 lines · Roman Zippel

Hi,

On Thu, 20 Sep 2007, Shlomi Fish wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Which specific problems do you see with the coding style of the patch? Can you comment on it?

Mostly whitespace around any braces, please keep it close to the other source.

I see. I'll see what I can do.

I have dropped your previous patch for now awaiting the update.

Sam