#ifndef CONTEXT_H #define CONTEXT_H #include #include #include #include #include #include #include #include "define.h" #include "core_global.h" #include "transaction.h" #include "data/core-data.h" #include #include class IPlugin; class CORESHARED_EXPORT Context { public: ~Context(); static Context &instance(); QList plugins(); IPlugin *plugin(const QString &pluginId); void loadPlugins(); void openDb(const QString &path); odb::database *db() { return m_db; } QSettings *settings() { return m_settings; } bool dbOpened() { return m_dbOpened; } void destroy(); QStringList defaultPerms(); QSharedPointer currentUser() const; void setCurrentUser(const QSharedPointer ¤tUser); private: Context(); QList m_plugins; odb::database *m_db; QSettings *m_settings; bool m_dbOpened; odb::session m_session; QSharedPointer m_currentUser; QStringList m_solved; void checkDb(const QString &path); void checkSchema(const QSqlDatabase &db, const QMap &schemaMap); void solveDep(IPlugin *plugin, const QSqlDatabase &db, const QMap &schemaMap); void createSchema(IPlugin *plugin, const QSqlDatabase &db, const QMap &schemaMap); void checkPermissions(); }; #endif // CONTEXT_H