From b92e26710ee4547e6780d498f3604c74b79279c3 Mon Sep 17 00:00:00 2001 From: upstream svn Date: Sat, 16 Oct 2010 22:09:48 +0000 Subject: [PATCH] Implement uploading view in aMuleGUI and fix notifications --- .svn-revision | 2 +- src/SharedFilesWnd.cpp | 4 +++- src/amule-remote-gui.cpp | 29 +++++++++++++++++++++++++++-- src/amule-remote-gui.h | 2 ++ src/libs/ec/cpp/ECSpecialTags.h | 4 ++-- 5 files changed, 35 insertions(+), 6 deletions(-) diff --git a/.svn-revision b/.svn-revision index 54fde19d..a9597ccc 100644 --- a/.svn-revision +++ b/.svn-revision @@ -1 +1 @@ -10322 +10323 diff --git a/src/SharedFilesWnd.cpp b/src/SharedFilesWnd.cpp index 89055238..c3e8ba43 100644 --- a/src/SharedFilesWnd.cpp +++ b/src/SharedFilesWnd.cpp @@ -192,7 +192,9 @@ void CSharedFilesWnd::SelectionUpdated() // So the uploadqueue carries a special known file with all ongoing uploads in its upload list. // This is a hack, but easier than trying to bend the class into a shape it was not intended for // to show all clients currently uploading. -#ifndef CLIENT_GUI +#ifdef CLIENT_GUI + fileVector.push_back(theApp->m_allUploadingKnownFile); +#else fileVector.push_back(theApp->uploadqueue->GetAllUploadingKnownFile()); #endif } diff --git a/src/amule-remote-gui.cpp b/src/amule-remote-gui.cpp index 838c6449..776211ea 100644 --- a/src/amule-remote-gui.cpp +++ b/src/amule-remote-gui.cpp @@ -222,6 +222,7 @@ void CamuleRemoteGuiApp::ShutDown(wxCloseEvent &WXUNUSED(evt)) amuledlg->Destroy(); amuledlg = NULL; } + delete m_allUploadingKnownFile; } @@ -358,6 +359,8 @@ void CamuleRemoteGuiApp::Startup() { downloadqueue = new CDownQueueRem(m_connect); ipfilter = new CIPFilterRem(m_connect); + m_allUploadingKnownFile = new CKnownFile; + // Create main dialog InitGui(m_geometryEnabled, m_geometryString); @@ -1280,8 +1283,14 @@ void CUpDownClientListRem::ProcessItemUpdate( tag->OldRemoteQueueRank(&client->m_nOldRemoteQueueRank); tag->AskedCount(&client->m_cAsked); - tag->ClientDownloadState(&client->m_nDownloadState); - tag->ClientUploadState(&client->m_nUploadState); + tag->ClientDownloadState(client->m_nDownloadState); + if (tag->ClientUploadState(client->m_nUploadState)) { + if (client->m_nUploadState == US_UPLOADING) { + theApp->m_allUploadingKnownFile->AddUploadingClient(client); + } else { + theApp->m_allUploadingKnownFile->RemoveUploadingClient(client); + } + } tag->SpeedUp(&client->m_nUpDatarate); if ( client->m_nDownloadState == DS_DOWNLOADING ) { @@ -1361,9 +1370,11 @@ void CUpDownClientListRem::ProcessItemUpdate( } // Upload client + notified = false; if (tag->UploadFile(fileID)) { if (client->m_uploadingfile) { client->m_uploadingfile->RemoveUploadingClient(client); // this notifies + notified = true; client->m_uploadingfile = NULL; //client->m_downPartStatus.clear(); } @@ -1371,9 +1382,23 @@ void CUpDownClientListRem::ProcessItemUpdate( if (kf) { client->m_uploadingfile = kf; client->m_uploadingfile->AddUploadingClient(client); // this notifies + notified = true; //client->m_downPartStatus.setsize(kf->GetPartCount(), 0); } } + + if (!notified && client->m_uploadingfile + && (client->m_uploadingfile->ShowSources() || (client->m_nUploadState == US_UPLOADING))) { + // notify if KnowFile is selected, or if it's uploading (in case clients are in show uploading mode) + SourceItemType type = UNAVAILABLE_SOURCE; + switch (client->GetUploadState()) { + case US_UPLOADING: + case US_ONUPLOADQUEUE: + type = AVAILABLE_SOURCE; + break; + } + Notify_SharedCtrlRefreshClient(client, type); + } } diff --git a/src/amule-remote-gui.h b/src/amule-remote-gui.h index 56624ccc..f4341b2a 100644 --- a/src/amule-remote-gui.h +++ b/src/amule-remote-gui.h @@ -705,6 +705,8 @@ public: uint32 m_clientID; wxLocale m_locale; + // This KnownFile collects all currently uploading clients for display in the upload list control + CKnownFile * m_allUploadingKnownFile; DECLARE_EVENT_TABLE() }; diff --git a/src/libs/ec/cpp/ECSpecialTags.h b/src/libs/ec/cpp/ECSpecialTags.h index 95db44a5..32ec9afc 100644 --- a/src/libs/ec/cpp/ECSpecialTags.h +++ b/src/libs/ec/cpp/ECSpecialTags.h @@ -301,8 +301,8 @@ class CEC_UpDownClient_Tag : public CECTag { bool ClientSoftware(uint8 &target) const { return AssignIfExist(EC_TAG_CLIENT_SOFTWARE, target); } bool SoftVerStr(wxString &target) const { return AssignIfExist(EC_TAG_CLIENT_SOFT_VER_STR, target); } - uint8 ClientUploadState(uint8 *target = 0) const { return AssignIfExist(EC_TAG_CLIENT_UPLOAD_STATE, target); } - uint8 ClientDownloadState(uint8 *target = 0) const { return AssignIfExist(EC_TAG_CLIENT_DOWNLOAD_STATE, target); } + bool ClientUploadState(uint8 &target) const { return AssignIfExist(EC_TAG_CLIENT_UPLOAD_STATE, target); } + bool ClientDownloadState(uint8 &target) const { return AssignIfExist(EC_TAG_CLIENT_DOWNLOAD_STATE, target); } //uint32 WaitTime(uint32 *target = 0) const { return AssignIfExist(EC_TAG_CLIENT_WAIT_TIME, target); } //uint32 XferTime(uint32 *target = 0) const { return AssignIfExist(EC_TAG_CLIENT_XFER_TIME, target); } -- 2.11.4.GIT