| 73 | } |
| 74 | |
| 75 | void 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 | |
| 103 | void ProfileBox::LoadProfilesFromDir(std::vector<Profile>* profiles, const QString& path, bool can_delete) { |
| 104 | QDir dir(path); |
nothing calls this directly
no test coverage detected