mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 17:03:58 +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 maximumY: parent ? parent.height - height : 0
|
||||
|
||||
function isCircular() {
|
||||
return loginDialog.dialogFormat == "circular"
|
||||
}
|
||||
|
||||
LoginDialog {
|
||||
id: loginDialog
|
||||
|
||||
implicitWidth: isCircular() ? circularBackground.width : rectangularBackground.width
|
||||
implicitHeight: isCircular() ? circularBackground.height : rectangularBackground.height
|
||||
implicitWidth: backgroundRectangle.width
|
||||
implicitHeight: backgroundRectangle.height
|
||||
|
||||
readonly property int inputWidth: 500
|
||||
readonly property int inputHeight: 60
|
||||
readonly property int borderWidth: 30
|
||||
readonly property int closeMargin: 16
|
||||
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 maximumY: parent ? parent.height - height : 0
|
||||
|
||||
Rectangle {
|
||||
id: circularBackground
|
||||
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()
|
||||
id: backgroundRectangle
|
||||
width: loginDialog.inputWidth + loginDialog.borderWidth * 2
|
||||
height: loginDialog.inputHeight * 6 + loginDialog.closeMargin * 2
|
||||
radius: loginDialog.closeMargin * 2
|
||||
|
@ -151,13 +72,12 @@ Dialog {
|
|||
|
||||
Image {
|
||||
id: closeIcon
|
||||
visible: !isCircular()
|
||||
source: "../images/login-close.svg"
|
||||
width: 20
|
||||
height: 20
|
||||
anchors {
|
||||
top: rectangularBackground.top
|
||||
right: rectangularBackground.right
|
||||
top: backgroundRectangle.top
|
||||
right: backgroundRectangle.right
|
||||
topMargin: loginDialog.closeMargin
|
||||
rightMargin: loginDialog.closeMargin
|
||||
}
|
||||
|
@ -183,7 +103,7 @@ Dialog {
|
|||
Item {
|
||||
// Offset content down a little
|
||||
width: loginDialog.inputWidth
|
||||
height: isCircular() ? loginDialog.inputHeight : loginDialog.closeMargin
|
||||
height: loginDialog.closeMargin
|
||||
}
|
||||
|
||||
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: {
|
||||
|
|
|
@ -571,21 +571,6 @@ Menu::Menu() {
|
|||
addCheckableActionToQMenuAndActionHash(physicsOptionsMenu, MenuOption::PhysicsShowOwned);
|
||||
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");
|
||||
addActionToQMenuAndActionHash(helpMenu, MenuOption::EditEntitiesHelp, 0, qApp, SLOT(showEditEntitiesHelp()));
|
||||
|
||||
|
|
|
@ -209,8 +209,6 @@ namespace MenuOption {
|
|||
const QString LoadRSSDKFile = "Load .rssdk file";
|
||||
const QString LodTools = "LOD Tools";
|
||||
const QString Login = "Login";
|
||||
const QString LoginDialogCircular = "Circular";
|
||||
const QString LoginDialogRectangular = "Rectangular";
|
||||
const QString Log = "Log";
|
||||
const QString LowVelocityFilter = "Low Velocity Filter";
|
||||
const QString Mirror = "Mirror";
|
||||
|
|
|
@ -50,10 +50,6 @@ void DialogsManager::showLoginDialog() {
|
|||
LoginDialog::show();
|
||||
}
|
||||
|
||||
void DialogsManager::updateLoginDialogFormat() {
|
||||
emit loginDialogFormatChanged();
|
||||
}
|
||||
|
||||
void DialogsManager::octreeStatsDetails() {
|
||||
if (!_octreeStatsDialog) {
|
||||
_octreeStatsDialog = new OctreeStatsDialog(qApp->getWindow(), qApp->getOcteeSceneStats());
|
||||
|
|
|
@ -47,15 +47,11 @@ public:
|
|||
QPointer<OctreeStatsDialog> getOctreeStatsDialog() const { return _octreeStatsDialog; }
|
||||
QPointer<PreferencesDialog> getPreferencesDialog() const { return _preferencesDialog; }
|
||||
|
||||
signals:
|
||||
void loginDialogFormatChanged();
|
||||
|
||||
public slots:
|
||||
void toggleAddressBar();
|
||||
void toggleDiskCacheEditor();
|
||||
void toggleLoginDialog();
|
||||
void showLoginDialog();
|
||||
void updateLoginDialogFormat();
|
||||
void octreeStatsDetails();
|
||||
void cachesSizeDialog();
|
||||
void editPreferences();
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "LoginDialog.h"
|
||||
|
||||
#include <NetworkingConstants.h>
|
||||
#include <QDesktopServices.h>
|
||||
|
||||
#include "AccountManager.h"
|
||||
#include "DependencyManager.h"
|
||||
|
@ -20,16 +21,12 @@
|
|||
HIFI_QML_DEF(LoginDialog)
|
||||
|
||||
LoginDialog::LoginDialog(QQuickItem *parent) : OffscreenQmlDialog(parent),
|
||||
_dialogFormat("rectangular"),
|
||||
_rootUrl(NetworkingConstants::METAVERSE_SERVER_URL.toString())
|
||||
{
|
||||
connect(&AccountManager::getInstance(), &AccountManager::loginComplete,
|
||||
this, &LoginDialog::handleLoginCompleted);
|
||||
connect(&AccountManager::getInstance(), &AccountManager::loginFailed,
|
||||
this, &LoginDialog::handleLoginFailed);
|
||||
|
||||
connect(DependencyManager::get<DialogsManager>().data(), &DialogsManager::loginDialogFormatChanged,
|
||||
this, &LoginDialog::updateDialogFormat);
|
||||
}
|
||||
|
||||
void LoginDialog::toggleAction() {
|
||||
|
@ -59,25 +56,6 @@ void LoginDialog::handleLoginFailed() {
|
|||
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) {
|
||||
if (statusText != _statusText) {
|
||||
_statusText = statusText;
|
||||
|
@ -101,5 +79,5 @@ void LoginDialog::login(const QString& username, const QString& password) {
|
|||
|
||||
void LoginDialog::openUrl(const QString& url) {
|
||||
qDebug() << url;
|
||||
Application::getInstance()->openUrl(url);
|
||||
QDesktopServices::openUrl(url);
|
||||
}
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
#ifndef 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>
|
||||
|
||||
class LoginDialog : public OffscreenQmlDialog
|
||||
|
@ -23,7 +21,6 @@ class LoginDialog : public OffscreenQmlDialog
|
|||
Q_OBJECT
|
||||
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 rootUrl READ rootUrl)
|
||||
|
||||
|
@ -32,17 +29,12 @@ public:
|
|||
|
||||
LoginDialog(QQuickItem* parent = nullptr);
|
||||
|
||||
void setDialogFormat(const QString& dialogFormat);
|
||||
QString dialogFormat() const;
|
||||
void updateDialogFormat(); // protected?
|
||||
|
||||
void setStatusText(const QString& statusText);
|
||||
QString statusText() const;
|
||||
|
||||
QString rootUrl() const;
|
||||
|
||||
signals:
|
||||
void dialogFormatChanged();
|
||||
void statusTextChanged();
|
||||
|
||||
protected:
|
||||
|
@ -52,7 +44,6 @@ protected:
|
|||
Q_INVOKABLE void login(const QString& username, const QString& password);
|
||||
Q_INVOKABLE void openUrl(const QString& url);
|
||||
private:
|
||||
QString _dialogFormat;
|
||||
QString _statusText;
|
||||
const QString _rootUrl;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue