MCPcopy Create free account
hub / github.com/MaartenBaert/ssr / LoadProfiles

Method LoadProfiles

src/GUI/ProfileBox.cpp:75–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75void ProfileBox::LoadProfiles() {
76
77 // get all profiles
78 std::vector<Profile> profiles;
79 LoadProfilesFromDir(&profiles, GetApplicationSystemDir(m_type), false);
80 LoadProfilesFromDir(&profiles, GetApplicationUserDir(m_type), true);
81
82 // sort and remove duplicates
83 std::sort(profiles.begin(), profiles.end());
84 m_profiles.clear();
85 for(const Profile& p : profiles) {
86 if(!m_profiles.empty() && m_profiles.back().m_name == p.m_name) {
87 if(p.m_can_delete)
88 m_profiles.back().m_can_delete = true;
89 } else {
90 m_profiles.push_back(p);
91 }
92 }
93
94 // add profiles to combobox
95 m_combobox_profiles->clear();
96 m_combobox_profiles->addItem("\u200e" + tr("(none)") + "\u200e");
97 for(unsigned int i = 0; i < m_profiles.size(); ++i) {
98 m_combobox_profiles->addItem("\u200e" + QByteArray::fromPercentEncoding(m_profiles[i].m_name.toUtf8()) + "\u200e");
99 }
100
101}
102
103void ProfileBox::LoadProfilesFromDir(std::vector<Profile>* profiles, const QString& path, bool can_delete) {
104 QDir dir(path);

Callers

nothing calls this directly

Calls 2

GetApplicationSystemDirFunction · 0.85
GetApplicationUserDirFunction · 0.85

Tested by

no test coverage detected