Add margin to chat window for titlebar + menu

This commit is contained in:
Ryan Huffman 2014-09-04 07:20:27 -07:00
parent bbc1bbdf47
commit 51e616d122
2 changed files with 14 additions and 5 deletions

View file

@ -1456,7 +1456,9 @@ void Menu::showChat() {
if (_chatWindow->isHidden()) {
_chatWindow->show();
}
_chatWindow->raise();
_chatWindow->activateWindow();
_chatWindow->setFocus();
} else {
Application::getInstance()->getTrayIcon()->showMessage("Interface", "You need to login to be able to chat with others on this domain.");
}
@ -1468,6 +1470,9 @@ void Menu::toggleChat() {
if (!_chatAction->isEnabled() && _chatWindow && AccountManager::getInstance().isLoggedIn()) {
if (_chatWindow->isHidden()) {
_chatWindow->show();
_chatWindow->raise();
_chatWindow->activateWindow();
_chatWindow->setFocus();
} else {
_chatWindow->hide();
}

View file

@ -18,12 +18,13 @@
#include <QTimer>
#include "Application.h"
#include "ChatMessageArea.h"
#include "FlowLayout.h"
#include "qtimespan.h"
#include "ui_chatWindow.h"
#include "UIUtil.h"
#include "XmppClient.h"
#include "ChatMessageArea.h"
#include "ui_chatWindow.h"
#include "ChatWindow.h"
@ -120,10 +121,13 @@ void ChatWindow::showEvent(QShowEvent* event) {
if (!event->spontaneous()) {
ui->messagePlainTextEdit->setFocus();
}
const QRect parentGeometry = parentWidget()->geometry();
setGeometry(parentGeometry.topRight().x() - size().width(), parentGeometry.topRight().y(),
size().width(), parentWidget()->height());
int titleBarHeight = UIUtil::getWindowTitleBarHeight(this);
int menuBarHeight = Menu::getInstance()->geometry().height();
int topMargin = titleBarHeight + menuBarHeight;
setGeometry(parentGeometry.topRight().x() - size().width() + 1, parentGeometry.topRight().y() + topMargin,
size().width(), parentWidget()->height() - topMargin);
#ifdef HAVE_QXMPP
const QXmppClient& xmppClient = XmppClient::getInstance().getXMPPClient();