LibrePCB Developers Documentation
Loading...
Searching...
No Matches
systeminfo.h
Go to the documentation of this file.
1/*
2 * LibrePCB - Professional EDA for everyone!
3 * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4 * https://librepcb.org/
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef LIBREPCB_CORE_SYSTEMINFO_H
21#define LIBREPCB_CORE_SYSTEMINFO_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include <QtCore>
27
28/*******************************************************************************
29 * Namespace / Forward Declarations
30 ******************************************************************************/
31namespace librepcb {
32
33/*******************************************************************************
34 * Class SystemInfo
35 ******************************************************************************/
36
48class SystemInfo final {
49 Q_DECLARE_TR_FUNCTIONS(SystemInfo)
50
51public:
52 // Constructors/Destructor
53 SystemInfo() = delete;
54
60 static const QString& getUsername() noexcept;
61
68 static const QString& getFullUsername() noexcept;
69
75 static const QString& getHostname() noexcept;
76
82 static QString detectRuntime() noexcept;
83
93 static bool isProcessRunning(qint64 pid);
94
105 static QString getProcessNameByPid(qint64 pid);
106};
107
108/*******************************************************************************
109 * End of File
110 ******************************************************************************/
111
112} // namespace librepcb
113
114#endif
This class provides some methods to get information from the operating system.
Definition systeminfo.h:48
static const QString & getUsername() noexcept
Get the name of the user which is logged in (like "homer")
Definition systeminfo.cpp:77
static QString getProcessNameByPid(qint64 pid)
Get the process name of a given PID.
Definition systeminfo.cpp:257
static const QString & getFullUsername() noexcept
Get the full name of the user which is logged in (like "Homer Simpson")
Definition systeminfo.cpp:99
static const QString & getHostname() noexcept
Get the hostname of the computer (like "homer-workstation")
Definition systeminfo.cpp:170
static bool isProcessRunning(qint64 pid)
Check whether a process with a given PID is running or not.
Definition systeminfo.cpp:209
static QString detectRuntime() noexcept
Detect the environment in which LibrePCB runs.
Definition systeminfo.cpp:185
Definition occmodel.cpp:76