Restored code that Git had somehow deleted.

This commit is contained in:
Dimitar Dobrev 2014-03-28 19:26:16 +02:00
parent 4bc6fd38cb
commit 9b43508098

View file

@ -1102,13 +1102,23 @@ void Menu::showMetavoxelEditor() {
} }
void Menu::showChat() { void Menu::showChat() {
QMainWindow* mainWindow = Application::getInstance()->getWindow();
if (!_chatWindow) { if (!_chatWindow) {
Application::getInstance()->getWindow()->addDockWidget(Qt::RightDockWidgetArea, _chatWindow = new ChatWindow()); mainWindow->addDockWidget(Qt::NoDockWidgetArea, _chatWindow = new ChatWindow());
}
} else { if (!_chatWindow->toggleViewAction()->isChecked()) {
if (!_chatWindow->toggleViewAction()->isChecked()) { int width = _chatWindow->width();
_chatWindow->toggleViewAction()->trigger(); int y = qMax((mainWindow->height() - _chatWindow->height()) / 2, 0);
} _chatWindow->move(mainWindow->width(), y);
_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);
} }
} }