From 306cfc06ed38a2f86616c1f2fe64de45321f21a6 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sat, 13 Sep 2025 14:38:44 +1000 Subject: plugin: refactor into modules --- plugin/src/Caelestia/service.cpp | 70 ---------------------------------------- 1 file changed, 70 deletions(-) delete mode 100644 plugin/src/Caelestia/service.cpp (limited to 'plugin/src/Caelestia/service.cpp') diff --git a/plugin/src/Caelestia/service.cpp b/plugin/src/Caelestia/service.cpp deleted file mode 100644 index bc919c9..0000000 --- a/plugin/src/Caelestia/service.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include "service.hpp" - -#include -#include - -namespace caelestia { - -Service::Service(QObject* parent) - : QObject(parent) - , m_refCount(0) {} - -int Service::refCount() const { - QMutexLocker locker(&m_mutex); - return m_refCount; -} - -void Service::ref() { - bool needsStart = false; - - { - QMutexLocker locker(&m_mutex); - if (m_refCount == 0) { - needsStart = true; - } - m_refCount++; - } - emit refCountChanged(); - - if (needsStart) { - const QPointer self(this); - QMetaObject::invokeMethod( - this, - [self]() { - if (self) { - self->start(); - } - }, - Qt::QueuedConnection); - } -} - -void Service::unref() { - bool needsStop = false; - - { - QMutexLocker locker(&m_mutex); - if (m_refCount == 0) { - return; - } - m_refCount--; - if (m_refCount == 0) { - needsStop = true; - } - } - emit refCountChanged(); - - if (needsStop) { - const QPointer self(this); - QMetaObject::invokeMethod( - this, - [self]() { - if (self) { - self->stop(); - } - }, - Qt::QueuedConnection); - } -} - -} // namespace caelestia -- cgit v1.2.3-freya