mirror of
https://github.com/YACReader/yacreader
synced 2025-07-18 21:14:33 -04:00
Log libraries validation when YACReaderLibrary and YACReaderLibraryServer start
This commit is contained in:
@ -29,6 +29,27 @@ private:
|
||||
void run() override;
|
||||
};
|
||||
|
||||
struct DatabaseAccess {
|
||||
bool libraryExists;
|
||||
bool canRead; // db read
|
||||
bool canWrite; // db write
|
||||
bool canWriteToFolder; // disk write
|
||||
|
||||
operator QString() const
|
||||
{
|
||||
if (libraryExists && canRead && canWrite && canWriteToFolder) {
|
||||
return "OK";
|
||||
} else if (!libraryExists) {
|
||||
return "WARNING! Library does not exist on disk";
|
||||
} else {
|
||||
return QString("WARNING! DB read access: %1, DB write access: %2, can write to disk: %3")
|
||||
.arg(canRead ? "YES" : "NO")
|
||||
.arg(canWrite ? "YES" : "NO")
|
||||
.arg(canWriteToFolder ? "YES" : "NO");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class DataBaseManagement : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -58,6 +79,8 @@ public:
|
||||
static QString checkValidDB(const QString &fullPath); // retorna "" si la DB es inválida ó la versión si es válida.
|
||||
static int compareVersions(const QString &v1, const QString v2); // retorna <0 si v1 < v2, 0 si v1 = v2 y >0 si v1 > v2
|
||||
static bool updateToCurrentVersion(const QString &libraryPath);
|
||||
|
||||
static DatabaseAccess getDatabaseAccess(const QString &libraryPath);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user