diff options
author | Tobias Markmann <tm@ayena.de> | 2011-05-26 18:46:49 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-09-25 17:42:32 (GMT) |
commit | 4f62e5ec4b42929fe3c1a68667e63cb1b7a35509 (patch) | |
tree | 0d19fac3f578dec00ccf3e58930312951e38de89 /Swift/QtUI | |
parent | de660b763459cdd707876ec244b6866abca07fa2 (diff) | |
download | swift-4f62e5ec4b42929fe3c1a68667e63cb1b7a35509.zip swift-4f62e5ec4b42929fe3c1a68667e63cb1b7a35509.tar.bz2 |
Google Summer of Code 2011 Project: Adding support for Jingle File Transfers (XEP-0234), Jingle SOCKS5 Bytestreams Transport Method (XEP-0260), Jingle In-Band Bytestreams Transport Method (XEP-0261) and SOCKS5 Bytestreams (XEP-0065).
License: This patch is BSD-licensed, see http://www.opensource.org/licenses/bsd-license.php
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtChatView.cpp | 73 | ||||
-rw-r--r-- | Swift/QtUI/QtChatView.h | 5 | ||||
-rw-r--r-- | Swift/QtUI/QtChatWindow.cpp | 133 | ||||
-rw-r--r-- | Swift/QtUI/QtChatWindow.h | 22 | ||||
-rw-r--r-- | Swift/QtUI/QtFileTransferJSBridge.cpp | 19 | ||||
-rw-r--r-- | Swift/QtUI/QtFileTransferJSBridge.h | 30 | ||||
-rw-r--r-- | Swift/QtUI/QtFileTransferListItemModel.cpp | 110 | ||||
-rw-r--r-- | Swift/QtUI/QtFileTransferListItemModel.h | 54 | ||||
-rw-r--r-- | Swift/QtUI/QtFileTransferListWidget.cpp | 77 | ||||
-rw-r--r-- | Swift/QtUI/QtFileTransferListWidget.h | 45 | ||||
-rw-r--r-- | Swift/QtUI/QtLoginWindow.cpp | 10 | ||||
-rw-r--r-- | Swift/QtUI/QtLoginWindow.h | 2 | ||||
-rw-r--r-- | Swift/QtUI/QtUIFactory.cpp | 10 | ||||
-rw-r--r-- | Swift/QtUI/QtUIFactory.h | 1 | ||||
-rw-r--r-- | Swift/QtUI/QtWebView.cpp | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtXMLConsoleWidget.cpp | 11 | ||||
-rw-r--r-- | Swift/QtUI/QtXMLConsoleWidget.h | 4 | ||||
-rw-r--r-- | Swift/QtUI/Roster/QtRosterWidget.cpp | 12 | ||||
-rw-r--r-- | Swift/QtUI/Roster/QtTreeWidget.cpp | 39 | ||||
-rw-r--r-- | Swift/QtUI/Roster/QtTreeWidget.h | 7 | ||||
-rw-r--r-- | Swift/QtUI/SConscript | 3 |
21 files changed, 665 insertions, 6 deletions
diff --git a/Swift/QtUI/QtChatView.cpp b/Swift/QtUI/QtChatView.cpp index 4c6a729..d51f74c 100644 --- a/Swift/QtUI/QtChatView.cpp +++ b/Swift/QtUI/QtChatView.cpp @@ -18,6 +18,8 @@ #include <QMessageBox> #include <QApplication> +#include <Swiften/Base/Log.h> + #include "QtWebView.h" #include "QtChatTheme.h" @@ -47,9 +49,11 @@ QtChatView::QtChatView(QtChatTheme* theme, QWidget* parent) : QWidget(parent), f #else mainLayout->addWidget(webView_); #endif + setAcceptDrops(true); webPage_ = new QWebPage(this); webPage_->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); + webPage_->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); webView_->setPage(webPage_); connect(webPage_, SIGNAL(selectionChanged()), SLOT(copySelectionToClipboard())); @@ -151,6 +155,10 @@ QString QtChatView::getLastSentMessage() { return lastElement_.toPlainText(); } +void QtChatView::addToJSEnvironment(const QString& name, QObject* obj) { + webView_->page()->currentFrame()->addToJavaScriptWindowObject(name, obj); +} + void QtChatView::replaceMessage(const QString& newMessage, const QString& id, const QDateTime& editTime) { rememberScrolledToBottom(); QWebElement message = document_.findFirst("#" + id); @@ -263,4 +271,69 @@ void QtChatView::resetView() { connect(webPage_->mainFrame(), SIGNAL(contentsSizeChanged(const QSize&)), this, SLOT(handleFrameSizeChanged()), Qt::UniqueConnection); } +QWebElement findDivElementWithID(QWebElement document, QString id) { + QWebElementCollection divs = document.findAll("div"); + foreach(QWebElement div, divs) { + if (div.attribute("id") == id) { + return div; + } + } + return QWebElement(); +} + +void QtChatView::setFileTransferProgress(QString id, const int percentageDone) { + QWebElement ftElement = findDivElementWithID(document_, id); + if (ftElement.isNull()) { + SWIFT_LOG(debug) << "Tried to access FT UI via invalid id!" << std::endl; + return; + } + QWebElement progressBar = ftElement.findFirst("div.progressbar"); + progressBar.setStyleProperty("width", QString::number(percentageDone) + "%"); + + QWebElement progressBarValue = ftElement.findFirst("div.progressbar-value"); + progressBarValue.setInnerXml(QString::number(percentageDone) + " %"); +} + +void QtChatView::setFileTransferStatus(QString id, const ChatWindow::FileTransferState state, const QString& /* msg */) { + QWebElement ftElement = findDivElementWithID(document_, id); + if (ftElement.isNull()) { + SWIFT_LOG(debug) << "Tried to access FT UI via invalid id! id = " << id.toStdString() << std::endl; + return; + } + + QString newInnerHTML = ""; + if (state == ChatWindow::WaitingForAccept) { + newInnerHTML = "Waiting for other side to accept the transfer.<br/>" + "<input id=\"discard\" type=\"submit\" value=\"Cancel\" onclick=\"filetransfer.cancel(\'" + id + "\');\">"; + } + if (state == ChatWindow::Negotiating) { + // replace with text "Negotiaging" + Cancel button + newInnerHTML = "Negotiating...<br/>" + "<input id=\"discard\" type=\"submit\" value=\"Cancel\" onclick=\"filetransfer.cancel(\'" + id + "\');\">"; + } + else if (state == ChatWindow::Transferring) { + // progress bar + Cancel Button + newInnerHTML = "<div style=\"position: relative; width: 90%; height: 20px; border: 2px solid grey; -webkit-border-radius: 10px;\">" + "<div class=\"progressbar\" style=\"width: 0%; height: 100%; background: #AAA; -webkit-border-radius: 6px;\">" + "<div class=\"progressbar-value\" style=\"position: absolute; top: 0px; left: 0px; width: 100%; text-align: center; padding-top: 2px;\">" + "0%" + "</div>" + "</div>" + "</div>" + "<input id=\"discard\" type=\"submit\" value=\"Cancel\" onclick=\"filetransfer.cancel(\'" + id + "\');\">"; + } + else if (state == ChatWindow::Canceled) { + newInnerHTML = "Transfer has been canceled!"; + } + else if (state == ChatWindow::Finished) { + // text "Successful transfer" + newInnerHTML = "Transfer completed successfully."; + } + else if (state == ChatWindow::FTFailed) { + newInnerHTML = "Transfer failed."; + } + + ftElement.setInnerXml(newInnerHTML); +} + } diff --git a/Swift/QtUI/QtChatView.h b/Swift/QtUI/QtChatView.h index eda7e42..cf47029 100644 --- a/Swift/QtUI/QtChatView.h +++ b/Swift/QtUI/QtChatView.h @@ -16,6 +16,8 @@ #include "ChatSnippet.h" +#include <Swift/Controllers/UIInterfaces/ChatWindow.h> + class QWebPage; class QUrl; @@ -34,6 +36,9 @@ namespace Swift { void rememberScrolledToBottom(); void setAckXML(const QString& id, const QString& xml); QString getLastSentMessage(); + void addToJSEnvironment(const QString&, QObject*); + void setFileTransferProgress(QString id, const int percentageDone); + void setFileTransferStatus(QString id, const ChatWindow::FileTransferState state, const QString& msg); signals: void gotFocus(); diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index a36bc32..238100a 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -19,8 +19,15 @@ #include "QtScaledAvatarCache.h" #include "SwifTools/TabComplete.h" +#include <Swift/Controllers/UIEvents/UIEventStream.h> +#include <Swift/Controllers/UIEvents/SendFileUIEvent.h> +#include "QtFileTransferJSBridge.h" + +#include <boost/format.hpp> +#include <boost/lexical_cast.hpp> #include <QLabel> +#include <QInputDialog> #include <QApplication> #include <QBoxLayout> #include <QCloseEvent> @@ -33,9 +40,12 @@ #include <QTime> #include <QUrl> #include <QPushButton> +#include <QFileDialog> + +#include <QDebug> namespace Swift { -QtChatWindow::QtChatWindow(const QString &contact, QtChatTheme* theme, UIEventStream* eventStream) : QtTabbable(), contact_(contact), previousMessageWasSelf_(false), previousMessageWasSystem_(false), previousMessageWasPresence_(false), eventStream_(eventStream) { +QtChatWindow::QtChatWindow(const QString &contact, QtChatTheme* theme, UIEventStream* eventStream) : QtTabbable(), contact_(contact), previousMessageWasSelf_(false), previousMessageWasSystem_(false), previousMessageWasPresence_(false), previousMessageWasFileTransfer_(false), eventStream_(eventStream) { unreadCount_ = 0; inputEnabled_ = true; completer_ = NULL; @@ -45,6 +55,8 @@ QtChatWindow::QtChatWindow(const QString &contact, QtChatTheme* theme, UIEventSt updateTitleWithUnreadCount(); QtSettingsProvider settings; + setAcceptDrops(true); + alertStyleSheet_ = "background: rgb(255, 255, 153); color: black"; QBoxLayout *layout = new QBoxLayout(QBoxLayout::TopToBottom, this); @@ -117,15 +129,23 @@ QtChatWindow::QtChatWindow(const QString &contact, QtChatTheme* theme, UIEventSt connect(messageLog_, SIGNAL(gotFocus()), input_, SLOT(setFocus())); resize(400,300); connect(messageLog_, SIGNAL(fontResized(int)), this, SIGNAL(fontResized(int))); + treeWidget_->onSomethingSelectedChanged.connect(boost::bind(&QtChatWindow::handleOccupantSelectionChanged, this, _1)); treeWidget_->onOccupantActionSelected.connect(boost::bind(boost::ref(onOccupantActionSelected), _1, _2)); + fileTransferJS = new QtFileTransferJSBridge(); + messageLog_->addToJSEnvironment("filetransfer", fileTransferJS); + connect(fileTransferJS, SIGNAL(setDescription(QString)), this, SLOT(handleFileTransferSetDescription(QString))); + connect(fileTransferJS, SIGNAL(sendRequest(QString)), this, SLOT(handleFileTransferStart(QString))); + connect(fileTransferJS, SIGNAL(acceptRequest(QString, QString)), this, SLOT(handleFileTransferAccept(QString, QString))); + connect(fileTransferJS, SIGNAL(cancel(QString)), this, SLOT(handleFileTransferCancel(QString))); } QtChatWindow::~QtChatWindow() { - + delete fileTransferJS; } + void QtChatWindow::handleOccupantSelectionChanged(RosterItem* item) { onOccupantSelectionChanged(dynamic_cast<ContactRosterItem*>(item)); } @@ -306,6 +326,7 @@ void QtChatWindow::closeEvent(QCloseEvent* event) { } void QtChatWindow::convertToMUC() { + setAcceptDrops(false); treeWidget_->show(); } @@ -391,7 +412,7 @@ std::string QtChatWindow::addMessage(const std::string &message, const std::stri QString styleSpanEnd = style == "" ? "" : "</span>"; htmlString += styleSpanStart + messageHTML + styleSpanEnd; - bool appendToPrevious = !previousMessageWasSystem_ && !previousMessageWasPresence_ && ((senderIsSelf && previousMessageWasSelf_) || (!senderIsSelf && !previousMessageWasSelf_ && previousSenderName_ == P2QSTRING(senderName))); + bool appendToPrevious = !previousMessageWasFileTransfer_ && !previousMessageWasSystem_ && !previousMessageWasPresence_ && ((senderIsSelf && previousMessageWasSelf_) || (!senderIsSelf && !previousMessageWasSelf_ && previousSenderName_ == P2QSTRING(senderName))); if (lastLineTracker_.getShouldMoveLastLine()) { /* should this be queued? */ messageLog_->addLastSeenLine(); @@ -406,6 +427,7 @@ std::string QtChatWindow::addMessage(const std::string &message, const std::stri previousSenderName_ = P2QSTRING(senderName); previousMessageWasSystem_ = false; previousMessageWasPresence_ = false; + previousMessageWasFileTransfer_ = false; return id; } @@ -431,6 +453,94 @@ std::string QtChatWindow::addAction(const std::string &message, const std::strin return addMessage(" *" + message + "*", senderName, senderIsSelf, label, avatarPath, "font-style:italic ", time); } +std::string formatSize(const uintmax_t bytes) { + static const char *siPrefix[] = {"k", "M", "G", "T", "P", "E", "Z", "Y", NULL}; + int power = 0; + double engBytes = bytes; + while (engBytes >= 1000) { + ++power; + engBytes = engBytes / 1000.0; + } + return str( boost::format("%.1lf %sB") % engBytes % (power > 0 ? siPrefix[power-1] : "") ); +} + +std::string QtChatWindow::addFileTransfer(const std::string& senderName, bool senderIsSelf, const std::string& filename, const boost::uintmax_t sizeInBytes) { + qDebug() << "addFileTransfer"; + std::string ft_id = id_.generateID(); + + std::string htmlString; + if (senderIsSelf) { + // outgoing + htmlString = "Send file: " + filename + " ( " + formatSize(sizeInBytes) + ") </br>" + + "<div id='" + ft_id + "'>" + + "<input id='discard' type='submit' value='Cancel' onclick='filetransfer.cancel(\"" + ft_id + "\");' />" + + "<input id='description' type='submit' value='Set Description' onclick='filetransfer.setDescription(\"" + ft_id + "\");' />" + + "<input id='send' type='submit' value='Send' onclick='filetransfer.sendRequest(\"" + ft_id + "\");' />" + + "</div>"; + } else { + // incoming + htmlString = "Receiving file: " + filename + " ( " + formatSize(sizeInBytes) + ") </br>" + + "<div id='" + ft_id + "'>" + + "<input id='discard' type='submit' value='Cancel' onclick='filetransfer.cancel(\"" + ft_id + "\");' />" + + "<input id='accept' type='submit' value='Accept' onclick='filetransfer.acceptRequest(\"" + ft_id + "\", \"" + filename + "\");' />" + + "</div>"; + } + + //addMessage(message, senderName, senderIsSelf, boost::shared_ptr<SecurityLabel>(), "", boost::posix_time::second_clock::local_time()); + + bool appendToPrevious = !previousMessageWasFileTransfer_ && !previousMessageWasSystem_ && !previousMessageWasPresence_ && ((senderIsSelf && previousMessageWasSelf_) || (!senderIsSelf && !previousMessageWasSelf_ && previousSenderName_ == P2QSTRING(senderName))); + if (lastLineTracker_.getShouldMoveLastLine()) { + /* should this be queued? */ + messageLog_->addLastSeenLine(); + /* if the line is added we should break the snippet */ + appendToPrevious = false; + } + QString qAvatarPath = "qrc:/icons/avatar.png"; + std::string id = id_.generateID(); + messageLog_->addMessage(boost::shared_ptr<ChatSnippet>(new MessageSnippet(QString::fromStdString(htmlString), Qt::escape(P2QSTRING(senderName)), B2QDATE(boost::posix_time::second_clock::local_time()), qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id)))); + + + return ft_id; +} + +void QtChatWindow::setFileTransferProgress(std::string id, const int percentageDone) { + messageLog_->setFileTransferProgress(QString::fromStdString(id), percentageDone); +} + +void QtChatWindow::setFileTransferStatus(std::string id, const FileTransferState state, const std::string& msg) { + messageLog_->setFileTransferStatus(QString::fromStdString(id), state, QString::fromStdString(msg)); +} + +void QtChatWindow::handleFileTransferCancel(QString id) { + qDebug() << "QtChatWindow::handleFileTransferCancel(" << id << ")"; + onFileTransferCancel(id.toStdString()); +} + +void QtChatWindow::handleFileTransferSetDescription(QString id) { + bool ok = false; + QString text = QInputDialog::getText(this, tr("File transfer description"), + tr("Description:"), QLineEdit::Normal, "", &ok); + if (ok) { + descriptions[id] = text; + } +} + +void QtChatWindow::handleFileTransferStart(QString id) { + qDebug() << "QtChatWindow::handleFileTransferStart(" << id << ")"; + + QString text = descriptions.find(id) == descriptions.end() ? QString() : descriptions[id]; + onFileTransferStart(id.toStdString(), text.toStdString()); +} + +void QtChatWindow::handleFileTransferAccept(QString id, QString filename) { + qDebug() << "QtChatWindow::handleFileTransferAccept(" << id << ", " << filename << ")"; + + QString path = QFileDialog::getSaveFileName(this, tr("Save File"), filename); + if (!path.isEmpty()) { + onFileTransferAccept(id.toStdString(), path.toStdString()); + } +} + void QtChatWindow::addErrorMessage(const std::string& errorMessage) { if (isWidgetSelected()) { onAllMessagesRead(); @@ -443,6 +553,7 @@ void QtChatWindow::addErrorMessage(const std::string& errorMessage) { previousMessageWasSelf_ = false; previousMessageWasSystem_ = true; previousMessageWasPresence_ = false; + previousMessageWasFileTransfer_ = false; } void QtChatWindow::addSystemMessage(const std::string& message) { @@ -458,6 +569,7 @@ void QtChatWindow::addSystemMessage(const std::string& message) { previousMessageWasSelf_ = false; previousMessageWasSystem_ = true; previousMessageWasPresence_ = false; + previousMessageWasFileTransfer_ = false; } void QtChatWindow::replaceMessage(const std::string& message, const std::string& id, const boost::posix_time::ptime& time) { @@ -532,6 +644,21 @@ void QtChatWindow::moveEvent(QMoveEvent*) { emit geometryChanged(); } +void QtChatWindow::dragEnterEvent(QDragEnterEvent *event) { + if (event->mimeData()->hasUrls() && event->mimeData()->urls().size() == 1) { + // TODO: check whether contact actually supports file transfer + event->acceptProposedAction(); + } +} + +void QtChatWindow::dropEvent(QDropEvent *event) { + if (event->mimeData()->urls().size() == 1) { + onSendFileRequest(event->mimeData()->urls().at(0).toLocalFile().toStdString()); + } else { + addSystemMessage("Sending of multiple files at once isn't supported at this time."); + } +} + void QtChatWindow::replaceLastMessage(const std::string& message) { messageLog_->replaceLastMessage(P2QSTRING(Linkify::linkify(message))); } diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h index d38e9c6..f0c078c 100644 --- a/Swift/QtUI/QtChatWindow.h +++ b/Swift/QtUI/QtChatWindow.h @@ -14,6 +14,8 @@ #include "Swiften/Base/IDGenerator.h" +#include <map> + class QTextEdit; class QLineEdit; class QComboBox; @@ -28,6 +30,7 @@ namespace Swift { class TreeWidget; class QtTextEdit; class UIEventStream; + class QtFileTransferJSBridge; class QtChatWindow : public QtTabbable, public ChatWindow { Q_OBJECT public: @@ -39,6 +42,11 @@ namespace Swift { void addPresenceMessage(const std::string& message); void addErrorMessage(const std::string& errorMessage); void replaceMessage(const std::string& message, const std::string& id, const boost::posix_time::ptime& time); + // File transfer related stuff + std::string addFileTransfer(const std::string& senderName, bool senderIsSelf, const std::string& filename, const boost::uintmax_t sizeInBytes); + void setFileTransferProgress(std::string id, const int percentageDone); + void setFileTransferStatus(std::string id, const FileTransferState state, const std::string& msg); + void show(); void activate(); void setUnreadMessageCount(int count); @@ -79,6 +87,9 @@ namespace Swift { void resizeEvent(QResizeEvent* event); void moveEvent(QMoveEvent* event); + void dragEnterEvent(QDragEnterEvent *event); + void dropEvent(QDropEvent *event); + protected: void showEvent(QShowEvent* event); @@ -88,6 +99,13 @@ namespace Swift { void handleKeyPressEvent(QKeyEvent* event); void handleSplitterMoved(int pos, int index); void handleAlertButtonClicked(); + + + void handleFileTransferCancel(QString id); + void handleFileTransferSetDescription(QString id); + void handleFileTransferStart(QString id); + void handleFileTransferAccept(QString id, QString filename); + private: void updateTitleWithUnreadCount(); void tabComplete(); @@ -116,6 +134,7 @@ namespace Swift { bool previousMessageWasSelf_; bool previousMessageWasSystem_; bool previousMessageWasPresence_; + bool previousMessageWasFileTransfer_; QString previousSenderName_; bool inputClearing_; UIEventStream* eventStream_; @@ -124,5 +143,8 @@ namespace Swift { QSplitter *logRosterSplitter_; Tristate correctionEnabled_; QString alertStyleSheet_; + + std::map<QString, QString> descriptions; + QtFileTransferJSBridge* fileTransferJS; }; } diff --git a/Swift/QtUI/QtFileTransferJSBridge.cpp b/Swift/QtUI/QtFileTransferJSBridge.cpp new file mode 100644 index 0000000..76c1509 --- /dev/null +++ b/Swift/QtUI/QtFileTransferJSBridge.cpp @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2011 Tobias Markmann + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#include "QtFileTransferJSBridge.h" + +namespace Swift { + +QtFileTransferJSBridge::QtFileTransferJSBridge() { + +} + +QtFileTransferJSBridge::~QtFileTransferJSBridge() { + +} + +}
\ No newline at end of file diff --git a/Swift/QtUI/QtFileTransferJSBridge.h b/Swift/QtUI/QtFileTransferJSBridge.h new file mode 100644 index 0000000..bd884e5 --- /dev/null +++ b/Swift/QtUI/QtFileTransferJSBridge.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2011 Tobias Markmann + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <QObject> + +#include <map> + +namespace Swift { + +class FileTransferController; + +class QtFileTransferJSBridge : public QObject { + Q_OBJECT +public: + QtFileTransferJSBridge(); + virtual ~QtFileTransferJSBridge(); +signals: + void discard(QString id); + void sendRequest(QString id); + void setDescription(QString id); + void acceptRequest(QString id, QString filename); + void cancel(QString id); +}; + +} diff --git a/Swift/QtUI/QtFileTransferListItemModel.cpp b/Swift/QtUI/QtFileTransferListItemModel.cpp new file mode 100644 index 0000000..1b8ec51 --- /dev/null +++ b/Swift/QtUI/QtFileTransferListItemModel.cpp @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2011 Tobias Markmann + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#include "QtFileTransferListItemModel.h" + +#include <boost/bind.hpp> + +#include <Swiften/Base/boost_bsignals.h> +#include <Swift/Controllers/FileTransfer/FileTransferController.h> +#include <Swift/Controllers/FileTransfer/FileTransferOverview.h> + +namespace Swift { + +extern std::string formatSize(const uintmax_t bytes); + +QtFileTransferListItemModel::QtFileTransferListItemModel(QObject *parent) : QAbstractItemModel(parent), fileTransferOverview(0) { +} + +void QtFileTransferListItemModel::setFileTransferOverview(FileTransferOverview *overview) { + fileTransferOverview = overview; + fileTransferOverview->onNewFileTransferController.connect(boost::bind(&QtFileTransferListItemModel::handleNewFileTransferController, this, _1)); +} + +void QtFileTransferListItemModel::handleNewFileTransferController(FileTransferController* newController) { + emit layoutAboutToBeChanged(); + emit layoutChanged(); + dataChanged(createIndex(0,0), createIndex(fileTransferOverview->getFileTransfers().size(),4)); + newController->onStateChage.connect(boost::bind(&QtFileTransferListItemModel::handleStateChange, this, fileTransferOverview->getFileTransfers().size() - 1)); + newController->onProgressChange.connect(boost::bind(&QtFileTransferListItemModel::handleProgressChange, this, fileTransferOverview->getFileTransfers().size() - 1)); +} + +void QtFileTransferListItemModel::handleStateChange(int index) { + emit dataChanged(createIndex(index, 2), createIndex(index, 2)); +} + +void QtFileTransferListItemModel::handleProgressChange(int index) { + emit dataChanged(createIndex(index, 3), createIndex(index, 3)); +} + +QVariant QtFileTransferListItemModel::headerData(int section, Qt::Orientation /* orientation */, int role) const { + if (role != Qt::DisplayRole) return QVariant(); + if (section == Direction) return QVariant("Direction"); + if (section == OtherParty) return QVariant("Other Party"); + if (section == State) return QVariant("State"); + if (section == Progress) return QVariant("Progress"); + if (section == OverallSize) return QVariant("Size"); + return QVariant(); +} + +int QtFileTransferListItemModel::columnCount(const QModelIndex& /* parent */) const { + return NoOfColumns; +} + +QVariant QtFileTransferListItemModel::data(const QModelIndex &index, int role) const { + if (role != Qt::DisplayRole || !index.isValid() || + !fileTransferOverview || static_cast<size_t>(index.row()) >= fileTransferOverview->getFileTransfers().size()) { + return QVariant(); + } + FileTransferController* controller = fileTransferOverview->getFileTransfers().at(index.row()); + if (index.column() == Direction) { + return controller->isIncoming() ? QVariant("Incoming") : QVariant("Outgoing"); + } + if (index.column() == OtherParty) { + return QVariant(QString::fromStdString(controller->getOtherParty().toString())); + } + if (index.column() == State) { + FileTransfer::State state = controller->getState(); + switch(state.state) { + case FileTransfer::State::WaitingForStart: + return QVariant("Waiting for start"); + case FileTransfer::State::WaitingForAccept: + return QVariant("Waiting for other side to accept"); + case FileTransfer::State::Negotiating: + return QVariant("Negotiating"); + case FileTransfer::State::Transferring: + return QVariant("Transferring"); + case FileTransfer::State::Finished: + return QVariant("Finished"); + case FileTransfer::State::Failed: + return QVariant("Failed"); + case FileTransfer::State::Canceled: + return QVariant("Canceled"); + } + } + + if (index.column() == Progress) { + return QVariant(QString::number(controller->getProgress())); + } + if (index.column() == OverallSize) { + return QVariant(QString::fromStdString(formatSize((controller->getSize())))); + } + return QVariant(); +} + +QModelIndex QtFileTransferListItemModel::parent(const QModelIndex& /* child */) const { + return createIndex(0,0); +} + +int QtFileTransferListItemModel::rowCount(const QModelIndex& /* parent */) const { + return fileTransferOverview ? fileTransferOverview->getFileTransfers().size() : 0; +} + +QModelIndex QtFileTransferListItemModel::index(int row, int column, const QModelIndex& /* parent */) const { + return createIndex(row, column, 0); +} + +} diff --git a/Swift/QtUI/QtFileTransferListItemModel.h b/Swift/QtUI/QtFileTransferListItemModel.h new file mode 100644 index 0000000..1d892a5 --- /dev/null +++ b/Swift/QtUI/QtFileTransferListItemModel.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2011 Tobias Markmann + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <QAbstractItemModel> + +namespace Swift { + +class FileTransferController; +class FileTransferOverview; + +class QtFileTransferListItemModel : public QAbstractItemModel { + Q_OBJECT +public: + explicit QtFileTransferListItemModel(QObject *parent = 0); + + void setFileTransferOverview(FileTransferOverview*); + + QVariant headerData(int section, Qt::Orientation orientation, int role) const; + int columnCount(const QModelIndex &parent) const; + QVariant data(const QModelIndex &index, int role) const; + QModelIndex parent(const QModelIndex &child) const; + int rowCount(const QModelIndex &parent) const; + QModelIndex index(int row, int column, const QModelIndex &parent) const; + +private: + enum Columns { + Direction = 0, + OtherParty, + State, + Progress, + OverallSize, + NoOfColumns, + }; + +private: + void handleNewFileTransferController(FileTransferController*); + void handleStateChange(int index); + void handleProgressChange(int index); + +signals: + +public slots: + +private: + FileTransferOverview *fileTransferOverview; + +}; + +} diff --git a/Swift/QtUI/QtFileTransferListWidget.cpp b/Swift/QtUI/QtFileTransferListWidget.cpp new file mode 100644 index 0000000..01c632f --- /dev/null +++ b/Swift/QtUI/QtFileTransferListWidget.cpp @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2011 Tobias Markmann + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#include "QtFileTransferListWidget.h" + +#include <Swift/QtUI/QtFileTransferListItemModel.h> + +#include <QVBoxLayout> +#include <QHBoxLayout> +#include <QWidget> +#include <QPushButton> + +namespace Swift { + +QtFileTransferListWidget::QtFileTransferListWidget() : fileTransferOverview(0) { + QVBoxLayout* layout = new QVBoxLayout(this); + layout->setSpacing(0); + layout->setContentsMargins(0,0,0,0); + + treeView = new QTreeView(this); + treeView->setRootIsDecorated(false); + treeView->setItemsExpandable(false); + layout->addWidget(treeView); + + itemModel = new QtFileTransferListItemModel(); + treeView->setModel(itemModel); + + QWidget* bottom = new QWidget(this); + layout->addWidget(bottom); + bottom->setAutoFillBackground(true); + + QHBoxLayout* buttonLayout = new QHBoxLayout(bottom); + buttonLayout->setContentsMargins(10,0,20,0); + buttonLayout->setSpacing(0); + + QPushButton* clearFinished = new QPushButton(tr("Clear Finished Transfers"), bottom); + clearFinished->setEnabled(false); + //connect(clearButton, SIGNAL(clicked()), textEdit, SLOT(clear())); + buttonLayout->addWidget(clearFinished); + + setWindowTitle(tr("File Transfer List")); + emit titleUpdated(); +} + +QtFileTransferListWidget::~QtFileTransferListWidget() { + delete itemModel; +} + +void QtFileTransferListWidget::showEvent(QShowEvent* event) { + emit windowOpening(); + emit titleUpdated(); /* This just needs to be somewhere after construction */ + QWidget::showEvent(event); +} + +void QtFileTransferListWidget::show() { + QWidget::show(); + emit windowOpening(); +} + +void QtFileTransferListWidget::activate() { + emit wantsToActivate(); +} + +void QtFileTransferListWidget::setFileTransferOverview(FileTransferOverview *overview) { + fileTransferOverview = overview; + itemModel->setFileTransferOverview(overview); +} + +void QtFileTransferListWidget::closeEvent(QCloseEvent* event) { + emit windowClosing(); + event->accept(); +} + +} diff --git a/Swift/QtUI/QtFileTransferListWidget.h b/Swift/QtUI/QtFileTransferListWidget.h new file mode 100644 index 0000000..c828d4e --- /dev/null +++ b/Swift/QtUI/QtFileTransferListWidget.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2011 Tobias Markmann + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include "Swift/Controllers/UIInterfaces/FileTransferListWidget.h" + +#include "QtTabbable.h" + +#include <QCloseEvent> +#include <QShowEvent> +#include <QTreeView> + +namespace Swift { + +class FileTransferOverview; +class QtFileTransferListItemModel; + +class QtFileTransferListWidget : public QtTabbable, public FileTransferListWidget { + Q_OBJECT + +public: + QtFileTransferListWidget(); + virtual ~QtFileTransferListWidget(); + + void show(); + void activate(); + + void setFileTransferOverview(FileTransferOverview *); + +private: + virtual void closeEvent(QCloseEvent* event); + virtual void showEvent(QShowEvent* event); + +private: + QTreeView* treeView; + + QtFileTransferListItemModel* itemModel; + FileTransferOverview* fileTransferOverview; +}; + +} diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp index 475863c..543af65 100644 --- a/Swift/QtUI/QtLoginWindow.cpp +++ b/Swift/QtUI/QtLoginWindow.cpp @@ -7,6 +7,7 @@ #include "QtLoginWindow.h" #include <boost/bind.hpp> +#include <boost/smart_ptr/make_shared.hpp> #include <algorithm> #include <cassert> @@ -28,6 +29,7 @@ #include "Swift/Controllers/UIEvents/UIEventStream.h" #include "Swift/Controllers/UIEvents/RequestXMLConsoleUIEvent.h" +#include "Swift/Controllers/UIEvents/RequestFileTransferListUIEvent.h" #include "Swift/Controllers/UIEvents/ToggleSoundsUIEvent.h" #include "Swift/Controllers/UIEvents/ToggleNotificationsUIEvent.h" #include "Swiften/Base/Platform.h" @@ -166,6 +168,10 @@ QtLoginWindow::QtLoginWindow(UIEventStream* uiEventStream) : QMainWindow(), forg connect(xmlConsoleAction_, SIGNAL(triggered()), SLOT(handleShowXMLConsole())); generalMenu_->addAction(xmlConsoleAction_); + fileTransferOverviewAction_ = new QAction(tr("Show &File Transfer Overview"), this); + connect(fileTransferOverviewAction_, SIGNAL(triggered()), SLOT(handleShowFileTransferOverview())); + generalMenu_->addAction(fileTransferOverviewAction_); + toggleSoundsAction_ = new QAction(tr("&Play Sounds"), this); toggleSoundsAction_->setCheckable(true); toggleSoundsAction_->setChecked(true); @@ -356,6 +362,10 @@ void QtLoginWindow::handleShowXMLConsole() { uiEventStream_->send(boost::shared_ptr<RequestXMLConsoleUIEvent>(new RequestXMLConsoleUIEvent())); } +void QtLoginWindow::handleShowFileTransferOverview() { + uiEventStream_->send(boost::make_shared<RequestFileTransferListUIEvent>()); +} + void QtLoginWindow::handleToggleSounds(bool enabled) { uiEventStream_->send(boost::shared_ptr<ToggleSoundsUIEvent>(new ToggleSoundsUIEvent(enabled))); } diff --git a/Swift/QtUI/QtLoginWindow.h b/Swift/QtUI/QtLoginWindow.h index 4628af7..414bb20 100644 --- a/Swift/QtUI/QtLoginWindow.h +++ b/Swift/QtUI/QtLoginWindow.h @@ -51,6 +51,7 @@ namespace Swift { void handleCertficateChecked(bool); void handleQuit(); void handleShowXMLConsole(); + void handleShowFileTransferOverview(); void handleToggleSounds(bool enabled); void handleToggleNotifications(bool enabled); void handleAbout(); @@ -88,5 +89,6 @@ namespace Swift { QPointer<QtAboutWidget> aboutDialog_; bool forgetful_; QAction* xmlConsoleAction_; + QAction* fileTransferOverviewAction_; }; } diff --git a/Swift/QtUI/QtUIFactory.cpp b/Swift/QtUI/QtUIFactory.cpp index bd936d4..9de700c 100644 --- a/Swift/QtUI/QtUIFactory.cpp +++ b/Swift/QtUI/QtUIFactory.cpp @@ -24,6 +24,7 @@ #include "QtProfileWindow.h" #include "QtContactEditWindow.h" #include "QtAdHocCommandWindow.h" +#include "QtFileTransferListWidget.h" #define CHATWINDOW_FONT_SIZE "chatWindowFontSize" @@ -43,6 +44,15 @@ XMLConsoleWidget* QtUIFactory::createXMLConsoleWidget() { return widget; } +FileTransferListWidget* QtUIFactory::createFileTransferListWidget() { + QtFileTransferListWidget* widget = new QtFileTransferListWidget(); + tabs->addTab(widget); + if (!tabs->isVisible()) { + tabs->show(); + } + widget->show(); + return widget; +} MainWindow* QtUIFactory::createMainWindow(UIEventStream* eventStream) { lastMainWindow = new QtMainWindow(settings, eventStream); diff --git a/Swift/QtUI/QtUIFactory.h b/Swift/QtUI/QtUIFactory.h index e7ea6c6..8fc5395 100644 --- a/Swift/QtUI/QtUIFactory.h +++ b/Swift/QtUI/QtUIFactory.h @@ -39,6 +39,7 @@ namespace Swift { virtual JoinMUCWindow* createJoinMUCWindow(UIEventStream* uiEventStream); virtual ProfileWindow* createProfileWindow(); virtual ContactEditWindow* createContactEditWindow(); + virtual FileTransferListWidget* createFileTransferListWidget(); virtual void createAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocCommandSession> command); private slots: diff --git a/Swift/QtUI/QtWebView.cpp b/Swift/QtUI/QtWebView.cpp index 5f9539e..d849ce7 100644 --- a/Swift/QtUI/QtWebView.cpp +++ b/Swift/QtUI/QtWebView.cpp @@ -45,7 +45,9 @@ void QtWebView::setFontSizeIsMinimal(bool minimum) { void QtWebView::contextMenuEvent(QContextMenuEvent* ev) { // Filter out the relevant actions from the standard actions + QMenu* menu = page()->createStandardContextMenu(); + /* QList<QAction*> actions(menu->actions()); for (int i = 0; i < actions.size(); ++i) { QAction* action = actions.at(i); @@ -59,7 +61,7 @@ void QtWebView::contextMenuEvent(QContextMenuEvent* ev) { if (removeAction) { menu->removeAction(action); } - } + }*/ // Add our own custom actions menu->addAction(tr("Clear"), this, SIGNAL(clearRequested())); diff --git a/Swift/QtUI/QtXMLConsoleWidget.cpp b/Swift/QtUI/QtXMLConsoleWidget.cpp index b0c0385..0c88ce6 100644 --- a/Swift/QtUI/QtXMLConsoleWidget.cpp +++ b/Swift/QtUI/QtXMLConsoleWidget.cpp @@ -6,6 +6,8 @@ #include "QtXMLConsoleWidget.h" +#include <Swiften/Client/XMLBeautifier.h> + #include <QCloseEvent> #include <QTextEdit> #include <QVBoxLayout> @@ -49,6 +51,11 @@ QtXMLConsoleWidget::QtXMLConsoleWidget() { setWindowTitle(tr("Debug Console")); emit titleUpdated(); + beautifier = new XMLBeautifier(true, false); +} + +QtXMLConsoleWidget::~QtXMLConsoleWidget() { + delete beautifier; } void QtXMLConsoleWidget::showEvent(QShowEvent* event) { @@ -72,11 +79,11 @@ void QtXMLConsoleWidget::closeEvent(QCloseEvent* event) { } void QtXMLConsoleWidget::handleDataRead(const SafeByteArray& data) { - appendTextIfEnabled(std::string(tr("<!-- IN -->").toUtf8()) + "\n" + safeByteArrayToString(data) + "\n", QColor(33,98,33)); + appendTextIfEnabled(std::string(tr("<!-- IN -->").toUtf8()) + "\n" + beautifier->beautify(safeByteArrayToString(data)) + "\n", QColor(33,98,33)); } void QtXMLConsoleWidget::handleDataWritten(const SafeByteArray& data) { - appendTextIfEnabled(std::string(tr("<!-- OUT -->").toUtf8()) + "\n" + safeByteArrayToString(data) + "\n", QColor(155,1,0)); + appendTextIfEnabled(std::string(tr("<!-- OUT -->").toUtf8()) + "\n" + beautifier->beautify(safeByteArrayToString(data)) + "\n", QColor(155,1,0)); } void QtXMLConsoleWidget::appendTextIfEnabled(const std::string& data, const QColor& color) { diff --git a/Swift/QtUI/QtXMLConsoleWidget.h b/Swift/QtUI/QtXMLConsoleWidget.h index 73a3bad..c22251f 100644 --- a/Swift/QtUI/QtXMLConsoleWidget.h +++ b/Swift/QtUI/QtXMLConsoleWidget.h @@ -14,11 +14,14 @@ class QCheckBox; class QColor; namespace Swift { + class XMLBeautifier; + class QtXMLConsoleWidget : public QtTabbable, public XMLConsoleWidget { Q_OBJECT public: QtXMLConsoleWidget(); + ~QtXMLConsoleWidget(); void show(); void activate(); @@ -35,5 +38,6 @@ namespace Swift { private: QTextEdit* textEdit; QCheckBox* enabled; + XMLBeautifier* beautifier; }; } diff --git a/Swift/QtUI/Roster/QtRosterWidget.cpp b/Swift/QtUI/Roster/QtRosterWidget.cpp index 923f977..f3b0441 100644 --- a/Swift/QtUI/Roster/QtRosterWidget.cpp +++ b/Swift/QtUI/Roster/QtRosterWidget.cpp @@ -9,10 +9,12 @@ #include <QContextMenuEvent> #include <QMenu> #include <QInputDialog> +#include <QFileDialog> #include "Swift/Controllers/UIEvents/RequestContactEditorUIEvent.h" #include "Swift/Controllers/UIEvents/RemoveRosterItemUIEvent.h" #include "Swift/Controllers/UIEvents/RenameGroupUIEvent.h" +#include "Swift/Controllers/UIEvents/SendFileUIEvent.h" #include "QtContactEditWindow.h" #include "Swift/Controllers/Roster/ContactRosterItem.h" #include "Swift/Controllers/Roster/GroupRosterItem.h" @@ -54,6 +56,10 @@ void QtRosterWidget::contextMenuEvent(QContextMenuEvent* event) { if (ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item)) { QAction* editContact = contextMenu.addAction(tr("Edit")); QAction* removeContact = contextMenu.addAction(tr("Remove")); + QAction* sendFile = NULL; + if (contact->supportsFeature(ContactRosterItem::FileTransferFeature)) { + sendFile = contextMenu.addAction(tr("Send File")); + } QAction* result = contextMenu.exec(event->globalPos()); if (result == editContact) { eventStream_->send(boost::make_shared<RequestContactEditorUIEvent>(contact->getJID())); @@ -63,6 +69,12 @@ void QtRosterWidget::contextMenuEvent(QContextMenuEvent* event) { eventStream_->send(boost::make_shared<RemoveRosterItemUIEvent>(contact->getJID())); } } + else if (result == sendFile) { + QString fileName = QFileDialog::getOpenFileName(this, tr("Send File"), "", tr("All Files (*);;")); + if (!fileName.isEmpty()) { + eventStream_->send(boost::make_shared<SendFileUIEvent>(contact->getJID(), fileName.toStdString())); + } + } } else if (GroupRosterItem* group = dynamic_cast<GroupRosterItem*>(item)) { QAction* renameGroupAction = contextMenu.addAction(tr("Rename")); diff --git a/Swift/QtUI/Roster/QtTreeWidget.cpp b/Swift/QtUI/Roster/QtTreeWidget.cpp index 96a078b..79dd6a2 100644 --- a/Swift/QtUI/Roster/QtTreeWidget.cpp +++ b/Swift/QtUI/Roster/QtTreeWidget.cpp @@ -8,11 +8,14 @@ #include <boost/smart_ptr/make_shared.hpp> +#include <QUrl> + #include "Swiften/Base/Platform.h" #include "Swift/Controllers/Roster/ContactRosterItem.h" #include "Swift/Controllers/Roster/GroupRosterItem.h" #include "Swift/Controllers/UIEvents/UIEventStream.h" #include "Swift/Controllers/UIEvents/RequestChatUIEvent.h" +#include "Swift/Controllers/UIEvents/SendFileUIEvent.h" #include "QtSwiftUtil.h" namespace Swift { @@ -31,6 +34,7 @@ QtTreeWidget::QtTreeWidget(UIEventStream* eventStream, QWidget* parent) : QTreeV expandAll(); setAnimated(true); setIndentation(0); + setAcceptDrops(true); setRootIsDecorated(true); connect(this, SIGNAL(activated(const QModelIndex&)), this, SLOT(handleItemActivated(const QModelIndex&))); connect(model_, SIGNAL(itemExpanded(const QModelIndex&, bool)), this, SLOT(handleModelItemExpanded(const QModelIndex&, bool))); @@ -104,6 +108,41 @@ void QtTreeWidget::handleItemActivated(const QModelIndex& index) { } } +void QtTreeWidget::dragEnterEvent(QDragEnterEvent *event) { + if (event->mimeData()->hasUrls() && event->mimeData()->urls().size() == 1) { + event->acceptProposedAction(); + } +} + +void QtTreeWidget::dropEvent(QDropEvent *event) { + QModelIndex index = indexAt(event->pos()); + if (index.isValid()) { + RosterItem* item = static_cast<RosterItem*>(index.internalPointer()); + if (ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item)) { + if (contact->supportsFeature(ContactRosterItem::FileTransferFeature)) { + QString filename = event->mimeData()->urls().at(0).toLocalFile(); + if (!filename.isEmpty()) { + eventStream_->send(boost::make_shared<SendFileUIEvent>(contact->getJID(), filename.toStdString())); + } + } + } + } +} + +void QtTreeWidget::dragMoveEvent(QDragMoveEvent* event) { + QModelIndex index = indexAt(event->pos()); + if (index.isValid()) { + RosterItem* item = static_cast<RosterItem*>(index.internalPointer()); + if (ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item)) { + if (contact->supportsFeature(ContactRosterItem::FileTransferFeature)) { + event->accept(); + return; + } + } + } + event->ignore(); +} + void QtTreeWidget::handleExpanded(const QModelIndex& index) { GroupRosterItem* item = dynamic_cast<GroupRosterItem*>(static_cast<RosterItem*>(index.internalPointer())); if (item) { diff --git a/Swift/QtUI/Roster/QtTreeWidget.h b/Swift/QtUI/Roster/QtTreeWidget.h index 1ad56d6..271fbd5 100644 --- a/Swift/QtUI/Roster/QtTreeWidget.h +++ b/Swift/QtUI/Roster/QtTreeWidget.h @@ -8,6 +8,9 @@ #include <QTreeView> #include <QModelIndex> +#include <QDragEnterEvent> +#include <QDropEvent> +#include <QDragMoveEvent> #include "Swift/QtUI/Roster/RosterModel.h" #include "Swift/QtUI/Roster/RosterDelegate.h" @@ -31,6 +34,10 @@ class QtTreeWidget : public QTreeView{ void handleExpanded(const QModelIndex&); void handleCollapsed(const QModelIndex&); void handleClicked(const QModelIndex&); + protected: + void dragEnterEvent(QDragEnterEvent* event); + void dropEvent(QDropEvent* event); + void dragMoveEvent(QDragMoveEvent* event); protected: QModelIndexList getSelectedIndexes() const; diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript index 33450ed..1d7ab78 100644 --- a/Swift/QtUI/SConscript +++ b/Swift/QtUI/SConscript @@ -84,6 +84,8 @@ sources = [ "QtTabWidget.cpp", "QtTextEdit.cpp", "QtXMLConsoleWidget.cpp", + "QtFileTransferListWidget.cpp", + "QtFileTransferListItemModel.cpp", "QtAdHocCommandWindow.cpp", "QtUtilities.cpp", "QtBookmarkDetailWindow.cpp", @@ -133,6 +135,7 @@ sources = [ "QtWebView.cpp", "qrc_DefaultTheme.cc", "qrc_Swift.cc", + "QtFileTransferJSBridge.cpp", ] myenv["SWIFT_VERSION"] = Version.getBuildVersion(env.Dir("#").abspath, "swift") |