diff options
| author | Catalin Badea <catalin.badea392@gmail.com> | 2012-07-01 20:13:27 (GMT) | 
|---|---|---|
| committer | Cătălin Badea <catalin.badea392@gmail.com> | 2012-08-11 15:52:57 (GMT) | 
| commit | 5b030224c25dcb7e0f8dabe9ba80cc6d6397320b (patch) | |
| tree | 71aa4e7d4ddeaa172fe233b096d4c354cc9ecb6f /Swift/QtUI/QtHistoryWindow.cpp | |
| parent | dd28860d46fb873bd9ff221f0ef639c932c22bb8 (diff) | |
| download | swift-contrib-5b030224c25dcb7e0f8dabe9ba80cc6d6397320b.zip swift-contrib-5b030224c25dcb7e0f8dabe9ba80cc6d6397320b.tar.bz2  | |
Dump message logs using new db structure. Avatars not working
Diffstat (limited to 'Swift/QtUI/QtHistoryWindow.cpp')
| -rw-r--r-- | Swift/QtUI/QtHistoryWindow.cpp | 21 | 
1 files changed, 17 insertions, 4 deletions
diff --git a/Swift/QtUI/QtHistoryWindow.cpp b/Swift/QtUI/QtHistoryWindow.cpp index 24085d9..122655a 100644 --- a/Swift/QtUI/QtHistoryWindow.cpp +++ b/Swift/QtUI/QtHistoryWindow.cpp @@ -13,6 +13,13 @@  #include <string>  #include <boost/shared_ptr.hpp> + +#include <QTime> +#include <QUrl> +#include <QMenu> +#include <QTextDocument> +#include <Swift/QtUI/QtScaledAvatarCache.h> +  #include <boost/smart_ptr/make_shared.hpp>  namespace Swift { @@ -69,12 +76,18 @@ void QtHistoryWindow::setRosterModel(Roster* model) {  	conversationRoster_->setRosterModel(model);  } -void QtHistoryWindow::addMessage(const HistoryMessage& message) { -	// TODO -	// boost::shared_ptr<MessageSnippet> snippet(new MessageSnippet(QString::fromStdString(message.getMessage()), QString::fromStdString(message.getDisplayNick()), QDateTime::currentDateTime(), "", false, false, theme_, "id"));  -	// conversation_->addMessage(snippet); +void QtHistoryWindow::addMessage(const std::string &message, const std::string &senderName, bool senderIsSelf, const std::string& avatarPath, const boost::posix_time::ptime& time) { +	QString scaledAvatarPath = QtScaledAvatarCache(32).getScaledAvatarPath(avatarPath.c_str()); + +	QString messageHTML(P2QSTRING(message)); +	messageHTML = Qt::escape(messageHTML); + +	QString qAvatarPath =  scaledAvatarPath.isEmpty() ? "qrc:/icons/avatar.png" : QUrl::fromLocalFile(scaledAvatarPath).toEncoded(); + +	conversation_->addMessage(boost::shared_ptr<ChatSnippet>(new MessageSnippet(messageHTML, Qt::escape(P2QSTRING(senderName)), B2QDATE(time), qAvatarPath, senderIsSelf, false, theme_, "id")));  } +  void QtHistoryWindow::handleSomethingSelectedChanged(RosterItem* item) {  	conversation_->resetView();  	onSelectedContactChanged(item);  | 
 Swift