mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
37 lines
735 B
C
37 lines
735 B
C
|
#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
|