Close hubs windows if..

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

Moderator: Moderators

NattensQje
Posts: 26
Joined: 2003-01-17 18:33
Location: Denmark

Close hubs windows if..

Post by NattensQje » 2003-07-06 23:18

Hi guys..

You all know the "Close Disconnected" option:

Hubframe.cpp:

Code: Select all

void HubFrame::closeDisconnected() {
    for(FrameIter i=frames.begin(); i!= frames.end(); ++i) {
        if (!(i->second->client->isConnected())) {
            i->second->PostMessage(WM_CLOSE);
        }
    }
}


But could you help me making a few other versions?

Close if not uploading in hub
Close if not downloading in hub
Close all windows exept hub windows


Thank you in advance :wink:

Sincerely
Nattens-Qje

NattensQje
Posts: 26
Joined: 2003-01-17 18:33
Location: Denmark

Post by NattensQje » 2003-07-06 23:20

Ohh, and if it's possible a combination of the first two?

Thanks

/Nattens-Qje

cologic
Programmer
Posts: 337
Joined: 2003-01-06 18:32

Post by cologic » 2003-07-06 23:43

Image
Look at the "Popup private messages" option, which accomplishes your "Close all windows exept hub windows" request in a slightly different manner.

NattensQje
Posts: 26
Joined: 2003-01-17 18:33
Location: Denmark

Post by NattensQje » 2003-07-06 23:51

Well, that's right. But it doesn't help me when I have the Hublist, Download Queue and Finished Uploads open. Yes I'm lazy :)

Anyway I like the Popup PM function and wouldn't dream about disabling it.

Thank you for your answer cologic :wink:

Sincerely
Nattens-Qje

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

Re: Close hubs windows if..

Post by GargoyleMT » 2003-07-07 01:08

NattensQje wrote:But could you help me making a few other versions?
Close if not uploading in hub
Close if not downloading in hub
Close all windows exept hub windows

Sure, just post specific questions about implementation of those, and I'll be happy to answer you.

NattensQje
Posts: 26
Joined: 2003-01-17 18:33
Location: Denmark

Post by NattensQje » 2003-07-07 11:38

Thank you GargoyleMT.

Okay, I have to say it, but I'm a newbie to C++.

But I could imagine that it would be something like this for the "Close Hubs not downloading in"

Code: Select all

void HubFrame::closeNodownloading() { 
    for(FrameIter i=frames.begin(); i!= frames.end(); ++i) {
        if (!(i->second->client->isDownloading())) {
            i->second->PostMessage(WM_CLOSE);
        }
    }
}


Code: Select all

void HubFrame::closeNodownloading() { 
    for(FrameIter i=frames.begin(); i!= frames.end(); ++i) {
          if (!(i->second->client->isUploading())) {
            i->second->PostMessage(WM_CLOSE);
        }
    }
}


But this doesn't work... :twisted:

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

Post by GargoyleMT » 2003-07-08 00:31

That'd be a nice consistent way of doing it, you'll have to write isDownloading and isUploading, though. You can step through the Upload::List and Download::List in Upload/DownloadManager, and check against the current hub name...

NattensQje
Posts: 26
Joined: 2003-01-17 18:33
Location: Denmark

Post by NattensQje » 2003-07-08 10:01

Thanks for replying.

But I don't know how to do that :?

What do I have to change?

Sorry for my n00bishm..

Sincerely
Nattens-Qje

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

Post by GargoyleMT » 2003-07-08 11:52

I'm only giving you hints. As you said in your first post, you wanted help with the features. If you want someone to write them for you, you'd have gotten a wildly different response from me.

Look at the source and try to understand what it's doing. Look at the UploadManager and DownloadManager... You should be able to piece it together.


It has nothing to do with being a newbie, it has to do with helping yourself. :mrgreen:

NattensQje
Posts: 26
Joined: 2003-01-17 18:33
Location: Denmark

Post by NattensQje » 2003-07-09 13:10

Okay then..

I found this in DownloadManager. It says it "ticks" ongoing downloads:

Code: Select all

   Download::List tickList;
   for(Download::Iter i = downloads.begin(); i != downloads.end(); ++i) {
      if((*i)->getTotal() > 0) {
         tickList.push_back(*i);
      }
   }


Shall I use it GargoyleMT? It looks a bit like the close disconnected codes.

This is the codes I got so far..
HubFrame.cpp

Code: Select all

void HubFrame::closeNotDownloading() {
// Hmm...
            i->second->PostMessage(WM_CLOSE);
        }
    }
};


MainFrm.cpp

Code: Select all

LRESULT MainFrame::onCloseNotDownloading(WORD , WORD , HWND , BOOL& ) {
   HubFrame::closeNotDownloading();
   return 0;
}


MainFrm.h

Code: Select all

      COMMAND_ID_HANDLER(IDC_CLOSE_NOT_DOWNLOADING, onCloseNotDownloading)


MainFrm.h

Code: Select all

LRESULT onCloseNotDownloading(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);


And added a Caption to StringDefs.cpp

Sincerely
Nattens-Qje

NattensQje
Posts: 26
Joined: 2003-01-17 18:33
Location: Denmark

Post by NattensQje » 2003-07-09 13:27

And it compiles with no errors now..

But I still need the main coding..

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

Post by GargoyleMT » 2003-07-09 15:43

NattensQje wrote:Okay then..

I found this in DownloadManager. It says it "ticks" ongoing downloads:

Code: Select all

   Download::List tickList;
   for(Download::Iter i = downloads.begin(); i != downloads.end(); ++i) {
      if((*i)->getTotal() > 0) {
         tickList.push_back(*i);
      }
   }


Shall I use it GargoyleMT? It looks a bit like the close disconnected codes.


Well, that code fragment, I think (I don't have the source handy) is just marking actvity. But the important part is that it iterates through the downloads. Each download will have a user, and each user will have a hub name. If you make a new DownloadManager function that takes a string, say "bool hubHasDownloads(string);" you can see if any current downloads match the hub you're asking about... You'll want to Lock the download list, but that should be the other major piece of your puzzle.

I think that should help a bit. ;)

(thanks for displaying the initiative, and your code.)

Who is online

Users browsing this forum: Google [Bot] and 0 guests