mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
Better output when disconnection
This commit is contained in:
parent
7411697e1c
commit
9863d62348
@ -39,7 +39,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void allWallpaperRemoved();
|
void allWallpaperRemoved();
|
||||||
void projectSettingsListModelFound(ProjectSettingsListModel* li,QString type);
|
void projectSettingsListModelFound(ProjectSettingsListModel* li, QString type);
|
||||||
void projectSettingsListModelNotFound();
|
void projectSettingsListModelNotFound();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@ -81,7 +81,8 @@ public:
|
|||||||
QProcess* m_process = new QProcess();
|
QProcess* m_process = new QProcess();
|
||||||
|
|
||||||
connect(m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), [=](int exitCode, QProcess::ExitStatus exitStatus) {
|
connect(m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), [=](int exitCode, QProcess::ExitStatus exitStatus) {
|
||||||
qDebug() << "EX: " << exitCode;
|
if (exitCode != 0)
|
||||||
|
qDebug() << "WARNING EXIT CODE: " << exitCode;
|
||||||
});
|
});
|
||||||
connect(m_process, &QProcess::errorOccurred, [=](QProcess::ProcessError error) {
|
connect(m_process, &QProcess::errorOccurred, [=](QProcess::ProcessError error) {
|
||||||
qDebug() << "EX: " << error;
|
qDebug() << "EX: " << error;
|
||||||
@ -101,11 +102,6 @@ public:
|
|||||||
m_projectSettingsListModel = QSharedPointer<ProjectSettingsListModel>(new ProjectSettingsListModel(projectPath + "/project.json"));
|
m_projectSettingsListModel = QSharedPointer<ProjectSettingsListModel>(new ProjectSettingsListModel(projectPath + "/project.json"));
|
||||||
}
|
}
|
||||||
|
|
||||||
~ScreenPlayWallpaper()
|
|
||||||
{
|
|
||||||
qDebug() << "Destructing wallpaper " << m_appID;
|
|
||||||
}
|
|
||||||
|
|
||||||
QSharedPointer<ProjectSettingsListModel> projectSettingsListModel() const;
|
QSharedPointer<ProjectSettingsListModel> projectSettingsListModel() const;
|
||||||
|
|
||||||
QVector<int> screenNumber() const
|
QVector<int> screenNumber() const
|
||||||
|
@ -26,7 +26,6 @@ void SDKConnector::newConnection()
|
|||||||
void SDKConnector::closeAllWallpapers()
|
void SDKConnector::closeAllWallpapers()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_clients.size(); ++i) {
|
for (int i = 0; i < m_clients.size(); ++i) {
|
||||||
qDebug() << m_clients.data()->get()->appID();
|
|
||||||
m_clients.at(i)->close();
|
m_clients.at(i)->close();
|
||||||
m_clients.clear();
|
m_clients.clear();
|
||||||
m_clients.squeeze();
|
m_clients.squeeze();
|
||||||
@ -50,7 +49,6 @@ void SDKConnector::setWallpaperValue(QString appID, QString key, QString value)
|
|||||||
{
|
{
|
||||||
|
|
||||||
for (int i = 0; i < m_clients.count(); ++i) {
|
for (int i = 0; i < m_clients.count(); ++i) {
|
||||||
qDebug() << appID << " " << m_clients.at(i).data()->appID() << " " << m_clients.count() << " " << key << " " << value;
|
|
||||||
if (m_clients.at(i).data()->appID() == appID) {
|
if (m_clients.at(i).data()->appID() == appID) {
|
||||||
QJsonObject obj;
|
QJsonObject obj;
|
||||||
obj.insert(key, QJsonValue(value));
|
obj.insert(key, QJsonValue(value));
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class SDKConnector
|
\class SDKConnector
|
||||||
\brief Used for every Wallpaper, Scene or Widget communication via Windows pipes/QLocalSocket
|
\brief Used for every Wallpaper, Scene or Widget communication via Windows pipes/QLocalSocket
|
||||||
@ -22,7 +20,6 @@ class SDKConnector : public QObject {
|
|||||||
public:
|
public:
|
||||||
explicit SDKConnector(QObject* parent = nullptr);
|
explicit SDKConnector(QObject* parent = nullptr);
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@ -36,7 +33,6 @@ public slots:
|
|||||||
private:
|
private:
|
||||||
QSharedPointer<QLocalServer> m_server;
|
QSharedPointer<QLocalServer> m_server;
|
||||||
QVector<QSharedPointer<SDKConnection>> m_clients;
|
QVector<QSharedPointer<SDKConnection>> m_clients;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SDKConnection : public QObject {
|
class SDKConnection : public QObject {
|
||||||
@ -52,11 +48,6 @@ public:
|
|||||||
connect(m_socket, &QLocalSocket::readyRead, this, &SDKConnection::readyRead);
|
connect(m_socket, &QLocalSocket::readyRead, this, &SDKConnection::readyRead);
|
||||||
connect(m_socket, &QLocalSocket::disconnected, this, &SDKConnection::disconnected);
|
connect(m_socket, &QLocalSocket::disconnected, this, &SDKConnection::disconnected);
|
||||||
}
|
}
|
||||||
~SDKConnection()
|
|
||||||
{
|
|
||||||
qDebug() << "destroying SDKConnection Object";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString appID() const
|
QString appID() const
|
||||||
{
|
{
|
||||||
@ -70,7 +61,6 @@ public:
|
|||||||
return m_monitor;
|
return m_monitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void requestCloseAt(int at);
|
void requestCloseAt(int at);
|
||||||
void appIDChanged(QString appID);
|
void appIDChanged(QString appID);
|
||||||
@ -80,17 +70,19 @@ public slots:
|
|||||||
void readyRead()
|
void readyRead()
|
||||||
{
|
{
|
||||||
|
|
||||||
QString msg = QString(m_socket->readAll());
|
auto msg = QString(m_socket->readAll());
|
||||||
|
|
||||||
// The first message allways contains the appID
|
// The first message allways contains the appID
|
||||||
if (msg.startsWith("appID=")) {
|
if (msg.startsWith("appID=")) {
|
||||||
//Only use the first 32 chars for the appID
|
//Only use the first 32 chars for the appID
|
||||||
m_appID = msg.remove("appID=").mid(0,32);
|
m_appID = msg.remove("appID=").mid(0, 32);
|
||||||
msg.remove(m_appID);
|
msg.remove(m_appID);
|
||||||
|
qDebug() << "###### Wallpaper created at:";
|
||||||
qDebug() << "### APPID:\t "<< m_appID << "\n### Monitor: "<< m_monitor.at(0);
|
qDebug() << "### APPID:\t " << m_appID << "\n### Monitor: " << m_monitor.at(0) << "\n";
|
||||||
}
|
}
|
||||||
qDebug() << "SDK CONNECTOR "<< msg;
|
|
||||||
|
// TODO We now get all debug messages from apps here
|
||||||
|
// show them inside ScreenPlay somewhere
|
||||||
}
|
}
|
||||||
|
|
||||||
void disconnected()
|
void disconnected()
|
||||||
@ -100,8 +92,14 @@ public slots:
|
|||||||
|
|
||||||
void close()
|
void close()
|
||||||
{
|
{
|
||||||
m_socket->disconnect();
|
if ((m_socket->state()) == QLocalSocket::UnconnectedState || (m_socket->state()) == QLocalSocket::ClosingState )
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_socket->disconnectFromServer();
|
||||||
m_socket->close();
|
m_socket->close();
|
||||||
|
|
||||||
|
qDebug() << "###### Destroy: ";
|
||||||
|
qDebug() << "### APPID:\t " << m_appID << "\n### Monitor: " << m_monitor.at(0) << " State: " << m_socket->state();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAppID(QString appID)
|
void setAppID(QString appID)
|
||||||
@ -126,5 +124,4 @@ private:
|
|||||||
QLocalSocket* m_socket;
|
QLocalSocket* m_socket;
|
||||||
QString m_appID;
|
QString m_appID;
|
||||||
QVector<int> m_monitor;
|
QVector<int> m_monitor;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user