LeechCraft
0.6.70-18450-gabe19ee3b0
Modular cross-platform feature rich live environment.
Toggle main menu visibility
Loading...
Searching...
No Matches
unhidelistviewbase.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 "
unhidelistviewbase.h
"
10
#include <QQmlContext>
11
#include <QQuickItem>
12
#include <QtDebug>
13
#include <
util/qml/colorthemeproxy.h
>
14
#include <
util/qml/themeimageprovider.h
>
15
#include <
util/gui/unhoverdeletemixin.h
>
16
#include <
util/sys/paths.h
>
17
#include <
util/qml/unhidelistmodel.h
>
18
#include <
util/qml/util.h
>
19
20
namespace
LC::Util
21
{
22
UnhideListViewBase::UnhideListViewBase
(
const
ICoreProxy_ptr
& proxy,
23
const
std::function<
void
(
UnhideListModel
*)>& filler, QWidget *parent)
24
: QQuickWidget (parent)
25
,
Model_
(new
UnhideListModel
(this))
26
{
27
new
UnhoverDeleteMixin
(
this
);
28
29
if
(filler)
30
filler (
Model_
);
31
32
const
auto
& file =
GetSysPath
(
SysPath::QML
, QStringLiteral (
"common"
), QStringLiteral (
"UnhideListView.qml"
));
33
if
(file.isEmpty ())
34
{
35
qWarning () << Q_FUNC_INFO
36
<<
"file not found"
;
37
deleteLater ();
38
return
;
39
}
40
41
setWindowFlags (Qt::ToolTip);
42
Util::EnableTransparency
(*
this
);
43
44
for
(
const
auto
& cand :
GetPathCandidates
(
SysPath::QML
, {}))
45
engine ()->addImportPath (cand);
46
47
rootContext ()->setContextProperty (QStringLiteral (
"unhideListModel"
),
Model_
);
48
rootContext ()->setContextProperty (QStringLiteral (
"colorProxy"
),
49
new
Util::ColorThemeProxy
(proxy->
GetColorThemeManager
(),
this
));
50
engine ()->addImageProvider (QStringLiteral (
"ThemeIcons"
),
new
Util::ThemeImageProvider
(proxy));
51
setSource (QUrl::fromLocalFile (file));
52
53
connect (rootObject (),
54
SIGNAL (closeRequested ()),
55
this
,
56
SLOT (deleteLater ()));
57
connect (rootObject (),
58
SIGNAL (
itemUnhideRequested
(QString)),
59
this
,
60
SIGNAL (
itemUnhideRequested
(QString)));
61
}
62
63
void
UnhideListViewBase::SetItems
(
const
QList<QStandardItem*>
& items)
64
{
65
Model_
->invisibleRootItem ()->appendRows (items);
66
}
67
}
ICoreProxy::GetColorThemeManager
virtual IColorThemeManager * GetColorThemeManager() const =0
Returns the color theme manager.
LC::Util::ColorThemeProxy
Proxy for QML files to use colors from current color theme.
Definition
colorthemeproxy.h:106
LC::Util::ThemeImageProvider
Provides icons from the current theme by their FDO name.
Definition
themeimageprovider.h:57
LC::Util::UnhideListModel
A model to be used with UnhideListViewBase.
Definition
unhidelistmodel.h:27
LC::Util::UnhideListViewBase::UnhideListViewBase
UnhideListViewBase(const ICoreProxy_ptr &proxy, const std::function< void(UnhideListModel *)> &modelFiller, QWidget *parent=nullptr)
Initializes the view and fills it with the items.
Definition
unhidelistviewbase.cpp:22
LC::Util::UnhideListViewBase::itemUnhideRequested
void itemUnhideRequested(const QString &itemId)
Emitted when an item with the given itemId is activated.
LC::Util::UnhideListViewBase::Model_
UnhideListModel *const Model_
Definition
unhidelistviewbase.h:40
LC::Util::UnhideListViewBase::SetItems
void SetItems(const QList< QStandardItem * > &items)
Sets the items of the view model to items.
Definition
unhidelistviewbase.cpp:63
LC::Util::UnhoverDeleteMixin
Allows to hide a widget or popup after mouse leave.
Definition
unhoverdeletemixin.h:43
QList
Definition
ianrulesstorage.h:14
colorthemeproxy.h
ICoreProxy_ptr
std::shared_ptr< ICoreProxy > ICoreProxy_ptr
Definition
icoreproxy.h:177
LC::Util
Definition
icoreproxy.h:34
LC::Util::EnableTransparency
void EnableTransparency(QQuickWidget &widget)
Definition
util.cpp:17
LC::Util::GetSysPath
QString GetSysPath(SysPath path, const QString &suffix, const QString &filename)
Returns path to the file in the given root path and subfolder.
Definition
paths.cpp:56
LC::Util::GetPathCandidates
QStringList GetPathCandidates(SysPath path, QString suffix)
Returns possible full paths for the path and subfolder.
Definition
paths.cpp:24
LC::Util::SysPath::QML
@ QML
Root path for QML files.
Definition
paths.h:32
paths.h
util.h
themeimageprovider.h
unhidelistmodel.h
unhidelistviewbase.h
unhoverdeletemixin.h
src
util
qml
unhidelistviewbase.cpp
Generated by
1.17.0