Fix bug
This commit is contained in:
parent
3ed5b1570b
commit
f67ca674c4
@ -1,7 +1,4 @@
|
|||||||
/* Copyright 2014 MultiMC Contributors
|
/* Copyright 2014 MultiMC Contributors
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Taeyeon Mori <orochimarufan.x3@gmail.com>
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -45,12 +42,12 @@ void LoginDialog::accept()
|
|||||||
ui->progressBar->setVisible(true);
|
ui->progressBar->setVisible(true);
|
||||||
|
|
||||||
m_account = MojangAccount::createFromUsername(ui->userTextBox->text());
|
m_account = MojangAccount::createFromUsername(ui->userTextBox->text());
|
||||||
auto task = m_account->login(nullptr, ui->passTextBox->text());
|
m_loginTask = m_account->login(nullptr, ui->passTextBox->text());
|
||||||
connect(task.get(), &Task::failed, this, &LoginDialog::onTaskFailed);
|
connect(m_loginTask.get(), &ProgressProvider::failed, this, &LoginDialog::onTaskFailed);
|
||||||
connect(task.get(), &Task::succeeded, this, &LoginDialog::onTaskSucceeded);
|
connect(m_loginTask.get(), &ProgressProvider::succeeded, this, &LoginDialog::onTaskSucceeded);
|
||||||
connect(task.get(), &Task::status, this, &LoginDialog::onTaskStatus);
|
connect(m_loginTask.get(), &ProgressProvider::status, this, &LoginDialog::onTaskStatus);
|
||||||
connect(task.get(), &Task::progress, this, &LoginDialog::onTaskProgress);
|
connect(m_loginTask.get(), &ProgressProvider::progress, this, &LoginDialog::onTaskProgress);
|
||||||
task->start();
|
m_loginTask->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoginDialog::setUserInputsEnabled(bool enable)
|
void LoginDialog::setUserInputsEnabled(bool enable)
|
||||||
@ -91,10 +88,10 @@ void LoginDialog::onTaskStatus(const QString &status)
|
|||||||
ui->label->setText(status);
|
ui->label->setText(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoginDialog::onTaskProgress(qint64 value, qint64 max)
|
void LoginDialog::onTaskProgress(qint64 current, qint64 total)
|
||||||
{
|
{
|
||||||
ui->progressBar->setMaximum(max);
|
ui->progressBar->setMaximum(total);
|
||||||
ui->progressBar->setValue(value);
|
ui->progressBar->setValue(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Public interface
|
// Public interface
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
/* Copyright 2014 MultiMC Contributors
|
/* Copyright 2014 MultiMC Contributors
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Taeyeon Mori <orochimarufan.x3@gmail.com>
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -49,7 +46,7 @@ slots:
|
|||||||
void onTaskFailed(const QString &reason);
|
void onTaskFailed(const QString &reason);
|
||||||
void onTaskSucceeded();
|
void onTaskSucceeded();
|
||||||
void onTaskStatus(const QString &status);
|
void onTaskStatus(const QString &status);
|
||||||
void onTaskProgress(qint64 value, qint64 max);
|
void onTaskProgress(qint64 current, qint64 total);
|
||||||
|
|
||||||
void on_userTextBox_textEdited(const QString &newText);
|
void on_userTextBox_textEdited(const QString &newText);
|
||||||
void on_passTextBox_textEdited(const QString &newText);
|
void on_passTextBox_textEdited(const QString &newText);
|
||||||
@ -57,4 +54,5 @@ slots:
|
|||||||
private:
|
private:
|
||||||
Ui::LoginDialog *ui;
|
Ui::LoginDialog *ui;
|
||||||
MojangAccountPtr m_account;
|
MojangAccountPtr m_account;
|
||||||
|
std::shared_ptr<Task> m_loginTask;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user