diff options
| author | Tobias Markmann <tm@ayena.de> | 2015-06-17 20:40:41 (GMT) |
|---|---|---|
| committer | Tobias Markmann <tm@ayena.de> | 2015-07-10 14:56:43 (GMT) |
| commit | b54aa689ffc6bec7987c193e28c641d2f0f73236 (patch) | |
| tree | ad9984fc3f9633e21fe0ff5ef8728f6d420ca07f | |
| parent | 7af21fdd59af3b3112cff69996301605859af84c (diff) | |
| download | swift-b54aa689ffc6bec7987c193e28c641d2f0f73236.zip swift-b54aa689ffc6bec7987c193e28c641d2f0f73236.tar.bz2 | |
Implement logic behind 'Clear all' button
The 'Clear all' button in the file transfer overview window
was only present in the UI, without any logic behind. That's fixed now.
Test-Information:
Send a file in between two Swift instances. Verified that the button is
enabled/disabled at appropriate times and works as expected if pressed.
Change-Id: Ib92621cba479683ade8d815ce5ace9768449a499
| -rw-r--r-- | Swift/Controllers/FileTransfer/FileTransferController.cpp | 2 | ||||
| -rw-r--r-- | Swift/Controllers/FileTransfer/FileTransferController.h | 19 | ||||
| -rw-r--r-- | Swift/Controllers/FileTransfer/FileTransferOverview.cpp | 58 | ||||
| -rw-r--r-- | Swift/Controllers/FileTransfer/FileTransferOverview.h | 15 | ||||
| -rw-r--r-- | Swift/Controllers/MainController.cpp | 107 | ||||
| -rw-r--r-- | Swift/QtUI/QtFileTransferListItemModel.cpp | 39 | ||||
| -rw-r--r-- | Swift/QtUI/QtFileTransferListItemModel.h | 8 | ||||
| -rw-r--r-- | Swift/QtUI/QtFileTransferListWidget.cpp | 44 | ||||
| -rw-r--r-- | Swift/QtUI/QtFileTransferListWidget.h | 20 |
9 files changed, 229 insertions, 83 deletions
diff --git a/Swift/Controllers/FileTransfer/FileTransferController.cpp b/Swift/Controllers/FileTransfer/FileTransferController.cpp index f7ce8e6..c21c364 100644 --- a/Swift/Controllers/FileTransfer/FileTransferController.cpp +++ b/Swift/Controllers/FileTransfer/FileTransferController.cpp | |||
| @@ -119,11 +119,11 @@ void FileTransferController::cancel() { | |||
| 119 | } | 119 | } |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | void FileTransferController::handleFileTransferStateChange(FileTransfer::State state) { | 122 | void FileTransferController::handleFileTransferStateChange(FileTransfer::State state) { |
| 123 | currentState = state; | 123 | currentState = state; |
| 124 | onStateChage(); | 124 | onStateChanged(); |
| 125 | switch(state.type) { | 125 | switch(state.type) { |
| 126 | case FileTransfer::State::Initial: | 126 | case FileTransfer::State::Initial: |
| 127 | assert(false); | 127 | assert(false); |
| 128 | return; | 128 | return; |
| 129 | case FileTransfer::State::Negotiating: | 129 | case FileTransfer::State::Negotiating: |
diff --git a/Swift/Controllers/FileTransfer/FileTransferController.h b/Swift/Controllers/FileTransfer/FileTransferController.h index 3d6f7d5..490773d 100644 --- a/Swift/Controllers/FileTransfer/FileTransferController.h +++ b/Swift/Controllers/FileTransfer/FileTransferController.h | |||
| @@ -2,22 +2,29 @@ | |||
| 2 | * Copyright (c) 2011 Tobias Markmann | 2 | * Copyright (c) 2011 Tobias Markmann |
| 3 | * Licensed under the simplified BSD license. | 3 | * Licensed under the simplified BSD license. |
| 4 | * See Documentation/Licenses/BSD-simplified.txt for more information. | 4 | * See Documentation/Licenses/BSD-simplified.txt for more information. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | /* | ||
| 8 | * Copyright (c) 2015 Isode Limited. | ||
| 9 | * All rights reserved. | ||
| 10 | * See the COPYING file for more information. | ||
| 11 | */ | ||
| 12 | |||
| 7 | #pragma once | 13 | #pragma once |
| 8 | 14 | ||
| 9 | #include <string> | 15 | #include <string> |
| 10 | 16 | ||
| 11 | #include <boost/shared_ptr.hpp> | ||
| 12 | #include <boost/cstdint.hpp> | 17 | #include <boost/cstdint.hpp> |
| 18 | #include <boost/shared_ptr.hpp> | ||
| 13 | 19 | ||
| 14 | #include <Swiften/JID/JID.h> | ||
| 15 | #include <Swiften/FileTransfer/FileTransfer.h> | ||
| 16 | #include <Swiften/FileTransfer/IncomingFileTransfer.h> | ||
| 17 | #include <Swiften/FileTransfer/FileReadBytestream.h> | 20 | #include <Swiften/FileTransfer/FileReadBytestream.h> |
| 21 | #include <Swiften/FileTransfer/FileTransfer.h> | ||
| 18 | #include <Swiften/FileTransfer/FileWriteBytestream.h> | 22 | #include <Swiften/FileTransfer/FileWriteBytestream.h> |
| 23 | #include <Swiften/FileTransfer/IncomingFileTransfer.h> | ||
| 24 | #include <Swiften/JID/JID.h> | ||
| 25 | |||
| 19 | #include <Swift/Controllers/FileTransfer/FileTransferProgressInfo.h> | 26 | #include <Swift/Controllers/FileTransfer/FileTransferProgressInfo.h> |
| 20 | 27 | ||
| 21 | namespace Swift { | 28 | namespace Swift { |
| 22 | 29 | ||
| 23 | class FileTransferManager; | 30 | class FileTransferManager; |
| @@ -47,18 +54,18 @@ public: | |||
| 47 | bool isIncoming() const; | 54 | bool isIncoming() const; |
| 48 | FileTransfer::State getState() const; | 55 | FileTransfer::State getState() const; |
| 49 | int getProgress() const; | 56 | int getProgress() const; |
| 50 | boost::uintmax_t getSize() const; | 57 | boost::uintmax_t getSize() const; |
| 51 | 58 | ||
| 52 | boost::signal<void ()> onStateChage; | 59 | boost::signal<void ()> onStateChanged; |
| 53 | boost::signal<void ()> onProgressChange; | 60 | boost::signal<void ()> onProgressChange; |
| 54 | 61 | ||
| 55 | private: | 62 | private: |
| 56 | void handleFileTransferStateChange(FileTransfer::State); | 63 | void handleFileTransferStateChange(FileTransfer::State); |
| 57 | void handleProgressPercentageChange(int percentage); | 64 | void handleProgressPercentageChange(int percentage); |
| 58 | 65 | ||
| 59 | private: | 66 | private: |
| 60 | bool sending; | 67 | bool sending; |
| 61 | JID otherParty; | 68 | JID otherParty; |
| 62 | std::string filename; | 69 | std::string filename; |
| 63 | FileTransfer::ref transfer; | 70 | FileTransfer::ref transfer; |
| 64 | boost::shared_ptr<FileReadBytestream> fileReadStream; | 71 | boost::shared_ptr<FileReadBytestream> fileReadStream; |
diff --git a/Swift/Controllers/FileTransfer/FileTransferOverview.cpp b/Swift/Controllers/FileTransfer/FileTransferOverview.cpp index 2a8c319..b2afea9 100644 --- a/Swift/Controllers/FileTransfer/FileTransferOverview.cpp +++ b/Swift/Controllers/FileTransfer/FileTransferOverview.cpp | |||
| @@ -2,43 +2,91 @@ | |||
| 2 | * Copyright (c) 2011 Tobias Markmann | 2 | * Copyright (c) 2011 Tobias Markmann |
| 3 | * Licensed under the simplified BSD license. | 3 | * Licensed under the simplified BSD license. |
| 4 | * See Documentation/Licenses/BSD-simplified.txt for more information. | 4 | * See Documentation/Licenses/BSD-simplified.txt for more information. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | /* | ||
| 8 | * Copyright (c) 2015 Isode Limited. | ||
| 9 | * All rights reserved. | ||
| 10 | * See the COPYING file for more information. | ||
| 11 | */ | ||
| 12 | |||
| 7 | #include "FileTransferOverview.h" | 13 | #include "FileTransferOverview.h" |
| 8 | 14 | ||
| 9 | #include <boost/bind.hpp> | 15 | #include <boost/bind.hpp> |
| 10 | #include <boost/filesystem.hpp> | 16 | #include <boost/filesystem.hpp> |
| 11 | #include <Swiften/Base/boost_bsignals.h> | ||
| 12 | 17 | ||
| 18 | #include <Swiften/Base/Log.h> | ||
| 19 | #include <Swiften/Base/boost_bsignals.h> | ||
| 20 | #include <Swiften/Base/foreach.h> | ||
| 13 | #include <Swiften/FileTransfer/FileTransferManager.h> | 21 | #include <Swiften/FileTransfer/FileTransferManager.h> |
| 14 | 22 | ||
| 15 | namespace Swift { | 23 | namespace Swift { |
| 16 | 24 | ||
| 17 | FileTransferOverview::FileTransferOverview(FileTransferManager* ftm) : fileTransferManager(ftm) { | 25 | FileTransferOverview::FileTransferOverview(FileTransferManager* ftm) : fileTransferManager(ftm) { |
| 18 | fileTransferManager->onIncomingFileTransfer.connect(boost::bind(&FileTransferOverview::handleIncomingFileTransfer, this, _1)); | 26 | fileTransferManager->onIncomingFileTransfer.connect(boost::bind(&FileTransferOverview::handleIncomingFileTransfer, this, _1)); |
| 27 | onNewFileTransferController.connect(boost::bind(&FileTransferOverview::handleNewFileTransferController, this, _1)); | ||
| 19 | } | 28 | } |
| 20 | 29 | ||
| 21 | FileTransferOverview::~FileTransferOverview() { | 30 | FileTransferOverview::~FileTransferOverview() { |
| 22 | 31 | onNewFileTransferController.disconnect(boost::bind(&FileTransferOverview::handleNewFileTransferController, this, _1)); | |
| 32 | fileTransferManager->onIncomingFileTransfer.disconnect(boost::bind(&FileTransferOverview::handleIncomingFileTransfer, this, _1)); | ||
| 33 | foreach(FileTransferController* controller, fileTransfers) { | ||
| 34 | controller->onStateChanged.disconnect(boost::bind(&FileTransferOverview::handleFileTransferStateChanged, this)); | ||
| 35 | } | ||
| 23 | } | 36 | } |
| 24 | 37 | ||
| 25 | void FileTransferOverview::sendFile(const JID& jid, const std::string& filename) { | 38 | void FileTransferOverview::sendFile(const JID& jid, const std::string& filename) { |
| 26 | if (boost::filesystem::exists(filename) && boost::filesystem::file_size(filename) > 0) { | 39 | if (boost::filesystem::exists(filename) && boost::filesystem::file_size(filename) > 0) { |
| 27 | FileTransferController* controller = new FileTransferController(jid, filename, fileTransferManager); | 40 | FileTransferController* controller = new FileTransferController(jid, filename, fileTransferManager); |
| 28 | fileTransfers.push_back(controller); | ||
| 29 | |||
| 30 | onNewFileTransferController(controller); | 41 | onNewFileTransferController(controller); |
| 31 | } | 42 | } |
| 32 | } | 43 | } |
| 33 | 44 | ||
| 34 | void FileTransferOverview::handleIncomingFileTransfer(IncomingFileTransfer::ref transfer) { | 45 | void FileTransferOverview::handleIncomingFileTransfer(IncomingFileTransfer::ref transfer) { |
| 35 | FileTransferController* controller = new FileTransferController(transfer); | 46 | FileTransferController* controller = new FileTransferController(transfer); |
| 36 | fileTransfers.push_back(controller); | ||
| 37 | onNewFileTransferController(controller); | 47 | onNewFileTransferController(controller); |
| 38 | } | 48 | } |
| 39 | 49 | ||
| 50 | void FileTransferOverview::handleNewFileTransferController(FileTransferController* controller) { | ||
| 51 | fileTransfers.push_back(controller); | ||
| 52 | controller->onStateChanged.connect(boost::bind(&FileTransferOverview::handleFileTransferStateChanged, this)); | ||
| 53 | } | ||
| 54 | |||
| 55 | void FileTransferOverview::handleFileTransferStateChanged() { | ||
| 56 | onFileTransferListChanged(); | ||
| 57 | } | ||
| 58 | |||
| 40 | const std::vector<FileTransferController*>& FileTransferOverview::getFileTransfers() const { | 59 | const std::vector<FileTransferController*>& FileTransferOverview::getFileTransfers() const { |
| 41 | return fileTransfers; | 60 | return fileTransfers; |
| 42 | } | 61 | } |
| 43 | 62 | ||
| 63 | void FileTransferOverview::clearFinished() { | ||
| 64 | for (std::vector<FileTransferController*>::iterator it = fileTransfers.begin(); it != fileTransfers.end(); ) { | ||
| 65 | if((*it)->getState().type == FileTransfer::State::Finished | ||
| 66 | || (*it)->getState().type == FileTransfer::State::Failed | ||
| 67 | || (*it)->getState().type == FileTransfer::State::Canceled) { | ||
| 68 | FileTransferController* controller = *it; | ||
| 69 | it = fileTransfers.erase(it); | ||
| 70 | controller->onStateChanged.disconnect(boost::bind(&FileTransferOverview::handleFileTransferStateChanged, this)); | ||
| 71 | delete controller; | ||
| 72 | } else { | ||
| 73 | ++it; | ||
| 74 | } | ||
| 75 | } | ||
| 76 | onFileTransferListChanged(); | ||
| 77 | } | ||
| 78 | |||
| 79 | bool FileTransferOverview::isClearable() const { | ||
| 80 | bool isClearable = false; | ||
| 81 | foreach (FileTransferController* controller, fileTransfers) { | ||
| 82 | if(controller->getState().type == FileTransfer::State::Finished | ||
| 83 | || controller->getState().type == FileTransfer::State::Failed | ||
| 84 | || controller->getState().type == FileTransfer::State::Canceled) { | ||
| 85 | isClearable = true; | ||
| 86 | break; | ||
| 87 | } | ||
| 88 | } | ||
| 89 | return isClearable; | ||
| 90 | } | ||
| 91 | |||
| 44 | } | 92 | } |
diff --git a/Swift/Controllers/FileTransfer/FileTransferOverview.h b/Swift/Controllers/FileTransfer/FileTransferOverview.h index 716666a..e3cbf81 100644 --- a/Swift/Controllers/FileTransfer/FileTransferOverview.h +++ b/Swift/Controllers/FileTransfer/FileTransferOverview.h | |||
| @@ -2,18 +2,24 @@ | |||
| 2 | * Copyright (c) 2011 Tobias Markmann | 2 | * Copyright (c) 2011 Tobias Markmann |
| 3 | * Licensed under the simplified BSD license. | 3 | * Licensed under the simplified BSD license. |
| 4 | * See Documentation/Licenses/BSD-simplified.txt for more information. | 4 | * See Documentation/Licenses/BSD-simplified.txt for more information. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | /* | ||
| 8 | * Copyright (c) 2015 Isode Limited. | ||
| 9 | * All rights reserved. | ||
| 10 | * See the COPYING file for more information. | ||
| 11 | */ | ||
| 12 | |||
| 7 | #pragma once | 13 | #pragma once |
| 8 | 14 | ||
| 9 | #include <vector> | 15 | #include <vector> |
| 10 | 16 | ||
| 11 | #include "Swift/Controllers/FileTransfer/FileTransferController.h" | ||
| 12 | |||
| 13 | #include <Swiften/Base/boost_bsignals.h> | 17 | #include <Swiften/Base/boost_bsignals.h> |
| 14 | 18 | ||
| 19 | #include <Swift/Controllers/FileTransfer/FileTransferController.h> | ||
| 20 | |||
| 15 | namespace Swift { | 21 | namespace Swift { |
| 16 | 22 | ||
| 17 | class ChatsManager; | 23 | class ChatsManager; |
| 18 | class FileTransferManager; | 24 | class FileTransferManager; |
| 19 | 25 | ||
| @@ -22,15 +28,20 @@ public: | |||
| 22 | FileTransferOverview(FileTransferManager*); | 28 | FileTransferOverview(FileTransferManager*); |
| 23 | ~FileTransferOverview(); | 29 | ~FileTransferOverview(); |
| 24 | 30 | ||
| 25 | void sendFile(const JID&, const std::string&); | 31 | void sendFile(const JID&, const std::string&); |
| 26 | const std::vector<FileTransferController*>& getFileTransfers() const; | 32 | const std::vector<FileTransferController*>& getFileTransfers() const; |
| 33 | void clearFinished(); | ||
| 34 | bool isClearable() const; | ||
| 27 | 35 | ||
| 28 | boost::signal<void (FileTransferController*)> onNewFileTransferController; | 36 | boost::signal<void (FileTransferController*)> onNewFileTransferController; |
| 37 | boost::signal<void ()> onFileTransferListChanged; | ||
| 29 | 38 | ||
| 30 | private: | 39 | private: |
| 31 | void handleIncomingFileTransfer(IncomingFileTransfer::ref transfer); | 40 | void handleIncomingFileTransfer(IncomingFileTransfer::ref transfer); |
| 41 | void handleNewFileTransferController(FileTransferController* controller); | ||
| 42 | void handleFileTransferStateChanged(); | ||
| 32 | 43 | ||
| 33 | private: | 44 | private: |
| 34 | std::vector<FileTransferController*> fileTransfers; | 45 | std::vector<FileTransferController*> fileTransfers; |
| 35 | FileTransferManager *fileTransferManager; | 46 | FileTransferManager *fileTransferManager; |
| 36 | }; | 47 | }; |
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index a65a18a..cdaa207 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp | |||
| @@ -11,88 +11,88 @@ | |||
| 11 | #include <boost/bind.hpp> | 11 | #include <boost/bind.hpp> |
| 12 | #include <boost/lexical_cast.hpp> | 12 | #include <boost/lexical_cast.hpp> |
| 13 | #include <boost/shared_ptr.hpp> | 13 | #include <boost/shared_ptr.hpp> |
| 14 | #include <boost/smart_ptr/make_shared.hpp> | 14 | #include <boost/smart_ptr/make_shared.hpp> |
| 15 | 15 | ||
| 16 | #include <Swiften/Base/format.h> | ||
| 17 | #include <Swiften/Base/Algorithm.h> | 16 | #include <Swiften/Base/Algorithm.h> |
| 18 | #include <Swiften/Base/String.h> | 17 | #include <Swiften/Base/String.h> |
| 19 | #include <Swiften/StringCodecs/Base64.h> | ||
| 20 | #include <Swiften/Network/TimerFactory.h> | ||
| 21 | #include <Swiften/Client/Storages.h> | ||
| 22 | #include <Swiften/VCards/VCardManager.h> | ||
| 23 | #include <Swiften/Client/NickResolver.h> | ||
| 24 | #include <Swiften/Base/foreach.h> | 18 | #include <Swiften/Base/foreach.h> |
| 19 | #include <Swiften/Base/format.h> | ||
| 25 | #include <Swiften/Client/Client.h> | 20 | #include <Swiften/Client/Client.h> |
| 26 | #include <Swiften/Presence/PresenceSender.h> | 21 | #include <Swiften/Client/ClientBlockListManager.h> |
| 22 | #include <Swiften/Client/ClientXMLTracer.h> | ||
| 23 | #include <Swiften/Client/NickResolver.h> | ||
| 24 | #include <Swiften/Client/StanzaChannel.h> | ||
| 25 | #include <Swiften/Client/Storages.h> | ||
| 26 | #include <Swiften/Crypto/CryptoProvider.h> | ||
| 27 | #include <Swiften/Disco/CapsInfoGenerator.h> | ||
| 28 | #include <Swiften/Disco/ClientDiscoManager.h> | ||
| 29 | #include <Swiften/Disco/GetDiscoInfoRequest.h> | ||
| 27 | #include <Swiften/Elements/ChatState.h> | 30 | #include <Swiften/Elements/ChatState.h> |
| 31 | #include <Swiften/Elements/DiscoInfo.h> | ||
| 28 | #include <Swiften/Elements/Presence.h> | 32 | #include <Swiften/Elements/Presence.h> |
| 29 | #include <Swiften/Elements/VCardUpdate.h> | 33 | #include <Swiften/Elements/VCardUpdate.h> |
| 30 | #include <Swiften/Elements/DiscoInfo.h> | ||
| 31 | #include <Swiften/Disco/CapsInfoGenerator.h> | ||
| 32 | #include <Swiften/Disco/GetDiscoInfoRequest.h> | ||
| 33 | #include <Swiften/Disco/ClientDiscoManager.h> | ||
| 34 | #include <Swiften/VCards/GetVCardRequest.h> | ||
| 35 | #include <Swiften/StringCodecs/Hexify.h> | ||
| 36 | #include <Swiften/Network/NetworkFactories.h> | ||
| 37 | #include <Swiften/FileTransfer/FileTransferManager.h> | 34 | #include <Swiften/FileTransfer/FileTransferManager.h> |
| 38 | #include <Swiften/Client/ClientXMLTracer.h> | 35 | #include <Swiften/Network/NetworkFactories.h> |
| 39 | #include <Swiften/Client/StanzaChannel.h> | 36 | #include <Swiften/Network/TimerFactory.h> |
| 40 | #include <Swiften/Client/ClientBlockListManager.h> | 37 | #include <Swiften/Presence/PresenceSender.h> |
| 41 | #include <Swiften/Crypto/CryptoProvider.h> | 38 | #include <Swiften/StringCodecs/Base64.h> |
| 39 | #include <Swiften/StringCodecs/Hexify.h> | ||
| 40 | #include <Swiften/VCards/GetVCardRequest.h> | ||
| 41 | #include <Swiften/VCards/VCardManager.h> | ||
| 42 | 42 | ||
| 43 | #ifdef SWIFTEN_PLATFORM_WIN32 | 43 | #ifdef SWIFTEN_PLATFORM_WIN32 |
| 44 | #include <Swiften/SASL/WindowsAuthentication.h> | 44 | #include <Swiften/SASL/WindowsAuthentication.h> |
| 45 | #endif | 45 | #endif |
| 46 | 46 | ||
| 47 | #include <SwifTools/Dock/Dock.h> | 47 | #include <Swift/Controllers/AdHocManager.h> |
| 48 | #include <SwifTools/Notifier/TogglableNotifier.h> | 48 | #include <Swift/Controllers/BlockListController.h> |
| 49 | #include <SwifTools/Idle/IdleDetector.h> | ||
| 50 | |||
| 51 | #include <Swift/Controllers/Intl.h> | ||
| 52 | #include <Swift/Controllers/UIInterfaces/UIFactory.h> | ||
| 53 | #include <Swift/Controllers/BuildVersion.h> | 49 | #include <Swift/Controllers/BuildVersion.h> |
| 54 | #include <Swift/Controllers/Chat/UserSearchController.h> | ||
| 55 | #include <Swift/Controllers/Chat/ChatsManager.h> | 50 | #include <Swift/Controllers/Chat/ChatsManager.h> |
| 56 | #include <Swift/Controllers/XMPPEvents/EventController.h> | ||
| 57 | #include <Swift/Controllers/EventWindowController.h> | ||
| 58 | #include <Swift/Controllers/UIInterfaces/LoginWindow.h> | ||
| 59 | #include <Swift/Controllers/UIInterfaces/LoginWindowFactory.h> | ||
| 60 | #include <Swift/Controllers/UIInterfaces/MainWindow.h> | ||
| 61 | #include <Swift/Controllers/Chat/MUCController.h> | 51 | #include <Swift/Controllers/Chat/MUCController.h> |
| 52 | #include <Swift/Controllers/Chat/UserSearchController.h> | ||
| 53 | #include <Swift/Controllers/ContactEditController.h> | ||
| 54 | #include <Swift/Controllers/ContactSuggester.h> | ||
| 55 | #include <Swift/Controllers/ContactsFromXMPPRoster.h> | ||
| 56 | #include <Swift/Controllers/EventNotifier.h> | ||
| 57 | #include <Swift/Controllers/EventWindowController.h> | ||
| 58 | #include <Swift/Controllers/FileTransfer/FileTransferOverview.h> | ||
| 59 | #include <Swift/Controllers/FileTransferListController.h> | ||
| 60 | #include <Swift/Controllers/HighlightEditorController.h> | ||
| 61 | #include <Swift/Controllers/HighlightManager.h> | ||
| 62 | #include <Swift/Controllers/HistoryController.h> | ||
| 63 | #include <Swift/Controllers/HistoryViewController.h> | ||
| 64 | #include <Swift/Controllers/Intl.h> | ||
| 65 | #include <Swift/Controllers/PresenceNotifier.h> | ||
| 66 | #include <Swift/Controllers/ProfileController.h> | ||
| 62 | #include <Swift/Controllers/Roster/RosterController.h> | 67 | #include <Swift/Controllers/Roster/RosterController.h> |
| 68 | #include <Swift/Controllers/SettingConstants.h> | ||
| 69 | #include <Swift/Controllers/Settings/SettingsProvider.h> | ||
| 70 | #include <Swift/Controllers/ShowProfileController.h> | ||
| 63 | #include <Swift/Controllers/SoundEventController.h> | 71 | #include <Swift/Controllers/SoundEventController.h> |
| 64 | #include <Swift/Controllers/SoundPlayer.h> | 72 | #include <Swift/Controllers/SoundPlayer.h> |
| 65 | #include <Swift/Controllers/StatusTracker.h> | 73 | #include <Swift/Controllers/StatusTracker.h> |
| 74 | #include <Swift/Controllers/Storages/CertificateStorageFactory.h> | ||
| 75 | #include <Swift/Controllers/Storages/CertificateStorageTrustChecker.h> | ||
| 76 | #include <Swift/Controllers/Storages/StoragesFactory.h> | ||
| 66 | #include <Swift/Controllers/SystemTray.h> | 77 | #include <Swift/Controllers/SystemTray.h> |
| 67 | #include <Swift/Controllers/SystemTrayController.h> | 78 | #include <Swift/Controllers/SystemTrayController.h> |
| 68 | #include <Swift/Controllers/XMLConsoleController.h> | 79 | #include <Swift/Controllers/UIEvents/JoinMUCUIEvent.h> |
| 69 | #include <Swift/Controllers/HistoryController.h> | 80 | #include <Swift/Controllers/UIEvents/RequestChatUIEvent.h> |
| 70 | #include <Swift/Controllers/HistoryViewController.h> | ||
| 71 | #include <Swift/Controllers/FileTransferListController.h> | ||
| 72 | #include <Swift/Controllers/UIEvents/UIEventStream.h> | 81 | #include <Swift/Controllers/UIEvents/UIEventStream.h> |
| 73 | #include <Swift/Controllers/PresenceNotifier.h> | 82 | #include <Swift/Controllers/UIInterfaces/LoginWindow.h> |
| 74 | #include <Swift/Controllers/EventNotifier.h> | 83 | #include <Swift/Controllers/UIInterfaces/LoginWindowFactory.h> |
| 75 | #include <Swift/Controllers/Storages/StoragesFactory.h> | 84 | #include <Swift/Controllers/UIInterfaces/MainWindow.h> |
| 85 | #include <Swift/Controllers/UIInterfaces/UIFactory.h> | ||
| 76 | #include <Swift/Controllers/WhiteboardManager.h> | 86 | #include <Swift/Controllers/WhiteboardManager.h> |
| 77 | #include <Swift/Controllers/Settings/SettingsProvider.h> | 87 | #include <Swift/Controllers/XMLConsoleController.h> |
| 78 | #include <Swift/Controllers/UIEvents/RequestChatUIEvent.h> | 88 | #include <Swift/Controllers/XMPPEvents/EventController.h> |
| 79 | #include <Swift/Controllers/UIEvents/JoinMUCUIEvent.h> | ||
| 80 | #include <Swift/Controllers/Storages/CertificateStorageFactory.h> | ||
| 81 | #include <Swift/Controllers/Storages/CertificateStorageTrustChecker.h> | ||
| 82 | #include <Swift/Controllers/ProfileController.h> | ||
| 83 | #include <Swift/Controllers/ShowProfileController.h> | ||
| 84 | #include <Swift/Controllers/ContactEditController.h> | ||
| 85 | #include <Swift/Controllers/XMPPURIController.h> | 89 | #include <Swift/Controllers/XMPPURIController.h> |
| 86 | #include <Swift/Controllers/AdHocManager.h> | 90 | |
| 87 | #include <Swift/Controllers/FileTransfer/FileTransferOverview.h> | 91 | #include <SwifTools/Dock/Dock.h> |
| 88 | #include <Swift/Controllers/SettingConstants.h> | 92 | #include <SwifTools/Idle/IdleDetector.h> |
| 89 | #include <Swift/Controllers/HighlightManager.h> | 93 | #include <SwifTools/Notifier/TogglableNotifier.h> |
| 90 | #include <Swift/Controllers/HighlightEditorController.h> | ||
| 91 | #include <Swift/Controllers/BlockListController.h> | ||
| 92 | #include <Swift/Controllers/ContactSuggester.h> | ||
| 93 | #include <Swift/Controllers/ContactsFromXMPPRoster.h> | ||
| 94 | 94 | ||
| 95 | namespace Swift { | 95 | namespace Swift { |
| 96 | 96 | ||
| 97 | static const std::string CLIENT_NAME = "Swift"; | 97 | static const std::string CLIENT_NAME = "Swift"; |
| 98 | static const std::string CLIENT_NODE = "http://swift.im"; | 98 | static const std::string CLIENT_NODE = "http://swift.im"; |
| @@ -268,10 +268,11 @@ void MainController::resetClient() { | |||
| 268 | delete historyViewController_; | 268 | delete historyViewController_; |
| 269 | historyViewController_ = NULL; | 269 | historyViewController_ = NULL; |
| 270 | delete historyController_; | 270 | delete historyController_; |
| 271 | historyController_ = NULL; | 271 | historyController_ = NULL; |
| 272 | #endif | 272 | #endif |
| 273 | fileTransferListController_->setFileTransferOverview(NULL); | ||
| 273 | delete ftOverview_; | 274 | delete ftOverview_; |
| 274 | ftOverview_ = NULL; | 275 | ftOverview_ = NULL; |
| 275 | delete blockListController_; | 276 | delete blockListController_; |
| 276 | blockListController_ = NULL; | 277 | blockListController_ = NULL; |
| 277 | delete rosterController_; | 278 | delete rosterController_; |
diff --git a/Swift/QtUI/QtFileTransferListItemModel.cpp b/Swift/QtUI/QtFileTransferListItemModel.cpp index b9b9fd1..ef73f4f 100644 --- a/Swift/QtUI/QtFileTransferListItemModel.cpp +++ b/Swift/QtUI/QtFileTransferListItemModel.cpp | |||
| @@ -2,39 +2,68 @@ | |||
| 2 | * Copyright (c) 2011 Tobias Markmann | 2 | * Copyright (c) 2011 Tobias Markmann |
| 3 | * Licensed under the simplified BSD license. | 3 | * Licensed under the simplified BSD license. |
| 4 | * See Documentation/Licenses/BSD-simplified.txt for more information. | 4 | * See Documentation/Licenses/BSD-simplified.txt for more information. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #include "QtFileTransferListItemModel.h" | 7 | /* |
| 8 | * Copyright (c) 2015 Isode Limited. | ||
| 9 | * All rights reserved. | ||
| 10 | * See the COPYING file for more information. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include <Swift/QtUI/QtFileTransferListItemModel.h> | ||
| 8 | 14 | ||
| 9 | #include <boost/bind.hpp> | 15 | #include <boost/bind.hpp> |
| 10 | #include <boost/cstdint.hpp> | 16 | #include <boost/cstdint.hpp> |
| 11 | 17 | ||
| 12 | #include <Swiften/Base/boost_bsignals.h> | ||
| 13 | #include <Swiften/Base/FileSize.h> | 18 | #include <Swiften/Base/FileSize.h> |
| 19 | #include <Swiften/Base/boost_bsignals.h> | ||
| 20 | |||
| 14 | #include <Swift/Controllers/FileTransfer/FileTransferController.h> | 21 | #include <Swift/Controllers/FileTransfer/FileTransferController.h> |
| 15 | #include <Swift/Controllers/FileTransfer/FileTransferOverview.h> | 22 | #include <Swift/Controllers/FileTransfer/FileTransferOverview.h> |
| 16 | #include "QtSwiftUtil.h" | 23 | |
| 24 | #include <Swift/QtUI/QtSwiftUtil.h> | ||
| 17 | 25 | ||
| 18 | namespace Swift { | 26 | namespace Swift { |
| 19 | 27 | ||
| 20 | QtFileTransferListItemModel::QtFileTransferListItemModel(QObject *parent) : QAbstractItemModel(parent), fileTransferOverview(0) { | 28 | QtFileTransferListItemModel::QtFileTransferListItemModel(QObject *parent) : QAbstractItemModel(parent), fileTransferOverview(0) { |
| 21 | } | 29 | } |
| 22 | 30 | ||
| 31 | QtFileTransferListItemModel::~QtFileTransferListItemModel() { | ||
| 32 | if (fileTransferOverview) { | ||
| 33 | fileTransferOverview->onNewFileTransferController.disconnect(boost::bind(&QtFileTransferListItemModel::handleNewFileTransferController, this, _1)); | ||
| 34 | fileTransferOverview->onFileTransferListChanged.disconnect(boost::bind(&QtFileTransferListItemModel::handleFileTransferListChanged, this)); | ||
| 35 | } | ||
| 36 | } | ||
| 37 | |||
| 23 | void QtFileTransferListItemModel::setFileTransferOverview(FileTransferOverview *overview) { | 38 | void QtFileTransferListItemModel::setFileTransferOverview(FileTransferOverview *overview) { |
| 39 | if (fileTransferOverview) { | ||
| 40 | fileTransferOverview->onNewFileTransferController.disconnect(boost::bind(&QtFileTransferListItemModel::handleNewFileTransferController, this, _1)); | ||
| 41 | fileTransferOverview->onFileTransferListChanged.disconnect(boost::bind(&QtFileTransferListItemModel::handleFileTransferListChanged, this)); | ||
| 42 | } | ||
| 24 | fileTransferOverview = overview; | 43 | fileTransferOverview = overview; |
| 25 | fileTransferOverview->onNewFileTransferController.connect(boost::bind(&QtFileTransferListItemModel::handleNewFileTransferController, this, _1)); | 44 | if (fileTransferOverview) { |
| 45 | fileTransferOverview->onNewFileTransferController.connect(boost::bind(&QtFileTransferListItemModel::handleNewFileTransferController, this, _1)); | ||
| 46 | fileTransferOverview->onFileTransferListChanged.connect(boost::bind(&QtFileTransferListItemModel::handleFileTransferListChanged, this)); | ||
| 47 | } | ||
| 48 | emit layoutAboutToBeChanged(); | ||
| 49 | emit layoutChanged(); | ||
| 26 | } | 50 | } |
| 27 | 51 | ||
| 28 | void QtFileTransferListItemModel::handleNewFileTransferController(FileTransferController* newController) { | 52 | void QtFileTransferListItemModel::handleNewFileTransferController(FileTransferController* newController) { |
| 29 | emit layoutAboutToBeChanged(); | 53 | emit layoutAboutToBeChanged(); |
| 30 | emit layoutChanged(); | 54 | emit layoutChanged(); |
| 31 | dataChanged(createIndex(0,0), createIndex(fileTransferOverview->getFileTransfers().size(),4)); | 55 | dataChanged(createIndex(0,0), createIndex(fileTransferOverview->getFileTransfers().size(),4)); |
| 32 | newController->onStateChage.connect(boost::bind(&QtFileTransferListItemModel::handleStateChange, this, fileTransferOverview->getFileTransfers().size() - 1)); | 56 | newController->onStateChanged.connect(boost::bind(&QtFileTransferListItemModel::handleStateChange, this, fileTransferOverview->getFileTransfers().size() - 1)); |
| 33 | newController->onProgressChange.connect(boost::bind(&QtFileTransferListItemModel::handleProgressChange, this, fileTransferOverview->getFileTransfers().size() - 1)); | 57 | newController->onProgressChange.connect(boost::bind(&QtFileTransferListItemModel::handleProgressChange, this, fileTransferOverview->getFileTransfers().size() - 1)); |
| 34 | } | 58 | } |
| 35 | 59 | ||
| 60 | void QtFileTransferListItemModel::handleFileTransferListChanged() { | ||
| 61 | emit layoutAboutToBeChanged(); | ||
| 62 | emit layoutChanged(); | ||
| 63 | } | ||
| 64 | |||
| 36 | void QtFileTransferListItemModel::handleStateChange(int index) { | 65 | void QtFileTransferListItemModel::handleStateChange(int index) { |
| 37 | emit dataChanged(createIndex(index, 2), createIndex(index, 2)); | 66 | emit dataChanged(createIndex(index, 2), createIndex(index, 2)); |
| 38 | } | 67 | } |
| 39 | 68 | ||
| 40 | void QtFileTransferListItemModel::handleProgressChange(int index) { | 69 | void QtFileTransferListItemModel::handleProgressChange(int index) { |
diff --git a/Swift/QtUI/QtFileTransferListItemModel.h b/Swift/QtUI/QtFileTransferListItemModel.h index 28f13f8..64cdca4 100644 --- a/Swift/QtUI/QtFileTransferListItemModel.h +++ b/Swift/QtUI/QtFileTransferListItemModel.h | |||
| @@ -2,10 +2,16 @@ | |||
| 2 | * Copyright (c) 2011 Tobias Markmann | 2 | * Copyright (c) 2011 Tobias Markmann |
| 3 | * Licensed under the simplified BSD license. | 3 | * Licensed under the simplified BSD license. |
| 4 | * See Documentation/Licenses/BSD-simplified.txt for more information. | 4 | * See Documentation/Licenses/BSD-simplified.txt for more information. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | /* | ||
| 8 | * Copyright (c) 2015 Isode Limited. | ||
| 9 | * All rights reserved. | ||
| 10 | * See the COPYING file for more information. | ||
| 11 | */ | ||
| 12 | |||
| 7 | #pragma once | 13 | #pragma once |
| 8 | 14 | ||
| 9 | #include <QAbstractItemModel> | 15 | #include <QAbstractItemModel> |
| 10 | 16 | ||
| 11 | namespace Swift { | 17 | namespace Swift { |
| @@ -15,10 +21,11 @@ class FileTransferOverview; | |||
| 15 | 21 | ||
| 16 | class QtFileTransferListItemModel : public QAbstractItemModel { | 22 | class QtFileTransferListItemModel : public QAbstractItemModel { |
| 17 | Q_OBJECT | 23 | Q_OBJECT |
| 18 | public: | 24 | public: |
| 19 | explicit QtFileTransferListItemModel(QObject *parent = 0); | 25 | explicit QtFileTransferListItemModel(QObject *parent = 0); |
| 26 | virtual ~QtFileTransferListItemModel(); | ||
| 20 | 27 | ||
| 21 | void setFileTransferOverview(FileTransferOverview*); | 28 | void setFileTransferOverview(FileTransferOverview*); |
| 22 | 29 | ||
| 23 | QVariant headerData(int section, Qt::Orientation orientation, int role) const; | 30 | QVariant headerData(int section, Qt::Orientation orientation, int role) const; |
| 24 | int columnCount(const QModelIndex &parent) const; | 31 | int columnCount(const QModelIndex &parent) const; |
| @@ -37,10 +44,11 @@ private: | |||
| 37 | NoOfColumns | 44 | NoOfColumns |
| 38 | }; | 45 | }; |
| 39 | 46 | ||
| 40 | private: | 47 | private: |
| 41 | void handleNewFileTransferController(FileTransferController*); | 48 | void handleNewFileTransferController(FileTransferController*); |
| 49 | void handleFileTransferListChanged(); | ||
| 42 | void handleStateChange(int index); | 50 | void handleStateChange(int index); |
| 43 | void handleProgressChange(int index); | 51 | void handleProgressChange(int index); |
| 44 | 52 | ||
| 45 | signals: | 53 | signals: |
| 46 | 54 | ||
diff --git a/Swift/QtUI/QtFileTransferListWidget.cpp b/Swift/QtUI/QtFileTransferListWidget.cpp index fb2b4de..729c95f 100644 --- a/Swift/QtUI/QtFileTransferListWidget.cpp +++ b/Swift/QtUI/QtFileTransferListWidget.cpp | |||
| @@ -2,18 +2,28 @@ | |||
| 2 | * Copyright (c) 2011 Tobias Markmann | 2 | * Copyright (c) 2011 Tobias Markmann |
| 3 | * Licensed under the simplified BSD license. | 3 | * Licensed under the simplified BSD license. |
| 4 | * See Documentation/Licenses/BSD-simplified.txt for more information. | 4 | * See Documentation/Licenses/BSD-simplified.txt for more information. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #include "QtFileTransferListWidget.h" | 7 | /* |
| 8 | * Copyright (c) 2015 Isode Limited. | ||
| 9 | * All rights reserved. | ||
| 10 | * See the COPYING file for more information. | ||
| 11 | */ | ||
| 8 | 12 | ||
| 9 | #include <Swift/QtUI/QtFileTransferListItemModel.h> | 13 | #include <Swift/QtUI/QtFileTransferListWidget.h> |
| 14 | |||
| 15 | #include <boost/bind.hpp> | ||
| 10 | 16 | ||
| 11 | #include <QVBoxLayout> | ||
| 12 | #include <QHBoxLayout> | 17 | #include <QHBoxLayout> |
| 13 | #include <QWidget> | ||
| 14 | #include <QPushButton> | 18 | #include <QPushButton> |
| 19 | #include <QVBoxLayout> | ||
| 20 | #include <QWidget> | ||
| 21 | |||
| 22 | #include <Swift/Controllers/FileTransfer/FileTransferOverview.h> | ||
| 23 | |||
| 24 | #include <Swift/QtUI/QtFileTransferListItemModel.h> | ||
| 15 | 25 | ||
| 16 | namespace Swift { | 26 | namespace Swift { |
| 17 | 27 | ||
| 18 | QtFileTransferListWidget::QtFileTransferListWidget() : fileTransferOverview(0) { | 28 | QtFileTransferListWidget::QtFileTransferListWidget() : fileTransferOverview(0) { |
| 19 | QVBoxLayout* layout = new QVBoxLayout(this); | 29 | QVBoxLayout* layout = new QVBoxLayout(this); |
| @@ -34,40 +44,60 @@ QtFileTransferListWidget::QtFileTransferListWidget() : fileTransferOverview(0) { | |||
| 34 | 44 | ||
| 35 | QHBoxLayout* buttonLayout = new QHBoxLayout(bottom); | 45 | QHBoxLayout* buttonLayout = new QHBoxLayout(bottom); |
| 36 | buttonLayout->setContentsMargins(10,0,20,0); | 46 | buttonLayout->setContentsMargins(10,0,20,0); |
| 37 | buttonLayout->setSpacing(0); | 47 | buttonLayout->setSpacing(0); |
| 38 | 48 | ||
| 39 | QPushButton* clearFinished = new QPushButton(tr("Clear Finished Transfers"), bottom); | 49 | clearFinished = new QPushButton(tr("Clear Inactive Transfers"), bottom); |
| 40 | clearFinished->setEnabled(false); | 50 | clearFinished->setEnabled(false); |
| 41 | //connect(clearButton, SIGNAL(clicked()), textEdit, SLOT(clear())); | 51 | connect(clearFinished, SIGNAL(clicked()), this, SLOT(clearInactiveTransfers())); |
| 42 | buttonLayout->addWidget(clearFinished); | 52 | buttonLayout->addWidget(clearFinished); |
| 43 | 53 | ||
| 44 | setWindowTitle(tr("File Transfer List")); | 54 | setWindowTitle(tr("File Transfer List")); |
| 45 | emit titleUpdated(); | 55 | emit titleUpdated(); |
| 46 | } | 56 | } |
| 47 | 57 | ||
| 48 | QtFileTransferListWidget::~QtFileTransferListWidget() { | 58 | QtFileTransferListWidget::~QtFileTransferListWidget() { |
| 59 | if (fileTransferOverview) { | ||
| 60 | fileTransferOverview->onFileTransferListChanged.disconnect(boost::bind(&QtFileTransferListWidget::handleFileTransferListChanged, this)); | ||
| 61 | fileTransferOverview = NULL; | ||
| 62 | } | ||
| 49 | delete itemModel; | 63 | delete itemModel; |
| 50 | } | 64 | } |
| 51 | 65 | ||
| 52 | void QtFileTransferListWidget::showEvent(QShowEvent* event) { | 66 | void QtFileTransferListWidget::showEvent(QShowEvent* event) { |
| 53 | emit windowOpening(); | 67 | emit windowOpening(); |
| 54 | emit titleUpdated(); /* This just needs to be somewhere after construction */ | 68 | emit titleUpdated(); /* This just needs to be somewhere after construction */ |
| 55 | QWidget::showEvent(event); | 69 | QWidget::showEvent(event); |
| 56 | } | 70 | } |
| 57 | 71 | ||
| 72 | void QtFileTransferListWidget::handleFileTransferListChanged() { | ||
| 73 | clearFinished->setEnabled(fileTransferOverview->isClearable()); | ||
| 74 | } | ||
| 75 | |||
| 76 | void QtFileTransferListWidget::clearInactiveTransfers() { | ||
| 77 | fileTransferOverview->clearFinished(); | ||
| 78 | } | ||
| 79 | |||
| 58 | void QtFileTransferListWidget::show() { | 80 | void QtFileTransferListWidget::show() { |
| 59 | QWidget::show(); | 81 | QWidget::show(); |
| 60 | emit windowOpening(); | 82 | emit windowOpening(); |
| 61 | } | 83 | } |
| 62 | 84 | ||
| 63 | void QtFileTransferListWidget::activate() { | 85 | void QtFileTransferListWidget::activate() { |
| 64 | emit wantsToActivate(); | 86 | emit wantsToActivate(); |
| 65 | } | 87 | } |
| 66 | 88 | ||
| 67 | void QtFileTransferListWidget::setFileTransferOverview(FileTransferOverview *overview) { | 89 | void QtFileTransferListWidget::setFileTransferOverview(FileTransferOverview *overview) { |
| 68 | fileTransferOverview = overview; | 90 | if (fileTransferOverview) { |
| 91 | fileTransferOverview->onFileTransferListChanged.disconnect(boost::bind(&QtFileTransferListWidget::handleFileTransferListChanged, this)); | ||
| 92 | fileTransferOverview = NULL; | ||
| 93 | } | ||
| 94 | if (overview) { | ||
| 95 | fileTransferOverview = overview; | ||
| 96 | fileTransferOverview->onFileTransferListChanged.connect(boost::bind(&QtFileTransferListWidget::handleFileTransferListChanged, this)); | ||
| 97 | clearFinished->setEnabled(fileTransferOverview->isClearable()); | ||
| 98 | } | ||
| 69 | itemModel->setFileTransferOverview(overview); | 99 | itemModel->setFileTransferOverview(overview); |
| 70 | } | 100 | } |
| 71 | 101 | ||
| 72 | std::string QtFileTransferListWidget::getID() const { | 102 | std::string QtFileTransferListWidget::getID() const { |
| 73 | return "QtFileTransferListWidget"; | 103 | return "QtFileTransferListWidget"; |
diff --git a/Swift/QtUI/QtFileTransferListWidget.h b/Swift/QtUI/QtFileTransferListWidget.h index 8adc009..740eb15 100644 --- a/Swift/QtUI/QtFileTransferListWidget.h +++ b/Swift/QtUI/QtFileTransferListWidget.h | |||
| @@ -2,20 +2,27 @@ | |||
| 2 | * Copyright (c) 2011 Tobias Markmann | 2 | * Copyright (c) 2011 Tobias Markmann |
| 3 | * Licensed under the simplified BSD license. | 3 | * Licensed under the simplified BSD license. |
| 4 | * See Documentation/Licenses/BSD-simplified.txt for more information. | 4 | * See Documentation/Licenses/BSD-simplified.txt for more information. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #pragma once | 7 | /* |
| 8 | 8 | * Copyright (c) 2015 Isode Limited. | |
| 9 | #include "Swift/Controllers/UIInterfaces/FileTransferListWidget.h" | 9 | * All rights reserved. |
| 10 | * See the COPYING file for more information. | ||
| 11 | */ | ||
| 10 | 12 | ||
| 11 | #include "QtTabbable.h" | 13 | #pragma once |
| 12 | 14 | ||
| 13 | #include <QCloseEvent> | 15 | #include <QCloseEvent> |
| 16 | #include <QPushButton> | ||
| 14 | #include <QShowEvent> | 17 | #include <QShowEvent> |
| 15 | #include <QTreeView> | 18 | #include <QTreeView> |
| 16 | 19 | ||
| 20 | #include <Swift/Controllers/UIInterfaces/FileTransferListWidget.h> | ||
| 21 | |||
| 22 | #include <Swift/QtUI/QtTabbable.h> | ||
| 23 | |||
| 17 | namespace Swift { | 24 | namespace Swift { |
| 18 | 25 | ||
| 19 | class FileTransferOverview; | 26 | class FileTransferOverview; |
| 20 | class QtFileTransferListItemModel; | 27 | class QtFileTransferListItemModel; |
| 21 | 28 | ||
| @@ -34,14 +41,19 @@ public: | |||
| 34 | virtual std::string getID() const; | 41 | virtual std::string getID() const; |
| 35 | 42 | ||
| 36 | private: | 43 | private: |
| 37 | virtual void closeEvent(QCloseEvent* event); | 44 | virtual void closeEvent(QCloseEvent* event); |
| 38 | virtual void showEvent(QShowEvent* event); | 45 | virtual void showEvent(QShowEvent* event); |
| 46 | void handleFileTransferListChanged(); | ||
| 47 | |||
| 48 | private slots: | ||
| 49 | void clearInactiveTransfers(); | ||
| 39 | 50 | ||
| 40 | private: | 51 | private: |
| 41 | QTreeView* treeView; | 52 | QTreeView* treeView; |
| 42 | 53 | ||
| 43 | QtFileTransferListItemModel* itemModel; | 54 | QtFileTransferListItemModel* itemModel; |
| 44 | FileTransferOverview* fileTransferOverview; | 55 | FileTransferOverview* fileTransferOverview; |
| 56 | QPushButton* clearFinished; | ||
| 45 | }; | 57 | }; |
| 46 | 58 | ||
| 47 | } | 59 | } |
Swift