1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-22 10:42:29 +01:00

Add connected socket check

Fix WinMonitorStats member order
This commit is contained in:
Elias Steurer 2021-12-18 13:01:01 +01:00
parent 1eb36a7476
commit 26352ee9ca
2 changed files with 19 additions and 7 deletions

View File

@ -94,6 +94,10 @@ void ScreenPlay::SDKConnection::readyRead()
*/
bool ScreenPlay::SDKConnection::sendMessage(const QByteArray& message)
{
if (!m_socket) {
qWarning() << "Unable to write to unconnected socket wit message: " << message;
return false;
}
m_socket->write(message);
return m_socket->waitForBytesWritten();
}

View File

@ -54,12 +54,11 @@
namespace ScreenPlayUtil {
#if defined(Q_OS_WIN)
struct WinMonitorStats {
std::vector<int> iMonitors;
std::vector<HMONITOR> hMonitors;
std::vector<HDC> hdcMonitors;
std::vector<RECT> rcMonitors;
std::vector<DEVICE_SCALE_FACTOR> scaleFactor;
std::vector<std::pair<UINT, UINT>> sizes;
WinMonitorStats()
{
EnumDisplayMonitors(NULL, NULL, MonitorEnum, (LPARAM)this);
}
static BOOL CALLBACK MonitorEnum(HMONITOR hMon, HDC hdc, LPRECT lprcMonitor,
LPARAM pData)
@ -77,10 +76,19 @@ struct WinMonitorStats {
pThis->hdcMonitors.push_back(hdc);
pThis->rcMonitors.push_back(*lprcMonitor);
pThis->iMonitors.push_back(pThis->hdcMonitors.size());
//qInfo() << std::abs(lprcMonitor->right - lprcMonitor->left) << std::abs(lprcMonitor->top - lprcMonitor->bottom);
return TRUE;
}
WinMonitorStats() { EnumDisplayMonitors(0, 0, MonitorEnum, (LPARAM)this); }
std::vector<int> iMonitors;
std::vector<HMONITOR> hMonitors;
std::vector<HDC> hdcMonitors;
std::vector<RECT> rcMonitors;
std::vector<DEVICE_SCALE_FACTOR> scaleFactor;
std::vector<std::pair<UINT, UINT>> sizes;
int index = 0;
};
#endif
QJsonArray fillArray(const QVector<QString>& items);