mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-10-21 21:37:52 +00:00
core: Use single instance of profile manager
This commit is contained in:
parent
4907a83298
commit
c2b2d7a903
13 changed files with 94 additions and 73 deletions
|
@ -27,9 +27,9 @@
|
|||
Lobby::Lobby(QWidget* parent, QStandardItemModel* list,
|
||||
std::shared_ptr<Core::AnnounceMultiplayerSession> session, Core::System& system_)
|
||||
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint),
|
||||
ui(std::make_unique<Ui::Lobby>()), announce_multiplayer_session(session),
|
||||
profile_manager(std::make_unique<Service::Account::ProfileManager>()), system{system_},
|
||||
room_network{system.GetRoomNetwork()} {
|
||||
ui(std::make_unique<Ui::Lobby>()),
|
||||
announce_multiplayer_session(session), system{system_}, room_network{
|
||||
system.GetRoomNetwork()} {
|
||||
ui->setupUi(this);
|
||||
|
||||
// setup the watcher for background connections
|
||||
|
@ -299,14 +299,15 @@ void Lobby::OnRefreshLobby() {
|
|||
}
|
||||
|
||||
std::string Lobby::GetProfileUsername() {
|
||||
const auto& current_user = profile_manager->GetUser(Settings::values.current_user.GetValue());
|
||||
const auto& current_user =
|
||||
system.GetProfileManager().GetUser(Settings::values.current_user.GetValue());
|
||||
Service::Account::ProfileBase profile{};
|
||||
|
||||
if (!current_user.has_value()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (!profile_manager->GetProfileBase(*current_user, profile)) {
|
||||
if (!system.GetProfileManager().GetProfileBase(*current_user, profile)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
|
@ -24,10 +24,6 @@ namespace Core {
|
|||
class System;
|
||||
}
|
||||
|
||||
namespace Service::Account {
|
||||
class ProfileManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Listing of all public games pulled from services. The lobby should be simple enough for users to
|
||||
* find the game they want to play, and join it.
|
||||
|
@ -103,7 +99,6 @@ private:
|
|||
|
||||
QFutureWatcher<AnnounceMultiplayerRoom::RoomList> room_list_watcher;
|
||||
std::weak_ptr<Core::AnnounceMultiplayerSession> announce_multiplayer_session;
|
||||
std::unique_ptr<Service::Account::ProfileManager> profile_manager;
|
||||
QFutureWatcher<void>* watcher;
|
||||
Validation validation;
|
||||
Core::System& system;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue