Disable Search Window Before Connected
Moderator: Moderators
Disable Search Window Before Connected
I have now seen 4 threads in the Help/Support section go on for 12 or more posts before it was realized that the reason the person isn't receiving any search results is because they aren't connected to a hub!
Would it be possible to "grey out" the search button until the user is actually connected to at least one hub? Or, if they try to open a search window before connecting, they could be told "Must be connected to at least one hub before searching."
I know that this is a complete n00b feature, but I fear that many good shares are being lost due to frustration. It may seem like a no-brainer to us, but dc++ is different than most other p2p clients, and some don't realize that you must be connected to a hub to search for files.
A problem with "greying out" the button is the help forum will be cluttered with "I can't search"...but at least it would be more obvious to those assisting that they aren't connected.
The purpose is not to take load off of those helping new guys in the help forum, but to make it a little easier to use.
Just some thoughts.
Would it be possible to "grey out" the search button until the user is actually connected to at least one hub? Or, if they try to open a search window before connecting, they could be told "Must be connected to at least one hub before searching."
I know that this is a complete n00b feature, but I fear that many good shares are being lost due to frustration. It may seem like a no-brainer to us, but dc++ is different than most other p2p clients, and some don't realize that you must be connected to a hub to search for files.
A problem with "greying out" the button is the help forum will be cluttered with "I can't search"...but at least it would be more obvious to those assisting that they aren't connected.
The purpose is not to take load off of those helping new guys in the help forum, but to make it a little easier to use.
Just some thoughts.
Hehe.
-
- Forum Moderator
- Posts: 1420
- Joined: 2003-04-22 14:37
-
- Forum Moderator
- Posts: 1420
- Joined: 2003-04-22 14:37
-
- Forum Moderator
- Posts: 1420
- Joined: 2003-04-22 14:37
-
- Forum Moderator
- Posts: 1420
- Joined: 2003-04-22 14:37
Code: Select all
//Gratch - Search check.
//ClientManager.h line 67
void search(int aSizeMode, int64_t aSize, int aFileType, const string& aString, bool bMultiSearch = false) {
Lock l(cs);
int countRooms = 0;
for(Client::Iter i = clients.begin(); i != clients.end(); ++i) {
if((*i)->isConnected()) {
countRooms++;
(*i)->search(aSizeMode, aSize, aFileType, aString, bMultiSearch);
}
}
if (countRooms <= 0) MessageBox( NULL, CSTRING(MUST_BE_IN_ROOM_TO_SEARCH), CSTRING(SEARCH_ERROR), MB_OK | MB_SYSTEMMODAL );
}
-
- Forum Moderator
- Posts: 1420
- Joined: 2003-04-22 14:37
ah, nice going with the patching :)
unfortunately I don't think arne will accept that patch. the UI code just got intertwined with the Client code.
I do think the approach is right though.. a grey search button wouldn't prevent anyone from opening a search window first, closing the hub, and try to search later.
this nice messagebox, like the one that disables connecting to hubs when no nick has been entered, works fine imho.
(so - if I'm right - for it to be accepted, you'd either have to move the check to somewhere in the UI, or fire() something when countRooms <= 0)
unfortunately I don't think arne will accept that patch. the UI code just got intertwined with the Client code.
I do think the approach is right though.. a grey search button wouldn't prevent anyone from opening a search window first, closing the hub, and try to search later.
this nice messagebox, like the one that disables connecting to hubs when no nick has been entered, works fine imho.
(so - if I'm right - for it to be accepted, you'd either have to move the check to somewhere in the UI, or fire() something when countRooms <= 0)
http://dc.selwerd.nl/hublist.xml.bz2
http://www.b.ali.btinternet.co.uk/DCPlusPlus/index.html (TheParanoidOne's DC++ Guide)
http://www.dslreports.com/faq/dc (BSOD2600's Direct Connect FAQ)
http://www.b.ali.btinternet.co.uk/DCPlusPlus/index.html (TheParanoidOne's DC++ Guide)
http://www.dslreports.com/faq/dc (BSOD2600's Direct Connect FAQ)
Progress! Thanks Paranoid, Gratch, and Sedulus!
What is the "<" for? Murphey's Law?
Code: Select all
if (countRooms <= 0)
Hehe.
-
- Forum Moderator
- Posts: 1420
- Joined: 2003-04-22 14:37
OK, this being my first time toying with the fire() and onAction system that has been set up, I'm significantly lost.
What I DO know:
I can fire(someobject::Types, <insert other params here>)
It will eventually reach an onAction function which will check the type, and upon finding a match, will execute the appropriate code.
What I DON'T know:
How to link the fire's to the onActions: specifically, which functions do I need to include so that I can fire information from the ClientManger::search function so that it arrives at the correct onAction function? My idea was to put together a DO_MESSAGE_BOX type and let the onAction function take two char* parameters, thus giving the framework for a quick and easy messagebox using any title and text if needed in the future.
-Gratch06
What I DO know:
I can fire(someobject::Types, <insert other params here>)
It will eventually reach an onAction function which will check the type, and upon finding a match, will execute the appropriate code.
What I DON'T know:
How to link the fire's to the onActions: specifically, which functions do I need to include so that I can fire information from the ClientManger::search function so that it arrives at the correct onAction function? My idea was to put together a DO_MESSAGE_BOX type and let the onAction function take two char* parameters, thus giving the framework for a quick and easy messagebox using any title and text if needed in the future.
-Gratch06
Well, I suppose I should probably put in the code that I had tweaked with that didn't work correctly, so here goes....
Hope this helps to find the mistake I've made!
-Gratch06
Code: Select all
ClientManagerListener.h
enum Types {
USER_UPDATED,
INCOMING_SEARCH,
DO_MESSAGE_BOX //Gratch edit
};
virtual void onAction(Types, const char*, const char*) throw() { }; //Gratch edit
Code: Select all
ClientManager.h
if (countRooms <= 0) fire(ClientManagerListener::DO_MESSAGE_BOX, CSTRING(MUST_BE_IN_ROOM_TO_SEARCH), CSTRING(SEARCH_ERROR) ); //Gratch edit
Private:
virtual void onAction(ClientManagerListener::Types, const char* message, const char* title); //Gratch edit
Code: Select all
ClientManager.cpp
//Gratch edit
void ClientManager::onAction(ClientManagerListener::Types, const char* message, const char* title) throw() {
MessageBox( NULL, message, title, MB_OK | MB_SYSTEMMODAL );
}
-Gratch06
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
I think disabling the search button itself could create new questions in the forum about why the search button is broken, I think the best would be to diable the searching inside the search window and to put a msg where the search results should go... "You need to connect to at least one hub to search!"..
http://whyrar.omfg.se - Guide to RAR and DC behaviour!
http://bodstrom.omfg.se - Bodströmsamhället, Länksamling om hoten mot vår personliga integritet
http://bodstrom.omfg.se - Bodströmsamhället, Länksamling om hoten mot vår personliga integritet
still disabling the search icon is on Gargoyles todo-list, this I don't like!
http://whyrar.omfg.se - Guide to RAR and DC behaviour!
http://bodstrom.omfg.se - Bodströmsamhället, Länksamling om hoten mot vår personliga integritet
http://bodstrom.omfg.se - Bodströmsamhället, Länksamling om hoten mot vår personliga integritet
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
Tough noogies.cyberal wrote:still disabling the search icon is on Gargoyle's todo-list, this I don't like!
There are a million ways to solve this problem, and disabling the search menu item, keyboard shortcut, and toolbar icon is a pretty good one. Especially if you add an "OFFLINE" or "ONLINE: x/y/z HUBS" to the status bar.
I can suggest other solutions, if you're up to coding them. Are you?
Code: Select all
//ClientManager, public portion of class
int getNumberOfOnlineClients() { //Gratch added for Search window
int counterVar = 0;
for(Client::Iter i = clients.begin(); i != clients.end(); ++i) {
Client* c = *i;
if (c->isConnected())
counterVar++;
}
return counterVar;
}
Code: Select all
void SearchFrame::onEnter() {
//Start Gratch add search window
if ((ClientManager::getInstance())->getNumberOfOnlineClients() == 0) {
MessageBox( CSTRING(MUST_BE_IN_HUB_TO_SEARCH), CSTRING(SEARCH_ERROR), MB_OK );
return;
}
//end Gratch added search window
...
-Gratch06
[Edit: TPO: Class name modified as requested ]