mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-22 21:06:27 +02:00
Display notification if domain connection refused
This commit is contained in:
parent
92a639d2ee
commit
cb6abfb2e6
6 changed files with 27 additions and 2 deletions
|
@ -91,10 +91,12 @@ var NotificationType = {
|
||||||
MUTE_TOGGLE: 1,
|
MUTE_TOGGLE: 1,
|
||||||
SNAPSHOT: 2,
|
SNAPSHOT: 2,
|
||||||
WINDOW_RESIZE: 3,
|
WINDOW_RESIZE: 3,
|
||||||
|
CONNECTION_REFUSED: 4,
|
||||||
properties: [
|
properties: [
|
||||||
{ text: "Mute Toggle" },
|
{ text: "Mute Toggle" },
|
||||||
{ text: "Snapshot" },
|
{ text: "Snapshot" },
|
||||||
{ text: "Window Resize" }
|
{ text: "Window Resize" },
|
||||||
|
{ text: "Connection Refused" }
|
||||||
],
|
],
|
||||||
getTypeFromMenuItem: function(menuItemName) {
|
getTypeFromMenuItem: function(menuItemName) {
|
||||||
if (menuItemName.substr(menuItemName.length - NOTIFICATION_MENU_ITEM_POST.length) !== NOTIFICATION_MENU_ITEM_POST) {
|
if (menuItemName.substr(menuItemName.length - NOTIFICATION_MENU_ITEM_POST.length) !== NOTIFICATION_MENU_ITEM_POST) {
|
||||||
|
@ -489,6 +491,10 @@ function onMuteStateChanged() {
|
||||||
createNotification(muteString, NotificationType.MUTE_TOGGLE);
|
createNotification(muteString, NotificationType.MUTE_TOGGLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onDomainConnectionRefused(reason) {
|
||||||
|
createNotification("Connection refused: " + reason, NotificationType.CONNECTION_REFUSED );
|
||||||
|
}
|
||||||
|
|
||||||
// handles mouse clicks on buttons
|
// handles mouse clicks on buttons
|
||||||
function mousePressEvent(event) {
|
function mousePressEvent(event) {
|
||||||
var pickRay,
|
var pickRay,
|
||||||
|
@ -582,5 +588,6 @@ Controller.keyReleaseEvent.connect(keyReleaseEvent);
|
||||||
Script.update.connect(update);
|
Script.update.connect(update);
|
||||||
Script.scriptEnding.connect(scriptEnding);
|
Script.scriptEnding.connect(scriptEnding);
|
||||||
Menu.menuItemEvent.connect(menuItemEvent);
|
Menu.menuItemEvent.connect(menuItemEvent);
|
||||||
|
Window.domainConnectionRefused.connect(onDomainConnectionRefused);
|
||||||
|
|
||||||
setup();
|
setup();
|
||||||
|
|
|
@ -297,7 +297,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
_lastSendDownstreamAudioStats(usecTimestampNow()),
|
_lastSendDownstreamAudioStats(usecTimestampNow()),
|
||||||
_isVSyncOn(true),
|
_isVSyncOn(true),
|
||||||
_aboutToQuit(false),
|
_aboutToQuit(false),
|
||||||
_notifiedPacketVersionMismatchThisDomain(false)
|
_notifiedPacketVersionMismatchThisDomain(false),
|
||||||
|
_domainConnectionRefusals(QList<QString>())
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
installNativeEventFilter(&MyNativeEventFilter::getInstance());
|
installNativeEventFilter(&MyNativeEventFilter::getInstance());
|
||||||
|
@ -3288,6 +3289,14 @@ void Application::clearDomainOctreeDetails() {
|
||||||
void Application::domainChanged(const QString& domainHostname) {
|
void Application::domainChanged(const QString& domainHostname) {
|
||||||
updateWindowTitle();
|
updateWindowTitle();
|
||||||
clearDomainOctreeDetails();
|
clearDomainOctreeDetails();
|
||||||
|
_domainConnectionRefusals.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::domainConnectionDenied(const QString& reason) {
|
||||||
|
if (!_domainConnectionRefusals.contains(reason)) {
|
||||||
|
_domainConnectionRefusals.append(reason);
|
||||||
|
emit domainConnectionRefused(reason);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::connectedToDomain(const QString& hostname) {
|
void Application::connectedToDomain(const QString& hostname) {
|
||||||
|
|
|
@ -332,6 +332,8 @@ signals:
|
||||||
|
|
||||||
void svoImportRequested(const QString& url);
|
void svoImportRequested(const QString& url);
|
||||||
|
|
||||||
|
void domainConnectionRefused(const QString& reason);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void domainChanged(const QString& domainHostname);
|
void domainChanged(const QString& domainHostname);
|
||||||
void updateWindowTitle();
|
void updateWindowTitle();
|
||||||
|
@ -382,6 +384,8 @@ public slots:
|
||||||
|
|
||||||
void setActiveFaceTracker();
|
void setActiveFaceTracker();
|
||||||
|
|
||||||
|
void domainConnectionDenied(const QString& reason);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void clearDomainOctreeDetails();
|
void clearDomainOctreeDetails();
|
||||||
void checkFPS();
|
void checkFPS();
|
||||||
|
@ -606,6 +610,8 @@ private:
|
||||||
int _menuBarHeight;
|
int _menuBarHeight;
|
||||||
|
|
||||||
QHash<QString, AcceptURLMethod> _acceptedExtensions;
|
QHash<QString, AcceptURLMethod> _acceptedExtensions;
|
||||||
|
|
||||||
|
QList<QString> _domainConnectionRefusals;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_Application_h
|
#endif // hifi_Application_h
|
||||||
|
|
|
@ -127,6 +127,7 @@ void DatagramProcessor::processDatagrams() {
|
||||||
// and check and signal for an access token so that we can make sure they are logged in
|
// and check and signal for an access token so that we can make sure they are logged in
|
||||||
qDebug() << "The domain-server denied a connection request: " << reason;
|
qDebug() << "The domain-server denied a connection request: " << reason;
|
||||||
qDebug() << "You may need to re-log to generate a keypair so you can provide a username signature.";
|
qDebug() << "You may need to re-log to generate a keypair so you can provide a username signature.";
|
||||||
|
application->domainConnectionDenied(reason);
|
||||||
AccountManager::getInstance().checkAndSignalForAccessToken();
|
AccountManager::getInstance().checkAndSignalForAccessToken();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ WindowScriptingInterface::WindowScriptingInterface() :
|
||||||
const DomainHandler& domainHandler = DependencyManager::get<NodeList>()->getDomainHandler();
|
const DomainHandler& domainHandler = DependencyManager::get<NodeList>()->getDomainHandler();
|
||||||
connect(&domainHandler, &DomainHandler::hostnameChanged, this, &WindowScriptingInterface::domainChanged);
|
connect(&domainHandler, &DomainHandler::hostnameChanged, this, &WindowScriptingInterface::domainChanged);
|
||||||
connect(Application::getInstance(), &Application::svoImportRequested, this, &WindowScriptingInterface::svoImportRequested);
|
connect(Application::getInstance(), &Application::svoImportRequested, this, &WindowScriptingInterface::svoImportRequested);
|
||||||
|
connect(Application::getInstance(), &Application::domainConnectionRefused, this, &WindowScriptingInterface::domainConnectionRefused);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebWindowClass* WindowScriptingInterface::doCreateWebWindow(const QString& title, const QString& url, int width, int height, bool isToolWindow) {
|
WebWindowClass* WindowScriptingInterface::doCreateWebWindow(const QString& title, const QString& url, int width, int height, bool isToolWindow) {
|
||||||
|
|
|
@ -62,6 +62,7 @@ signals:
|
||||||
void inlineButtonClicked(const QString& name);
|
void inlineButtonClicked(const QString& name);
|
||||||
void nonBlockingFormClosed();
|
void nonBlockingFormClosed();
|
||||||
void svoImportRequested(const QString& url);
|
void svoImportRequested(const QString& url);
|
||||||
|
void domainConnectionRefused(const QString& reason);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
QScriptValue showAlert(const QString& message);
|
QScriptValue showAlert(const QString& message);
|
||||||
|
|
Loading…
Reference in a new issue