Deskflow
1.26.0.418
Keyboard and mouse sharing utility
Toggle main menu visibility
Loading...
Searching...
No Matches
LogLevel.h
Go to the documentation of this file.
1
/*
2
* Deskflow -- mouse and keyboard sharing utility
3
* SPDX-FileCopyrightText: (C) 2026 Deskflow Developers
4
* SPDX-FileCopyrightText: (C) 2012 - 2016 Synergy App Ltd
5
* SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman
6
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
7
*/
8
9
#pragma once
10
#include <QObject>
11
#include <QString>
12
13
class
LogLevel
:
private
QObject
14
{
15
Q_OBJECT
17
20
public
:
21
enum class
Level
22
{
23
Print = -1,
24
Fatal,
25
Error
,
26
Warning,
27
Info,
28
Debug,
29
Verbose
30
};
31
Q_ENUM(
Level
)
32
33
static QString
toOption
(const
LogLevel
::
Level
&
level
)
34
{
35
return
toOption
(
static_cast<
int
>
(
level
));
36
}
37
38
static
QString
toOption
(
const
int
&
level
)
39
{
40
if
(
level < 0 || level >
m_levelOptions.size())
41
return
""
;
42
return
m_levelOptions.at(
level
);
43
}
44
45
static
LogLevel::Level
fromOption
(
const
QString &
level
)
46
{
47
const
auto
index = m_levelOptions.indexOf(
level
, 0, Qt::CaseInsensitive);
48
if
(index < 0 || index >= m_levelOptions.count())
49
return
LogLevel::Level::Info
;
50
return
LogLevel::Level
(index);
51
}
52
53
static
QString
toString
(
const
LogLevel::Level
&
level
)
54
{
55
return
toString
(
static_cast<
int
>
(
level
));
56
}
57
58
static
QString
toString
(
const
int
&
level
)
59
{
60
if
(
level < 0 || level >
m_levelNames.size())
61
return
""
;
62
return
tr(m_levelNames.at(
level
).toUtf8());
63
}
64
65
static
QStringList
logLevelOptions
()
66
{
67
return
m_levelOptions;
68
}
69
70
static
QStringList
logLevelNames
()
71
{
72
return
m_levelNames;
73
}
74
75
private
:
76
// clang-format off
80
inline
static
const
QStringList m_levelOptions {
81
QStringLiteral(
"FATAL"
)
82
, QStringLiteral(
"ERROR"
)
83
, QStringLiteral(
"WARNING"
)
84
, QStringLiteral(
"INFO"
)
85
, QStringLiteral(
"DEBUG"
)
86
, QStringLiteral(
"VERBOSE"
)
87
};
88
92
inline
static
const
QStringList m_levelNames = {
93
QT_TR_NOOP(
"Fatal"
)
94
, QT_TR_NOOP(
"Error"
)
95
, QT_TR_NOOP(
"Warning"
)
96
, QT_TR_NOOP(
"Info"
)
97
, QT_TR_NOOP(
"Debug"
)
98
, QT_TR_NOOP(
"Verbose"
)
99
};
100
// clang-format on
101
};
level
static int level
Definition
ArchNetworkWinsock.cpp:32
LogLevel
Definition
LogLevel.h:14
LogLevel::toString
static QString toString(const LogLevel::Level &level)
Definition
LogLevel.h:53
LogLevel::toString
static QString toString(const int &level)
Definition
LogLevel.h:58
LogLevel::toOption
static QString toOption(const int &level)
Definition
LogLevel.h:38
LogLevel::logLevelOptions
static QStringList logLevelOptions()
Definition
LogLevel.h:65
LogLevel::toOption
static QString toOption(const LogLevel::Level &level)
Definition
LogLevel.h:33
LogLevel::logLevelNames
static QStringList logLevelNames()
Definition
LogLevel.h:70
LogLevel::Level
Level
Log levels.
Definition
LogLevel.h:22
LogLevel::Level::Info
@ Info
For informational messages.
Definition
LogLevel.h:27
LogLevel::fromOption
static LogLevel::Level fromOption(const QString &level)
Definition
LogLevel.h:45
TransferState::Error
@ Error
Reception failed with error.
Definition
ProtocolTypes.h:178
src
lib
common
LogLevel.h
Generated by
1.18.0