Make chat a dock widget, since that's the behavior it's emulating anyway

(and for some reason, the current strategy causes a problem on at least Ryan's
and my machine).
This commit is contained in:
Andrzej Kapolka 2014-03-14 10:43:12 -07:00
parent 2f13d1e30c
commit b721533f0b
5 changed files with 13 additions and 24 deletions

View file

@ -4,22 +4,22 @@
<context>
<name>Application</name>
<message>
<location filename="src/Application.cpp" line="1362"/>
<location filename="src/Application.cpp" line="1354"/>
<source>Export Voxels</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/Application.cpp" line="1363"/>
<location filename="src/Application.cpp" line="1355"/>
<source>Sparse Voxel Octree Files (*.svo)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/Application.cpp" line="3573"/>
<location filename="src/Application.cpp" line="3565"/>
<source>Open Script</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/Application.cpp" line="3574"/>
<location filename="src/Application.cpp" line="3566"/>
<source>JavaScript Files (*.js)</source>
<translation type="unfinished"></translation>
</message>
@ -45,7 +45,7 @@
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="src/ui/ChatWindow.cpp" line="124"/>
<location filename="src/ui/ChatWindow.cpp" line="123"/>
<source>day</source>
<translation>
<numerusform>%n day</numerusform>
@ -53,7 +53,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="src/ui/ChatWindow.cpp" line="124"/>
<location filename="src/ui/ChatWindow.cpp" line="123"/>
<source>hour</source>
<translation>
<numerusform>%n hour</numerusform>
@ -61,7 +61,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="src/ui/ChatWindow.cpp" line="124"/>
<location filename="src/ui/ChatWindow.cpp" line="123"/>
<source>minute</source>
<translation>
<numerusform>%n minute</numerusform>
@ -76,7 +76,7 @@
</translation>
</message>
<message>
<location filename="src/ui/ChatWindow.cpp" line="179"/>
<location filename="src/ui/ChatWindow.cpp" line="178"/>
<source>%1 online now:</source>
<translation type="unfinished"></translation>
</message>

View file

@ -27,7 +27,6 @@
#include <QColorDialog>
#include <QDesktopWidget>
#include <QCheckBox>
#include <QHBoxLayout>
#include <QImage>
#include <QKeyEvent>
#include <QMainWindow>
@ -292,14 +291,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
ResourceCache::setNetworkAccessManager(_networkAccessManager);
ResourceCache::setRequestLimit(3);
QWidget* centralWidget = new QWidget();
QHBoxLayout* mainLayout = new QHBoxLayout();
mainLayout->setSpacing(0);
mainLayout->setContentsMargins(0, 0, 0, 0);
centralWidget->setLayout(mainLayout);
_glWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
centralWidget->layout()->addWidget(_glWidget);
_window->setCentralWidget(centralWidget);
_window->setCentralWidget(_glWidget);
restoreSizeAndPosition();

View file

@ -1044,10 +1044,8 @@ void Menu::showMetavoxelEditor() {
void Menu::showChat() {
if (!_chatWindow) {
_chatWindow = new ChatWindow();
QMainWindow* mainWindow = Application::getInstance()->getWindow();
QBoxLayout* boxLayout = static_cast<QBoxLayout*>(mainWindow->centralWidget()->layout());
boxLayout->addWidget(_chatWindow, 0, Qt::AlignRight);
Application::getInstance()->getWindow()->addDockWidget(Qt::RightDockWidgetArea, _chatWindow = new ChatWindow());
} else {
if (!_chatWindow->isVisible()) {
_chatWindow->show();

View file

@ -28,7 +28,6 @@ const int NUM_MESSAGES_TO_TIME_STAMP = 20;
const QRegularExpression regexLinks("((?:(?:ftp)|(?:https?))://\\S+)");
ChatWindow::ChatWindow() :
QWidget(),
ui(new Ui::ChatWindow),
numMessagesAfterLastTimeStamp(0)
{

View file

@ -10,8 +10,8 @@
#define __interface__ChatWindow__
#include <QDateTime>
#include <QDockWidget>
#include <QTimer>
#include <QWidget>
#include <Application.h>
@ -26,7 +26,7 @@ namespace Ui {
class ChatWindow;
}
class ChatWindow : public QWidget {
class ChatWindow : public QDockWidget {
Q_OBJECT
public: