Where in the Code Shareaza Processes Pressing of Search Bttn

Post comments about Shareaza code and discuss with other developers.
Forum rules
Home | Wiki | Rules

Where in the Code Shareaza Processes Pressing of Search Bttn

Postby kvnsmnsn » 25 Oct 2010 02:29

When one brings up Shareaza, a window appears on the upper left labeled "Search". Underneath is a line of text that says "Type your search here:", and underneath that is a text field. If I type "jqz" in the text field and then click on a "Search" button a little ways below it, Shareaza starts looking over "the network" for files that are somehow related to the string "jqz". Can someone tell me where in the code Shareaza processes the pressing of that "Search" button?

Kevin S
kvnsmnsn
 
Posts: 40
Joined: 19 Oct 2010 19:13

Re: Where in the Code Shareaza Processes Pressing of Search Bttn

Postby kevogod » 25 Oct 2010 03:07

Why?
kevogod
 
Posts: 278
Joined: 13 Jun 2009 16:13

Re: Where in the Code Shareaza Processes Pressing of Search Bttn

Postby kvnsmnsn » 25 Oct 2010 04:34

kvnsmnsn
 
Posts: 40
Joined: 19 Oct 2010 19:13

Re: Where in the Code Shareaza Processes Pressing of Search Bttn

Postby kvnsmnsn » 25 Oct 2010 04:46

kvnsmnsn
 
Posts: 40
Joined: 19 Oct 2010 19:13

Re: Where in the Code Shareaza Processes Pressing of Search Bttn

Postby old_death » 25 Oct 2010 13:31

Why don't you just download the source and check what method is triggered when clicking on the search button? I mean this should be far more easy than asking, as you need to get the code anyway to modify Shareaza. If you let me guess however, I'd have a look at WndSearch.cpp for the code related to the search window.
User avatar
old_death
 
Posts: 1950
Joined: 13 Jun 2009 16:19

Re: Where in the Code Shareaza Processes Pressing of Search Bttn

Postby kvnsmnsn » 25 Oct 2010 17:10

kvnsmnsn
 
Posts: 40
Joined: 19 Oct 2010 19:13

Re: Where in the Code Shareaza Processes Pressing of Search Bttn

Postby ailurophobe » 25 Oct 2010 19:06

void CSearchWnd::OnSearchSearch()?

The start of the WndSearch.cpp has a message map that tells which messages correspond to which actions. Pretty hard to miss.
ailurophobe
 
Posts: 709
Joined: 11 Nov 2009 05:25

Re: Where in the Code Shareaza Processes Pressing of Search Bttn

Postby kvnsmnsn » 25 Oct 2010 20:19

kvnsmnsn
 
Posts: 40
Joined: 19 Oct 2010 19:13

Re: Where in the Code Shareaza Processes Pressing of Search Bttn

Postby cyko_01 » 25 Oct 2010 22:33

User avatar
cyko_01
 
Posts: 938
Joined: 13 Jun 2009 15:51

Re: Where in the Code Shareaza Processes Pressing of Search Bttn

Postby kvnsmnsn » 25 Oct 2010 22:51

If I'm being overly naive just let me know.

<ailurophobe> said that "WndSearch.cpp" has "a message map that tells which messages correspond to which actions," but as I said in the last post, when I set a breakpoint in his suspected method CSearchWnd::OnSearchSearch(), and another breakpoint in CQuerySearch::ToG2Packet(), and ran the program, execution got to "ToG2Packet()" before it got to "OnSearchSearch(). (In fact I don't think it ever got to "OnSearchSearch()". On the other hand, file "CtrlHomeSearch.cpp" _also_ has a message map, and I noticed right away that as soon as I pressed "Search" on the GUI, CHomeSearchCtrl::Search() got called, so I think CHomeSearchCtrl::Search() is the method I want.

So I added another boolean parameter that, if true, causes a "SetWindowText" to a predefined value (actually "abc def" right now), before it does the normal processing it does, and then I went to CHomeSearchCtrl::OnCreate() and added a line at the end that said "Search( true, true);", and added a "false" parameter as a second argument to the two other places in the code where "Search()" was called.

