fix PageSites table error

This commit is contained in:
Ngoc Diep 2021-08-09 01:34:25 +07:00
parent d1a3545912
commit c687bb39ef
5 changed files with 55 additions and 27 deletions

View file

@ -120,45 +120,73 @@ Item {
UiLogic.onPushButtonSitesImportClicked(fileUrl) UiLogic.onPushButtonSitesImportClicked(fileUrl)
} }
} }
TableView { ListView {
id: tb id: tb
x: 20 x: 20
y: 200 y: 200
width: 341 width: 341
height: 371 height: 371
rowSpacing: 1 spacing: 1
clip: true clip: true
property int currentRow: -1 property int currentRow: -1
columnSpacing: 0
model: UiLogic.tableViewSitesModel model: UiLogic.tableViewSitesModel
delegate: Item { delegate: Item {
implicitWidth: 170 implicitWidth: 170 * 2
implicitHeight: 30 implicitHeight: 30
Rectangle { Item {
anchors.top: parent.top width: 170
width: parent.width height: 30
height: 1 anchors.left: parent.left
color: "lightgray" id: c1
visible: row !== tb.currentRow Rectangle {
} anchors.top: parent.top
Rectangle { width: parent.width
anchors.fill: parent height: 1
color: "#63B4FB" color: "lightgray"
visible: row === tb.currentRow 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 Text {
anchors.fill: parent text: ip
leftPadding: 10 anchors.fill: parent
verticalAlignment: Text.AlignVCenter leftPadding: 10
verticalAlignment: Text.AlignVCenter
}
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
tb.currentRow = row tb.currentRow = index
} }
} }
} }

View file

@ -70,7 +70,7 @@ Item {
checked: UiLogic.pushButtonConnectChecked checked: UiLogic.pushButtonConnectChecked
onCheckedChanged: { onCheckedChanged: {
UiLogic.pushButtonConnectChecked = checked UiLogic.pushButtonConnectChecked = checked
UiLogic.onPushButtonConnectClicked() UiLogic.onPushButtonConnectClicked(checked)
} }
background: Image { background: Image {
anchors.fill: parent anchors.fill: parent

View file

@ -15,7 +15,7 @@ Window {
UiLogic.onCloseWindow() UiLogic.onCloseWindow()
} }
// flags: Qt.FramelessWindowHint flags: Qt.FramelessWindowHint
title: "AmneziaVPN" title: "AmneziaVPN"
function getPageComponent(page) { function getPageComponent(page) {
switch (page) { switch (page) {

View file

@ -171,7 +171,7 @@ UiLogic::UiLogic(QObject *parent) :
m_pushButtonNewServerConnectEnabled{}, m_pushButtonNewServerConnectEnabled{},
m_pushButtonNewServerConnectText{tr("Connect")}, m_pushButtonNewServerConnectText{tr("Connect")},
m_dialogConnectErrorText{}, m_dialogConnectErrorText{},
m_pageServerSettingsEnabled{false}, m_pageServerSettingsEnabled{true},
m_pushButtonServerSettingsClearText{tr("Clear server from Amnezia software")}, m_pushButtonServerSettingsClearText{tr("Clear server from Amnezia software")},
m_pageShareAmneziaVisible{true}, m_pageShareAmneziaVisible{true},
m_pageShareOpenvpnVisible{true}, m_pageShareOpenvpnVisible{true},

View file

@ -651,6 +651,9 @@ public:
Q_INVOKABLE void onPushButtonForgetServer(); Q_INVOKABLE void onPushButtonForgetServer();
Q_INVOKABLE void onPushButtonServerSettingsClearClientCacheClicked(); Q_INVOKABLE void onPushButtonServerSettingsClearClientCacheClicked();
Q_INVOKABLE void onLineEditServerSettingsDescriptionEditingFinished(); Q_INVOKABLE void onLineEditServerSettingsDescriptionEditingFinished();
Q_INVOKABLE void updateSitesPage();
Q_INVOKABLE void updateServersListPage();
Q_INVOKABLE void updateProtocolsPage();
signals: signals:
void frameWireguardSettingsVisibleChanged(); void frameWireguardSettingsVisibleChanged();
@ -1094,9 +1097,6 @@ private:
void setupSitesPageConnections(); void setupSitesPageConnections();
void setupProtocolsPageConnections(); void setupProtocolsPageConnections();
void updateSitesPage();
void updateServersListPage();
void updateProtocolsPage();
void updateOpenVpnPage(const QJsonObject &openvpnConfig, DockerContainer container, bool haveAuthData); void updateOpenVpnPage(const QJsonObject &openvpnConfig, DockerContainer container, bool haveAuthData);
void updateShadowSocksPage(const QJsonObject &ssConfig, DockerContainer container, bool haveAuthData); void updateShadowSocksPage(const QJsonObject &ssConfig, DockerContainer container, bool haveAuthData);
void updateCloakPage(const QJsonObject &ckConfig, DockerContainer container, bool haveAuthData); void updateCloakPage(const QJsonObject &ckConfig, DockerContainer container, bool haveAuthData);