|
|
|
@ -15,6 +15,7 @@
|
|
|
|
|
#include <QJsonDocument>
|
|
|
|
|
#include <QJsonArray>
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <QtWidgets/QMessageBox>
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
@ -59,7 +60,7 @@ struct pattern
|
|
|
|
|
QString value;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void NetController::downloadInfo(QAbstractItemModel *pModel, QModelIndex index)
|
|
|
|
|
bool NetController::downloadInfo(QAbstractItemModel *pModel, QModelIndex index)
|
|
|
|
|
{
|
|
|
|
|
ServerModel *model = ((ServerModel *) pModel);
|
|
|
|
|
|
|
|
|
@ -76,6 +77,12 @@ void NetController::downloadInfo(QAbstractItemModel *pModel, QModelIndex index)
|
|
|
|
|
RakSleep(30);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(data == "UNKNOWN_ADDRESS")
|
|
|
|
|
{
|
|
|
|
|
QMessageBox::critical(0, "Error", "Cannot connect to the master server!");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qDebug() << "Content: " << data;
|
|
|
|
|
|
|
|
|
|
QJsonParseError err;
|
|
|
|
@ -116,6 +123,7 @@ void NetController::downloadInfo(QAbstractItemModel *pModel, QModelIndex index)
|
|
|
|
|
model->setData(mi, PingRakNetServer(addr[0].toLatin1().data(), addr[1].toUShort()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool NetController::updateInfo(QAbstractItemModel *pModel, QModelIndex index)
|
|
|
|
@ -137,8 +145,9 @@ bool NetController::updateInfo(QAbstractItemModel *pModel, QModelIndex index)
|
|
|
|
|
qDebug() << iter->addr;
|
|
|
|
|
}
|
|
|
|
|
model->removeRows(0, model->rowCount(index));
|
|
|
|
|
downloadInfo(pModel, index);
|
|
|
|
|
result = downloadInfo(pModel, index);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NetController::updateInfo()
|
|
|
|
@ -153,6 +162,12 @@ void NetController::updateInfo()
|
|
|
|
|
RakSleep(30);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(data == "UNKNOWN_ADDRESS")
|
|
|
|
|
{
|
|
|
|
|
QMessageBox::critical(0, "Error", "Cannot connect to the master server!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qDebug() << "Content: " << data;
|
|
|
|
|
|
|
|
|
|
QJsonParseError err;
|
|
|
|
|