diff options
| author | Tobias Markmann <tm@ayena.de> | 2015-06-22 09:06:58 (GMT) |
|---|---|---|
| committer | Tobias Markmann <tm@ayena.de> | 2015-07-10 11:46:50 (GMT) |
| commit | ed7a1fbf61d7879fd33896f36effd2f154753438 (patch) | |
| tree | 4904bf7298a7b25ece1e56c6d29aace1a60e9020 | |
| parent | 84dcfb6263b46b62504706d69198675690f759be (diff) | |
| download | swift-ed7a1fbf61d7879fd33896f36effd2f154753438.zip swift-ed7a1fbf61d7879fd33896f36effd2f154753438.tar.bz2 | |
Show collecting of file transfer candidates in UI
Show the user the collection of possible file transfer candidates
after pressing the 'Start' button for a file transfer. Previously the
buttons remained in the UI giving no feedback to the user at all. If
no UPnP/NAT-PMP device is present, it this stage can take a couple
seconds to timeout and move on to the next stage.
Furthermore this commit adds documentation for the different states
in the ChatWindow::FileTransferState enum.
Test-Information:
Tested this in a network environment with no UPnP/NAT-PMP device
between two Swift instances.
Change-Id: I76ec6e641a2acd683938fe2d8f542d023a244145
| -rw-r--r-- | Swift/Controllers/FileTransfer/FileTransferController.cpp | 1 | ||||
| -rw-r--r-- | Swift/Controllers/UIInterfaces/ChatWindow.h | 10 | ||||
| -rw-r--r-- | Swift/QtUI/QtPlainChatView.cpp | 23 | ||||
| -rw-r--r-- | Swift/QtUI/QtWebKitChatView.cpp | 14 |
4 files changed, 34 insertions, 14 deletions
diff --git a/Swift/Controllers/FileTransfer/FileTransferController.cpp b/Swift/Controllers/FileTransfer/FileTransferController.cpp index 076d3c0..f7ce8e6 100644 --- a/Swift/Controllers/FileTransfer/FileTransferController.cpp +++ b/Swift/Controllers/FileTransfer/FileTransferController.cpp | |||
| @@ -146,10 +146,11 @@ void FileTransferController::handleFileTransferStateChange(FileTransfer::State s | |||
| 146 | return; | 146 | return; |
| 147 | case FileTransfer::State::WaitingForAccept: | 147 | case FileTransfer::State::WaitingForAccept: |
| 148 | chatWindow->setFileTransferStatus(uiID, ChatWindow::WaitingForAccept); | 148 | chatWindow->setFileTransferStatus(uiID, ChatWindow::WaitingForAccept); |
| 149 | return; | 149 | return; |
| 150 | case FileTransfer::State::WaitingForStart: | 150 | case FileTransfer::State::WaitingForStart: |
| 151 | chatWindow->setFileTransferStatus(uiID, ChatWindow::Initialisation); | ||
| 151 | return; | 152 | return; |
| 152 | } | 153 | } |
| 153 | assert(false); | 154 | assert(false); |
| 154 | } | 155 | } |
| 155 | 156 | ||
diff --git a/Swift/Controllers/UIInterfaces/ChatWindow.h b/Swift/Controllers/UIInterfaces/ChatWindow.h index b1e2a11..0fa734c 100644 --- a/Swift/Controllers/UIInterfaces/ChatWindow.h +++ b/Swift/Controllers/UIInterfaces/ChatWindow.h | |||
| @@ -87,11 +87,19 @@ namespace Swift { | |||
| 87 | 87 | ||
| 88 | enum AckState {Pending, Received, Failed}; | 88 | enum AckState {Pending, Received, Failed}; |
| 89 | enum ReceiptState {ReceiptRequested, ReceiptReceived, ReceiptFailed}; | 89 | enum ReceiptState {ReceiptRequested, ReceiptReceived, ReceiptFailed}; |
| 90 | enum OccupantAction {Kick, Ban, MakeModerator, MakeParticipant, MakeVisitor, AddContact, ShowProfile}; | 90 | enum OccupantAction {Kick, Ban, MakeModerator, MakeParticipant, MakeVisitor, AddContact, ShowProfile}; |
| 91 | enum RoomAction {ChangeSubject, Configure, Affiliations, Destroy, Invite}; | 91 | enum RoomAction {ChangeSubject, Configure, Affiliations, Destroy, Invite}; |
| 92 | enum FileTransferState {WaitingForAccept, Negotiating, Transferring, Canceled, Finished, FTFailed}; | 92 | enum FileTransferState { |
| 93 | Initialisation, ///< Collecting information required for sending the request out. | ||
| 94 | WaitingForAccept, ///< The file transfer request was send out. | ||
| 95 | Negotiating, ///< The other party accepted the file transfer request and a suitable transfer method is negotiated. | ||
| 96 | Transferring, ///< The negotiation was successful and the file is currently transferred. | ||
| 97 | Canceled, ///< Someone actively canceled the transfer. | ||
| 98 | Finished, ///< The file was transferred successfully. | ||
| 99 | FTFailed ///< The negotiation, the transfer itself or the verification failed. | ||
| 100 | }; | ||
| 93 | enum WhiteboardSessionState {WhiteboardAccepted, WhiteboardTerminated, WhiteboardRejected}; | 101 | enum WhiteboardSessionState {WhiteboardAccepted, WhiteboardTerminated, WhiteboardRejected}; |
| 94 | enum BlockingState {BlockingUnsupported, IsBlocked, IsUnblocked}; | 102 | enum BlockingState {BlockingUnsupported, IsBlocked, IsUnblocked}; |
| 95 | enum Direction { UnknownDirection, DefaultDirection }; | 103 | enum Direction { UnknownDirection, DefaultDirection }; |
| 96 | enum MUCType { StandardMUC, ImpromptuMUC }; | 104 | enum MUCType { StandardMUC, ImpromptuMUC }; |
| 97 | enum TimestampBehaviour { KeepTimestamp, UpdateTimestamp }; | 105 | enum TimestampBehaviour { KeepTimestamp, UpdateTimestamp }; |
diff --git a/Swift/QtUI/QtPlainChatView.cpp b/Swift/QtUI/QtPlainChatView.cpp index 031a41d..eabf35f 100644 --- a/Swift/QtUI/QtPlainChatView.cpp +++ b/Swift/QtUI/QtPlainChatView.cpp | |||
| @@ -4,26 +4,26 @@ | |||
| 4 | * See the COPYING file for more information. | 4 | * See the COPYING file for more information. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #include <Swift/QtUI/QtPlainChatView.h> | 7 | #include <Swift/QtUI/QtPlainChatView.h> |
| 8 | 8 | ||
| 9 | #include <QTextEdit> | ||
| 10 | #include <QScrollBar> | ||
| 11 | #include <QVBoxLayout> | ||
| 12 | #include <QPushButton> | ||
| 13 | #include <QLabel> | ||
| 14 | #include <QDialog> | 9 | #include <QDialog> |
| 15 | #include <QProgressBar> | ||
| 16 | #include <QFileDialog> | 10 | #include <QFileDialog> |
| 17 | #include <QInputDialog> | 11 | #include <QInputDialog> |
| 12 | #include <QLabel> | ||
| 18 | #include <QMenu> | 13 | #include <QMenu> |
| 14 | #include <QProgressBar> | ||
| 15 | #include <QPushButton> | ||
| 16 | #include <QScrollBar> | ||
| 17 | #include <QTextEdit> | ||
| 18 | #include <QVBoxLayout> | ||
| 19 | 19 | ||
| 20 | #include <Swiften/Base/foreach.h> | ||
| 21 | #include <Swiften/Base/FileSize.h> | 20 | #include <Swiften/Base/FileSize.h> |
| 21 | #include <Swiften/Base/foreach.h> | ||
| 22 | 22 | ||
| 23 | #include <Swift/Controllers/UIEvents/UIEventStream.h> | ||
| 24 | #include <Swift/Controllers/UIEvents/JoinMUCUIEvent.h> | 23 | #include <Swift/Controllers/UIEvents/JoinMUCUIEvent.h> |
| 24 | #include <Swift/Controllers/UIEvents/UIEventStream.h> | ||
| 25 | 25 | ||
| 26 | #include <Swift/QtUI/ChatSnippet.h> | 26 | #include <Swift/QtUI/ChatSnippet.h> |
| 27 | #include <Swift/QtUI/QtSwiftUtil.h> | 27 | #include <Swift/QtUI/QtSwiftUtil.h> |
| 28 | #include <Swift/QtUI/QtUtilities.h> | 28 | #include <Swift/QtUI/QtUtilities.h> |
| 29 | 29 | ||
| @@ -358,10 +358,17 @@ QtPlainChatView::FileTransfer::FileTransfer(QtPlainChatView* parent, bool sender | |||
| 358 | } | 358 | } |
| 359 | 359 | ||
| 360 | std::string status = msg; | 360 | std::string status = msg; |
| 361 | 361 | ||
| 362 | switch (state) { | 362 | switch (state) { |
| 363 | case ChatWindow::Initialisation: { | ||
| 364 | status = "Preparing to send <i>"+ filename + "</i>..."; | ||
| 365 | FileTransfer::Action* cancel = new FileTransfer::Action("Cancel", ftId); | ||
| 366 | parent->connect(cancel, SIGNAL(clicked()), SLOT(fileTransferReject())); | ||
| 367 | layout_->addWidget(cancel); | ||
| 368 | break; | ||
| 369 | } | ||
| 363 | case ChatWindow::WaitingForAccept: { | 370 | case ChatWindow::WaitingForAccept: { |
| 364 | status = "Waiting for user to accept <i>" + filename + "</i>..."; | 371 | status = "Waiting for user to accept <i>" + filename + "</i>..."; |
| 365 | FileTransfer::Action* cancel = new FileTransfer::Action("Cancel", ftId); | 372 | FileTransfer::Action* cancel = new FileTransfer::Action("Cancel", ftId); |
| 366 | parent->connect(cancel, SIGNAL(clicked()), SLOT(fileTransferReject())); | 373 | parent->connect(cancel, SIGNAL(clicked()), SLOT(fileTransferReject())); |
| 367 | layout_->addWidget(cancel); | 374 | layout_->addWidget(cancel); |
diff --git a/Swift/QtUI/QtWebKitChatView.cpp b/Swift/QtUI/QtWebKitChatView.cpp index d6dc6f5..b7f96f6 100644 --- a/Swift/QtUI/QtWebKitChatView.cpp +++ b/Swift/QtUI/QtWebKitChatView.cpp | |||
| @@ -436,22 +436,26 @@ void QtWebKitChatView::setFileTransferStatus(QString id, const ChatWindow::FileT | |||
| 436 | SWIFT_LOG(debug) << "Tried to access FT UI via invalid id! id = " << Q2PSTRING(id) << std::endl; | 436 | SWIFT_LOG(debug) << "Tried to access FT UI via invalid id! id = " << Q2PSTRING(id) << std::endl; |
| 437 | return; | 437 | return; |
| 438 | } | 438 | } |
| 439 | 439 | ||
| 440 | QString newInnerHTML = ""; | 440 | QString newInnerHTML = ""; |
| 441 | if (state == ChatWindow::WaitingForAccept) { | 441 | if (state == ChatWindow::Initialisation) { |
| 442 | newInnerHTML = tr("Waiting for other side to accept the transfer.") + "<br/>" + | 442 | newInnerHTML = tr("Preparing to send.") + "<br/>" + |
| 443 | buildChatWindowButton(tr("Cancel"), ButtonFileTransferCancel, id); | 443 | buildChatWindowButton(tr("Cancel"), ButtonFileTransferCancel, id); |
| 444 | } | 444 | } |
| 445 | if (state == ChatWindow::Negotiating) { | 445 | else if (state == ChatWindow::WaitingForAccept) { |
| 446 | newInnerHTML = tr("Waiting for other side to accept the transfer.") + "<br/>" + | ||
| 447 | buildChatWindowButton(tr("Cancel"), ButtonFileTransferCancel, id); | ||
| 448 | } | ||
| 449 | else if (state == ChatWindow::Negotiating) { | ||
| 446 | // replace with text "Negotiaging" + Cancel button | 450 | // replace with text "Negotiaging" + Cancel button |
| 447 | newInnerHTML = tr("Negotiating...") + "<br/>" + | 451 | newInnerHTML = tr("Negotiating...") + "<br/>" + |
| 448 | buildChatWindowButton(tr("Cancel"), ButtonFileTransferCancel, id); | 452 | buildChatWindowButton(tr("Cancel"), ButtonFileTransferCancel, id); |
| 449 | } | 453 | } |
| 450 | else if (state == ChatWindow::Transferring) { | 454 | else if (state == ChatWindow::Transferring) { |
| 451 | // progress bar + Cancel Button | 455 | // progress bar + Cancel Button |
| 452 | newInnerHTML = "<div style=\"position: relative; width: 90%; height: 20px; border: 2px solid grey; -webkit-border-radius: 10px;\">" | 456 | newInnerHTML = "<div style=\"position: relative; width: 90%; height: 20px; border: 2px solid grey; -webkit-border-radius: 10px;\">" |
| 453 | "<div class=\"progressbar\" style=\"width: 0%; height: 100%; background: #AAA; -webkit-border-radius: 6px;\">" | 457 | "<div class=\"progressbar\" style=\"width: 0%; height: 100%; background: #AAA; -webkit-border-radius: 6px;\">" |
| 454 | "<div class=\"progressbar-value\" style=\"position: absolute; top: 0px; left: 0px; width: 100%; text-align: center; padding-top: 2px;\">" | 458 | "<div class=\"progressbar-value\" style=\"position: absolute; top: 0px; left: 0px; width: 100%; text-align: center; padding-top: 2px;\">" |
| 455 | "0%" | 459 | "0%" |
| 456 | "</div>" | 460 | "</div>" |
| 457 | "</div>" | 461 | "</div>" |
Swift