File indexing completed on 2024-12-01 07:37:23

0001 /*
0002     This file is part of Choqok, the KDE micro-blogging client
0003 
0004     SPDX-FileCopyrightText: 2010-2012 Mehrdad Momeny <mehrdad.momeny@gmail.com>
0005 
0006     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0007 */
0008 
0009 #ifndef FILTERSETTINGS_H
0010 #define FILTERSETTINGS_H
0011 
0012 #include <QMap>
0013 #include <QObject>
0014 
0015 #include "filter.h"
0016 
0017 class KConfigGroup;
0018 
0019 class FilterSettings : public QObject
0020 {
0021     Q_OBJECT
0022 public:
0023     static FilterSettings *self();
0024     virtual ~FilterSettings();
0025 
0026     QList<Filter *> filters() const;
0027     void setFilters(const QList< Filter * > &filters);
0028     void writeConfig();
0029     void readConfig();
0030 
0031     static QMap<Filter::FilterField, QString> filterFieldsMap();
0032     static QMap<Filter::FilterType, QString> filterTypesMap();
0033     static QMap<Filter::FilterAction, QString> filterActionsMap();
0034 
0035     static QString filterFieldName(Filter::FilterField field);
0036     static Filter::FilterField filterFieldFromName(const QString &name);
0037     static QString filterTypeName(Filter::FilterType type);
0038     static Filter::FilterType filterTypeFromName(const QString &name);
0039     static QString filterActionName(Filter::FilterAction action);
0040     static Filter::FilterAction filterActionFromName(const QString &name);
0041 
0042     static bool hideNoneFriendsReplies();
0043     static void setHideNoneFriendsReplies(bool enable = true);
0044     static bool hideRepliesNotRelatedToMe();
0045     static void setHideRepliesNotRelatedToMe(bool enable = true);
0046 
0047 private:
0048     FilterSettings();
0049     static FilterSettings *_self;
0050 
0051     QList<Filter *> _filters;
0052     static QMap<Filter::FilterField, QString> _filterFieldName;
0053     static QMap<Filter::FilterType, QString> _filterTypeName;
0054     static QMap<Filter::FilterAction, QString> _filterActionName;
0055 
0056     static bool _hideNoneFriendsReplies;
0057     static bool _hideRepliesNotRelatedToMe;
0058 
0059     KConfigGroup *conf;
0060 };
0061 
0062 #endif // FILTERSETTINGS_H