1 #ifndef EXTRALICENSEMANAGER_H
2 #define EXTRALICENSEMANAGER_H
3 
4 #include "coreSQLiteStudio_global.h"
5 #include <QString>
6 #include <QHash>
7 
8 class API_EXPORT ExtraLicenseManager
9 {
10     public:
11         enum class Type
12         {
13             FILE,
14             CONTENTS
15         };
16 
17         struct License
18         {
19             QString title;
20             QString data;
21             Type type;
22             QString violationMessage;
23             bool violated = false;
24         };
25 
26         ExtraLicenseManager();
27         virtual ~ExtraLicenseManager();
28 
29         bool addLicense(const QString& title, const QString& filePath);
30         bool addLicenseContents(const QString& title, const QString& contents);
31         void setViolatedLicense(const QString& title, const QString& violationMessage);
32         void unsetViolatedLicense(const QString& title);
33         bool isViolatedLicense(const QString& title);
34         QString getViolationMessage(const QString& title);
35         bool removeLicense(const QString& title);
36         QHash<QString,QString> getLicensesContents() const;
37 
38     private:
39         bool addLicense(const QString& title, const QString& data, Type type);
40         QString readLicenseFile(const QString& path) const;
41 
42         QHash<QString,License*> licenses;
43 };
44 
45 #endif // EXTRALISENCEMANAGER_H
46