3
0
Fork 0
mirror of https://github.com/lubosz/overte.git synced 2025-04-26 10:55:37 +02:00

Put the chat window above the 3D view and animated its showing.

This commit is contained in:
Dimitar Dobrev 2014-03-26 23:44:31 +02:00
parent 4374e28e9c
commit 3907c563df
3 changed files with 31 additions and 16 deletions

View file

@ -27,20 +27,20 @@
<context>
<name>ChatWindow</name>
<message>
<location filename="ui/chatWindow.ui" line="26"/>
<location filename="../build/interface/ui_chatWindow.h" line="152"/>
<location filename="ui/chatWindow.ui" line="29"/>
<location filename="../build/interface/ui_chatWindow.h" line="153"/>
<source>Chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/chatWindow.ui" line="54"/>
<location filename="../build/interface/ui_chatWindow.h" line="153"/>
<location filename="ui/chatWindow.ui" line="57"/>
<location filename="../build/interface/ui_chatWindow.h" line="154"/>
<source>Connecting to XMPP...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/chatWindow.ui" line="75"/>
<location filename="../build/interface/ui_chatWindow.h" line="154"/>
<location filename="ui/chatWindow.ui" line="78"/>
<location filename="../build/interface/ui_chatWindow.h" line="155"/>
<source> online now:</source>
<translation type="unfinished"></translation>
</message>
@ -113,18 +113,18 @@
<context>
<name>Menu</name>
<message>
<location filename="src/Menu.cpp" line="456"/>
<location filename="src/Menu.cpp" line="458"/>
<source>Open .ini config file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/Menu.cpp" line="458"/>
<location filename="src/Menu.cpp" line="470"/>
<location filename="src/Menu.cpp" line="460"/>
<location filename="src/Menu.cpp" line="472"/>
<source>Text files (*.ini)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/Menu.cpp" line="468"/>
<location filename="src/Menu.cpp" line="470"/>
<source>Save .ini config file</source>
<translation type="unfinished"></translation>
</message>

View file

@ -20,6 +20,8 @@
#include <QMainWindow>
#include <QMenuBar>
#include <QMessageBox>
#include <QParallelAnimationGroup>
#include <QPropertyAnimation>
#include <QShortcut>
#include <QSlider>
#include <QStandardPaths>
@ -1103,13 +1105,23 @@ void Menu::showMetavoxelEditor() {
}
void Menu::showChat() {
QMainWindow* mainWindow = Application::getInstance()->getWindow();
if (!_chatWindow) {
Application::getInstance()->getWindow()->addDockWidget(Qt::RightDockWidgetArea, _chatWindow = new ChatWindow());
} else {
if (!_chatWindow->toggleViewAction()->isChecked()) {
_chatWindow->toggleViewAction()->trigger();
}
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);
_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);
}
}

View file

@ -22,6 +22,9 @@
<property name="features">
<set>QDockWidget::NoDockWidgetFeatures</set>
</property>
<property name="allowedAreas">
<set>Qt::NoDockWidgetArea</set>
</property>
<property name="windowTitle">
<string>Chat</string>
</property>