UI fixes, VPN page fixes
This commit is contained in:
parent
25428c9165
commit
9dee7bb7e7
25 changed files with 251 additions and 157 deletions
BIN
client/images/animation.gif
Normal file
BIN
client/images/animation.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 MiB |
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB |
BIN
client/images/connected.png
Normal file
BIN
client/images/connected.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
client/images/disconnected.png
Normal file
BIN
client/images/disconnected.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
|
@ -16,8 +16,6 @@
|
|||
<file>images/tray/default.png</file>
|
||||
<file>images/tray/error.png</file>
|
||||
<file>images/arrow_left.png</file>
|
||||
<file>images/connect_button_connected.png</file>
|
||||
<file>images/connect_button_disconnected.png</file>
|
||||
<file>fonts/Lato-Black.ttf</file>
|
||||
<file>fonts/Lato-BlackItalic.ttf</file>
|
||||
<file>fonts/Lato-Bold.ttf</file>
|
||||
|
@ -140,5 +138,8 @@
|
|||
<file>server_scripts/ipsec/mobileconfig.plist</file>
|
||||
<file>ui/qml/Pages/Share/PageShareProtoIkev2.qml</file>
|
||||
<file>server_scripts/ipsec/strongswan.profile</file>
|
||||
<file>images/animation.gif</file>
|
||||
<file>images/connected.png</file>
|
||||
<file>images/disconnected.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -43,7 +43,7 @@ void ServerContainersLogic::onPushButtonProtoSettingsClicked(DockerContainer c,
|
|||
void ServerContainersLogic::onPushButtonDefaultClicked(DockerContainer c)
|
||||
{
|
||||
m_settings.setDefaultContainer(uiLogic()->selectedServerIndex, c);
|
||||
onUpdatePage();
|
||||
uiLogic()->onUpdateAllPages();
|
||||
}
|
||||
|
||||
void ServerContainersLogic::onPushButtonShareClicked(DockerContainer c)
|
||||
|
@ -64,7 +64,7 @@ void ServerContainersLogic::onPushButtonRemoveClicked(DockerContainer container)
|
|||
if (c.isEmpty()) m_settings.setDefaultContainer(uiLogic()->selectedServerIndex, DockerContainer::None);
|
||||
else m_settings.setDefaultContainer(uiLogic()->selectedServerIndex, c.keys().first());
|
||||
}
|
||||
onUpdatePage();
|
||||
uiLogic()->onUpdateAllPages();
|
||||
}
|
||||
|
||||
void ServerContainersLogic::onPushButtonContinueClicked(DockerContainer c, int port, TransportProto tp)
|
||||
|
@ -85,6 +85,6 @@ void ServerContainersLogic::onPushButtonContinueClicked(DockerContainer c, int p
|
|||
}
|
||||
}
|
||||
|
||||
onUpdatePage();
|
||||
uiLogic()->onUpdateAllPages();
|
||||
emit uiLogic()->closePage();
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ ServerListLogic::ServerListLogic(UiLogic *logic, QObject *parent):
|
|||
void ServerListLogic::onServerListPushbuttonDefaultClicked(int index)
|
||||
{
|
||||
m_settings.setDefaultServer(index);
|
||||
onUpdatePage();
|
||||
uiLogic()->onUpdateAllPages();
|
||||
}
|
||||
|
||||
void ServerListLogic::onServerListPushbuttonSettingsClicked(int index)
|
||||
|
|
|
@ -37,7 +37,7 @@ void ServerSettingsLogic::onUpdatePage()
|
|||
.arg(port));
|
||||
set_lineEditDescriptionText(server.value(config_key::description).toString());
|
||||
QString selectedContainerName = m_settings.defaultContainerName(uiLogic()->selectedServerIndex);
|
||||
set_labelCurrentVpnProtocolText(tr("Protocol: ") + selectedContainerName);
|
||||
set_labelCurrentVpnProtocolText(tr("Service: ") + selectedContainerName);
|
||||
}
|
||||
|
||||
void ServerSettingsLogic::onPushButtonClearServer()
|
||||
|
@ -90,8 +90,7 @@ void ServerSettingsLogic::onPushButtonForgetServer()
|
|||
|
||||
|
||||
uiLogic()->selectedServerIndex = -1;
|
||||
|
||||
uiLogic()->serverListLogic()->onUpdatePage();
|
||||
uiLogic()->onUpdateAllPages();
|
||||
|
||||
if (m_settings.serversCount() == 0) {
|
||||
uiLogic()->setStartPage(Page::Start);
|
||||
|
@ -121,7 +120,7 @@ void ServerSettingsLogic::onLineEditDescriptionEditingFinished()
|
|||
QJsonObject server = m_settings.server(uiLogic()->selectedServerIndex);
|
||||
server.insert(config_key::description, newText);
|
||||
m_settings.editServer(uiLogic()->selectedServerIndex, server);
|
||||
uiLogic()->serverListLogic()->onUpdatePage();
|
||||
uiLogic()->onUpdateAllPages();
|
||||
}
|
||||
|
||||
void ServerSettingsLogic::onPushButtonShareFullClicked()
|
||||
|
|
|
@ -43,6 +43,15 @@ void VpnLogic::onUpdatePage()
|
|||
set_radioButtonVpnModeForwardSitesChecked(mode == Settings::VpnOnlyForwardSites);
|
||||
set_radioButtonVpnModeExceptSitesChecked(mode == Settings::VpnAllExceptSites);
|
||||
set_pushButtonVpnAddSiteEnabled(mode != Settings::VpnAllSites);
|
||||
|
||||
const QJsonObject &server = uiLogic()->m_settings.defaultServer();
|
||||
QString serverString = QString("%2 (%3)")
|
||||
.arg(server.value(config_key::description).toString())
|
||||
.arg(server.value(config_key::hostName).toString());
|
||||
set_labelCurrentServer(serverString);
|
||||
|
||||
QString selectedContainerName = m_settings.defaultContainerName(m_settings.defaultServerIndex());
|
||||
set_labelCurrentService(selectedContainerName);
|
||||
}
|
||||
|
||||
|
||||
|
@ -79,6 +88,7 @@ void VpnLogic::onConnectionStateChanged(VpnProtocol::ConnectionState state)
|
|||
|
||||
bool pbConnectEnabled = false;
|
||||
bool rbModeEnabled = false;
|
||||
bool pbConnectVisible = false;
|
||||
set_labelStateText(VpnProtocol::textConnectionState(state));
|
||||
|
||||
uiLogic()->setTrayState(state);
|
||||
|
@ -88,39 +98,48 @@ void VpnLogic::onConnectionStateChanged(VpnProtocol::ConnectionState state)
|
|||
onBytesChanged(0,0);
|
||||
set_pushButtonConnectChecked(false);
|
||||
pbConnectEnabled = true;
|
||||
pbConnectVisible = true;
|
||||
rbModeEnabled = true;
|
||||
break;
|
||||
case VpnProtocol::Preparing:
|
||||
pbConnectEnabled = false;
|
||||
pbConnectVisible = false;
|
||||
rbModeEnabled = false;
|
||||
break;
|
||||
case VpnProtocol::Connecting:
|
||||
pbConnectEnabled = false;
|
||||
pbConnectVisible = false;
|
||||
rbModeEnabled = false;
|
||||
break;
|
||||
case VpnProtocol::Connected:
|
||||
pbConnectEnabled = true;
|
||||
pbConnectVisible = true;
|
||||
rbModeEnabled = false;
|
||||
break;
|
||||
case VpnProtocol::Disconnecting:
|
||||
pbConnectEnabled = false;
|
||||
pbConnectVisible = false;
|
||||
rbModeEnabled = false;
|
||||
break;
|
||||
case VpnProtocol::Reconnecting:
|
||||
pbConnectEnabled = true;
|
||||
pbConnectVisible = false;
|
||||
rbModeEnabled = false;
|
||||
break;
|
||||
case VpnProtocol::Error:
|
||||
set_pushButtonConnectEnabled(false);
|
||||
pbConnectEnabled = true;
|
||||
pbConnectVisible = true;
|
||||
rbModeEnabled = true;
|
||||
break;
|
||||
case VpnProtocol::Unknown:
|
||||
pbConnectEnabled = true;
|
||||
pbConnectVisible = true;
|
||||
rbModeEnabled = true;
|
||||
}
|
||||
|
||||
set_pushButtonConnectEnabled(pbConnectEnabled);
|
||||
set_pushButtonConnectVisible(pbConnectVisible);
|
||||
set_widgetVpnModeEnabled(rbModeEnabled);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,10 @@ class VpnLogic : public PageLogicBase
|
|||
AUTO_PROPERTY(QString, labelSpeedReceivedText)
|
||||
AUTO_PROPERTY(QString, labelSpeedSentText)
|
||||
AUTO_PROPERTY(QString, labelStateText)
|
||||
AUTO_PROPERTY(QString, labelCurrentServer)
|
||||
AUTO_PROPERTY(QString, labelCurrentService)
|
||||
AUTO_PROPERTY(bool, pushButtonConnectEnabled)
|
||||
AUTO_PROPERTY(bool, pushButtonConnectVisible)
|
||||
AUTO_PROPERTY(bool, widgetVpnModeEnabled)
|
||||
AUTO_PROPERTY(QString, labelErrorText)
|
||||
AUTO_PROPERTY(bool, pushButtonVpnAddSiteEnabled)
|
||||
|
|
|
@ -6,8 +6,6 @@ BasicButtonType {
|
|||
id: root
|
||||
width: parent.width - 80
|
||||
height: 40
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.topMargin: 20
|
||||
|
||||
background: Rectangle {
|
||||
anchors.fill: parent
|
||||
|
|
|
@ -20,7 +20,7 @@ Drawer {
|
|||
height: parent.height
|
||||
|
||||
modal: true
|
||||
interactive: true
|
||||
interactive: activeFocus
|
||||
|
||||
SortFilterProxyModel {
|
||||
id: proxyModel
|
||||
|
|
|
@ -30,6 +30,7 @@ PageBase {
|
|||
id: pushButtonWizard
|
||||
text: qsTr("Run Setup Wizard")
|
||||
anchors.top: labelWizard.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.topMargin: 10
|
||||
onClicked: {
|
||||
UiLogic.goToPage(PageEnum.Wizard);
|
||||
|
|
|
@ -110,22 +110,11 @@ PageBase {
|
|||
wrapMode: Text.Wrap
|
||||
text: desc
|
||||
}
|
||||
ImageButtonType {
|
||||
x: 212
|
||||
y: 25
|
||||
width: 32
|
||||
height: 24
|
||||
checkable: true
|
||||
iconMargin: 0
|
||||
icon.source: checked ? "qrc:/images/connect_button_connected.png"
|
||||
: "qrc:/images/connect_button_disconnected.png"
|
||||
visible: false
|
||||
}
|
||||
ImageButtonType {
|
||||
x: parent.width - 30
|
||||
y: 25
|
||||
width: 24
|
||||
height: 24
|
||||
y: 15
|
||||
width: 30
|
||||
height: 30
|
||||
checkable: true
|
||||
icon.source: checked ? "qrc:/images/check.png"
|
||||
: "qrc:/images/uncheck.png"
|
||||
|
@ -138,9 +127,9 @@ PageBase {
|
|||
ImageButtonType {
|
||||
id: pushButtonSetting
|
||||
x: parent.width - 60
|
||||
y: 25
|
||||
width: 24
|
||||
height: 24
|
||||
y: 15
|
||||
width: 30
|
||||
height: 30
|
||||
icon.source: "qrc:/images/settings.png"
|
||||
opacity: 0
|
||||
|
||||
|
|
|
@ -15,36 +15,30 @@ PageBase {
|
|||
BackButton {
|
||||
id: back
|
||||
}
|
||||
Text {
|
||||
font.family: "Lato"
|
||||
font.styleName: "normal"
|
||||
font.pixelSize: 16
|
||||
|
||||
Caption {
|
||||
id: caption
|
||||
text: SitesLogic.labelSitesAddCustomText
|
||||
}
|
||||
|
||||
LabelType {
|
||||
id: lb_addr
|
||||
color: "#333333"
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: qsTr("Web site/Hostname/IP address/Subnet")
|
||||
x: 20
|
||||
y: 110
|
||||
width: 311
|
||||
anchors.top: caption.bottom
|
||||
anchors.topMargin: 10
|
||||
width: parent.width
|
||||
height: 21
|
||||
}
|
||||
Text {
|
||||
font.family: "Lato"
|
||||
font.styleName: "normal"
|
||||
font.pixelSize: 20
|
||||
color: "#100A44"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignTop
|
||||
text: SitesLogic.labelSitesAddCustomText
|
||||
x: 20
|
||||
y: 40
|
||||
width: 340
|
||||
height: 60
|
||||
}
|
||||
|
||||
TextFieldType {
|
||||
x: 20
|
||||
y: 140
|
||||
width: 231
|
||||
anchors.top: lb_addr.bottom
|
||||
anchors.topMargin: 10
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 20
|
||||
anchors.right: sites_add.left
|
||||
anchors.rightMargin: 10
|
||||
height: 31
|
||||
placeholderText: qsTr("yousite.com or IP address")
|
||||
text: SitesLogic.lineEditSitesAddCustomText
|
||||
|
@ -55,10 +49,13 @@ PageBase {
|
|||
SitesLogic.onPushButtonAddCustomSitesClicked()
|
||||
}
|
||||
}
|
||||
|
||||
BlueButtonType {
|
||||
id: sites_add
|
||||
x: 260
|
||||
y: 140
|
||||
anchors.right: sites_import.left
|
||||
anchors.rightMargin: 10
|
||||
anchors.top: lb_addr.bottom
|
||||
anchors.topMargin: 10
|
||||
width: 51
|
||||
height: 31
|
||||
font.pixelSize: 24
|
||||
|
@ -67,23 +64,13 @@ PageBase {
|
|||
SitesLogic.onPushButtonAddCustomSitesClicked()
|
||||
}
|
||||
}
|
||||
BlueButtonType {
|
||||
id: sites_delete
|
||||
x: 80
|
||||
y: 589
|
||||
width: 231
|
||||
height: 31
|
||||
font.pixelSize: 16
|
||||
text: qsTr("Delete selected")
|
||||
onClicked: {
|
||||
SitesLogic.onPushButtonSitesDeleteClicked(tb.currentRow)
|
||||
}
|
||||
}
|
||||
|
||||
BasicButtonType {
|
||||
id: sites_import
|
||||
x: 320
|
||||
y: 140
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 20
|
||||
anchors.top: lb_addr.bottom
|
||||
anchors.topMargin: 10
|
||||
width: 51
|
||||
height: 31
|
||||
background: Rectangle {
|
||||
|
@ -116,12 +103,15 @@ PageBase {
|
|||
SitesLogic.onPushButtonSitesImportClicked(fileUrl)
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: tb
|
||||
x: 20
|
||||
y: 200
|
||||
width: 341
|
||||
height: 371
|
||||
anchors.top: sites_add.bottom
|
||||
anchors.topMargin: 10
|
||||
width: parent.width - 40
|
||||
anchors.bottom: sites_delete.top
|
||||
anchors.bottomMargin: 10
|
||||
spacing: 1
|
||||
clip: true
|
||||
property int currentRow: -1
|
||||
|
@ -187,4 +177,17 @@ PageBase {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
BlueButtonType {
|
||||
id: sites_delete
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 20
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
height: 31
|
||||
font.pixelSize: 16
|
||||
text: qsTr("Delete selected")
|
||||
onClicked: {
|
||||
SitesLogic.onPushButtonSitesDeleteClicked(tb.currentRow)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ PageBase {
|
|||
anchors.top: parent.top
|
||||
anchors.topMargin: 5
|
||||
|
||||
text: qsTr("Where to get connection data →")
|
||||
text: qsTr("How to get own server? →")
|
||||
background: Item {
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ PageBase {
|
|||
checkable: true
|
||||
checked: true
|
||||
onClicked: {
|
||||
Qt.openUrlExternally("https://amnezia.org")
|
||||
Qt.openUrlExternally("https://amnezia.org/instruction.html")
|
||||
}
|
||||
}
|
||||
LabelType {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.15
|
||||
import PageEnum 1.0
|
||||
import "./"
|
||||
import "../Controls"
|
||||
|
@ -11,12 +12,11 @@ PageBase {
|
|||
logic: VpnLogic
|
||||
|
||||
Image {
|
||||
id: bg_top
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
y: 0
|
||||
width: parent.width
|
||||
|
||||
// width: 380
|
||||
// height: 325
|
||||
height: parent.height * 0.28
|
||||
source: "qrc:/images/background_connected.png"
|
||||
}
|
||||
|
||||
|
@ -31,38 +31,26 @@ PageBase {
|
|||
}
|
||||
}
|
||||
|
||||
LabelType {
|
||||
id: error_text
|
||||
x: 0
|
||||
y: 280
|
||||
width: 381
|
||||
height: 61
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
wrapMode: Text.Wrap
|
||||
text: VpnLogic.labelErrorText
|
||||
}
|
||||
Text {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
y: 250
|
||||
width: 380
|
||||
height: 31
|
||||
font.family: "Lato"
|
||||
font.styleName: "normal"
|
||||
font.pixelSize: 15
|
||||
color: "#181922"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
wrapMode: Text.Wrap
|
||||
text: VpnLogic.labelStateText
|
||||
AnimatedImage {
|
||||
id: connect_anim
|
||||
source: "qrc:/images/animation.gif"
|
||||
anchors.top: bg_top.bottom
|
||||
anchors.topMargin: 10
|
||||
anchors.horizontalCenter: root.horizontalCenter
|
||||
width: Math.min(parent.width, parent.height) / 4
|
||||
height: width
|
||||
|
||||
visible: !VpnLogic.pushButtonConnectVisible
|
||||
paused: VpnLogic.pushButtonConnectVisible
|
||||
//VisibleBehavior on visible { }
|
||||
}
|
||||
|
||||
BasicButtonType {
|
||||
id: button_connect
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
y: 200
|
||||
width: 80
|
||||
height: 40
|
||||
anchors.horizontalCenter: connect_anim.horizontalCenter
|
||||
anchors.verticalCenter: connect_anim.verticalCenter
|
||||
width: connect_anim.width
|
||||
height: width
|
||||
checkable: true
|
||||
checked: VpnLogic.pushButtonConnectChecked
|
||||
onCheckedChanged: {
|
||||
|
@ -71,12 +59,96 @@ PageBase {
|
|||
}
|
||||
background: Image {
|
||||
anchors.fill: parent
|
||||
source: button_connect.checked ? "qrc:/images/connect_button_connected.png"
|
||||
: "qrc:/images/connect_button_disconnected.png"
|
||||
source: button_connect.checked ? "qrc:/images/connected.png"
|
||||
: "qrc:/images/disconnected.png"
|
||||
}
|
||||
contentItem: Item {}
|
||||
antialiasing: true
|
||||
enabled: VpnLogic.pushButtonConnectEnabled
|
||||
opacity: VpnLogic.pushButtonConnectVisible ? 1 : 0
|
||||
|
||||
// transitions: Transition {
|
||||
// NumberAnimation { properties: "opacity"; easing.type: Easing.InOutQuad; duration: 500 }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
LabelType {
|
||||
id: lb_state
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: button_connect.bottom
|
||||
width: parent.width
|
||||
height: 21
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: VpnLogic.labelStateText
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: layout1
|
||||
anchors.top: lb_state.bottom
|
||||
//anchors.topMargin: 5
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
height: 21
|
||||
|
||||
|
||||
LabelType {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
height: 21
|
||||
text: qsTr("Server") + ": "
|
||||
}
|
||||
|
||||
BasicButtonType {
|
||||
Layout.alignment: Qt.AlignLeft
|
||||
height: 21
|
||||
background: Item {}
|
||||
text: VpnLogic.labelCurrentServer
|
||||
font.family: "Lato"
|
||||
font.styleName: "normal"
|
||||
font.pixelSize: 16
|
||||
onClicked: {
|
||||
UiLogic.goToPage(PageEnum.ServersList)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: layout2
|
||||
anchors.top: layout1.bottom
|
||||
anchors.topMargin: 5
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
height: 21
|
||||
|
||||
|
||||
LabelType {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
height: 21
|
||||
text: qsTr("Service") + ": "
|
||||
}
|
||||
|
||||
BasicButtonType {
|
||||
Layout.alignment: Qt.AlignLeft
|
||||
height: 21
|
||||
background: Item {}
|
||||
text: VpnLogic.labelCurrentService
|
||||
font.family: "Lato"
|
||||
font.styleName: "normal"
|
||||
font.pixelSize: 16
|
||||
onClicked: {
|
||||
UiLogic.onGotoCurrentProtocolsPage()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LabelType {
|
||||
id: error_text
|
||||
anchors.top: layout2.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: parent.width
|
||||
height: 21
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.Wrap
|
||||
text: VpnLogic.labelErrorText
|
||||
}
|
||||
|
||||
Item {
|
||||
|
|
|
@ -36,8 +36,7 @@ PageShareProtocolBase {
|
|||
ColumnLayout {
|
||||
id: content
|
||||
enabled: logic.pageEnabled
|
||||
anchors.top: content.bottom
|
||||
anchors.topMargin: 20
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
|
|
|
@ -60,8 +60,7 @@ PageShareProtocolBase {
|
|||
ColumnLayout {
|
||||
id: content
|
||||
enabled: logic.pageEnabled
|
||||
anchors.top: content.bottom
|
||||
anchors.topMargin: 20
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
|
|
|
@ -36,8 +36,7 @@ PageShareProtocolBase {
|
|||
ColumnLayout {
|
||||
id: content
|
||||
enabled: logic.pageEnabled
|
||||
anchors.top: content.bottom
|
||||
anchors.topMargin: 20
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
|
|
|
@ -36,8 +36,7 @@ PageShareProtocolBase {
|
|||
ColumnLayout {
|
||||
id: content
|
||||
enabled: logic.pageEnabled
|
||||
anchors.top: content.bottom
|
||||
anchors.topMargin: 20
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
|
|
|
@ -36,8 +36,7 @@ PageShareProtocolBase {
|
|||
ColumnLayout {
|
||||
id: content
|
||||
enabled: logic.pageEnabled
|
||||
anchors.top: content.bottom
|
||||
anchors.topMargin: 20
|
||||
anchors.top: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
|
|
|
@ -105,6 +105,28 @@ UiLogic::UiLogic(QObject *parent) :
|
|||
|
||||
}
|
||||
|
||||
UiLogic::~UiLogic()
|
||||
{
|
||||
emit hide();
|
||||
|
||||
if (m_vpnConnection->connectionState() != VpnProtocol::ConnectionState::Disconnected) {
|
||||
m_vpnConnection->disconnectFromVpn();
|
||||
for (int i = 0; i < 50; i++) {
|
||||
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
QThread::msleep(100);
|
||||
if (m_vpnConnection->isDisconnected()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_vpnConnectionThread.quit();
|
||||
m_vpnConnectionThread.wait(3000);
|
||||
delete m_vpnConnection;
|
||||
|
||||
qDebug() << "Application closed";
|
||||
}
|
||||
|
||||
void UiLogic::initalizeUiLogic()
|
||||
{
|
||||
qDebug() << "UiLogic::initalizeUiLogic()";
|
||||
|
@ -210,19 +232,6 @@ void UiLogic::setTrayActionConnectEnabled(bool trayActionConnectEnabled)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QString UiLogic::getDialogConnectErrorText() const
|
||||
{
|
||||
return m_dialogConnectErrorText;
|
||||
|
@ -236,29 +245,6 @@ void UiLogic::setDialogConnectErrorText(const QString &dialogConnectErrorText)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
UiLogic::~UiLogic()
|
||||
{
|
||||
emit hide();
|
||||
|
||||
if (m_vpnConnection->connectionState() != VpnProtocol::ConnectionState::Disconnected) {
|
||||
m_vpnConnection->disconnectFromVpn();
|
||||
for (int i = 0; i < 50; i++) {
|
||||
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
QThread::msleep(100);
|
||||
if (m_vpnConnection->isDisconnected()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_vpnConnectionThread.quit();
|
||||
m_vpnConnectionThread.wait(3000);
|
||||
delete m_vpnConnection;
|
||||
|
||||
qDebug() << "Application closed";
|
||||
}
|
||||
|
||||
void UiLogic::showOnStartup()
|
||||
{
|
||||
if (! m_settings.isStartMinimized()) {
|
||||
|
@ -270,6 +256,26 @@ void UiLogic::showOnStartup()
|
|||
}
|
||||
}
|
||||
|
||||
void UiLogic::onUpdateAllPages()
|
||||
{
|
||||
for (PageLogicBase *logic : {
|
||||
(PageLogicBase *) m_appSettingsLogic,
|
||||
(PageLogicBase *) m_generalSettingsLogic,
|
||||
(PageLogicBase *) m_networkSettingsLogic,
|
||||
(PageLogicBase *) m_serverConfiguringProgressLogic,
|
||||
(PageLogicBase *) m_newServerProtocolsLogic,
|
||||
(PageLogicBase *) m_serverListLogic,
|
||||
(PageLogicBase *) m_serverSettingsLogic,
|
||||
(PageLogicBase *) m_serverVpnProtocolsLogic,
|
||||
(PageLogicBase *) m_shareConnectionLogic,
|
||||
(PageLogicBase *) m_sitesLogic,
|
||||
(PageLogicBase *) m_startPageLogic,
|
||||
(PageLogicBase *) m_vpnLogic,
|
||||
(PageLogicBase *) m_wizardLogic
|
||||
}) {
|
||||
logic->onUpdatePage();
|
||||
}
|
||||
}
|
||||
|
||||
void UiLogic::keyPressEvent(Qt::Key key)
|
||||
{
|
||||
|
@ -306,9 +312,7 @@ void UiLogic::keyPressEvent(Qt::Key key)
|
|||
emit goToPage(Page::ServerSettings);
|
||||
break;
|
||||
case Qt::Key_P:
|
||||
selectedServerIndex = m_settings.defaultServerIndex();
|
||||
selectedDockerContainer = m_settings.defaultContainer(selectedServerIndex);
|
||||
emit goToPage(Page::ServerContainers);
|
||||
onGotoCurrentProtocolsPage();
|
||||
break;
|
||||
case Qt::Key_T:
|
||||
SshConfigurator::openSshTerminal(m_settings.serverCredentials(m_settings.defaultServerIndex()));
|
||||
|
@ -351,6 +355,13 @@ QString UiLogic::containerDesc(int container)
|
|||
|
||||
}
|
||||
|
||||
void UiLogic::onGotoCurrentProtocolsPage()
|
||||
{
|
||||
selectedServerIndex = m_settings.defaultServerIndex();
|
||||
selectedDockerContainer = m_settings.defaultContainer(selectedServerIndex);
|
||||
emit goToPage(Page::ServerContainers);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//void UiLogic::showEvent(QShowEvent *event)
|
||||
|
|
|
@ -85,6 +85,7 @@ public:
|
|||
friend class OtherProtocolsLogic;
|
||||
|
||||
Q_INVOKABLE virtual void onUpdatePage() {} // UiLogic is set as logic class for some qml pages
|
||||
Q_INVOKABLE void onUpdateAllPages();
|
||||
|
||||
Q_INVOKABLE void initalizeUiLogic();
|
||||
Q_INVOKABLE void onCloseWindow();
|
||||
|
@ -96,6 +97,8 @@ public:
|
|||
Q_INVOKABLE void onGotoProtocolPage(Protocol p, bool reset = true, bool slide = true) { emit goToProtocolPage(p, reset, slide); }
|
||||
Q_INVOKABLE void onGotoShareProtocolPage(Protocol p, bool reset = true, bool slide = true) { emit goToShareProtocolPage(p, reset, slide); }
|
||||
|
||||
Q_INVOKABLE void onGotoCurrentProtocolsPage();
|
||||
|
||||
Q_INVOKABLE void keyPressEvent(Qt::Key key);
|
||||
|
||||
Q_INVOKABLE bool saveTextFile(const QString& desc, const QString& ext, const QString& data);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue