2017-12-09 20:21:22 +01:00
|
|
|
|
#ifndef OPENDATABASE_H
|
2017-02-01 18:01:02 +01:00
|
|
|
|
#define OPENDATABASE_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
2017-08-23 13:27:23 +02:00
|
|
|
|
#include "ConnectionConfig.h"
|
|
|
|
|
|
#include "Expected.h"
|
2017-12-09 20:21:22 +01:00
|
|
|
|
#include <memory>
|
2017-02-01 18:01:02 +01:00
|
|
|
|
|
2017-08-26 11:44:40 +02:00
|
|
|
|
class PgDatabaseCatalogue;
|
2017-02-04 11:55:49 +01:00
|
|
|
|
class TypeSelectionItemModel;
|
2017-02-01 18:01:02 +01:00
|
|
|
|
|
2017-02-01 20:00:03 +01:00
|
|
|
|
/** Instances of this class represent a single database on which atleast one
|
|
|
|
|
|
* window is opened. This class is used to track details about that database.
|
|
|
|
|
|
*/
|
2017-02-01 18:01:02 +01:00
|
|
|
|
class OpenDatabase : public QObject
|
|
|
|
|
|
{
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
public:
|
|
|
|
|
|
static Expected<OpenDatabase*> createOpenDatabase(const ConnectionConfig &cfg);
|
|
|
|
|
|
|
|
|
|
|
|
OpenDatabase(const OpenDatabase &) = delete;
|
|
|
|
|
|
OpenDatabase& operator=(const OpenDatabase &) = delete;
|
|
|
|
|
|
~OpenDatabase();
|
|
|
|
|
|
|
2017-12-09 20:21:22 +01:00
|
|
|
|
std::shared_ptr<PgDatabaseCatalogue> catalogue();
|
2017-02-07 21:39:45 +01:00
|
|
|
|
TypeSelectionItemModel* typeSelectionModel();
|
2017-02-01 18:01:02 +01:00
|
|
|
|
signals:
|
|
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
ConnectionConfig m_config;
|
2017-12-09 20:21:22 +01:00
|
|
|
|
std::shared_ptr<PgDatabaseCatalogue> m_catalogue;
|
2017-02-01 18:01:02 +01:00
|
|
|
|
|
2017-02-04 11:55:49 +01:00
|
|
|
|
TypeSelectionItemModel *m_typeSelectionModel = nullptr;
|
|
|
|
|
|
|
2017-02-01 18:01:02 +01:00
|
|
|
|
OpenDatabase(const ConnectionConfig& cfg, QObject *parent = 0);
|
|
|
|
|
|
bool Init();
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // OPENDATABASE_H
|