forked from quickshell/quickshell
		
	all: fix failing lints
This commit is contained in:
		
							parent
							
								
									8ec245ac66
								
							
						
					
					
						commit
						3033cba52d
					
				
					 4 changed files with 83 additions and 89 deletions
				
			
		| 
						 | 
				
			
			@ -4,10 +4,8 @@
 | 
			
		|||
#include <qdebug.h>
 | 
			
		||||
#include <qdir.h>
 | 
			
		||||
#include <qfileinfo.h>
 | 
			
		||||
#include <qfilesystemwatcher.h>
 | 
			
		||||
#include <qhash.h>
 | 
			
		||||
#include <qlist.h>
 | 
			
		||||
#include <qlocale.h>
 | 
			
		||||
#include <qlogging.h>
 | 
			
		||||
#include <qloggingcategory.h>
 | 
			
		||||
#include <qnamespace.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -94,7 +92,7 @@ void DesktopEntry::parseEntry(const QString& text) {
 | 
			
		|||
	auto groupName = QString();
 | 
			
		||||
	auto entries = QHash<QString, QPair<Locale, QString>>();
 | 
			
		||||
 | 
			
		||||
	auto finishCategory = [&]() {
 | 
			
		||||
	auto finishCategory = [this, &groupName, &entries]() {
 | 
			
		||||
		if (groupName == "Desktop Entry") {
 | 
			
		||||
			if (entries["Type"].second != "Application") return;
 | 
			
		||||
			if (entries.contains("Hidden") && entries["Hidden"].second == "true") return;
 | 
			
		||||
| 
						 | 
				
			
			@ -334,13 +332,13 @@ void DesktopEntryManager::scanPath(const QDir& dir, const QString& prefix) {
 | 
			
		|||
 | 
			
		||||
			qCDebug(logDesktopEntry) << "Found desktop entry" << id << "at" << path;
 | 
			
		||||
 | 
			
		||||
			if (desktopEntries.contains(id)) {
 | 
			
		||||
			if (this->desktopEntries.contains(id)) {
 | 
			
		||||
				qCDebug(logDesktopEntry) << "Replacing old entry for" << id;
 | 
			
		||||
				delete desktopEntries.value(id);
 | 
			
		||||
				desktopEntries.remove(id);
 | 
			
		||||
				delete this->desktopEntries.value(id);
 | 
			
		||||
				this->desktopEntries.remove(id);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			desktopEntries.insert(id, dentry);
 | 
			
		||||
			this->desktopEntries.insert(id, dentry);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,7 +10,9 @@
 | 
			
		|||
#include <qguiapplication.h>
 | 
			
		||||
#include <qhash.h>
 | 
			
		||||
#include <qicon.h>
 | 
			
		||||
#include <qlist.h>
 | 
			
		||||
#include <qlogging.h>
 | 
			
		||||
#include <qnamespace.h>
 | 
			
		||||
#include <qqmldebug.h>
 | 
			
		||||
#include <qquickwindow.h>
 | 
			
		||||
#include <qstandardpaths.h>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,6 +7,7 @@
 | 
			
		|||
#include <qobject.h>
 | 
			
		||||
#include <qquickitem.h>
 | 
			
		||||
#include <qquickwindow.h>
 | 
			
		||||
#include <qtmetamacros.h>
 | 
			
		||||
 | 
			
		||||
void TransformWatcher::resolveChains(QQuickItem* a, QQuickItem* b, QQuickItem* commonParent) {
 | 
			
		||||
	if (a == nullptr || b == nullptr) return;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -377,58 +377,55 @@ void HyprlandIpc::refreshWorkspaces(bool canCreate) {
 | 
			
		|||
	if (this->requestingWorkspaces) return;
 | 
			
		||||
	this->requestingWorkspaces = true;
 | 
			
		||||
 | 
			
		||||
	this->makeRequest(
 | 
			
		||||
	    "j/workspaces",
 | 
			
		||||
	    [this, canCreate](bool success, const QByteArray& resp) {
 | 
			
		||||
		    this->requestingWorkspaces = false;
 | 
			
		||||
		    if (!success) return;
 | 
			
		||||
	this->makeRequest("j/workspaces", [this, canCreate](bool success, const QByteArray& resp) {
 | 
			
		||||
		this->requestingWorkspaces = false;
 | 
			
		||||
		if (!success) return;
 | 
			
		||||
 | 
			
		||||
		    qCDebug(logHyprlandIpc) << "parsing workspaces response";
 | 
			
		||||
		    auto json = QJsonDocument::fromJson(resp).array();
 | 
			
		||||
		qCDebug(logHyprlandIpc) << "parsing workspaces response";
 | 
			
		||||
		auto json = QJsonDocument::fromJson(resp).array();
 | 
			
		||||
 | 
			
		||||
		    const auto& mList = this->mWorkspaces.valueList();
 | 
			
		||||
		    auto names = QVector<QString>();
 | 
			
		||||
		const auto& mList = this->mWorkspaces.valueList();
 | 
			
		||||
		auto names = QVector<QString>();
 | 
			
		||||
 | 
			
		||||
		    for (auto entry: json) {
 | 
			
		||||
			    auto object = entry.toObject().toVariantMap();
 | 
			
		||||
			    auto name = object.value("name").toString();
 | 
			
		||||
		for (auto entry: json) {
 | 
			
		||||
			auto object = entry.toObject().toVariantMap();
 | 
			
		||||
			auto name = object.value("name").toString();
 | 
			
		||||
 | 
			
		||||
			    auto workspaceIter =
 | 
			
		||||
			        std::find_if(mList.begin(), mList.end(), [name](const HyprlandWorkspace* m) {
 | 
			
		||||
				        return m->name() == name;
 | 
			
		||||
			        });
 | 
			
		||||
			auto workspaceIter =
 | 
			
		||||
			    std::find_if(mList.begin(), mList.end(), [name](const HyprlandWorkspace* m) {
 | 
			
		||||
				    return m->name() == name;
 | 
			
		||||
			    });
 | 
			
		||||
 | 
			
		||||
			    auto* workspace = workspaceIter == mList.end() ? nullptr : *workspaceIter;
 | 
			
		||||
			    auto existed = workspace != nullptr;
 | 
			
		||||
			auto* workspace = workspaceIter == mList.end() ? nullptr : *workspaceIter;
 | 
			
		||||
			auto existed = workspace != nullptr;
 | 
			
		||||
 | 
			
		||||
			    if (workspace == nullptr) {
 | 
			
		||||
				    if (!canCreate) continue;
 | 
			
		||||
				    workspace = new HyprlandWorkspace(this);
 | 
			
		||||
			    }
 | 
			
		||||
			if (workspace == nullptr) {
 | 
			
		||||
				if (!canCreate) continue;
 | 
			
		||||
				workspace = new HyprlandWorkspace(this);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			    workspace->updateFromObject(object);
 | 
			
		||||
			workspace->updateFromObject(object);
 | 
			
		||||
 | 
			
		||||
			    if (!existed) {
 | 
			
		||||
				    this->mWorkspaces.insertObject(workspace);
 | 
			
		||||
			    }
 | 
			
		||||
			if (!existed) {
 | 
			
		||||
				this->mWorkspaces.insertObject(workspace);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			    names.push_back(name);
 | 
			
		||||
		    }
 | 
			
		||||
			names.push_back(name);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		    auto removedWorkspaces = QVector<HyprlandWorkspace*>();
 | 
			
		||||
		auto removedWorkspaces = QVector<HyprlandWorkspace*>();
 | 
			
		||||
 | 
			
		||||
		    for (auto* workspace: mList) {
 | 
			
		||||
			    if (!names.contains(workspace->name())) {
 | 
			
		||||
				    removedWorkspaces.push_back(workspace);
 | 
			
		||||
			    }
 | 
			
		||||
		    }
 | 
			
		||||
		for (auto* workspace: mList) {
 | 
			
		||||
			if (!names.contains(workspace->name())) {
 | 
			
		||||
				removedWorkspaces.push_back(workspace);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		    for (auto* workspace: removedWorkspaces) {
 | 
			
		||||
			    this->mWorkspaces.removeObject(workspace);
 | 
			
		||||
			    delete workspace;
 | 
			
		||||
		    }
 | 
			
		||||
	    }
 | 
			
		||||
	);
 | 
			
		||||
		for (auto* workspace: removedWorkspaces) {
 | 
			
		||||
			this->mWorkspaces.removeObject(workspace);
 | 
			
		||||
			delete workspace;
 | 
			
		||||
		}
 | 
			
		||||
	});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
HyprlandMonitor*
 | 
			
		||||
| 
						 | 
				
			
			@ -489,61 +486,57 @@ void HyprlandIpc::refreshMonitors(bool canCreate) {
 | 
			
		|||
	if (this->requestingMonitors) return;
 | 
			
		||||
	this->requestingMonitors = true;
 | 
			
		||||
 | 
			
		||||
	this->makeRequest(
 | 
			
		||||
	    "j/monitors",
 | 
			
		||||
	    [this, canCreate](bool success, const QByteArray& resp) {
 | 
			
		||||
		    this->requestingMonitors = false;
 | 
			
		||||
		    if (!success) return;
 | 
			
		||||
	this->makeRequest("j/monitors", [this, canCreate](bool success, const QByteArray& resp) {
 | 
			
		||||
		this->requestingMonitors = false;
 | 
			
		||||
		if (!success) return;
 | 
			
		||||
 | 
			
		||||
		    this->monitorsRequested = true;
 | 
			
		||||
		this->monitorsRequested = true;
 | 
			
		||||
 | 
			
		||||
		    qCDebug(logHyprlandIpc) << "parsing monitors response";
 | 
			
		||||
		    auto json = QJsonDocument::fromJson(resp).array();
 | 
			
		||||
		qCDebug(logHyprlandIpc) << "parsing monitors response";
 | 
			
		||||
		auto json = QJsonDocument::fromJson(resp).array();
 | 
			
		||||
 | 
			
		||||
		    const auto& mList = this->mMonitors.valueList();
 | 
			
		||||
		    auto names = QVector<QString>();
 | 
			
		||||
		const auto& mList = this->mMonitors.valueList();
 | 
			
		||||
		auto names = QVector<QString>();
 | 
			
		||||
 | 
			
		||||
		    for (auto entry: json) {
 | 
			
		||||
			    auto object = entry.toObject().toVariantMap();
 | 
			
		||||
			    auto name = object.value("name").toString();
 | 
			
		||||
		for (auto entry: json) {
 | 
			
		||||
			auto object = entry.toObject().toVariantMap();
 | 
			
		||||
			auto name = object.value("name").toString();
 | 
			
		||||
 | 
			
		||||
			    auto monitorIter =
 | 
			
		||||
			        std::find_if(mList.begin(), mList.end(), [name](const HyprlandMonitor* m) {
 | 
			
		||||
				        return m->name() == name;
 | 
			
		||||
			        });
 | 
			
		||||
			auto monitorIter = std::find_if(mList.begin(), mList.end(), [name](const HyprlandMonitor* m) {
 | 
			
		||||
				return m->name() == name;
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			    auto* monitor = monitorIter == mList.end() ? nullptr : *monitorIter;
 | 
			
		||||
			    auto existed = monitor != nullptr;
 | 
			
		||||
			auto* monitor = monitorIter == mList.end() ? nullptr : *monitorIter;
 | 
			
		||||
			auto existed = monitor != nullptr;
 | 
			
		||||
 | 
			
		||||
			    if (monitor == nullptr) {
 | 
			
		||||
				    if (!canCreate) continue;
 | 
			
		||||
				    monitor = new HyprlandMonitor(this);
 | 
			
		||||
			    }
 | 
			
		||||
			if (monitor == nullptr) {
 | 
			
		||||
				if (!canCreate) continue;
 | 
			
		||||
				monitor = new HyprlandMonitor(this);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			    monitor->updateFromObject(object);
 | 
			
		||||
			monitor->updateFromObject(object);
 | 
			
		||||
 | 
			
		||||
			    if (!existed) {
 | 
			
		||||
				    this->mMonitors.insertObject(monitor);
 | 
			
		||||
			    }
 | 
			
		||||
			if (!existed) {
 | 
			
		||||
				this->mMonitors.insertObject(monitor);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			    names.push_back(name);
 | 
			
		||||
		    }
 | 
			
		||||
			names.push_back(name);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		    auto removedMonitors = QVector<HyprlandMonitor*>();
 | 
			
		||||
		auto removedMonitors = QVector<HyprlandMonitor*>();
 | 
			
		||||
 | 
			
		||||
		    for (auto* monitor: mList) {
 | 
			
		||||
			    if (!names.contains(monitor->name())) {
 | 
			
		||||
				    removedMonitors.push_back(monitor);
 | 
			
		||||
			    }
 | 
			
		||||
		    }
 | 
			
		||||
		for (auto* monitor: mList) {
 | 
			
		||||
			if (!names.contains(monitor->name())) {
 | 
			
		||||
				removedMonitors.push_back(monitor);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		    for (auto* monitor: removedMonitors) {
 | 
			
		||||
			    this->mMonitors.removeObject(monitor);
 | 
			
		||||
			    // see comment in onEvent
 | 
			
		||||
			    monitor->deleteLater();
 | 
			
		||||
		    }
 | 
			
		||||
	    }
 | 
			
		||||
	);
 | 
			
		||||
		for (auto* monitor: removedMonitors) {
 | 
			
		||||
			this->mMonitors.removeObject(monitor);
 | 
			
		||||
			// see comment in onEvent
 | 
			
		||||
			monitor->deleteLater();
 | 
			
		||||
		}
 | 
			
		||||
	});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace qs::hyprland::ipc
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue