87 lines
1.8 KiB
C++
87 lines
1.8 KiB
C++
#ifndef OBSERVERCLIENTMODEL_H
|
|
#define OBSERVERCLIENTMODEL_H
|
|
|
|
#include <QObject>
|
|
|
|
#include "UserInfo.h"
|
|
#include "misc.h"
|
|
#include "ClientSocket.h"
|
|
#include "customtimer.h"
|
|
|
|
|
|
class MainWindow;
|
|
|
|
class TObserverClientModel : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit TObserverClientModel(QObject *parent = 0);
|
|
|
|
MainWindow* MainWindowPtr;
|
|
|
|
boost::shared_ptr<TClientSocket> ClientSocket;
|
|
|
|
boost::asio::io_service IoService;
|
|
|
|
boost::thread IoServiceThread;
|
|
|
|
boost::mutex UpdatingMapMutex;
|
|
|
|
std::vector<TUserInfo> UserInfoArr;
|
|
std::vector<TUserInfo> AlarmUserInfoArr;
|
|
|
|
CustomTimer Timer;
|
|
|
|
int MapType;
|
|
|
|
bool Connected;
|
|
|
|
void Start(std::string address, std::string port);
|
|
void Finish();
|
|
|
|
void OnSocketClosed();
|
|
|
|
void RestartHeartbeatTimer();
|
|
void RestartMapHeartbeatTimer();
|
|
|
|
void OnConnectButtonPressed();
|
|
|
|
|
|
|
|
void OnUpdateInfoButtonPressed();
|
|
|
|
void OnChangeMapTypeButtonPressed();
|
|
|
|
void OnAutorizationSent();
|
|
|
|
void OnHeartbeat(const boost::system::error_code& e);
|
|
void OnMapHeartbeat(const boost::system::error_code& e);
|
|
|
|
void DoRunIoService();
|
|
|
|
void OnUpdateMapTimer();
|
|
void OnReceiveMapUpdate(std::vector<TUserInfo> userInfoArr);
|
|
void OnReceiveAlarmMapUpdate(std::vector<TUserInfo> userInfoArr);
|
|
|
|
void OnChatSendClick();
|
|
|
|
void OnReceiveChatMessage(TUserInfo userInfo, std::string msg);
|
|
|
|
void OnSendAlarmClick();
|
|
|
|
void OnKickPlayerClick();
|
|
void OnSelectPlayerClick();
|
|
|
|
boost::shared_ptr<boost::asio::deadline_timer> HeartbeatTimer;
|
|
boost::shared_ptr<boost::asio::deadline_timer> MapHeartbeatTimer;
|
|
|
|
boost::signal<void ()> ReceiveCloseSignal;
|
|
|
|
//signals:
|
|
|
|
//public slots:
|
|
|
|
};
|
|
|
|
#endif // OBSERVERCLIENTMODEL_H
|