Browse Source

New settings style for servers
ip:port:s-p support 0/1

Mihawk 12 years ago
parent
commit
9a4079ccb3
3 changed files with 26 additions and 20 deletions
  1. 0 1
      ServerQuery.cpp
  2. 9 3
      Settings.cpp
  3. 17 16
      Settings.h

+ 0 - 1
ServerQuery.cpp

@@ -221,7 +221,6 @@ void ServerQuery::parseServerInfo()
     }
     myPlayers.append(player);
   }
-
   myActiveFlag = false;
 
   emit finished();

+ 9 - 3
Settings.cpp

@@ -77,7 +77,7 @@ Settings::ServerList Settings::serverList()
     Server sv;
     sv.address = svaddr.at(0);
     sv.port = svaddr.at(1).toUShort();
-    sv.supportsSendPrivate = ourSettings->value("supportsSendPrivate", false).toBool();
+    sv.supportsSendPrivate = svaddr.at(2).toInt();
     list.append(sv);
   }
   ourSettings->endArray();
@@ -92,8 +92,7 @@ void Settings::setServerList(ServerList &list)
   for(int i = 0; i < list.size(); ++i)
   {
     ourSettings->setArrayIndex(i);
-    ourSettings->setValue("address", list.at(i).address + ":" + QString::number(list.at(i).port));
-    ourSettings->setValue("supportsSendPrivate", list.at(i).supportsSendPrivate);
+    ourSettings->setValue("address", list.at(i).address + ":" + QString::number(list.at(i).port) + ":" + QString::number(QVariant(list.at(i).supportsSendPrivate).toInt()));
   }
   ourSettings->endArray();
 }
@@ -194,6 +193,12 @@ int Settings::refreshHostNamesHour() const
   return ourSettings->value("refreshHostNamesHour", 21).toInt();
 }
 
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+int Settings::maxServers() const
+{
+  return ourSettings->value("maxServers", 100).toInt();
+}
+
 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 void Settings::save()
 {
@@ -213,6 +218,7 @@ void Settings::save()
   ourSettings->setValue("sshHostName", sshHostName());
   ourSettings->setValue("sshUserName", sshUserName());
   ourSettings->setValue("refreshHostNamesHour", refreshHostNamesHour());
+  ourSettings->setValue("maxServers", maxServers());
 
   ServerList list = serverList();
   setServerList(list);

+ 17 - 16
Settings.h

@@ -68,22 +68,23 @@ public:
   /**
     Config file direct parameter accessors
   */
-  QString           quakeFolder() const;
-  QString           botName() const;
-  int               botPing() const;
-  int               botTopColor() const;
-  int               botBottomColor() const;
-  bool              botSpectator() const;
-  int               floodProtTime() const;
-  int               qwFloodProtTime() const;
-  int               spamFloodProtTime() const;
-  unsigned int      queryInterval() const;
-  int               timeToSayHiAfterConnected() const;
-  int               timeToWaitForCountReply() const;
-  bool              developerMode() const;
-  QString           sshUserName() const;
-  QString           sshHostName() const;
-  int               refreshHostNamesHour() const;
+  QString           quakeFolder() const; // QuakeWorld folder
+  QString           botName() const; // Bot name
+  int               botPing() const; // Bot ping
+  int               botTopColor() const; // Bot shirts color
+  int               botBottomColor() const; // Bot pants color
+  bool              botSpectator() const; // Bot joins as spectator
+  int               floodProtTime() const; // Flood protection time
+  int               qwFloodProtTime() const; // Flood protection time for .qw command
+  int               spamFloodProtTime() const; // Flood protection time for .spam command
+  unsigned int      queryInterval() const; // Interval between server status queries (check if there are or there arent players on a given server)
+  int               timeToSayHiAfterConnected() const; // OBSOLETE
+  int               timeToWaitForCountReply() const; // Time to wait from a reply from central about the amount of people that the message we broadcasted has reached
+  bool              developerMode() const; // Developer mode
+  QString           sshUserName() const; // Username on central
+  QString           sshHostName() const; // HostName of central
+  int               refreshHostNamesHour() const; // An specific hour that the bot must refresh his hostname list
+  int               maxServers() const; // Maximum servers that we can monitor
 
   /**
     Save current settings to the file.