update ui once again
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
bbbe7c879e
commit
5f5296ef5e
@ -135,9 +135,9 @@ void MSADeviceCodeStep::deviceAutorizationFinished()
|
|||||||
m_expiration_timer.setSingleShot(true);
|
m_expiration_timer.setSingleShot(true);
|
||||||
connect(&m_expiration_timer, &QTimer::timeout, this, &MSADeviceCodeStep::abort);
|
connect(&m_expiration_timer, &QTimer::timeout, this, &MSADeviceCodeStep::abort);
|
||||||
m_expiration_timer.start();
|
m_expiration_timer.start();
|
||||||
|
|
||||||
m_pool_timer.setTimerType(Qt::VeryCoarseTimer);
|
m_pool_timer.setTimerType(Qt::VeryCoarseTimer);
|
||||||
m_pool_timer.setSingleShot(true);
|
m_pool_timer.setSingleShot(true);
|
||||||
|
connect(&m_pool_timer, &QTimer::timeout, this, &MSADeviceCodeStep::authenticateUser);
|
||||||
startPoolTimer();
|
startPoolTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,8 +157,12 @@ void MSADeviceCodeStep::startPoolTimer()
|
|||||||
if (m_is_aborted) {
|
if (m_is_aborted) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (m_expiration_timer.remainingTime() < interval * 1000) {
|
||||||
|
perform();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_pool_timer.setInterval(interval * 1000);
|
m_pool_timer.setInterval(interval * 1000);
|
||||||
connect(&m_pool_timer, &QTimer::timeout, this, &MSADeviceCodeStep::authenticateUser);
|
|
||||||
m_pool_timer.start();
|
m_pool_timer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<RCC version="1.0">
|
<RCC version="1.0">
|
||||||
<qresource prefix="/documents">
|
<qresource prefix="/documents">
|
||||||
<file>../../../COPYING.md</file>
|
<file>../../../COPYING.md</file>
|
||||||
<file>login-qr.png</file>
|
<file>login-qr.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
||||||
|
8
launcher/resources/documents/login-qr.svg
Normal file
8
launcher/resources/documents/login-qr.svg
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<svg width="33" height="33" version="1.1" viewBox="0 0 8.7312 8.7312" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g transform="scale(.26458)">
|
||||||
|
<rect width="33" height="33" fill="#fff"/>
|
||||||
|
<g>
|
||||||
|
<path d="m29 29h-6v-1h1v-3h-1v2h-1v-1h-1v1h-2v-1h1v-2h-1v-1h1v-1h-1v-1h1v-1h1v-1h1v1h1v-1h1v-1h-5v3h-2v-1h1v-1h-1v1h-2v-1h1v-1h1v-1h-1v1h-1v1h-1v-2h1v-2h2v-2h1v2h2v1h-1v1h2v-2h-1v-3h-1v-1h1v-2h-2v-1h-1v-1h-1v2h-2v1h-1v-1h-1v-3h1v1h1v1h1v-2h2v-2h1v3h3v5h1v1h-1v1h2v-1h1v1h1v1h2v1h2v2h-1v-1h-2v-1h-1v4h3v-1h1v7h-1v1h-1v1h2zm-10 0h-5v-1h3v-1h1v1h1zm-6 0h-1v-4h3v-1h1v2h1v1h-2v-1h-2zm-2 0h-7v-7h7zm15-1v-2h-1v2zm-16 0v-5h-5v5zm-1-1h-3v-3h3zm9-1h-1v-1h1zm10-1v-1h-1v-1h-1v-2h-1v3h1v1zm-9 0h-1v-1h1zm5-1v-3h-3v3zm-7 0h-1v-2h-1v1h-2v-1h-1v-1h-3v-1h6v1h2v1h2v1h-2zm6-1h-1v-1h1zm5-1v-1h-1v1zm-21-1h-1v-2h1zm-2-1h-1v-1h1zm23-1h-2v-1h2zm-17 0h-4v-1h1v-1h1v1h2zm-5 0h-1v-3h1v-1h1v-1h-1v1h-2v-3h4v1h2v1h-2v1h2v1h2v-1h1v1h1v1h-5v-1h-1v1h-2zm18-2v-2h-2v1h1v1zm-13-2h-1v-1h1zm17-1h-1v-1h1zm-14 0h-1v-1h1zm-2 0h-1v-1h1zm17-1h-1v-1h1zm-2 0h-3v-1h3zm-8 0h-1v-1h1zm-6 0h-1v-1h1zm-2 0h-1v-1h1zm5-1h-1v-1h1zm-2 0h-1v-1h1zm15-1h-7v-7h7zm-10 0h-1v-1h1zm-2 0h-1v-2h1zm-2 0h-1v-1h1zm-2 0h-1v-1h1zm-2 0h-7v-7h7zm17-1v-5h-5v5zm-18 0v-5h-5v5zm17-1h-3v-3h3zm-18 0h-3v-3h3zm5-4h-2v-1h2z"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.2 KiB |
@ -36,6 +36,7 @@
|
|||||||
#include "MSALoginDialog.h"
|
#include "MSALoginDialog.h"
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
|
||||||
|
#include "BuildConfig.h"
|
||||||
#include "ui_MSALoginDialog.h"
|
#include "ui_MSALoginDialog.h"
|
||||||
|
|
||||||
#include "DesktopServices.h"
|
#include "DesktopServices.h"
|
||||||
@ -59,25 +60,40 @@ MSALoginDialog::MSALoginDialog(QWidget* parent) : QDialog(parent), ui(new Ui::MS
|
|||||||
font.setFixedPitch(true);
|
font.setFixedPitch(true);
|
||||||
ui->code->setFont(font);
|
ui->code->setFont(font);
|
||||||
|
|
||||||
ui->buttonBox->button(QDialogButtonBox::Help)->setDefault(false);
|
// ui->buttonBox->button(QDialogButtonBox::Help)->setDefault(false);
|
||||||
|
|
||||||
connect(ui->copyCode, &QPushButton::clicked, this, [this] { QApplication::clipboard()->setText(ui->code->text()); });
|
connect(ui->copyCode, &QPushButton::clicked, this, [this] { QApplication::clipboard()->setText(ui->code->text()); });
|
||||||
ui->qr->setPixmap(QPixmap(":/documents/login-qr.png"));
|
ui->qr->setPixmap(QIcon((":/documents/login-qr.svg")).pixmap(QSize(75, 75)));
|
||||||
|
ui->title->setText(tr("Login to %1").arg(BuildConfig.LAUNCHER_DISPLAYNAME));
|
||||||
|
connect(ui->loginButton, &QPushButton::clicked, this, [this] {
|
||||||
|
if (m_url.isValid())
|
||||||
|
DesktopServices::openUrl(m_url);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
int MSALoginDialog::exec()
|
int MSALoginDialog::exec()
|
||||||
{
|
{
|
||||||
// Setup the login task and start it
|
// Setup the login task and start it
|
||||||
m_account = MinecraftAccount::createBlankMSA();
|
m_account = MinecraftAccount::createBlankMSA();
|
||||||
m_task = m_account->login(m_using_device_code);
|
m_authflow_task = m_account->login(false);
|
||||||
connect(m_task.get(), &Task::failed, this, &MSALoginDialog::onTaskFailed);
|
connect(m_authflow_task.get(), &Task::failed, this, &MSALoginDialog::onTaskFailed);
|
||||||
connect(m_task.get(), &Task::succeeded, this, &QDialog::accept);
|
connect(m_authflow_task.get(), &Task::succeeded, this, &QDialog::accept);
|
||||||
connect(m_task.get(), &Task::aborted, this, &MSALoginDialog::reject);
|
connect(m_authflow_task.get(), &Task::aborted, this, &MSALoginDialog::reject);
|
||||||
connect(m_task.get(), &Task::status, this, &MSALoginDialog::onTaskStatus);
|
connect(m_authflow_task.get(), &Task::status, this, &MSALoginDialog::onTaskStatus);
|
||||||
connect(m_task.get(), &AuthFlow::authorizeWithBrowser, this, &MSALoginDialog::authorizeWithBrowser);
|
connect(m_authflow_task.get(), &AuthFlow::authorizeWithBrowser, this, &MSALoginDialog::authorizeWithBrowser);
|
||||||
connect(m_task.get(), &AuthFlow::authorizeWithBrowserWithExtra, this, &MSALoginDialog::authorizeWithBrowserWithExtra);
|
connect(m_authflow_task.get(), &AuthFlow::authorizeWithBrowserWithExtra, this, &MSALoginDialog::authorizeWithBrowserWithExtra);
|
||||||
connect(ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, m_task.get(), &Task::abort);
|
connect(ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, m_authflow_task.get(), &Task::abort);
|
||||||
m_task->start();
|
|
||||||
|
m_devicecode_task.reset(new AuthFlow(m_account->accountData(), AuthFlow::Action::DeviceCode, this));
|
||||||
|
connect(m_devicecode_task.get(), &Task::failed, this, &MSALoginDialog::onTaskFailed);
|
||||||
|
connect(m_devicecode_task.get(), &Task::succeeded, this, &QDialog::accept);
|
||||||
|
connect(m_devicecode_task.get(), &Task::aborted, this, &MSALoginDialog::reject);
|
||||||
|
connect(m_devicecode_task.get(), &Task::status, this, &MSALoginDialog::onTaskStatus);
|
||||||
|
connect(m_devicecode_task.get(), &AuthFlow::authorizeWithBrowser, this, &MSALoginDialog::authorizeWithBrowser);
|
||||||
|
connect(m_devicecode_task.get(), &AuthFlow::authorizeWithBrowserWithExtra, this, &MSALoginDialog::authorizeWithBrowserWithExtra);
|
||||||
|
connect(ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, m_devicecode_task.get(), &Task::abort);
|
||||||
|
QMetaObject::invokeMethod(m_authflow_task.get(), &Task::start, Qt::QueuedConnection);
|
||||||
|
QMetaObject::invokeMethod(m_devicecode_task.get(), &Task::start, Qt::QueuedConnection);
|
||||||
|
|
||||||
return QDialog::exec();
|
return QDialog::exec();
|
||||||
}
|
}
|
||||||
@ -100,23 +116,29 @@ void MSALoginDialog::onTaskFailed(QString reason)
|
|||||||
processed += "<br />";
|
processed += "<br />";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
auto task = qobject_cast<Task*>(sender());
|
||||||
ui->status->setText(processed);
|
ui->status->setText(processed);
|
||||||
ui->loadingLabel->setText(m_task->getStatus());
|
if (task) {
|
||||||
disconnect(ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, m_task.get(), &Task::abort);
|
ui->loadingLabel->setText(task->getStatus());
|
||||||
|
}
|
||||||
|
disconnect(ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, m_authflow_task.get(), &Task::abort);
|
||||||
|
disconnect(ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, m_devicecode_task.get(), &Task::abort);
|
||||||
connect(ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, this, &MSALoginDialog::reject);
|
connect(ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, this, &MSALoginDialog::reject);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSALoginDialog::authorizeWithBrowser(const QUrl& url)
|
void MSALoginDialog::authorizeWithBrowser(const QUrl& url)
|
||||||
{
|
{
|
||||||
ui->stackedWidget->setCurrentIndex(2);
|
ui->stackedWidget->setCurrentIndex(1);
|
||||||
DesktopServices::openUrl(url);
|
// DesktopServices::openUrl(url);
|
||||||
const auto uri = url.toString();
|
const auto uri = url.toString();
|
||||||
const auto linkString = QString("<a href=\"%1\">%2</a>").arg(uri, uri);
|
const auto linkString = QString("<a href=\"%1\">%2</a>").arg(uri, uri);
|
||||||
ui->urlInfo->setText(
|
m_url = url;
|
||||||
tr("Browser opened to complete the login process."
|
ui->link->setText(linkString);
|
||||||
"<br /><br />"
|
// ui->urlInfo->setText(
|
||||||
"If your browser hasn't opened, please manually open the following link and choose your account:</p>"));
|
// tr("Browser opened to complete the login process."
|
||||||
ui->url->setText(linkString);
|
// "<br /><br />"
|
||||||
|
// "If your browser hasn't opened, please manually open the following link and choose your account:</p>"));
|
||||||
|
// ui->url->setText(linkString);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSALoginDialog::authorizeWithBrowserWithExtra(QString url, QString code, int expiresIn)
|
void MSALoginDialog::authorizeWithBrowserWithExtra(QString url, QString code, int expiresIn)
|
||||||
@ -125,8 +147,13 @@ void MSALoginDialog::authorizeWithBrowserWithExtra(QString url, QString code, in
|
|||||||
|
|
||||||
const auto linkString = QString("<a href=\"%1\">%2</a>").arg(url, url);
|
const auto linkString = QString("<a href=\"%1\">%2</a>").arg(url, url);
|
||||||
ui->code->setText(code);
|
ui->code->setText(code);
|
||||||
ui->codeInfo->setText(tr("<p>Enter this code into %1 and choose your account.</p>").arg(linkString));
|
auto isDefaultUrl = url == "https://www.microsoft.com/link";
|
||||||
ui->qr->setVisible(url == "https://www.microsoft.com/link");
|
ui->qr->setVisible(isDefaultUrl);
|
||||||
|
if (isDefaultUrl) {
|
||||||
|
ui->qrMessage->setText(tr("Open %1 or scan the QR and enter the above code.").arg(linkString));
|
||||||
|
} else {
|
||||||
|
ui->qrMessage->setText(tr("Open %1 and enter the above code.").arg(linkString));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSALoginDialog::onTaskStatus(QString status)
|
void MSALoginDialog::onTaskStatus(QString status)
|
||||||
@ -136,10 +163,9 @@ void MSALoginDialog::onTaskStatus(QString status)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Public interface
|
// Public interface
|
||||||
MinecraftAccountPtr MSALoginDialog::newAccount(QWidget* parent, bool usingDeviceCode)
|
MinecraftAccountPtr MSALoginDialog::newAccount(QWidget* parent)
|
||||||
{
|
{
|
||||||
MSALoginDialog dlg(parent);
|
MSALoginDialog dlg(parent);
|
||||||
dlg.m_using_device_code = usingDeviceCode;
|
|
||||||
if (dlg.exec() == QDialog::Accepted) {
|
if (dlg.exec() == QDialog::Accepted) {
|
||||||
return dlg.m_account;
|
return dlg.m_account;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ class MSALoginDialog : public QDialog {
|
|||||||
public:
|
public:
|
||||||
~MSALoginDialog();
|
~MSALoginDialog();
|
||||||
|
|
||||||
static MinecraftAccountPtr newAccount(QWidget* parent, bool usingDeviceCode = false);
|
static MinecraftAccountPtr newAccount(QWidget* parent);
|
||||||
int exec() override;
|
int exec() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -47,7 +47,8 @@ class MSALoginDialog : public QDialog {
|
|||||||
private:
|
private:
|
||||||
Ui::MSALoginDialog* ui;
|
Ui::MSALoginDialog* ui;
|
||||||
MinecraftAccountPtr m_account;
|
MinecraftAccountPtr m_account;
|
||||||
shared_qobject_ptr<AuthFlow> m_task;
|
shared_qobject_ptr<AuthFlow> m_devicecode_task;
|
||||||
|
shared_qobject_ptr<AuthFlow> m_authflow_task;
|
||||||
|
|
||||||
bool m_using_device_code = false;
|
QUrl m_url;
|
||||||
};
|
};
|
||||||
|
@ -6,18 +6,18 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>500</width>
|
<width>772</width>
|
||||||
<height>300</height>
|
<height>326</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Add Microsoft Account</string>
|
<string>Add Microsoft Account</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QStackedWidget" name="stackedWidget">
|
<widget class="QStackedWidget" name="stackedWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="loadingPage">
|
<widget class="QWidget" name="loadingPage">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
@ -49,6 +49,9 @@
|
|||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -59,6 +62,9 @@
|
|||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -76,253 +82,349 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="codePage">
|
<widget class="QWidget" name="mpPage">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_6" stretch="0">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_6">
|
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_2">
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
<property name="orientation">
|
<item>
|
||||||
<enum>Qt::Horizontal</enum>
|
<spacer name="verticalSpacer_9">
|
||||||
</property>
|
<property name="orientation">
|
||||||
<property name="sizeHint" stdset="0">
|
<enum>Qt::Vertical</enum>
|
||||||
<size>
|
</property>
|
||||||
<width>40</width>
|
<property name="sizeHint" stdset="0">
|
||||||
<height>20</height>
|
<size>
|
||||||
</size>
|
<width>20</width>
|
||||||
</property>
|
<height>40</height>
|
||||||
</spacer>
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="title">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>16</pointsize>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Login to Prismlauncher</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="link">
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_5">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="loginButton">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>250</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Login with Microsoft</string>
|
||||||
|
</property>
|
||||||
|
<property name="default">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_6">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_10">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="code">
|
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||||
<property name="font">
|
<item>
|
||||||
<font>
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<pointsize>40</pointsize>
|
<item>
|
||||||
<weight>75</weight>
|
<widget class="Line" name="line">
|
||||||
<bold>true</bold>
|
<property name="sizePolicy">
|
||||||
</font>
|
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||||
</property>
|
<horstretch>0</horstretch>
|
||||||
<property name="cursor">
|
<verstretch>0</verstretch>
|
||||||
<cursorShape>IBeamCursor</cursorShape>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="midLineWidth">
|
||||||
<string>CODE</string>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="orientation">
|
||||||
<set>Qt::AlignCenter</set>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="textInteractionFlags">
|
</widget>
|
||||||
<set>Qt::TextBrowserInteraction</set>
|
</item>
|
||||||
</property>
|
</layout>
|
||||||
</widget>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="orLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Or</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line_2">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="midLineWidth">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="copyCode">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="toolTip">
|
<item>
|
||||||
<string>Copy code to clipboard</string>
|
<spacer name="verticalSpacer">
|
||||||
</property>
|
<property name="orientation">
|
||||||
<property name="text">
|
<enum>Qt::Vertical</enum>
|
||||||
<string/>
|
</property>
|
||||||
</property>
|
<property name="sizeHint" stdset="0">
|
||||||
<property name="icon">
|
<size>
|
||||||
<iconset theme="copy">
|
<width>20</width>
|
||||||
<normaloff>.</normaloff>.</iconset>
|
<height>40</height>
|
||||||
</property>
|
</size>
|
||||||
<property name="iconSize">
|
</property>
|
||||||
<size>
|
</spacer>
|
||||||
<width>22</width>
|
</item>
|
||||||
<height>22</height>
|
<item>
|
||||||
</size>
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
</property>
|
<item>
|
||||||
<property name="flat">
|
<spacer name="horizontalSpacer">
|
||||||
<bool>true</bool>
|
<property name="orientation">
|
||||||
</property>
|
<enum>Qt::Horizontal</enum>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
<property name="sizeHint" stdset="0">
|
||||||
<item>
|
<size>
|
||||||
<spacer name="horizontalSpacer">
|
<width>40</width>
|
||||||
<property name="orientation">
|
<height>20</height>
|
||||||
<enum>Qt::Horizontal</enum>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
</spacer>
|
||||||
<size>
|
</item>
|
||||||
<width>40</width>
|
<item>
|
||||||
<height>20</height>
|
<widget class="QLabel" name="qr">
|
||||||
</size>
|
<property name="minimumSize">
|
||||||
</property>
|
<size>
|
||||||
</spacer>
|
<width>75</width>
|
||||||
|
<height>75</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>100</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="scaledContents">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="code">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>30</pointsize>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="cursor">
|
||||||
|
<cursorShape>IBeamCursor</cursorShape>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>CODE</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextBrowserInteraction</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="copyCode">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Copy code to clipboard</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="copy">
|
||||||
|
<normaloff>.</normaloff>.</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>22</width>
|
||||||
|
<height>22</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="qrMessage">
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="codeInfo">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<italic>false</italic>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Information</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
<property name="openExternalLinks">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="textInteractionFlags">
|
|
||||||
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_3">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="qr">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>100</width>
|
|
||||||
<height>100</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="pixmap">
|
|
||||||
<pixmap>:/assets/login-qr.png</pixmap>
|
|
||||||
</property>
|
|
||||||
<property name="scaledContents">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_4">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer_5">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="urlPage">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer_7">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="urlInfo">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<italic>false</italic>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Information</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="openExternalLinks">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="textInteractionFlags">
|
|
||||||
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="url">
|
|
||||||
<property name="text">
|
|
||||||
<string>url</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="textInteractionFlags">
|
|
||||||
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer_8">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
@ -330,10 +432,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="standardButtons">
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Help</set>
|
<set>QDialogButtonBox::Cancel</set>
|
||||||
</property>
|
|
||||||
<property name="centerButtons">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -130,19 +130,7 @@ void AccountListPage::listChanged()
|
|||||||
|
|
||||||
void AccountListPage::on_actionAddMicrosoft_triggered()
|
void AccountListPage::on_actionAddMicrosoft_triggered()
|
||||||
{
|
{
|
||||||
QMessageBox box(this);
|
auto account = MSALoginDialog::newAccount(this);
|
||||||
box.setWindowTitle(tr("Add account"));
|
|
||||||
box.setText(tr("Where would you like to login?"));
|
|
||||||
box.setIcon(QMessageBox::Question);
|
|
||||||
auto authCode = box.addButton(tr("On this device"), QMessageBox::ButtonRole::NoRole);
|
|
||||||
auto deviceCode = box.addButton(tr("On another device"), QMessageBox::ButtonRole::YesRole);
|
|
||||||
auto cancel = box.addButton(tr("Cancel"), QMessageBox::ButtonRole::RejectRole);
|
|
||||||
box.setDefaultButton(authCode);
|
|
||||||
box.exec();
|
|
||||||
if ((box.clickedButton() != deviceCode && box.clickedButton() != authCode) || box.clickedButton() == cancel)
|
|
||||||
return;
|
|
||||||
MinecraftAccountPtr account = MSALoginDialog::newAccount(this, box.clickedButton() == deviceCode);
|
|
||||||
|
|
||||||
if (account) {
|
if (account) {
|
||||||
m_accounts->addAccount(account);
|
m_accounts->addAccount(account);
|
||||||
if (m_accounts->count() == 1) {
|
if (m_accounts->count() == 1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user