11#include < algorithm>
2+ #include < cstring>
3+ #include < tuple>
24
5+ #include < qbytearray.h>
36#include < qbytearrayview.h>
7+ #include < qcontainerfwd.h>
8+ #include < qdatastream.h>
49#include < qjsonarray.h>
510#include < qjsondocument.h>
611#include < qjsonobject.h>
712#include < qjsonvalue.h>
13+ #include < qlocalsocket.h>
14+ #include < qlogging.h>
815#include < qloggingcategory.h>
16+ #include < qobject.h>
917#include < qsysinfo.h>
18+ #include < qtenvironmentvariables.h>
19+ #include < qtmetamacros.h>
20+ #include < qtypes.h>
1021
22+ #include " ../../../core/model.hpp"
1123#include " connection.hpp"
1224#include " monitor.hpp"
1325#include " workspace.hpp"
@@ -43,7 +55,7 @@ void I3Ipc::dispatch(const QString& payload) {
4355
4456 for (auto message: data.array ()) {
4557 auto jsonMessage = message.toObject ();
46- bool success = jsonMessage[" success" ].toBool ();
58+ const bool success = jsonMessage[" success" ].toBool ();
4759
4860 if (!success) {
4961 qWarning () << " Error while executing dispatch of" << payload << " :\n\t "
@@ -126,16 +138,16 @@ void I3Ipc::eventSocketReady() {
126138
127139QVector<Event> I3Ipc::parseResponse (QByteArray rawEvent) {
128140 QVector<std::tuple<EventCode, QJsonDocument>> events;
129- int magicLen = 6 ;
130- int header = 8 + magicLen;
141+ const int magicLen = 6 ;
142+ const int header = 8 + magicLen;
131143
132144 while (rawEvent.startsWith (MAGIC)) {
133145 QDataStream ds (QByteArray (rawEvent.data () + magicLen, 8 )); // NOLINT
134146
135147 ds.setByteOrder (static_cast <QDataStream::ByteOrder>(QSysInfo::ByteOrder));
136148
137- uint32_t size = 0 ;
138- uint32_t type = 0 ;
149+ quint32 size = 0 ;
150+ quint32 type = 0 ;
139151
140152 ds >> size;
141153 ds >> type;
@@ -238,7 +250,7 @@ I3Ipc* I3Ipc::instance() {
238250
239251void I3Ipc::refreshWorkspaces () {
240252 auto msg = I3Ipc::buildRequestMessage (EventCode::GET_WORKSPACES);
241- auto res = I3Ipc:: makeRequest (msg);
253+ auto res = this -> makeRequest (msg);
242254
243255 if (res.isEmpty ()) {
244256 qWarning (logi3Ipc) << " Failed updating workspaces" ;
@@ -299,7 +311,7 @@ void I3Ipc::refreshWorkspaces() {
299311
300312void I3Ipc::refreshMonitors () {
301313 auto msg = I3Ipc::buildRequestMessage (EventCode::GET_OUTPUTS);
302- auto res = I3Ipc:: makeRequest (msg);
314+ auto res = this -> makeRequest (msg);
303315
304316 if (res.isEmpty ()) {
305317 qWarning (logi3Ipc) << " Failed to update monitors" ;
@@ -399,8 +411,8 @@ void I3Ipc::handleWorkspaceEvent(I3IpcEvent* event) {
399411
400412 qCInfo (logi3IpcEvents) << " Focus changed: " << oldName << " ->" << newName;
401413
402- auto * oldWorkspace = I3Ipc:: findWorkspaceByName (oldName);
403- auto * newWorkspace = I3Ipc:: findWorkspaceByName (newName);
414+ auto * oldWorkspace = this -> findWorkspaceByName (oldName);
415+ auto * newWorkspace = this -> findWorkspaceByName (newName);
404416
405417 if (oldWorkspace != nullptr ) {
406418 oldWorkspace->setFocus (false );
@@ -414,7 +426,7 @@ void I3Ipc::handleWorkspaceEvent(I3IpcEvent* event) {
414426 } else if (change == " empty" ) {
415427 auto name = event->mData [" current" ][" name" ].toString ();
416428
417- auto * oldWorkspace = I3Ipc:: findWorkspaceByName (name);
429+ auto * oldWorkspace = this -> findWorkspaceByName (name);
418430
419431 if (oldWorkspace != nullptr ) {
420432 qCInfo (logi3Ipc) << " Deleting" << oldWorkspace->id () << name;
0 commit comments