Quassel IRC  Pre-Release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
QtUiStyle Class Reference

#include </tmp/quassel/src/qtui/qtuistyle.h>

Inheritance diagram for QtUiStyle:
Collaboration diagram for QtUiStyle:

Public Types

enum  FormatType {
  Base = 0x00000000, Invalid = 0xffffffff, PlainMsg = 0x00000001, NoticeMsg = 0x00000002,
  ActionMsg = 0x00000003, NickMsg = 0x00000004, ModeMsg = 0x00000005, JoinMsg = 0x00000006,
  PartMsg = 0x00000007, QuitMsg = 0x00000008, KickMsg = 0x00000009, KillMsg = 0x0000000a,
  ServerMsg = 0x0000000b, InfoMsg = 0x0000000c, ErrorMsg = 0x0000000d, DayChangeMsg = 0x0000000e,
  TopicMsg = 0x0000000f, NetsplitJoinMsg = 0x00000010, NetsplitQuitMsg = 0x00000020, InviteMsg = 0x00000030,
  Bold = 0x00000100, Italic = 0x00000200, Underline = 0x00000400, Reverse = 0x00000800,
  Timestamp = 0x00001000, Sender = 0x00002000, Contents = 0x00004000, Nick = 0x00008000,
  Hostmask = 0x00010000, ChannelName = 0x00020000, ModeFlags = 0x00040000, Url = 0x00080000
}
 This enumerates the possible formats a text element may have. */. More...
enum  MessageLabel { OwnMsg = 0x00000001, Highlight = 0x00000002, Selected = 0x00000004 }
enum  ItemFormatType {
  BufferViewItem = 0x00000001, NickViewItem = 0x00000002, NetworkItem = 0x00000010, ChannelBufferItem = 0x00000020,
  QueryBufferItem = 0x00000040, IrcUserItem = 0x00000080, UserCategoryItem = 0x00000100, InactiveBuffer = 0x00001000,
  ActiveBuffer = 0x00002000, UnreadBuffer = 0x00004000, HighlightedBuffer = 0x00008000, UserAway = 0x00010000
}
enum  ColorRole { MarkerLine, NumRoles }
typedef QList< QPair< quint16,
quint32 > > 
FormatList

Public Slots

void generateSettingsQss () const
void reload ()

Signals

void changed ()

Public Member Functions

 QtUiStyle (QObject *parent=0)
virtual ~QtUiStyle ()
virtual qreal firstColumnSeparator () const
virtual qreal secondColumnSeparator () const
QTextCharFormat format (quint32 formatType, quint32 messageLabel) const
QFontMetricsF * fontMetrics (quint32 formatType, quint32 messageLabel) const
QList< QTextLayout::FormatRange > toTextLayoutList (const FormatList &, int textLength, quint32 messageLabel) const
const QBrush & brush (ColorRole role) const
void setBrush (ColorRole role, const QBrush &brush)
QVariant bufferViewItemData (const QModelIndex &networkModelIndex, int role) const
QVariant nickViewItemData (const QModelIndex &networkModelIndex, int role) const

Static Public Member Functions

static FormatType formatType (Message::Type msgType)
static StyledString styleString (const QString &string, quint32 baseFormat=Base)
static QString mircToInternal (const QString &)
static QString timestampFormatString ()

Protected Member Functions

QTextCharFormat format (quint64 key) const
void loadStyleSheet ()
QString loadStyleSheet (const QString &name, bool shouldExist=false)
QTextCharFormat cachedFormat (quint32 formatType, quint32 messageLabel) const
void setCachedFormat (const QTextCharFormat &format, quint32 formatType, quint32 messageLabel) const
void mergeFormat (QTextCharFormat &format, quint32 formatType, quint64 messageLabel) const
void mergeSubElementFormat (QTextCharFormat &format, quint32 formatType, quint64 messageLabel) const
QVariant itemData (int role, const QTextCharFormat &format) const

Static Protected Member Functions

static FormatType formatType (const QString &code)
static QString formatCode (FormatType)
static void setTimestampFormatString (const QString &format)

Private Slots

void updateTimestampFormatString ()

Private Member Functions

QString fontDescription (const QFont &font) const
QString color (const QString &key, UiSettings &settings) const
QString msgTypeQss (const QString &msgType, const QString &key, UiSettings &settings) const
QString senderQss (int i, UiSettings &settings) const
QString chatListItemQss (const QString &state, const QString &key, UiSettings &settings) const

Detailed Description

Definition at line 27 of file qtuistyle.h.

Member Typedef Documentation

typedef QList<QPair<quint16, quint32> > FormatList
inherited

Definition at line 46 of file uistyle.h.

Member Enumeration Documentation

enum FormatType
inherited

This enumerates the possible formats a text element may have. */.

These formats are ordered on increasing importance, in cases where a given property is specified by multiple active formats. : Do not change/add values here without also adapting the relevant methods in this class (in particular mergedFormat())! Also, we do rely on certain properties of these values in styleString() and friends!

Enumerator:
Base 
Invalid 
PlainMsg 
NoticeMsg 
ActionMsg 
NickMsg 
ModeMsg 
JoinMsg 
PartMsg 
QuitMsg 
KickMsg 
KillMsg 
ServerMsg 
InfoMsg 
ErrorMsg 
DayChangeMsg 
TopicMsg 
NetsplitJoinMsg 
NetsplitQuitMsg 
InviteMsg 
Bold 
Italic 
Underline 
Reverse 
Timestamp 
Sender 
Contents 
Nick 
Hostmask 
ChannelName 
ModeFlags 
Url 

Definition at line 55 of file uistyle.h.

