File indexing completed on 2024-04-21 16:34:02
0001 /* 0002 This file is part of the Okteta Gui library, made within the KDE community. 0003 0004 SPDX-FileCopyrightText: 2003, 2008-2009 Friedrich W. H. Kossebau <kossebau@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 0009 #ifndef OKTETA_HELPER 0010 #define OKTETA_HELPER 0011 0012 // Okteta core 0013 #include <Okteta/Character> 0014 // KF 0015 #include <KColorScheme> 0016 // Qt 0017 #include <QColor> 0018 0019 // temporary solution until syntax highlighting is implemented 0020 static inline QColor colorForChar(const Okteta::Character byteChar) 0021 { 0022 return byteChar.isUndefined() ? Qt::yellow : 0023 byteChar.isPunct() ? Qt::red : 0024 byteChar.isPrint() ? Qt::black : 0025 (byteChar == QLatin1Char(0x0A) || byteChar == QLatin1Char(0x0D)) ? 0026 Qt::darkCyan : 0027 Qt::blue; 0028 } 0029 0030 static inline KColorScheme::ForegroundRole foregroundRoleForChar(const Okteta::Character byteChar) 0031 { 0032 return byteChar.isUndefined() ? KColorScheme::NegativeText : 0033 byteChar.isPunct() ? KColorScheme::InactiveText : 0034 byteChar.isPrint() ? KColorScheme::NormalText : 0035 (byteChar == QLatin1Char(0x0A) || byteChar == QLatin1Char(0x0D)) ? 0036 KColorScheme::VisitedText : 0037 KColorScheme::ActiveText; 0038 } 0039 0040 #endif