mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 08:17:35 +02:00
Changed the chat window to a popup with a custom closing button.
This commit is contained in:
parent
0a69b1b038
commit
727903b216
7 changed files with 108 additions and 34 deletions
|
@ -73,8 +73,13 @@ file (GLOB_RECURSE QT_UI_FILES ui/*.ui)
|
||||||
# have qt5 wrap them and generate the appropriate header files
|
# have qt5 wrap them and generate the appropriate header files
|
||||||
qt5_wrap_ui(QT_UI_HEADERS "${QT_UI_FILES}")
|
qt5_wrap_ui(QT_UI_HEADERS "${QT_UI_FILES}")
|
||||||
|
|
||||||
|
# grab the resource files in resources
|
||||||
|
file (GLOB_RECURSE QT_RESOURCE_FILES resources/*.qrc)
|
||||||
|
# have qt5 wrap them and generate the appropriate source files
|
||||||
|
qt5_add_resources(QT_RESOURCES "${QT_RESOURCE_FILES}")
|
||||||
|
|
||||||
# add them to the interface source files
|
# add them to the interface source files
|
||||||
set(INTERFACE_SRCS ${INTERFACE_SRCS} "${QT_UI_HEADERS}")
|
set(INTERFACE_SRCS ${INTERFACE_SRCS} "${QT_UI_HEADERS}" "${QT_RESOURCES}")
|
||||||
|
|
||||||
set(QM ${TARGET_NAME}_en.qm)
|
set(QM ${TARGET_NAME}_en.qm)
|
||||||
set(TS ${TARGET_NAME}_en.ts)
|
set(TS ${TARGET_NAME}_en.ts)
|
||||||
|
|
|
@ -4,22 +4,22 @@
|
||||||
<context>
|
<context>
|
||||||
<name>Application</name>
|
<name>Application</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="src/Application.cpp" line="1351"/>
|
<location filename="src/Application.cpp" line="1354"/>
|
||||||
<source>Export Voxels</source>
|
<source>Export Voxels</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="src/Application.cpp" line="1352"/>
|
<location filename="src/Application.cpp" line="1355"/>
|
||||||
<source>Sparse Voxel Octree Files (*.svo)</source>
|
<source>Sparse Voxel Octree Files (*.svo)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="src/Application.cpp" line="3531"/>
|
<location filename="src/Application.cpp" line="3554"/>
|
||||||
<source>Open Script</source>
|
<source>Open Script</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="src/Application.cpp" line="3532"/>
|
<location filename="src/Application.cpp" line="3555"/>
|
||||||
<source>JavaScript Files (*.js)</source>
|
<source>JavaScript Files (*.js)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -28,19 +28,19 @@
|
||||||
<name>ChatWindow</name>
|
<name>ChatWindow</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="ui/chatWindow.ui" line="14"/>
|
<location filename="ui/chatWindow.ui" line="14"/>
|
||||||
<location filename="../build/interface/ui_chatWindow.h" line="114"/>
|
<location filename="../build/interface/ui_chatWindow.h" line="141"/>
|
||||||
<source>Chat</source>
|
<source>Chat</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="ui/chatWindow.ui" line="41"/>
|
<location filename="ui/chatWindow.ui" line="41"/>
|
||||||
<location filename="../build/interface/ui_chatWindow.h" line="115"/>
|
<location filename="../build/interface/ui_chatWindow.h" line="142"/>
|
||||||
<source>Connecting to XMPP...</source>
|
<source>Connecting to XMPP...</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="ui/chatWindow.ui" line="60"/>
|
<location filename="ui/chatWindow.ui" line="62"/>
|
||||||
<location filename="../build/interface/ui_chatWindow.h" line="116"/>
|
<location filename="../build/interface/ui_chatWindow.h" line="143"/>
|
||||||
<source> online now:</source>
|
<source> online now:</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
|
14
interface/resources/images/close.svg
Normal file
14
interface/resources/images/close.svg
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
viewBox="0 0 15.9 15.9" enable-background="new 0 0 15.9 15.9" xml:space="preserve">
|
||||||
|
<g>
|
||||||
|
<g>
|
||||||
|
<path fill="#666666" d="M15.5,13.7l-1.8,1.8c-0.2,0.2-0.6,0.4-0.9,0.4s-0.7-0.1-0.9-0.4L8,11.6L4,15.5c-0.2,0.2-0.6,0.4-0.9,0.4
|
||||||
|
s-0.7-0.1-0.9-0.4l-1.8-1.8C0.1,13.5,0,13.1,0,12.8s0.1-0.7,0.4-0.9L4.3,8L0.4,4C0.1,3.8,0,3.4,0,3.1s0.1-0.7,0.4-0.9l1.8-1.8
|
||||||
|
C2.4,0.1,2.8,0,3.1,0S3.8,0.1,4,0.4L8,4.3l3.9-3.9C12.1,0.1,12.5,0,12.8,0s0.7,0.1,0.9,0.4l1.8,1.8c0.2,0.2,0.4,0.6,0.4,0.9
|
||||||
|
S15.8,3.8,15.5,4L11.6,8l3.9,3.9c0.2,0.2,0.4,0.6,0.4,0.9S15.8,13.5,15.5,13.7z"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 944 B |
5
interface/resources/resources.qrc
Normal file
5
interface/resources/resources.qrc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<RCC>
|
||||||
|
<qresource prefix="/">
|
||||||
|
<file>images/close.svg</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
|
@ -1039,15 +1039,10 @@ void Menu::showChat() {
|
||||||
if (!_chatWindow) {
|
if (!_chatWindow) {
|
||||||
_chatWindow = new ChatWindow();
|
_chatWindow = new ChatWindow();
|
||||||
QMainWindow* mainWindow = Application::getInstance()->getWindow();
|
QMainWindow* mainWindow = Application::getInstance()->getWindow();
|
||||||
|
|
||||||
// the height of the title bar is given by frameGeometry().height() - geometry().height()
|
|
||||||
// however, frameGeometry() is initialised after showing (Qt queries the OS windowing system)
|
|
||||||
// on the other hand, moving a window after showing it flickers; so just use some reasonable value
|
|
||||||
int titleBarHeight = 16;
|
|
||||||
_chatWindow->setGeometry(mainWindow->width() - _chatWindow->width(),
|
_chatWindow->setGeometry(mainWindow->width() - _chatWindow->width(),
|
||||||
mainWindow->geometry().y() + titleBarHeight,
|
mainWindow->geometry().y(),
|
||||||
_chatWindow->width(),
|
_chatWindow->width(),
|
||||||
mainWindow->height() - titleBarHeight);
|
mainWindow->height());
|
||||||
_chatWindow->show();
|
_chatWindow->show();
|
||||||
}
|
}
|
||||||
_chatWindow->raise();
|
_chatWindow->raise();
|
||||||
|
|
|
@ -28,7 +28,7 @@ const int NUM_MESSAGES_TO_TIME_STAMP = 20;
|
||||||
const QRegularExpression regexLinks("((?:(?:ftp)|(?:https?))://\\S+)");
|
const QRegularExpression regexLinks("((?:(?:ftp)|(?:https?))://\\S+)");
|
||||||
|
|
||||||
ChatWindow::ChatWindow() :
|
ChatWindow::ChatWindow() :
|
||||||
QDialog(Application::getInstance()->getGLWidget(), Qt::Tool),
|
QDialog(Application::getInstance()->getGLWidget(), Qt::CustomizeWindowHint),
|
||||||
ui(new Ui::ChatWindow),
|
ui(new Ui::ChatWindow),
|
||||||
numMessagesAfterLastTimeStamp(0)
|
numMessagesAfterLastTimeStamp(0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,20 +46,53 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="numOnlineLabel">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<property name="sizePolicy">
|
<item>
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<widget class="QLabel" name="numOnlineLabel">
|
||||||
<horstretch>0</horstretch>
|
<property name="sizePolicy">
|
||||||
<verstretch>0</verstretch>
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
</sizepolicy>
|
<horstretch>0</horstretch>
|
||||||
</property>
|
<verstretch>0</verstretch>
|
||||||
<property name="styleSheet">
|
</sizepolicy>
|
||||||
<string notr="true">font-weight: bold; color: palette(shadow); margin-bottom: 4px;</string>
|
</property>
|
||||||
</property>
|
<property name="styleSheet">
|
||||||
<property name="text">
|
<string notr="true">font-weight: bold; color: palette(shadow); margin-bottom: 4px;</string>
|
||||||
<string> online now:</string>
|
</property>
|
||||||
</property>
|
<property name="text">
|
||||||
</widget>
|
<string> online now:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="closeButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../resources/resources.qrc">
|
||||||
|
<normaloff>:/images/close.svg</normaloff>:/images/close.svg</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="usersWidget" native="true"/>
|
<widget class="QWidget" name="usersWidget" native="true"/>
|
||||||
|
@ -81,7 +114,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>358</width>
|
<width>358</width>
|
||||||
<height>454</height>
|
<height>452</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
|
@ -133,6 +166,9 @@
|
||||||
<property name="sizeAdjustPolicy">
|
<property name="sizeAdjustPolicy">
|
||||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="tabChangesFocus">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -141,6 +177,25 @@
|
||||||
<tabstop>messagePlainTextEdit</tabstop>
|
<tabstop>messagePlainTextEdit</tabstop>
|
||||||
<tabstop>messagesScrollArea</tabstop>
|
<tabstop>messagesScrollArea</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources>
|
||||||
<connections/>
|
<include location="../resources/resources.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>closeButton</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>ChatWindow</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>342</x>
|
||||||
|
<y>42</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>550</x>
|
||||||
|
<y>42</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
Loading…
Reference in a new issue