enum MessageLabel
inherited
Enumerator:
OwnMsg 
Highlight 
Selected 

Definition at line 102 of file uistyle.h.

enum ItemFormatType
inherited
Enumerator:
BufferViewItem 
NickViewItem 
NetworkItem 
ChannelBufferItem 
QueryBufferItem 
IrcUserItem 
UserCategoryItem 
InactiveBuffer 
ActiveBuffer 
UnreadBuffer 
HighlightedBuffer 
UserAway 

Definition at line 108 of file uistyle.h.

enum ColorRole
inherited
Enumerator:
MarkerLine 
NumRoles 

Definition at line 125 of file uistyle.h.

Constructor & Destructor Documentation

QtUiStyle ( QObject *  parent = 0)

Definition at line 27 of file qtuistyle.cpp.

References Settings::notify(), and updateTimestampFormatString().

~QtUiStyle ( )
virtual

Definition at line 35 of file qtuistyle.cpp.

Member Function Documentation

virtual qreal firstColumnSeparator ( ) const
inlinevirtual

Definition at line 35 of file qtuistyle.h.

virtual qreal secondColumnSeparator ( ) const
inlinevirtual

Definition at line 36 of file qtuistyle.h.

void generateSettingsQss ( ) const
slot
void updateTimestampFormatString ( )
privateslot
QString fontDescription ( const QFont &  font) const
private

Definition at line 143 of file qtuistyle.cpp.

Referenced by generateSettingsQss().

QString color ( const QString &  key,
UiSettings settings 
) const
private

Definition at line 137 of file qtuistyle.cpp.

References UiSettings::value().

Referenced by chatListItemQss(), generateSettingsQss(), msgTypeQss(), and senderQss().

QString msgTypeQss ( const QString &  msgType,
const QString &  key,
UiSettings settings 
) const
private

Definition at line 157 of file qtuistyle.cpp.

References color().

Referenced by generateSettingsQss().

QString senderQss ( int  i,
UiSettings settings 
) const
private

Definition at line 163 of file qtuistyle.cpp.

References color().

Referenced by generateSettingsQss().

QString chatListItemQss ( const QString &  state,
const QString &  key,
UiSettings settings 
) const
private

Definition at line 172 of file qtuistyle.cpp.

References color().

Referenced by generateSettingsQss().

UiStyle::FormatType formatType ( const QString &  code)
staticprotectedinherited

Definition at line 474 of file uistyle.cpp.

References UiStyle::_formatCodes, and UiStyle::Invalid.

UiStyle::StyledString styleString ( const QString &  string,
quint32  baseFormat = Base 
)
staticinherited
QString mircToInternal ( const QString &  mirc_)
staticinherited

Definition at line 580 of file uistyle.cpp.

Referenced by StyledLabel::setText(), and UiStyle::StyledMessage::style().

static QString timestampFormatString ( )
inlinestaticinherited

Definition at line 140 of file uistyle.h.

References UiStyle::_timestampFormatString.

Referenced by UiStyle::StyledMessage::decoratedTimestamp().

QTextCharFormat format ( quint64  key) const
protectedinherited

Definition at line 328 of file uistyle.cpp.

References UiStyle::_formats.

QFontMetricsF * fontMetrics ( quint32  formatType,
quint32  messageLabel 
) const
inherited
QList< QTextLayout::FormatRange > toTextLayoutList ( const FormatList formatList,
int  textLength,
quint32  messageLabel 
) const
inherited
const QBrush& brush ( ColorRole  role) const
inlineinherited

Definition at line 147 of file uistyle.h.

References UiStyle::_uiStylePalette.

Referenced by MarkerLineItem::styleChanged().

void setBrush ( ColorRole  role,
const QBrush &  brush 
)
inlineinherited

Definition at line 148 of file uistyle.h.

References UiStyle::_uiStylePalette.

void reload ( )
slotinherited
void changed ( )
signalinherited
QString loadStyleSheet ( const QString &  name,
bool  shouldExist = false 
)
protectedinherited

Definition at line 143 of file uistyle.cpp.

QTextCharFormat cachedFormat ( quint32  formatType,
quint32  messageLabel 
) const
protectedinherited

Definition at line 334 of file uistyle.cpp.

References UiStyle::_formatCache.

Referenced by UiStyle::format().

void setCachedFormat ( const QTextCharFormat &  format,
quint32  formatType,
quint32  messageLabel 
) const
protectedinherited

Definition at line 340 of file uistyle.cpp.

References UiStyle::_formatCache, and UiStyle::format().

Referenced by UiStyle::format().

void mergeFormat ( QTextCharFormat &  format,
quint32  formatType,
quint64  messageLabel 
) const
protectedinherited

Definition at line 386 of file uistyle.cpp.

References UiStyle::_allowMircColors, UiStyle::mergeSubElementFormat(), and UiStyle::Url.

Referenced by UiStyle::format().

void mergeSubElementFormat ( QTextCharFormat &  format,
quint32  formatType,
quint64  messageLabel 
) const
protectedinherited

Definition at line 418 of file uistyle.cpp.

References UiStyle::format().

Referenced by UiStyle::mergeFormat().

QString formatCode ( FormatType  ftype)
staticprotectedinherited

Definition at line 481 of file uistyle.cpp.

References UiStyle::_formatCodes.

void setTimestampFormatString ( const QString &  format)
staticprotectedinherited
QVariant itemData ( int  role,
const QTextCharFormat &  format 
) const
protectedinherited

Definition at line 311 of file uistyle.cpp.

Referenced by UiStyle::bufferViewItemData(), and UiStyle::nickViewItemData().


The documentation for this class was generated from the following files: