LeechCraft Azoth  0.6.70-15082-g543737046d
Modular multiprotocol IM plugin for LeechCraft
LC::Azoth::IChatStyleResourceSource Class Referenceabstract

Interface for chat style resource loaders and handlers. More...

#include "ichatstyleresourcesource.h"

+ Inheritance diagram for LC::Azoth::IChatStyleResourceSource:
+ Collaboration diagram for LC::Azoth::IChatStyleResourceSource:

Public Member Functions

 ~IChatStyleResourceSource () override=default
 
virtual QUrl GetBaseURL (const QString &style) const =0
 Returns the base URL for the given style. More...
 
virtual QString GetHTMLTemplate (const QString &style, const QString &variant, QObject *entry, QWebEnginePage *page) const =0
 Returns the base HTML template for the given style. More...
 
virtual bool AppendMessage (QWebEnginePage *page, QObject *message, const ChatMsgAppendInfo &info)=0
 Appends a new message to the chat view. More...
 
virtual void FrameFocused (QWebEnginePage *page)=0
 Notifies about a frame obtaining user input focus. More...
 
virtual QStringList GetVariantsForPack (const QString &style)=0
 Returns the list of variants for the style pack. More...
 
- Public Member Functions inherited from LC::Azoth::IResourceSource
virtual ~IResourceSource ()
 
virtual QAbstractItemModel * GetOptionsModel () const =0
 Returns the model with the options for resource. More...
 

Detailed Description

Interface for chat style resource loaders and handlers.

This interface should be implemented by resource sources that are willing to provide chat styles for Azoth.

The basic HTML template to be installed into the chat window whenever a new chat window is created is returned by GetHTMLTemplate. AppendMessage is used to append a message into a chat window with an HTML template already set. FrameFocused is called whenever user focuses on the given chat window.

Definition at line 54 of file ichatstyleresourcesource.h.

Constructor & Destructor Documentation

◆ ~IChatStyleResourceSource()

LC::Azoth::IChatStyleResourceSource::~IChatStyleResourceSource ( )
overridedefault

Member Function Documentation

◆ AppendMessage()

virtual bool LC::Azoth::IChatStyleResourceSource::AppendMessage ( QWebEnginePage *  page,
QObject *  message,
const ChatMsgAppendInfo info 
)
pure virtual

Appends a new message to the chat view.

This function is called whenever a new message should be appended to the chat view located in the given frame.

Parameters
[in]frameThe chat view frame.
[in]messageThe message to be appended.
[in]infoAdditional chat message info structure.
Returns
true on success, false otherwise.

◆ FrameFocused()

virtual void LC::Azoth::IChatStyleResourceSource::FrameFocused ( QWebEnginePage *  page)
pure virtual

Notifies about a frame obtaining user input focus.

This function is called whenever a given frame receives user input focus.

It may be used, for example, to visually separate already read messages from new ones since the user last focused on the given chat session.

Parameters
[in]frameThe frame that received focus.

◆ GetBaseURL()

virtual QUrl LC::Azoth::IChatStyleResourceSource::GetBaseURL ( const QString &  style) const
pure virtual

Returns the base URL for the given style.

The returned URL would be passed as base URL to the QWebView::setHtml() method.

Return a proper value if your theme may contain elements with relative URIs for them to be loaded properly. Though, if your theme is known to not have such elements, it's safe to return a default-constructed QUrl object.

Parameters
[in]styleThe style name for which to return the base URL.
Returns
The base URL (or default-constructed one).

◆ GetHTMLTemplate()

virtual QString LC::Azoth::IChatStyleResourceSource::GetHTMLTemplate ( const QString &  style,
const QString &  variant,
QObject *  entry,
QWebEnginePage *  page 
) const
pure virtual

Returns the base HTML template for the given style.

This function is called whenever a new chat window is being opened and its chat view is being initialized. The string returned by this function is then passed to the chat view (to the QWebView::setHtml() method, to be exact).

The style parameter indicates the exact style name for which the template should be returned. The style is the one from the model returned by IResourceSource::GetOptionsModel().

The entry parameter defines the entry for which the chat window is being created. Of course, the entry implements at least the ICLEntry interface.

Parameters
[in]styleThe style name for which to return the template.
[in]variantThe style variant for which to return the template, an element of the list returned by GetVariantsForPack().
[in]entryThe entry object for which the chat window is being set up.
[in]frameThe frame that's being set up.
Returns
The HTML template.
See also
GetVariantsForPack()

◆ GetVariantsForPack()

virtual QStringList LC::Azoth::IChatStyleResourceSource::GetVariantsForPack ( const QString &  style)
pure virtual

Returns the list of variants for the style pack.

Values from the returned list will be passed to the GetHTMLTemplate() function. If the style plugin does not support style variants, an empty list may be returned.

Returns
The list of variants for pack, or an empty list if not supported.
See also
GetHTMLTemplate()

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