2017-02-01 18:01:02 +01:00
|
|
|
|
#ifndef MASTERCONTROLLER_H
|
|
|
|
|
|
#define MASTERCONTROLLER_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
2017-08-24 19:45:00 +02:00
|
|
|
|
#include <future>
|
2017-02-01 18:01:02 +01:00
|
|
|
|
#include <map>
|
|
|
|
|
|
|
2017-08-24 19:45:00 +02:00
|
|
|
|
|
2017-02-01 18:01:02 +01:00
|
|
|
|
class ConnectionConfig;
|
2017-02-26 19:29:50 +01:00
|
|
|
|
class ConnectionList;
|
2017-02-01 18:01:02 +01:00
|
|
|
|
class ConnectionListModel;
|
|
|
|
|
|
class ConnectionManagerWindow;
|
|
|
|
|
|
|
2017-02-01 19:59:07 +01:00
|
|
|
|
/** \brief Controller class responsible for all things global.
|
|
|
|
|
|
*/
|
2017-02-26 19:29:50 +01:00
|
|
|
|
class MasterController : public QObject {
|
2017-02-01 18:01:02 +01:00
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
public:
|
2018-11-04 11:26:20 +01:00
|
|
|
|
explicit MasterController(QObject *parent = nullptr);
|
2017-02-26 19:29:50 +01:00
|
|
|
|
MasterController(const MasterController&) = delete;
|
|
|
|
|
|
MasterController &operator=(const MasterController&) = delete;
|
2017-02-01 18:01:02 +01:00
|
|
|
|
~MasterController();
|
|
|
|
|
|
|
|
|
|
|
|
void init();
|
|
|
|
|
|
|
|
|
|
|
|
ConnectionListModel *getConnectionListModel()
|
|
|
|
|
|
{
|
|
|
|
|
|
return m_connectionListModel;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void showConnectionManager();
|
2018-11-04 11:26:20 +01:00
|
|
|
|
void openSqlWindowForConnection(size_t connection_index);
|
2017-02-12 08:13:38 +01:00
|
|
|
|
void openServerWindowForConnection(int connection_index);
|
2017-03-05 21:23:36 +01:00
|
|
|
|
void openBackupDlgForConnection(int connection_index);
|
2017-08-24 19:45:00 +02:00
|
|
|
|
|
2017-02-01 18:01:02 +01:00
|
|
|
|
signals:
|
|
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
2017-02-26 19:29:50 +01:00
|
|
|
|
ConnectionList *m_connectionList = nullptr;
|
2017-02-01 18:01:02 +01:00
|
|
|
|
ConnectionListModel *m_connectionListModel = nullptr;
|
|
|
|
|
|
ConnectionManagerWindow *m_connectionManagerWindow = nullptr;
|
2018-11-04 11:26:20 +01:00
|
|
|
|
|
|
|
|
|
|
/** Retrieves the connection password from the user (directly or through the psk db)
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
|
|
|
|
|
bool retrieveConnectionPassword(ConnectionConfig &cc);
|
|
|
|
|
|
|
|
|
|
|
|
bool getPasswordFromPskdb(const std::string &password_id, std::string &password);
|
|
|
|
|
|
|
|
|
|
|
|
bool storePasswordInPskdb(const std::string &password_id, const std::string password);
|
2017-02-01 18:01:02 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // MASTERCONTROLLER_H
|