mutterkey
KDE-first push-to-talk transcription tool for KDE Plasma
Loading...
Searching...
No Matches
daemoncontrolserver.h
Go to the documentation of this file.
1#pragma once
2
5#include "config.h"
6#include "service.h"
7
8#include <QObject>
9
10class QLocalServer;
11
20class DaemonControlServer final : public QObject
21{
22 Q_OBJECT
23
24public:
32 explicit DaemonControlServer(QString configPath,
33 AppConfig config,
34 const MutterkeyService *service,
35 QObject *parent = nullptr);
44 explicit DaemonControlServer(QString configPath,
45 AppConfig config,
46 const MutterkeyService *service,
47 QString socketName,
48 QObject *parent);
53
54 Q_DISABLE_COPY_MOVE(DaemonControlServer)
55
56
61 bool start(QString *errorMessage = nullptr);
62
66 void stop();
67
68private Q_SLOTS:
69 void onNewConnection();
70 void onSocketReadyRead();
71
72private:
73 [[nodiscard]] QByteArray handleRequest(const QByteArray &payload) const;
74 [[nodiscard]] DaemonStatusSnapshot buildStatusSnapshot() const;
75 [[nodiscard]] DaemonConfigSnapshot buildConfigSnapshot() const;
76
77 QString m_configPath;
78 AppConfig m_config;
79 const MutterkeyService *m_service = nullptr;
81 QString m_socketName;
82 QLocalServer *m_server = nullptr;
83};
Serves daemon status and config requests over a local socket.
DaemonControlServer(QString configPath, AppConfig config, const MutterkeyService *service, QString socketName, QObject *parent)
Creates the local control server for a running daemon on a custom socket name.
void stop()
Stops listening and removes the local socket endpoint.
~DaemonControlServer() override
Stops the local server and releases the socket name.
bool start(QString *errorMessage=nullptr)
Starts listening on the local daemon control socket.
DaemonControlServer(QString configPath, AppConfig config, const MutterkeyService *service, QObject *parent=nullptr)
Creates the local control server for a running daemon.
Coordinates the daemon-mode push-to-talk workflow.
Definition service.h:29
Runtime configuration types, defaults, and JSON loading entrypoints.
Local daemon control protocol types and JSON serialization helpers.
Typed daemon-control payloads used above the transport layer.
Background service that wires hotkey, audio capture, transcription, and clipboard delivery together.
Top-level runtime configuration snapshot.
Definition config.h:78
Daemon-owned config snapshot for tray and CLI clients.
Daemon-owned runtime status snapshot for tray and CLI clients.