mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 20:44:14 +02:00
Make login dialog automatically show only once per domain visit
This commit is contained in:
parent
61a09146cd
commit
46c1a9d59a
3 changed files with 22 additions and 3 deletions
|
@ -246,7 +246,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
connect(&domainHandler, SIGNAL(connectedToDomain(const QString&)), SLOT(updateWindowTitle()));
|
||||
connect(&domainHandler, SIGNAL(disconnectedFromDomain()), SLOT(updateWindowTitle()));
|
||||
connect(&domainHandler, &DomainHandler::settingsReceived, this, &Application::domainSettingsReceived);
|
||||
|
||||
connect(&domainHandler, &DomainHandler::hostnameChanged, Menu::getInstance(), &Menu::clearLoginDomain);
|
||||
|
||||
// hookup VoxelEditSender to PaymentManager so we can pay for octree edits
|
||||
const PaymentManager& paymentManager = PaymentManager::getInstance();
|
||||
connect(&_voxelEditSender, &VoxelEditPacketSender::octreePaymentRequired,
|
||||
|
|
|
@ -114,6 +114,7 @@ Menu::Menu() :
|
|||
_loginAction(NULL),
|
||||
_preferencesDialog(NULL),
|
||||
_loginDialog(NULL),
|
||||
_loginDomain(),
|
||||
_snapshotsLocation(),
|
||||
_scriptsLocation(),
|
||||
_walletPrivateKey()
|
||||
|
@ -1052,14 +1053,28 @@ void sendFakeEnterEvent() {
|
|||
|
||||
const float DIALOG_RATIO_OF_WINDOW = 0.30f;
|
||||
|
||||
void Menu::clearLoginDomain() {
|
||||
// Needed for domains that don't require login.
|
||||
_loginDomain = QString();
|
||||
}
|
||||
|
||||
void Menu::loginForCurrentDomain() {
|
||||
if (!_loginDialog) {
|
||||
QString domain = NodeList::getInstance()->getDomainHandler().getHostname();
|
||||
bool hasShownForDomain = domain == _loginDomain;
|
||||
|
||||
if (!_loginDialog && !hasShownForDomain) {
|
||||
_loginDomain = domain;
|
||||
_loginDialog = new LoginDialog(Application::getInstance()->getWindow());
|
||||
_loginDialog->show();
|
||||
_loginDialog->resizeAndPosition(false);
|
||||
}
|
||||
}
|
||||
|
||||
void Menu::showLoginForCurrentDomain() {
|
||||
_loginDomain = QString();
|
||||
loginForCurrentDomain();
|
||||
}
|
||||
|
||||
void Menu::editPreferences() {
|
||||
if (!_preferencesDialog) {
|
||||
_preferencesDialog = new PreferencesDialog(Application::getInstance()->getWindow());
|
||||
|
@ -1404,7 +1419,7 @@ void Menu::toggleLoginMenuItem() {
|
|||
// change the menu item to login
|
||||
_loginAction->setText("Login");
|
||||
|
||||
connect(_loginAction, &QAction::triggered, this, &Menu::loginForCurrentDomain);
|
||||
connect(_loginAction, &QAction::triggered, this, &Menu::showLoginForCurrentDomain);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -175,7 +175,9 @@ signals:
|
|||
|
||||
public slots:
|
||||
|
||||
void clearLoginDomain();
|
||||
void loginForCurrentDomain();
|
||||
void showLoginForCurrentDomain();
|
||||
void bandwidthDetails();
|
||||
void octreeStatsDetails();
|
||||
void lodTools();
|
||||
|
@ -302,6 +304,7 @@ private:
|
|||
QPointer<AttachmentsDialog> _attachmentsDialog;
|
||||
QPointer<AnimationsDialog> _animationsDialog;
|
||||
QPointer<LoginDialog> _loginDialog;
|
||||
QString _loginDomain;
|
||||
QAction* _chatAction;
|
||||
QString _snapshotsLocation;
|
||||
QString _scriptsLocation;
|
||||
|
|
Loading…
Reference in a new issue