summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-12-05 02:39:52 +0100
committerPetr Mrázek <peterix@gmail.com>2013-12-05 02:39:52 +0100
commitf028aa76bc5d28b7fc4d1ea4e194895690e9944e (patch)
tree5157fb0c4675c7f6f14c3947ab685f3b87d45610 /gui
parent613699b3626aea750093ab7eaaeccaa28c0e87c6 (diff)
downloadMultiMC-f028aa76bc5d28b7fc4d1ea4e194895690e9944e.tar
MultiMC-f028aa76bc5d28b7fc4d1ea4e194895690e9944e.tar.gz
MultiMC-f028aa76bc5d28b7fc4d1ea4e194895690e9944e.tar.lz
MultiMC-f028aa76bc5d28b7fc4d1ea4e194895690e9944e.tar.xz
MultiMC-f028aa76bc5d28b7fc4d1ea4e194895690e9944e.zip
Offline mode support, part 1
Refactor MojangAccount so it exposes a less generic interface and supports login. Hide the ugly details. Yggdrasil tasks are now only used from MojangAccount.
Diffstat (limited to 'gui')
-rw-r--r--gui/MainWindow.cpp22
-rw-r--r--gui/dialogs/AccountListDialog.cpp10
-rw-r--r--gui/dialogs/AccountSelectDialog.cpp2
3 files changed, 16 insertions, 18 deletions
diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp
index 854091c6..69591f8b 100644
--- a/gui/MainWindow.cpp
+++ b/gui/MainWindow.cpp
@@ -69,10 +69,6 @@
#include "logic/lists/IconList.h"
#include "logic/lists/JavaVersionList.h"
-#include "logic/auth/flows/AuthenticateTask.h"
-#include "logic/auth/flows/RefreshTask.h"
-#include "logic/auth/flows/ValidateTask.h"
-
#include "logic/BaseInstance.h"
#include "logic/InstanceFactory.h"
#include "logic/MinecraftProcess.h"
@@ -210,9 +206,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
for(AccountProfile profile : account->profiles())
{
- auto meta = MMC->metacache()->resolveEntry("skins", profile.name() + ".png");
+ auto meta = MMC->metacache()->resolveEntry("skins", profile.name + ".png");
auto action = CacheDownload::make(
- QUrl("http://skins.minecraft.net/MinecraftSkins/" + profile.name() + ".png"),
+ QUrl("http://skins.minecraft.net/MinecraftSkins/" + profile.name + ".png"),
meta);
job->addNetAction(action);
meta->stale = true;
@@ -310,9 +306,9 @@ void MainWindow::repopulateAccountsMenu()
section->setEnabled(false);
accountMenu->addAction(section);
- for (AccountProfile profile : account->profiles())
+ for (auto profile : account->profiles())
{
- QAction *action = new QAction(profile.name(), this);
+ QAction *action = new QAction(profile.name, this);
action->setData(account->username());
action->setCheckable(true);
if(active_username == account->username())
@@ -320,7 +316,7 @@ void MainWindow::repopulateAccountsMenu()
action->setChecked(true);
}
- action->setIcon(SkinUtils::getFaceFromCache(profile.name()));
+ action->setIcon(SkinUtils::getFaceFromCache(profile.name));
accountMenu->addAction(action);
connect(action, SIGNAL(triggered(bool)), SLOT(changeActiveAccount()));
}
@@ -378,7 +374,7 @@ void MainWindow::activeAccountChanged()
const AccountProfile *profile = account->currentProfile();
if (profile != nullptr)
{
- accountMenuButton->setIcon(SkinUtils::getFaceFromCache(profile->name()));
+ accountMenuButton->setIcon(SkinUtils::getFaceFromCache(profile->name));
return;
}
}
@@ -790,6 +786,7 @@ void MainWindow::doLaunch()
void MainWindow::doLaunchInst(BaseInstance* instance, MojangAccountPtr account)
{
// We'll need to validate the access token to make sure the account is still logged in.
+ /*
ProgressDialog progDialog(this);
RefreshTask refreshtask(account, &progDialog);
progDialog.exec(&refreshtask);
@@ -829,10 +826,12 @@ void MainWindow::doLaunchInst(BaseInstance* instance, MojangAccountPtr account)
QMessageBox::Warning, QMessageBox::Ok)->exec();
}
}
+ */
}
bool MainWindow::doRefreshToken(MojangAccountPtr account, const QString& errorMsg)
{
+ /*
EditAccountDialog passDialog(errorMsg, this, EditAccountDialog::PasswordField);
if (passDialog.exec() == QDialog::Accepted)
{
@@ -848,7 +847,8 @@ bool MainWindow::doRefreshToken(MojangAccountPtr account, const QString& errorMs
return doRefreshToken(account, authTask.failReason());
}
}
- else return false;
+ else return false;*/
+ return false;
}
void MainWindow::prepareLaunch(BaseInstance* instance, MojangAccountPtr account)
diff --git a/gui/dialogs/AccountListDialog.cpp b/gui/dialogs/AccountListDialog.cpp
index f5268b61..e1f65c16 100644
--- a/gui/dialogs/AccountListDialog.cpp
+++ b/gui/dialogs/AccountListDialog.cpp
@@ -20,7 +20,6 @@
#include <logger/QsLog.h>
-#include <logic/auth/flows/AuthenticateTask.h>
#include <logic/net/NetJob.h>
#include <gui/dialogs/EditAccountDialog.h>
@@ -117,8 +116,8 @@ void AccountListDialog::addAccount(const QString& errMsg)
QString username(loginDialog.username());
QString password(loginDialog.password());
- MojangAccountPtr account = MojangAccountPtr(new MojangAccount(username));
-
+ MojangAccountPtr account = MojangAccount::createFromUsername(username);
+/*
ProgressDialog progDialog(this);
AuthenticateTask authTask(account, password, &progDialog);
if (progDialog.exec(&authTask))
@@ -132,9 +131,9 @@ void AccountListDialog::addAccount(const QString& errMsg)
for(AccountProfile profile : account->profiles())
{
- auto meta = MMC->metacache()->resolveEntry("skins", profile.name() + ".png");
+ auto meta = MMC->metacache()->resolveEntry("skins", profile.name + ".png");
auto action = CacheDownload::make(
- QUrl("http://skins.minecraft.net/MinecraftSkins/" + profile.name() + ".png"),
+ QUrl("http://skins.minecraft.net/MinecraftSkins/" + profile.name + ".png"),
meta);
job->addNetAction(action);
meta->stale = true;
@@ -142,5 +141,6 @@ void AccountListDialog::addAccount(const QString& errMsg)
job->start();
}
+ */
}
}
diff --git a/gui/dialogs/AccountSelectDialog.cpp b/gui/dialogs/AccountSelectDialog.cpp
index b8fa9e42..ec2f09be 100644
--- a/gui/dialogs/AccountSelectDialog.cpp
+++ b/gui/dialogs/AccountSelectDialog.cpp
@@ -20,8 +20,6 @@
#include <logger/QsLog.h>
-#include <logic/auth/flows/AuthenticateTask.h>
-
#include <gui/dialogs/ProgressDialog.h>
#include <MultiMC.h>