I was hoping that this would result in the predefined value being searched for, and having the results of the search displayed on the GUI when it came up. Unfortunately that didn't happen; the ordinary GUI that has always come up still came up. Does anybody have any idea why the plan I've described didn't work?

I'm appending the parts of "CtrlHomeSearch.cpp" that I changed.

Kevin S

#########################################################################################

..........<snip>..........

int CHomeSearchCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if ( CWnd::OnCreate( lpCreateStruct ) == -1 ) return -1;

CRect rc( 0, 0, 0, 0 );

if ( ! m_wndText.Create( WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_GROUP|WS_VSCROLL|CBS_AUTOHSCROLL|CBS_DROPDOWN,
rc, this, IDC_SEARCH_TEXT ) ) return -1;

if ( ! m_wndSchema.Create( WS_CHILD|WS_VISIBLE|WS_TABSTOP, rc, this, IDC_SCHEMAS ) )
return -1;

m_wndSchema.SetDroppedWidth( SCHEMA_WIDTH );
LoadString( m_wndSchema.m_sNoSchemaText, IDS_SEARCH_PANEL_AFT );
m_wndSchema.Load( Settings.Search.LastSchemaURI );

m_wndSearch.Create( rc, this, IDC_SEARCH_START, WS_TABSTOP | BS_DEFPUSHBUTTON );
m_wndSearch.SetHandCursor( TRUE );

m_wndAdvanced.Create( rc, this, IDC_SEARCH_ADVANCED, WS_TABSTOP );
m_wndAdvanced.SetHandCursor( TRUE );

OnSkinChange( CoolInterface.m_crWindow );

FillHistory();
Search( true, true);

return 0;
}

..........<snip>..........

void CHomeSearchCtrl::Search( bool bAutostart
, bool preset)
{
CString strText( "abc def"), strURI, strEntry, strClear;

if (preset)
{ m_wndText.SetWindowText( strText);
}
m_wndText.GetWindowText( strText );
strText.TrimLeft();
strText.TrimRight();

LoadString( strClear, IDS_SEARCH_PAD_CLEAR_HISTORY );
if ( _tcscmp ( strClear , strText ) == 0 ) return;

// Check if user mistakenly pasted download link to search input box
if ( CShareazaApp::OpenURL( strText, TRUE, TRUE ) )
{
m_wndText.SetWindowText( _T("") );
return;
}

..........<snip>..........
kvnsmnsn
 
Posts: 40
Joined: 19 Oct 2010 19:13

Re: Where in the Code Shareaza Processes Pressing of Search Bttn

Postby raspopov » 26 Oct 2010 03:41

kvnsmnsn, please don't forget that Shareaza licensed under GPL so you derived work must be licensed under GPL too, so where are your sources?
User avatar
raspopov
Project Admin
 
Posts: 945
Joined: 13 Jun 2009 12:30

Re: Where in the Code Shareaza Processes Pressing of Search Bttn

Postby kvnsmnsn » 26 Oct 2010 16:51

kvnsmnsn
 
Posts: 40
Joined: 19 Oct 2010 19:13

Re: Where in the Code Shareaza Processes Pressing of Search Bttn

Postby old_death » 26 Oct 2010 17:50

He was talking about that any product that includes Shareaza source code must make all of its source code openly available (=downloadable), even if only a single line of Shareaza source code is used in that product. This is basically what the open source license Shareaza uses says.

This is important if you wish to keep the code of your program secret, as in this case you are not allowed to use a single line of Shareaza code within your program, else your program would be illegal.


mfg,
Old
User avatar
old_death
 
Posts: 1950
Joined: 13 Jun 2009 16:19

Re: Where in the Code Shareaza Processes Pressing of Search Bttn

Postby kvnsmnsn » 26 Oct 2010 20:11

kvnsmnsn
 
Posts: 40
Joined: 19 Oct 2010 19:13

Re: Where in the Code Shareaza Processes Pressing of Search Bttn

Postby kevogod » 27 Oct 2010 01:16

kevogod
 
Posts: 278
Joined: 13 Jun 2009 16:13

Re: Where in the Code Shareaza Processes Pressing of Search Bttn

Postby cyko_01 » 29 Oct 2010 01:14

User avatar
cyko_01
 
Posts: 938
Joined: 13 Jun 2009 15:51


Return to Development Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron