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:
|
||||
void allWallpaperRemoved();
|
||||
void projectSettingsListModelFound(ProjectSettingsListModel* li,QString type);
|
||||
void projectSettingsListModelFound(ProjectSettingsListModel* li, QString type);
|
||||
void projectSettingsListModelNotFound();
|
||||
|
||||
public slots:
|
||||
@ -81,7 +81,8 @@ public:
|
||||
QProcess* m_process = new QProcess();
|
||||
|
||||
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) {
|
||||
qDebug() << "EX: " << error;
|
||||
@ -101,11 +102,6 @@ public:
|
||||
m_projectSettingsListModel = QSharedPointer<ProjectSettingsListModel>(new ProjectSettingsListModel(projectPath + "/project.json"));
|
||||
}
|
||||
|
||||
~ScreenPlayWallpaper()
|
||||
{
|
||||
qDebug() << "Destructing wallpaper " << m_appID;
|
||||
}
|
||||
|
||||
QSharedPointer<ProjectSettingsListModel> projectSettingsListModel() const;
|
||||
|
||||
QVector<int> screenNumber() const
|
||||
|
@ -26,7 +26,6 @@ void SDKConnector::newConnection()
|
||||
void SDKConnector::closeAllWallpapers()
|
||||
{
|
||||
for (int i = 0; i < m_clients.size(); ++i) {
|
||||
qDebug() << m_clients.data()->get()->appID();
|
||||
m_clients.at(i)->close();
|
||||
m_clients.clear();
|
||||
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) {
|
||||
qDebug() << appID << " " << m_clients.at(i).data()->appID() << " " << m_clients.count() << " " << key << " " << value;
|
||||
if (m_clients.at(i).data()->appID() == appID) {
|
||||
QJsonObject obj;
|
||||
obj.insert(key, QJsonValue(value));
|
||||
|
@ -8,8 +8,6 @@
|
||||
#include <QTimer>
|
||||
#include <QVector>
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
\class SDKConnector
|
||||
\brief Used for every Wallpaper, Scene or Widget communication via Windows pipes/QLocalSocket
|
||||
@ -22,7 +20,6 @@ class SDKConnector : public QObject {
|
||||
public:
|
||||
explicit SDKConnector(QObject* parent = nullptr);
|
||||
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
@ -36,7 +33,6 @@ public slots:
|
||||
private:
|
||||
QSharedPointer<QLocalServer> m_server;
|
||||
QVector<QSharedPointer<SDKConnection>> m_clients;
|
||||
|
||||
};
|
||||
|
||||
class SDKConnection : public QObject {
|
||||
@ -52,11 +48,6 @@ public:
|
||||
connect(m_socket, &QLocalSocket::readyRead, this, &SDKConnection::readyRead);
|
||||
connect(m_socket, &QLocalSocket::disconnected, this, &SDKConnection::disconnected);
|
||||
}
|
||||
~SDKConnection()
|
||||
{
|
||||
qDebug() << "destroying SDKConnection Object";
|
||||
}
|
||||
|
||||
|
||||
QString appID() const
|
||||
{
|
||||
@ -70,7 +61,6 @@ public:
|
||||
return m_monitor;
|
||||
}
|
||||
|
||||
|
||||
signals:
|
||||
void requestCloseAt(int at);
|
||||
void appIDChanged(QString appID);
|
||||
@ -80,17 +70,19 @@ public slots:
|
||||
void readyRead()
|
||||
{
|
||||
|
||||
QString msg = QString(m_socket->readAll());
|
||||
auto msg = QString(m_socket->readAll());
|
||||
|
||||
// The first message allways contains the appID
|
||||
if (msg.startsWith("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);
|
||||
|
||||
qDebug() << "### APPID:\t "<< m_appID << "\n### Monitor: "<< m_monitor.at(0);
|
||||
qDebug() << "###### Wallpaper created at:";
|
||||
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()
|
||||
@ -100,8 +92,14 @@ public slots:
|
||||
|
||||
void close()
|
||||
{
|
||||
m_socket->disconnect();
|
||||
if ((m_socket->state()) == QLocalSocket::UnconnectedState || (m_socket->state()) == QLocalSocket::ClosingState )
|
||||
return;
|
||||
|
||||
m_socket->disconnectFromServer();
|
||||
m_socket->close();
|
||||
|
||||
qDebug() << "###### Destroy: ";
|
||||
qDebug() << "### APPID:\t " << m_appID << "\n### Monitor: " << m_monitor.at(0) << " State: " << m_socket->state();
|
||||
}
|
||||
|
||||
void setAppID(QString appID)
|
||||
@ -126,5 +124,4 @@ private:
|
||||
QLocalSocket* m_socket;
|
||||
QString m_appID;
|
||||
QVector<int> m_monitor;
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user