2017-05-27 02:57:34 +00:00
|
|
|
//
|
|
|
|
// Created by koncord on 27.05.17.
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef OPENMW_QUERYHELPER_HPP
|
|
|
|
#define OPENMW_QUERYHELPER_HPP
|
|
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
2017-05-27 05:08:52 +00:00
|
|
|
#include <vector>
|
2017-05-27 02:57:34 +00:00
|
|
|
#include <QAbstractItemModel>
|
2017-05-27 05:08:52 +00:00
|
|
|
#include <components/openmw-mp/Master/MasterData.hpp>
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(QueryData)
|
2017-05-27 02:57:34 +00:00
|
|
|
|
|
|
|
class QueryHelper : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit QueryHelper(QAbstractItemModel *model);
|
|
|
|
public slots:
|
|
|
|
void refresh();
|
|
|
|
void terminate();
|
2017-05-27 05:08:52 +00:00
|
|
|
private slots:
|
|
|
|
void update(QString addr, unsigned short port, QueryData data);
|
2017-05-27 03:44:55 +00:00
|
|
|
signals:
|
|
|
|
void finished();
|
|
|
|
void started();
|
2017-05-27 02:57:34 +00:00
|
|
|
private:
|
|
|
|
QThread *queryThread;
|
2017-05-27 05:08:52 +00:00
|
|
|
QAbstractItemModel *_model;
|
2017-05-27 02:57:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class QueryUpdate : public QObject
|
|
|
|
{
|
|
|
|
friend class QueryHelper;
|
|
|
|
Q_OBJECT
|
|
|
|
signals:
|
|
|
|
void finished();
|
2017-05-27 05:08:52 +00:00
|
|
|
void updateModel(QString addr, unsigned short port, QueryData data);
|
2017-05-27 02:57:34 +00:00
|
|
|
public slots:
|
|
|
|
void process();
|
|
|
|
};
|
|
|
|
|
2017-05-31 05:37:11 +00:00
|
|
|
#endif //OPENMW_QUERYHELPER_HPP
|