LeechCraft  0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
IHaveTabs Class Referenceabstract

Interface for plugins that have one or more tabs. More...

#include "ihavetabs.h"

Public Member Functions

virtual ~IHaveTabs ()
 
virtual LC::TabClasses_t GetTabClasses () const =0
 Returns the list of tab classes provided by this plugin. More...
 
virtual void TabOpenRequested (const QByteArray &tabClass)=0
 Opens the new tab from the given tabClass. More...
 

Detailed Description

Interface for plugins that have one or more tabs.

Each plugin that may have tabs in LeechCraft should implement this interface.

Plugins implementing this interface may have one or more tabs of different semantics, like chat tabs and service discovery tabs in an IM or download tab and hub browse tab in a DirectConnect plugin.

Different tabs with different semantics are said to belong to different tab classes. Different tab classes may have different behavior, but tabs of the same tab class are considered to be semantically equivalent. For example, there may be only one opened tab with the list of active downloads at a time, but there may be many simultaneously opened tabs for hub browsing. Tab behavior is defined by the LC::TabFeature enum.

Different tab classes may have different priorities. The priorities system is used to try to guess the most-currently-wanted tab by the user. When user requests a new tab, but doesn't specify its type (for example, just hits Ctrl+T), priorities of two tab classes are compared: the priority of the class of the current tab and the highest priority among all the tabs. If current priority plus some delta is higher than maximum one, a new instance of current tab class is opened, otherwise the tab with the highest priority is opened. For example, if web browser tab has priority of 80, text editor — 70 and search plugin — 60, and delta is 15, then if current tab is web browser or search plugin, the new tab will be a web browser tab (since 60 + 15 < 80), but if the current tab is text editor's one, then the new tab will also be a text editor (70 + 15 > 80).

In future implementations user may be allowed to adjust the delta and priorities of different classes to his liking.

Note
You mustn't use tab-related signals before SecondInit() has been called on your plugin, but you may use them in SecondInit() or later.
See also
ITabWidget, LC::TabClassInfo

Definition at line 341 of file ihavetabs.h.

Constructor & Destructor Documentation

◆ ~IHaveTabs()

virtual IHaveTabs::~IHaveTabs ( )
inlinevirtual

Definition at line 344 of file ihavetabs.h.

Member Function Documentation

◆ GetTabClasses()

virtual LC::TabClasses_t IHaveTabs::GetTabClasses ( ) const
pure virtual

Returns the list of tab classes provided by this plugin.

This list must not change between different calls to this function.

Note
Actually, not all tab classes returned from this method have to result in a new tab being opened when called the TabOpenRequested() method. For example, the Azoth plugin returns a tab class for a fictional tab that, when passed to the TabOpenRequested() method, results in MUC join dialog appearing.
Returns
The list of tab classes this plugin provides.
See also
TabClassInfo, ITabWidget::GetTabClass(), TabOpenRequested().

◆ TabOpenRequested()

virtual void IHaveTabs::TabOpenRequested ( const QByteArray &  tabClass)
pure virtual

Opens the new tab from the given tabClass.

This method is called to notify the plugin that a tab of the given tabClass is requested by the user.

Note
Please note that the call to this method doesn't have to result in a new tab being opened. Refer to the note in GetTabClasses() documentation for more information.
Parameters
[in]tabClassThe class of the requested tab, from the returned from GetTabClasses() list.
See also
GetTabClasses()

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