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> <context>
<name>Application</name> <name>Application</name>
<message> <message>
<location filename="src/Application.cpp" line="1362"/> <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="1363"/> <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="3573"/> <location filename="src/Application.cpp" line="3565"/>
<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="3574"/> <location filename="src/Application.cpp" line="3566"/>
<source>JavaScript Files (*.js)</source> <source>JavaScript Files (*.js)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -45,7 +45,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<location filename="src/ui/ChatWindow.cpp" line="124"/> <location filename="src/ui/ChatWindow.cpp" line="123"/>
<source>day</source> <source>day</source>
<translation> <translation>
<numerusform>%n day</numerusform> <numerusform>%n day</numerusform>
@ -53,7 +53,7 @@
</translation> </translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<location filename="src/ui/ChatWindow.cpp" line="124"/> <location filename="src/ui/ChatWindow.cpp" line="123"/>
<source>hour</source> <source>hour</source>
<translation> <translation>
<numerusform>%n hour</numerusform> <numerusform>%n hour</numerusform>
@ -61,7 +61,7 @@
</translation> </translation>
</message> </message>
<message numerus="yes"> <message numerus="yes">
<location filename="src/ui/ChatWindow.cpp" line="124"/> <location filename="src/ui/ChatWindow.cpp" line="123"/>
<source>minute</source> <source>minute</source>
<translation> <translation>
<numerusform>%n minute</numerusform> <numerusform>%n minute</numerusform>
@ -76,7 +76,7 @@
</translation> </translation>
</message> </message>
<message> <message>
<location filename="src/ui/ChatWindow.cpp" line="179"/> <location filename="src/ui/ChatWindow.cpp" line="178"/>
<source>%1 online now:</source> <source>%1 online now:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View file

@ -27,7 +27,6 @@
#include <QColorDialog> #include <QColorDialog>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QCheckBox> #include <QCheckBox>
#include <QHBoxLayout>
#include <QImage> #include <QImage>
#include <QKeyEvent> #include <QKeyEvent>
#include <QMainWindow> #include <QMainWindow>
@ -292,14 +291,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
ResourceCache::setNetworkAccessManager(_networkAccessManager); ResourceCache::setNetworkAccessManager(_networkAccessManager);
ResourceCache::setRequestLimit(3); ResourceCache::setRequestLimit(3);
QWidget* centralWidget = new QWidget(); _window->setCentralWidget(_glWidget);
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);
restoreSizeAndPosition(); restoreSizeAndPosition();

View file

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

View file

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

View file

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