Various ui fixes
This commit is contained in:
parent
d9630afafd
commit
64526c5232
6 changed files with 20 additions and 11 deletions
|
@ -29,6 +29,7 @@ void ServerContainersLogic::onUpdatePage()
|
||||||
ProtocolsModel *p_model = qobject_cast<ProtocolsModel *>(uiLogic()->protocolsModel());
|
ProtocolsModel *p_model = qobject_cast<ProtocolsModel *>(uiLogic()->protocolsModel());
|
||||||
p_model->setSelectedServerIndex(uiLogic()->selectedServerIndex);
|
p_model->setSelectedServerIndex(uiLogic()->selectedServerIndex);
|
||||||
|
|
||||||
|
set_isManagedServer(m_settings->haveAuthData(uiLogic()->selectedServerIndex));
|
||||||
emit updatePage();
|
emit updatePage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@ public:
|
||||||
Q_INVOKABLE void onPushButtonRemoveClicked(DockerContainer c);
|
Q_INVOKABLE void onPushButtonRemoveClicked(DockerContainer c);
|
||||||
Q_INVOKABLE void onPushButtonContinueClicked(DockerContainer c, int port, TransportProto tp);
|
Q_INVOKABLE void onPushButtonContinueClicked(DockerContainer c, int port, TransportProto tp);
|
||||||
|
|
||||||
|
AUTO_PROPERTY(bool, isManagedServer)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ServerContainersLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
explicit ServerContainersLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||||
~ServerContainersLogic() = default;
|
~ServerContainersLogic() = default;
|
||||||
|
|
|
@ -37,11 +37,17 @@ void ServerSettingsLogic::onUpdatePage()
|
||||||
set_pushButtonShareFullVisible(m_settings->haveAuthData(uiLogic()->selectedServerIndex));
|
set_pushButtonShareFullVisible(m_settings->haveAuthData(uiLogic()->selectedServerIndex));
|
||||||
const QJsonObject &server = m_settings->server(uiLogic()->selectedServerIndex);
|
const QJsonObject &server = m_settings->server(uiLogic()->selectedServerIndex);
|
||||||
const QString &port = server.value(config_key::port).toString();
|
const QString &port = server.value(config_key::port).toString();
|
||||||
set_labelServerText(QString("%1@%2%3%4")
|
|
||||||
.arg(server.value(config_key::userName).toString())
|
const QString &userName = server.value(config_key::userName).toString();
|
||||||
.arg(server.value(config_key::hostName).toString())
|
const QString &hostName = server.value(config_key::hostName).toString();
|
||||||
.arg(port.isEmpty() ? "" : ":")
|
QString name = QString("%1%2%3%4%5")
|
||||||
.arg(port));
|
.arg(userName)
|
||||||
|
.arg(userName.isEmpty() ? "" : "@")
|
||||||
|
.arg(hostName)
|
||||||
|
.arg(port.isEmpty() ? "" : ":")
|
||||||
|
.arg(port);
|
||||||
|
|
||||||
|
set_labelServerText(name);
|
||||||
set_lineEditDescriptionText(server.value(config_key::description).toString());
|
set_lineEditDescriptionText(server.value(config_key::description).toString());
|
||||||
|
|
||||||
DockerContainer selectedContainer = m_settings->defaultContainer(uiLogic()->selectedServerIndex);
|
DockerContainer selectedContainer = m_settings->defaultContainer(uiLogic()->selectedServerIndex);
|
||||||
|
|
|
@ -269,7 +269,7 @@ bool StartPageLogic::importConnectionFromOpenVpnConfig(const QString &config)
|
||||||
QJsonObject o;
|
QJsonObject o;
|
||||||
o[config_key::containers] = arr;
|
o[config_key::containers] = arr;
|
||||||
o[config_key::defaultContainer] = "amnezia-openvpn";
|
o[config_key::defaultContainer] = "amnezia-openvpn";
|
||||||
o[config_key::description] = QString("OpenVpn server");
|
o[config_key::description] = m_settings->nextAvailableServerName();
|
||||||
|
|
||||||
|
|
||||||
const static QRegularExpression dnsRegExp("dhcp-option DNS (\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b)");
|
const static QRegularExpression dnsRegExp("dhcp-option DNS (\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b)");
|
||||||
|
@ -316,7 +316,7 @@ bool StartPageLogic::importConnectionFromWireguardConfig(const QString &config)
|
||||||
QJsonObject o;
|
QJsonObject o;
|
||||||
o[config_key::containers] = arr;
|
o[config_key::containers] = arr;
|
||||||
o[config_key::defaultContainer] = "amnezia-wireguard";
|
o[config_key::defaultContainer] = "amnezia-wireguard";
|
||||||
o[config_key::description] = QString("Wireguard server");
|
o[config_key::description] = m_settings->nextAvailableServerName();
|
||||||
|
|
||||||
const static QRegularExpression dnsRegExp("DNS = (\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b).*(\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b)");
|
const static QRegularExpression dnsRegExp("DNS = (\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b).*(\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b)");
|
||||||
QRegularExpressionMatch dnsMatch = dnsRegExp.match(config);
|
QRegularExpressionMatch dnsMatch = dnsRegExp.match(config);
|
||||||
|
|
|
@ -289,7 +289,7 @@ PageBase {
|
||||||
|
|
||||||
ImageButtonType {
|
ImageButtonType {
|
||||||
id: button_remove
|
id: button_remove
|
||||||
visible: index === tb_c.currentIndex
|
visible: (index === tb_c.currentIndex) && ServerContainersLogic.isManagedServer
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
checkable: true
|
checkable: true
|
||||||
icon.source: "qrc:/images/delete.png"
|
icon.source: "qrc:/images/delete.png"
|
||||||
|
@ -316,7 +316,7 @@ PageBase {
|
||||||
|
|
||||||
ImageButtonType {
|
ImageButtonType {
|
||||||
id: button_share
|
id: button_share
|
||||||
visible: index === tb_c.currentIndex
|
visible: (index === tb_c.currentIndex) && ServerContainersLogic.isManagedServer
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
icon.source: "qrc:/images/share.png"
|
icon.source: "qrc:/images/share.png"
|
||||||
implicitWidth: 30
|
implicitWidth: 30
|
||||||
|
|
|
@ -93,14 +93,14 @@ PageBase {
|
||||||
id: label_address
|
id: label_address
|
||||||
x: 20
|
x: 20
|
||||||
y: 40
|
y: 40
|
||||||
width: 141
|
width: listWidget_servers.width - 100
|
||||||
height: 16
|
height: 16
|
||||||
text: address
|
text: address
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
x: 10
|
x: 10
|
||||||
y: 10
|
y: 10
|
||||||
width: 181
|
width: listWidget_servers.width - 100
|
||||||
height: 21
|
height: 21
|
||||||
font.family: "Lato"
|
font.family: "Lato"
|
||||||
font.styleName: "normal"
|
font.styleName: "normal"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue