This class provides some methods to get information from the operating system.
More...
#include <systeminfo.h>
|
static const QString & | getUsername () noexcept |
| Get the name of the user which is logged in (like "homer") More...
|
|
static const QString & | getFullUsername () noexcept |
| Get the full name of the user which is logged in (like "Homer
Simpson") More...
|
|
static const QString & | getHostname () noexcept |
| Get the hostname of the computer (like "homer-workstation") More...
|
|
static QString | detectRuntime () noexcept |
| Detect the environment in which LibrePCB runs. More...
|
|
static bool | isProcessRunning (qint64 pid) |
| Check whether a process with a given PID is running or not. More...
|
|
static QString | getProcessNameByPid (qint64 pid) |
| Get the process name of a given PID. More...
|
|
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.
◆ SystemInfo()
◆ 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!)
◆ 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)
◆ 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!)
◆ detectRuntime()
QString detectRuntime |
( |
| ) |
|
|
staticnoexcept |
Detect the environment in which LibrePCB runs.
- Returns
- Runtime name(s) like "Snap"or "Flatpak", or an empty string.
◆ isProcessRunning()
bool isProcessRunning |
( |
qint64 |
pid | ) |
|
|
static |
Check whether a process with a given PID is running or not.
- Parameters
-
pid | The process ID to query |
- Returns
- True if the process is running, fals if not
- Exceptions
-
◆ getProcessNameByPid()
QString getProcessNameByPid |
( |
qint64 |
pid | ) |
|
|
static |
Get the process name of a given PID.
- Parameters
-
pid | The 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
-
The documentation for this class was generated from the following files: