From 5099a0e06126edce98b7df50cd8b2fdcee2af76a Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 10 Apr 2014 11:41:10 -0700 Subject: [PATCH 01/13] Remove chat window opening animation --- interface/src/Menu.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 70e69597f6..ba3ea45229 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -1212,12 +1212,6 @@ void Menu::showChat() { _chatWindow->resize(0, _chatWindow->height()); _chatWindow->toggleViewAction()->trigger(); - QPropertyAnimation* slideAnimation = new QPropertyAnimation(_chatWindow, "geometry", _chatWindow); - slideAnimation->setStartValue(_chatWindow->geometry()); - slideAnimation->setEndValue(QRect(mainWindow->width() - width, _chatWindow->y(), - width, _chatWindow->height())); - slideAnimation->setDuration(250); - slideAnimation->start(QAbstractAnimation::DeleteWhenStopped); } } From 2d481dda4e4d5ff345dcec0cda9cbc56515ce342 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 10 Apr 2014 11:46:28 -0700 Subject: [PATCH 02/13] Update chat menu to properly position itself when opening The previous implementation seemed to assume a full-screen main window - it will now open on the right side of the window, vertically centered, regardless of where the main window is. --- interface/src/Menu.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index ba3ea45229..7b67aadfba 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -1206,12 +1206,12 @@ void Menu::showChat() { mainWindow->addDockWidget(Qt::NoDockWidgetArea, _chatWindow = new ChatWindow()); } if (!_chatWindow->toggleViewAction()->isChecked()) { - int width = _chatWindow->width(); - int y = qMax((mainWindow->height() - _chatWindow->height()) / 2, 0); - _chatWindow->move(mainWindow->width(), y); + const QRect& windowGeometry = mainWindow->geometry(); + _chatWindow->move(windowGeometry.topRight().x() - _chatWindow->width(), + windowGeometry.topRight().y() + (windowGeometry.height() / 2) - (_chatWindow->height() / 2)); + _chatWindow->resize(0, _chatWindow->height()); _chatWindow->toggleViewAction()->trigger(); - } } From ff3ebd1eda1e8a69210be650df3c87b35c83a7e6 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 10 Apr 2014 12:04:30 -0700 Subject: [PATCH 03/13] Fix centering of timestamp in chat window --- interface/src/ui/ChatWindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interface/src/ui/ChatWindow.cpp b/interface/src/ui/ChatWindow.cpp index 0060cb839c..63f76295bd 100644 --- a/interface/src/ui/ChatWindow.cpp +++ b/interface/src/ui/ChatWindow.cpp @@ -155,6 +155,8 @@ void ChatWindow::addTimeStamp() { timeLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); timeLabel->setAlignment(Qt::AlignHCenter); ui->messagesGridLayout->addWidget(timeLabel, ui->messagesGridLayout->rowCount(), 0, 1, 2); + ui->messagesGridLayout->parentWidget()->updateGeometry(); + numMessagesAfterLastTimeStamp = 0; } } From 37f9f47488a4ef48c27c930cc43354c5b659fdba Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 10 Apr 2014 12:09:06 -0700 Subject: [PATCH 04/13] Fix odd resizing of chat messages When calling updateGeometry on the message labels the layout system seems to resize the widgets in weird ways. There may be a different way to keep it from doing this. --- interface/src/ui/ChatWindow.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/interface/src/ui/ChatWindow.cpp b/interface/src/ui/ChatWindow.cpp index 63f76295bd..1230140fc8 100644 --- a/interface/src/ui/ChatWindow.cpp +++ b/interface/src/ui/ChatWindow.cpp @@ -251,7 +251,6 @@ void ChatWindow::messageReceived(const QXmppMessage& message) { Application::processEvents(); QScrollBar* verticalScrollBar = ui->messagesScrollArea->verticalScrollBar(); verticalScrollBar->setSliderPosition(verticalScrollBar->maximum()); - messageLabel->updateGeometry(); ++numMessagesAfterLastTimeStamp; if (message.stamp().isValid()) { From de475ee46cafd67d4ffea57e680d81309445b020 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 10 Apr 2014 12:19:27 -0700 Subject: [PATCH 05/13] Update behavior of chat window close button Use a stylesheet to suppress highlighting of the background when pressing the button down. Instead, it will change the image. Unfortunately I wasn't able to find a way to do this without requiring an extra image, or by doing it through the icon system. The different icon states didn't seem to take effect for button presses, and using opacity in the stylesheet doesn't work yet for `QPushButton`s. --- interface/resources/images/close_down.svg | 79 +++++++++++++++++++++++ interface/resources/resources.qrc | 13 ++-- interface/ui/chatWindow.ui | 18 ++++-- 3 files changed, 100 insertions(+), 10 deletions(-) create mode 100644 interface/resources/images/close_down.svg diff --git a/interface/resources/images/close_down.svg b/interface/resources/images/close_down.svg new file mode 100644 index 0000000000..f36865fff1 --- /dev/null +++ b/interface/resources/images/close_down.svg @@ -0,0 +1,79 @@ + + + + + + image/svg+xml + + Slice 1 + + + + + Slice 1 + Created with Sketch (http://www.bohemiancoding.com/sketch) + + + + + + + + diff --git a/interface/resources/resources.qrc b/interface/resources/resources.qrc index 35c0e40270..bc41f41784 100644 --- a/interface/resources/resources.qrc +++ b/interface/resources/resources.qrc @@ -1,8 +1,9 @@ - - images/close.svg - images/kill-script.svg - images/reload.svg - images/stop.svg - + + images/close_down.svg + images/close.svg + images/kill-script.svg + images/reload.svg + images/stop.svg + diff --git a/interface/ui/chatWindow.ui b/interface/ui/chatWindow.ui index 60a0c6badd..095a2ba8f9 100644 --- a/interface/ui/chatWindow.ui +++ b/interface/ui/chatWindow.ui @@ -96,13 +96,23 @@ Qt::NoFocus + + QPushButton { + background-color: rgba( 0, 0, 0, 0% ); + border: none; + image: url(:images/close.svg) +} + + +QPushButton:pressed { + background-color: rgba( 0, 0, 0, 0% ); + border: none; + image: url(:images/close_down.svg) +} + - - - :/images/close.svg:/images/close.svg - true From 16a2367b294b28284db382a60671a63df1af1b6f Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 10 Apr 2014 12:34:45 -0700 Subject: [PATCH 06/13] Update chat window to only scroll when at the bottom It can be frustrating when scrolling up to read a message to have the window forcibly scrolled to the bottom when a new message appears. --- interface/src/ui/ChatWindow.cpp | 28 ++++++++++++++++++++++++++-- interface/src/ui/ChatWindow.h | 2 ++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/interface/src/ui/ChatWindow.cpp b/interface/src/ui/ChatWindow.cpp index 1230140fc8..c164ea3fb3 100644 --- a/interface/src/ui/ChatWindow.cpp +++ b/interface/src/ui/ChatWindow.cpp @@ -154,10 +154,18 @@ void ChatWindow::addTimeStamp() { "padding: 4px;"); timeLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); timeLabel->setAlignment(Qt::AlignHCenter); + + bool atBottom = isAtBottom(); + ui->messagesGridLayout->addWidget(timeLabel, ui->messagesGridLayout->rowCount(), 0, 1, 2); ui->messagesGridLayout->parentWidget()->updateGeometry(); + Application::processEvents(); numMessagesAfterLastTimeStamp = 0; + + if (atBottom) { + scrollToBottom(); + } } } @@ -245,12 +253,15 @@ void ChatWindow::messageReceived(const QXmppMessage& message) { messageLabel->setStyleSheet(messageLabel->styleSheet() + "; background-color: #e1e8ea"); } + bool atBottom = isAtBottom(); ui->messagesGridLayout->addWidget(userLabel, ui->messagesGridLayout->rowCount(), 0); ui->messagesGridLayout->addWidget(messageLabel, ui->messagesGridLayout->rowCount() - 1, 1); ui->messagesGridLayout->parentWidget()->updateGeometry(); Application::processEvents(); - QScrollBar* verticalScrollBar = ui->messagesScrollArea->verticalScrollBar(); - verticalScrollBar->setSliderPosition(verticalScrollBar->maximum()); + + if (atBottom) { + scrollToBottom(); + } ++numMessagesAfterLastTimeStamp; if (message.stamp().isValid()) { @@ -260,4 +271,17 @@ void ChatWindow::messageReceived(const QXmppMessage& message) { } } +bool ChatWindow::isAtBottom() { + QScrollBar* verticalScrollBar = ui->messagesScrollArea->verticalScrollBar(); + qDebug() << "Checking for bottom " << verticalScrollBar->sliderPosition() << " " << verticalScrollBar->maximum(); + return verticalScrollBar->sliderPosition() == verticalScrollBar->maximum(); +} + +// Scroll chat message area to bottom. +void ChatWindow::scrollToBottom() { + QScrollBar* verticalScrollBar = ui->messagesScrollArea->verticalScrollBar(); + qDebug() << "Scrolling to " << verticalScrollBar->maximum(); + verticalScrollBar->setSliderPosition(verticalScrollBar->maximum()); +} + #endif diff --git a/interface/src/ui/ChatWindow.h b/interface/src/ui/ChatWindow.h index cb9619cc42..46e7de1c39 100644 --- a/interface/src/ui/ChatWindow.h +++ b/interface/src/ui/ChatWindow.h @@ -48,6 +48,8 @@ private: #endif void startTimerForTimeStamps(); void addTimeStamp(); + bool isAtBottom(); + void scrollToBottom(); Ui::ChatWindow* ui; int numMessagesAfterLastTimeStamp; From 13cf0c80e687f4bf34d5d5532af01d84f29b25eb Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Sat, 12 Apr 2014 00:20:43 -0700 Subject: [PATCH 07/13] Fix chat message formatting and word wrapping By switching from a QLabel to a QTextBrowser widget more formatting options and word wrapping that breaks words is possible. It comes with an issue I have been unable to resolve * Selecting text and going down with the cursor will cause it to scroll. It's possible to increase padding to remove this behavior, but it doesn't look great. --- interface/src/ui/ChatMessageArea.cpp | 44 ++++++++++++++++++++++++++++ interface/src/ui/ChatMessageArea.h | 33 +++++++++++++++++++++ interface/src/ui/ChatWindow.cpp | 35 +++++++++++++++------- 3 files changed, 102 insertions(+), 10 deletions(-) create mode 100644 interface/src/ui/ChatMessageArea.cpp create mode 100644 interface/src/ui/ChatMessageArea.h diff --git a/interface/src/ui/ChatMessageArea.cpp b/interface/src/ui/ChatMessageArea.cpp new file mode 100644 index 0000000000..936f2dba18 --- /dev/null +++ b/interface/src/ui/ChatMessageArea.cpp @@ -0,0 +1,44 @@ +// +// ChatMessageArea.cpp +// interface/src/ui +// +// Created by Ryan Huffman on 4/11/14. +// Copyright 2014 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#include "ChatMessageArea.h" +#include +#include + +ChatMessageArea::ChatMessageArea() : QTextBrowser() { + connect(document()->documentLayout(), &QAbstractTextDocumentLayout::documentSizeChanged, + this, &ChatMessageArea::updateLayout); +}; + +void ChatMessageArea::setHtml(const QString& html) { + // Create format with updated line height + QTextBlockFormat format; + format.setLineHeight(CHAT_MESSAGE_LINE_HEIGHT, QTextBlockFormat::ProportionalHeight); + + // Possibly a bug in QT, the format won't take effect if `insertHtml` is used first. Inserting a space and deleting + // it after ensures the format is applied. + QTextCursor cursor = textCursor(); + cursor.setBlockFormat(format); + cursor.insertText(" "); + cursor.insertHtml(html); + cursor.setPosition(0); + cursor.deleteChar(); +}; + +void ChatMessageArea::updateLayout() { + setFixedHeight(document()->size().height()); + updateGeometry(); +} + +void ChatMessageArea::wheelEvent(QWheelEvent* event) { + // Capture wheel events to stop Ctrl-WheelUp/Down zooming + event->ignore(); +}; diff --git a/interface/src/ui/ChatMessageArea.h b/interface/src/ui/ChatMessageArea.h new file mode 100644 index 0000000000..1c49c60b08 --- /dev/null +++ b/interface/src/ui/ChatMessageArea.h @@ -0,0 +1,33 @@ +// +// ChatMessageArea.h +// interface/src/ui +// +// Created by Ryan Huffman on 4/11/14. +// Copyright 2014 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_ChatMessageArea_h +#define hifi_ChatMessageArea_h + +#include + +const int CHAT_MESSAGE_LINE_HEIGHT = 130; + +class ChatMessageArea : public QTextBrowser { + Q_OBJECT +public: + ChatMessageArea(); + virtual void setHtml(const QString& html); + +public slots: + void updateLayout(); + +protected: + virtual void wheelEvent(QWheelEvent* event); + +}; + +#endif // hifi_ChatMessageArea_h diff --git a/interface/src/ui/ChatWindow.cpp b/interface/src/ui/ChatWindow.cpp index c164ea3fb3..9cd0690536 100644 --- a/interface/src/ui/ChatWindow.cpp +++ b/interface/src/ui/ChatWindow.cpp @@ -22,6 +22,7 @@ #include "qtimespan.h" #include "ui_chatWindow.h" #include "XmppClient.h" +#include "ChatMessageArea.h" #include "ChatWindow.h" @@ -241,25 +242,39 @@ void ChatWindow::messageReceived(const QXmppMessage& message) { userLabel->setStyleSheet("padding: 2px; font-weight: bold"); userLabel->setAlignment(Qt::AlignTop | Qt::AlignRight); - QLabel* messageLabel = new QLabel(message.body().replace(regexLinks, "\\1")); - messageLabel->setWordWrap(true); - messageLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); - messageLabel->setOpenExternalLinks(true); - messageLabel->setStyleSheet("padding-bottom: 2px; padding-left: 2px; padding-top: 2px; padding-right: 20px"); - messageLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft); + ChatMessageArea* messageArea = new ChatMessageArea(); - if (getParticipantName(message.from()) == AccountManager::getInstance().getUsername()) { + messageArea->setOpenLinks(true); + messageArea->setOpenExternalLinks(true); + messageArea->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); + messageArea->setTextInteractionFlags(Qt::TextBrowserInteraction); + messageArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + messageArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + messageArea->setReadOnly(true); + + messageArea->setStyleSheet("padding-bottom: 2px;" + "padding-left: 2px;" + "padding-top: 2px;" + "padding-right: 20px;" + "background-color: rgba(0, 0, 0, 0%);" + "border: 0;"); + + bool fromSelf = getParticipantName(message.from()) == AccountManager::getInstance().getUsername(); + if (fromSelf) { userLabel->setStyleSheet(userLabel->styleSheet() + "; background-color: #e1e8ea"); - messageLabel->setStyleSheet(messageLabel->styleSheet() + "; background-color: #e1e8ea"); + messageArea->setStyleSheet(messageArea->styleSheet() + "; background-color: #e1e8ea"); } + messageArea->setHtml(message.body().replace(regexLinks, "\\1")); + bool atBottom = isAtBottom(); ui->messagesGridLayout->addWidget(userLabel, ui->messagesGridLayout->rowCount(), 0); - ui->messagesGridLayout->addWidget(messageLabel, ui->messagesGridLayout->rowCount() - 1, 1); + ui->messagesGridLayout->addWidget(messageArea, ui->messagesGridLayout->rowCount() - 1, 1); + ui->messagesGridLayout->parentWidget()->updateGeometry(); Application::processEvents(); - if (atBottom) { + if (atBottom || fromSelf) { scrollToBottom(); } From 45402336ac9ff702c9440f0a6118b069e23b9f02 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Sat, 12 Apr 2014 00:25:53 -0700 Subject: [PATCH 08/13] Add chat window dragging This was originally implemented by Mohammed Nafees, shared on Basecamp. I've noticed an issue with dragging across screens (monitors) where the chat window will jump vertically. I've tried debugging it, and ultimately it looks like an issue with the `move` method. The coordinates are valid (I tried using global coordinates as well), and the amount to move is correct, but when moving to coordinates on a different screen it doesn't do the right thing. --- interface/src/ui/ChatWindow.cpp | 23 ++++++++++++++++++++++- interface/src/ui/ChatWindow.h | 6 ++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/interface/src/ui/ChatWindow.cpp b/interface/src/ui/ChatWindow.cpp index 9cd0690536..de1362273b 100644 --- a/interface/src/ui/ChatWindow.cpp +++ b/interface/src/ui/ChatWindow.cpp @@ -32,7 +32,9 @@ const QRegularExpression regexLinks("((?:(?:ftp)|(?:https?))://\\S+)"); ChatWindow::ChatWindow() : ui(new Ui::ChatWindow), - numMessagesAfterLastTimeStamp(0) + numMessagesAfterLastTimeStamp(0), + _mousePressed(false), + _mouseStartPosition() { ui->setupUi(this); @@ -83,6 +85,25 @@ ChatWindow::~ChatWindow() { delete ui; } +void ChatWindow::mousePressEvent(QMouseEvent *e) { + if (e->button() == Qt::LeftButton) { + _mousePressed = true; + _mouseStartPosition = e->pos(); + } +} + +void ChatWindow::mouseMoveEvent(QMouseEvent *e) { + if (_mousePressed) { + move(mapToParent(e->pos() - _mouseStartPosition)); + } +} + +void ChatWindow::mouseReleaseEvent( QMouseEvent *e ) { + if ( e->button() == Qt::LeftButton ) { + _mousePressed = false; + } +} + void ChatWindow::keyPressEvent(QKeyEvent* event) { QDockWidget::keyPressEvent(event); if (event->key() == Qt::Key_Escape) { diff --git a/interface/src/ui/ChatWindow.h b/interface/src/ui/ChatWindow.h index 46e7de1c39..4a339ad278 100644 --- a/interface/src/ui/ChatWindow.h +++ b/interface/src/ui/ChatWindow.h @@ -39,6 +39,10 @@ public: virtual void keyPressEvent(QKeyEvent *event); virtual void showEvent(QShowEvent* event); + virtual void mousePressEvent(QMouseEvent *e); + virtual void mouseMoveEvent(QMouseEvent *e); + virtual void mouseReleaseEvent(QMouseEvent *e); + protected: bool eventFilter(QObject* sender, QEvent* event); @@ -54,6 +58,8 @@ private: Ui::ChatWindow* ui; int numMessagesAfterLastTimeStamp; QDateTime lastMessageStamp; + bool _mousePressed; + QPoint _mouseStartPosition; private slots: void connected(); From 8b904b91eaf812537525431af5a1b162a9696332 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Sat, 12 Apr 2014 00:53:43 -0700 Subject: [PATCH 09/13] Cleanup ChatMessageArea.cpp --- interface/src/ui/ChatMessageArea.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/src/ui/ChatMessageArea.cpp b/interface/src/ui/ChatMessageArea.cpp index 936f2dba18..f15b788990 100644 --- a/interface/src/ui/ChatMessageArea.cpp +++ b/interface/src/ui/ChatMessageArea.cpp @@ -16,7 +16,7 @@ ChatMessageArea::ChatMessageArea() : QTextBrowser() { connect(document()->documentLayout(), &QAbstractTextDocumentLayout::documentSizeChanged, this, &ChatMessageArea::updateLayout); -}; +} void ChatMessageArea::setHtml(const QString& html) { // Create format with updated line height @@ -31,7 +31,7 @@ void ChatMessageArea::setHtml(const QString& html) { cursor.insertHtml(html); cursor.setPosition(0); cursor.deleteChar(); -}; +} void ChatMessageArea::updateLayout() { setFixedHeight(document()->size().height()); @@ -41,4 +41,4 @@ void ChatMessageArea::updateLayout() { void ChatMessageArea::wheelEvent(QWheelEvent* event) { // Capture wheel events to stop Ctrl-WheelUp/Down zooming event->ignore(); -}; +} From 2c10b558589d913ecd181c0b7f92f4a5ee5b1406 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Sat, 12 Apr 2014 01:09:29 -0700 Subject: [PATCH 10/13] Remove extraneous debug messages --- interface/src/ui/ChatWindow.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/interface/src/ui/ChatWindow.cpp b/interface/src/ui/ChatWindow.cpp index de1362273b..78d5adf394 100644 --- a/interface/src/ui/ChatWindow.cpp +++ b/interface/src/ui/ChatWindow.cpp @@ -309,14 +309,12 @@ void ChatWindow::messageReceived(const QXmppMessage& message) { bool ChatWindow::isAtBottom() { QScrollBar* verticalScrollBar = ui->messagesScrollArea->verticalScrollBar(); - qDebug() << "Checking for bottom " << verticalScrollBar->sliderPosition() << " " << verticalScrollBar->maximum(); return verticalScrollBar->sliderPosition() == verticalScrollBar->maximum(); } // Scroll chat message area to bottom. void ChatWindow::scrollToBottom() { QScrollBar* verticalScrollBar = ui->messagesScrollArea->verticalScrollBar(); - qDebug() << "Scrolling to " << verticalScrollBar->maximum(); verticalScrollBar->setSliderPosition(verticalScrollBar->maximum()); } From f698f3375aae2da4ed3fc86e8e2f874d27509bc5 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Mon, 14 Apr 2014 11:34:27 -0700 Subject: [PATCH 11/13] Update resource urls for chat window close button --- interface/ui/chatWindow.ui | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/ui/chatWindow.ui b/interface/ui/chatWindow.ui index 9321e1e8ea..0372e00c09 100644 --- a/interface/ui/chatWindow.ui +++ b/interface/ui/chatWindow.ui @@ -139,14 +139,14 @@ QPushButton { background-color: rgba( 0, 0, 0, 0% ); border: none; - image: url(:images/close.svg) + image: url(../resources/images/close.svg) } QPushButton:pressed { background-color: rgba( 0, 0, 0, 0% ); border: none; - image: url(:images/close_down.svg) + image: url(../resources/images/close_down.svg) } From 4ae148ff19d141199648595685593897d67f3f71 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Mon, 14 Apr 2014 11:34:35 -0700 Subject: [PATCH 12/13] Update chat window to not allow movement while docked --- interface/src/ui/ChatWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/ui/ChatWindow.cpp b/interface/src/ui/ChatWindow.cpp index 38e9553723..97fa81afc5 100644 --- a/interface/src/ui/ChatWindow.cpp +++ b/interface/src/ui/ChatWindow.cpp @@ -90,7 +90,7 @@ ChatWindow::~ChatWindow() { } void ChatWindow::mousePressEvent(QMouseEvent *e) { - if (e->button() == Qt::LeftButton) { + if (e->button() == Qt::LeftButton && isFloating()) { _mousePressed = true; _mouseStartPosition = e->pos(); } From 06235decae206efa7caffa868b8ee18babc9c454 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Mon, 14 Apr 2014 14:10:12 -0700 Subject: [PATCH 13/13] Move ChatWindow isAtBottom and moveToBottom outside of HAVE_QXMPP --- interface/src/ui/ChatWindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/ui/ChatWindow.cpp b/interface/src/ui/ChatWindow.cpp index 97fa81afc5..635f1f3d10 100644 --- a/interface/src/ui/ChatWindow.cpp +++ b/interface/src/ui/ChatWindow.cpp @@ -311,6 +311,8 @@ void ChatWindow::messageReceived(const QXmppMessage& message) { } } +#endif + bool ChatWindow::isAtBottom() { QScrollBar* verticalScrollBar = ui->messagesScrollArea->verticalScrollBar(); return verticalScrollBar->sliderPosition() == verticalScrollBar->maximum(); @@ -322,8 +324,6 @@ void ChatWindow::scrollToBottom() { verticalScrollBar->setSliderPosition(verticalScrollBar->maximum()); } -#endif - void ChatWindow::togglePinned() { QMainWindow* mainWindow = Application::getInstance()->getWindow(); mainWindow->removeDockWidget(this);