2020-09-20 20:33:16 +01:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2010 Volker Lanz <vl@fidra.de>
|
|
|
|
SPDX-FileCopyrightText: 2014-2018 Andrius Štikonas <andrius@stikonas.eu>
|
|
|
|
SPDX-FileCopyrightText: 2015 Teo Mrnjavac <teo@kde.org>
|
|
|
|
SPDX-FileCopyrightText: 2015 Chris Campbell <c.j.campbell@ed.ac.uk>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*/
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2018-03-31 13:05:34 +01:00
|
|
|
#ifndef KPMCORE_COREBACKENDMANAGER_H
|
2017-09-10 20:12:52 +01:00
|
|
|
#define KPMCORE_COREBACKENDMANAGER_H
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2016-05-06 22:36:24 +01:00
|
|
|
#include "util/libpartitionmanagerexport.h"
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2018-03-31 13:05:34 +01:00
|
|
|
#include <memory>
|
2018-03-21 17:01:40 +00:00
|
|
|
|
2017-10-01 21:57:03 +01:00
|
|
|
#include <QVector>
|
2015-06-04 01:29:22 +01:00
|
|
|
|
|
|
|
class QString;
|
|
|
|
class QStringList;
|
2017-10-01 21:57:03 +01:00
|
|
|
class KPluginMetaData;
|
2015-06-04 01:29:22 +01:00
|
|
|
class CoreBackend;
|
2018-03-31 13:05:34 +01:00
|
|
|
struct CoreBackendManagerPrivate;
|
2015-06-04 01:29:22 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The backend manager class.
|
|
|
|
*
|
|
|
|
* This is basically a singleton class to give the application access to the currently
|
|
|
|
* selected backend and also to manage the available backend plugins.
|
|
|
|
* @author Volker Lanz <vl@fidra.de>
|
|
|
|
*/
|
|
|
|
class LIBKPMCORE_EXPORT CoreBackendManager
|
|
|
|
{
|
2015-07-13 15:16:36 +01:00
|
|
|
CoreBackendManager();
|
2018-04-14 21:55:05 +01:00
|
|
|
~CoreBackendManager();
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2015-07-13 15:16:36 +01:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @return pointer to ourselves
|
|
|
|
*/
|
|
|
|
static CoreBackendManager* self();
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2015-07-13 15:16:36 +01:00
|
|
|
/**
|
|
|
|
* @return the name of the default backend plugin
|
|
|
|
*/
|
|
|
|
static QString defaultBackendName() {
|
2018-01-31 18:49:21 +00:00
|
|
|
return QStringLiteral("pmsfdiskbackendplugin");
|
2015-07-13 15:16:36 +01:00
|
|
|
}
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2015-07-13 15:16:36 +01:00
|
|
|
/**
|
|
|
|
* @return a list of available backend plugins
|
|
|
|
*/
|
2017-10-01 21:57:03 +01:00
|
|
|
QVector<KPluginMetaData> list() const;
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2015-07-13 15:16:36 +01:00
|
|
|
/**
|
|
|
|
* Loads the given backend plugin into the application.
|
|
|
|
* @param name the name of the plugin to load
|
|
|
|
* @return true on success
|
|
|
|
*/
|
|
|
|
bool load(const QString& name);
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2015-07-13 15:16:36 +01:00
|
|
|
/**
|
|
|
|
* Unload the current plugin.
|
|
|
|
*/
|
|
|
|
void unload();
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2015-07-13 15:16:36 +01:00
|
|
|
/**
|
|
|
|
* @return a pointer to the currently loaded backend
|
|
|
|
*/
|
2018-03-31 13:05:34 +01:00
|
|
|
CoreBackend* backend();
|
2015-06-04 01:29:22 +01:00
|
|
|
|
2015-07-13 15:16:36 +01:00
|
|
|
private:
|
2018-03-31 13:05:34 +01:00
|
|
|
std::unique_ptr<CoreBackendManagerPrivate> d;
|
2015-06-04 01:29:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|