Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
System
KSystemLog
Commits
602f4325
Commit
602f4325
authored
Mar 04, 2022
by
Laurent Montel
Browse files
Use KColorScheme color
parent
c18a3e8c
Pipeline
#145014
passed with stage
in 1 minute and 38 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/lib/CMakeLists.txt
View file @
602f4325
...
...
@@ -89,4 +89,5 @@ target_link_libraries(ksystemlog_lib
KF5::ItemViews
KF5::KIOCore
KF5::Completion
KF5::ConfigWidgets
)
src/lib/globals.cpp
View file @
602f4325
...
...
@@ -21,6 +21,8 @@
#include
"ksystemlog_debug.h"
#include
<KColorScheme>
Globals
&
Globals
::
instance
()
{
static
Globals
self
;
...
...
@@ -98,35 +100,42 @@ QString Globals::formatDate(Globals::DateFormat format, const QDateTime &dateTim
void
Globals
::
setupLogLevels
()
{
KColorScheme
scheme
(
QPalette
::
Active
,
KColorScheme
::
View
);
QColor
redColor
=
scheme
.
foreground
(
KColorScheme
::
NegativeText
).
color
();
QColor
inactiveText
=
scheme
.
foreground
(
KColorScheme
::
InactiveText
).
color
();
int
index
=
metaObject
()
->
indexOfEnumerator
(
"LogLevelIds"
);
d
->
mLogLevelsMetaEnum
=
metaObject
()
->
enumerator
(
index
);
d
->
mNoLogLevel
=
new
LogLevel
(
NONE_LOG_LEVEL_ID
,
i18n
(
"None"
),
QStringLiteral
(
"edit-none"
),
QColor
(
208
,
210
,
2
20
));
d
->
mNoLogLevel
=
new
LogLevel
(
NONE_LOG_LEVEL_ID
,
i18n
(
"None"
),
QStringLiteral
(
"edit-none"
),
inactiveText
.
darker
(
1
20
));
d
->
mLogLevels
[
NONE_LOG_LEVEL_ID
]
=
d
->
mNoLogLevel
;
d
->
mDebugLogLevel
=
new
LogLevel
(
DEBUG_LOG_LEVEL_ID
,
i18n
(
"Debug"
),
QStringLiteral
(
"debug-run"
),
QColor
(
156
,
157
,
165
)
);
d
->
mDebugLogLevel
=
new
LogLevel
(
DEBUG_LOG_LEVEL_ID
,
i18n
(
"Debug"
),
QStringLiteral
(
"debug-run"
),
inactiveText
);
d
->
mLogLevels
[
DEBUG_LOG_LEVEL_ID
]
=
d
->
mDebugLogLevel
;
d
->
mInformationLogLevel
=
new
LogLevel
(
INFORMATION_LOG_LEVEL_ID
,
i18n
(
"Information"
),
QStringLiteral
(
"dialog-information"
),
QColor
(
36
,
49
,
103
)
/*QColor(0, 0, 0)*/
);
d
->
mInformationLogLevel
=
new
LogLevel
(
INFORMATION_LOG_LEVEL_ID
,
i18n
(
"Information"
),
QStringLiteral
(
"dialog-information"
),
scheme
.
foreground
(
KColorScheme
::
ActiveText
).
color
()
/*QColor(0, 0, 0)*/
);
d
->
mLogLevels
[
INFORMATION_LOG_LEVEL_ID
]
=
d
->
mInformationLogLevel
;
d
->
mNoticeLogLevel
=
new
LogLevel
(
NOTICE_LOG_LEVEL_ID
,
i18n
(
"Notice"
),
QStringLiteral
(
"note"
),
QColor
(
36
,
138
,
22
));
d
->
mNoticeLogLevel
=
new
LogLevel
(
NOTICE_LOG_LEVEL_ID
,
i18n
(
"Notice"
),
QStringLiteral
(
"note"
),
scheme
.
foreground
(
KColorScheme
::
PositiveText
).
color
(
));
d
->
mLogLevels
[
NOTICE_LOG_LEVEL_ID
]
=
d
->
mNoticeLogLevel
;
d
->
mWarningLogLevel
=
new
LogLevel
(
WARNING_LOG_LEVEL_ID
,
i18n
(
"Warning"
),
QStringLiteral
(
"dialog-warning"
),
QColor
(
238
,
144
,
21
));
d
->
mWarningLogLevel
=
new
LogLevel
(
WARNING_LOG_LEVEL_ID
,
i18n
(
"Warning"
),
QStringLiteral
(
"dialog-warning"
),
scheme
.
foreground
(
KColorScheme
::
NeutralText
).
color
());
d
->
mLogLevels
[
WARNING_LOG_LEVEL_ID
]
=
d
->
mWarningLogLevel
;
d
->
mErrorLogLevel
=
new
LogLevel
(
ERROR_LOG_LEVEL_ID
,
i18n
(
"Error"
),
QStringLiteral
(
"dialog-error"
),
Q
Color
(
173
,
28
,
28
));
d
->
mErrorLogLevel
=
new
LogLevel
(
ERROR_LOG_LEVEL_ID
,
i18n
(
"Error"
),
QStringLiteral
(
"dialog-error"
),
red
Color
.
darker
(
200
));
d
->
mLogLevels
[
ERROR_LOG_LEVEL_ID
]
=
d
->
mErrorLogLevel
;
d
->
mCriticalLogLevel
=
new
LogLevel
(
CRITICAL_LOG_LEVEL_ID
,
i18n
(
"Critical"
),
QStringLiteral
(
"dialog-error"
),
Q
Color
(
214
,
26
,
26
));
d
->
mCriticalLogLevel
=
new
LogLevel
(
CRITICAL_LOG_LEVEL_ID
,
i18n
(
"Critical"
),
QStringLiteral
(
"dialog-error"
),
red
Color
.
darker
(
150
));
d
->
mLogLevels
[
CRITICAL_LOG_LEVEL_ID
]
=
d
->
mCriticalLogLevel
;
d
->
mAlertLogLevel
=
new
LogLevel
(
ALERT_LOG_LEVEL_ID
,
i18n
(
"Alert"
),
QStringLiteral
(
"preferences-desktop-notification-bell"
),
Q
Color
(
214
,
0
,
0
));
d
->
mAlertLogLevel
=
new
LogLevel
(
ALERT_LOG_LEVEL_ID
,
i18n
(
"Alert"
),
QStringLiteral
(
"preferences-desktop-notification-bell"
),
red
Color
.
darker
(
12
0
));
d
->
mLogLevels
[
ALERT_LOG_LEVEL_ID
]
=
d
->
mAlertLogLevel
;
d
->
mEmergencyLogLevel
=
new
LogLevel
(
EMERGENCY_LOG_LEVEL_ID
,
i18n
(
"Emergency"
),
QStringLiteral
(
"application-exit"
),
Q
Color
(
255
,
0
,
0
)
);
d
->
mEmergencyLogLevel
=
new
LogLevel
(
EMERGENCY_LOG_LEVEL_ID
,
i18n
(
"Emergency"
),
QStringLiteral
(
"application-exit"
),
red
Color
);
d
->
mLogLevels
[
EMERGENCY_LOG_LEVEL_ID
]
=
d
->
mEmergencyLogLevel
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment