23 #include "serverlistfilterinfo.h" 25 ServerListFilterInfo::ServerListFilterInfo()
30 bShowOnlyValid =
false;
32 testingServers = Doomseeker::Indifferent;
37 bEnabled = other.bEnabled;
38 bShowEmpty = other.bShowEmpty;
39 bShowFull = other.bShowFull;
40 bShowOnlyValid = other.bShowOnlyValid;
41 gameModes = other.gameModes;
42 gameModesExcluded = other.gameModesExcluded;
44 serverName = other.serverName.trimmed();
45 testingServers = other.testingServers;
47 copyTrimmed(this->wads, other.wads);
48 copyTrimmed(this->wadsExcluded, other.wadsExcluded);
51 void ServerListFilterInfo::copyTrimmed(QStringList &target,
const QStringList &source)
const 54 for (QString element : source)
56 element = element.trimmed();
57 if (!element.isEmpty())
64 if (!serverName.isEmpty())
70 if (!bShowEmpty || !bShowFull)
73 if (bShowOnlyValid ||
maxPing > 0)
76 if (!gameModes.isEmpty()
77 || !gameModesExcluded.isEmpty()
79 || !wadsExcluded.isEmpty())
84 if (testingServers != Doomseeker::Indifferent)
90 QString ServerListFilterInfo::toString()
const 94 ret += QString(
"bEnabled: ") + (bEnabled ?
"Yes" :
"No") +
"\n";
95 ret += QString(
"bShowEmpty: ") + (bShowEmpty ?
"Yes" :
"No") +
"\n";
96 ret += QString(
"bShowFull: ") + (bShowFull ?
"Yes" :
"No") +
"\n";
97 ret += QString(
"bShowOnlyValid: ") + (bShowOnlyValid ?
"Yes" :
"No") +
"\n";
98 ret += QString(
"GameModes: ") + gameModes.join(
",") +
"\n";
99 ret += QString(
"GameModes Excluded: ") + gameModesExcluded.join(
",") +
"\n";
100 ret += QString(
"MaxPing: ") + QString::number(
maxPing) +
"\n";
101 ret += QString(
"ServerName: ") + serverName +
"\n";
102 ret += QString(
"Testing servers: %1\n").arg(testingServers);
103 ret += QString(
"WADs: ") + wads.join(
",") +
"\n";
104 ret += QString(
"WADs Excluded: ") + wadsExcluded.join(
",") +
"\n";
Structure describing server filter.
unsigned maxPing
Maximum allowed ping.
bool isFilteringAnything() const
Informs if filter will apply to any server.