From a9669bc3dbca6c4e4e76770468bf71b61897b716 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 14 Jun 2018 14:13:30 +0200 Subject: [PATCH] Code cleanup on the Profile Settings Summary: Favor manual list creator over for loop for small list Three items, create them manually, cleaner and less computationally expensive. Btw - this is ugly, both ways. I blame QStandardItemModel. Simplify Logic Use auto when types are explicit Simplify Logic: use ternary when it improves readability Stack when heap's uneeded. There's absolutely no point on creating a QPointer and manually deleting the item later. Just create the variable on the stack Auto when type's explicit Subscribers: konsole-devel Tags: #konsole Differential Revision: https://phabricator.kde.org/D13532 --- src/settings/ProfileSettings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/settings/ProfileSettings.cpp b/src/settings/ProfileSettings.cpp index 2bbca639..76e7a35e 100644 --- a/src/settings/ProfileSettings.cpp +++ b/src/settings/ProfileSettings.cpp @@ -296,7 +296,7 @@ void ProfileSettings::createProfile() Q_ASSERT(sourceProfile); - Profile::Ptr newProfile = Profile::Ptr(new Profile(ProfileManager::instance()->fallbackProfile())); + auto newProfile = Profile::Ptr(new Profile(ProfileManager::instance()->fallbackProfile())); newProfile->clone(sourceProfile, true); newProfile->setProperty(Profile::Name, i18nc("@item This will be used as part of the file name", "New Profile")); newProfile->setProperty(Profile::UntranslatedName, QStringLiteral("New Profile"));