X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fqssparser.h;h=8cb1db46bf4dc4141a5695ee461819182f3bf0ac;hp=b7bb38ededec628e3b98bb2f668d7281ec497618;hb=fcacaaf16551524c7ebb6114254d005274cc3d63;hpb=694f9bfbf7f1af19108461c7e00d133e55082bce diff --git a/src/uisupport/qssparser.h b/src/uisupport/qssparser.h index b7bb38ed..8cb1db46 100644 --- a/src/uisupport/qssparser.h +++ b/src/uisupport/qssparser.h @@ -1,25 +1,26 @@ /*************************************************************************** -* Copyright (C) 2005-09 by the Quassel Project * -* devel@quassel-irc.org * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) version 3. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU General Public License * -* along with this program; if not, write to the * -* Free Software Foundation, Inc., * -* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * -***************************************************************************/ - -#ifndef QSSPARSER_H_ -#define QSSPARSER_H_ + * Copyright (C) 2005-2018 by the Quassel Project * + * devel@quassel-irc.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) version 3. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#pragma once + +#include #include "uistyle.h" @@ -35,22 +36,25 @@ public: inline QPalette palette() const { return _palette; } inline QVector uiStylePalette() const { return _uiStylePalette; } inline const QHash &formats() const { return _formats; } - inline const QHash &listItemFormats() const { return _listItemFormats; } + inline const QHash &listItemFormats() const { return _listItemFormats; } protected: - typedef QList ColorTuple; + using ColorTuple = QList; void parseChatLineBlock(const QString &decl, const QString &contents); void parsePaletteBlock(const QString &decl, const QString &contents); void parseListItemBlock(const QString &decl, const QString &contents); - quint64 parseFormatType(const QString &decl); - quint32 parseItemFormatType(const QString &decl); + std::pair parseFormatType(const QString &decl); + UiStyle::ItemFormatType parseItemFormatType(const QString &decl); QTextCharFormat parseFormat(const QString &qss); + // Parse boolean properties + bool parseBoolean(const QString &str, bool *ok = nullptr) const; + // Parse color/brush-related properties - QBrush parseBrush(const QString &str, bool *ok = 0); + QBrush parseBrush(const QString &str, bool *ok = nullptr); QColor parseColor(const QString &str); ColorTuple parseColorTuple(const QString &str); QGradientStops parseGradientStops(const QString &str); @@ -69,9 +73,5 @@ private: QPalette _palette; QVector _uiStylePalette; QHash _formats; - QHash _listItemFormats; - int _maxSenderHash; + QHash _listItemFormats; }; - - -#endif