summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtHistoryWindow.cpp')
-rw-r--r--Swift/QtUI/QtHistoryWindow.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/Swift/QtUI/QtHistoryWindow.cpp b/Swift/QtUI/QtHistoryWindow.cpp
index 95a47ac..36c899c 100644
--- a/Swift/QtUI/QtHistoryWindow.cpp
+++ b/Swift/QtUI/QtHistoryWindow.cpp
@@ -29,6 +29,7 @@ QtHistoryWindow::QtHistoryWindow(SettingsProvider* settings, UIEventStream* even
ui_.setupUi(this);
theme_ = new QtChatTheme("");
+ idCounter_ = 0;
delete ui_.conversation_;
conversation_ = new QtChatView(theme_, this);
@@ -53,6 +54,8 @@ QtHistoryWindow::QtHistoryWindow(SettingsProvider* settings, UIEventStream* even
conversationRoster_->onSomethingSelectedChanged.connect(boost::bind(&QtHistoryWindow::handleSomethingSelectedChanged, this, _1));
connect(conversation_, SIGNAL(scrollRequested(int)), this, SLOT(handleScrollRequested(int)));
+ connect(conversation_, SIGNAL(scrollReachedTop()), this, SLOT(handleScrollReachedTop()));
+ connect(conversation_, SIGNAL(scrollReachedBottom()), this, SLOT(handleScrollReachedBottom()));
}
QtHistoryWindow::~QtHistoryWindow() {
@@ -90,9 +93,11 @@ void QtHistoryWindow::addMessage(const std::string &message, const std::string &
QDateTime qTime = B2QDATE(time);
QDate date = qTime.date();
+ std::string id = "id" + boost::lexical_cast<std::string>(idCounter_++);
+
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)), qTime, qAvatarPath, senderIsSelf, false, theme_, "id")));
+ conversation_->addMessageBottom(boost::shared_ptr<ChatSnippet>(new MessageSnippet(messageHTML, Qt::escape(P2QSTRING(senderName)), qTime, qAvatarPath, senderIsSelf, false, theme_, P2QSTRING(id))));
// keep track of the days viewable in the chatView
if (!dates_.count(date)) {
@@ -128,5 +133,10 @@ void QtHistoryWindow::handleScrollRequested(int pos) {
ui_.calendarWidget_->setSelectedDate(currentDate_);
}
}
+void QtHistoryWindow::handleScrollReachedTop() {
+}
+
+void QtHistoryWindow::handleScrollReachedBottom() {
+}
}