2016-02-05 18:32:20 -08:00
|
|
|
#include "profilemanager.h"
|
|
|
|
|
|
|
|
ProfileManager::ProfileManager()
|
|
|
|
{
|
2016-05-16 14:42:05 -07:00
|
|
|
}
|
2016-02-05 18:32:20 -08:00
|
|
|
|
2016-05-16 14:42:05 -07:00
|
|
|
Profile ProfileManager::getByName(QString name)
|
|
|
|
{
|
|
|
|
for (Profile profile : profiles) {
|
|
|
|
if (profile.getName() == name) return profile;
|
|
|
|
}
|
2016-02-05 18:32:20 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool ProfileManager::addProfile(Profile profile)
|
|
|
|
{
|
2016-05-16 14:42:05 -07:00
|
|
|
for (Profile p : profiles) {
|
|
|
|
if (p.getName() == profile.getName()) return false;
|
|
|
|
}
|
2016-02-09 20:02:52 -08:00
|
|
|
|
2016-02-07 09:11:48 -08:00
|
|
|
profiles.push_back(profile);
|
2016-02-09 20:02:52 -08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ProfileManager::deleteByName(QString name)
|
|
|
|
{
|
2016-05-16 14:42:05 -07:00
|
|
|
for (int i = 0; i < profiles.size(); i++) {
|
2016-02-09 20:02:52 -08:00
|
|
|
if (profiles[i].getName() == name)
|
|
|
|
{
|
|
|
|
profiles.erase(profiles.begin() + i);
|
|
|
|
return true;
|
|
|
|
}
|
2016-05-16 14:42:05 -07:00
|
|
|
}
|
2016-02-09 20:02:52 -08:00
|
|
|
return false;
|
2016-02-07 09:11:48 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProfileManager::refreshList(QComboBox *box)
|
|
|
|
{
|
|
|
|
box->clear();
|
|
|
|
for (Profile profile : profiles) {
|
|
|
|
box->addItem(profile.getName());
|
|
|
|
}
|
2016-02-05 18:32:20 -08:00
|
|
|
}
|