mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 18:13:29 +02:00
Merge pull request #2311 from ey6es/master
Make the chat window a Qt dock widget; that seems to be what it was trying to emulate. This fixes the issue on startup that Ryan and I experienced.
This commit is contained in:
commit
8d3da1ba70
8 changed files with 46 additions and 46 deletions
|
@ -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="128"/>
|
||||
<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="128"/>
|
||||
<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="128"/>
|
||||
<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="183"/>
|
||||
<source>%1 online now:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -1044,13 +1044,11 @@ 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();
|
||||
if (!_chatWindow->toggleViewAction()->isChecked()) {
|
||||
_chatWindow->toggleViewAction()->trigger();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1058,8 +1056,8 @@ void Menu::showChat() {
|
|||
void Menu::toggleChat() {
|
||||
#ifdef HAVE_QXMPP
|
||||
_chatAction->setEnabled(XmppClient::getInstance().getXMPPClient().isConnected());
|
||||
if (!_chatAction->isEnabled() && _chatWindow) {
|
||||
_chatWindow->hide();
|
||||
if (!_chatAction->isEnabled() && _chatWindow && _chatWindow->toggleViewAction()->isChecked()) {
|
||||
_chatWindow->toggleViewAction()->trigger();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -36,9 +36,9 @@ Head::Head(Avatar* owningAvatar) :
|
|||
_leftEyeBlinkVelocity(0.0f),
|
||||
_rightEyeBlinkVelocity(0.0f),
|
||||
_timeWithoutTalking(0.0f),
|
||||
_tweakedPitch(0.f),
|
||||
_tweakedYaw(0.f),
|
||||
_tweakedRoll(0.f),
|
||||
_pitchTweak(0.f),
|
||||
_yawTweak(0.f),
|
||||
_rollTweak(0.f),
|
||||
_isCameraMoving(false),
|
||||
_faceModel(this)
|
||||
{
|
||||
|
@ -202,15 +202,15 @@ glm::vec3 Head::getScalePivot() const {
|
|||
}
|
||||
|
||||
float Head::getTweakedYaw() const {
|
||||
return glm::clamp(_yaw + _tweakedYaw, MIN_HEAD_YAW, MAX_HEAD_YAW);
|
||||
return glm::clamp(_yaw + _yawTweak, MIN_HEAD_YAW, MAX_HEAD_YAW);
|
||||
}
|
||||
|
||||
float Head::getTweakedPitch() const {
|
||||
return glm::clamp(_pitch + _tweakedPitch, MIN_HEAD_PITCH, MAX_HEAD_PITCH);
|
||||
return glm::clamp(_pitch + _pitchTweak, MIN_HEAD_PITCH, MAX_HEAD_PITCH);
|
||||
}
|
||||
|
||||
float Head::getTweakedRoll() const {
|
||||
return glm::clamp(_roll + _tweakedRoll, MIN_HEAD_ROLL, MAX_HEAD_ROLL);
|
||||
return glm::clamp(_roll + _rollTweak, MIN_HEAD_ROLL, MAX_HEAD_ROLL);
|
||||
}
|
||||
|
||||
void Head::applyCollision(CollisionInfo& collision) {
|
||||
|
|
|
@ -70,10 +70,15 @@ public:
|
|||
/// Returns the point about which scaling occurs.
|
||||
glm::vec3 getScalePivot() const;
|
||||
|
||||
void tweakPitch(float pitch) { _tweakedPitch = pitch; }
|
||||
void tweakYaw(float yaw) { _tweakedYaw = yaw; }
|
||||
void tweakRoll(float roll) { _tweakedRoll = roll; }
|
||||
void setPitchTweak(float pitch) { _pitchTweak = pitch; }
|
||||
float getPitchTweak() const { return _pitchTweak; }
|
||||
|
||||
void setYawTweak(float yaw) { _yawTweak = yaw; }
|
||||
float getYawTweak() const { return _yawTweak; }
|
||||
|
||||
void setRollTweak(float roll) { _rollTweak = roll; }
|
||||
float getRollTweak() const { return _rollTweak; }
|
||||
|
||||
virtual float getTweakedPitch() const;
|
||||
virtual float getTweakedYaw() const;
|
||||
virtual float getTweakedRoll() const;
|
||||
|
@ -104,9 +109,9 @@ private:
|
|||
float _timeWithoutTalking;
|
||||
|
||||
// tweaked angles affect the rendered head, but not the camera
|
||||
float _tweakedPitch;
|
||||
float _tweakedYaw;
|
||||
float _tweakedRoll;
|
||||
float _pitchTweak;
|
||||
float _yawTweak;
|
||||
float _rollTweak;
|
||||
|
||||
bool _isCameraMoving;
|
||||
FaceModel _faceModel;
|
||||
|
|
|
@ -363,8 +363,9 @@ void MyAvatar::updateFromGyros(float deltaTime) {
|
|||
// restore rotation, lean to neutral positions
|
||||
const float RESTORE_PERIOD = 1.f; // seconds
|
||||
float restorePercentage = glm::clamp(deltaTime/RESTORE_PERIOD, 0.f, 1.f);
|
||||
head->setYaw(glm::mix(head->getYaw(), 0.0f, restorePercentage));
|
||||
head->setRoll(glm::mix(head->getRoll(), 0.0f, restorePercentage));
|
||||
head->setPitchTweak(glm::mix(head->getPitchTweak(), 0.0f, restorePercentage));
|
||||
head->setYawTweak(glm::mix(head->getYawTweak(), 0.0f, restorePercentage));
|
||||
head->setRollTweak(glm::mix(head->getRollTweak(), 0.0f, restorePercentage));
|
||||
head->setLeanSideways(glm::mix(head->getLeanSideways(), 0.0f, restorePercentage));
|
||||
head->setLeanForward(glm::mix(head->getLeanForward(), 0.0f, restorePercentage));
|
||||
return;
|
||||
|
@ -375,9 +376,9 @@ void MyAvatar::updateFromGyros(float deltaTime) {
|
|||
const float AVATAR_HEAD_PITCH_MAGNIFY = 1.0f;
|
||||
const float AVATAR_HEAD_YAW_MAGNIFY = 1.0f;
|
||||
const float AVATAR_HEAD_ROLL_MAGNIFY = 1.0f;
|
||||
head->tweakPitch(estimatedRotation.x * AVATAR_HEAD_PITCH_MAGNIFY);
|
||||
head->tweakYaw(estimatedRotation.y * AVATAR_HEAD_YAW_MAGNIFY);
|
||||
head->tweakRoll(estimatedRotation.z * AVATAR_HEAD_ROLL_MAGNIFY);
|
||||
head->setPitchTweak(estimatedRotation.x * AVATAR_HEAD_PITCH_MAGNIFY);
|
||||
head->setYawTweak(estimatedRotation.y * AVATAR_HEAD_YAW_MAGNIFY);
|
||||
head->setRollTweak(estimatedRotation.z * AVATAR_HEAD_ROLL_MAGNIFY);
|
||||
|
||||
// Update torso lean distance based on accelerometer data
|
||||
const float TORSO_LENGTH = 0.5f;
|
||||
|
|
|
@ -28,17 +28,21 @@ const int NUM_MESSAGES_TO_TIME_STAMP = 20;
|
|||
const QRegularExpression regexLinks("((?:(?:ftp)|(?:https?))://\\S+)");
|
||||
|
||||
ChatWindow::ChatWindow() :
|
||||
QWidget(),
|
||||
ui(new Ui::ChatWindow),
|
||||
numMessagesAfterLastTimeStamp(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QWidget* widget = new QWidget();
|
||||
setWidget(widget);
|
||||
|
||||
ui->setupUi(widget);
|
||||
|
||||
FlowLayout* flowLayout = new FlowLayout(0, 4, 4);
|
||||
ui->usersWidget->setLayout(flowLayout);
|
||||
|
||||
ui->messagePlainTextEdit->installEventFilter(this);
|
||||
|
||||
ui->closeButton->hide();
|
||||
|
||||
#ifdef HAVE_QXMPP
|
||||
const QXmppClient& xmppClient = XmppClient::getInstance().getXMPPClient();
|
||||
if (xmppClient.isConnected()) {
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue