#ifndef CONTEXT_H #define CONTEXT_H #include #include #include #include #include #include #include #include "define.h" #include "core_global.h" #include "data/core-data.h" 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); void* db() { return nullptr; } QSettings *settings() { return m_settings; } bool dbOpened() { return m_dbOpened; } void destroy(); QStringList defaultPerms(); QSharedPointer currentUser() const; void setCurrentUser(const QSharedPointer ¤tUser); //odb::session &session(); SeasonPtr currentSeason() const; void setCurrentSeason(const SeasonPtr ¤tSeason); void checkNumberSeries(); private: Context(); QList m_plugins; QSettings *m_settings; bool m_dbOpened; QSharedPointer m_currentUser; SeasonPtr m_currentSeason; 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(); void checkSeason(); }; #endif // CONTEXT_H