SingleInstance.h header
#include <ew/app/SingleInstance.h>
Namespace ew::app
LaunchArguments struct
struct ew::app::LaunchArguments
The forwarding-relevant parts of a command line, extracted from arguments (which includes the program name at index 0, as QCoreApplication::arguments() does).
Members
QString ew::app::LaunchArguments::projectPath
The positional project path (a double-clicked .ewriter file or a folder path), or empty.
bool ew::app::LaunchArguments::newInstance = false
True when --new-instance was passed: skip forwarding and always open a standalone window (so several projects can be worked side by side).
LaunchMessage struct
struct ew::app::LaunchMessage
A launch request forwarded from a second process to the already-running instance: a project to open, or – when the path is empty – just a nudge to raise the existing window (a bare second launch). One request is one UTF-8 line on the wire.
Members
QString ew::app::LaunchMessage::projectPath
The absolute project path to open; empty means "just raise the running window".
bool operator==(const LaunchMessage &, const LaunchMessage &)=default
Two messages are equal when they carry the same path.
Functions
LaunchMessage ew::app::decodeLaunchMessage(const QByteArray &bytes)
Decodes wire bytes back to a launch message, reading only the first line and tolerating a trailing CR/LF – so a partial or line-buffered read that ends the line decodes correctly.
QByteArray ew::app::encodeLaunchMessage(const LaunchMessage &message)
Encodes message to its wire bytes: the project path as one newline-terminated UTF-8 line (a path never contains a newline, so the line is unambiguous).
LaunchArguments ew::app::parseLaunchArguments(const QStringList &arguments)
Parses arguments for the project path and the --new-instance flag. --capture and --lang each consume the following argument as their value; any other --flag is ignored as a valueless option; the first remaining positional argument is the project path.
QString ew::app::singleInstanceServerName(const QString &userName)
The name of the per-user single-instance IPC channel (a QLocalServer pipe name). Keyed by the current user so two accounts on one machine never collide, and reduced to the characters a local-socket name safely allows. The desktop app's first process listens on this name; a second launch connects to it to forward its request instead of opening another window.