MessageList::Core::Theme

#include <theme.h>

Inheritance diagram for MessageList::Core::Theme:

Classes

class  Column
 
class  ContentItem
 
class  Row
 

Public Types

enum  GroupHeaderBackgroundMode { Transparent, AutoColor, CustomColor }
 
enum  GroupHeaderBackgroundStyle {
  PlainRect, PlainJoinedRect, RoundedRect, RoundedJoinedRect,
  GradientRect, GradientJoinedRect, StyledRect, StyledJoinedRect
}
 
enum  ThemeIcon {
  IconNew, IconUnread, IconRead, IconDeleted,
  IconReplied, IconRepliedAndForwarded, IconQueued, IconActionItem,
  IconSent, IconForwarded, IconImportant, IconWatched,
  IconIgnored, IconSpam, IconHam, IconFullySigned,
  IconPartiallySigned, IconUndefinedSigned, IconNotSigned, IconFullyEncrypted,
  IconPartiallyEncrypted, IconUndefinedEncrypted, IconNotEncrypted, IconAttachment,
  IconAnnotation, IconInvitation, IconShowMore, IconShowLess,
  IconVerticalLine, IconHorizontalSpacer, _IconCount
}
 
enum  ViewHeaderPolicy { ShowHeaderAlways, NeverShowHeader }
 

Public Member Functions

 Theme ()
 
 Theme (const QString &name, const QString &description, bool readOnly=false)
 
 Theme (const Theme &src)
 
 ~Theme ()
 
void addColumn (Column *column)
 
Columncolumn (int idx) const
 
const QList< Column * > & columns () const
 
void detach ()
 
const QColorgroupHeaderBackgroundColor () const
 
GroupHeaderBackgroundMode groupHeaderBackgroundMode () const
 
GroupHeaderBackgroundStyle groupHeaderBackgroundStyle () const
 
int iconSize () const
 
void insertColumn (int idx, Column *column)
 
void moveColumn (int idx, int newPosition)
 
const QPixmappixmap (ThemeIcon icon) const
 
void removeAllColumns ()
 
void removeColumn (Column *col)
 
void resetColumnSizes ()
 
void resetColumnState ()
 
void setGroupHeaderBackgroundColor (const QColor &clr)
 
void setGroupHeaderBackgroundMode (GroupHeaderBackgroundMode bm)
 
void setGroupHeaderBackgroundStyle (GroupHeaderBackgroundStyle groupHeaderBackgroundStyle)
 
void setIconSize (int iconSize)
 
void setViewHeaderPolicy (ViewHeaderPolicy vhp)
 
ViewHeaderPolicy viewHeaderPolicy () const
 
- Public Member Functions inherited from MessageList::Core::OptionSet
 OptionSet (const OptionSet &src)
 
 OptionSet (const QString &name, const QString &description, bool readOnly=false)
 
const QStringdescription () const
 
void generateUniqueId ()
 
const QStringid () const
 
bool loadFromString (const QString &data)
 
const QStringname () const
 
bool readOnly () const
 
QString saveToString () const
 
void setDescription (const QString &description)
 
void setName (const QString &name)
 
void setReadOnly (bool b)
 

Static Public Member Functions

static bool compareName (Theme *theme1, Theme *theme2)
 
static QVector< QPair< QString, int > > enumerateGroupHeaderBackgroundStyles ()
 
static QVector< QPair< QString, int > > enumerateViewHeaderPolicyOptions ()
 

Protected Member Functions

void clearPixmapCache () const
 
bool load (QDataStream &stream) override
 
void populatePixmapCache () const
 
void save (QDataStream &stream) const override
 

Additional Inherited Members

- Protected Attributes inherited from MessageList::Core::OptionSet
QString mDescription
 
QString mId
 
QString mName
 
bool mReadOnly
 

Detailed Description

The Theme class defines the visual appearance of the MessageList.

The core structure of the theme is made up of Column objects which are mapped to View (QTreeView) columns. Each theme must provide at least one column.

Each column contains a set of Row objects dedicated to message items and a set of Row objects dedicated to group header items. There must be at least one message row and one group header row in each column. Rows are visually ordered from top to bottom.

Each Row contains a set of left aligned and a set of right aligned ContentItem objects. The right aligned items are painted from right to left while the left aligned ones are painted from left to right. In Right-To-Left mode the ThemeDelegate follows the exact opposite convention.

Each ContentItem object specifies a visual element to be displayed in a View row. The visual elements may be pieces of text (Subject, Date) or icons.

The Theme is designed to strictly interoperate with the ThemeDelegate class which takes care of rendering the contents when attached to an QAbstractItemView.

Definition at line 47 of file theme.h.

Member Enumeration Documentation

Which color do we use to paint group header background ?

Enumerator
Transparent 

No background at all: use style default.

AutoColor 

Automatically determine the color (somewhere in the middle between background and text)

CustomColor 

Use a custom color.

Definition at line 795 of file theme.h.

How do we paint group header background ?

Enumerator
PlainRect 

One plain rect per column.

PlainJoinedRect 

One big plain rect for all the columns.

RoundedRect 

One rounded rect per column.

RoundedJoinedRect 

One big rounded rect for all the columns.

GradientRect 

One rounded gradient filled rect per column.

GradientJoinedRect 

One big rounded gradient rect for all the columns.

StyledRect 

One styled rect per column.

StyledJoinedRect 

