serverlistfilterinfo.h
1 //------------------------------------------------------------------------------
2 // serverlistfilterinfo.h
3 //------------------------------------------------------------------------------
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301 USA
19 //
20 //------------------------------------------------------------------------------
21 // Copyright (C) 2011 "Zalewa" <zalewapl@gmail.com>
22 //------------------------------------------------------------------------------
23 #ifndef __SERVERLISTFILTERINFO_H__
24 #define __SERVERLISTFILTERINFO_H__
25 
26 #include <QString>
27 #include <QStringList>
28 #include <QVariant>
29 
30 #include "gui/entity/showmode.h"
31 
36 {
37 public:
38  QString name;
39  bool bEnabled;
40  bool bShowEmpty;
41  bool bShowFull;
42  bool bShowOnlyValid;
43  bool bShowBannedServers;
44  bool bShowTooSoonServers;
45  bool bShowNotRespondingServers;
46  QStringList gameModes;
47  QStringList gameModesExcluded;
48 
49  Doomseeker::ShowMode lockedServers;
50 
57  unsigned maxPing;
58  QString serverName;
59  QStringList wads;
60  QStringList wadsExcluded;
61  Doomseeker::ShowMode testingServers;
62 
65 
68  {
69  copy(other);
70  }
71 
72  ServerListFilterInfo &operator=(const ServerListFilterInfo &other)
73  {
74  if (this != &other)
75  copy(other);
76 
77  return *this;
78  }
79 
87  bool isFilteringAnything() const;
88 
95  bool isFilteringEquivalent(const ServerListFilterInfo &other) const;
96 
97  static ServerListFilterInfo deserialize(const QVariant &variant);
98  QVariant serialize() const;
99 
100  QString toString() const;
101 
102 private:
103  void copy(const ServerListFilterInfo &other);
104  void copyTrimmed(QStringList &target, const QStringList &source) const;
105 };
106 
107 #endif