6#include "phosphorconfig_export.h"
57 [[nodiscard]]
static std::optional<HostDescriptor>
parse(
const QJsonObject& json, QString* error);
83 std::optional<HostDescriptor>
host;
142 [[nodiscard]] std::optional<HostRecord>
record()
const;
149 [[nodiscard]]
bool writeRecord(
const QString& hostId,
const QString& configPath, qint64 pid)
const;
187 const std::optional<HostRecord>&
record, qint64 busOwnerPid,
bool writeRecord(const QString &hostId, const QString &configPath, qint64 pid) const
Record host hostId, keeping its settings in configPath, as this user's host of the API.
std::optional< HostRecord > record() const
The record, or nullopt when there is none.
HostDirectory(QString api)
api names the API, placement for the placement API.
static QStringList currentDesktops()
XDG_CURRENT_DESKTOP, split on :.
static HostResolution resolve(const QList< HostDescriptor > &descriptors, const std::optional< HostRecord > &record, qint64 busOwnerPid, const QStringList ¤tDesktops)
Choose a host.
QList< HostDescriptor > descriptors() const
Every valid descriptor in the phosphor-works/<api>-hosts/ directories of the XDG data dirs,...
QString recordPath() const
$XDG_STATE_HOME/phosphor-works/<api>-host.json.
Definition HostDirectory.h:19
One host of a settings API, as the static descriptor its package installs in <datadir>/phosphor-works...
Definition HostDirectory.h:33
QStringList desktops
XDG_CURRENT_DESKTOP entries the host serves, compared ignoring case.
Definition HostDirectory.h:52
QString busName
The bus name the host owns while it runs.
Definition HostDirectory.h:42
QString backend
The PhosphorConfig backend the file uses. Only json is known.
Definition HostDirectory.h:44
QString id
Matches [a-z0-9][a-z0-9-]*.
Definition HostDirectory.h:36
QString resolvedConfigPath() const
configPath with its leading variable expanded for this user.
QString name
A product name, shown untranslated where a user chooses between hosts.
Definition HostDirectory.h:38
static std::optional< HostDescriptor > parse(const QJsonObject &json, QString *error)
Parse json.
QString configPath
The file: $XDG_CONFIG_HOME, $XDG_DATA_HOME, $XDG_STATE_HOME or $HOME, then / and a path with no empty...
Definition HostDirectory.h:48
What the last host of an API to start wrote about itself, or the choice a user made between several h...
Definition HostDirectory.h:70
QString configPath
Definition HostDirectory.h:72
QString host
Definition HostDirectory.h:71
QDateTime written
Definition HostDirectory.h:74
qint64 pid
Definition HostDirectory.h:73
Which host's settings file a module edits, from HostDirectory::resolve().
Definition HostDirectory.h:79
std::optional< HostDescriptor > host
The host, or nullopt when none could be chosen: no record chose one and the session's desktops match ...
Definition HostDirectory.h:83
QList< HostDescriptor > candidates
Several descriptors match this session and nothing chose between them: ask the user,...
Definition HostDirectory.h:93
QString configPath
The file to edit.
Definition HostDirectory.h:88
bool running
Some process owns the API's bus name.
Definition HostDirectory.h:107