LeechCraft
0.6.70-18450-gabe19ee3b0
Modular cross-platform feature rich live environment.
Toggle main menu visibility
Loading...
Searching...
No Matches
ihaverecoverabletabs.h
Go to the documentation of this file.
1
/**********************************************************************
2
* LeechCraft - modular cross-platform feature rich internet client.
3
* Copyright (C) 2006-2014 Georg Rudoy
4
*
5
* Distributed under the Boost Software License, Version 1.0.
6
* (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7
**********************************************************************/
8
9
#ifndef INTERFACES_IHAVERECOVERABLETABS_H
10
#define INTERFACES_IHAVERECOVERABLETABS_H
11
#include <QList>
12
#include <QByteArray>
13
#include <QVariant>
14
15
class
QWidget;
16
class
QIcon;
17
34
class
Q_DECL_EXPORT
IRecoverableTab
35
{
36
public
:
37
virtual
~IRecoverableTab
() {}
38
45
virtual
QByteArray
GetTabRecoverData
()
const
= 0;
46
55
virtual
QString
GetTabRecoverName
()
const
= 0;
56
64
virtual
QIcon
GetTabRecoverIcon
()
const
= 0;
65
protected
:
74
virtual
void
tabRecoverDataChanged
() = 0;
75
};
76
77
namespace
LC
78
{
79
typedef
QList<QPair<QByteArray, QVariant>
>
DynPropertiesList_t
;
80
92
struct
TabRecoverInfo
93
{
99
QByteArray
Data_
;
100
106
DynPropertiesList_t
DynProperties_
;
107
};
108
}
109
128
class
Q_DECL_EXPORT
IHaveRecoverableTabs
129
{
130
public
:
131
virtual
~IHaveRecoverableTabs
() {}
132
147
virtual
void
RecoverTabs
(
const
QList<LC::TabRecoverInfo>
& infos) = 0;
148
166
virtual
bool
HasSimilarTab
(
const
QByteArray& data,
167
const
QList<QByteArray>
& existing)
const
= 0;
168
protected
:
188
template
<
typename
T>
189
static
bool
StandardSimilarImpl
(
const
QByteArray& data,
190
const
QList<QByteArray>
& existing,
const
T& f)
191
{
192
const
auto
& thisData = f (data);
193
return
std::any_of (existing.begin (), existing.end (),
194
[&thisData, &f] (
const
QByteArray& other) { return thisData == f (other); });
195
}
196
};
197
198
Q_DECLARE_INTERFACE (
IRecoverableTab
,
"org.Deviant.LeechCraft.IRecoverableTab/1.0"
)
199
Q_DECLARE_INTERFACE (
IHaveRecoverableTabs
,
"org.Deviant.LeechCraft.IHaveRecoverableTabs/1.0"
)
200
201
#endif
IHaveRecoverableTabs
Interface for plugins that can recover tabs after restart.
Definition
ihaverecoverabletabs.h:129
IHaveRecoverableTabs::HasSimilarTab
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.
IHaveRecoverableTabs::RecoverTabs
virtual void RecoverTabs(const QList< LC::TabRecoverInfo > &infos)=0
Recovers the tabs according to the infos list.
IHaveRecoverableTabs::~IHaveRecoverableTabs
virtual ~IHaveRecoverableTabs()
Definition
ihaverecoverabletabs.h:131
IHaveRecoverableTabs::StandardSimilarImpl
static bool StandardSimilarImpl(const QByteArray &data, const QList< QByteArray > &existing, const T &f)
A standard implementation of the HasSimilarTab() function.
Definition
ihaverecoverabletabs.h:189
IRecoverableTab
Interface for a single tab that may be recovered.
Definition
ihaverecoverabletabs.h:35
IRecoverableTab::GetTabRecoverData
virtual QByteArray GetTabRecoverData() const =0
Returns the serialized state of the tab.
IRecoverableTab::~IRecoverableTab
virtual ~IRecoverableTab()
Definition
ihaverecoverabletabs.h:37
IRecoverableTab::GetTabRecoverIcon
virtual QIcon GetTabRecoverIcon() const =0
Returns the icon of this tab.
IRecoverableTab::GetTabRecoverName
virtual QString GetTabRecoverName() const =0
Returns the user-readable name of the tab.
IRecoverableTab::tabRecoverDataChanged
virtual void tabRecoverDataChanged()=0
Notifies that tab state's changed.
QList
Definition
ianrulesstorage.h:14
LC
Definition
constants.h:15
LC::DynPropertiesList_t
QList< QPair< QByteArray, QVariant > > DynPropertiesList_t
Definition
ihaverecoverabletabs.h:79
LC::TabRecoverInfo
Keeps the tab state between runs.
Definition
ihaverecoverabletabs.h:93
LC::TabRecoverInfo::DynProperties_
DynPropertiesList_t DynProperties_
Dynamic properties list from other plugins.
Definition
ihaverecoverabletabs.h:106
LC::TabRecoverInfo::Data_
QByteArray Data_
The tab-specific restore data.
Definition
ihaverecoverabletabs.h:99
src
interfaces
ihaverecoverabletabs.h
Generated by
1.17.0