/
alexashkin
/
telegraph
Обзор
Документация
Войти
/
alexashkin
/
telegraph
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/data/chatfoldermodel.cpp
49 строк
2 KB
mbarashkov
Отрефакторил массив options у папки чатов
14 фев 2025, 19:10
14 фев 2025, 19:10
5761819
Код
Авторство
О чём код?
#include "chatfoldermodel.h" ChatFolderModel::ChatFolderModel(QObject *parent): QObject(parent) { type = ChatFolderModel::Generic; } ChatFolderModel::ChatFolderModel(QMap<QString, QVariant> folder, ChatFolderModel::Type type, QObject *parent): QObject(parent) { this->id = folder["id"].toLongLong(); this->name = folder["name"].toMap()["text"].toMap()["text"].toString(); this->type = type; } ChatFolderModel::ChatFolderModel(qlonglong id, QString name, ChatFolderModel::Type type, QObject *parent): QObject(parent) { this->id = id; this->name = name; this->type = type; } void ChatFolderModel::setProperties(QVariantMap properties) { options[ExcludeArchived] = properties["exclude_archived"].toBool(); options[ExcludeMuted] = properties["exclude_muted"].toBool(); options[ExcludeRead] = properties["exclude_read"].toBool(); options[IncludeBots] = properties["include_bots"].toBool(); options[IncludeContacts] = properties["include_contacts"].toBool(); options[IncludeChannels] = properties["include_channels"].toBool(); options[IncludeGroups] = properties["include_groups"].toBool(); options[IncludeNonContacts] = properties["include_non_contacts"].toBool(); auto _includedChatIds = properties["included_chat_ids"].toList(); for (const auto &id: _includedChatIds){ includedChatIds.push_back(id.toLongLong()); } auto _excludedChatIds = properties["excluded_chat_ids"].toList(); for (const auto &id: _excludedChatIds){ excludedChatIds.push_back(id.toLongLong()); } auto _pinned_chat_ids = properties["pinned_chat_ids"].toList(); for (const auto &id: _pinned_chat_ids){ pinnedChatIds.push_back(id.toLongLong()); } } bool ChatFolderModel::getOptionValue(ChatFolderModel::Option option) const { if(!options.contains(option)) { return false; } return options.value(option); }