LeechCraft  0.6.70-10870-g558588d6ec
Modular cross-platform feature rich live environment.
iquarkcomponentprovider.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  * Boost Software License - Version 1.0 - August 17th, 2003
6  *
7  * Permission is hereby granted, free of charge, to any person or organization
8  * obtaining a copy of the software and accompanying documentation covered by
9  * this license (the "Software") to use, reproduce, display, distribute,
10  * execute, and transmit the Software, and to prepare derivative works of the
11  * Software, and to permit third-parties to whom the Software is furnished to
12  * do so, all subject to the following:
13  *
14  * The copyright notices in the Software and this entire statement, including
15  * the above license grant, this restriction and the following disclaimer,
16  * must be included in all copies of the Software, in whole or in part, and
17  * all derivative works of the Software, unless such copies or derivative
18  * works are solely in the form of machine-executable object code generated by
19  * a source language processor.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
24  * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
25  * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  **********************************************************************/
29 
30 #pragma once
31 
32 #include <vector>
33 #include <utility>
34 #include <memory>
35 #include <QString>
36 #include <QUrl>
37 #include <QVariant>
38 #include <util/sys/paths.h>
39 
40 class QQuickImageProvider;
41 
42 namespace LeechCraft
43 {
72  {
73  public:
83  QUrl Url_;
84 
88 
91  std::vector<std::pair<QString, std::unique_ptr<QObject>>> ContextProps_;
92 
99 
107 
110  QuarkComponent () = default;
111 
119  QuarkComponent (QuarkComponent&& other) = default;
120 
129  QuarkComponent& operator= (QuarkComponent&& other) = default;
130 
146  QuarkComponent (const QString& subdir, const QString& filename)
147  : Url_ (Util::GetSysPathUrl (Util::SysPath::QML, subdir, filename))
148  {
149  }
150  };
151 
154  typedef std::shared_ptr<QuarkComponent> QuarkComponent_ptr;
155 
159 }
160 
163 class Q_DECL_EXPORT IQuarkComponentProvider
164 {
165 public:
169 
185  virtual LeechCraft::QuarkComponents_t GetComponents () const = 0;
186 };
187 
188 Q_DECLARE_INTERFACE (IQuarkComponentProvider, "org.Deviant.LeechCraft.IQuarkComponentProvider/1.0")
std::shared_ptr< QuarkComponent > QuarkComponent_ptr
A shared pointer to a quark.
QuarkComponent & operator=(QuarkComponent &&other)=default
Move-assigns this quark component from other.
Interface for plugins providing quark components.
QList< QPair< QString, QObject * > > DynamicProps_
Dynamic properties to be exposed to the engine.
SysPath
Describes various root paths recognized by GetSysPath().
Definition: paths.h:48
QUrl GetSysPathUrl(SysPath path, const QString &subfolder, const QString &filename)
Returns path to the file in the given root path and subfolder.
Definition: paths.cpp:92
QUrl Url_
URL of the main QML of this file.
std::vector< std::pair< QString, std::unique_ptr< QObject > > > ContextProps_
Context-depended properties to be exposed to the engine.
QList< QuarkComponent_ptr > QuarkComponents_t
A list of quarks pointers.
QuarkComponent()=default
Initializes a null quark component.
virtual ~IQuarkComponentProvider()
Virtual destructor.
QList< QPair< QString, QVariant > > StaticProps_
Statis properties to be exposed to the engine.
QuarkComponent(const QString &subdir, const QString &filename)
Initializes a quark component for the given file path.
QList< QPair< QString, QQuickImageProvider * > > ImageProviders_
The image providers to be exposed to the engine.
Describes a single quark.