25 #include "mastermanager.h" 27 #include "customservers.h" 28 #include "serverapi/broadcastmanager.h" 29 #include "serverapi/message.h" 30 #include "serverapi/server.h" 40 MasterManager::~MasterManager()
51 if (master ==
nullptr)
54 masters.append(master);
57 this->connect(master, SIGNAL(listUpdated()), SLOT(masterListUpdated()));
58 this->connect(master, SIGNAL(
message(QString,QString,
bool)),
59 SLOT(forwardMasterMessage(QString,QString,
bool)));
61 SLOT(forwardMasterMessageImportant(
Message)));
64 QList<ServerPtr> MasterManager::allServers()
const 66 QSet<ServerPtr> result;
69 for (ServerPtr server : master->servers())
70 result.insert(server);
72 for (ServerPtr server : customServers->servers())
73 result.insert(server);
74 if (broadcastManager !=
nullptr)
76 for (ServerPtr server : broadcastManager->servers())
77 result.insert(server);
79 return result.toList();
82 void MasterManager::masterListUpdated()
85 for (ServerPtr pServer : master->servers())
90 emit listUpdatedForMaster(master);
91 mastersBeingRefreshed.remove(master);
92 if (mastersBeingRefreshed.isEmpty())
98 MasterManager::Response MasterManager::readMasterResponse(
const QByteArray &data)
101 assert(0 &&
"MasterManager::readMasterResponse should not get called.");
105 void MasterManager::refreshStarts()
111 for (
auto *master : masters)
118 mastersBeingRefreshed.insert(master);
123 void MasterManager::timeoutRefreshEx()
127 pMaster->timeoutRefresh();
130 mastersBeingRefreshed.clear();
133 void MasterManager::setBroadcastManager(
BroadcastManager *broadcastManagerPtr)
135 broadcastManager = broadcastManagerPtr;
Message object used to pass messages throughout the Doomseeker's system.
void registerNewServer(ServerPtr server)
Registers new server with this MasterClient.
void message(const QString &title, const QString &content, bool isError)
virtual void refreshStarts()
void messageImportant(const Message &message)
Signal used to forward important message to Doomseeker.
Abstract base for all MasterClients.