Cleanup old seperate server window.
This commit is contained in:
parent
f0e5488ce0
commit
60bbb4c445
9 changed files with 7 additions and 287 deletions
|
|
@ -4,7 +4,6 @@
|
|||
#include "ConnectionListModel.h"
|
||||
#include "PasswordManager.h"
|
||||
#include "DatabaseWindow.h"
|
||||
#include "ServerWindow.h"
|
||||
#include "BackupDialog.h"
|
||||
#include "PasswordPromptDialog.h"
|
||||
#include "ConnectionConfigurationWidget.h"
|
||||
|
|
@ -72,7 +71,7 @@ void ConnectionController::openBackupDlgForConnection(QModelIndex index)
|
|||
if (config) {
|
||||
if (retrieveConnectionPassword(*config)) {
|
||||
m_connectionTreeModel->save(*config);
|
||||
auto w = new BackupDialog(nullptr); //new ServerWindow(this, nullptr);
|
||||
auto w = new BackupDialog(nullptr);
|
||||
w->setAttribute( Qt::WA_DeleteOnClose );
|
||||
w->setConfig(*config);
|
||||
w->show();
|
||||
|
|
@ -138,20 +137,6 @@ std::shared_ptr<PasswordManager> ConnectionController::passwordManager()
|
|||
return m_passwordManager;
|
||||
}
|
||||
|
||||
void ConnectionController::openServerWindowForConnection(QModelIndex index)
|
||||
{
|
||||
auto config = ConnectionTreeModel::getConfigFromModelIndex(index);
|
||||
if (config) {
|
||||
if (retrieveConnectionPassword(*config)) {
|
||||
m_connectionTreeModel->save(*config);
|
||||
auto w = new ServerWindow(m_masterController, nullptr);
|
||||
w->setAttribute( Qt::WA_DeleteOnClose );
|
||||
w->setConfig(*config);
|
||||
w->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ConnectionController::retrieveConnectionPassword(ConnectionConfig &cc)
|
||||
{
|
||||
auto enc_pwd = cc.encodedPassword();
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ public:
|
|||
|
||||
void showConnectionManager();
|
||||
void openSqlWindowForConnection(QModelIndex index);
|
||||
void openServerWindowForConnection(QModelIndex index);
|
||||
void openBackupDlgForConnection(QModelIndex index);
|
||||
|
||||
/// Starts the form for creating a new conncetion.
|
||||
|
|
|
|||
|
|
@ -73,12 +73,6 @@ void ConnectionManagerWindow::on_actionBackup_database_triggered()
|
|||
m_connectionController->openBackupDlgForConnection(ci);
|
||||
}
|
||||
|
||||
void ConnectionManagerWindow::on_actionManage_server_triggered()
|
||||
{
|
||||
auto ci = ui->treeView->selectionModel()->currentIndex();
|
||||
m_connectionController->openServerWindowForConnection(ci);
|
||||
}
|
||||
|
||||
void ConnectionManagerWindow::connectionActivated(const QModelIndex &index)
|
||||
{
|
||||
if (index.isValid()) {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ private slots:
|
|||
void on_actionConnect_triggered();
|
||||
void on_actionQuit_application_triggered();
|
||||
void on_actionBackup_database_triggered();
|
||||
void on_actionManage_server_triggered();
|
||||
|
||||
void connectionActivated(const QModelIndex &index);
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ QToolButton {
|
|||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="actionConnect"/>
|
||||
<addaction name="actionManage_server"/>
|
||||
<addaction name="actionBackup_database"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionAdd_group"/>
|
||||
|
|
@ -80,7 +79,7 @@ QToolButton {
|
|||
</widget>
|
||||
<action name="actionAdd_Connection">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/icons/add_connection.png</normaloff>:/icons/add_connection.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
|
|
@ -89,7 +88,7 @@ QToolButton {
|
|||
</action>
|
||||
<action name="actionDelete_connection">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/icons/delete_connection.png</normaloff>
|
||||
<normalon>:/icons/delete_connection.png</normalon>:/icons/delete_connection.png</iconset>
|
||||
</property>
|
||||
|
|
@ -117,7 +116,7 @@ QToolButton {
|
|||
</action>
|
||||
<action name="actionBackup_database">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/icons/backup_database.png</normaloff>
|
||||
<normalon>:/icons/backups.png</normalon>:/icons/backup_database.png</iconset>
|
||||
</property>
|
||||
|
|
@ -125,16 +124,6 @@ QToolButton {
|
|||
<string>Backup database</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionManage_server">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/manage_server.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Manage server</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionConfigure_connection">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
|
|
@ -176,6 +165,8 @@ QToolButton {
|
|||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
|||
|
|
@ -1,55 +0,0 @@
|
|||
#include "ServerWindow.h"
|
||||
#include "ui_ServerWindow.h"
|
||||
#include "OpenDatabase.h"
|
||||
#include "DatabasesTableModel.h"
|
||||
#include "RolesTableModel.h"
|
||||
#include "catalog/PgDatabaseCatalog.h"
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QDebug>
|
||||
|
||||
ServerWindow::ServerWindow(MasterController *master, QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::ServerWindow)
|
||||
, m_masterController(master)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
m_databasesModel = new DatabasesTableModel(this);
|
||||
auto databasesSortFilter = new QSortFilterProxyModel(this);
|
||||
databasesSortFilter->setSourceModel(m_databasesModel);
|
||||
ui->databasesTableView->setModel(databasesSortFilter);
|
||||
ui->databasesTableView->setSortingEnabled(true);
|
||||
|
||||
m_rolesModel = new RolesTableModel(this);
|
||||
auto rolesSortFilter = new QSortFilterProxyModel(this);
|
||||
rolesSortFilter->setSourceModel(m_rolesModel);
|
||||
ui->rolesTableView->setModel(rolesSortFilter);
|
||||
ui->rolesTableView->setSortingEnabled(true);
|
||||
}
|
||||
|
||||
ServerWindow::~ServerWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ServerWindow::setConfig(const ConnectionConfig &config)
|
||||
{
|
||||
m_config = config;
|
||||
try {
|
||||
m_database = OpenDatabase::createOpenDatabase(config);
|
||||
auto cat = m_database->catalog();
|
||||
if (cat) {
|
||||
m_databasesModel->setDatabaseList(cat);
|
||||
ui->databasesTableView->resizeColumnsToContents();
|
||||
|
||||
m_rolesModel->setRoleList(cat->authIds());
|
||||
ui->rolesTableView->resizeColumnsToContents();
|
||||
}
|
||||
}
|
||||
catch (const OpenDatabaseException &ex) {
|
||||
qWarning() << ex.text();
|
||||
}
|
||||
QString title = "pglab - ";
|
||||
title += m_config.name();
|
||||
setWindowTitle(title);
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
#ifndef SERVERWINDOW_H
|
||||
#define SERVERWINDOW_H
|
||||
|
||||
#include "ConnectionConfig.h"
|
||||
#include <QMainWindow>
|
||||
#include <memory>
|
||||
|
||||
namespace Ui {
|
||||
class ServerWindow;
|
||||
}
|
||||
|
||||
class MasterController;
|
||||
class OpenDatabase;
|
||||
class DatabasesTableModel;
|
||||
class RolesTableModel;
|
||||
|
||||
class ServerWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ServerWindow(MasterController *master, QWidget *parent );
|
||||
~ServerWindow();
|
||||
|
||||
void setConfig(const ConnectionConfig &config);
|
||||
private:
|
||||
Ui::ServerWindow *ui;
|
||||
|
||||
MasterController *m_masterController = nullptr;
|
||||
ConnectionConfig m_config;
|
||||
std::shared_ptr<OpenDatabase> m_database;
|
||||
DatabasesTableModel *m_databasesModel = nullptr;
|
||||
RolesTableModel *m_rolesModel = nullptr;
|
||||
};
|
||||
|
||||
#endif // SERVERWINDOW_H
|
||||
|
|
@ -1,156 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ServerWindow</class>
|
||||
<widget class="QMainWindow" name="ServerWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="databasesTab">
|
||||
<attribute name="title">
|
||||
<string>Databases</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="PgLabTableView" name="databasesTableView">
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="verticalHeaderMinimumSectionSize">
|
||||
<number>16</number>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderDefaultSectionSize">
|
||||
<number>20</number>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tablespacesTab">
|
||||
<attribute name="title">
|
||||
<string>Tablespaces</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTableView" name="tablespacesTableView">
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="verticalHeaderMinimumSectionSize">
|
||||
<number>16</number>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderDefaultSectionSize">
|
||||
<number>20</number>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="rolesTab">
|
||||
<attribute name="title">
|
||||
<string>Roles/users</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="PgLabTableView" name="rolesTableView">
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="verticalHeaderMinimumSectionSize">
|
||||
<number>16</number>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderDefaultSectionSize">
|
||||
<number>20</number>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>PgLabTableView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>PgLabTableView.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
@ -46,7 +46,6 @@ SOURCES += main.cpp\
|
|||
ParamTypeDelegate.cpp \
|
||||
OpenDatabase.cpp \
|
||||
SqlSyntaxHighlighter.cpp \
|
||||
ServerWindow.cpp \
|
||||
DatabasesTableModel.cpp \
|
||||
RolesTableModel.cpp \
|
||||
ProcessStdioWidget.cpp \
|
||||
|
|
@ -121,7 +120,6 @@ HEADERS += \
|
|||
ParamTypeDelegate.h \
|
||||
OpenDatabase.h \
|
||||
SqlSyntaxHighlighter.h \
|
||||
ServerWindow.h \
|
||||
DatabasesTableModel.h \
|
||||
RolesTableModel.h \
|
||||
ProcessStdioWidget.h \
|
||||
|
|
@ -176,7 +174,6 @@ FORMS += \
|
|||
CreateDatabaseDialog.ui \
|
||||
TuplesResultWidget.ui \
|
||||
QueryTab.ui \
|
||||
ServerWindow.ui \
|
||||
ProcessStdioWidget.ui \
|
||||
NamespaceFilterWidget.ui \
|
||||
CrudTab.ui \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue