Blame toonz/sources/include/tmsgcore.h
|
Toshihiro Shimizu |
890ddd |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Campbell Barton |
d0e335 |
#include <qobject></qobject>
|
|
Toshihiro Shimizu |
890ddd |
#include <set></set>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tcommon.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef DVAPI
|
|
Toshihiro Shimizu |
890ddd |
#undef DVVAR
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TSYSTEM_EXPORTS
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_EXPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_EXPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_IMPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_IMPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class QLocalServer;
|
|
Toshihiro Shimizu |
890ddd |
class QLocalSocket;
|
|
Toshihiro Shimizu |
890ddd |
class QTcpServer;
|
|
Toshihiro Shimizu |
890ddd |
class QTcpSocket;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef ERROR
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
namespace DVGui
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
enum MsgType {
|
|
Toshihiro Shimizu |
890ddd |
INFORMATION,
|
|
Toshihiro Shimizu |
890ddd |
WARNING, //this one opens a popup only if tmsg not visible
|
|
Toshihiro Shimizu |
890ddd |
CRITICAL, //this one opens always a popup
|
|
Toshihiro Shimizu |
890ddd |
QUESTION
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void DVAPI MsgBox(MsgType type, const QString &text);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void DVAPI error(const QString &msg);
|
|
Toshihiro Shimizu |
890ddd |
void DVAPI warning(const QString &msg);
|
|
Toshihiro Shimizu |
890ddd |
void DVAPI info(const QString &msg);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI TMsgCore : public QObject
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QTcpServer *m_tcpServer;
|
|
Toshihiro Shimizu |
890ddd |
QTcpSocket *m_clientSocket;
|
|
Toshihiro Shimizu |
890ddd |
std::set<qtcpsocket *=""> m_sockets;</qtcpsocket>
|
|
Toshihiro Shimizu |
890ddd |
void readFromSocket(QTcpSocket *socket);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TMsgCore();
|
|
Toshihiro Shimizu |
890ddd |
~TMsgCore();
|
|
Toshihiro Shimizu |
890ddd |
static TMsgCore *instance();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//client side
|
|
Toshihiro Shimizu |
890ddd |
// 'send' returns false if the tmessage is not active in the application (tipically, in console applications such as tcomposer)
|
|
Shinya Kitaoka |
bb1d04 |
bool send(DVGui::MsgType type, const QString &message);
|
|
Toshihiro Shimizu |
890ddd |
void connectTo(const QString &address = "");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//server side
|
|
Toshihiro Shimizu |
890ddd |
bool openConnection();
|
|
Toshihiro Shimizu |
890ddd |
QString getConnectionName();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Q_SIGNALS :
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void
|
|
Toshihiro Shimizu |
890ddd |
sendMessage(int type, const QString &message);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public Q_SLOTS:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void OnNewConnection();
|
|
Toshihiro Shimizu |
890ddd |
void OnReadyRead();
|
|
Toshihiro Shimizu |
890ddd |
void OnDisconnected();
|
|
Toshihiro Shimizu |
890ddd |
};
|