2017-06-07 10:09:24 +02:00
|
|
|
#pragma once
|
2017-01-24 19:51:57 +01:00
|
|
|
|
2017-06-11 09:31:45 +02:00
|
|
|
#include "setting.hpp"
|
2017-01-24 19:51:57 +01:00
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
namespace chatterino {
|
2017-01-24 19:51:57 +01:00
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
struct SettingsSnapshot {
|
2017-01-24 19:51:57 +01:00
|
|
|
public:
|
|
|
|
SettingsSnapshot()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
void addItem(std::reference_wrapper<BaseSetting> setting, const QVariant &value)
|
2017-01-24 19:51:57 +01:00
|
|
|
{
|
2017-04-12 17:46:44 +02:00
|
|
|
_items.push_back(
|
|
|
|
std::pair<std::reference_wrapper<BaseSetting>, QVariant>(setting.get(), value));
|
2017-01-24 19:51:57 +01:00
|
|
|
}
|
|
|
|
|
2017-07-31 00:57:42 +02:00
|
|
|
void addMapItem(QString string, QPair<bool, bool> pair)
|
|
|
|
{
|
|
|
|
QMap<QString, QPair<bool, bool>> map;
|
|
|
|
_mapItems.insert(string, pair);
|
2017-07-31 00:37:22 +02:00
|
|
|
}
|
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
void apply()
|
2017-01-24 19:51:57 +01:00
|
|
|
{
|
2017-04-12 17:46:44 +02:00
|
|
|
for (auto &item : _items) {
|
2017-01-24 19:51:57 +01:00
|
|
|
item.first.get().setVariant(item.second);
|
|
|
|
}
|
|
|
|
}
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2017-07-31 00:57:42 +02:00
|
|
|
QMap<QString, QPair<bool, bool>> _mapItems;
|
2017-07-31 00:37:22 +02:00
|
|
|
|
2017-04-12 17:46:44 +02:00
|
|
|
private:
|
|
|
|
std::vector<std::pair<std::reference_wrapper<BaseSetting>, QVariant>> _items;
|
2017-01-24 19:51:57 +01:00
|
|
|
};
|
|
|
|
|
2017-06-07 10:09:24 +02:00
|
|
|
} // namespace chatterino
|