mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:24:00 +02:00
Add add/remove friends menu item
This must display the dialog whether or not users.js is running. Both C++ and JavaScript need to open or restore the same dialog, hence a new dialog rather than using WebWindow with its JavaScript baggage.
This commit is contained in:
parent
418ff5929e
commit
be69c0b58f
7 changed files with 44 additions and 14 deletions
|
@ -88,12 +88,6 @@ var usersWindow = (function () {
|
|||
scrollbarBarClickedAt, // 0.0 .. 1.0
|
||||
scrollbarValue = 0.0, // 0.0 .. 1.0
|
||||
|
||||
FRIENDS_DIALOG_TITLE = "Add/Remove Friends",
|
||||
FRIENDS_DIALOG_URL = "https://metaverse.highfidelity.com/user/friends",
|
||||
FRIENDS_DIALOG_WIDTH = 900,
|
||||
FRIENDS_DIALOG_HEIGHT = 700,
|
||||
friendsDialog,
|
||||
|
||||
RADIO_BUTTON_SVG = HIFI_PUBLIC_BUCKET + "images/radio-button.svg",
|
||||
RADIO_BUTTON_SVG_DIAMETER = 14,
|
||||
RADIO_BUTTON_DISPLAY_SCALE = 0.7, // 1.0 = windowTextHeight
|
||||
|
@ -426,8 +420,7 @@ var usersWindow = (function () {
|
|||
}
|
||||
|
||||
if (clickedOverlay === friendsButton2D) {
|
||||
friendsDialog.setVisible(true);
|
||||
friendsDialog.raise();
|
||||
GlobalServices.editFriends();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -587,10 +580,6 @@ var usersWindow = (function () {
|
|||
myVisibility = "";
|
||||
}
|
||||
|
||||
friendsDialog = new WebWindow(FRIENDS_DIALOG_TITLE, FRIENDS_DIALOG_URL, FRIENDS_DIALOG_WIDTH, FRIENDS_DIALOG_HEIGHT,
|
||||
false);
|
||||
friendsDialog.setVisible(false);
|
||||
|
||||
optionText = "everyone";
|
||||
visibilityControls2D = [{
|
||||
radioOverlay: Overlays.addOverlay("image", { // Create first so that it is under textOverlay.
|
||||
|
|
|
@ -129,6 +129,7 @@
|
|||
#endif
|
||||
|
||||
#include "ui/DataWebDialog.h"
|
||||
#include "ui/DataWebPage.h"
|
||||
#include "ui/DialogsManager.h"
|
||||
#include "ui/InfoView.h"
|
||||
#include "ui/LoginDialog.h"
|
||||
|
@ -156,6 +157,8 @@ const QString SKIP_FILENAME = QStandardPaths::writableLocation(QStandardPaths::D
|
|||
|
||||
const QString DEFAULT_SCRIPTS_JS_URL = "http://s3.amazonaws.com/hifi-public/scripts/defaultScripts.js";
|
||||
|
||||
const QString EDIT_FRIENDS_DIALOG_URL = "https://metaverse.highfidelity.com/user/friends";
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
class MyNativeEventFilter : public QAbstractNativeEventFilter {
|
||||
public:
|
||||
|
@ -297,7 +300,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
_lastSendDownstreamAudioStats(usecTimestampNow()),
|
||||
_isVSyncOn(true),
|
||||
_aboutToQuit(false),
|
||||
_notifiedPacketVersionMismatchThisDomain(false)
|
||||
_notifiedPacketVersionMismatchThisDomain(false),
|
||||
_editFriendsDialog(nullptr)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
installNativeEventFilter(&MyNativeEventFilter::getInstance());
|
||||
|
@ -3936,6 +3940,32 @@ void Application::loadScriptURLDialog() {
|
|||
}
|
||||
}
|
||||
|
||||
void Application::showEditFriendsDialog() {
|
||||
if (!_editFriendsDialog) {
|
||||
_editFriendsDialog = new QWidget(Application::getInstance()->getWindow(), Qt::Window);
|
||||
_editFriendsDialog->setWindowTitle("Add/Remove Friends");
|
||||
_editFriendsDialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
auto layout = new QVBoxLayout(_editFriendsDialog);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
_editFriendsDialog->setLayout(layout);
|
||||
|
||||
QWebView* webView = new QWebView(_editFriendsDialog);
|
||||
layout->addWidget(webView);
|
||||
webView->setPage(new DataWebPage());
|
||||
webView->setUrl(EDIT_FRIENDS_DIALOG_URL);
|
||||
|
||||
connect(_editFriendsDialog, &QWidget::destroyed, this, &Application::editFriendsDialogDestroyed);
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(_editFriendsDialog, "setVisible", Qt::AutoConnection, Q_ARG(bool, true));
|
||||
QMetaObject::invokeMethod(_editFriendsDialog, "showNormal", Qt::AutoConnection);
|
||||
}
|
||||
|
||||
void Application::editFriendsDialogDestroyed() {
|
||||
_editFriendsDialog = nullptr;
|
||||
}
|
||||
|
||||
QString Application::getScriptsLocation() {
|
||||
return _scriptsLocationHandle.get();
|
||||
}
|
||||
|
|
|
@ -361,7 +361,9 @@ public slots:
|
|||
void loadDefaultScripts();
|
||||
void toggleRunningScriptsWidget();
|
||||
void saveScripts();
|
||||
|
||||
void showEditFriendsDialog();
|
||||
void editFriendsDialogDestroyed();
|
||||
|
||||
void packageModel();
|
||||
|
||||
void openUrl(const QUrl& url);
|
||||
|
@ -565,6 +567,7 @@ private:
|
|||
ControllerScriptingInterface _controllerScriptingInterface;
|
||||
QPointer<LogDialog> _logDialog;
|
||||
QPointer<SnapshotShareDialog> _snapshotShareDialog;
|
||||
QWidget*_editFriendsDialog;
|
||||
|
||||
FileLogger* _logger;
|
||||
|
||||
|
|
|
@ -152,6 +152,8 @@ Menu::Menu() {
|
|||
|
||||
addActionToQMenuAndActionHash(toolsMenu, MenuOption::Chat, Qt::Key_Backslash,
|
||||
dialogsManager.data(), SLOT(showIRCLink()));
|
||||
addActionToQMenuAndActionHash(toolsMenu, MenuOption::AddRemoveFriends, 0,
|
||||
qApp, SLOT(showEditFriendsDialog()));
|
||||
|
||||
addActionToQMenuAndActionHash(toolsMenu,
|
||||
MenuOption::ToolWindow,
|
||||
|
|
|
@ -100,6 +100,7 @@ private:
|
|||
|
||||
namespace MenuOption {
|
||||
const QString AboutApp = "About Interface";
|
||||
const QString AddRemoveFriends = "Add/Remove Friends...";
|
||||
const QString AddressBar = "Show Address Bar";
|
||||
const QString AlignForearmsWithWrists = "Align Forearms with Wrists";
|
||||
const QString AlternateIK = "Alternate IK";
|
||||
|
|
|
@ -123,3 +123,7 @@ void GlobalServicesScriptingInterface::checkDownloadInfo() {
|
|||
void GlobalServicesScriptingInterface::updateDownloadInfo() {
|
||||
emit downloadInfoChanged(getDownloadInfo());
|
||||
}
|
||||
|
||||
void GlobalServicesScriptingInterface::editFriends() {
|
||||
QMetaObject::invokeMethod(Application::getInstance(), "showEditFriendsDialog");
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ public:
|
|||
public slots:
|
||||
DownloadInfoResult getDownloadInfo();
|
||||
void updateDownloadInfo();
|
||||
void editFriends();
|
||||
|
||||
private slots:
|
||||
void loggedOut();
|
||||
|
|
Loading…
Reference in a new issue