mirror-chatterino2/settingssnapshot.h

37 lines
735 B
C
Raw Normal View History

2017-01-24 19:51:57 +01:00
#ifndef SETTINGSSNAPSHOT_H
#define SETTINGSSNAPSHOT_H
#include "setting.h"
struct SettingsSnapshot {
private:
std::vector<
std::pair<std::reference_wrapper<chatterino::BaseSetting>, QVariant>>
items;
public:
SettingsSnapshot()
: items()
{
}
void
addItem(std::reference_wrapper<chatterino::BaseSetting> setting,
const QVariant &value)
{
items.push_back(
std::pair<std::reference_wrapper<chatterino::BaseSetting>,
QVariant>(setting.get(), value));
}
void
apply()
{
for (auto &item : this->items) {
item.first.get().setVariant(item.second);
}
}
};
#endif // SETTINGSSNAPSHOT_H