LeechCraft
0.6.70-19424-g027e980fd1
Modular cross-platform feature rich live environment.
Toggle main menu visibility
Loading...
Searching...
No Matches
sessionprops.cpp
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
#include "
sessionprops.h
"
10
#include <QObject>
11
#include <QtDebug>
12
13
namespace
LC::Util
14
{
15
bool
IsSessionProp
(
const
QByteArray& name)
16
{
17
return
name.startsWith (
"SessionData/"
);
18
}
19
20
DynPropertiesList_t
GetSessionProps
(
const
QObject& tab)
21
{
22
DynPropertiesList_t
props;
23
for
(
const
auto
& name : tab.dynamicPropertyNames ())
24
if
(
IsSessionProp
(name))
25
props.append ({ name, tab.property (name.constData ()) });
26
return
props;
27
}
28
29
void
SetSessionProps
(QObject& tab,
const
DynPropertiesList_t
& props)
30
{
31
for
(
const
auto
& [name, value] : props)
32
if
(
IsSessionProp
(name))
33
tab.setProperty (name.constData (), value);
34
else
35
qWarning () <<
"skipping non-session property"
<< name <<
"for"
<< &tab;
36
}
37
}
LC::Util
Definition
icoreproxy.h:34
LC::Util::GetSessionProps
DynPropertiesList_t GetSessionProps(const QObject &tab)
Returns the dynamic properties of tab that a tab session keeps.
Definition
sessionprops.cpp:20
LC::Util::IsSessionProp
bool IsSessionProp(const QByteArray &name)
Checks whether a tab session keeps the dynamic property name.
Definition
sessionprops.cpp:15
LC::Util::SetSessionProps
void SetSessionProps(QObject &tab, const DynPropertiesList_t &props)
Sets the session properties among props as dynamic properties of tab.
Definition
sessionprops.cpp:29
LC::DynPropertiesList_t
QList< std::pair< QByteArray, QVariant > > DynPropertiesList_t
Definition
ihaverecoverabletabs.h:93
sessionprops.h
src
util
xpc
sessionprops.cpp
Generated by
1.18.0