LeechCraft  0.6.70-15082-g543737046d
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...
 
virtual void addNewTab (const QString &name, QWidget *tabContents)=0
 This signal is emitted by plugin to add a new tab. More...
 
virtual void removeTab (QWidget *tabContents)=0
 This signal is emitted by plugin when it wants to remove a tab. More...
 
virtual void changeTabName (QWidget *tabContents, const QString &name)=0
 This signal is emitted by plugin to change the name of the tab with the given tabContents. More...
 
virtual void changeTabIcon (QWidget *tabContents, const QIcon &icon)=0
 This signal is emitted by plugin to change the icon of the tab with the given tabContents. More...
 
virtual void statusBarChanged (QWidget *tabContents, const QString &text)=0
 This signal is emitted by plugin to change the status bar text for the tab with the given tabContents. More...
 
virtual void raiseTab (QWidget *tabContents)=0
 This signal is emitted by plugin to bring the tab with the given tabContents to the front. 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 296 of file ihavetabs.h.

Constructor & Destructor Documentation

◆ ~IHaveTabs()

virtual IHaveTabs::~IHaveTabs ( )
inlinevirtual

Definition at line 299 of file ihavetabs.h.

Member Function Documentation

◆ addNewTab()

virtual void IHaveTabs::addNewTab ( const QString &  name,
QWidget *  tabContents 
)
pure virtual

This signal is emitted by plugin to add a new tab.

tabContents must implement the ITabWidget interface to be successfully added to the tab widget.

For the tab to have an icon, emit the changeTabIcon() signal after emitting this one.

Note
This function is expected to be a signal in subclasses.
Parameters
[out]nameThe initial name of the tab.
[out]tabContentsThe widget to be added, must implement ITabWidget.
See also
removeTab(), changeTabName(), changeTabIcon(), statusBarChanged(), raiseTab().

◆ changeTabIcon()

virtual void IHaveTabs::changeTabIcon ( QWidget *  tabContents,
const QIcon &  icon 
)
pure virtual

This signal is emitted by plugin to change the icon of the tab with the given tabContents.

The tab is identified by tabContents, which should be the widget previously added by emitting the addNewTab() signal by this same plugin.

Null icon object may be used to clear the icon.

Note
This function is expected to be a signal in subclasses.
Parameters
[out]tabContentsThe widget with the contents of the tab which icon should be changed, added previously with addNewTab().
[out]iconThe new icon of the tab with tabContents.
See also
addNewTab().

◆ changeTabName()

virtual void IHaveTabs::changeTabName ( QWidget *  tabContents,
const QString &  name 
)
pure virtual

This signal is emitted by plugin to change the name of the tab with the given tabContents.

The name of the tab is shown in the tab bar of the tab widget. It also may be shown in other places and contexts, like in the LeechCraft title bar when the corresponding tab is active.

The tab is identified by tabContents, which should be the widget previously added by emitting the addNewTab() signal by this same plugin.

Note
This function is expected to be a signal in subclasses.
Parameters
[out]tabContentsThe widget with the contents of the tab which name should be changed, added previously with addNewTab().
[out]nameThe new name of the tab with tabContents.
See also
addNewTab().

◆ 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().

◆ raiseTab()

virtual void IHaveTabs::raiseTab ( QWidget *  tabContents)
pure virtual

This signal is emitted by plugin to bring the tab with the given tabContents to the front.

The tab is identified by tabContents, which should be the widget previously added by emitting the addNewTab() signal by this same plugin.

Note
This function is expected to be a signal in subclasses.
Parameters
[out]tabContentsThe widget with the contents of the tab that should be brought to the front.

◆ removeTab()

virtual void IHaveTabs::removeTab ( QWidget *  tabContents)
pure virtual

This signal is emitted by plugin when it wants to remove a tab.

tabContents must be a widget previously added by emitting the addNewTab() signal by this same plugin.

Note
This function is expected to be a signal in subclasses.
Parameters
[out]tabContentsThe widget to remove from the tab widget, must be previously added with addNewTab().
See also
addNewTab()

◆ statusBarChanged()

virtual void IHaveTabs::statusBarChanged ( QWidget *  tabContents,
const QString &  text 
)
pure virtual

This signal is emitted by plugin to change the status bar text for the tab with the given tabContents.

The text set by this signal would be shown when the corresponding tab is active. To clear the status bar, this signal should be emitted with empty text.

The tab is identified by tabContents, which should be the widget previously added by emitting the addNewTab() signal by this same plugin.

Note
This function is expected to be a signal in subclasses.
User may choose to hide the status bar, so important information should not be presented this way.
Parameters
[out]tabContentsThe widget with the contents of the tab which statusbar text should be changed, added previously with addNewTab().
[out]textThe new statusbar text of the tab with tabContents.
See also
addNewTab().

◆ 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: