mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
34 lines
664 B
C++
34 lines
664 B
C++
#ifndef SETTINGSSNAPSHOT_H
|
|
#define SETTINGSSNAPSHOT_H
|
|
|
|
#include "setting.h"
|
|
|
|
namespace chatterino {
|
|
|
|
struct SettingsSnapshot {
|
|
public:
|
|
SettingsSnapshot()
|
|
: _items()
|
|
{
|
|
}
|
|
|
|
void addItem(std::reference_wrapper<BaseSetting> setting, const QVariant &value)
|
|
{
|
|
_items.push_back(
|
|
std::pair<std::reference_wrapper<BaseSetting>, QVariant>(setting.get(), value));
|
|
}
|
|
|
|
void apply()
|
|
{
|
|
for (auto &item : _items) {
|
|
item.first.get().setVariant(item.second);
|
|
}
|
|
}
|
|
|
|
private:
|
|
std::vector<std::pair<std::reference_wrapper<BaseSetting>, QVariant>> _items;
|
|
};
|
|
}
|
|
|
|
#endif // SETTINGSSNAPSHOT_H
|