1
1
#include < algorithm>
2
+ #include < cstring>
3
+ #include < tuple>
2
4
5
+ #include < qbytearray.h>
3
6
#include < qbytearrayview.h>
7
+ #include < qcontainerfwd.h>
8
+ #include < qdatastream.h>
4
9
#include < qjsonarray.h>
5
10
#include < qjsondocument.h>
6
11
#include < qjsonobject.h>
7
12
#include < qjsonvalue.h>
13
+ #include < qlocalsocket.h>
14
+ #include < qlogging.h>
8
15
#include < qloggingcategory.h>
16
+ #include < qobject.h>
9
17
#include < qsysinfo.h>
18
+ #include < qtenvironmentvariables.h>
19
+ #include < qtmetamacros.h>
20
+ #include < qtypes.h>
10
21
22
+ #include " ../../../core/model.hpp"
11
23
#include " connection.hpp"
12
24
#include " monitor.hpp"
13
25
#include " workspace.hpp"
@@ -43,7 +55,7 @@ void I3Ipc::dispatch(const QString& payload) {
43
55
44
56
for (auto message: data.array ()) {
45
57
auto jsonMessage = message.toObject ();
46
- bool success = jsonMessage[" success" ].toBool ();
58
+ const bool success = jsonMessage[" success" ].toBool ();
47
59
48
60
if (!success) {
49
61
qWarning () << " Error while executing dispatch of" << payload << " :\n\t "
@@ -126,16 +138,16 @@ void I3Ipc::eventSocketReady() {
126
138
127
139
QVector<Event> I3Ipc::parseResponse (QByteArray rawEvent) {
128
140
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;
131
143
132
144
while (rawEvent.startsWith (MAGIC)) {
133
145
QDataStream ds (QByteArray (rawEvent.data () + magicLen, 8 )); // NOLINT
134
146
135
147
ds.setByteOrder (static_cast <QDataStream::ByteOrder>(QSysInfo::ByteOrder));
136
148
137
- uint32_t size = 0 ;
138
- uint32_t type = 0 ;
149
+ quint32 size = 0 ;
150
+ quint32 type = 0 ;
139
151
140
152
ds >> size;
141
153
ds >> type;
@@ -238,7 +250,7 @@ I3Ipc* I3Ipc::instance() {
238
250
239
251
void I3Ipc::refreshWorkspaces () {
240
252
auto msg = I3Ipc::buildRequestMessage (EventCode::GET_WORKSPACES);
241
- auto res = I3Ipc:: makeRequest (msg);
253
+ auto res = this -> makeRequest (msg);
242
254
243
255
if (res.isEmpty ()) {
244
256
qWarning (logi3Ipc) << " Failed updating workspaces" ;
@@ -299,7 +311,7 @@ void I3Ipc::refreshWorkspaces() {
299
311
300
312
void I3Ipc::refreshMonitors () {
301
313
auto msg = I3Ipc::buildRequestMessage (EventCode::GET_OUTPUTS);
302
- auto res = I3Ipc:: makeRequest (msg);
314
+ auto res = this -> makeRequest (msg);
303
315
304
316
if (res.isEmpty ()) {
305
317
qWarning (logi3Ipc) << " Failed to update monitors" ;
@@ -399,8 +411,8 @@ void I3Ipc::handleWorkspaceEvent(I3IpcEvent* event) {
399
411
400
412
qCInfo (logi3IpcEvents) << " Focus changed: " << oldName << " ->" << newName;
401
413
402
- auto * oldWorkspace = I3Ipc:: findWorkspaceByName (oldName);
403
- auto * newWorkspace = I3Ipc:: findWorkspaceByName (newName);
414
+ auto * oldWorkspace = this -> findWorkspaceByName (oldName);
415
+ auto * newWorkspace = this -> findWorkspaceByName (newName);
404
416
405
417
if (oldWorkspace != nullptr ) {
406
418
oldWorkspace->setFocus (false );
@@ -414,7 +426,7 @@ void I3Ipc::handleWorkspaceEvent(I3IpcEvent* event) {
414
426
} else if (change == " empty" ) {
415
427
auto name = event->mData [" current" ][" name" ].toString ();
416
428
417
- auto * oldWorkspace = I3Ipc:: findWorkspaceByName (name);
429
+ auto * oldWorkspace = this -> findWorkspaceByName (name);
418
430
419
431
if (oldWorkspace != nullptr ) {
420
432
qCInfo (logi3Ipc) << " Deleting" << oldWorkspace->id () << name;
0 commit comments