![]() |
LeechCraft
0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
|
Interface for plugins that can recover tabs after restart. More...
#include "ihaverecoverabletabs.h"
Public Member Functions | |
virtual | ~IHaveRecoverableTabs () |
virtual void | RecoverTabs (const QList< LC::TabRecoverInfo > &infos)=0 |
Recovers the tabs according to the infos list. More... | |
virtual bool | HasSimilarTab (const QByteArray &data, const QList< QByteArray > &existing) const =0 |
Checks if there is a tab similar to the one defined by data. More... | |
Static Protected Member Functions | |
template<typename T > | |
static bool | StandardSimilarImpl (const QByteArray &data, const QList< QByteArray > &existing, const T &f) |
A standard implementation of the HasSimilarTab() function. More... | |
Interface for plugins that can recover tabs after restart.
This interface should be implemented by plugins for which it makes sense to recover tabs in some way: either after restart or un-close, for instance. For example, a web browser or a media player may wish to implement this interface.
First, tabs which wish to be saved between runs should implement the IRecoverableTab interface. If a session manager plugin (like TabSessManager) is installed, then it will query the tabs regarding their state via that interface and save that information.
After restarting LeechCraft (or when requesting reopening a recently closed tab), the RecoverTabs() method will be called by a tab session manager plugin to recover the needed tabs.
Definition at line 128 of file ihaverecoverabletabs.h.
|
inlinevirtual |
Definition at line 131 of file ihaverecoverabletabs.h.
|
pure virtual |
Checks if there is a tab similar to the one defined by data.
The data is guaranteed to be obtained from a tab belonging to the plugin being queried. That is, there is no need to perform any checks for the tab to be belonging to the plugin.
A standard implementation is provided for the convenience in the form of the StandardSimilarImpl() function.
[in] | data | The tab recover data previously obtained from IRecoverableTab::GetTabRecoverData() |
[in] | existing | The list of existing tabs, provided for convenience. |
|
pure virtual |
Recovers the tabs according to the infos list.
This method should recover the tabs according to the information contained in the infos list. That is, for each tab recover info in that list it should create the tab, recover the tab state according to LC::TabRecoverInfo::Data_, set the dynamic properties of the tab (via QObject::setProperty()) according to LC::TabRecoverInfo::DynProperties_ list, and only then emit the IHaveTabs::addNewTab() signal.
|
inlinestaticprotected |
A standard implementation of the HasSimilarTab() function.
This function is suitable for calling from HasSimilarTab() given an additional functor f, which should return some equality comparable type. If f(data)
is equal to f(e)
for some e in existing, then this function returns true.
T | The type of the functor f. |
[in] | data | The tab recover data previously obtained from IRecoverableTab::GetTabRecoverData() |
[in] | existing | The list of existing tabs, provided for convenience. |
[in] | f | A functor returning some equality comparable type. |
Definition at line 189 of file ihaverecoverabletabs.h.
References LC::Util::oral::sph::f.