1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-05-11 20:47:45 +00:00

Use better default profile names

Instead of "New Profile" for every new profile, they are now named as
follows:
* The first profile is "Default", because most users will most likely
only have one.
* Every subsequent profile is "New Profile (N)" where N is the number of
profiles.
This commit is contained in:
Joshua Goins 2025-05-05 16:18:19 -04:00
parent 7cb82b43d3
commit 0d8e807f87

View file

@ -5,6 +5,7 @@
#include "astra_log.h"
#include "profileconfig.h"
#include <KLocalizedString>
#include <KSharedConfig>
#include <QDir>
#include <QUuid>
@ -43,8 +44,15 @@ Profile *ProfileManager::getProfileByUUID(const QString &uuid)
Profile *ProfileManager::addProfile()
{
QString newProfileName;
if (m_profiles.size() == 0) {
newProfileName = i18n("Default");
} else {
newProfileName = i18n("New Profile (%1)", m_profiles.size());
}
const auto newProfile = new Profile(QUuid::createUuid().toString(), this);
newProfile->config()->setName(QStringLiteral("New Profile"));
newProfile->config()->setName(newProfileName);
newProfile->config()->save();
insertProfile(newProfile);