mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-24 10:24:07 +02:00
Simplified the new goToUser function.
This commit is contained in:
parent
3907c563df
commit
6fd1bf7edb
4 changed files with 20 additions and 33 deletions
|
@ -113,18 +113,18 @@
|
||||||
<context>
|
<context>
|
||||||
<name>Menu</name>
|
<name>Menu</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="src/Menu.cpp" line="458"/>
|
<location filename="src/Menu.cpp" line="456"/>
|
||||||
<source>Open .ini config file</source>
|
<source>Open .ini config file</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="src/Menu.cpp" line="460"/>
|
<location filename="src/Menu.cpp" line="458"/>
|
||||||
<location filename="src/Menu.cpp" line="472"/>
|
<location filename="src/Menu.cpp" line="470"/>
|
||||||
<source>Text files (*.ini)</source>
|
<source>Text files (*.ini)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="src/Menu.cpp" line="470"/>
|
<location filename="src/Menu.cpp" line="468"/>
|
||||||
<source>Save .ini config file</source>
|
<source>Save .ini config file</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
|
|
@ -20,8 +20,6 @@
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QParallelAnimationGroup>
|
|
||||||
#include <QPropertyAnimation>
|
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
#include <QSlider>
|
#include <QSlider>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
@ -925,19 +923,18 @@ void Menu::goTo() {
|
||||||
gotoDialog.resize(gotoDialog.parentWidget()->size().width() * DIALOG_RATIO_OF_WINDOW, gotoDialog.size().height());
|
gotoDialog.resize(gotoDialog.parentWidget()->size().width() * DIALOG_RATIO_OF_WINDOW, gotoDialog.size().height());
|
||||||
|
|
||||||
int dialogReturn = gotoDialog.exec();
|
int dialogReturn = gotoDialog.exec();
|
||||||
goToUser(dialogReturn == QDialog::Accepted && !gotoDialog.textValue().isEmpty(),
|
if (dialogReturn == QDialog::Accepted && !gotoDialog.textValue().isEmpty()) {
|
||||||
gotoDialog.textValue());
|
goToUser(gotoDialog.textValue());
|
||||||
}
|
|
||||||
|
|
||||||
void Menu::goToUser(bool go, const QString& user) {
|
|
||||||
if (go) {
|
|
||||||
LocationManager* manager = &LocationManager::getInstance();
|
|
||||||
manager->goTo(user);
|
|
||||||
connect(manager, &LocationManager::multipleDestinationsFound, this, &Menu::multipleDestinationsDecision);
|
|
||||||
}
|
}
|
||||||
sendFakeEnterEvent();
|
sendFakeEnterEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Menu::goToUser(const QString& user) {
|
||||||
|
LocationManager* manager = &LocationManager::getInstance();
|
||||||
|
manager->goTo(user);
|
||||||
|
connect(manager, &LocationManager::multipleDestinationsFound, this, &Menu::multipleDestinationsDecision);
|
||||||
|
}
|
||||||
|
|
||||||
void Menu::multipleDestinationsDecision(const QJsonObject& userData, const QJsonObject& placeData) {
|
void Menu::multipleDestinationsDecision(const QJsonObject& userData, const QJsonObject& placeData) {
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
msgBox.setText("Both user and location exists with same name");
|
msgBox.setText("Both user and location exists with same name");
|
||||||
|
@ -1105,23 +1102,13 @@ void Menu::showMetavoxelEditor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu::showChat() {
|
void Menu::showChat() {
|
||||||
QMainWindow* mainWindow = Application::getInstance()->getWindow();
|
|
||||||
if (!_chatWindow) {
|
if (!_chatWindow) {
|
||||||
mainWindow->addDockWidget(Qt::NoDockWidgetArea, _chatWindow = new ChatWindow());
|
Application::getInstance()->getWindow()->addDockWidget(Qt::RightDockWidgetArea, _chatWindow = new ChatWindow());
|
||||||
}
|
|
||||||
if (!_chatWindow->toggleViewAction()->isChecked()) {
|
} else {
|
||||||
int width = _chatWindow->width();
|
if (!_chatWindow->toggleViewAction()->isChecked()) {
|
||||||
int y = qMax((mainWindow->height() - _chatWindow->height()) / 2, 0);
|
_chatWindow->toggleViewAction()->trigger();
|
||||||
_chatWindow->move(mainWindow->width(), y);
|
}
|
||||||
_chatWindow->resize(0, _chatWindow->height());
|
|
||||||
_chatWindow->toggleViewAction()->trigger();
|
|
||||||
|
|
||||||
QPropertyAnimation* slideAnimation = new QPropertyAnimation(_chatWindow, "geometry", _chatWindow);
|
|
||||||
slideAnimation->setStartValue(_chatWindow->geometry());
|
|
||||||
slideAnimation->setEndValue(QRect(mainWindow->width() - width, _chatWindow->y(),
|
|
||||||
width, _chatWindow->height()));
|
|
||||||
slideAnimation->setDuration(250);
|
|
||||||
slideAnimation->start(QAbstractAnimation::DeleteWhenStopped);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ public slots:
|
||||||
void importSettings();
|
void importSettings();
|
||||||
void exportSettings();
|
void exportSettings();
|
||||||
void goTo();
|
void goTo();
|
||||||
void goToUser(bool go, const QString& user);
|
void goToUser(const QString& user);
|
||||||
void pasteToVoxel();
|
void pasteToVoxel();
|
||||||
|
|
||||||
void toggleLoginMenuItem();
|
void toggleLoginMenuItem();
|
||||||
|
|
|
@ -117,7 +117,7 @@ bool ChatWindow::eventFilter(QObject* sender, QEvent* event) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QString user = sender->property("user").toString();
|
QString user = sender->property("user").toString();
|
||||||
Menu::getInstance()->goToUser(true, user);
|
Menu::getInstance()->goToUser(user);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue