aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/src-cpp/plugins-screensaver.h
blob: 08210147daa3a9e8e87848e3d2171c695b16fbcb (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//===========================================
//  Lumina-desktop source code
//  Copyright (c) 2017, Ken Moore
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
// This is a simple class for managing all the various desktop
//  screensaver plugins that could be available
//===========================================
//  NOTE:
//  This class has a heirarchy-based lookup system
//  USER plugins > SYSTEM plugins
//  XDG_DATA_HOME/lumina-desktop/screensavers >  XDG_DATA_DIRS/lumina-desktop/screensavers
//===========================================
#ifndef _LUMINA_DESKTOP_SCREENSAVER_PLUGINS_CLASS_H
#define _LUMINA_DESKTOP_SCREENSAVER_PLUGINS_CLASS_H

#include <QJsonObject>
#include <QString>
#include <QUrl>
#include <QObject>

class SSPlugin{
private:
	QString currentfile;
	QJsonObject data; //Hazardous to manually modify
  bool containsDefault(QString obj) { return data.value(obj).toObject().contains("default"); }

public:
	SSPlugin();
	~SSPlugin();

	void loadFile(QString path);
	bool isLoaded();
	bool isValid();
	QString translatedObject(QString obj);
	QUrl scriptURL();
};

class SSPluginSystem{
public:
	static SSPlugin findPlugin(QString name);
	static QList<SSPlugin> findAllPlugins(bool validonly = true);

};

#endif
bgstack15