2017-02-01 18:01:02 +01:00
|
|
|
|
#include "MasterController.h"
|
|
|
|
|
|
#include "connectionmanagerwindow.h"
|
|
|
|
|
|
#include "connectionlistmodel.h"
|
2017-02-06 21:41:45 +01:00
|
|
|
|
#include "MainWindow.h"
|
2017-02-12 08:13:38 +01:00
|
|
|
|
#include "ServerWindow.h"
|
2017-02-01 18:01:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MasterController::MasterController(QObject *parent) : QObject(parent)
|
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
MasterController::~MasterController()
|
|
|
|
|
|
{
|
|
|
|
|
|
delete m_connectionManagerWindow;
|
|
|
|
|
|
delete m_connectionListModel;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MasterController::init()
|
|
|
|
|
|
{
|
|
|
|
|
|
m_connectionListModel = new ConnectionListModel(this);
|
|
|
|
|
|
|
|
|
|
|
|
m_connectionManagerWindow = new ConnectionManagerWindow(this, nullptr);
|
|
|
|
|
|
m_connectionManagerWindow->show();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MasterController::showConnectionManager()
|
|
|
|
|
|
{
|
|
|
|
|
|
m_connectionManagerWindow->show();
|
|
|
|
|
|
}
|
2017-02-01 19:59:07 +01:00
|
|
|
|
|
2017-02-12 08:13:38 +01:00
|
|
|
|
void MasterController::openSqlWindowForConnection(int connection_index)
|
2017-02-01 19:59:07 +01:00
|
|
|
|
{
|
|
|
|
|
|
auto cc = m_connectionListModel->get(connection_index);
|
|
|
|
|
|
m_connectionListModel->save(connection_index);
|
|
|
|
|
|
if (cc.valid()) {
|
|
|
|
|
|
auto w = new MainWindow(this, nullptr);
|
|
|
|
|
|
w->setAttribute( Qt::WA_DeleteOnClose );
|
|
|
|
|
|
w->setConfig(cc.get());
|
|
|
|
|
|
w->show();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2017-02-12 08:13:38 +01:00
|
|
|
|
|
|
|
|
|
|
void MasterController::openServerWindowForConnection(int connection_index)
|
|
|
|
|
|
{
|
|
|
|
|
|
auto cc = m_connectionListModel->get(connection_index);
|
|
|
|
|
|
m_connectionListModel->save(connection_index);
|
|
|
|
|
|
if (cc.valid()) {
|
|
|
|
|
|
auto w = new ServerWindow(this, nullptr);
|
|
|
|
|
|
w->setAttribute( Qt::WA_DeleteOnClose );
|
|
|
|
|
|
//w->setConfig(cc.get());
|
|
|
|
|
|
w->show();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|