refactoring

This commit is contained in:
fourtf
2017-04-12 17:46:44 +02:00
parent 8ef492d7ae
commit 96db82e867
114 changed files with 5554 additions and 3703 deletions
+12 -15
View File
@@ -3,34 +3,31 @@
#include "setting.h"
struct SettingsSnapshot {
private:
std::vector<
std::pair<std::reference_wrapper<chatterino::BaseSetting>, QVariant>>
items;
namespace chatterino {
struct SettingsSnapshot {
public:
SettingsSnapshot()
: items()
: _items()
{
}
void
addItem(std::reference_wrapper<chatterino::BaseSetting> setting,
const QVariant &value)
void addItem(std::reference_wrapper<BaseSetting> setting, const QVariant &value)
{
items.push_back(
std::pair<std::reference_wrapper<chatterino::BaseSetting>,
QVariant>(setting.get(), value));
_items.push_back(
std::pair<std::reference_wrapper<BaseSetting>, QVariant>(setting.get(), value));
}
void
apply()
void apply()
{
for (auto &item : this->items) {
for (auto &item : _items) {
item.first.get().setVariant(item.second);
}
}
private:
std::vector<std::pair<std::reference_wrapper<BaseSetting>, QVariant>> _items;
};
}
#endif // SETTINGSSNAPSHOT_H