From c687bb39efbcdef4250a2b04b33f15dbef6d688f Mon Sep 17 00:00:00 2001 From: Ngoc Diep Date: Mon, 9 Aug 2021 01:34:25 +0700 Subject: [PATCH] fix PageSites table error --- client/ui/qml/PageSites.qml | 70 ++++++++++++++++++++++++++----------- client/ui/qml/PageVPN.qml | 2 +- client/ui/qml/main.qml | 2 +- client/ui/uilogic.cpp | 2 +- client/ui/uilogic.h | 6 ++-- 5 files changed, 55 insertions(+), 27 deletions(-) diff --git a/client/ui/qml/PageSites.qml b/client/ui/qml/PageSites.qml index 55769f62..5f3c15f4 100644 --- a/client/ui/qml/PageSites.qml +++ b/client/ui/qml/PageSites.qml @@ -120,45 +120,73 @@ Item { UiLogic.onPushButtonSitesImportClicked(fileUrl) } } - TableView { + ListView { id: tb x: 20 y: 200 width: 341 height: 371 - rowSpacing: 1 + spacing: 1 clip: true property int currentRow: -1 - columnSpacing: 0 model: UiLogic.tableViewSitesModel delegate: Item { - implicitWidth: 170 + implicitWidth: 170 * 2 implicitHeight: 30 - Rectangle { - anchors.top: parent.top - width: parent.width - height: 1 - color: "lightgray" - visible: row !== tb.currentRow - } - Rectangle { - anchors.fill: parent - color: "#63B4FB" - visible: row === tb.currentRow + Item { + width: 170 + height: 30 + anchors.left: parent.left + id: c1 + Rectangle { + anchors.top: parent.top + width: parent.width + height: 1 + color: "lightgray" + visible: index !== tb.currentRow + } + Rectangle { + anchors.fill: parent + color: "#63B4FB" + visible: index === tb.currentRow + } + Text { + text: url_path + anchors.fill: parent + leftPadding: 10 + verticalAlignment: Text.AlignVCenter + } } + Item { + anchors.left: c1.right + width: 170 + height: 30 + Rectangle { + anchors.top: parent.top + width: parent.width + height: 1 + color: "lightgray" + visible: index !== tb.currentRow + } + Rectangle { + anchors.fill: parent + color: "#63B4FB" + visible: index === tb.currentRow - Text { - text: display - anchors.fill: parent - leftPadding: 10 - verticalAlignment: Text.AlignVCenter + } + Text { + text: ip + anchors.fill: parent + leftPadding: 10 + verticalAlignment: Text.AlignVCenter + } } MouseArea { anchors.fill: parent onClicked: { - tb.currentRow = row + tb.currentRow = index } } } diff --git a/client/ui/qml/PageVPN.qml b/client/ui/qml/PageVPN.qml index 72f1ea87..49d55c2e 100644 --- a/client/ui/qml/PageVPN.qml +++ b/client/ui/qml/PageVPN.qml @@ -70,7 +70,7 @@ Item { checked: UiLogic.pushButtonConnectChecked onCheckedChanged: { UiLogic.pushButtonConnectChecked = checked - UiLogic.onPushButtonConnectClicked() + UiLogic.onPushButtonConnectClicked(checked) } background: Image { anchors.fill: parent diff --git a/client/ui/qml/main.qml b/client/ui/qml/main.qml index 4ce7690b..0b39b621 100644 --- a/client/ui/qml/main.qml +++ b/client/ui/qml/main.qml @@ -15,7 +15,7 @@ Window { UiLogic.onCloseWindow() } - // flags: Qt.FramelessWindowHint + flags: Qt.FramelessWindowHint title: "AmneziaVPN" function getPageComponent(page) { switch (page) { diff --git a/client/ui/uilogic.cpp b/client/ui/uilogic.cpp index ce023930..eeda7277 100644 --- a/client/ui/uilogic.cpp +++ b/client/ui/uilogic.cpp @@ -171,7 +171,7 @@ UiLogic::UiLogic(QObject *parent) : m_pushButtonNewServerConnectEnabled{}, m_pushButtonNewServerConnectText{tr("Connect")}, m_dialogConnectErrorText{}, - m_pageServerSettingsEnabled{false}, + m_pageServerSettingsEnabled{true}, m_pushButtonServerSettingsClearText{tr("Clear server from Amnezia software")}, m_pageShareAmneziaVisible{true}, m_pageShareOpenvpnVisible{true}, diff --git a/client/ui/uilogic.h b/client/ui/uilogic.h index d3e4afa8..144eca3f 100644 --- a/client/ui/uilogic.h +++ b/client/ui/uilogic.h @@ -651,6 +651,9 @@ public: Q_INVOKABLE void onPushButtonForgetServer(); Q_INVOKABLE void onPushButtonServerSettingsClearClientCacheClicked(); Q_INVOKABLE void onLineEditServerSettingsDescriptionEditingFinished(); + Q_INVOKABLE void updateSitesPage(); + Q_INVOKABLE void updateServersListPage(); + Q_INVOKABLE void updateProtocolsPage(); signals: void frameWireguardSettingsVisibleChanged(); @@ -1094,9 +1097,6 @@ private: void setupSitesPageConnections(); void setupProtocolsPageConnections(); - void updateSitesPage(); - void updateServersListPage(); - void updateProtocolsPage(); void updateOpenVpnPage(const QJsonObject &openvpnConfig, DockerContainer container, bool haveAuthData); void updateShadowSocksPage(const QJsonObject &ssConfig, DockerContainer container, bool haveAuthData); void updateCloakPage(const QJsonObject &ckConfig, DockerContainer container, bool haveAuthData);