added editing for profiles\versions

This commit is contained in:
2026-06-16 12:16:59 +03:00
parent bbbed6aa89
commit 966cd46049
5 changed files with 393 additions and 4 deletions
+37
View File
@@ -46,6 +46,43 @@ void LauncherBackend::addVersion(const QString &name, const QString &serverUrl)
emit versionsChanged();
}
void LauncherBackend::updateProfile(int index, const QString &name, const QString &login, const QString &password)
{
if (index < 0 || index >= m_profiles.size())
return;
m_profiles[index].name = name;
m_profiles[index].login = login;
m_profiles[index].password = password;
saveProfiles();
emit profilesChanged();
}
void LauncherBackend::updateVersion(int index, const QString &name, const QString &serverUrl)
{
if (index < 0 || index >= m_versions.size())
return;
m_versions[index].name = name;
m_versions[index].serverUrl = serverUrl;
saveVersions();
emit versionsChanged();
}
QVariantMap LauncherBackend::profileAt(int index) const
{
if (index < 0 || index >= m_profiles.size())
return {};
const auto &p = m_profiles[index];
return {{"name", p.name}, {"login", p.login}, {"password", p.password}};
}
QVariantMap LauncherBackend::versionAt(int index) const
{
if (index < 0 || index >= m_versions.size())
return {};
const auto &v = m_versions[index];
return {{"name", v.name}, {"serverUrl", v.serverUrl}};
}
void LauncherBackend::removeProfile(int index)
{
if (index < 0 || index >= m_profiles.size())