Close only un-used hubs

Problems compiling? Don't understand the source code? Don't know how to code your feature? Post here.

Moderator: Moderators

Locked
darwusch
Posts: 23
Joined: 2004-03-19 12:57

Close only un-used hubs

Post by darwusch » 2004-08-06 17:53

Hi again !

In the features forum, I found this idea which I think is great:
An option to only close un-used hubs (meaning the hubs you don't have any up- or downloads with).
See also:
http://dcplusplus.sourceforge.net/forum ... 0794#60794

But because I started coding it and got stuck, I thought it belongs better over here.
If anybody could help, it would be appreciated !

It should be placed just like the "Close disconnected" feature, in the Window menu.

The idea is like this:
If a hub is named in the TranferViews Hub column, some connection (up- or download) is active.

In the file Hubframe.cpp it should look like this:

Code: Select all


void HubFrame::closeAllUnusedHubs() { 
   for(FrameIter i=frames.begin(); i!= frames.end(); ++i) { 
      if(!(i->second->isActiveHub)) { 
                  i->second->PostMessage(WM_CLOSE); 
      } 
   } 
}; 
 
Here the isActiveHub is a bool which is true when the hub is in the TransferViews Hub column.

Now I'm a bit stuck where and how I should set this isActiveHub to true when a hub is used.

I guess it should be something like:

Code: Select all


if (Util::stricmp(TransferView::COLUMN_HUB, name_of_hub_window)==0) 
isActiveHub = true 
 
But in what way are the hub windows named, and where to do this ? In TransferView.h maybe ?

Thanks for helping !

darwusch
Posts: 23
Joined: 2004-03-19 12:57

Post by darwusch » 2004-08-07 08:41

Can anybody help me out here please ?

The only problem I got left at this moment is how to set the "isActiveHub" to true for each hubwindow when the column Hub in the Transfer window contains that hubname.

I think the hubwindow names can be taken from:
getClientName()
And should then be compared with all hubs in the Hub column from the Transfer window

But here I'm a bit stuck...

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2004-08-07 09:30

darwusch wrote:Can anybody help me out here please ?
Be patient, one post ist fine.

Locked