One big styled rect per column.

Definition at line 804 of file theme.h.

How do we manage the QHeaderView attached to our View ?

Definition at line 818 of file theme.h.

Constructor & Destructor Documentation

Theme::Theme ( )
explicit

Creates a totally uninitialized theme object.

Definition at line 920 of file theme.cpp.

Theme::Theme ( const QString name,
const QString description,
bool  readOnly = false 
)
explicit

Creates a theme object with the specified name and description.

Definition at line 929 of file theme.cpp.

Theme::Theme ( const Theme src)
explicit

Creates an exact copy of the theme sharing the same runtime data.

If you need an exact clone please use detach() and generateUniqueId() just after creation.

Definition at line 938 of file theme.cpp.

Theme::~Theme ( )

Destroys this theme object.

Definition at line 951 of file theme.cpp.

Member Function Documentation

void Theme::addColumn ( Theme::Column column)

Appends a column to this theme.

Definition at line 996 of file theme.cpp.

Theme::Column * Theme::column ( int  idx) const

Returns a pointer to the column at the specified index or 0 if there is no such column.

Definition at line 984 of file theme.cpp.

const QList< Theme::Column * > & Theme::columns ( ) const

Returns the list of columns available in this theme.

Definition at line 979 of file theme.cpp.

void Theme::detach ( )

Detaches this object from the shared runtime data for columns.

Definition at line 957 of file theme.cpp.

QVector< QPair< QString, int > > Theme::enumerateGroupHeaderBackgroundStyles ( )
static

Enumerates the available group header background styles.

The returned descriptors are pairs in that the first item is the localized description of the option value and the second item is the integer option value itself.

Definition at line 1066 of file theme.cpp.

QVector< QPair< QString, int > > Theme::enumerateViewHeaderPolicyOptions ( )
static

Enumerates the available view header policy options.

The returned descriptors are pairs in that the first item is the localized description of the option value and the second item is the integer option value itself.

Definition at line 1056 of file theme.cpp.

const QColor & Theme::groupHeaderBackgroundColor ( ) const

Returns the group header background color for this theme.

This color is used only if groupHeaderBackgroundMode() is set to CustomColor.

Definition at line 1036 of file theme.cpp.

Theme::GroupHeaderBackgroundMode Theme::groupHeaderBackgroundMode ( ) const

Returns the group header background mode for this theme.

Definition at line 1015 of file theme.cpp.

Theme::GroupHeaderBackgroundStyle Theme::groupHeaderBackgroundStyle ( ) const

Returns the group header background style for this theme.

The group header background style makes sense only if groupHeaderBackgroundMode() is set to something different than Transparent.

Definition at line 1046 of file theme.cpp.

int Theme::iconSize ( ) const

Returns the currently set icon size.

Definition at line 1104 of file theme.cpp.

void Theme::insertColumn ( int  idx,
Column column 
)

Inserts a column to this theme at the specified position.

Definition at line 1001 of file theme.cpp.

bool Theme::load ( QDataStream stream)
overrideprotectedvirtual

Pure virtual reimplemented from OptionSet.

Implements MessageList::Core::OptionSet.

Definition at line 1121 of file theme.cpp.

void Theme::removeAllColumns ( )

Removes all columns from this theme.

Definition at line 989 of file theme.cpp.

void Theme::removeColumn ( Theme::Column col)

Removes the specified message row.

The row is NOT deleted.

Definition at line 1010 of file theme.cpp.

void Theme::resetColumnSizes ( )

Resets the column sizes to "default" (subset of resetColumnState() above).

Definition at line 972 of file theme.cpp.

void Theme::resetColumnState ( )

Resets the column state (visibility and width) to their default values (the "visible by default" ones).

Definition at line 964 of file theme.cpp.

void Theme::save ( QDataStream stream) const
overrideprotectedvirtual

Pure virtual reimplemented from OptionSet.

Implements MessageList::Core::OptionSet.

Definition at line 1215 of file theme.cpp.

void Theme::setGroupHeaderBackgroundColor ( const QColor clr)

Sets the group header background color for this theme.

This color is used only if groupHeaderBackgroundMode() is set to CustomColor.

Definition at line 1041 of file theme.cpp.

void Theme::setGroupHeaderBackgroundMode ( GroupHeaderBackgroundMode  bm)

Sets the group header background mode for this theme.

If you set it to CustomColor then please also setGroupHeaderBackgroundColor()

Definition at line 1028 of file theme.cpp.

void Theme::setGroupHeaderBackgroundStyle ( Theme::GroupHeaderBackgroundStyle  groupHeaderBackgroundStyle)

Sets the group header background style for this theme.

The group header background style makes sense only if groupHeaderBackgroundMode() is set to something different than Transparent.

Definition at line 1051 of file theme.cpp.

void Theme::setIconSize ( int  iconSize)

Sets the icon size for this theme.

Please note that the function will not let you set insane values. The allowable range is [8,64]

Definition at line 1109 of file theme.cpp.

void Theme::setViewHeaderPolicy ( Theme::ViewHeaderPolicy  vhp)

Sets the ViewHeaderPolicy for this theme.

Definition at line 1099 of file theme.cpp.

Theme::ViewHeaderPolicy Theme::viewHeaderPolicy ( ) const

Returns the currently set ViewHeaderPolicy.

Definition at line 1094 of file theme.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat Nov 28 2020 23:14:09 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.