LibrePCB Developers Documentation
Loading...
Searching...
No Matches
SystemInfo Class Referencefinal

This class provides some methods to get information from the operating system. More...

#include <systeminfo.h>

+ Collaboration diagram for SystemInfo:

Public Member Functions

 SystemInfo ()=delete
 

Static Public Member Functions

static const QString & getUsername () noexcept
 Get the name of the user which is logged in (like "homer")
 
static const QString & getFullUsername () noexcept
 Get the full name of the user which is logged in (like "Homer Simpson")
 
static const QString & getHostname () noexcept
 Get the hostname of the computer (like "homer-workstation")
 
static QString detectRuntime () noexcept
 Detect the environment in which LibrePCB runs.
 
static bool isProcessRunning (qint64 pid)
 Check whether a process with a given PID is running or not.
 
static QString getProcessNameByPid (qint64 pid)
 Get the process name of a given PID.
 

Detailed Description

This class provides some methods to get information from the operating system.

For example, this class is used to get the name of the user which is logged in and the hostname of the computer to create a lock file (see class librepcb::DirectoryLock).

Note
Only static methods are available. You cannot create objects of this class.

Constructor & Destructor Documentation

◆ SystemInfo()

SystemInfo ( )
delete

Member Function Documentation

◆ getUsername()

const QString & getUsername ( )
staticnoexcept

Get the name of the user which is logged in (like "homer")

Returns
The username (in case of an error, this string can be empty!)
+ Here is the caller graph for this function:

◆ getFullUsername()

const QString & getFullUsername ( )
staticnoexcept

Get the full name of the user which is logged in (like "Homer Simpson")

Returns
The full user name (can be empty)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHostname()

const QString & getHostname ( )
staticnoexcept

Get the hostname of the computer (like "homer-workstation")

Returns
The hostname (in case of an error, this string can be empty!)
+ Here is the caller graph for this function:

◆ detectRuntime()

QString detectRuntime ( )
staticnoexcept

Detect the environment in which LibrePCB runs.

Returns
Runtime name(s) like "Snap"or "Flatpak", or an empty string.
+ Here is the caller graph for this function:

◆ isProcessRunning()

bool isProcessRunning ( qint64  pid)
static

Check whether a process with a given PID is running or not.

Parameters
pidThe process ID to query
Returns
True if the process is running, fals if not
Exceptions
ExceptionIn case of an error.
+ Here is the caller graph for this function:

◆ getProcessNameByPid()

QString getProcessNameByPid ( qint64  pid)
static

Get the process name of a given PID.

Parameters
pidThe process ID (may be a running process or not)
Returns
The name of the given process ID, or an empty string if no process with the given PID exists.
Exceptions
ExceptionIn case of an error.
+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: