forked from alphaonex86/Ultracopier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ResourcesManager.h
54 lines (48 loc) · 2.08 KB
/
ResourcesManager.h
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
48
49
50
51
52
53
54
/** \file ResourcesManager.h
\brief Define the class to manage and load the resources linked with the themes
\author alpha_one_x86
\licence GPL3, see the file COPYING */
#ifndef RESOURCES_MANAGER_H
#define RESOURCES_MANAGER_H
#include <QStringList>
#include <QString>
#include <QObject>
#include <QRegularExpression>
#include "Environment.h"
/** \brief Define the class to manage and load the resources linked with the themes
This class provide a core load and manage the resources */
class ResourcesManager : public QObject
{
Q_OBJECT
public:
/// \brief Create the manager and load the default variable
ResourcesManager();
/// \brief Destroy the resource manager
~ResourcesManager();
static ResourcesManager *resourcesManager;
/** \brief Get folder presence and the path
\return Empty QString if not found */
QString getFolderReadPath(const QString &path) const;
/** \brief Get folder presence, the path and check in the folder and sub-folder the file presence
\return Empty QString if not found */
QString getFolderReadPathMultiple(const QString &path,const QStringList &fileToCheck) const;
bool checkFolderContent(const QString &path,const QStringList &fileToCheck) const;
/// \brief add / or \ in function of the platform at the end of path if both / and \ are not found
static QString AddSlashIfNeeded(const QString &path);
/// \brief get the writable path
QString getWritablePath() const;
/// \brief disable the writable path, if ultracopier is unable to write into
bool disableWritablePath();
/// \brief get the read path
QStringList getReadPath() const;
/// \brief remove folder
static bool removeFolder(const QString &dir);
private:
/// \brief List of the path to read only access
QStringList searchPath;
/// \brief The writable path, empty if not found
QString writablePath;
/// \brief match with slash end
static QRegularExpression slashEnd;
};
#endif // RESOURCES_MANAGER_H