summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtChatView.cpp8
-rw-r--r--Swift/QtUI/QtChatView.h2
-rw-r--r--Swift/QtUI/QtHistoryWindow.cpp2
3 files changed, 9 insertions, 3 deletions
diff --git a/Swift/QtUI/QtChatView.cpp b/Swift/QtUI/QtChatView.cpp
index 4ae613a..74ffb8b 100644
--- a/Swift/QtUI/QtChatView.cpp
+++ b/Swift/QtUI/QtChatView.cpp
@@ -28,7 +28,7 @@
namespace Swift {
-QtChatView::QtChatView(QtChatTheme* theme, QWidget* parent) : QWidget(parent), fontSizeSteps_(0) {
+QtChatView::QtChatView(QtChatTheme* theme, QWidget* parent, bool disableAutoScroll) : QWidget(parent), fontSizeSteps_(0) {
theme_ = theme;
QVBoxLayout* mainLayout = new QVBoxLayout(this);
@@ -66,6 +66,10 @@ QtChatView::QtChatView(QtChatTheme* theme, QWidget* parent) : QWidget(parent), f
viewReady_ = false;
isAtBottom_ = true;
resetView();
+
+ if (disableAutoScroll) {
+ webPage_->mainFrame()->evaluateJavaScript("var disableAutoScroll = true;");
+ }
}
void QtChatView::handleClearRequested() {
@@ -360,6 +364,8 @@ void QtChatView::resetView() {
chatElement.appendInside(newInsertPoint_);
Q_ASSERT(!newInsertPoint_.isNull());
+ scrollToBottom();
+
connect(webPage_->mainFrame(), SIGNAL(contentsSizeChanged(const QSize&)), this, SLOT(handleFrameSizeChanged()), Qt::UniqueConnection);
}
diff --git a/Swift/QtUI/QtChatView.h b/Swift/QtUI/QtChatView.h
index dada46a..8c523d5 100644
--- a/Swift/QtUI/QtChatView.h
+++ b/Swift/QtUI/QtChatView.h
@@ -28,7 +28,7 @@ namespace Swift {
class QtChatView : public QWidget {
Q_OBJECT
public:
- QtChatView(QtChatTheme* theme, QWidget* parent);
+ QtChatView(QtChatTheme* theme, QWidget* parent, bool disableAutoScroll = false);
void addMessageTop(boost::shared_ptr<ChatSnippet> snippet);
void addMessageBottom(boost::shared_ptr<ChatSnippet> snippet);
void addLastSeenLine();
diff --git a/Swift/QtUI/QtHistoryWindow.cpp b/Swift/QtUI/QtHistoryWindow.cpp
index 94d604e..d926db7 100644
--- a/Swift/QtUI/QtHistoryWindow.cpp
+++ b/Swift/QtUI/QtHistoryWindow.cpp
@@ -36,7 +36,7 @@ QtHistoryWindow::QtHistoryWindow(SettingsProvider* settings, UIEventStream* even
idCounter_ = 0;
delete ui_.conversation_;
- conversation_ = new QtChatView(theme_, this);
+ conversation_ = new QtChatView(theme_, this, true);
QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
sizePolicy.setHorizontalStretch(80);
sizePolicy.setVerticalStretch(0);