X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fuisupport%2Fold-uistyle.h;fp=src%2Fuisupport%2Fold-uistyle.h;h=ab2d86de63587f2a379be290b971e13cff92e094;hb=e017aca90eb3444df68fb365a5d50b05881b1c5c;hp=0000000000000000000000000000000000000000;hpb=2f515f5ea173837eae501292c45af69793da6d60;p=quassel.git diff --git a/src/uisupport/old-uistyle.h b/src/uisupport/old-uistyle.h new file mode 100644 index 00000000..ab2d86de --- /dev/null +++ b/src/uisupport/old-uistyle.h @@ -0,0 +1,83 @@ +/*************************************************************************** + * Copyright (C) 2005-08 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 _OLD_UISTYLE_H_ +#define _OLD_UISTYLE_H_ + +#include +#include +#include + +#include "message.h" +#include "settings.h" + +class UiStyle { + + public: + UiStyle(const QString &settingsKey); + virtual ~UiStyle(); + + /** This enumerates the possible formats a text element may have. */ + enum FormatType { + None, Bold, Italic, Underline, Reverse, // Standard formats + PlainMsg, NoticeMsg, ServerMsg, ErrorMsg, JoinMsg, PartMsg, QuitMsg, KickMsg, // Internal message formats + RenameMsg, ModeMsg, ActionMsg, // ...cnt'd + Timestamp, Sender, Nick, Hostmask, ChannelName, ModeFlags, Url, // individual elements + FgCol00, FgCol01, FgCol02, FgCol03, FgCol04, FgCol05, FgCol06, FgCol07, // Color codes + FgCol08, FgCol09, FgCol10, FgCol11, FgCol12, FgCol13, FgCol14, FgCol15, + BgCol00, BgCol01, BgCol02, BgCol03, BgCol04, BgCol05, BgCol06, BgCol07, + BgCol08, BgCol09, BgCol10, BgCol11, BgCol12, BgCol13, BgCol14, BgCol15, + NumFormatTypes, Invalid // Do not add anything after this + }; + + struct UrlInfo { + int start, end; + QUrl url; + }; + + struct StyledText { + QString text; + QList formats; + QList urls; + }; + + StyledText styleString(const QString &); + + void setFormat(FormatType, QTextCharFormat, Settings::Mode mode/* = Settings::Custom*/); + QTextCharFormat format(FormatType, Settings::Mode mode = Settings::Custom) const; + + FormatType formatType(const QString &code) const; + QString formatCode(FormatType) const; + + protected: + + + private: + QTextCharFormat mergedFormat(QList); + + QVector _defaultFormats; + QVector _customFormats; + QHash _formatCodes; + + QString _settingsKey; + +}; + +#endif