mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 17:50:42 +02:00
Remove circular login dialog variation
This commit is contained in:
parent
ee8449712c
commit
c7c355c19f
7 changed files with 9 additions and 167 deletions
|
@ -29,102 +29,23 @@ Dialog {
|
||||||
property int maximumX: parent ? parent.width - width : 0
|
property int maximumX: parent ? parent.width - width : 0
|
||||||
property int maximumY: parent ? parent.height - height : 0
|
property int maximumY: parent ? parent.height - height : 0
|
||||||
|
|
||||||
function isCircular() {
|
|
||||||
return loginDialog.dialogFormat == "circular"
|
|
||||||
}
|
|
||||||
|
|
||||||
LoginDialog {
|
LoginDialog {
|
||||||
id: loginDialog
|
id: loginDialog
|
||||||
|
|
||||||
implicitWidth: isCircular() ? circularBackground.width : rectangularBackground.width
|
implicitWidth: backgroundRectangle.width
|
||||||
implicitHeight: isCircular() ? circularBackground.height : rectangularBackground.height
|
implicitHeight: backgroundRectangle.height
|
||||||
|
|
||||||
readonly property int inputWidth: 500
|
readonly property int inputWidth: 500
|
||||||
readonly property int inputHeight: 60
|
readonly property int inputHeight: 60
|
||||||
readonly property int borderWidth: 30
|
readonly property int borderWidth: 30
|
||||||
readonly property int closeMargin: 16
|
readonly property int closeMargin: 16
|
||||||
readonly property real tan30: 0.577 // tan(30°)
|
readonly property real tan30: 0.577 // tan(30°)
|
||||||
property int inputSpacing: isCircular() ? 24 : 16
|
readonly property int inputSpacing: 16
|
||||||
property int maximumX: parent ? parent.width - width : 0
|
property int maximumX: parent ? parent.width - width : 0
|
||||||
property int maximumY: parent ? parent.height - height : 0
|
property int maximumY: parent ? parent.height - height : 0
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: circularBackground
|
id: backgroundRectangle
|
||||||
visible: isCircular()
|
|
||||||
width: loginDialog.inputWidth * 1.2
|
|
||||||
height: width
|
|
||||||
radius: width / 2
|
|
||||||
|
|
||||||
color: "#2c86b1"
|
|
||||||
opacity: 0.85
|
|
||||||
|
|
||||||
Item {
|
|
||||||
// Approximage circle with 3 rectangles that together contain the circle in a hexagon.
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
width: parent.width
|
|
||||||
height: parent.width * loginDialog.tan30
|
|
||||||
anchors {
|
|
||||||
horizontalCenter: parent.horizontalCenter
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
drag {
|
|
||||||
target: root
|
|
||||||
minimumX: -loginDialog.borderWidth
|
|
||||||
minimumY: -loginDialog.borderWidth
|
|
||||||
maximumX: root.parent ? root.maximumX + loginDialog.borderWidth : 0
|
|
||||||
maximumY: root.parent ? root.maximumY + loginDialog.borderWidth : 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
width: parent.width
|
|
||||||
height: parent.width * loginDialog.tan30
|
|
||||||
anchors {
|
|
||||||
horizontalCenter: parent.horizontalCenter
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
transform: Rotation {
|
|
||||||
origin.x: width / 2
|
|
||||||
origin.y: width * loginDialog.tan30 / 2
|
|
||||||
angle: -60
|
|
||||||
}
|
|
||||||
drag {
|
|
||||||
target: root
|
|
||||||
minimumX: -loginDialog.borderWidth
|
|
||||||
minimumY: -loginDialog.borderWidth
|
|
||||||
maximumX: root.parent ? root.maximumX + loginDialog.borderWidth : 0
|
|
||||||
maximumY: root.parent ? root.maximumY + loginDialog.borderWidth : 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
width: parent.width
|
|
||||||
height: parent.width * loginDialog.tan30
|
|
||||||
anchors {
|
|
||||||
horizontalCenter: parent.horizontalCenter
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
transform: Rotation {
|
|
||||||
origin.x: width / 2
|
|
||||||
origin.y: width * loginDialog.tan30 / 2
|
|
||||||
angle: 60
|
|
||||||
}
|
|
||||||
drag {
|
|
||||||
target: root
|
|
||||||
minimumX: -loginDialog.borderWidth
|
|
||||||
minimumY: -loginDialog.borderWidth
|
|
||||||
maximumX: root.parent ? root.maximumX + loginDialog.borderWidth : 0
|
|
||||||
maximumY: root.parent ? root.maximumY + loginDialog.borderWidth : 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: rectangularBackground
|
|
||||||
visible: !isCircular()
|
|
||||||
width: loginDialog.inputWidth + loginDialog.borderWidth * 2
|
width: loginDialog.inputWidth + loginDialog.borderWidth * 2
|
||||||
height: loginDialog.inputHeight * 6 + loginDialog.closeMargin * 2
|
height: loginDialog.inputHeight * 6 + loginDialog.closeMargin * 2
|
||||||
radius: loginDialog.closeMargin * 2
|
radius: loginDialog.closeMargin * 2
|
||||||
|
@ -151,13 +72,12 @@ Dialog {
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
id: closeIcon
|
id: closeIcon
|
||||||
visible: !isCircular()
|
|
||||||
source: "../images/login-close.svg"
|
source: "../images/login-close.svg"
|
||||||
width: 20
|
width: 20
|
||||||
height: 20
|
height: 20
|
||||||
anchors {
|
anchors {
|
||||||
top: rectangularBackground.top
|
top: backgroundRectangle.top
|
||||||
right: rectangularBackground.right
|
right: backgroundRectangle.right
|
||||||
topMargin: loginDialog.closeMargin
|
topMargin: loginDialog.closeMargin
|
||||||
rightMargin: loginDialog.closeMargin
|
rightMargin: loginDialog.closeMargin
|
||||||
}
|
}
|
||||||
|
@ -183,7 +103,7 @@ Dialog {
|
||||||
Item {
|
Item {
|
||||||
// Offset content down a little
|
// Offset content down a little
|
||||||
width: loginDialog.inputWidth
|
width: loginDialog.inputWidth
|
||||||
height: isCircular() ? loginDialog.inputHeight : loginDialog.closeMargin
|
height: loginDialog.closeMargin
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -404,28 +324,6 @@ Dialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
|
||||||
id: closeText
|
|
||||||
visible: isCircular()
|
|
||||||
anchors {
|
|
||||||
horizontalCenter: parent.horizontalCenter
|
|
||||||
top: mainContent.bottom
|
|
||||||
topMargin: loginDialog.inputSpacing
|
|
||||||
}
|
|
||||||
|
|
||||||
text: "Close"
|
|
||||||
font.pixelSize: hifi.fonts.pixelSize * 0.8
|
|
||||||
color: "#175d74"
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
cursorShape: "PointingHandCursor"
|
|
||||||
onClicked: {
|
|
||||||
root.enabled = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onOpacityChanged: {
|
onOpacityChanged: {
|
||||||
|
|
|
@ -571,21 +571,6 @@ Menu::Menu() {
|
||||||
addCheckableActionToQMenuAndActionHash(physicsOptionsMenu, MenuOption::PhysicsShowOwned);
|
addCheckableActionToQMenuAndActionHash(physicsOptionsMenu, MenuOption::PhysicsShowOwned);
|
||||||
addCheckableActionToQMenuAndActionHash(physicsOptionsMenu, MenuOption::PhysicsShowHulls);
|
addCheckableActionToQMenuAndActionHash(physicsOptionsMenu, MenuOption::PhysicsShowHulls);
|
||||||
|
|
||||||
MenuWrapper* loginDialogFormatMenu = developerMenu->addMenu("Login Dialog");
|
|
||||||
{
|
|
||||||
QActionGroup* dialogMenuFormatGroup = new QActionGroup(loginDialogFormatMenu);
|
|
||||||
|
|
||||||
QAction* circularLoginDialog = addCheckableActionToQMenuAndActionHash(loginDialogFormatMenu,
|
|
||||||
MenuOption::LoginDialogCircular, 0, false,
|
|
||||||
dialogsManager.data(), SLOT(updateLoginDialogFormat()));
|
|
||||||
dialogMenuFormatGroup->addAction(circularLoginDialog);
|
|
||||||
|
|
||||||
QAction* rectangularLoginDialog = addCheckableActionToQMenuAndActionHash(loginDialogFormatMenu,
|
|
||||||
MenuOption::LoginDialogRectangular, 0, true,
|
|
||||||
dialogsManager.data(), SLOT(updateLoginDialogFormat()));
|
|
||||||
dialogMenuFormatGroup->addAction(rectangularLoginDialog);
|
|
||||||
}
|
|
||||||
|
|
||||||
MenuWrapper* helpMenu = addMenu("Help");
|
MenuWrapper* helpMenu = addMenu("Help");
|
||||||
addActionToQMenuAndActionHash(helpMenu, MenuOption::EditEntitiesHelp, 0, qApp, SLOT(showEditEntitiesHelp()));
|
addActionToQMenuAndActionHash(helpMenu, MenuOption::EditEntitiesHelp, 0, qApp, SLOT(showEditEntitiesHelp()));
|
||||||
|
|
||||||
|
|
|
@ -209,8 +209,6 @@ namespace MenuOption {
|
||||||
const QString LoadRSSDKFile = "Load .rssdk file";
|
const QString LoadRSSDKFile = "Load .rssdk file";
|
||||||
const QString LodTools = "LOD Tools";
|
const QString LodTools = "LOD Tools";
|
||||||
const QString Login = "Login";
|
const QString Login = "Login";
|
||||||
const QString LoginDialogCircular = "Circular";
|
|
||||||
const QString LoginDialogRectangular = "Rectangular";
|
|
||||||
const QString Log = "Log";
|
const QString Log = "Log";
|
||||||
const QString LowVelocityFilter = "Low Velocity Filter";
|
const QString LowVelocityFilter = "Low Velocity Filter";
|
||||||
const QString Mirror = "Mirror";
|
const QString Mirror = "Mirror";
|
||||||
|
|
|
@ -50,10 +50,6 @@ void DialogsManager::showLoginDialog() {
|
||||||
LoginDialog::show();
|
LoginDialog::show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogsManager::updateLoginDialogFormat() {
|
|
||||||
emit loginDialogFormatChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DialogsManager::octreeStatsDetails() {
|
void DialogsManager::octreeStatsDetails() {
|
||||||
if (!_octreeStatsDialog) {
|
if (!_octreeStatsDialog) {
|
||||||
_octreeStatsDialog = new OctreeStatsDialog(qApp->getWindow(), qApp->getOcteeSceneStats());
|
_octreeStatsDialog = new OctreeStatsDialog(qApp->getWindow(), qApp->getOcteeSceneStats());
|
||||||
|
|
|
@ -47,15 +47,11 @@ public:
|
||||||
QPointer<OctreeStatsDialog> getOctreeStatsDialog() const { return _octreeStatsDialog; }
|
QPointer<OctreeStatsDialog> getOctreeStatsDialog() const { return _octreeStatsDialog; }
|
||||||
QPointer<PreferencesDialog> getPreferencesDialog() const { return _preferencesDialog; }
|
QPointer<PreferencesDialog> getPreferencesDialog() const { return _preferencesDialog; }
|
||||||
|
|
||||||
signals:
|
|
||||||
void loginDialogFormatChanged();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void toggleAddressBar();
|
void toggleAddressBar();
|
||||||
void toggleDiskCacheEditor();
|
void toggleDiskCacheEditor();
|
||||||
void toggleLoginDialog();
|
void toggleLoginDialog();
|
||||||
void showLoginDialog();
|
void showLoginDialog();
|
||||||
void updateLoginDialogFormat();
|
|
||||||
void octreeStatsDetails();
|
void octreeStatsDetails();
|
||||||
void cachesSizeDialog();
|
void cachesSizeDialog();
|
||||||
void editPreferences();
|
void editPreferences();
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "LoginDialog.h"
|
#include "LoginDialog.h"
|
||||||
|
|
||||||
#include <NetworkingConstants.h>
|
#include <NetworkingConstants.h>
|
||||||
|
#include <QDesktopServices.h>
|
||||||
|
|
||||||
#include "AccountManager.h"
|
#include "AccountManager.h"
|
||||||
#include "DependencyManager.h"
|
#include "DependencyManager.h"
|
||||||
|
@ -20,16 +21,12 @@
|
||||||
HIFI_QML_DEF(LoginDialog)
|
HIFI_QML_DEF(LoginDialog)
|
||||||
|
|
||||||
LoginDialog::LoginDialog(QQuickItem *parent) : OffscreenQmlDialog(parent),
|
LoginDialog::LoginDialog(QQuickItem *parent) : OffscreenQmlDialog(parent),
|
||||||
_dialogFormat("rectangular"),
|
|
||||||
_rootUrl(NetworkingConstants::METAVERSE_SERVER_URL.toString())
|
_rootUrl(NetworkingConstants::METAVERSE_SERVER_URL.toString())
|
||||||
{
|
{
|
||||||
connect(&AccountManager::getInstance(), &AccountManager::loginComplete,
|
connect(&AccountManager::getInstance(), &AccountManager::loginComplete,
|
||||||
this, &LoginDialog::handleLoginCompleted);
|
this, &LoginDialog::handleLoginCompleted);
|
||||||
connect(&AccountManager::getInstance(), &AccountManager::loginFailed,
|
connect(&AccountManager::getInstance(), &AccountManager::loginFailed,
|
||||||
this, &LoginDialog::handleLoginFailed);
|
this, &LoginDialog::handleLoginFailed);
|
||||||
|
|
||||||
connect(DependencyManager::get<DialogsManager>().data(), &DialogsManager::loginDialogFormatChanged,
|
|
||||||
this, &LoginDialog::updateDialogFormat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoginDialog::toggleAction() {
|
void LoginDialog::toggleAction() {
|
||||||
|
@ -59,25 +56,6 @@ void LoginDialog::handleLoginFailed() {
|
||||||
setStatusText("Invalid username or password");
|
setStatusText("Invalid username or password");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoginDialog::setDialogFormat(const QString& dialogFormat) {
|
|
||||||
if (dialogFormat != _dialogFormat) {
|
|
||||||
_dialogFormat = dialogFormat;
|
|
||||||
emit dialogFormatChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString LoginDialog::dialogFormat() const {
|
|
||||||
return _dialogFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LoginDialog::updateDialogFormat() {
|
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::LoginDialogCircular)) {
|
|
||||||
setDialogFormat("circular");
|
|
||||||
} else {
|
|
||||||
setDialogFormat("rectangular");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LoginDialog::setStatusText(const QString& statusText) {
|
void LoginDialog::setStatusText(const QString& statusText) {
|
||||||
if (statusText != _statusText) {
|
if (statusText != _statusText) {
|
||||||
_statusText = statusText;
|
_statusText = statusText;
|
||||||
|
@ -101,5 +79,5 @@ void LoginDialog::login(const QString& username, const QString& password) {
|
||||||
|
|
||||||
void LoginDialog::openUrl(const QString& url) {
|
void LoginDialog::openUrl(const QString& url) {
|
||||||
qDebug() << url;
|
qDebug() << url;
|
||||||
Application::getInstance()->openUrl(url);
|
QDesktopServices::openUrl(url);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
#ifndef hifi_LoginDialog_h
|
#ifndef hifi_LoginDialog_h
|
||||||
#define hifi_LoginDialog_h
|
#define hifi_LoginDialog_h
|
||||||
|
|
||||||
#include "DialogsManager.h" // Need before OffscreenQmlDialog.h in order to get gl.h and glew.h includes in correct order.
|
|
||||||
|
|
||||||
#include <OffscreenQmlDialog.h>
|
#include <OffscreenQmlDialog.h>
|
||||||
|
|
||||||
class LoginDialog : public OffscreenQmlDialog
|
class LoginDialog : public OffscreenQmlDialog
|
||||||
|
@ -23,7 +21,6 @@ class LoginDialog : public OffscreenQmlDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
HIFI_QML_DECL
|
HIFI_QML_DECL
|
||||||
|
|
||||||
Q_PROPERTY(QString dialogFormat READ dialogFormat WRITE setDialogFormat NOTIFY dialogFormatChanged)
|
|
||||||
Q_PROPERTY(QString statusText READ statusText WRITE setStatusText NOTIFY statusTextChanged)
|
Q_PROPERTY(QString statusText READ statusText WRITE setStatusText NOTIFY statusTextChanged)
|
||||||
Q_PROPERTY(QString rootUrl READ rootUrl)
|
Q_PROPERTY(QString rootUrl READ rootUrl)
|
||||||
|
|
||||||
|
@ -32,17 +29,12 @@ public:
|
||||||
|
|
||||||
LoginDialog(QQuickItem* parent = nullptr);
|
LoginDialog(QQuickItem* parent = nullptr);
|
||||||
|
|
||||||
void setDialogFormat(const QString& dialogFormat);
|
|
||||||
QString dialogFormat() const;
|
|
||||||
void updateDialogFormat(); // protected?
|
|
||||||
|
|
||||||
void setStatusText(const QString& statusText);
|
void setStatusText(const QString& statusText);
|
||||||
QString statusText() const;
|
QString statusText() const;
|
||||||
|
|
||||||
QString rootUrl() const;
|
QString rootUrl() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void dialogFormatChanged();
|
|
||||||
void statusTextChanged();
|
void statusTextChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -52,7 +44,6 @@ protected:
|
||||||
Q_INVOKABLE void login(const QString& username, const QString& password);
|
Q_INVOKABLE void login(const QString& username, const QString& password);
|
||||||
Q_INVOKABLE void openUrl(const QString& url);
|
Q_INVOKABLE void openUrl(const QString& url);
|
||||||
private:
|
private:
|
||||||
QString _dialogFormat;
|
|
||||||
QString _statusText;
|
QString _statusText;
|
||||||
const QString _rootUrl;
|
const QString _rootUrl;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue