summaryrefslogtreecommitdiff
path: root/src/plugins/pluginloader.h
blob: 23c884b1df9a1250616fdcb4d941ec7e99bccad5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* ============================================================
 *     The rekonq project
 * ============================================================
 * SPDX-License-Identifier: GPL-3.0-only
 * Copyright (C) 2022 aqua <aqua@iserlohn-fortress.net>
 * ============================================================
 * Description: rekonq plugin loader
 * ============================================================ */

#pragma once

#include "rplugininterface.hpp"
#include <QPluginLoader>

class PluginLoader : public QPluginLoader {

public:
  explicit PluginLoader(const QString &path, QObject *parent = nullptr);
  ~PluginLoader() override = default;

  [[nodiscard]] auto schemes() const { return m_schemes; }
  [[nodiscard]] bool hasScheme(const QString &scheme) const { return m_schemes.contains(scheme); }

  [[nodiscard]] RekonqPluginInterface *interface() { return qobject_cast<RekonqPluginInterface *>(instance()); }

private:
  QStringList m_schemes;
};