Changed the dock widget for the chat so that it replicates the agreed

upon design.
This commit is contained in:
Dimitar Dobrev 2014-03-24 17:37:34 +02:00
parent 5073439007
commit e27f191413
3 changed files with 177 additions and 173 deletions

View file

@ -27,25 +27,25 @@
<context>
<name>ChatWindow</name>
<message>
<location filename="ui/chatWindow.ui" line="20"/>
<location filename="../build/interface/ui_chatWindow.h" line="146"/>
<location filename="ui/chatWindow.ui" line="26"/>
<location filename="../build/interface/ui_chatWindow.h" line="152"/>
<source>Chat</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/chatWindow.ui" line="50"/>
<location filename="../build/interface/ui_chatWindow.h" line="147"/>
<location filename="ui/chatWindow.ui" line="54"/>
<location filename="../build/interface/ui_chatWindow.h" line="153"/>
<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="148"/>
<location filename="ui/chatWindow.ui" line="75"/>
<location filename="../build/interface/ui_chatWindow.h" line="154"/>
<source> online now:</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="src/ui/ChatWindow.cpp" line="136"/>
<location filename="src/ui/ChatWindow.cpp" line="135"/>
<source>day</source>
<translation>
<numerusform>%n day</numerusform>
@ -53,7 +53,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="src/ui/ChatWindow.cpp" line="136"/>
<location filename="src/ui/ChatWindow.cpp" line="135"/>
<source>hour</source>
<translation>
<numerusform>%n hour</numerusform>
@ -61,7 +61,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="src/ui/ChatWindow.cpp" line="136"/>
<location filename="src/ui/ChatWindow.cpp" line="135"/>
<source>minute</source>
<translation>
<numerusform>%n minute</numerusform>
@ -76,7 +76,7 @@
</translation>
</message>
<message>
<location filename="src/ui/ChatWindow.cpp" line="192"/>
<location filename="src/ui/ChatWindow.cpp" line="191"/>
<source>%1 online now:</source>
<translation type="unfinished"></translation>
</message>

View file

@ -30,10 +30,10 @@ ChatWindow::ChatWindow() :
ui(new Ui::ChatWindow),
numMessagesAfterLastTimeStamp(0)
{
QWidget* widget = new QWidget();
setWidget(widget);
ui->setupUi(this);
ui->setupUi(widget);
// remove the title bar (see the Qt docs on setTitleBarWidget)
setTitleBarWidget(new QWidget());
FlowLayout* flowLayout = new FlowLayout(0, 4, 4);
ui->usersWidget->setLayout(flowLayout);
@ -43,8 +43,6 @@ ChatWindow::ChatWindow() :
ui->messagePlainTextEdit->installEventFilter(this);
ui->closeButton->hide();
#ifdef HAVE_QXMPP
const QXmppClient& xmppClient = XmppClient::getInstance().getXMPPClient();
if (xmppClient.isConnected()) {
@ -78,15 +76,16 @@ ChatWindow::~ChatWindow() {
}
void ChatWindow::keyPressEvent(QKeyEvent* event) {
QWidget::keyPressEvent(event);
QDockWidget::keyPressEvent(event);
if (event->key() == Qt::Key_Escape) {
hide();
}
}
void ChatWindow::showEvent(QShowEvent* event) {
QWidget::showEvent(event);
QDockWidget::showEvent(event);
if (!event->spontaneous()) {
activateWindow();
ui->messagePlainTextEdit->setFocus();
}
}

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ChatWindow</class>
<widget class="QWidget" name="ChatWindow">
<widget class="QDockWidget" name="ChatWindow">
<property name="geometry">
<rect>
<x>0</x>
@ -13,15 +13,19 @@
<property name="minimumSize">
<size>
<width>400</width>
<height>0</height>
<height>238</height>
</size>
</property>
<property name="windowTitle">
<string>Chat</string>
</property>
<property name="styleSheet">
<string notr="true">font-family: Helvetica, Arial, sans-serif;</string>
</property>
<property name="features">
<set>QDockWidget::NoDockWidgetFeatures</set>
</property>
<property name="windowTitle">
<string>Chat</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
@ -188,6 +192,7 @@
</item>
</layout>
</widget>
</widget>
<tabstops>
<tabstop>messagePlainTextEdit</tabstop>
<tabstop>messagesScrollArea</tabstop>