* @brief Implementation of the iStorage interface
* @author Enar Vaikene
*
- * Copyright (c) 2011-2012 Enar Vaikene
+ * Copyright (c) 2011-2019 Enar Vaikene
*
* This file is part of the eVaf C++ cross-platform application development framework.
*
# define __PSWGEN_STORAGE_MODULE_H
#include "istorage.h"
+#include "version.h"
#include <Plugins/iPlugin>
#include <QString>
#include <QAbstractListModel>
#include <QMap>
-#include <QtSql/QSqlDatabase>
+class QSqlDatabase;
namespace eVaf {
namespace PswGen {
{
Q_OBJECT
Q_INTERFACES(eVaf::Plugins::iPlugin)
+ Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
public:
QAbstractListModel methods
*/
- virtual int rowCount(QModelIndex const & parent) const { return mData.count(); }
+ virtual int rowCount(QModelIndex const &) const { return mData.count(); }
virtual QVariant data(QModelIndex const & index, int role = Qt::DisplayRole) const;
/// Name of the database file without path
static char const * const DbName;
- /// Database connection
- QSqlDatabase mDb;
-
/// List of name/data pairs
QMap<QString, QExplicitlySharedDataPointer<Storage::Data> > mData;
* Creates database tables if necessary
* @return True if ok; false if failed
*/
- bool createTables();
+ bool createTables(QSqlDatabase & db);
/**
* Upgrades database tables if necessary
* performs the upgrade without a loss of data if possible.
* Returns false if upgrade is not possible or fails.
*/
- bool upgradeTables();
+ bool upgradeTables(QSqlDatabase & db);
/**
* Loads data from the database
* @return True if ok; false if failed
*/
- bool loadData();
+ bool loadData(QSqlDatabase & db);
};