3
0
Fork 0
mirror of https://github.com/lubosz/overte.git synced 2025-04-26 16:35:28 +02:00

Gave more space to the user in sent messages so that resizing of the

column for messages occurs for really long user names.
This commit is contained in:
Dimitar Dobrev 2014-03-17 18:05:16 +02:00
parent a48ca65236
commit d764ef79ed
3 changed files with 33 additions and 28 deletions

View file

@ -28,24 +28,24 @@
<name>ChatWindow</name>
<message>
<location filename="ui/chatWindow.ui" line="20"/>
<location filename="../build/interface/ui_chatWindow.h" line="143"/>
<location filename="../build/interface/ui_chatWindow.h" line="146"/>
<source>Chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/chatWindow.ui" line="50"/>
<location filename="../build/interface/ui_chatWindow.h" line="144"/>
<location filename="../build/interface/ui_chatWindow.h" line="147"/>
<source>Connecting to XMPP...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/chatWindow.ui" line="71"/>
<location filename="../build/interface/ui_chatWindow.h" line="145"/>
<location filename="../build/interface/ui_chatWindow.h" line="148"/>
<source> online now:</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="src/ui/ChatWindow.cpp" line="133"/>
<location filename="src/ui/ChatWindow.cpp" line="136"/>
<source>day</source>
<translation>
<numerusform>%n day</numerusform>
@ -53,7 +53,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="src/ui/ChatWindow.cpp" line="133"/>
<location filename="src/ui/ChatWindow.cpp" line="136"/>
<source>hour</source>
<translation>
<numerusform>%n hour</numerusform>
@ -61,7 +61,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="src/ui/ChatWindow.cpp" line="133"/>
<location filename="src/ui/ChatWindow.cpp" line="136"/>
<source>minute</source>
<translation>
<numerusform>%n minute</numerusform>
@ -76,7 +76,7 @@
</translation>
</message>
<message>
<location filename="src/ui/ChatWindow.cpp" line="188"/>
<location filename="src/ui/ChatWindow.cpp" line="192"/>
<source>%1 online now:</source>
<translation type="unfinished"></translation>
</message>

View file

@ -6,7 +6,7 @@
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
//
#include <QFormLayout>
#include <QGridLayout>
#include <QFrame>
#include <QLayoutItem>
#include <QPalette>
@ -38,6 +38,9 @@ ChatWindow::ChatWindow() :
FlowLayout* flowLayout = new FlowLayout(0, 4, 4);
ui->usersWidget->setLayout(flowLayout);
ui->messagesGridLayout->setColumnStretch(0, 1);
ui->messagesGridLayout->setColumnStretch(1, 3);
ui->messagePlainTextEdit->installEventFilter(this);
ui->closeButton->hide();
@ -143,8 +146,9 @@ void ChatWindow::addTimeStamp() {
timeLabel->setStyleSheet("color: palette(shadow);"
"background-color: palette(highlight);"
"padding: 4px;");
timeLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
timeLabel->setAlignment(Qt::AlignHCenter);
ui->messagesFormLayout->addRow(timeLabel);
ui->messagesGridLayout->addWidget(timeLabel, ui->messagesGridLayout->rowCount(), 0, 1, 2);
numMessagesAfterLastTimeStamp = 0;
}
}
@ -217,7 +221,7 @@ void ChatWindow::messageReceived(const QXmppMessage& message) {
}
QLabel* userLabel = new QLabel(getParticipantName(message.from()));
userLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
userLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
userLabel->setStyleSheet("padding: 2px; font-weight: bold");
userLabel->setAlignment(Qt::AlignTop);
@ -228,8 +232,9 @@ void ChatWindow::messageReceived(const QXmppMessage& message) {
messageLabel->setStyleSheet("padding: 2px; margin-right: 20px");
messageLabel->setAlignment(Qt::AlignTop);
ui->messagesFormLayout->addRow(userLabel, messageLabel);
ui->messagesFormLayout->parentWidget()->updateGeometry();
ui->messagesGridLayout->addWidget(userLabel, ui->messagesGridLayout->rowCount(), 0, Qt::AlignTop | Qt::AlignRight);
ui->messagesGridLayout->addWidget(messageLabel, ui->messagesGridLayout->rowCount() - 1, 1);
ui->messagesGridLayout->parentWidget()->updateGeometry();
Application::processEvents();
QScrollBar* verticalScrollBar = ui->messagesScrollArea->verticalScrollBar();
verticalScrollBar->setSliderPosition(verticalScrollBar->maximum());

View file

@ -122,34 +122,34 @@
<rect>
<x>0</x>
<y>0</y>
<width>358</width>
<height>464</height>
<width>382</width>
<height>16</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">margin-top: 0px;</string>
</property>
<layout class="QFormLayout" name="messagesFormLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="horizontalSpacing">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<layout class="QGridLayout" name="messagesGridLayout">
<property name="leftMargin">
<number>4</number>
<number>0</number>
</property>
<property name="topMargin">
<number>4</number>
<number>0</number>
</property>
<property name="rightMargin">
<number>4</number>
<number>0</number>
</property>
<property name="bottomMargin">
<number>4</number>
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
</layout>
</widget>