mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-23 09:06:45 -05:00
First pass for collab editing
This commit is contained in:
31
include/collabsession.h
Normal file
31
include/collabsession.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef COLLABSESSION_H
|
||||
#define COLLABSESSION_H
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include <QString>
|
||||
|
||||
#define COMMAND_BLOCKS_CHANGED 0x1
|
||||
|
||||
#define SERVER_MESSAGE_CREATED_SESSION 0x1
|
||||
#define SERVER_MESSAGE_JOINED_SESSION 0x2
|
||||
#define SERVER_MESSAGE_BROADCAST_COMMAND 0x3
|
||||
|
||||
class CollabSession
|
||||
{
|
||||
public:
|
||||
CollabSession(MainWindow *mainWindow);
|
||||
static void init(MainWindow *mainWindow);
|
||||
static bool connect(QString host, int port);
|
||||
static void createSession(QString sessionName);
|
||||
static void joinSession(QString sessionName);
|
||||
static QByteArray prepareSocketMessage(QByteArray message, int messageType);
|
||||
static void onBlockChanged(int x, int y, Block prevBlock, Block newBlock);
|
||||
void processMessage();
|
||||
MainWindow *mainWindow = nullptr;
|
||||
private:
|
||||
static void handleBlocksChangedCommand(QByteArray message);
|
||||
QTcpSocket *socket = nullptr;
|
||||
QByteArray messageBuffer;
|
||||
};
|
||||
|
||||
#endif // COLLABSESSION_H
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QTcpSocket>
|
||||
#include <QString>
|
||||
#include <QModelIndex>
|
||||
#include <QMainWindow>
|
||||
@@ -232,6 +233,10 @@ private slots:
|
||||
|
||||
void on_actionRegion_Map_Editor_triggered();
|
||||
|
||||
void on_actionConnect_to_Collab_triggered();
|
||||
void on_actionCreate_Collab_Session_triggered();
|
||||
void on_actionJoin_Collab_Session_triggered();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
TilesetEditor *tilesetEditor = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user