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 <QHostAddress>
27 #include <QString>
28 #include <QStringList>
29 #include <QVariant>
30 
31 #include "gui/entity/addressfilter.h"
32 #include "gui/entity/showmode.h"
33 
38 {
39 public:
40  QString name;
41  bool bEnabled;
42  bool bShowEmpty;
43  bool bShowFull;
44  bool bShowOnlyValid;
45  bool bShowBannedServers;
46  bool bShowTooSoonServers;
47  bool bShowNotRespondingServers;
48 
49  AddressFilter addresses;
50  QStringList gameModes;
51  QStringList gameModesExcluded;
52 
53  Doomseeker::ShowMode lockedServers;
54 
61  unsigned maxPing;
62  QString serverName;
63  QStringList wads;
64  QStringList wadsExcluded;
65  Doomseeker::ShowMode testingServers;
66 
69 
72  {
73  copy(other);
74  }
75 
76  ServerListFilterInfo &operator=(const ServerListFilterInfo &other)
77  {
78  if (this != &other)
79  copy(other);
80 
81  return *this;
82  }
83 
91  bool isFilteringAnything() const;
92 
99  bool isFilteringEquivalent(const ServerListFilterInfo &other) const;
100 
101  static ServerListFilterInfo deserialize(const QVariant &variant);
102  QVariant serialize() const;
103 
104  QString toString() const;
105 
106 private:
107  void copy(const ServerListFilterInfo &other);
108  void copyTrimmed(QStringList &target, const QStringList &source) const;
109 };
110 
111 #endif