Where in the Code Shareaza Processes Pressing of Search Bttn
Posted:
25 Oct 2010 02:29
by kvnsmnsn
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
Re: Where in the Code Shareaza Processes Pressing of Search Bttn
Posted:
25 Oct 2010 13:31
by old_death
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.
Re: Where in the Code Shareaza Processes Pressing of Search Bttn
Posted:
25 Oct 2010 19:06
by ailurophobe
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.
Re: Where in the Code Shareaza Processes Pressing of Search Bttn
Posted:
25 Oct 2010 22:51
by kvnsmnsn
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>..........
Re: Where in the Code Shareaza Processes Pressing of Search Bttn
Posted:
26 Oct 2010 03:41
by raspopov
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?
Re: Where in the Code Shareaza Processes Pressing of Search Bttn
Posted:
26 Oct 2010 17:50
by old_death
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