Qt: move some more settings to persistent_settings

This commit is contained in:
Megamouse 2020-08-02 16:03:30 +02:00
parent 70fb5712e5
commit 8799eebfe1
15 changed files with 176 additions and 88 deletions

View file

@ -16,6 +16,7 @@
#include "table_item_delegate.h"
#include "main_application.h"
#include "gui_settings.h"
#include "persistent_settings.h"
#include "Emu/System.h"
@ -64,9 +65,10 @@ namespace
}
}
user_manager_dialog::user_manager_dialog(std::shared_ptr<gui_settings> gui_settings, QWidget* parent)
user_manager_dialog::user_manager_dialog(std::shared_ptr<gui_settings> gui_settings, std::shared_ptr<persistent_settings> persistent_settings, QWidget* parent)
: QDialog(parent)
, m_gui_settings(gui_settings)
, m_persistent_settings(persistent_settings)
{
setWindowTitle(tr("User Manager"));
setMinimumSize(QSize(500, 400));
@ -123,7 +125,19 @@ void user_manager_dialog::Init()
vbox_main->addLayout(hbox_buttons);
setLayout(vbox_main);
m_active_user = m_gui_settings->GetValue(gui::um_active_user).toString().toStdString();
m_active_user = m_persistent_settings->GetValue(gui::persistent::active_user).toString().toStdString();
// Handle deprecated value (before August 2nd 2020)
if (m_active_user.empty())
{
m_active_user = m_gui_settings->GetValue(gui::um_active_user).toString().toStdString();
if (!m_active_user.empty())
{
m_persistent_settings->SetValue(gui::persistent::active_user, qstr(m_active_user));
}
}
UpdateTable();
restoreGeometry(m_gui_settings->GetValue(gui::um_geometry).toByteArray());
@ -389,7 +403,7 @@ void user_manager_dialog::OnUserLogin()
}
m_active_user = new_user;
m_gui_settings->SetValue(gui::um_active_user, qstr(m_active_user));
m_persistent_settings->SetValue(gui::persistent::active_user, qstr(m_active_user));
UpdateTable(true);
Q_EMIT OnUserLoginSuccess();
}