删除connInfoEditDialog相关文件
This commit is contained in:
parent
c35eba416d
commit
bb45a1a1ac
|
|
@ -1,48 +0,0 @@
|
|||
#ifndef CONNINFOEDITIALOG_H
|
||||
#define CONNINFOEDITIALOG_H
|
||||
|
||||
#include "global.h"
|
||||
#include <QDialog>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui {
|
||||
class ConnInfoEditDialog;
|
||||
}
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class MainWindow;
|
||||
class MaskLayer;
|
||||
class CustomBorderContainer;
|
||||
|
||||
class ConnInfoEditDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ConnInfoEditDialog(QWidget *parent = nullptr);
|
||||
~ConnInfoEditDialog();
|
||||
|
||||
void setMainWindow(MainWindow* w){m_pMainWindow = w;}
|
||||
void setErrorInfo(const QString&);
|
||||
void clearErrorInfo();
|
||||
void loadConnInfo(const QString&);
|
||||
|
||||
Q_INVOKABLE void showMask();
|
||||
Q_INVOKABLE void hideMask();
|
||||
|
||||
private:
|
||||
void initialize();
|
||||
|
||||
Ui::ConnInfoEditDialog *ui;
|
||||
MaskLayer* m_pMaskLayer;
|
||||
MainWindow* m_pMainWindow;
|
||||
CustomBorderContainer* m_customBorderContainer;
|
||||
QString m_connID;
|
||||
|
||||
public slots:
|
||||
void onBtnClicked_save();
|
||||
void onBtnClicked_cancle();
|
||||
void onComboxChanged_dbType(const QString&);
|
||||
};
|
||||
|
||||
#endif //CONNINFOEDITIALOG_H
|
||||
|
|
@ -1,128 +0,0 @@
|
|||
#include "connInfoEditDialog.h"
|
||||
#include "./ui_connInfoEditDialog.h"
|
||||
#include "maskLayer.h"
|
||||
#include "mainwindow.h"
|
||||
#include "settings.h"
|
||||
#include "customBorderContainer.h"
|
||||
|
||||
ConnInfoEditDialog::ConnInfoEditDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::ConnInfoEditDialog)
|
||||
, m_pMainWindow(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
if(QSysInfo::kernelType() == "linux")
|
||||
{
|
||||
//Linux下默认的Qt::Dialog即使有父窗口也无法按照子窗口的行为进行展示,并且最大、最小按钮不好关闭,因此需要去掉Dialog属性,随之而来的问题是,模态无法起作用
|
||||
setWindowFlags(windowFlags() & ~Qt::Dialog);
|
||||
setStyleSheet("QDialog{border: 1px solid rgb(205,205,205);border-radius:5px;background-color:rgb(245,245,245);}");
|
||||
|
||||
m_customBorderContainer = new CustomBorderContainer(this);
|
||||
m_customBorderContainer->setOperationOptions(CustomBorderContainer::Movable | CustomBorderContainer::Resizable);
|
||||
}
|
||||
|
||||
initialize();
|
||||
}
|
||||
|
||||
ConnInfoEditDialog::~ConnInfoEditDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ConnInfoEditDialog::initialize()
|
||||
{
|
||||
m_connID = "";
|
||||
m_pMaskLayer = new MaskLayer(this);
|
||||
|
||||
QIntValidator* validator = new QIntValidator(0, 9999, this);
|
||||
ui->lineEdit_port->setValidator(validator);
|
||||
ui->lineEdit_password->setEchoMode(QLineEdit::Password);
|
||||
|
||||
connect(ui->btnSave, &QPushButton::clicked, this, &ConnInfoEditDialog::onBtnClicked_save);
|
||||
connect(ui->btnCancle, &QPushButton::clicked, this, &ConnInfoEditDialog::onBtnClicked_cancle);
|
||||
connect(ui->comboBox_dbType, &QComboBox::currentTextChanged, this, &ConnInfoEditDialog::onComboxChanged_dbType);
|
||||
}
|
||||
|
||||
void ConnInfoEditDialog::setErrorInfo(const QString& info)
|
||||
{
|
||||
if(m_pMainWindow)
|
||||
m_pMainWindow->showMessageDialog(type_warning, QString::fromWCharArray(L"错误"),info);
|
||||
else
|
||||
ui->label_error->setText(info);
|
||||
}
|
||||
void ConnInfoEditDialog::clearErrorInfo()
|
||||
{
|
||||
if(m_pMainWindow)
|
||||
m_pMainWindow->hideMessageDialog();
|
||||
else
|
||||
ui->label_error->setText("");
|
||||
}
|
||||
|
||||
void ConnInfoEditDialog::showMask()
|
||||
{
|
||||
m_pMaskLayer->setGeometry(0, 0, this->width(), this->height());
|
||||
m_pMaskLayer->show();
|
||||
}
|
||||
void ConnInfoEditDialog::hideMask()
|
||||
{
|
||||
m_pMaskLayer->close();
|
||||
}
|
||||
|
||||
void ConnInfoEditDialog::loadConnInfo(const QString& connID)
|
||||
{
|
||||
DatabaseConfig config = Settings::instance().loadDatabaseConfig(connID);
|
||||
ui->lineEdit_connection->setText(config.strConnectionName);
|
||||
ui->lineEdit_hostName->setText(config.strHost);
|
||||
ui->lineEdit_port->setText(QString::number(config.nPort));
|
||||
ui->lineEdit_userName->setText(config.strUserName);
|
||||
ui->lineEdit_password->setText(config.strPassword);
|
||||
ui->lineEdit_dbName->setText(config.strDBName);
|
||||
if(config.strDBType == "QPSQL")
|
||||
ui->comboBox_dbType->setCurrentText("PostgreSQL");
|
||||
else if(config.strDBType == "QMYSQL")
|
||||
ui->comboBox_dbType->setCurrentText("MySQL");
|
||||
ui->plainTextEdit->setPlainText(config.strComment);
|
||||
|
||||
m_connID = connID;
|
||||
}
|
||||
|
||||
void ConnInfoEditDialog::onBtnClicked_save()
|
||||
{
|
||||
if(ui->lineEdit_connection->text() == "" || ui->lineEdit_hostName->text() == "" || ui->lineEdit_userName->text() == "" ||
|
||||
ui->lineEdit_password->text() == "" || ui->lineEdit_port->text() == "")
|
||||
{
|
||||
setErrorInfo(QString::fromWCharArray(L"除‘备注’外不能有其它信息为空"));
|
||||
return;
|
||||
}
|
||||
|
||||
DatabaseConfig config;
|
||||
config.strConnectionName = ui->lineEdit_connection->text();
|
||||
config.strHost = ui->lineEdit_hostName->text();
|
||||
config.nPort = ui->lineEdit_port->text().toInt();
|
||||
config.strUserName = ui->lineEdit_userName->text();
|
||||
config.strPassword = ui->lineEdit_password->text();
|
||||
config.strDBName = ui->lineEdit_dbName->text();
|
||||
if(ui->comboBox_dbType->currentText() == "PostgreSQL")
|
||||
config.strDBType = "QPSQL";
|
||||
else if(ui->comboBox_dbType->currentText() == "MySQL")
|
||||
config.strDBType = "QMYSQL";
|
||||
if(ui->plainTextEdit->toPlainText().isEmpty())
|
||||
config.strComment = QString::fromWCharArray(L"无");
|
||||
else
|
||||
config.strComment = ui->plainTextEdit->toPlainText();
|
||||
|
||||
Settings::instance().saveDatabaseConfig(config);
|
||||
}
|
||||
|
||||
void ConnInfoEditDialog::onBtnClicked_cancle()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
void ConnInfoEditDialog::onComboxChanged_dbType(const QString& text)
|
||||
{
|
||||
if(text == "PostgreSQL")
|
||||
ui->lineEdit_port->setText("5432");
|
||||
else if(text == "MySQL")
|
||||
ui->lineEdit_port->setText("3306");
|
||||
}
|
||||
|
|
@ -1,468 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ConnInfoEditDialog</class>
|
||||
<widget class="QDialog" name="ConnInfoEditDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>431</width>
|
||||
<height>422</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>会话编辑</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../resource/PowerModeler.qrc">
|
||||
<normaloff>:/img/images/icon_disconnect.png</normaloff>:/img/images/icon_disconnect.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="tabsClosable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="tabBarAutoHide">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="icon">
|
||||
<iconset resource="../resource/PowerModeler.qrc">
|
||||
<normaloff>:/img/images/icon_setting.png</normaloff>:/img/images/icon_setting.png</iconset>
|
||||
</attribute>
|
||||
<attribute name="title">
|
||||
<string>配置</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>18</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>18</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_connection">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>30</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_userName">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>91</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>91</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>用户名:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_port">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>91</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>91</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>端口号:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_hostName">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>30</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_password">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::EchoMode::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_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="QLineEdit" name="lineEdit_port">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>51</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>51</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>5432</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_error">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: rgb(255, 0, 0);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_dbComment">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>91</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>91</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>备注:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_hostName">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>106</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>106</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>主机名/IP地址:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_connection">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>91</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>91</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>链接名称:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_password">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>91</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>91</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>密码:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_userName">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>30</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_dbType">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>91</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>91</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>数据库类型:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBox_dbType">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>PostgreSQL</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resource/PowerModeler.qrc">
|
||||
<normaloff>:/img/images/icon_postgresql.png</normaloff>:/img/images/icon_postgresql.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>MySQL</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resource/PowerModeler.qrc">
|
||||
<normaloff>:/img/images/icon_mysql.png</normaloff>:/img/images/icon_mysql.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_dbName">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>91</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>91</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>数据库名称:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_dbName">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>30</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnSave">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>86</width>
|
||||
<height>31</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>86</width>
|
||||
<height>31</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>保存</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnCancle">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>86</width>
|
||||
<height>31</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>86</width>
|
||||
<height>31</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../resource/PowerModeler.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
Loading…
Reference in New Issue